mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Force switch implemenation
This commit is contained in:
parent
360a897ed2
commit
656a51bcc8
@ -5979,7 +5979,21 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switchOutTarget.hp > 0) {
|
if (switchOutTarget.hp && SwitchType.FORCE_SWITCH) {
|
||||||
|
switchOutTarget.leaveField(this.switchType === SwitchType.FORCE_SWITCH);
|
||||||
|
const slotIndex = Utils.randIntRange(user.scene.currentBattle.getBattlerCount(), user.scene.getPlayerParty().length);
|
||||||
|
user.scene.unshiftPhase(
|
||||||
|
new SwitchSummonPhase(
|
||||||
|
user.scene,
|
||||||
|
this.switchType,
|
||||||
|
switchOutTarget.getFieldIndex(),
|
||||||
|
slotIndex,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (switchOutTarget.hp > 0 && !SwitchType.FORCE_SWITCH) {
|
||||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||||
user.scene.prependToPhase(new SwitchPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(), true, true), MoveEndPhase);
|
user.scene.prependToPhase(new SwitchPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(), true, true), MoveEndPhase);
|
||||||
return true;
|
return true;
|
||||||
@ -5990,8 +6004,21 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (switchOutTarget.hp && SwitchType.FORCE_SWITCH) {
|
||||||
if (switchOutTarget.hp > 0) {
|
switchOutTarget.leaveField(this.switchType === SwitchType.FORCE_SWITCH);
|
||||||
|
const slotIndex = Utils.randIntRange(user.scene.currentBattle.getBattlerCount(), user.scene.getEnemyParty().length);
|
||||||
|
user.scene.unshiftPhase(
|
||||||
|
new SwitchSummonPhase(
|
||||||
|
user.scene,
|
||||||
|
this.switchType,
|
||||||
|
switchOutTarget.getFieldIndex(),
|
||||||
|
slotIndex,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (switchOutTarget.hp > 0 && !SwitchType.FORCE_SWITCH) {
|
||||||
// for opponent switching out
|
// for opponent switching out
|
||||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||||
user.scene.prependToPhase(new SwitchSummonPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(),
|
user.scene.prependToPhase(new SwitchSummonPhase(user.scene, this.switchType, switchOutTarget.getFieldIndex(),
|
||||||
@ -7777,11 +7804,10 @@ export function initMoves() {
|
|||||||
.windMove(),
|
.windMove(),
|
||||||
new AttackMove(Moves.WING_ATTACK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 35, -1, 0, 1),
|
new AttackMove(Moves.WING_ATTACK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 35, -1, 0, 1),
|
||||||
new StatusMove(Moves.WHIRLWIND, Type.NORMAL, -1, 20, -1, -6, 1)
|
new StatusMove(Moves.WHIRLWIND, Type.NORMAL, -1, 20, -1, -6, 1)
|
||||||
.attr(ForceSwitchOutAttr)
|
.attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH)
|
||||||
.ignoresSubstitute()
|
.ignoresSubstitute()
|
||||||
.hidesTarget()
|
.hidesTarget()
|
||||||
.windMove()
|
.windMove(),
|
||||||
.partial(), // Should force random switches
|
|
||||||
new ChargingAttackMove(Moves.FLY, Type.FLYING, MoveCategory.PHYSICAL, 90, 95, 15, -1, 0, 1)
|
new ChargingAttackMove(Moves.FLY, Type.FLYING, MoveCategory.PHYSICAL, 90, 95, 15, -1, 0, 1)
|
||||||
.chargeText(i18next.t("moveTriggers:flewUpHigh", { pokemonName: "{USER}" }))
|
.chargeText(i18next.t("moveTriggers:flewUpHigh", { pokemonName: "{USER}" }))
|
||||||
.chargeAttr(SemiInvulnerableAttr, BattlerTagType.FLYING)
|
.chargeAttr(SemiInvulnerableAttr, BattlerTagType.FLYING)
|
||||||
@ -7857,10 +7883,9 @@ export function initMoves() {
|
|||||||
.soundBased()
|
.soundBased()
|
||||||
.target(MoveTarget.ALL_NEAR_ENEMIES),
|
.target(MoveTarget.ALL_NEAR_ENEMIES),
|
||||||
new StatusMove(Moves.ROAR, Type.NORMAL, -1, 20, -1, -6, 1)
|
new StatusMove(Moves.ROAR, Type.NORMAL, -1, 20, -1, -6, 1)
|
||||||
.attr(ForceSwitchOutAttr)
|
.attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH)
|
||||||
.soundBased()
|
.soundBased()
|
||||||
.hidesTarget()
|
.hidesTarget(),
|
||||||
.partial(), // Should force random switching
|
|
||||||
new StatusMove(Moves.SING, Type.NORMAL, 55, 15, -1, 0, 1)
|
new StatusMove(Moves.SING, Type.NORMAL, 55, 15, -1, 0, 1)
|
||||||
.attr(StatusEffectAttr, StatusEffect.SLEEP)
|
.attr(StatusEffectAttr, StatusEffect.SLEEP)
|
||||||
.soundBased(),
|
.soundBased(),
|
||||||
@ -9222,8 +9247,8 @@ export function initMoves() {
|
|||||||
.attr(StatStageChangeAttr, [ Stat.ATK ], 1, true)
|
.attr(StatStageChangeAttr, [ Stat.ATK ], 1, true)
|
||||||
.attr(StatStageChangeAttr, [ Stat.SPD ], 2, true),
|
.attr(StatStageChangeAttr, [ Stat.SPD ], 2, true),
|
||||||
new AttackMove(Moves.CIRCLE_THROW, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5)
|
new AttackMove(Moves.CIRCLE_THROW, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5)
|
||||||
.attr(ForceSwitchOutAttr)
|
.attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH)
|
||||||
.partial(), // Should force random switches
|
.hidesTarget(),
|
||||||
new AttackMove(Moves.INCINERATE, Type.FIRE, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 5)
|
new AttackMove(Moves.INCINERATE, Type.FIRE, MoveCategory.SPECIAL, 60, 100, 15, -1, 0, 5)
|
||||||
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
||||||
.attr(RemoveHeldItemAttr, true),
|
.attr(RemoveHeldItemAttr, true),
|
||||||
@ -9291,9 +9316,8 @@ export function initMoves() {
|
|||||||
new AttackMove(Moves.FROST_BREATH, Type.ICE, MoveCategory.SPECIAL, 60, 90, 10, 100, 0, 5)
|
new AttackMove(Moves.FROST_BREATH, Type.ICE, MoveCategory.SPECIAL, 60, 90, 10, 100, 0, 5)
|
||||||
.attr(CritOnlyAttr),
|
.attr(CritOnlyAttr),
|
||||||
new AttackMove(Moves.DRAGON_TAIL, Type.DRAGON, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5)
|
new AttackMove(Moves.DRAGON_TAIL, Type.DRAGON, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5)
|
||||||
.attr(ForceSwitchOutAttr)
|
.attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH)
|
||||||
.hidesTarget()
|
.hidesTarget(),
|
||||||
.partial(), // Should force random switches
|
|
||||||
new SelfStatusMove(Moves.WORK_UP, Type.NORMAL, -1, 30, -1, 0, 5)
|
new SelfStatusMove(Moves.WORK_UP, Type.NORMAL, -1, 30, -1, 0, 5)
|
||||||
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], 1, true),
|
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], 1, true),
|
||||||
new AttackMove(Moves.ELECTROWEB, Type.ELECTRIC, MoveCategory.SPECIAL, 55, 95, 15, 100, 0, 5)
|
new AttackMove(Moves.ELECTROWEB, Type.ELECTRIC, MoveCategory.SPECIAL, 55, 95, 15, 100, 0, 5)
|
||||||
|
@ -10,5 +10,8 @@ export enum SwitchType {
|
|||||||
/** Transfers stat stages and other effects from the returning Pokemon to the switched in Pokemon */
|
/** Transfers stat stages and other effects from the returning Pokemon to the switched in Pokemon */
|
||||||
BATON_PASS,
|
BATON_PASS,
|
||||||
/** Transfers the returning Pokemon's Substitute to the switched in Pokemon */
|
/** Transfers the returning Pokemon's Substitute to the switched in Pokemon */
|
||||||
SHED_TAIL
|
SHED_TAIL,
|
||||||
|
/** Force switchout to a random party member */
|
||||||
|
FORCE_SWITCH
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user