Merge pull request #2043 from ghoulslash/be/psychoshift

Psycho Shift uses CanBeStatused Functions
This commit is contained in:
Eduardo Quezada D'Ottone 2022-02-11 17:55:11 -03:00 committed by GitHub
commit 5c552cd070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 81 deletions

View file

@ -1532,7 +1532,7 @@ BattleScript_EffectPsychoShift:
BattleScript_EffectPsychoShiftCanWork: BattleScript_EffectPsychoShiftCanWork:
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
trypsychoshift BattleScript_MoveEnd trypsychoshift BattleScript_ButItFailed
attackanimation attackanimation
waitanimation waitanimation
copybyte gEffectBattler, gBattlerTarget copybyte gEffectBattler, gBattlerTarget

View file

@ -8657,89 +8657,17 @@ static void Cmd_various(void)
return; return;
case VARIOUS_PSYCHO_SHIFT: case VARIOUS_PSYCHO_SHIFT:
{ {
u16 targetAbility = GetBattlerAbility(gBattlerTarget); if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS && !CanBeParalyzed(gBattlerTarget))
i = TRUE; || (gBattleMons[gBattlerAttacker].status1 & STATUS1_PSN_ANY && !CanBePoisoned(gBattlerAttacker, gBattlerTarget))
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) || (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN && !CanBeBurned(gBattlerTarget))
|| (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP && !CanSleep(gBattlerTarget)))
{ {
if (targetAbility == ABILITY_LIMBER) // fails
{ gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_ELECTRIC))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
i = FALSE;
} }
else else
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = 3; // Psycho shift works
}
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_PSN_ANY)
{
if (targetAbility == ABILITY_IMMUNITY)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_STEEL))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
i = FALSE;
}
else
{
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_POISON)
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
else
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
}
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN)
{
if (targetAbility == ABILITY_WATER_VEIL
|| targetAbility == ABILITY_WATER_BUBBLE)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FIRE))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
i = FALSE;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
}
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP)
{
if (targetAbility == ABILITY_INSOMNIA || targetAbility == ABILITY_VITAL_SPIRIT)
{
gBattlerAbility = gBattlerTarget;
// BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
// gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
i = FALSE;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
}
}
if (i == TRUE)
{
gBattleMons[gBattlerTarget].status1 = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY; gBattleMons[gBattlerTarget].status1 = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY;
gActiveBattler = gBattlerTarget; gActiveBattler = gBattlerTarget;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1);