Skip to content
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

Gen. 9 Move Effects, 2nd batch #2870

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1595a66
Implemented Triple Arrows' effect
LOuroboros Dec 14, 2022
05a34ed
Implemented Infernal Parade's effect
LOuroboros Dec 14, 2022
d2a221e
Corrected Lunar Blessing's data
LOuroboros Dec 14, 2022
8ae57dc
Implemented Take Heart's effect
LOuroboros Dec 14, 2022
000077f
Implemented Axe Kick's effect
LOuroboros Dec 15, 2022
ed9e860
Post cherrypick corrections and improvements
LOuroboros Mar 26, 2023
5bde987
Completed Take Heart's effect
LOuroboros Mar 29, 2023
977a55b
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Mar 29, 2023
8c4396d
Gen9 move tests batch2
AlexOn1ine Mar 29, 2023
a59ecf8
Merge pull request #21 from AlexOn1ine/gen9_move_tests_batch2
LOuroboros Mar 29, 2023
318b1ce
Added empty line at the end of test/move_effect_triple_arrows.c
LOuroboros Apr 2, 2023
7d49954
Updates
LOuroboros Apr 15, 2023
43a5aa0
Corrections
LOuroboros Apr 16, 2023
28ce87f
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Apr 18, 2023
2043380
Oopsie
LOuroboros Apr 18, 2023
787c0a1
Updated Triple Arrows' tests
LOuroboros Apr 18, 2023
b09ab5a
Updated Triple Arrows' effect's code and tests yet again
LOuroboros Apr 19, 2023
313f522
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jun 13, 2023
5fbfc11
'Triple Arrows [the move] makeS the foe'... etc
LOuroboros Jun 13, 2023
eb26039
Adjusted Triple Arrows' checks
LOuroboros Jun 13, 2023
3a23207
Applied Alex's corrections to Triple Arrows' tests
LOuroboros Jun 13, 2023
81bb299
Updated Axe Kick's battle script
LOuroboros Jun 13, 2023
9896f20
Applied fixes and corrections (Jun 2023)
LOuroboros Jun 14, 2023
9984a9e
Update src/data/battle_moves.h
LOuroboros Jun 15, 2023
48c04f9
Split Refresh's and Take Heart's effects in AI_CheckViability
LOuroboros Jun 19, 2023
2bf8850
More corrections
LOuroboros Jun 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,37 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectRevivalBlessing @ EFFECT_REVIVAL_BLESSING
.4byte BattleScript_EffectFrostbiteHit @ EFFECT_FROSTBITE_HIT
.4byte BattleScript_EffectSnow @ EFFECT_SNOWSCAPE
.4byte BattleScript_EffectTripleArrows @ EFFECT_TRIPLE_ARROWS
.4byte BattleScript_EffectInfernalParade @ EFFECT_INFERNAL_PARADE
.4byte BattleScript_EffectTakeHeart @ EFFECT_TAKE_HEART
.4byte BattleScript_EffectAxeKick @ EFFECT_AXE_KICK

BattleScript_EffectAxeKick::
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
setmoveeffect MOVE_EFFECT_CONFUSION
goto BattleScript_EffectRecoilIfMiss

BattleScript_EffectTakeHeart::
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
attackcanceler
attackstring
ppreduce
cureifburnedparalysedorpoisoned BattleScript_EffectTakeHeart_TryToRaiseStats
attackanimation
waitanimation
updatestatusicon BS_ATTACKER
printstring STRINGID_PKMNSTATUSNORMAL
waitmessage B_WAIT_TIME_LONG
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindStatRaise
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CalmMindStatRaise
goto BattleScript_CantRaiseMultipleStats

BattleScript_EffectTakeHeart_TryToRaiseStats:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed. Jump directly to Calm Mind after the ppreduce.

jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
goto BattleScript_CantRaiseMultipleStats

BattleScript_EffectTripleArrows::
setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS
goto BattleScript_EffectHit

BattleScript_EffectRevivalBlessing::
attackcanceler
Expand Down Expand Up @@ -1482,6 +1513,19 @@ BattleScript_DoubleShockRemoveType::
waitmessage B_WAIT_TIME_LONG
return

