事件寻路
# @taroxd metadata 1.0
# @id event_astar
# @require taroxd_core
# @require astar
# @display 事件寻路
Taroxd::EventAStar = true

class Game_Character < Game_CharacterBase
  def find_path_toward(x, y)
    return @find_path if @find_path_xy == [x, y, @x, @y]
    @find_path = Taroxd::AStar.path(self, x, y)
    @find_path_xy = x, y, @x, @y
    @find_path
  end

  # 保留原方法,以备需要的时候使用。
  alias_method :move_toward_character_directly, :move_toward_character

  def move_toward_character(character)
    dir = find_path_toward(character.x, character.y).shift
    return move_toward_character_directly(character) unless dir
    move_straight(dir)
    @find_path_xy[2, 2] = @x, @y if @move_succeed
  end

  # 使用此方法 require 坐标类
  def move_toward_point(x, y)
    move_toward_character Taroxd::Point[x, y]
  end
end

class Game_Event < Game_Character
  alias_method :move_type_toward_player, :move_toward_player
end
脚本快捷方式
# @taroxd metadata 1.0
# @require taroxd_core
# @id eval
# @display 脚本快捷方式
# @deprecated 
module Taroxd::Eval

  Game_Character.send   :include, self
  Game_Interpreter.send :include, self
  # 脚本中的简称列表
  SCRIPT_ABBR_LIST = {
    'V' => '$game_variables',
    'S' => '$game_switches',
    'N' => '$game_actors',
    'A' => '$game_actors',
    'P' => '$game_party',
    'G' => '$game_party.gold',
    'E' => '$game_troop'
  }
  # 处理脚本用的正则表达式
  words = SCRIPT_ABBR_LIST.keys.join('|')
  SCRIPT_ABBR_RE = /(?<!::|['"\\\.])\b(?:#{words})\b(?! *[(@$\w'"])/


  module_function

  def process_script(script)
    script.gsub(SCRIPT_ABBR_RE, SCRIPT_ABBR_LIST)
  end

  def eval(script, *args)
    v = $game_variables
    s = $game_switches
    n = $game_actors
    a = $game_actors
    p = $game_party
    g = $game_party.gold
    e = $game_troop
    script = process_script(script)
    if args.empty?
      instance_eval(script, __FILE__, __LINE__)
    else
      Kernel.eval(script, *args)
    end
  end
end

class RPG::UsableItem::Damage
  def eval(a, b, v)
    value = Taroxd::Eval.eval(@formula, b.formula_binding(a, b, v))
    value > 0 ? value * sign : 0
  end
end

class Game_BattlerBase
  def formula_binding(a, b, v)
    s = $game_switches
    n = $game_actors
    p = $game_party
    g = $game_party.gold
    e = $game_troop
    binding
  end
end

class Window_Base < Window
  # 对 #{} 的处理
  process_expression = Proc.new do |old|
    old.gsub(/\e?#(?<brace>\{([^{}]|\g<brace>)*\})/) do |code|
      next code if code.slice!(0) == "\e"
      Taroxd::Eval.eval code[1..-2]
    end
  end
  def_with :convert_escape_characters, process_expression
end
调整敌人位置
# @taroxd metadata 1.0
# @require taroxd_core
# @id enemy_offset
# @display 调整敌人位置
# @help 

Taroxd::EnemyOffset = true

class RPG::Enemy < RPG::BaseItem
  note_i :offset_x
  note_i :offset_y
end

class Game_Troop
  def_after :setup do |_|
    @enemies.each do |enemy|
      enemy.screen_x += enemy.enemy.offset_x
      enemy.screen_y += enemy.enemy.offset_y
    end
  end
end