• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Discussion] AI discussions

Erh guys, I've started really going deep into improving the AI by myself and I find 2 bugs that renders the damage calc completely useless, here they are:

1- Not as problematic, but this one still ruins the calculations. The damage dealt is being calculated using the attacker pokemon defense/sp.def stats, and not it's opponents as it should, this obviously mess things up.

Code:
    # Get base defense stat
    defense=pbRoughStat(attacker,PBStats::DEFENSE,skill)
    applysandstorm=false
    if type>=0 && move.pbIsSpecial?(type)
      if move.function!=0x122 # Psyshock
        defense=pbRoughStat(attacker,PBStats::SPDEF,skill)
        applysandstorm=true
      end
    end


2- This one ruins everything, and it took me some time to figure out what was causing it. By using the debug console I realized that EVERY basedamage in the damage calculation bit was returning either 0 or 1 while it shouldn't obviously. The problem is here:

Code:
        # Account for accuracy of move
        echo(basedamage.to_s+",")
        accuracy=pbRoughAccuracy(move,attacker,opponent,skill)
        basedamage*=accuracy/100
        echo(basedamage.to_s+",")

So to fix these is pretty simple then yes? You just change 'attacker' to 'opponent' for the first and remove the '/100' from the second? Or does this problem recur throughout the script?
 
Back
Top