kwsch / pk3DS

Pokémon (3DS) ROM Editor & Randomizer
https://projectpokemon.org/forums/forums/topic/34377-pk3ds-xyoras-rom-editor-randomizer/
Other
408 stars 150 forks source link

[Feature Request] Option to entirely ignore Special Classes or shuffle them (Multi Battles) #210

Closed sora10pls closed 7 years ago

sora10pls commented 7 years ago

This is a semi-long read, so grab your popcorn! :)

Refer to: https://github.com/kwsch/pk3DS/blob/master/pk3DS/Subforms/Gen6/TrainerRand.cs#L103 "Ignoring Special Trainer Classes has the chance of crashing your game in some battles!"

In X/Y and OR/AS, there are a few Important Trainers who have 3D models when in battle as opposed to 2D mugshots. These include, and are not limited to: Calem, Serena, Brendan, May, and Steven.

Also in X/Y and OR/AS, when you are in a Multi Battle, they are always shown with 2D mugshots, with the only exceptions being Bryony and Celosia in X/Y. However, even in that scenario, the two Trainers are never seen in battle, so the game can properly load two 2D mugshots in place of them.

However, on the other side of the battlefield, if the 3D model of let's say, Serena, were to be changed into a 2D mugshot, the game would softlock because it would have no model to load, leaving the space blank and having nothing to fall back on (click here to see evidence of this; Brendan was replaced with a 2D mugshot).

Why I'm bringing this to your attention is because I'd like to remove the alert entirely and bring up a fix through some blacklisted Trainer Classes. I've gone ahead and compiled a list of every single Important Trainer with a 3D model in Multi Battles, via their Trainer slot numbers, barring ORAS Demo (because who's gonna randomize the demo? :P)

Regardless of whether or not Ignore Special Classes is checked, pk3DS should always blacklist these Trainer slots when it comes to randomizing Trainer Classes.

I believe that this should be done because if this, alongside my other Trainer Class issue are resolved, then users are 100% safe to randomize all Trainer Classes, including Special Trainer Classes, without the risk of crashing their game.

To make things a little easier for you, here's a list of all the Trainer slot numbers organized nicely into two arrays for you that you can easily copy/paste.

XY Multi Battle 3D Model slots

130, 131, 132, 338, 339, 340, 435, 436, 437, 575, 576, 577, 590, 591, 592, 596, 597, 598, 604, 605, 606, 607, 608, 609

ORAS Multi Battle 3D Model slots

674, 675, 676, 677, 678, 679, 680, 942
FrostedGeulleisia commented 7 years ago

technically, the game would crash, not softlock. That's due to each class used in Multi having its own 3d model, which other classes don't. In S/M this isn't a problem as every trainer class comes with a 3d model, so this applies only to gen 6. Technically, randomization could replace a multi battle ally class with a different one as I tried that before and it works just fine...

sora10pls commented 7 years ago

Yes, it's possible to replace allies with other allies, though I'd assume it's just easier to blacklist them altogether.

kwsch commented 7 years ago

Special classes are banned as follows: https://github.com/kwsch/pk3DS/blob/24775fba68c9402b91250dd98377fd2f31c576f1/pk3DS/Subforms/Gen6/TrainerRand.cs#L56-L60 ^ defines which classes are special

https://github.com/kwsch/pk3DS/blob/1d1227512a05c2f5a633e1ddb7d4f4440baeaaa0/pk3DS/Subforms/Gen6/RSTE.cs#L720-L725 ^ defines if a trainer's class should be randomized

https://github.com/kwsch/pk3DS/blob/ddc7b8558d1481d220538421a725b7c54b5e1723/pk3DS.Core/Legality/Legal.cs#L24-L139 ^ defines special classes

=====

will likely have to have a separate list of Trainer Indexes that are banned from modification regardless of randomizer settings.

HashSet<int> modelClassRestricted = new HashSet<int>(Main.Config.ORAS ? xymulti : aomulti);

!modelClassRestricted.Contains(i)

will have to modify some method calls so that the current randomization file index is supplied (i). Can always have it branch separately to return a random class from the banned set (ie shuffle allies) if that'd be preferable. [ie if modelClassRestricted.Contains(i) -> shuffle() else doExistingRand()]

sora10pls commented 7 years ago

Here are all of the Trainer Class IDs for Trainer Classes with 3D models.

XY

018, // Team Flare (Aliana)
019, // Team Flare (Bryony)
020, // Team Flare (Celosia)
021, // Team Flare (Mable)
022, // Team Flare (Xerosic)
055, // Pokémon Trainer (Shauna)
056, // Pokémon Trainer (Tierno)
057, // Pokémon Trainer (Trevor)
077, // Team Flare (Admin)*
078, // Team Flare (Admin)
079, // Team Flare (Grunt)*
080, // Team Flare (Grunt)
081, // Team Flare (Lysandre)
102, // Pokémon Trainer (AZ)
103, // Pokémon Trainer (Calem)
104, // Pokémon Trainer (Serena)
105, // Pokémon Profoessor (Sycamore)
175, // Team Flare Boss (Lysandre)
// * = Female

ORAS

127, // Pokémon Trainer (Brendan)
128, // Pokémon Trainer (May)
174, // Aqua Leader (Archie)
178, // Magma Leader (Maxie)
192, // Pokémon Trainer (Wally)
219, // Pokémon Trainer (Steven)
221, // Lorekeeper (Zinnia)
267, // Pokémon Trainer (Zinnia)
272, // Pokémon Trainer (Wally)*
278, // Pokémon Trainer (Brendan)*
279, // Pokémon Trainer (May)*
// * = has Mega Pendant/Bracelet

Doesn't crash, either! If I'm missing any, let me know :) top_0000

sora10pls commented 7 years ago

Thank you very much! This now makes https://github.com/kwsch/pk3DS/blob/master/pk3DS/Subforms/Gen6/TrainerRand.cs#L102-L103 invalid, as disallowed Trainer Classes are now gone, and Multi Battle 3D models are properly swapped :)