BattleScript_DefDown::
modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDown_Ret, ANIM_ON
BattleScript_DefDown_Ret:
return

BattleScript_ReduceDefenseAndFlinch::

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This battle script isn't in use anymore.

modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDownAndFlinch_Ret, ANIM_ON
jumpifability BS_TARGET, ABILITY_INNER_FOCUS, BattleScript_DefDownAndFlinch_Ret

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not needed. Should already be covered in the flinch move effect itself.

setmoveeffect MOVE_EFFECT_FLINCH
seteffectprimary
BattleScript_DefDownAndFlinch_Ret:
return

BattleScript_EffectPurify:
attackcanceler
attackstring
Expand Down Expand Up @@ -3476,6 +3520,7 @@ BattleScript_AbsorbHealBlock::
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd

BattleScript_EffectInfernalParade::
BattleScript_EffectBurnHit::
setmoveeffect MOVE_EFFECT_BURN
goto BattleScript_EffectHit
Expand Down Expand Up @@ -6349,6 +6394,7 @@ BattleScript_EffectCalmMind::
BattleScript_CalmMindDoMoveAnim::
attackanimation
waitanimation
BattleScript_CalmMindStatRaise::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0
setstatchanger STAT_SPATK, 1, FALSE
Expand Down
2 changes: 2 additions & 0 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ extern const u8 BattleScript_StealthRockActivates[];
extern const u8 BattleScript_SpikesActivates[];
extern const u8 BattleScript_BerserkGeneRet[];
extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[];
extern const u8 BattleScript_DefDown[];
extern const u8 BattleScript_ReduceDefenseAndFlinch[];

// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];
Expand Down
1 change: 1 addition & 0 deletions include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,6 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId);
void RemoveConfusionStatus(u8 battlerId);
u8 GetBattlerGender(u8 battlerId);
bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2);
u32 GetMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance);

#endif // GUARD_BATTLE_UTIL_H
3 changes: 2 additions & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,9 @@
#define MOVE_EFFECT_DIRE_CLAW 75
#define MOVE_EFFECT_STEALTH_ROCK 76
#define MOVE_EFFECT_SPIKES 77
#define MOVE_EFFECT_TRIPLE_ARROWS 78

#define NUM_MOVE_EFFECTS 78
#define NUM_MOVE_EFFECTS 79

#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000
Expand Down
6 changes: 5 additions & 1 deletion include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@
#define EFFECT_REVIVAL_BLESSING 401
#define EFFECT_FROSTBITE_HIT 402
#define EFFECT_SNOWSCAPE 403
#define EFFECT_TRIPLE_ARROWS 404
#define EFFECT_INFERNAL_PARADE 405
#define EFFECT_TAKE_HEART 406
#define EFFECT_AXE_KICK 407

#define NUM_BATTLE_MOVE_EFFECTS 404
#define NUM_BATTLE_MOVE_EFFECTS 408

#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
2 changes: 2 additions & 0 deletions include/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ enum RandomTag
RNG_STATIC,
RNG_STENCH,
RNG_TRI_ATTACK,
RNG_TRIPLE_ARROWS_DEFENSE_DOWN,
RNG_TRIPLE_ARROWS_FLINCH,
};

#define RandomWeighted(tag, ...) \
Expand Down
33 changes: 31 additions & 2 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,23 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
&& AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER)
score -= 10;
break;
case EFFECT_JUNGLE_HEALING:
if (AtMaxHp(battlerAtk)
&& AtMaxHp(BATTLE_PARTNER(battlerAtk))
&& !(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
&& !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY))
score -= 10;
else if (AI_DATA->hpPercents[battlerAtk] >= 90 || AI_DATA->hpPercents[BATTLE_PARTNER(battlerAtk)] >= 90)
Copy link

@Skeli789 Skeli789 Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what if either the attacker or partner has a status condition? It would be better if that was checked for as well. Take for instance both the attacker and partner are at full HP but are paralyzed. The AI would choose not to use Jungle Healing because of the current logic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what

             && !(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
             && !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY))

