Removed zMovePower field in gBattleMoves in favor of a function.

This commit is contained in:
Eduardo Quezada 2023-02-27 23:49:43 -03:00
parent 86144c6a53
commit 90021f3be6
5 changed files with 46 additions and 933 deletions

View File

@ -26,5 +26,6 @@ const u8 *GetZMoveName(u16 move);
void SetZEffect(void);
bool32 IsZMoveUsable(u8 battlerId, u16 moveIndex);
void GetUsableZMoves(u8 battlerId, u16 *moves);
u16 GetZMovePower(u16 move);
#endif // GUARD_BATTLE_Z_MOVE_H

View File

@ -339,7 +339,6 @@ struct BattleMove
u32 flags;
u8 split;
u8 argument;
u8 zMovePower;
u8 zMoveEffect;
};

View File

@ -7,6 +7,7 @@
#include "battle_controllers.h"
#include "battle_interface.h"
#include "battle_setup.h"
#include "battle_z_move.h"
#include "party_menu.h"
#include "pokemon.h"
#include "international_string_util.h"
@ -8532,7 +8533,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
u32 weight, hpFraction, speed;
if (gBattleStruct->zmove.active)
return gBattleMoves[gBattleStruct->zmove.baseMoves[battlerAtk]].zMovePower;
return GetZMovePower(gBattleStruct->zmove.baseMoves[battlerAtk]);
switch (gBattleMoves[move].effect)
{

View File

@ -535,7 +535,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove)
static void ZMoveSelectionDisplayPower(u16 move, u16 zMove)
{
u8 *txtPtr;
u16 power = gBattleMoves[move].zMovePower;
u16 power = GetZMovePower(move);
if (zMove >= MOVE_CATASTROPIKA)
power = gBattleMoves[zMove].power;
@ -698,3 +698,45 @@ static bool32 AreStatsMaxed(u8 battlerId, u8 n)
return TRUE;
}
u16 GetZMovePower(u16 move)
{
if (gBattleMoves[move].split == SPLIT_STATUS)
return 0;
if (gBattleMoves[move].effect == EFFECT_OHKO)
return 180;
switch (move)
{
case MOVE_MEGA_DRAIN: return 120;
case MOVE_CORE_ENFORCER: return 140;
case MOVE_WEATHER_BALL: return 160;
case MOVE_HEX: return 160;
case MOVE_FLYING_PRESS: return 170;
case MOVE_GEAR_GRIND: return 180;
case MOVE_V_CREATE: return 220;
default:
{
if (gBattleMoves[move].power >= 140)
return 200;
else if (gBattleMoves[move].power >= 130)
return 195;
else if (gBattleMoves[move].power >= 120)
return 190;
else if (gBattleMoves[move].power >= 110)
return 185;
else if (gBattleMoves[move].power >= 100)
return 180;
else if (gBattleMoves[move].power >= 90)
return 175;
else if (gBattleMoves[move].power >= 80)
return 160;
else if (gBattleMoves[move].power >= 70)
return 140;
else if (gBattleMoves[move].power >= 60)
return 120;
else
return 100;
}
}
}

File diff suppressed because it is too large Load Diff