mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
Turned Town Map PBS data into a GameData class
This commit is contained in:
42
Data/Scripts/010_Data/002_PBS data/004_Ability.rb
Normal file
42
Data/Scripts/010_Data/002_PBS data/004_Ability.rb
Normal file
@@ -0,0 +1,42 @@
|
||||
module GameData
|
||||
class Ability
|
||||
attr_reader :id
|
||||
attr_reader :real_name
|
||||
attr_reader :real_description
|
||||
attr_reader :flags
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "abilities.dat"
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
"Description" => [:real_description, "q"],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
@real_description = hash[:real_description] || "???"
|
||||
@flags = hash[:flags] || []
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this ability
|
||||
def name
|
||||
return pbGetMessageFromHash(MessageTypes::Abilities, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this ability
|
||||
def description
|
||||
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description)
|
||||
end
|
||||
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user