class Window_Base < Window
SYSTEM_WORD_EVA = "Evade" #
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
when 7 #
parameter_name = SYSTEM_WORD_EVA #
parameter_value = actor.eva #
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
#==============================================================================
# Complete equipment screen
#------------------------------------------------------------------------------
# Guillaume777
# 2.0
# 2006/04/24
# Edit from RPG Avocate's script ( http://www.phylomortis.com/resource/script/scr012.html )
#==============================================================================
module Adv_Equip_Mod
DRAW_EVA = true # true = show the evade statistic, if you didn't change
# draw_actor_parameter to take this into account it will crash
HEIGHT_LEFT_WINDOW = 416 #416 full screen height, 352 help window at bottom
AUTO_CALC_SPACE_SIZE = true #true = automaticly calculate optimum space size
#between each stat
SPACE = 32 # manually set the space size, 32 : default
FONT_NAME = 'Monotype Corsiva' #Arial = default
FONT_SIZE = 22 #font size : 24 default
NEW_STAT_SYMBOL = '→'
REMOVE_ITEM_TEXT = '[Remove]'
end
class Window_EquipLeft < Window_Base
# --------------------------------
attr_accessor :mode
attr_accessor :changes
# --------------------------------
def initialize(actor)
super(0, 64, 272, Adv_Equip_Mod::HEIGHT_LEFT_WINDOW)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = Adv_Equip_Mod::FONT_NAME
self.contents.font.size = Adv_Equip_Mod::FONT_SIZE
self.z += 100
@actor = actor
@mode = 0
@changes = [0, 0, 0, 0, 0, 0, 0, 0]
@elem_text = ""
@stat_text = ""
refresh
end
# --------------------------------
def calculate_space_size(height_window)
#this automaticly calculates the optimum size of spaces between each stats
borders = 32
number_of_lines = 12
if Adv_Equip_Mod::DRAW_EVA then number_of_lines += 1 end
space_size = (height_window - borders) / number_of_lines
return space_size
end
def refresh
self.contents.clear
symbol = Adv_Equip_Mod::NEW_STAT_SYMBOL
if Adv_Equip_Mod::AUTO_CALC_SPACE_SIZE
space = self.calculate_space_size(self.height) #space size is calculated
else
space = Adv_Equip_Mod::SPACE #space size as manually specified
end
extra = 0
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 180, 0)
draw_actor_parameter(@actor, 4, space, 0)
draw_actor_parameter(@actor, 4, space*2, 1)
draw_actor_parameter(@actor, 4, space*3, 2)
if Adv_Equip_Mod::DRAW_EVA
draw_actor_parameter(@actor, 4, space*4, 7)
extra = 1 #makes extra space for evasion to fit
end
draw_actor_parameter(@actor, 4, space*(4+extra), 3)
draw_actor_parameter(@actor, 4, space*(5+extra), 4)
draw_actor_parameter(@actor, 4, space*(6+extra), 5)
draw_actor_parameter(@actor, 4, space*(7+extra), 6)
if @mode == 0
self.contents.draw_text(4, space*(8+extra), 200, 32, "Elemental Attack:")
self.contents.draw_text(4, space*(10+extra), 200, 32, "Status Attack:")
end
if @mode == 1
self.contents.draw_text(4, space*(8+extra), 200, 32, "Elemental Defense:")
self.contents.draw_text(4, space*(10+extra), 200, 32, "Status Defense:")
end
self.contents.draw_text(12, space*(9+extra), 260, 32, @elem_text)
self.contents.draw_text(12, space*(11+extra), 260, 32, @stat_text)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space, 40, 32, symbol, 1)
if @changes[0] == 0
self.contents.font.color = normal_color
elsif @changes[0] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*2, 40, 32, symbol, 1)
if @changes[1] == 0
self.contents.font.color = normal_color
elsif @changes[1] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*2, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*3, 40, 32, symbol, 1)
if @changes[2] == 0
self.contents.font.color = normal_color
elsif @changes[2] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*3, 36, 32, @new_mdef.to_s, 2)
end
if @new_eva != nil and Adv_Equip_Mod::DRAW_EVA # if drawing evasion
self.contents.font.color = system_color
self.contents.draw_text(160, space*4, 40, 32, symbol, 1)
if @changes[7] == 0
self.contents.font.color = normal_color
elsif @changes[7] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*4, 36, 32, @new_eva.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*(4+extra), 40, 32, symbol, 1)
if @changes[3] == 0
self.contents.font.color = normal_color
elsif @changes[3] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*(4+extra), 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*(5+extra), 40, 32, symbol, 1)
if @changes[4] == 0
self.contents.font.color = normal_color
elsif @changes[4] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*(5+extra), 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*(6+extra), 40, 32,symbol , 1)
if @changes[5] == 0
self.contents.font.color = normal_color
elsif @changes[5] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*(6+extra), 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, space*(7+extra), 40, 32, symbol, 1)
if @changes[6] == 0
self.contents.font.color = normal_color
elsif @changes[6] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, space*(7+extra), 36, 32, @new_int.to_s, 2)
end
end
# --------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
new_agi, new_int, new_eva, elem_text, stat_text)
flag = false
if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
flag = true
end
if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
flag = true
end
if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
flag = true
end
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
@new_eva = new_eva
@elem_text = elem_text
@stat_text = stat_text
if flag
refresh
end
end
end
class Window_EquipItem < Window_Selectable
# --------------------------------
def initialize(actor, equip_type)
super(272, 256, 368, 224)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
# --------------------------------
def item
return @data[self.index]
end
# --------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
@data.push(nil)
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = Adv_Equip_Mod::FONT_NAME
self.contents.font.size = 22
for i in 0...@item_max-1
draw_item(i)
end
i = @item_max-1
x = 4 + i % @column_max * (288 + 32)
y = i / @column_max * 32
self.contents.draw_text(x+4, y, 100, 32, Adv_Equip_Mod::REMOVE_ITEM_TEXT )
end
# --------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 288, y, 16, 32, ":", 1)
self.contents.draw_text(x + 304, y, 24, 32, number.to_s, 2)
end
end
class Window_Base < Window
# --------------------------------
def up_color
return Color.new(74, 210, 74)
end
def down_color
return Color.new(170, 170, 170)
end
end
class Scene_Equip
# --------------------------------
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
newmode = 0
when 1
@item_window = @item_window2
newmode = 1
when 2
@item_window = @item_window3
newmode = 1
when 3
@item_window = @item_window4
newmode = 1
when 4
@item_window = @item_window5
newmode = 1
else
newmode = 1
end
if newmode != @left_window.mode
@left_window.mode = newmode
@left_window.refresh
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,
"", "")
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
old_atk = @actor.atk
old_pdef = @actor.pdef
old_mdef = @actor.mdef
old_str = @actor.str
old_dex = @actor.dex
old_agi = @actor.agi
old_int = @actor.int
old_eva = @actor.eva
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
new_eva = @actor.eva
@left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
if new_atk > old_atk
@left_window.changes[0] = 1
end
if new_atk < old_atk
@left_window.changes[0] = -1
end
if new_pdef > old_pdef
@left_window.changes[1] = 1
end
if new_pdef < old_pdef
@left_window.changes[1] = -1
end
if new_mdef > old_mdef
@left_window.changes[2] = 1
end
if new_mdef < old_mdef
@left_window.changes[2] = -1
end
if new_str > old_str
@left_window.changes[3] = 1
end
if new_str < old_str
@left_window.changes[3] = -1
end
if new_dex > old_dex
@left_window.changes[4] = 1
end
if new_dex < old_dex
@left_window.changes[4] = -1
end
if new_agi > old_agi
@left_window.changes[5] = 1
end
if new_agi < old_agi
@left_window.changes[5] = -1
end
if new_int > old_int
@left_window.changes[6] = 1
end
if new_int < old_int
@left_window.changes[6] = -1
end
if new_eva > old_eva
@left_window.changes[7] = 1
end
if new_eva < old_eva
@left_window.changes[7] = -1
end
elem_text = make_elem_text(item2)
stat_text = make_stat_text(item2)
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
end
end
def make_elem_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon)
for i in item.element_set
if flag
text += ", "
end
text += $data_system.elements[i]
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_element_set
if flag
text += ", "
end
text += $data_system.elements[i]
flag = true
end
end
return text
end
# --------------------------------
def make_stat_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon)
for i in item.plus_state_set
if flag
text += ", "
end
text += $data_states[i].name
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_state_set
if flag
text += ", "
end
text += $data_states[i].name
flag = true
end
end
return text
end
end