Pixelmon Mod - Bug tracker

[8.1.2] OU Battle Rule does not work ticket expired

Ticket description:
Steps to reproduce:
  1. Create Trainer NPC
  2. Set NPC's battle rules to use OU tier
  3. Battle NPC with non-OU Pokemon (i.e. Dialga)
  4. Battle is allowed (it should not be)

Comments

#21967 Posted by Barza » 25 Jan 2021 02:31

Thank you for the report.
It appears to have been a known issue for a decent amount of time.
However i can't seem to be able to find other open tickets about it.

If it helps, clauses can be used (legendary clause works). It's not perfect but hey, it's something.

#22056 Posted by Furgl » 15 Feb 2021 21:54

I'd really like to see this bug fixed, so here's the reasons that I've found why it doesn't work:

RulesRegistry#getPokemonSet() uses PokemonForm.getFromName(), which creates new PokemonForms using these two constructors:
Code: Select all   public PokemonForm(EnumSpecies pokemon) {
      this.pokemon = pokemon;
      this.form = -1;
      this.gender = Gender.Male;
   }

   public PokemonForm(EnumSpecies pokemon, int form) {
      this(pokemon);
      this.form = form;
      this.gender = Gender.Male;
   }
Since most/all Pokemon don't have a form of -1 and many Pokemon are not male, the rules don't match Pokemon like they should.

Another issue is the form parsing in PokemonForm.getFromName():
Code: Select all   String[] hyphenSplit = name.split("-");
   if (hyphenSplit.length == 2) {
      pokemon = EnumSpecies.getFromName(hyphenSplit[0]);
      String formName = hyphenSplit[1];
      if (pokemon.isPresent()) {
         EnumSpecies species = (EnumSpecies)pokemon.get();
         int formIndex = -1;
         Iterator var7 = species.getPossibleForms(true).iterator();

         while(var7.hasNext()) {
            IEnumForm form = (IEnumForm)var7.next();
            if (form.getFormSuffix().equalsIgnoreCase(formName)) {
               formIndex = form.getForm();
            }
         }

         return Optional.of(new PokemonForm(species, formIndex));
      }
   }
It splits the name with name.split("-"), which removes all dashes, and then it tries to match forms with form.getFormSuffix(), which includes a dash. So it will not match any forms.

I hope this will help with fixing the issue. Could you let me know if this will be fixed in the next update / near future, if possible? Just so I don't spend a lot of time making a workaround if it will be fixed soon. Thanks!

#22630 Posted by Foxily » 13 Jun 2021 19:30

Forwarded to our internal tracker.
Note: This happens with all tier battle rules.

Ticket details

  • Ticket ID: 15455
  • Project: Pixelmon Mod
  • Status: Ticket Expired
  • Component: Battle
  • Project version: 1.12.2-8.x.x
  • Priority: Normal
  • Severity: Normal
  • Forge/Sponge: (unknown)
  • What else would be useful to know?: (unknown)
  • Assigned to: Katzyn
  • Reported by: Furgl (Send PM)
  • Reporter's tickets: (List all tickets)
  • Reported on: 14 Jan 2021 12:52
  • Ticket last visited by: RosaTheRad on 02 Feb 2023 17:36
JOIN THE TEAM