Updated Supreme Overlord's effect's code (#2809)
This commit is contained in:
commit
cf432b088b
2 changed files with 26 additions and 23 deletions
|
@ -662,6 +662,7 @@ struct BattleStruct
|
||||||
u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party.
|
u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party.
|
||||||
u8 storedHealingWish:4; // Each battler as a bit.
|
u8 storedHealingWish:4; // Each battler as a bit.
|
||||||
u8 storedLunarDance:4; // Each battler as a bit.
|
u8 storedLunarDance:4; // Each battler as a bit.
|
||||||
|
u16 supremeOverlordModifier[MAX_BATTLERS_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define F_DYNAMIC_TYPE_1 (1 << 6)
|
#define F_DYNAMIC_TYPE_1 (1 << 6)
|
||||||
|
|
|
@ -62,6 +62,7 @@ static u8 GetFlingPowerFromItemId(u16 itemId);
|
||||||
static void SetRandomMultiHitCounter();
|
static void SetRandomMultiHitCounter();
|
||||||
static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item);
|
static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item);
|
||||||
static u16 GetInverseTypeMultiplier(u16 multiplier);
|
static u16 GetInverseTypeMultiplier(u16 multiplier);
|
||||||
|
static u16 GetSupremeOverlordModifier(u8 battlerId);
|
||||||
|
|
||||||
extern const u8 *const gBattleScriptsForMoveEffects[];
|
extern const u8 *const gBattleScriptsForMoveEffects[];
|
||||||
extern const u8 *const gBattlescriptsForRunningByItem[];
|
extern const u8 *const gBattlescriptsForRunningByItem[];
|
||||||
|
@ -4319,6 +4320,28 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Supreme Overlord adds a damage boost for each fainted ally.
|
||||||
|
// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each.
|
||||||
|
static u16 GetSupremeOverlordModifier(u8 battlerId)
|
||||||
|
{
|
||||||
|
u32 i;
|
||||||
|
u8 side = GetBattlerSide(battlerId);
|
||||||
|
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||||
|
u16 modifier = UQ_4_12(1.0);
|
||||||
|
bool8 appliedFirstBoost = FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
{
|
||||||
|
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
|
||||||
|
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
|
||||||
|
&& GetMonData(&party[i], MON_DATA_HP) == 0)
|
||||||
|
modifier += (!appliedFirstBoost) ? UQ_4_12(0.2) : UQ_4_12(0.1);
|
||||||
|
appliedFirstBoost = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modifier;
|
||||||
|
}
|
||||||
|
|
||||||
u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg)
|
u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg)
|
||||||
{
|
{
|
||||||
u8 effect = 0;
|
u8 effect = 0;
|
||||||
|
@ -4867,6 +4890,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||||
if (!gSpecialStatuses[battler].switchInAbilityDone && CountUsablePartyMons(battler) < PARTY_SIZE)
|
if (!gSpecialStatuses[battler].switchInAbilityDone && CountUsablePartyMons(battler) < PARTY_SIZE)
|
||||||
{
|
{
|
||||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||||
|
gBattleStruct->supremeOverlordModifier[battler] = GetSupremeOverlordModifier(battler);
|
||||||
BattleScriptPushCursorAndCallback(BattleScript_SupremeOverlordActivates);
|
BattleScriptPushCursorAndCallback(BattleScript_SupremeOverlordActivates);
|
||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
|
@ -8761,28 +8785,6 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||||
return basePower;
|
return basePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Supreme Overlord adds a damage boost for each fainted ally.
|
|
||||||
// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each.
|
|
||||||
static u16 GetSupremeOverlordModifier(u8 battlerId)
|
|
||||||
{
|
|
||||||
u32 i;
|
|
||||||
u8 side = GetBattlerSide(battlerId);
|
|
||||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
|
||||||
u16 modifier = UQ_4_12(1.0);
|
|
||||||
bool8 appliedFirstBoost = FALSE;
|
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
|
||||||
{
|
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
|
|
||||||
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
|
|
||||||
&& GetMonData(&party[i], MON_DATA_HP) == 0)
|
|
||||||
modifier += (!appliedFirstBoost) ? UQ_4_12(0.2) : UQ_4_12(0.1);
|
|
||||||
appliedFirstBoost = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 updateFlags)
|
static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 updateFlags)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
@ -8932,7 +8934,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||||
MulModifier(&modifier, UQ_4_12(1.5));
|
MulModifier(&modifier, UQ_4_12(1.5));
|
||||||
break;
|
break;
|
||||||
case ABILITY_SUPREME_OVERLORD:
|
case ABILITY_SUPREME_OVERLORD:
|
||||||
MulModifier(&modifier, GetSupremeOverlordModifier(battlerAtk));
|
MulModifier(&modifier, gBattleStruct->supremeOverlordModifier[battlerAtk]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue