From 8b99920481ffa2a08affa90b63526f57ba8d8c5c Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 8 Aug 2020 07:21:23 -0400 Subject: [PATCH] Check tests on composition actions before executing them; add ctf to Geta --- src/game/combat.ts | 11 ++++++--- src/game/creatures/geta.ts | 48 ++++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/game/combat.ts b/src/game/combat.ts index 6f36748..63e1237 100644 --- a/src/game/combat.ts +++ b/src/game/combat.ts @@ -379,9 +379,14 @@ export class CompositionAction extends Action { } execute (user: Creature, target: Creature): LogEntry { - return new LogLines( - ...this.consequences.filter(consequence => consequence.applicable(user, target)).map(consequence => consequence.apply(user, target)) - ) + const failReason = this.tests.find(test => !test.test.test(user, target)) + if (failReason !== undefined) { + return failReason.fail(user, target) + } else { + return new LogLines( + ...this.consequences.filter(consequence => consequence.applicable(user, target)).map(consequence => consequence.apply(user, target)) + ) + } } describe (user: Creature, target: Creature): LogEntry { diff --git a/src/game/creatures/geta.ts b/src/game/creatures/geta.ts index 551a6f0..c45e6b7 100644 --- a/src/game/creatures/geta.ts +++ b/src/game/creatures/geta.ts @@ -5,8 +5,9 @@ import { VoreType, Stomach, Bowels, Cock, Balls, anyVore, Slit, Womb, biconnectC import { AttackAction, TransferAction, FeedAction, DevourAction } from '../combat/actions' import { StatusConsequence, LogConsequence, DamageConsequence, ArbitraryConsequence } from '../combat/consequences' import { SizeEffect, DamageTypeResistanceEffect, InstantKillEffect } from '../combat/effects' -import { LogLine } from '../interface' +import { LogLine, nilLog } from '../interface' import { TogetherCondition, MassRatioCondition, ContainsCondition } from '../combat/conditions' +import { ChanceTest } from '../combat/tests' export class Geta extends Creature { constructor () { @@ -43,14 +44,51 @@ export class Geta extends Creature { const cock = new Cock(this, 10, new Damage( { amount: 10, type: DamageType.Crush, target: Vigor.Health }, - { amount: 30, type: DamageType.Crush, target: Vigor.Stamina }, - { amount: 30, type: DamageType.Dominance, target: Vigor.Resolve } + { amount: 50, type: DamageType.Crush, target: Vigor.Stamina }, + { amount: 150, type: DamageType.Dominance, target: Vigor.Resolve } )) + cock.digestLine = (user, target, args) => { + return new LogLine(`${user.name.capital.possessive} ${args.container.name} throbs as it abruptly absorbs ${target.name.objective}, transforming ${target.name.objective} into more of ${user.pronouns.possessive} meaty shaft.`) + } + + cock.actions.push( + new CompositionAction( + "Clench", + "Try to crush the life from your cock-snack", + { + conditions: [ + new ContainsCondition(cock) + ], + tests: [ + { + test: new ChanceTest(0.5), + fail: (user, target) => new LogLine( + `${user.name.capital.possessive} cock clenches hard around ${target.name.objective}, but ${target.pronouns.subjective} ${target.name.conjugate(new Verb("avoid"))} being crushed.` + ) + } + ], + consequences: [ + new LogConsequence( + (user, target) => new LogLine( + `${user.name.capital} ${user.name.conjugate(new Verb('let'))} out a lustful moan as ${user.pronouns.subjective} crushes the life from ${target.name.possessive} body with a flex of ${user.pronouns.possessive} shaft.` + ) + ), + new StatusConsequence( + () => new InstantKillEffect() + ), + new ArbitraryConsequence( + (user, target) => cock.tick(0) + ) + ] + } + ) + ) + const balls = new Balls(this, 10, new Damage( { amount: 50, type: DamageType.Acid, target: Vigor.Health }, { amount: 25, type: DamageType.Crush, target: Vigor.Stamina }, - { amount: 150, type: DamageType.Dominance, target: Vigor.Resolve } + { amount: 50, type: DamageType.Dominance, target: Vigor.Resolve } ), cock) this.containers.push(balls) @@ -58,6 +96,8 @@ export class Geta extends Creature { biconnectContainers(cock, balls) + cock.onDigest = (prey) => nilLog + const shrinkAction = new CompositionAction( "Shrink", "Zap!",