implemented Dancer Ability
parent
582330df33
commit
9efb2b834f
|
@ -2,7 +2,7 @@ import Pokemon, { HitResult, PokemonMove } from "../field/pokemon";
|
|||
import { Type } from "./type";
|
||||
import * as Utils from "../utils";
|
||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||
import { PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases";
|
||||
import {MovePhase, PokemonHealPhase, ShowAbilityPhase, StatChangePhase} from "../phases";
|
||||
import { getPokemonMessage } from "../messages";
|
||||
import { Weather, WeatherType } from "./weather";
|
||||
import { BattlerTag } from "./battler-tags";
|
||||
|
@ -22,6 +22,7 @@ import i18next, { Localizable } from "#app/plugins/i18n.js";
|
|||
import { Command } from "../ui/command-ui-handler";
|
||||
import Battle from "#app/battle.js";
|
||||
import { ability } from "#app/locales/en/ability.js";
|
||||
import {BattlerIndex} from "#app/battle";
|
||||
|
||||
export class Ability implements Localizable {
|
||||
public id: Abilities;
|
||||
|
@ -2126,6 +2127,30 @@ export class PostBiomeChangeTerrainChangeAbAttr extends PostBiomeChangeAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class PostMoveUsedAbAttr extends AbAttr {
|
||||
applyPostMoveUsed(pokemon: Pokemon, move: PokemonMove, source: Pokemon, args: any[]): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr {
|
||||
applyPostMoveUsed(dancer: Pokemon, move: PokemonMove, source: Pokemon, args: any[]): boolean | Promise<boolean> {
|
||||
const selfDance: Moves[] = [ Moves.DRAGON_DANCE, Moves.SWORDS_DANCE,
|
||||
Moves.TEETER_DANCE, Moves.VICTORY_DANCE, Moves.QUIVER_DANCE, Moves.CLANGOROUS_SOUL, Moves.LUNAR_DANCE];
|
||||
const attackingDance: Moves[] = [ Moves.AQUA_STEP, Moves.PETAL_DANCE, Moves.FIERY_DANCE, Moves.REVELATION_DANCE, Moves.FEATHER_DANCE];
|
||||
if (source.getBattlerIndex() !== dancer.getBattlerIndex()) {
|
||||
if (attackingDance.includes(move.getMove().id)) {
|
||||
const target= source.getBattlerIndex() === BattlerIndex.PLAYER || BattlerIndex.PLAYER_2 ?
|
||||
dancer.scene.getEnemyPokemon().getBattlerIndex() : BattlerIndex.ATTACKER;
|
||||
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [target], move));
|
||||
} else if (selfDance.includes(move.getMove().id)) {
|
||||
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [dancer.getBattlerIndex()], move));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class StatChangeMultiplierAbAttr extends AbAttr {
|
||||
private multiplier: integer;
|
||||
|
||||
|
@ -2575,6 +2600,11 @@ export function applyPostDefendAbAttrs(attrType: { new(...args: any[]): PostDefe
|
|||
return applyAbAttrsInternal<PostDefendAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostDefend(pokemon, passive, attacker, move, hitResult, args), args);
|
||||
}
|
||||
|
||||
export function applyPostMoveUsedAbAttrs(attrType: { new(...args: any[]): PostMoveUsedAbAttr },
|
||||
pokemon: Pokemon, move: PokemonMove, source: Pokemon, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<PostMoveUsedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostMoveUsed(pokemon, move, source, args), args);
|
||||
}
|
||||
|
||||
export function applyBattleStatMultiplierAbAttrs(attrType: { new(...args: any[]): BattleStatMultiplierAbAttr },
|
||||
pokemon: Pokemon, battleStat: BattleStat, statValue: Utils.NumberHolder, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<BattleStatMultiplierAbAttr>(attrType, pokemon, (attr, passive) => attr.applyBattleStat(pokemon, passive, battleStat, statValue, args), args);
|
||||
|
@ -3318,7 +3348,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.INNARDS_OUT, 7)
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.DANCER, 7)
|
||||
.unimplemented(),
|
||||
.attr(PostDancingMoveAbAttr),
|
||||
new Ability(Abilities.BATTERY, 7)
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.FLUFFY, 7)
|
||||
|
|
|
@ -30,7 +30,7 @@ import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, get
|
|||
import { TempBattleStat } from "./data/temp-battle-stat";
|
||||
import { ArenaTagSide, ArenaTrapTag, MistTag, TrickRoomTag } from "./data/arena-tag";
|
||||
import { ArenaTagType } from "./data/enums/arena-tag-type";
|
||||
import { CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostAttackAbAttr, PostBattleAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreSwitchOutAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, RedirectMoveAbAttr, RunSuccessAbAttr, StatChangeMultiplierAbAttr, SuppressWeatherEffectAbAttr, SyncEncounterNatureAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostAttackAbAttrs, applyPostBattleAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreSwitchOutAbAttrs, applyPreWeatherEffectAbAttrs, BattleStatMultiplierAbAttr, applyBattleStatMultiplierAbAttrs, IncrementMovePriorityAbAttr, applyPostVictoryAbAttrs, PostVictoryAbAttr, applyPostBattleInitAbAttrs, PostBattleInitAbAttr, BlockNonDirectDamageAbAttr as BlockNonDirectDamageAbAttr, applyPostKnockOutAbAttrs, PostKnockOutAbAttr, PostBiomeChangeAbAttr, applyPostFaintAbAttrs, PostFaintAbAttr, IncreasePpAbAttr, PostStatChangeAbAttr, applyPostStatChangeAbAttrs, AlwaysHitAbAttr, PreventBerryUseAbAttr, StatChangeCopyAbAttr } from "./data/ability";
|
||||
import { CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostAttackAbAttr, PostBattleAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreSwitchOutAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, RedirectMoveAbAttr, RunSuccessAbAttr, StatChangeMultiplierAbAttr, SuppressWeatherEffectAbAttr, SyncEncounterNatureAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostAttackAbAttrs, applyPostBattleAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreSwitchOutAbAttrs, applyPreWeatherEffectAbAttrs, BattleStatMultiplierAbAttr, applyBattleStatMultiplierAbAttrs, IncrementMovePriorityAbAttr, applyPostVictoryAbAttrs, PostVictoryAbAttr, applyPostBattleInitAbAttrs, PostBattleInitAbAttr, BlockNonDirectDamageAbAttr as BlockNonDirectDamageAbAttr, applyPostKnockOutAbAttrs, PostKnockOutAbAttr, PostBiomeChangeAbAttr, applyPostFaintAbAttrs, PostFaintAbAttr, IncreasePpAbAttr, PostStatChangeAbAttr, applyPostStatChangeAbAttrs, AlwaysHitAbAttr, PreventBerryUseAbAttr, StatChangeCopyAbAttr, applyPostMoveUsedAbAttrs, PostMoveUsedAbAttr} from "./data/ability";
|
||||
import { Unlockables, getUnlockableName } from "./system/unlockables";
|
||||
import { getBiomeKey } from "./field/arena";
|
||||
import { BattleType, BattlerIndex, TurnCommand } from "./battle";
|
||||
|
@ -2292,7 +2292,10 @@ export class MovePhase extends BattlePhase {
|
|||
if (!cancelled.value)
|
||||
this.showFailedText(failedText);
|
||||
}
|
||||
|
||||
this.scene.getPlayerField().forEach(pokemon => {
|
||||
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon);
|
||||
})
|
||||
|
||||
this.end();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue