HumanoidPenis.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /// <reference path="../../Bodypart.ts" />
  2. /// <reference path="../../Humanoid/Humanoid.ts" />
  3. /// <reference path="../SexStick.ts" />
  4. /// <reference path="../SexHole.ts" />
  5. /// <reference path="../../../Measure.ts" />
  6. /// <reference path="../../../../../Elements/Classes/Say/OneOf.ts" />
  7. class HumanoidPenis extends SexStick {
  8. public sorenessWeight = Bodypart.WEIGHT_HIGH;
  9. public genderValue = 25;
  10. public genderWeight = Bodypart.WEIGHT_HIGHEST;
  11. public slots : Array<number> = [Humanoid.SLOT_CROTCH_FRONT];
  12. public sluttiness = Bodypart.SLUTTINESS_HIGH_SLUT;
  13. public sluttinessWeight = Bodypart.WEIGHT_MEDIUM;
  14. public flaccidSize = new Measure(6);
  15. public flaccidWidth = new Measure(3);
  16. public erectSize = new Measure(15);
  17. public erectWidth = new Measure(6);
  18. private arousalMinimum : number = 5;
  19. private arousalErect : number = 25;
  20. private flaccidMult : number;
  21. public getSluttiness () {
  22. return this.getBulgeSize() * 3;
  23. }
  24. public isGrower () {
  25. return this.flaccidMult < 0.5;
  26. }
  27. public constructor (options? : ThingOptions) {
  28. super(options);
  29. if (Math.random() >= 0.5) {
  30. // grower?
  31. this.flaccidMult = 0.33;
  32. } else {
  33. // shower?
  34. this.flaccidMult = 0.77;
  35. }
  36. this.addGetAlterations((thing) => {
  37. return {
  38. FSize : this.flaccidSize.getNumber(),
  39. FWidth : this.flaccidWidth.getNumber(),
  40. ESize : this.erectSize.getNumber(),
  41. EWidth : this.erectWidth.getNumber(),
  42. AMin : this.arousalMinimum,
  43. AErect : this.arousalErect,
  44. FMult : this.flaccidMult
  45. }
  46. });
  47. this.addSetAlterations((thing, changes) => {
  48. this.flaccidSize = new Measure(changes.FSize);
  49. this.flaccidWidth = new Measure(changes.FWidth);
  50. this.erectSize = new Measure(changes.ESize);
  51. this.erectWidth = new Measure(changes.EWidth);
  52. this.arousalMinimum = changes.AMin;
  53. this.arousalErect = changes.AErect;
  54. this.flaccidMult = changes.FMult;
  55. });
  56. }
  57. public getActualSize () {
  58. let min = this.flaccidSize.getNumber();
  59. let max = this.erectSize.getNumber();
  60. let variableSize = (max - min);
  61. let finalSize = min + (variableSize * this.getArousalPerc());
  62. return finalSize;
  63. }
  64. public isBig () {
  65. return this.getBulgeSize() > 22;
  66. }
  67. public getArousalPerc () {
  68. //TODO: Get arousal from owner
  69. let arousal = 0;
  70. let numSteps = this.arousalErect - this.arousalMinimum;
  71. let arousalPerc = (arousal - this.arousalMinimum) / numSteps;
  72. arousalPerc = arousalPerc < 0 ? 0 :
  73. arousalPerc > 1 ? 1 :
  74. arousalPerc;
  75. return arousalPerc;
  76. }
  77. public isFlaccid () {
  78. return this.getArousalPerc() < 0.6;
  79. }
  80. public isErect () {
  81. return !this.isFlaccid();
  82. }
  83. public getActualWidth () {
  84. let min = this.flaccidWidth.getNumber();
  85. let max = this.erectWidth.getNumber();
  86. let variableSize = (max - min);
  87. let numSteps = this.arousalErect - this.arousalMinimum;
  88. //TODO: Get arousal from owner
  89. let arousal = 0;
  90. let arousalPerc = (arousal - this.arousalMinimum) / numSteps;
  91. arousalPerc = arousalPerc < 0 ? 0 :
  92. arousalPerc > 1 ? 1 :
  93. arousalPerc;
  94. let finalSize = min + (variableSize * arousalPerc);
  95. return finalSize;
  96. }
  97. public getLong () {
  98. return new Measure(this.getActualSize());
  99. }
  100. public getWide () {
  101. return new Measure(this.getActualWidth());
  102. }
  103. public getBulgeSize () {
  104. return this.getActualSize() + (3 * this.getActualWidth());
  105. }
  106. public getSizeText () {
  107. return HumanoidPenis.getSizeText(this.getBulgeSize());
  108. }
  109. public static getSizeText (size : number) {
  110. // size = long + (width * 3)
  111. // so long from 1 to 20, lets say
  112. // width from 1 to 6, so 3 to 18
  113. let sizeTable = [
  114. [0, "nonexistent"],
  115. [1, "tiny"], // 3l 2w = 9
  116. [20, "small"], // 10l 3w = 19
  117. [23, "medium"], // 14l 3w = 24
  118. [27, "big"],
  119. [32, "huge"],
  120. [36, "monstrous"]
  121. ];
  122. let i;
  123. for (i = 1; i < sizeTable.length && sizeTable[i][0] < size; i++) {}
  124. return sizeTable[i - 1][1];
  125. }
  126. public getGenderValue () {
  127. let sizeTable = [
  128. [10, 60], // 3l 2w = 9
  129. [20, 45], // 10l 3w = 19
  130. [23, 35], // 14l 3w = 24
  131. [27, 28],
  132. [32, 24],
  133. [36, 18]
  134. ];
  135. let i;
  136. for (i = 1; i < sizeTable.length && sizeTable[i][0] < this.getActualSize(); i++) {}
  137. return sizeTable[i - 1][1];
  138. }
  139. public arrangeGenderValue (gv : number) {
  140. let sizeTable = [
  141. [60, 3, 2], // 3l 2w = 9
  142. [45, 10, 3], // 10l 3w = 19
  143. [35, 14, 3], // 14l 3w = 24
  144. [28, 17, 3],
  145. [24, 19, 4],
  146. [18, 22, 4.5]
  147. ];
  148. let i;
  149. for (i = 1; i < sizeTable.length && sizeTable[i][0] > gv; i++) {}
  150. this.flaccidSize = new Measure(this.flaccidMult * sizeTable[i - 1][1]);
  151. this.flaccidWidth = new Measure(this.flaccidMult * sizeTable[i - 1][2]);
  152. this.erectSize = new Measure(sizeTable[i - 1][1]);
  153. this.erectWidth = new Measure(sizeTable[i - 1][2]);
  154. (<Humanoid> this.getPartOne()).invalidateCaches();
  155. }
  156. public static getSynonym () {
  157. // TODO: Add more when creative.
  158. let cockNames = [
  159. "cock",
  160. "dick"
  161. ];
  162. return (new OneOf(OneOf.PURELY_AT_RANDOM, ...cockNames).getOne());
  163. }
  164. }