Added def count to all GameData variants, and one that returns the number of species for Species, removed all uses of ID numbers for GameData::Status, made more use of GameData::X.keys

This commit is contained in:
Maruno17
2021-06-17 22:21:24 +01:00
parent 5358037986
commit eaa915878a
15 changed files with 86 additions and 72 deletions

View File

@@ -1,31 +1,29 @@
# NOTE: The id_number is only used to determine the order of the status icons in
# the graphics containing them. Number 0 (:NONE) is ignored; they start
# with status 1.
# "Graphics/Pictures/statuses.png" also contains icons for being fainted
# NOTE: "Graphics/Pictures/statuses.png" also contains icons for being fainted
# and for having Pokérus, in that order, at the bottom of the graphic.
# "Graphics/Pictures/Battle/icon_statuses.png" also contains an icon for
# bad poisoning (toxic), at the bottom of the graphic.
# Both graphics automatically handle varying numbers of defined statuses.
# Both graphics automatically handle varying numbers of defined statuses,
# as long as their extra icons remain at the bottom of them.
module GameData
class Status
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :animation
attr_reader :icon_position # Where this status's icon is within statuses.png
DATA = {}
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number]
@real_name = hash[:name] || "Unnamed"
@animation = hash[:animation]
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@animation = hash[:animation]
@icon_position = hash[:icon_position] || -1 # -1 means "no icon"
end
# @return [String] the translated name of this status condition
@@ -38,42 +36,41 @@ end
#===============================================================================
GameData::Status.register({
:id => :NONE,
:id_number => 0,
:name => _INTL("None")
:id => :NONE,
:name => _INTL("None")
})
GameData::Status.register({
:id => :SLEEP,
:id_number => 1,
:name => _INTL("Sleep"),
:animation => "Sleep"
:id => :SLEEP,
:name => _INTL("Sleep"),
:animation => "Sleep",
:icon_position => 0
})
GameData::Status.register({
:id => :POISON,
:id_number => 2,
:name => _INTL("Poison"),
:animation => "Poison"
:id => :POISON,
:name => _INTL("Poison"),
:animation => "Poison",
:icon_position => 1
})
GameData::Status.register({
:id => :BURN,
:id_number => 3,
:name => _INTL("Burn"),
:animation => "Burn"
:id => :BURN,
:name => _INTL("Burn"),
:animation => "Burn",
:icon_position => 2
})
GameData::Status.register({
:id => :PARALYSIS,
:id_number => 4,
:name => _INTL("Paralysis"),
:animation => "Paralysis"
:id => :PARALYSIS,
:name => _INTL("Paralysis"),
:animation => "Paralysis",
:icon_position => 3
})
GameData::Status.register({
:id => :FROZEN,
:id_number => 5,
:name => _INTL("Frozen"),
:animation => "Frozen"
:id => :FROZEN,
:name => _INTL("Frozen"),
:animation => "Frozen",
:icon_position => 4
})