• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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

84
Posts
10
Years
  • Age 28
  • Seen Jun 11, 2022
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