|
|
|
@@ -2,6 +2,7 @@ import { TargetDrainedVigorCondition } from '@/game/combat/conditions' |
|
|
|
import { Creature } from '@/game/creature' |
|
|
|
import { LogEntry, LogLines, nilLog } from "@/game/interface" |
|
|
|
import { VoreContainer } from '@/game/vore' |
|
|
|
import { Action } from './combat' |
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
abstract class Relay<Sender, EventMap extends { [name: string]: any }> { |
|
|
|
@@ -51,3 +52,19 @@ export class VoreRelay extends Relay<VoreContainer, VoreMap> { |
|
|
|
super(["onEaten", "onReleased", "onDigested", "onAbsorbed"]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
type ActionMap = { |
|
|
|
"onActionAttempt": { user: Creature; target: Creature; action: Action }; |
|
|
|
"onActionFail": { user: Creature; target: Creature; action: Action }; |
|
|
|
"onActionSuccess": { user: Creature; target: Creature; action: Action }; |
|
|
|
} |
|
|
|
|
|
|
|
export class ActionRelay extends Relay<Action, ActionMap> { |
|
|
|
constructor () { |
|
|
|
super([ |
|
|
|
"onActionAttempt", |
|
|
|
"onActionFail", |
|
|
|
"onActionSuccess" |
|
|
|
]) |
|
|
|
} |
|
|
|
} |