Feast 2.0!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

398 line
15 KiB

  1. import { Creature, POV } from '../entity'
  2. import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction, CombatTest, Stat, DamageFormula, UniformRandomDamageFormula, Action, DamageInstance, StatDamageFormula, VoreStat } from '../combat'
  3. import { ImproperNoun, POVPair, POVPairArgs, ProperNoun, FemalePronouns, RandomWord, Adjective, Verb } from '../language'
  4. import { LogLine, LogLines, LogEntry, Newline } from '../interface'
  5. import { VoreType, Stomach, VoreContainer, Vore, NormalContainer, Container } from '../vore'
  6. import { AttackAction, FeedAction, TransferAction, EatenAction } from '../combat/actions'
  7. import { TogetherCondition, ContainsCondition, EnemyCondition, AllyCondition, PairCondition, CapableCondition } from '../combat/conditions'
  8. import { InstantKill } from '../combat/effects'
  9. import * as Words from '../words'
  10. import { StatVigorTest } from '../combat/tests'
  11. class LevelDrain extends Action {
  12. execute (user: Creature, target: Creature): LogEntry {
  13. const damage: Damage = new Damage(...Object.keys(Stat).map(stat => {
  14. return {
  15. type: DamageType.Acid,
  16. target: stat as Stat,
  17. amount: target.baseStats[stat as Stat] / 5
  18. }
  19. }))
  20. const heal: Damage = new Damage(...Object.keys(Stat).map(stat => {
  21. return {
  22. type: DamageType.Heal,
  23. target: stat as Stat,
  24. amount: target.baseStats[stat as Stat] / 5
  25. }
  26. }))
  27. user.takeDamage(heal)
  28. const targetResult = target.takeDamage(damage)
  29. return new LogLines(
  30. new LogLine(`${user.name.capital.possessive} ${this.container.name} drains power from ${target.name.objective}, siphoning `, damage.renderShort(), ` from ${target.pronouns.possessive} body!`),
  31. targetResult
  32. )
  33. }
  34. describe (user: Creature, target: Creature): LogEntry {
  35. return new LogLine(`Drain energy from ${target.name}`)
  36. }
  37. constructor (private container: Container) {
  38. super(
  39. 'Level Drain',
  40. 'Drain energy from your prey',
  41. [
  42. new ContainsCondition(container),
  43. new CapableCondition()
  44. ]
  45. )
  46. }
  47. }
  48. class HypnotizeAction extends Action {
  49. lines = new POVPair<Creature, Creature>([
  50. [[POV.Second, POV.Third], (user, target) => new LogLine(`Your hypnotic gaze enthralls ${target.name}, putting ${target.pronouns.objective} under your control!`)],
  51. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital}'s hypnotic gaze enthralls you, putting you under ${user.pronouns.possessive} control!`)],
  52. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital}'s hypnotic gaze enthralls ${target.name}, putting ${target.pronouns.objective} under ${user.pronouns.possessive} control!`)]
  53. ])
  54. execute (user: Creature, target: Creature): LogEntry {
  55. target.side = user.side
  56. return this.lines.run(user, target)
  57. }
  58. describe (user: Creature, target: Creature): LogEntry {
  59. return new LogLine(`Force your target to fight by your side`)
  60. }
  61. constructor () {
  62. super(
  63. `Hypnotize`,
  64. `Change their mind!`,
  65. [
  66. new TogetherCondition(),
  67. new EnemyCondition(),
  68. new CapableCondition()
  69. ]
  70. )
  71. }
  72. }
  73. class MawContainer extends NormalContainer {
  74. consumeVerb = new Verb('grab', 'grabs', 'grabbing', 'grabbed')
  75. releaseVerb = new Verb('release')
  76. struggleVerb = new Verb('struggle', 'struggles', 'struggling', 'struggled')
  77. consumeLines = new POVPair<Vore, Vore>([
  78. [[POV.Second, POV.Third], (user, target) => new LogLine(`You snatch ${target.name} up in your jaws`)],
  79. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} snatches you up in ${user.pronouns.possessive} maw`)],
  80. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} snatches ${target.name} up in ${user.pronouns.possessive} maw`)]
  81. ])
  82. releaseLines = new POVPair([
  83. [[POV.Second, POV.Third], (user, target) => new LogLine(`You let out ${target.name}`)],
  84. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} lets you out `)],
  85. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} lets out ${target.name}`)]
  86. ])
  87. struggleLines = new POVPair([
  88. [[POV.Second, POV.Third], (user, target) => new LogLine(`You claw your way free of ${target.name}`)],
  89. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} forces ${user.pronouns.possessive} way free!`)],
  90. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} escapes from ${target.name}`)]
  91. ])
  92. constructor (owner: Vore, stomach: VoreContainer) {
  93. super(new ImproperNoun('maw'), owner, new Set([VoreType.Oral]), 50)
  94. this.actions.push(new TransferAction(this, stomach))
  95. }
  96. }
  97. class FlexToesAction extends GroupAction {
  98. line = (user: Creature, target: Creature, args: { damage: Damage }) => new LogLine(`${user.name.capital.possessive} toes crush ${target.name.objective} for `, args.damage.renderShort(), ` damage!`)
  99. describeGroup (user: Creature, targets: Creature[]): LogEntry {
  100. return new LogLine(`Flex your toes. `, this.damage.explain(user))
  101. }
  102. execute (user: Creature, target: Creature): LogEntry {
  103. const damage = this.damage.calc(user, target)
  104. return new LogLines(target.takeDamage(damage), this.line(user, target, { damage: damage }))
  105. }
  106. describe (user: Creature, target: Creature): LogEntry {
  107. return new LogLine(`Flex your toes! `, this.damage.describe(user, target))
  108. }
  109. constructor (private damage: DamageFormula, container: Container) {
  110. super('Flex Toes', 'Flex your toes!', [
  111. new ContainsCondition(container),
  112. new PairCondition()
  113. ])
  114. }
  115. }
  116. class BootContainer extends NormalContainer {
  117. consumeLines = new POVPair<Vore, Vore>([
  118. [[POV.Second, POV.Third], (user, target) => new LogLine(`You stuff ${target.name} into your boot.`)],
  119. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} stuffs you in ${user.pronouns.possessive} boot, pinning you between toes and insole.`)],
  120. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} stuffs ${target.name} in ${user.pronouns.possessive} boot.`)]
  121. ])
  122. releaseLines = new POVPair([
  123. [[POV.Second, POV.Third], (user, target) => new LogLine(`You dump ${target.name} out from your boot.`)],
  124. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} dumps you out from ${user.pronouns.possessive} boot.`)],
  125. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} dumps ${target.name} out from ${user.pronouns.possessive} boot.`)]
  126. ])
  127. struggleLines = new POVPair([
  128. [[POV.Second, POV.Third], (user, target) => new LogLine(`You slip out from ${target.name}'s boot.`)],
  129. [[POV.Third, POV.Second], (user, target) => new LogLine(`${user.name.capital} squeezes ${user.pronouns.possessive} way free of your footwear!`)],
  130. [[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} escapes from ${target.name}'s boot.`)]
  131. ])
  132. consumeVerb = new Verb('trap', 'traps', 'trapped', 'trapping')
  133. releaseVerb = new Verb('dump')
  134. struggleVerb = new Verb('struggle', 'struggles', 'struggling', 'struggled')
  135. constructor (owner: Vore) {
  136. super(new ImproperNoun('boot'), owner, new Set(), 50)
  137. const flex = new FlexToesAction(
  138. new UniformRandomDamageFormula(new Damage(
  139. { target: Stat.Toughness, type: DamageType.Crush, amount: 10 },
  140. { target: Stat.Power, type: DamageType.Crush, amount: 10 },
  141. { target: Stat.Speed, type: DamageType.Crush, amount: 10 },
  142. { target: Stat.Willpower, type: DamageType.Crush, amount: 10 },
  143. { target: Stat.Charm, type: DamageType.Crush, amount: 10 }
  144. ), 0.5),
  145. this
  146. )
  147. this.actions.push(flex)
  148. }
  149. }
  150. const huge = new RandomWord([
  151. new Adjective('massive'),
  152. new Adjective('colossal'),
  153. new Adjective('big ol\''),
  154. new Adjective('heavy'),
  155. new Adjective('crushing'),
  156. new Adjective('huge')
  157. ])
  158. class BiteAction extends AttackAction {
  159. constructor () {
  160. super(
  161. new ConstantDamageFormula(new Damage({ amount: 50, type: DamageType.Slash, target: Vigor.Health })),
  162. new Verb('bite', 'bites', 'biting', 'bit')
  163. )
  164. this.name = "Bite"
  165. }
  166. }
  167. class ChewAction extends GroupAction {
  168. line = (user: Creature, target: Creature, args: { damage: Damage }) => new LogLine(`${user.name.capital} chews on ${target.name.objective} for `, args.damage.renderShort(), `!`)
  169. describeGroup (user: Creature, targets: Creature[]): LogEntry {
  170. return new LogLine('Crunch \'em all. ', this.damage.explain(user))
  171. }
  172. execute (user: Creature, target: Creature): LogEntry {
  173. const damage = this.damage.calc(user, target)
  174. const results: Array<LogEntry> = []
  175. results.push(this.line(user, target, { damage: damage }))
  176. results.push(new LogLine(' '))
  177. results.push(target.takeDamage(damage))
  178. if (target.vigors.Health <= 0) {
  179. if (this.killAction.allowed(user, target)) {
  180. results.push(new Newline())
  181. results.push(this.killAction.execute(user, target))
  182. }
  183. }
  184. return new LogLine(...results)
  185. }
  186. describe (user: Creature, target: Creature): LogEntry {
  187. return new LogLine('Do the crunch')
  188. }
  189. constructor (private damage: DamageFormula, container: Container, private killAction: Action) {
  190. super('Chew', 'Give them the big chew', [
  191. new ContainsCondition(container)
  192. ])
  193. }
  194. }
  195. class StompAction extends GroupAction {
  196. lines: POVPair<Creature, Creature> = new POVPair([
  197. [[POV.Second, POV.Third], (user: Creature, target: Creature) => new LogLine(`You flatten ${target.name} under your foot!`)],
  198. [[POV.Third, POV.Second], (user: Creature) => new LogLine(`${user.name.capital} flattens you under ${user.pronouns.possessive} ${huge} foot!`)],
  199. [[POV.Third, POV.Third], (user: Creature, target: Creature) => new LogLine(`${user.name.capital} flattens ${target.name} under ${user.pronouns.possessive} ${huge} foot!`)]
  200. ])
  201. execute (user: Creature, target: Creature): LogEntry {
  202. return new LogLines(this.lines.run(user, target), new InstantKill().apply(target))
  203. }
  204. describe (user: Creature, target: Creature): LogEntry {
  205. return new LogLine('Stomp one sucker')
  206. }
  207. describeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  208. return new LogLine('Stomp all ', targets.length.toString(), ' of \'em!')
  209. }
  210. constructor () {
  211. super('Stomp', 'STOMP!', [
  212. new TogetherCondition(),
  213. new EnemyCondition(),
  214. new CapableCondition()
  215. ])
  216. }
  217. }
  218. class StompAllyAction extends Action {
  219. lines: POVPair<Creature, Creature> = new POVPair([
  220. [[POV.Second, POV.Third], (user: Creature, target: Creature) => new LogLine(`You flatten ${target.name} under your boot!`)],
  221. [[POV.Third, POV.Second], (user: Creature) => new LogLine(`${user.name.capital} flattens you under ${user.pronouns.possessive} ${huge} boot!`)],
  222. [[POV.Third, POV.Third], (user: Creature, target: Creature) => new LogLine(`${user.name.capital} flattens ${target.name} under ${user.pronouns.possessive} ${huge} boot!`)]
  223. ])
  224. execute (user: Creature, target: Creature): LogEntry {
  225. const damages: Array<DamageInstance> = Object.keys(Stat).map(stat => ({
  226. target: stat as Stat,
  227. amount: target.stats[stat as Stat] / 3,
  228. type: DamageType.Heal
  229. }))
  230. const heal = new Damage(
  231. ...damages
  232. )
  233. user.takeDamage(heal)
  234. target.destroyed = true
  235. return new LogLines(
  236. this.lines.run(user, target),
  237. new InstantKill().apply(target),
  238. new LogLine(`${user.name.capital} absorbs ${target.pronouns.possessive} power, gaining `, heal.renderShort())
  239. )
  240. }
  241. describe (user: Creature, target: Creature): LogEntry {
  242. return new LogLine('Crush an ally to absorb their power')
  243. }
  244. constructor () {
  245. super('Stomp Ally', '-1 ally, +1 buff', [
  246. new TogetherCondition(),
  247. new AllyCondition(),
  248. new CapableCondition()
  249. ])
  250. }
  251. }
  252. class DevourAllAction extends GroupAction {
  253. line = (user: Creature, target: Creature) => new LogLine(`${user.name.capital} ${user.name.conjugate(new Verb('scoop'))} ${target.name} up!`)
  254. groupLine = (user: Creature, args: { count: number }) => new LogLine(`${Words.SwallowSound.allCaps}! All ${args.count} of ${user.pronouns.possessive} prey pour down ${user.name.possessive} ${Words.Slick} gullet as ${user.pronouns.subjective} ${user.name.conjugate(Words.Swallows)}; they're just ${user.kind.all} chow now`)
  255. execute (user: Creature, target: Creature): LogEntry {
  256. this.container.consume(target)
  257. return new LogLines(this.line(user, target))
  258. }
  259. describe (user: Creature, target: Creature): LogEntry {
  260. return new LogLine('Stomp one sucker')
  261. }
  262. executeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  263. return new LogLines(...targets.filter(target => this.test.test(user, target)).map(target => this.execute(user, target)).concat(
  264. [
  265. new Newline(),
  266. this.groupLine(user, { count: targets.length })
  267. ]
  268. ))
  269. }
  270. describeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  271. return new LogLine('Eat all ', targets.length.toString(), ' of \'em!')
  272. }
  273. private test: CombatTest
  274. constructor (private container: VoreContainer) {
  275. super('Devour All', 'GULP!', [
  276. new TogetherCondition(),
  277. new EnemyCondition(),
  278. new CapableCondition()
  279. ])
  280. this.test = new StatVigorTest(Stat.Power)
  281. }
  282. }
  283. export class Withers extends Creature {
  284. title = "Huge Hellhound"
  285. desc = "Will eat your party"
  286. constructor () {
  287. super(
  288. new ProperNoun('Withers'),
  289. new ImproperNoun('hellhound', 'hellhounds'),
  290. FemalePronouns,
  291. { Toughness: 40, Power: 50, Speed: 30, Willpower: 40, Charm: 70 },
  292. new Set(),
  293. new Set([VoreType.Oral]),
  294. 5000
  295. )
  296. this.actions.push(new BiteAction())
  297. this.groupActions.push(new StompAction())
  298. this.side = Side.Monsters
  299. const stomach = new Stomach(this, 50, new Damage(
  300. { amount: 300, type: DamageType.Acid, target: Vigor.Health },
  301. { amount: 200, type: DamageType.Crush, target: Vigor.Stamina },
  302. { amount: 200, type: DamageType.Dominance, target: Vigor.Resolve }
  303. ))
  304. this.containers.push(stomach)
  305. this.otherActions.push(new FeedAction(stomach))
  306. this.groupActions.push(new DevourAllAction(stomach))
  307. const maw = new MawContainer(this, stomach)
  308. this.otherContainers.push(maw)
  309. this.actions.push(new ChewAction(
  310. new UniformRandomDamageFormula(new Damage(
  311. { target: Vigor.Health, type: DamageType.Crush, amount: 10000 }
  312. ), 0.5),
  313. maw,
  314. new TransferAction(maw, stomach)
  315. ))
  316. const boot = new BootContainer(this)
  317. this.otherContainers.push(boot)
  318. this.actions.push(new StompAllyAction())
  319. this.actions.push(
  320. new AttackAction(
  321. new StatDamageFormula([
  322. { fraction: 0.5, stat: Stat.Toughness, target: Vigor.Health, type: DamageType.Crush },
  323. { fraction: 0.05, stat: VoreStat.Bulk, target: Vigor.Health, type: DamageType.Crush }
  324. ]),
  325. new Verb('stomp')
  326. )
  327. )
  328. this.actions.push(new HypnotizeAction())
  329. this.actions.push(new LevelDrain(stomach))
  330. }
  331. }