mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 13:59:27 +02:00
Add counterRedirectAttr to other counter-like moves
This commit is contained in:
parent
7207c3b6ab
commit
d74a70a529
@ -1851,21 +1851,18 @@ export class CounterRedirectAttr extends MoveAttr {
|
|||||||
// check if the target is still alive
|
// check if the target is still alive
|
||||||
if (
|
if (
|
||||||
globalScene.currentBattle.double &&
|
globalScene.currentBattle.double &&
|
||||||
!globalScene.getField()[desiredTarget]?.isActive
|
!globalScene.getField()[desiredTarget]?.isActive(true)
|
||||||
) {
|
) {
|
||||||
const targetField = desiredTarget >= BattlerIndex.ENEMY ? globalScene.getEnemyField() : globalScene.getPlayerField();
|
const targetField = desiredTarget >= BattlerIndex.ENEMY ? globalScene.getEnemyField() : globalScene.getPlayerField();
|
||||||
args[0].value = targetField.find(p => p.hp > 0)?.getBattlerIndex() ?? BattlerIndex.ATTACKER;
|
args[0].value = targetField.find(p => p.hp > 0)?.getBattlerIndex() ?? BattlerIndex.ATTACKER;
|
||||||
} else {
|
} else {
|
||||||
args[0].value = desiredTarget;
|
args[0].value = desiredTarget;
|
||||||
}
|
}
|
||||||
|
console.log(`CounterRedirectAttr: Redirecting move to battler index ${BattlerIndex[args[0].value]}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
override canApply(user: Pokemon, target: Pokemon, move: Move, args: [NumberHolder, ...any[]]): boolean {
|
|
||||||
return args[0].value === BattlerIndex.ATTACKER;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LevelDamageAttr extends FixedDamageAttr {
|
export class LevelDamageAttr extends FixedDamageAttr {
|
||||||
@ -9387,6 +9384,7 @@ export function initMoves() {
|
|||||||
.bitingMove(),
|
.bitingMove(),
|
||||||
new AttackMove(MoveId.MIRROR_COAT, PokemonType.PSYCHIC, MoveCategory.SPECIAL, -1, 100, 20, -1, -5, 2)
|
new AttackMove(MoveId.MIRROR_COAT, PokemonType.PSYCHIC, MoveCategory.SPECIAL, -1, 100, 20, -1, -5, 2)
|
||||||
.attr(CounterDamageAttr, 2, MoveCategory.SPECIAL)
|
.attr(CounterDamageAttr, 2, MoveCategory.SPECIAL)
|
||||||
|
.attr(CounterRedirectAttr, MoveCategory.SPECIAL)
|
||||||
.condition(counterAttackCondition_Special, 3)
|
.condition(counterAttackCondition_Special, 3)
|
||||||
.target(MoveTarget.ATTACKER),
|
.target(MoveTarget.ATTACKER),
|
||||||
new StatusMove(MoveId.PSYCH_UP, PokemonType.NORMAL, -1, 10, -1, 0, 2)
|
new StatusMove(MoveId.PSYCH_UP, PokemonType.NORMAL, -1, 10, -1, 0, 2)
|
||||||
@ -9805,6 +9803,7 @@ export function initMoves() {
|
|||||||
.target(MoveTarget.USER_OR_NEAR_ALLY),
|
.target(MoveTarget.USER_OR_NEAR_ALLY),
|
||||||
new AttackMove(MoveId.METAL_BURST, PokemonType.STEEL, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 4)
|
new AttackMove(MoveId.METAL_BURST, PokemonType.STEEL, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 4)
|
||||||
.attr(CounterDamageAttr, 1.5)
|
.attr(CounterDamageAttr, 1.5)
|
||||||
|
.attr(CounterRedirectAttr)
|
||||||
.condition(counterAttackCondition_Both, 3)
|
.condition(counterAttackCondition_Both, 3)
|
||||||
.makesContact(false)
|
.makesContact(false)
|
||||||
.target(MoveTarget.ATTACKER),
|
.target(MoveTarget.ATTACKER),
|
||||||
@ -11622,6 +11621,7 @@ export function initMoves() {
|
|||||||
.restriction(ConsecutiveUseRestriction),
|
.restriction(ConsecutiveUseRestriction),
|
||||||
new AttackMove(MoveId.COMEUPPANCE, PokemonType.DARK, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 9)
|
new AttackMove(MoveId.COMEUPPANCE, PokemonType.DARK, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 9)
|
||||||
.attr(CounterDamageAttr, 1.5)
|
.attr(CounterDamageAttr, 1.5)
|
||||||
|
.attr(CounterRedirectAttr)
|
||||||
.condition(counterAttackCondition_Both, 3)
|
.condition(counterAttackCondition_Both, 3)
|
||||||
.target(MoveTarget.ATTACKER),
|
.target(MoveTarget.ATTACKER),
|
||||||
new AttackMove(MoveId.AQUA_CUTTER, PokemonType.WATER, MoveCategory.PHYSICAL, 70, 100, 20, -1, 0, 9)
|
new AttackMove(MoveId.AQUA_CUTTER, PokemonType.WATER, MoveCategory.PHYSICAL, 70, 100, 20, -1, 0, 9)
|
||||||
|
@ -912,6 +912,7 @@ export class MovePhase extends BattlePhase {
|
|||||||
*/
|
*/
|
||||||
protected resolveCounterAttackTarget(): void {
|
protected resolveCounterAttackTarget(): void {
|
||||||
if (this.targets.length !== 1 || this.targets[0] !== BattlerIndex.ATTACKER) {
|
if (this.targets.length !== 1 || this.targets[0] !== BattlerIndex.ATTACKER) {
|
||||||
|
console.log("%cSkipping counter attack target resolution", "color: blue");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,6 +921,7 @@ export class MovePhase extends BattlePhase {
|
|||||||
applyMoveAttrs("CounterRedirectAttr", this.pokemon, null, this.move.getMove(), targetHolder);
|
applyMoveAttrs("CounterRedirectAttr", this.pokemon, null, this.move.getMove(), targetHolder);
|
||||||
this.targets[0] = targetHolder.value;
|
this.targets[0] = targetHolder.value;
|
||||||
if (targetHolder.value === BattlerIndex.ATTACKER) {
|
if (targetHolder.value === BattlerIndex.ATTACKER) {
|
||||||
|
console.log("%cSkipping counter attack target resolution", "color: red");
|
||||||
this.fail();
|
this.fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user