|
|
|
@@ -1,5 +1,5 @@ |
|
|
|
import { Creature } from './entity' |
|
|
|
import { TextLike, DynText, ToBe } from './language' |
|
|
|
import { TextLike, DynText, ToBe, LiveText } from './language' |
|
|
|
import { LogEntry, LogLines, FAElem, LogLine, FormatEntry, FormatOpt, PropElem, nilLog } from './interface' |
|
|
|
|
|
|
|
export enum DamageType { |
|
|
|
@@ -333,6 +333,8 @@ export interface VisibleStatus { |
|
|
|
name: TextLike; |
|
|
|
desc: TextLike; |
|
|
|
icon: TextLike; |
|
|
|
topLeft: string; |
|
|
|
bottomRight: string; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -343,6 +345,9 @@ export class ImplicitStatus implements VisibleStatus { |
|
|
|
constructor (public name: TextLike, public desc: TextLike, public icon: string) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
topLeft = '' |
|
|
|
bottomRight = '' |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -357,6 +362,9 @@ export abstract class StatusEffect implements VisibleStatus { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
get topLeft () { return '' } |
|
|
|
get bottomRight () { return '' } |
|
|
|
|
|
|
|
onApply (creature: Creature): LogEntry { return nilLog } |
|
|
|
onRemove (creature: Creature): LogEntry { return nilLog } |
|
|
|
preAction (creature: Creature): { prevented: boolean; log: LogEntry } { |
|
|
|
@@ -368,8 +376,13 @@ export abstract class StatusEffect implements VisibleStatus { |
|
|
|
} |
|
|
|
|
|
|
|
export class StunEffect extends StatusEffect { |
|
|
|
constructor () { |
|
|
|
super('Stun', 'Stunned!', 'fas fa-sun') |
|
|
|
constructor (private duration: number) { |
|
|
|
super('Stun', 'Cannot act!', 'fas fa-sun') |
|
|
|
this.desc = new DynText('Stunned for your next ', new LiveText(this, x => x.duration), ' actions!') |
|
|
|
} |
|
|
|
|
|
|
|
get topLeft () { |
|
|
|
return this.duration.toString() |
|
|
|
} |
|
|
|
|
|
|
|
onApply (creature: Creature) { |
|
|
|
@@ -381,7 +394,7 @@ export class StunEffect extends StatusEffect { |
|
|
|
} |
|
|
|
|
|
|
|
preAction (creature: Creature): { prevented: boolean; log: LogEntry } { |
|
|
|
if (Math.random() < 0.3) { |
|
|
|
if (--this.duration <= 0) { |
|
|
|
return { |
|
|
|
prevented: true, |
|
|
|
log: new LogLines( |
|
|
|
|