| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 3 |
| 经验 | |
| 最后登录 | 2024-2-5 |
| 在线时间 | 24 小时 |
- 梦石
- 0
- 星屑
- 254
- 在线时间
- 24 小时
- 注册时间
- 2018-7-14
- 回帖
- 3
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
如题,就是指定能让敌人或者我方的hp值和mp值回溯到XX回合之前一类的大佬写的参考脚本,指定向单人回溯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
原帖:https://rpg.blue/thread-481466-1-15.html |
|