Maruno17 / pokemon-essentials

A heavily modified RPG Maker XP game project that makes the game play like a Pokémon game. Not a full project in itself; this repo is to be added into an existing RMXP game project.
Other
208 stars 398 forks source link

Battle Bond not working as intended in v19.1 #145

Closed M1CR0H4CK3R closed 2 years ago

M1CR0H4CK3R commented 2 years ago

The below text is the relevant code:

    # Greninja - Battle Bond
    if !user.fainted? && !user.effects[PBEffects::Transform] &&
       user.isSpecies?(:GRENINJA) && user.ability == :BATTLEBOND
      if !@battle.pbAllFainted?(user.idxOpposingSide) &&
         !@battle.battleBond[user.index&1][user.pokemonIndex]
        numFainted = 0
        targets.each { |b| numFainted += 1 if b.damageState.fainted }
        if numFainted>0 && user.form==1
          @battle.battleBond[user.index&1][user.pokemonIndex] = true
          @battle.pbDisplay(_INTL("{1} became fully charged due to its bond with its Trainer!",user.pbThis))
          @battle.pbShowAbilitySplash(user,true)
          @battle.pbHideAbilitySplash(user)
          user.pbChangeForm(2,_INTL("{1} became Ash-Greninja!",user.pbThis))
        end
      end
    end

I'm no expert at reading code, but I think it's weird that the code first sets numFainted to 0, then, within another if statement nested right after that, says if numFainted>0 && user.form==1. This means that numFainted will never be more than 0, making Battle Bond never trigger. Possibly needs rewritten without being nested. Maruno, can you please post a working version of this code in the comments here so I can update it in my game? Thanks.

M1CR0H4CK3R commented 2 years ago

I'm so dumb. I missed the { |b| numFainted += 1 if b.damageState.fainted } in the literal next line after setting it to 0. I am exhausted after doing grocery shopping, so I missed reading a line. Still, I'm getting reports from my playtesters that it doesn't trigger for them. I tested in stock v19.1, and can confirm it does not trigger.

Maruno17 commented 2 years ago

I've just tried it in the latest dev version, and the special Greninja does turn into Ash-Greninja when it makes another Pokémon faint. This code is identical in both the dev version and v19.1, and I don't recall any complaints about it not working.

Consider all the requirements. The Pokémon has to be form 1 Greninja (not transformed into one), it has to have Battle Bond, and it has to personally make at least one other Pokémon faint because of a move, and it doesn't happen at the end of a battle. My best guess is that you've missed something in your game, or the playtesters aren't doing things properly.

M1CR0H4CK3R commented 2 years ago

Would an Ability Patch throw off the Ability? The Greninja being tested was not originally a Battle Bond Greninja.

Maruno17 commented 2 years ago

If it means the Pokémon doesn't meet the criteria of being a form 1 Greninja with Battle Bond, then yes. Form 1 Greninja only has one possible ability, so Ability Patch wouldn't work on it, meaning the Pokémon being tested probably wasn't form 1.

M1CR0H4CK3R commented 2 years ago

What exactly do you mean by 'Form 1'? Are you saying that, other than regular Greninja and Ash-Greninja, there's a 'special' form that I don't know about? Are you saying there's a Form, 0, 1, and 2?

M1CR0H4CK3R commented 2 years ago

If so, then that's probabl;y my issue.

M1CR0H4CK3R commented 2 years ago

Does a Protean Frogadier evolve into a Form 1 Greninja?

M1CR0H4CK3R commented 2 years ago

Just checked, and the answer is no, seemingly. Can I make it so that Froakie and Frogadier have an Ability 1 of Battle Bond, and make it so that BB Frogadier automatically becomes Form 1 Greninja? If so, where is the relevant code where I can do that?

Maruno17 commented 2 years ago

Form 0 is the standard form. Form 1 is naturally unobtainable, and is different to form 0 in that it can only have Battle Bond as an ability. Form 2 is Ash-Greninja, which reverts to form 1 at the end of the battle. Form 0 cannot access Battle Bond.

The player needs to be specially given a form 1 Greninja (which has Battle Bond). It sounds like you haven't. It also sounds like this isn't a bug in Essentials, so I'm closing this.