mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
update to latest 6.0 release
This commit is contained in:
@@ -479,6 +479,7 @@ end
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :heart_gauges
|
||||
attr_accessor :during_battle
|
||||
end
|
||||
|
||||
|
||||
@@ -486,6 +487,7 @@ end
|
||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
||||
# during battle and need to say they're ready to be purified afterwards
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
$PokemonTemp.during_battle=true
|
||||
$PokemonTemp.heart_gauges = []
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
$PokemonTemp.heart_gauges[i] = pkmn.heart_gauge
|
||||
@@ -493,6 +495,7 @@ Events.onStartBattle += proc { |_sender|
|
||||
}
|
||||
|
||||
Events.onEndBattle += proc { |_sender,_e|
|
||||
$PokemonTemp.during_battle=false
|
||||
$PokemonTemp.heart_gauges.each_with_index do |value, i|
|
||||
pkmn = $Trainer.party[i]
|
||||
next if !pkmn || !value || value == 0
|
||||
|
||||
@@ -58,9 +58,9 @@ class PokemonSprite < SpriteWrapper
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setPokemonBitmapFromId(id, back = false, shiny=false, bodyShiny=false, headShiny=false)
|
||||
def setPokemonBitmapFromId(id, back = false, shiny = false, bodyShiny = false, headShiny = false,spriteform_body=nil,spriteform_head=nil)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back,shiny, bodyShiny,headShiny)
|
||||
@_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back, shiny, bodyShiny, headShiny)
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
self.color = Color.new(0, 0, 0, 0)
|
||||
changeOrigin
|
||||
@@ -154,6 +154,8 @@ class PokemonIconSprite < SpriteWrapper
|
||||
end
|
||||
if useRegularIcon(@pokemon.species) || @pokemon.egg?
|
||||
@animBitmap = AnimatedBitmap.new(GameData::Species.icon_filename_from_pokemon(value))
|
||||
elsif useTripleFusionIcon(@pokemon.species)
|
||||
@animBitmap = AnimatedBitmap.new(pbResolveBitmap(sprintf("Graphics/Icons/iconDNA")))
|
||||
else
|
||||
@animBitmap = createFusionIcon()
|
||||
end
|
||||
@@ -164,6 +166,10 @@ class PokemonIconSprite < SpriteWrapper
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
def useTripleFusionIcon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
return isTripleFusion?(dexNum)
|
||||
end
|
||||
|
||||
def useRegularIcon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
@@ -176,26 +182,28 @@ class PokemonIconSprite < SpriteWrapper
|
||||
end
|
||||
|
||||
SPRITE_OFFSET = 10
|
||||
|
||||
def createFusionIcon()
|
||||
bodyPoke_number = getBodyID(pokemon.species)
|
||||
headPoke_number = getHeadID(pokemon.species, bodyPoke_number)
|
||||
|
||||
|
||||
bodyPoke = GameData::Species.get(bodyPoke_number).species
|
||||
headPoke = GameData::Species.get(headPoke_number).species
|
||||
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke, @pokemon.spriteform_head))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke, @pokemon.spriteform_body))
|
||||
|
||||
dexNum = getDexNumberForSpecies(@pokemon.species)
|
||||
ensureFusionIconExists
|
||||
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke)
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke, @pokemon.spriteform_head)
|
||||
|
||||
bitmapPath = sprintf("%s.png", bitmapFileName)
|
||||
generated_new_icon = generateFusionIcon(headPokeFileName,bitmapPath)
|
||||
generated_new_icon = generateFusionIcon(headPokeFileName, bitmapPath)
|
||||
result_icon = generated_new_icon ? AnimatedBitmap.new(bitmapPath) : icon1
|
||||
|
||||
for i in 0..icon1.width-1
|
||||
for j in ((icon1.height / 2) + Settings::FUSION_ICON_SPRITE_OFFSET)..icon1.height-1
|
||||
for i in 0..icon1.width - 1
|
||||
for j in ((icon1.height / 2) + Settings::FUSION_ICON_SPRITE_OFFSET)..icon1.height - 1
|
||||
temp = icon2.bitmap.get_pixel(i, j)
|
||||
result_icon.bitmap.set_pixel(i, j, temp)
|
||||
end
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
# The player's party Pokémon are stored in the array $Trainer.party.
|
||||
#===============================================================================
|
||||
class Pokemon
|
||||
attr_accessor :spriteform_body
|
||||
attr_accessor :spriteform_head
|
||||
|
||||
# @return [Symbol] this Pokémon's species
|
||||
attr_reader :species
|
||||
# If defined, this Pokémon's form will be this value even if a MultipleForms
|
||||
# handler tries to say otherwise.
|
||||
# @return [Integer, nil] this Pokémon's form
|
||||
# @return [Integer, nil] this Pokémon's formspriteform
|
||||
attr_accessor :forced_form
|
||||
# If defined, is the time (in Integer form) when this Pokémon's form was set.
|
||||
# @return [Integer, nil] the time this Pokémon's form was set
|
||||
@@ -45,7 +48,6 @@ class Pokemon
|
||||
attr_accessor :body_original_ability_index
|
||||
attr_accessor :head_original_ability_index
|
||||
|
||||
|
||||
# @return [Array<Pokemon::Move>] the moves known by this Pokémon
|
||||
attr_accessor :moves
|
||||
# @return [Array<Integer>] the IDs of moves known by this Pokémon when it was obtained
|
||||
@@ -126,7 +128,10 @@ class Pokemon
|
||||
end
|
||||
|
||||
def species_data
|
||||
return GameData::Species.get_species_form(@species, form_simple)
|
||||
if !@species_data || @species != @species_data.species
|
||||
@species_data = GameData::Species.get(@species)
|
||||
end
|
||||
return @species_data #GameData::Species.get(@species)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -161,7 +166,7 @@ class Pokemon
|
||||
return isSpecies?(check_species)
|
||||
end
|
||||
bodySpecies = getBodyID(species)
|
||||
checkSpeciesId = getID(nil,check_species)
|
||||
checkSpeciesId = getID(nil, check_species)
|
||||
return bodySpecies == checkSpeciesId
|
||||
end
|
||||
|
||||
@@ -170,14 +175,14 @@ class Pokemon
|
||||
return isSpecies?(check_species)
|
||||
end
|
||||
headSpecies = getHeadID(species)
|
||||
checkSpeciesId = getID(nil,check_species)
|
||||
checkSpeciesId = getID(nil, check_species)
|
||||
return headSpecies == checkSpeciesId
|
||||
end
|
||||
|
||||
def shiny=(value)
|
||||
@shiny=value
|
||||
@shiny = value
|
||||
if value && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
|
||||
@debug_shiny=true
|
||||
@debug_shiny = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -385,6 +390,7 @@ class Pokemon
|
||||
if @ability == :MULTITYPE && species_data.type1 == :NORMAL
|
||||
return getHeldPlateType()
|
||||
end
|
||||
return @type1 if @type1
|
||||
return species_data.type1
|
||||
end
|
||||
|
||||
@@ -397,6 +403,14 @@ class Pokemon
|
||||
return sp_data.type2 || sp_data.type1
|
||||
end
|
||||
|
||||
def type1=(value)
|
||||
@type1 = value
|
||||
end
|
||||
|
||||
def type2=(value)
|
||||
@type2 = value
|
||||
end
|
||||
|
||||
# @return [Array<Symbol>] an array of this Pokémon's types
|
||||
def types
|
||||
sp_data = species_data
|
||||
@@ -478,8 +492,6 @@ class Pokemon
|
||||
return [:AlwaysMale, :AlwaysFemale, :Genderless].include?(gender_ratio)
|
||||
end
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Shininess
|
||||
#=============================================================================
|
||||
@@ -494,13 +506,13 @@ class Pokemon
|
||||
is_shiny = d < Settings::SHINY_POKEMON_CHANCE
|
||||
if is_shiny
|
||||
@shiny = true
|
||||
@natural_shiny=true
|
||||
@natural_shiny = true
|
||||
end
|
||||
|
||||
end
|
||||
if @shiny && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
|
||||
@debug_shiny=true
|
||||
@natural_shiny=false
|
||||
@debug_shiny = true
|
||||
@natural_shiny = false
|
||||
end
|
||||
return @shiny
|
||||
end
|
||||
@@ -787,9 +799,9 @@ class Pokemon
|
||||
body_species_id = getBasePokemonID(species)
|
||||
head_species = GameData::Species.get(head_species_id)
|
||||
body_species = GameData::Species.get(body_species_id)
|
||||
return move_data && (pokemon_can_learn_move(head_species,move_data) || pokemon_can_learn_move(body_species,move_data))
|
||||
return move_data && (pokemon_can_learn_move(head_species, move_data) || pokemon_can_learn_move(body_species, move_data))
|
||||
else
|
||||
return move_data && pokemon_can_learn_move(species_data,move_data)
|
||||
return move_data && pokemon_can_learn_move(species_data, move_data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1050,11 +1062,53 @@ class Pokemon
|
||||
#=============================================================================
|
||||
# Checks whether this Pokemon can evolve because of levelling up.
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
def prompt_evolution_choice(body_evolution, head_evolution)
|
||||
current_body = @species_data.body_pokemon
|
||||
current_head = @species_data.head_pokemon
|
||||
|
||||
choices = [
|
||||
#_INTL("Evolve both!"),
|
||||
_INTL("Evolve head!"),
|
||||
_INTL("Evolve body!"),
|
||||
_INTL("Don't evolve")
|
||||
]
|
||||
choice = pbMessage(_INTL('Both halves of {1} are ready to evolve!', self.name), choices, 0)
|
||||
# if choice == 0 #EVOLVE BOTH
|
||||
# newspecies = getFusionSpecies(body_evolution,head_evolution)
|
||||
if choice == 0 #EVOLVE HEAD
|
||||
newspecies = getFusionSpecies(current_body, head_evolution)
|
||||
elsif choice == 1 #EVOLVE BODY
|
||||
newspecies = getFusionSpecies(body_evolution, current_head)
|
||||
else
|
||||
newspecies = nil
|
||||
end
|
||||
return newspecies
|
||||
end
|
||||
|
||||
def check_evolution_on_level_up
|
||||
|
||||
if @species_data.is_a?(GameData::FusedSpecies)
|
||||
body = self.species_data.body_pokemon
|
||||
head = self.species_data.head_pokemon
|
||||
|
||||
body_evolution = check_evolution_internal(@species_data.body_pokemon) { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
head_evolution = check_evolution_internal(@species_data.head_pokemon) { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
if body_evolution && head_evolution
|
||||
return prompt_evolution_choice(body_evolution, head_evolution)
|
||||
end
|
||||
end
|
||||
|
||||
return check_evolution_internal { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
# Checks whether this Pokemon can evolve because of using an item on it.
|
||||
@@ -1091,11 +1145,13 @@ class Pokemon
|
||||
# which will provide either a GameData::Species ID (the species to evolve
|
||||
# into) or nil (keep checking).
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
def check_evolution_internal
|
||||
def check_evolution_internal(species = nil)
|
||||
return nil if egg? || shadowPokemon?
|
||||
return nil if hasItem?(:EVERSTONE)
|
||||
return nil if hasAbility?(:BATTLEBOND)
|
||||
species_data.get_evolutions(true).each do |evo|
|
||||
species = species_data if !species
|
||||
|
||||
species.get_evolutions(true).each do |evo|
|
||||
# [new_species, method, parameter, boolean]
|
||||
next if evo[3] # Prevolution
|
||||
ret = yield self, evo[0], evo[1], evo[2] # pkmn, new_species, method, parameter
|
||||
@@ -1221,9 +1277,9 @@ class Pokemon
|
||||
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
|
||||
# @param rechech_form [TrueClass, FalseClass] whether to auto-check the form
|
||||
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
|
||||
species_data = GameData::Species.get(species)
|
||||
@species = species_data.species
|
||||
@form = species_data.form
|
||||
@species_data = GameData::Species.get(species)
|
||||
@species = @species_data.species
|
||||
@form = @species_data.form
|
||||
@forced_form = nil
|
||||
@time_form_set = nil
|
||||
self.level = level
|
||||
@@ -1253,14 +1309,14 @@ class Pokemon
|
||||
@sheen = 0
|
||||
@pokerus = 0
|
||||
@name = nil
|
||||
@happiness = species_data.happiness
|
||||
@happiness = @species_data.happiness
|
||||
@poke_ball = :POKEBALL
|
||||
@markings = 0
|
||||
@iv = {}
|
||||
@ivMaxed = {}
|
||||
@ev = {}
|
||||
@hiddenPowerType = nil
|
||||
@glitter=nil
|
||||
@glitter = nil
|
||||
GameData::Stat.each_main do |s|
|
||||
@iv[s.id] = rand(IV_STAT_LIMIT + 1)
|
||||
@ev[s.id] = 0
|
||||
@@ -1284,6 +1340,8 @@ class Pokemon
|
||||
@personalID = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
@hp = 1
|
||||
@totalhp = 1
|
||||
@spriteform_body = nil
|
||||
@spriteform_head = nil
|
||||
calc_stats
|
||||
if @form == 0 && recheck_form
|
||||
f = MultipleForms.call("getFormOnCreation", self)
|
||||
|
||||
Reference in New Issue
Block a user