#============================================================================
# ☆ 仿传说称号系统。
# 由feizhaodan制作。
# 发布于66RPG
# [url]http://rpg.blue/[/url]
# 版本号: 1.2.3
# 添加内容:
# 1.2.3
# 根据皮卡星的建议,增大装备称号确认窗口的Z值并添加$imported
# 1.2.2
# 1.在升级时重新计算百分比增加的属性量。
# 2.在失去称号时若失去的是当前装备,则将称号ID改回默认,并重设属性。
# 3.增加新方法:refresh_appellation。
# 1.2.1
# 修正qwrffdtqfsd 提出的在满HPMP状态下降低HPMP上限会使
# HPMP超过上限。
# 1.2.0
# 修正若称号说明超过1行,显示不完整。
# 1.1.0
# 增加从状态画面进入各角色的称号装备界面的功能。
# 2011/10/22
# 转载时请连同这里一起转
#============================================================================
#==============================================================================
# ■ Kien::Appellation
#------------------------------------------------------------------------------
# 称号系统。(新模块)(设置内容)
#==============================================================================
module Kien
module Appellation
# 不要该这里。
APPELLATION = []
# 从这里开始设置。
# 先在这里按例子添加。
# 格式:
# APPELLATION[actor_id] = []
# 在actor_id内填入你的角色ID。把所有你的游戏里的角色都添加一次。
APPELLATION[1] =[]
# 这里开始一个一个设置。
# 格式: APPELLATION[actor_id][id] = ["STn[%]|STn[%]", "name", "str"]
# actor_id填入要设置的角色ID
# id填入要设置的称号ID。0为预设。
# ["ST=n|ST=n", "str"]
# ST表示装备此称号时增加的属性(ATK,DEF,AGI,SPI,HP,SP,EXP,GOLD)
# 用"|"隔开。可以填写多个。
# n表示增加量,%可填可不填,填的场合为百分比,不填为那个数量。可以是负数。
# 其中EXP和GOLD表示获取时增加的量,固定为%。
# name表示这个称号的名字
# str表示这个称号的说明。
# 三个内容的""要留着。
# 例:
# 一个没有属性加成的预设称号
APPELLATION[1][0] = ["", "见习剑士", "还在修炼中的剑士"]
# 一个增加5点HP的一号称号
APPELLATION[1][1] = ["HP5", "强壮", "表示你拥有强壮体制的称号"]
# 一个增加10点ATK,5点DEF的称号
APPELLATION[1][2] = ["ATK10|DEF5", "剑士", "已经完成修炼的剑士"]
# 一个将所有属性乘10倍的称号。
APPELLATION[1][3] = ["HP1000%|MP1000%|ATK1000%|DEF1000%|SPI1000%|AGI1000%", "挑战者", "给敢于挑战未知的人的称号。"]
# 选项添加在哪,
# 1为菜单,2为状态窗口内,0为不使用。
ADD_APPELLATION_COMMAND = 2
# 选项名称。
APPELLATION_COMMANDNAME = "称号"
# 称号属性名
APPELLATION_NAME = "称号"
# 未开放称号名
UNENABLE_NAME = "-------"
end
end
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
# 已下为脚本。 不会编脚本的修改之前请备份。
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
$imported = {} if $imported == nil
$imported["Tales_Appellation"] = true
module Kien
module Regexp
module Appellation
# 称号附加属性判定
STATUS = /(HP|MP|ATK|DEF|SPI|AGI|EXP|GOLD)?([\+\-]?\d+)([%])?/i
end # Appellation
end # Regexp
end # Kien
module Kien::Appellation
APPE_INFO = Struct.new("Appe_Info", :param, :name, :description, :enable)
module_function
#--------------------------------------------------------------------------
# ● 获取称号属性
# actor_id : 角色 ID
# id : 称号 ID
#--------------------------------------------------------------------------
def got_appe_param(actor_id, id)
param = []
APPELLATION[actor_id][id][0].split(/\|/).each{ |str|
case str
when Kien::Regexp::Appellation::STATUS
param.push [$1, $2.to_i, $3]
end
}
return param
end
#--------------------------------------------------------------------------
# ● 将称号属性构建体化
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def construct_appe_data(actor_id)
appe = []
i = 0
APPELLATION[actor_id].each { |v|
info = APPE_INFO.new
info.param = got_appe_param(actor_id, i)
info.name = v[1]
info.description = v[2]
info.enable = (i == 0)
appe[i] = info
i += 1
}
return appe
end
end # Kien
module Kien
module Command
module_function
def get_appellation(actor_id, id)
$game_actors[actor_id].get_appellation(id)
return true
end
def lose_appellation(actor_id, id)
$game_actors[actor_id].lose_appellation(id)
return true
end
def call_equip_appellation(actor_index = 1)
$scene = Scene_Appellation.new(
actor_index,
0,
1)
return true
end
def have_appellation(actor_id, id, sid = 0)
$game_switches[sid] = $game_actors[actor_id].appellation_list[id].enable
return $game_actors[actor_id].appellation_list[id].enable
end
def equip_appellation(actor_id, id, sid = 0)
$game_switches[sid] = ($game_actors[actor_id].appellation_id == id)
return ($game_actors[actor_id].appellation_id == id)
end
def have_howmany_appellation(actor_id, vid = 0)
n = 0
for appe in $game_actors[actor_id].appellation_list
if appe.enable == true
n += 1
else
next
end
end
$game_variables[vid] = n
return n
end
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 执行事件命令的解释器。本类在 Game_Map 类、Game_Troop 类、与
# Game_Event 类的内部使用。
#==============================================================================
class Game_Interpreter
include Kien::Command
end
#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 定义了用语和信息。将部分资料定义为常量。用语部分来自于$data_system。
#==============================================================================
module Vocab
def self.appellation
return Kien::Appellation::APPELLATION_NAME
end
def self.appellation_command_name
return Kien::Appellation::APPELLATION_COMMANDNAME
end
end
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
# 华丽的分割线
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
# Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
APPE_INFO = Struct.new("Appe_Info", :param, :name, :description, :enable)
alias appellation_setup setup
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :appellation_id
attr_reader :appe_gold
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
@appe_hp = 0
@appe_mp = 0
@appe_atk = 0
@appe_def = 0
@appe_spi = 0
@appe_agi = 0
@appe_gold = 0
@appe_exp = 0
appellation_setup(actor_id)
@appellation_list = Kien::Appellation.construct_appe_data(actor_id)
@appellation_id = 0
create_appe_param
end
#--------------------------------------------------------------------------
# ● 获取称号列表
#--------------------------------------------------------------------------
def appellation_list
return @appellation_list
end
#--------------------------------------------------------------------------
# ● 获取称号内容
#--------------------------------------------------------------------------
def appellation
return @appellation_list[@appellation_id]
end
#--------------------------------------------------------------------------
# ● 获取新称号
#--------------------------------------------------------------------------
def get_appellation(id)
@appellation_list[id].enable = true
end
#--------------------------------------------------------------------------
# ● 失去称号
#--------------------------------------------------------------------------
def lose_appellation(id)
return if id == 0
@appellation_list[id].enable = false
if @appellation_id == id
@appllation_id = 0
refresh_appellation
end
end
#--------------------------------------------------------------------------
# ● 更新称号
#--------------------------------------------------------------------------
def refresh_appellation
create_appe_param
@mp = [@mp, self.maxmp].min
@hp = [@hp, self.maxhp].min
end
#--------------------------------------------------------------------------
# ● 更换称号
#--------------------------------------------------------------------------
def change_appellation(appe_id)
@appellation_id = appe_id
refresh_appellation
end
#--------------------------------------------------------------------------
# ● 获取称号内容
#--------------------------------------------------------------------------
def create_appe_param
@appe_hp = 0
@appe_mp = 0
@appe_atk = 0
@appe_def = 0
@appe_spi = 0
@appe_agi = 0
@appe_gold = 0
@appe_exp = 0
if appellation.param.empty?
else
for i in appellation.param
case i[0]
when /HP/i
@appe_hp = i[1]
@appe_hpper = i[2] == nil ? false : true
when /MP/i
@appe_mp = i[1]
@appe_mpper = i[2] == nil ? false : true
when /ATK/i
@appe_atk = i[1]
@appe_atkper = i[2] == nil ? false : true
when /DEF/i
@appe_def = i[1]
@appe_defper = i[2] == nil ? false : true
when /SPI/i
@appe_spi = i[1]
@appe_spiper = i[2] == nil ? false : true
when /AGI/i
@appe_agi = i[1]
@appe_agiper = i[2] == nil ? false : true
when /GOLD/i
@appe_gold = i[1]
@appe_goldper = i[2] == nil ? false : true
when /EXP/i
@appe_exp = i[1]
@appe_expper = i[2] == nil ? false : true
else
next
end
end
end
end
#--------------------------------------------------------------------------
# ● 获取基本体力最大值
#--------------------------------------------------------------------------
alias appellation_base_maxhp base_maxhp
def base_maxhp
n = appellation_base_maxhp
if @appe_hpper == true
n += actor.parameters[0, @level] * @appe_hp / 100
else
n += @appe_hp
end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本魔力最大值
#--------------------------------------------------------------------------
alias appellation_base_maxmp base_maxmp
def base_maxmp
n = appellation_base_maxmp
if @appe_mpper == true
n += actor.parameters[1, @level] * @appe_mp / 100
else
n += @appe_mp
end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
alias appellation_base_atk base_atk
def base_atk
n = appellation_base_atk
if @appe_atkper == true
n += actor.parameters[2, @level] * @appe_atk / 100
else
n += @appe_atk
end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本防御力
#--------------------------------------------------------------------------
alias appellation_base_def base_def
def base_def
n = appellation_base_def
if @appe_defper == true
n += actor.parameters[3, @level] * @appe_def / 100
else
n += @appe_def
end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本精神力
#--------------------------------------------------------------------------
alias appellation_base_spi base_spi
def base_spi
n = appellation_base_spi
if @appe_spiper == true
n += actor.parameters[4, @level] * @appe_spi / 100
else
n += @appe_spi
end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本敏捷
#--------------------------------------------------------------------------
alias appellation_base_agi base_agi
def base_agi
n = appellation_base_agi
if @appe_agiper == true
n += actor.parameters[5, @level] * @appe_agi / 100
else
n += @appe_agi
end
return n
end
#--------------------------------------------------------------------------
# ● 获取经验(获取双倍经验值用)
# exp : 经验值量
# show : 显示等级提示标志
#--------------------------------------------------------------------------
alias appellation_gain_exp gain_exp
def gain_exp(exp, show)
exp += exp * @appe_exp / 100
appellation_gain_exp(exp, show)
end
#--------------------------------------------------------------------------
# ● 升级
#--------------------------------------------------------------------------
alias appellation_level_up level_up
def level_up
appellation_level_up
refresh_appellation
end
end
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
# 处理敌人队伍和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
# 本类的实例请参考 $game_troop。
#==============================================================================
class Game_Troop < Game_Unit
alias appellation_gold_total gold_total
#--------------------------------------------------------------------------
# ● 计算金钱总数
#--------------------------------------------------------------------------
def gold_total
gold = appellation_gold_total
per = $game_party.appe_gold_per
gold += gold * per / 100
return gold
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 处理同伴的类。包含金钱以及物品的信息。本类的实例请参考 $game_party。
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 计算称号金钱获得影响量
#--------------------------------------------------------------------------
def appe_gold_per
per = 0
for member in members
per += member.appe_gold
end
return per
end
end
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
# 华丽的分割线2
# 以下插入指令的方法从KGC的脚本内取出。版权归KGC
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
#==============================================================================
# ■ Window_Command
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# ○ コマンドを追加
# 追加した位置を返す
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# ○ コマンドをリフレッシュ
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# ○ コマンドを挿入
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# ○ コマンドを削除
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
if Kien::Appellation::ADD_APPELLATION_COMMAND == 1
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias create_command_window_appellation create_command_window
def create_command_window
create_command_window_appellation
@command_appellation_index =
@command_window.add_command(Vocab.appellation_command_name)
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# ● コマンド選択の更新
#--------------------------------------------------------------------------
alias update_command_selection_appellation update_command_selection
def update_command_selection
call_distribute_parameter_flag = false
if Input.trigger?(Input::C)
case @command_window.index
when @command_appellation_index # パラメータ振り分け
call_appellation_flag = true
end
end
# パラメータ振り分け画面に移行
if call_appellation_flag
if $game_party.members.size == 0
Sound.play_buzzer
return
end
Sound.play_decision
start_actor_selection
return
end
update_command_selection_appellation
end
#--------------------------------------------------------------------------
# ● アクター選択の更新
#--------------------------------------------------------------------------
alias update_actor_selection_appellation update_actor_selection
def update_actor_selection
if Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when @command_appellation_index # 更换称号。
$scene = Scene_Appellation.new(
@status_window.index,
@command_appellation_index,
Kien::Appellation::ADD_APPELLATION_COMMAND)
return
end
end
update_actor_selection_appellation
end
end
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
# 华丽的分割线3号
# 以下回归原创
#★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 绘制角色称号
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_appellation(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 108, WLH, actor.appellation.name)
end
end
#==============================================================================
# ■ Window_AppellationStatus
#------------------------------------------------------------------------------
# 更换称号时显示角色能力值变化的窗口。
#==============================================================================
class Window_AppellationStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 208, 316)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_face(@actor, 0, WLH * 1)
draw_actor_appellation(@actor, 0, WLH * 2 + 72)
draw_parameter(0, WLH * 3 + 72, 4)
draw_parameter(0, WLH * 4 + 72, 5)
draw_parameter(0, WLH * 5 + 72, 0)
draw_parameter(0, WLH * 6 + 72, 1)
draw_parameter(0, WLH * 7 + 72, 2)
draw_parameter(0, WLH * 8 + 72, 3)
end
#--------------------------------------------------------------------------
# ● 设置装备後的能力值
# new_atk : 装备後的攻击力
# new_def : 装备後的防御力
# new_spi : 装备後的精神力
# new_agi : 装备後的敏捷
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_def, new_spi, new_agi, new_hp, new_mp)
if @new_atk != new_atk or @new_def != new_def or
@new_spi != new_spi or @new_agi != new_agi
@new_atk = new_atk
@new_def = new_def
@new_spi = new_spi
@new_agi = new_agi
@new_hp = new_hp
@new_mp = new_mp
refresh
end
end
#--------------------------------------------------------------------------
# ● 获取装备後的能力值文字颜色
# old_value : 装备前的能力值
# new_value : 装备後的能力值
#--------------------------------------------------------------------------
def new_parameter_color(old_value, new_value)
if new_value > old_value # 增强
return power_up_color
elsif new_value == old_value # 不变
return normal_color
else # 减弱
return power_down_color
end
end
#--------------------------------------------------------------------------
# ● 绘制能力值
# x : 绘制点 X 座标
# y : 绘制点 Y 座标
# type : 能力值 (0:攻击力、1:防御力、2:精神力、3:敏捷)
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
case type
when 0
name = Vocab::atk
value = @actor.atk
new_value = @new_atk
when 1
name = Vocab::def
value = @actor.def
new_value = @new_def
when 2
name = Vocab::spi
value = @actor.spi
new_value = @new_spi
when 3
name = Vocab::agi
value = @actor.agi
new_value = @new_agi
when 4
name = "最大" + Vocab::hp
value = @actor.maxhp
new_value = @new_hp
when 5
name = "最大" + Vocab::mp
value = @actor.maxmp
new_value = @new_mp
end
self.contents.font.color = system_color
self.contents.draw_text(x + 4, y, 80, WLH, name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
if new_value != nil
self.contents.font.color = system_color
self.contents.draw_text(x + 122, y, 20, WLH, ">", 1)
self.contents.font.color = new_parameter_color(value, new_value)
self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
end
end
end
#==============================================================================
# ■ Window_SelectAppellation
#------------------------------------------------------------------------------
# 选择称号的窗口。
#==============================================================================
class Window_SelectAppellation < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
super(208, 0, 336, 316)
@column_max = 2
self.index = 0
self.active = true
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@appellation_list = @actor.appellation_list
@item_max = @appellation_list.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 获取称号
#--------------------------------------------------------------------------
def appellation
return @appellation_list[self.index]
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
appe = @appellation_list[index]
if appe.enable == true
self.contents.font.color = normal_color
self.contents.font.color.alpha = 255
self.contents.draw_text(rect, appe.name, 1)
else
self.contents.font.color = normal_color
self.contents.font.color.alpha = 128
self.contents.draw_text(rect, Kien::Appellation::UNENABLE_NAME, 1)
end
end
end
#==============================================================================
# ■ Window_AppellationData
#------------------------------------------------------------------------------
# 称号说明。
#==============================================================================
class Window_AppellationData < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 316, 544, 100)
@appe = nil
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update(appe)
super()
if appe != @appe
@appe = appe
self.contents.clear
if @appe.enable == true
self.contents.draw_text(0, WLH * 0, 544, WLH, @appe.description)
draw_effect
else
self.contents.draw_text(0, WLH * 0, 544, WLH, "你还没有得到这个称号")
end
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def draw_effect
if @appe.param == nil
self.contents.draw_text(0, WLH * 1, 544, WLH, "无属性")
else
x = 0
line = 1
for effect in @appe.param
case effect[0]
when /HP/i
param = "最大" + Vocab::hp
when /MP/i
param = "最大" + Vocab::mp
when /ATK/i
param = Vocab::atk
when /DEF/i
param = Vocab::def
when /AGI/i
param = Vocab::agi
when /SPI/i
param = Vocab::spi
when /EXP/i
param = "获得经验"
when /GOLD/i
param = "获得金钱"
end
word = effect[1] > 0 ? "+" + effect[1].to_i.to_s : effect[1].to_i.to_s
word = effect[2] == nil ? word : word + "%"
width = contents.text_size(param).width
width += contents.text_size(word).width
if x + width > 544 and line == 1
line = 2
x = 0
end
if x + width > 544 and line == 2
break
end
self.contents.draw_text(x, WLH * line, width, WLH, param)
self.contents.draw_text(x, WLH * line, width, WLH, word, 2)
x += width + 32
end
end
end
end
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# 显示状态画面、完全规格的状态窗口。
#==============================================================================
class Window_Status < Window_Base
alias appellation_refresh refresh
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
appellation_refresh
draw_actor_appellation(@actor, 256, 0)
end
end
#==============================================================================
# ■ Scene_Status
#------------------------------------------------------------------------------
# 处理状态画面的类。
#==============================================================================
class Scene_Status < Scene_Base
if Kien::Appellation::ADD_APPELLATION_COMMAND == 2
alias appellation_start start
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
appellation_start
create_command_window
end
#--------------------------------------------------------------------------
# ● 生成命令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "变更称号"
s2 = "取消"
@command_window = Window_Command.new(128, [s1, s2])
@command_window.active = false
@command_window.openness = 0
@command_window.x = 544 / 2 - 128 / 2
@command_window.y = 416 / 2 - (Window_Base::WLH * 2 + 32) / 2
end
alias appellation_terminate terminate
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
appellation_terminate
@command_window.dispose
end
alias appellation_update update
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
@command_window.update
if @command_window.active
if Input.trigger?(Input::C)
Sound.play_decision
$scene = Scene_Appellation.new(@actor_index)
elsif Input.trigger?(Input::B)
Sound.play_cancel
@command_window.close
@command_window.active = false
return
end
else
if Input.trigger?(Input::C)
Sound.play_decision
@command_window.open
@command_window.active = true
return
end
appellation_update
end
end
end
end
#==============================================================================
# ■ Scene_Appellation
#------------------------------------------------------------------------------
# 处理更换称号的类。
#==============================================================================
class Scene_Appellation < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色 ID
# menu_index : 命令窗口光标初始位置
# host_scene : 上个场景(0..地图, 1..菜单, 2..状态画面)
#--------------------------------------------------------------------------
def initialize(actor_index = 1, menu_index = 0, host_scene = Kien::Appellation::ADD_APPELLATION_COMMAND)
@actor_index = actor_index
@menu_index = menu_index
@host_scene = host_scene
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
create_menu_background
@actor = $game_party.members[@actor_index]
@appellation_status = Window_AppellationStatus.new(@actor)
@appellation_select = Window_SelectAppellation.new(@actor)
@appellation_data = Window_AppellationData.new
create_command_window
end
#--------------------------------------------------------------------------
# ● 生成命令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "装备称号"
s2 = "取消"
@command_window = Window_Command.new(128, [s1, s2])
@command_window.active = false
@command_window.openness = 0
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
@appellation_status.update
@appellation_select.update
@appellation_data.update(@appellation_select.appellation)
@command_window.update
if @appellation_select.active
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
show_command_window
end
elsif @command_window.active
if Input.trigger?(Input::B)
Sound.play_cancel
close_command_window
elsif Input.trigger?(Input::C)
case @command_window.index
when 0
if @appellation_select.index == @actor.appellation_id or @appellation_select.appellation.enable == false
Sound.play_buzzer
return
else
Sound.play_decision
change_appellation
end
when 1
Sound.play_decision
close_command_window
end
end
end
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
@appellation_status.dispose
@appellation_select.dispose
@appellation_data.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 显示命令窗口
#--------------------------------------------------------------------------
def show_command_window
@command_window.x = @appellation_select.index % 2 == 0 ? 208 : 376
@command_window.y = @appellation_select.item_rect(@appellation_select.index).y
if @command_window.y > Window_Base::WLH * 2 + 32
@command_window.y -= Window_Base::WLH * 2 + 32
else
@command_window.y += Window_Base::WLH
end
@command_window.z = 100
@command_window.open
if @appellation_select.index == @actor.appellation_id or @appellation_select.appellation.enable == false
@command_window.draw_item(0, false)
else
@command_window.draw_item(0, true)
end
@command_window.active = true
@appellation_select.active = false
end
#--------------------------------------------------------------------------
# ● 关闭命令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
@command_window.active = false
@appellation_select.active = true
end
#--------------------------------------------------------------------------
# ● 更换称号
#--------------------------------------------------------------------------
def change_appellation
@actor.change_appellation(@appellation_select.index)
@appellation_status.refresh
close_command_window
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
if @host_scene == 1
$scene = Scene_Menu.new(@menu_index)
elsif @host_scene == 2
$scene = Scene_Status.new(@actor_index)
else
$scene = Scene_Map.new
end
end
end
#============================================================================
# ☆ 仿传说称号系统。
# 由feizhaodan制作。
# 发布于66RPG
# [url]http://rpg.blue/[/url]
# 版本号: 1.2.3
# 2011/12/11
# 转载时请连同这里一起转
#============================================================================