#===============================================================================
# Maxhero Party Manager
#-------------------------------------------------------------------------------
#
#===============================================================================
module Maxhero
module Party_Manager
TEXTS = [
"Qual personagem quer adicionar?",
"Você tem o limite de personagens no grupo",
"Qual personagem quer remover?"
]
BLOCKED_ACTORS = [1]
INCLUDED_ACTORS = [2,3,4,5,6,7,8]
end
end
class Game_Actors
alias index [] unless $@
def []( x )
x = x.id if x.is_a?(Game_Actor)
return index( x )
end
end
#===============================================================================
# **Window_Party_Manager
#===============================================================================
class Window_Party_Manager < Window_Base
#-----------------------------------------------------------------------------
# *Initialize
# x: X of the Window
# y: Y of the Window
# width: Width of Window
# height: Height pf Window
#-----------------------------------------------------------------------------
def initialize(x,y,width,height)
super(x,y,width,height)
self.contents = Bitmap.new(width - 32,height - 32)
end
#-----------------------------------------------------------------------------
# *draw_info
# actor_id: the id of the actor to draw the contents
#-----------------------------------------------------------------------------
def draw_info(actor_id)
draw_actor_name ($game_actors[actor_id] ,0, 0)
draw_actor_level ($game_actors[actor_id] ,0, 40)
draw_actor_class ($game_actors[actor_id] ,0, 20)
draw_actor_face ($game_actors[actor_id] ,0, 60)
draw_actor_hp ($game_actors[actor_id] ,0, 156)
draw_equipments ($game_actors[actor_id], 135, 0)
draw_actor_mp ($game_actors[actor_id] ,0, 176)
draw_actor_parameter($game_actors[actor_id] ,0, 196, 0)
draw_actor_parameter($game_actors[actor_id] ,0, 216, 1)
draw_actor_parameter($game_actors[actor_id] ,0, 236, 2)
draw_actor_parameter($game_actors[actor_id] ,0, 256, 3)
end
#-----------------------------------------------------------------------------
# *draw_equipaments
# x: x where draw the actor equipaments
# y: y where draw the actor equipaments
# actor: actor which has the item
#-----------------------------------------------------------------------------
def draw_equipments(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
(0..4).each{|i|draw_item_name(actor.equips[i], x + 16, y + WLH * (i + 1))}
end
#-----------------------------------------------------------------------------
# *update
#-----------------------------------------------------------------------------
def update
super
end
end
#===============================================================================
# **Scene_Party_Menu
#===============================================================================
class Scene_Party_Menu < Scene_Base
include Maxhero::Party_Manager
#-----------------------------------------------------------------------------
# *Initialize
# type: if "Add" go to Add Window Character, if "Remove" go to Remove Char Win
#-----------------------------------------------------------------------------
def initialize(type)
@type = type
end
#--------------------------------------------------------------------------
# *start
#--------------------------------------------------------------------------
def start
@WPM = Window_Party_Manager.new(160,000,544-160,416-(24+32))
@WC = Window_Command.new(160,include_add_chars)
@WH = Window_Help.new
@WH.y = 416-(24+32)
@WH.set_text(TEXTS[0]) if add_mode?
@WH.set_text(TEXTS[2]) if remove_mode?
create_menu_background
@WPM.draw_info(INCLUDED_ACTORS[@WC.index]) if add_mode?
@WPM.draw_info($game_party.members[@WC.index].id) if remove_mode?
end
#-----------------------------------------------------------------------------
# *update
#-----------------------------------------------------------------------------
def update
@WPM.update
@WC.update
if Input.trigger?(Input::C)
Sound.play_decision
party = $game_party
if add_mode?
if party.members.size < 4
$game_party.add_actor(INCLUDED_ACTORS[@WC.index])
else
print TEXTS[1]
end
end
if remove_mode?
$game_party.remove_actor(@actors[@WC.index].id)
end
$scene = Scene_Map.new
end
@WPM.contents.clear
@WPM.draw_info(INCLUDED_ACTORS[@WC.index]) if add_mode?
if remove_mode?
@WPM.draw_info(@actors[@WC.index].id)
end
if Input.trigger?(Input::B)
return_scene
end
end
#-----------------------------------------------------------------------------
# *terminate
#-----------------------------------------------------------------------------
def terminate
dispose_menu_background
@WPM.dispose
@WC.dispose
@WH.dispose
end
#-----------------------------------------------------------------------------
# *Add Mode?
#-----------------------------------------------------------------------------
def add_mode?
return true if @type == "Add"
return false
end
#-----------------------------------------------------------------------------
# *Remove Mode?
#-----------------------------------------------------------------------------
def remove_mode?
return true if @type == "Remove"
return false
end
#-----------------------------------------------------------------------------
# *return_scene
#-----------------------------------------------------------------------------
def return_scene
$scene = Scene_Map.new
end
#-----------------------------------------------------------------------------
# *include_add_chars
#-----------------------------------------------------------------------------
def include_add_chars
array = []
party = $game_party.members
INCLUDED_ACTORS.each{|i| array << $game_actors[i].name} if add_mode?
if remove_mode?
commands = []
@actors = []
$game_party.members.each do |actor|
if !actor.nil? && $game_party.members.size > 1 &&
!BLOCKED_ACTORS.include?(actor.id)
@actors << actor
array << actor.name
end
end
array << "" if array.empty?
end
return array
end
end
sexta-feira, 11 de novembro de 2011
Maxhero Party Manager
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário