b200077 发表于 2020-3-24 09:50
这个应该可以用数组做,每个回合记录血量和法力。
下面这段每个回合执行一次,
$HP[$game_system.battle_co ...
b200077 发表于 2020-3-24 09:50
这个应该可以用数组做,每个回合记录血量和法力。
下面这段每个回合执行一次,
$HP[$game_system.battle_co ...
$QW60XWQWH29093VCRY%SVY.png (10.33 KB, 下载次数: 45)
_9`ZBWZO4~O0GU88H@$`C7B.png (10.54 KB, 下载次数: 32)
module CLD99 module REWIND_HP_MP # 回溯的回合数 DEPTH = 3 # 信息格式(请不要修改汉字以外的部分) FMT = "%s的%s与%s恢复到了#{DEPTH}回合之前" end end #--------------------------------------------------------------------------# # ● 修改以下部分所造成的后果由修改者本人负责 ● # #--------------------------------------------------------------------------# class RPG::Skill def rewind_skill? self.note =~ /<回溯>/ end end class Game_Actor #-------------------------------------------------------------------------- # ● 战斗开始处理 #-------------------------------------------------------------------------- def on_battle_start super store_hp_mp end #-------------------------------------------------------------------------- # ● 回合结束处理 #-------------------------------------------------------------------------- def on_turn_end super store_hp_mp end #-------------------------------------------------------------------------- # ● 战斗结束处理 #-------------------------------------------------------------------------- def on_battle_end super clear_stroring_hp_mp end def store_hp_mp if skills.any?{|s| s.rewind_skill? } @storing_hp ||= [] @storing_mp ||= [] @storing_hp << @hp @storing_mp << @mp end end def rewind_hp_mp turn = [$game_troop.turn_count - CLD99::REWIND_HP_MP::DEPTH, 0].max @hp = @storing_hp[turn] @mp = @storing_mp[turn] end def clear_stroring_hp_mp if skills.any?{|s| s.rewind_skill? } @storing_hp && @storing_hp.clear @storing_mp && @storing_mp.clear end end end class Scene_Battle #-------------------------------------------------------------------------- # ● 发动技能/物品 #-------------------------------------------------------------------------- alias invoke_item_for_rewind_hp_mp invoke_item def invoke_item(target, item) invoke_item_for_rewind_hp_mp(target, item) if item.is_a?(RPG::Skill) && item.rewind_skill? target.rewind_hp_mp end end end class Window_BattleLog #-------------------------------------------------------------------------- # ● 显示行动结果 #-------------------------------------------------------------------------- alias display_action_results_for_rewind_hp_mp display_action_results def display_action_results(target, item) if item.is_a?(RPG::Skill) && item.rewind_skill? add_text(CLD99::REWIND_HP_MP::FMT % [target.name, Vocab.hp, Vocab.mp]) end display_action_results_for_rewind_hp_mp(target, item) end end
KB.Driver 发表于 2020-3-24 13:22
在技能备注栏写,效果范围必须设置为使用者
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |