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.
 
 
 
 
 

367 lines
12 KiB

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