Add Protean

This commit is contained in:
DizzyEggg 2018-11-30 21:21:43 +01:00
parent 5aff99b015
commit 0329175f06
4 changed files with 32 additions and 9 deletions

View file

@ -5997,6 +5997,12 @@ BattleScript_ColorChangeActivates::
waitmessage 0x40
return
BattleScript_ProteanActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNCHANGEDTYPE
waitmessage 0x40
return
BattleScript_CursedBodyActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_CUSEDBODYDISABLED

View file

@ -283,5 +283,6 @@ extern const u8 BattleScript_MoveEffectFlameBurst[];
extern const u8 BattleScript_TrainerSlideMsgRet[];
extern const u8 BattleScript_TrainerSlideMsgEnd2[];
extern const u8 BattleScript_MoveEffectFeint[];
extern const u8 BattleScript_ProteanActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -5467,8 +5467,7 @@ static void HandleAction_UseMove(void)
{
u8 side;
u8 var = 4;
u32 attackerAbility;
u32 ateType, moveType;
u32 moveType;
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
@ -5535,6 +5534,10 @@ static void HandleAction_UseMove(void)
gBattleResults.lastUsedMoveOpponent = gCurrentMove;
}
// Set dynamic move type.
SetTypeBeforeUsingMove(gChosenMove, gBattlerAttacker);
GET_MOVE_TYPE(gChosenMove, moveType);
// choose target
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer != 0
@ -5547,8 +5550,8 @@ static void HandleAction_UseMove(void)
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& gSideTimers[side].followmeTimer == 0
&& (gBattleMoves[gCurrentMove].power != 0 || gBattleMoves[gCurrentMove].target != MOVE_TARGET_USER)
&& ((gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_LIGHTNING_ROD && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|| (gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_STORM_DRAIN && gBattleMoves[gCurrentMove].type == TYPE_WATER)
&& ((gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC)
|| (gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_STORM_DRAIN && moveType == TYPE_WATER)
)
)
{
@ -5557,8 +5560,8 @@ static void HandleAction_UseMove(void)
{
if (side != GetBattlerSide(gActiveBattler)
&& *(gBattleStruct->moveTarget + gBattlerAttacker) != gActiveBattler
&& ((gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|| (gBattleMons[gActiveBattler].ability == ABILITY_STORM_DRAIN && gBattleMoves[gCurrentMove].type == TYPE_WATER)
&& ((gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC)
|| (gBattleMons[gActiveBattler].ability == ABILITY_STORM_DRAIN && moveType == TYPE_WATER)
)
&& GetBattlerTurnOrderNum(gActiveBattler) < var)
{
@ -5692,9 +5695,6 @@ static void HandleAction_UseMove(void)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
BattleArena_AddMindPoints(gBattlerAttacker);
// Set dynamic move type.
SetTypeBeforeUsingMove(gChosenMove, gBattlerAttacker);
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}

View file

@ -949,6 +949,7 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
static void atk00_attackcanceler(void)
{
s32 i;
u32 moveType;
if (gBattleOutcome != 0)
{
@ -963,6 +964,21 @@ static void atk00_attackcanceler(void)
}
if (AtkCanceller_UnableToUseMove())
return;
// Check Protean activation.
GET_MOVE_TYPE(gCurrentMove, moveType);
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PROTEAN
&& (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType ||
(gBattleMons[gBattlerAttacker].type3 != moveType && gBattleMons[gBattlerAttacker].type3 != TYPE_MYSTERY))
&& gCurrentMove != MOVE_STRUGGLE)
{
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
SET_BATTLER_TYPE(gBattlerAttacker, moveType);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ProteanActivates;
return;
}
if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattlerTarget, 0, 0, 0))
return;
if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & 0x800200)