[wip] fusedPokemon

This commit is contained in:
infinitefusion
2023-08-05 12:32:35 -04:00
parent d304d223bd
commit 440a585d8c
17 changed files with 102 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -30,6 +30,11 @@ module GameData
# p "Please switch to symbols, thanks."
# end
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
if other == :Species
end
return self::DATA[other]
end

View File

@@ -1110,6 +1110,7 @@ class Pokemon
this_base_stats = species_data.base_stats
ret = {}
GameData::Stat.each_main { |s| ret[s.id] = this_base_stats[s.id] }
p ret
return ret
end

View File

@@ -1,6 +1,91 @@
class FusedPokemon < Pokemon
attr_reader :body_pokemon, :head_pokemon
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
super
end
@body_pokemon = GameData::Species.get((getBodyID(species)))
@head_pokemon = GameData::Species.get((getHeadID(species, @body_pokemon)))
#default to body for missing values
super(getBodyID(species), level, owner, withMoves, recheck_form)
end
#TODO
def name
return @body_pokemon.name + " " + @head_pokemon.name
end
#Types
#Todo: type exceptions
def type1
return @head_pokemon.type1
end
def type2
return @body_pokemon.type2
end
def baseStats
head_stats = @head_pokemon.base_stats
body_stats = @body_pokemon.base_stats
fused_stats = {}
#Head dominant stats
fused_stats[:HP] = calculate_fused_stats(head_stats[:HP], body_stats[:HP])
fused_stats[:SPECIAL_DEFENSE] = calculate_fused_stats(head_stats[:SPECIAL_DEFENSE], body_stats[:SPECIAL_DEFENSE])
fused_stats[:SPECIAL_ATTACK] = calculate_fused_stats(head_stats[:SPECIAL_ATTACK], body_stats[:SPECIAL_ATTACK])
#Body dominant stats
fused_stats[:ATTACK] = calculate_fused_stats(body_stats[:ATTACK], head_stats[:ATTACK])
fused_stats[:DEFENSE] = calculate_fused_stats(body_stats[:DEFENSE], head_stats[:DEFENSE])
fused_stats[:SPEED] = calculate_fused_stats(body_stats[:SPEED], head_stats[:SPEED])
return fused_stats
end
#Always return genderless
def gender
@gender = 2
return @gender
end
#todo
def growth_rate
super
end
def base_exp
head_exp = @head_pokemon.base_exp
body_exp = @body_pokemon.base_exp
return average_values(head_exp, body_exp)
end
def evYield
super
end
#Util methods
def calculate_fused_stats(dominantStat, otherStat)
return ((2 * dominantStat) / 3) + (otherStat / 3).floor
end
def average_values(value1, value2)
return ((value1 + value2) / 2).floor
end
def average_map_values(map1, map2)
p map1
p map2
averaged_map = map1.merge(map2) do |key, value1, value2|
((value1 + value2) / 2.0).floor
end
p averaged_map
return averaged_map
end
end

View File

@@ -0,0 +1,3 @@
class FusedSpecies < Species
end

View File

@@ -71,24 +71,24 @@ module GameData
return offset
end
def self.front_sprite_bitmap(dex_number, a = 0, b = 0, isShiny = false, bodyShiny = false, headShiny = false)
def self.front_sprite_bitmap(body_number, head_number = nil, b = 0, isShiny = false, bodyShiny = false, headShiny = false)
#la méthode est utilisé ailleurs avec d'autres arguments (gender, form, etc.) mais on les veut pas
if dex_number.is_a?(Symbol)
dex_number = GameData::Species.get(dex_number).id_number
if body_number.is_a?(Symbol)
body_number = GameData::Species.get(body_number).id_number
end
filename = self.sprite_filename(dex_number)
filename = self.sprite_filename(body_number)
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
if isShiny
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
sprite.shiftColors(self.calculateShinyHueOffset(body_number, bodyShiny, headShiny))
end
return sprite
end
def self.back_sprite_bitmap(dex_number, b = 0, form = 0, isShiny = false, bodyShiny = false, headShiny = false)
filename = self.sprite_filename(dex_number)
def self.back_sprite_bitmap(body_number, head_number = nil, form = 0, isShiny = false, bodyShiny = false, headShiny = false)
filename = self.sprite_filename(body_number)
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
if isShiny
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
sprite.shiftColors(self.calculateShinyHueOffset(body_number, bodyShiny, headShiny))
end
return sprite
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.