///
///
/**
* This atom should be used in place of the default atom when handling Combat.
*/
class ContentAtomCombat extends ContentAtom {
/**
* Only one of the following markers appears at once.
*/
public static HIT = new ContentNounSimple("HIT");
public static MISS = new ContentNounSimple("MISS");
public static CRITICAL = new ContentNounSimple("CRITICAL");
/**
* Only one of the following markers appears at once.
*/
public static KNOCKED = new ContentNounSimple("KNOCKED");
public static KNOCKED_OFF = new ContentNounSimple("KNOCKED_OFF");
public static KILLED = new ContentNounSimple("KILLED");
public attacker : any;
public target : any;
public weapons : ContentAtom = new ContentAtom();
public markers : ContentAtom = new ContentAtom();
constructor (attacker : any, target : any, weapons : Array = [], markers : Array = []) {
super();
this.attacker = attacker;
this.target = target;
this.weapons.addNoun(...weapons);
this.markers.addNoun(...markers);
}
public compareAgainst (other : ContentAtom) {
if (other instanceof ContentAtomCombat) {
console.warn(
ContentAtom.compareNoun(this.attacker, other.attacker) &&
ContentAtom.compareNoun(this.target, other.target) &&
this.weapons.compareAgainst(other.weapons) &&
this.markers.compareAgainst(other.markers),
);
return (
ContentAtom.compareNoun(this.attacker, other.attacker) &&
ContentAtom.compareNoun(this.target, other.target) &&
this.weapons.compareAgainst(other.weapons) &&
this.markers.compareAgainst(other.markers)
);
}
return false;
}
public getAtomPriority () {
return (
ContentAtom.weightNoun(this.attacker) +
ContentAtom.weightNoun(this.target) +
this.weapons.getAtomPriority() +
this.markers.getAtomPriority()
);
}
}
//new ContentAtomCombat(WorldState.player, OrcDebugger, [HumanoidHands], [ContentAtomCombat.HIT]);
//Looks good.