is for. if they're both at max health AND both it and its partner have no status condition, reduce 10 from the score.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's how it reads currently. If both the attacker and partner are all full health and neither the attacker nor the partner have a status condition, do score - 10. So far so good. But I'm commenting on the next block that is entered if either mon isn't at full health or either mon has a status condition. This second block is saying that if either mon has more than 90% of their HP remaining, do score - 10.

So take for instance another case. Attacker is at 1 HP remaining while the partner is at full health. The AI_DATA->hpPercents[BATTLE_PARTNER(battlerAtk)] >= 90 condition will evaluate to TRUE causing score - 9. This is clearly not what's wanted.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha, I misread it. An && would be needed for the HP percent, but it's not checking status in the second block. Do you think that's ok?

score -= 9; //No point in healing, but should at least do it if nothing better
break;
case EFFECT_TAKE_HEART:
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
if ((!(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
|| PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_JUNGLE_HEALING)
|| PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_HEAL_BELL)
|| PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_AROMATHERAPY))
&& !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)
&& !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF))
break;
case EFFECT_PLACEHOLDER:
return 0; // cannot even select
} // move effect checks
Expand Down Expand Up @@ -3772,7 +3789,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
case EFFECT_WISH:
case EFFECT_HEAL_BELL:
if (ShouldUseWishAromatherapy(battlerAtk, battlerDef, move))
score += 7;
score += 3;
break;
case EFFECT_THIEF:
{
Expand Down Expand Up @@ -4421,7 +4438,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score++;
break;
case EFFECT_REFRESH:
if (gBattleMons[battlerAtk].status1 & STATUS1_ANY)
case EFFECT_TAKE_HEART:
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
if (gBattleMons[battlerAtk].status1 & STATUS1_ANY
|| BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
|| BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF))
score += 2;
break;
case EFFECT_PSYCHO_SHIFT:
Expand Down Expand Up @@ -4871,6 +4891,15 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
//break;
//case EFFECT_SKY_DROP
//break;
case EFFECT_JUNGLE_HEALING:
if (ShouldRecover(battlerAtk, battlerDef, move, 25)
|| ShouldRecover(battlerAtk, BATTLE_PARTNER(battlerDef), move, 25)
|| ShouldRecover(BATTLE_PARTNER(battlerAtk), battlerDef, move, 25)
|| ShouldRecover(BATTLE_PARTNER(battlerAtk), BATTLE_PARTNER(battlerDef), move, 25)
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
|| gBattleMons[battlerAtk].status1 & STATUS1_ANY
|| gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY)
score += 3;
break;
} // move effect checks

return score;
Expand Down
1 change: 1 addition & 0 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,7 @@ bool32 IsHealingMoveEffect(u16 effect)
case EFFECT_HEALING_WISH:
case EFFECT_HEAL_PULSE:
case EFFECT_REST:
case EFFECT_JUNGLE_HEALING:
return TRUE;
default:
return FALSE;
Expand Down
1 change: 1 addition & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4749,6 +4749,7 @@ s8 GetMovePriority(u32 battlerId, u16 move)
case EFFECT_SOFTBOILED:
case EFFECT_ABSORB:
case EFFECT_ROOST:
case EFFECT_JUNGLE_HEALING:
priority += 3;
break;
}
Expand Down
32 changes: 26 additions & 6 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -3862,6 +3862,31 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_SpikesActivates;
}
break;
case MOVE_EFFECT_TRIPLE_ARROWS:
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
{
u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, GetMoveSecondaryEffectChance(gBattlerAttacker, 50));
u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, GetMoveSecondaryEffectChance(gBattlerAttacker, 30));

if (randomLowerDefenseChance && randomFlinchChance)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_ReduceDefenseAndFlinch;
}
else if (randomLowerDefenseChance && !randomFlinchChance)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_DefDown;
}
else if (randomFlinchChance
&& !randomLowerDefenseChance
&& battlerAbility != ABILITY_INNER_FOCUS
&& GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
{
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
gBattlescriptCurrInstr++;
}
}
break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section is still incredibly hacky with a lot of duplicate code. Even if it works, it would be best if cleaned up.

