From 99f1a8208d27caf6336fb8c41f59db2ed212dc09 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 16 Nov 2023 07:30:58 -0300 Subject: [PATCH 1/8] Point to the configs easier (#3564) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 520dd5930f..abadccd0e8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The pokeemerald Expansion is a feature branch meant to be integrated into existing Pokémon Emerald hacks based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. This is ***NOT*** a standalone romhack, and as such, most features will be unavailable and/or unbalanced if played as is. ## What features are included? -- Configuration files that allows you to choose generation-specific behaviors. Full contents here: +- ***IMPORTANT*❗❗ Read through these to learn what features you can toggle**: - [Battle configurations](/include/config/battle.h) - [Pokémon configurations](/include/config/pokemon.h) - [Item configurations](/include/config/item.h) From b33c4952af2ef864ec76d8cced05b5da976f75be Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 16 Nov 2023 19:32:58 -0300 Subject: [PATCH 2/8] Clarify project's description to avoid people cloning vanilla pokeemerald (#3570) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index abadccd0e8..19d4f23f5a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## What is the pokeemerald Expansion? -The pokeemerald Expansion is a feature branch meant to be integrated into existing Pokémon Emerald hacks based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. This is ***NOT*** a standalone romhack, and as such, most features will be unavailable and/or unbalanced if played as is. +The pokeemerald Expansion is a decomp hack base project based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. It's recommended that any new projects that plan on using it, to clone this repository instead of pret's vanilla repository, as we regurlarly incorporate pret's documentation changes. This is ***NOT*** a standalone romhack, and as such, most features will be unavailable and/or unbalanced if played as is. ## What features are included? - ***IMPORTANT*❗❗ Read through these to learn what features you can toggle**: From 5f24bf6e776ea6955963515e7aa425b9306ded6d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 17 Nov 2023 11:49:01 -0300 Subject: [PATCH 3/8] PR template test --- .github/{ => PULL_REQUEST_TEMPLATE}/pull_request_template.md | 0 .github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md | 1 + 2 files changed, 1 insertion(+) rename .github/{ => PULL_REQUEST_TEMPLATE}/pull_request_template.md (100%) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md diff --git a/.github/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md similarity index 100% rename from .github/pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md new file mode 100644 index 0000000000..3bfb992931 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md @@ -0,0 +1 @@ +## Example From 8f3eb1c9a55763346970a4348a208af7b134f111 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 17 Nov 2023 11:53:25 -0300 Subject: [PATCH 4/8] PR template test 2 --- .github/pull_request_template.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..d4e3d6cd28 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,4 @@ +Please go the the `Preview` tab and select the appropriate sub-template: + +* [Group A](?expand=1&template=pull_request_template.md) +* [Group B](?expand=1&template=pull_request_template_2.md) From 508332a93f1f04eacdc3a4128310851378463ea5 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 17 Nov 2023 11:59:34 -0300 Subject: [PATCH 5/8] Reverted PR template tests --- .../pull_request_template.md | 16 ---------------- .../pull_request_template_2.md | 1 - .github/pull_request_template.md | 18 +++++++++++++++--- 3 files changed, 15 insertions(+), 20 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index 930d20a018..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ - - -## Description - - -## Images - - - -## Issue(s) that this PR fixes - - - -## **Discord contact info** - - \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md deleted file mode 100644 index 3bfb992931..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template_2.md +++ /dev/null @@ -1 +0,0 @@ -## Example diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d4e3d6cd28..930d20a018 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,16 @@ -Please go the the `Preview` tab and select the appropriate sub-template: + -* [Group A](?expand=1&template=pull_request_template.md) -* [Group B](?expand=1&template=pull_request_template_2.md) +## Description + + +## Images + + + +## Issue(s) that this PR fixes + + + +## **Discord contact info** + + \ No newline at end of file From c9c0827ba2031602c948549be0478c1d234dd504 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Mon, 20 Nov 2023 19:33:06 +0100 Subject: [PATCH 6/8] Fix 3568 (#3569) --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 7eb4aa1920..e9bb83e19b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6099,7 +6099,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 break; } - if (effect && gLastUsedAbility != 0xFF) + if (effect && gLastUsedAbility != 0xFFFF) RecordAbilityBattle(battler, gLastUsedAbility); if (effect && caseID <= ABILITYEFFECT_MOVE_END) gBattlerAbility = battler; From ca39889587281cfda54d2dd554cebbd9f00f7e67 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 22 Nov 2023 21:55:08 +0100 Subject: [PATCH 7/8] Fixes Howl --- data/battle_scripts_1.s | 8 +++++ test/battle/move_effect/attack_up_user_ally.c | 33 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 898be404b5..07e0bf065a 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -596,6 +596,7 @@ BattleScript_EffectAttackUpUserAlly_TryAlly: BattleScript_EffectAttackUpUserAlly_End: goto BattleScript_MoveEnd BattleScript_EffectAttackUpUserAlly_TryAlly_: + jumpifability BS_ATTACKER_PARTNER, ABILITY_SOUNDPROOF, BattleScript_EffectAttackUpUserAlly_TryAllyBlocked setstatchanger STAT_ATK, 1, FALSE statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_EffectAttackUpUserAlly_End jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_EffectAttackUpUserAlly_AllyAnim @@ -610,6 +611,13 @@ BattleScript_EffectAttackUpUserAlly_AllyAnim: waitmessage B_WAIT_TIME_LONG goto BattleScript_EffectAttackUpUserAlly_End +BattleScript_EffectAttackUpUserAlly_TryAllyBlocked: + copybyte sBATTLER, gBattlerTarget + call BattleScript_AbilityPopUpTarget + printstring STRINGID_PKMNSXBLOCKSY2 + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectTeatime:: attackcanceler attackstring diff --git a/test/battle/move_effect/attack_up_user_ally.c b/test/battle/move_effect/attack_up_user_ally.c index 6691b49ed8..4b7fdae084 100644 --- a/test/battle/move_effect/attack_up_user_ally.c +++ b/test/battle/move_effect/attack_up_user_ally.c @@ -63,3 +63,36 @@ DOUBLE_BATTLE_TEST("Howl raises user's and partner's Attack", s16 damageLeft, s1 EXPECT_MUL_EQ(results[0].damageRight, Q_4_12(1.5), results[1].damageRight); } } + +DOUBLE_BATTLE_TEST("Howl does not work on partner if it has Soundproof") +{ + s16 damage[2]; + + GIVEN { + ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL); + PLAYER(SPECIES_WOBBUFFET) { Speed(15); } + PLAYER(SPECIES_VOLTORB) { Speed(10); Ability(ABILITY_SOUNDPROOF); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(5); } + OPPONENT(SPECIES_WYNAUT) { Speed(1); } + } WHEN { + TURN { MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); } + TURN { MOVE(playerLeft, MOVE_HOWL); MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + HP_BAR(opponentLeft, captureDamage: &damage[0]); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_HOWL, playerLeft); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); + MESSAGE("Wobbuffet's Attack rose!"); + NONE_OF { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); + MESSAGE("Wynaut's Attack rose!"); + } + ABILITY_POPUP(playerRight, ABILITY_SOUNDPROOF); + MESSAGE("Voltorb's Soundproof blocks Howl!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + HP_BAR(opponentLeft, captureDamage: &damage[1]); + } THEN { + EXPECT_EQ(damage[0], damage[1]); + } +} From 71fd95e6d46d255c3fec0dfadd7407d36fc6cdfb Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:49:21 +0100 Subject: [PATCH 8/8] Fixes Protosynthesis and Quark Drive ability pop up (#3595) --- include/battle.h | 4 +-- src/battle_util.c | 23 +++++++------ test/battle/ability/protosynthesis.c | 47 +++++++++++++++++++++++++++ test/battle/ability/quark_drive.c | 48 ++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 11 deletions(-) diff --git a/include/battle.h b/include/battle.h index 5b2ed5c6de..0ad6c172a4 100644 --- a/include/battle.h +++ b/include/battle.h @@ -103,6 +103,8 @@ struct DisableStruct u8 toxicSpikesDone:1; u8 stickyWebDone:1; u8 stealthRockDone:1; + u8 weatherAbilityDone:1; + u8 terrainAbilityDone:1; }; struct ProtectStruct @@ -193,8 +195,6 @@ struct SpecialStatus u8 dancerUsedMove:1; u8 dancerOriginalTarget:3; // End of byte - u8 weatherAbilityDone:1; - u8 terrainAbilityDone:1; u8 emergencyExited:1; u8 afterYou:1; }; diff --git a/src/battle_util.c b/src/battle_util.c index e9bb83e19b..bdce8fbc9d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1968,12 +1968,13 @@ u32 GetBattlerFriendshipScore(u32 battler) return GetMonFriendshipScore(&party[gBattlerPartyIndexes[battler]]); } -static void TryToRevertMimicry(void) +static void TryToRevertMimicryAndFlags(void) { u32 i; for (i = 0; i < gBattlersCount; i++) { + gDisableStructs[i].terrainAbilityDone = FALSE; if (GetBattlerAbility(i) == ABILITY_MIMICRY) RESTORE_BATTLER_TYPE(i); } @@ -2022,7 +2023,7 @@ static bool32 EndTurnTerrain(u32 terrainFlag, u32 stringTableId) if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0) { gFieldStatuses &= ~terrainFlag; - TryToRevertMimicry(); + TryToRevertMimicryAndFlags(); gBattleCommunication[MULTISTRING_CHOOSER] = stringTableId; BattleScriptExecute(BattleScript_TerrainEnds); return TRUE; @@ -2322,6 +2323,8 @@ u8 DoFieldEndTurnEffects(void) && --gWishFutureKnock.weatherDuration == 0) { gBattleWeather &= ~B_WEATHER_SUN_TEMPORARY; + for (i = 0; i < gBattlersCount; i++) + gDisableStructs[i].weatherAbilityDone = FALSE; gBattlescriptCurrInstr = BattleScript_SunlightFaded; } else @@ -4051,6 +4054,7 @@ static bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag, u8 *timer) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN); gFieldStatuses |= statusFlag; + gDisableStructs[battler].terrainAbilityDone = FALSE; if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER) *timer = 8; @@ -6061,10 +6065,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 } break; case ABILITY_PROTOSYNTHESIS: - if (!gSpecialStatuses[battler].weatherAbilityDone && IsBattlerWeatherAffected(battler, B_WEATHER_SUN)) + if (!gDisableStructs[battler].weatherAbilityDone && IsBattlerWeatherAffected(battler, B_WEATHER_SUN)) { - gSpecialStatuses[battler].weatherAbilityDone = TRUE; + gDisableStructs[battler].weatherAbilityDone = TRUE; PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler)); + gBattlerAbility = gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_ProtosynthesisActivates); effect++; } @@ -6076,9 +6081,9 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 switch (gLastUsedAbility) { case ABILITY_MIMICRY: - if (!gSpecialStatuses[battler].terrainAbilityDone && ChangeTypeBasedOnTerrain(battler)) + if (!gDisableStructs[battler].terrainAbilityDone && ChangeTypeBasedOnTerrain(battler)) { - gSpecialStatuses[battler].terrainAbilityDone = TRUE; + gDisableStructs[battler].terrainAbilityDone = TRUE; ChangeTypeBasedOnTerrain(battler); gBattlerAbility = gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_MimicryActivates_End3); @@ -6086,11 +6091,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 } break; case ABILITY_QUARK_DRIVE: - if (!gSpecialStatuses[battler].terrainAbilityDone && IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN)) + if (!gDisableStructs[battler].terrainAbilityDone && IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN)) { - gSpecialStatuses[battler].terrainAbilityDone = TRUE; - gBattlerAbility = gBattleScripting.battler = battler; + gDisableStructs[battler].terrainAbilityDone = TRUE; PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler)); + gBattlerAbility = gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_QuarkDriveActivates); effect++; } diff --git a/test/battle/ability/protosynthesis.c b/test/battle/ability/protosynthesis.c index 0ed74d4f65..40711ecced 100644 --- a/test/battle/ability/protosynthesis.c +++ b/test/battle/ability/protosynthesis.c @@ -85,3 +85,50 @@ SINGLE_BATTLE_TEST("Protosynthesis either boosts Defense or Special Defense, not EXPECT_EQ(damage[0], damage[1]); } } + +SINGLE_BATTLE_TEST("Protosynthesis ability pop up activates only once during the duration of sunny day") +{ + u16 turns; + + GIVEN { + PLAYER(SPECIES_BELLSPROUT) { Ability(ABILITY_PROTOSYNTHESIS); } + OPPONENT(SPECIES_NINETALES) { Ability(ABILITY_DROUGHT); }; + } WHEN { + for (turns = 0; turns < 5; turns++) + TURN {} + TURN { MOVE(opponent, MOVE_SUNNY_DAY); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_DROUGHT); + ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); + MESSAGE("The harsh sunlight activated Bellsprout's Protosynthesis!"); + MESSAGE("Bellsprout's Attack was heightened!"); + NONE_OF { + for (turns = 0; turns < 4; turns++) { + ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); + MESSAGE("The harsh sunlight activated Bellsprout's Protosynthesis!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } + } + ANIMATION(ANIM_TYPE_MOVE, MOVE_SUNNY_DAY, opponent); + ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); + MESSAGE("The harsh sunlight activated Bellsprout's Protosynthesis!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } +} + +SINGLE_BATTLE_TEST("Protosynthesis activates on switch-in") +{ + KNOWN_FAILING; // Fails because of wrong species + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_BELLSPROUT) { Ability(ABILITY_PROTOSYNTHESIS); } + OPPONENT(SPECIES_NINETALES) { Ability(ABILITY_DROUGHT); }; + } WHEN { + TURN { SWITCH(player, 1); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_DROUGHT); + ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); + MESSAGE("The harsh sunlight activated Bellsprout's Protosynthesis!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } +} diff --git a/test/battle/ability/quark_drive.c b/test/battle/ability/quark_drive.c index bce6795cae..abf0b7f5cb 100644 --- a/test/battle/ability/quark_drive.c +++ b/test/battle/ability/quark_drive.c @@ -85,3 +85,51 @@ SINGLE_BATTLE_TEST("Quark Drive either boosts Defense or Special Defense, not bo EXPECT_EQ(damage[0], damage[1]); } } + +SINGLE_BATTLE_TEST("Quark Drive ability pop up activates only once during the duration of electric terrain") +{ + u16 turns; + + GIVEN { + PLAYER(SPECIES_BELLSPROUT) { Ability(ABILITY_QUARK_DRIVE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_ELECTRIC_TERRAIN); } + for (turns = 0; turns < 4; turns++) + TURN {} + TURN { MOVE(opponent, MOVE_ELECTRIC_TERRAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRIC_TERRAIN, opponent); + ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); + MESSAGE("The Electric Terrain activated Bellsprout's Quark Drive!"); + MESSAGE("Bellsprout's Attack was heightened!"); + NONE_OF { + for (turns = 0; turns < 4; turns++) { + ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); + MESSAGE("The Electric Terrain activated Bellsprout's Quark Drive!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } + } + ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRIC_TERRAIN, opponent); + ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); + MESSAGE("The Electric Terrain activated Bellsprout's Quark Drive!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } +} + +SINGLE_BATTLE_TEST("Quark Drive activates on switch-in") +{ + KNOWN_FAILING; // Fails because of wrong species + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_BELLSPROUT) { Ability(ABILITY_QUARK_DRIVE); } + OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); }; + } WHEN { + TURN { SWITCH(player, 1); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); + ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); + MESSAGE("The Electric Terrain activated Bellsprout's Quark Drive!"); + MESSAGE("Bellsprout's Attack was heightened!"); + } +}