| oid sha256:e8cb78e4cbaaa195ca23b200037128734f2d00e8ce73fe766ff91d63454fe1e1 | |||||
| size 34866 |
| @@ -316,8 +316,9 @@ export class AttackAction extends TogetherAction { | |||||
| execute (user: Creature, target: Creature): LogEntry { | execute (user: Creature, target: Creature): LogEntry { | ||||
| if (this.test.test(user, target)) { | if (this.test.test(user, target)) { | ||||
| target.takeDamage(this.damage) | |||||
| return this.successLines.run(user, target, { damage: this.damage }) | |||||
| const targetResult = target.takeDamage(this.damage) | |||||
| const ownResult = this.successLines.run(user, target, { damage: this.damage }) | |||||
| return new CompositeLog(ownResult, targetResult) | |||||
| } else { | } else { | ||||
| return this.failLines.run(user, target) | return this.failLines.run(user, target) | ||||
| } | } | ||||
| @@ -5,6 +5,33 @@ import { VoreType, Stomach, InnerStomach, Container, Bowels } from '../vore' | |||||
| import { LogLine, LogLines, LogEntry, FAElem, CompositeLog, ImgElem } from '../interface' | import { LogLine, LogLines, LogEntry, FAElem, CompositeLog, ImgElem } from '../interface' | ||||
| import { Wolf } from '../creatures' | import { Wolf } from '../creatures' | ||||
| class BellyCrushAction extends AttackAction { | |||||
| successLines = new POVPairArgs<Entity, Entity, { damage: Damage }>([ | |||||
| [[POV.First, POV.Third], (user, target, args) => new CompositeLog(new LogLine( | |||||
| `You crush on ${target.name} with your belly for `, | |||||
| args.damage.renderShort() | |||||
| ), new ImgElem('./media/cafat/images/belly-crush.webp'))], | |||||
| [[POV.Third, POV.First], (user, target, args) => new CompositeLog(new LogLine( | |||||
| `${user.name.capital} crushes on you with ${user.pronouns.possessive} belly for `, | |||||
| args.damage.renderShort() | |||||
| ), new ImgElem('./media/cafat/images/belly-crush.webp'))], | |||||
| [[POV.Third, POV.Third], (user, target, args) => new CompositeLog(new LogLine( | |||||
| `${user.name.capital} crushes on ${target.name} with ${user.pronouns.possessive} belly for `, | |||||
| args.damage.renderShort() | |||||
| ), new ImgElem('./media/cafat/images/belly-crush.webp'))] | |||||
| ]) | |||||
| constructor (private _damage: Damage) { | |||||
| super(_damage) | |||||
| this.name = 'Belly Crush' | |||||
| } | |||||
| execute (user: Creature, target: Creature): LogEntry { | |||||
| this.damage = this._damage.scale(user.bulk / 25 + 1) | |||||
| return super.execute(user, target) | |||||
| } | |||||
| } | |||||
| class BelchAction extends AttackAction { | class BelchAction extends AttackAction { | ||||
| successLines = new POVPairArgs<Entity, Entity, { damage: Damage }>([ | successLines = new POVPairArgs<Entity, Entity, { damage: Damage }>([ | ||||
| [[POV.First, POV.Third], (user, target, args) => new CompositeLog(new LogLine( | [[POV.First, POV.Third], (user, target, args) => new CompositeLog(new LogLine( | ||||
| @@ -96,6 +123,8 @@ export class Cafat extends Creature { | |||||
| this.actions.push(transfer) | this.actions.push(transfer) | ||||
| this.actions.push(new TransferAction(lowerStomach, stomach)) | this.actions.push(new TransferAction(lowerStomach, stomach)) | ||||
| this.actions.push(new AttackAction(new Damage({ amount: 40, type: DamageType.Crush, target: Vigor.Health }))) | |||||
| this.actions.push(new BellyCrushAction(new Damage({ amount: 10, type: DamageType.Crush, target: Vigor.Health }, { amount: 10, type: DamageType.Dominance, target: Vigor.Willpower }))) | |||||
| this.actions.push(new BelchAction(new Damage( | this.actions.push(new BelchAction(new Damage( | ||||
| { amount: 100, target: Vigor.Willpower, type: DamageType.Acid } | { amount: 100, target: Vigor.Willpower, type: DamageType.Acid } | ||||
| ))) | ))) | ||||
| @@ -1,6 +1,6 @@ | |||||
| import { DamageType, Damage, Combatant, Stats, Action, Vigor } from './combat' | import { DamageType, Damage, Combatant, Stats, Action, Vigor } from './combat' | ||||
| import { Noun, Pronoun } from './language' | import { Noun, Pronoun } from './language' | ||||
| import { LogEntry, LogLine } from './interface' | |||||
| import { Vore, Container, VoreType } from './vore' | import { Vore, Container, VoreType } from './vore' | ||||
| export enum POV {First, Third} | export enum POV {First, Third} | ||||
| @@ -19,7 +19,7 @@ export interface Mortal extends Entity { | |||||
| takeDamage: (damage: Damage) => void; | takeDamage: (damage: Damage) => void; | ||||
| stats: Stats; | stats: Stats; | ||||
| status: string; | status: string; | ||||
| destroy: () => void; | |||||
| destroy: () => LogEntry; | |||||
| } | } | ||||
| export class Creature extends Vore implements Combatant { | export class Creature extends Vore implements Combatant { | ||||
| @@ -47,7 +47,7 @@ export class Creature extends Vore implements Combatant { | |||||
| private baseBulk: number; | private baseBulk: number; | ||||
| get bulk (): number { | get bulk (): number { | ||||
| return this.baseBulk | |||||
| return this.baseBulk + this.containers.reduce((total, conatiner) => { return total + conatiner.contents.reduce((total, prey) => total + prey.bulk, 0) }, 0) | |||||
| } | } | ||||
| containedIn: Container|null = null; | containedIn: Container|null = null; | ||||
| @@ -61,7 +61,7 @@ export class Creature extends Vore implements Combatant { | |||||
| return this.name.toString() | return this.name.toString() | ||||
| } | } | ||||
| takeDamage (damage: Damage): void { | |||||
| takeDamage (damage: Damage): LogEntry { | |||||
| damage.damages.forEach(instance => { | damage.damages.forEach(instance => { | ||||
| const resistance: number|undefined = this.resistances.get(instance.type) | const resistance: number|undefined = this.resistances.get(instance.type) | ||||
| if (resistance !== undefined) { | if (resistance !== undefined) { | ||||
| @@ -72,7 +72,9 @@ export class Creature extends Vore implements Combatant { | |||||
| }) | }) | ||||
| if (this.vigors.Health <= -100) { | if (this.vigors.Health <= -100) { | ||||
| this.destroy() | |||||
| return this.destroy() | |||||
| } else { | |||||
| return new LogLine() | |||||
| } | } | ||||
| } | } | ||||
| @@ -113,7 +115,7 @@ export class Creature extends Vore implements Combatant { | |||||
| }) | }) | ||||
| } | } | ||||
| destroy (): void { | |||||
| super.destroy() | |||||
| destroy (): LogEntry { | |||||
| return super.destroy() | |||||
| } | } | ||||
| } | } | ||||
| @@ -26,7 +26,7 @@ export abstract class Vore implements Mortal { | |||||
| abstract containedIn: Container | null; | abstract containedIn: Container | null; | ||||
| abstract predPrefs: Set<VoreType>; | abstract predPrefs: Set<VoreType>; | ||||
| abstract containers: Array<Container>; | abstract containers: Array<Container>; | ||||
| destroy (): void { | |||||
| destroy (): LogEntry { | |||||
| this.containers.map(container => { | this.containers.map(container => { | ||||
| container.contents.map(prey => { | container.contents.map(prey => { | ||||
| prey.containedIn = this.containedIn | prey.containedIn = this.containedIn | ||||
| @@ -35,6 +35,8 @@ export abstract class Vore implements Mortal { | |||||
| } | } | ||||
| }) | }) | ||||
| }) | }) | ||||
| return new LogLine(`${this.name.capital} dies!`) | |||||
| } | } | ||||
| } | } | ||||