#=========================================================================
=====
#
# Yanfly 6 - Hospital
# --- Last Date Updated: 2011.09.26
# --- Level: Easy, Normal
# Requires: n/a
#
#==============================================================================
$imported = {} if $imported == nil
$imported["Y6-Hospital"] = true
#==============================================================================
# Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# o 2011.09.26 - Updated window positions.
# o 2011.09.18 - Added compatibility with Y6 Hospital Prizes.
# o 2011.09.17 - Finally finished script (stupid distractions).
# o 2011.09.11 - Started Script.
#
#==============================================================================
# Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# In most RPG's, inns are often used to allow parties to recover their health,
# restore their status, etc. It's often a cure-all for a set price. This
# hospital, however, charges based on the amount of damage take, to the amount
# of mana consumed, and the ailments inflicted also have a bearing on the cost.
# Players can also heal individual members as opposed to all members of their
# party in the event that they cannot heal the whole party. This provides a
# challenge to the player and also provides a more cost-proportional way of
# recovering from damage obtained through battle.
#
#==============================================================================
# Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials but above ¥ Main. Remember to save.
#
# Adjust the module as you see fit.
#
# -----------------------------------------------------------------------------
# Script Call
# -----------------------------------------------------------------------------
# call_hospital
#
# This will trigger the hospital scene from a script call event.
#
#==============================================================================
# Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Note: This script may not work with former Yanfly Engine scripts.
# Use Yanfly Engine 6 scripts to work with this if available.
#==============================================================================
module Y6
module HOSPITAL
#--------------------------------------------------------------------------
# - Command Menu -
#--------------------------------------------------------------------------
# This section will adjust what commands appear in the upper left corner
# of the hospital scene and the vocabulary used with it.
#--------------------------------------------------------------------------
# This array determines what items will appear in the hospital scene and
# what order they appear in. Remove them if you don't want them to appear.
COMMANDS =[
:heal_one, # Heals one battler.
:heal_all, # Heals all battlers.
:prize, # Claim hospital prizes.
:history, # Look at all the claimed hospital prizes.
] # Do not remove this.
# This hash determines how the vocabulary appears in your game. Modify them
# as you see fit if you wish to rename certain aspects.
COMMAND_VOCAB ={
# :command => String
:heal_one => "Heal One",
:heal_all => "Heal All",
:prize => "Claim Prize",
:history => "Prize List",
} # Do not remove this.
# This hash provides descriptions through the help window based on the
# highlighted command.
COMMAND_HELP ={
# :command => String
:heal_one => "Heals members individually.",
:heal_all => "Heals all members in your party.",
:prize => "Claim prizes from the hospital.",
:history => "List of prizes you've claimed.",
} # Do not remove this.
#--------------------------------------------------------------------------
# - Attendant Messages -
#--------------------------------------------------------------------------
# The hospital attendant will communicate with the player regarding various
# functions of the hospital. Adjust the various settings regarding the
# default attendant and the messages that will appear with each option.
#--------------------------------------------------------------------------
DEFAULT_NAME = "Healer" # Default name for hospital attendant.
NAME_COLOUR = 6 # What text colour will be used for the name.
DEFAULT_F_NAME = "People2" # Default face name used for the attendant.
DEFAULT_F_INDEX = 1 # Default face index used for the attendant.
# This hash contains the messages that will be displayed regarding each
# option. Use | for line splits and \\N[x] to write out an actor's name.
# \\V[x] will display variables. Use \' and \" to write out quotation marks
# without disrupting the string quote.
MESSAGE_HASH ={
# :command => String
nil => "\"I have nothing to say!\"",
:heal_one => "\"Would you like to heal one of|" +
" your party members?\"",
:heal_all => "\"Would you like to heal all the|" +
" members of your party? It\'s|" +
" better to be safe than sorry.\"",
:prize => "\"The more you use our services,|" +
" more prizes you receive. So|" +
" please visit us a lot~\"",
:history => "\"This is a list of all the|" +
" prizes you've won over time.\"",
} # Do not remove this.
#--------------------------------------------------------------------------
# - Statistics Window -
#--------------------------------------------------------------------------
# This window will show how much HP, MP, deaths, and ailments were healed.
# Adjust the vocabulary used here and anything else that may be viable.
#--------------------------------------------------------------------------
TOTALS_TITLE = "Hospital Totals" # Title
TOTAL_HP_HEALED = "Total HP Healed" # How much HP was healed.
TOTAL_MP_HEALED = "Total SP Recovered" # How much MP was healed.
TOTAL_AILMENTS = "Total Cleansed" # How many ailments were healed.
AILMENT_STATE = 2 # State ID to represent ailments
TOTAL_DEATHS = "Total Revived" # How many deaths were revived.
#--------------------------------------------------------------------------
# - Heal Settings -
#--------------------------------------------------------------------------
# Here, you can adjust the settings regarding various aspects of the heal
# list window, how much heals cost, and more.
#--------------------------------------------------------------------------
HEALTHY_ICON = 122 # Used if actor is fully healed.
COST_FONT_SIZE = 16 # Font size used for the heal cost.
# This hash contains the costs for the various factors that can be healed
# inside of the hospital.
COST_SETTINGS ={
# :condition => Cost Formula
:hp_cost => "(self.maxhp - self.hp) * 0.5",
:mp_cost => "(self.maxmp - self.mp) * 1.0",
:death_cost => "self.level * 100",
:ailment_cost => "self.level * 25",
:maximum_cost => "[self.level * 3000, 999999999].min",
} # Do not remove this.
# This array contains the ailments that can be healed in the hospital.
HEALABLE_AILMENTS = [2, 3, 4, 5, 6, 7, 8]
# These adjust the text that appears in the help window while the heal list
# window is active.
NEED_HEAL_HELP = "%s requires treatment."
NO_HEAL_HELP = "%s does not need treatment."
TOTAL_HEAL_HELP = "Heal party for %s gold."
end # HOSPITAL
end # Y6
#==============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis
# so edit at your own risk.
#==============================================================================
module Y6
module HOSPITAL
module_function
#--------------------------------------------------------------------------
# convert_integer_array
#--------------------------------------------------------------------------
def convert_integer_array(array)
result = []
array.each { |i|
case i
when Range; result |= i.to_a
when Integer; result |= [i]
end }
return result
end
#--------------------------------------------------------------------------
# converted_contants
#--------------------------------------------------------------------------
HEALABLE_AILMENTS = convert_integer_array(HEALABLE_AILMENTS)
end # ITEM
end # Y6
#==============================================================================
# ** Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.healthy
#--------------------------------------------------------------------------
def self.healthy; return Y6::HOSPITAL::HEALTHY_ICON; end
end # Icon
#==============================================================================
# ** Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["Y6-Core"]
def group(decimal = 2); return self; end
end # $imported["Y6-Core"]
end # Numeric
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# new method: hospital_cost
#--------------------------------------------------------------------------
def hospital_cost
n = 0.0
n += eval(Y6::HOSPITAL::COST_SETTINGS[:hp_cost])
n += eval(Y6::HOSPITAL::COST_SETTINGS[:mp_cost])
n += eval(Y6::HOSPITAL::COST_SETTINGS[:death_cost]) if state?(1)
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
n += eval(Y6::HOSPITAL::COST_SETTINGS[:ailment_cost]) if state?(state_id)
end
n = [n, eval(Y6::HOSPITAL::COST_SETTINGS[:maximum_cost])].min
return Integer(n)
end
end # Game_Actor
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# new method: hospital_hp_healed
#--------------------------------------------------------------------------
def hospital_hp_healed
@hospital_hp_healed = 0 if @hospital_hp_healed.nil?
return @hospital_hp_healed
end
#--------------------------------------------------------------------------
# new method: update_hospital_hp
#--------------------------------------------------------------------------
def update_hospital_hp(total = 0)
@hospital_hp_healed = 0 if @hospital_hp_healed.nil?
@hospital_hp_healed += total
end
#--------------------------------------------------------------------------
# new method: hospital_mp_healed
#--------------------------------------------------------------------------
def hospital_mp_healed
@hospital_mp_healed = 0 if @hospital_mp_healed.nil?
return @hospital_mp_healed
end
#--------------------------------------------------------------------------
# new method: update_hospital_mp
#--------------------------------------------------------------------------
def update_hospital_mp(total = 0)
@hospital_mp_healed = 0 if @hospital_mp_healed.nil?
@hospital_mp_healed += total
end
#--------------------------------------------------------------------------
# new method: hospital_states_healed
#--------------------------------------------------------------------------
def hospital_states_healed
@hospital_states_healed = 0 if @hospital_states_healed.nil?
return @hospital_states_healed
end
#--------------------------------------------------------------------------
# new method: update_hospital_states
#--------------------------------------------------------------------------
def update_hospital_states(total = 0)
@hospital_states_healed = 0 if @hospital_states_healed.nil?
@hospital_states_healed += total
end
#--------------------------------------------------------------------------
# new method: hospital_deaths_healed
#--------------------------------------------------------------------------
def hospital_deaths_healed
@hospital_deaths_healed = 0 if @hospital_deaths_healed.nil?
return @hospital_deaths_healed
end
#--------------------------------------------------------------------------
# new method: update_hospital_deaths
#--------------------------------------------------------------------------
def update_hospital_deaths(total = 0)
@hospital_deaths_healed = 0 if @hospital_deaths_healed.nil?
@hospital_deaths_healed += total
end
#--------------------------------------------------------------------------
# new method: total_hospital_cost
#--------------------------------------------------------------------------
def total_hospital_cost
n = 0
for member in members; n += member.hospital_cost; end
return n
end
end # Game_Party
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# new method: call_hospital
#--------------------------------------------------------------------------
def call_hospital(name = nil, face_name = nil, face_index = nil)
$scene = Scene_Hospital.new(name, face_name, face_index)
end
end # Game_Interpreter
#==============================================================================
# ** Window_Command_Centered
#==============================================================================
class Window_Command_Centered < Window_Command
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
contents.clear_rect(rect)
contents.font.color = normal_color
contents.font.color.alpha = enabled ? 255 : 128
contents.draw_text(rect, @commands[index], 1)
end
end # Window_Command_Centered
#==============================================================================
# ** Window_Hospital_Message
#==============================================================================
class Window_Hospital_Message < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(name = nil, face_name = nil, face_index = nil)
super(160, 0, Graphics.width - 160, 128)
@name = name.nil? ? Y6::HOSPITAL::DEFAULT_NAME : name
@face_name = face_name.nil? ? Y6::HOSPITAL::DEFAULT_F_NAME : face_name
@face_index = face_index.nil? ? Y6::HOSPITAL::DEFAULT_F_INDEX : face_index
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(message = nil)
contents.clear
draw_attendant
draw_message(message)
end
#--------------------------------------------------------------------------
# draw_attendant
#--------------------------------------------------------------------------
def draw_attendant
draw_face(@face_name, @face_index, 0, 0)
contents.font.color = text_color(Y6::HOSPITAL::NAME_COLOUR)
contents.draw_text(112, 0, contents.width-112, WLH, @name)
contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# draw_message
#--------------------------------------------------------------------------
def draw_message(command)
text = Y6::HOSPITAL::MESSAGE_HASH[command]
nwidth = Graphics.width * 8
dx = 112; dy = WLH
text = "" if text.nil?
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
lines = text.split(/(?:[|]|\\n)/i)
lines.each_with_index { |l, i|
l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
self.contents.draw_text(dx, i * WLH + dy, nwidth, WLH, l, 0)}
end
end # Window_Hospital_Message
#==============================================================================
# ** Window_Hospital_Statistics
#==============================================================================
class Window_Hospital_Statistics < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(hw)
super(0, 128, Graphics.width, Graphics.height - 128 - hw.height)
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_title
draw_hp_healed
draw_mp_healed
draw_ailments
draw_deaths
end
#--------------------------------------------------------------------------
# draw_hp_healed
#--------------------------------------------------------------------------
def draw_title
contents.font.color = normal_color
text = Y6::HOSPITAL::TOTALS_TITLE
contents.draw_text(0, WLH / 2, contents.width, WLH, text, 1)
end
#--------------------------------------------------------------------------
# draw_hp_healed
#--------------------------------------------------------------------------
def draw_hp_healed
dy = WLH*2
contents.font.color = system_color
text = Y6::HOSPITAL::TOTAL_HP_HEALED
icon = $imported["Y6-Iconview"] ? Icon.stat(:hp) : 0
value = $game_party.hospital_hp_healed.group
draw_icon(icon, 48, dy)
contents.draw_text(72, dy, contents.width/2-72, WLH, text, 0)
contents.font.color = normal_color
dx = contents.width/2+24; dw = contents.width / 2 - 72
contents.draw_text(dx, dy, dw, WLH, value, 2)
end
#--------------------------------------------------------------------------
# draw_mp_healed
#--------------------------------------------------------------------------
def draw_mp_healed
dy = WLH*3
contents.font.color = system_color
text = Y6::HOSPITAL::TOTAL_MP_HEALED
icon = $imported["Y6-Iconview"] ? Icon.stat(:mp) : 0
value = $game_party.hospital_mp_healed.group
draw_icon(icon, 48, dy)
contents.draw_text(72, dy, contents.width/2-72, WLH, text, 0)
contents.font.color = normal_color
dx = contents.width/2+24; dw = contents.width / 2 - 72
contents.draw_text(dx, dy, dw, WLH, value, 2)
end
#--------------------------------------------------------------------------
# draw_ailments
#--------------------------------------------------------------------------
def draw_ailments
dy = WLH*4
contents.font.color = system_color
text = Y6::HOSPITAL::TOTAL_AILMENTS
state = $data_states[Y6::HOSPITAL::AILMENT_STATE]
if $imported["Y6-Iconview"] and !state.nil?
icon = state.icon_index
else
icon = 0
end
value = $game_party.hospital_states_healed.group
draw_icon(icon, 48, dy)
contents.draw_text(72, dy, contents.width/2-72, WLH, text, 0)
contents.font.color = normal_color
dx = contents.width/2+24; dw = contents.width / 2 - 72
contents.draw_text(dx, dy, dw, WLH, value, 2)
end
#--------------------------------------------------------------------------
# draw_deaths
#--------------------------------------------------------------------------
def draw_deaths
dy = WLH*5
contents.font.color = system_color
text = Y6::HOSPITAL::TOTAL_DEATHS
if $imported["Y6-Iconview"]
state = $data_states[1]
icon = state.icon_index
else
icon = 0
end
value = $game_party.hospital_deaths_healed.group
draw_icon(icon, 48, dy)
contents.draw_text(72, dy, contents.width/2-72, WLH, text, 0)
contents.font.color = normal_color
dx = contents.width/2+24; dw = contents.width / 2 - 72
contents.draw_text(dx, dy, dw, WLH, value, 2)
end
end # Window_Hospital_Statistics
#==============================================================================
# ** Window_Hospital_Heal_List
#==============================================================================
class Window_Hospital_Heal_List < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(hw)
super(0, 128, Graphics.width, Graphics.height - 128 - hw.height)
self.index = 0
self.active = false
set_mode(0)
end
#--------------------------------------------------------------------------
# set_mode
#--------------------------------------------------------------------------
def set_mode(mode)
@mode = mode
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(mode = 0)
@data = []
for member in $game_party.members; @data.push(member); end
@item_max = @data.size
create_contents
for i in 0...@item_max; draw_item(i); end
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
contents.clear_rect(rect)
actor = @data[index]
return if actor.nil?
draw_actor_status(rect, actor)
draw_actor_name(rect, actor)
draw_actor_hp_mp(rect, actor)
draw_actor_cost(rect, actor)
end
#--------------------------------------------------------------------------
# draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(rect, actor)
if actor.dead?
contents.font.color = knockout_color
elsif actor.hospital_cost > 0
contents.font.color = crisis_color
else
contents.font.color = normal_color
end
contents.font.size = Font.default_size
contents.draw_text(24, rect.y, rect.width / 4, WLH, actor.name, 0)
end
#--------------------------------------------------------------------------
# draw_actor_status
#--------------------------------------------------------------------------
def draw_actor_status(rect, actor)
icon = actor.hospital_cost <= 0 ? Icon.healthy : 0
if actor.dead?
icon = $data_states[1].icon_index
else
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
next unless actor.state?(state_id)
icon = $data_states[state_id].icon_index
break
end
end
draw_icon(icon, 0, rect.y)
end
#--------------------------------------------------------------------------
# draw_actor_hp_mp
#--------------------------------------------------------------------------
def draw_actor_hp_mp(rect, actor)
draw_actor_hp(actor, rect.width/4+2, rect.y+1, rect.width/4-4)
draw_actor_mp(actor, rect.width/2+2, rect.y+1, rect.width/4-4)
end
#--------------------------------------------------------------------------
# draw_actor_cost
#--------------------------------------------------------------------------
def draw_actor_cost(rect, actor)
if $game_party.gold >= actor.hospital_cost
contents.font.color = normal_color
else
contents.font.color = knockout_color
end
contents.font.size = Y6::HOSPITAL::COST_FONT_SIZE
draw_icon(Icon.gold, rect.width-24, rect.y) if $imported["Y6-GoldLimit"]
value = actor.hospital_cost.group
value = sprintf("%s %s", value, Vocab.gold )if !$imported["Y6-GoldLimit"]
dw = $imported["Y6-GoldLimit"] ? rect.width/4-24 : rect.width/4
contents.draw_text(rect.width*3/4, rect.y, dw, WLH, value, 2)
end
#--------------------------------------------------------------------------
# update_help
#--------------------------------------------------------------------------
def update_help
if @mode >= 1
value = $game_party.total_hospital_cost.group
text = sprintf(Y6::HOSPITAL::TOTAL_HEAL_HELP, value)
else
return if @data.nil?
return if @data[index].nil?
name = @data[index].name
if @data[index].hospital_cost > 0
text = sprintf(Y6::HOSPITAL::NEED_HEAL_HELP, name)
else
text = sprintf(Y6::HOSPITAL::NO_HEAL_HELP, name)
end
end
@help_window.set_text(text)
end
#--------------------------------------------------------------------------
# target
#--------------------------------------------------------------------------
def target
return nil if @data.nil?
return @data[self.index]
end
end # Window_Hospital_Heal_List
#==============================================================================
# ** Scene_Hospital
#==============================================================================
class Scene_Hospital < Scene_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(name, face_name, face_index)
@name = name
@f_name = face_name
@f_index = face_index
end
#--------------------------------------------------------------------------
# start
#--------------------------------------------------------------------------
def start
super
create_menu_background
@help_window = Window_Help.new
@gold_window = Window_Gold.new(Graphics.width - 160, 0)
@gold_window.height = @help_window.height
@help_window.width = Graphics.width - @gold_window.width
@help_window.create_contents
@attendant_window = Window_Hospital_Message.new(@name, @f_name, @f_index)
@statistics_window = Window_Hospital_Statistics.new(@help_window)
create_command_window
end
#--------------------------------------------------------------------------
# terminate
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@gold_window.dispose
@attendant_window.dispose
@command_window.dispose
@statistics_window.dispose
for window in @windows; window.dispose unless window.disposed?; end
end
#--------------------------------------------------------------------------
# create_command_window
#--------------------------------------------------------------------------
def create_command_window
@data = []
commands = []
@windows = []
for command in Y6::HOSPITAL::COMMANDS
case command
when :heal_one
if @heal_list_window.nil?
@heal_list_window = Window_Hospital_Heal_List.new(@help_window)
@heal_list_window.help_window = @help_window
@windows.push(@heal_list_window)
end
when :heal_all
if @heal_list_window.nil?
@heal_list_window = Window_Hospital_Heal_List.new(@help_window)
@heal_list_window.help_window = @help_window
@windows.push(@heal_list_window)
end
#---
when :prize
next unless $imported["Y6-HospitalPrizes"]
if @prize_back_window.nil?
@prize_back_window = Window_Hospital_Prize_Back.new(@help_window)
@windows.push(@prize_back_window)
end
pbw = @prize_back_window
@prize_give_window = Window_Hospital_Prize_Give.new(pbw)
@prize_give_window.help_window = @help_window
@windows.push(@prize_give_window)
when :history
next unless $imported["Y6-HospitalPrizes"]
if @prize_back_window.nil?
@prize_back_window = Window_Hospital_Prize_Back.new(@help_window)
@windows.push(@prize_back_window)
end
pbw = @prize_back_window
@prize_history_window = Window_Hospital_Prize_History.new(pbw)
@prize_history_window.help_window = @help_window
@windows.push(@prize_history_window)
#---
else; next
end
@data.push(command)
commands.push(Y6::HOSPITAL::COMMAND_VOCAB[command])
end
@command_window = Window_Command_Centered.new(160, commands)
@command_window.height = 128
@command_window.active = true
redraw_command_window_prize
update_visible_windows
end
#--------------------------------------------------------------------------
# update_visible_windows
#--------------------------------------------------------------------------
def update_visible_windows
for window in @windows; window.y = Graphics.height * 8; end
@help_window.y = Graphics.height - @help_window.height
@gold_window.y = @help_window.y
@statistics_window.y = @attendant_window.height
@attendant_window.refresh(@data[@command_window.index])
update_command_help
end
#--------------------------------------------------------------------------
# update_command_help
#--------------------------------------------------------------------------
def update_command_help
string = Y6::HOSPITAL::COMMAND_HELP[@data[@command_window.index]]
string = "" if string.nil?
@help_window.set_text(string)
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
update_menu_background
if @command_window.active
update_command_window
elsif @heal_list_window != nil and @heal_list_window.active
update_heal_list_window
elsif @prize_give_window != nil and @prize_give_window.active
update_prize_give_window
elsif @prize_history_window != nil and @prize_history_window.active
update_prize_history_window
end
end
#--------------------------------------------------------------------------
# update_command_window
#--------------------------------------------------------------------------
def update_command_window
@command_window.update
if @last_status_index != @command_window.index
@last_status_index = @command_window.index
update_visible_windows
end
if Input.trigger?(Input::

Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @data[@command_window.index]
when :heal_one
@heal_list_window.y = @attendant_window.height
@heal_list_window.active = true
@heal_list_window.set_mode(0)
hide_statistics_window
when :heal_all
@heal_list_window.y = @attendant_window.height
@heal_list_window.active = true
@heal_list_window.set_mode(1)
hide_statistics_window
when :prize
open_prize_give_window
when :history
open_prize_history_window
else; return
end
end
end
#--------------------------------------------------------------------------
# hide_command_window
#--------------------------------------------------------------------------
def hide_statistics_window
Sound.play_decision
@command_window.active = false
@statistics_window.y = Graphics.height * 8
end
#--------------------------------------------------------------------------
# heal_target
#--------------------------------------------------------------------------
def heal_target(member)
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
$game_party.update_hospital_states(1)
member.remove_state(state_id)
end
if member.dead?
$game_party.update_hospital_deaths(1)
member.remove_state(1)
end
$game_party.update_hospital_hp(member.maxhp - member.hp)
member.hp = member.maxhp
$game_party.update_hospital_mp(member.maxmp - member.mp)
member.mp = member.maxmp
end
#--------------------------------------------------------------------------
# update_heal_list_window
#--------------------------------------------------------------------------
def update_heal_list_window
@heal_list_window.update
if Input.trigger?(Input::

Sound.play_cancel
@heal_list_window.active = false
@command_window.active = true
@statistics_window.refresh
update_visible_windows
elsif Input.trigger?(Input::C)
case @data[@command_window.index]
when :heal_one
target = @heal_list_window.target
if target.hospital_cost <= 0
Sound.play_buzzer
elsif $game_party.gold >= target.hospital_cost
Sound.play_shop
$game_party.lose_gold(target.hospital_cost)
heal_target(target)
@heal_list_window.draw_item(@heal_list_window.index)
@gold_window.refresh
redraw_command_window_prize
else
Sound.play_buzzer
end
when :heal_all
if $game_party.total_hospital_cost <= 0
Sound.play_buzzer
elsif $game_party.gold >= $game_party.total_hospital_cost
Sound.play_shop
$game_party.lose_gold($game_party.total_hospital_cost)
for member in $game_party.members; heal_target(member); end
@heal_list_window.refresh
@gold_window.refresh
redraw_command_window_prize
else
Sound.play_buzzer
end
end
#---
elsif $TEST and Input.repeat?(Input::F5)
if Input.press?(Input::SHIFT)
Sound.play_recovery
for member in $game_party.members; heal_target(member); end
@heal_list_window.refresh
else
Sound.play_recovery
target = @heal_list_window.target
heal_target(target)
@heal_list_window.draw_item(@heal_list_window.index)
end
redraw_command_window_prize
elsif $TEST and Input.trigger?(Input::F6)
if Input.press?(Input::SHIFT)
Sound.play_actor_collapse
for member in $game_party.members
member.hp = 0
member.mp = 0
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
member.add_state(state_id)
end
end
@heal_list_window.refresh
else
Sound.play_actor_collapse
target = @heal_list_window.target
target.hp = 0
target.mp = 0
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
target.add_state(state_id)
end
@heal_list_window.draw_item(@heal_list_window.index)
end
elsif $TEST and Input.trigger?(Input::F7)
Sound.play_actor_damage
if Input.press?(Input::SHIFT)
for member in $game_party.members; member.hp -= member.maxhp/4; end
@heal_list_window.refresh
else
target = @heal_list_window.target
target.hp -= target.maxhp/4
@heal_list_window.draw_item(@heal_list_window.index)
end
elsif $TEST and Input.trigger?(Input::F8)
Sound.play_miss
if Input.press?(Input::SHIFT)
for member in $game_party.members; member.mp = 0; end
@heal_list_window.refresh
else
target = @heal_list_window.target
target.mp = 0
@heal_list_window.draw_item(@heal_list_window.index)
end
elsif $TEST and Input.trigger?(Input::F9)
Sound.play_enemy_attack
if Input.press?(Input::SHIFT)
for member in $game_party.members
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
member.add_state(state_id)
end
end
@heal_list_window.refresh
else
target = @heal_list_window.target
for state_id in Y6::HOSPITAL::HEALABLE_AILMENTS
next if state_id <= 1
target.add_state(state_id)
end
@heal_list_window.draw_item(@heal_list_window.index)
end
#---
end
end
#--------------------------------------------------------------------------
# anti-crash method: redraw_command_window_prize
#--------------------------------------------------------------------------
def redraw_command_window_prize
end
end # Scene_Hospital
#===============================================================================
#
# END OF FILE
#
#===============================================================================