///
///
///
///
class CombatUnit extends ContentUnit {
private actor : ContentDifferential = new ContentDifferential(Person);
private target : ContentDifferential = new ContentDifferential(Person);
private weapon : ContentDifferential = new ContentDifferential(Thing);
private markers : ContentDifferential = new ContentDifferential();
public constructor () {
super();
}
public setActor (it : Thing | typeof Thing) {
this.actor = new ContentDifferential(it);
return this;
}
public setTarget (it : Thing | typeof Thing) {
this.target = new ContentDifferential(it);
return this;
}
public setWeapon (it : Thing | typeof Thing) {
this.weapon = new ContentDifferential(it);
return this;
}
public addMarker (marker : ContentMarker) {
this.markers.addNoun(marker);
return this;
}
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;
}
}