ContentAtomAnnoy.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ///<reference path="../ContentAtom.ts"/>
  2. ///<reference path="../ContentNounSimple.ts"/>
  3. /**
  4. * This atom should be used in place of the default atom when handling Annoying people.
  5. * Do note that any aggressive action is automatically Annoying.
  6. */
  7. class ContentAtomAnnoy extends ContentAtom {
  8. /**
  9. * Only one of the following markers appears at once. Will always contain one of those.
  10. */
  11. public static TYPE_LOW = new ContentNounSimple("LOW ANNOYING LEVEL");
  12. public static TYPE_MEDIUM = new ContentNounSimple("MEDIUM ANNOYING LEVEL");
  13. public static TYPE_HIGH = new ContentNounSimple("HIGH ANNOYING LEVEL");
  14. /**
  15. * Only one of the following markers appears at once. Will always contain one of those.
  16. */
  17. public static RESULT_FRIENDLY = new ContentNounSimple("TARGET IS STILL FRIENDLY");
  18. public static RESULT_PISSED = new ContentNounSimple("TARGET IS GETTING PISSED OFF");
  19. public static RESULT_HOSTILE = new ContentNounSimple("TARGET IS NOW HOSTILE");
  20. public annoyer : any;
  21. public target : any;
  22. public markers : ContentAtom = new ContentAtom();
  23. constructor (attacker : any, target : any, markers : Array<ContentNounSimple> = []) {
  24. super();
  25. this.annoyer = attacker;
  26. this.target = target;
  27. this.markers.addNoun(...markers);
  28. }
  29. public compareAgainst (other : ContentAtom) {
  30. if (other instanceof ContentAtomAnnoy) {
  31. return (
  32. ContentAtom.compareNoun(this.annoyer, other.annoyer) &&
  33. ContentAtom.compareNoun(this.target, other.target) &&
  34. this.markers.compareAgainst(other.markers)
  35. );
  36. }
  37. return false;
  38. }
  39. public getAtomPriority () {
  40. return (
  41. ContentAtom.weightNoun(this.annoyer) +
  42. ContentAtom.weightNoun(this.target) +
  43. this.markers.getAtomPriority()
  44. );
  45. }
  46. }