mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-11 10:52:17 +02:00
corrected target selection for double battles, improved ability detection
This commit is contained in:
parent
9efb2b834f
commit
c5a27281e2
@ -9,7 +9,7 @@ import { BattlerTag } from "./battler-tags";
|
|||||||
import { BattlerTagType } from "./enums/battler-tag-type";
|
import { BattlerTagType } from "./enums/battler-tag-type";
|
||||||
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||||
import { Gender } from "./gender";
|
import { Gender } from "./gender";
|
||||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove } from "./move";
|
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove, SelfStatusMove} from "./move";
|
||||||
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
||||||
import { ArenaTagType } from "./enums/arena-tag-type";
|
import { ArenaTagType } from "./enums/arena-tag-type";
|
||||||
import { Stat } from "./pokemon-stat";
|
import { Stat } from "./pokemon-stat";
|
||||||
@ -2128,27 +2128,29 @@ export class PostBiomeChangeTerrainChangeAbAttr extends PostBiomeChangeAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostMoveUsedAbAttr extends AbAttr {
|
export class PostMoveUsedAbAttr extends AbAttr {
|
||||||
applyPostMoveUsed(pokemon: Pokemon, move: PokemonMove, source: Pokemon, args: any[]): boolean | Promise<boolean> {
|
applyPostMoveUsed(pokemon: Pokemon, move: PokemonMove, source: Pokemon, targets: BattlerIndex[], args: any[]): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr {
|
export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr {
|
||||||
applyPostMoveUsed(dancer: Pokemon, move: PokemonMove, source: Pokemon, args: any[]): boolean | Promise<boolean> {
|
applyPostMoveUsed(dancer: Pokemon, move: PokemonMove, source: Pokemon, targets: BattlerIndex[], 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 (source.getBattlerIndex() !== dancer.getBattlerIndex()) {
|
||||||
if (attackingDance.includes(move.getMove().id)) {
|
if (move.getMove() instanceof AttackMove || move instanceof StatusMove) {
|
||||||
const target= source.getBattlerIndex() === BattlerIndex.PLAYER || BattlerIndex.PLAYER_2 ?
|
const target = this.getTarget(dancer, source, targets);
|
||||||
dancer.scene.getEnemyPokemon().getBattlerIndex() : BattlerIndex.ATTACKER;
|
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, target, move, true));
|
||||||
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [target], move));
|
} else if (move.getMove() instanceof SelfStatusMove) {
|
||||||
} else if (selfDance.includes(move.getMove().id)) {
|
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [dancer.getBattlerIndex()], move, true));
|
||||||
dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [dancer.getBattlerIndex()], move));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTarget(dancer: Pokemon, source: Pokemon, targets: BattlerIndex[]) : BattlerIndex[] {
|
||||||
|
if (dancer.isPlayer())
|
||||||
|
return source.isPlayer() ? targets : [source.getBattlerIndex()];
|
||||||
|
return source.isPlayer() ? [source.getBattlerIndex()] : targets;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StatChangeMultiplierAbAttr extends AbAttr {
|
export class StatChangeMultiplierAbAttr extends AbAttr {
|
||||||
@ -2601,8 +2603,8 @@ export function applyPostDefendAbAttrs(attrType: { new(...args: any[]): PostDefe
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyPostMoveUsedAbAttrs(attrType: { new(...args: any[]): PostMoveUsedAbAttr },
|
export function applyPostMoveUsedAbAttrs(attrType: { new(...args: any[]): PostMoveUsedAbAttr },
|
||||||
pokemon: Pokemon, move: PokemonMove, source: Pokemon, ...args: any[]): Promise<void> {
|
pokemon: Pokemon, move: PokemonMove, source: Pokemon, targets: BattlerIndex[], ...args: any[]): Promise<void> {
|
||||||
return applyAbAttrsInternal<PostMoveUsedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostMoveUsed(pokemon, move, source, args), args);
|
return applyAbAttrsInternal<PostMoveUsedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostMoveUsed(pokemon, move, source, targets, args), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyBattleStatMultiplierAbAttrs(attrType: { new(...args: any[]): BattleStatMultiplierAbAttr },
|
export function applyBattleStatMultiplierAbAttrs(attrType: { new(...args: any[]): BattleStatMultiplierAbAttr },
|
||||||
|
@ -2185,7 +2185,7 @@ export class MovePhase extends BattlePhase {
|
|||||||
console.log(Moves[this.move.moveId]);
|
console.log(Moves[this.move.moveId]);
|
||||||
|
|
||||||
if (!this.canMove()) {
|
if (!this.canMove()) {
|
||||||
if (this.move.moveId && this.pokemon.summonData.disabledMove === this.move.moveId)
|
if (this.move.moveId && this.pokemon.summonData?.disabledMove === this.move.moveId)
|
||||||
this.scene.queueMessage(`${this.move.getName()} is disabled!`);
|
this.scene.queueMessage(`${this.move.getName()} is disabled!`);
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
@ -2292,9 +2292,14 @@ export class MovePhase extends BattlePhase {
|
|||||||
if (!cancelled.value)
|
if (!cancelled.value)
|
||||||
this.showFailedText(failedText);
|
this.showFailedText(failedText);
|
||||||
}
|
}
|
||||||
this.scene.getPlayerField().forEach(pokemon => {
|
if (this.move.getMove().hasFlag(MoveFlags.DANCE_MOVE) && !this.followUp) {
|
||||||
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon);
|
this.scene.getPlayerField().forEach(pokemon => {
|
||||||
})
|
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets);
|
||||||
|
})
|
||||||
|
this.scene.getEnemyParty().forEach(pokemon => {
|
||||||
|
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user