#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ 技能SP点--让技能像装备一样装备吧~
#_/
#_/ 看到了VX中KGC的技能CP制脚本,然后到KGC和6R找了好久都没找到ACE版本,就参照着
#_/ KGCVX版的思路移植了个技能SP的脚本~
#_/ 功能:
#_/ 让技能像装备一样装备,只有装备后的技能可以在战斗中使用。
#_/ 技能可在备注设定消耗的SP,角色升级可增加SP,装备也可追加SP(或者扣除SP上限)。
#_/ 可定义技能栏上限,这样即使SP再多也只能携带特定数目技能。
#_/ ---千叶玖濑
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ☆系统设置
#==============================================================================
module Skill_SP
# ◆ 技能栏最大空位
MAX_SKILLS = 7
# ◆ SP 的名字
VOCAB_SP = "SP"
# ◆ SP 的简称
VOCAB_SP_A = "技"
# ◆ 在角色状态中显示SP数值(适合默认菜单)
SHOW_STATUS_SP = true
# ◆ 未设定消耗SP的技能,默认消耗的SP值。
DEFAULT_SP_COST = 1
# ◆ 人物升级所获得得SP值上限
SP_MAX = 25
# ◆ 人物SP值下限
SP_MIN = 0
# ◆ 本来的SP加上装备提供的SP上限
REVISED_SP_MAX = 25
# ◆ 经过装备扣除后的SP下限
REVISED_SP_MIN = 0
# ◆通用的SP最大值的计算公式
# level代表角色当前等级
# 结果自动取整
SP_ABOUT_EXP = "level * 0.6 + 1.0"
# ◆ 对于特定角色角色最大SP计算公式
# PERSONAL_SP_ABOUT_EXP[角色 ID] = "公式"
# 公式格式和最大值计算公式举例如下
PERSONAL_SP_ABOUT_EXP = [] # 此行不要改动
PERSONAL_SP_ABOUT_EXP[1] = "level * 1.0 - 10.0"
PERSONAL_SP_ABOUT_EXP[3] = "level * 1.0 + 5.0"
# ◆ 在技能装备栏中允许显示不可使用的技能
SHOW_UNUSABLE_SKILL = true
# ◆ 新学习到的技能自动装备
AUTO_SET_NEW_SKILL = true
# ◆ SP 最小值时的颜色
# (数值为\C[n]表示的颜色)
GAUGE_START_COLOR = 13
# ◆ SP 最大值时的颜色
GAUGE_END_COLOR = 5
# ◆ 菜单中进入技能SP的名称
VOCAB_MENU_SET_SKILL = "魔装"
# ◆ 未设定技能时显示的名称
BLANK_TEXT = "- 空技能框 -"
# ◆ 技能解除时候显示的名称
RELEASE_TEXT = "( 解除技能 )"
end
#==============================================================================
# ☆对于在数据库备注中的设定方法~
#==============================================================================
module Skill_SP
module Regexp
module BaseItem
# 最大SP增加:在装备栏备注中填写<最大SP X>或<MAXSP X>(X可为负数)
MAXSP_PLUS = /<(?:MAX|最大)SP\s*([\-\+]?\d+)>/
# 技能框增加:在装备栏备注中填写<技能栏追加 X>
BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|技能栏追加)\s*([\-\+]?\d+)>/i
end
module Skill
# 消费SP设定 :在技能备注中填写<SP X>
SP_COST = /<SP\s*(\d+)>/i
end
end
end
#==============================================================================
## ☆ Game_Interpreter----用事件脚本来获取SP的方法~
#==============================================================================
module Skill_SP
#--------------------------------------------------------------------------
# ○ 获得角色SP最大值
# actor_id : 角色编号
# variable_id : SP赋值的变量号(不填则不代入)
#--------------------------------------------------------------------------
def get_actor_sp(actor_id, variable_id = 0)
value = $game_actors[actor_id].maxsp_plus
$game_variables[variable_id] = value if variable_id > 0
return value
end
#--------------------------------------------------------------------------
# ○ 变更角色SP最大值
# actor_id : 角色编号
# value : 变更后的SP最大值
#--------------------------------------------------------------------------
def set_actor_sp(actor_id, value)
$game_actors[actor_id].maxsp_plus = value
end
#--------------------------------------------------------------------------
# ○ 角色最大SP增加
# actor_id : 角色编号
# value : SP最大值增加量
#--------------------------------------------------------------------------
def gain_actor_sp(actor_id, value)
$game_actors[actor_id].maxsp_plus += value
end
#--------------------------------------------------------------------------
# ○ 技能栏最大数获得
# actor_id : 角色编号
# variable_id : 技能栏最大数赋值的变量号(不填则不代入)
#--------------------------------------------------------------------------
def get_battle_skill_max(actor_id, variable_id = 0)
value = $game_actors[actor_id].battle_skill_max
$game_variables[variable_id] = value if variable_id > 0
return value
end
#--------------------------------------------------------------------------
# ○ 技能栏最大数变更
# actor_id : 角色ID
# value : 变更后的技能栏数目
#--------------------------------------------------------------------------
def set_battle_skill_max(actor_id, value = -1)
$game_actors[actor_id].battle_skill_max = value
end
#--------------------------------------------------------------------------
# ○ 确认某技能是否已装备
# actor_id : 角色ID
# skill_id : 技能ID
#--------------------------------------------------------------------------
def battle_skill_set?(actor_id, skill_id)
return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
end
#--------------------------------------------------------------------------
# ○ 装备技能
# actor_id : 角色编号
# index : 装备的技能栏位
# skill_id : 技能ID(nil则为解除装备)
#--------------------------------------------------------------------------
def set_battle_skill(actor_id, index, skill_id = nil)
actor = $game_actors[actor_id]
if skill_id.is_a?(Integer)
# 装备
skill = $data_skills[skill_id]
return unless actor.battle_skill_settable?(index, skill) # 无法装备
actor.set_battle_skill(index, skill)
actor.restore_battle_skill
else
# 解除
actor.remove_battle_skill(index)
end
end
#--------------------------------------------------------------------------
# ○ 直接装备某技能
# actor_id : 角色编号
# skill_id : 技能编号
#--------------------------------------------------------------------------
def add_battle_skill(actor_id, skill_id)
actor = $game_actors[actor_id]
skill = $data_skills[skill_id]
return if actor == nil || skill == nil
actor.add_battle_skill(skill)
end
#--------------------------------------------------------------------------
# ○ 卸下全部技能
# actor_id : 角色编号
#--------------------------------------------------------------------------
def clear_battle_skill(actor_id)
$game_actors[actor_id].clear_battle_skill
end
end
class Game_Interpreter
include Skill_SP
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ○ 读取装备备注
#--------------------------------------------------------------------------
def create_skill_sp_system_cache
@__maxsp_plus = 0
@__battle_skill_max_plus = 0
self.note.each_line { |line|
case line
when Skill_SP::Regexp::BaseItem::MAXSP_PLUS
@__maxsp_plus += $1.to_i
when Skill_SP::Regexp::BaseItem::BATTLE_SKILL_MAX
@__battle_skill_max_plus += $1.to_i
end
}
end
#--------------------------------------------------------------------------
# ○ 最大 SP
#--------------------------------------------------------------------------
def maxsp_plus
create_skill_sp_system_cache if @__maxsp_plus == nil
return @__maxsp_plus
end
#--------------------------------------------------------------------------
# ○ 技能框追加
#--------------------------------------------------------------------------
def battle_skill_max_plus
create_skill_sp_system_cache if @__battle_skill_max_plus == nil
return @__battle_skill_max_plus
end
end
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# ○ 技能SP生成
#--------------------------------------------------------------------------
def create_skill_sp_system_cache
@__sp_cost = Skill_SP::DEFAULT_SP_COST
self.note.each_line { |line|
case line
when Skill_SP::Regexp::Skill::SP_COST
# 消费SP
@__sp_cost = $1.to_i
end
}
end
#--------------------------------------------------------------------------
# ○ 消費 SP
#--------------------------------------------------------------------------
def sp_cost
create_skill_sp_system_cache if @__sp_cost == nil
return @__sp_cost
end
end
#==============================================================================
# ■ Vocab
#==============================================================================
module Vocab
#SP
def self.sp
return Skill_SP::VOCAB_SP
end
#SP略
def self.sp_a
return Skill_SP::VOCAB_SP_A
end
# 技能设定
def self.set_battle_skill
return Skill_SP::VOCAB_MENU_SET_SKILL
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ○ 战斗技能配置确定
#--------------------------------------------------------------------------
def battle_skill_set?(skill)
return true
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 实例变量
#--------------------------------------------------------------------------
attr_writer :maxsp_plus # 最大SP补正值
#--------------------------------------------------------------------------
# ○ MaxSP 取得
#--------------------------------------------------------------------------
def maxsp
about_exp = Skill_SP::PERSONAL_SP_ABOUT_EXP[self.id]
if about_exp == nil
about_exp = Skill_SP::SP_ABOUT_EXP
end
n = Integer(eval(about_exp))
n = [[n, sp_limit].min, Skill_SP::SP_MIN].max
n += maxsp_plus + maxsp_plus_equip
return [[n, revised_sp_limit].min, Skill_SP::REVISED_SP_MIN].max
end
#--------------------------------------------------------------------------
# ○ SP 取得
#--------------------------------------------------------------------------
def sp
return [maxsp - consumed_sp, 0].max
end
#--------------------------------------------------------------------------
# ○ SP 消耗量取得
#--------------------------------------------------------------------------
def consumed_sp
n = 0
battle_skills.compact.each { |skill| n += skill.sp_cost }
return n
end
#--------------------------------------------------------------------------
# ○ SP 上限取得
#--------------------------------------------------------------------------
def sp_limit
return Skill_SP::SP_MAX
end
#--------------------------------------------------------------------------
# ○ 补正后SP上限获得
#--------------------------------------------------------------------------
def revised_sp_limit
return Skill_SP::REVISED_SP_MAX
end
#--------------------------------------------------------------------------
# ○ 补正值获得
#--------------------------------------------------------------------------
def maxsp_plus
if @maxsp_plus == nil
if @own_sp != nil
@maxsp_plus = @own_sp
@own_sp = nil
else
@maxsp_plus = 0
end
end
return @maxsp_plus
end
#--------------------------------------------------------------------------
# ○ 装备补正
#--------------------------------------------------------------------------
def maxsp_plus_equip
n = 0
equips.compact.each { |item| n += item.maxsp_plus }
return n
end
#--------------------------------------------------------------------------
# ● 技能取得
#--------------------------------------------------------------------------
alias skills_SkillSP skills
def skills
return (skill_sp_restrict? ? restricted_skills : skills_SkillSP)
end
#--------------------------------------------------------------------------
# ○ 战斗测试
#--------------------------------------------------------------------------
def skill_sp_restrict?
if $game_party.in_battle
return true unless $BTEST
end
return false
end
#--------------------------------------------------------------------------
# ○ 技能限制
#--------------------------------------------------------------------------
def restricted_skills
# 战斗技能加入
result = battle_skills
result.sort! { |a, b| a.id <=> b.id }
return result
end
#--------------------------------------------------------------------------
# ○ 全部技能取得
#--------------------------------------------------------------------------
def all_skills
last_in_battle = $game_party.in_battle
$game_party.in_battle = false
result = skills_SkillSP
$game_party.in_battle = last_in_battle
return result
end
#--------------------------------------------------------------------------
# ○ 技能栏最大数取得
#--------------------------------------------------------------------------
def battle_skill_max
@battle_skill_max = -1 if @battle_skill_max == nil
n = (@battle_skill_max < 0 ?
Skill_SP::MAX_SKILLS : @battle_skill_max)
n += equipment_battle_skill_max_plus
return [n, 0].max
end
#--------------------------------------------------------------------------
# ○ 扩充技能栏
#--------------------------------------------------------------------------
def equipment_battle_skill_max_plus
n = 0
equips.compact.each { |item| n += item.battle_skill_max_plus }
return n
end
#--------------------------------------------------------------------------
# ○ 技能栏最大值设定
#--------------------------------------------------------------------------
def battle_skill_max=(value)
@battle_skill_max = value
if @battle_skills == nil
@battle_skills = []
else
@battle_skills = @battle_skills[0...value]
end
end
#--------------------------------------------------------------------------
# ○ 战斗使用技能ID
#--------------------------------------------------------------------------
def battle_skill_ids
@battle_skills = [] if @battle_skills == nil
return @battle_skills
end
#--------------------------------------------------------------------------
# ○ 战斗用技能取得
#--------------------------------------------------------------------------
def battle_skills
result = []
battle_skill_ids.each { |i|
next if i == nil
result << $data_skills[i]
}
return result
end
#--------------------------------------------------------------------------
# ○ 战斗技能登陆
# index : 位置
# skill : 技能编号
#--------------------------------------------------------------------------
def set_battle_skill(index, skill)
if skill == nil
@battle_skills[index] = nil
else
return unless skill.is_a?(RPG::Skill)
return if sp < skill.sp_cost
@battle_skills[index] = skill.id
end
end
#--------------------------------------------------------------------------
# ○ 战斗技能追加
# skill : 技能
#--------------------------------------------------------------------------
def add_battle_skill(skill)
return unless skill.is_a?(RPG::Skill)
skills = battle_skill_ids
return if skills.include?(skill.id)
return if sp < skill.sp_cost
battle_skill_max.times { |i|
if skills[i] == nil
set_battle_skill(i, skill)
break
end
}
restore_battle_skill
end
#--------------------------------------------------------------------------
# ○ 战斗技能解除
# index : 位置
#--------------------------------------------------------------------------
def remove_battle_skill(index)
@battle_skills[index] = nil
end
#--------------------------------------------------------------------------
# ○ 战斗技能全部解除
#--------------------------------------------------------------------------
def clear_battle_skill
@battle_skills = []
end
#--------------------------------------------------------------------------
# ○ 技能能否设置判定
# index : 位置
# skill : 技能
#--------------------------------------------------------------------------
def battle_skill_settable?(index, skill)
return false if battle_skill_max <= index # 超出范围
return true if skill == nil # 解除技能
return false if battle_skill_ids.include?(skill.id) #已经设定
skill_id = battle_skill_ids[index]
curr_skill = (skill_id != nil ? $data_skills[skill_id] : nil)
offset = (curr_skill != nil ? curr_skill.sp_cost : 0)
return false if self.sp < (skill.sp_cost - offset) # SP 不足
return true
end
#--------------------------------------------------------------------------
# ○ 战斗技能存储
#--------------------------------------------------------------------------
def restore_battle_skill
result = battle_skill_ids.clone
usable_skills = all_skills
result.each_with_index { |n, i|
next if n == nil
# 未学习的情况
if (usable_skills.find { |s| s.id == n }) == nil
result[i] = nil
end
}
@battle_skills = result[0...battle_skill_max]
# SP不足的时候排除
(battle_skill_max - 1).downto(0) { |i|
@battle_skills[i] = nil if maxsp - consumed_sp < 0
}
end
#--------------------------------------------------------------------------
# ● 换装备的时候
# equip_type : 装备部位
# item : 道具
# test : 在战斗测试中
#--------------------------------------------------------------------------
alias change_equip_SkillSP change_equip
def change_equip(equip_type, item, test = false)
change_equip_SkillSP(equip_type, item)
restore_battle_skill
end
#--------------------------------------------------------------------------
# ● 装备丢弃时
#--------------------------------------------------------------------------
alias discard_equip_SkillSP discard_equip
def discard_equip(item)
discard_equip__SkillSP(item)
restore_battle_skill
end
#--------------------------------------------------------------------------
# ● 经验变更
#--------------------------------------------------------------------------
alias change_exp_SP change_exp
def change_exp(exp, show)
last_in_battle = $game_party.in_battle
$game_party.in_battle = false
change_exp_SP(exp, show)
$game_party.in_battle = last_in_battle
end
if Skill_SP::AUTO_SET_NEW_SKILL
alias learn_skill_SP learn_skill
def learn_skill(skill_id)
learn_skill_SP(skill_id)
add_battle_skill($data_skills[skill_id])
end
end
#--------------------------------------------------------------------------
# ● 技能遗忘
#--------------------------------------------------------------------------
alias forget_skill_SkillSP forget_skill
def forget_skill(skill_id)
# 忘れるスキルを戦闘用スキルから削除
battle_skill_ids.each_with_index { |s, i|
remove_battle_skill(i) if s == skill_id
}
forget_skill_SkillSP(skill_id)
end
#--------------------------------------------------------------------------
# ● 判定技能是否装备
#--------------------------------------------------------------------------
def battle_skill_set?(skill)
return false unless skill.is_a?(RPG::Skill)
return battle_skill_ids.include?(skill.id)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ○ SP颜色取得
#--------------------------------------------------------------------------
def sp_color(actor)
return knockout_color if actor.maxsp > 0 && actor.sp == 0
return normal_color
end
#--------------------------------------------------------------------------
# ○ SP渐变色1
#--------------------------------------------------------------------------
def sp_gauge_color1
color = Skill_SP::GAUGE_START_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ SP渐变色2
#--------------------------------------------------------------------------
def sp_gauge_color2
color = Skill_SP::GAUGE_END_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ SP描绘
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 120)
draw_actor_sp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, 24, Vocab::sp_a)
self.contents.font.color = sp_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, 24, actor.sp, 2)
else
self.contents.draw_text(xr - 90, y, 40, 24, actor.sp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, 24, "/", 2)
self.contents.draw_text(xr - 40, y, 40, 24, actor.maxsp, 2)
end
self.contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# ○ SP条描绘
#--------------------------------------------------------------------------
def draw_actor_sp_gauge(actor, x, y, width = 120)
gw = width * actor.sp / [actor.maxsp, 1].max
gs1 = sp_gauge_color1
gs2 = sp_gauge_color2
self.contents.fill_rect(x, y + 24 - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + 24 - 8, gw, 6, gs1, gs2)
end
end
#==============================================================================
# ■ Window_Status
#==============================================================================
if Skill_SP::SHOW_STATUS_SP
class Window_Status < Window_Selectable
#--------------------------------------------------------------------------
# ● 绘制基本信息
#--------------------------------------------------------------------------
alias draw_basic_info_SkillSP draw_basic_info
def draw_basic_info(x, y)
draw_basic_info_SkillSP(x, y)
draw_actor_sp(@actor, x, y + 24 * 4)
end
end
end
#==============================================================================
# □ Window_BattleSkillStatus
#------------------------------------------------------------------------------
# 显示基本信息的窗口
#==============================================================================
class Window_BattleSkillStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, Graphics.width, 24 + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_sp(@actor, 240, 0)
end
end
#==============================================================================
# □ Window_BattleSkillSlot
#------------------------------------------------------------------------------
# 已装备的技能窗口。
#==============================================================================
class Window_BattleSkillSlot < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@data = []
self.index = 0
self.active = false
refresh
end
#--------------------------------------------------------------------------
# ○ 获取最大值
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ○ 获取技能
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data=[]
skill_ids = @actor.battle_skill_ids
@actor.battle_skill_max.times { |i|
if skill_ids[i] != nil
@data << $data_skills[skill_ids[i]]
else
@data << nil
end
}
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# ○ 绘制内容
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
draw_item_name(skill, rect.x, rect.y)
self.contents.draw_text(rect, skill.sp_cost, 2)
else
self.contents.draw_text(rect, Skill_SP::BLANK_TEXT, 1)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end
#==============================================================================
# □ Window_BattleSkillList
#------------------------------------------------------------------------------
# 右侧显示技能列表的窗口。
#==============================================================================
class Window_BattleSkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :slot_index # 技能栏编号
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@slot_index = 0
@data = []
self.index = 0
self.active = false
refresh
end
#--------------------------------------------------------------------------
# ○ 技能取得
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ○ 最大技能数取得
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ○ 显示技能列表
#--------------------------------------------------------------------------
def make_item_list
@data = [nil]
@actor.all_skills.each { |skill|
@data.push(skill) if selectable?(skill)
}
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# ○ 技能可否选择判定
#--------------------------------------------------------------------------
def selectable?(skill)
return false if skill == nil
return true if skill.battle_ok?
if Skill_SP::SHOW_UNUSABLE_SKILL && skill.occasion == 3
return true
end
return false
end
#--------------------------------------------------------------------------
# ○ 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.battle_skill_settable?(@slot_index, skill)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, skill.sp_cost, 2)
else
self.contents.draw_text(rect, Skill_SP::RELEASE_TEXT, 1)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end
#==============================================================================
# □ Scene_SetBattleSkill
#------------------------------------------------------------------------------
# 技能设定的场景。
#==============================================================================
class Scene_SetBattleSkill < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(actor_index = 0, menu_index = 0)
@actor_index = actor_index
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_background
@actor = $game_party.menu_actor
create_windows
end
#--------------------------------------------------------------------------
# ○ 创建窗口
#--------------------------------------------------------------------------
def create_windows
@help_window = Window_Help.new
dy = @help_window.height
@status_window = Window_BattleSkillStatus.new(0, dy, @actor)
dy += @status_window.height
@slot_window = Window_BattleSkillSlot.new(
0,
dy,
Graphics.width / 2,
Graphics.height - dy,
@actor)
@slot_window.help_window = @help_window
@slot_window.active = true
@list_window = Window_BattleSkillList.new(
Graphics.width - @slot_window.width,
dy,
Graphics.width - @slot_window.width,
Graphics.height - dy,
@actor)
@list_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
@help_window.dispose
@status_window.dispose
@slot_window.dispose
@list_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
if @slot_window.active
update_slot
elsif @list_window.active
update_list
end
end
#--------------------------------------------------------------------------
# ○ 刷新窗口
#--------------------------------------------------------------------------
def refresh_window
@status_window.refresh
@slot_window.refresh
@list_window.refresh
end
#--------------------------------------------------------------------------
# ○ 左侧窗口更新
#--------------------------------------------------------------------------
def update_slot
if @last_slot_index != @slot_window.index
@list_window.slot_index = @slot_window.index
@list_window.refresh
@last_slot_index = @slot_window.index
end
if Input.trigger?(Input::A)
Sound.play_ok
@actor.remove_battle_skill(@slot_window.index)
refresh_window
elsif Input.trigger?(Input::B)
Sound.play_cancel
SceneManager.return
elsif Input.trigger?(Input::C)
Sound.play_ok
# 切换活动窗口
@slot_window.active = false
@list_window.active = true
end
end
#--------------------------------------------------------------------------
# ○ 右侧窗口更新
#--------------------------------------------------------------------------
def update_list
if Input.trigger?(Input::B)
Sound.play_cancel
# 切换活动窗口
@slot_window.active = true
@list_window.active = false
elsif Input.trigger?(Input::C)
skill = @list_window.skill
# 无法设置的场合
unless @actor.battle_skill_settable?(@slot_window.index, skill)
Sound.play_buzzer
return
end
Sound.play_ok
set_skill(@slot_window.index, skill)
@slot_window.active = true
@list_window.active = false
end
end
#--------------------------------------------------------------------------
# ○ 设置技能
#--------------------------------------------------------------------------
def set_skill(index, skill)
@actor.remove_battle_skill(index)
if skill != nil
@actor.set_battle_skill(index, skill)
end
refresh_window
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# 菜单画面中显示指令的窗口
#==============================================================================
class Window_MenuCommand < Window_Command
alias add_main_commands_kunase add_main_commands
def add_main_commands
add_main_commands_kunase
add_command(Skill_SP::VOCAB_MENU_SET_SKILL, :skillsp, main_commands_enabled)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 菜单画面
#==============================================================================
class Scene_Menu < Scene_MenuBase
alias create_command_window_kunase create_command_window
def create_command_window
create_command_window_kunase
@command_window.set_handler(:skillsp, method(:command_personal))
end
def on_personal_ok
case @command_window.current_symbol
when :skill
SceneManager.call(Scene_Skill)
when :equip
SceneManager.call(Scene_Equip)
when :status
SceneManager.call(Scene_Status)
when :skillsp
SceneManager.call(Scene_SetBattleSkill)
end
end
end
#==============================================================================
# ■ Game_Unit
#------------------------------------------------------------------------------
# 管理游戏单位的类。是 Game_Party 和 Game_Troop 类的父类。
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :in_battle # 战斗中的标志
end