CombatPokeDescription.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /// <reference path="../ContentDescription.ts" />
  2. /// <reference path="CombatPokeUnit.ts" />
  3. /// <reference path="CombatUnit.ts" />
  4. /**
  5. * Quick Cheat Sheet of markers!
  6. */
  7. class CombatPokeDescription extends ContentDescription {
  8. public static DESCRIPTIONS = [];
  9. public constructor (name : string) {
  10. super(name, new ContentGroup());
  11. CombatPokeDescription.DESCRIPTIONS.push(this);
  12. }
  13. public setDescriptionFunction (descriptionFor : (target : any, markers : Array<any>) => Say) {
  14. let finalFunction = (description : CombatPokeDescription, group : ContentGroup) => {
  15. // Combat only has one unit
  16. let unit = <CombatPokeUnit> group.getUnit(0);
  17. return descriptionFor (unit.getTarget().nouns[0], unit.getMarkers());
  18. }
  19. this.description = finalFunction;
  20. return this;
  21. }
  22. public addUnit () {
  23. let unit = new CombatPokeUnit();
  24. (<ContentGroup> this.group).addUnit(unit);
  25. return unit;
  26. }
  27. public static getDescription (target : ContentGroup) {
  28. return ContentDescription.pickDescriptions(CombatPokeDescription.DESCRIPTIONS, target);
  29. }
  30. }