mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
Implement Perish Song
This commit is contained in:
parent
a774fa69d5
commit
721ec6e8a9
@ -1,7 +1,7 @@
|
|||||||
import { CommonAnim, CommonBattleAnim } from "./battle-anims";
|
import { CommonAnim, CommonBattleAnim } from "./battle-anims";
|
||||||
import { CommonAnimPhase, DamagePhase, MovePhase, ObtainStatusEffectPhase, PokemonHealPhase, ShowAbilityPhase } from "../battle-phases";
|
import { CommonAnimPhase, DamagePhase, MovePhase, ObtainStatusEffectPhase, PokemonHealPhase, ShowAbilityPhase } from "../battle-phases";
|
||||||
import { getPokemonMessage } from "../messages";
|
import { getPokemonMessage } from "../messages";
|
||||||
import Pokemon, { MoveResult } from "../pokemon";
|
import Pokemon, { MoveResult, HitResult } from "../pokemon";
|
||||||
import { Stat } from "./pokemon-stat";
|
import { Stat } from "./pokemon-stat";
|
||||||
import { StatusEffect } from "./status-effect";
|
import { StatusEffect } from "./status-effect";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
@ -31,6 +31,7 @@ export enum BattlerTagType {
|
|||||||
SAND_TOMB,
|
SAND_TOMB,
|
||||||
MAGMA_STORM,
|
MAGMA_STORM,
|
||||||
PROTECTED,
|
PROTECTED,
|
||||||
|
PERISH_SONG,
|
||||||
TRUANT,
|
TRUANT,
|
||||||
FLYING,
|
FLYING,
|
||||||
UNDERGROUND,
|
UNDERGROUND,
|
||||||
@ -596,6 +597,25 @@ export class ProtectedTag extends BattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class PerishSongTag extends BattlerTag {
|
||||||
|
constructor(turnCount: integer) {
|
||||||
|
super(BattlerTagType.PERISH_SONG, BattlerTagLapseType.TURN_END, turnCount, Moves.PERISH_SONG);
|
||||||
|
}
|
||||||
|
|
||||||
|
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
|
const ret = super.lapse(pokemon, lapseType);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
pokemon.scene.queueMessage(getPokemonMessage(pokemon, `\'s perish count fell to ${this.turnCount}.`));
|
||||||
|
else {
|
||||||
|
pokemon.scene.unshiftPhase(new DamagePhase(pokemon.scene, pokemon.getBattlerIndex(), HitResult.ONE_HIT_KO));
|
||||||
|
pokemon.damage(pokemon.hp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class TruantTag extends BattlerTag {
|
export class TruantTag extends BattlerTag {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(BattlerTagType.TRUANT, BattlerTagLapseType.MOVE, 1, undefined);
|
super(BattlerTagType.TRUANT, BattlerTagLapseType.MOVE, 1, undefined);
|
||||||
@ -721,6 +741,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||||||
return new MagmaStormTag(turnCount, sourceId);
|
return new MagmaStormTag(turnCount, sourceId);
|
||||||
case BattlerTagType.PROTECTED:
|
case BattlerTagType.PROTECTED:
|
||||||
return new ProtectedTag(sourceMove);
|
return new ProtectedTag(sourceMove);
|
||||||
|
case BattlerTagType.PERISH_SONG:
|
||||||
|
return new PerishSongTag(turnCount);
|
||||||
case BattlerTagType.TRUANT:
|
case BattlerTagType.TRUANT:
|
||||||
return new TruantTag();
|
return new TruantTag();
|
||||||
case BattlerTagType.FLYING:
|
case BattlerTagType.FLYING:
|
||||||
|
@ -1785,7 +1785,7 @@ export class ClearWeatherAttr extends MoveEffectAttr {
|
|||||||
|
|
||||||
export class OneHitKOAttr extends MoveAttr {
|
export class OneHitKOAttr extends MoveAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
if (target.species.speciesId === Species.ETERNATUS && target.formIndex === 1)
|
if (target.isBossImmune())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
(args[0] as Utils.BooleanHolder).value = true;
|
(args[0] as Utils.BooleanHolder).value = true;
|
||||||
@ -2382,6 +2382,8 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
|
|||||||
return -5;
|
return -5;
|
||||||
case BattlerTagType.FRENZY:
|
case BattlerTagType.FRENZY:
|
||||||
return -2;
|
return -2;
|
||||||
|
case BattlerTagType.ENCORE:
|
||||||
|
return -2;
|
||||||
case BattlerTagType.INGRAIN:
|
case BattlerTagType.INGRAIN:
|
||||||
return 3;
|
return 3;
|
||||||
case BattlerTagType.AQUA_RING:
|
case BattlerTagType.AQUA_RING:
|
||||||
@ -2398,7 +2400,9 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
|
|||||||
case BattlerTagType.MAGMA_STORM:
|
case BattlerTagType.MAGMA_STORM:
|
||||||
return -3;
|
return -3;
|
||||||
case BattlerTagType.PROTECTED:
|
case BattlerTagType.PROTECTED:
|
||||||
return 10;
|
return 5;
|
||||||
|
case BattlerTagType.PERISH_SONG:
|
||||||
|
return -8;
|
||||||
case BattlerTagType.FLYING:
|
case BattlerTagType.FLYING:
|
||||||
return 5;
|
return 5;
|
||||||
case BattlerTagType.CRIT_BOOST:
|
case BattlerTagType.CRIT_BOOST:
|
||||||
@ -2483,6 +2487,25 @@ export class IgnoreAccuracyAttr extends AddBattlerTagAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class FaintCountdownAttr extends AddBattlerTagAttr {
|
||||||
|
constructor() {
|
||||||
|
super(BattlerTagType.PERISH_SONG, false, 4, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
if (!super.apply(user, target, move, args))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
user.scene.queueMessage(getPokemonMessage(target, `\nwill faint in ${this.turnCount - 1} turns.`));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCondition(): MoveCondition {
|
||||||
|
return (user, target, move) => super.getCondition()(user, target, move) && !target.isBossImmune();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class HitsTagAttr extends MoveAttr {
|
export class HitsTagAttr extends MoveAttr {
|
||||||
public tagType: BattlerTagType;
|
public tagType: BattlerTagType;
|
||||||
public doubleDamage: boolean;
|
public doubleDamage: boolean;
|
||||||
@ -3412,7 +3435,8 @@ export function initMoves() {
|
|||||||
new StatusMove(Moves.FORESIGHT, "Foresight (N)", Type.NORMAL, -1, 40, -1, "Enables a Ghost-type target to be hit by Normal- and Fighting-type attacks. This also enables an evasive target to be hit.", -1, 0, 2),
|
new StatusMove(Moves.FORESIGHT, "Foresight (N)", Type.NORMAL, -1, 40, -1, "Enables a Ghost-type target to be hit by Normal- and Fighting-type attacks. This also enables an evasive target to be hit.", -1, 0, 2),
|
||||||
new SelfStatusMove(Moves.DESTINY_BOND, "Destiny Bond (N)", Type.GHOST, -1, 5, -1, "After using this move, if the user faints, the Pokémon that landed the knockout hit also faints. Its chance of failing rises if it is used in succession.", -1, 0, 2)
|
new SelfStatusMove(Moves.DESTINY_BOND, "Destiny Bond (N)", Type.GHOST, -1, 5, -1, "After using this move, if the user faints, the Pokémon that landed the knockout hit also faints. Its chance of failing rises if it is used in succession.", -1, 0, 2)
|
||||||
.ignoresProtect(),
|
.ignoresProtect(),
|
||||||
new StatusMove(Moves.PERISH_SONG, "Perish Song (N)", Type.NORMAL, -1, 5, -1, "Any Pokémon that hears this song faints in three turns, unless it switches out of battle.", -1, 0, 2)
|
new StatusMove(Moves.PERISH_SONG, "Perish Song", Type.NORMAL, -1, 5, -1, "Any Pokémon that hears this song faints in three turns, unless it switches out of battle.", -1, 0, 2)
|
||||||
|
.attr(FaintCountdownAttr)
|
||||||
.ignoresProtect()
|
.ignoresProtect()
|
||||||
.soundBased()
|
.soundBased()
|
||||||
.target(MoveTarget.ALL),
|
.target(MoveTarget.ALL),
|
||||||
|
@ -1035,6 +1035,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.hp = Math.min(this.hp + amount, this.getMaxHp());
|
this.hp = Math.min(this.hp + amount, this.getMaxHp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBossImmune(): boolean {
|
||||||
|
return this.species.speciesId === Species.ETERNATUS && this.formIndex === 1;
|
||||||
|
}
|
||||||
|
|
||||||
addTag(tagType: BattlerTagType, turnCount?: integer, sourceMove?: Moves, sourceId?: integer): boolean {
|
addTag(tagType: BattlerTagType, turnCount?: integer, sourceMove?: Moves, sourceId?: integer): boolean {
|
||||||
const existingTag = this.getTag(tagType);
|
const existingTag = this.getTag(tagType);
|
||||||
if (existingTag) {
|
if (existingTag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user