查看: 2848|回复: 2

[已经过期] 求一个回溯脚本

[复制链接]
梦石
0
星屑
254
在线时间
24 小时
注册时间
2018-7-14
回帖
3
发表于 2021-9-21 13:55:52 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
如题,就是指定能让敌人或者我方的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
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2021-9-21 16:35:45 | 显示全部楼层
想改成什么效果?具体说一下..
回复

使用道具 举报

梦石
0
星屑
254
在线时间
24 小时
注册时间
2018-7-14
回帖
3
 楼主| 发表于 2021-11-1 21:48:23 | 显示全部楼层
soulsaga 发表于 2021-9-21 16:35
想改成什么效果?具体说一下..

比如说是将一个技能设定为可以将我方或者敌方角色的状态或者hp mp tp 调回X回合以前
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部