mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-06 15:38:11 +01:00
Merge branch 'RHH/master' into RHH/upcoming
# Conflicts: # include/battle_util.h
This commit is contained in:
commit
ca1d9f5393
@ -212,6 +212,7 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId);
|
|||||||
void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon);
|
void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon);
|
||||||
void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon);
|
void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon);
|
||||||
void RecalcBattlerStats(u32 battler, struct Pokemon *mon);
|
void RecalcBattlerStats(u32 battler, struct Pokemon *mon);
|
||||||
|
void MulModifier(u16 *modifier, u16 val);
|
||||||
bool32 IsAlly(u32 battlerAtk, u32 battlerDef);
|
bool32 IsAlly(u32 battlerAtk, u32 battlerDef);
|
||||||
|
|
||||||
// Ability checks
|
// Ability checks
|
||||||
|
@ -822,7 +822,7 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId,
|
|||||||
|
|
||||||
while (bits != 0x3F) // All mons were checked.
|
while (bits != 0x3F) // All mons were checked.
|
||||||
{
|
{
|
||||||
u32 bestResist = UQ_4_12(1.0);
|
u16 bestResist = UQ_4_12(1.0);
|
||||||
int bestMonId = PARTY_SIZE;
|
int bestMonId = PARTY_SIZE;
|
||||||
// Find the mon whose type is the most suitable defensively.
|
// Find the mon whose type is the most suitable defensively.
|
||||||
for (i = firstId; i < lastId; i++)
|
for (i = firstId; i < lastId; i++)
|
||||||
@ -830,21 +830,21 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId,
|
|||||||
if (!(gBitTable[i] & invalidMons) && !(gBitTable[i] & bits))
|
if (!(gBitTable[i] & invalidMons) && !(gBitTable[i] & bits))
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(&party[i], MON_DATA_SPECIES);
|
u16 species = GetMonData(&party[i], MON_DATA_SPECIES);
|
||||||
u32 typeEffectiveness = UQ_4_12(1.0);
|
u16 typeEffectiveness = UQ_4_12(1.0);
|
||||||
|
|
||||||
u8 atkType1 = gBattleMons[opposingBattler].type1;
|
u8 atkType1 = gBattleMons[opposingBattler].type1;
|
||||||
u8 atkType2 = gBattleMons[opposingBattler].type2;
|
u8 atkType2 = gBattleMons[opposingBattler].type2;
|
||||||
u8 defType1 = gSpeciesInfo[species].types[0];
|
u8 defType1 = gSpeciesInfo[species].types[0];
|
||||||
u8 defType2 = gSpeciesInfo[species].types[1];
|
u8 defType2 = gSpeciesInfo[species].types[1];
|
||||||
|
|
||||||
typeEffectiveness *= GetTypeModifier(atkType1, defType1);
|
MulModifier(&typeEffectiveness, (GetTypeModifier(atkType1, defType1)));
|
||||||
if (atkType2 != atkType1)
|
if (atkType2 != atkType1)
|
||||||
typeEffectiveness *= GetTypeModifier(atkType2, defType1);
|
MulModifier(&typeEffectiveness, (GetTypeModifier(atkType2, defType1)));
|
||||||
if (defType2 != defType1)
|
if (defType2 != defType1)
|
||||||
{
|
{
|
||||||
typeEffectiveness *= GetTypeModifier(atkType1, defType2);
|
MulModifier(&typeEffectiveness, (GetTypeModifier(atkType1, defType2)));
|
||||||
if (atkType2 != atkType1)
|
if (atkType2 != atkType1)
|
||||||
typeEffectiveness *= GetTypeModifier(atkType2, defType2);
|
MulModifier(&typeEffectiveness, (GetTypeModifier(atkType2, defType2)));
|
||||||
}
|
}
|
||||||
if (typeEffectiveness < bestResist)
|
if (typeEffectiveness < bestResist)
|
||||||
{
|
{
|
||||||
@ -989,9 +989,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
|||||||
if (bestMonId != PARTY_SIZE)
|
if (bestMonId != PARTY_SIZE)
|
||||||
return bestMonId;
|
return bestMonId;
|
||||||
|
|
||||||
// If ace mon is the last available Pokemon and U-Turn/Volt Switch was used - switch to the mon.
|
// If ace mon is the last available Pokemon and switch move was used - switch to the mon.
|
||||||
if (aceMonId != PARTY_SIZE
|
if (aceMonId != PARTY_SIZE)
|
||||||
&& (gBattleMoves[gLastUsedMove].effect == EFFECT_HIT_ESCAPE || gBattleMoves[gLastUsedMove].effect == EFFECT_PARTING_SHOT))
|
|
||||||
return aceMonId;
|
return aceMonId;
|
||||||
|
|
||||||
return PARTY_SIZE;
|
return PARTY_SIZE;
|
||||||
|
@ -3258,7 +3258,7 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
|
|||||||
#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68)
|
#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68)
|
||||||
|
|
||||||
#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1)
|
#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1)
|
||||||
#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0)
|
#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 1)
|
||||||
#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8)
|
#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8)
|
||||||
|
|
||||||
#define sHide data[0]
|
#define sHide data[0]
|
||||||
@ -3314,7 +3314,7 @@ void TryAddLastUsedBallItemSprites(void)
|
|||||||
gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow,
|
gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow,
|
||||||
LAST_BALL_WIN_X_0,
|
LAST_BALL_WIN_X_0,
|
||||||
LAST_USED_WIN_Y, 5);
|
LAST_USED_WIN_Y, 5);
|
||||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -8341,7 +8341,7 @@ u32 GetMoveTargetCount(u16 move, u8 battlerAtk, u8 battlerDef)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MulModifier(u16 *modifier, u16 val)
|
void MulModifier(u16 *modifier, u16 val)
|
||||||
{
|
{
|
||||||
*modifier = UQ_4_12_TO_INT((*modifier * val) + UQ_4_12_ROUND);
|
*modifier = UQ_4_12_TO_INT((*modifier * val) + UQ_4_12_ROUND);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user