ate abilities

This commit is contained in:
DizzyEggg 2018-07-28 18:41:57 +02:00
parent 3a0c244f40
commit ec9693c797
5 changed files with 53 additions and 0 deletions

View File

@ -593,6 +593,7 @@ struct BattleStruct
u8 presentBasePower;
u8 roostTypes[MAX_BATTLERS_COUNT][3];
u8 savedBattlerTarget;
bool8 ateBoost[MAX_BATTLERS_COUNT];
};
#define GET_MOVE_TYPE(move, typeArg) \

View File

@ -216,6 +216,7 @@
#define STATUS_FIELD_MISTY_TERRAIN 0x80
#define STATUS_FIELD_ELECTRIC_TERRAIN 0x100
#define STATUS_FIELD_PSYCHIC_TERRAIN 0x200
#define STATUS_FIELD_ION_DELUGE 0x400
// Flags describing move's result
#define MOVE_RESULT_MISSED (1 << 0)

View File

@ -5295,6 +5295,8 @@ static void HandleAction_UseMove(void)
{
u8 side;
u8 var = 4;
u32 attackerAbility;
u32 ateType;
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
@ -5510,6 +5512,34 @@ static void HandleAction_UseMove(void)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
sub_81A56E8(gBattlerAttacker);
attackerAbility = GetBattlerAbility(gBattlerAttacker);
// Set move type.
if (gFieldStatuses & STATUS_FIELD_ION_DELUGE) // All moves become Electric-type this turn.
{
gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC;
}
else if (gBattleMoves[gChosenMove].type == TYPE_NORMAL
&& gBattleMoves[gChosenMove].effect != EFFECT_HIDDEN_POWER
&& gBattleMoves[gChosenMove].effect != EFFECT_WEATHER_BALL
&& ((attackerAbility == ABILITY_PIXILATE && (ateType = TYPE_FAIRY))
|| (attackerAbility == ABILITY_REFRIGERATE && (ateType = TYPE_ICE))
|| (attackerAbility == ABILITY_AERILATE && (ateType = TYPE_FLYING))
|| ((attackerAbility == ABILITY_GALVANIZE) && (ateType = TYPE_ELECTRIC))
)
)
{
gBattleStruct->dynamicMoveType = 0x80 | ateType;
gBattleStruct->ateBoost[gBattlerAttacker] = 1;
}
else if (gBattleMoves[gChosenMove].type != TYPE_NORMAL
&& gBattleMoves[gChosenMove].effect != EFFECT_HIDDEN_POWER
&& gBattleMoves[gChosenMove].effect != EFFECT_WEATHER_BALL
&& attackerAbility == ABILITY_NORMALIZE)
{
gBattleStruct->dynamicMoveType = 0x80 | TYPE_NORMAL;
gBattleStruct->ateBoost[gBattlerAttacker] = 1;
}
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}

View File

@ -4324,6 +4324,7 @@ static void atk49_moveend(void)
break;
case 17: // Clear bits active just while using a move.
gProtectStructs[gBattlerAttacker].usesBouncedMove = 0;
gBattleStruct->ateBoost[gBattlerAttacker] = 0;
gBattleScripting.atk49_state++;
break;
case ATK49_LAST_CASE:

View File

@ -4669,6 +4669,26 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
if (moveType == TYPE_STEEL)
MulModifier(&modifier, UQ_4_12(1.5));
break;
case ABILITY_PIXILATE:
if (moveType == TYPE_FAIRY && gBattleStruct->ateBoost[battlerAtk])
MulModifier(&modifier, UQ_4_12(1.2));
break;
case ABILITY_GALVANIZE:
if (moveType == TYPE_ELECTRIC && gBattleStruct->ateBoost[battlerAtk])
MulModifier(&modifier, UQ_4_12(1.2));
break;
case ABILITY_REFRIGERATE:
if (moveType == TYPE_ICE && gBattleStruct->ateBoost[battlerAtk])
MulModifier(&modifier, UQ_4_12(1.2));
break;
case ABILITY_AERILATE:
if (moveType == TYPE_FLYING && gBattleStruct->ateBoost[battlerAtk])
MulModifier(&modifier, UQ_4_12(1.2));
break;
case ABILITY_NORMALIZE:
if (moveType == TYPE_NORMAL && gBattleStruct->ateBoost[battlerAtk])
MulModifier(&modifier, UQ_4_12(1.2));
break;
}
// field abilities