Implemented Supreme Overlord's effect

This commit is contained in:
LOuroboros 2022-12-06 02:51:13 -03:00
parent 3c30e6bdc3
commit 7a52404fd3
5 changed files with 43 additions and 1 deletions

View File

@ -8444,6 +8444,13 @@ BattleScript_RuinAbilityActivates::
waitmessage B_WAIT_TIME_LONG
end3
BattleScript_SupremeOverlordActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
printstring STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN
waitmessage B_WAIT_TIME_LONG
end3
BattleScript_AttackWeakenedByStrongWinds::
pause B_WAIT_TIME_SHORT
printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS

View File

@ -445,6 +445,7 @@ extern const u8 BattleScript_QuarkDriveActivates[];
extern const u8 BattleScript_GoodAsGoldActivates[];
extern const u8 BattleScript_RuinAbilityActivates[];
extern const u8 BattleScript_CudChewActivates[];
extern const u8 BattleScript_SupremeOverlordActivates[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -635,8 +635,9 @@
#define STRINGID_STATWASHEIGHTENED 633
#define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 634
#define STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT 635
#define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 636
#define BATTLESTRINGS_COUNT 636
#define BATTLESTRINGS_COUNT 637
// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,

View File

@ -764,9 +764,11 @@ static const u8 sText_SunlightActivatedAbility[] = _("The harsh sunlight activat
static const u8 sText_StatWasHeightened[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1} was heightened!");
static const u8 sText_ElectricTerrainActivatedAbility[] = _("The Electric Terrain activated\n{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}!");
static const u8 sText_AbilityWeakenedSurroundingMonsStat[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nweakened the {B_BUFF1} of\lall surrounding Pokémon!\p");
static const u8 sText_AttackerGainedStrengthFromTheFallen[] = _("{B_ATK_NAME_WITH_PREFIX} gained strength\nfrom the fallen!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN - BATTLESTRINGS_TABLE_START] = sText_AttackerGainedStrengthFromTheFallen,
[STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT - BATTLESTRINGS_TABLE_START] = sText_AbilityWeakenedSurroundingMonsStat,
[STRINGID_ELECTRICTERRAINACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_ElectricTerrainActivatedAbility,
[STRINGID_STATWASHEIGHTENED - BATTLESTRINGS_TABLE_START] = sText_StatWasHeightened,

View File

@ -4957,6 +4957,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case ABILITY_SUPREME_OVERLORD:
if (!gSpecialStatuses[battler].switchInAbilityDone && CountUsablePartyMons(battler) < PARTY_SIZE)
{
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
BattleScriptPushCursorAndCallback(BattleScript_SupremeOverlordActivates);
effect++;
}
break;
#if B_WEATHER_FORMS < GEN_5
default:
if (gBattleMons[battler].species == SPECIES_CHERRIM)
@ -8722,6 +8730,26 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
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 ApplySupremeOverlordModifier(u8 battlerId)
{
u8 side = GetBattlerSide(battlerId);
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
u8 i;
u16 modifier = UQ_4_12(1.0);
bool8 appliedFirstBoost = FALSE;
for (i = 0; i < PARTY_SIZE; i++)
{
if (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)
{
u32 i;
@ -8866,6 +8894,9 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
if (gBattleMoves[move].flags & FLAG_SLICING_MOVE)
MulModifier(&modifier, UQ_4_12(1.5));
break;
case ABILITY_SUPREME_OVERLORD:
MulModifier(&modifier, ApplySupremeOverlordModifier(battlerAtk));
break;
}
// field abilities