2023-04-20 20:46:05 +01:00
|
|
|
import * as Utils from "../utils";
|
2023-04-12 00:08:03 +01:00
|
|
|
|
2023-04-04 04:38:31 +01:00
|
|
|
export enum StatusEffect {
|
|
|
|
NONE,
|
|
|
|
POISON,
|
|
|
|
TOXIC,
|
|
|
|
PARALYSIS,
|
|
|
|
SLEEP,
|
|
|
|
FREEZE,
|
2023-04-16 23:40:32 +01:00
|
|
|
BURN,
|
|
|
|
FAINT
|
2023-04-04 04:38:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Status {
|
2023-04-12 00:08:03 +01:00
|
|
|
public effect: StatusEffect;
|
2023-04-04 04:38:31 +01:00
|
|
|
public turnCount: integer;
|
2023-04-12 00:08:03 +01:00
|
|
|
public cureTurn: integer;
|
|
|
|
|
|
|
|
constructor(effect: StatusEffect) {
|
|
|
|
this.effect = effect;
|
|
|
|
this.turnCount = 0;
|
|
|
|
if (effect === StatusEffect.SLEEP)
|
|
|
|
this.cureTurn = Utils.randInt(3, 1);
|
|
|
|
}
|
2023-04-04 04:38:31 +01:00
|
|
|
|
2023-04-12 00:08:03 +01:00
|
|
|
incrementTurn(): void {
|
|
|
|
this.turnCount++;
|
2023-04-04 04:38:31 +01:00
|
|
|
}
|
2023-04-12 00:08:03 +01:00
|
|
|
|
|
|
|
isPostTurn(): boolean {
|
|
|
|
return this.effect === StatusEffect.POISON || this.effect === StatusEffect.TOXIC || this.effect === StatusEffect.BURN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getStatusEffectObtainText(statusEffect: StatusEffect): string {
|
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
return '\nwas poisoned!';
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
return '\nwas badly poisoned!';
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
return ' is paralyzed!\nIt may be unable to move!';
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
return '\nfell asleep!';
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return '\nwas frozen solid!';
|
|
|
|
case StatusEffect.BURN:
|
|
|
|
return '\nwas burned!';
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getStatusEffectActivationText(statusEffect: StatusEffect): string {
|
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
return ' is hurt\nby poison!';
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
return ' is paralyzed!\nIt can\'t move!';
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
return ' is fast asleep.';
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return ' is\nfrozen solid!';
|
|
|
|
case StatusEffect.BURN:
|
|
|
|
return ' is hurt\nby its burn!';
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getStatusEffectOverlapText(statusEffect: StatusEffect): string {
|
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
return ' is\nalready poisoned!';
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
return ' is\nalready paralyzed!';
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
return ' is\nalready asleep!';
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return ' is\nalready frozen!';
|
|
|
|
case StatusEffect.BURN:
|
|
|
|
return ' is\nalready burned!';
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2023-04-21 00:44:56 +01:00
|
|
|
export function getStatusEffectHealText(statusEffect: StatusEffect): string {
|
2023-04-12 00:08:03 +01:00
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
return ' was\ncured of its poison!';
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
return ' was\nhealed of paralysis!';
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
return ' woke up!';
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return ' was\ndefrosted!';
|
|
|
|
case StatusEffect.BURN:
|
2023-04-21 03:26:38 +01:00
|
|
|
return ' was\nhealed of its burn!';
|
2023-04-12 00:08:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
2023-04-19 03:09:37 +01:00
|
|
|
}
|
|
|
|
|
2023-04-21 00:44:56 +01:00
|
|
|
export function getStatusEffectDescriptor(statusEffect: StatusEffect): string {
|
2023-04-19 21:52:14 +01:00
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
return 'poisoning';
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
return 'paralysis';
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
return 'sleep';
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return 'freezing';
|
|
|
|
case StatusEffect.BURN:
|
|
|
|
return 'burn';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-21 00:44:56 +01:00
|
|
|
export function getStatusEffectCatchRateMultiplier(statusEffect: StatusEffect): number {
|
2023-04-19 03:09:37 +01:00
|
|
|
switch (statusEffect) {
|
|
|
|
case StatusEffect.POISON:
|
|
|
|
case StatusEffect.TOXIC:
|
|
|
|
case StatusEffect.PARALYSIS:
|
|
|
|
case StatusEffect.BURN:
|
|
|
|
return 1.5;
|
|
|
|
case StatusEffect.SLEEP:
|
|
|
|
case StatusEffect.FREEZE:
|
|
|
|
return 2.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2023-04-04 04:38:31 +01:00
|
|
|
}
|