From 24465858a7d3506cc66b724bf7dc6eda85e8c7a6 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 4 Dec 2022 20:24:35 -0300 Subject: [PATCH] Implemented the 4 Ruin Abilities --- data/battle_scripts_1.s | 6 ++++ include/battle_scripts.h | 1 + include/constants/battle_string_ids.h | 3 +- src/battle_message.c | 2 ++ src/battle_util.c | 48 +++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6cf62d2f9..746d83230 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8426,6 +8426,12 @@ BattleScript_QuarkDriveActivates:: waitmessage B_WAIT_TIME_MED end3 +BattleScript_RuinAbilityActivates:: + call BattleScript_AbilityPopUp + printstring STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_AttackWeakenedByStrongWinds:: pause B_WAIT_TIME_SHORT printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 960262cba..33138189b 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -443,6 +443,7 @@ extern const u8 BattleScript_WindPowerActivatesEnd2[]; extern const u8 BattleScript_ProtosynthesisActivates[]; extern const u8 BattleScript_QuarkDriveActivates[]; extern const u8 BattleScript_GoodAsGoldActivates[]; +extern const u8 BattleScript_RuinAbilityActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 9606c5f59..9c0965bb5 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -634,8 +634,9 @@ #define STRINGID_SUNLIGHTACTIVATEDABILITY 632 #define STRINGID_STATWASHEIGHTENED 633 #define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 634 +#define STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT 635 -#define BATTLESTRINGS_COUNT 635 +#define BATTLESTRINGS_COUNT 636 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index 00275fa45..d109e0f4e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -763,9 +763,11 @@ static const u8 sText_BeingHitChargedPkmnWithPower[] = _("Being hit by {B_CURREN static const u8 sText_SunlightActivatedAbility[] = _("The harsh sunlight activated\n{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}!"); 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"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT - BATTLESTRINGS_TABLE_START] = sText_AbilityWeakenedSurroundingMonsStat, [STRINGID_ELECTRICTERRAINACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_ElectricTerrainActivatedAbility, [STRINGID_STATWASHEIGHTENED - BATTLESTRINGS_TABLE_START] = sText_StatWasHeightened, [STRINGID_SUNLIGHTACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_SunlightActivatedAbility, diff --git a/src/battle_util.c b/src/battle_util.c index 6c69183d0..e89ea26b1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4901,6 +4901,42 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_VESSEL_OF_RUIN: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK); + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + BattleScriptPushCursorAndCallback(BattleScript_RuinAbilityActivates); + effect++; + } + break; + case ABILITY_SWORD_OF_RUIN: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF); + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + BattleScriptPushCursorAndCallback(BattleScript_RuinAbilityActivates); + effect++; + } + break; + case ABILITY_TABLETS_OF_RUIN: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + BattleScriptPushCursorAndCallback(BattleScript_RuinAbilityActivates); + effect++; + } + break; + case ABILITY_BEADS_OF_RUIN: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF); + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + BattleScriptPushCursorAndCallback(BattleScript_RuinAbilityActivates); + effect++; + } + break; #if B_WEATHER_FORMS < GEN_5 default: if (gBattleMons[battler].species == SPECIES_CHERRIM) @@ -8801,6 +8837,18 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, UQ_4_12(1.33)); } + if (IsAbilityOnField(ABILITY_VESSEL_OF_RUIN) && atkAbility != ABILITY_VESSEL_OF_RUIN && IS_MOVE_SPECIAL(gCurrentMove)) + MulModifier(&modifier, UQ_4_12(0.25)); + + if (IsAbilityOnField(ABILITY_SWORD_OF_RUIN) && defAbility != ABILITY_SWORD_OF_RUIN && IS_MOVE_PHYSICAL(gCurrentMove)) + MulModifier(&modifier, UQ_4_12(0.25)); + + if (IsAbilityOnField(ABILITY_TABLETS_OF_RUIN) && atkAbility != ABILITY_TABLETS_OF_RUIN && IS_MOVE_PHYSICAL(gCurrentMove)) + MulModifier(&modifier, UQ_4_12(0.25)); + + if (IsAbilityOnField(ABILITY_BEADS_OF_RUIN) && defAbility != ABILITY_BEADS_OF_RUIN && IS_MOVE_SPECIAL(gCurrentMove)) + MulModifier(&modifier, UQ_4_12(0.25)); + // attacker partner's abilities if (IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) {