Fix sturdy
This commit is contained in:
parent
1bf2a725c9
commit
3dabfd3c55
|
@ -204,7 +204,7 @@ export class PreDefendFullHpEndureAbAttr extends PreDefendAbAttr {
|
|||
if (pokemon.getHpRatio() < 1 || (args[0] as Utils.NumberHolder).value < pokemon.hp)
|
||||
return false;
|
||||
|
||||
return pokemon.addTag(BattlerTagType.ENDURING, 1);
|
||||
return pokemon.addTag(BattlerTagType.STURDY, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -721,6 +721,21 @@ export class EnduringTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
export class SturdyTag extends BattlerTag {
|
||||
constructor(sourceMove: Moves) {
|
||||
super(BattlerTagType.STURDY, BattlerTagLapseType.TURN_END, 0, sourceMove);
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' endured\nthe hit!'));
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.lapse(pokemon, lapseType);
|
||||
}
|
||||
}
|
||||
|
||||
export class PerishSongTag extends BattlerTag {
|
||||
constructor(turnCount: integer) {
|
||||
super(BattlerTagType.PERISH_SONG, BattlerTagLapseType.TURN_END, turnCount, Moves.PERISH_SONG);
|
||||
|
@ -1013,6 +1028,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||
return new ContactBurnProtectedTag(sourceMove);
|
||||
case BattlerTagType.ENDURING:
|
||||
return new EnduringTag(sourceMove);
|
||||
case BattlerTagType.STURDY:
|
||||
return new SturdyTag(sourceMove);
|
||||
case BattlerTagType.PERISH_SONG:
|
||||
return new PerishSongTag(turnCount);
|
||||
case BattlerTagType.TRUANT:
|
||||
|
|
|
@ -29,6 +29,7 @@ export enum BattlerTagType {
|
|||
BANEFUL_BUNKER = "BANEFUL_BUNKER",
|
||||
BURNING_BULWARK = "BURNING_BULWARK",
|
||||
ENDURING = "ENDURING",
|
||||
STURDY = "STURDY",
|
||||
PERISH_SONG = "PERISH_SONG",
|
||||
TRUANT = "TRUANT",
|
||||
SLOW_START = "SLOW_START",
|
||||
|
|
|
@ -1284,11 +1284,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false): integer {
|
||||
if (this.isFainted())
|
||||
return 0;
|
||||
const surviveDamage = new Utils.BooleanHolder(false);
|
||||
|
||||
if (this.hp >= 1 && this.hp - damage <= 0 && !preventEndure) {
|
||||
const surviveDamage = new Utils.BooleanHolder(false);
|
||||
if (this.lapseTag(BattlerTagType.ENDURING))
|
||||
surviveDamage.value = true;
|
||||
if (!preventEndure && this.hp - damage <= 0) {
|
||||
if(this.hp >= 1 && this.getTag(BattlerTagType.ENDURING))
|
||||
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING)
|
||||
else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY))
|
||||
surviveDamage.value = this.lapseTag(BattlerTagType.STURDY)
|
||||
if (!surviveDamage.value)
|
||||
this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage);
|
||||
if (surviveDamage.value)
|
||||
|
|
Loading…
Reference in New Issue