From da791cde9407641d3eb86700ffb8bd274a9a2d3a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 24 Oct 2024 12:41:38 -0400 Subject: [PATCH 01/23] Add TRY_DRAW_SPOT_PIXEL --- src/pokemon.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 077b856793..d59f46ada1 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5684,7 +5684,7 @@ u16 SpeciesToCryId(u16 species) // To draw a spot pixel, add 4 to the color index #define SPOT_COLOR_ADJUSTMENT 4 /* - The macro below handles drawing the randomly-placed spots on Spinda's front sprite. + The macros below handle drawing the randomly-placed spots on Spinda's front sprite. Spinda has 4 spots, each with an entry in gSpindaSpotGraphics. Each entry contains a base x and y coordinate for the spot and a 16x16 binary image. Each bit in the image determines whether that pixel should be considered part of the spot. @@ -5696,18 +5696,26 @@ u16 SpeciesToCryId(u16 species) coordinate is calculated as (baseCoord + (given 4 bits of personality) - 8). In effect this means each spot can start at any position -8 to +7 off of its base coordinates (256 possibilities). - The macro then loops over the 16x16 spot image. For each bit in the spot's binary image, if + DRAW_SPINDA_SPOTS loops over the 16x16 spot image. For each bit in the spot's binary image, if the bit is set then it's part of the spot; try to draw it. A pixel is drawn on Spinda if the - pixel on Spinda satisfies the following formula: ((u8)(colorIndex - 1) <= 2). The -1 excludes - transparent pixels, as these are index 0. Therefore only colors 1, 2, or 3 on Spinda will - allow a spot to be drawn. These color indexes are Spinda's light brown body colors. To create + pixel is between FIRST_SPOT_COLOR and LAST_SPOT_COLOR (so only colors 1, 2, or 3 on Spinda will + allow a spot to be drawn). These color indexes are Spinda's light brown body colors. To create the spot it adds 4 to the color index, so Spinda's spots will be colors 5, 6, and 7. - The above is done two different ways in the macro: one with << 4, and one without. This - is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels + The above is done in TRY_DRAW_SPOT_PIXEL two different ways: one with << 4, and one without. + This is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels (destPixels) is an 8 bit pointer, so it addresses two pixels. Shifting by 4 accesses the 2nd of these pixels, so this is done every other time. */ + +// Draw spot pixel if this is Spinda's body color +#define TRY_DRAW_SPOT_PIXEL(pixels, shift) \ + if (((*(pixels) & (0xF << (shift))) >= (FIRST_SPOT_COLOR << (shift))) \ + && ((*(pixels) & (0xF << (shift))) <= (LAST_SPOT_COLOR << (shift)))) \ + { \ + *(pixels) += (SPOT_COLOR_ADJUSTMENT << (shift)); \ + } + #define DRAW_SPINDA_SPOTS(personality, dest) \ { \ s32 i; \ @@ -5737,17 +5745,11 @@ u16 SpeciesToCryId(u16 species) /* of the two pixels is being considered for drawing */ \ if (column & 1) \ { \ - /* Draw spot pixel if this is Spinda's body color */ \ - if ((u8)((*destPixels & 0xF0) - (FIRST_SPOT_COLOR << 4))\ - <= ((LAST_SPOT_COLOR - FIRST_SPOT_COLOR) << 4))\ - *destPixels += (SPOT_COLOR_ADJUSTMENT << 4); \ + TRY_DRAW_SPOT_PIXEL(destPixels, 4); \ } \ else \ { \ - /* Draw spot pixel if this is Spinda's body color */ \ - if ((u8)((*destPixels & 0xF) - FIRST_SPOT_COLOR) \ - <= (LAST_SPOT_COLOR - FIRST_SPOT_COLOR)) \ - *destPixels += SPOT_COLOR_ADJUSTMENT; \ + TRY_DRAW_SPOT_PIXEL(destPixels, 0); \ } \ } \ \ From b60da57d8aad9b025e867900e55ccb83947e383a Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 12 Nov 2024 14:28:33 -0300 Subject: [PATCH 02/23] Remove usage of gHeap in sSpritePalettes_ContestantsTurnBlinkEffect Those offsets into gHeap are actually just inside of eContestTempSave. --- src/contest.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/contest.c b/src/contest.c index 5b9560faf5..40a42a3529 100644 --- a/src/contest.c +++ b/src/contest.c @@ -858,23 +858,22 @@ static const struct CompressedSpriteSheet sSpriteSheets_ContestantsTurnBlinkEffe } }; -// Yup this is super dangerous but that's how it is here static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = { { - .data = (u16 *)(gHeap + 0x1A0A4), + .data = eContestTempSave.cachedWindowPalettes[5], .tag = TAG_BLINK_EFFECT_CONTESTANT0 }, { - .data = (u16 *)(gHeap + 0x1A0C4), + .data = eContestTempSave.cachedWindowPalettes[6], .tag = TAG_BLINK_EFFECT_CONTESTANT1 }, { - .data = (u16 *)(gHeap + 0x1A0E4), + .data = eContestTempSave.cachedWindowPalettes[7], .tag = TAG_BLINK_EFFECT_CONTESTANT2 }, { - .data = (u16 *)(gHeap + 0x1A104), + .data = eContestTempSave.cachedWindowPalettes[8], .tag = TAG_BLINK_EFFECT_CONTESTANT3 } }; From 13692076f9374a41d9ee57e7bb424fc1789cbdbc Mon Sep 17 00:00:00 2001 From: surtr-games Date: Thu, 14 Nov 2024 00:29:42 -0500 Subject: [PATCH 03/23] Fixed a bug with Counter and Mirror Coat where they would be scored up depending on the wrong target mon type category. --- data/battle_ai_scripts.s | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index a43c889502..19ee9d18a5 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -1613,6 +1613,8 @@ AI_CV_Disable2: AI_CV_Disable_End: end +@ BUG: The original script would score up Counter when the target's types were not physical +@ This is incorrect since Counter only deals double the damage received if hit by a physical attack AI_CV_Counter: if_status AI_TARGET, STATUS1_SLEEP, AI_CV_Counter_ScoreDown1 if_status2 AI_TARGET, STATUS2_INFATUATION, AI_CV_Counter_ScoreDown1 @@ -1625,7 +1627,7 @@ AI_CV_Counter2: if_random_less_than 100, AI_CV_Counter3 score -1 AI_CV_Counter3: - if_has_move AI_USER, MOVE_MIRROR_COAT, AI_CV_Counter7 + if_has_move AI_USER, MOVE_MIRROR_COAT, AI_CV_Counter8 get_last_used_bank_move AI_TARGET get_move_power_from_result if_equal 0, AI_CV_Counter5 @@ -1645,15 +1647,24 @@ AI_CV_Counter5: if_random_less_than 100, AI_CV_Counter6 score +1 AI_CV_Counter6: +#ifdef BUGFIX + get_target_type1 + if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter7 + get_target_type2 + if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter7 + goto AI_CV_Counter_End +#else get_target_type1 if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter_End get_target_type2 if_in_bytes AI_CV_Counter_PhysicalTypeList, AI_CV_Counter_End - if_random_less_than 50, AI_CV_Counter_End +#endif AI_CV_Counter7: - if_random_less_than 100, AI_CV_Counter8 - score +4 + if_random_less_than 50, AI_CV_Counter_End AI_CV_Counter8: + if_random_less_than 100, AI_CV_Counter9 + score +4 +AI_CV_Counter9: end AI_CV_Counter_ScoreDown1: @@ -2100,6 +2111,8 @@ AI_CV_PsychUp_ScoreDown2: AI_CV_PsychUp_End: end +@ BUG: The original script would score up Mirror Coat when the target's types were not special +@ This is incorrect since Mirror Coat only deals double the damage received if hit by a special attack AI_CV_MirrorCoat: if_status AI_TARGET, STATUS1_SLEEP, AI_CV_MirrorCoat_ScoreDown1 if_status2 AI_TARGET, STATUS2_INFATUATION, AI_CV_MirrorCoat_ScoreDown1 @@ -2132,10 +2145,19 @@ AI_CV_MirrorCoat5: if_random_less_than 100, AI_CV_MirrorCoat6 score +1 AI_CV_MirrorCoat6: +#ifdef BUGFIX + get_target_type1 + if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat7 + get_target_type2 + if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat7 + goto AI_CV_MirrorCoat_End +#else get_target_type1 if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat_End get_target_type2 if_in_bytes AI_CV_MirrorCoat_SpecialTypeList, AI_CV_MirrorCoat_End +#endif +AI_CV_MirrorCoat7: if_random_less_than 50, AI_CV_MirrorCoat_End AI_CV_MirrorCoat_ScoreUp4: if_random_less_than 100, AI_CV_MirrorCoat_ScoreUp4_End From 6560bbab21ff171d7f0078d9f4966338f6466ef8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 23 Nov 2024 14:17:40 -0500 Subject: [PATCH 04/23] Restore .map file creation --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index a5f0224331..6252664bde 100644 --- a/Makefile +++ b/Makefile @@ -379,6 +379,7 @@ libagbsyscall: @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN) # Elf from object files +LDFLAGS = -Map ../../$(MAP) $(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS) libagbsyscall @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ | cat" From 4beb0efbcc202048fafa606147b7b5243ed55951 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 24 Nov 2024 22:46:01 -0300 Subject: [PATCH 05/23] Added extra encoded character support (#2050) --- src/mini_printf.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/mini_printf.c b/src/mini_printf.c index ac8a0ef127..e4b8937242 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -86,6 +86,8 @@ static inline char mini_pchar_decode(char encoded) ret = '('; // opening parentheses else if (encoded == CHAR_RIGHT_PAREN) ret = ')'; // closing parentheses + else if (encoded == CHAR_HYPHEN) + ret = '-'; // hyphen return ret; } @@ -133,7 +135,31 @@ static s32 _putsEncoded(char *s, s32 len, void *buf) { break; } - *(b->pbuffer ++) = mini_pchar_decode(s[i]); + if (s[i] == CHAR_NEWLINE) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'n'; + } + else if (s[i] == CHAR_PROMPT_SCROLL) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'l'; + } + else if (s[i] == CHAR_PROMPT_CLEAR) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'p'; + } + else if (s[i] == CHAR_ELLIPSIS) + { + *(b->pbuffer ++) = '.'; + *(b->pbuffer ++) = '.'; + *(b->pbuffer ++) = '.'; + } + else + { + *(b->pbuffer ++) = mini_pchar_decode(s[i]); + } } *(b->pbuffer) = 0; return b->pbuffer - p0; From 51fbc80ac5a9c9003bff03399f156e9366638a5d Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:32:46 +0100 Subject: [PATCH 06/23] Fixes Misty Terrain displaying wrong message (#5742) --- 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 7e0970bcab..f95b8f9901 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2784,7 +2784,7 @@ u8 DoBattlerEndTurnEffects(void) && !IsLeafGuardProtected(battler)) { CancelMultiTurnMoves(battler); - gEffectBattler = battler; + gEffectBattler = gBattlerTarget = battler; if (IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TERRAINPREVENTS_ELECTRIC; From 3343a16a7c00bb7eef9f7f261033ddd185d4c9cc Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:49:50 +0100 Subject: [PATCH 07/23] Fixes Dynamax dynamic move type (#5739) --- src/battle_dynamax.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index 073e2c55bc..e0b782d12c 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -280,7 +280,10 @@ static u16 GetTypeBasedMaxMove(u32 battler, u32 type) // Returns the appropriate Max Move or G-Max Move for a battler to use. u16 GetMaxMove(u32 battler, u32 baseMove) { - u32 move = baseMove; + u32 moveType; + SetTypeBeforeUsingMove(baseMove, battler); + GET_MOVE_TYPE(baseMove, moveType); + if (baseMove == MOVE_NONE) // for move display { return MOVE_NONE; @@ -291,18 +294,12 @@ u16 GetMaxMove(u32 battler, u32 baseMove) } else if (gMovesInfo[baseMove].category == DAMAGE_CATEGORY_STATUS) { - move = MOVE_MAX_GUARD; - } - else if (gBattleStruct->dynamicMoveType) - { - move = GetTypeBasedMaxMove(battler, gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK); + return MOVE_MAX_GUARD; } else { - move = GetTypeBasedMaxMove(battler, gMovesInfo[baseMove].type); + return GetTypeBasedMaxMove(battler, moveType); } - - return move; } // First value is for Fighting, Poison and Multi-Attack. The second is for everything else. From b3b0973fbb88b5ab368925d764ba3cbee289ae54 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:06:17 +0100 Subject: [PATCH 08/23] Fixes Population Bomb / Triple Kick missing message (#5747) --- asm/macros/battle_script.inc | 4 +--- include/config/battle.h | 2 +- src/battle_script_commands.c | 40 +++++++++++------------------------- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 6dbcabe43e..27488c25d8 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -798,9 +798,7 @@ 2: .endm - .macro setmultihitcounter value:req - .byte 0x8d - .byte \value + .macro unused_0x8d .endm .macro initmultihitstring diff --git a/include/config/battle.h b/include/config/battle.h index fbc41be6ba..1b19d0d2c9 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -6,7 +6,7 @@ #define B_CRIT_MULTIPLIER GEN_LATEST // In Gen6+, critical hits multiply damage by 1.5 instead of 2. #define B_PARALYSIS_SPEED GEN_LATEST // In Gen7+, Speed is decreased by 50% instead of 75%. #define B_CONFUSION_SELF_DMG_CHANCE GEN_LATEST // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. -#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. +#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See SetRandomMultiHitCounter for values. #define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) #define B_LIGHT_BALL_ATTACK_BOOST GEN_LATEST // In Gen4+, Light Ball doubles the power of physical moves in addition to special moves. #define B_SANDSTORM_SPDEF_BOOST GEN_LATEST // In Gen4+, Sandstorm weather multiplies the Sp. Defense of Rock-type Pokémon by x1.5. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f8619880d0..0375cfeed0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -481,7 +481,7 @@ static void Cmd_statbuffchange(void); static void Cmd_normalisebuffs(void); static void Cmd_setbide(void); static void Cmd_twoturnmoveschargestringandanimation(void); -static void Cmd_setmultihitcounter(void); +static void Cmd_unused_0x8d(void); static void Cmd_initmultihitstring(void); static void Cmd_forcerandomswitch(void); static void Cmd_tryconversiontypechange(void); @@ -740,7 +740,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_normalisebuffs, //0x8A Cmd_setbide, //0x8B Cmd_twoturnmoveschargestringandanimation, //0x8C - Cmd_setmultihitcounter, //0x8D + Cmd_unused_0x8d, //0x8D Cmd_initmultihitstring, //0x8E Cmd_forcerandomswitch, //0x8F Cmd_tryconversiontypechange, //0x90 @@ -2538,6 +2538,15 @@ static void Cmd_resultmessage(void) if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK)) { + if (gMultiHitCounter && gMultiHitCounter < gMovesInfo[gCurrentMove].strikeCount) + { + gMultiHitCounter = 0; + gMoveResultFlags &= ~MOVE_RESULT_MISSED; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings; + return; + } + if (gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK) // Wonder Guard or Levitate - show the ability pop-up CreateAbilityPopUp(gBattlerTarget, gBattleMons[gBattlerTarget].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0); stringId = gMissStringIds[gBattleCommunication[MISS_TYPE]]; @@ -12019,33 +12028,8 @@ static void Cmd_twoturnmoveschargestringandanimation(void) gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_setmultihitcounter(void) +static void Cmd_unused_0x8d(void) { - CMD_ARGS(u8 value); - - if (cmd->value) - { - gMultiHitCounter = cmd->value; - } - else - { - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK) - { - gMultiHitCounter = 5; - } - else - { - // WARNING: These seem to be unused, see SetRandomMultiHitCounter. - if (B_MULTI_HIT_CHANCE >= GEN_5) - // 35%: 2 hits, 35%: 3 hits, 15% 4 hits, 15% 5 hits. - gMultiHitCounter = RandomWeighted(RNG_HITS, 0, 0, 7, 7, 3, 3); - else - // 37.5%: 2 hits, 37.5%: 3 hits, 12.5% 4 hits, 12.5% 5 hits. - gMultiHitCounter = RandomWeighted(RNG_HITS, 0, 0, 3, 3, 1, 1); - } - } - - gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_initmultihitstring(void) From acdd447160f6e069a57b291ab551e0a65a181ee9 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:19:08 +0100 Subject: [PATCH 09/23] Changes Max Phantasm move anim script call (#5737) --- data/battle_anim_scripts.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 55abebbbf0..48ccc089dc 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -34257,7 +34257,7 @@ Move_G_MAX_TERROR:: Move_MAX_PHANTASM:: createvisualtask AnimTask_DynamaxGrowth, 0x5, 0x1, 0x1 waitforvisualfinish - goto Move_PHANTOM_FORCE + goto Move_SHADOW_BALL end Move_G_MAX_GRAVITAS:: From 987264caea512645d06d999531e56e7e4b4c1ac2 Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:35:44 +0100 Subject: [PATCH 10/23] Deoxys Sprite/Animation Fixes (#5603) --- graphics/pokemon/deoxys/anim_front.png | Bin 1484 -> 1494 bytes graphics/pokemon/deoxys/attack/anim_front.png | Bin 1705 -> 1787 bytes graphics/pokemon/deoxys/attack/normal.pal | 4 ++-- .../pokemon/deoxys/defense/anim_front.png | Bin 1280 -> 1670 bytes graphics/pokemon/deoxys/defense/normal.pal | 6 +++--- graphics/pokemon/deoxys/defense/shiny.pal | 2 +- graphics/pokemon/deoxys/normal.pal | 6 +++--- graphics/pokemon/deoxys/shiny.pal | 2 +- graphics/pokemon/deoxys/speed/anim_front.png | Bin 1599 -> 1681 bytes graphics/pokemon/deoxys/speed/normal.pal | 4 ++-- src/data/pokemon_graphics/front_pic_anims.h | 3 +-- 11 files changed, 13 insertions(+), 14 deletions(-) diff --git a/graphics/pokemon/deoxys/anim_front.png b/graphics/pokemon/deoxys/anim_front.png index d2f3e993818961667895514e9aca7a3d3685cef7..fc782931d1587be45130f8000e6b5e331e1eeace 100644 GIT binary patch delta 1463 zcmV;o1xWhL3)TyeB!35VNliru=n5MS9v0DHT=W0{02g#cSaefwW^{L9a%BKVOhiyl zM<8}(av(DOV1ZP1_K>z@;j|==^1poj5 zFi=cXMfjkw%t1l;u#o?AN? zME|7+^2GoE1o}xtK~#90wU*C|<2Dq>Jzy~CCSvH~|H8b?(gq4K($Et2&=N#4OV2$l z6lT~OyXmE27@`__oV^unk~FEHyO&<}U+A@$rGLU4y7xUy`y@N@kJw3Js1AcY?~||I zd$OdjWivf_6f_i^=ayO&3hKwZuU0Oov<7@(5iNn4@n`G1?=!0E zDTY5-76M%Na3tT!IZYctssS6k%*BVFmA`4v@p`6htb4sz$a#0Jw)6dEUpJLpPCAho=z*4Bf-_ux1oTf-2F+g4# z^SxI~1U{N=CFE=72ou@^zrOtw0h*HS;+ncz;JH--4)cHcSpzsBSx>|@O3X~e-kK$k zmoWH7$5Smme-VplS4!Z?MHGo7(;3pd*Gj5TjHuMp=FWy5TWs+ES8OP^9Jv@9U zIxK`t($r#JxvtC~y!rd#gSX0oiJ6(D6~M(MQXYU2e^q&jbpW@7&wy4`tANcs+5>mr zsiKGFGY>qB_523ll>&X5AwcT@*#n=00RlIu0ecDiCHR3C&;aA3N*woFj)!{kz+34# zssfmsd3C6FzN;TiBkwKNsUxz{U)`GzV&pEK@B~v(KRm z@P<2}e=SD~TjZKt#(tXsW{(6nKbe+(E+YMOQ z>Yyvf-N;S>1_G&?RXDZPAtR84xs8g5&gj`3QiO`GMpB7f*m~j zP0W7B6MKJ2gm_iS^>ntY0{wxM?x?&(*7zI zf7TG+=qRnmod^{ca*3A>9x!}_pZ&ZBgj1abY5*buxSp1%3J8qpG;!z#;(;t_uOi_{ zljUx_)JHmneuYpvubGN-;2LrdQa5u1+u|raB8)x#I)i>4C`X3Z-lwnrf4gs1)=F*PS*ck(Ee~zVe05MjGCL;?vT#R!A z=0YQ^!$L6db7=9002ovPDHLkV1musmb(A| delta 1466 zcmV;r1x5PS3(O0UB!4haOjJeqps=`TX!x*@_;5&II5=p?;8-{?I8b0vkg%9wuoxH^ z`1tt1z|e3wh*(ficzAFfL~c<4000SaNLh0L01m_e01m_fl`9S#000F-NklKfU*6-kbN{T9&!!2iD$257}P1 zeGmNMKH#%M@b{^>^Z7&Y=@-2^s4K*=&mia_Y`8xb!vDyHpa(dL9|>_vDR@05BJYtn z`I}PO2Uw%0=YKzb&*-S=1FY4#k~HcSBk(%w*RL1(IoqROujjK-G~6SPSn9!^v$j78 zvH*Cmibx&;4FlSzB7#2-0T&(h$)SYN0^{wgE;#{Evp}g3!wHKHAOtVX2QQwL{(%C2 zm#|@Qk*UG+ze<{B%7vYsgis_oVK1I>dhjGxJ1Kz*9Dh+*a-=95CSp>yRS+ngF#?zj z%yL9b+A6|`*J zy?UhxUX3KSLKEjl=r}Q93cbch%J~}71&%Eo)%ThZ!p4bLZ>P;ZPuC7O* z0WrZXH-Gj~dI%8k;OqYe{teJ@LL!h`q32@Aea+Orc)ld8HSi{Y zbh^ZhXCsSjG)NO*DY^jq)eT_WAMT|ktW%&iVSmQLk_S250F?$anwDJwmC<^eycsKW zLIdk6j0c54_PFUIu8Z8QtDo)8Jj=-*w@Oi(Z>pcI|3RQ=0dv^`3>WZ)2@pJp7Vucs zm8Ak?6L2PYmon+m^~Tn~K{mMol6abmoFlOIi?@LbA;fq=M_ZuK(bYDl>qAt``#-JZAMOqa&b0A>6T(i% zSvF1#M+`6%9=~5^+n_Mv0%hMdfkd3HHhIMYcw7kT}{Ui}*XBROltCK2;A7xT>* z~fgd3fMe3JUs#wWb8-Gc& zGmW?(^Dk#+q%r?do@)q;(5Lspug#4nwj8^6q29kI3gCW>@ypvl zh#tPbx?1?FY>qLWF55N`7+qamhcKvsdDgZOQbxbI{uldeI*)aX+cpqzgX<6js+2fQ zb5iU$>EYE4t81~0cf=Lo>i(>O9rbzCt|`;+==x1dK}B0obW-7~y2=f{rLY!6MKJMEe_ZUy%KGQDL!sFu79Aj9g<|I8)+ U@k3AW7XSbN07*qoM6N<$f{6jhNdN!< diff --git a/graphics/pokemon/deoxys/attack/anim_front.png b/graphics/pokemon/deoxys/attack/anim_front.png index 0b43a9fe11e147604f6fb112102d703d15d38de5..566e80eafd01372ad38973a81193358cd53aade8 100644 GIT binary patch delta 186 zcmZ3<``sf3odCsWfl*^R3-)n2JsTth?3y^w370~qErTVAC~|>cZIUl zA_ZeTlfu>|4}nTJN(%hkfilKGHiK7#raX{hNq6*hWMJ6X&;2Kn705RT@CkAKv0y`j zg~k73uQQI05)u*_CmsY$*f1kugGE3>fknrU9}_(Vq&K|Eiw3G^O!9Vj`M;F?(@_Qn hHhE7M$B>FS8*60Q1pY}WvjgQBJYD@<);T3K0RUEdIz|8h delta 84 zcmey(yOMW;il9M&Pl)S}1sf79EPfPt?8wNN*sr3TH|d2h0|NtRfk$L90|Va?5N4dJ l%_q&kz$WkM;usRqy78PWn}EP`+YF#O22WQ%mvv4FO#sU48dLxP diff --git a/graphics/pokemon/deoxys/attack/normal.pal b/graphics/pokemon/deoxys/attack/normal.pal index 246d4784a2..52ddbb8fc6 100644 --- a/graphics/pokemon/deoxys/attack/normal.pal +++ b/graphics/pokemon/deoxys/attack/normal.pal @@ -3,8 +3,8 @@ JASC-PAL 16 248 160 176 96 56 56 -248 112 72 -184 104 104 +255 115 74 +204 65 65 24 24 24 104 200 224 80 144 176 diff --git a/graphics/pokemon/deoxys/defense/anim_front.png b/graphics/pokemon/deoxys/defense/anim_front.png index 2ee6e0c527eddef7c6f11f0f0e651cb6cbbf429d..ce3cdad39cf4eaeca8018faa22cef35fdac81e0e 100644 GIT binary patch delta 1640 zcmV-u2ABDO3Wg1kB!35VNliru=n5MSAShA9S|R`d02g#cSaefwW^{L9a%BKVOhiyl zM<8}(av(DOV1ZP1_K>z@;j|==^1poj5 zFi=cXMfjkwU^qC;K|%j>N< zME|7+^2GoE1*%CzK~#90t(VPeBS#R&)xJc`Nz)D1;#0Z?5~G`@U{~xpFJdqBD25#5 z1+{Hh@cJMPX3u*G0civ)r$g>}gs|ke5OUaeNmciZG&A}LhV;Q7)4!>zuCA{BPp8uy zI_`Cj4UITFMu?Y&e~2T1G9TX{E{+)ZaY`m$A2u+(H8*hz2TjQSZT8_az~GRF*MHuQ zKmP%6$b=ZWcUSHKK%ecOU!i$tvTM+B?Dhfc3!MHmwE!`knmt5hG}?F8f(C7@-3?=X zImB1??`u$anoZ>0j)Bt)RLBN!XeJV%wI!nPKnjqc&SZk9f17|rJ;5Ok9C_#ifeAKD z2zmt&rE?N7RS2&Rh5qjp--8O zlCTs?)_`|nf4=dtqE+#eA}QxX!OY)Q0QvM=6G1ure5X4}gAWlraK6KQS&|!o5_@_d z(h-2(7SJJ!dV1ffnP>rmLNFePJA#S$+m2f_00@A+Vt}nt2z?KbD_=37 zSI7(51pt&!LrgygHGnq4jKhus17yc9bshkU5!TbOf8Q}hwM1L3LNe$4TQ`6NDM+a) z>R6V*padugnd-0?1W3@mZdL=VS#*j3up{z-x_f~>?d)}6DM}A;B9%WJIGZ$pE0LxU zGOgGEj*Pc7=&U?o??j3XV3yT@wapg_6F%3@EelN^M#g*aKw1GQ_%`c-(!d6I6v)B& zT8ao5f0+xvE%bnZfxUSYL%&2{Y=ul_MqycfA^>#w5zE#T$@9tp0bKJ87~Hl;aZVxD zfEV^=InC+~R?ch{BOj|Ln=h&N)cUKSMc@`#tn-3^dOLVgrlIGL3j_V@2GBK`s*V@| zQC>)BHmzBs~ z_0o{OIIJH8nvaIh&mj|DfV@FGs2?N=knFum4+DKtD1UMB>|aPs0>pgyjRnSD{UDYk ze?W|T;`zP$VSS-qUG&XC{ScjAs(kgDj^KX%5G|+FRvvIEK?VKL+>=Oxc`-BNL}?Zn zGD(|6L>Gmb8Ef97_mG5ZVGHms<`mgfjUE#0PeM=Lo<^1zBa>Mh<7})e1(I&hGpP=0 zjFtqzxiJrPYf#6O+_-yNU_=hA8qJKkf7C&N#0gX;s7>R@vV%GK83W&9{BK$ZhV$Tn z0)5aVFmgAy8!_d9wRb>)OvfNuU_@@R0WiT~#11$RYaWVF5lcwQDAkZ|v*5t8iJ|mc zB|w!xfpLt%0gtOBXlof)3fggMO9wPQ<;jrJEaFWQq9S?KjcyIm5%FES7mO8aAq z&fW%)zz3_>GJsygoH=&}9>6xh`a;JGz6S!(^r42~Kodav!UGK-!h|LI)w4vQF9~b{ z+=7Q^3;*Ae_Jm|#{jUDTysadT=gG%+ZyJE*t9+Y1GGVg%ZQi%njr}1LUi3v)10;QZ z=|!jZAThQ9v_G2!d~dJy5r8DPg(lGYtP-H*HYm<+3m_8>V7JDKHn3;`Y;|!QfQE+I mEz;syK;+sU{uhN2WXr#DE;#sW?fH%X0000`@VP+*u~uoxH^ z`1tt1z|e3whyVZp0000DLkd>_000SaNLh0L01m_e01m_fl`9S#000DbNklqrBaQ`m9z9Rj$QfW;TDqv!~J5MBWGSFfY*{{#=woMN&2@`vc>r61t> zaAQ=EEafligrPhxNXQPK=~qOME;%fqt<*6|%0Tk+XCgrD9#4>o5+EKI;F z^Z=e?HB10w=qt~=2-xBlH|i~|#->EUO~4U1fBj9sDm4OZl?I#Nex=n~$KWkFuNsw%Df@l?lL$MO+FqU~7Ov`+syQf&hw83LVK)oB*WpRuv>+ zX)TL|K?DIza2H;}5;rChx=P@o3!Dlqa(663YeYC9LP?F_`9!4#1P^JMN?qw~h!q$;J}XdW-U78r=2A_!ol&tcRo4d56^5kn7(7Pw{x zK=_KjR)Aj5o(Nm4;xfc)S^`L)Zp09f1XMq10IFR#0CGw4E5K_2w_gSmq?*;g*hoi| zfOHIqSpf3%{tkM8rS}i-1G^7N^8>>xy%^Mp4u7zbfanSM@eKj}M%2Kr1=b&u8t6pm zKFNL70N#4L;~Ee{;N&%cy_P%O%3dSb5I~t}ARPmK2dtn0T9ph4IQq>yU5Gq3o+IR3XN|A9rZz4&;Zu_!h}b;m!twMF5D zAbPriUoHrAxMUAY($Gl}JWR9H6Y4Ikp&{fQMLK;~~oEVdZp?gW-<$ z1SODc9noD^!nr!?{S>wkTvCFZrpY*c)qlhg061S$f>>@7c)L12$`b^=IkZM9loH4) z1)bG&1PGs@P9P~oRiOgbSII(p>~bBKGAZ@0blic1cnnY+qAD)a3|-51#i|cH+)=zv zARiJym#)sF-v=jY<2$vD4jI59A1t}EZU3)GW|SNbQFJrt^;tIm*Pq*nMmz+ZeSf7- z)f^F%P32Hbojlc~lIe{#9!gafMO9hUG;TSqMNvvUPQx_%7R5B2zC|$ttwllLMxe7O zM$1bHu(K#;pnS3@W)TEHV^NHNgRCn}9g$9%a4z_s1!)*g*&E Wqydg=Q!o7h0000`sf3odCsB~~@vl&cI34B{oO5hcO-X(i=}MX3z#J}v=%?h0k8 zMGD4xCWWm_9s-qcloa^617(bXYzD6eO?e>2lJ4m1$iT3%pZiZD>qJFy&i}<;5)u+; z933Y*N=QrWyr>9N#F*sm?(%;r`=_G}46Iu{T^vIy=4`Cl%qqZOck>0vFi%%Mmvv4F FO#lqnF2Mi* delta 116 zcmbQpyPs!*N`ygxPl)S}1sf~^5&|Y{$T;yJ!NTH4fro^I#DR>A0|ze5NZ9b>$BzPw zj);JOii!dTFnDcYcooRtEbxddW?X?_wfUqO7+AM@x;TbJv~E1NnN{Fb@P>~d N4W6!kF6*2UngDyWDt`a~ diff --git a/graphics/pokemon/deoxys/speed/normal.pal b/graphics/pokemon/deoxys/speed/normal.pal index dad052e1da..ea1073a0ee 100644 --- a/graphics/pokemon/deoxys/speed/normal.pal +++ b/graphics/pokemon/deoxys/speed/normal.pal @@ -6,9 +6,9 @@ JASC-PAL 80 144 176 104 200 224 96 56 56 -248 112 72 +255 115 74 24 24 24 -192 104 104 +204 65 65 192 192 208 152 96 176 248 248 248 diff --git a/src/data/pokemon_graphics/front_pic_anims.h b/src/data/pokemon_graphics/front_pic_anims.h index d802521afe..5b49ed6d20 100644 --- a/src/data/pokemon_graphics/front_pic_anims.h +++ b/src/data/pokemon_graphics/front_pic_anims.h @@ -5205,8 +5205,7 @@ static const union AnimCmd sAnim_DeoxysNormal_1[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_FRAME(1, 16), - ANIMCMD_FRAME(0, 26), - ANIMCMD_FRAME(1, 16), + ANIMCMD_FRAME(1, 26), ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; From 0ca588943b47606b6abd91c757b0b27e9001f518 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:45:35 +0100 Subject: [PATCH 11/23] Fixes choiced moves not locked in after ability block (#5738) --- include/battle.h | 2 +- include/battle_util.h | 1 + src/battle_script_commands.c | 40 -------------------------- src/battle_util.c | 56 ++++++++++++++++++++++++++++++++---- test/battle/ai/ai.c | 25 ++++++++++++++++ 5 files changed, 77 insertions(+), 47 deletions(-) diff --git a/include/battle.h b/include/battle.h index 20afe876ca..d32481ee4d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -802,8 +802,8 @@ struct BattleStruct u8 categoryOverride; // for Z-Moves and Max Moves u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side u8 fickleBeamBoosted:1; - u8 obedienceResult:3; u8 redCardActivates:1; + u8 padding:6; u8 usedMicleBerry; }; diff --git a/include/battle_util.h b/include/battle_util.h index 71d81ce3bb..0d73a0a9dd 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -82,6 +82,7 @@ enum CANCELLER_SKY_DROP, CANCELLER_ASLEEP, CANCELLER_FROZEN, + CANCELLER_OBEDIENCE, CANCELLER_TRUANT, CANCELLER_RECHARGE, CANCELLER_FLINCH, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0375cfeed0..ede9c07332 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1282,46 +1282,6 @@ static void Cmd_attackcanceler(void) gHitMarker &= ~HITMARKER_ALLOW_NO_PP; - if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) - { - switch (gBattleStruct->obedienceResult) - { - case OBEYS: - break; - case DISOBEYS_LOAFS: - // Randomly select, then print a disobedient string - // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE - gBattleCommunication[MULTISTRING_CHOOSER] = MOD(Random(), NUM_LOAF_STRINGS); - gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; - gMoveResultFlags |= MOVE_RESULT_MISSED; - return; - case DISOBEYS_HITS_SELF: - gBattlerTarget = gBattlerAttacker; - gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); - gBattlescriptCurrInstr = BattleScript_IgnoresAndHitsItself; - gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gHitMarker |= HITMARKER_OBEYS; - return; - case DISOBEYS_FALL_ASLEEP: - gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep; - gMoveResultFlags |= MOVE_RESULT_MISSED; - return; - case DISOBEYS_WHILE_ASLEEP: - gBattlescriptCurrInstr = BattleScript_IgnoresWhileAsleep; - gMoveResultFlags |= MOVE_RESULT_MISSED; - return; - case DISOBEYS_RANDOM_MOVE: - gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; - SetAtkCancellerForCalledMove(); - gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove; - gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE); - gHitMarker |= HITMARKER_DISOBEDIENT_MOVE; - gHitMarker |= HITMARKER_OBEYS; - return; - } - } - - gHitMarker |= HITMARKER_OBEYS; // Check if no available target present on the field or if Sky Battles ban the move if ((NoTargetPresent(gBattlerAttacker, gCurrentMove) && (!gBattleMoveEffects[gMovesInfo[gCurrentMove].effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))) diff --git a/src/battle_util.c b/src/battle_util.c index f95b8f9901..6f0b2af880 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -145,8 +145,6 @@ void HandleAction_UseMove(void) gBattleScripting.savedMoveEffect = 0; gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerAttacker); - gBattleStruct->obedienceResult = GetAttackerObedienceForAction(); - // choose move if (gProtectStructs[gBattlerAttacker].noValidMoves) { @@ -3222,7 +3220,8 @@ void SetAtkCancellerForCalledMove(void) u8 AtkCanceller_UnableToUseMove(u32 moveType) { - u8 effect = 0; + u32 effect = 0; + u32 obedienceResult; do { switch (gBattleStruct->atkCancellerTracker) @@ -3306,6 +3305,53 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) } gBattleStruct->atkCancellerTracker++; break; + case CANCELLER_OBEDIENCE: + obedienceResult = GetAttackerObedienceForAction(); + if (obedienceResult != OBEYS + && !(gHitMarker & HITMARKER_NO_PPDEDUCT) // Don't check obedience after first hit of multi target move or multi hit moves + && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) + { + switch (obedienceResult) + { + case DISOBEYS_LOAFS: + // Randomly select, then print a disobedient string + // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE + gBattleCommunication[MULTISTRING_CHOOSER] = MOD(Random(), NUM_LOAF_STRINGS); + gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; + gMoveResultFlags |= MOVE_RESULT_MISSED; + break; + case DISOBEYS_HITS_SELF: + gBattlerTarget = gBattlerAttacker; + gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); + gBattlescriptCurrInstr = BattleScript_IgnoresAndHitsItself; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + gHitMarker |= HITMARKER_OBEYS; + break; + case DISOBEYS_FALL_ASLEEP: + gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep; + gMoveResultFlags |= MOVE_RESULT_MISSED; + break; + case DISOBEYS_WHILE_ASLEEP: + gBattlescriptCurrInstr = BattleScript_IgnoresWhileAsleep; + gMoveResultFlags |= MOVE_RESULT_MISSED; + break; + case DISOBEYS_RANDOM_MOVE: + gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; + SetAtkCancellerForCalledMove(); + gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove; + gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE); + gHitMarker |= HITMARKER_DISOBEDIENT_MOVE; + gHitMarker |= HITMARKER_OBEYS; + break; + } + effect = 1; + } + else + { + gHitMarker |= HITMARKER_OBEYS; + } + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_TRUANT: // truant if (GetBattlerAbility(gBattlerAttacker) == ABILITY_TRUANT && gDisableStructs[gBattlerAttacker].truantCounter) { @@ -3554,7 +3600,6 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleMoveDamage = GetNonDynamaxMaxHP(gBattlerAttacker) / 4; if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE - || gBattleStruct->obedienceResult != OBEYS || HasTrainerUsedGimmick(gBattlerAttacker, GIMMICK_Z_MOVE)) gBattlescriptCurrInstr = BattleScript_MoveUsedPowder; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3575,8 +3620,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_Z_MOVES: - if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE - && gBattleStruct->obedienceResult == OBEYS) + if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE) { // For Z-Mirror Move, so it doesn't play the animation twice. bool32 alreadyUsed = HasTrainerUsedGimmick(gBattlerAttacker, GIMMICK_Z_MOVE); diff --git a/test/battle/ai/ai.c b/test/battle/ai/ai.c index a19481c7ed..b52e64262d 100644 --- a/test/battle/ai/ai.c +++ b/test/battle/ai/ai.c @@ -805,3 +805,28 @@ AI_SINGLE_BATTLE_TEST("AI uses a guaranteed KO move instead of the move with the NOT MESSAGE("Wobbuffet fainted!"); } } + +AI_SINGLE_BATTLE_TEST("AI stays choice locked into moves in spite of the player's ability disabling them") +{ + u32 playerMon, ability, aiMove; + PARAMETRIZE { ability = ABILITY_DAZZLING; playerMon = SPECIES_BRUXISH; aiMove = MOVE_QUICK_ATTACK; } + PARAMETRIZE { ability = ABILITY_QUEENLY_MAJESTY; playerMon = SPECIES_TSAREENA; aiMove = MOVE_QUICK_ATTACK; } + PARAMETRIZE { ability = ABILITY_ARMOR_TAIL; playerMon = SPECIES_FARIGIRAF; aiMove = MOVE_QUICK_ATTACK; } + PARAMETRIZE { ability = ABILITY_SOUNDPROOF; playerMon = SPECIES_EXPLOUD; aiMove = MOVE_BOOMBURST; } + PARAMETRIZE { ability = ABILITY_BULLETPROOF; playerMon = SPECIES_CHESNAUGHT; aiMove = MOVE_BULLET_SEED; } + + GIVEN { + ASSUME(gItemsInfo[ITEM_CHOICE_BAND].holdEffect == HOLD_EFFECT_CHOICE_BAND); + ASSUME(gMovesInfo[MOVE_QUICK_ATTACK].priority == 1); + ASSUME(gMovesInfo[MOVE_BOOMBURST].soundMove == TRUE); + ASSUME(gMovesInfo[MOVE_BULLET_SEED].ballisticMove == TRUE); + ASSUME(gMovesInfo[MOVE_TAIL_WHIP].category == DAMAGE_CATEGORY_STATUS); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(playerMon) { Ability(ability); } + OPPONENT(SPECIES_SMEARGLE) { Item(ITEM_CHOICE_BAND); Moves(aiMove, MOVE_TACKLE); } + } WHEN { + TURN { SWITCH(player, 1); EXPECT_MOVE(opponent, aiMove); } + TURN { EXPECT_MOVE(opponent, aiMove); } + } +} From 6fe935f1b8b8d3eb515c794fd2212b1b97cdbde1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 14:04:13 -0300 Subject: [PATCH 12/23] Version 1.9.4 --- .../ISSUE_TEMPLATE/01_battle_engine_bugs.yaml | 3 +- .../ISSUE_TEMPLATE/02_battle_ai_issues.yaml | 3 +- .github/ISSUE_TEMPLATE/04_other_errors.yaml | 3 +- README.md | 4 +- docs/SUMMARY.md | 1 + docs/changelogs/1.9.x/1.9.4.md | 200 ++++++++++++++++++ include/constants/expansion.h | 4 +- 7 files changed, 211 insertions(+), 7 deletions(-) create mode 100644 docs/changelogs/1.9.x/1.9.4.md diff --git a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml index 8240a56801..6a654402ac 100644 --- a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml +++ b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml @@ -23,9 +23,10 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.3 (Latest release) + - 1.9.4 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 diff --git a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml index 5688f8a7fb..ff9823aa01 100644 --- a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml +++ b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml @@ -23,9 +23,10 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.3 (Latest release) + - 1.9.4 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 diff --git a/.github/ISSUE_TEMPLATE/04_other_errors.yaml b/.github/ISSUE_TEMPLATE/04_other_errors.yaml index add0633d95..ab400f7b9d 100644 --- a/.github/ISSUE_TEMPLATE/04_other_errors.yaml +++ b/.github/ISSUE_TEMPLATE/04_other_errors.yaml @@ -23,9 +23,10 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.3 (Latest release) + - 1.9.4 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 diff --git a/README.md b/README.md index 5330e40981..823a02479c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ pokeemerald-expansion is a decomp hack base project based off pret's [pokeemeral If you use pokeemerald-expansion in your hack, please add RHH (Rom Hacking Hideout) to your credits list. Optionally, you can list the version used, so it can help players know what features to expect. You can phrase it as the following: ``` -Based off RHH's pokeemerald-expansion 1.9.3 https://github.com/rh-hideout/pokeemerald-expansion/ +Based off RHH's pokeemerald-expansion 1.9.4 https://github.com/rh-hideout/pokeemerald-expansion/ ``` Please follow the instructions in `INSTALL.md` to get pokeemerald-expansion set up on your machine. @@ -177,7 +177,7 @@ With this, you'll get the latest version of pokeemerald-expansion, plus a couple - Check your current version. - You can check in the debug menu's `Utilities -> Expansion Version` option. - If the option is not available, you possibly have version 1.6.2 or older. In that case, please check the [changelogs](CHANGELOG.md) to determine your version based on the features available on your repository. -- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.9.3, use `git pull RHH expansion/1.9.3`). +- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.9.4, use `git pull RHH expansion/1.9.4`). - ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on) - Alternatively, you can update to unreleased versions of the expansion. - ***master (stable):*** It contains unreleased **bugfixes** that will come in the next patch version. To merge, use `git pull RHH master`. diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index ac4698fdc3..ab016136a1 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -19,6 +19,7 @@ - [How to use the Testing System](tutorials/how_to_testing_system.md) - [Changelog](./CHANGELOG.md) - [1.9.x]() + - [Version 1.9.4](changelogs/1.9.x/1.9.4.md) - [Version 1.9.3](changelogs/1.9.x/1.9.3.md) - [Version 1.9.2](changelogs/1.9.x/1.9.2.md) - [Version 1.9.1](changelogs/1.9.x/1.9.1.md) diff --git a/docs/changelogs/1.9.x/1.9.4.md b/docs/changelogs/1.9.x/1.9.4.md new file mode 100644 index 0000000000..36dc2afc73 --- /dev/null +++ b/docs/changelogs/1.9.x/1.9.4.md @@ -0,0 +1,200 @@ +# Version 1.9.4 + +```md +## How to update +- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`. +- Once you have your remote set up, run the command `git pull RHH expansion/1.9.4`. +``` + +## 🌋 IMPORTANT 🌋 +- This update integrates pret's latest Makefile changes, which rearranges the entire file in order to speed up compilation times overall. If you did any changes to it (such as installing Poryscript) and are having issues resolving the conflicts, keep expansion's version of Makefile and reapply your changes afterwards. + +## 🧬 General 🧬 +### Fixed +* Fixed alignment errors in `EWRAM_INIT` and friends when using u8, u16, etc. by @aronson in [#5512](https://github.com/rh-hideout/pokeemerald-expansion/pull/5512) +* Update test LD script to respect 4 byte data section alignment by @aronson in [#5517](https://github.com/rh-hideout/pokeemerald-expansion/pull/5517) +* Fixed Missing `string_util.h` include in `mini_printf.c` by @mrgriffin in [#5572](https://github.com/rh-hideout/pokeemerald-expansion/pull/5572) +* Fixed unnecessary dependency scanning for test build and test rom names by @ravepossum in [#5594](https://github.com/rh-hideout/pokeemerald-expansion/pull/5594) +* Fixed makefile: dependencies for `map_group_count.h` by @SBird1337 in [#5648](https://github.com/rh-hideout/pokeemerald-expansion/pull/5648) + - Fixes an issue that caused the build to fail on updates to `src/debug.c` due to mismatched dependency. + +## 🗺️ Overworld 🗺️ +### Changed +* Followers sprite fixes by @Cafeei in [#5669](https://github.com/rh-hideout/pokeemerald-expansion/pull/5669) +* Follower fixes, Melmetal, Patrat, Woobat by @hedara90 in [#5685](https://github.com/rh-hideout/pokeemerald-expansion/pull/5685) +* Fixed Farfetch'd overworld sprite by @hedara90 in [#5711](https://github.com/rh-hideout/pokeemerald-expansion/pull/5711) + +### Fixed +* Fixed Berry mutations always generating a Persim Berry by @Bassoonian in [#5504](https://github.com/rh-hideout/pokeemerald-expansion/pull/5504) + +## 🐉 Pokémon 🐉 +### Changed +* Changing `EVO_NONE` from `0xFFFE` to `0` by @GhoulMage in [#5547](https://github.com/rh-hideout/pokeemerald-expansion/pull/5547) + - There could be a case for out of bounds errors if arrays or iterations are happening where you're using + 1 or - 1, as `EVO_FRIENDSHIP` used to be the first index although it started with 1. +* PokeCommunity sprites batch (October) by @kittenchilly in [#5655](https://github.com/rh-hideout/pokeemerald-expansion/pull/5655) +* Followers sprite fixes by @Cafeei in [#5669](https://github.com/rh-hideout/pokeemerald-expansion/pull/5669) +* Follower fixes, Melmetal, Patrat, Woobat by @hedara90 in [#5685](https://github.com/rh-hideout/pokeemerald-expansion/pull/5685) +* Fixed Farfetch'd overworld sprite by @hedara90 in [#5711](https://github.com/rh-hideout/pokeemerald-expansion/pull/5711) + +### Fixed +* Fixed `P_FRIENDSHIP_EVO_THRESHOLD` not checking for Gen 8 by @kittenchilly in [#5503](https://github.com/rh-hideout/pokeemerald-expansion/pull/5503) +* Fixed HGSS dex search printing wrong mon after selecting evos by @ravepossum in [#5552](https://github.com/rh-hideout/pokeemerald-expansion/pull/5552) +* Fixed 64px uncompressed followers by @hedara90 in [#5601](https://github.com/rh-hideout/pokeemerald-expansion/pull/5601) +* Deoxys Sprite/Animation Fixes by @SarnPoke in [#5603](https://github.com/rh-hideout/pokeemerald-expansion/pull/5603) +* Fixes Aegislash not reverting back by @AlexOn1ine in [#5734](https://github.com/rh-hideout/pokeemerald-expansion/pull/5734) + +## ⚔️ Battle General ⚔️ +### Changed +* Fixed damage calc modifiers by @AlexOn1ine in [#5604](https://github.com/rh-hideout/pokeemerald-expansion/pull/5604) + +### Fixed +* Fixed Shiny Pokemon not being shiny after transforming with a gimmick by @hedara90 in [#5573](https://github.com/rh-hideout/pokeemerald-expansion/pull/5573) +* Handle showdowns apostrophe the same way as ASCII apostrophe by @cawtds in [#5712](https://github.com/rh-hideout/pokeemerald-expansion/pull/5712) +* Fixes Misty Terrain displaying wrong message by @AlexOn1ine in [#5742](https://github.com/rh-hideout/pokeemerald-expansion/pull/5742) +* Fixes Dynamax dynamic move type by @AlexOn1ine in [#5739](https://github.com/rh-hideout/pokeemerald-expansion/pull/5739) + +## 🤹 Moves 🤹 +### Changed +* Fixed damage calc modifiers by @AlexOn1ine in [#5604](https://github.com/rh-hideout/pokeemerald-expansion/pull/5604) +* Updated ability popups for Skill Swap, Mummy/Lingering Aroma, Worry Seed, Simple Beam, fix Doodle/Role Play bugs by @PhallenTree in [#5493](https://github.com/rh-hideout/pokeemerald-expansion/pull/5493) + +### Fixed +* Fixed Follow Me failing in Single Battles for Gen 6/7 config by @AsparagusEduardo in [#5542](https://github.com/rh-hideout/pokeemerald-expansion/pull/5542) +* Fixed `AnimTask_HorizontalShake` uses for shaking screen in battle anims by @ghoulslash in [#5562](https://github.com/rh-hideout/pokeemerald-expansion/pull/5562) +* Fixed weather genie move anims and Springtide Storm targets by @ravepossum in [#5553](https://github.com/rh-hideout/pokeemerald-expansion/pull/5553) +* Fixes Magic Guard not preventing Salt Cure by @AlexOn1ine in [#5583](https://github.com/rh-hideout/pokeemerald-expansion/pull/5583) +* Fixes Dragon Tail using the effect twice during a Parental Bond attack by @AlexOn1ine in [#5630](https://github.com/rh-hideout/pokeemerald-expansion/pull/5630) +* Fixes Magic Coat message by @AlexOn1ine in [#5645](https://github.com/rh-hideout/pokeemerald-expansion/pull/5645) +* Fixes Take heart by @AlexOn1ine in [#5658](https://github.com/rh-hideout/pokeemerald-expansion/pull/5658) +* Fixed Floral Healing anim by @AlexOn1ine in [#5733](https://github.com/rh-hideout/pokeemerald-expansion/pull/5733) +* Fixes Population Bomb / Triple Kick missing message by @AlexOn1ine in [#5747](https://github.com/rh-hideout/pokeemerald-expansion/pull/5747) +* Changes Max Phantasm move anim script call by @AlexOn1ine in [#5737](https://github.com/rh-hideout/pokeemerald-expansion/pull/5737) +* Fixes Partner targeting and Acupressure/Ally Switch interaction by @AlexOn1ine in [#5446](https://github.com/rh-hideout/pokeemerald-expansion/pull/5446) +* Revival Blessing fixes + Using Lunar Blessing's animation by @ghoulslash in [#5490](https://github.com/rh-hideout/pokeemerald-expansion/pull/5490) +* Fixed curse + Protean interaction by @hedara90 in [#5663](https://github.com/rh-hideout/pokeemerald-expansion/pull/5663) +* Added Minimize interaction to Supercell Slam by @hedara90 in [#5713](https://github.com/rh-hideout/pokeemerald-expansion/pull/5713) + +## 🎭 Abilities 🎭 +### Changed +* Fixed damage calc modifiers by @AlexOn1ine in [#5604](https://github.com/rh-hideout/pokeemerald-expansion/pull/5604) + +### Fixed +* Adds tests and Costar fix from PR #5526 by @AlexOn1ine in [#5529](https://github.com/rh-hideout/pokeemerald-expansion/pull/5529) +* Fixes Red Card / Eject Pack interaction with Emergency Exit by @AlexOn1ine in [#5657](https://github.com/rh-hideout/pokeemerald-expansion/pull/5657) +* Fixed curse + Protean interaction by @hedara90 in [#5663](https://github.com/rh-hideout/pokeemerald-expansion/pull/5663) +* Mimicry updates typing with `RemoveAllTerrains()` by @AERDU in [#5666](https://github.com/rh-hideout/pokeemerald-expansion/pull/5666) +* Updated ability popups for Skill Swap, Mummy/Lingering Aroma, Worry Seed, Simple Beam, fix Doodle/Role Play bugs by @PhallenTree in [#5493](https://github.com/rh-hideout/pokeemerald-expansion/pull/5493) +* Fixed curse + Protean interaction by @hedara90 in [#5663](https://github.com/rh-hideout/pokeemerald-expansion/pull/5663) +* Fixes Ice Face regression by @AlexOn1ine in [#5678](https://github.com/rh-hideout/pokeemerald-expansion/pull/5678) +* Fixes Neutralizing Gas crashes + adds missing interaction, Regenerator small fix by @PhallenTree in [#5694](https://github.com/rh-hideout/pokeemerald-expansion/pull/5694) + +## 🧶 Items 🧶 +### Changed +* Removes duplicate Booster Energy code by @AlexOn1ine in [#5656](https://github.com/rh-hideout/pokeemerald-expansion/pull/5656) + +### Fixed +* Fixes Red Card / Eject Pack interaction with Emergency Exit by @AlexOn1ine in [#5657](https://github.com/rh-hideout/pokeemerald-expansion/pull/5657) +* Fixes Red Card / Eject Pack interaction by @AlexOn1ine in [#5724](https://github.com/rh-hideout/pokeemerald-expansion/pull/5724) +* Fixes gems triggering on confusion damage by @AlexOn1ine in [#5723](https://github.com/rh-hideout/pokeemerald-expansion/pull/5723) +* Fixes Kee Maranga and Enigma Berry by @AlexOn1ine in [#5727](https://github.com/rh-hideout/pokeemerald-expansion/pull/5727) +* Fixes Blunder Policy by @AlexOn1ine in [#5722](https://github.com/rh-hideout/pokeemerald-expansion/pull/5722) + +## 🤖 Battle AI 🤖 +### Fixed +* Fixed certain move data being cleared on turn end by @Pawkkie and @AlexOn1ine in [#5488](https://github.com/rh-hideout/pokeemerald-expansion/pull/5488) +* Global is used instead of passed var by @AlexOn1ine in [#5546](https://github.com/rh-hideout/pokeemerald-expansion/pull/5546) +* Fixes `dynamicMoveType` global not being reset during AI calcs by @AlexOn1ine in [#5628](https://github.com/rh-hideout/pokeemerald-expansion/pull/5628) + +## 🧹 Other Cleanup 🧹 +* Remove one redundant call of `SetAiLogicDataForTurn` in `DoBattleIntro` by @AlexOn1ine in [#5491](https://github.com/rh-hideout/pokeemerald-expansion/pull/5491) +* Cleanup extraneous function in `battle_anim.h` by @hedara90 in [#5506](https://github.com/rh-hideout/pokeemerald-expansion/pull/5506) +* Add newline to move relearner string by @Bassoonian in [#5523](https://github.com/rh-hideout/pokeemerald-expansion/pull/5523) +* Fixed 10,000,000 Volt Thunderbolt name by @AsparagusEduardo in [#5533](https://github.com/rh-hideout/pokeemerald-expansion/pull/5533) +* Added constant to expansion inclusive copyright magic number by @pkmnsnfrn in [#5413](https://github.com/rh-hideout/pokeemerald-expansion/pull/5413) +* Centralise AI Tests trainer name by @Bassoonian in [#5532](https://github.com/rh-hideout/pokeemerald-expansion/pull/5532) +* Remove now outdated information from readme by @Bassoonian in [#5548](https://github.com/rh-hideout/pokeemerald-expansion/pull/5548) +* Changing `EVO_NONE` from `0xFFFE` to `0` by @GhoulMage in [#5547](https://github.com/rh-hideout/pokeemerald-expansion/pull/5547) + - There could be a case for out of bounds errors if arrays or iterations are happening where you're using + 1 or - 1, as `EVO_FRIENDSHIP` used to be the first index although it started with 1. +* Shed Skin chance fix by @Pawkkie in [#5558](https://github.com/rh-hideout/pokeemerald-expansion/pull/5558) +* Restore test file dependencies so they're rebuilt properly by @ravepossum in [#5617](https://github.com/rh-hideout/pokeemerald-expansion/pull/5617) +* Improve `SEND_OUT` error message; require Speed for all battlers by @mrgriffin in [#5631](https://github.com/rh-hideout/pokeemerald-expansion/pull/5631) +* Removes duplicate Booster Energy code by @AlexOn1ine in [#5656](https://github.com/rh-hideout/pokeemerald-expansion/pull/5656) +* Wrong assumtion in dauntless_shield.c by @AlexOn1ine in [#5692](https://github.com/rh-hideout/pokeemerald-expansion/pull/5692) + +## 🧪 Test Runner 🧪 +### Added +* Add curious medicine test by @ghoulslash in [#5540](https://github.com/rh-hideout/pokeemerald-expansion/pull/5540) +* Tests: detect task leaks by @mrgriffin in [#5528](https://github.com/rh-hideout/pokeemerald-expansion/pull/5528) + +### Changed +* Add text width tests for move, ability, item, and pokedex descriptions by @kittenchilly in [#5505](https://github.com/rh-hideout/pokeemerald-expansion/pull/5505) +* Centralise AI Tests trainer name by @Bassoonian in [#5532](https://github.com/rh-hideout/pokeemerald-expansion/pull/5532) +* Add basic Steam Engine, Guard Dog Tests by @ghoulslash in [#5569](https://github.com/rh-hideout/pokeemerald-expansion/pull/5569) +* Fixed damage test by @GhoulMage and @mrgriffin for teaching me pokeemerald-expansion tests in [#5574](https://github.com/rh-hideout/pokeemerald-expansion/pull/5574) +* Fallback `memmem` implementation by @mrgriffin in [#5561](https://github.com/rh-hideout/pokeemerald-expansion/pull/5561) +* Hydra: Support `%p` in test summaries by @mrgriffin in [#5626](https://github.com/rh-hideout/pokeemerald-expansion/pull/5626) +* Improve `SEND_OUT` error message; require Speed for all battlers by @mrgriffin in [#5631](https://github.com/rh-hideout/pokeemerald-expansion/pull/5631) +* Check that `PASSES_RANDOMLY` affected a `Random` call by @mrgriffin in [#5635](https://github.com/rh-hideout/pokeemerald-expansion/pull/5635) +* Wrong assumtion in dauntless_shield.c by @AlexOn1ine in [#5692](https://github.com/rh-hideout/pokeemerald-expansion/pull/5692) + +### Fixed +* Update test LD script to respect 4 byte data section alignment by @aronson in [#5517](https://github.com/rh-hideout/pokeemerald-expansion/pull/5517) +* Adds tests and Costar fix from PR #5526 by @AlexOn1ine in [#5529](https://github.com/rh-hideout/pokeemerald-expansion/pull/5529) +* Fixed broken Starting Terrain test by @hedara90 in [#5582](https://github.com/rh-hideout/pokeemerald-expansion/pull/5582) + +## 📚 Documentation 📚 +* Add changelog header in PR template to aid automation by @AsparagusEduardo in [#5539](https://github.com/rh-hideout/pokeemerald-expansion/pull/5539) +* Added compressed OW mon VRAM notice in config file by @AsparagusEduardo in [#5599](https://github.com/rh-hideout/pokeemerald-expansion/pull/5599) +* Update `README.md` to link to `INSTALL.md` by @Pawkkie in [#5720](https://github.com/rh-hideout/pokeemerald-expansion/pull/5720) +* Fixes minor move desc errors by @AlexOn1ine in [#5728](https://github.com/rh-hideout/pokeemerald-expansion/pull/5728) + +## 📦 Branch Synchronisation 📦 +### pret +* 15th of October in [#5527](https://github.com/rh-hideout/pokeemerald-expansion/pull/5527) + * Slight storage system documentation by @luckytyphlosion in [pret#2024](https://github.com/pret/pokeemerald/pull/2024) + * Clean up defines lacking spaces by @Bassoonian in [pret#2025](https://github.com/pret/pokeemerald/pull/2025) + * UB fix in battle_transition.c by @cawtds in [pret#2007](https://github.com/pret/pokeemerald/pull/2007) + * preproc: support arbitrary expressions in enums by @mrgriffin in [pret#2026](https://github.com/pret/pokeemerald/pull/2026) + * [Build System Rewrite] Refactored `Makefile` by @Icedude907 in [pret#1950](https://github.com/pret/pokeemerald/pull/1950) + * Fixed incorrect point macros in contest_ai_script.inc by @NTx86 in [pret#2028](https://github.com/pret/pokeemerald/pull/2028) + * [Build System Rewrite] Massive build speed improvement via scaninc changes by @Icedude907 in [pret#1954](https://github.com/pret/pokeemerald/pull/1954) + * [Build System Rewrite] Improved audio rules by @Icedude907 in [pret#1957](https://github.com/pret/pokeemerald/pull/1957) + * Update INSTALL.md to state that Windows 8 is no longer supported by Microsoft by @luciofstars in [pret#2029](https://github.com/pret/pokeemerald/pull/2029) + * Update pull_request_template.md to include Discord username update by @luciofstars in [pret#2030](https://github.com/pret/pokeemerald/pull/2030) + * remove ScriptContext_Enable from secret_base.h by @DizzyEggg in [pret#2032](https://github.com/pret/pokeemerald/pull/2032) + * Remove gflib by @Kurausukun in [pret#2033](https://github.com/pret/pokeemerald/pull/2033) + * Minor toolchain fixes by @GriffinRichards in [pret#2031](https://github.com/pret/pokeemerald/pull/2031) + * Bugfix for cable car hikerGraphicsIds array by @Scyrous in [pret#2039](https://github.com/pret/pokeemerald/pull/2039) + * Remove explicit symbol sizes in sym_common.txt by @GriffinRichards in [pret#2038](https://github.com/pret/pokeemerald/pull/2038) + * Ignore mGBA screenshots by @Jaizu in [pret#2041](https://github.com/pret/pokeemerald/pull/2041) + * Replaced copyright magic numbers in intro.c with constants by @pkmnsnfrn in [pret#2035](https://github.com/pret/pokeemerald/pull/2035) + * Fixed typo: | should be || in Task_TryFieldPoisonWhiteOut by @AreaZR in [pret#2044](https://github.com/pret/pokeemerald/pull/2044) + * [preproc] support C23 enum underlying type syntax by @mrgriffin in [pret#2043](https://github.com/pret/pokeemerald/pull/2043) + * Fixed deleting files with dependency files by @mid-kid in [pret#2045](https://github.com/pret/pokeemerald/pull/2045) + * Remove unnecessary looping for rule generation and unroll macros by @mid-kid in [pret#2046](https://github.com/pret/pokeemerald/pull/2046) + * Get rid of common syms by @luckytyphlosion in [pret#2040](https://github.com/pret/pokeemerald/pull/2040) + * Bugfix for cable car hikerGraphicsIds array by @Scyrous in [pret#2039](https://github.com/pret/pokeemerald/pull/2039) + * UB fix in battle_transition.c by @cawtds in [pret#2007](https://github.com/pret/pokeemerald/pull/2007) + * Fixed typo: | should be || in Task_TryFieldPoisonWhiteOut by @AreaZR in [pret#2044](https://github.com/pret/pokeemerald/pull/2044) + * Get rid of common syms by @luckytyphlosion in [pret#2040](https://github.com/pret/pokeemerald/pull/2040) + * Fixed incorrect point macros in contest_ai_script.inc by @NTx86 in [pret#2028](https://github.com/pret/pokeemerald/pull/2028) +* 5th of November in [#5644](https://github.com/rh-hideout/pokeemerald-expansion/pull/5644) + * Added define value for bard sound length by @fdeblasio in [pret#2052](https://github.com/pret/pokeemerald/pull/2052) + * Silence 'Nothing to be done for generated' messages by @GriffinRichards in [pret#2059](https://github.com/pret/pokeemerald/pull/2059) + * Lay out emerald version png horizontally by @GriffinRichards in [pret#2062](https://github.com/pret/pokeemerald/pull/2062) +* 29 of November in [#5736](https://github.com/rh-hideout/pokeemerald-expansion/pull/5736) + * Remove usage of gHeap in sSpritePalettes_ContestantsTurnBlinkEffect by @Lactozilla in [pret#2064](https://github.com/pret/pokeemerald/pull/2064) + * BUGFIX: Fix Counter and Mirror Coat checking the wrong category by @surtr-games in [pret#2066](https://github.com/pret/pokeemerald/pull/2066) + * Add TRY_DRAW_SPOT_PIXEL by @GriffinRichards in [pret#2055](https://github.com/pret/pokeemerald/pull/2055) + * Added extra encoded character support by @AsparagusEduardo in [pret#2050](https://github.com/pret/pokeemerald/pull/2050) +### merrp's followers +* Merrp merge (12th of October) by @Bassoonian in [#5514](https://github.com/rh-hideout/pokeemerald-expansion/pull/5514) + - d80190fe105eee12bbf74ae29647ac909084d35c fix: Dig in Sealed Chamber no longer freezes follower. + +## New Contributors +* @AERDU made their first contribution in [#5666](https://github.com/rh-hideout/pokeemerald-expansion/pull/5666) + +**Full Changelog**: https://github.com/rh-hideout/pokeemerald-expansion/compare/expansion/1.9.3...expansion/1.9.4 + + + diff --git a/include/constants/expansion.h b/include/constants/expansion.h index 44b1169bcd..7d883d77a8 100644 --- a/include/constants/expansion.h +++ b/include/constants/expansion.h @@ -1,13 +1,13 @@ #ifndef GUARD_CONSTANTS_EXPANSION_H #define GUARD_CONSTANTS_EXPANSION_H -// Last version: 1.9.3 +// Last version: 1.9.4 #define EXPANSION_VERSION_MAJOR 1 #define EXPANSION_VERSION_MINOR 9 #define EXPANSION_VERSION_PATCH 4 // FALSE if this this version of Expansion is not a tagged commit, i.e. // it contains unreleased changes. -#define EXPANSION_TAGGED_RELEASE FALSE +#define EXPANSION_TAGGED_RELEASE TRUE #endif From 720938f040248ebbcecf9bba8b627223783934f0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 14:28:26 -0300 Subject: [PATCH 13/23] Fix conflicts --- include/battle.h | 3 +-- src/battle_util.c | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/battle.h b/include/battle.h index 54c81a3e57..37f2359641 100644 --- a/include/battle.h +++ b/include/battle.h @@ -828,9 +828,8 @@ struct BattleStruct u8 commandingDondozo; u16 commanderActive[MAX_BATTLERS_COUNT]; u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side - u8 fickleBeamBoosted:1; u8 redCardActivates:1; - u8 padding:6; + u8 padding:7; u8 usedEjectItem; u8 usedMicleBerry; }; diff --git a/src/battle_util.c b/src/battle_util.c index dc2dcc55f1..01822691a3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3314,7 +3314,14 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) break; case DISOBEYS_HITS_SELF: gBattlerTarget = gBattlerAttacker; - gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); + struct DamageCalculationData damageCalcData; + damageCalcData.battlerAtk = damageCalcData.battlerDef = gBattlerAttacker; + damageCalcData.move = MOVE_NONE; + damageCalcData.moveType = TYPE_MYSTERY; + damageCalcData.isCrit = FALSE; + damageCalcData.randomFactor = FALSE; + damageCalcData.updateFlags = TRUE; + gBattleMoveDamage = CalculateMoveDamage(&damageCalcData, 40); gBattlescriptCurrInstr = BattleScript_IgnoresAndHitsItself; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; gHitMarker |= HITMARKER_OBEYS; From bb274c06918b19aca172f3d0e65be1c21cb27df4 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 14:42:40 -0300 Subject: [PATCH 14/23] Add missing changelogs to list --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9fec3e7e..70abeffd3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Pokeemerald-Expansion Changelogs ## 1.9.x +- **[Version 1.9.4](docs/changelogs/1.9.x/1.9.4.md) - 🧹 Bugfix Release** +- **[Version 1.9.3](docs/changelogs/1.9.x/1.9.3.md) - 🧹 Bugfix Release** - **[Version 1.9.2](docs/changelogs/1.9.x/1.9.2.md) - 🧹 Bugfix Release** - **[Version 1.9.1](docs/changelogs/1.9.x/1.9.1.md) - 🧹 Bugfix Release** - **[Version 1.9.0](docs/changelogs/1.9.x/1.9.0.md) - ✨ Feature Release** From ebc03c3cb313b242f7bcdd396dcb00233d44b839 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 14:46:22 -0300 Subject: [PATCH 15/23] Added missing PR --- docs/changelogs/1.9.x/1.9.4.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelogs/1.9.x/1.9.4.md b/docs/changelogs/1.9.x/1.9.4.md index 36dc2afc73..2a41988bd4 100644 --- a/docs/changelogs/1.9.x/1.9.4.md +++ b/docs/changelogs/1.9.x/1.9.4.md @@ -98,6 +98,7 @@ * Fixes gems triggering on confusion damage by @AlexOn1ine in [#5723](https://github.com/rh-hideout/pokeemerald-expansion/pull/5723) * Fixes Kee Maranga and Enigma Berry by @AlexOn1ine in [#5727](https://github.com/rh-hideout/pokeemerald-expansion/pull/5727) * Fixes Blunder Policy by @AlexOn1ine in [#5722](https://github.com/rh-hideout/pokeemerald-expansion/pull/5722) +* Fixes Rusted Shield/Sword allowed to be Knocked Off from Zamazenta/Zacian by @iriv24 in [#5750](https://github.com/rh-hideout/pokeemerald-expansion/pull/5750) ## 🤖 Battle AI 🤖 ### Fixed From bd7a46f9c7b42ad25e50723a4a2aca8028039ed5 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 15:10:46 -0300 Subject: [PATCH 16/23] Version 1.10.0 --- .../ISSUE_TEMPLATE/01_battle_engine_bugs.yaml | 12 +- .../ISSUE_TEMPLATE/02_battle_ai_issues.yaml | 12 +- .github/ISSUE_TEMPLATE/04_other_errors.yaml | 12 +- CHANGELOG.md | 3 + README.md | 4 +- docs/SUMMARY.md | 2 + docs/changelogs/1.10.0/1.10.0.md | 324 ++++++++++++++++++ include/constants/expansion.h | 2 +- 8 files changed, 341 insertions(+), 30 deletions(-) create mode 100644 docs/changelogs/1.10.0/1.10.0.md diff --git a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml index 6a654402ac..0a3eff0e43 100644 --- a/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml +++ b/.github/ISSUE_TEMPLATE/01_battle_engine_bugs.yaml @@ -23,21 +23,15 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.4 (Latest release) + - 1.10.0 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.4 - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 - - 1.8.6 - - 1.8.5 - - 1.8.4 - - 1.8.3 - - 1.8.2 - - 1.8.1 - - 1.8.0 - - pre-1.8.0 + - pre-1.9.0 validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml index ff9823aa01..4b8eec3a43 100644 --- a/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml +++ b/.github/ISSUE_TEMPLATE/02_battle_ai_issues.yaml @@ -23,21 +23,15 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.4 (Latest release) + - 1.10.0 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.4 - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 - - 1.8.6 - - 1.8.5 - - 1.8.4 - - 1.8.3 - - 1.8.2 - - 1.8.1 - - 1.8.0 - - pre-1.8.0 + - pre-1.9.0 validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/04_other_errors.yaml b/.github/ISSUE_TEMPLATE/04_other_errors.yaml index ab400f7b9d..54335ca5e4 100644 --- a/.github/ISSUE_TEMPLATE/04_other_errors.yaml +++ b/.github/ISSUE_TEMPLATE/04_other_errors.yaml @@ -23,21 +23,15 @@ body: label: Version description: What version of pokeemerald-expansion are you using as a base? options: - - 1.9.4 (Latest release) + - 1.10.0 (Latest release) - master (default, unreleased bugfixes) - upcoming (Edge) + - 1.9.4 - 1.9.3 - 1.9.2 - 1.9.1 - 1.9.0 - - 1.8.6 - - 1.8.5 - - 1.8.4 - - 1.8.3 - - 1.8.2 - - 1.8.1 - - 1.8.0 - - pre-1.8.0 + - pre-1.9.0 validations: required: true - type: input diff --git a/CHANGELOG.md b/CHANGELOG.md index 70abeffd3e..13d6e4f4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Pokeemerald-Expansion Changelogs +## 1.10.x +- **[Version 1.10.0](docs/changelogs/1.10.x/1.10.0.md) - ✨ Feature Release** + ## 1.9.x - **[Version 1.9.4](docs/changelogs/1.9.x/1.9.4.md) - 🧹 Bugfix Release** - **[Version 1.9.3](docs/changelogs/1.9.x/1.9.3.md) - 🧹 Bugfix Release** diff --git a/README.md b/README.md index 823a02479c..277dae2be7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ pokeemerald-expansion is a decomp hack base project based off pret's [pokeemeral If you use pokeemerald-expansion in your hack, please add RHH (Rom Hacking Hideout) to your credits list. Optionally, you can list the version used, so it can help players know what features to expect. You can phrase it as the following: ``` -Based off RHH's pokeemerald-expansion 1.9.4 https://github.com/rh-hideout/pokeemerald-expansion/ +Based off RHH's pokeemerald-expansion 1.10.0 https://github.com/rh-hideout/pokeemerald-expansion/ ``` Please follow the instructions in `INSTALL.md` to get pokeemerald-expansion set up on your machine. @@ -177,7 +177,7 @@ With this, you'll get the latest version of pokeemerald-expansion, plus a couple - Check your current version. - You can check in the debug menu's `Utilities -> Expansion Version` option. - If the option is not available, you possibly have version 1.6.2 or older. In that case, please check the [changelogs](CHANGELOG.md) to determine your version based on the features available on your repository. -- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.9.4, use `git pull RHH expansion/1.9.4`). +- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.10.0, use `git pull RHH expansion/1.10.0`). - ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on) - Alternatively, you can update to unreleased versions of the expansion. - ***master (stable):*** It contains unreleased **bugfixes** that will come in the next patch version. To merge, use `git pull RHH master`. diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index ab016136a1..cb02bb306e 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -18,6 +18,8 @@ - [v1.6.x](tutorials/how_to_new_pokemon_1_6_0.md) - [How to use the Testing System](tutorials/how_to_testing_system.md) - [Changelog](./CHANGELOG.md) + - [1.10.x]() + - [Version 1.10.0](changelogs/1.9.x/1.9.4.md) - [1.9.x]() - [Version 1.9.4](changelogs/1.9.x/1.9.4.md) - [Version 1.9.3](changelogs/1.9.x/1.9.3.md) diff --git a/docs/changelogs/1.10.0/1.10.0.md b/docs/changelogs/1.10.0/1.10.0.md new file mode 100644 index 0000000000..9cf2f9b41e --- /dev/null +++ b/docs/changelogs/1.10.0/1.10.0.md @@ -0,0 +1,324 @@ +# Version 1.10.0 + +```md +## How to update +- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`. +- Once you have your remote set up, run the command `git pull RHH expansion/1.10.0`. +``` + +## 🌋 *REFACTORS* 🌋 +📜 = Uses a migration script. +* Changes Evolution methods to Enums by @AlexOn1ine in [#4977](https://github.com/rh-hideout/pokeemerald-expansion/pull/4977) +* Turn item hold effects into an enum by @Bassoonian in [#5498](https://github.com/rh-hideout/pokeemerald-expansion/pull/5498) +* Change `GET_MOVE_TYPE` to a function by @AlexOn1ine in [#5090](https://github.com/rh-hideout/pokeemerald-expansion/pull/5090) +* Created `COMPOUND_STRING`s for default player names by @fdeblasio in [#5037](https://github.com/rh-hideout/pokeemerald-expansion/pull/5037) +* Removed agbcc by @mrgriffin in [#4994](https://github.com/rh-hideout/pokeemerald-expansion/pull/4994) +* Refactor Frontier Brains by @fdeblasio in [#5027](https://github.com/rh-hideout/pokeemerald-expansion/pull/5027) +* Removed all instances of `gBitTable[x]` by @hedara90 in [#5123](https://github.com/rh-hideout/pokeemerald-expansion/pull/5123) +* Made `BuildColorMaps` redundant by using static tables by @pkmnsnfrn in [#5289](https://github.com/rh-hideout/pokeemerald-expansion/pull/5289) +* Removed `FRONTIER_BRAIN_SPRITES` and updated `TRAINER_SPRITE`, `TRAINER_BACK_SPRITE`, and `TRAINER_CLASS` by @fdeblasio in [#5166](https://github.com/rh-hideout/pokeemerald-expansion/pull/5166) +* Added `ShouldSwitch` result to `AiLogicData` by @Pawkkie and @AlexOn1ine had the idea! in [#5440](https://github.com/rh-hideout/pokeemerald-expansion/pull/5440) +* Switch AI refactor + considers free switches by @Pawkkie in [#5379](https://github.com/rh-hideout/pokeemerald-expansion/pull/5379) +* Refactor `ShouldSwitchIfAllBadMoves` by @Pawkkie in [#5452](https://github.com/rh-hideout/pokeemerald-expansion/pull/5452) +* Updated Wring Out effects to match Eruption effects by @AsparagusEduardo in [#5549](https://github.com/rh-hideout/pokeemerald-expansion/pull/5549) + - Changed Wring Out/Crush Grip/Hard Press to use `power` instead of `argument` to determine its max power, just like how Eruption/Water Spout/Dragon Energy do it. + - Also: + - Renamed `EFFECT_VARY_POWER_BASED_ON_HP` to `EFFECT_POWER_BASED_ON_TARGET_HP` + - Renamed `EFFECT_ERUPTION` to `EFFECT_POWER_BASED_ON_USER_HP` +* Update battle messages to Gen 5+ standards by @kittenchilly in [#3240](https://github.com/rh-hideout/pokeemerald-expansion/pull/3240) +* Should switch refactor to facilitate switch prediction by @Pawkkie in [#5466](https://github.com/rh-hideout/pokeemerald-expansion/pull/5466) +* Unwind `TRAINER_CLASS` macro by @SBird1337 in [#5611](https://github.com/rh-hideout/pokeemerald-expansion/pull/5611) +* Refactors Absorb to use `Moveend` by @AlexOn1ine in [#5670](https://github.com/rh-hideout/pokeemerald-expansion/pull/5670) + * For new absorbing moves an argument should be added in `moves_info.h` +* Changes name of `B_SCR_NAME_WITH_PREFIX` by @AlexOn1ine in [#5675](https://github.com/rh-hideout/pokeemerald-expansion/pull/5675) + +## 🧬 General 🧬 +### Added +* Added performance counter by @hedara90 and @SBird1337 provided the actual code in [#5284](https://github.com/rh-hideout/pokeemerald-expansion/pull/5284) +* Added debug build target by @u8-Salem in [#4817](https://github.com/rh-hideout/pokeemerald-expansion/pull/4817) +* Added `AUTO_SCROLL_TEXT` and `NUM_FRAMES_AUTO_SCROLL_DELAY` by @pkmnsnfrn in [#5054](https://github.com/rh-hideout/pokeemerald-expansion/pull/5054) +* Adds `SAVE_TYPE_ERROR_SCREEN` by @pkmnsnfrn in [#5188](https://github.com/rh-hideout/pokeemerald-expansion/pull/5188) +* Move Relearner and Renaming From Summary Screen by @ravepossum in [#5513](https://github.com/rh-hideout/pokeemerald-expansion/pull/5513) +* Automatic Line Breaks, somewhat even lines by @hedara90 and @AsparagusEduardo in [#5689](https://github.com/rh-hideout/pokeemerald-expansion/pull/5689) + - Automatically insert line breaks into a string with `BreakStringAutomatic`. + - This function does not modify strings with existing line breaks. + - Remove existing line breaks from a string with `StripLineBreaks`. + +### Changed +* Removed agbcc by @mrgriffin in [#4994](https://github.com/rh-hideout/pokeemerald-expansion/pull/4994) +* Removed all instances of `gBitTable[x]` by @hedara90 in [#5123](https://github.com/rh-hideout/pokeemerald-expansion/pull/5123) +* Converted Mechadoll text to `COMPOUND_STRING`s by @fdeblasio in [#5276](https://github.com/rh-hideout/pokeemerald-expansion/pull/5276) +* New terrain bgs by @TheTrueSadfish in [#5162](https://github.com/rh-hideout/pokeemerald-expansion/pull/5162) +* Removed agbcc screenshots from `.gitignore` by @Bassoonian in [#5538](https://github.com/rh-hideout/pokeemerald-expansion/pull/5538) +* Set default battle shadow to Gen3 by @hedara90 in [#5632](https://github.com/rh-hideout/pokeemerald-expansion/pull/5632) + - Note: Trainerslides don't work properly with Gen4 shadows. +* Convert 3 variouses to `callnatives` by @AlexOn1ine in [#5646](https://github.com/rh-hideout/pokeemerald-expansion/pull/5646) + +## 🗺️ Overworld 🗺️ +### Added +* FRLG+ whiteout message by @cawtds in [#4967](https://github.com/rh-hideout/pokeemerald-expansion/pull/4967) +* Dynamic Move Types in Summary Screen/Battle by @Galaxeeh in [#5084](https://github.com/rh-hideout/pokeemerald-expansion/pull/5084) +* Adds `OW_BERRY_IMMORTAL` by @pkmnsnfrn in [#5187](https://github.com/rh-hideout/pokeemerald-expansion/pull/5187) +* (Default Off) Item Description Headers by @ghoulslash in [#4767](https://github.com/rh-hideout/pokeemerald-expansion/pull/4767) +* RTC-based wild encounters by @hjk321 in [#5313](https://github.com/rh-hideout/pokeemerald-expansion/pull/5313) +* Added `MB_X_Y_STAIR_WARP` metatile behaviors by @pkmnsnfrn in [#5278](https://github.com/rh-hideout/pokeemerald-expansion/pull/5278) +* Added Sideways Stairs by @ghoulslash in [#4836](https://github.com/rh-hideout/pokeemerald-expansion/pull/4836) +* Added `OW_UNION_DISABLE_CHECK` and `OW_FLAG_MOVE_UNION_ROOM_CHECK` by @pkmnsnfrn in [#5448](https://github.com/rh-hideout/pokeemerald-expansion/pull/5448) +* Adds new scripting macros to increase developer quality of life by @pkmnsnfrn in [#5177](https://github.com/rh-hideout/pokeemerald-expansion/pull/5177) +* Added more later gen fishing mechanics by @kittenchilly in [#5518](https://github.com/rh-hideout/pokeemerald-expansion/pull/5518) + +### Changed +* Created PokeNav `COMPOUND_STRING`s by @fdeblasio in [#4983](https://github.com/rh-hideout/pokeemerald-expansion/pull/4983) +* Added `I_REPEL_INCLUDE_FAINTED` config and behavior by @kittenchilly in [#5239](https://github.com/rh-hideout/pokeemerald-expansion/pull/5239) +* RTC-based wild encounters follow up by @AlexOn1ine in [#5328](https://github.com/rh-hideout/pokeemerald-expansion/pull/5328) +* Revert rtc based encounters by @AlexOn1ine in [#5331](https://github.com/rh-hideout/pokeemerald-expansion/pull/5331) +* Made BuildColorMaps redundant by using static tables by @pkmnsnfrn in [#5289](https://github.com/rh-hideout/pokeemerald-expansion/pull/5289) +* Added `OW_AUTO_SIGNPOST` and associated metatile behaviors by @pkmnsnfrn in [#5044](https://github.com/rh-hideout/pokeemerald-expansion/pull/5044) +* Added support for overworld sprite gender differences + add all the sprites by @kittenchilly in [#5394](https://github.com/rh-hideout/pokeemerald-expansion/pull/5394) + +### Fixed +* Added some null pointer checks by @tertu-m in [#5130](https://github.com/rh-hideout/pokeemerald-expansion/pull/5130) +* Reset item flags on new game by @ghoulslash in [#5363](https://github.com/rh-hideout/pokeemerald-expansion/pull/5363) +* Follower female fix by @hedara90 in [#5475](https://github.com/rh-hideout/pokeemerald-expansion/pull/5475) + +## 🐉 Pokémon 🐉 +### Added +* Added config to change Vivillon's breeding form by @kittenchilly in [#4813](https://github.com/rh-hideout/pokeemerald-expansion/pull/4813) +* Added back GBA sprites via config by @AsparagusEduardo and @AlexOn1ine for their help with script to migrate data from vanilla to our current `gSpeciesInfo` in [#5206](https://github.com/rh-hideout/pokeemerald-expansion/pull/5206) +* Added config to disable gender differences by @AsparagusEduardo in [#5595](https://github.com/rh-hideout/pokeemerald-expansion/pull/5595) + +### Changed +* Made perfect IV count into a granular setting by @AsparagusEduardo in [#5115](https://github.com/rh-hideout/pokeemerald-expansion/pull/5115) +* Updated species defines by @pkmnsnfrn in [#5075](https://github.com/rh-hideout/pokeemerald-expansion/pull/5075) +* Added support for overworld sprite gender differences + add all the sprites by @kittenchilly in [#5394](https://github.com/rh-hideout/pokeemerald-expansion/pull/5394) +* Renamed folders and symbols to match species defines by @AsparagusEduardo in [#5581](https://github.com/rh-hideout/pokeemerald-expansion/pull/5581) + - Burmy and Wormadam footprints were in a `plant` subfolder. They have been moved to the species root folder + - Paldean Wooper's subfolder was named `wooper_paldean` instead of just `paldean`. This has been corrected. + - Zen Mode Galarian Darmanitan's folder was located in `darmanitan/galarian/zen_mode`. This has been corrected to `darmanitan/galar_zen`, alongside Galarian Standard Mode's `darmanitan/galar_standard`. + - Also updated Ogerpon's folders similarly. + - Renamed `SPECIES_PIKACHU_PARTNER_CAP` to `SPECIES_PIKACHU_PARTNER`. +* Changing `EVO_NONE` from `0xFFFE` to `0` by @GhoulMage in [#5547](https://github.com/rh-hideout/pokeemerald-expansion/pull/5547) + - There could be a case for out of bounds errors if arrays or iterations are happening where you're using + 1 or - 1, as `EVO_FRIENDSHIP` used to be the first index although it started with 1. + +### Fixed +* Follower female fix by @hedara90 in [#5475](https://github.com/rh-hideout/pokeemerald-expansion/pull/5475) +* Fixed some gba sprites by @SubzeroEclipse in [#5607](https://github.com/rh-hideout/pokeemerald-expansion/pull/5607) + +## ⚔️ Battle General ⚔️ +### Added +* FRLG+ whiteout message by @cawtds in [#4967](https://github.com/rh-hideout/pokeemerald-expansion/pull/4967) +* Added B_SHOW_TYPES and cleaned up IsDoubleBattle by @pkmnsnfrn in [#5131](https://github.com/rh-hideout/pokeemerald-expansion/pull/5131) +* EV Caps and EV Items by @Flash1Lucky and @AlexOn1ine in [#5269](https://github.com/rh-hideout/pokeemerald-expansion/pull/5269) +* Added in-battle shadows underneath all enemy battlers by @lhearachel in [#5178](https://github.com/rh-hideout/pokeemerald-expansion/pull/5178) +* Added Gen 1 Crit Chance by @Pawkkie in [#5439](https://github.com/rh-hideout/pokeemerald-expansion/pull/5439) +* Added battle flag that prevents running from wild Pokémon by @SarnPoke in [#5502](https://github.com/rh-hideout/pokeemerald-expansion/pull/5502) + +### Changed +* Refactor Frontier Brains by @fdeblasio in [#5027](https://github.com/rh-hideout/pokeemerald-expansion/pull/5027) +* Removed some hardcoding of move IDs + Gen4/5 Defog by @AsparagusEduardo in [#5156](https://github.com/rh-hideout/pokeemerald-expansion/pull/5156) +* Convert 8 various to `callnatives` by @AsparagusEduardo in [#5172](https://github.com/rh-hideout/pokeemerald-expansion/pull/5172) +* Anger Shell use `saveattacker` by @ghoulslash in [#5409](https://github.com/rh-hideout/pokeemerald-expansion/pull/5409) +* Clean up Unseen Fist Check by @AlexOn1ine in [#5420](https://github.com/rh-hideout/pokeemerald-expansion/pull/5420) +* Updated species defines by @pkmnsnfrn in [#5075](https://github.com/rh-hideout/pokeemerald-expansion/pull/5075) +* Removes Crit Chance preproc by @AlexOn1ine in [#5520](https://github.com/rh-hideout/pokeemerald-expansion/pull/5520) +* Update battle messages to Gen 5+ standards by @kittenchilly in [#3240](https://github.com/rh-hideout/pokeemerald-expansion/pull/3240) +* More post-#3240 cleanup by @kittenchilly in [#5593](https://github.com/rh-hideout/pokeemerald-expansion/pull/5593) +* Unwind `TRAINER_CLASS` macro by @SBird1337 in [#5611](https://github.com/rh-hideout/pokeemerald-expansion/pull/5611) +* Removes redundant Decorate check by @AlexOn1ine in [#5696](https://github.com/rh-hideout/pokeemerald-expansion/pull/5696) +* Changes target bit of Flower Shield by @AlexOn1ine in [#5698](https://github.com/rh-hideout/pokeemerald-expansion/pull/5698) + +### Fixed +* Fixed a sprite issue with `B_SHOW_TYPES` by @pkmnsnfrn in [#5157](https://github.com/rh-hideout/pokeemerald-expansion/pull/5157) +* Dynamic Move Display fixes by @Galaxeeh in [#5251](https://github.com/rh-hideout/pokeemerald-expansion/pull/5251) +* Fixed a display issue with `B_SHOW_TYPES` by @pkmnsnfrn and @iriv24 in [#5201](https://github.com/rh-hideout/pokeemerald-expansion/pull/5201) +* Fixed Gen 3 foreseen and Beat Up damage type by @hedara90 in [#5323](https://github.com/rh-hideout/pokeemerald-expansion/pull/5323) +* Fixes Defog used by the wrong side when there is a Substitue and Screen by @AlexOn1ine in [#5381](https://github.com/rh-hideout/pokeemerald-expansion/pull/5381) +* Fixes Hidden Power dynamic type bug by @AlexOn1ine in [#5463](https://github.com/rh-hideout/pokeemerald-expansion/pull/5463) +* Display the correct shadow size when sending out a new Pokemon by @lhearachel in [#5618](https://github.com/rh-hideout/pokeemerald-expansion/pull/5618) +* Fixed text wrap obtaining the incorrect glyph width by @AsparagusEduardo and @AlexOn1ine for their help verifying that the fix works with one of his custom strings in [#5620](https://github.com/rh-hideout/pokeemerald-expansion/pull/5620) +* Improve line breaks/scrolls by @cawtds in [#5641](https://github.com/rh-hideout/pokeemerald-expansion/pull/5641) +* Fixed Order Up + Tera Stellar breaking each other with Commander by @PhallenTree in [#5667](https://github.com/rh-hideout/pokeemerald-expansion/pull/5667) +* Fixes wrong Id when AI chooses mon to switch in by @AlexOn1ine in [#5684](https://github.com/rh-hideout/pokeemerald-expansion/pull/5684) +* Fixes Absorb regression caused by #5670 by @AlexOn1ine in [#5688](https://github.com/rh-hideout/pokeemerald-expansion/pull/5688) +* Fixes heal blocked leeach seed in tests by @AlexOn1ine in [#5700](https://github.com/rh-hideout/pokeemerald-expansion/pull/5700) +* Trainer class+name expansion fix for Battle Frontier by @hedara90 in [#5699](https://github.com/rh-hideout/pokeemerald-expansion/pull/5699) + +## 🤹 Moves 🤹 +### Changed +* Added Population Bomb animation by @kittenchilly in [#5194](https://github.com/rh-hideout/pokeemerald-expansion/pull/5194) +* Move battle anim arrays to C by @cawtds in [#5306](https://github.com/rh-hideout/pokeemerald-expansion/pull/5306) +* Grass/Water Pledge Swamp Animation + Sea of Fire animation tweak by @SonikkuA-DatH in [#5325](https://github.com/rh-hideout/pokeemerald-expansion/pull/5325) +* New animations for many moves more details in description by @TheTrueSadfish in [#5367](https://github.com/rh-hideout/pokeemerald-expansion/pull/5367) +* Use move effect for some moves instead of ids by @AlexOn1ine in [#5433](https://github.com/rh-hideout/pokeemerald-expansion/pull/5433) +* Adds Commander and Order Up by @AlexOn1ine in [#5246](https://github.com/rh-hideout/pokeemerald-expansion/pull/5246) +* Heart Swap Move Animation by @SonikkuA-DatH in [#5460](https://github.com/rh-hideout/pokeemerald-expansion/pull/5460) +* Update `shed_tail.c` by @Bassoonian in [#5494](https://github.com/rh-hideout/pokeemerald-expansion/pull/5494) +* Added Ion Deluge animation by @kittenchilly in [#5467](https://github.com/rh-hideout/pokeemerald-expansion/pull/5467) +* Updated Wring Out effects to match Eruption effects by @AsparagusEduardo in [#5549](https://github.com/rh-hideout/pokeemerald-expansion/pull/5549) + - Changed Wring Out/Crush Grip/Hard Press to use `power` instead of `argument` to determine its max power, just like how Eruption/Water Spout/Dragon Energy do it. Also: + - Renamed `EFFECT_VARY_POWER_BASED_ON_HP` to `EFFECT_POWER_BASED_ON_TARGET_HP` + - Renamed `EFFECT_ERUPTION` to `EFFECT_POWER_BASED_ON_USER_HP` +* Refactors Absorb to use Moveend by @AlexOn1ine in [#5670](https://github.com/rh-hideout/pokeemerald-expansion/pull/5670) + * For new absorbing moves an argument should be added in `moves_info.h` + +### Fixed +* Dark Void, Clangorous Soulblaze, vortex animation fixes by @TheTrueSadfish in [#5650](https://github.com/rh-hideout/pokeemerald-expansion/pull/5650) + +## 🎭 Abilities 🎭 +### Changed +* Adds Commander and Order Up by @AlexOn1ine in [#5246](https://github.com/rh-hideout/pokeemerald-expansion/pull/5246) + +## 🧶 Items 🧶 +### Added +* Adds `OW_BERRY_IMMORTAL` by @pkmnsnfrn in [#5187](https://github.com/rh-hideout/pokeemerald-expansion/pull/5187) +* Added functionality to Poké Flute and Town Map by @kittenchilly and @LOuroboros basically did the Town Map implementation in [#5405](https://github.com/rh-hideout/pokeemerald-expansion/pull/5405) +* Decouple Poke Ball ids from item ids by @AlexOn1ine in [#5560](https://github.com/rh-hideout/pokeemerald-expansion/pull/5560) + +### Changed +* Consolidated the values of Rotom's moves and added Gen9 base form effect by @fdeblasio in [#5186](https://github.com/rh-hideout/pokeemerald-expansion/pull/5186) +* Added `I_REPEL_INCLUDE_FAINTED` config and behavior by @kittenchilly in [#5239](https://github.com/rh-hideout/pokeemerald-expansion/pull/5239) + +### Fixed +* Replace hardcoded flute check with consumability check by @Bassoonian in [#5508](https://github.com/rh-hideout/pokeemerald-expansion/pull/5508) + +## 🤖 Battle AI 🤖 +### Added +* Adds config to show target of ingame partner by @AlexOn1ine in [#5307](https://github.com/rh-hideout/pokeemerald-expansion/pull/5307) +* Switch AI refactor + considers free switches by @Pawkkie in [#5379](https://github.com/rh-hideout/pokeemerald-expansion/pull/5379) +* New AI flag for marking the two last Pokémon as Ace Pokémon by @GhoulMage in [#5587](https://github.com/rh-hideout/pokeemerald-expansion/pull/5587) + +### Changed +* Chilly Reception AI by @kittenchilly in [#5271](https://github.com/rh-hideout/pokeemerald-expansion/pull/5271) +* Shed Tail AI by @SarnPoke and @AlexOn1ine, @Pawkkie in [#5275](https://github.com/rh-hideout/pokeemerald-expansion/pull/5275) +* More missing AI logic by @kittenchilly in [#5279](https://github.com/rh-hideout/pokeemerald-expansion/pull/5279) +* Adds basic trainer and smart trainer flags by @AlexOn1ine in [#5298](https://github.com/rh-hideout/pokeemerald-expansion/pull/5298) +* `AI_FLAG_SETUP_FIRST_TURN` rename and clarifications by @Pawkkie in [#5310](https://github.com/rh-hideout/pokeemerald-expansion/pull/5310) +* Added Composite AI Flags to Docs by @Pawkkie in [#5349](https://github.com/rh-hideout/pokeemerald-expansion/pull/5349) +* AI frostbite score fixes and improvements by @Pawkkie and @kittenchilly for the suggestion! in [#5362](https://github.com/rh-hideout/pokeemerald-expansion/pull/5362) +* Switch AI `hitsToKO` considers one shot prevention by @Pawkkie in [#5371](https://github.com/rh-hideout/pokeemerald-expansion/pull/5371) +* Adds `CanEndureHit` AI function by @AlexOn1ine in [#5373](https://github.com/rh-hideout/pokeemerald-expansion/pull/5373) +* Switch AI `hitsToKO` considers Disguise by @Pawkkie in [#5375](https://github.com/rh-hideout/pokeemerald-expansion/pull/5375) +* Added `ShouldSwitch` result to `AiLogicData` by @Pawkkie and @AlexOn1ine had the idea! in [#5440](https://github.com/rh-hideout/pokeemerald-expansion/pull/5440) +* Removes duplicate code in AI functions by @AlexOn1ine in [#5457](https://github.com/rh-hideout/pokeemerald-expansion/pull/5457) +* Unify `GetBattlerAbility`/`TerrainAffected` to remove duplicate ai function by @AlexOn1ine in [#5497](https://github.com/rh-hideout/pokeemerald-expansion/pull/5497) +* `ShouldSwitchIfGameStatePrompt` Tests by @Pawkkie in [#5462](https://github.com/rh-hideout/pokeemerald-expansion/pull/5462) +* `AI_FLAG_ACE_POKEMON` takes into account separate trainers by @GhoulMage and @/uvula on Discord noted the weird behaviour. in [#5608](https://github.com/rh-hideout/pokeemerald-expansion/pull/5608) + - Fix for the AI not considering both trainers Ace Pokémons in double battles with `AI_FLAG_ACE_POKEMON`. +* Moves that deal a Fixed amount don't need AI handling by @AlexOn1ine in [#5614](https://github.com/rh-hideout/pokeemerald-expansion/pull/5614) +* Combines `CalculateMoveDamage` arguments into a struct by @AlexOn1ine in [#5570](https://github.com/rh-hideout/pokeemerald-expansion/pull/5570) + +### Fixed +* AI burn score fixes and improvements by @Pawkkie and @iriv24 and @AlexOn1ine in [#5356](https://github.com/rh-hideout/pokeemerald-expansion/pull/5356) +* Improve AI's Skill Swap handling in double battles by @Pawkkie in [#5360](https://github.com/rh-hideout/pokeemerald-expansion/pull/5360) +* Refactor `ShouldSwitchIfAllBadMoves` by @Pawkkie in [#5452](https://github.com/rh-hideout/pokeemerald-expansion/pull/5452) +* Should switch refactor to facilitate switch prediction by @Pawkkie in [#5466](https://github.com/rh-hideout/pokeemerald-expansion/pull/5466) +* Fixes Switch in flag not restoring mons properly with test by @Pawkkie and @iriv24 for finding, @AlexOn1ine for fixing in [#5746](https://github.com/rh-hideout/pokeemerald-expansion/pull/5746) + +## 🧹 Other Cleanup 🧹 +* Removed metadata in AIF files by @SombrAbsol in [#4958](https://github.com/rh-hideout/pokeemerald-expansion/pull/4958) +* Removed `gPaletteDecompressionBuffer` and unused palette functions/vars by @DizzyEggg in [#4841](https://github.com/rh-hideout/pokeemerald-expansion/pull/4841) +* Changes Evolution methods to `enum`s by @AlexOn1ine in [#4977](https://github.com/rh-hideout/pokeemerald-expansion/pull/4977) +* Doesn't compile on some compilers by @AlexOn1ine in [#5099](https://github.com/rh-hideout/pokeemerald-expansion/pull/5099) +* Update `event.inc` to accomodate new `gDecompressionBuffer` name by @Bassoonian in [#5100](https://github.com/rh-hideout/pokeemerald-expansion/pull/5100) +* Created `COMPOUND_STRING`s for default player names by @fdeblasio in [#5037](https://github.com/rh-hideout/pokeemerald-expansion/pull/5037) +* Changed single-use berry blender strings to be `COMPOUND_STRING`s by @fdeblasio in [#4963](https://github.com/rh-hideout/pokeemerald-expansion/pull/4963) +* Made perfect IV count into a granular setting by @AsparagusEduardo in [#5115](https://github.com/rh-hideout/pokeemerald-expansion/pull/5115) +* Dynamic move type clean up by @AlexOn1ine in [#5132](https://github.com/rh-hideout/pokeemerald-expansion/pull/5132) +* Refactor Frontier Brains by @fdeblasio in [#5027](https://github.com/rh-hideout/pokeemerald-expansion/pull/5027) +* Removed some hardcoding of move IDs + Gen4/5 Defog by @AsparagusEduardo in [#5156](https://github.com/rh-hideout/pokeemerald-expansion/pull/5156) +* Teatime animations use `B_WAIT_TIME_LONG` by @AsparagusEduardo in [#5173](https://github.com/rh-hideout/pokeemerald-expansion/pull/5173) +* Created PokeNav `COMPOUND_STRING`s by @fdeblasio in [#4983](https://github.com/rh-hideout/pokeemerald-expansion/pull/4983) +* Removed `gBitTable` usage again by @hedara90 in [#5193](https://github.com/rh-hideout/pokeemerald-expansion/pull/5193) +* Removed support for the original LCG random number generator by @tertu-m in [#5078](https://github.com/rh-hideout/pokeemerald-expansion/pull/5078) +* Deprecate MMBN Names by @pkmnsnfrn in [#5240](https://github.com/rh-hideout/pokeemerald-expansion/pull/5240) +* Convert 8 various to `callnatives` by @AsparagusEduardo in [#5172](https://github.com/rh-hideout/pokeemerald-expansion/pull/5172) +* Converted PC strings to `COMPOUND_STRING`s by @fdeblasio in [#5314](https://github.com/rh-hideout/pokeemerald-expansion/pull/5314) +* Cleaned up duplicate dynamic type functions by @AsparagusEduardo in [#5338](https://github.com/rh-hideout/pokeemerald-expansion/pull/5338) +* Removes redundant `moveTargetType` ai function by @AlexOn1ine in [#5354](https://github.com/rh-hideout/pokeemerald-expansion/pull/5354) +* Made `BuildColorMaps` redundant by using static tables by @pkmnsnfrn in [#5289](https://github.com/rh-hideout/pokeemerald-expansion/pull/5289) +* Some strings were switched by @AlexOn1ine in [#5374](https://github.com/rh-hideout/pokeemerald-expansion/pull/5374) +* Switch AI hitsToKO considers Disguise by @Pawkkie in [#5375](https://github.com/rh-hideout/pokeemerald-expansion/pull/5375) +* Cleaned up a bit of code with `GetBattlerPartyData` by @AlexOn1ine in [#5378](https://github.com/rh-hideout/pokeemerald-expansion/pull/5378) +* Minor Gem check optimazation by @AlexOn1ine in [#5401](https://github.com/rh-hideout/pokeemerald-expansion/pull/5401) +* Simplify HP Logic by @AreaZR in [#5403](https://github.com/rh-hideout/pokeemerald-expansion/pull/5403) +* Anger Shell use `saveattacker` by @ghoulslash in [#5409](https://github.com/rh-hideout/pokeemerald-expansion/pull/5409) +* Converted berry and PokeBlock strings to `COMPOUND_STRING`s by @fdeblasio in [#5324](https://github.com/rh-hideout/pokeemerald-expansion/pull/5324) +* Merge item description branch history by @Bassoonian in [#5419](https://github.com/rh-hideout/pokeemerald-expansion/pull/5419) +* Clean up Unseen Fist Check by @AlexOn1ine in [#5420](https://github.com/rh-hideout/pokeemerald-expansion/pull/5420) +* Merge level_caps and ev_caps into one caps file by @kittenchilly in [#5429](https://github.com/rh-hideout/pokeemerald-expansion/pull/5429) +* Removed trailing whitespace pass 10-2-2024 (Upcoming) by @kittenchilly in [#5456](https://github.com/rh-hideout/pokeemerald-expansion/pull/5456) +* Fixed Commander test name by @Bassoonian in [#5458](https://github.com/rh-hideout/pokeemerald-expansion/pull/5458) +* Updated species defines by @pkmnsnfrn in [#5075](https://github.com/rh-hideout/pokeemerald-expansion/pull/5075) +* Adds padding in `AiLogicData` by @AlexOn1ine in [#5468](https://github.com/rh-hideout/pokeemerald-expansion/pull/5468) +* Simplify `BS_FAINTED_MULTIPLE_1` double battle logic in openpartyscreen by @ghoulslash in [#5435](https://github.com/rh-hideout/pokeemerald-expansion/pull/5435) +* Removes duplicate code in AI functions by @AlexOn1ine in [#5457](https://github.com/rh-hideout/pokeemerald-expansion/pull/5457) +* `ShouldPivot` type cleanup by @Pawkkie in [#5441](https://github.com/rh-hideout/pokeemerald-expansion/pull/5441) +* Turn item hold effects into an enum by @Bassoonian in [#5498](https://github.com/rh-hideout/pokeemerald-expansion/pull/5498) +* Unify `GetBattlerAbility`/`TerrainAffected` to remove duplicate ai function by @AlexOn1ine in [#5497](https://github.com/rh-hideout/pokeemerald-expansion/pull/5497) +* Clean up Shedinja code by @Bassoonian in [#5501](https://github.com/rh-hideout/pokeemerald-expansion/pull/5501) +* Clean up `scrcmd` PR by @Bassoonian in [#5511](https://github.com/rh-hideout/pokeemerald-expansion/pull/5511) +* Removes Crit Chance preproc by @AlexOn1ine in [#5520](https://github.com/rh-hideout/pokeemerald-expansion/pull/5520) +* Removed agbcc screenshots from gitignore by @Bassoonian in [#5538](https://github.com/rh-hideout/pokeemerald-expansion/pull/5538) +* Removed unnecessary `gBattlerAttacker` usage by @AlexOn1ine in [#5554](https://github.com/rh-hideout/pokeemerald-expansion/pull/5554) +* Removed remaining line breaks from #3240 + Prefix wrap fix by @AsparagusEduardo in [#5556](https://github.com/rh-hideout/pokeemerald-expansion/pull/5556) +* More post-#3240 cleanup by @kittenchilly in [#5593](https://github.com/rh-hideout/pokeemerald-expansion/pull/5593) +* Renamed folders and symbols to match species defines by @AsparagusEduardo in [#5581](https://github.com/rh-hideout/pokeemerald-expansion/pull/5581) + - Also: + - Burmy and Wormadam footprints were in a `plant` subfolder. They have been moved to the species root folder + - Paldean Wooper's subfolder was named `wooper_paldean` instead of just `paldean`. This has been corrected. + - Zen Mode Galarian Darmanitan's folder was located in `darmanitan/galarian/zen_mode`. This has been corrected to `darmanitan/galar_zen`, alongside Galarian Standard Mode's `darmanitan/galar_standard`. + - Also updated Ogerpon's folders similarly. + - Renamed `SPECIES_PIKACHU_PARTNER_CAP` to `SPECIES_PIKACHU_PARTNER`. +* Minor `BattleStruct` clean up by @AlexOn1ine in [#5585](https://github.com/rh-hideout/pokeemerald-expansion/pull/5585) +* Fixed a ball update oversight by @Bassoonian in [#5609](https://github.com/rh-hideout/pokeemerald-expansion/pull/5609) +* `AI_FLAG_ACE_POKEMON` takes into account separate trainers by @GhoulMage and @/uvula on Discord noted the weird behaviour in [#5608](https://github.com/rh-hideout/pokeemerald-expansion/pull/5608) + - Fix for the AI not considering both trainers Ace Pokémons in double battles with `AI_FLAG_ACE_POKEMON`. +* Moves that deal a Fixed amount don't need AI handling by @AlexOn1ine in [#5614](https://github.com/rh-hideout/pokeemerald-expansion/pull/5614) +* Combines `CalculateMoveDamage` arguments into a struct by @AlexOn1ine in [#5570](https://github.com/rh-hideout/pokeemerald-expansion/pull/5570) +* Follow up for #5570 by @AlexOn1ine in [#5625](https://github.com/rh-hideout/pokeemerald-expansion/pull/5625) +* `AI_CalcDamage` clean up by @AlexOn1ine in [#5629](https://github.com/rh-hideout/pokeemerald-expansion/pull/5629) +* Convert 3 variouses to `callnatives` by @AlexOn1ine in [#5646](https://github.com/rh-hideout/pokeemerald-expansion/pull/5646) +* Convert `gBattleStringsTable` to `COMPOUND_STRING`s by @AsparagusEduardo in [#5649](https://github.com/rh-hideout/pokeemerald-expansion/pull/5649) +* Added merged placeholder text for trainer name with class by @kittenchilly in [#5622](https://github.com/rh-hideout/pokeemerald-expansion/pull/5622) +* Cleans up Primal Reversion code by @AlexOn1ine in [#5659](https://github.com/rh-hideout/pokeemerald-expansion/pull/5659) +* Critical Hit documentation and distorted match up struct switch by @AlexOn1ine in [#5665](https://github.com/rh-hideout/pokeemerald-expansion/pull/5665) +* Changes name of `B_SCR_NAME_WITH_PREFIX` by @AlexOn1ine in [#5675](https://github.com/rh-hideout/pokeemerald-expansion/pull/5675) +* Removes redundant Decorate check by @AlexOn1ine in [#5696](https://github.com/rh-hideout/pokeemerald-expansion/pull/5696) +* Changes taget bit of Flower Shield by @AlexOn1ine in [#5698](https://github.com/rh-hideout/pokeemerald-expansion/pull/5698) +* Changing `EVO_NONE` from `0xFFFE` to `0` by @GhoulMage in [#5547](https://github.com/rh-hideout/pokeemerald-expansion/pull/5547) + - There could be a case for out of bounds errors if arrays or iterations are happening where you're using + 1 or - 1, as `EVO_FRIENDSHIP` used to be the first index although it started with 1. + +## 🧪 Test Runner 🧪 +### Changed +* Fixed Commander test name by @Bassoonian in [#5458](https://github.com/rh-hideout/pokeemerald-expansion/pull/5458) +* `ShouldSwitchIfGameStatePrompt` Tests by @Pawkkie in [#5462](https://github.com/rh-hideout/pokeemerald-expansion/pull/5462) +* Added various tests, add `RNG_RANDOM_TARGET` by @ghoulslash in [#5438](https://github.com/rh-hideout/pokeemerald-expansion/pull/5438) +* Added Costar Tests, Download Test for Doubles by @ghoulslash in [#5526](https://github.com/rh-hideout/pokeemerald-expansion/pull/5526) +* Updated Wring Out effects to match Eruption effects by @AsparagusEduardo in [#5549](https://github.com/rh-hideout/pokeemerald-expansion/pull/5549) + - Changed Wring Out/Crush Grip/Hard Press to use `power` instead of `argument` to determine its max power, just like how Eruption/Water Spout/Dragon Energy do it. Also: + - Renamed `EFFECT_VARY_POWER_BASED_ON_HP` to `EFFECT_POWER_BASED_ON_TARGET_HP` + - Renamed `EFFECT_ERUPTION` to `EFFECT_POWER_BASED_ON_USER_HP` +* Healer ability tests by @Pawkkie in [#5559](https://github.com/rh-hideout/pokeemerald-expansion/pull/5559) +* Mark all tests as used by @mrgriffin in [#5531](https://github.com/rh-hideout/pokeemerald-expansion/pull/5531) + +### Fixed +* Should switch refactor to facilitate switch prediction by @Pawkkie in [#5466](https://github.com/rh-hideout/pokeemerald-expansion/pull/5466) + +## 📚 Documentation 📚 +* `DoBattleIntro` state documentation by @AsparagusEduardo and @ShinyDragonHunter in [#5231](https://github.com/rh-hideout/pokeemerald-expansion/pull/5231) +* Deprecate MMBN Names by @pkmnsnfrn in [#5240](https://github.com/rh-hideout/pokeemerald-expansion/pull/5240) +* `AI_FLAG_SETUP_FIRST_TURN` Rename and Clarifications by @Pawkkie in [#5310](https://github.com/rh-hideout/pokeemerald-expansion/pull/5310) +* Added Composite AI Flags to Docs by @Pawkkie in [#5349](https://github.com/rh-hideout/pokeemerald-expansion/pull/5349) +* Updated the new pokemon tutorial for 1.10 by @hedara90 in [#5721](https://github.com/rh-hideout/pokeemerald-expansion/pull/5721) + - Some changes compared to previous. + +## New Contributors +* @SombrAbsol made their first contribution in [#4958](https://github.com/rh-hideout/pokeemerald-expansion/pull/4958) +* @Galaxeeh made their first contribution in [#5084](https://github.com/rh-hideout/pokeemerald-expansion/pull/5084) +* @Flash1Lucky made their first contribution in [#5269](https://github.com/rh-hideout/pokeemerald-expansion/pull/5269) +* @GhoulMage made their first contribution in [#5547](https://github.com/rh-hideout/pokeemerald-expansion/pull/5547) + +**Full Changelog**: https://github.com/rh-hideout/pokeemerald-expansion/compare/expansion/1.9.4...expansion/1.10.0 + + + diff --git a/include/constants/expansion.h b/include/constants/expansion.h index 6e6ce7f0ee..c24fbeec80 100644 --- a/include/constants/expansion.h +++ b/include/constants/expansion.h @@ -1,7 +1,7 @@ #ifndef GUARD_CONSTANTS_EXPANSION_H #define GUARD_CONSTANTS_EXPANSION_H -// Last version: 1.9.4 +// Last version: 1.10.0 #define EXPANSION_VERSION_MAJOR 1 #define EXPANSION_VERSION_MINOR 10 #define EXPANSION_VERSION_PATCH 0 From 1dde42c0cc9d13c853e215c81f9ecc53ae9cffea Mon Sep 17 00:00:00 2001 From: iriv24 <40581123+iriv24@users.noreply.github.com> Date: Sun, 1 Dec 2024 14:37:46 -0500 Subject: [PATCH 17/23] Cant't knock off Rusted Shield/Sword from Zamazenta/Zacian (#5750) --- src/battle_util.c | 1 + test/battle/move_effect/knock_off.c | 122 +++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 6f0b2af880..4dd236a695 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10672,6 +10672,7 @@ bool32 DoesSpeciesUseHoldItemToChangeForm(u16 species, u16 heldItemId) case FORM_CHANGE_BATTLE_PRIMAL_REVERSION: case FORM_CHANGE_BATTLE_ULTRA_BURST: case FORM_CHANGE_ITEM_HOLD: + case FORM_CHANGE_BEGIN_BATTLE: if (formChanges[i].param1 == heldItemId) return TRUE; break; diff --git a/test/battle/move_effect/knock_off.c b/test/battle/move_effect/knock_off.c index 50d8aaa773..b03432e695 100644 --- a/test/battle/move_effect/knock_off.c +++ b/test/battle/move_effect/knock_off.c @@ -202,6 +202,126 @@ SINGLE_BATTLE_TEST("Knock Off doesn't knock off items from Pokemon behind substi } WHEN { TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_KNOCK_OFF); } } SCENE { - NOT MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Poké Ball"); + NOT MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Poké Ball!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off does knock off Mega Stones from Pokemon that don't actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ABSOLITE); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Absolite!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off Mega Stones from Pokemon that actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ABSOL) { Item(ITEM_ABSOLITE); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Absol's Absolite!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off does knock off Orbs for Primal Reversion from Pokemon that don't actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_RED_ORB); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Red Orb!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off Orbs for Primal Reversion from Pokemon that actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_GROUDON) { Item(ITEM_RED_ORB); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Groudon's Red Orb!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off Z-Crystals") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ELECTRIUM_Z); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Electrium Z!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off Ultranecrozium Z from Pokemon that actually use it") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Necrozma's Ultranecrozium Z!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off does knock off other form-change hold items from Pokemon that don't actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SKY_PLATE); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Sky Plate!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off other form-change hold items from Pokemon that actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ARCEUS) { Item(ITEM_SKY_PLATE); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Arceus's Sky Plate!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off does knock off begin-battle form-change hold items from Pokemon that don't actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_RUSTED_SHIELD); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + MESSAGE("Wobbuffet knocked off Foe Wobbuffet's Rusted Shield!"); + } +} + +SINGLE_BATTLE_TEST("Knock Off doesn't knock off begin-battle form-change hold items from Pokemon that actually use them") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ZAMAZENTA_HERO_OF_MANY_BATTLES) { Item(ITEM_RUSTED_SHIELD); } + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); } + } SCENE { + NOT MESSAGE("Wobbuffet knocked off Foe Zamazenta's Rusted Shield!"); } } From 2e30e66e1518f2e25b27421e21036d914dbc4484 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 15:33:42 -0300 Subject: [PATCH 18/23] Begin 1.11.0 cycle --- include/constants/expansion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/constants/expansion.h b/include/constants/expansion.h index c24fbeec80..59f0928fcb 100644 --- a/include/constants/expansion.h +++ b/include/constants/expansion.h @@ -1,9 +1,9 @@ #ifndef GUARD_CONSTANTS_EXPANSION_H #define GUARD_CONSTANTS_EXPANSION_H -// Last version: 1.10.0 +// Last version: 1.10.1 #define EXPANSION_VERSION_MAJOR 1 -#define EXPANSION_VERSION_MINOR 10 +#define EXPANSION_VERSION_MINOR 11 #define EXPANSION_VERSION_PATCH 0 // FALSE if this this version of Expansion is not a tagged commit, i.e. From 00cb7b36e105016c6aa468af8a6c09039165589f Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 1 Dec 2024 15:36:39 -0300 Subject: [PATCH 19/23] Actually start 1.11.0 cycle --- include/constants/expansion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/expansion.h b/include/constants/expansion.h index 59f0928fcb..6b3a5ace78 100644 --- a/include/constants/expansion.h +++ b/include/constants/expansion.h @@ -8,6 +8,6 @@ // FALSE if this this version of Expansion is not a tagged commit, i.e. // it contains unreleased changes. -#define EXPANSION_TAGGED_RELEASE TRUE +#define EXPANSION_TAGGED_RELEASE FALSE #endif From f44b8f9a0e0988e9c1c3e44f28a3d72e3aa5fda6 Mon Sep 17 00:00:00 2001 From: Pawkkie <61265402+Pawkkie@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:48:45 -0500 Subject: [PATCH 20/23] Smart Switching handles Soundproof (#5703) --- src/battle_ai_switch_items.c | 5 +++++ test/battle/ai/ai_switching.c | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 47f5cae740..9f807ad70d 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -381,6 +381,11 @@ static bool32 FindMonThatAbsorbsOpponentsMove(u32 battler) else if (gMovesInfo[predictedMove].type == TYPE_GROUND || (isOpposingBattlerChargingOrInvulnerable && gMovesInfo[incomingMove].type == TYPE_GROUND)) { absorbingTypeAbilities[numAbsorbingAbilities++] = ABILITY_EARTH_EATER; + absorbingTypeAbilities[numAbsorbingAbilities++] = ABILITY_LEVITATE; + } + else if (gMovesInfo[predictedMove].soundMove || (isOpposingBattlerChargingOrInvulnerable && gMovesInfo[incomingMove].soundMove)) + { + absorbingTypeAbilities[numAbsorbingAbilities++] = ABILITY_SOUNDPROOF; } else { diff --git a/test/battle/ai/ai_switching.c b/test/battle/ai/ai_switching.c index 7f2368261d..12f7443a15 100644 --- a/test/battle/ai/ai_switching.c +++ b/test/battle/ai/ai_switching.c @@ -708,15 +708,29 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI will switch out if player's m AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI will switch out if it has an absorber") { + u32 aiMon; u32 move; u32 absorbingAbility; + PARAMETRIZE { aiMon = SPECIES_NINETALES; absorbingAbility = ABILITY_FLASH_FIRE; move = MOVE_FLAMETHROWER;} + PARAMETRIZE { aiMon = SPECIES_MANTINE; absorbingAbility = ABILITY_WATER_ABSORB; move = MOVE_SURF;} + PARAMETRIZE { aiMon = SPECIES_TOXICROAK; absorbingAbility = ABILITY_DRY_SKIN; move = MOVE_SURF;} + PARAMETRIZE { aiMon = SPECIES_GASTRODON; absorbingAbility = ABILITY_STORM_DRAIN; move = MOVE_SURF;} + PARAMETRIZE { aiMon = SPECIES_JOLTEON; absorbingAbility = ABILITY_VOLT_ABSORB; move = MOVE_THUNDERBOLT;} + PARAMETRIZE { aiMon = SPECIES_ELECTIVIRE; absorbingAbility = ABILITY_MOTOR_DRIVE; move = MOVE_THUNDERBOLT;} + PARAMETRIZE { aiMon = SPECIES_MANECTRIC; absorbingAbility = ABILITY_LIGHTNING_ROD; move = MOVE_THUNDERBOLT;} + PARAMETRIZE { aiMon = SPECIES_ELECTIVIRE; absorbingAbility = ABILITY_MOTOR_DRIVE; move = MOVE_THUNDERBOLT;} + PARAMETRIZE { aiMon = SPECIES_AZUMARILL; absorbingAbility = ABILITY_SAP_SIPPER; move = MOVE_GIGA_DRAIN;} + PARAMETRIZE { aiMon = SPECIES_ORTHWORM; absorbingAbility = ABILITY_EARTH_EATER; move = MOVE_EARTHQUAKE;} + PARAMETRIZE { aiMon = SPECIES_BRONZONG; absorbingAbility = ABILITY_LEVITATE; move = MOVE_EARTHQUAKE;} + PARAMETRIZE { aiMon = SPECIES_ELECTRODE; absorbingAbility = ABILITY_SOUNDPROOF; move = MOVE_HYPER_VOICE;} GIVEN { + ASSUME(B_REDIRECT_ABILITY_IMMUNITY >= GEN_5); ASSUME(gMovesInfo[MOVE_WATER_GUN].type == TYPE_WATER); AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SMART_SWITCHING); - PLAYER(SPECIES_LUVDISC) { Moves(MOVE_WATER_GUN); } + PLAYER(SPECIES_ZIGZAGOON) { Moves(move); } OPPONENT(SPECIES_ZIGZAGOON) { Moves(MOVE_TACKLE); } - OPPONENT(SPECIES_MANTINE) { Moves(MOVE_TACKLE); Ability(ABILITY_WATER_ABSORB); } + OPPONENT(aiMon) { Moves(MOVE_TACKLE); Ability(absorbingAbility); } } WHEN { - TURN { MOVE(player, MOVE_WATER_GUN) ; EXPECT_MOVE(opponent, MOVE_TACKLE); } - TURN { MOVE(player, MOVE_WATER_GUN) ; EXPECT_SWITCH(opponent, 1); } + TURN { MOVE(player, move); EXPECT_MOVE(opponent, MOVE_TACKLE); } + TURN { MOVE(player, move); EXPECT_SWITCH(opponent, 1); } } } From 42b94e378ba7cc252775adcc162fe7fede2eec2e Mon Sep 17 00:00:00 2001 From: Pawkkie <61265402+Pawkkie@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:58:13 -0500 Subject: [PATCH 21/23] Add Revival Blessing AI (#5704) --- src/battle_ai_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 3c031de092..60e6f90fea 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4399,7 +4399,13 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) break; case EFFECT_REVIVAL_BLESSING: if (GetFirstFaintedPartyIndex(battlerAtk) != PARTY_SIZE) + { ADJUST_SCORE(DECENT_EFFECT); + if (AI_DATA->shouldSwitch & (1u << battlerAtk)) // Bad matchup + ADJUST_SCORE(WEAK_EFFECT); + if (AI_DATA->mostSuitableMonId[battlerAtk] != PARTY_SIZE) // Good mon to send in after + ADJUST_SCORE(WEAK_EFFECT); + } break; //case EFFECT_EXTREME_EVOBOOST: // TODO //break; From 0322d518875d857d8d6f3e11a3c3aaa9f2938156 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 2 Dec 2024 05:05:04 -0300 Subject: [PATCH 22/23] Split "Do nothing" move effects (#5613) --- data/battle_scripts_1.s | 25 +++++++++++++++++++------ include/battle_scripts.h | 3 +++ include/constants/battle_move_effects.h | 3 +++ src/battle_ai_main.c | 6 ++++++ src/data/battle_move_effects.h | 21 +++++++++++++++++++++ src/data/moves_info.h | 6 +++--- test/battle/move_effect/hold_hands.c | 25 +++++++++++++++++++++++++ 7 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 test/battle/move_effect/hold_hands.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 3d24cbfdf0..5e30457341 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3868,26 +3868,39 @@ BattleScript_EffectDoNothing:: attackcanceler attackstring ppreduce - jumpifmove MOVE_HOLD_HANDS, BattleScript_EffectHoldHands attackanimation waitanimation - jumpifmove MOVE_CELEBRATE, BattleScript_EffectCelebrate - jumpifmove MOVE_HAPPY_HOUR, BattleScript_EffectHappyHour incrementgamestat GAME_STAT_USED_SPLASH printstring STRINGID_BUTNOTHINGHAPPENED waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd -BattleScript_EffectHoldHands: + +BattleScript_EffectHoldHands:: + attackcanceler + attackstring + ppreduce jumpifsideaffecting BS_TARGET, SIDE_STATUS_CRAFTY_SHIELD, BattleScript_ButItFailed jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_ButItFailed attackanimation waitanimation goto BattleScript_MoveEnd -BattleScript_EffectCelebrate: + +BattleScript_EffectCelebrate:: + attackcanceler + attackstring + ppreduce + attackanimation + waitanimation printstring STRINGID_CELEBRATEMESSAGE waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd -BattleScript_EffectHappyHour: + +BattleScript_EffectHappyHour:: + attackcanceler + attackstring + ppreduce + attackanimation + waitanimation seteffectprimary MOVE_EFFECT_HAPPY_HOUR goto BattleScript_MoveEnd diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1148c955e5..4c8d8c0dde 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -624,6 +624,9 @@ extern const u8 BattleScript_EffectMimic[]; extern const u8 BattleScript_EffectMetronome[]; extern const u8 BattleScript_EffectLeechSeed[]; extern const u8 BattleScript_EffectDoNothing[]; +extern const u8 BattleScript_EffectHoldHands[]; +extern const u8 BattleScript_EffectCelebrate[]; +extern const u8 BattleScript_EffectHappyHour[]; extern const u8 BattleScript_EffectDisable[]; extern const u8 BattleScript_EffectLevelDamage[]; extern const u8 BattleScript_EffectPsywave[]; diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index b1472d0280..15edbd28ef 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -67,6 +67,9 @@ enum { EFFECT_METRONOME, EFFECT_LEECH_SEED, EFFECT_DO_NOTHING, + EFFECT_HOLD_HANDS, + EFFECT_CELEBRATE, + EFFECT_HAPPY_HOUR, EFFECT_DISABLE, EFFECT_LEVEL_DAMAGE, EFFECT_PSYWAVE, diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 60e6f90fea..5768666dfb 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2412,6 +2412,9 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) ADJUST_SCORE(-10); break; case EFFECT_DO_NOTHING: + case EFFECT_HOLD_HANDS: + case EFFECT_CELEBRATE: + case EFFECT_HAPPY_HOUR: ADJUST_SCORE(-10); break; case EFFECT_INSTRUCT: @@ -3513,6 +3516,9 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) ADJUST_SCORE(DECENT_EFFECT); break; case EFFECT_DO_NOTHING: + case EFFECT_HOLD_HANDS: + case EFFECT_CELEBRATE: + case EFFECT_HAPPY_HOUR: //todo - check z splash, z celebrate, z happy hour (lol) break; case EFFECT_TELEPORT: // Either remove or add better logic diff --git a/src/data/battle_move_effects.h b/src/data/battle_move_effects.h index b5b3e539c8..ab70de3681 100644 --- a/src/data/battle_move_effects.h +++ b/src/data/battle_move_effects.h @@ -425,6 +425,27 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] = .encourageEncore = TRUE, }, + [EFFECT_HOLD_HANDS] = + { + .battleScript = BattleScript_EffectHoldHands, + .battleTvScore = 1, + .encourageEncore = TRUE, + }, + + [EFFECT_CELEBRATE] = + { + .battleScript = BattleScript_EffectCelebrate, + .battleTvScore = 1, + .encourageEncore = TRUE, + }, + + [EFFECT_HAPPY_HOUR] = + { + .battleScript = BattleScript_EffectHappyHour, + .battleTvScore = 1, + .encourageEncore = TRUE, + }, + [EFFECT_DISABLE] = { .battleScript = BattleScript_EffectDisable, diff --git a/src/data/moves_info.h b/src/data/moves_info.h index 180d0d74ac..49d35c0897 100644 --- a/src/data/moves_info.h +++ b/src/data/moves_info.h @@ -15010,7 +15010,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = .description = COMPOUND_STRING( "Doubles the amount of\n" "Prize Money received."), - .effect = EFFECT_DO_NOTHING, + .effect = EFFECT_HAPPY_HOUR, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, @@ -15080,7 +15080,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = .description = COMPOUND_STRING( "Congratulates you on your\n" "special day."), - .effect = EFFECT_DO_NOTHING, + .effect = EFFECT_CELEBRATE, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, @@ -15110,7 +15110,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = .description = COMPOUND_STRING( "The user and ally hold hands\n" "making them happy."), - .effect = EFFECT_DO_NOTHING, + .effect = EFFECT_HOLD_HANDS, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, diff --git a/test/battle/move_effect/hold_hands.c b/test/battle/move_effect/hold_hands.c new file mode 100644 index 0000000000..bcdb6a952a --- /dev/null +++ b/test/battle/move_effect/hold_hands.c @@ -0,0 +1,25 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_HOLD_HANDS].effect == EFFECT_HOLD_HANDS); +} + +DOUBLE_BATTLE_TEST("Hold Hands is blocked by Crafty Shield") +{ + GIVEN { + PLAYER(SPECIES_WYNAUT); + PLAYER(SPECIES_WYNAUT); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { + MOVE(playerLeft, MOVE_CRAFTY_SHIELD, target: opponentLeft); + MOVE(playerRight, MOVE_HOLD_HANDS, target: playerLeft); + } + } SCENE { + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_HOLD_HANDS, playerLeft); + MESSAGE("Wynaut protected itself!"); + } +} From 2b7905beb1d8a334105653ced32fa9de8c1e43aa Mon Sep 17 00:00:00 2001 From: Pawkkie <61265402+Pawkkie@users.noreply.github.com> Date: Mon, 2 Dec 2024 03:06:03 -0500 Subject: [PATCH 23/23] Add B_FLAG_SLEEP_CLAUSE (#5566) Co-authored-by: Isaac Rivera Co-authored-by: iriv24 <40581123+iriv24@users.noreply.github.com> Co-authored-by: Hedara --- asm/macros/battle_script.inc | 8 +- data/battle_scripts_1.s | 17 +- include/battle.h | 2 + include/battle_ai_util.h | 1 + include/battle_scripts.h | 1 + include/battle_util.h | 5 +- include/config/battle.h | 1 + include/config/test.h | 4 + include/constants/battle_string_ids.h | 3 +- src/battle_ai_main.c | 10 +- src/battle_ai_switch_items.c | 2 +- src/battle_ai_util.c | 13 +- src/battle_dynamax.c | 6 +- src/battle_main.c | 7 + src/battle_message.c | 1 + src/battle_script_commands.c | 59 +- src/battle_util.c | 59 +- src/pokemon.c | 17 + test/battle/sleep_clause.c | 1816 +++++++++++++++++++++++++ test/test_runner_battle.c | 1 - 20 files changed, 2012 insertions(+), 21 deletions(-) create mode 100644 test/battle/sleep_clause.c diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 7ae4403ff9..6f3d2437c3 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1667,6 +1667,11 @@ callnative BS_DamageToQuarterTargetHP .endm + .macro jumpifsleepclause jumpInstr:req + callnative BS_JumpIfSleepClause + .4byte \jumpInstr + .endm + .macro ficklebeamdamagecalculation callnative BS_FickleBeamDamageCalculation .endm @@ -2004,9 +2009,10 @@ .4byte \jumpInstr .endm - .macro trypsychoshift failInstr:req + .macro trypsychoshift failInstr:req sleepClauseFailInstr:req various BS_ATTACKER, VARIOUS_PSYCHO_SHIFT .4byte \failInstr + .4byte \sleepClauseFailInstr .endm .macro curestatus battler:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5e30457341..e6ca33051c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1639,7 +1639,7 @@ BattleScript_EffectPsychoShift:: BattleScript_EffectPsychoShiftCanWork: jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifsafeguard BattleScript_SafeguardProtected - trypsychoshift BattleScript_ButItFailed + trypsychoshift BattleScript_ButItFailed, BattleScript_SleepClauseBlocked attackanimation waitanimation copybyte gEffectBattler, gBattlerTarget @@ -2892,6 +2892,7 @@ BattleScript_EffectSleep:: jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed + jumpifsleepclause BattleScript_SleepClauseBlocked jumpifterrainaffected BS_TARGET, STATUS_FIELD_ELECTRIC_TERRAIN, BattleScript_ElectricTerrainPrevents jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE @@ -5154,6 +5155,7 @@ BattleScript_EffectYawn:: jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect + jumpifsleepclause BattleScript_SleepClauseBlocked jumpifsubstituteblocks BattleScript_ButItFailed jumpifsafeguard BattleScript_SafeguardProtected accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON @@ -10108,3 +10110,16 @@ BattleScript_EffectSnow:: call BattleScript_CheckPrimalWeather setfieldweather ENUM_WEATHER_SNOW goto BattleScript_MoveWeatherChange + +BattleScript_SleepClauseBlocked:: + pause B_WAIT_TIME_SHORT + orhalfword gMoveResultFlags, MOVE_RESULT_FAILED + printstring STRINGID_BLOCKEDBYSLEEPCLAUSE + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_SleepClausePreventsEnd:: + pause B_WAIT_TIME_SHORT + printstring STRINGID_BLOCKEDBYSLEEPCLAUSE + waitmessage B_WAIT_TIME_LONG + end2 diff --git a/include/battle.h b/include/battle.h index 37f2359641..35b70a8032 100644 --- a/include/battle.h +++ b/include/battle.h @@ -832,6 +832,8 @@ struct BattleStruct u8 padding:7; u8 usedEjectItem; u8 usedMicleBerry; + u8 monCausingSleepClause[NUM_BATTLE_SIDES]; // Stores which pokemon on a given side is causing Sleep Clause to be active as the mon's index in the party + u8 sleepClauseEffectExempt:4; // Stores whether effect should be exempt from triggering Sleep Clause (Effect Spore) }; // The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider, diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index c74cad2e78..56dd8aa6e1 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -185,6 +185,7 @@ bool32 PartnerMoveEffectIsTerrain(u32 battlerAtkPartner, u32 partnerMove); bool32 PartnerMoveIs(u32 battlerAtkPartner, u32 partnerMove, u32 moveCheck); bool32 PartnerMoveIsSameAsAttacker(u32 battlerAtkPartner, u32 battlerDef, u32 move, u32 partnerMove); bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 PartnerMoveActivatesSleepClause(u32 move); bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, u32 move); // party logic diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 4c8d8c0dde..93cc7ba3ae 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -520,6 +520,7 @@ extern const u8 BattleScript_Terastallization[]; extern const u8 BattleScript_BoosterEnergyEnd2[]; extern const u8 BattleScript_TeraShellDistortingTypeMatchups[]; extern const u8 BattleScript_TeraFormChange[]; +extern const u8 BattleScript_SleepClausePreventsEnd[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/battle_util.h b/include/battle_util.h index e3fc7d869f..395cbf28e3 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -291,7 +291,7 @@ bool32 MoveHasChargeTurnAdditionalEffect(u32 move); bool32 CanTargetPartner(u32 battlerAtk, u32 battlerDef); bool32 TargetFullyImmuneToCurrMove(u32 battlerAtk, u32 battlerDef); -bool32 CanBeSlept(u32 battler, u32 ability); +bool32 CanBeSlept(u32 battler, u32 ability, u32 isBlockedBySleepClause); bool32 CanBePoisoned(u32 battlerAtk, u32 battlerDef, u32 defAbility); bool32 CanBeBurned(u32 battler, u32 ability); bool32 CanBeParalyzed(u32 battler, u32 ability); @@ -314,5 +314,8 @@ bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon); bool8 IsMonBannedFromSkyBattles(u16 species); void RemoveBattlerType(u32 battler, u8 type); u32 GetMoveType(u32 move); +void TryActivateSleepClause(u32 battler, u32 indexInParty); +void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty); +bool8 IsSleepClauseActiveForSide(u32 battlerSide); #endif // GUARD_BATTLE_UTIL_H diff --git a/include/config/battle.h b/include/config/battle.h index b0184838cb..43da403010 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -192,6 +192,7 @@ #define B_FLAG_DYNAMAX_BATTLE 0 // If this flag is set, the ability to Dynamax in battle is enabled for all trainers. #define B_FLAG_TERA_ORB_CHARGED 0 // If this flag is set, the Tera Orb is charged. It is automatically set upon healing and cleared upon Terastallizing once configured. #define B_FLAG_TERA_ORB_NO_COST 0 // If this flag is set, the Tera Orb does not use up its charge upon Terastallization. In S/V, this occurs after an event with Terapagos. +#define B_FLAG_SLEEP_CLAUSE 0 // If this flag is set, sleep clause is enabled; if the player / AI has already put a Pokémon on the opponent's side to sleep and it is still sleeping, another one can't be put to sleep. AI requires AI_FLAG_CHECK_BAD_MOVE to understand. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. diff --git a/include/config/test.h b/include/config/test.h index 708c2ca581..cce97484df 100644 --- a/include/config/test.h +++ b/include/config/test.h @@ -1129,4 +1129,8 @@ #undef P_FAMILY_PECHARUNT #define P_FAMILY_PECHARUNT TRUE +// Flags +#undef B_FLAG_SLEEP_CLAUSE +#define B_FLAG_SLEEP_CLAUSE FLAG_SPECIAL_FLAG_UNUSED_0x4003 + #endif // GUARD_CONFIG_TEST_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 563e70fc06..bd6c5b9501 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -724,8 +724,9 @@ #define STRINGID_ELECTRICCURRENTISRUNNING 722 #define STRINGID_SEEMSWEIRD 723 #define STRINGID_WAGGLINGAFINGER 724 +#define STRINGID_BLOCKEDBYSLEEPCLAUSE 725 -#define BATTLESTRINGS_COUNT 725 +#define BATTLESTRINGS_COUNT 726 // 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_ai_main.c b/src/battle_ai_main.c index 5768666dfb..28ac8f48d1 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -982,6 +982,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) case EFFECT_SLEEP: if (!AI_CanPutToSleep(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) ADJUST_SCORE(-10); + if (PartnerMoveActivatesSleepClause(aiData->partnerMove)) + ADJUST_SCORE(-20); break; case EFFECT_EXPLOSION: if (!(AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_WILL_SUICIDE)) @@ -1794,7 +1796,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) ADJUST_SCORE(-10); break; case EFFECT_REST: - if (!CanBeSlept(battlerAtk, aiData->abilities[battlerAtk])) + if (!CanBeSlept(battlerAtk, aiData->abilities[battlerAtk], FALSE)) ADJUST_SCORE(-10); //fallthrough case EFFECT_RESTORE_HP: @@ -2077,6 +2079,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) ADJUST_SCORE(-10); else if (!AI_CanPutToSleep(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) ADJUST_SCORE(-10); + if (PartnerMoveActivatesSleepClause(aiData->partnerMove)) + ADJUST_SCORE(-20); break; case EFFECT_SKILL_SWAP: if (aiData->abilities[battlerAtk] == ABILITY_NONE || aiData->abilities[battlerDef] == ABILITY_NONE @@ -2676,7 +2680,7 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) if (IsMoveEffectWeather(move)) ADJUST_SCORE(-10); break; - } + } } // check partner move effect // Adjust for always crit moves @@ -3454,7 +3458,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) } break; case EFFECT_REST: - if (!(CanBeSlept(battlerAtk, aiData->abilities[battlerAtk]))) + if (!(CanBeSlept(battlerAtk, aiData->abilities[battlerAtk], FALSE))) { break; } diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 9f807ad70d..ba2f3247a3 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -502,7 +502,7 @@ static bool32 ShouldSwitchIfBadlyStatused(u32 battler) { //Yawn if (gStatuses3[battler] & STATUS3_YAWN - && CanBeSlept(battler, monAbility) + && CanBeSlept(battler, monAbility, TRUE) && gBattleMons[battler].hp > gBattleMons[battler].maxHP / 3) { switchMon = TRUE; diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index c033061dc9..21c738de01 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2902,7 +2902,7 @@ bool32 IsBattlerIncapacitated(u32 battler, u32 ability) bool32 AI_CanPutToSleep(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove) { - if (!CanBeSlept(battlerDef, defAbility) + if (!CanBeSlept(battlerDef, defAbility, TRUE) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep return FALSE; @@ -3392,6 +3392,17 @@ bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, u32 move, u32 partnerMov return FALSE; } +bool32 PartnerMoveActivatesSleepClause(u32 partnerMove) +{ + u32 effect = gMovesInfo[partnerMove].effect; + if (!IsDoubleBattle() || !FlagGet(B_FLAG_SLEEP_CLAUSE)) + return FALSE; + if (effect == EFFECT_SLEEP + || effect == EFFECT_YAWN) + return TRUE; + return FALSE; +} + bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, u32 move) { u32 i; diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index 17425b51d8..79995b0f16 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -759,7 +759,7 @@ void BS_SetMaxMoveEffect(void) { static const u8 sSnoozeEffects[] = {TRUE, FALSE}; if (!(gStatuses3[gBattlerTarget] & STATUS3_YAWN) - && CanBeSlept(gBattlerTarget, GetBattlerAbility(gBattlerTarget)) + && CanBeSlept(gBattlerTarget, GetBattlerAbility(gBattlerTarget), TRUE) && RandomElement(RNG_G_MAX_SNOOZE, sSnoozeEffects)) // 50% chance of success { gStatuses3[gBattlerTarget] |= STATUS3_YAWN_TURN(2); @@ -881,12 +881,14 @@ void BS_TrySetStatus1(void) } break; case STATUS1_SLEEP: - if (CanBeSlept(gBattlerTarget, GetBattlerAbility(gBattlerTarget))) + if (CanBeSlept(gBattlerTarget, GetBattlerAbility(gBattlerTarget), TRUE)) { if (B_SLEEP_TURNS >= GEN_5) gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 3) + 2); else gBattleMons[gBattlerTarget].status1 |= STATUS1_SLEEP_TURN((Random() % 4) + 3); + + TryActivateSleepClause(gBattlerTarget, gBattlerPartyIndexes[gBattlerTarget]); gBattleCommunication[MULTISTRING_CHOOSER] = 4; effect++; } diff --git a/src/battle_main.c b/src/battle_main.c index ecad0d4e82..a665494c1c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3121,6 +3121,13 @@ static void BattleStartClearSetData(void) gSelectedMonPartyId = PARTY_SIZE; // Revival Blessing gCategoryIconSpriteId = 0xFF; + + if(FlagGet(B_FLAG_SLEEP_CLAUSE)) + { + // If monCausingSleepClause[side] equals PARTY_SIZE, Sleep Clause is not active for the given side. + gBattleStruct->monCausingSleepClause[B_SIDE_PLAYER] = PARTY_SIZE; + gBattleStruct->monCausingSleepClause[B_SIDE_OPPONENT] = PARTY_SIZE; + } } void SwitchInClearSetData(u32 battler) diff --git a/src/battle_message.c b/src/battle_message.c index 0dbb0c76a4..46256accdd 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -890,6 +890,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_ELECTRICCURRENTISRUNNING] = COMPOUND_STRING("An electric current is running across the battlefield!"), [STRINGID_SEEMSWEIRD] = COMPOUND_STRING("The battlefield seems weird!"), [STRINGID_WAGGLINGAFINGER] = COMPOUND_STRING("Waggling a finger let it use {B_CURRENT_MOVE}!"), + [STRINGID_BLOCKEDBYSLEEPCLAUSE] = COMPOUND_STRING("Sleep Clause kept {B_DEF_NAME_WITH_PREFIX2} awake!"), }; const u16 gTrainerUsedItemStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0390f0e85a..53c71adff7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3004,7 +3004,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) if (i != gBattlersCount) break; - if (!CanBeSlept(gEffectBattler, GetBattlerAbility(gEffectBattler))) + if (!CanBeSlept(gEffectBattler, GetBattlerAbility(gEffectBattler), TRUE) && !(gBattleStruct->sleepClauseEffectExempt & (1u << gEffectBattler))) break; cancelMultiTurnMovesResult = CancelMultiTurnMoves(gEffectBattler); @@ -3223,6 +3223,8 @@ void SetMoveEffect(bool32 primary, bool32 certain) gBattleMons[gEffectBattler].status1 |= STATUS1_SLEEP_TURN(1 + RandomUniform(RNG_SLEEP_TURNS, 1, 3)); else gBattleMons[gEffectBattler].status1 |= STATUS1_SLEEP_TURN(1 + RandomUniform(RNG_SLEEP_TURNS, 2, 5)); + + TryActivateSleepClause(gEffectBattler, gBattlerPartyIndexes[gEffectBattler]); } else { @@ -4188,6 +4190,8 @@ static void Cmd_tryfaintmon(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].moves[moveIndex]) } + + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } else { @@ -5931,6 +5935,7 @@ static void Cmd_moveend(void) gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal; break; case STATUS1_SLEEP: + TryDeactivateSleepClause(GetBattlerSide(gBattlerTarget), gBattlerPartyIndexes[gBattlerTarget]); gBattlescriptCurrInstr = BattleScript_TargetWokeUp; break; case STATUS1_BURN: @@ -10171,7 +10176,7 @@ static void Cmd_various(void) } case VARIOUS_PSYCHO_SHIFT: { - VARIOUS_ARGS(const u8 *failInstr); + VARIOUS_ARGS(const u8 *failInstr, const u8 *sleepClauseFailInstr); u32 targetAbility = GetBattlerAbility(gBattlerTarget); // Psycho shift works if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_POISON) && CanBePoisoned(gBattlerAttacker, gBattlerTarget, targetAbility)) @@ -10182,10 +10187,15 @@ static void Cmd_various(void) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) && CanBeParalyzed(gBattlerTarget, targetAbility)) gBattleCommunication[MULTISTRING_CHOOSER] = 3; - else if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) && CanBeSlept(gBattlerTarget, targetAbility)) + else if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) && CanBeSlept(gBattlerTarget, targetAbility, TRUE)) gBattleCommunication[MULTISTRING_CHOOSER] = 4; else if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_FROSTBITE) && CanGetFrostbite(gBattlerTarget)) gBattleCommunication[MULTISTRING_CHOOSER] = 5; + else if (IsSleepClauseActiveForSide(GetBattlerSide(battler))) + { + gBattlescriptCurrInstr = cmd->sleepClauseFailInstr; + return; + } else { gBattlescriptCurrInstr = cmd->failInstr; @@ -10196,11 +10206,16 @@ static void Cmd_various(void) BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; + TryActivateSleepClause(battler, gBattlerPartyIndexes[battler]); return; } case VARIOUS_CURE_STATUS: { VARIOUS_ARGS(); + + if (gBattleMons[battler].status1 & STATUS1_SLEEP) + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); + gBattleMons[battler].status1 = 0; BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); @@ -13269,12 +13284,11 @@ static void Cmd_healpartystatus(void) u32 zero = 0; u32 partner = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); u8 toHeal = 0; + struct Pokemon *party = GetBattlerParty(gBattlerAttacker); + s32 i; if (gCurrentMove == MOVE_HEAL_BELL) { - struct Pokemon *party = GetBattlerParty(gBattlerAttacker); - s32 i; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BELL; if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SOUNDPROOF @@ -13340,7 +13354,10 @@ static void Cmd_healpartystatus(void) } if (ability != ABILITY_SOUNDPROOF) + { toHeal |= (1 << i); + TryDeactivateSleepClause(GetBattlerSide(gBattlerAttacker), i); + } } } } @@ -13349,6 +13366,11 @@ static void Cmd_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOOTHING_AROMA; toHeal = (1 << PARTY_SIZE) - 1; + for (i = 0; i < PARTY_SIZE; i++) + { + TryDeactivateSleepClause(GetBattlerSide(gBattlerAttacker), i); + } + gBattleMons[gBattlerAttacker].status1 = 0; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; @@ -14123,6 +14145,9 @@ static void Cmd_curestatuswithmove(void) if (shouldHeal) { + if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) + TryDeactivateSleepClause(GetBattlerSide(gBattlerAttacker), gBattlerPartyIndexes[gBattlerAttacker]); + gBattleMons[gBattlerAttacker].status1 = 0; gBattlescriptCurrInstr = cmd->nextInstr; BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); @@ -14731,6 +14756,9 @@ static void Cmd_switchoutabilities(void) switch (GetBattlerAbility(battler)) { case ABILITY_NATURAL_CURE: + if (gBattleMons[battler].status1 & STATUS1_SLEEP) + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); + gBattleMons[battler].status1 = 0; BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 1u << *(gBattleStruct->battlerPartyIndexes + battler), @@ -17250,6 +17278,25 @@ void BS_DamageToQuarterTargetHP(void) gBattlescriptCurrInstr = cmd->nextInstr; } +void BS_JumpIfSleepClause(void) +{ + NATIVE_ARGS(const u8 *jumpInstr); + + // Can freely sleep own partner + if (IsDoubleBattle() && B_FLAG_SLEEP_CLAUSE && GetBattlerSide(gBattlerAttacker) == GetBattlerSide(gBattlerTarget)) + { + gBattleStruct->sleepClauseEffectExempt |= (1u << gBattlerTarget); + gBattlescriptCurrInstr = cmd->nextInstr; + return; + } + gBattleStruct->sleepClauseEffectExempt &= ~(1u << gBattlerTarget); + // Can't sleep if clause is active otherwise + if (IsSleepClauseActiveForSide(GetBattlerSide(gBattlerTarget))) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + void BS_FickleBeamDamageCalculation(void) { NATIVE_ARGS(); diff --git a/src/battle_util.c b/src/battle_util.c index bcd43f8962..b8a4653d56 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2785,6 +2785,10 @@ u8 DoBattlerEndTurnEffects(void) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TERRAINPREVENTS_MISTY; BattleScriptExecute(BattleScript_TerrainPreventsEnd2); } + else if (IsSleepClauseActiveForSide(GetBattlerSide(battler))) + { + BattleScriptExecute(BattleScript_SleepClausePreventsEnd); + } else { if (B_SLEEP_TURNS >= GEN_5) @@ -2792,6 +2796,7 @@ u8 DoBattlerEndTurnEffects(void) else gBattleMons[battler].status1 |= ((Random() % 4) + 3); + TryActivateSleepClause(battler, gBattlerPartyIndexes[battler]); BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(battler); BattleScriptExecute(BattleScript_YawnMakesAsleep); @@ -3239,6 +3244,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) { if (UproarWakeUpCheck(gBattlerAttacker)) { + TryDeactivateSleepClause(GetBattlerSide(gBattlerAttacker), gBattlerPartyIndexes[gBattlerAttacker]); gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_SLEEP; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); @@ -3268,6 +3274,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) } else { + TryDeactivateSleepClause(GetBattlerSide(gBattlerAttacker), gBattlerPartyIndexes[gBattlerAttacker]); gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; @@ -3327,6 +3334,8 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gHitMarker |= HITMARKER_OBEYS; break; case DISOBEYS_FALL_ASLEEP: + if (FlagGet(B_FLAG_SLEEP_CLAUSE)) + gBattleStruct->sleepClauseEffectExempt |= (1u << gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep; gMoveResultFlags |= MOVE_RESULT_MISSED; break; @@ -5212,7 +5221,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 if (gBattleMons[battler].status1 & (STATUS1_POISON | STATUS1_TOXIC_POISON)) StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); if (gBattleMons[battler].status1 & STATUS1_SLEEP) + { StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); + } + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); if (gBattleMons[battler].status1 & STATUS1_BURN) @@ -5816,10 +5829,12 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 && IsBattlerAlive(gBattlerAttacker) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && CanBeSlept(gBattlerAttacker, ability) + && CanBeSlept(gBattlerAttacker, ability, FALSE) && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS && IsMoveMakingContact(move, gBattlerAttacker)) { + if (FlagGet(B_FLAG_SLEEP_CLAUSE)) + gBattleStruct->sleepClauseEffectExempt |= (1u << gBattlerAttacker); gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_SLEEP; PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); BattleScriptPushCursor(); @@ -6252,6 +6267,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 case ABILITY_VITAL_SPIRIT: if (gBattleMons[battler].status1 & STATUS1_SLEEP) { + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); effect = 1; @@ -6674,8 +6690,11 @@ bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag) return IsBattlerGrounded(battler); } -bool32 CanBeSlept(u32 battler, u32 ability) +bool32 CanBeSlept(u32 battler, u32 ability, u32 isBlockedBySleepClause) { + if(IsSleepClauseActiveForSide(GetBattlerSide(battler)) && isBlockedBySleepClause) + return FALSE; + if (ability == ABILITY_INSOMNIA || ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_COMATOSE @@ -7345,6 +7364,7 @@ static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect) BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet; effect = ITEM_STATUS_CHANGE; + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } break; case HOLD_EFFECT_CURE_CONFUSION: @@ -7376,6 +7396,7 @@ static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect) { gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) @@ -7586,6 +7607,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; BattleScriptExecute(BattleScript_BerryCureSlpEnd2); effect = ITEM_STATUS_CHANGE; + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } break; case HOLD_EFFECT_CURE_STATUS: @@ -7604,6 +7626,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); i++; + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) { @@ -7883,6 +7906,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; BattleScriptExecute(BattleScript_BerryCureSlpEnd2); effect = ITEM_STATUS_CHANGE; + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } break; case HOLD_EFFECT_CURE_CONFUSION: @@ -7907,6 +7931,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); i++; + TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]); } if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) { @@ -8547,7 +8572,7 @@ u8 GetAttackerObedienceForAction() obedienceLevel = levelReferenced - obedienceLevel; calc = ((rnd >> 16) & 255); - if (calc < obedienceLevel && CanBeSlept(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker))) + if (calc < obedienceLevel && CanBeSlept(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker), FALSE)) { // try putting asleep int i; @@ -11972,3 +11997,31 @@ u32 GetMoveType(u32 move) return TYPE_MYSTERY; return gMovesInfo[move].type; } + +void TryActivateSleepClause(u32 battler, u32 indexInParty) +{ + if (gBattleStruct->sleepClauseEffectExempt & (1u << battler)) + { + gBattleStruct->sleepClauseEffectExempt &= ~(1u << battler); + return; + } + + if (FlagGet(B_FLAG_SLEEP_CLAUSE)) + gBattleStruct->monCausingSleepClause[GetBattlerSide(battler)] = indexInParty; +} + +void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty) +{ + // If the pokemon on the given side at the given index in the party is the one causing Sleep Clause to be active, + // set monCausingSleepClause[battlerSide] = PARTY_SIZE, which means Sleep Clause is not active for the given side + if (FlagGet(B_FLAG_SLEEP_CLAUSE) && gBattleStruct->monCausingSleepClause[battlerSide] == indexInParty) + gBattleStruct->monCausingSleepClause[battlerSide] = PARTY_SIZE; +} + +bool8 IsSleepClauseActiveForSide(u32 battlerSide) +{ + // If monCausingSleepClause[battlerSide] == PARTY_SIZE, Sleep Clause is not active for the given side. + // If monCausingSleepClause[battlerSide] < PARTY_SIZE, it means it is storing the index of the mon that is causing Sleep Clause to be active, + // from which it follows that Sleep Clause is active. + return (FlagGet(B_FLAG_SLEEP_CLAUSE) && (gBattleStruct->monCausingSleepClause[battlerSide] < PARTY_SIZE)); +} diff --git a/src/pokemon.c b/src/pokemon.c index a605b43e50..743f5b2771 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4199,7 +4199,24 @@ bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battlerId) status &= ~healMask; SetMonData(mon, MON_DATA_STATUS, &status); if (gMain.inBattle && battlerId != MAX_BATTLERS_COUNT) + { gBattleMons[battlerId].status1 &= ~healMask; + if((healMask & STATUS1_SLEEP)) + { + u32 i = 0; + u32 battlerSide = GetBattlerSide(battlerId); + struct Pokemon *party = GetSideParty(battlerSide); + + for (i = 0; i < PARTY_SIZE; i++) + { + if (&party[i] == mon) + { + TryDeactivateSleepClause(battlerSide, i); + break; + } + } + } + } return FALSE; } else diff --git a/test/battle/sleep_clause.c b/test/battle/sleep_clause.c new file mode 100644 index 0000000000..c8393685b8 --- /dev/null +++ b/test/battle/sleep_clause.c @@ -0,0 +1,1816 @@ +#include "global.h" +#include "test/battle.h" + +AI_SINGLE_BATTLE_TEST("Sleep Clause: AI will not use sleep moves while sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_SPORE, MOVE_MACH_PUNCH); } + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(player, 1); EXPECT_MOVE(opponent, MOVE_MACH_PUNCH); } + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_MACH_PUNCH); } + } +} + +AI_DOUBLE_BATTLE_TEST("Sleep Clause: AI will not use sleep moves while sleep clause is active (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_SPORE, MOVE_MACH_PUNCH); } + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_MACH_PUNCH); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_CELEBRATE); MOVE(playerRight, MOVE_CELEBRATE); EXPECT_MOVE(opponentLeft, MOVE_SPORE); EXPECT_MOVE(opponentRight, MOVE_MACH_PUNCH); } + TURN { SWITCH(playerLeft, 2); MOVE(playerRight, MOVE_CELEBRATE); EXPECT_MOVE(opponentLeft, MOVE_MACH_PUNCH); EXPECT_MOVE(opponentRight, MOVE_MACH_PUNCH); } + TURN { MOVE(playerLeft, MOVE_CELEBRATE); MOVE(playerRight, MOVE_CELEBRATE); EXPECT_MOVE(opponentLeft, MOVE_MACH_PUNCH); EXPECT_MOVE(opponentRight, MOVE_MACH_PUNCH); } + } +} + +AI_DOUBLE_BATTLE_TEST("Sleep Clause: AI will not use sleep move if partner is already using a sleep move") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_SPORE, MOVE_MACH_PUNCH); } + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_SPORE, MOVE_MACH_PUNCH); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_CELEBRATE); MOVE(playerRight, MOVE_CELEBRATE); EXPECT_MOVE(opponentLeft, MOVE_SPORE); EXPECT_MOVE(opponentRight, MOVE_MACH_PUNCH); } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep moves fail when sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_SPORE); SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + MESSAGE("Sleep Clause kept the opposing Wobbuffet awake!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep moves fail when sleep clause is active (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { HP(1); MaxHP(100); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentRight); MOVE(playerRight, MOVE_SPORE, target: opponentLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + } + MESSAGE("Sleep Clause kept the opposing Wobbuffet awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Rest does not activate sleep clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_REST); } + TURN { MOVE(player, MOVE_SPORE); SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Rest does not activate sleep clause (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { HP(1); MaxHP(100); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponentLeft, MOVE_REST); MOVE(playerLeft, MOVE_SPORE, target: opponentRight); } + } SCENE { + STATUS_ICON(opponentLeft, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Rest can still be used when sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_TACKLE); SWITCH(opponent, 1); } + TURN { MOVE(opponent, MOVE_REST); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, opponent); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Rest can still be used when sleep clause is active (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { HP(1); MaxHP(100); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentRight); MOVE(opponentLeft, MOVE_REST); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + STATUS_ICON(opponentLeft, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, opponentLeft); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Psycho Shift'ing sleep will fail if sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_SLEEP_TALK].effect == EFFECT_SLEEP_TALK); + ASSUME(gMovesInfo[MOVE_PSYCHO_SHIFT].effect == EFFECT_PSYCHO_SHIFT); + PLAYER(SPECIES_WOBBUFFET) + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_SLEEP_TALK, MOVE_PSYCHO_SHIFT); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(player, 1); SWITCH(opponent, 1); } + TURN { MOVE(opponent, MOVE_SPORE); MOVE(player, MOVE_SLEEP_TALK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, player); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_SHIFT, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + STATUS_ICON(opponent, sleep: TRUE); + } + MESSAGE("Sleep Clause kept the opposing Wobbuffet awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Psycho Shift'ing sleep will activate sleep clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_SLEEP_TALK].effect == EFFECT_SLEEP_TALK); + ASSUME(gMovesInfo[MOVE_PSYCHO_SHIFT].effect == EFFECT_PSYCHO_SHIFT); + PLAYER(SPECIES_ZIGZAGOON) + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON) { Moves(MOVE_SLEEP_TALK, MOVE_PSYCHO_SHIFT); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SLEEP_TALK); } + TURN { SWITCH(player, 1); SWITCH(opponent, 1); } + TURN { MOVE(opponent, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_SHIFT, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + STATUS_ICON(player, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +AI_SINGLE_BATTLE_TEST("Sleep Clause: AI will not use Yawn while sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_YAWN, MOVE_MACH_PUNCH); } + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_YAWN); } + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_MACH_PUNCH); } + TURN { SWITCH(player, 1); EXPECT_MOVE(opponent, MOVE_MACH_PUNCH); } + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_MACH_PUNCH); } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Yawn will fail when sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_YAWN); } + TURN { } + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_YAWN); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Wobbuffet fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + STATUS_ICON(player, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Wobbuffet awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Effect Spore causes sleep 11% of the time with sleep clause active") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(player, 1); } + TURN { MOVE(player, MOVE_TACKLE); } + TURN { } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("The opposing Breloom's Effect Spore made Wobbuffet sleep!"); + STATUS_ICON(player, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Effect Spore causes sleep 11% of the time with sleep clause active (Doubles)") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(opponentLeft, MOVE_SPORE, target:playerRight); MOVE(playerLeft, MOVE_TACKLE, target:opponentLeft);} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Wobbuffet fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ABILITY_POPUP(opponentLeft, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("The opposing Breloom's Effect Spore made Wobbuffet sleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + } +} + + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep from Effect Spore will not activate sleep clause") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN {} + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_SPORE); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("The opposing Breloom's Effect Spore made Wobbuffet sleep!"); + STATUS_ICON(player, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Wobbuffet fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep from Effect Spore will not activate sleep clause (Doubles)") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_TACKLE, target:opponentLeft); MOVE(opponentLeft, MOVE_SPORE, target:playerRight); } + } SCENE { + ABILITY_POPUP(opponentLeft, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("The opposing Breloom's Effect Spore made Wobbuffet sleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Wobbuffet fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Moves with sleep effect chance will activate sleep clause") +{ + PASSES_RANDOMLY(10, 100, RNG_SECONDARY_EFFECT); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(MoveHasAdditionalEffect(MOVE_RELIC_SONG, MOVE_EFFECT_SLEEP)); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_RELIC_SONG); } + TURN { MOVE(player, MOVE_SPORE); SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_RELIC_SONG, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + STATUS_ICON(opponent, sleep: TRUE); + MESSAGE("Wobbuffet used Spore!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Moves with sleep effect chance will still do damage when sleep clause active, but won't sleep") +{ + PASSES_RANDOMLY(100, 100, RNG_SECONDARY_EFFECT); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(MoveHasAdditionalEffect(MOVE_RELIC_SONG, MOVE_EFFECT_SLEEP)); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_RELIC_SONG); SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_RELIC_SONG, player); + HP_BAR(opponent); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Dire Claw cannot sleep a mon when sleep clause is active") +{ + PASSES_RANDOMLY(100, 100, RNG_SECONDARY_EFFECT); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(MoveHasAdditionalEffect(MOVE_DIRE_CLAW, MOVE_EFFECT_DIRE_CLAW)); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_DIRE_CLAW); SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); + HP_BAR(opponent); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Dark Void can only sleep one opposing mon if sleep clause is active") +{ + // Source: https://bulbapedia.bulbagarden.net/wiki/Dark_Void_(move) + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_DARK_VOID].effect == EFFECT_DARK_VOID); + PLAYER(SPECIES_DARKRAI); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_DARK_VOID); } + TURN { MOVE(playerLeft, MOVE_DARK_VOID); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DARK_VOID, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + STATUS_ICON(opponentRight, sleep: TRUE); + MESSAGE("The opposing Wobbuffet fell asleep!"); + } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: G-Max Befuddle can only sleep one opposing mon if sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_G_MAX_BEFUDDLE].argument == MAX_EFFECT_EFFECT_SPORE_FOES); + PLAYER(SPECIES_BUTTERFREE) { GigantamaxFactor(TRUE); } + PLAYER(SPECIES_CATERPIE); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_BUG_BITE, target: opponentLeft, gimmick: GIMMICK_DYNAMAX, + WITH_RNG(RNG_G_MAX_BEFUDDLE, STATUS1_SLEEP)); } + } SCENE { + MESSAGE("Butterfree used G-Max Befuddle!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + STATUS_ICON(opponentRight, sleep: TRUE); + MESSAGE("The opposing Wobbuffet fell asleep!"); + } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon wakes up") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(B_SLEEP_TURNS >= GEN_5); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN {} + TURN {} + TURN {} + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("The opposing Wobbuffet woke up!"); + MESSAGE("Wobbuffet used Spore!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Wobbuffet fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up with Aromatherapy / Heal Bell / Sparkly Swirl") +{ + u32 move = MOVE_NONE, switchIndex = 0; + struct BattlePokemon *healingSlot = opponentRight; + struct BattlePokemon *sporedSlot = opponentLeft; + PARAMETRIZE { move = MOVE_AROMATHERAPY; healingSlot = opponentRight; sporedSlot = opponentLeft; switchIndex = 0; } + PARAMETRIZE { move = MOVE_HEAL_BELL; healingSlot = opponentRight; sporedSlot = opponentLeft; switchIndex = 0; } + PARAMETRIZE { move = MOVE_SPARKLY_SWIRL; healingSlot = opponentRight; sporedSlot = opponentLeft; switchIndex = 0; } + PARAMETRIZE { move = MOVE_AROMATHERAPY; healingSlot = opponentLeft; sporedSlot = opponentRight; switchIndex = 1; } + PARAMETRIZE { move = MOVE_HEAL_BELL; healingSlot = opponentLeft; sporedSlot = opponentRight; switchIndex = 1; } + PARAMETRIZE { move = MOVE_SPARKLY_SWIRL; healingSlot = opponentLeft; sporedSlot = opponentRight; switchIndex = 1; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_AROMATHERAPY].effect == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_HEAL_BELL].effect == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_SPARKLY_SWIRL].effect == EFFECT_SPARKLY_SWIRL); + ASSUME(B_SLEEP_TURNS >= GEN_5); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target:sporedSlot); } + TURN { SWITCH(sporedSlot, 2); MOVE(playerLeft, MOVE_SPORE, target:healingSlot); } + if (move == MOVE_SPARKLY_SWIRL) + TURN { SWITCH(sporedSlot, switchIndex); MOVE(healingSlot, move, target: playerRight); MOVE(playerLeft, MOVE_SPORE, target:sporedSlot); } + else + TURN { SWITCH(sporedSlot, switchIndex); MOVE(healingSlot, move); MOVE(playerLeft, MOVE_SPORE, target:sporedSlot); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, sporedSlot); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(sporedSlot, sleep: TRUE); + MESSAGE("Zigzagoon used Spore!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, healingSlot); + STATUS_ICON(healingSlot, sleep: TRUE); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + if (move == MOVE_AROMATHERAPY) + { + MESSAGE("The opposing Zigzagoon used Aromatherapy!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_AROMATHERAPY, healingSlot); + } + else if (move == MOVE_HEAL_BELL) + { + MESSAGE("The opposing Zigzagoon used Heal Bell!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_HEAL_BELL, healingSlot); + } + else + { + MESSAGE("The opposing Zigzagoon used Sparkly Swirl!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPARKLY_SWIRL, healingSlot); + } + STATUS_ICON(sporedSlot, sleep: FALSE); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, sporedSlot); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up forcefully by a move from an opponent") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(MoveHasAdditionalEffect(MOVE_WAKE_UP_SLAP, MOVE_EFFECT_REMOVE_STATUS)); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); } + TURN { SWITCH(opponentLeft, 2); MOVE(playerLeft, MOVE_SPORE, target:opponentRight); } + TURN { SWITCH(opponentLeft, 0); MOVE(playerLeft, MOVE_WAKE_UP_SLAP, target:opponentLeft); } + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + MESSAGE("Zigzagoon used Spore!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + STATUS_ICON(opponentRight, sleep: TRUE); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + MESSAGE("Zigzagoon used Wake-Up Slap!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_WAKE_UP_SLAP, playerLeft); + MESSAGE("The opposing Zigzagoon woke up!"); + STATUS_ICON(opponentLeft, sleep: FALSE); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up forcefully by Uproar") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_UPROAR].effect == EFFECT_UPROAR); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); MOVE(playerRight, MOVE_UPROAR); MOVE(opponentRight, MOVE_ROAR, target:playerRight); } + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + MESSAGE("Zigzagoon used Uproar!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_UPROAR, playerRight); + MESSAGE("Zigzagoon caused an uproar!"); + MESSAGE("The uproar woke the opposing Zigzagoon!"); + STATUS_ICON(opponentLeft, sleep: FALSE); + MESSAGE("The opposing Zigzagoon used Roar!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ROAR, opponentRight); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by using Sleep Talk into a status curing move") +{ + u32 move; + PARAMETRIZE { move = MOVE_PSYCHO_SHIFT; } + PARAMETRIZE { move = MOVE_JUNGLE_HEALING; } + PARAMETRIZE { move = MOVE_LUNAR_BLESSING; } + PARAMETRIZE { move = MOVE_TAKE_HEART; } + PARAMETRIZE { move = MOVE_AROMATHERAPY; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_SLEEP_TALK].effect == EFFECT_SLEEP_TALK); + ASSUME(gMovesInfo[MOVE_PSYCHO_SHIFT].effect == EFFECT_PSYCHO_SHIFT); + ASSUME(gMovesInfo[MOVE_JUNGLE_HEALING].effect == EFFECT_JUNGLE_HEALING); + ASSUME(gMovesInfo[MOVE_LUNAR_BLESSING].effect == EFFECT_JUNGLE_HEALING); + ASSUME(gMovesInfo[MOVE_PURIFY].effect == EFFECT_PURIFY); + ASSUME(gMovesInfo[MOVE_TAKE_HEART].effect == EFFECT_TAKE_HEART); + ASSUME(gMovesInfo[MOVE_AROMATHERAPY].effect == EFFECT_HEAL_BELL); + ASSUME(gItemsInfo[ITEM_CHESTO_BERRY].holdEffect == HOLD_EFFECT_CURE_SLP); + PLAYER(SPECIES_ZIGZAGOON) { Item(ITEM_CHESTO_BERRY); } + OPPONENT(SPECIES_ZIGZAGOON) { Moves(MOVE_SLEEP_TALK, move); } + } WHEN { + TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SLEEP_TALK); } + TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, move); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("The opposing Zigzagoon used Sleep Talk!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, opponent); + if (move == MOVE_PSYCHO_SHIFT) + { + MESSAGE("The opposing Zigzagoon used Psycho Shift!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_SHIFT, opponent); + } + else if (move == MOVE_JUNGLE_HEALING) + { + MESSAGE("The opposing Zigzagoon used Jungle Healing!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_JUNGLE_HEALING, opponent); + } + else if (move == MOVE_LUNAR_BLESSING) + { + MESSAGE("The opposing Zigzagoon used Lunar Blessing!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_LUNAR_BLESSING, opponent); + } + else if (move == MOVE_TAKE_HEART) + { + MESSAGE("The opposing Zigzagoon used Take Heart!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TAKE_HEART, opponent); + } + else if (move == MOVE_AROMATHERAPY) + { + MESSAGE("The opposing Zigzagoon used Aromatherapy!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_AROMATHERAPY, opponent); + } + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by Hydration in the rain") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_PELIPPER) { Ability(ABILITY_DRIZZLE); } + OPPONENT(SPECIES_LUVDISC) { Ability(ABILITY_HYDRATION); } + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Pelipper used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Luvdisc fell asleep!"); + MESSAGE("The opposing Luvdisc's Hydration cured its sleep problem!"); + STATUS_ICON(opponent, sleep: FALSE); + MESSAGE("Pelipper used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Luvdisc fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by Natural Cure") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_SWABLU) { Ability(ABILITY_NATURAL_CURE); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); } + TURN { SWITCH(opponent, 0); MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Swablu fell asleep!"); + MESSAGE("2 withdrew Swablu!"); + MESSAGE("2 sent out Swablu!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Swablu fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by Shed Skin") +{ + if (B_ABILITY_TRIGGER_CHANCE == GEN_4) + PASSES_RANDOMLY(30, 100, RNG_SHED_SKIN); + else + PASSES_RANDOMLY(33, 100, RNG_SHED_SKIN); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_DRATINI) { Ability(ABILITY_SHED_SKIN); } + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Dratini fell asleep!"); + MESSAGE("The opposing Dratini's Shed Skin cured its sleep problem!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Dratini fell asleep!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by Healer") +{ + PASSES_RANDOMLY(30, 100, RNG_HEALER); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_CHANSEY) { Ability(ABILITY_HEALER); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); } + TURN { MOVE(playerLeft, MOVE_SPORE, target:opponentLeft); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("The opposing Chansey's Healer cured the opposing Zigzagoon's problem!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by using a held item") +{ + u32 heldItem = ITEM_NONE; + PARAMETRIZE { heldItem = ITEM_CHESTO_BERRY; } + PARAMETRIZE { heldItem = ITEM_LUM_BERRY; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gItemsInfo[ITEM_CHESTO_BERRY].holdEffect == HOLD_EFFECT_CURE_SLP); + ASSUME(gItemsInfo[ITEM_LUM_BERRY].holdEffect == HOLD_EFFECT_CURE_STATUS); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON) { Item(heldItem); } + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + if (heldItem == ITEM_CHESTO_BERRY) + MESSAGE("The opposing Zigzagoon's Chesto Berry woke it up!"); + else + MESSAGE("The opposing Zigzagoon's Lum Berry cured its sleep problem!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by Flinging a held item") +{ + u32 heldItem = ITEM_NONE; + PARAMETRIZE { heldItem = ITEM_CHESTO_BERRY; } + PARAMETRIZE { heldItem = ITEM_LUM_BERRY; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_FLING].effect == EFFECT_FLING); + ASSUME(gItemsInfo[ITEM_CHESTO_BERRY].holdEffect == HOLD_EFFECT_CURE_SLP); + ASSUME(gItemsInfo[ITEM_LUM_BERRY].holdEffect == HOLD_EFFECT_CURE_STATUS); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON) { Item(heldItem); } + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentLeft); MOVE(playerRight, MOVE_FLING, target: opponentLeft); } + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentLeft); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("Zigzagoon used Fling!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, playerRight); + if (heldItem == ITEM_CHESTO_BERRY) + MESSAGE("The opposing Zigzagoon's Chesto Berry woke it up!"); + else + MESSAGE("The opposing Zigzagoon's Lum Berry cured its sleep problem!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by using an item") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gItemsInfo[ITEM_AWAKENING].battleUsage == EFFECT_ITEM_CURE_STATUS); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { USE_ITEM(opponent, ITEM_AWAKENING, partyIndex: 0); MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("Zigzagoon had its status healed!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon faints") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON) { Level(5); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("The opposing Zigzagoon fainted!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon faints (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON) { Level(5); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentLeft); MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); } + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentRight);} + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("The opposing Zigzagoon fainted!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by gaining the ability Insomnia / Vital Spirit") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { ability = ABILITY_INSOMNIA; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_DELIBIRD) { Ability(ability); } + OPPONENT(SPECIES_ZIGZAGOON) { Moves(MOVE_SLEEP_TALK, MOVE_SKILL_SWAP); } + } WHEN { + TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SLEEP_TALK); } + TURN { MOVE(opponent, MOVE_SKILL_SWAP); } + TURN { MOVE(player, MOVE_SPORE); MOVE(opponent, MOVE_SKILL_SWAP); } + } SCENE { + MESSAGE("Delibird used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + MESSAGE("The opposing Zigzagoon used Sleep Talk!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, opponent); + MESSAGE("The opposing Zigzagoon used Skill Swap!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SKILL_SWAP, opponent); + if (ability == ABILITY_VITAL_SPIRIT) + MESSAGE("The opposing Zigzagoon's Vital Spirit cured its sleep problem!"); + if (ability == ABILITY_INSOMNIA) + MESSAGE("The opposing Zigzagoon's Insomnia cured its sleep problem!"); + MESSAGE("The opposing Zigzagoon used Skill Swap!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SKILL_SWAP, opponent); + MESSAGE("Delibird used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is sent out, has Trace, and Traces Insomnia / Vital spirit") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { ability = ABILITY_INSOMNIA; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON) + PLAYER(SPECIES_DELIBIRD) { Ability(ability); } + OPPONENT(SPECIES_RALTS) { Ability(ABILITY_TRACE); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(player, 1); SWITCH(opponent, 1); } + TURN { SWITCH(opponent, 0); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Ralts fell asleep!"); + MESSAGE("2 sent out Zigzagoon!"); + MESSAGE("2 sent out Ralts!"); + if (ability == ABILITY_VITAL_SPIRIT) + MESSAGE("The opposing Ralts's Vital Spirit cured its sleep problem!"); + if (ability == ABILITY_INSOMNIA) + MESSAGE("The opposing Ralts's Insomnia cured its sleep problem!"); + MESSAGE("2 sent out Zigzagoon!"); + MESSAGE("Delibird used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is sent out and transforms into a mon with Insomnia / Vital spirit") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { ability = ABILITY_INSOMNIA; } + KNOWN_FAILING; // Sleep Clause parts work, but Imposter seems broken with battle messages / targeting. Issue #5565 https://github.com/rh-hideout/pokeemerald-expansion/issues/5565 + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gItemsInfo[ITEM_LAGGING_TAIL].holdEffect == HOLD_EFFECT_LAGGING_TAIL); + PLAYER(SPECIES_ZIGZAGOON) + PLAYER(SPECIES_DELIBIRD) { Ability(ability); } + OPPONENT(SPECIES_DITTO) { Ability(ABILITY_IMPOSTER); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(player, 1); SWITCH(opponent, 1); } + TURN { SWITCH(opponent, 0); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("The opposing Ditto transformed into Zigzagoon using Imposter!"); + MESSAGE("Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Ditto fell asleep!"); + MESSAGE("2 sent out Zigzagoon!"); + MESSAGE("2 sent out Ditto!"); + if (ability == ABILITY_VITAL_SPIRIT) + MESSAGE("The opposing Ditto's Vital Spirit cured its sleep problem!"); + else + MESSAGE("The opposing Ditto's Insomnia cured its sleep problem!"); + MESSAGE("2 sent out Zigzagoon!"); + MESSAGE("Delibird used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + } +} + +AI_SINGLE_BATTLE_TEST("Sleep Clause: AI will use sleep moves again when sleep clause has been deactivated") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gItemsInfo[ITEM_CHESTO_BERRY].holdEffect == HOLD_EFFECT_CURE_SLP); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_CHESTO_BERRY); } + OPPONENT(SPECIES_BRELOOM) { Moves(MOVE_SPORE, MOVE_MACH_PUNCH); } + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_SPORE); } + TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, MOVE_SPORE); } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up with G-Max Sweetness") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_G_MAX_SWEETNESS].argument == MAX_EFFECT_AROMATHERAPY); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_APPLETUN) { GigantamaxFactor(TRUE); } + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponentRight, MOVE_SPORE, target: playerRight); } + TURN { MOVE(playerLeft, MOVE_VINE_WHIP, target: opponentLeft, gimmick: GIMMICK_DYNAMAX); } + TURN { MOVE(opponentRight, MOVE_SPORE, target: playerRight); } + } SCENE { + MESSAGE("The opposing Wobbuffet used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Wobbuffet fell asleep!"); + MESSAGE("Appletun used G-Max Sweetness!"); + MESSAGE("Wobbuffet's status returned to normal!"); + MESSAGE("The opposing Wobbuffet used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Wobbuffet fell asleep!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Pre-existing sleep condition doesn't activate sleep clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON) { Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Sleep caused by Effect Spore does not prevent sleep clause from ever activating") // checks that sleepClauseEffectExempt works properly +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_AROMATHERAPY].effect == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(player, 2); MOVE(opponent, MOVE_SPORE); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("The opposing Breloom's Effect Spore made Zigzagoon sleep!"); + STATUS_ICON(player, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Waking up after Effect Spore doesn't deactivate sleep clause") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN {} + TURN {} + TURN {} + TURN { MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_SPORE); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("The opposing Breloom's Effect Spore made Zigzagoon sleep!"); + STATUS_ICON(player, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Waking up after Effect Spore doesn't deactivate sleep clause (Doubles)") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_5); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_AROMATHERAPY].effect == EFFECT_HEAL_BELL); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); MOVE(opponentRight, MOVE_SPORE, target:playerRight); } + TURN { SWITCH(playerLeft, 2); } + TURN { MOVE(playerLeft, MOVE_AROMATHERAPY); MOVE(opponentRight, MOVE_SPORE, target:playerRight); MOVE(opponentLeft, MOVE_SPORE, target:playerLeft); } + } SCENE { + ABILITY_POPUP(opponentLeft, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("The opposing Breloom's Effect Spore made Zigzagoon sleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_AROMATHERAPY, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Waking up after Rest doesn't deactivate sleep clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_ZIGZAGOON) { HP(1); MaxHP(100); } + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_REST); } + TURN {} + TURN {} + TURN {} + TURN { MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_SPORE); } + } SCENE { + MESSAGE("Zigzagoon went to sleep!"); + STATUS_ICON(player, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon woke up!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(player, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Waking up after Rest doesn't deactivate sleep clause (Doubles)") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_REST].effect == EFFECT_REST); + PLAYER(SPECIES_ZIGZAGOON) { HP(1); MaxHP(100); } + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_REST); MOVE(opponentRight, MOVE_SPORE, target:playerRight); } + TURN { SWITCH(playerRight, 2); } + TURN {} + TURN {} + TURN { MOVE(opponentRight, MOVE_SPORE, target:playerRight); } + } SCENE { + MESSAGE("Zigzagoon went to sleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, playerLeft); + MESSAGE("The opposing Zigzagoon used Spore!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + MESSAGE("Zigzagoon woke up!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Suppressing and then sleeping Vital Spirit / Insomnia and switching back in deactivates sleep clause") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { ability = ABILITY_INSOMNIA; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_DELIBIRD) { Ability(ability); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_GASTRO_ACID); } + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 0); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Delibird fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Mold Breaker Pokémon sleeping Vital Spirit / Insomnia activates sleep clause") +{ + KNOWN_FAILING; // Interaction between Mold Breaker and Vital Spirit / Insomnia is broken. Issue #5578 https://github.com/rh-hideout/pokeemerald-expansion/issues/5578 + u32 ability; + PARAMETRIZE { ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { ability = ABILITY_INSOMNIA; } + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_PANCHAM) { Ability(ABILITY_MOLD_BREAKER); } + OPPONENT(SPECIES_DELIBIRD) { Ability(ability); } + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 0); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Delibird fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + MESSAGE("Sleep Clause kept the opposing Delibird awake!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Yawn'd Pokémon slept due to Effect Spore before Yawn triggers does not activate sleep clause") +{ + PASSES_RANDOMLY(11, 100, RNG_EFFECT_SPORE); + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + PLAYER(SPECIES_BRELOOM) { Ability(ABILITY_EFFECT_SPORE); } + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_YAWN); } + TURN { MOVE(opponent, MOVE_TACKLE); } + TURN { SWITCH(opponent, 1); MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("The opposing Zigzagoon grew drowsy!"); + ABILITY_POPUP(player, ABILITY_EFFECT_SPORE); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("Breloom's Effect Spore made the opposing Zigzagoon sleep!"); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Yawn'd Pokémon who's partner is slept before Yawn triggers will not fall asleep due to sleep clause being activated") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_YAWN, target: opponentLeft); MOVE(playerRight, MOVE_YAWN, target: opponentRight); } + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentLeft); } + } SCENE { + MESSAGE("The opposing Zigzagoon grew drowsy!"); + MESSAGE("The opposing Zigzagoon grew drowsy!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + MESSAGE( "The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: If both Pokémon on one side are Yawn'd at the same time, one will fall asleep and the other will not") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_ZIGZAGOON) { Speed(5); } + PLAYER(SPECIES_ZIGZAGOON) { Speed(4); } + OPPONENT(SPECIES_ZIGZAGOON) { Speed(3); } + OPPONENT(SPECIES_ZIGZAGOON) { Speed(2); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_YAWN, target: opponentLeft); MOVE(playerRight, MOVE_YAWN, target: opponentRight); } + TURN { } + } SCENE { + MESSAGE("The opposing Zigzagoon grew drowsy!"); + MESSAGE("The opposing Zigzagoon grew drowsy!"); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + MESSAGE( "The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Reflection moves (ie. Magic Coat) fail if sleep clause is active and they reflect a sleep move") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_MAGIC_COAT].effect == EFFECT_MAGIC_COAT); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); } + TURN { MOVE(player, MOVE_MAGIC_COAT); MOVE(opponent, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGIC_COAT, player); + MESSAGE("The opposing Zigzagoon bounced the Spore back!"); // Should be MESSAGE("Zigzagoon bounced the Spore back!"); Issue #5579 https://github.com/rh-hideout/pokeemerald-expansion/issues/5579 + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Reflection moves (ie. Magic Coat) that reflect a sleep move activate sleep clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_MAGIC_COAT].effect == EFFECT_MAGIC_COAT); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(player, MOVE_MAGIC_COAT); MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGIC_COAT, player); + MESSAGE("Zigzagoon bounced the Spore back!"); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Reflection moves (ie. Magic Coat) that reflect Dark Void only sleep one opposing Pokémon") +{ + // Source: https://bulbapedia.bulbagarden.net/wiki/Dark_Void_(move) + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_MAGIC_COAT].effect == EFFECT_MAGIC_COAT); + ASSUME(gMovesInfo[MOVE_DARK_VOID].effect == EFFECT_DARK_VOID); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DARKRAI); + OPPONENT(SPECIES_DARKRAI); + } WHEN { + TURN { MOVE(playerLeft, MOVE_MAGIC_COAT); MOVE(opponentLeft, MOVE_DARK_VOID); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DARK_VOID, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Darkrai fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + STATUS_ICON(opponentRight, sleep: TRUE); + MESSAGE("The opposing Darkrai fell asleep!"); + } + } +} + +SINGLE_BATTLE_TEST("Sleep Clause: Magic Bounce'ing a sleep move activates sleep clause, and fails if sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); } + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(opponent, MOVE_SPORE); } + TURN { SWITCH(opponent, 1); } + TURN { MOVE(opponent, MOVE_SPORE); } + } SCENE { + MESSAGE("The opposing Zigzagoon's Spore was bounced back by Espeon's Magic Bounce!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + MESSAGE("The opposing Zigzagoon's Spore was bounced back by Espeon's Magic Bounce!"); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponent); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } + MESSAGE("Sleep Clause kept the opposing Zigzagoon awake!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Magic Bounce reflecting Dark Void only sleeps one opposing Pokémon") +{ + // Source: https://bulbapedia.bulbagarden.net/wiki/Dark_Void_(move) + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_DARK_VOID].effect == EFFECT_DARK_VOID); + PLAYER(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); } + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DARKRAI); + OPPONENT(SPECIES_DARKRAI); + } WHEN { + TURN { MOVE(opponentLeft, MOVE_DARK_VOID); } + } SCENE { + MESSAGE("The opposing Darkrai's Dark Void was bounced back by Espeon's Magic Bounce!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Darkrai fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + STATUS_ICON(opponentRight, sleep: TRUE); + MESSAGE("The opposing Darkrai fell asleep!"); + } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep Clause does not prevent sleeping your partner Pokémon with sleep effects") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + TURN { SWITCH(playerRight, 2); MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + TURN { SWITCH(playerRight, 3); MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + TURN { SWITCH(playerRight, 4); MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + TURN { SWITCH(playerRight, 5); MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep Clause does not prevent sleeping your partner Pokémon with Yawn") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN {} + TURN { SWITCH(playerRight, 2); MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN {} + TURN { SWITCH(playerRight, 3); MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN {} + TURN { SWITCH(playerRight, 4); MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN {} + TURN { SWITCH(playerRight, 5); MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN {} + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + STATUS_ICON(playerRight, sleep: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + STATUS_ICON(playerRight, sleep: TRUE); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Sleep moves used after being Encore'd are prevented when sleep clause is active") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(opponentLeft, MOVE_SPORE, target: playerLeft); MOVE(playerRight, MOVE_ENCORE, target: opponentLeft); } + TURN { SWITCH(playerLeft, 2); FORCED_MOVE(opponentLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + MESSAGE("Zigzagoon used Encore!"); + MESSAGE("Go! Zigzagoon!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + } + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Spore'ing opponent after Yawn'ing partner does not prevent Yawn's effect from sleeping partner") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SPORE, target: playerRight); } + TURN { SWITCH(playerRight, 2); MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN { MOVE(playerLeft, MOVE_SPORE, target: opponentLeft); MOVE(playerRight, MOVE_SPORE, target: opponentRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + MESSAGE("Go! Zigzagoon!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentLeft); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentLeft, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, playerRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, opponentRight); + MESSAGE("The opposing Zigzagoon fell asleep!"); + STATUS_ICON(opponentRight, sleep: TRUE); + } + MESSAGE("Zigzagoon fell asleep!"); + } +} + +DOUBLE_BATTLE_TEST("Sleep Clause: Opponent Spore'ing player's partner after partner was Yawn'd by player does not prevent Spore's effect from sleeping partner and activating clause") +{ + GIVEN { + FLAG_SET(B_FLAG_SLEEP_CLAUSE); + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + ASSUME(gMovesInfo[MOVE_YAWN].effect == EFFECT_YAWN); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + PLAYER(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + OPPONENT(SPECIES_ZIGZAGOON); + } WHEN { + TURN { MOVE(playerLeft, MOVE_YAWN, target: playerRight); } + TURN { MOVE(opponentLeft, MOVE_SPORE, target: playerRight); MOVE(opponentRight, MOVE_SPORE, target:playerLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft); + MESSAGE("Zigzagoon grew drowsy!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerRight); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerRight, sleep: TRUE); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentRight); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, playerLeft); + MESSAGE("Zigzagoon fell asleep!"); + STATUS_ICON(playerLeft, sleep: TRUE); + } + MESSAGE("Sleep Clause kept Zigzagoon awake!"); + } +} diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index b073ac226a..6faf6a4715 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -1371,7 +1371,6 @@ static inline rng_value_t MakeRngValue(const u16 seed) static void CB2_BattleTest_NextTrial(void) { - ClearFlagAfterTest(); TearDownBattle(); SetMainCallback2(CB2_BattleTest_NextParameter);