Added Gen 9 forms code, evolution code, some item effects

This commit is contained in:
Maruno17
2024-06-08 19:35:45 +01:00
parent 6c3d9e77ad
commit 5e23984765
26 changed files with 678 additions and 495 deletions

View File

@@ -252,8 +252,10 @@ class Pokemon
# @param value [Integer] new HP value
def hp=(value)
@hp = value.clamp(0, @totalhp)
heal_status if @hp == 0
@ready_to_evolve = false if @hp == 0
return if @hp > 0
heal_status
@ready_to_evolve = false
@evolution_counter = 0 if isSpecies?(:BASCULIN) || isSpecies?(:YAMASK)
end
# Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
@@ -988,6 +990,16 @@ class Pokemon
end
end
# Checks whether this Pokemon can evolve because of levelling up in battle.
# This also checks call_level_up as above.
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_on_battle_level_up
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_battle_level_up(pkmn, parameter)
next (success) ? new_species : nil
end
end
# Checks whether this Pokemon can evolve because of using an item on it.
# @param item_used [Symbol, GameData::Item, nil] the item being used
# @return [Symbol, nil] the ID of the species to evolve into