=================================================================
=============
# ** Window_Attr_Desc
#------------------------------------------------------------------------------
# This window shows attribute explanations.
#==============================================================================
class Window_Attr_Desc < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, 3 * WLH + 32)
end
#--------------------------------------------------------------------------
# * Set Text lines 1..3
# text : character string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text1(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_wrap_text(4, -4, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
def set_text2(text, align = 0)
if text != @text or align != @align
self.contents.font.color = normal_color
self.contents.draw_text(4, WLH, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
def set_text3(text, align = 0)
if text != @text or align != @align
self.contents.font.color = normal_color
self.contents.draw_text(4, 2*WLH, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
end
class Bitmap
def draw_wrap_text(x,y,width, height, text, align)
array = text.split
for i in array
word = i + ' '
word_width = text_size(word).width
if x + word_width > width
y += (height + 10) / 2
x = 0
end
self.draw_text(x, y, width, height, word)
x += (word_width + 0)
end
end
end
#==============================================================================
# ** Window_Atrr_List
#------------------------------------------------------------------------------
# This window displays a list of attributes
#==============================================================================
class Window_Atrr_List < Window_Selectable
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 1
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Attribute
#--------------------------------------------------------------------------
def on_attribute
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@line = 0
@data = []
for attr in @actor.attributes
@data.push(attr)
draw_attribute(attr)
@line += 1
end
@item_max = @data.size
end
#--------------------------------------------------------------------------
# * Draw Attribute
# attr_i : attribute ID
#--------------------------------------------------------------------------
def draw_attribute(attr_i)
attr_name = Attibute_Def::ATTRIBUTES[attr_i][0]
y = @line * WLH
self.contents.draw_text(4, y, 544, WLH, attr_name)
for level in 0...@actor.attr_levels[attr_i]
draw_icon(ATTRIBUTES[attr_i][7],150 + level * 30, y)
end
end
#--------------------------------------------------------------------------
# * Update Attr Window text
#--------------------------------------------------------------------------
def update_help
if on_attribute == nil
text1 = ""; text2 = ""; text3 = ""
else
attr_text = ATTRIBUTES[on_attribute]
text1 = sprintf(attr_text[5])
text2 = sprintf(attr_text[6])
level = @actor.attr_levels[on_attribute]
points = @actor.attr_points
if level == attr_text[8]
text3 = sprintf("Level: %s Not Upgradable",level)
else
up = cost?(level)
text3 = sprintf("Level: %s Upgrade Cost: %s",level,up)
end
end
@help_window.set_text1(text1)
#@help_window.set_text2(text2)
#@help_window.set_text3(text3)
end
end
#==============================================================================
# ** Window_Points_Status
#------------------------------------------------------------------------------
# This window displays the user's Points, Attribute level, and Cost to Upgrade
# on the attrbitutes screen. Could only get points to update correctly.
# Not quite working as intended as I don't have much of a clue on what needs
# to be done, if it's at all possible.

#==============================================================================
class Window_Point_Status < Window_Base
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 240, WLH*3 + 32)
@actor = actor
refresh
end
def points
points = @actor.attr_points
end
def level
level = 5 # No clue on how to get Attribute level
end
def upgrade
upgrade = cost?(level)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, (WLH - 26), 172, WLH, "Points: ")
self.contents.draw_text(70, (WLH - 26), 172, WLH, points)
self.contents.draw_text(0, WLH - 2 , 172, WLH, "Level: ")
self.contents.draw_text(70, WLH - 2, 172, WLH, level)
self.contents.draw_text(0, WLH + 24, 172, WLH, "Cost to Upgrade: ")
self.contents.draw_text(160, WLH + 24, 172, WLH, upgrade)
end
end
#==============================================================================
# ** Window_Attr_Status
#------------------------------------------------------------------------------
# This window displays the user's status on the attrbitutes screen.
#==============================================================================
class Window_Attr_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 304, WLH*3 + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
contents.font.size = 16
self.contents.font.color = system_color
self.contents.draw_text(0, WLH, 172, WLH, "ATK:")
self.contents.draw_text(0, (WLH + 10) , 172, WLH, "DEF:")
self.contents.draw_text(0, (WLH + 20), 172, WLH, "SPI:")
self.contents.draw_text(0, (WLH + 30), 172, WLH, "AGI:")
self.contents.font.color = normal_color
self.contents.draw_text(40, WLH, 172, WLH, @actor.atk)
self.contents.draw_text(40, (WLH + 10), 172, WLH, @actor.def)
self.contents.draw_text(40, (WLH + 20), 172, WLH, @actor.spi)
self.contents.draw_text(40, (WLH + 30), 172, WLH, @actor.agi)
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 100, 0)
draw_actor_graphic(@actor, 110, 70)
draw_actor_hp(@actor, 140, 20)
draw_actor_mp(@actor, 140, 40)
# draw_actor_parameter(@actor, 180, WLH, 0)
# draw_actor_parameter(@actor, 160, (WLH * 1), 1)
# draw_actor_parameter(@actor, 80, (WLH * 2), 2)
# draw_actor_parameter(@actor, 0, (WLH * 1), 3)
end
end
#==============================================================================
# ** Scene_Attributes
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================
class Scene_Attributes < Scene_Base
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 416-104, 544, 416)
@help_window = Window_Attr_Desc.new
@help_window.viewport = @viewport
@attr_window = Window_Atrr_List.new(0, 104, 544, 304-96, @actor)
# @attr_window.viewport = @viewport
@attr_window.help_window = @help_window
@attr_window.active = true
@status_window = Window_Attr_Status.new(0, 0, @actor)
#@status_window.viewport = @viewport
@status2_window = Window_Point_Status.new(304, 0, @actor)
#@status2_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@attr_window.dispose
@status_window.dispose
@status2_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(1)
end
#--------------------------------------------------------------------------
# * Switch to Next Actor Screen
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Attributes.new(@actor_index)
end
#--------------------------------------------------------------------------
# * Switch to Previous Actor Screen
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Attributes.new(@actor_index)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@attr_window.update
@status_window.update
@status2_window.update
update_attr_selection
end
#--------------------------------------------------------------------------
# * Update Attribute Selection
#--------------------------------------------------------------------------
def update_attr_selection
if Input.trigger?(Input::

Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @attr_window.on_attribute.nil?
Sound.play_buzzer
else
attr_i = @attr_window.on_attribute
level = @actor.attr_levels[attr_i]
up = cost?(level)
points = @actor.attr_points
if points >= up and level < ATTRIBUTES[attr_i][8]
Sound.play_decision
@actor.upgrade_attr(attr_i)
@attr_window.contents.clear
@attr_window.refresh
@status_window.refresh
@status2_window.refresh
else
Sound.play_buzzer
end
end
end
end
end