forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Confusion, cursed body and poison touch trigger chance fixes and tests (
#4831) * accurate confusion chance and a test * Accurate Poison Touch chance and tests * Accurate cursed body chance * Create cursed_body.c
- Loading branch information
Showing
5 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Cursed Body triggers 30% of the time") | ||
{ | ||
PASSES_RANDOMLY(3, 10, RNG_CURSED_BODY); | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_FRILLISH) { Ability(ABILITY_CURSED_BODY); } | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_AQUA_JET); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_AQUA_JET, player); | ||
ABILITY_POPUP(opponent, ABILITY_CURSED_BODY); | ||
MESSAGE("Wobbuffet's Aqua Jet was disabled by Foe Frillish's Cursed Body!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Poison Touch has a 30% chance to poison when attacking with contact moves") | ||
{ | ||
PASSES_RANDOMLY(3, 10, RNG_POISON_TOUCH); | ||
GIVEN { | ||
ASSUME(gMovesInfo[MOVE_TACKLE].power > 0); | ||
ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); | ||
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_POISON_TOUCH); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_TACKLE); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); | ||
ABILITY_POPUP(player, ABILITY_POISON_TOUCH); | ||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); | ||
MESSAGE("Foe Wobbuffet was poisoned by Grimer's Poison Touch!"); | ||
STATUS_ICON(opponent, poison: TRUE); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Poison Touch only applies when using contact moves") | ||
{ | ||
u32 move; | ||
|
||
PARAMETRIZE { move = MOVE_TACKLE; } | ||
PARAMETRIZE { move = MOVE_SWIFT; } | ||
GIVEN { | ||
ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); | ||
ASSUME(!gMovesInfo[MOVE_SWIFT].makesContact); | ||
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_POISON_TOUCH); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(player, move); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, move, player); | ||
if (gMovesInfo[move].makesContact) { | ||
ABILITY_POPUP(player, ABILITY_POISON_TOUCH); | ||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); | ||
MESSAGE("Foe Wobbuffet was poisoned by Grimer's Poison Touch!"); | ||
STATUS_ICON(opponent, poison: TRUE); | ||
} else { | ||
NONE_OF { | ||
ABILITY_POPUP(player, ABILITY_POISON_TOUCH); | ||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); | ||
MESSAGE("Foe Wobbuffet was poisoned by Grimer's Poison Touch!"); | ||
STATUS_ICON(opponent, poison: TRUE); | ||
} | ||
} | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Poison Touch applies between multi-hit move hits") | ||
{ | ||
GIVEN { | ||
ASSUME(gMovesInfo[MOVE_ARM_THRUST].effect == EFFECT_MULTI_HIT); | ||
ASSUME(gMovesInfo[MOVE_ARM_THRUST].makesContact); | ||
ASSUME(gItemsInfo[ITEM_PECHA_BERRY].holdEffect == HOLD_EFFECT_CURE_PSN); | ||
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_POISON_TOUCH); } | ||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_PECHA_BERRY); }; | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_ARM_THRUST); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_ARM_THRUST, player); | ||
ABILITY_POPUP(player, ABILITY_POISON_TOUCH); | ||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); | ||
MESSAGE("Foe Wobbuffet was poisoned by Grimer's Poison Touch!"); | ||
STATUS_ICON(opponent, poison: TRUE); | ||
MESSAGE("Foe Wobbuffet's Pecha Berry cured poison!"); | ||
STATUS_ICON(opponent, poison: FALSE); | ||
ABILITY_POPUP(player, ABILITY_POISON_TOUCH); | ||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); | ||
MESSAGE("Foe Wobbuffet was poisoned by Grimer's Poison Touch!"); | ||
STATUS_ICON(opponent, poison: TRUE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Confusion adds a 50/33% chance to hit self with 40 power") | ||
{ | ||
s16 damage[2]; | ||
|
||
ASSUME(gMovesInfo[MOVE_TACKLE].power == 40); | ||
|
||
PASSES_RANDOMLY(B_CONFUSION_SELF_DMG_CHANCE >= GEN_7 ? 33 : 50, 100, RNG_CONFUSION); | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET) { Speed(1); }; | ||
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }; | ||
} WHEN { | ||
TURN { MOVE(opponent, MOVE_TACKLE, WITH_RNG(RNG_DAMAGE_MODIFIER, 0)); MOVE(player, MOVE_CONFUSE_RAY); } | ||
TURN; | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); | ||
HP_BAR(player, captureDamage: &damage[0]); | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFUSE_RAY, player); | ||
MESSAGE("Foe Wobbuffet became confused!"); | ||
MESSAGE("Foe Wobbuffet is confused!"); | ||
MESSAGE("It hurt itself in its confusion!"); | ||
HP_BAR(opponent, captureDamage: &damage[1]); | ||
} THEN { | ||
EXPECT_EQ(damage[0], damage[1]); | ||
} | ||
} |