-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 B_VAR_DIFFICULTY and related functions READ DESC #5337
base: upcoming
Are you sure you want to change the base?
Conversation
fwiw those are in expansion already, I just modified them to use the new substruct |
Thoughts on having one trainer (trainer flag) per file? so you would have trainer files like that: |
I certainly don't mind spitting up into smaller files, but unfortunately, I think opponent ID can make things tricky for things like rematches, where ideally Splitting them up would also triple the time take to run preproc (not a blocker imho, but FYI) (I also don't know how to split them up.) |
I'm probably missing something, but I'm surprised that there isn't a change in Maybe the problem is that -%.h: %.party tools ; $(CPP) $(CPPFLAGS) -traditional-cpp - < $< | $(TRAINERPROC) -o $@ -i $< -
+%.h: %.party tools $(TRAINERPROC) ; $(CPP) $(CPPFLAGS) -traditional-cpp - < $< | $(TRAINERPROC) -o $@ -i $< |
To be clear, you're saying "hey, tests shouldn't have passed with this change"? I assumed that them passing meant that my fallback to |
That's what I thought, yeah. I'd have thought that we'd at least need a 2D trainers array in the tests. You're right about the fallback though, the But I checked out your PR locally and it seemed to work fine, so my assumption was wrong 😅 |
Co-authored-by: Martin Griffin <[email protected]>
fix: type confusion of NativeFunc pointers
Is it possible to implement this without changing |
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.
Some things, I haven't looked at it in more depth yet.
tools/trainerproc/main.c
Outdated
trainer->difficulty = literal_string("Normal"); | ||
|
||
fprintf(f, "#line %d\n", trainer->difficulty_line); | ||
fprint_constant(f, "[DIFFICULTY",trainer->difficulty); |
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.
fprint_constant(f, "[DIFFICULTY",trainer->difficulty); | |
fprint_constant(f, " [DIFFICULTY",trainer->difficulty); |
Should be indented to match existing formatting of trainers.h
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.
…h-hideout#5337 (comment) Fixed indenting for difficulty struct per rh-hideout#5337 (comment) Added automated test for difficulty per https://discord.com/channels/419213663107416084/1207720924414087168/1319255404265472043
DO NOT MERGE
until Sbird and Mgriffin have completed their reviews.
Closes #4197
Description
B_VAR_DIFFICULTY
which changes the loaded Trainers opponents, partners and and battle slide messages based on the value of this variable.B_VAR_DIFFICULTY
Details
Adding New Difficulty Levels
By default, the included difficulty levels are
DIFFICULTY_EASY
DIFFICULTY_NORMAL
DIFFICULTY_HARD
If a developer wants to adjust the number of difficulty levels, add a constant to the above
DIFFICULTY_COUNT
and the system will automatically update to match.Constants
The following constants are set to protect the player from accidently setting the difficulty value to an incorrect state. Developers are free to change these.
DIFFICULTY_MIN
This is the lowest possible difficulty that the player can be on. Any attempts to decrease past this will fail.
DIFFICULTY_MAX
This is the highest possible difficulty that the player can be on. Any attempts to increase past this will fail.
Defining Difficulty for Trainers and Partners
To define a difficulty for a Trainer, add a Difficulty field to the trainer in src/data/trainers.party
If a Trainer does not have a defined difficulty, it will use
DIFFICULTY_NORMAL
If you do not want this to occur.The same syntax is applied for partners in
src/data/trainers.party
.New Difficulty Levels
If a developer adds a new difficulty level, the defined property in the
.party
files will need to match.Example
trainerproc
DefinitionDIFFICULTY_EASY
DIFFICULTY_NORMAL
DIFFICULTY_HARD
DIFFICULTY_WEENIEHUTJR
DIFFICULTY_WILD
Defining Difficulty for Slide Messages
Slide messages work in a similar way in
src/battle_message.c
.Fallback
If a Trainer is called for the current difficulty and that Trainer does not have an entry for that difficulty, the game will fallback on the version defined for
DIFFICULTY_NORMAL
.Testing
Clean Branch
You can recreate this branch by applying a patch or pulling the repo. From a clean version of expansion's upcoming, you can either:
Patch
wget https://files.catbox.moe/bg2ywt.patch -O difficulty.patch ; git apply difficulty.patch ; rm difficulty.patch
Repo
git remote add psf-expansion https://github.com/PokemonSanFran/pokeemerald-expansion/ ; git pull psf-expansion difficultySystem
Manual Tests
After replicating the branch, to recreate my testing environment, you can either directly download the debugging changes.
Download
B_VAR_DIFFICULTY
==VAR_UNUSED_0x404E
wget https://files.catbox.moe/b6x9q5.party -O src/data/trainers.party ; \
wget https://files.catbox.moe/vj4g6n.party -O src/data/battle_partners.party ; \
wget https://files.catbox.moe/05ifz4.c -O src/battle_message.c ; \
wget https://files.catbox.moe/oxwlvj.inc -O data/scripts/debug.inc ; \
wget https://files.catbox.moe/5s17gx.h -O include/config/battle.h ;
B_VAR_DIFFICULTY
==0
wget https://files.catbox.moe/b6x9q5.party -O src/data/trainers.party ; \
wget https://files.catbox.moe/vj4g6n.party -O src/data/battle_partners.party ; \
wget https://files.catbox.moe/05ifz4.c -O src/battle_message.c ; \
wget https://files.catbox.moe/oxwlvj.inc -O data/scripts/debug.inc ; \
Verified Scenarios
After compiling the game and starting a new save, the first videos show:
DIFFICULTY_NORMAL
toDIFFICULTY_EASY
. (Script 1)DIFFICULTY_NORMAL
. (Script 2)DIFFICULTY_MIN
. (Script 4)DIFFICULTY_MIN
. (Script 5)There is a second video that shows a battle against Maxie HARD and Maxie EASY to show off the changes in battle messages.
B_VAR_DIFFICULTY
==VAR_UNUSED_0x404E
test.mp4
slideon.mp4
B_VAR_DIFFICULTY
==0
off.mp4
slideoff.mp4
People who collaborated with me in this PR
@TheSylphIsIn is the original author, @mrgriffin was instrumental in getting this to work with
trainerproc
, @hedara90 wrote tests.Discord Contact Info
I am
pkmnsnfrn
on Discord, there is a a discussion thread.