1
1

Attribute.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /// <reference path="PersonStat.ts" />
  2. interface AttributeBearer {
  3. getStat (attr : Attribute) : number;
  4. setStat (attr : Attribute, value : number) : void;
  5. }
  6. class Attribute extends PersonStat {
  7. public defaultValue : number = 2;
  8. public maxValue : number = 5;
  9. public constructor (id : string, description? : string | Say | ((value : number) => string | Say), defValue? :number, maxValue?:number) {
  10. super(id, description);
  11. if (defValue != undefined) {
  12. this.defaultValue = defValue;
  13. }
  14. if (maxValue != undefined) {
  15. this.maxValue = maxValue;
  16. }
  17. Attribute.Attributes[id] = this;
  18. }
  19. private static Attributes : {[id : string] : Attribute} = {};
  20. public static getAttributes () {
  21. let attributes = [];
  22. for (let key in Attribute.Attributes) {
  23. attributes.push(Attribute.Attributes[key]);
  24. }
  25. return attributes;
  26. }
  27. public static getAttribute (id : string) {
  28. return Attribute.Attributes[id];
  29. }
  30. }
  31. module Attributes {
  32. export let Strength = new Attribute(
  33. "Strength",
  34. value => {
  35. switch (value) {
  36. case 5: return "Hercules' Bigger Cousin";
  37. case 4: return ("Circus Strong" + ((<Humanoid> WorldState.player).isMale() ? "man" : "woman"));
  38. case 3: return "Beach Bully";
  39. case 2: return ("Average " + ((<Humanoid> WorldState.player).isMale() ? "Joe" : "Jane"));
  40. case 1: return "Wet Noodle";
  41. default: return "Out of bounds.";
  42. }
  43. }
  44. );
  45. export let Agility = new Attribute(
  46. "Agility",
  47. value => {
  48. switch (value) {
  49. case 5: return "Catlike";
  50. case 4: return "Gymnast";
  51. case 3: return "Accurate";
  52. case 2: return "Common";
  53. case 1: return "Accident-prone";
  54. default: return "Out of bounds.";
  55. }
  56. }
  57. );
  58. export let Intelligence = new Attribute(
  59. "Intelligence",
  60. value => {
  61. switch (value) {
  62. case 5: return "Genius";
  63. case 4: return "Gifted";
  64. case 3: return "Knowledgeable";
  65. case 2: return "Normal";
  66. case 1: return "Door";
  67. default: return "Out of bounds.";
  68. }
  69. }
  70. );
  71. export let Charm = new Attribute(
  72. "Charm",
  73. value => {
  74. switch (value) {
  75. case 5: return ((<Humanoid> WorldState.player).isMale() ? "Casanova" : "Seductress");
  76. case 4: return "Diplomat";
  77. case 3: return ("Cheery Sales" + ((<Humanoid> WorldState.player).isMale() ? "man" : "woman"));
  78. case 2: return "Not even trying";
  79. case 1: return "Unpleasant";
  80. default: return "Out of bounds.";
  81. }
  82. }
  83. );
  84. export let Corruption = new Attribute(
  85. "Corruption",
  86. value => {
  87. return "Not defined"
  88. },
  89. 0, 100
  90. );
  91. export let GenderIdentity = new Attribute(
  92. "Gender Identity",
  93. value => {
  94. if (value >= 75) {
  95. return "You strongly feel, and act, like a woman.";
  96. } else if (value >= 60) {
  97. return "You feel, and act, like a woman.";
  98. } else if (value >= 40) {
  99. return "You don't feel nor act like any particular gender.";
  100. } else if (value >= 20) {
  101. return "You feel, and act, like a man.";
  102. } else {
  103. return "You strongly feel, and act, like a man.";
  104. }
  105. },
  106. 50, 100
  107. );
  108. export let Degeneration = new Attribute(
  109. "Degeneration",
  110. value => {
  111. if (value >= 75) {
  112. return "Sex is about the only thing on your mind, and you don't even try to hide it anymore.";
  113. } else if (value >= 60) {
  114. return "Sometimes you can't hide how naughty you'd like to be.";
  115. } else if (value >= 40) {
  116. return "";
  117. } else if (value >= 20) {
  118. return "Your composure is prudish and calm.";
  119. } else {
  120. return "You have the composure of a saint.";
  121. }
  122. },
  123. 30, 100
  124. );
  125. }