延迟技能
# @taroxd metadata 1.0
# @require taroxd_core
# @id delay_item
# @display 延迟技能
# @help 
#       技能备注<delay message s>,s为技能施放时提示的信息。
#       其中使用者名称用\N代替。

module Taroxd
  DelayItem = '\N'     # 用 \N 代替使用者名称
end

class RPG::UsableItem
  note_i :delay, false
  note_s :delay_message
end

class Window_BattleLog < Window_Selectable

  def display_delay_use_item(subject, item)
    add_text(item.delay_message.gsub(Taroxd::DelayItem, subject.name))
  end
end

class Scene_Battle < Scene_Base

  def_after(:start) { @delay_list = [] }

  def_chain :execute_action do |old|
    item = @subject.current_action.item
    return old.call unless item.delay
    @log_window.display_delay_use_item(@subject, item)
    subject = @subject
    action = @subject.current_action
    @delay_list.push Fiber.new {
      item.delay.times { Fiber.yield }
      subject.actions.unshift(action)
      @subject, subject = subject, @subject
      old.call
      @subject.remove_current_action
      @subject = subject
      true
    }
  end

  def_before(:turn_end) { @delay_list.delete_if(&:resume) }
end
定值再生
# @taroxd metadata 1.0
# @id const_rg
# @display 定值再生
# @require taroxd_core
# @help 备注<hrg x>,表示每回合回复 x 点 HP。
#       备注<trg x>,表示每回合回复 x 点 TP。
#       其中 x 可以为负数

Taroxd::ConstRG = true

%w(h m t).each do |type|
  name = "#{type}rg"
  RPG::BaseItem.note_f name
  Game_BattlerBase.class_eval %{
    def_with :#{name} do |old|
      max = m#{type}p
      max == 0 ? old : feature_objects.sum(old) { |obj| obj.#{name} / max }
    end
  }
end
游戏常数设置
# @taroxd metadata 1.0
# @display 游戏常数设置
# @require taroxd_core
# @id const
module Taroxd::Const

  # 游戏常数设置区域(如果要用默认值,可以设置为 false 或直接删除)

  SAVEFILE_MAX = 16               # 存档文件的最大个数
  ESCAPE_RATIO_UP = 0.1           # 撤退失败后,撤退成功率提升值
  MAX_TP = 100                    # TP 的最大值
  ATTACK_SKILL_ID = 1             # 默认攻击技能 ID
  GUARD_SKILL_ID = 2              # 默认防御技能 ID
  DEATH_STATE_ID = 1              # 默认死亡状态 ID
  PARAM_LIMIT = 999999            # 能力值的最大值
  PRESERVE_TP = false             # 是否永远特技专注
  LUK_EFFECT_RATE = 0.001         # 幸运值影响程度
  CRITICAL_RATE = 3               # 关键一击伤害倍率
  STEPS_FOR_RUN = 20              # 地图上多少步等于一回合
  BASIC_FLOOR_DAMAGE = 10         # 地形伤害的基础值
  MAX_BATTLE_MEMBERS = 4          # 参战角色的最大数
  MAX_GOLD = 99999999             # 持有金钱的最大值
  MAX_ITEM_NUMBER = 99            # 物品的最大持有数
  BUSH_DEPTH = 8                  # 流体地形的深度
  BUSH_OPACITY = 128              # 流体地形的不透明度
  PLAYER_INITIAL_DIRECTION = 2    # 角色初始朝向
  SUBSTITUTE_HP_RATE = 0.25       # HP 比率达到多少以下会触发保护弱者
  Font.default_name = 'nsimsun'   # 默认字体名称
  Font.default_size = 24          # 默认字体大小

  def self.[](sym)
    const_defined?(sym, false) && const_get(sym)
  end
end

def DataManager.savefile_max
  Taroxd::Const::SAVEFILE_MAX
end if Taroxd::Const[:SAVEFILE_MAX]

def BattleManager.process_escape
  $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  success = @preemptive ? true : (rand < @escape_ratio)
  Sound.play_escape
  if success
    process_abort
  else
    @escape_ratio += Taroxd::Const::ESCAPE_RATIO_UP
    $game_message.add('\.' + Vocab::EscapeFailure)
    $game_party.clear_actions
  end
  wait_for_message
  success
end if Taroxd::Const[:ESCAPE_RATIO_UP]

class Game_BattlerBase

  def max_tp
    Taroxd::Const::MAX_TP
  end if Taroxd::Const[:MAX_TP]

  def attack_skill_id
    Taroxd::Const::ATTACK_SKILL_ID
  end if Taroxd::Const[:ATTACK_SKILL_ID]

  def guard_skill_id
    Taroxd::Const::GUARD_SKILL_ID
  end if Taroxd::Const[:GUARD_SKILL_ID]

  def death_state_id
    Taroxd::Const::DEATH_STATE_ID
  end if Taroxd::Const[:DEATH_STATE_ID]

  def param_min(_)
    0
  end if Taroxd::Const[:PARAM_LIMIT]

  def param_max(_)
    Taroxd::Const::PARAM_LIMIT
  end if Taroxd::Const[:PARAM_LIMIT]

  def preserve_tp?
    true
  end if Taroxd::Const[:PRESERVE_TP]
end

class Game_Battler < Game_BattlerBase

  def luk_effect_rate(user)
    [1.0 + (user.luk - luk) * Taroxd::Const::LUK_EFFECT_RATE, 0.0].max
  end if Taroxd::Const[:LUK_EFFECT_RATE]

  def apply_critical(damage)
    damage * Taroxd::Const::CRITICAL_RATE
  end if Taroxd::Const[:CRITICAL_RATE]
end

class Game_Actor < Game_Battler

  remove_method :param_max if Taroxd::Const[:PARAM_LIMIT]

  def steps_for_turn
    Taroxd::Const::STEPS_FOR_RUN
  end if Taroxd::Const[:STEPS_FOR_RUN]

  def basic_floor_damage
    Taroxd::Const::BASIC_FLOOR_DAMAGE
  end if Taroxd::Const[:BASIC_FLOOR_DAMAGE]
end

class Game_Party < Game_Unit

  def max_battle_members
    Taroxd::Const::MAX_BATTLE_MEMBERS
  end if Taroxd::Const[:MAX_BATTLE_MEMBERS]

  def max_gold
    Taroxd::Const::MAX_GOLD
  end if Taroxd::Const[:MAX_GOLD]

  def max_item_number(_)
    Taroxd::Const::MAX_ITEM_NUMBER
  end if Taroxd::Const[:MAX_ITEM_NUMBER]
end

class Game_CharacterBase

  def update_bush_depth
    if normal_priority? && !object_character? && bush? && !jumping?
      @bush_depth = Taroxd::Const::BUSH_DEPTH unless moving?
    else
      @bush_depth = 0
    end
  end if Taroxd::Const[:BUSH_DEPTH]
end

class Sprite_Character < Sprite_Base

  def_after :initialize do |_, _ = nil|
    self.bush_opacity = Taroxd::Const::BUSH_OPACITY
  end if Taroxd::Const[:BUSH_OPACITY]
end

class Game_Player < Game_Character

  def_after :initialize do
    @direction = Taroxd::Const::PLAYER_INITIAL_DIRECTION
  end if Taroxd::Const[:PLAYER_INITIAL_DIRECTION]
end

class Scene_Battle < Scene_Base

  def check_substitute(target, item)
    target.hp_rate < Taroxd::Const::SUBSTITUTE_HP_RATE &&
      (!item || !item.certain?)
  end if Taroxd::Const[:SUBSTITUTE_HP_RATE]
end