12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /// <reference path="../ContentDescription.ts" />
- /// <reference path="CombatPokeUnit.ts" />
- /// <reference path="CombatUnit.ts" />
- /**
- * Quick Cheat Sheet of markers!
- * When making a description take these markers into account while describing the action! If a marker describes something
- * please include it if you add it to the description. Example: if you describe the attack as a "heavy hit!", make sure
- * to add the HIGH_DAMAGE marker, we don't want a "heavy hit!" to be displayed for an attack that caused 1 damage.
- *
- * Mandatory Markers - Include only one and clone description for each
- * CombatHit.FULL_DODGE
- * CombatHit.PARTIAL_DODGE
- * CombatHit.FULL_HIT
- *
- * Mandatory Markers - Include only one and clone description for each. These don't show up in FULL_DODGE
- * CombatResult.KNOCKED
- * CombatResult.KNOCKED_OFF
- * CombatResult.KILLED
- *
- * Non-Mandatory Markers - Include at most one per description, none makes a description fit more attacks. These don't show up in FULL_DODGE.
- * CombatDamage.LOW_DAMAGE
- * CombatDamage.MEDIUM_DAMAGE
- * CombatDamage.HIGH_DAMAGE
- */
- class CombatDescription extends ContentDescription {
- public static DESCRIPTIONS = [];
- public constructor (name : string) {
- super(name, new ContentGroup());
- CombatDescription.DESCRIPTIONS.push(this);
- }
- public setDescriptionFunction (descriptionFor : (actor : any, target : any, weapons : Array<any>, markers : Array<any>) => Say) {
- let finalFunction = (description : CombatDescription, group : ContentGroup) => {
- // Combat only has one unit
- let unit = <CombatUnit> group.getUnit(0);
- return descriptionFor (unit.getActor().nouns[0], unit.getTarget().nouns[0], unit.getWeapons(), unit.getMarkers());
- }
- this.description = finalFunction;
- return this;
- }
- public addUnit () {
- let unit = new CombatUnit();
- (<ContentGroup> this.group).addUnit(unit);
- return unit;
- }
- public static getDescription (target : ContentGroup) {
- return ContentDescription.pickDescriptions(CombatDescription.DESCRIPTIONS, target);
- }
- }
|