///
///
///
///
class CombatUnit extends ContentUnit {
private actor : ContentDifferential = new ContentDifferential(Person);
private target : ContentDifferential = new ContentDifferential(Person);
private weapon : ContentDifferential = new ContentDifferential();
private markers : ContentDifferential = new ContentDifferential();
public constructor () {
super();
}
public setActor (it : Thing | typeof Thing) {
this.actor = new ContentDifferential(it);
return this;
}
public getActor () {
return this.actor;
}
public setTarget (it : Thing | typeof Thing) {
this.target = new ContentDifferential(it);
return this;
}
public getTarget () {
return this.target;
}
public setWeapon (...it : Array) {
this.weapon = new ContentDifferential(...it);
return this;
}
public getWeapons () {
return [...this.weapon.nouns];
}
public addMarker (...marker : Array) {
this.markers.addNoun(...marker);
return this;
}
public getMarkers () {
return [...this.markers.nouns];
}
public getScore () {
return this.actor.getScore() + this.target.getScore() + this.weapon.getScore() + this.markers.getScore();
}
public isMatch (cu : CombatUnit) {
if (cu instanceof CombatUnit) {
return this.actor.isMatch(cu.actor) && this.target.isMatch(cu.target) &&
this.weapon.isMatch(cu.weapon) && this.markers.isMatch(cu.markers);
}
return false;
}
}