OrcDebugger.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /// <reference path="../Humanoid.ts" />
  2. class OrcDebugger extends Humanoid {
  3. public static nameModifier = new Shuffler([
  4. "Ugly", "Muscular", "Veiny", "Angry", "Sad", "Smart", "Agile", "Short", "Bulging", "Intense", "Smouldering"
  5. ]);
  6. public static counter = 1;
  7. public constructor () {
  8. super({
  9. isMale: true,
  10. name : (() => {
  11. let nameMod = OrcDebugger.nameModifier.getOne();
  12. if (nameMod == undefined) {
  13. nameMod = (OrcDebugger.counter++).toString();
  14. }
  15. return nameMod + " Orc";
  16. })(),
  17. unique : true,
  18. description : "This is one extremely ugly fellow."
  19. });
  20. this.AI.wanderer = true;
  21. this.AI.picksShinies = true;
  22. }
  23. }
  24. ActionTalk.carry.createAndAddRule({
  25. name : "Talking to the orc",
  26. firstPriority : ActionTalk.PRIORITY_GLOBAL_DIALOGUE,
  27. priority : ActionTalk.PRIORITY_COMMON_DIALOGUE,
  28. conditions : (runner : RulebookRunner<ActionTalk>) => {
  29. return runner.noun.getNoun(0) instanceof OrcDebugger;
  30. },
  31. code : (runner : RulebookRunner<ActionTalk>) => {
  32. let orc = <OrcDebugger> runner.noun.getNoun(0);
  33. //await DialogueTrees.CompilableTest.execute();
  34. let result = Dice.testAgainstRoll(
  35. {name: "Charm + 2", value : WorldState.player.getStat(Attributes.Charm) + 2},
  36. {name: "Orc's wits + 2", value : orc.getStat(Attributes.Intelligence) + 2}
  37. );
  38. if (result > 0) {
  39. Elements.CurrentTurnHandler.printAsContent(new Say("You win!"));
  40. } else {
  41. Elements.CurrentTurnHandler.printAsContent(new Say("You lose."));
  42. }
  43. return true;
  44. }
  45. });