mgriffin

Online now
Posted 6 Hours Ago
922 posts
5.8 Years
in Pokebattle_Pokemon:

# Returns the maximum HP of this Pokmon.
  def calcHP(base,level,iv,ev)
    return 1 if base==1
    return ((base*2+iv+(ev>>2))*level/100).floor+level+10
    if isConst?(self.species,PBSpecies,:DUSKNOIR) && 
      self.hasWorkingItem(:REAPERCLOTH)
      return ((((base*2+iv+(ev>>2))*level/100)+level+10)*1.3).floor
    end
  end
edit: I tried rearranging the script so that dusknoir's code happens before the normal calculation:

# Returns the maximum HP of this Pokmon.
  def calcHP(base,level,iv,ev)
    return 1 if base==1
    return ((((base*2+iv+(ev>>2))*level/100)+level+10)*1.3).floor if isConst?(self.species,PBSpecies,:DUSKNOIR) && 
      self.hasWorkingItem(:REAPERCLOTH)   
    return ((base*2+iv+(ev>>2))*level/100).floor+level+10
  end
but it still doesn't change.
It so far is not changing HP at all, I'm assuming it's because equipping items isn't calling calcStats. Maybe I messed up somewhere else, idk
Your second code looks reasonableyou're right that if you don't put the Dusknoir case above the normal case that it will never apply.

And I think you're also right that equipping items doesn't call calcStatsif I remove the item check the HP *is* modified; and if I leave the item check in (actually I used hasItem instead of hasWorkingItem) then my HP is modified if I faint/gain a level.

So add a call to calcStats in setItem and then have a think about what NewAgeSteel said about Pokmon getting KOed by the sudden change in max HP.