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

Another Gen 9 move batch #3450

Closed
wants to merge 19 commits into from

Conversation

kittenchilly
Copy link

Description

  • EFFECT_SPICY_EXTRACT
  • EFFECT_DOODLE
  • EFFECT_FILLET_AWAY
  • EFFECT_SHED_TAIL
  • EFFECT_TIDY_UP

Issue(s) that this PR fixes

Closes #2491
Closes #2498
Closes #2499
Closes #2504
Closes #2506

Discord contact info

kittenchilly

Copy link
Collaborator

@mrgriffin mrgriffin left a comment

Choose a reason for hiding this comment

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

A good start!

Just a note, it might be worth configuring your text editor to not trim trailing whitespace from lines because it makes the diffs a little more annoying to read.

src/battle_script_commands.c Outdated Show resolved Hide resolved
Comment on lines +1791 to +1795
.macro tidyupclear battler:req, clear:req, failInstr:req
various \battler, VARIOUS_TIDY_UP
.byte \clear
.4byte \failInstr
.endm
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would make sense to separate this into two commands (idk what the names should be, but obviously they need to be different):

	.macro tidyupclear battler:req, failInstr:req
	various \battler, VARIOUS_TIDY_UP
	.byte FALSE
	.4byte \failInstr
	.endm

	.macro tidyupclear battler:req
	various \battler, VARIOUS_TIDY_UP
	.byte TRUE
	.4byte NULL
	.endm

Because failInstr isn't actually required in the clear=TRUE case.

But also we never actually use the clear=FALSE case in the code as-written. Why does it exist?

Copy link
Author

Choose a reason for hiding this comment

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

I copied it from defogclear, which did have that. Forgot to remove it, but it might be useful...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahhh I think I see what clear does, if TRUE then it actually does the clearing, and if FALSE then it checks if there's anything that can be cleared and if there isn't it branches to failInstr?

I think it'd be fine to keep them both, and I suppose the names could be tidyupclear and cantidyupclear or something like that?

@@ -9640,6 +9669,25 @@ static void Cmd_various(void)
}
return;
}
case VARIOUS_TIDY_UP:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I might have seen somebody comment about this on #expansion-dev, but we've moved away from defining new variouses and now define callnatives because variouses are harder to read, and can be a merge conflict magnet for downstream users.

src/battle_util.c Show resolved Hide resolved
src/data/battle_moves.h Outdated Show resolved Hide resolved
ASSUME(gBattleMoves[MOVE_DOODLE].effect == EFFECT_DOODLE);
}

DOUBLE_BATTLE_TEST("Doodle gives the target's ability to user and ally")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write a/some tests that show Doodle failing if any three of the Pokémon involved have a forbidden ability? PARAMETRIZE will be useful for this.

Also can we get a SINGLE_BATTLE_TEST for whatever the expected behavior of Doodle in singles is.

Copy link
Author

Choose a reason for hiding this comment

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

Doodle in singles is exactly the same as Role Play.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool! So in that case I'd copy Role Play's applicable single test(s) and change them to use Doodle.

Or alternatively I suppose you could PARAMETRIZE those applicable tests over both MOVE_ROLE_PLAY and MOVE_DOODLE.

ASSUME(gBattleMoves[MOVE_FILLET_AWAY].effect == EFFECT_FILLET_AWAY);
}

SINGLE_BATTLE_TEST("Fillet Away cuts the user's HP in half")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should test that the stats have been boosted.

Can you test that this move fails if the HP is too low, or all the stats are at +6 already, and that it succeeds if only some but not all are at +6.

Comment on lines +9 to +10
TO_DO_BATTLE_TEST("Shed Tail sets up substitute");
TO_DO_BATTLE_TEST("Shed Tail transfers substitute to switch in");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write these tests?

Copy link
Collaborator

Choose a reason for hiding this comment

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

New effects should always have their full tests.

Comment on lines +52 to +55
TO_DO_BATTLE_TEST("Tidy Up raises attack and speed by 1 and removes Substitute")
TO_DO_BATTLE_TEST("Tidy Up raises attack and speed by 1 and removes Stealth Rock")
TO_DO_BATTLE_TEST("Tidy Up raises attack and speed by 1 and removes Toxic Spikes")
TO_DO_BATTLE_TEST("Tidy Up raises attack and speed by 1 and removes Sticky Web")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write these tests?

@AsparagusEduardo
Copy link
Collaborator

