Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into prankster
This commit is contained in:
commit
85f3982fb9
7 changed files with 38 additions and 13 deletions
|
@ -4286,6 +4286,7 @@ BattleScript_EffectWillOWisp::
|
|||
jumpifstatus BS_TARGET, STATUS1_BURN, BattleScript_AlreadyBurned
|
||||
jumpiftype BS_TARGET, TYPE_FIRE, BattleScript_NotAffected
|
||||
jumpifability BS_TARGET, ABILITY_WATER_VEIL, BattleScript_WaterVeilPrevents
|
||||
jumpifability BS_TARGET, ABILITY_WATER_BUBBLE, BattleScript_WaterVeilPrevents
|
||||
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
|
||||
jumpifflowerveil BattleScript_FlowerVeilProtects
|
||||
jumpifleafguard BattleScript_LeafGuardProtects
|
||||
|
@ -4300,6 +4301,7 @@ BattleScript_EffectWillOWisp::
|
|||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_WaterVeilPrevents::
|
||||
call BattleScript_AbilityPopUp
|
||||
copybyte gEffectBattler, gBattlerTarget
|
||||
setbyte cMULTISTRING_CHOOSER, B_MSG_ABILITY_PREVENTS_MOVE_STATUS
|
||||
call BattleScript_BRNPrevention
|
||||
|
@ -6621,9 +6623,11 @@ BattleScript_DefiantActivates::
|
|||
return
|
||||
|
||||
BattleScript_AbilityPopUp:
|
||||
.if B_ABILITY_POP_UP == TRUE
|
||||
showabilitypopup BS_ABILITY_BATTLER
|
||||
recordability BS_ABILITY_BATTLER
|
||||
pause 40
|
||||
.endif
|
||||
sethword sABILITY_OVERWRITE, 0
|
||||
return
|
||||
|
||||
|
@ -6983,6 +6987,7 @@ BattleScript_MoveStatDrain::
|
|||
waitanimation
|
||||
printstring STRINGID_TARGETABILITYSTATRAISE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_MonMadeMoveUseless_PPLoss::
|
||||
|
@ -6993,6 +6998,7 @@ BattleScript_MonMadeMoveUseless::
|
|||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_PKMNSXMADEYUSELESS
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
|
@ -7004,6 +7010,7 @@ BattleScript_FlashFireBoost::
|
|||
call BattleScript_AbilityPopUp
|
||||
printfromtable gFlashFireStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_AbilityPreventsPhasingOut::
|
||||
|
|
|
@ -217,7 +217,6 @@ struct FieldTimer
|
|||
u8 mistyTerrainTimer;
|
||||
u8 electricTerrainTimer;
|
||||
u8 psychicTerrainTimer;
|
||||
u8 echoVoiceCounter;
|
||||
u8 gravityTimer;
|
||||
u8 fairyLockTimer;
|
||||
};
|
||||
|
|
|
@ -795,6 +795,9 @@ static bool8 ShouldUseItem(void)
|
|||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT)
|
||||
return FALSE;
|
||||
|
||||
if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO)
|
||||
return FALSE;
|
||||
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
||||
party = gPlayerParty;
|
||||
|
|
|
@ -821,7 +821,7 @@ static bool8 DoesAbilityPreventStatus(struct Pokemon *mon, u32 status)
|
|||
ret = TRUE;
|
||||
break;
|
||||
case STATUS1_BURN:
|
||||
if (ability == ABILITY_WATER_VEIL)
|
||||
if (ability == ABILITY_WATER_VEIL || ability == ABILITY_WATER_BUBBLE)
|
||||
ret = TRUE;
|
||||
break;
|
||||
case STATUS1_PARALYSIS:
|
||||
|
|
|
@ -1743,7 +1743,7 @@ static void Cmd_ppreduce(void)
|
|||
if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattlerAttacker].pp[gCurrMovePos])
|
||||
{
|
||||
gProtectStructs[gBattlerAttacker].notFirstStrike = 1;
|
||||
// For item Metronome
|
||||
// For item Metronome, echoed voice
|
||||
if (gCurrentMove == gLastResultingMoves[gBattlerAttacker]
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& !WasUnableToUseMove(gBattlerAttacker))
|
||||
|
@ -2356,6 +2356,7 @@ static void Cmd_resultmessage(void)
|
|||
if (gSpecialStatuses[gBattlerTarget].berryReduced
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
gSpecialStatuses[gBattlerTarget].berryReduced = 0;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString;
|
||||
|
@ -2615,11 +2616,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
statusChanged = TRUE;
|
||||
break;
|
||||
case STATUS1_BURN:
|
||||
if (GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL
|
||||
if ((GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL || GetBattlerAbility(gEffectBattler) == ABILITY_WATER_BUBBLE)
|
||||
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
|
||||
{
|
||||
gLastUsedAbility = ABILITY_WATER_VEIL;
|
||||
RecordAbilityBattle(gEffectBattler, ABILITY_WATER_VEIL);
|
||||
gLastUsedAbility = GetBattlerAbility(gEffectBattler);
|
||||
RecordAbilityBattle(gEffectBattler, GetBattlerAbility(gEffectBattler));
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
|
||||
|
@ -2648,6 +2649,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
break;
|
||||
if (GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL
|
||||
|| GetBattlerAbility(gEffectBattler) == ABILITY_COMATOSE
|
||||
|| GetBattlerAbility(gEffectBattler) == ABILITY_WATER_BUBBLE
|
||||
|| IsAbilityStatusProtected(gEffectBattler))
|
||||
break;
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
|
@ -7288,9 +7290,14 @@ static void Cmd_various(void)
|
|||
return;
|
||||
case VARIOUS_JUMP_IF_NO_HOLD_EFFECT:
|
||||
if (GetBattlerHoldEffect(gActiveBattler, TRUE) != gBattlescriptCurrInstr[3])
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
gLastUsedItem = gBattleMons[gActiveBattler].item; // For B_LAST_USED_ITEM
|
||||
gBattlescriptCurrInstr += 8;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_NO_ALLY:
|
||||
if (!IsBattlerAlive(BATTLE_PARTNER(gActiveBattler)))
|
||||
|
@ -8260,7 +8267,8 @@ static void Cmd_various(void)
|
|||
}
|
||||
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN)
|
||||
{
|
||||
if (GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_VEIL)
|
||||
if (GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_VEIL
|
||||
|| GetBattlerAbility(gBattlerTarget) == ABILITY_WATER_BUBBLE)
|
||||
{
|
||||
gBattlerAbility = gBattlerTarget;
|
||||
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
|
||||
|
|
|
@ -4882,6 +4882,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||
&& TARGET_TURN_DAMAGED
|
||||
&& !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_VEIL
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_BUBBLE
|
||||
&& !(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY)
|
||||
&& !IsAbilityStatusProtected(gBattlerAttacker)
|
||||
&& (Random() % 3) == 0)
|
||||
|
@ -5089,6 +5090,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||
}
|
||||
break;
|
||||
case ABILITY_WATER_VEIL:
|
||||
case ABILITY_WATER_BUBBLE:
|
||||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn);
|
||||
|
@ -7209,12 +7211,12 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
|||
basePower = 150;
|
||||
break;
|
||||
case EFFECT_ECHOED_VOICE:
|
||||
if (gFieldTimers.echoVoiceCounter != 0)
|
||||
// gBattleStruct->sameMoveTurns incremented in ppreduce
|
||||
if (gBattleStruct->sameMoveTurns[battlerAtk] != 0)
|
||||
{
|
||||
if (gFieldTimers.echoVoiceCounter >= 5)
|
||||
basePower *= 5;
|
||||
else
|
||||
basePower *= gFieldTimers.echoVoiceCounter;
|
||||
basePower += (basePower * gBattleStruct->sameMoveTurns[battlerAtk]);
|
||||
if (basePower > 200)
|
||||
basePower = 200;
|
||||
}
|
||||
break;
|
||||
case EFFECT_PAYBACK:
|
||||
|
|
|
@ -4313,7 +4313,13 @@ static bool8 IsItemFlute(u16 item)
|
|||
static bool8 ExecuteTableBasedItemEffect_(u8 partyMonIndex, u16 item, u8 monMoveIndex)
|
||||
{
|
||||
if (gMain.inBattle)
|
||||
return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex);
|
||||
{
|
||||
if ((partyMonIndex == 0 && gStatuses3[B_POSITION_PLAYER_LEFT] & STATUS3_EMBARGO)
|
||||
|| (partyMonIndex == 1 && gStatuses3[B_POSITION_PLAYER_RIGHT] & STATUS3_EMBARGO))
|
||||
return TRUE; // cannot use on this mon
|
||||
else
|
||||
return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex);
|
||||
}
|
||||
else
|
||||
return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, partyMonIndex, monMoveIndex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue