本帖最后由 KB.Driver 于 2019-6-21 23:47 编辑
先参考系统的反击(对受到的物理攻击用普通攻击反击)
然后用相同的方法写一个就行:
#============================================================================== # ■ 自定义技能反击 by Calendar99 #------------------------------------------------------------------------------ # 略。 #============================================================================== module CLD99 module SpecialInvoke # 反击表 # # 格式: # 英雄编号 => 反击技能编号 # LIST = { 1 => 80, 2 => 1 } end end class Scene_Battle #-------------------------------------------------------------------------- # ● [别名修改]发动技能/物品 #-------------------------------------------------------------------------- alias invoke_item_for_special invoke_item def invoke_item(target, item) invoke_item_for_special(target, item) # 原方法 if @subject.enemy? && target.actor? if skill_id = CLD99::SpecialInvoke::LIST[target.actor.id] invoke_special_attack(target, skill_id) end end end #-------------------------------------------------------------------------- # ● [追加]特殊反击 #-------------------------------------------------------------------------- def invoke_special_attack(target, skill_id) counter_skill = $data_skills[skill_id] @log_window.display_counter_special(target, counter_skill) @subject.item_apply(target, counter_skill) refresh_status @log_window.display_action_results(@subject, counter_skill) end end class Window_BattleLog #-------------------------------------------------------------------------- # ● 显示反击 #-------------------------------------------------------------------------- def display_counter_special(target, item) back_one Sound.play_evasion add_text(sprintf("%s使用%s进行反击!", target.name, item.name)) wait end end
#==============================================================================
# ■ 自定义技能反击 by Calendar99
#------------------------------------------------------------------------------
# 略。
#==============================================================================
module CLD99
module SpecialInvoke
# 反击表
#
# 格式:
# 英雄编号 => 反击技能编号
#
LIST = {
1 => 80,
2 => 1
}
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● [别名修改]发动技能/物品
#--------------------------------------------------------------------------
alias invoke_item_for_special invoke_item
def invoke_item(target, item)
invoke_item_for_special(target, item) # 原方法
if @subject.enemy? && target.actor?
if skill_id = CLD99::SpecialInvoke::LIST[target.actor.id]
invoke_special_attack(target, skill_id)
end
end
end
#--------------------------------------------------------------------------
# ● [追加]特殊反击
#--------------------------------------------------------------------------
def invoke_special_attack(target, skill_id)
counter_skill = $data_skills[skill_id]
@log_window.display_counter_special(target, counter_skill)
@subject.item_apply(target, counter_skill)
refresh_status
@log_window.display_action_results(@subject, counter_skill)
end
end
class Window_BattleLog
#--------------------------------------------------------------------------
# ● 显示反击
#--------------------------------------------------------------------------
def display_counter_special(target, item)
back_one
Sound.play_evasion
add_text(sprintf("%s使用%s进行反击!", target.name, item.name))
wait
end
end
效果:
|