mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Added class GameData::GenderRatio
This commit is contained in:
@@ -15,7 +15,7 @@ module GameData
|
||||
attr_reader :evs
|
||||
attr_reader :base_exp
|
||||
attr_reader :growth_rate
|
||||
attr_reader :gender_rate
|
||||
attr_reader :gender_ratio
|
||||
attr_reader :catch_rate
|
||||
attr_reader :happiness
|
||||
attr_reader :moves
|
||||
@@ -119,7 +119,7 @@ module GameData
|
||||
ret["InternalName"] = [0, "n"]
|
||||
ret["Name"] = [0, "s"]
|
||||
ret["GrowthRate"] = [0, "e", :PBGrowthRates]
|
||||
ret["GenderRate"] = [0, "e", :PBGenderRates]
|
||||
ret["GenderRate"] = [0, "e", :GenderRatio]
|
||||
ret["Incense"] = [0, "e", :Item]
|
||||
ret["Evolutions"] = [0, "*ses", nil, :PBEvolution, nil]
|
||||
end
|
||||
@@ -142,7 +142,7 @@ module GameData
|
||||
@evs = hash[:evs] || [0, 0, 0, 0, 0, 0]
|
||||
@base_exp = hash[:base_exp] || 100
|
||||
@growth_rate = hash[:growth_rate] || PBGrowthRates::Medium
|
||||
@gender_rate = hash[:gender_rate] || PBGenderRates::Female50Percent
|
||||
@gender_ratio = hash[:gender_ratio] || :Female50Percent
|
||||
@catch_rate = hash[:catch_rate] || 255
|
||||
@happiness = hash[:happiness] || 70
|
||||
@moves = hash[:moves] || []
|
||||
|
||||
75
Data/Scripts/011_Data/002_Hardcoded data/004_GenderRatio.rb
Normal file
75
Data/Scripts/011_Data/002_Hardcoded data/004_GenderRatio.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
# If a Pokémon's gender ratio is none of :AlwaysMale, :AlwaysFemale or
|
||||
# :Genderless, then it will choose a random number between 0 and 255 inclusive,
|
||||
# and compare it to the @female_chance. If the random number is lower than this
|
||||
# chance, it will be female; otherwise, it will be male.
|
||||
module GameData
|
||||
class GenderRatio
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :female_chance
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@female_chance = hash[:female_chance]
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this gender ratio
|
||||
def name
|
||||
return _INTL(@real_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :AlwaysMale,
|
||||
:name => _INTL("Always Male")
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :AlwaysFemale,
|
||||
:name => _INTL("Always Female")
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :Genderless,
|
||||
:name => _INTL("Genderless")
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :FemaleOneEighth,
|
||||
:name => _INTL("Female One Eighth"),
|
||||
:female_chance => 32
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :Female25Percent,
|
||||
:name => _INTL("Female 25 Percent"),
|
||||
:female_chance => 64
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :Female50Percent,
|
||||
:name => _INTL("Female 50 Percent"),
|
||||
:female_chance => 128
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :Female75Percent,
|
||||
:name => _INTL("Female 75 Percent"),
|
||||
:female_chance => 192
|
||||
})
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
:id => :FemaleSevenEighths,
|
||||
:name => _INTL("Female Seven Eighths"),
|
||||
:female_chance => 224
|
||||
})
|
||||
@@ -1,26 +0,0 @@
|
||||
module PBGenderRates
|
||||
Genderless = 0
|
||||
AlwaysMale = 1
|
||||
FemaleOneEighth = 2
|
||||
Female25Percent = 3
|
||||
Female50Percent = 4
|
||||
Female75Percent = 5
|
||||
FemaleSevenEighths = 6
|
||||
AlwaysFemale = 7
|
||||
|
||||
def self.maxValue; return 7; end
|
||||
|
||||
def self.genderByte(gender)
|
||||
case gender
|
||||
when AlwaysMale then return 0
|
||||
when FemaleOneEighth then return 32
|
||||
when Female25Percent then return 64
|
||||
when Female50Percent then return 128
|
||||
when Female75Percent then return 192
|
||||
when FemaleSevenEighths then return 224
|
||||
when AlwaysFemale then return 254
|
||||
when Genderless then return 255
|
||||
end
|
||||
return 255 # Default value (genderless)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user