mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Added battle debug functions for setting position effects and NPC trainer items
This commit is contained in:
@@ -1,11 +1,7 @@
|
|||||||
=begin
|
=begin
|
||||||
# TODO:
|
# TODO:
|
||||||
|
|
||||||
Positions (Battle::ActivePosition)
|
turnCount - Is currently read-only, probably not worth being able to set
|
||||||
PBEffects::HealingWish
|
|
||||||
PBEffects::LunarDance
|
|
||||||
turnCount
|
|
||||||
items (of foe trainers)
|
|
||||||
initialItems - Array of two arrays, each with one value per party index
|
initialItems - Array of two arrays, each with one value per party index
|
||||||
recycleItems - Array of two arrays, each with one value per party index
|
recycleItems - Array of two arrays, each with one value per party index
|
||||||
belch - Array of two arrays, each with one value per party index
|
belch - Array of two arrays, each with one value per party index
|
||||||
@@ -303,6 +299,42 @@ MenuHandlers.add(:battle_debug_menu, :opposing_side, {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
MenuHandlers.add(:battle_debug_menu, :position_effects, {
|
||||||
|
"name" => _INTL("Battler Position Effects..."),
|
||||||
|
"parent" => :field,
|
||||||
|
"description" => _INTL("Effects that apply to individual battler positions."),
|
||||||
|
"effect" => proc { |battle|
|
||||||
|
positions = []
|
||||||
|
cmds = []
|
||||||
|
battle.positions.each_with_index do |position, i|
|
||||||
|
next if !position
|
||||||
|
positions.push(i)
|
||||||
|
battler = battle.battlers[i]
|
||||||
|
if battler && !battler.fainted?
|
||||||
|
text = "[#{i}] #{battler.name}"
|
||||||
|
else
|
||||||
|
text = _INTL("[#{i}] (empty)", i)
|
||||||
|
end
|
||||||
|
if battler.pbOwnedByPlayer?
|
||||||
|
text += " (yours)"
|
||||||
|
elsif battle.opposes?(i)
|
||||||
|
text += " (opposing)"
|
||||||
|
else
|
||||||
|
text += " (ally's)"
|
||||||
|
end
|
||||||
|
cmds.push(text)
|
||||||
|
end
|
||||||
|
cmd = 0
|
||||||
|
loop do
|
||||||
|
cmd = pbMessage("\\ts[]" + _INTL("Choose a battler position."), cmds, -1, nil, cmd)
|
||||||
|
break if cmd < 0
|
||||||
|
editor = Battle::DebugSetEffects.new(battle, :position, positions[cmd])
|
||||||
|
editor.update
|
||||||
|
editor.dispose
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Trainer Options
|
# Trainer Options
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -312,6 +344,58 @@ MenuHandlers.add(:battle_debug_menu, :trainers, {
|
|||||||
"description" => _INTL("Variables that apply to trainers.")
|
"description" => _INTL("Variables that apply to trainers.")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
MenuHandlers.add(:battle_debug_menu, :trainer_items, {
|
||||||
|
"name" => _INTL("NPC Trainer Items"),
|
||||||
|
"parent" => :trainers,
|
||||||
|
"description" => _INTL("View and change the items each NPC trainer has access to."),
|
||||||
|
"effect" => proc { |battle|
|
||||||
|
cmd = 0
|
||||||
|
loop do
|
||||||
|
# Find all NPC trainers and their items
|
||||||
|
commands = []
|
||||||
|
item_arrays = []
|
||||||
|
trainer_indices = []
|
||||||
|
if battle.opponent
|
||||||
|
battle.opponent.each_with_index do |trainer, i|
|
||||||
|
items = battle.items ? battle.items[i].clone : []
|
||||||
|
commands.push(_INTL("Opponent {1}: {2} ({3} items)", i + 1, trainer.full_name, items.length))
|
||||||
|
item_arrays.push(items)
|
||||||
|
trainer_indices.push([1, i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if battle.player.length > 1
|
||||||
|
battle.player.each_with_index do |trainer, i|
|
||||||
|
next if i == 0 # Player
|
||||||
|
items = battle.ally_items ? battle.ally_items[i].clone : []
|
||||||
|
commands.push(_INTL("Ally {1}: {2} ({3} items)", i, trainer.full_name, items.length))
|
||||||
|
item_arrays.push(items)
|
||||||
|
trainer_indices.push([0, i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if commands.length == 0
|
||||||
|
pbMessage("\\ts[]" + _INTL("There are no NPC trainers in this battle."))
|
||||||
|
break
|
||||||
|
end
|
||||||
|
# Choose a trainer
|
||||||
|
cmd = pbMessage("\\ts[]" + _INTL("Choose a trainer."), commands, -1, nil, cmd)
|
||||||
|
break if cmd < 0
|
||||||
|
# Get trainer's items
|
||||||
|
items = item_arrays[cmd]
|
||||||
|
indices = trainer_indices[cmd]
|
||||||
|
# Edit trainer's items
|
||||||
|
item_list_property = GameDataPoolProperty.new(:Item)
|
||||||
|
new_items = item_list_property.set(nil, items)
|
||||||
|
if indices[0] == 0 # Ally
|
||||||
|
battle.ally_items = [] if !battle.ally_items
|
||||||
|
battle.ally_items[indices[1]] = new_items
|
||||||
|
else # Opponent
|
||||||
|
battle.items = [] if !battle.items
|
||||||
|
battle.items[indices[1]] = new_items
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
MenuHandlers.add(:battle_debug_menu, :mega_evolution, {
|
MenuHandlers.add(:battle_debug_menu, :mega_evolution, {
|
||||||
"name" => _INTL("Mega Evolution"),
|
"name" => _INTL("Mega Evolution"),
|
||||||
"parent" => :trainers,
|
"parent" => :trainers,
|
||||||
|
|||||||
@@ -163,6 +163,18 @@ module Battle::DebugVariables
|
|||||||
PBEffects::WaterSportField => { name: "Water Sport duration (Gen 6+)", default: 0 },
|
PBEffects::WaterSportField => { name: "Water Sport duration (Gen 6+)", default: 0 },
|
||||||
PBEffects::WonderRoom => { name: "Wonder Room duration", default: 0 }
|
PBEffects::WonderRoom => { name: "Wonder Room duration", default: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
POSITION_EFFECTS = {
|
||||||
|
# PBEffects::FutureSightCounter - too complex to be worth bothering with
|
||||||
|
# PBEffects::FutureSightMove - too complex to be worth bothering with
|
||||||
|
# PBEffects::FutureSightUserIndex - too complex to be worth bothering with
|
||||||
|
# PBEffects::FutureSightUserPartyIndex - too complex to be worth bothering with
|
||||||
|
PBEffects::HealingWish => { name: "Whether Healing Wish is waiting to apply", default: false },
|
||||||
|
PBEffects::LunarDance => { name: "Whether Lunar Dance is waiting to apply", default: false }
|
||||||
|
# PBEffects::Wish - too complex to be worth bothering with
|
||||||
|
# PBEffects::WishAmount - too complex to be worth bothering with
|
||||||
|
# PBEffects::WishMaker - too complex to be worth bothering with
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -250,6 +262,9 @@ class Battle::DebugSetEffects
|
|||||||
when :side
|
when :side
|
||||||
@variables_data = Battle::DebugVariables::SIDE_EFFECTS
|
@variables_data = Battle::DebugVariables::SIDE_EFFECTS
|
||||||
@variables = @battle.sides[@side].effects
|
@variables = @battle.sides[@side].effects
|
||||||
|
when :position
|
||||||
|
@variables_data = Battle::DebugVariables::POSITION_EFFECTS
|
||||||
|
@variables = @battle.positions[@side].effects
|
||||||
when :battler
|
when :battler
|
||||||
@variables_data = Battle::DebugVariables::BATTLER_EFFECTS
|
@variables_data = Battle::DebugVariables::BATTLER_EFFECTS
|
||||||
@variables = @battle.battlers[@side].effects
|
@variables = @battle.battlers[@side].effects
|
||||||
|
|||||||
Reference in New Issue
Block a user