-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds ability Zero to Hero #3542
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,7 @@ static const u16 sSkillSwapBannedAbilities[] = | |
ABILITY_ICE_FACE, | ||
ABILITY_HUNGER_SWITCH, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sRolePlayBannedAbilities[] = | ||
|
@@ -138,6 +139,7 @@ static const u16 sRolePlayBannedAbilities[] = | |
ABILITY_ICE_FACE, | ||
ABILITY_HUNGER_SWITCH, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sRolePlayBannedAttackerAbilities[] = | ||
|
@@ -154,6 +156,7 @@ static const u16 sRolePlayBannedAttackerAbilities[] = | |
ABILITY_POWER_CONSTRUCT, | ||
ABILITY_ICE_FACE, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sWorrySeedBannedAbilities[] = | ||
|
@@ -170,6 +173,7 @@ static const u16 sWorrySeedBannedAbilities[] = | |
ABILITY_TRUANT, | ||
ABILITY_ICE_FACE, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sGastroAcidBannedAbilities[] = | ||
|
@@ -188,6 +192,7 @@ static const u16 sGastroAcidBannedAbilities[] = | |
ABILITY_SHIELDS_DOWN, | ||
ABILITY_STANCE_CHANGE, | ||
ABILITY_ZEN_MODE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sEntrainmentBannedAttackerAbilities[] = | ||
|
@@ -206,6 +211,7 @@ static const u16 sEntrainmentBannedAttackerAbilities[] = | |
ABILITY_ICE_FACE, | ||
ABILITY_HUNGER_SWITCH, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] = | ||
|
@@ -221,6 +227,7 @@ static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] = | |
ABILITY_BATTLE_BOND, | ||
ABILITY_ICE_FACE, | ||
ABILITY_GULP_MISSILE, | ||
ABILITY_ZERO_TO_HERO, | ||
}; | ||
|
||
static u8 CalcBeatUpPower(void) | ||
|
@@ -994,6 +1001,7 @@ static const u8 sAbilitiesNotTraced[ABILITIES_COUNT] = | |
[ABILITY_STANCE_CHANGE] = 1, | ||
[ABILITY_TRACE] = 1, | ||
[ABILITY_ZEN_MODE] = 1, | ||
[ABILITY_ZERO_TO_HERO] = 1, | ||
}; | ||
|
||
static const u8 sHoldEffectToType[][2] = | ||
|
@@ -4695,6 +4703,17 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 | |
effect++; | ||
} | ||
break; | ||
case ABILITY_ZERO_TO_HERO: | ||
if (!gSpecialStatuses[battler].switchInAbilityDone | ||
&& gBattleMons[battler].species == SPECIES_PALAFIN_HERO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be checking the party mon species. Doing it the current way causes the string to be played when this is acquired via Transform. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, didn't consider that case. @AlexOn1ine can you make a test and see if using Transform triggers the Zero to Hero popup/message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Transform seemed fine but Imposter did play the message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slightly concerning that the message didn't play for Transform but it did for Imposter. Leads me to wonder if other switch-in Abilities aren't triggering after Transform is used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible, we haven't added Transform tests, so that's something to go back and check. |
||
&& !gBattleStruct->transformZeroToHero[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)]) | ||
{ | ||
gSpecialStatuses[battler].switchInAbilityDone = TRUE; | ||
gBattleStruct->transformZeroToHero[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)] = TRUE; | ||
BattleScriptPushCursorAndCallback(BattleScript_ZeroToHeroActivates); | ||
effect++; | ||
} | ||
break; | ||
} | ||
break; | ||
case ABILITYEFFECT_ENDTURN: // 1 | ||
|
@@ -6078,6 +6097,7 @@ bool32 IsNeutralizingGasBannedAbility(u32 ability) | |
case ABILITY_ICE_FACE: | ||
case ABILITY_AS_ONE_ICE_RIDER: | ||
case ABILITY_AS_ONE_SHADOW_RIDER: | ||
case ABILITY_ZERO_TO_HERO: | ||
return TRUE; | ||
default: | ||
return FALSE; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
ASSUMPTIONS | ||
{ | ||
ASSUME(P_GEN_9_POKEMON == TRUE); | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Zero to Hero transforms Palafin when it switches out") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { SWITCH(player, 1); } | ||
TURN { SWITCH(player, 0); } | ||
} SCENE { | ||
MESSAGE("Palafin, that's enough! Come back!"); | ||
MESSAGE("Go! Wobbuffet!"); | ||
MESSAGE("Wobbuffet, that's enough! Come back!"); | ||
MESSAGE("Go! Palafin!"); | ||
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO); | ||
MESSAGE("Palafin underwent a heroic transformation!"); | ||
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); } | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Zero to Hero can't be surpressed by Neutralizing Gas") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_KOFFING) { Ability(ABILITY_NEUTRALIZING_GAS); } | ||
} WHEN { | ||
TURN { SWITCH(player, 1); } | ||
TURN { SWITCH(player, 0); } | ||
} SCENE { | ||
ABILITY_POPUP(opponent, ABILITY_NEUTRALIZING_GAS); | ||
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO); | ||
MESSAGE("Palafin underwent a heroic transformation!"); | ||
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); } | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Zero to Hero transforms both player and opponent") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { SWITCH(player, 1); SWITCH(opponent, 1); } | ||
TURN { SWITCH(player, 0); SWITCH(opponent, 0); } | ||
} SCENE { | ||
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO); | ||
MESSAGE("Palafin underwent a heroic transformation!"); | ||
ABILITY_POPUP(opponent, ABILITY_ZERO_TO_HERO); | ||
MESSAGE("Foe Palafin underwent a heroic transformation!"); | ||
} THEN { | ||
EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); | ||
EXPECT_EQ(opponent->species, SPECIES_PALAFIN_HERO); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Zero to Hero will activate if a switch move is used") | ||
{ | ||
GIVEN { | ||
ASSUME(gBattleMoves[MOVE_FLIP_TURN].effect == EFFECT_HIT_ESCAPE); | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_FLIP_TURN); SEND_OUT(player, 1); } | ||
TURN { SWITCH(player, 0); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FLIP_TURN, player); | ||
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO); | ||
MESSAGE("Palafin underwent a heroic transformation!"); | ||
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); } | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Gastro Acid, Worry Seed, and Simple Beam fail if the target has the Ability Zero to Hero") | ||
{ | ||
u16 move; | ||
|
||
PARAMETRIZE { move = MOVE_GASTRO_ACID; } | ||
PARAMETRIZE { move = MOVE_WORRY_SEED; } | ||
PARAMETRIZE { move = MOVE_SIMPLE_BEAM; } | ||
|
||
GIVEN { | ||
ASSUME(gBattleMoves[MOVE_GASTRO_ACID].effect == EFFECT_GASTRO_ACID); | ||
ASSUME(gBattleMoves[MOVE_WORRY_SEED].effect == EFFECT_WORRY_SEED); | ||
ASSUME(gBattleMoves[MOVE_SIMPLE_BEAM].effect == EFFECT_SIMPLE_BEAM); | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(opponent, move); } | ||
} SCENE { | ||
NOT ANIMATION(ANIM_TYPE_MOVE, move, player); | ||
MESSAGE("But it failed!"); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Role Play, Skill Swap, and Entrainment fail if either Pokémon has Zero to Hero") | ||
{ | ||
u16 move; | ||
|
||
PARAMETRIZE { move = MOVE_ROLE_PLAY; } | ||
PARAMETRIZE { move = MOVE_SKILL_SWAP; } | ||
PARAMETRIZE { move = MOVE_ENTRAINMENT; } | ||
|
||
GIVEN { | ||
ASSUME(gBattleMoves[MOVE_ROLE_PLAY].effect == EFFECT_ROLE_PLAY); | ||
ASSUME(gBattleMoves[MOVE_SKILL_SWAP].effect == EFFECT_SKILL_SWAP); | ||
ASSUME(gBattleMoves[MOVE_ENTRAINMENT].effect == EFFECT_ENTRAINMENT); | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(player, move); } | ||
} SCENE { | ||
NOT ANIMATION(ANIM_TYPE_MOVE, move, player); | ||
MESSAGE("But it failed!"); | ||
} | ||
} | ||
|
||
// Write Trace test and move this one to that file (including every other ability that can't be copied) | ||
SINGLE_BATTLE_TEST("Zero to Hero cannot be copied by Trace") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); } | ||
OPPONENT(SPECIES_RALTS) { Ability(ABILITY_TRACE); } | ||
} WHEN { | ||
TURN {} | ||
} SCENE { | ||
NONE_OF { | ||
ABILITY_POPUP(opponent, ABILITY_TRACE); | ||
MESSAGE("Foe Ralts Traced Palafin's Zero to Hero!"); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend for things like this just use a bitfield. That way you cut down 12 bytes of memory to 2 (1 for each side).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I let it pass for now since we gotta do a general
BattleStruct
cleanup anyway, a revamp of #2704.