|
|
|
@@ -7,6 +7,9 @@ import { LogLine, LogLines, LogEntry, nilLog } from '../interface' |
|
|
|
import { VoreContainer, Container } from '../vore' |
|
|
|
import { CapableCondition, UserDrainedVigorCondition, TogetherCondition, EnemyCondition, SoloCondition, PairCondition, ContainsCondition, ContainedByCondition } from './conditions' |
|
|
|
|
|
|
|
/** |
|
|
|
* The PassAction has no effect. |
|
|
|
*/ |
|
|
|
export class PassAction extends Action { |
|
|
|
constructor () { |
|
|
|
super("Pass", "Do nothing", [new SoloCondition()]) |
|
|
|
@@ -21,6 +24,9 @@ export class PassAction extends Action { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* A generic action that causes damage. |
|
|
|
*/ |
|
|
|
export abstract class DamageAction extends Action { |
|
|
|
protected test: StatTest |
|
|
|
|
|
|
|
@@ -53,6 +59,9 @@ export abstract class DamageAction extends Action { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Adds flavor text to [[DamageAction]] |
|
|
|
*/ |
|
|
|
export class AttackAction extends DamageAction { |
|
|
|
constructor (damage: DamageFormula, protected verb: Verb = new Verb('smack')) { |
|
|
|
super(verb.root.capital, 'Attack the enemy', damage, [new TogetherCondition()]) |
|
|
|
@@ -72,6 +81,9 @@ export class AttackAction extends DamageAction { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Devours the target. |
|
|
|
*/ |
|
|
|
export class DevourAction extends Action { |
|
|
|
private test: StatVigorTest |
|
|
|
|
|
|
|
@@ -113,6 +125,9 @@ export class DevourAction extends Action { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Causes the user to be eaten by the target. |
|
|
|
*/ |
|
|
|
export class FeedAction extends Action { |
|
|
|
constructor (protected container: Container) { |
|
|
|
super( |
|
|
|
@@ -152,6 +167,9 @@ export class FeedAction extends Action { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Tries to escape from the target's container |
|
|
|
*/ |
|
|
|
export class StruggleAction extends Action { |
|
|
|
private test: StatVigorTest |
|
|
|
|
|
|
|
@@ -189,24 +207,6 @@ export class StruggleAction extends Action { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
export abstract class EatenAction extends Action { |
|
|
|
constructor (public container: Container, name: TextLike, desc: string) { |
|
|
|
super( |
|
|
|
new DynText(name, ' (', new LiveText(container, x => x.name.all), ')'), |
|
|
|
desc, |
|
|
|
[new CapableCondition(), new PairCondition()] |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
allowed (user: Creature, target: Creature) { |
|
|
|
if (target.containedIn === this.container) { |
|
|
|
return super.allowed(user, target) |
|
|
|
} else { |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class DigestAction extends Action { |
|
|
|
constructor (protected container: VoreContainer) { |
|
|
|
super( |
|
|
|
|