#=======================================================
# Yazik - Skill & State Shop
#=======================================================
$imported = {} if $imported == nil
$imported[:Yazik_Skill_State_Shop] = true
#=======================================================
# Configurations
#=======================================================
module Yazik
module Actor
#--------------------------------------------------
# Script Call:
# 1. Actor's Add Skill Points
# add_skill_points(actor_id, points)
#--------------------------------------------------
# Starting Skill Point (When Actor at Level 1)
StartingSkillPoint = 2
# Skill Point Gain (When Actor Leveled Up)
SkillPointGain = 1
end
module SkillShop
# Command Name in Main Menu
CommandName = 'Temple'
# Command Index in Main Menu
CommandIndex = 1
# Skill Point Symbol
SkillPointSymbol = '\C[16]W\C[0]'
# Total Skill Point Text
TotalSkillPointText = '\C[16]Waves: \C[0]'
# Total Skill Point Text's X & Y position
TotalSkillPointText_X = 216
TotalSkillPointText_Y = 216
# Vocab on Option Window
VocabBuy = 'Acquire'
VocabCancel = 'Cancel'
# Help Window Settings
HelpWindow_Opacity = 0
HelpWindow_LineNumber = 4
# Shop Window Settings
ShopWindow_Opacity = 0
ShopWindow_Column = 4
ShopWindow_X = 0
ShopWindow_Y = 22
ShopWindow_Width = Graphics.width * 3/4
ShopWindow_Height = (6 * 24) + 2 * 12
# Actor's Skill Shop Database
ShopDatabase = {
# actor_id => [[skill_id, price], ..., [skill_id, price]],
#player
1 => [[139, 2], [140, 2], [133, 3], [127, 3], [51, 3], [52, 2], [50, 3], [8, 2], [135, 4], [60, 1], [102, 1], [28, 1], [29, 1], [2, 2], [53, 1], [54, 1],
[55, 1], [56, 1], [57, 1], [44, 1], [124, 1], [97, 1], [92, 1], [181, 1], [75, 4, :state, "Teaches you how to use bows."],
[74, 2, :state, "Teaches you how to use spears."], [112, 1, :state, "Teaches you how to use axes."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [105, 2, :state, "+2% HP Regen."], [104, 5, :state, "200% Status Recovery Rate"],
[102, 6, :state, "+15% DEF stat"], [68, 4, :state, "Immune to common poisons and venoms."], [4, 4, :state, "+150% TP Charge Rate."],
[125, 4, :state, "Immune to stat debuffs."],
[162, 2, :variable, "Increases rhetorics by 1.", 347, 1], [164, 2, :variable, "Increases Intellect by 1.", 347, 1],
[0, 1, :stat, "HEALTH +40 (repeatable)", 347, 40, true, 0, 0], [1, 1, :stat, "MAGIA +30 (repeatable)", 347, 30, true, 0, 0],
[3, 1, :stat, "DEFENSE +15 (repeatable)", 347, 15, true, 0, 0], [2, 1, :stat, "STRENGTH +15 (repeatable)", 347, 15, true, 0, 0],
[6, 1, :stat, "AGILITY +15 (repeatable)", 347, 15, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 1, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#3 Bran
3 => [[6, 2], [10, 3], [11, 2], [28, 1], [29, 1], [97, 1], [92, 1], [123, 4, :state, "DEF stat is doubled."], [125, 3, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +50 (repeatable)", 347, 50, true, 0, 0], [3, 1, :stat, "DEFENSE +25 (repeatable)", 347, 20, true, 0, 0],
[2, 1, :stat, "STRENGTH +25 (repeatable)", 347, 25, true, 0, 0]],
#4 Huiliang
4 => [[137, 2], [60, 1], [28, 1], [29, 1], [97, 1], [92, 1], [125, 5, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +20 (repeatable)", 347, 20, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#5 Xia
5 => [[156, 3], [146, 1], [147, 2], [166, 1], [133, 1], [108, 2], [145, 2], [170, 1], [51, 1], [52, 1], [141, 4], [139, 1], [140, 1], [44, 1], [92, 1], [42, 3], [186,1],
[197, 2, :variable, "Boost Cyan Rain's damage by 250.", 344, 250],
[68, 2, :state, "Immune to common poisons and venoms."], [101, 4, :state, "Doubles maximum magia points."], [125, 1, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +35 (repeatable)", 347, 35, true, 0, 0], [1, 1, :stat, "MAGIA +25 (repeatable)", 347, 25, true, 0, 0],
[3, 1, :stat, "DEFENSE +12 (repeatable)", 347, 12, true, 0, 0], [2, 1, :stat, "STRENGTH +17 (repeatable)", 347, 17, true, 0, 0],
[6, 1, :stat, "AGILITY +17 (repeatable)", 347, 17, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 2, :stat, "DEXTERITY +3 (repeatable)", 347, 3, true, 0, 0], [5, 2, :stat, "AFFINITY +3 (repeatable)", 347, 3, true, 0, 0]],
#7 Hana
7 => [[45, 4], [50, 4], [13, 3], [14, 3], [15, 3], [16, 4], [135, 3], [3, 1], [12, 1], [92, 1], [60, 1], [102, 1], [202, 3], [28, 1], [29, 1], [44, 1], [91, 3], [9, 1],
[199, 1, :variable, "Increases Black Rose's damage by 200.", 345, 200], [199, 1, :variable, "Increases Black Rose's damage by another 200.", 345, 200],
[75, 2, :state, "Teaches you how to use bows."], [76, 4, :state, "Teaches you how to use swords."],
[87, 1, :state, "Teaches you how to wear magia clothes."], [68, 2, :state, "Immune to common poisons and venoms."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [4, 3, :state, "+150% TP Charge Rate."],
[100, 6, :state, "60% Frost Resistance, 10% Agility boost, +2 HP Regen, Immune to State: Hypothermia"], [125, 2, :state, "Immune to stat debuffs."],
[110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[165, 2, :variable, "Increases deception by 1.", 347, 1], [30, 1, :variable, "Increases MC testosterone by 1.", 347, 1],
[0, 1, :stat, "HEALTH +25 (repeatable)", 347, 25, true, 0, 0], [1, 1, :stat, "MAGIA +35 (repeatable)", 347, 35, true, 0, 0],
[3, 1, :stat, "DEFENSE +10 (repeatable)", 347, 10, true, 0, 0], [2, 1, :stat, "STRENGTH +11 (repeatable)", 347, 11, true, 0, 0],
[6, 1, :stat, "AGILITY +20 (repeatable)", 347, 20, true, 0, 0], [7, 1, :stat, "LUCK +20 (repeatable)", 347, 20, true, 0, 0],
[4, 1, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 2, :stat, "AFFINITY +3 (repeatable)", 347, 3, true, 0, 0]],
#8 Bloodfang
8 => [[59, 5], [22, 3], [24, 4], [92, 1], [25, 2], [45, 2], [60, 1], [28, 1], [29, 1], [165, 1], [90, 1], [20, 2], [21, 1], [26, 2], [88, 5, :state, "Teaches you how to use artifacts."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [68, 4, :state, "Immune to common poisons and venoms."],
[4, 5, :state, "+150% TP Charge Rate."], [110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[125, 3, :state, "Immune to stat debuffs."], [29, 1, :variable, "Increases MC estrogen by 1.", 347, 1], [28, 1, :variable, "Increases perception by 1.", 347, 1],
[0, 1, :stat, "HEALTH +63 (repeatable)", 347, 63, true, 0, 0], [1, 1, :stat, "MAGIA +30 (repeatable)", 347, 30, true, 0, 0],
[3, 1, :stat, "DEFENSE +15 (repeatable)", 347, 15, true, 0, 0], [2, 1, :stat, "STRENGTH +20 (repeatable)", 347, 20, true, 0, 0],
[6, 1, :stat, "AGILITY +25 (repeatable)", 347, 25, true, 0, 0], [7, 1, :stat, "LUCK +5 (repeatable)", 347, 5, true, 0, 0],
[4, 1, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#9 Azar
9 => [[81, 2], [82, 3], [84, 4], [56, 3], [59, 4], [52, 1], [60, 1], [92, 1], [191, 2], [193,1], [194, 1], [88, 3], [89, 2], [101, 8, :state, "Doubles maximum magia points (continuously)."],
[4, 2, :state, "+150% TP Charge Rate."], [68, 2, :state, "Immune to common poisons and venoms."], [125, 4, :state, "Immune to stat debuffs."],
[110, 2, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[30, 2, :variable, "Increases MC testosterone by 1.", 347, 1], [163, 2, :variable, "Increases Academics by 1.", 347, 1],
[0, 1, :stat, "HEALTH +15 (repeatable)", 347, 15, true, 0, 0], [1, 1, :stat, "MAGIA +50 (repeatable)", 347, 50, true, 0, 0],
[3, 1, :stat, "DEFENSE +5 (repeatable)", 347, 5, true, 0, 0], [2, 1, :stat, "STRENGTH +5 (repeatable)", 347, 5, true, 0, 0],
[6, 1, :stat, "AGILITY +10 (repeatable)", 347, 10, true, 0, 0], [7, 1, :stat, "LUCK +10 (repeatable)", 347, 10, true, 0, 0],
[4, 2, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 4, :stat, "AFFINITY +6 (repeatable)", 347, 6, true, 0, 0]],
#10 Tsei
10 => [[52, 1], [71, 10], [74, 8], [76, 9], [60, 1], [28, 1], [29, 1], [97, 1], [92, 1], [101, 8, :state, "Doubles maximum magia points (continuously)."],
[68, 4, :state, "Immune to common poisons and venoms."], [4, 2, :state, "+150% TP Charge Rate."], [125, 5, :state, "Immune to stat debuffs."],
[110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."]],
#12 Kaliska
12 => [[38, 2], [39, 7], [51, 2], [60, 1], [92, 1], [198, 1, :variable, "Kaliska's Stance now also heals for 250 Fire element.", 348, 250],
[101, 2, :state, "Doubles maximum magia points (continuously)."],
[68, 2, :state, "Immune to common poisons and venoms."], [4, 4, :state, "+150% TP Charge Rate."], [125, 4, :state, "Immune to stat debuffs."],
[110, 2, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[123, 4, :state, "DEF stat is doubled."], [124, 3, :state, "Kaliska received -60% Light and Dark damage, and also +1 HRG"],
[25, 1, :variable, "Increases karma by 1.", 347, 1],
[0, 1, :stat, "HEALTH +30 (repeatable)", 347, 30, true, 0, 0], [1, 1, :stat, "MAGIA +10 (repeatable)", 347, 10, true, 0, 0],
[3, 1, :stat, "DEFENSE +25 (repeatable)", 347, 25, true, 0, 0], [2, 1, :stat, "STRENGTH +22 (repeatable)", 347, 22, true, 0, 0],
[6, 1, :stat, "AGILITY +19 (repeatable)", 347, 19, true, 0, 0], [7, 1, :stat, "LUCK +25 (repeatable)", 347, 25, true, 0, 0],
[4, 3, :stat, "DEXTERITY +4 (repeatable)", 347, 4, true, 0, 0]],
#17 Alliah
17 => [[91, 2], [92, 1], [196, 1, :variable, "Alliah's Clarity restores 15 MP.", 343],[105, 2, :state, "+2% HP Regen."],[68, 2, :state, "Immune to common poisons and venoms."],
[25, -1, :variable, "Lowers karma by 1.", 347, 1],
[0, 2, :stat, "HEALTH +100 (repeatable)", 347, 40, true, 0, 0], [1, 1, :stat, "MAGIA +40 (repeatable)", 347, 40, true, 0, 0],
[3, 1, :stat, "DEFENSE +10 (repeatable)", 347, 10, true, 0, 0], [2, 1, :stat, "STRENGTH +15 (repeatable)", 347, 15, true, 0, 0],
[6, 1, :stat, "AGILITY +13 (repeatable)", 347, 13, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 1, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +2 (repeatable)", 347, 2, true, 0, 0]],
#19 Yseult
19 => [[77, 3], [82, 1], [84, 2], [180,2], [89,3], [46,1], [185,1],
[0, 1, :stat, "HEALTH +22 (repeatable)", 347, 22, true, 0, 0], [1, 1, :stat, "MAGIA +40 (repeatable)", 347, 40, true, 0, 0],
[3, 1, :stat, "DEFENSE +9 (repeatable)", 347, 9, true, 0, 0], [2, 1, :stat, "STRENGTH +12 (repeatable)", 347, 12, true, 0, 0],
[6, 1, :stat, "AGILITY +14 (repeatable)", 347, 14, true, 0, 0], [7, 1, :stat, "LUCK +26 (repeatable)", 347, 26, true, 0, 0],
[4, 1, :stat, "DEXTERITY +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#20 Celeste
20 => [[59, 4], [92, 2], [191, 2], [109, 1], [68, 2, :state, "Immune to common poisons and venoms."], [105, 2, :state, "+2% HP Regen."],
[125, 2, :state, "Immune to stat debuffs."],
[0, 3, :stat, "HEALTH +150 (repeatable)", 347, 10, true, 0, 0], [1, 1, :stat, "MAGIA +35 (repeatable)", 347, 35, true, 0, 0],
[3, 1, :stat, "DEFENSE +4 (repeatable)", 347, 2, true, 0, 0], [2, 1, :stat, "STRENGTH +3 (repeatable)", 347, 3, true, 0, 0],
[6, 1, :stat, "AGILITY +14 (repeatable)", 347, 14, true, 0, 0], [7, 1, :stat, "LUCK +8 (repeatable)", 347, 8, true, 0, 0],
[4, 1, :stat, "DEXTERITY +2 (repeatable)", 347, 2, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#21 Nuala
21 => [[6, 2], [10, 3], [92, 2], [11, 2], [28, 1], [29, 1], [44, 1], [97, 1], [73, 1, :variable, "Block heals for 60 HP, water element.", 348, 60],
[123, 4, :state, "DEF stat is doubled."], [125, 4, :state, "Immune to stat debuffs."]],
}
# Actor's Skill Shop Group Background
# Place background graphic in Graphics/Pictures folder
ShopBackground = {
# actor_id => "Filename",
# Set "" into filename to disable background.
1 => "Brain Basic",
2 => "Brain Basic",
3 => "Brain Basic",
4 => "Brain Basic",
5 => "Brain Xia",
6 => "Brain Basic",
7 => "Brain Hana",
8 => "Brain Bloodfang",
9 => "Brain Azar",
10 => "Brain Basic",
11 => "Brain Basic",
12 => "Brain Basic",
13 => "Brain Basic",
14 => "Brain Basic",
15 => "Brain Basic",
16 => "Brain Basic",
17 => "Brain Basic",
18 => "Brain Basic",
19 => "Brain Basic",
20 => "Brain Celeste",
21 => "Brain Basic",
}
end
end
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Addd Skill Points
#--------------------------------------------------------------------------
def add_skill_points(actor_id, points)
$game_actors[actor_id].skill_point += points
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Variables
#--------------------------------------------------------------------------
attr_accessor :skill_point
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
alias :yazik_lsk_setup :setup
def setup(actor_id)
yazik_lsk_setup(actor_id)
if @level > 1
sp = Yazik::Actor::StartingSkillPoint
@skill_point = sp + Yazik::Actor::SkillPointGain * (@level - 1)
else
@skill_point = Yazik::Actor::StartingSkillPoint
end
end
#--------------------------------------------------------------------------
# * Level Up
#--------------------------------------------------------------------------
alias :lune_sk_level_up :level_up
def level_up
lune_sk_level_up
@skill_point += Yazik::Actor::SkillPointGain
end
end
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def insert_command(index, name, symbol, enabled = true, ext = nil)
cmd = {:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext}
@list.insert(index, cmd)
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
alias :yazik_lst_make_command_list :make_command_list
def make_command_list
yazik_lst_make_command_list
cmd_index = Yazik::SkillShop::CommandIndex
cmd_name = Yazik::SkillShop::CommandName
insert_command(cmd_index, cmd_name, :skill_tree, main_commands_enabled)
end
end
#==============================================================================
# ** Window_ShopSkill
#==============================================================================
class Window_ShopSkill < Window_SkillList
#--------------------------------------------------------------------------
# * Variáveis públicas
#--------------------------------------------------------------------------
attr_reader :skill_tree
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, w, h)
super(x, y, w, h)
self.opacity = Yazik::SkillShop::ShopWindow_Opacity
self.contents_opacity = 255
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return Yazik::SkillShop::ShopWindow_Column
end
#--------------------------------------------------------------------------
# * Include in Skill List?
#--------------------------------------------------------------------------
def include?(item)
return item
end
#--------------------------------------------------------------------------
# * Display Skill in Active State?
#--------------------------------------------------------------------------
def enable?(item)
return item
end
#--------------------------------------------------------------------------
# * Create Skill List
#--------------------------------------------------------------------------
def make_item_list
if @actor
skills = []
db = Yazik::SkillShop::ShopDatabase[@actor.id]
for i in 0...db.size
if db[i][2] == :state
state_id = db[i][0]
if @actor.state_addable?(state_id)
state = $data_states[state_id]
skills.push(state)
end
else
skill = $data_skills[db[i][0]]
if @actor.added_skill_types.include?(skill.stype_id)
skills.push(skill)
end
end
end
@data = skills
else
@data = []
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
data = @data[index]
if data
rect = item_rect(index)
rect.width -= 4
enabled = data.class == RPG::Skill ? @actor.skill_learn?(data) : @actor.state?(data.id)
draw_skill_icon(index, data, rect.x, rect.y, enabled)
draw_skill_price(rect, index)
end
end
#--------------------------------------------------------------------------
# * Draw Item Name
#--------------------------------------------------------------------------
def draw_skill_icon(index, item, x, y, enabled)
return unless item
draw_icon(item.icon_index, x, y, enabled)
end
#--------------------------------------------------------------------------
# * Draw Skill Price
#--------------------------------------------------------------------------
def draw_skill_price(rect, index)
db = Yazik::SkillShop::ShopDatabase[@actor.id]
price = db[index][1]
draw_text_ex(rect.x + 24 + 4, rect.y, price.to_s + Yazik::SkillShop::SkillPointSymbol)
end
end
#==============================================================================
# ** Window_ShopHelp
#==============================================================================
class Window_ShopHelp < Window_Help
#--------------------------------------------------------------------------
# * Inicialização
#--------------------------------------------------------------------------
def initialize(line_number = Yazik::SkillShop::HelpWindow_LineNumber)
super(line_number)
self.opacity = Yazik::SkillShop::HelpWindow_Opacity
self.contents_opacity = 255
@item_name = ''
end
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
alias :yazik_ss_clear :clear
def clear
@item_name = ''
yazik_ss_clear
end
#--------------------------------------------------------------------------
# * Set Name
#--------------------------------------------------------------------------
def set_name(item_name)
if item_name != @item_name
@item_name = item_name
refresh
end
end
#--------------------------------------------------------------------------
# * Set Item
#--------------------------------------------------------------------------
alias :yazik_ss_set_item :set_item
def set_item(item)
set_name(item ? item.name : "")
if SceneManager.scene_is?(Scene_SkillShop)
if (item) and (item.class == RPG::State)
set_text(SceneManager.scene.database_item[3])
return
end
end
yazik_ss_set_item(item)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(system_color)
draw_text(4, 0, contents_width - 4, line_height, @item_name)
change_color(normal_color)
draw_text_ex(4, line_height, @text)
reset_font_settings
end
end
#==============================================================================
# ** Window_TotalSkillPoint
#==============================================================================
class Window_TotalSkillPoint < Window_Base
#--------------------------------------------------------------------------
# * Inicialização
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
@actor = nil
self.z = 200
self.opacity = 0
self.contents_opacity = 255
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Atualização
#--------------------------------------------------------------------------
def refresh
contents.clear
tx = Yazik::SkillShop::TotalSkillPointText_X
ty = Yazik::SkillShop::TotalSkillPointText_Y
txt = Yazik::SkillShop::TotalSkillPointText + @actor.skill_point.to_s
draw_text_ex(tx, ty, txt)
end
end
#==============================================================================
# ** Window_ShopConfirm
#==============================================================================
class Window_ShopConfirm < Window_Command
#--------------------------------------------------------------------------
# * Inicialização do objeto
#--------------------------------------------------------------------------
def initialize
super(0, 0)
self.z = 9999
self.x = (Graphics.width - self.width) / 2
self.y = (Graphics.height - self.height) / 2
self.openness = 0
end
#--------------------------------------------------------------------------
# * Aquisição da largura da janela
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Criação da lista de comandos
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
end
#--------------------------------------------------------------------------
# * Get Alignment
#--------------------------------------------------------------------------
def alignment
return 1
end
#--------------------------------------------------------------------------
# * Adição dos comandos principais
#--------------------------------------------------------------------------
def add_main_commands
add_command(Yazik::SkillShop::VocabBuy, :confirm_buy, true)
add_command(Yazik::SkillShop::VocabCancel, :confirm_cancel, true)
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
alias :yazik_lst_create_command_window :create_command_window
def create_command_window
yazik_lst_create_command_window
@command_window.set_handler(:skill_tree, method(:command_personal))
end
#--------------------------------------------------------------------------
# * [OK] Personal Command
#--------------------------------------------------------------------------
alias :yazik_lst_on_personal_ok :on_personal_ok
def on_personal_ok
case @command_window.current_symbol
when :skill_tree
SceneManager.call(Scene_SkillShop)
else
yazik_lst_on_personal_ok
end
end
end
#==============================================================================
# ** Scene_SkillShop
#==============================================================================
class Scene_SkillShop < Scene_Skill
#--------------------------------------------------------------------------
# * Inicialização do processo
#--------------------------------------------------------------------------
def start
super
# create_actor_window
create_info_window
create_confirm_window
create_background_image
end
#--------------------------------------------------------------------------
# * Remove Default Scene_Skill Windows
#--------------------------------------------------------------------------
def create_command_window; end
def create_status_window; end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_ShopHelp.new(4)
@help_window.viewport = @viewport
@help_window.x = 0
@help_window.y = Graphics.height - @help_window.height
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
wx = Yazik::SkillShop::ShopWindow_X
wy = Yazik::SkillShop::ShopWindow_Y
ww = Yazik::SkillShop::ShopWindow_Width
wh = Yazik::SkillShop::ShopWindow_Height
@item_window = Window_ShopSkill.new(wx, wy, ww, wh)
@item_window.actor = @actor
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:return_scene))
@item_window.select(0)
@item_window.activate
end
#--------------------------------------------------------------------------
# * Item [OK]
#--------------------------------------------------------------------------
def on_item_ok
is_skill = item.class == RPG::Skill
is_state = item.class == RPG::State
if (is_skill and !@actor.skill_learn?(item)) or (is_state and !@actor.state?(item.id))
db = Yazik::SkillShop::ShopDatabase[@actor.id]
price = db[@item_window.index][1]
if price <= $game_actors[@actor.id].skill_point
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
else
Sound.play_buzzer
@item_window.activate
end
else
@item_window.activate
end
end
#--------------------------------------------------------------------------
# * Criação das Janelas
#--------------------------------------------------------------------------
def create_confirm_window
@confirm_window = Window_ShopConfirm.new
@confirm_window.set_handler(:confirm_buy, method(:buy_item))
@confirm_window.set_handler(:confirm_cancel, method(:activate_shop_window))
@confirm_window.set_handler(:cancel, method(:activate_shop_window))
@confirm_window.close
@confirm_window.deactivate
end
#--------------------------------------------------------------------------
# * Create Info Window
#--------------------------------------------------------------------------
def create_info_window
@info_window = Window_TotalSkillPoint.new
@info_window.actor = @actor
end
#--------------------------------------------------------------------------
# * Activate Shop Window
#--------------------------------------------------------------------------
def activate_shop_window
@confirm_window.close
@confirm_window.deactivate
@item_window.refresh
@item_window.activate
end
#--------------------------------------------------------------------------
# * Create Background Image
#--------------------------------------------------------------------------
def create_background_image
bg = Yazik::SkillShop::ShopBackground[@actor.id]
@background_image = Sprite.new
@background_image.bitmap = Cache.picture(bg)
end
#--------------------------------------------------------------------------
# * Database Item
#--------------------------------------------------------------------------
def database_item
return Yazik::SkillShop::ShopDatabase[@actor.id][@item_window.index]
end
#--------------------------------------------------------------------------
# * Buy Skill or State
#--------------------------------------------------------------------------
def buy_item
db = Yazik::SkillShop::ShopDatabase[@actor.id]
if db[@item_window.index][2] == :state
state_id = db[@item_window.index][0]
state_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= state_price
$game_actors[@actor.id].add_state(state_id)
else
skill_id = db[@item_window.index][0]
skill_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= skill_price
$game_actors[@actor.id].learn_skill(skill_id)
end
@info_window.refresh
@confirm_window.close
@confirm_window.deactivate
@item_window.refresh
@item_window.activate
end
#--------------------------------------------------------------------------
# * Terminate
#--------------------------------------------------------------------------
def terminate
super
@background_image.bitmap.dispose
@background_image.dispose
end
end