mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Beat Up AI Damage Calc (#3104)
* add specific AI dmg calc for new beat up * beat up ai calc optimizations --------- Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
parent
eab4e32e2a
commit
1a53154324
@ -611,5 +611,6 @@ bool32 TryFormChange(u32 monId, u32 side, u16 method);
|
|||||||
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method);
|
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method);
|
||||||
u32 GetMonFriendshipScore(struct Pokemon *pokemon);
|
u32 GetMonFriendshipScore(struct Pokemon *pokemon);
|
||||||
void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality);
|
void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality);
|
||||||
|
u8 CalculatePartyCount(struct Pokemon *party);
|
||||||
|
|
||||||
#endif // GUARD_POKEMON_H
|
#endif // GUARD_POKEMON_H
|
||||||
|
@ -833,6 +833,20 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness,
|
|||||||
case EFFECT_FINAL_GAMBIT:
|
case EFFECT_FINAL_GAMBIT:
|
||||||
dmg = gBattleMons[battlerAtk].hp;
|
dmg = gBattleMons[battlerAtk].hp;
|
||||||
break;
|
break;
|
||||||
|
#if B_BEAT_UP >= GEN_5
|
||||||
|
case EFFECT_BEAT_UP:
|
||||||
|
{
|
||||||
|
u32 partyCount = CalculatePartyCount(GetBattlerParty(battlerAtk));
|
||||||
|
u32 i;
|
||||||
|
gBattleStruct->beatUpSlot = 0;
|
||||||
|
dmg = 0;
|
||||||
|
for (i = 0; i < partyCount; i++) {
|
||||||
|
dmg += CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, FALSE, FALSE, FALSE);
|
||||||
|
}
|
||||||
|
gBattleStruct->beatUpSlot = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle other multi-strike moves
|
// Handle other multi-strike moves
|
||||||
|
@ -5432,29 +5432,28 @@ u8 SendMonToPC(struct Pokemon* mon)
|
|||||||
return MON_CANT_GIVE;
|
return MON_CANT_GIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CalculatePlayerPartyCount(void)
|
u8 CalculatePartyCount(struct Pokemon *party)
|
||||||
{
|
{
|
||||||
gPlayerPartyCount = 0;
|
u32 partyCount = 0;
|
||||||
|
|
||||||
while (gPlayerPartyCount < PARTY_SIZE
|
while (partyCount < PARTY_SIZE
|
||||||
&& GetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
&& GetMonData(&party[partyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
gPlayerPartyCount++;
|
partyCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return partyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 CalculatePlayerPartyCount(void)
|
||||||
|
{
|
||||||
|
gPlayerPartyCount = CalculatePartyCount(gPlayerParty);
|
||||||
return gPlayerPartyCount;
|
return gPlayerPartyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CalculateEnemyPartyCount(void)
|
u8 CalculateEnemyPartyCount(void)
|
||||||
{
|
{
|
||||||
gEnemyPartyCount = 0;
|
gEnemyPartyCount = CalculatePartyCount(gEnemyParty);
|
||||||
|
|
||||||
while (gEnemyPartyCount < PARTY_SIZE
|
|
||||||
&& GetMonData(&gEnemyParty[gEnemyPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
|
||||||
{
|
|
||||||
gEnemyPartyCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gEnemyPartyCount;
|
return gEnemyPartyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user