1
1

CombatUnit.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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(Thing);
  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 setTarget (it : Thing | typeof Thing) {
  18. this.target = new ContentDifferential(it);
  19. return this;
  20. }
  21. public setWeapon (it : Thing | typeof Thing) {
  22. this.weapon = new ContentDifferential(it);
  23. return this;
  24. }
  25. public addMarker (marker : ContentMarker) {
  26. this.markers.addNoun(marker);
  27. return this;
  28. }
  29. public getScore () {
  30. return this.actor.getScore() + this.target.getScore() + this.weapon.getScore() + this.markers.getScore();
  31. }
  32. public isMatch (cu : CombatUnit) {
  33. if (cu instanceof CombatUnit) {
  34. return this.actor.isMatch(cu.actor) && this.target.isMatch(cu.target) &&
  35. this.weapon.isMatch(cu.weapon) && this.markers.isMatch(cu.markers);
  36. }
  37. return false;
  38. }
  39. }