Just a note, it might be worth configuring your text editor to not trim trailing whitespace from lines because it makes the diffs a little more annoying to read.

GitHub has an option to hide whitespace differences to make it easier on that front
image

data/battle_scripts_1.s Outdated Show resolved Hide resolved
data/battle_scripts_1.s Outdated Show resolved Hide resolved
jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed
jumpifcantswitch SWITCH_IGNORE_ESCAPE_PREVENTION | BS_ATTACKER, BattleScript_ButItFailed
setsubstitute
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_SUBSTITUTE_FAILED, BattleScript_ButItFailed

Choose a reason for hiding this comment

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

Should this not jump to BattleScript_NotEnoughHPForSubstitute?

Copy link
Author

Choose a reason for hiding this comment

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

That doesn't exist. The way the substitute message works is different.

Choose a reason for hiding this comment

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

So then you should jump to the part of the substitute battle script where it prints the failure string. That way it'll print the correct string using the multistring chooser.

healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
printstring STRINGID_SHEDITSTAIL
waitmessage B_WAIT_TIME_LONG

Choose a reason for hiding this comment

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

At this point you need to call the moveend effects so things like HP restoring berries activate before the switchout.

Copy link
Author

Choose a reason for hiding this comment

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

Does this happen? Do moveend effects happen before the baton pass or u-turn switch out?

Choose a reason for hiding this comment

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

Each switchout move is its own case. U-Turn and Volt Switch for example can activate contact Abilities, while Baton Pass doesn't need to at all. In the case of Shed Tail, the user's HP is restored via a held Berry before switching out.

datahpupdate BS_ATTACKER
printstring STRINGID_SHEDITSTAIL
waitmessage B_WAIT_TIME_LONG
openpartyscreen BS_ATTACKER, BattleScript_ButItFailed

Choose a reason for hiding this comment

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

You should jump to a preexisting battle script for pivoting out. I'm sure plenty exist to choose from given the number of different pivot moves.

Copy link
Author

Choose a reason for hiding this comment

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

There isn't one. They all individually do the code for a switch out.

Choose a reason for hiding this comment

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

You should consolidate them then because there's a lot of reusable code from the different pivoting moves.

data/battle_scripts_1.s Outdated Show resolved Hide resolved
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_TidyUpTryHazards
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_TidyUpTryHazards:

Choose a reason for hiding this comment

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

The hazards are supposed to be removed before the stat changes. Once the order is fixed, you can also just jump to the Dragon Dance battle script to avoid duplicating code.

Copy link
Author

Choose a reason for hiding this comment

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

Where did you get this from? Defog raises evasiveness before clearing hazards.

Choose a reason for hiding this comment

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

https://youtu.be/n0_8i17k1RE?si=Cclst_BjTd9869pB&t=410
It's a dangerous trap to equate two similar yet unrelated effects. You can't rely on GameFreak to do things consistently.

data/battle_scripts_1.s Outdated Show resolved Hide resolved
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_BY_TWO
setstatchanger STAT_ATK, 2, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR | STAT_CHANGE_NOT_PROTECT_AFFECTED, BattleScript_SpicyExtractDefDown
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_SpicyExtractDefDown

Choose a reason for hiding this comment

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

This should be when greater than. The message that the stat can't be raised should print if necessary.

Copy link
Author

Choose a reason for hiding this comment

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

I don't see any other stat change that uses greater than for this.
Also it does print the message that the stat can't be raised? The printfromtable command right below does it.

Choose a reason for hiding this comment

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

But you're skipping it. How can the printfromtable command be reached if you're jumping to BattleScript_SpicyExtractDefDown when the message is B_MSG_STAT_WONT_INCREASE?

playstatchangeanimation BS_TARGET, BIT_DEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_DEF, 2, TRUE
statbuffchange STAT_CHANGE_ALLOW_PTR | STAT_CHANGE_NOT_PROTECT_AFFECTED, BattleScript_EffectSpicyExtract_End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_EffectSpicyExtract_End

Choose a reason for hiding this comment

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

Same here as the above comment.

@AsparagusEduardo
Copy link
Collaborator

AsparagusEduardo commented Nov 3, 2023

Dude, stop pushing commits without at testing them.
If we switch to a self-hosted runner, this will choke other other actions.
image

@kittenchilly
Copy link
Author

Decided I am going to split this into separate PRs. Will be easier to debug and review that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants