-
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
Partner Battle refactor #3592
Partner Battle refactor #3592
Conversation
When checking for the partner, you need to do "TRAINER_PARTNER(partner)". For example: with partner Steven, you'd need check for "TRAINER_PARTNER(PARTNER_STEVEN)". I had plans to do it so the otId is handled in the partner array itself which would be the reusing of fields for a trainer that wouldn't make sense for a partner. Can partners use items like Potions for example? |
Oops, right. That solved the issue with the ID number for steven.
No, I don't think so. |
Then that data could be repurposed for the otId of the partner's Pokémon imo. How I initially set it up was that any partner that wasn't Steven has a random otId and then that would be passed for Mon creation. One thing I couldn't work out was handling shininess. How trainer control did it was change the otId of the Pokémon so the current personality would be that of a shiny. This doesn't quite work for partners and I'd like to think there's a way to make a mon shiny whilst preserving gender, nature and otId |
Yeah, makes sense. I'll see what others think and if it's an issue we should care about but the change can be made. |
I think being able to provide an ID is good - if you team up with the same NPC multiple times throughout the story, you'd expect their otID to at least be consistent. I don't know what the best implementation is - an actual value of the otID in the Trainer struct, or an ID that refers to a table so that multiple trainers can refer to the same ID - but I think it'd be a very good addition anyway. |
I feel repurposing the fields that don't get used for the partner makes the most sense and it would be easier for a user to be able to edit and tinker with it. From what I've seen, trainer items is 8 bytes (16 bits * MAX_TRAINER_ITEMS). So reusing 32 bits of that is more than enough. You'd also have 4 bytes remaining so there's a bit of room for more unique stuff for the partner. I feel you could add a union to "struct Trainer" for this. That said though, setting the otId is redundant when adding a shiny to the party roster as the trainer control stuff rewrites the otId to be the shiny value when shiny. This overwrites what you may have set for the otId previously. So shiny Pokémon for trainers or partners have a completely different otId. I feel this needs to be addressed and a alternate method for making the Pokémon shiny whilst preserving mon gender, nature and otId needs to be added for this |
I agree that the shiny generation needs to be revisited, but that shouldn't be a blocking issue for this PR. I'd however argue that being able to specify the otID in all other cases should be incorporated from the get-go. |
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.
Need to make sure to remove everything about the hypothetical May partner is removed too when this is ready for a merge besides just the debug scripts
I've applied all reviews but still didn't touch the id part. I tried some things but didn't like what I was doing. Maybe SBird / MGriffin could chime in? 👀 |
What was it you tried? |
#define TRAINER_TYPE(type, ...) { .type = { __VA_ARGS__ } }
// Macros used for specific trainer types
#define TRAINER_ITEMS(...) TRAINER_TYPE(trainer, __VA_ARGS__)
#define PARTNER_OTID(...) TRAINER_TYPE(partner, __VA_ARGS__) Do these macros work for you? [PARTNER_STEVEN] =
{
.trainerClass = TRAINER_CLASS_RIVAL,
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
.trainerPic = TRAINER_BACK_PIC_STEVEN,
.trainerName = gText_Steven,
.trainerType = PARTNER_OTID(.otId = STEVEN_OTID),
.doubleBattle = FALSE,
.aiFlags = 0, // TODO: allow partners to use their own AI flags
.party = TRAINER_PARTY(sParty_StevenPartner),
}, And for trainers, it'd be: [TRAINER_SAWYER_1] =
{
.trainerClass = TRAINER_CLASS_HIKER,
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_HIKER,
.trainerPic = TRAINER_PIC_HIKER,
.trainerName = gTrainerNameString_Sawyer,
.trainerType = TRAINER_ITEMS(.items = {}),
.doubleBattle = FALSE,
.aiFlags = AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY,
.party = TRAINER_PARTY(sParty_Sawyer1),
}, |
I got the shiny stuff and macro to work. Credits to SDH. Ready for re-review. |
a4e229b
to
fe1bad6
Compare
Ready for re-review. I force-pushed because I reverted changes. Maybe there is a better idea for the loop that does the Id thing. Suggestions are welcome. |
review changes applied. |
* Partner Battle refactor * fix for steven id * clean up * Use trainer partner names for id * removed testing leftover * comment change * more review changes * fix compiling * remove partener count --------- Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
* Partner Battle refactor * fix for steven id * clean up * Use trainer partner names for id * removed testing leftover * comment change * more review changes * fix compiling * remove partener count --------- Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
* Partner Battle refactor * fix for steven id * clean up * Use trainer partner names for id * removed testing leftover * comment change * more review changes * fix compiling * remove partener count --------- Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
Based on PR #3234 so full credit to ShinyDragonHunter.
The PR decouples partner trainers from
gTrainers
and adds new files to make it more convenient to create new trainer parties for a partner in a multi battle. Alongside I adjusted the Steven multi battle which can now serve as an example for new partners.Possible problem: Partner pokemon have different IDs. I'm not sure if this is something we need to care about.
Also I've kept in some debug scripts for now. They can be removed once the PR is ready to be merged.