• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

v20.1 Change Vitamins to Increase IVs instead of EVs 1.0.0

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
This will change the vitamins default behavior from increasing the EVs of the stat by ten, to increasing the IV of a stat by one. This also does not change the Pokemon's nature as it might have in previous versions of Essentials.

To install the plugin, download this file, and unzip the contents to your plugin folder in Essentials.
Insert the following code into Item_Utilities just under the function pbUseEVRaisingItem ends
Item_Utilities script:
Expand Collapse Copy
#CHANGED
def pbMaxUsesOfIVRaisingItem(stat, amt_per_use, pkmn, iv_cap = Pokemon::IV_STAT_LIMIT)
  amt_can_gain = iv_cap - pkmn.iv[stat]
  return [(amt_can_gain.to_f / amt_per_use).ceil, 1].max
end

#CHANGED
def pbUseIVRaisingItem(stat, amt_per_use, qty, pkmn, happiness_type, scene, iv_cap = Pokemon::IV_STAT_LIMIT)
  ret = true
  qty.times do |i|
    if pkmn.iv[stat] < iv_cap
      pkmn.iv[stat] = [pkmn.iv[stat] + amt_per_use, 31].min
      pkmn.changeHappiness(happiness_type)
    else
      ret = false if i == 0
      break
    end
  end
  if !ret
    scene.pbDisplay(_INTL("It won't have any effect."))
    return false
  end
  pkmn.calc_stats
  scene.pbRefresh
  scene.pbDisplay(_INTL("{1}'s base {2} increased permanently.", pkmn.name, GameData::Stat.get(stat).name))
  return true
end

Next, in the Item_Effects script tab, find where ItemHandlers::UseOnPokemonMaximum.add(:HPUP begins, and ending just before ItemHandlers::UseOnPokemonMaximum.add(:HEALTHFEATHER begins, and replace it with the following code:
Item_Effects script:
Expand Collapse Copy
#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:HPUP, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:HP, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:HPUP, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:HP, 1, qty, pkmn, "vitamin", scene)
})

#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:PROTEIN, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:ATTACK, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:PROTEIN, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:ATTACK, 1, qty, pkmn, "vitamin", scene)
})

#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:IRON, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:DEFENSE, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:IRON, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:DEFENSE, 1, qty, pkmn, "vitamin", scene)
})

#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:CALCIUM, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:SPECIAL_ATTACK, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:CALCIUM, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:SPECIAL_ATTACK, 1, qty, pkmn, "vitamin", scene)
})

#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:ZINC, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:SPECIAL_DEFENSE, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:ZINC, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:SPECIAL_DEFENSE, 1, qty, pkmn, "vitamin", scene)
})

#CHANGED
ItemHandlers::UseOnPokemonMaximum.add(:CARBOS, proc { |item, pkmn|
  next pbMaxUsesOfIVRaisingItem(:SPEED, 1, pkmn)
})

#CHANGED
ItemHandlers::UseOnPokemon.add(:CARBOS, proc { |item, qty, pkmn, scene|
  next pbUseIVRaisingItem(:SPEED, 1, qty, pkmn, "vitamin", scene)
})

unknown.png
Credits
Please credit DarkYuan if used!
  • Like
Reactions: CelestialFearow
Author
DarkYuan
Views
1,599
First release
Last update

Ratings

4.00 star(s) 1 ratings

Latest reviews

This will def make things more simple to get good iv's for any pokémon!
The only thing I would change is the item use to raise the iv's.
Back
Top