Suggested changes

- Various style fixes
- Add BATTLE_ALIVE_EXCEPT_ATTACKER case to CountAliveMonsInBattle
This commit is contained in:
BuffelSaft 2022-10-24 22:19:35 +13:00
parent 7bca475d77
commit d9cc98a4fe
5 changed files with 39 additions and 37 deletions

View File

@ -329,9 +329,10 @@
#define MON_PIC_HEIGHT 64
#define MON_PIC_SIZE (MON_PIC_WIDTH * MON_PIC_HEIGHT / 2)
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
#define BATTLE_ALIVE_ATK_SIDE 1
#define BATTLE_ALIVE_DEF_SIDE 2
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
#define BATTLE_ALIVE_ATK_SIDE 1
#define BATTLE_ALIVE_DEF_SIDE 2
#define BATTLE_ALIVE_EXCEPT_ATTACKER 3
#define SKIP_FRONT_ANIM (1 << 7)

View File

@ -4841,7 +4841,7 @@ static void TurnValuesCleanUp(bool8 var0)
}
if (gDisableStructs[gActiveBattler].substituteHP == 0)
gBattleMons[gActiveBattler].status2 &= ~(STATUS2_SUBSTITUTE);
gBattleMons[gActiveBattler].status2 &= ~STATUS2_SUBSTITUTE;
gSpecialStatuses[gActiveBattler].parentalBondState = PARENTAL_BOND_OFF;
}

View File

@ -1451,7 +1451,7 @@ static void Cmd_attackcanceler(void)
if (AtkCanceller_UnableToUseMove())
return;
if (!gSpecialStatuses[gBattlerAttacker].parentalBondState
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_OFF
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_PARENTAL_BOND
&& IsMoveAffectedByParentalBond(gCurrentMove, gBattlerAttacker)
&& !(gAbsentBattlerFlags & gBitTable[gBattlerTarget])
@ -14847,14 +14847,12 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
{
// Both foes are alive, spread move strikes once
case MOVE_TARGET_BOTH:
if (IsBattlerAlive(gBattlerTarget) && IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)))
if (CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) >= 2)
return FALSE;
break;
// Either both foes or one foe and its ally are alive; spread move strikes once
case MOVE_TARGET_FOES_AND_ALLY:
if (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget))
|| (IsBattlerAlive(BATTLE_PARTNER(battlerId))
&& (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)) || IsBattlerAlive(gBattlerTarget))))
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ATTACKER) >= 2)
return FALSE;
break;
default:

View File

@ -10495,32 +10495,28 @@ bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move)
static void SetRandomMultiHitCounter()
{
#if (B_MULTI_HIT_CHANCE >= GEN_5)
{
// Based on Gen 5's odds
// 35% for 2 hits
// 35% for 3 hits
// 15% for 4 hits
// 15% for 5 hits
gMultiHitCounter = Random() % 100;
if (gMultiHitCounter < 35)
gMultiHitCounter = 2;
else if (gMultiHitCounter < 35 + 35)
gMultiHitCounter = 3;
else if (gMultiHitCounter < 35 + 35 + 15)
gMultiHitCounter = 4;
else
gMultiHitCounter = 5;
}
#else
{
// 2 and 3 hits: 37.5%
// 4 and 5 hits: 12.5%
gMultiHitCounter = Random() % 4;
if (gMultiHitCounter > 1)
gMultiHitCounter = (Random() % 4) + 2;
else
gMultiHitCounter += 2;
}
#endif
#if (B_MULTI_HIT_CHANCE >= GEN_5)
// Based on Gen 5's odds
// 35% for 2 hits
// 35% for 3 hits
// 15% for 4 hits
// 15% for 5 hits
gMultiHitCounter = Random() % 100;
if (gMultiHitCounter < 35)
gMultiHitCounter = 2;
else if (gMultiHitCounter < 35 + 35)
gMultiHitCounter = 3;
else if (gMultiHitCounter < 35 + 35 + 15)
gMultiHitCounter = 4;
else
gMultiHitCounter = 5;
#else
// 2 and 3 hits: 37.5%
// 4 and 5 hits: 12.5%
gMultiHitCounter = Random() % 4;
if (gMultiHitCounter > 1)
gMultiHitCounter = (Random() % 4) + 2;
else
gMultiHitCounter += 2;
#endif
}

View File

@ -4238,6 +4238,13 @@ u8 CountAliveMonsInBattle(u8 caseId)
retVal++;
}
break;
case BATTLE_ALIVE_EXCEPT_ATTACKER:
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (i != gBattlerAttacker && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
}
return retVal;