Copy link
Collaborator Author

@LOuroboros LOuroboros Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't keep it like that because it worked, but because I couldn't come up with something better and that worked.

I've been staring really hard and scratching my peanut sized brain some more, and I think this is a nice improvement and it still seems to work. Probably the farthest I can personally go.

https://diffy.org/diff/9f85000bb97c8

EDIT: Ignore the double semicolon in the call at Cmd_seteffectwithchance. Fixed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you're giving yourself enough credit 🙂
Take it slow, and take a break if you need to. I'm sure after enough time you'll be able to figure it out! Hacky code can often lead to unwanted bugs down the line. It's better to take it slow and write something that if modified in the future will stay bug-free.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand by my earlier statement, this section has still not been fixed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that, that's why I haven't resolved the conversation.

Still, I can't do more than I did here, so we're at an impasse.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do

u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, GetMoveSecondaryEffectChance(gBattlerAttacker, 50));
u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, GetMoveSecondaryEffectChance(gBattlerAttacker, 30));

if (randomFlinchChance
&& battlerAbility != ABILITY_INNER_FOCUS
&& GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
{
    gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
}

if (randomLowerDefenseChance)
{
    BattleScriptPush(gBattlescriptCurrInstr + 1);
    gBattlescriptCurrInstr = BattleScript_DefDown;
}
else
    gBattlescriptCurrInstr++;

If your tests fail because of this change, might be worth reworking those.

}
}
}
Expand All @@ -3873,12 +3898,7 @@ static void Cmd_seteffectwithchance(void)
{
CMD_ARGS();

u32 percentChance;

if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE)
percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance * 2;
else
percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance;
u32 percentChance = GetMoveSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be cleaner to pass gCurrentMove instead of secondaryEffectChance.

Copy link
Collaborator Author

@LOuroboros LOuroboros Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably fit the function's own label better. I'll make the change.

EDIT: Is what I'd say if I didn't make this for Triple Arrows which has 2 different effects with different chances, lel.

Uh, suggestions for a new label?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about CalcMoveSecondaryEffectChance? To make it similar to CalcMoveBasePower.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. In the Discord server, Cancer Fairy and I settled for CalculateMoveSecondaryEffectChance, so we were all on pretty much the same wavelength, I'll rename and push for another review.


if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleScripting.moveEffect)
Expand Down
9 changes: 9 additions & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8537,6 +8537,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = 120 * gBattleMons[battlerDef].hp / gBattleMons[battlerDef].maxHP;
break;
case EFFECT_HEX:
case EFFECT_INFERNAL_PARADE:
if (gBattleMons[battlerDef].status1 & STATUS1_ANY || GetBattlerAbility(battlerDef) == ABILITY_COMATOSE)
basePower *= 2;
break;
Expand Down Expand Up @@ -10928,3 +10929,11 @@ bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2)

return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
}

