Renamed skill code property in trainer_types.txt to SkillFlags, and allowed any number of them

This commit is contained in:
Maruno17
2021-08-31 17:36:48 +01:00
parent 171f1aade2
commit cfbefceb00
6 changed files with 102 additions and 14 deletions

View File

@@ -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]

View File

@@ -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)