mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Renamed skill code property in trainer_types.txt to SkillFlags, and allowed any number of them
This commit is contained in:
@@ -5,7 +5,7 @@ module GameData
|
||||
attr_reader :gender
|
||||
attr_reader :base_money
|
||||
attr_reader :skill_level
|
||||
attr_reader :skill_code
|
||||
attr_reader :skill_flags
|
||||
attr_reader :intro_ME
|
||||
attr_reader :battle_BGM
|
||||
attr_reader :victory_ME
|
||||
@@ -21,7 +21,7 @@ module GameData
|
||||
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2}],
|
||||
"BaseMoney" => [:base_money, "u"],
|
||||
"SkillLevel" => [:skill_level, "u"],
|
||||
"SkillCode" => [:skill_code, "s"],
|
||||
"SkillFlags" => [:skill_flags, "*s"],
|
||||
"IntroME" => [:intro_ME, "s"],
|
||||
"BattleBGM" => [:battle_BGM, "s"],
|
||||
"VictoryME" => [:victory_ME, "s"]
|
||||
@@ -85,7 +85,7 @@ module GameData
|
||||
@gender = hash[:gender] || 2
|
||||
@base_money = hash[:base_money] || 30
|
||||
@skill_level = hash[:skill_level] || @base_money
|
||||
@skill_code = hash[:skill_code]
|
||||
@skill_flags = hash[:skill_flags] || []
|
||||
@intro_ME = hash[:intro_ME]
|
||||
@battle_BGM = hash[:battle_BGM]
|
||||
@victory_ME = hash[:victory_ME]
|
||||
|
||||
@@ -48,11 +48,10 @@ class Trainer
|
||||
def male?; return GameData::TrainerType.get(self.trainer_type).male?; end
|
||||
def female?; return GameData::TrainerType.get(self.trainer_type).female?; end
|
||||
def skill_level; return GameData::TrainerType.get(self.trainer_type).skill_level; end
|
||||
def skill_code; return GameData::TrainerType.get(self.trainer_type).skill_code; end
|
||||
def skill_flags; return GameData::TrainerType.get(self.trainer_type).skill_flags; end
|
||||
|
||||
def has_skill_code?(code)
|
||||
c = skill_code
|
||||
return c && c != "" && c[/#{code}/]
|
||||
def has_skill_flag?(code)
|
||||
return skill_flags.any? { |c| c.downcase == code.downcase }
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
@@ -349,7 +349,7 @@ def pbTrainerTypeEditor
|
||||
[_INTL("Gender"), EnumProperty.new(gender_array), _INTL("Gender of this Trainer Type.")],
|
||||
[_INTL("BaseMoney"), LimitProperty.new(9999), _INTL("Player earns this much money times the highest level among the trainer's Pokémon.")],
|
||||
[_INTL("SkillLevel"), LimitProperty.new(9999), _INTL("Skill level of this Trainer Type.")],
|
||||
[_INTL("SkillCode"), StringProperty, _INTL("Letters/phrases representing AI modifications of trainers of this type.")],
|
||||
[_INTL("SkillFlags"), StringListProperty, _INTL("Words/phrases representing AI modifications of trainers of this type.")],
|
||||
[_INTL("IntroME"), MEProperty, _INTL("ME played before battles against trainers of this type.")],
|
||||
[_INTL("BattleBGM"), BGMProperty, _INTL("BGM played in battles against trainers of this type.")],
|
||||
[_INTL("VictoryME"), MEProperty, _INTL("ME played when player wins battles against trainers of this type.")]
|
||||
@@ -374,7 +374,7 @@ def pbTrainerTypeEditor
|
||||
t_data.gender,
|
||||
t_data.base_money,
|
||||
t_data.skill_level,
|
||||
t_data.skill_code,
|
||||
t_data.skill_flags,
|
||||
t_data.intro_ME,
|
||||
t_data.battle_BGM,
|
||||
t_data.victory_ME
|
||||
@@ -387,7 +387,7 @@ def pbTrainerTypeEditor
|
||||
:gender => data[2],
|
||||
:base_money => data[3],
|
||||
:skill_level => data[4],
|
||||
:skill_code => data[5],
|
||||
:skill_flags => data[5],
|
||||
:intro_ME => data[6],
|
||||
:battle_BGM => data[7],
|
||||
:victory_ME => data[8]
|
||||
|
||||
@@ -236,6 +236,95 @@ end
|
||||
|
||||
|
||||
|
||||
class StringListProperty
|
||||
def self.set(_setting_name, old_setting)
|
||||
real_cmds = []
|
||||
real_cmds.push([_INTL("[ADD VALUE]"), -1])
|
||||
old_setting.length.times do
|
||||
real_cmds.push([old_setting[i], 0])
|
||||
end
|
||||
# Edit list
|
||||
cmdwin = pbListWindow([], 200)
|
||||
oldsel = nil
|
||||
ret = old_setting
|
||||
cmd = 0
|
||||
commands = []
|
||||
do_refresh = true
|
||||
loop do
|
||||
if do_refresh
|
||||
commands = []
|
||||
real_cmds.each_with_index do |entry, i|
|
||||
commands.push(entry[0])
|
||||
cmd = i if oldsel && entry[0] == oldsel
|
||||
end
|
||||
end
|
||||
do_refresh = false
|
||||
oldsel = nil
|
||||
cmd = pbCommands2(cmdwin, commands, -1, cmd, true)
|
||||
if cmd >= 0 # Chose a value
|
||||
entry = real_cmds[cmd]
|
||||
if entry[1] == -1 # Add new value
|
||||
new_value = pbMessageFreeText(_INTL("Enter the new value."),
|
||||
"", false, 250, Graphics.width)
|
||||
if !nil_or_empty?(new_value)
|
||||
if real_cmds.any? { |e| e[0] == new_value }
|
||||
oldsel = new_value # Already have value; just move cursor to it
|
||||
else
|
||||
real_cmds.push([new_value, 0])
|
||||
end
|
||||
do_refresh = true
|
||||
end
|
||||
else # Edit value
|
||||
case pbMessage(_INTL("\\ts[]Do what with this value?"),
|
||||
[_INTL("Edit"), _INTL("Delete"), _INTL("Cancel")], 3)
|
||||
when 0 # Edit
|
||||
new_value = pbMessageFreeText(_INTL("Enter the new value."),
|
||||
entry[0], false, 250, Graphics.width)
|
||||
if !nil_or_empty?(new_value)
|
||||
if real_cmds.any? { |e| e[0] == new_value } # Already have value; delete this one
|
||||
real_cmds.delete_at(cmd)
|
||||
cmd = [cmd, real_cmds.length - 1].min
|
||||
else # Change value
|
||||
entry[0] = new_value
|
||||
end
|
||||
oldsel = new_value
|
||||
do_refresh = true
|
||||
end
|
||||
when 1 # Delete
|
||||
real_cmds.delete_at(cmd)
|
||||
cmd = [cmd, real_cmds.length - 1].min
|
||||
do_refresh = true
|
||||
end
|
||||
end
|
||||
else # Cancel/quit
|
||||
case pbMessage(_INTL("Keep changes?"), [_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
for i in 0...real_cmds.length
|
||||
real_cmds[i] = (real_cmds[i][1] == -1) ? nil : real_cmds[i][0]
|
||||
end
|
||||
real_cmds.compact!
|
||||
ret = real_cmds
|
||||
break
|
||||
when 1
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
cmdwin.dispose
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.defaultValue
|
||||
return []
|
||||
end
|
||||
|
||||
def self.format(value)
|
||||
return value.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class GameDataProperty
|
||||
def initialize(value)
|
||||
raise _INTL("Couldn't find class {1} in module GameData.", value.to_s) if !GameData.const_defined?(value.to_sym)
|
||||
|
||||
@@ -1165,7 +1165,7 @@ module Compiler
|
||||
:intro_ME => line[6],
|
||||
:gender => line[7],
|
||||
:skill_level => line[8],
|
||||
:skill_code => line[9]
|
||||
:skill_flags => line[9]
|
||||
}
|
||||
# Add trainer type's data to records
|
||||
GameData::TrainerType.register(tr_type_hash)
|
||||
|
||||
@@ -248,7 +248,7 @@ module Compiler
|
||||
# Save Pokémon data to PBS file
|
||||
#=============================================================================
|
||||
def write_pokemon
|
||||
echo _INTL("Writing species")
|
||||
echo _INTL("Writing species...")
|
||||
File.open("PBS/pokemon.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
@@ -559,7 +559,7 @@ module Compiler
|
||||
f.write(sprintf("Gender = %s\r\n", gender))
|
||||
f.write(sprintf("BaseMoney = %d\r\n", t.base_money))
|
||||
f.write(sprintf("SkillLevel = %d\r\n", t.skill_level)) if t.skill_level != t.base_money
|
||||
f.write(sprintf("SkillCode = %s\r\n", t.skill_code)) if !nil_or_empty?(t.skill_code)
|
||||
f.write(sprintf("SkillFlags = %s\r\n", t.skill_flags.join(","))) if t.skill_flags.length > 0
|
||||
f.write(sprintf("IntroME = %s\r\n", t.intro_ME)) if !nil_or_empty?(t.intro_ME)
|
||||
f.write(sprintf("BattleBGM = %s\r\n", t.battle_BGM)) if !nil_or_empty?(t.battle_BGM)
|
||||
f.write(sprintf("VictoryME = %s\r\n", t.victory_ME)) if !nil_or_empty?(t.victory_ME)
|
||||
@@ -572,7 +572,7 @@ module Compiler
|
||||
# Save individual trainer data to PBS file
|
||||
#=============================================================================
|
||||
def write_trainers
|
||||
echo _INTL("Writing trainers")
|
||||
echo _INTL("Writing trainers...")
|
||||
File.open("PBS/trainers.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
|
||||
Reference in New Issue
Block a user