u32 GetMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance)
{
if (GetBattlerAbility(battlerId) == ABILITY_SERENE_GRACE)
return (secondaryEffectChance * 2);
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved

return secondaryEffectChance;
}
19 changes: 10 additions & 9 deletions src/data/battle_moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -12753,29 +12753,30 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
{
#if B_UPDATED_MOVE_DATA >= GEN_9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...This move has only been in a main series game since Gen 9? Why is this needed? (PLA is not considered a main series game in the same sense as all of the other ones).

Copy link
Collaborator Author

@LOuroboros LOuroboros Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, Nintendo does seem to consider it a main game.

Regardless, as it's explained in some of the comments at include/config/battle.h, we're considering LA a Gen. 8 Game (so we can have a configuration like this one for Triple Arrows because adding sub-version labels like GEN_9_LA was rejected), and in PLA, Triple Arrows had a power of 50 and a base amount of PP of 15.

"Why is it [the config for Triple Arrows] needed?" It isn't. I highly doubt someone will want to make use of Triple Arrows' LA data which makes the move weaker, but I have to cover my bases. We have configurations for a lot of different things, and the different aspects of move data is one of them.

I'm just going with the flow, and for better or worse, the expansion wants to have configurations for every little thing possible.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be better in that case to invert the condition and make a special define for PLA moves (such as #ifdef PLA_MOVE_EFFECTS) since they don't belong to any gen. That way if someone wants the moves to do what they did in PLA, they'll get all moves that existed in PLA to do what they did.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since they don't belong to any gen

PLA is Gen 8, but I get what you mean. Since we're not planning on adding PLA's combat mechanics, having the PLA data for these moves and not others is a bit redundant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you want me to proceed then, @AsparagusEduardo?

Should I just remove the move config for the PLA moves?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say so, yeah.

.power = 90,
.pp = 10,
#else
.power = 50,
.pp = 15,
#endif
.effect = EFFECT_PLACEHOLDER, // EFFECT_TRIPLE_ARROWS,
.effect = EFFECT_TRIPLE_ARROWS,
.type = TYPE_FIGHTING,
.accuracy = 100,
.pp = 15,
.secondaryEffectChance = 100,
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_HIGH_CRIT,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All moves that have a flinch chance are not affected by King's Rock.

.split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE,
},

[MOVE_INFERNAL_PARADE] =
{
.effect = EFFECT_PLACEHOLDER, // EFFECT_INFERNAL_PARADE,
.effect = EFFECT_INFERNAL_PARADE,
.power = 60,
.type = TYPE_GHOST,
.accuracy = 100,
.pp = 15,
.secondaryEffectChance = 0,
.secondaryEffectChance = 30,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
Expand Down Expand Up @@ -12861,7 +12862,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =

[MOVE_LUNAR_BLESSING] =
{
.effect = EFFECT_PLACEHOLDER, // EFFECT_LUNAR_BLESSING,
.effect = EFFECT_JUNGLE_HEALING,
.power = 0,
.type = TYPE_PSYCHIC,
.accuracy = 0,
Expand All @@ -12876,7 +12877,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =

[MOVE_TAKE_HEART] =
{
.effect = EFFECT_PLACEHOLDER, // EFFECT_TAKE_HEART,
.effect = EFFECT_TAKE_HEART,
.power = 0,
.type = TYPE_PSYCHIC,
.accuracy = 0,
Expand Down Expand Up @@ -12921,12 +12922,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =

[MOVE_AXE_KICK] =
{
.effect = EFFECT_PLACEHOLDER, // EFFECT_RECOIL_IF_MISS + 30% chance to confuse
.effect = EFFECT_AXE_KICK,
.power = 120,
.type = TYPE_FIGHTING,
.accuracy = 90,
.pp = 10,
.secondaryEffectChance = 0,
.secondaryEffectChance = 30,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
Expand Down
54 changes: 54 additions & 0 deletions test/move_effect_axe_kick.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "global.h"
#include "test_battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_AXE_KICK].effect == EFFECT_AXE_KICK);
}

SINGLE_BATTLE_TEST("Axe Kick confuses the target")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_AXE_KICK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_AXE_KICK, player);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent);
MESSAGE("Foe Wobbuffet became confused!");
}
}

SINGLE_BATTLE_TEST("Axe Kick deals damage half the hp to user if def battler protected")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_AXE_KICK); }
} SCENE {
s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, opponent);
MESSAGE("Foe Wobbuffet protected itself!");
MESSAGE("Foe Wobbuffet protected itself!");
MESSAGE("Wobbuffet kept going and crashed!");
HP_BAR(player, hp: maxHP / 2);
}
}

SINGLE_BATTLE_TEST("Axe Kick deals damage half the hp to user if it fails")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_AXE_KICK, hit: FALSE); }
} SCENE {
s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP);
MESSAGE("Wobbuffet used Axe Kick!");
MESSAGE("Wobbuffet's attack missed!");
MESSAGE("Wobbuffet kept going and crashed!");
HP_BAR(player, hp: maxHP / 2);
}
}
Loading