1
1

CombatUnit.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /// <reference path="../ContentUnit.ts" />
  2. /// <reference path="../../Things/Person.ts" />
  3. /// <reference path="../../Things/Bodypart/SexHole.ts" />
  4. /// <reference path="../../Things/Bodypart/SexStick.ts" />
  5. class CombatUnit extends ContentUnit {
  6. private actor : ContentDifferential = new ContentDifferential(Person);
  7. private target : ContentDifferential = new ContentDifferential(Person);
  8. private weapon : ContentDifferential = new ContentDifferential();
  9. private markers : ContentDifferential = new ContentDifferential();
  10. public constructor () {
  11. super();
  12. }
  13. public setActor (it : Thing | typeof Thing) {
  14. this.actor = new ContentDifferential(it);
  15. return this;
  16. }
  17. public getActor () {
  18. return this.actor;
  19. }
  20. public setTarget (it : Thing | typeof Thing) {
  21. this.target = new ContentDifferential(it);
  22. return this;
  23. }
  24. public getTarget () {
  25. return this.target;
  26. }
  27. public setWeapon (...it : Array<Thing | typeof Thing>) {
  28. this.weapon = new ContentDifferential(...it);
  29. return this;
  30. }
  31. public getWeapons () {
  32. return [...this.weapon.nouns];
  33. }
  34. public addMarker (...marker : Array<ContentMarker | AdaptiveDifferential>) {
  35. this.markers.addNoun(...marker);
  36. return this;
  37. }
  38. public getMarkers () {
  39. return [...this.markers.nouns];
  40. }
  41. public getScore () {
  42. return this.actor.getScore() + this.target.getScore() + this.weapon.getScore() + this.markers.getScore();
  43. }
  44. public isMatch (cu : CombatUnit) {
  45. if (cu instanceof CombatUnit) {
  46. return this.actor.isMatch(cu.actor) && this.target.isMatch(cu.target) &&
  47. this.weapon.isMatch(cu.weapon) && this.markers.isMatch(cu.markers);
  48. }
  49. return false;
  50. }
  51. }