Project1
标题:
技能冷卻解除
[打印本页]
作者:
w3860000
时间:
2012-6-26 22:16
标题:
技能冷卻解除
本帖最后由 w3860000 于 2012-6-26 22:19 编辑
这是小弟在某个网站找到的技能冷却脚本...
module Sword
ON = true ; OFF = false ; Sword15_Cooling = Array.new
#● 使用者自定設置
Sword15_XPVX = 1 # 此腳本用於XP時設為0;此腳本用在VX時設為1
Sword15_Battle = 1 # 戰鬥結束時的冷卻狀態,0為不需冷卻;1為記憶;2為需冷卻
Sword15_Menu1 = true # 選單中的技能畫面,是否要顯示剩餘的冷卻時間
Sword15_Menu2 = 0 # 選單中的使用標準,0為一律可用;1為沒冷卻中時可用;
# 2為沒冷卻中時可用(使用後變更為冷卻中);3為一律不可用
Sword15_Enemy = OFF # 敵人使用冷卻技能時,是否需要冷卻
Sword15_Text = ' 剩\V回合才能使用' # 技能冷卻的顯示內容,\V表示剩餘冷卻回合數
#--------------------------------------------------------------
#○ 技能冷卻回合(Sword15_Cooling[技能編號] = 冷卻回合數)
Sword15_Cooling[124] = 6
Sword15_Cooling[123] = 4
Sword15_Cooling[122] = 2
Sword15_Cooling[93] = 3
Sword15_Cooling[91] = 5
Sword15_Cooling[83] = 5
Sword15_Cooling[37] = 2
Sword15_Cooling[62] = 2
Sword15_Cooling[66] = 2
Sword15_Cooling[70] = 2
Sword15_Cooling[72] = 2
Sword15_Cooling[74] = 2
Sword15_Cooling[76] = 2
Sword15_Cooling[78] = 2
Sword15_Cooling[80] = 2
Sword15_Cooling[82] = 2
Sword15_Cooling[118] = 2
Sword15_Cooling[116] = 4
Sword15_Cooling[137] = 3
Sword15_Cooling[136] = 2
Sword15_Cooling[135] = 2
Sword15_Cooling[133] = 4
Sword15_Cooling[132] = 2
Sword15_Cooling[131] = 3
Sword15_Cooling[130] = 2
Sword15_Cooling[129] = 2
Sword15_Cooling[128] = 2
Sword15_Cooling[127] = 2
Sword15_Cooling[126] = 2
Sword15_Cooling[103] = 2
Sword15_Cooling[139] = 5
Sword15_Cooling[142] = 6
Sword15_Cooling[141] = 4
Sword15_Cooling[144] = 4
Sword15_Cooling[1] = 1
Sword15_Cooling[2] = 1
Sword15_Cooling[3] = 1
Sword15_Cooling[117] = 1
Sword15_Cooling[151] = 4
Sword15_Cooling[150] = 4
Sword15_Cooling[149] = 4
Sword15_Cooling[148] = 4
Sword15_Cooling[147] = 4
Sword15_Cooling[146] = 4
Sword15_Cooling[153] = 2
Sword15_Cooling[154] = 4
Sword15_Cooling[155] = 4
Sword15_Cooling[159] = 4
Sword15_Cooling[160] = 4
Sword15_Cooling[161] = 2
Sword15_Cooling[163] = 4
Sword15_Cooling[164] = 4
=begin
========================================
=end
$Sword ? $Sword[15] = 101 : $Sword = {15=>101} # 腳本使用標誌
end
#=======================================
#■ 處理臨時資料的類別
class Game_Temp
attr_accessor :skill_id # 技能編號(選單用)
alias sword15_initialize initialize
def initialize
@skill_id = 0 ; sword15_initialize
end
end
#=======================================
#■ 處理戰鬥者的類別
class Game_Battler
include Sword # 連接自定設置
attr_accessor :cooling # 冷卻技能表
#-------------------------------------------------------------
#● 初始化物件
alias sword15_initialize initialize
def initialize
sword15_initialize
@cooling = {}
Sword15_Cooling.each_index do |index|
next if Sword15_Cooling[index] == nil # 沒設置冷卻時間的技能跳過
if Sword15_Battle == 2 ; @cooling[index] = Sword15_Cooling[index]
else ; @cooling[index] = 0 ; end
end
end
#-------------------------------------------------------------
#● 可以使用技能的判定
alias sword15_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
if Sword15_Enemy or self.is_a?(Game_Actor)
skill_id = skill_id.id if Sword15_XPVX == 1 # 將數據轉成編號(VX)
if (not $game_temp.in_battle) # 不是戰鬥中時
return sword15_skill_can_use?(skill_id) if Sword15_Menu2 == 0 # 一律可用
return false if Sword15_Cooling.has_key?(skill_id) if Sword15_Menu2 == 3
end
return false if self.cooling[skill_id] > 0 if self.cooling[skill_id] # 冷卻技能不可使用
skill_id = $data_skills[skill_id] if Sword15_XPVX == 1 # 將編號轉成數據(VX)
end
sword15_skill_can_use?(skill_id)
end
end
#=======================================
#■ 處理角色的類別
class Game_Actor < Game_Battler
include Sword # 連接自定設置
attr_reader :actor_id # 角色編號
attr_accessor :cooling # 冷卻技能表
#-------------------------------------------------------------
#● 初始化物件
alias sword15_setup setup
def setup(actor_id)
sword15_setup(actor_id)
@cooling = {}
Sword15_Cooling.each_index do |index|
next if Sword15_Cooling[index] == nil # 沒設置冷卻時間的技能跳過
if Sword15_Battle == 2 ; @cooling[index] = Sword15_Cooling[index]
else ; @cooling[index] = 0 ; end
end
end
#-------------------------------------------------------------
#● 變更 SP(XP)
if Sword15_Menu2 == 2 and Sword15_Battle != 0
if Sword15_XPVX == 0 ; alias sword15_sp= sp=
else ; alias sword15_mp= mp= ; end
def sp=(a)
@cooling[$game_temp.skill_id] = Sword15_Cooling[$game_temp.skill_id] if
Sword15_Cooling[$game_temp.skill_id] != nil # 自定設置有設定就設置冷卻回合
self.sword15_sp = a
end
#-----------------------------------------------------------
#● 變更 MP(VX)
def mp=(a)
@cooling[$game_temp.skill_id] = Sword15_Cooling[$game_temp.skill_id] if
Sword15_Cooling[$game_temp.skill_id] != nil # 自定設置有設定就設置冷卻回合
self.sword15_mp = a
end
end
end
#=======================================
#■ 技能畫面、戰鬥畫面、顯示可以使用的技能的瀏覽視窗
class Window_Skill < Window_Selectable
include Sword # 連接自定設置
#-------------------------------------------------------------
#● 描繪項目
alias sword15_draw_item draw_item
def draw_item(index)
if Sword15_Menu1 or $game_temp.in_battle # 允許顯示或戰鬥時的場合
text = '' # 負責存入冷卻內容的變量
if @actor.cooling[@data[index].id] ; if @actor.cooling[@data[index].id] > 0
text = Sword15_Text ; text = text.gsub(/\\[Vv]/) { @actor.cooling[@data[index].id] }
@data[index].name += text
end ; end
end
sword15_draw_item(index)
@data[index].name = @data[index].name.gsub(/#{text}/) { '' }
end
end
#=======================================
#■ 處理戰鬥畫面的類別
class Scene_Battle
include Sword # 連接自定設置
#-------------------------------------------------------------
#● 戰鬥結束
alias sword15_battle_end battle_end
def battle_end(result)
sword15_battle_end(result)
actor = Sword15_XPVX == 0 ? $game_party.actors : $game_party.members
xpvx = Sword15_XPVX == 0 ? 1 : 0
if Sword15_Battle == 0 # 當指定為「不需冷卻」的場合
(0...actor.size).each {|i| $game_actors[actor[i].id].cooling = Hash.new}
elsif Sword15_Battle == 2 # 當指定為「需冷卻」的場合
(0...actor.size).each do |i| ; (1..Sword15_Cooling.size).each do |ii|
$game_actors[actor[i].id].cooling[ii] = Sword15_Cooling[ii] + xpvx if
Sword15_Cooling[ii] != nil # 當有設置冷卻時代入冷卻回合
end ; end
end
end
#-------------------------------------------------------------
#● 產生技能行動結果(XP)
if Sword15_XPVX == 0 ; alias sword15_make_skill_action_result make_skill_action_result
else ; alias sword15_make_skill_action_result execute_action_skill ; end
def make_skill_action_result
#○ 確認敵人是否可使用該技能
skill_id = Sword15_XPVX == 0 ? @active_battler.current_action.skill_id :
@active_battler.action.skill_id # 縮短腳本長度
skill = Sword15_XPVX == 0 ?
$data_skills[@active_battler.current_action.skill_id] :
$data_skills[@active_battler.action.skill_id]
no = false
a = Sword15_XPVX == 0 ?
@active_battler.current_action.forcing : @active_battler.action.forcing
b = Sword15_XPVX == 0 ? skill.id : skill
unless a ; unless @active_battler.skill_can_use?(b)
@phase4_step = 1 if no # 跳轉到階段1
no = true
end ; end
sword15_make_skill_action_result unless no
#○ 設置冷卻回合
return if @active_battler.cooling[skill_id] > 0 if @active_battler.cooling[skill_id] != nil
xpvx = Sword15_XPVX == 0 ? 1 : 0 # XP和VX的回合數值修正
@active_battler.cooling[skill_id] = Sword15_Cooling[skill_id] + xpvx if
Sword15_Cooling[skill_id] != nil # 如果自定設置有設定就設置冷卻回合
$game_temp.forcing_battler = nil if no # 清除強制行動對象
end
#-------------------------------------------------------------
#● 執行戰鬥行動:使用技能(VX)
def execute_action_skill
make_skill_action_result
end
#-------------------------------------------------------------
#● 更新畫面 (主回合步驟 6 : 更新)(XP)
if Sword15_XPVX == 0 ; alias sword15_update_phase4_step6 update_phase4_step6
else ; alias sword15_update_phase4_step6 set_next_active_battler ; end
def update_phase4_step6
sword15_update_phase4_step6
return if @active_battler == nil # 如果行動方是空的就中斷
@active_battler.cooling.each_key do |i|
@active_battler.cooling[i] -= 1 if @active_battler.cooling[i] > 0
end
end
#-------------------------------------------------------------
#● 設置下一戰鬥者行動(VX)
def set_next_active_battler
update_phase4_step6
end
end
#=======================================
#■ 處理技能畫面的類別
class Scene_Skill
include Sword # 連接自定設置
#-------------------------------------------------------------
#● 更新畫面 (技能視窗被活化的情況下) (XP)
if Sword15_XPVX == 0 ; alias sword15_update_skill update_skill
else ; alias sword15_update_skill update_skill_selection ; end
def update_skill
$game_temp.skill_id = @skill_window.skill.id
sword15_update_skill
$game_temp.skill_id = nil if $scene.is_a?(Scene_Skill)
end
#-------------------------------------------------------------
#● 更新技能選擇(VX)
def update_skill_selection
update_skill
end
end
复制代码
可是问题来了......想要解除这个技能冷却的话他没有设开关
而且版主给的方法非常的...
$game_actors[角色編號].cooling[技能編號] = 冷卻回合
我有作转换人物介面的公共事件加总足足有七十个左右的冷却技能
如果真的全部复制贴上的话大概也有70乘上12个人物
我的手指会酸死!!
有没有比较简单的方法啊! dsu_plus_rewardpost_czw
作者:
zdc223658
时间:
2012-6-27 09:36
冷却的话用这个可以实现吧
<recharge x> 该标签表示技能在施放后 x 回合内不能再次使用.
#===============================================================================
# Yanfly Engine RD - Custom Skill Effects ReDONE
# 《自定义技能效果重制版》 简体中文化 by 小爽
#
# 最后更新: 2009.06.01
# 适用人群: 普通玩家、专家和疯子
#
# 本脚本整合了两个不同效果的脚本,导致非常的巨大...
# 但是一定值得你使用。看看下面的功能吧:
#
# - 为每个参战者增加一个怒气值. 每一回合或者每当参战者受到伤害时可以获得怒气,
# 以使用需要怒气值才能发动的技能。同时也可以使用其它消费形式使用技能(不
# 局限于消耗MP才能发动技能,比如HP、金钱、怒气等).
# - 技能延迟:技能可以设置为延迟一定回合后才施放,怪物的技能亦可实现此效果.
# - 技能冷却:技能可以设置成在施放后的一定回合内无法再次施放.
# - 物品合成系统:允许你使用合成的物品,这些物品可以继承原料自带的特殊效果.
# - 子技能菜单:节省技能列表菜单(例如不同级别的法术归类到该法术下的子菜单中).
# - 允许技能立刻施放而不再等待到下个回合.
# - 现在技能可以按指定的顺序依次施放了.
# - 现在技能可以在指定的情况下在战斗中习得了.
#
# - 为脚本狂人量身订制的自定义技能效果. 在施放法术时、蓄力时、吟唱过程中
# 或法术施放后均可自定义技能造成的效果.
# - 为脚本狂人量身订制的自定义技能动画. 可以依据不同的条件为技能设置完全不同的.
# 法术动画.
#===============================================================================
# 更新:
# ----------------------------------------------------------------------------
# o 2009.05.31 - 合成技能和连锁技能现在可以正确地重置消耗了.
# o 2009.05.30 - Scene Battle 恢复兼容性.
# o 2009.05.28 - 更改 <require learn> 为 <not require learn>
# 为 子技能 及 技能链 添加 <require level> 标签.
# o 2009.05.25 - Upgrade Pack 2
# 添加合成物品能力
# 添加瞬发技能
# 添加子技能扩展
# 添加技能链功能
# 添加受到攻击后领悟技能
# o 2009.05.18 - 修正装备技能插槽
# o 2009.05.15 - 修正参战者属性:士气
# o 2009.05.12 - 更高效的技能窗口.
# 添加 <require element x> 标签
# 修复一个惊天大bug:现在怪物们不会因技能消耗我们的金钱了-,-.
# o 2009.04.22 - 现在怪物们也将受到如下效果的影响:重载、预备及次数限制
# 反射现在能正确反弹伤害给对立的队伍了,反弹给怪物或者被反弹回来.
# o 2009.04.19 - Upgrade Pack 1
# 添加怒气值增速修改选项.
# 添加无法被反弹的技能属性.
# 添加技能消费值修改选项.
# 为狂人们添加了技能链功能.
# o 2009.04.15 - 添加 Scene_Skill 功能. 我居然会忘记这个.
# 修正参战者在MP不符合时依然可以使用技能.
# Added another return for cost_custom.
# 为重载添加特性.
# o 2009.04.14 - 更新兼容 KGC 装备后习得技能脚本.
# 添加一个爆击后等待时间的选项.
# Added common before, common during, and common after effects.
# Added calc_common_cost.
# o 2009.04.12 - 本次更新整合了自定义技能脚本.
# 添加一个施法时间参数用于装载技能.
# 爆击信息不再占用一整行的信息窗口了.
# o 2009.04.09 - 注意:这些最初是为自定义技能功能使用的.
# 添加诸如“当前MP、最大MP百分比、当前HP、最大HP百分比、金钱、
# 最大金钱百分比、自定义消费类型和脚本模板”用于技能的消耗.
# 添加怒气系统.
# 0 2009.02.18 - 完成第一版脚本.
#===============================================================================
# 使用方法: 正常模式
#===============================================================================
#
# 将下列需要的标签插入到数据库——技能——备注栏里. 一次可以填入多个标签
# 并由上至下执行.
# 但是你不能填入两个功能相反的标签.
#
# <cost curmp x> 该标签表示技能消费的MP值 x ,最大为9999.
# <cost maxmp x> 该标签表示技能消费占最大MP值的百分比 x %.
# <cost curhp x> 该标签表示技能消费的HP值 x ,会造成使用者 x 点的伤害.
# <cost maxhp x> 该标签表示技能消费占最大HP值的百分比 x %,并造成使用者 x %
# 最大血量的伤害.
# <cost gold x> 该标签表示技能消费的金币值 x.
# <cost maxgold x> 该标签表示技能消费占最大(当前)金币值的 x %.
# <cost rage x> 该标签表示技能消费的怒气值 x.
# <rage boost x> 该标签表示使用技能获得的怒气值 x.
#
#===============================================================================
# 使用方法: 专家模式
#===============================================================================
#
# 将下列需要的标签插入到数据库——技能——备注栏里. 它们不会被优先执行,
# 但是无论本回合技能是否被施放都将产生标签代表的效果.
#
# <prepare x> 该标签表示技能会在战斗开始后 x 回合后施放(准备时间).
# <cast time x> 该标签表示技能施法时间为 x 回合.
# <fatigue x> 该标签表示人物在施放技能后会存在 x 回合的虚弱时间(无法操作).
# <recharge x> 该标签表示技能在施放后 x 回合内不能再次使用.
# <limit uses x> 该标签表示技能在本次战斗中只能使用 x 次.
#
# ----------------------------------------------------------------------------
# 以下为技能的特殊效果
# ----------------------------------------------------------------------------
#
# <require all elements x> 及 <require all elements x,x>
# 带有该标签的技能必须在玩家的武器属性中拥有 x 元素属性才能发动(需同时满足).
# 比如技能 火球术 必须装备了火属性的武器后发动. 你需要首先为武器设置好属性.
# 可以同时使用多个这样的标签.
#
# <require any elements x> 及 <require any elements x,x>
# 带有该标签的技能必须在玩家的武器属性中拥有 x 元素属性才能发动(任意一个).
# 比如技能 冰火球术 可以在装备有冰属性武器或火属性武器的情况下发动.
#
# <require all states x> 及 <require all states x,x>
# 带有该标签的技能必须在玩家获得所有状态 x 后才能使用.
#
# <not require learn>
# 这个标签修改自 <require learn> ,子技能和技能链专用标签.
# 默认情况下,技能必须在技能窗口中可习得的状态下学习到. 使用这个标签后
# 子技能和技能链属性的技能就无需学习了.
#
# <require level x>
# 带有该标签的技能只有在玩家等级到达 x 时才会显示在子技能或技能链的窗口中.
# 这不会改变学习此技能所需要的等级.
#
# <unreflectable>
# 带有该标签的技能将无视施放对象所拥有的反弹法术状态.
#
# <mix items all>
# 允许玩家合成物品并获得新的物品特效,此标签表示所有队伍角色拥有的物品都可以
# 参与合成,但是那些被标注为 <do not mix> 的除外.
#
# <mix type x> or <mix type x,x>
# 允许玩家合成类型为 x 的物品,持有同类标签的物品可以参与合成,你可以插入更多
# 不同的类型标签来获得更多的合成方式,或者使用 <mix type x,x> .
#
# <do not mix>
# 带有该标签的物品显然不会参与任何合成,可以使用在任务物品或者其它关键物品上.
#
# <instant cast>
# 带有该标签的法术会在选择后立刻使用而不再按顺序施放.
#
# <subskills x> or <subskills x,x>
# 带有该标签的技能在从技能窗口被点击时将弹出子技能菜单,里面存储着id为x的技能.
# 这些技能也许是玩家已经学会的子技能,也可以是尚未学会或压根不可能学到的技能.
#
# <subskill only>
# 带有该标签的技能只会显示在子技能窗口中(可以理解为需要前置技能).
#
# <open chain x>
# 自由技能链,允许你一次选择 x 个技能连续施放,这些技能师你已经学会的,包括但
# 不限于暂时无法使用的技能。
#
# <closed chain x:y> or <closed chain x:y,y>
# 闭合技能链,与自由技能链的区别是,你需要指定处于技能链中的技能类型 y,只有该
# 类型的技能才会显示在技能链选择菜单中.类型的指定使用下列标签.
#
# <closed type x> or <closed type x,x>
# 带有该标签的技能可以被闭合技能链调用组成连续技,x 可以是数字或其它容易辨识的
# 字符,被标识相同类型的技能可以被闭合技能链调用,如<closed type 1,2> 可以被
# <closed chain 5:1> 或者<closed chain 4:1,2>调用.
#
# <forced chain x:y,y>
# 强制技能链,与闭合技能链的区别是,除了要符合闭合技能链的要求外,可以忽略
# 使用者是否学会了技能链中的技能而强行使用它们,但是标注为 <require learn>
# 的技能除外 .
#
# <reselect chain>
# 允许处于技能链反射已选定的技能.
#
# <unchainable>
# 带有该标签的技能无法组建技能链.
#
# <hit learn actor x> 及 <hit learn actor x,x>
# <hit learn class x> 及 <hit learn class x,x>
# 带有此标签的技能击中后将导致玩家 x 习得该技能,可以指定多个玩家,但是只有被.
# 击中的玩家才能习得.class代表拥有本组法术类别的玩家可以习得,比如法师可以习得
# 怪物的3级火球术之类.
#
# ----------------------------------------------------------------------------
# 以下为状态的特殊效果
# ----------------------------------------------------------------------------
# 下面的某些效果必须设置正确,才能配合上述的一些技能产生特效
#
# <reflect>
# 将法术反射给施法者,但是法术免疫反弹例外(免疫反射标签).
#
# <rage boost per x>, <rage boost add x>, <rage boost sub x>
# 增加或减少参数 x 的怒气,第一个按百分比增加 x% 怒气,第二个直接增加x点怒气,
# 第三个减去 x 点怒气,下同.
# <cost hp per x> <cost hp add x> <cost hp sub x>
# <cost mp per x> <cost mp add x> <cost mp sub x>
# <cost gold per x> <cost gold add x> <cost gold sub x>
# <cost maxgold per x> <cost maxgold add x> <cost maxgold sub x>
# <cost rage per x> <cost rage add x> <cost rage sub x>
#
#
#===============================================================================
#
# 兼容性:
# - 兼容于: KGC_OnScreenStatus, KGC_Steal
# - 兼容于: Yanfly's Battler Stat: Morale
# - Alias: Game_Actor, setup
# - Alias: Game_Battler, inputable?, attack_effect, skill_effect
# - Alias: Game_BattleAction, valid?
# - Alias: Game_Enemy, initialize
# - Alias: Scene_Battle, process_battle_start, display_hp_damage, execute_action
# - Alias: Scene_Skill, use_skill_nontarget
# - Overwrites: Game_Battler, calc_mp_cost, skill_can_use?
# - Overwrites: Scene_Battle, execute_action_skill, display_action_effects
# - Overwrites: Scene_Skill, apply_skill_cost
#
#===============================================================================
$imported = {} if $imported == nil
$imported["CustomSkillEffects"] = true
module YE
module BATTLE
#-------------------------------------------------------------------------
# 基本性能
#-------------------------------------------------------------------------
# 这里设置默认信息及爆击信息的等待时间.
MSGWAIT = 60
CRITWAIT = 30
# 这里设置技能消费的种类所使用的图标,比如代表这个技能使用的是怒气的图标
USE_ICONS = true # 图标开关
MP_ICON = 100 # 消耗法力值技能的图标.
HP_ICON = 99 # 消耗体力值技能的图标.
GOLD_ICON = 205 # 消耗金币值技能的图标.
WINCOLUMN = 2 # 技能窗口分栏数量.
# 如果你不准备使用图标, 那么必须将下列信息填写完整以便区分技能消费类型.
MP_COST = "%d MP" # 消耗 %d 法力值,只修改“MP”的名称即可,下同.
HP_COST = "%d HP" # 消耗 %d 体力值.
GOLD_COST = "%d Gold" # 消耗 %d 金币.
MGOLD_COST = "%d%% Gold" # 消耗百分之 %d 的金币值.
# 这个开关可以控制在使用消费HP技能时是否无视玩家的生命值过少?
ALLOW_DEATH_HP_COST = false
# 这里设置怒气系统,包括怒气的获取方式.
INC_RAGE_ATTACK = true # 每次攻击获得.
NUM_RAGE_ATTACK = 2 # 每次攻击获得量.
INC_RAGE_DAMAGED = true # 受到攻击获取.
NUM_RAGE_DAMAGED = 1 # 受到攻击获得量.
INC_RAGE_SKILL = true # 使用技能时获得.
NUM_RAGE_SKILL = 1 # 每次使用技能获得量.
RAGE_ICON = 132 # 代表消费怒气值的技能的类别图标.
RAGE_COST = "%d Rage" # 技能消费 %d 怒气值.
MAX_RAGE = 12 # 怒气的最大值.
RAGE_RESET_BATTLE = true # 每场战斗怒气归零.
# 这里设置那些需要吟唱时间的技能在信息框显示的信息及播放的音效.
CHARGE_MSG = "%s 开始吟唱 %s!" # 开始吟唱
CHARGE_CON = "%s 持续吟唱 %s!" # 正在吟唱
CHARGE_SND = RPG::SE.new("Up", 80, 100) # 音效名称
# 这里设置使用蓄力法术时是否替换消费图标,需要显示的信息和图标.
REPLACE_ICON_RECHARGE = true # 图标开关
RECHARGE_ICON = 142 # 图标id
RECHARGE_MSG = "%d Turns" # 蓄力回合数
RECHARGE_MSG1 = "%d Turn" # 蓄力回合数
# 这里设置虚弱,施法后获得虚弱属性,无法再次行动直到状态消失.
FATIGUE_MSG = "%s 变得虚弱了." # 虚弱信息
FATIGUE_SND = RPG::SE.new("Down", 80, 100) # 音效
# 这里设置使用次数限制的技能,每场战斗可使用的次数,并且在消耗完所有次数后
# 使用新图标代替同时显示警告信息.
REPLACE_ICON_USAGE = true # 图标开关
USAGE_ICON = 143 # 图标id
USAGE_MSG = "Can't Use" # 显示信息
# 这里设置技能被反射时显示效果.
REFLECT_MSG = "%s 反射了 %s." # 反射提示
REFLECT_SND = RPG::SE.new("Flash2", 80, 100) # 音效
#-------------------------------------------------------------------------
# 物品合成
#-------------------------------------------------------------------------
# 下列规则约束了物品的合成,规则的合理性直接决定了合成系统的成败,GoodLucy.
# 物品合成成功的音效.
SUCCESSFUL_ITEM_MIX = RPG::SE.new("Decision2", 80, 150)
# 缺少原料的提示信息.
NOT_ENOUGH_ITEMS = "缺少足够的原料."
ITEM_COLOUR1 = 14 # 第一件物品被选择时的颜色.
ITEM_COLOUR2 = 14 # 第二件物品被选择时的颜色.
ITEM_COLOUR3 = 18 # 一件物品被重复选取时的颜色.
# 以下规定了如果合成物品不存在于哈希表中,那么系统将自动从下列两种类型中
# 随机选取一种技能,请不要删除 type 0 及其中至少保留一个技能 id,如果
# 如果随机类型不存在,那么默认使用 type 0.
RANDOM_ITEM_MIX_TYPES ={
# 类型 => [技能 id]
0 => [15, 17, 19, 21, 23, 25],
2 => [ 9, 10, 11, 12, 13, 14],
} # 请勿删除本规则.
# 此哈希表规定了各物品合成后获得何种技能的效果,物品合成表是双向的,
# 也就是说你不必为了一个相反的合成规则订立新的规则.
# 在合成结果中填入一个或多个技能 id,表示合成物会拥有其中之一的技能效果.
ITEM_MIX_COMBO_HASH ={
# [Item, Item] => [Skill.ID Result]
[ 15, 15] => [60], # 例:火球术卷轴 + 火球术卷轴 = 2级火球术
[ 15, 16] => [60, 62], # 火球术卷轴 + 火焰卷轴 = 2级火球术或2级火焰术
[ 16, 16] => [62], # 下同,略
[ 17, 17] => [64], #
[ 17, 18] => [64, 66], #
[ 18, 18] => [66], #
[ 19, 19] => [68], #
[ 19, 20] => [68, 70], #
[ 20, 20] => [70], #
} # 请勿删除本规则.
#-------------------------------------------------------------------------
# 攻击后习得技能
#-------------------------------------------------------------------------
# 以下规定了攻击技能发动后习得其他技能的规则.只有玩家有此功能.
HIT_LEARN_MESSAGE = "%s 领悟了 %s!" # 习得新技能信息
SUBCLASS_HIT_LEARN = true # 如果你开启了子技能系统这里也保持开启.
#-------------------------------------------------------------------------
# 技能链
#-------------------------------------------------------------------------
# 以下设定为如何在技能链窗口中显示已选择的技能链中的所有技能.
CHAIN_MAX_TEXT = "%d/%d"
end
end
#===============================================================================
# 使用方法:脚本狂人!本节未翻译,有能力写脚本的无需我画蛇添足吧.原文意思更明确
#===============================================================================
#
# 你可以使用 YE::BATTLE::MSGWAIT 自由定义信息等待时间. 如果你确定你需要文字信息
# 延迟一些时间显示,请使用下面的代码.
# msgwait
#
# <effect before x>
# Adding that tag into the notebox of a skill would give it the extra effect
# before the damage is dealt. Find "def effect_before" to begin adding in your
# own before skill effects. "def common_before" will occur for each skill
# regardless of BSE tags. Input those common before effects there.
#
# <effect charge x>
# This can only occur when the skill is one that requires charging. This is here
# mainly because chargable skills don't activate any before, during, or after
# effects and that sometimes, scripters would like to produce effects simply
# from charing a skill. "def common_charge" will occur for each charge skill.
#
# <effect during x>
# Adding that tag into the notebox of a skill would give it the extra effect
# during the damage being dealt. Note that the damage still takes place, but
# the extra effect will occur in between each enemy taking damage. To use this,
# find "def effect_during" to begin adding in your own during skill effects.
# "def common_during" will occur for each skill regardless of DSE tags. Input
# those common during effects there.
#
# <effect after x>
# Adding that tag into the notebox of a skill would give it the extra effect
# after the damage is dealt. Find "def effect_after" to begin adding in your own
# after skill effects. "def common_after" will occur for each skill regardless
# of ASE tags. Input those common during effects there.
#
# <custom ani x>
# Adding that tag into the notebox of a skill would allow it to have conditional
# skill animations played. You can choose what animations would be played and
# under what conditions. Find "def custom_ani" to begin adding in your own
# conditional skill animations.
#
# <cost custom x>
# Adding that tag into the notebox of a skill would allow it to have different
# (and conditional) costs. Follow the template and you should be okay regarding
# how it's composed. Find "cost_custom" to change the visual aspects of the
# costs and "apply_custom_cost" for the mechanical aspects. The new definition
# "def calc_cost_common" will alter costs regardless of their type.
#
#===============================================================================
class Scene_Battle < Scene_Base
def effect_before(skill, beforeskill)
line_number = @message_window.line_number
case beforeskill
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own before skill effects.
#---------------------------------------------------------------------------
when 1
@active_battler.maxmp = 10000
@active_battler.mp = 10000
sound = RPG::SE.new("Item2", 80, 100)
sound.play
refresh_onscreenstatus # if KGC_OnScreenStatus is imported
text = sprintf("%s 感到全身充满了能量.", @active_battler.name)
@message_window.add_instant_text(text)
msgwait
@message_window.back_to(line_number)
when 2
when 3
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
end
#-----------------------------------------------------------------------------
#-----This is the common before effect. It'll occur regardless of BSE tagging.
def common_before(skill)
end
#-----------------------------------------------------------------------------
def effect_charge(skill, chargeskill)
line_number = @message_window.line_number
case chargeskill
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own charge skill effects.
#---------------------------------------------------------------------------
when 1
#
when 2
when 3
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
end
#-----------------------------------------------------------------------------
#-----This is the common charge effect. It'll occur regardless of CSE tagging.
def common_charge(skill)
end
#-----------------------------------------------------------------------------
def effect_during(target, skill, duringskill)
line_number = @message_window.line_number
case duringskill
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own during skill effects.
#---------------------------------------------------------------------------
when 1
target.maxmp = 0
target.mp = 0
sound = RPG::SE.new("Bow2", 80, 100)
sound.play
text = sprintf("%s 失去了能量!", target.name)
@message_window.add_instant_text(text)
msgwait
when 2
target.hp = 1
sound = RPG::SE.new("Down", 80, 100)
sound.play
text = sprintf("%s 快要死了!", target.name)
@message_window.replace_instant_text(text)
when 3
#@active_battler.remove_state(17)
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
end
#-----------------------------------------------------------------------------
#-----This is the common during effect. It'll occur regardless of DSE tagging.
def common_during(target, skill)
#---
if skill == nil
# Regular Attack
else
# Skill Effect
end
#---
end
#-----------------------------------------------------------------------------
def effect_after(skill, afterskill)
line_number = @message_window.line_number
case afterskill
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own after skill effects.
#---------------------------------------------------------------------------
when 1
@active_battler.maxhp = 10000
@active_battler.hp = 10000
sound = RPG::SE.new("Item1", 80, 100)
sound.play
refresh_onscreenstatus # if KGC_OnScreenStatus is imported
text = sprintf ("%s 此刻已经无敌!", @active_battler.name)
@message_window.add_instant_text(text)
msgwait
@message_window.back_to(line_number)
when 2
when 3
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
end
#-----------------------------------------------------------------------------
#-----This is the common after effect. It'll occur regardless of ASE tagging.
def common_after(skill)
end
#-----------------------------------------------------------------------------
def custom_ani(targets, customani)
case customani
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own custom skill animations.
#---------------------------------------------------------------------------
when 1
# Plays a fire sword animation if user's current HP is above 50%.
if @active_battler.hp > (@active_battler.maxhp / 2)
display_normal_animation(targets, 8)
else
display_normal_animation(targets, 7)
end
when 2
when 3
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
wait(20)
wait_for_animation
end
end # Scene_Battle
class Game_Battler
def cost_custom(skill, return_value)
cost_icon = 0
cost_name = ""
cost_name2 = ""
cost_value = 0
can_use = true
skill_case = skill.cost_custom
case skill_case
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin editting your own custom costs.
#---------------------------------------------------------------------------
when 1
cost_icon = 1
cost_name = "Mastery"
cost_name2 = "Mastery Requirement"
cost_value = 10
if cost_value > $game_variables[1]
can_use = false
end
when 2
cost_icon = 64
cost_name = "Pots"
cost_name2 = "Requires"
cost_value = 3
if cost_value > $game_party.item_number($data_items[1])
can_use = false
end
when 3
cost_icon = 65
cost_name = "Ether"
cost_name2 = "Requires"
cost_value = 0
if cost_value > $game_party.item_number($data_items[1])
can_use = false
end
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
return cost_icon if return_value == 1
return cost_name if return_value == 2
return cost_value if return_value == 3
return can_use if return_value == 4
return cost_name2 if return_value == 5
end
#-----------------------------------------------------------------------------
#-----This is where all undergo one final cost calculation before returning.
def calc_cost_common(cost, skill)
return cost
end
#-----------------------------------------------------------------------------
end # Game_Battler
class Scene_Battle < Scene_Base
def apply_custom_cost(battler, skill)
skill_case = skill.cost_custom
case skill_case
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you perform the custom costs.
#---------------------------------------------------------------------------
when 1
$game_variables[1] -= 10
when 2
$game_party.gain_item($data_items[1], -3)
when 3
$game_party.gain_item($data_items[1], -1)
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
end
end # Scene_Battle
#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.大意就是:下有电缆,高压危险 :)
#===============================================================================
module YE
module REGEXP
module BASEITEM
# 技能消费.
COST_CURMP = /<(?:COST_CURMP|cost curmp|cost cur mp)[ ]*(\d+)>/i
COST_MAXMP = /<(?:COST_MAXMP|cost maxmp|cost max mp)[ ]*(\d+)>/i
COST_CURHP = /<(?:COST_CURMP|cost curhp|cost cur hp)[ ]*(\d+)>/i
COST_MAXHP = /<(?:COST_MAXMP|cost maxhp|cost max hp)[ ]*(\d+)>/i
COST_GOLD = /<(?:COST_GOLD|cost gold)[ ]*(\d+)>/i
COST_MGOLD = /<(?:COST_MAXGOLD|cost maxgold|cost max gold)[ ]*(\d+)>/i
COST_RAGE = /<(?:COST_RAGE|cost rage)[ ]*(\d+)>/i
RAGE_BOOST = /<(?:RAGE_BOOST|rage boost)[ ]*(\d+)>/i
COST_CUSTOM = /<(?:COST_CUSTOM|cost custom)[ ]*(\d+)>/i
# 其他技能特性.
UNREFLECT = /<(?:UNREFLECT|unreflectable)>/i
REQUIRE_LEVEL = /<(?:REQUIRE_LEVEL|require level)[ ]*(\d+)>/i
REQUIRE_LEARN = /<(?:NOT_REQUIRE_LEARN|not require learn)>/i
REQUIRE_ELE_ALL =
/<(?:REQUIRE_ALL_ELEMENTS|require all elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
REQUIRE_ELE_ANY =
/<(?:REQUIRE_ANY_ELEMENTS|require any elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
REQUIRE_STATE_ALL =
/<(?:REQUIRE_ALL_STATES|require all states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
REQUIRE_STATE_ANY =
/<(?:REQUIRE_ANY_STATES|require any states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
MIX_ITEMS_ALL = /<(?:MIX_ITEMS_ALL|MIX_TYPE_ALL|mix items all|mix type all)>/i
MIX_ITEMS = /<(?:MIX_TYPE|mix type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
DONT_MIX = /<(?:DONT_MIX|DO_NOT_MIX|dont mix|do not mix)>/i
INSTANT_CAST = /<(?:INSTANT_CAST|instant cast)>/i
SUBSKILLS = /<(?:SUBSKILLS|sub skills)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SUBSKILL_ONLY = /<(?:SUBSKILL_ONLY|subskill only)>/i
# 攻击习得技能特性
HIT_LEARN_ACTOR = /<(?:HIT_LEARN_ACTOR|hit learn actor)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
HIT_LEARN_CLASS = /<(?:HIT_LEARN_CLASS|hit learn class)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
# 技能链特性
UNCHAINABLE = /<(?:UNCHAINABLE|nonchainable)>/i
RESELECT_CHAIN = /<(?:RESELECTABLE|reselect chain)>/i
OPEN_CHAIN = /<(?:OPEN_CHAIN|open chain)[ ]*(\d+)>/i
CLOSED_CHAIN = /<(?:CLOSED_CHAIN|closed chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i
CLOSED_TYPE = /<(?:CLOSED_TYPE|closed type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
FORCED_CHAIN = /<(?:FORCED_CHAIN|forced chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i
# 其它技能.
CAST_TIME = /<(?:CAST_TIME|cast time)[ ]*(\d+)>/i
RECHARGE = /<(?:RECHARGE|cooldown)[ ]*(\d+)>/i
LIMITUSES = /<(?:LIMIT_USES|limit uses)[ ]*(\d+)>/i
FATIGUEVAL = /<(?:FATIGUE|tired)[ ]*(\d+)>/i
PREPARE = /<(?:PREPARE|warmup)[ ]*(\d+)>/i
# 自定义技能特效.
EFFECT_BEFORE = /<(?:EFFECT_BEFORE|effect before|before effect|bse)[ ]*(\d+)>/i
EFFECT_CHARGE = /<(?:EFFECT_CHARGE|effect charge|charge effect|cse)[ ]*(\d+)>/i
EFFECT_DURING = /<(?:EFFECT_DURING|effect during|during effect|dse)[ ]*(\d+)>/i
EFFECT_AFTER = /<(?:EFFECT_AFTER|effect after|after effect|ase)[ ]*(\d+)>/i
# 技能动画条件.
CUSTOM_ANI = /<(?:CUSTOM_ANI|custom ani|custom animation|csa)[ ]*(\d+)>/i
end #module BASEITEM
module STATE
# 技能参数.
REFLECT = /<(?:REFLECT|reflectable)>/i
RAGE_BOOST_PER = /<(?:RAGE_BOOST_PER|rage boost per)[ ]*(\d+)>/i
RAGE_BOOST_ADD = /<(?:RAGE_BOOST_ADD|rage boost add)[ ]*(\d+)>/i
RAGE_BOOST_SUB = /<(?:RAGE_BOOST_SUB|rage boost sub)[ ]*(\d+)>/i
# 技能消耗修正.
COST_HP_PER = /<(?:COST_HP_PER|cost hp per)[ ]*(\d+)>/i
COST_HP_ADD = /<(?:COST_HP_ADD|cost hp add)[ ]*(\d+)>/i
COST_HP_SUB = /<(?:COST_HP_SUB|cost hp sub)[ ]*(\d+)>/i
COST_MP_PER = /<(?:COST_MP_PER|cost mp per)[ ]*(\d+)>/i
COST_MP_ADD = /<(?:COST_MP_ADD|cost mp add)[ ]*(\d+)>/i
COST_MP_SUB = /<(?:COST_MP_SUB|cost mp sub)[ ]*(\d+)>/i
COST_GOLD_PER = /<(?:COST_GOLD_PER|cost gold per)[ ]*(\d+)>/i
COST_GOLD_ADD = /<(?:COST_GOLD_ADD|cost gold add)[ ]*(\d+)>/i
COST_GOLD_SUB = /<(?:COST_GOLD_SUB|cost gold sub)[ ]*(\d+)>/i
COST_MAXG_PER = /<(?:COST_MAXGOLD_PER|cost maxgold per)[ ]*(\d+)>/i
COST_MAXG_ADD = /<(?:COST_MAXGOLD_ADD|cost maxgold add)[ ]*(\d+)>/i
COST_MAXG_SUB = /<(?:COST_MAXGOLD_SUB|cost maxgold sub)[ ]*(\d+)>/i
COST_RAGE_PER = /<(?:COST_RAGE_PER|cost rage per)[ ]*(\d+)>/i
COST_RAGE_ADD = /<(?:COST_RAGE_ADD|cost rage add)[ ]*(\d+)>/i
COST_RAGE_SUB = /<(?:COST_RAGE_SUB|cost rage sub)[ ]*(\d+)>/i
end # STATE
end # REGEXP
end # YE
#===============================================================================
# RPG::State
#===============================================================================
class RPG::State
#--------------------------------------------------------------------------
# Yanfly_Cache_CSE
#--------------------------------------------------------------------------
def yanfly_cache_state_cse
@reflect = false; @rage_boost_per = 100; @rage_boost_set = 0
@cost_hp_per = 100; @cost_hp_set = 0; @cost_mp_per = 100; @cost_mp_set = 0
@cost_gold_per = 100; @cost_gold_set = 0; @cost_maxgold_per = 100;
@cost_maxgold_set = 0; @cost_rage_per = 100; @cost_rage_set = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when YE::REGEXP::STATE::REFLECT
@reflect = true
when YE::REGEXP::STATE::RAGE_BOOST_PER
@rage_boost_per = $1.to_i
when YE::REGEXP::STATE::RAGE_BOOST_ADD
@rage_boost_set = $1.to_i
when YE::REGEXP::STATE::RAGE_BOOST_SUB
@rage_boost_set = $1.to_i * -1
when YE::REGEXP::STATE::COST_HP_PER
@cost_hp_per = $1.to_i
when YE::REGEXP::STATE::COST_HP_ADD
@cost_hp_set = $1.to_i
when YE::REGEXP::STATE::COST_HP_SUB
@cost_hp_set = $1.to_i *-1
when YE::REGEXP::STATE::COST_MP_PER
@cost_mp_per = $1.to_i
when YE::REGEXP::STATE::COST_MP_ADD
@cost_mp_set = $1.to_i
when YE::REGEXP::STATE::COST_MP_SUB
@cost_mp_set = $1.to_i * -1
when YE::REGEXP::STATE::COST_GOLD_PER
@cost_gold_per = $1.to_i
when YE::REGEXP::STATE::COST_GOLD_ADD
@cost_gold_set = $1.to_i
when YE::REGEXP::STATE::COST_GOLD_SUB
@cost_gold_set = $1.to_i * -1
when YE::REGEXP::STATE::COST_MAXG_PER
@cost_maxgold_per = $1.to_i
when YE::REGEXP::STATE::COST_MAXG_ADD
@cost_maxgold_set = $1.to_i
when YE::REGEXP::STATE::COST_MAXG_SUB
@cost_maxgold_set = $1.to_i * -1
when YE::REGEXP::STATE::COST_RAGE_PER
@cost_rage_per = $1.to_i
when YE::REGEXP::STATE::COST_RAGE_ADD
@cost_rage_set = $1.to_i
when YE::REGEXP::STATE::COST_RAGE_SUB
@cost_rage_set = $1.to_i * -1
end
}
end # end yanfly_cache_state_cse
#--------------------------------------------------------------------------
# 反射
#--------------------------------------------------------------------------
def reflect
yanfly_cache_state_cse if @reflect == nil
return @reflect
end
#--------------------------------------------------------------------------
# 怒气获得情况
#--------------------------------------------------------------------------
def rage_boost_per
yanfly_cache_state_cse if @rage_boost_per == nil
return @rage_boost_per
end
def rage_boost_set
yanfly_cache_state_cse if @rage_boost_set == nil
return @rage_boost_set
end
#--------------------------------------------------------------------------
# 消费体力情况
#--------------------------------------------------------------------------
def cost_hp_per
yanfly_cache_state_cse if @cost_hp_per == nil
return @cost_hp_per
end
def cost_hp_set
yanfly_cache_state_cse if @cost_hp_set == nil
return @cost_hp_set
end
#--------------------------------------------------------------------------
# 消费法力情况
#--------------------------------------------------------------------------
def cost_mp_per
yanfly_cache_state_cse if @cost_mp_per == nil
return @cost_mp_per
end
def cost_mp_set
yanfly_cache_state_cse if @cost_mp_set == nil
return @cost_mp_set
end
#--------------------------------------------------------------------------
# 消费金币的技能
#--------------------------------------------------------------------------
def cost_gold_per
yanfly_cache_state_cse if @cost_gold_per == nil
return @cost_gold_per
end
def cost_gold_set
yanfly_cache_state_cse if @cost_gold_set == nil
return @cost_gold_set
end
#--------------------------------------------------------------------------
# 消费最大金币
#--------------------------------------------------------------------------
def cost_maxgold_per
yanfly_cache_state_cse if @cost_maxgold_per == nil
return @cost_maxgold_per
end
def cost_maxgold_set
yanfly_cache_state_cse if @cost_maxgold_set == nil
return @cost_maxgold_set
end
#--------------------------------------------------------------------------
# 消费怒气情况
#--------------------------------------------------------------------------
def cost_rage_per
yanfly_cache_state_cse if @cost_rage_per == nil
return @cost_rage_per
end
def cost_rage_set
yanfly_cache_state_cse if @cost_rage_set == nil
return @cost_rage_set
end
end # end RPG::State
#===============================================================================
# RPG::BaseItem
#===============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# Yanfly_Cache_CSE
#--------------------------------------------------------------------------
def yanfly_cache_baseitem_cse
@unreflectable = false; @bse = 0; @cse = 0; @dse = 0; @ase = 0; @csa = 0
@cur_mp_cost = 0; @max_mp_cost = 0; @cur_hp_cost = 0; @max_hp_cost = 0
@gold_cost = 0; @maxgold_cost = 0; @rage_cost = 0; @cost_custom = 0
@cast_time = 0; @recharge = 0; @prepare = 0; @usage = 0; @rage_boost = 0
@fatigue = 0; @mix_items = false; @mix_types = []; @mix_items_all = false;
@dont_mix = false; @subskills = []; @instant_cast = false
@hit_learn_actor = []; @hit_learn_class = []; @hit_learnable = false
@subskill_only = false; @require_learn = true
@required_all_elements = []; @required_any_elements = []; @require_level = 0
@required_all_states = []; @required_any_states = []
@unchainable = false; @reselect_chain = false; @closed_type = []
@chain_type = 0 # 0:none 1:open 2:limit 3:forced
@chain_times = 0; @chain_array = []
self.note.split(/[\r\n]+/).each { |line|
case line
when YE::REGEXP::BASEITEM::UNREFLECT
@unreflectable = true
when YE::REGEXP::BASEITEM::REQUIRE_LEVEL
@require_level = $1.to_i
when YE::REGEXP::BASEITEM::REQUIRE_LEARN
@require_learn = false
when YE::REGEXP::BASEITEM::REQUIRE_ELE_ALL
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@required_all_elements.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::REQUIRE_ELE_ANY
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@required_any_elements.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::REQUIRE_STATE_ALL
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@required_all_states.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::REQUIRE_STATE_ANY
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@required_any_states.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::MIX_ITEMS
@instant_cast = false
@mix_items = true
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@mix_types.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::MIX_ITEMS_ALL
@instant_cast = false
@mix_items = true
@mix_items_all = true
when YE::REGEXP::BASEITEM::DONT_MIX
@dont_mix = true
when YE::REGEXP::BASEITEM::INSTANT_CAST
@instant_cast = true
when YE::REGEXP::BASEITEM::SUBSKILLS
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@subskills.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::SUBSKILL_ONLY
@subskill_only = true
when YE::REGEXP::BASEITEM::HIT_LEARN_ACTOR
@hit_learnable = true
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@hit_learn_actor.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::HIT_LEARN_CLASS
@hit_learnable = true
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@hit_learn_class.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::UNCHAINABLE
@unchainable = true
when YE::REGEXP::BASEITEM::RESELECT_CHAIN
@reselect_chain = true
when YE::REGEXP::BASEITEM::OPEN_CHAIN
@instant_cast = false
@chain_type = 1
@chain_times = $1.to_i
when YE::REGEXP::BASEITEM::CLOSED_CHAIN
@instant_cast = false
@chain_type = 2
@chain_times = $1.to_i
$2.scan(/\d+/).each { |num|
if num.to_i > 0
@chain_array.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::CLOSED_TYPE
$1.scan(/\d+/).each { |num|
if num.to_i > 0
@closed_type.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::FORCED_CHAIN
@instant_cast = false
@chain_type = 3
@chain_times = $1.to_i
$2.scan(/\d+/).each { |num|
if num.to_i > 0
@chain_array.push(num.to_i)
end }
when YE::REGEXP::BASEITEM::EFFECT_BEFORE
@bse = $1.to_i
when YE::REGEXP::BASEITEM::EFFECT_CHARGE
@cse = $1.to_i
when YE::REGEXP::BASEITEM::EFFECT_DURING
@dse = $1.to_i
when YE::REGEXP::BASEITEM::EFFECT_AFTER
@ase = $1.to_i
when YE::REGEXP::BASEITEM::CUSTOM_ANI
@csa = $1.to_i
when YE::REGEXP::BASEITEM::COST_CURMP
@cur_mp_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_MAXMP
@max_mp_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_CURHP
@cur_hp_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_MAXHP
@max_hp_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_GOLD
@gold_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_MGOLD
@maxgold_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_RAGE
@rage_cost = $1.to_i
when YE::REGEXP::BASEITEM::COST_CUSTOM
@cost_custom = $1.to_i
when YE::REGEXP::BASEITEM::CAST_TIME
@cast_time = $1.to_i
when YE::REGEXP::BASEITEM::RECHARGE
@recharge = $1.to_i
when YE::REGEXP::BASEITEM::PREPARE
@prepare = $1.to_i
when YE::REGEXP::BASEITEM::LIMITUSES
@usage = $1.to_i
when YE::REGEXP::BASEITEM::RAGE_BOOST
@rage_boost = $1.to_i
when YE::REGEXP::BASEITEM::FATIGUEVAL
@fatigue = $1.to_i
end
}
end # end yanfly_cache_cse
#--------------------------------------------------------------------------
# 杂项
#--------------------------------------------------------------------------
def unreflectable
yanfly_cache_baseitem_cse if @unreflectable == nil
return @unreflectable
end
#--------------------------------------------------------------------------
# 前提
#--------------------------------------------------------------------------
def require_level
yanfly_cache_baseitem_cse if @require_level == nil
return @require_level
end
def require_learn
yanfly_cache_baseitem_cse if @require_learn == nil
return @require_learn
end
def required_all_elements
yanfly_cache_baseitem_cse if @required_all_elements == nil
return @required_all_elements
end
def required_any_elements
yanfly_cache_baseitem_cse if @required_any_elements == nil
return @required_any_elements
end
def required_all_states
yanfly_cache_baseitem_cse if @required_all_states == nil
return @required_all_states
end
def required_any_states
yanfly_cache_baseitem_cse if @required_any_states == nil
return @required_any_states
end
#--------------------------------------------------------------------------
# 合成物品
#--------------------------------------------------------------------------
def mix_items
yanfly_cache_baseitem_cse if @mix_items == nil
return @mix_items
end
def mix_items_all
yanfly_cache_baseitem_cse if @mix_items_all == nil
return @mix_items_all
end
def mix_types
yanfly_cache_baseitem_cse if @mix_types == nil
return @mix_types
end
def dont_mix
yanfly_cache_baseitem_cse if @dont_mix == nil
return @dont_mix
end
#--------------------------------------------------------------------------
# 瞬发
#--------------------------------------------------------------------------
def instant_cast
yanfly_cache_baseitem_cse if @instant_cast == nil
return @instant_cast
end
#--------------------------------------------------------------------------
# 子技能
#--------------------------------------------------------------------------
def subskills
yanfly_cache_baseitem_cse if @subskills == nil
return @subskills
end
def subskill_only
yanfly_cache_baseitem_cse if @subskill_only == nil
return @subskill_only
end
#--------------------------------------------------------------------------
# 攻击习得
#--------------------------------------------------------------------------
def hit_learnable?
yanfly_cache_baseitem_cse if @hit_learnable == nil
return @hit_learnable
end
def hit_learn_actor
yanfly_cache_baseitem_cse if @hit_learn_actor == nil
return @hit_learn_actor
end
def hit_learn_class
yanfly_cache_baseitem_cse if @hit_learn_class == nil
return @hit_learn_class
end
#--------------------------------------------------------------------------
# 技能链
#--------------------------------------------------------------------------
def unchainable
yanfly_cache_baseitem_cse if @unchainable == nil
return @unchainable
end
def reselect_chain
yanfly_cache_baseitem_cse if @reselect_chain == nil
return @reselect_chain
end
def chain_type
yanfly_cache_baseitem_cse if @chain_type == nil
return @chain_type
end
def closed_type
yanfly_cache_baseitem_cse if @closed_type == nil
return @closed_type
end
def chain_times
yanfly_cache_baseitem_cse if @chain_times == nil
return @chain_times
end
def chain_array
yanfly_cache_baseitem_cse if @chain_array == nil
return @chain_array
end
#--------------------------------------------------------------------------
# 技能时态侦测. 动画侦测.
#--------------------------------------------------------------------------
def bse
yanfly_cache_baseitem_cse if @bse == nil
return @bse
end
def cse
yanfly_cache_baseitem_cse if @cse == nil
return @cse
end
def dse
yanfly_cache_baseitem_cse if @dse == nil
return @dse
end
def ase
yanfly_cache_baseitem_cse if @ase == nil
return @ase
end
def csa
yanfly_cache_baseitem_cse if @csa == nil
return @csa
end
#--------------------------------------------------------------------------
# 消费侦测
#--------------------------------------------------------------------------
def cur_mp_cost
yanfly_cache_baseitem_cse if @cur_mp_cost == nil
return @cur_mp_cost
end
def max_mp_cost
yanfly_cache_baseitem_cse if @max_mp_cost == nil
return @max_mp_cost
end
def cur_hp_cost
yanfly_cache_baseitem_cse if @cur_hp_cost == nil
return @cur_hp_cost
end
def max_hp_cost
yanfly_cache_baseitem_cse if @max_hp_cost == nil
return @max_hp_cost
end
def gold_cost
yanfly_cache_baseitem_cse if @gold_cost == nil
return @gold_cost
end
def maxgold_cost
yanfly_cache_baseitem_cse if @maxgold_cost == nil
return @maxgold_cost
end
def rage_cost
yanfly_cache_baseitem_cse if @rage_cost == nil
return @rage_cost
end
def cost_custom
yanfly_cache_baseitem_cse if @cost_custom == nil
return @cost_custom
end
#--------------------------------------------------------------------------
# 蓄力/蓄力时间/预备/用法/怒气获取/虚弱
#--------------------------------------------------------------------------
def cast_time
yanfly_cache_baseitem_cse if @cast_time == nil
return @cast_time
end
def recharge
yanfly_cache_baseitem_cse if @recharge == nil
return @recharge
end
def prepare
yanfly_cache_baseitem_cse if @prepare == nil
return @prepare
end
def usage
yanfly_cache_baseitem_cse if @usage == nil
return @usage
end
def rage_boost
yanfly_cache_baseitem_cse if @rage_boost == nil
return @rage_boost
end
def fatigue
yanfly_cache_baseitem_cse if @fatigue == nil
return @fatigue
end
end # RPG::BaseItem
#===============================================================================
# Game_Actor
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# alias setup
#--------------------------------------------------------------------------
alias setup_cse setup unless $@
def setup(actor_id)
setup_cse(actor_id)
@mix_flag = false
@scd = {}
reset_recharge
@slu = {}
reset_usage
end
#--------------------------------------------------------------------------
# set_chain
#--------------------------------------------------------------------------
def set_chain(array1 = nil, array2 = nil)
@chain_skills = array1
@chain_targets = array2
end
#--------------------------------------------------------------------------
# reset mix items
#--------------------------------------------------------------------------
def reset_mix_items
@mix_item_1 = nil
@mix_item_2 = nil
@mix_item_skill = nil
end
#--------------------------------------------------------------------------
# recharge definitions
#--------------------------------------------------------------------------
def reset_recharge
@scd = {} if @scd == nil
for skill in skills
@scd[skill.id] = 0
end
end
#--------------------------------------------------------------------------
# limited uses definitions
#--------------------------------------------------------------------------
def reset_usage
@slu = {} if @slu == nil
for skill in skills
@slu[skill.id] = 0
end
end
#--------------------------------------------------------------------------
# alias skills
#--------------------------------------------------------------------------
alias skills_cse skills unless $@
def skills
result = skills_cse
for skill in result
result -= [skill] if skill.subskill_only
end
return result
end
#--------------------------------------------------------------------------
# alias skill_can_use?
#--------------------------------------------------------------------------
alias skill_can_use_actor_cse skill_can_use? unless $@
def skill_can_use?(skill)
if skill == nil
return false
elsif @subskill_flag == true
return super
elsif skill.subskills != [] and @subskill_flag != true
return true
else
return skill_can_use_actor_cse(skill)
end
end
end # Game_Actor
#===============================================================================
# Game_Enemy
#===============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# alias initialize
#--------------------------------------------------------------------------
alias initialize_enemy_cse initialize unless $@
def initialize(index, enemy_id)
initialize_enemy_cse(index, enemy_id)
@scd = {}
reset_recharge
@slu = {}
reset_usage
end
#--------------------------------------------------------------------------
# recharge definitions
#--------------------------------------------------------------------------
def reset_recharge
@scd = {} if @scd == nil
for action in enemy.actions
next if action.kind != 1
skill = $data_skills[action.skill_id]
@scd[skill.id] = 0
end
end
#--------------------------------------------------------------------------
# limited uses definitions
#--------------------------------------------------------------------------
def reset_usage
@slu = {} if @slu == nil
for action in enemy.actions
next if action.kind != 1
skill = $data_skills[action.skill_id]
@slu[skill.id] = 0
end
end
end # Game_Enemy
#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :mix_item_1
attr_accessor :mix_item_2
attr_accessor :mix_item_skill
attr_accessor :chain_skills
attr_accessor :chain_targets
attr_accessor :subskill_flag
#--------------------------------------------------------------------------
# alias initialize
#--------------------------------------------------------------------------
alias initialize_cse initialize unless $@
def initialize
@rage = 0
@charge_turns = 0
@charge_skill = nil
@fatigue = 0
initialize_cse
end
#--------------------------------------------------------------------------
# recharge definitions
#--------------------------------------------------------------------------
def recharge(skill_id)
@scd = {} if @scd == nil
return 0 if skill_id == nil
@scd[skill_id] = 0 if @scd[skill_id] == nil
x = @scd[skill_id]
return x
end
def make_recharge(skill, amount)
amount = 0 if amount < 0
@scd = {} if @scd == nil
@scd[skill.id] = amount
end
def update_recharge
@scd = {} if @scd == nil
@scd.each_key {|key|
@scd[key] = 0 if @scd[key] == nil
@scd[key] -= 1
@scd[key] = 0 if @scd[key] < 0
}
end
#--------------------------------------------------------------------------
# limited uses definitions
#--------------------------------------------------------------------------
def usage(skill_id)
@slu = {} if @slu == nil
return 0 if skill_id == nil
@slu[skill_id] = 0 if @slu[skill_id] == nil
x = @slu[skill_id]
return x
end
def update_usage(skill_id)
@slu = {} if @slu == nil
@slu[skill_id] = 0 if @slu[skill_id] == nil
@slu[skill_id] = @slu[skill_id] + 1
end
#--------------------------------------------------------------------------
# alias inputable?
#--------------------------------------------------------------------------
alias inputable_cse inputable? unless $@
def inputable?
return false if @fatigue >= 1
return false if (@charge_skill != nil) and (@charge_turns > 0)
inputable_cse
end
#--------------------------------------------------------------------------
# reflect
#--------------------------------------------------------------------------
def reflect
for state in states
return true if state.reflect
end
return false
end
#--------------------------------------------------------------------------
# Cost Mods
#--------------------------------------------------------------------------
def cost_hp_mod(value)
states.each { |state|
value = value * state.cost_hp_per / 100
value += state.cost_hp_set
}
return value
end
def cost_mp_mod(value)
states.each { |state|
value = value * state.cost_mp_per / 100
value += state.cost_mp_set
}
return value
end
def cost_gold_mod(value)
states.each { |state|
value = value * state.cost_gold_per / 100
value += state.cost_gold_set
}
return value
end
def cost_maxgold_mod(value)
states.each { |state|
value = value * state.cost_maxgold_per / 100
value += state.cost_maxgold_set
}
return value
end
def cost_rage_mod(value)
states.each { |state|
value = value * state.cost_rage_per / 100
value += state.cost_rage_set
}
return value
end
#--------------------------------------------------------------------------
# rage definitions
#--------------------------------------------------------------------------
def rage
@rage = 0 if @rage == nil or @rage < 0
@rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE
return @rage
end
def rage=(new_rage)
@rage = new_rage
@rage = 0 if @rage < 0
@rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE
end
def rage_boost_mod(value)
states.each { |state|
value = value * state.rage_boost_per / 100
value += state.rage_boost_set
}
value = 0 if value < 0
return value
end
#--------------------------------------------------------------------------
# cast time definitions
#--------------------------------------------------------------------------
def charge_turns
return @charge_turns
end
def charge_turns=(new_charge_turn)
@charge_turns = (new_charge_turn)
end
def charge_skill
return @charge_skill
end
def charge_skill=(new_skill)
@charge_skill = new_skill
end
def make_charge(skill)
@charge_turns = skill.cast_time
@charge_skill = skill
end
def reset_charging
if @charge_skill != nil
make_recharge(@charge_skill, @charge_skill.recharge)
end
@charge_turns = 0
@charge_skill = nil
end
def update_charging
if @charge_skill != nil
@charge_turns -= 1
csekeep = true
csekeep = false if dead?
csekeep = false if !exist?
csekeep = false if !movable?
csekeep = false if berserker?
csekeep = false if confusion?
if !csekeep
reset_charging
end
end
end
#--------------------------------------------------------------------------
# fatigue definitions
#--------------------------------------------------------------------------
def fatigue
return @fatigue
end
def fatigue=(new_fatigue)
@fatigue = new_fatigue
@fatigue = 0 if fatigue < 0
end
def make_fatigue(skill)
@fatigue = skill.fatigue
end
def update_fatigue
@fatigue -= 1
end
#--------------------------------------------------------------------------
# Create Cost Icon
#--------------------------------------------------------------------------
def create_cost_icon(skill)
if skill.cost_custom > 0
icon = cost_custom(skill, 1)
elsif skill.cur_mp_cost > 0
icon = YE::BATTLE::MP_ICON
elsif skill.max_mp_cost > 0
icon = YE::BATTLE::MP_ICON
elsif skill.cur_hp_cost > 0
icon = YE::BATTLE::HP_ICON
elsif skill.max_hp_cost > 0
icon = YE::BATTLE::HP_ICON
elsif skill.gold_cost > 0
icon = YE::BATTLE::GOLD_ICON
elsif skill.maxgold_cost > 0
icon = YE::BATTLE::GOLD_ICON
elsif skill.rage_cost > 0
icon = YE::BATTLE::RAGE_ICON
else
icon = YE::BATTLE::MP_ICON
end
if skill.subskills != [] and self.subskill_flag != true
icon = 0
end
return icon
end
#--------------------------------------------------------------------------
# Calculation of MP Consumed for Skills
#--------------------------------------------------------------------------
def calc_mp_cost(skill)
recharge = self.recharge(skill.id)
if recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
cost = recharge
elsif skill.cost_custom > 0
cost = cost_custom(skill, 3)
elsif skill.cur_mp_cost > 0
cost = skill.cur_mp_cost
cost /= 2 if half_mp_cost
cost = cost_mp_mod(cost)
elsif skill.max_mp_cost > 0
cost = skill.max_mp_cost * maxmp
cost /= 100
cost /= 2 if half_mp_cost
cost = cost_mp_mod(cost)
elsif skill.cur_hp_cost > 0
cost = skill.cur_hp_cost
cost = cost_hp_mod(cost)
elsif skill.max_hp_cost > 0
cost = skill.max_hp_cost * maxhp
cost /= 100
cost = cost_hp_mod(cost)
elsif skill.gold_cost > 0
cost = skill.gold_cost
cost = cost_gold_mod(cost)
cost = 0 unless self.actor?
elsif skill.maxgold_cost > 0
cost = skill.maxgold_cost
cost = cost_maxgold_mod(cost)
cost = 0 unless self.actor?
elsif skill.rage_cost > 0
cost = skill.rage_cost
cost = cost_rage_mod(cost)
else
cost = skill.mp_cost
cost /= 2 if half_mp_cost
cost = cost_mp_mod(cost)
end
cost = 0 if cost <= 0
return calc_cost_common(cost, skill)
end
#--------------------------------------------------------------------------
# overwrite skill_can_use?
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
#---
if $imported["BattlerStatMorale"] and skill.requires_morale
if skill.required_morale >= 0
return false if skill.required_morale > self.morale
elsif skill.required_morale < 0
return false if skill.required_morale < self.morale
end
end
if $imported["EquipSkillSlots"]
return false unless can_use_limit_type?(skill)
end
#---
return false unless custom_skill_requirements(skill)
#---
recharge = self.recharge(skill.id)
recharge = 0 unless $scene.is_a?(Scene_Battle)
usage = self.usage(skill.id)
usage = 0 unless $scene.is_a?(Scene_Battle)
cost = calc_mp_cost(skill)
if recharge > 0
return false
elsif skill.cost_custom > 0
can_use = cost_custom(skill, 4)
return false if can_use == false
elsif skill.usage > 0
return false if usage >= skill.usage
elsif skill.cur_mp_cost > 0
return false if cost > mp
elsif skill.max_mp_cost > 0
return false if cost > mp
elsif skill.cur_hp_cost > 0
if !YE::BATTLE::ALLOW_DEATH_HP_COST
return false if cost > self.hp
end
elsif skill.max_hp_cost > 0
if !YE::BATTLE::ALLOW_DEATH_HP_COST
return false if cost > self.hp
end
elsif skill.gold_cost > 0
return false if cost > $game_party.gold
elsif skill.maxgold_cost > 0
cost *= $game_party.gold
cost /= 100
return false if $game_party.gold < cost
return false if cost == 0
elsif skill.rage_cost > 0
return false if cost > self.rage
else
return false if cost > mp
end
#---
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
#--------------------------------------------------------------------------
# custom_skill_requirements
#--------------------------------------------------------------------------
def custom_skill_requirements(skill)
return true if !self.actor?
#---
if skill.required_all_elements != []
for ele_id in skill.required_all_elements
next if self.element_set.include?(ele_id)
return false
end
end
if skill.required_any_elements != []
possess_element = false
for ele_id in skill.required_any_elements
possess_element = true if self.element_set.include?(ele_id)
end
return false unless possess_element
end
#---
if skill.required_all_states != []
for state_id in skill.required_all_states
return false unless self.states.include?($data_states[state_id])
end
end
if skill.required_any_states != []
for state_id in skill.required_any_states
possess_state = true if self.states.include?($data_states[state_id])
end
return false unless possess_state
end
#---
return true
end
#--------------------------------------------------------------------------
# alias attack_effect
#--------------------------------------------------------------------------
alias attack_effect_cse attack_effect unless $@
def attack_effect(attacker)
attack_effect_cse(attacker)
if YE::BATTLE::INC_RAGE_ATTACK
attacker.rage += YE::BATTLE::NUM_RAGE_ATTACK
end
end
#--------------------------------------------------------------------------
# alias skill_effect
#--------------------------------------------------------------------------
alias skill_effect_cse skill_effect unless $@
def skill_effect(user, skill)
skill_effect_cse(user, skill)
if $scene.is_a?(Scene_Battle)
user.rage += YE::BATTLE::NUM_RAGE_SKILL if YE::BATTLE::INC_RAGE_SKILL
rb = user.rage_boost_mod(skill.rage_boost)
user.rage += rb
end
if $scene.is_a?(Scene_Battle)
user.make_recharge(skill, skill.recharge)
user.update_usage(skill.id) unless $scene.usage_flag
$scene.set_usage
end
end
#--------------------------------------------------------------------------
# hit_learn?
#--------------------------------------------------------------------------
def hit_learn?(skill)
return false unless self.actor?
return false unless skill.hit_learnable?
return false if self.skill_learn?(skill)
return false if self.dead?
return true if skill.hit_learn_actor.include?(self.id)
return true if skill.hit_learn_class.include?(self.class.id)
if $imported["SubclassSelectionSystem"] and self.subclass != nil and
YE::BATTLE::SUBCLASS_HIT_LEARN
return true if skill.hit_learn_class.include?(self.subclass.id)
end
return false
end
end #class Game_Battler
#===============================================================================
# Game_BattleAction
#===============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# alias valid
#--------------------------------------------------------------------------
alias valid_cse valid? unless $@
def valid?
battler.update_recharge
if battler.fatigue >= 1
battler.update_fatigue
return false
end
return true if battler.charge_turns >= 1 and
battler.charge_skill != nil and !battler.dead?
valid_cse
end
#--------------------------------------------------------------------------
# perform_charge_skill
#--------------------------------------------------------------------------
def perform_charge_skill
@forcing = true
decide_last_target
set_skill(battler.charge_skill.id)
$game_troop.forcing_battler = @active_battler
end
end
#===============================================================================
# Scene Battle
#===============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# Refresh OnScreenStatus
#--------------------------------------------------------------------------
def refresh_onscreenstatus
@onscreen_status_window.refresh if $imported["OnScreenStatus"]
end
#--------------------------------------------------------------------------
# Message Wait
#--------------------------------------------------------------------------
def msgwait
wait(YE::BATTLE::MSGWAIT)
end
#--------------------------------------------------------------------------
# alias process_battle_start
#--------------------------------------------------------------------------
alias process_battle_start_cps process_battle_start unless $@
def process_battle_start
for actor in $game_party.members
actor_reset(actor)
create_prep_charge_actor(actor)
end
for battler in $game_troop.members
create_prep_charge_enemy(battler)
end
process_battle_start_cps
end
#--------------------------------------------------------------------------
# alias battle_end
#--------------------------------------------------------------------------
alias battle_end_cse battle_end unless $@
def battle_end(result)
for actor in $game_party.members
actor_reset(actor)
end
battle_end_cse(result)
end
#--------------------------------------------------------------------------
# actor reset
#--------------------------------------------------------------------------
def actor_reset(actor)
actor.rage = 0 if YE::BATTLE::RAGE_RESET_BATTLE
actor.charge_turns = 0
actor.charge_skill = nil
actor.fatigue = 0
actor.reset_recharge
actor.subskill_flag = nil
actor.set_chain
end
#--------------------------------------------------------------------------
# create preparation charging
#--------------------------------------------------------------------------
def create_prep_charge_actor(actor)
for skill in actor.skills
next if skill == nil
actor.make_recharge(skill, skill.prepare)
end
end
#--------------------------------------------------------------------------
# create preparation charging
#--------------------------------------------------------------------------
def create_prep_charge_enemy(battler)
for action in battler.enemy.actions
if action.kind == 1
skill = $data_skills[action.skill_id]
battler.make_recharge(skill, skill.prepare)
end
end
end
#--------------------------------------------------------------------------
# alias update_actor_command_selection
#--------------------------------------------------------------------------
alias update_actor_command_selection_cse update_actor_command_selection unless $@
def update_actor_command_selection
if Input.trigger?(Input::B)
@active_battler.reset_mix_items
@active_battler.subskill_flag = nil
@active_battler.set_chain
elsif Input.trigger?(Input::C) and !$imported["CustomBattleActions"]
@active_battler.reset_mix_items
@active_battler.subskill_flag = nil
@active_battler.set_chain
end
update_actor_command_selection_cse
end
#--------------------------------------------------------------------------
# alias update_target_enemy_selection
#--------------------------------------------------------------------------
alias update_target_enemy_selection_cse update_target_enemy_selection unless $@
def update_target_enemy_selection
if Input.trigger?(Input::B)
if @mix_item_window != nil
@mix_item_window.active = true
@active_battler.mix_item_2 = nil
@mix_item_window.refresh
elsif @subskill_window != nil
@subskill_window.active = true
elsif @chain_window != nil
@chain_window.active = true
@chain_array.delete_at (@chain_array.size - 1)
@chain_targets.delete_at (@chain_targets.size - 1)
@chain_info.refresh(@chain_array)
@chain_window.refresh(@chain_array)
else
@active_battler.reset_mix_items
end
end
if Input.trigger?(Input::C) and @chain_window != nil
add_chain_targets
else
update_target_enemy_selection_cse
end
end
#--------------------------------------------------------------------------
# alias update_target_actor_selection
#--------------------------------------------------------------------------
alias update_target_actor_selection_cse update_target_actor_selection unless $@
def update_target_actor_selection
if Input.trigger?(Input::B)
if @mix_item_window != nil
@mix_item_window.active = true
@active_battler.mix_item_2 = nil
@mix_item_window.refresh
elsif @subskill_window != nil
@subskill_window.active = true
elsif @chain_window != nil
@chain_window.active = true
@chain_array.delete_at (@chain_array.size - 1)
@chain_targets.delete_at (@chain_targets.size - 1)
@chain_info.refresh(@chain_array)
@chain_window.refresh(@chain_array)
else
@active_battler.reset_mix_items
end
end
if Input.trigger?(Input::C) and @chain_window != nil
add_chain_targets
else
update_target_actor_selection_cse
end
end
#--------------------------------------------------------------------------
# alias next_actor
#--------------------------------------------------------------------------
alias next_actor_cse next_actor unless $@
def next_actor
if instant_cast_skill?
perform_instant_cast
if @active_battler.inputable?
start_actor_command_selection
else
next_actor_cse
end
else
next_actor_cse
end
end
#--------------------------------------------------------------------------
# instant_cast_skill?
#--------------------------------------------------------------------------
def instant_cast_skill?
return false if @active_battler == nil
return false unless @active_battler.action.skill?
return false unless @active_battler.action.skill.instant_cast
return true
end
#--------------------------------------------------------------------------
# perform instant cast
#--------------------------------------------------------------------------
def perform_instant_cast
@message_window.clear
@message_window.visible = true
unless $imported["SceneBattleReDux"] and @redux_msg
@info_viewport.visible = false
end
cast_the_skill(@active_battler.action.skill)
unless $imported["SceneBattleReDux"] and @redux_msg
@info_viewport.visible = true
end
@message_window.visible = false
@status_window.refresh
end
#--------------------------------------------------------------------------
# alias determine skill
#--------------------------------------------------------------------------
alias determine_skill_cse determine_skill unless $@
def determine_skill
if @skill.mix_items
create_mix_item_windows
elsif @skill.subskills != []
create_subskill_windows
elsif @skill.chain_type > 0
create_chain_windows
else
determine_skill_cse
end
end
#--------------------------------------------------------------------------
# create_mix_item_windows
#--------------------------------------------------------------------------
def create_mix_item_windows
sk = @skill
@active_battler.action.set_skill(@skill.id)
@mix_item_window = Window_Mix_Item.new(0, 56, 544, 232, @active_battler, sk)
@mix_item_window.help_window = @help_window
if $imported["HelpExtension"]
@mix_item_window.y = @help_window.height
@mix_item_window.height = Graphics.height -
(@help_window.height + @status_window.height)
@mix_item_window.refresh
end
@mix_item_window.active = true
@skill_window.active = false
@skill_window.visible = false
end
#--------------------------------------------------------------------------
# end_mix_item
#--------------------------------------------------------------------------
def end_mix_item
if $imported["CustomBattleActions"]
if @active_battler.custom_action_flag == true
end_skill_selection
end
end
if @skill_window != nil
@skill_window.active = true
@skill_window.visible = true
end
if @mix_item_window != nil
@mix_item_window.dispose
@mix_item_window = nil
end
@active_battler.reset_mix_items
end
#--------------------------------------------------------------------------
# alias end_skill_selection
#--------------------------------------------------------------------------
alias end_skill_selection_cse end_skill_selection unless $@
def end_skill_selection
if @mix_item_window != nil
@mix_item_window.dispose
@mix_item_window = nil
end
if @subskill_window != nil
@subskill_window.dispose
@subskill_window = nil
end
if @chain_window != nil
@chain_window.dispose
@chain_window = nil
end
if @chain_info != nil
@chain_info.dispose
@chain_info = nil
end
end_skill_selection_cse
end
#--------------------------------------------------------------------------
# alias update_skill_selection
#--------------------------------------------------------------------------
alias update_skill_selection_cse update_skill_selection unless $@
def update_skill_selection
if @mix_item_window != nil and @mix_item_window.active
update_mix_item
elsif @subskill_window != nil and @subskill_window.active
update_subskill
elsif @chain_window != nil and @chain_window.active
update_chain_skill
else
update_skill_selection_cse
end
end
#--------------------------------------------------------------------------
# update_mix_item
#--------------------------------------------------------------------------
def update_mix_item
@mix_item_window.update
@help_window.update
if Input.trigger?(Input::B)
if @active_battler.mix_item_1 == nil and @active_battler.mix_item_2 == nil
Sound.play_cancel
end_mix_item
elsif @active_battler.mix_item_2 != nil
Sound.play_cancel
@active_battler.mix_item_2 = nil
@mix_item_window.refresh
elsif @active_battler.mix_item_1 != nil
Sound.play_cancel
@active_battler.mix_item_1 = nil
@mix_item_window.refresh
end
elsif Input.trigger?(Input::C)
item = @mix_item_window.item
if item == nil
Sound.play_buzzer
elsif @active_battler.mix_item_1 == nil
Sound.play_decision
@active_battler.mix_item_1 = item.id
elsif @active_battler.mix_item_2 == nil
if item.id == @active_battler.mix_item_1 and
$game_party.item_number(item) < 2
Sound.play_buzzer
else
@active_battler.mix_item_2 = item.id
determine_mix_item
end
end
@mix_item_window.refresh if @mix_item_window != nil
end
end
#--------------------------------------------------------------------------
# determine_mix_item
#--------------------------------------------------------------------------
def determine_mix_item
item1 = @active_battler.mix_item_1
item2 = @active_battler.mix_item_2
combo_hash = YE::BATTLE::ITEM_MIX_COMBO_HASH
if combo_hash.include?([item1, item2])
if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil
YE::BATTLE::SUCCESSFUL_ITEM_MIX.play
else
Sound.play_decision
end
combo_array = combo_hash[[item1, item2]]
@active_battler.mix_item_skill = combo_array[rand(combo_array.size)]
elsif combo_hash.include?([item2, item1])
if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil
YE::BATTLE::SUCCESSFUL_ITEM_MIX.play
else
Sound.play_decision
end
combo_array = combo_hash[[item2, item1]]
@active_battler.mix_item_skill = combo_array[rand(combo_array.size)]
else
Sound.play_decision
select_random_mix_item_skill(item1, item2)
end
item_skill = $data_skills[@active_battler.mix_item_skill]
if item_skill.need_selection?
if item_skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
next_actor
end
end
#--------------------------------------------------------------------------
# select_random_mix_item_skill
#--------------------------------------------------------------------------
def select_random_mix_item_skill(item1, item2)
random_hash = YE::BATTLE::RANDOM_ITEM_MIX_TYPES
random_array = []
for type in $data_items[item1].mix_types
random_array += random_hash[type] if random_hash.include?(type)
end
for type in $data_items[item2].mix_types
random_array += random_hash[type] if random_hash.include?(type)
end
random_array = random_hash[0] if random_array == []
@active_battler.mix_item_skill = random_array[rand(random_array.size)]
end
#--------------------------------------------------------------------------
# create_subskill_windows
#--------------------------------------------------------------------------
def create_subskill_windows
sk = @skill
@active_battler.subskill_flag = true
@active_battler.action.set_skill(@skill.id)
@subskill_window = Window_Subskills.new(0,56,544,232,@active_battler, sk)
@subskill_window.help_window = @help_window
if $imported["HelpExtension"]
@subskill_window.y = @help_window.height
@subskill_window.height = Graphics.height -
(@help_window.height + @status_window.height)
@subskill_window.refresh
end
@subskill_window.active = true
@skill_window.active = false
@skill_window.visible = false
end
#--------------------------------------------------------------------------
# update subskill
#--------------------------------------------------------------------------
def update_subskill
@subskill_window.update
@help_window.update
if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW
if @skill_data_window.active
@help_info_window.visible = false
elsif @subskill_window.active
@help_info_window.visible = true
else
@help_info_window.visible = false
end
else
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
end
if Input.trigger?(Input::B)
Sound.play_cancel
@subskill_window.dispose
@subskill_window = nil
@skill_window.active = true
@skill_window.visible = true
@active_battler.subskill_flag = nil
if $imported["CustomBattleActions"]
if @active_battler.custom_action_flag == true
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
end_skill_selection
end
end
elsif Input.trigger?(Input::C)
@skill = @subskill_window.skill
if @active_battler.skill_can_use?(@skill)
Sound.play_decision
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
determine_subskill
else
Sound.play_buzzer
end
elsif $imported["DisplaySkillQuery"] and
Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON)
skill = @subskill_window.skill
if skill != nil
Sound.play_decision
@skill_data_window.appear(skill, @subskill_window, @active_battler)
@subskill_window.active = false
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# determine_subskill
#--------------------------------------------------------------------------
def determine_subskill
@active_battler.action.set_skill(@skill.id)
@subskill_window.active = false
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
next_actor
end
end
#--------------------------------------------------------------------------
# create chain windows
#--------------------------------------------------------------------------
def create_chain_windows
sk = @skill
@chain_array = []
@chain_targets = []
@active_battler.subskill_flag = true
@active_battler.action.set_skill(@skill.id)
@chain_window = Window_Chain_Skill.new(0,56,272,232,@active_battler, sk)
@chain_window.help_window = @help_window
@chain_info = Window_Chain_Info.new(272,56,272,232,@active_battler, sk)
if $imported["HelpExtension"]
@chain_window.y = @help_window.height
@chain_info.y = @help_window.height
@chain_window.height = Graphics.height -
(@help_window.height + @status_window.height)
@chain_info.height = Graphics.height -
(@help_window.height + @status_window.height)
@chain_window.refresh
@chain_window.refresh(@chain_array)
@chain_info.refresh(@chain_array)
end
@chain_window.active = true
@skill_window.active = false
@skill_window.visible = false
end
#--------------------------------------------------------------------------
# update chain skill
#--------------------------------------------------------------------------
def update_chain_skill
@chain_window.update
@help_window.update
if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW
if @skill_data_window.active
@help_info_window.visible = false
elsif @chain_window.active
@help_info_window.visible = true
else
@help_info_window.visible = false
end
else
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
end
if Input.trigger?(Input::B)
Sound.play_cancel
if @chain_array == []
@active_battler.set_chain
@chain_window.dispose
@chain_window = nil
@chain_info.dispose
@chain_info = nil
@skill_window.active = true
@skill_window.visible = true
if $imported["CustomBattleActions"]
if @active_battler.custom_action_flag == true
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
end_skill_selection
end
end
else
@chain_array.delete_at (@chain_array.size - 1)
@chain_targets.delete_at (@chain_targets.size - 1)
@chain_info.refresh(@chain_array)
@chain_window.refresh(@chain_array)
end
elsif Input.trigger?(Input::C)
skill = @chain_window.skill
if select_chain_valid?(skill)
@help_info_window.visible = false if $imported["DisplaySkillQuery"]
determine_chain(skill)
else
Sound.play_buzzer
end
elsif $imported["DisplaySkillQuery"] and
Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON)
skill = @chain_window.skill
if skill != nil
Sound.play_decision
@skill_data_window.appear(skill, @chain_window, @active_battler, 2)
@chain_window.active = false
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# select chain valid
#--------------------------------------------------------------------------
def select_chain_valid?(skill)
return false if
[email protected]
_chain and @chain_array.include?(skill.id)
return false if @chain_array.size >= @skill.chain_times
return true
end
#--------------------------------------------------------------------------
# determine chain
#--------------------------------------------------------------------------
def determine_chain(skill)
Sound.play_decision
skill = @chain_window.skill
@chain_array.push(skill.id)
@chain_window.refresh(@chain_array)
@chain_info.refresh(@chain_array)
if skill.need_selection?
@chain_window.active = false
if skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
add_chain_targets
end
end
#--------------------------------------------------------------------------
# add chain targets
#--------------------------------------------------------------------------
def add_chain_targets
if @target_actor_window != nil and @target_actor_window.visible
Sound.play_decision
@chain_targets.push(@target_actor_window.index)
end_target_actor_selection
elsif @target_enemy_window != nil and @target_enemy_window.visible
Sound.play_decision
@chain_targets.push(@target_enemy_window.index)
end_target_enemy_selection
else
@chain_targets.push(0)
end
@active_battler.set_chain(@chain_array, @chain_targets)
if @chain_array.size >= @skill.chain_times
end_skill_selection
end_item_selection
next_actor
else
@chain_window.active = true
end
end
#--------------------------------------------------------------------------
# alias display_hp_damage
#--------------------------------------------------------------------------
alias display_hp_damage_cse display_hp_damage unless $@
def display_hp_damage(target, obj = nil)
if target.hp_damage > 0 and YE::BATTLE::INC_RAGE_DAMAGED
target.rage += YE::BATTLE::NUM_RAGE_DAMAGED
end
display_hp_damage_cse(target, obj)
end
#--------------------------------------------------------------------------
# alias execute_action
#--------------------------------------------------------------------------
alias execute_action_cse execute_action unless $@
def execute_action
if @active_battler.charge_skill != nil
@active_battler.update_charging
if @active_battler.charge_turns <= 0
@active_battler.action.perform_charge_skill
else
name = @active_battler.name
skill = @active_battler.charge_skill.name
text = sprintf(YE::BATTLE::CHARGE_CON, name, skill)
@message_window.add_instant_text(text)
wait(60)
end
end
execute_action_cse
end
#--------------------------------------------------------------------------
# usage flag
#--------------------------------------------------------------------------
def usage_flag
@usage_flag = false if @usage_flag == nil
return @usage_flag
end
def set_usage
@usage_flag = true
end
#--------------------------------------------------------------------------
# Execute Battle Action: Skill
#--------------------------------------------------------------------------
def execute_action_skill
skill = @active_battler.action.skill
charged = @active_battler.action.forcing
@mix_item_flag = nil
if skill.cast_time >= 1 and @active_battler.charge_skill == nil and !charged
charge_the_skill(skill)
elsif !@active_battler.actor? and @active_battler.charge_turns >= 1
#do nothing since monsters don't have an inputable? check
elsif @active_battler.actor? and skill.mix_items and
@active_battler.mix_item_skill != nil
set_mix_skill(skill)
elsif @active_battler.actor? and skill.chain_type > 0
chain_cast_skill(skill)
else
cast_the_skill(skill)
end
end # end execute_action_skill
#--------------------------------------------------------------------------
# charge_the_skill
#--------------------------------------------------------------------------
def charge_the_skill(skill)
sound = YE::BATTLE::CHARGE_SND
sound.play
unless $imported["SceneBattleReDux"] and
!YE::REDUX::BATTLE::MSG_CURRENT_ACTION
text = sprintf(YE::BATTLE::CHARGE_MSG, @active_battler.name, skill.name)
@message_window.add_instant_text(text)
end
apply_skill_cost(@active_battler, skill)
@active_battler.make_charge(skill)
refresh_onscreenstatus
effect_charge(skill, skill.cse) if skill.cse > 0
common_charge(skill)
msgwait
end
#--------------------------------------------------------------------------
# set_mix_skill
#--------------------------------------------------------------------------
def set_mix_skill(skill)
unless $imported["SceneBattleReDux"] and
!YE::REDUX::BATTLE::MSG_CURRENT_ACTION
unless skill.message1.empty?
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
end
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
msgwait
end
effect_before(skill, skill.bse) if skill.bse > 0
common_before(skill)
apply_skill_cost(@active_battler, skill)
refresh_onscreenstatus
@message_window.clear
@mix_item_flag = true
item1 = $data_items[@active_battler.mix_item_1]
item2 = $data_items[@active_battler.mix_item_2]
#---
if @active_battler.mix_item_1 == @active_battler.mix_item_1
@mix_item_flag = false if $game_party.item_number(item1) < 2
else
@mix_item_flag = false if $game_party.item_number(item1) < 1
@mix_item_flag = false if $game_party.item_number(item2) < 1
end
#---
if @mix_item_flag
$game_party.gain_item(item1, -1)
$game_party.gain_item(item2, -1)
skill = $data_skills[@active_battler.mix_item_skill]
@active_battler.action.set_skill(skill.id)
cast_the_skill(skill)
else
text = YE::BATTLE::NOT_ENOUGH_ITEMS
@message_window.add_instant_text(text)
end
@message_window.clear
effect_after(skill, skill.ase) if skill.ase > 0
common_after(skill)
@active_battler.reset_mix_items
@active_battler.reset_charging
end
#--------------------------------------------------------------------------
# chain_cast_skill
#--------------------------------------------------------------------------
def chain_cast_skill(skill)
unless $imported["SceneBattleReDux"] and
!YE::REDUX::BATTLE::MSG_CURRENT_ACTION
unless skill.message1.empty?
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
end
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
msgwait
end
effect_before(skill, skill.bse) if skill.bse > 0
common_before(skill)
#---
for i in 0..(@active_battler.chain_skills.size - 1)
chainskill = $data_skills[@active_battler.chain_skills[i]]
next if chainskill == nil
@active_battler.action.set_skill(chainskill.id)
@active_battler.action.target_index = @active_battler.chain_targets[i]
next unless @active_battler.action.valid?
@message_window.clear
cast_the_skill(@active_battler.action.skill)
end
#---
@message_window.clear
apply_skill_cost(@active_battler, skill)
refresh_onscreenstatus
effect_after(skill, skill.ase) if skill.ase > 0
common_after(skill)
@active_battler.set_chain
@active_battler.reset_charging
end
#--------------------------------------------------------------------------
# cast_the_skill
#--------------------------------------------------------------------------
def cast_the_skill(skill)
@mix_item_flag = false if @mix_item_flag == nil
unless $imported["SceneBattleReDux"] and
!YE::REDUX::BATTLE::MSG_CURRENT_ACTION
unless skill.message1.empty?
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
end
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
end
targets = @active_battler.action.make_targets
if skill.csa > 0
custom_ani(targets, skill.csa)
else
display_animation(targets, skill.animation_id)
end
apply_skill_cost(@active_battler, skill) unless @mix_item_flag
refresh_onscreenstatus
effect_before(skill, skill.bse) if skill.bse > 0
common_before(skill)
@usage_flag = false
for target in targets
target = reflect_check(target, skill)
target.skill_effect(@active_battler, skill)
display_action_effects(target, skill)
end
for target in targets
target.perform_collapse unless target.collapse
if $imported["SceneBattleReDux"] and @redux_msg and target.actor?
@status_window.draw_item(target.index) if target.collapse
end
end
effect_after(skill, skill.ase) if skill.ase > 0
common_after(skill)
@active_battler.make_fatigue(skill)
if @active_battler.fatigue > 0
sound = YE::BATTLE::FATIGUE_SND
sound.play
text = sprintf(YE::BATTLE::FATIGUE_MSG, @active_battler.name)
@message_window.add_instant_text(text)
wait(60)
end
@active_battler.reset_charging
if $imported["EquipSkillSlots"] and skill.skill_copy?
create_skill_copy_window(skill, targets) if @active_battler.actor?
else
$game_temp.common_event_id = skill.common_event_id
end
@mix_item_flag = nil
end
#--------------------------------------------------------------------------
# Reflect Check
#--------------------------------------------------------------------------
def reflect_check(target, skill)
@reflected = false
@origtarget = target
unless skill.unreflectable
if target.reflect
@reflected = true
if target.actor? and @active_battler.actor?
target = $game_troop.random_target
elsif !target.actor? and !@active_battler.actor?
target = $game_party.random_target
else
target = @active_battler
end
end
end
return target
end
#--------------------------------------------------------------------------
# Show Action Results
#--------------------------------------------------------------------------
def display_action_effects(target, obj = nil)
unless target.skipped
line_number = @message_window.line_number
anti_no_effect = false
wait(5)
if @reflected
sound = YE::BATTLE::REFLECT_SND
sound.play
text = sprintf(YE::BATTLE::REFLECT_MSG, @origtarget.name, obj.name)
unless $imported["SceneBattleReDux"] and !@misc_msg
@reflected = false
@message_window.add_instant_text(text)
msgwait
@message_window.back_to(line_number)
end
end
if target.critical
display_critical(target, obj)
wait(YE::BATTLE::CRITWAIT)
@message_window.back_to(line_number)
end
display_damage(target, obj)
if $imported["Steal"] and obj.is_a?(RPG::Skill)
if obj.steal?
display_stole_object(target, obj)
end
end
if obj.is_a?(RPG::Skill)
if obj.dse > 0 and !target.missed and !target.evaded
effect_during(target, obj, obj.dse)
anti_no_effect = true
end
end
if $imported["EquipSkillSlots"] and obj.is_a?(RPG::Skill)
anti_no_effect = true if obj.skill_copy?
end
common_during(target, obj)
if obj.is_a?(RPG::Skill)
if target.hit_learn?(obj)
target.learn_skill(obj.id)
text = sprintf(YE::BATTLE::HIT_LEARN_MESSAGE, target.name, obj.name)
@message_window.add_instant_text(text)
msgwait
end
end
display_state_changes(target, obj)
anti_no_effect = true if target.states_active?
if line_number == @message_window.line_number
display_failure(target, obj) unless anti_no_effect
end
if line_number != @message_window.line_number
wait(YE::BATTLE::MSGWAIT)
end
@message_window.back_to(line_number)
end
end
#--------------------------------------------------------------------------
# Apply Skill Cost
#--------------------------------------------------------------------------
def apply_skill_cost(battler, skill)
if battler.charge_skill == nil
cost = battler.calc_mp_cost(skill)
if skill.cost_custom > 0
apply_custom_cost(battler, skill)
elsif skill.cur_mp_cost > 0
battler.mp -= cost
elsif skill.max_mp_cost > 0
battler.mp -= cost
elsif skill.cur_hp_cost > 0
battler.hp -= cost
elsif skill.max_hp_cost > 0
battler.hp -= cost
elsif skill.gold_cost > 0
return unless battler.actor?
cost *= -1
$game_party.gain_gold(cost)
elsif skill.maxgold_cost > 0
return unless battler.actor?
cost *= $game_party.gold
cost /= 100
cost *= -1
$game_party.gain_gold(cost)
elsif skill.rage_cost > 0
battler.rage -= cost
else
battler.mp -= cost
end
end
if $imported["SceneBattleReDux"] and battler.actor?
@status_window.draw_item(battler.index)
end
end
end # Scene_Battle
#===============================================================================
# Scene_Skill
#===============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# use_skill_nontarget
#--------------------------------------------------------------------------
def use_skill_nontarget
Sound.play_use_skill
apply_skill_cost(@actor, @skill)
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# Apply Skill Cost
#--------------------------------------------------------------------------
def apply_skill_cost(actor, skill)
if actor.charge_skill == nil
cost = actor.calc_mp_cost(skill)
if skill.cost_custom > 0
apply_custom_cost(actor, skill)
elsif skill.cur_mp_cost > 0
actor.mp -= cost
elsif skill.max_mp_cost > 0
actor.mp -= cost
elsif skill.cur_hp_cost > 0
actor.hp -= cost
elsif skill.max_hp_cost > 0
actor.hp -= cost
elsif skill.gold_cost > 0
cost *= -1
$game_party.gain_gold(cost)
elsif skill.maxgold_cost > 0
cost *= $game_party.gold
cost /= 100
cost *= -1
$game_party.gain_gold(cost)
elsif skill.rage_cost > 0
actor.rage -= cost
else
actor.mp -= cost
end
end
end
#--------------------------------------------------------------------------
# use_skill_nontarget
#--------------------------------------------------------------------------
def use_skill_nontarget
if @skill.subskills != [] and @actor.subskill_flag == nil
Sound.play_decision
create_subskill_window
return
end
Sound.play_use_skill
apply_skill_cost(@actor, @skill)
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# create subskill window
#--------------------------------------------------------------------------
def create_subskill_window
y = @help_window.height + @status_window.height
height = Graphics.height - @help_window.height - @status_window.height
if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::MENU_HELP_SHOW
height -= 56
end
skill = @skill
@actor.subskill_flag = true
@subskill_window = Window_Subskills.new(0, y, 544, height, @actor, skill)
@subskill_window.active = true
@subskill_window.z = 1
@subskill_window.help_window = @help_window
@subskill_window.viewport = @viewport
@skill_window.active = false
@skill_window.visible = false
end
#--------------------------------------------------------------------------
# alias update
#--------------------------------------------------------------------------
alias update_skill_submenu_cse update unless $@
def update
if @subskill_window != nil and @subskill_window.active
update_subskill_window
else
update_skill_submenu_cse
end
end
#--------------------------------------------------------------------------
# update_subskill_window
#--------------------------------------------------------------------------
def update_subskill_window
@subskill_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
@actor.subskill_flag = nil
@skill_window.active = true
@skill_window.visible = true
@subskill_window.dispose
@subskill_window = nil
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)
@skill = @subskill_window.skill
if @actor.skill_can_use?(@skill)
Sound.play_decision
@subskill_window.active = false
determine_skill
@actor.subskill_flag = nil
else
Sound.play_buzzer
end
elsif $imported["DisplaySkillQuery"] and
Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_MENU_BUTTON)
skill = @subskill_window.skill
if skill != nil
Sound.play_decision
@skill_data_window.appear(skill, @subskill_window, @actor)
@subskill_window.active = false
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# alias hide_target_window
#--------------------------------------------------------------------------
alias hide_target_window_cse hide_target_window unless $@
def hide_target_window
hide_target_window_cse
if @subskill_window != nil
@subskill_window.active = true
end
end
end
#===============================================================================
# Window_Base
#===============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# Draw Skill
#--------------------------------------------------------------------------
def draw_skill(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
skill_id = @data[index].id
actor_id = @actor.id
recharge = $game_actors[actor_id].recharge(skill_id)
#---
usage = $game_actors[actor_id].usage(skill_id)
if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE
if usage >= skill.usage
usagecheck = true
else
usagecheck = false
end
end
#---
rect.width -= 4
x = rect.x
y = rect.y
enabled = @actor.skill_can_use?(skill)
#---
draw_icon(skill.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0)
#---
cost = @actor.calc_mp_cost(skill)
if YE::BATTLE::USE_ICONS
#--- Use icons
rect.width -= 24
x = rect.x + rect.width
y = rect.y
#---
if usagecheck
self.contents.draw_text(rect, "", 2)
elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
self.contents.draw_text(x-30, y, 30, WLH, recharge, 2)
elsif cost == 0
self.contents.draw_text(rect, "", 2)
elsif skill.maxgold_cost > 0
self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2)
else
self.contents.draw_text(x-30, y, 30, WLH, cost, 2)
end
#---
if usagecheck
icon = YE::BATTLE::USAGE_ICON
elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
icon = YE::BATTLE::RECHARGE_ICON
elsif skill.cost_custom > 0
icon = @actor.create_cost_icon(skill)
elsif cost == 0
icon = 0
else
icon = @actor.create_cost_icon(skill)
end
draw_icon(icon, x, y, enabled)
#---
else
#--- Don't use icons
if usagecheck
text = sprintf(YE::BATTLE::USAGE_MSG, recharge)
elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
if recharge == 1
text = sprintf(YE::BATTLE::RECHARGE_MSG1, recharge)
else
text = sprintf(YE::BATTLE::RECHARGE_MSG, recharge)
end
elsif skill.cost_custom > 0
text = @actor.cost_custom(skill, 1)
elsif cost == 0
text = ""
elsif skill.cur_mp_cost > 0
text = sprintf(YE::BATTLE::MP_COST, cost)
elsif skill.max_mp_cost > 0
text = sprintf(YE::BATTLE::MP_COST, cost)
elsif skill.cur_hp_cost > 0
text = sprintf(YE::BATTLE::HP_COST, cost)
elsif skill.max_hp_cost > 0
text = sprintf(YE::BATTLE::HP_COST, cost)
elsif skill.gold_cost > 0
text = sprintf(YE::BATTLE::GOLD_COST, cost)
elsif skill.maxgold_cost > 0
text = sprintf(YE::BATTLE::MGOLD_COST, cost)
elsif skill.rage_cost > 0
text = sprintf(YE::BATTLE::RAGE_COST, cost)
else
text = sprintf(YE::BATTLE::MP_COST, cost)
end
x = rect.x + rect.width - 54
self.contents.draw_text(x, y, 54, WLH, text, 2)
#---
end
end
end
end
#===============================================================================
# Window_Skill
#===============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
draw_skill(index)
end
end # class Window_Skill < Window_Selectable
#==============================================================================
# Window_Mix_Item
#==============================================================================
class Window_Mix_Item < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor, skill)
super(x, y, width, height)
@column_max = 2
@actor = actor
@skill = skill
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
@data.push(item) if include?(item)
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# include?
#--------------------------------------------------------------------------
def include?(item)
return false unless item.is_a?(RPG::Item)
return false if item.dont_mix
return true if @skill.mix_items_all
for type in @skill.mix_types
return true if item.mix_types.include?(type)
end
return false
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
self.contents.font.color = normal_color
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, true)
self.contents.draw_text(rect, sprintf("亊%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# draw item name
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
if item.id == @actor.mix_item_1 and item.id == @actor.mix_item_2
self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR3)
elsif item.id == @actor.mix_item_1
self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR1)
elsif item.id == @actor.mix_item_2
self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR2)
else
self.contents.font.color = normal_color
end
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
end
end
#--------------------------------------------------------------------------
# update help
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
#===============================================================================
# Window Subskills
#===============================================================================
class Window_Subskills < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor, sk)
super(x, y, width, height)
@superskill = sk
@actor = actor
@column_max = 2
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for skill_id in @superskill.subskills
sk = $data_skills[skill_id]
next if sk == nil
@data.push(sk) if include?(sk)
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_skill(i)
end
end
#--------------------------------------------------------------------------
# skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# include?
#--------------------------------------------------------------------------
def include?(sk)
return false if sk == nil
return false if sk.require_level > @actor.level
return false if sk.require_learn and
[email protected]
_learn?(sk)
return false if sk.mix_items
return false if sk.subskills != []
return false if sk.chain_type > 0
return true
end
#--------------------------------------------------------------------------
# update_help
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end # Window_Subskills
#===============================================================================
# Window Chain Skill
#===============================================================================
class Window_Chain_Skill < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor, sk)
super(x, y, width, height)
@skill = sk
@actor = actor
@column_max = 1
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(chain_array = [])
@data = []
@chain_array = chain_array
array = []
#----------------------------
if @skill.chain_type == 1
for skill in @actor.skills
array.push(skill.id)
end
end
#----------------------------
if @skill.chain_type == 2
allowed_types = @skill.chain_array
for sk in @actor.skills
for type in sk.closed_type
array.push(sk.id) if allowed_types.include?(type)
end
end
end
#----------------------------
if @skill.chain_type == 3
for skill_id in @skill.chain_array
array.push(skill_id)
end
end
#----------------------------
for skill_id in array
sk = $data_skills[skill_id]
next if sk == nil
@data.push(sk) if include?(sk)
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_skill(i)
end
end
#--------------------------------------------------------------------------
# skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# include?
#--------------------------------------------------------------------------
def include?(sk)
return false if sk == nil
return false if sk.mix_items
return false if sk.require_level > @actor.level
return false if sk.require_learn and
[email protected]
_learn?(sk)
return false if sk.subskills != []
return false if sk.chain_type > 0
return true
end
#--------------------------------------------------------------------------
# Draw Skill
#--------------------------------------------------------------------------
def draw_skill(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
skill_id = @data[index].id
actor_id = @actor.id
recharge = $game_actors[actor_id].recharge(skill_id)
#---
usage = $game_actors[actor_id].usage(skill_id)
if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE
if usage >= skill.usage
usagecheck = true
else
usagecheck = false
end
end
#---
rect.width -= 4
x = rect.x
y = rect.y
enabled = skill_can_use?(skill)
#---
draw_icon(skill.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0)
#---
cost = @actor.calc_mp_cost(skill)
rect.width -= 24
x = rect.x + rect.width
y = rect.y
#---
if usagecheck
self.contents.draw_text(rect, "", 2)
elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
self.contents.draw_text(x-30, y, 30, WLH, recharge, 2)
elsif cost == 0
self.contents.draw_text(rect, "", 2)
elsif skill.maxgold_cost > 0
self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2)
else
self.contents.draw_text(x-30, y, 30, WLH, cost, 2)
end
#---
if usagecheck
icon = YE::BATTLE::USAGE_ICON
elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE
icon = YE::BATTLE::RECHARGE_ICON
elsif skill.cost_custom > 0
icon = @actor.create_cost_icon(skill)
elsif cost == 0
icon = 0
else
icon = @actor.create_cost_icon(skill)
end
draw_icon(icon, x, y, enabled)
end
end
#--------------------------------------------------------------------------
# skill_can_use?
#--------------------------------------------------------------------------
def skill_can_use?(sk)
return false if @chain_array.include?(sk.id) and
[email protected]
_chain
return true
end
#--------------------------------------------------------------------------
# update_help
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end # Window_Chain_Skill
#==============================================================================
# Window_Chain_Info
#==============================================================================
class Window_Chain_Info < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor, sk)
super(x, y, width, height)
@actor = actor
@skill = sk
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(array = [])
self.contents.clear
self.contents.font.color = normal_color
@array = array
draw_icon(@skill.icon_index, 0, 0)
self.contents.draw_text(24, 0, 166, WLH, @skill.name, 0)
text = sprintf(YE::BATTLE::CHAIN_MAX_TEXT, @array.size, @skill.chain_times)
self.contents.draw_text(190, 0, 50, WLH, text, 2)
draw_costs
dx = 0
dy = WLH * 2
for skill_id in @array
skill = $data_skills[skill_id]
draw_item_name(skill, dx, dy)
cost = @actor.calc_mp_cost(skill)
icon = @actor.create_cost_icon(skill)
draw_icon(icon, 216, dy)
self.contents.draw_text(186, dy, 30, WLH, cost, 2)
dy += WLH
break if dy + WLH > self.height - 32
end
end
#--------------------------------------------------------------------------
# draw costs
#--------------------------------------------------------------------------
def draw_costs
icon = YE::BATTLE::MP_ICON
draw_icon(icon, 44, 24)
icon = YE::BATTLE::HP_ICON
draw_icon(icon, 124, 24)
icon = YE::BATTLE::RAGE_ICON
draw_icon(icon, 204, 24)
mpcost = 0; hpcost = 0; ragecost = 0
for skill_id in @array
sk = $data_skills[skill_id]
next if sk == nil
if sk.cur_mp_cost > 0
mpcost += @actor.calc_mp_cost(sk)
elsif sk.max_mp_cost > 0
mpcost += @actor.calc_mp_cost(sk)
elsif sk.cur_hp_cost > 0
hpcost += @actor.calc_mp_cost(sk)
elsif sk.max_hp_cost > 0
hpcost += @actor.calc_mp_cost(sk)
elsif sk.rage_cost > 0
hpcost += @actor.calc_mp_cost(sk)
else
mpcost += @actor.calc_mp_cost(sk)
end
end
self.contents.draw_text(12, 24, 32, WLH, mpcost, 2)
self.contents.draw_text(92, 24, 32, WLH, hpcost, 2)
self.contents.draw_text(172, 24, 32, WLH, ragecost, 2)
end
end # Window_Chain_Info
#===============================================================================
#
# 脚本结束
#
#===============================================================================
复制代码
作者:
54酱
时间:
2012-6-27 19:37
http://rpg.blue/forum.php?mod=viewthread&tid=187384
纯连接不解释=,=
作者:
w3860000
时间:
2012-6-27 23:22
本帖最后由 w3860000 于 2012-6-27 23:23 编辑
54酱 发表于 2012-6-27 19:37
http://rpg.blue/forum.php?mod=viewthread&tid=187384
纯连接不解释=,=
不解释实在是会把自己变成伸手党,我用这语法
$game_actors[編號].cooling = Hash.new
如果这是你所想要给的给的答案的话我会很高兴,如果是完全不一样的,我想我会哭哭...
因为不知道什么时候会爆炸
作者:
这算小号吗
时间:
2012-7-23 13:46
这脚本好!横版能用就好!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1