mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
Fix spread moves, tidy up CANCELLER_MULTIHIT_MOVES
- Parental Bond spread moves should now strike twice whenever there is a single target, even if the target is the user's ally. - Random chance to hit 2-5 times is now set in SetRandomMultiHitCounter().
This commit is contained in:
parent
1b056f9044
commit
9b076a9dcf
@ -364,7 +364,7 @@
|
|||||||
#define MOVE_EFFECT_RECOIL_HP_25 0x44
|
#define MOVE_EFFECT_RECOIL_HP_25 0x44
|
||||||
#define MOVE_EFFECT_RELIC_SONG 0x45
|
#define MOVE_EFFECT_RELIC_SONG 0x45
|
||||||
#define MOVE_EFFECT_TRAP_BOTH 0x46
|
#define MOVE_EFFECT_TRAP_BOTH 0x46
|
||||||
|
|
||||||
#define NUM_MOVE_EFFECTS 0x47
|
#define NUM_MOVE_EFFECTS 0x47
|
||||||
|
|
||||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||||
|
@ -14844,12 +14844,16 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
|
|||||||
{
|
{
|
||||||
switch (GetBattlerMoveTargetType(battlerId, move))
|
switch (GetBattlerMoveTargetType(battlerId, move))
|
||||||
{
|
{
|
||||||
|
// Both foes are alive, spread move strikes once
|
||||||
case MOVE_TARGET_BOTH:
|
case MOVE_TARGET_BOTH:
|
||||||
if (CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) >= 2) // Check for single target
|
if (IsBattlerAlive(gBattlerTarget) && IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
// Either both foes or one foe and its ally are alive; spread move strikes once
|
||||||
case MOVE_TARGET_FOES_AND_ALLY:
|
case MOVE_TARGET_FOES_AND_ALLY:
|
||||||
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) >= 2) // Count mons on both sides; ignore attacker
|
if (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget))
|
||||||
|
|| (IsBattlerAlive(BATTLE_PARTNER(battlerId))
|
||||||
|
&& (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)) || IsBattlerAlive(gBattlerTarget))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -59,6 +59,7 @@ functions instead of at the top of the file with the other declarations.
|
|||||||
static bool32 TryRemoveScreens(u8 battler);
|
static bool32 TryRemoveScreens(u8 battler);
|
||||||
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId);
|
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId);
|
||||||
static u8 GetFlingPowerFromItemId(u16 itemId);
|
static u8 GetFlingPowerFromItemId(u16 itemId);
|
||||||
|
static void SetRandomMultiHitCounter();
|
||||||
|
|
||||||
extern const u8 *const gBattleScriptsForMoveEffects[];
|
extern const u8 *const gBattleScriptsForMoveEffects[];
|
||||||
extern const u8 *const gBattlescriptsForRunningByItem[];
|
extern const u8 *const gBattlescriptsForRunningByItem[];
|
||||||
@ -3868,35 +3869,8 @@ u8 AtkCanceller_UnableToUseMove(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (B_MULTI_HIT_CHANCE >= GEN_5)
|
SetRandomMultiHitCounter();
|
||||||
{
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
|
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
|
||||||
}
|
}
|
||||||
else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES)
|
else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES)
|
||||||
@ -10518,3 +10492,35 @@ bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move)
|
|||||||
return FALSE; // Pokémon affected by Heal Block cannot target allies with Pollen Puff
|
return FALSE; // Pokémon affected by Heal Block cannot target allies with Pollen Puff
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user