查看: 1814|回复: 8

[已经解决] 主角当怪物属性战斗- 弹错..

[复制链接]
梦石
0
星屑
539
在线时间
664 小时
注册时间
2010-6-30
回帖
198
发表于 2013-12-10 17:43:00 | 显示全部楼层 |阅读模式
悬赏1星屑已解决
本帖最后由 Front 于 2013-12-10 17:42 编辑

http://rpg.blue/forum.php?mod=viewthread&tid=173585 原地址..

很需要用到这个脚本,作者确N久没上线了...
脚本是在敌人名字后+ “_ID”敌人直接用主角属性...但是如果没有加“_ID”就会出错脚本,本身问题...
谁能修一下,不然用这脚本后就所有敌人都得同步成主角属性了,敌人设置属性都作废掉..
  1. #_____________________________________________________________________________
  2. # * 此脚本归66RPG - Idiot Script Association(ISA)及坏人协会所有,谢绝任何形式转载。
  3. #-----------------------------------------------------------------------------

  4. #==============================================================================
  5. # ■ 主角当怪物属性战斗 - Actor Change Enemy
  6. #------------------------------------------------------------------------------
  7. #   遵守协议:66RPG - Idiot Script Association(ISA)
  8. #             66RPG - 坏人协会
  9. #   初始脚本:退屈无聊
  10. #   更新优化:无
  11. #   当前版本:1.0.0.1
  12. #------------------------------------------------------------------------------
  13. #   更新日记:退屈无聊(2011.3.26)
  14. #             - 初始化
  15. #             退屈无聊(2011.3.26)
  16. #             - 修正level2计算时的BUG
  17. #             退屈无聊(2011.3.27)
  18. #             - 修正获取actor等级的BUG
  19. #==============================================================================
  20. #--------------------------------------------------------------------------
  21. # ● 资料记录
  22. #--------------------------------------------------------------------------

  23. module ISA
  24.    Use["主角当怪物战斗"] = [true, "1.0.0.1"]
  25.    System["主角当怪物战斗"] = {}
  26. end

  27. #--------------------------------------------------------------------------
  28. # ● 设定部分
  29. #--------------------------------------------------------------------------
  30. module ISA
  31.   System["主角当怪物战斗"]["难度"] = 5
  32.   System["主角当怪物战斗"]["怪物名改为角色名"] = true
  33.   System["主角当怪物战斗"]["显示怪物等级"] = true
  34. end

  35. class Game_Enemy < Game_Battler
  36.   attr_accessor :level                         # 怪物等级
  37.   include ISA
  38.   def initialize(index, enemy_id)
  39.     super()
  40.     [url=home.php?mod=space&uid=370741]@Index[/url] = index
  41.     @enemy_id = enemy_id
  42.     enemy = $data_enemies[@enemy_id]
  43.     @original_name = enemy.name.split("_")[0]
  44.     level1 = 0
  45.     level2 = 10000
  46.     for i in 1..$game_party.members.size
  47.       actor = $game_party.members[i-1]
  48.       level1 = actor.level if level1 < actor.level
  49.       level2 = actor.level if level2 > actor.level
  50.     end
  51.     @b = rand(level1 - level2)
  52.     [url=home.php?mod=space&uid=22147]@level[/url] = level2.to_i + @b.to_i + System["主角当怪物战斗"]["难度"]
  53.     [url=home.php?mod=space&uid=22147]@level[/url] = 99 if [url=home.php?mod=space&uid=22147]@level[/url] > 99
  54.     @level = enemy.name.split("_")[2].to_i if enemy.name.split("_")[2] != nil
  55.     @letter = ''
  56.     @plural = false
  57.     @screen_x = 0
  58.     @screen_y = 0
  59.     @cp = 65535
  60.     @battler_name = enemy.battler_name
  61.     @battler_hue = enemy.battler_hue
  62.     @hp = maxhp
  63.     @mp = maxmp
  64.     @exp_list = Array.new(101)
  65.     make_exp_list
  66.     [url=home.php?mod=space&uid=13302]@exp[/url] = @exp_list[@level]
  67.     @o = @original_name.split("_")[1]
  68.   end
  69.   def name
  70.     if System["主角当怪物战斗"]["怪物名改为角色名"]
  71.       if System["主角当怪物战斗"]["显示怪物等级"]
  72.       return $data_actors[enemy.name.split("_")[1].to_i].name + @level.to_s + "级"
  73.       else
  74.       return $data_actors[enemy.name.split("_")[1].to_i].name
  75.     end
  76.   else
  77.     if System["主角当怪物战斗"]["显示怪物等级"]
  78.       return enemy.name.split("_")[0] + @level.to_s + "级"
  79.       else
  80.       return enemy.name.split("_")[0]
  81.     end
  82.     end
  83.   end
  84.   def base_maxhp
  85.     @a_maxhp = $data_actors[enemy.name.split("_")[1].to_i].parameters[0, @level]*1.3
  86.     return @a_maxhp.to_i
  87.   end
  88.   def base_maxmp
  89.     @a_maxmp = $data_actors[enemy.name.split("_")[1].to_i].parameters[1, @level]
  90.     return @a_maxmp
  91.   end
  92.   def base_atk # 获取基本攻击力
  93.     @a_atk = $data_actors[enemy.name.split("_")[1].to_i].parameters[2, @level]
  94.     return @a_atk
  95.   end
  96.   def base_def # 获取基本防御力
  97.     @a_def = $data_actors[enemy.name.split("_")[1].to_i].parameters[3, @level]
  98.     return @a_def
  99.   end
  100.   def base_spi # 获取基本防御力
  101.     @a_spi = $data_actors[enemy.name.split("_")[1].to_i].parameters[4, @level]
  102.     return @a_spi
  103.   end
  104.   def base_agi # 获取基本敏捷
  105.     @a_agi = $data_actors[enemy.name.split("_")[1].to_i].parameters[5, @level]
  106.     return @a_agi
  107.   end
  108. end

复制代码

  1. #______________________________________________________________________________
  2. # * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
  3. #______________________________________________________________________________

  4. #==============================================================================
  5. # ■ 接入包 - Access Package
  6. #------------------------------------------------------------------------------
  7. #   遵守协议:66RPG - Idiot Script Association(ISA)
  8. #   当前版本:1.0.0.0
  9. #------------------------------------------------------------------------------
  10. #   更新日记:忧雪の伤(2011.3.11)
  11. #             - 初始化
  12. #==============================================================================

  13. #--------------------------------------------------------------------------
  14. # ● Start
  15. #--------------------------------------------------------------------------

  16. module ISA
  17.    Use = {}
  18.    System = {}
  19.    Switch = {}
  20.    Actor = load_data("Data/Actors.rvdata")
  21. end
  22.   
  23. #--------------------------------------------------------------------------
  24. # ● 资料记录
  25. #--------------------------------------------------------------------------

  26. module ISA
  27.    Use["接入包"] = [true, "1.0.0.0"]
  28. end
复制代码

最佳答案

查看完整内容

笑死我了,你应该怪这倒霉的论坛。 你把“主角当怪物属性战斗 ●” 第79行的@Index改成@index就行了 无非是个大小写的问题,这个时候你应该把@传说VS天涯 叫过来殴打一顿。

老黄鸡

梦石
4
星屑
45709
在线时间
7951 小时
注册时间
2009-7-6
回帖
13338

MZ评测员RM创作大赛01组委会开拓者贵宾

发表于 2013-12-10 17:43:01 | 显示全部楼层
笑死我了,你应该怪这倒霉的论坛。
你把“主角当怪物属性战斗 ●” 第79行的@Index改成@index就行了
无非是个大小写的问题,这个时候你应该把@传说VS天涯 叫过来殴打一顿。

评分

参与人数 2星屑 +13 收起 理由
Front + 12 太精辟了!你帮了我太多问题...
怪蜀黍 + 1 笑尿,投殴打票

查看全部评分

RGDirect - DirectX驱动的RGSS,点我了解.
(排满,暂停)RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

百合乡の蕾咪

梦石
0
星屑
75
在线时间
151 小时
注册时间
2011-1-12
回帖
196
发表于 2013-12-11 00:33:32 | 显示全部楼层
[pre lang="ruby" line="1"]#______________________________________________________________________________
# * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
#______________________________________________________________________________

#==============================================================================
# ■ 接入包 - Access Package
#------------------------------------------------------------------------------
#   遵守协议:66RPG - Idiot Script Association(ISA)
#   当前版本:1.0.0.0
#------------------------------------------------------------------------------
#   更新日记:忧雪の伤(2011.3.11)
#             - 初始化
#==============================================================================

#--------------------------------------------------------------------------
# ● Start
#--------------------------------------------------------------------------

module ISA
   Use = {}
   System = {}
   Switch = {}
   Actor = load_data("Data/Actors.rvdata")
end
  
#--------------------------------------------------------------------------
# ● 资料记录
#--------------------------------------------------------------------------

module ISA
   Use["接入包"] = [true, "1.0.0.0"]
end

#_____________________________________________________________________________
# * 此脚本归66RPG - Idiot Script Association(ISA)及坏人协会所有,谢绝任何形式转载。
#-----------------------------------------------------------------------------

#==============================================================================
# ■ 主角当怪物属性战斗 - Actor Change Enemy
#------------------------------------------------------------------------------
#   遵守协议:66RPG - Idiot Script Association(ISA)
#             66RPG - 坏人协会
#   初始脚本:退屈无聊
#   更新优化:无
#   当前版本:1.0.0.1
#------------------------------------------------------------------------------
#   更新日记:退屈无聊(2011.3.26)
#             - 初始化
#             退屈无聊(2011.3.26)
#             - 修正level2计算时的BUG
#             退屈无聊(2011.3.27)
#             - 修正获取actor等级的BUG
#==============================================================================

#--------------------------------------------------------------------------
# ● 资料记录
#--------------------------------------------------------------------------

module ISA
   Use["主角当怪物战斗"] = [true, "1.0.0.1"]
   System["主角当怪物战斗"] = {}
end

#--------------------------------------------------------------------------
# ● 设定部分
#--------------------------------------------------------------------------

module ISA
  System["主角当怪物战斗"]["难度"] = 1
  System["主角当怪物战斗"]["怪物名改为角色名"] = true
  System["主角当怪物战斗"]["显示怪物等级"] = true
end

class Game_Enemy < Game_Battler
  attr_accessor :level                         # 怪物等级
  include ISA
  def initialize(index, enemy_id)
    super()
    @Index = index
    @enemy_id = enemy_id
    enemy = $data_enemies[@enemy_id]
    @original_name = enemy.name
    @letter = ''
    @plural = false
    @screen_x = 0
    @screen_y = 0
    @battler_name = enemy.battler_name
    @battler_hue = enemy.battler_hue
    @original_name, @enemy_actor_id, set_level = *enemy.name.split("_")
    if set_level
      level1 = 0
      level2 = 10000
      for i in 1..$game_party.members.size
        actor = $game_party.members[i-1]
        level1 = actor.level if level1 < actor.level
        level2 = actor.level if level2 > actor.level
      end
      @level = level2.to_i + rand(level2 - level1) + System["主角当怪物战斗"]["难度"]
      @level = [@level.to_i, 99].min
    else
      @level = set_level.to_i
    end
    @cp = 65535
    @exp_list = Array.new(101)
    make_exp_list
    @hp = maxhp
    @mp = maxmp
  end
  
  def name
    return @original_name unless @enemy_actor_id
    if System["主角当怪物战斗"]["怪物名改为角色名"]
      if System["主角当怪物战斗"]["显示怪物等级"]
        return $data_actors[@enemy_actor_id.to_i].name + @level.to_s + "级"
      else
        return $data_actors[@enemy_actor_id.to_i].name
      end
    else
      if System["主角当怪物战斗"]["显示怪物等级"]
        return @original_name + @level.to_s + "级"
      else
        return @original_name
      end
    end
  end
  
  def base_maxhp
    return enemy.maxhp unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[0, @level].to_i / 3
  end
  def base_maxmp
    return enemy.maxmp unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[1, @level]
  end
  def base_atk # 获取基本攻击力
    return enemy.atk unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[2, @level]
  end
  def base_def # 获取基本防御力
    return enemy.def unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[3, @level]
  end
  def base_spi # 获取基本防御力
    return enemy.spi unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[4, @level]
  end
  def base_agi # 获取基本敏捷
    return enemy.agi unless @enemy_actor_id
    return $data_actors[@enemy_actor_id.to_i].parameters[5, @level]
  end
  #--------------------------------------------------------------------------
  # 命中率、会心一击率、闪躲率、受伤率、属性修正、状态有效需要自己在怪物界面写
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  # ● 计算经验值
  #--------------------------------------------------------------------------
  def make_exp_list
    return unless @enemy_actor_id
    @exp_list[1] = @exp_list[100] = 0
    m = $data_actors[@enemy_actor_id.to_i].exp_basis
    n = 0.75 + $data_actors[@enemy_actor_id.to_i].exp_inflation / 200.0;
    for i in 2..99
      @exp_list = @exp_list[i-1] + Integer(m)
      m *= 1 + n;
      n *= 0.9;
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取经验值
  #--------------------------------------------------------------------------
  def exp
    return enemy.exp unless @enemy_actor_id
    return (@exp_list[@level+1] / 7).to_i
  end
  #--------------------------------------------------------------------------
  # ● 获取金钱
  #--------------------------------------------------------------------------
  def gold
    return enemy.gold unless @enemy_actor_id
    return rand(@level + 1) + rand(10) + 10
  end
  #--------------------------------------------------------------------------
  # 掉落物品也在怪物界面设置
  #--------------------------------------------------------------------------
end
[/pre]

评分

参与人数 1星屑 +12 收起 理由
Front + 12 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
539
在线时间
664 小时
注册时间
2010-6-30
回帖
198
 楼主| 发表于 2013-12-11 08:10:47 | 显示全部楼层
蕾米莉亚·斯卡雷特 发表于 2013-12-11 00:33
#______________________________________________________________________________
# * 此脚本归66RPG -  ...

和ACT跟Sideview冲突了,旧脚本不会...

[pre lang="ruby" line="1"]  #--------------------------------------------------------------------------
  # ● ACTゲージ切り替え
  #--------------------------------------------------------------------------
  def change_act(act_type, actor, index)
    @actor_sprites[index].change_act(act_type) if actor
    @enemy_sprites[index].change_act(act_type) unless actor
  end[/pre]


[pre lang="ruby" line="1"]#==============================================================================
# ■ Scene_Battle  for ATB Ver1.2c
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias start_n02 start
  def start
    $gauge_stop = true
    $game_party.atb_customize
    start_n02
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  alias terminate_n02 terminate # Enu code; 1.1e
  def terminate
    terminate_n02
    # 二刀流の持ち替え処理を戻す
    for member in $game_party.members
      if member.two_swords_change
        member.change_equip_by_id(1, member.weapon_id)
        member.change_equip_by_id(0, 0)
        member.two_swords_change = false
      end  
      member.clear_sprite_effects
    end
  end
  #--------------------------------------------------------------------------
  # ● 戦闘開始の処理
  #--------------------------------------------------------------------------
  alias process_battle_start_n02 process_battle_start
  def process_battle_start
    @end_member = 0
    preemptive if $game_troop.preemptive
    surprise if $game_troop.surprise
    @status_window.visible = true
    process_battle_start_n02
    @status_window.refresh
    $gauge_stop = false
  end
  #--------------------------------------------------------------------------
  # ● 先制処理
  #--------------------------------------------------------------------------
  def preemptive
    $game_troop.preemptive = false
    for member in $game_party.members + $game_troop.members
      member.at_count = 1000 if member.actor?
      member.at_count = N02::ATB_BACKATTACK * -10 if !member.actor?
    end  
  end
  #--------------------------------------------------------------------------
  # ● 不意打ち処理
  #--------------------------------------------------------------------------
  def surprise
    $game_troop.surprise = false
    for member in $game_party.members + $game_troop.members
      member.at_count = N02::ATB_BACKATTACK * -10 if member.actor?
      member.at_count = 1000 if !member.actor?
    end
  end
  #--------------------------------------------------------------------------
  # ● 情報表示ビューポートの解放
  #--------------------------------------------------------------------------
  alias dispose_info_viewport_n02 dispose_info_viewport
  def dispose_info_viewport
    dispose_info_viewport_n02
    @cursor.dispose if @cursor != nil && !@cursor.disposed?
    @help_window.dispose if @help_window != nil && !@help_window.disposed?
    @help_window = nil
    @help_window2.dispose if @help_window2 != nil && !@help_window2.disposed?
    @help_window2 = nil
    @skill_window.dispose if @skill_window != nil && !@skill_window.disposed?
    @skill_window = nil
    @item_window.dispose if @item_window != nil && !@item_window.disposed?
    @item_window = nil # 1.1b
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新  ※再定義
  #--------------------------------------------------------------------------
  def update
    super
    update_basic(true)
    # plays out party escape; 1.1e
    do_party_escape if @escape && $game_party.inputable? unless @judge
    unless $game_message.visible                # メッセージ表示中以外
      return if judge_win_loss if @judge == nil # 勝敗判定
      update_scene_change
    end
  end
  #--------------------------------------------------------------------------
  # ● Update Basic
  # frame update, runs the show
  # 1.1h - added a method to process the next common event, if necessary
  #--------------------------------------------------------------------------
  def update_basic(main = false)
    Graphics.update unless main                 # ゲーム画面を更新
    Input.update unless main                    # 入力情報を更新
    $game_system.update                         # タイマーを更新
    $game_troop.update                          # 敵グループを更新
    @spriteset.update                           # スプライトセットを更新
    @message_window.update                      # メッセージウィンドウを更新
    update_info_viewport if !$gauge_stop        # 情報表示ビューポートを更新
    # カーソル更新
    @cursor.update if @cursor != nil && @cursor.visible
    # メッセージ表示中はこれ以降処理させない
    if $game_message.visible
      @spriteset.gauge_off
      @info_viewport.visible = false
      return @message_window.visible = true
    end
    return if $gauge_stop
    # 戦闘中断、シーン切り替えの際これ以降は処理させない
    return if @judge
    return if $game_temp.next_scene != nil
    # ATBを更新
    process_battle_event if $game_temp.common_event_id > 0 # run skill common event if necessary
    update_atb
    # ターゲット更新
    update_target if @target_members != nil
    # コマンド入力フェイズ
    start_actor_command_selection if @command_members.size != 0 && !@command_phase
    if @skill_window != nil
      update_skill_selection                    # スキル選択
    elsif @item_window != nil
      update_item_selection                     # アイテム選択
    elsif @party_command_window.visible && @party_command_window.active
      update_party_command_selection            # パーティコマンド選択
    elsif @actor_command_window.active
      update_actor_command_selection            # アクターコマンド選択
    end
  end
  #--------------------------------------------------------------------------
  # ● ATB Update
  # checks and see if any battler is ready to move into the command phase
  # if there is a forcing battler present, put them into action
  # if there is a battler ready to act, put them into action
  #--------------------------------------------------------------------------
  def update_atb
    prepare_forcing_atb # Mithran Force Action fix 1.1e
    if !@forcing_battlers.empty?
      if @active_battler == nil
        set_next_active_battler
        return
      end
    end # end Mithran Force Action fix 1.1e
    for member in $game_party.members + $game_troop.members
      # ACT更新
#       return start_main(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler && !member.action.forcing
      # 3.4a
      return set_next_action_battlers(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler && !member.action.forcing
      # ATBアクター更新
      if member.actor? && member.at_active && !@command_members.include?(member) && member.movable? && !member.action.forcing
        # Mithran 1.1h added && !member.action.forcing
        # this flag prevents the command window from being reopened to this character
        return start_auto_action(member) if member.auto_action?
        return @command_members.push(member)
      # ATBエネミー更新
      elsif !member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
        return start_auto_action(member) unless member.action.forcing
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● Set Next Action Battlers *New method 3.4a
  #   Was start_main(member) but now has own method name rather than using
  #   an existing one (it is only used in one other method)
  #--------------------------------------------------------------------------
  def set_next_action_battlers(member)
    return if @judge
    @message_window.clear
    @action_battlers.push(member) # edited
    @status_window.refresh
    member.charge_start = false
    # アクティブバトラーがいなければ次の行動者をセット
    set_next_active_battler if @active_battler == nil
  end
  #--------------------------------------------------------------------------
  # ● 自動行動開始
  #--------------------------------------------------------------------------
  def start_auto_action(member)
    return if @judge
    # 戦闘行動の作成
    member.make_action if member.union_skill_id == 0
    # チャージ設定
    act_type = charge_set(member)
    # 複数回行動の作成
    member.act_time = member.action_time[0] if !member.actor?
    # 行動ゲージに切り替え
    @spriteset.change_act(act_type, member.actor?, member.index)
    # チャージアクション
    make_charge_action(member)
  end
  #--------------------------------------------------------------------------
  # ++ Charge Set
  #--------------------------------------------------------------------------
  def charge_set(member)
    act_type = member.charge
    # 通常攻撃(二刀のチャージ時間は双方武器の平均)
    if member.actor? && member.action.attack? && member.weapon_id != 0
      act_type = member.weapons[0].charge if member.weapons[0] != nil
      act_type2 = member.weapons[1].charge if member.weapons[1] != nil
      act_type[1] = (act_type[1] + act_type2[1]) / 2 if act_type2 != nil
    elsif member.action.attack?
      act_type = $data_weapons[member.weapon_id].charge if member.actor? && member.weapon_id != 0
      act_type = $data_weapons[member.weapon].charge if !member.actor? && member.weapon != 0
    end
    act_type = $data_skills[member.action.skill_id].charge if member.action.skill?
    act_type = $data_items[member.action.item_id].charge if member.action.item?
    # チャージボーナス加算
    if member.actor?
      act_type[1] += $data_weapons[member.weapon_id].charge_bonus if member.weapon_id != 0
      for i in 0...member.armors.size
        act_type[1] += member.armors.charge_bonus if member.armors != nil
      end
    end
    # 1.2c
    for i in 0...member.states.size
      act_type[1] += member.states.charge_bonus if member.states != nil
    end
    return act_type
  end
  #--------------------------------------------------------------------------
  # ● 戦闘行動者の準備  ※再定義 Original
  #--------------------------------------------------------------------------
#  def start_main(member)
#    return if @judge
#    @message_window.clear
#    @action_battlers.push(member)
#    @status_window.refresh
#    member.charge_start = false
    # アクティブバトラーがいなければ次の行動者をセット
#    set_next_active_battler if @active_battler == nil
#  end
  #--------------------------------------------------------------------------
  # ● Start Main *Rewrite
  #--------------------------------------------------------------------------
  def start_main
    # 3.4a
    # Contents from the old start_main(members) has been moved to
    # set_next_action_battlers(member). This gets rid of the new argument
    # tacked on to start_main.
    # The original contents of start_main have moved to other methods.
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウインドウの表示  ※再定義
  #--------------------------------------------------------------------------
  def pop_help(obj)
    return if @help_window == nil && obj.extension.include?("HELPHIDE")
    return @help_window.visible = false if obj.extension.include?("HELPHIDE")
    return if @skill_window != nil && @skill_window.visible
    return if @item_window != nil && @item_window.visible
    @help_window = Window_Help.new if @help_window == nil
    @help_window.set_text(obj.name, 1)
    @help_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ● チャージアクション作成
  #--------------------------------------------------------------------------
  def make_charge_action(member)
    action = ""
    case member.action.kind
    when 0
      if member.actor?
        action = member.charge[3] if member.weapon_id == 0
        action = $data_weapons[member.weapon_id].charge[3] if member.weapon_id != 0
      else
        action = member.charge[3] if member.weapon == 0
        action = $data_weapons[member.weapon].charge[3] if member.weapon != 0
      end
    when 1;action = member.action.skill.charge[3]
    when 2;action = member.action.item.charge[3]
    end
    member.charge_action = action
    return if action == ""
    member.charge_start = true
    @spriteset.set_action(member.actor?, member.index, member.charge_action)
  end
  #--------------------------------------------------------------------------
  # ● アクション実行中  ※再定義
  #--------------------------------------------------------------------------
  def playing_action
    loop do
      break if @judge
      update_basic
      # アクティブバトラーに格納されているアクション情報を見る
      action = @active_battler.play
      next if action == 0
      @active_battler.play = 0
      if action[0] == "Individual"
        individual
      elsif action == "Can Collapse"
        unimmortaling
      elsif action == "Cancel Action"
        break action_end
      elsif action == "End"
        break action_end
      elsif action[0] == "OBJ_ANIM"
        damage_action(action[1])
      end
    end  
  end
  #--------------------------------------------------------------------------
  # ● 戦闘アクション実行
  #--------------------------------------------------------------------------
  def process_action
    # 合体攻撃処理
    union_possibility?
    process_union_skill if @active_battler.union_skill_id != 0
    return set_next_active_battler if @active_battler.union_battler
    # 暴走混乱処理
    @active_battler.action.prepare unless @active_battler.action.forcing
    # 戦闘行動開始
    $in_action = true
    @message_window.clear
    @active_battler.white_flash = true
    # ヘルプウインドウ表示
    help_on
    # 戦闘アクション実行
    execute_action if @active_battler.action.valid? && @active_battler.restriction < 4
    # ヘルプウインドウ隠蔽
    help_off
    # 強制行動などでバトラーが空になったら次の行動者へ
    return set_next_active_battler if @active_battler == nil
    # HP Slip Damage; 1.1i moved, CrimsonSeas fix
    hp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
    # MP Slip Damage
    mp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
    # 戦闘アクション終了
    @message_window.clear
    @active_battler.white_flash = false
    $in_action = false
    @spriteset.gauge_update
    # 合体攻撃終了処理
    end_union_skill if @active_battler.union_skill_id != 0
    # スキル派生がある場合、行動続行
#    return set_next_active_battler if @active_battler.derivation != 0 && !@forcing_battler # Derivation fix, 1.1e
    # エネミーの複数回行動
    return set_next_active_battler if enemy_order
    # 戦闘行動終了
    turn_end(@active_battler)
    # 次の行動者へ
    @action_battlers.delete(@active_battler)
    set_next_active_battler
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウインドウ表示
  #--------------------------------------------------------------------------
  def help_on
    @help_window = Window_Help.new if @help_window == nil
    @help_window.visible = false
    return @help_window.visible = true if @skill_window != nil && @skill_window.visible
    return @help_window.visible = true if @item_window != nil && @item_window.visible
    return @help_window.visible = true if @active_battler.action.guard?
    return @help_window.visible = true if @active_battler.action.kind == 0 && @active_battler.action.basic == 2
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウインドウ隠蔽
  #--------------------------------------------------------------------------
  def help_off
    return if @help_window == nil
    return @help_window.visible = true if @skill_window != nil && @skill_window.visible
    return @help_window.visible = true if @item_window != nil && @item_window.visible
    @help_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● アクション終了  ※再定義
  #--------------------------------------------------------------------------
  def action_end
    # 初期化
    @individual_target = nil
    @active_battler.active = false
    @active_battler.clear_action_results
    # 念のため不死身化解除
    unimmortaling
    # 反射されていた場合
    if @active_battler.reflex != nil
      if @active_battler.action.skill?
        obj = @active_battler.action.skill
        @active_battler.perfect_skill_effect(@active_battler, obj)
      elsif @active_battler.action.item?
        obj = @active_battler.action.item
        @active_battler.item_effect(@active_battler, obj)
      else
        @active_battler.perfect_attack_effect(@active_battler)
      end
      pop_damage(@active_battler, obj, @active_battler.reflex)
      @active_battler.perform_collapse
      @active_battler.reflex = nil
      wait(N01::COLLAPSE_WAIT)
    end
    # 逆吸収で戦闘不能になった場合
    if @absorb_dead
      @active_battler.perform_collapse
      @absorb_dead = false
      wait(N01::COLLAPSE_WAIT)
    end
    # 次の行動までウエイトを挟む
    wait(N01::ACTION_WAIT)
  end  
  #--------------------------------------------------------------------------
  # ● 合体攻撃判定
  #--------------------------------------------------------------------------
  def union_skill?(member)
    # スキルに合体攻撃設定があるかチェック
    for union_action in member.action.skill.union_action
      union_skills = union_action if union_action.size != 0 && union_action.include?(member.action.skill_id)
    end
    return if union_skills == nil
    @partners = []
    @union_targets = union_target_decision(member, member.action.skill)
    @union_target_index = member.action.target_index
    # 合体攻撃メンバーが使用可能かチェック
    for skill_id in union_skills
      for actor in $game_party.members
        if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
          @partners.push(actor)
          actor.union_skill_id = skill_id
        end
      end
    end
    # 合体攻撃使用不可
    if @partners.size != union_skills.size
      for actor in @partners do actor.union_skill_id = 0 end
      @partners = nil
      member.action.clear if !member.action.guard?
      return
    end
    # 合体攻撃使用可
    for actor in @partners
      # パートナーアクション決定
      actor.action.kind = 1
      actor.action.skill_id = actor.union_skill_id
      actor.action.target_index = member.action.target_index
      # コマンド強制キャンセル
      if @command_members.include?(actor)
        force_action_command_cansel(actor)
        start_auto_action(member)
      end
    end
    $in_union_action = true
    @union_size = 0
  end  
  #--------------------------------------------------------------------------
  # ● 合体攻撃可能か
  #--------------------------------------------------------------------------
  def union_possibility?
    return if @partners == nil
    for member in @partners
      union_cansel = true unless member.inputable?
    end
    return if !union_cansel
    end_union_skill
    @active_battler.action.clear if !@active_battler.action.guard?
  end
  #--------------------------------------------------------------------------
  # ● 合体攻撃ターゲット決定
  #--------------------------------------------------------------------------
  def union_target_decision(member, obj)
    targets = member.action.make_targets
    # デフォルトの複数回攻撃が設定されていれば単体ターゲットに変換
    targets = [targets[0]] if obj.for_two? or obj.for_three? or obj.dual?
    # ランダムターゲットの場合、一体を選択しランダム範囲を保持
    if obj.extension.include?("RANDOMTARGET")
      randum_targets = targets.dup
      targets = [randum_targets[rand(randum_targets.size)]]
    end
    # ターゲット情報をバトラースプライトに送る
    @spriteset.set_target(member.actor?, member.index, targets)
    return targets
  end   
  #--------------------------------------------------------------------------
  # ● 合体攻撃処理
  #--------------------------------------------------------------------------
  def process_union_skill
    @union_size += 1
    if @union_size != @partners.size
      return @active_battler.union_battler = true
    end
    # 合体攻撃スタート
    @action_battlers.delete(@active_battler)
    @active_battler.active = false
    @active_battler = @partners.shift
    @active_battler.act_active = true
    @active_battler.active = true
    @active_battler.union_battler = false
    @active_battler.action.kind = 1
    @active_battler.action.skill_id = @active_battler.union_skill_id
    @active_battler.action.target_index = @union_target_index
    for member in @partners
      member.action.kind = 1
      member.action.skill_id = member.union_skill_id
      member.action.target_index = @union_target_index
      member.mp -= member.calc_mp_cost($data_skills[member.action.skill_id]) if member != @active_battler # 3.4a
      member.force_target = ["N01target_change", @union_targets]
      @spriteset.update_target(true, member.index)
      # アクション実行
      @spriteset.set_action(true, member.index, member.action.skill.base_action)
    end
    @status_window.refresh # 3.4a
  end  
  #--------------------------------------------------------------------------
  # ● 合体攻撃終了処理
  #--------------------------------------------------------------------------
  def end_union_skill
    @active_battler.union_skill_id = 0
    @active_battler.union_battler = false
    for member in @partners
      member.union_skill_id = 0
      member.union_battler = false
      member.action.clear
      @action_battlers.delete(member)
      turn_end(member)
    end
    @union_size = 0
    @partners = nil
    $in_union_action = false
  end
  #--------------------------------------------------------------------------
  # ● エネミーの行動回数作成
  #--------------------------------------------------------------------------
  def enemy_order
    return false if @active_battler.actor?
    return false if @active_battler.act_time == 0 or !@active_battler.action.valid?
    return true if rand(100) < @active_battler.action_time[1]
  end
  #--------------------------------------------------------------------------
  # ● Batter Turn End
  # clears action and resets the ATB gauge
  # runs 'end of turn' events as in the setup section
  #--------------------------------------------------------------------------
  def turn_end(member) # rewrite, ATB 1.1h
    member = @active_battler
    forced = member.action.forcing
    member.action.forcing = false # remove forcing flag no matter what
    t_index = member.action.target_index
    $in_action = false
    # アクション終了時のATBゲージ設定
    # If you get an error on this line, it means you need to update your
    # ATB Configurations script to the latest version.
    if !forced || (N02::FORCE_ACTION_CONSUME_GAUGE && forced)
      recharge_action(member)
    elsif member.act_active && !N02::FORCE_ACTION_CONSUME_GAUGE
      @spriteset.gauge_refill(member.actor?, member.index)
    end
    member.action.clear if !member.action.guard?
    member.action.target_index = t_index # perserves target index through action clear
    # needed for 'last target' to work in force action
    process_battle_event
    # ターン経過カウント
    @end_member += 1 if !forced || (N02::FORCE_ACTION_INCREASE_TURN && forced)
    passage = true if N02::ATB_TURN_COUNT == 2
    if @end_member >= $game_party.members.size + $game_troop.members.size
      passage = true if N02::ATB_TURN_COUNT == 0
      passage = true if N02::ATB_TURN_COUNT == 1 && @end_member == 2
    elsif @end_member == ($game_party.members.size + $game_troop.members.size) / 2
      passage = true if N02::ATB_TURN_COUNT == 1
    end
    # スリップダメージ
    if @slip_all_damage
      for battlers in $game_party.members + $game_troop.members do mp_slip_damage(battlers) end
      @slip_all_damage = false
      @slip_all_damaged = true
    end
    return if !passage
    # スリップダメージ
    if N02::ATB_SLIP_DAMAGE == 1 && !@slip_all_damaged
      for battlers in $game_party.members + $game_troop.members do hp_slip_damage(battlers) end
      @slip_all_damage = true
    end
    @slip_all_damaged = false
    @end_member = 0
    $game_troop.increase_turn
    $game_troop.turn_ending = true
    process_battle_event # Mithran 1.1h - correct place for processing battle event
    # otherwise, 'turn ending' events will not work
    $game_troop.turn_ending = false
    @status_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● アクション終了時のATBゲージ設定
  #--------------------------------------------------------------------------
  def recharge_action(member)
    member.act_count = 0
    recharge = member.recharge
    # 通常攻撃(二刀のチャージ時間は双方武器の平均)
    if member.actor? && member.action.attack?
      recharge = member.weapons[0].recharge if member.weapons[0] != nil
      recharge2 = member.weapons[1].recharge if member.weapons[1] != nil
      recharge = (recharge + recharge2) / 2 if recharge2 != nil
    elsif member.action.attack?
      act_type = $data_weapons[member.weapon].charge if member.weapon != 0
    end
    recharge = $data_skills[member.action.skill_id].recharge if member.action.skill?
    recharge = $data_items[member.action.item_id].recharge if member.action.item?
    recharge = N02::ATB_GUARD_RESET if member.action.guard?
    # ATBゲージに切り替え
    @spriteset.change_atb(10 * recharge, member.actor?, member.index)
    @spriteset.gauge_refresh(member.actor?, member.index)
  end   
  #--------------------------------------------------------------------------
  # ● Set Next Active Battler
  # sets the next battler to perform an action
  # those that are 'forcing' an action will 'cut in line'
  #--------------------------------------------------------------------------
  def set_next_active_battler # Redefined 1.1e; Mithran's Force Action/escape fix
    @forcing_battlers ||= []
    return if $game_party.all_dead? or $game_troop.all_dead?
    do_party_escape if @escape && $game_party.inputable? unless @judge # plays out party escape; 1.1e
    # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
    prepare_forcing_atb   
    # エネミー複数回行動時
    @action_battlers.shift if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
    loop do
      if !@forcing_battlers.empty? # Force Action fix 1.1f
        potential = @forcing_battlers.shift
        if potential.action.valid?
          @action_battlers.delete(potential)
          force_action_cleanup(potential)
          @active_battler = potential
        else
          potential.action.clear
        end # Force Action fix 1.1f end
      else
        @active_battler = @action_battlers.shift
      end
      @active_battler.action.clear if @active_battler != nil && @active_battler.dead?
      return if @active_battler == nil
      # 戦闘行動開始
      return process_action if @active_battler.index != nil
    end
  end
  #--------------------------------------------------------------------------
  # ● Process Battle Event
  #--------------------------------------------------------------------------
  def process_battle_event # Redefined 1.1e
    @forcing_battlers ||= []
    members_size = $game_party.members.size
    loop do
      return if judge_win_loss
      return if $game_temp.next_scene != nil
      $game_troop.interpreter.update
      $game_troop.setup_battle_event
      @message_window.update
      if $game_message.visible
        @message_window.visible = true
        @status_window.visible = false
      end
      wait_for_message
      @message_window.visible = false
      @status_window.visible = true
      reset_atb_actor if members_size != $game_party.members.size
      prepare_forcing_atb
      return unless $game_troop.interpreter.running?
      update_basic
    end
  end
  #--------------------------------------------------------------------------
  # ● Prepare Force Action for ATB
  #--------------------------------------------------------------------------
  def prepare_forcing_atb # New method 1.1e; Mithran's Force Action fix
    # changed in 1.1h
    @forcing_battlers ||= []
    if $game_troop.forcing_battler != nil
      member = $game_troop.forcing_battler
      $game_troop.forcing_battler = nil
      force_action_cleanup(member)
      @action_battlers.delete(member)
      @forcing_battlers.delete(member)
      # delete duplicates from the list
      @forcing_battlers.push(member)
    end
  end
  #--------------------------------------------------------------------------
  # ● Force Action Cleanup
  # cleans up all open targeting/selection window, if necessary, in preparation
  # for a force action
  #--------------------------------------------------------------------------
  def force_action_cleanup(member) # new method 1.1h
    return if member.nil?
    if @commander == member
      @message_window.visible = false
      @party_command_window.active = false
      @party_command_window.visible = false
      $in_command = $in_select = $in_target = $in_party_command = false
      @target_members = nil
      @actor_command_window.active = false
      @cursor.visible = false unless $game_party.all_dead? or $game_troop.all_dead?
      @command_phase = false
      target_select_cleanup # new method 1.1h
      end_skill_selection
      end_item_selection
      @party_command_window.active = @actor_command_window.active = false
      @actor_command_window_on = false
      @status_window.index = @actor_index = @actor_command_window.index = -1
      @command_members.delete(@commander)
      @commander = nil
      @actor_command_window.active = false
      @command_members.delete(member)
      @commander = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● Target Select Cleanup
  # removes visible portion of target selection and unsets the global flag
  #--------------------------------------------------------------------------
  def target_select_cleanup # new method 1.1h
    $in_target = false
    @help_window2.dispose if @help_window2 != nil
    @help_window2 = nil
    @help_window.visible = false if @help_window != nil
    @target_members = nil
  end
  #--------------------------------------------------------------------------
  # ● battle_end(result) alias
  #--------------------------------------------------------------------------
  alias battle_end_forcefix battle_end # Force Action fix 1.1e
  def battle_end(result)
    @forcing_battlers = []
    battle_end_forcefix(result)
  end
  #--------------------------------------------------------------------------
  # ● 全員の不死身化解除
  #--------------------------------------------------------------------------
  def member_unimmortaling # Redefined, 1.1e
    for member in $game_party.members + $game_troop.members # all battlers
      next if member.non_dead # stop if they are truly immortal
      next if member.dead? # stop if they are already dead
      member.set_temp_immortal(false) # make them not immortal
    end
  end
  #--------------------------------------------------------------------------
  # ● HPスリップダメージ
  #--------------------------------------------------------------------------
  def hp_slip_damage(member)
    member.clear_action_results
    return if !member.exist?
    member.slip_damage = false
    damage = 0
    # 0ターン解除のステートがあるかチェック
    for state in member.states
      member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
      # スリップダメージ実行 state = [ 対象, 定数, 割合, POP, 戦闘不能許可]
      next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
      for ext in state.slip_extension
        if ext[0] == "hp"
          base_damage = ext[1] + member.maxhp * ext[2] / 100
          damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
          slip_pop = ext[3] unless ext[3] == nil # 3.4a
          slip_dead = ext[4] unless ext[4] == nil # 3.4a
          slip_damage_flug = true
          member.slip_damage = true
        end
      end  
    end
    # デフォルトのスリップダメージ
#    if member.slip_damage? && member.exist? && !slip_damage_flug
#      damage += member.apply_variance(member.maxhp / 10, 10)
#      slip_dead = false
#      slip_pop = true
#      slip_damage_flug = true
#      member.slip_damage = true
#    end
    # 防具の自動回復があるか
    if member.actor? && member.auto_hp_recover && member.exist?
      damage -= member.maxhp / 20
      slip_pop = true
    end  
    # 戦闘不能不許可
    damage = member.hp - 1 if damage >= member.hp && slip_dead = false
    member.hp -= damage
    @spriteset.set_damage_pop(member.actor?, member.index, damage) if slip_pop
    member.perform_collapse if member.dead? && member.slip_damage
    member.clear_action_results
    @status_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● MPスリップダメージ
  #--------------------------------------------------------------------------
  def mp_slip_damage(member)
    member.clear_action_results
    return if !member.exist? or member.states.size == 0
    member.slip_damage = false
    mp_damage = 0
    for state in member.states
      next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
      for ext in state.slip_extension
        if ext[0] == "mp"
          base_damage = ext[1] + member.maxmp * ext[2] / 100
          mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
          slip_pop = ext[2]
          slip_damage_flug = true
        end
      end
    end  
    member.mp_damage = mp_damage
    member.mp -= mp_damage
    @spriteset.set_damage_pop(member.actor?, member.index, mp_damage) if slip_pop
    member.clear_action_results
    @status_window.refresh
  end  
  #--------------------------------------------------------------------------
  # ● 戦闘行動の実行 : 防御  ※再定義
  #--------------------------------------------------------------------------
  def execute_action_guard
    @help_window.set_text(N01::GUARD_HELP_TEXT, 1)
    @help_window.visible = true
    # バトラーのアクティブ化を解除
    @active_battler.active = false
    wait(45)
    @help_window.visible = false if @help_window != nil
  end
  #--------------------------------------------------------------------------
  # ● 戦闘行動の実行 : 逃走  ※再定義
  #--------------------------------------------------------------------------
  def execute_action_escape
    @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
    @help_window.set_text(N01::ESCAPED_HELP_TEXT, 1)
    @help_window.visible = true
    # バトラーのアクティブ化を解除
    @active_battler.active = false
    @active_battler.escape
    Sound.play_escape
    wait(45)
    @help_window.visible = false if @help_window != nil
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンド選択の開始  ※再定義
  #--------------------------------------------------------------------------
  def start_party_command_selection
    @info_viewport.visible = true
    @status_window.index = @actor_index = -1
  end
  #--------------------------------------------------------------------------
  # ● 次のアクターのコマンド入力へ  ※再定義
  #--------------------------------------------------------------------------
  def next_actor
  end
  #--------------------------------------------------------------------------
  # ● 前のアクターのコマンド入力へ  ※再定義
  #--------------------------------------------------------------------------
  def prior_actor
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンド選択の開始  ※再定義
  #--------------------------------------------------------------------------
  def start_actor_command_selection
    $in_command = true
    @command_phase = true
    @command_member_index = 0
    @commander = @command_members[@command_member_index]
    @status_window.active = true
    @status_window.index = @commander.index
    # カーソルセット
    @cursor = Sprite_Cursor.new if @cursor == nil
    @cursor.set(@commander)
    # 動けるキャラのみコマンドアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
    @party_command_window.active = false
    @actor_command_window.setup(@commander)
    @actor_command_window.active = true
    @actor_command_window.index = 0
    @actor_command_window_on = true
    @status_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● コマンド更新  ※再定義
  #--------------------------------------------------------------------------
  def update_actor_command_selection
    # コマンド入力できる状態でなくなればキャンセル
    return reset_command unless commanding?
    if Input.trigger?(Input::B)
      Input.update
      Sound.play_decision
      start_party_command
    elsif Input.trigger?(Input::C)
      Input.update
      case @actor_command_window.index
      when 0  # 攻撃
        Sound.play_decision
        @commander.action.set_attack
        start_target_enemy_selection
      when 1  # スキル
        Sound.play_decision
        $in_select = true
        start_skill_selection
      when 2  # 防御
        Sound.play_decision
        @commander.action.set_guard
        end_command
      when 3  # アイテム
        Sound.play_decision
        $in_select = true
        start_item_selection
      end
    # →キーでコマンドキャラ送り
    elsif Input.trigger?(Input::RIGHT)
      next_commander
    # ←キーでコマンドキャラ戻し
    elsif Input.trigger?(Input::LEFT)
      back_commander
    end
  end
  #--------------------------------------------------------------------------
  # ● コマンド入力できる状態か
  #--------------------------------------------------------------------------
  def commanding?
    return false if @judge or $gauge_stop
    return false if @commander != nil && !@commander.inputable?
    return false if @commander != nil && @commander.union_skill_id != 0
    return false if @commander != nil && @commander.at_count < 1000
    return true
  end
  #--------------------------------------------------------------------------
  # ● コマンドキャラ送り
  #--------------------------------------------------------------------------
  def next_commander
    return if @command_members.size == 1 or @commander == nil
    Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
    # 動けるキャラのみコマンド戻りアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
    # コマンド待ちメンバーのインデックスが最後なら
    if @command_member_index == @command_members.size - 1
      @command_member_index = 0
    # 次のキャラにコマンドを送る
    else
      @command_member_index += 1
    end
    @commander = @command_members[@command_member_index]
    @status_window.index = @commander.index
    @actor_command_window.setup(@commander) # 1.1c
    # カーソルセット
    @cursor.set(@commander)
    # 動けるキャラのみコマンドアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  end  
  #--------------------------------------------------------------------------
  # ● コマンドキャラ戻し
  #--------------------------------------------------------------------------
  def back_commander
    return if @command_members.size == 1 or @commander == nil
    Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
    # 動けるキャラのみコマンド戻りアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
    # コマンド待ちメンバーのインデックスが最初なら
    if @command_member_index == 0
      @command_member_index = @command_members.size - 1
    # 前のキャラにコマンドを送る
    else
      @command_member_index -= 1
    end
    @commander = @command_members[@command_member_index]
    @status_window.index = @commander.index
    # カーソルセット
    @cursor.set(@commander)
    # 動けるキャラのみコマンドアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  end  
  #--------------------------------------------------------------------------
  # ● パーティコマンド選択の開始
  #--------------------------------------------------------------------------
  def start_party_command
    $in_party_command = true
    $in_command = false
    @status_window.refresh
    @status_window.index = @actor_index = -1
    @info_viewport.visible = true
    @message_window.visible = false
    @pre_a_index = @actor_command_window.index
    @actor_command_window.active = false
    @actor_command_window.index = -1
    @party_command_window.active = true
    @party_command_window.index = 0
    @party_command_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンド選択の更新
  #--------------------------------------------------------------------------
  def update_party_command_selection
    # コマンド入力できる状態でなくなればキャンセル
    return reset_command unless commanding?
    if Input.trigger?(Input::C)
      case @party_command_window.index
      when 0  # 戦う
        Sound.play_decision
        @status_window.index = @actor_index = -1
        end_party_command
      when 1  # 逃げる
        return Sound.play_buzzer if $game_troop.can_escape == false
        Sound.play_decision
        end_party_command
        process_escape if !@escape
      end
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      end_party_command
    end
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンド選択の終了
  #--------------------------------------------------------------------------
  def end_party_command
    $in_party_command = false
    $in_command = true
    @status_window.refresh
    @message_window.visible = false
    @party_command_window.active = false
    @actor_command_window.active = true
    @party_command_window.visible = false
    @actor_command_window.index = @pre_a_index
    @status_window.index = @commander.index
    @status_window.active = true
  end
  #--------------------------------------------------------------------------
  # ● 逃走の処理  ※再定義
  #--------------------------------------------------------------------------
  def process_escape # redefined by Mithran
    # escape processing method - trimmed to almost nothing
    @escape = true # sets the escape flag for later use
    closed_window # closes all windows
  end
  #--------------------------------------------------------------------------
  # ● do_party_escape
  #--------------------------------------------------------------------------
  def do_party_escape # new method 1.1e, contains most of the old content
    # of the prior escape method
    # it has been largely reordered to play out more naturally given its current
    # position in the code
    reset_atb_actor # sets the atb of all actors to zero
    if $game_troop.preemptive
      success = true
    else
      success = (rand(100) < @escape_ratio)
    end
    for actor in $game_party.members
      if !actor.non_dead
        actor.set_temp_immortal(false) # technically, line is not reached while the non_dead flag is set
        if actor.hp == 0 and not actor.state?(1)
          actor.add_state(1)
          actor.added_states.push(1)
        end
      end
      # unimmortal all battlers, kill them if necessary
    end
    if $game_party.all_dead? # if everyone is dead, end the battle with defeat
      @escape = false
      @judge = true
      process_defeat
      battle_end(2)
      return true
    end
    for actor in $game_party.members # perform run animation
      unless actor.restriction >= 4
        @spriteset.set_action(true, actor.index, success ? actor.run_success : actor.run_ng )
      end
    end
    @info_viewport.visible = false # hide the info viewport
    @message_window.visible = true # show the message window
    text = sprintf(Vocab::EscapeStart, $game_party.name) # format the escape text
    $game_message.texts.push(text) # add it to the $game_message, so the message window grabs it next update
    Sound.play_escape #play escape sound
    if !success
      $game_message.texts.push('\.' + Vocab::EscapeFailure)
      # add fail message if necessary
    end
    wait_for_message # wait for message
    if success
      @judge = true # cut battle short - it seems this flag is used to indicate that the battle is over
      # and as such, no further actions will be performed
      battle_end(1) # end battle with escape
      return true # cut short the calling method
    else
      @escape_ratio += 10 # add 10 to the escape ratio
      $game_party.clear_actions # clear all actions
      @info_viewport.visible = true # make the party display viewport again visible
      @escape = false # unset the escape flag
      for member in $game_party.members
        member.clear_sprite_effects # clear all sprite effects
      end
      return false # the calling method continues as normal
    end
  end
  #--------------------------------------------------------------------------
  # ● アクターのATBを初期化
  #--------------------------------------------------------------------------
  def reset_atb_actor
    @command_members = []
    @commander = nil
    $in_action = @command_phase = false
    $in_command = $in_target = $in_select = false
    @message_window.clear
    for member in $game_party.members
      @action_battlers.delete(member)
      member.white_flash = false
      member.action.clear
      # ATBゲージに切り替え
      @spriteset.change_atb(N02::ATB_RUN_NG * -10, member.actor?, member.index)
    end
  end
  #--------------------------------------------------------------------------
  # ● 開いているウインドウを閉じる
  #--------------------------------------------------------------------------
  def closed_window
    @cursor.dispose if @cursor != nil
    @cursor = nil
    @help_window.dispose if @help_window != nil
    @help_window = nil
    @help_window2.dispose if @help_window2 != nil
    @help_window2 = nil
    @skill_window.dispose if @skill_window != nil
    @skill_window = nil
    @item_window.dispose if @item_window != nil
    @item_window = nil
    @actor_command_window_on = false if @actor_command_window != nil
    @actor_command_window.active = false if @actor_command_window != nil
    @party_command_window.visible = false if @party_command_window != nil
    @party_command_window.active = false if @party_command_window != nil
    @status_window.index = @actor_index = @actor_command_window.index = -1
  end
  #--------------------------------------------------------------------------
  # ● ターゲット選択の開始  ※再定義
  #--------------------------------------------------------------------------
  def start_target_selection(actor = false)
    $in_target = true
    $in_command = $in_select = false
    @target_actors = actor
    @target_members = $game_party.members if @target_actors
    @target_members = $game_troop.members unless @target_actors
    # 不要なウインドウを消す
    @actor_command_window.active = false
    @skill_window.visible = false if @skill_window != nil
    @item_window.visible = false if @item_window != nil
    # 存在しているターゲットで最も番号の低い対象を最初に指すように
    @index = 0
    @max_index = @target_members.size - 1
    # アクターは戦闘不能者でもターゲットできるようにエネミーと区別
    unless @target_actors
      @target_members.size.times do
        break if @target_members[@index].exist?
        @index += 1
      end
    end  
    # カーソルセット
    @cursor.set(@target_members[@index])
    @help_window.visible = false if @help_window != nil
    @help_window2 = Window_Help.new if @help_window2 == nil
    @help_window2.set_text_n01add(@target_members[@index])
  end
  #--------------------------------------------------------------------------
  # ● ターゲット選択更新  ※再定義
  #--------------------------------------------------------------------------
  def update_target
    # コマンド入力できる状態でなくなればキャンセル
    return reset_command unless commanding?
    return end_target_selection(cansel = true) if $game_troop.all_dead?
    cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist?
    if Input.trigger?(Input::B)
      Input.update
      Sound.play_cancel
      end_target_selection(cansel = true)
    elsif Input.trigger?(Input::C)
      Input.update
      Sound.play_decision
      @commander.action.target_index = @index
      end_target_selection
      end_skill_selection
      end_item_selection
      @actor_command_window.active = false
      next_actor
    end
    if Input.repeat?(Input::LEFT)
      if @target_actors
        cursor_down if $back_attack
        cursor_up unless $back_attack
      else
        cursor_up if $back_attack
        cursor_down unless $back_attack
      end  
    end
    if Input.repeat?(Input::RIGHT)
      if @target_actors
        cursor_up if $back_attack
        cursor_down unless $back_attack
      else
        cursor_down if $back_attack
        cursor_up unless $back_attack
      end
    end
    cursor_up if Input.repeat?(Input::UP)
    cursor_down if Input.repeat?(Input::DOWN)
  end
  #--------------------------------------------------------------------------
  # ● カーソルを前に移動  ※再定義
  #--------------------------------------------------------------------------
  def cursor_up
    Sound.play_cursor
    @target_members.size.times do
      @index += @target_members.size - 1
      @index %= @target_members.size
      break if @target_actors
      break if @target_members[@index].exist?
    end
    # カーソルセット
    @cursor.set(@target_members[@index])
    @help_window2.set_text_n01add(@target_members[@index]) if @help_window2 != nil
  end
  #--------------------------------------------------------------------------
  # ● カーソルを次に移動  ※再定義
  #--------------------------------------------------------------------------
  def cursor_down
    Sound.play_cursor
    @target_members.size.times do
      @index += 1
      @index %= @target_members.size
      break if @target_actors
      break if @target_members[@index].exist?
    end
    # カーソルセット
    @cursor.set(@target_members[@index])
    @help_window2.set_text_n01add(@target_members[@index]) if @help_window2 != nil
  end
  #--------------------------------------------------------------------------
  # ● ターゲット選択の終了  再定義
  #--------------------------------------------------------------------------
  def end_target_selection(cansel = false)
    $in_target = false
    @help_window2.dispose if @help_window2 != nil
    @help_window2 = nil
    @help_window.visible = false if @help_window != nil
    if @skill_window != nil
      @skill_window.visible = @skill_window.active = true
      @help_window.visible = true if @help_window != nil
      @actor_command_window.active = false if cansel
      $in_select = true if cansel
    elsif @item_window != nil
      @item_window.visible = @item_window.active = true
      @help_window.visible = true if @help_window != nil
      @actor_command_window.active = false if cansel
      $in_select = true if cansel
    end
    @target_members = nil
    end_command if !cansel
    # カーソルセット
    @cursor.set(@commander) if cansel
    $in_command = true if cansel && @actor_command_window.index == 0
    @actor_command_window.active = true if cansel && @actor_command_window.index == 0
  end
  #--------------------------------------------------------------------------
  # ● コマンド初期化
  #--------------------------------------------------------------------------
  def reset_command
    @message_window.visible = false
    @party_command_window.active = false
    @commander.action.clear
    @party_command_window.visible = false
    $in_command = $in_select = $in_target = false
    @target_members = nil
    @actor_command_window.active = false
    @cursor.visible = false unless $game_party.all_dead? or $game_troop.all_dead? # bug fix 1.1b
    @command_phase = false
    end_skill_selection
    end_item_selection
    @party_command_window.active = @actor_command_window.active = false
    @actor_command_window_on = false
    @status_window.index = @actor_index = @actor_command_window.index = -1
    @command_members.delete(@commander)
    @commander = nil
  end  
  #--------------------------------------------------------------------------
  # ● 強制行動によるコマンドキャンセル
  #--------------------------------------------------------------------------
  def force_action_command_cansel(member)
    return if !member.inputable?
    # Force Action fix 1.1e
    end_target_selection if @commander == member # 1.1f
    return if member.nil?
    @pre_a_index ||= 0
    end_party_command if @commander == member
    # end Force Action fix 1.1e
    # チャージ設定
    act_type = charge_set(member)
    # 行動ゲージに切り替え
    @spriteset.change_act(act_type, member.actor?, member.index)
    # 動けるキャラのみコマンド戻りアクションを
    @spriteset.set_action(true, member.index,member.command_a) if member.actor? && member.inputable?
    # チャージアクション
    make_charge_action(member)
    # 以下の処理はコマンド入力中のアクター限定
    return if !member.actor? or @commander != member
    # カーソル消去
    @cursor.visible = false
    @command_phase = false
    # ウインドウ初期化
    end_skill_selection
    end_item_selection
    $in_target = false
    @help_window2.dispose if @help_window2 != nil
    @help_window2 = nil
    @help_window.visible = false if @help_window != nil
    @party_command_window.active = @actor_command_window.active = false
    @actor_command_window_on = false
    @status_window.index = @actor_index = @actor_command_window.index = -1
    @command_members.delete(member)
    @commander = nil
    @message_window.visible = false
    @party_command_window.active = false
    @party_command_window.visible = false
    $in_command = $in_select = $in_target = false
  end  
  #--------------------------------------------------------------------------
  # ● コマンド入力終了
  #--------------------------------------------------------------------------
  def end_command
    return if !@commander.inputable?
    $in_command = false
    $in_select = false
    # カーソル消去
    @cursor.visible = false if @cursor.visible != nil # 1.2a
    @command_phase = false
    # アクション実行時間チェック
    act_type = charge_set(@commander)
    # 行動ゲージに切り替え
    @spriteset.change_act(act_type, true, @commander.index)
    # 動けるキャラのみコマンド戻りアクションを
    @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
    # チャージアクション
    make_charge_action(@commander)
    # 合体攻撃チェック
    union_skill?(@commander) if @commander.action.skill? && @partners == nil
    # ウインドウ初期化
    @party_command_window.active = @actor_command_window.active = false
    @actor_command_window_on = false
    @status_window.index = @actor_index = @actor_command_window.index = -1
    @command_members.delete(@commander)
    @commander = nil
  end
  #--------------------------------------------------------------------------
  # ● 情報表示ビューポートの作成  ※再定義
  #--------------------------------------------------------------------------
  def create_info_viewport
    @command_members = []
    @action_battlers = []
    @info_viewport = Viewport.new(0, 288, 544, 128)
    @info_viewport.z = 100
    @status_window = Window_BattleStatus.new
    @party_command_window = Window_PartyCommand2.new
    @actor_command_window = Window_ActorCommand.new
    @status_window.viewport = @info_viewport
    @actor_command_window.viewport = @info_viewport
    @status_window.x = 128
    @actor_command_window.x = 672
    @info_viewport.visible = false
    @party_command_window.visible = false
    @info_viewport.ox = 128
  end
  #--------------------------------------------------------------------------
  # ● 情報表示ビューポートの更新   ※再定義
  #--------------------------------------------------------------------------
  def update_info_viewport
    @party_command_window.update if @party_command_window.active
    @actor_command_window.update if @actor_command_window.active
    @status_window.update if @status_window.active
    @message_window.visible = false if !$game_message.visible
    @info_viewport.visible = true if !@message_window.visible
    @actor_command_window.x += 32 if @actor_command_window.x < 672 && !@actor_command_window_on
    @actor_command_window.x -= 32 if @actor_command_window.x > 544 && @actor_command_window_on
  end
  #--------------------------------------------------------------------------
  # ● スキル選択の開始  ※再定義
  #--------------------------------------------------------------------------
  def start_skill_selection
    @help_window = Window_Help.new if @help_window == nil
    @help_window.visible = true
    @skill_window = Window_Skill.new(0, 56, 544, 232, @commander)
    @skill_window.z = 1000
    @skill_window.help_window = @help_window
    @actor_command_window.active = false
  end
  #--------------------------------------------------------------------------
  # ● スキル選択の更新  ※再定義
  #--------------------------------------------------------------------------
  def update_skill_selection
    # コマンド入力できる状態でなくなればキャンセル
    return reset_command unless commanding?
    @skill_window.active = true
    @skill_window.update
    @help_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_skill_selection
      $in_command = true
    elsif Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill != nil
        @commander.last_skill_id = @skill.id
      end
      if @commander.skill_can_use?(@skill)
        return Sound.play_buzzer if @commander.union_skill?(@skill.id) && !@commander.union_skill_can_use?(@skill.id)
        Sound.play_decision
        determine_skill
      else
        Sound.play_buzzer
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● スキルの決定  ※再定義
  #--------------------------------------------------------------------------
  def determine_skill
    @commander.action.set_skill(@skill.id)
    @skill_window.active = false
    if @skill.need_selection?
      if @skill.for_opponent?
        start_target_enemy_selection
      else
        start_target_actor_selection
      end
    else
      end_skill_selection
      end_target_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● スキル選択の終了
  #--------------------------------------------------------------------------
  alias end_skill_selection_n01 end_skill_selection
  def end_skill_selection
    end_skill_selection_n01
    $in_select = false
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の開始  ※再定義
  #--------------------------------------------------------------------------
  def start_item_selection
    @help_window = Window_Help.new if @help_window == nil
    @help_window.visible = true
    @item_window = Window_Item.new(0, 56, 544, 232)
    @item_window.z = 1000
    @item_window.help_window = @help_window
    @actor_command_window.active = false
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の更新  ※再定義
  #--------------------------------------------------------------------------
  def update_item_selection
    # コマンド入力できる状態でなくなればキャンセル
    return reset_command unless commanding?
    @item_window.active = true
    @item_window.update
    @help_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_item_selection
      $in_command = true # 1.1b
    elsif Input.trigger?(Input::C)
      @item = @item_window.item
      if @item != nil
        $game_party.last_item_id = @item.id
      end
      if $game_party.item_can_use?(@item)
        Sound.play_decision
        determine_item
      else
        Sound.play_buzzer
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテムの決定  ※再定義
  #--------------------------------------------------------------------------
  def determine_item
    @commander.action.set_item(@item.id)
    @item_window.active = false
    if @item.need_selection?
      if @item.for_opponent?
        start_target_enemy_selection
      else
        start_target_actor_selection
      end
    else
      end_item_selection
      end_target_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の終了
  #--------------------------------------------------------------------------
  alias end_item_selection_n01 end_item_selection
  def end_item_selection
    end_item_selection_n01
    $in_select = false
  end
  #--------------------------------------------------------------------------
  # ● 勝敗判定  ※再定義
  #--------------------------------------------------------------------------
  def judge_win_loss
    return true unless $game_temp.in_battle
    if $game_party.all_dead?
      @judge = true
      $gauge_stop = true
      closed_window
      @spriteset.atb_dispose
      $game_troop.clear_actions
      $game_party.clear_actions
      process_defeat
      return true
    elsif $game_troop.all_dead?
      @judge = true
      $gauge_stop = true
      closed_window
      @spriteset.atb_dispose
      $game_troop.clear_actions
      $game_party.clear_actions
      process_victory
      return true
    else
      return false
    end
  end
end
#==============================================================================
# ■ Game_BattleAction#valid? is no longer overwritten.
#------------------------------------------------------------------------------

#==============================================================================
# ■ Game_Battler (分割定義 1)
#------------------------------------------------------------------------------
#  バトラーを扱うクラスです。
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :at_count         # コマンド待ちゲージ(1000がMAX)
  attr_accessor :at_active        # コマンド入力可能
  attr_accessor :atb_count_up     # ATBカウントアップ中
  attr_accessor :act_count        # 行動待ちゲージ(1000がMAX)
  attr_accessor :act_active       # 行動可能
  attr_accessor :at_speed         # ゲージアップスピード基準値
  attr_accessor :charge_action    # チャージアクション
  attr_accessor :charge_start     # チャージ中か
  attr_accessor :union_skill_id   # 合体攻撃スキルID
  attr_accessor :union_battler    # 合体攻撃参加者か
  attr_accessor :speed_level      # 戦闘参加者の最速スピード基準
  attr_accessor :low_speed_level  # 戦闘参加者の最遅スピード基準
  #--------------------------------------------------------------------------
  # ● ステートの付加  ATBダメージ処理を追加
  #--------------------------------------------------------------------------
  alias add_state_n02 add_state
  def add_state(state_id)
    add_state_n02(state_id)
    if $data_states[state_id].atb_damage != 0
      @at_count = @at_count + $data_states[state_id].atb_damage * 10
      @at_count = 0 if @at_count < 0 && !$data_states[state_id].atb_minus_damage
      @at_count = 1000 if @at_count > 1000
      # ATBダメージでチャージキャンセル
      if $data_states[state_id].atb_damage < 0
        @act_count = 0
        @act_active = false
        @at_active = false
        @atb_count_up = true
      end
    end  
  end
  #--------------------------------------------------------------------------
  # ● 戦闘開始時のAT設定
  #--------------------------------------------------------------------------
  def atb_setting
    # 初期化
    @at_count = @act_count = @speed_level = @low_speed_level = @union_skill_id = 0
    @at_active = @act_active = @atb_count_up = @charge_start = @union_battler = false
    $in_party_command = $in_command = $in_target = $in_select = $in_action = false
    @charge_action = normal
    $in_union_action = false
    # ゲージアップスピード(戦闘速度)
    @at_speed = $game_party.atb_control[1]
    # ユーザー設定を使わない場合
    return if N02::ATB_CUSTOMIZE
    @at_speed = N02::ATB_SPEED
  end
  #--------------------------------------------------------------------------
  # ● ATBスピード基準値リフレッシュ
  #--------------------------------------------------------------------------
  def atb_base_speed_refresh
    battle_members = $game_party.members + $game_troop.members
    battle_members.sort! do |a,b|
      b.agi - a.agi
    end
    self.speed_level = battle_members[0].agi
    self.low_speed_level = battle_members[battle_members.size - 1].agi
  end
  #--------------------------------------------------------------------------
  # ● 自動行動判定
  #--------------------------------------------------------------------------
  def auto_action?
    return true if berserker? or confusion? or auto_battle or @union_skill_id != 0
    return false
  end
  #--------------------------------------------------------------------------
  # ● 合体攻撃スキル判定
  #--------------------------------------------------------------------------
  def union_skill?(skill_id)
    # スキルに合体攻撃設定があるかチェック
    for union_action in $data_skills[skill_id].union_action
      union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
    end
    return false if union_skills == nil
    return true
  end  
  #--------------------------------------------------------------------------
  # ● 合体攻撃使用可能判定
  #--------------------------------------------------------------------------
  def union_skill_can_use?(skill_id)
    return false if $in_union_action
    for union_action in $data_skills[skill_id].union_action
      union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
    end
    return false if union_skills == nil
    partners = []
    # 合体攻撃メンバーが使用可能かチェック
    for skill_id in union_skills
      for actor in $game_party.members
        if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
          partners.push(actor)
        end
      end
    end
    return false if partners.size != union_skills.size
    return true
  end
end  
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  パーティを扱うクラスです。
#==============================================================================
class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor   :atb_custom                       # ATBユーザー設定
  attr_accessor   :atb_control                      # ATB設定
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_n02 initialize
  def initialize
    initialize_n02
    @atb_control = []
    @atb_custom = [N02::ATB_NEWGAME_MODE, N02::ATB_NEWGAME_SPEED - 1]
  end
  #--------------------------------------------------------------------------
  # ● ユーザー設定をATB設定に反映
  #--------------------------------------------------------------------------
  def atb_customize
    # ウエイト・アクティブ設定を格納
    case @atb_custom[0]
    when 0;@atb_control[0] = N02::ATB_MODE1
    when 1;@atb_control[0] = N02::ATB_MODE2
    when 2;@atb_control[0] = N02::ATB_MODE3
    end
    # 戦闘速度を格納
    @atb_control[1] = N02::ATB_SPEED_MODE[@atb_custom[1]]
    # ユーザー設定を使わない場合
    return if N02::ATB_CUSTOMIZE
    @atb_control[0] = ["",N02::ATB_PARTY_COMMAND_WAIT, N02::ATB_COMMAND_WAIT, N02::ATB_TARGET_WAIT, N02::ATB_SELECT_WAIT, N02::ATB_ACTION_WAIT]
    @atb_control[1] = N02::ATB_SPEED
  end
end
#==============================================================================
# ■ Sprite_MoveAnime
#------------------------------------------------------------------------------
#  ATBゲージ用のスプライトです。
#==============================================================================
class Sprite_ATB < Sprite_Base
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :battler
  attr_accessor :count            # 更新カウント
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(viewport,battler = nil)
    super(viewport)
    @battler = battler
    @count = 0
    @base_atb_count = 1
    @restriction_count = 0
    @state_freeze = false
    @update = 0
    @pre_width = 0
    make_gauge
    start_atb
    @party_command_wait = $game_party.atb_control[0][1]
    @command_wait = $game_party.atb_control[0][2]
    @target_wait = $game_party.atb_control[0][3]
    @select_wait = $game_party.atb_control[0][4]
    @action_wait = $game_party.atb_control[0][5]
  end
  #--------------------------------------------------------------------------
  # ● ATB初期値セッティング
  #--------------------------------------------------------------------------
  def start_atb
    atb = battler.atb_base * 10 + rand(N02::ATB_BASE_ADD) * 10
    if battler.actor?
      atb1 = battler.weapons[0].atb_base * 10 if battler.weapons[0] != nil
      atb2 = battler.weapons[1].atb_base * 10 if battler.weapons[1] != nil
      atb1 = atb if atb1 == nil
      atb2 = atb1 if atb2 == nil
      atb += (atb1 + atb2) / 2
      for i in 0...battler.armors.size
        # 二刀はキャンセル
        next if battler.two_swords_style && battler.armors[0] != nil && battler.armors[0]
        atb += battler.armors.atb_base * 10 if battler.armors != nil
      end  
    end
    change_atb(atb)
  end
  #--------------------------------------------------------------------------
  # ● ゲージ作成
  #--------------------------------------------------------------------------
  def make_gauge
    self.bitmap = Cache.system("atb_bar_skin")
    @gauge = Sprite.new(viewport)
    @gauge.bitmap = Cache.system("atb_bar")
    @gauge_max = Sprite.new(viewport)
    @gauge_max.bitmap = Cache.system("atb_bar_active")
    @gauge_max.visible = false
    @gauge_division = 1000 / N02::ATB_WIDTH
    @gauge_space = N02::ATB_SPACE
  end
  #--------------------------------------------------------------------------
  # ● 座標セット
  #--------------------------------------------------------------------------
  def set(x, y)
    self.ox = @gauge.ox = @gauge_max.ox = self.bitmap.width / 2
    self.oy = @gauge.oy = @gauge_max.oy = self.bitmap.height / 2
    self.visible = @gauge.visible = @gauge_max.visible = false
    if @battler.actor? && N02::ATB_POSITION_HPWINDOW
      self.z = @gauge.z = @gauge_max.z = 1000
      self.x = @gauge.x = @gauge_max.x = N02::ATB_PARTY_POSITION[@battler.index][0]
      self.y = @gauge.y = @gauge_max.y = N02::ATB_PARTY_POSITION[@battler.index][1]
      return
    end
    adjust = N02::ATB_POSITION_ENEMY
    adjust = N02::ATB_POSITION_ACTOR if battler.actor?
    self.x = @gauge.x = @gauge_max.x = x + adjust[0]
    self.x = @gauge.x = @gauge_max.x = x - adjust[0] if $back_attack
    self.y = @gauge.y = @gauge_max.y = y + adjust[1]
    self.z = @gauge.z = @gauge_max.z = battler.position_z + 10
    @gauge_max.z += 1
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ切り替え
  #--------------------------------------------------------------------------
  def change_atb(restart_gauge = 0)
    @battler.atb_base_speed_refresh
    case N02::ATB_BASE_SPEED
    when 0
      return @base_atb_count = @battler.at_speed * battler.agi if N02::ATB_ABSOLUTE_SPEED == 0
      @base_atb_count = @battler.at_speed * battler.agi / N02::ATB_ABSOLUTE_SPEED
    when 1
      return @base_atb_count = @battler.at_speed * battler.agi if @battler.speed_level == 0
      @base_atb_count = @battler.at_speed * battler.agi / @battler.speed_level
    when 2
      return @base_atb_count = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
      @base_atb_count = @battler.at_speed * @battler.agi / @battler.low_speed_level
    when 3
      return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
      @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
    end
    @base_atb_count = 1 if @base_atb_count == 0
    @battler.at_count = restart_gauge
    @battler.act_count = 0
    @gauge.bitmap = Cache.system("atb_bar")
    @battler.act_active = false
    @battler.at_active = false
    @battler.atb_count_up = true
  end
  #--------------------------------------------------------------------------
  # ● ACTゲージ切り替え
  #--------------------------------------------------------------------------
  def change_act(act_type)
    change_atb
    case act_type[0]
    when 0
      base = @battler.at_speed * @battler.agi
      base = @battler.at_speed * @battler.agi / act_type[2] if act_type[2] != 0
    when 1
      base = @battler.at_speed * @battler.agi / @battler.speed_level
    when 2
      base = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
      base = @battler.at_speed * @battler.agi / @battler.low_speed_level
    when 3
      base = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
      base = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
    when 4
      base = @battler.at_speed
    end
    if act_type[1] <= 0
      @base_act_count = 1000
    else
      @base_act_count = base *  100 / act_type[1]
    end
    @base_act_count = 1 if @base_act_count == 0
    @battler.act_count = 0
    @gauge.bitmap = Cache.system("act_bar")
    @battler.atb_count_up = false
    @battler.at_active = false
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # ステート管理
    states_control
    # 強制ゲージストップ
    return if $gauge_stop or !@battler.exist? or $game_message.visible
    # アクションウエイト
    wait = true if $in_action && !@action_wait
    wait = false if $in_action && @action_wait
    # パーティコマンド選択中ウエイト
    wait = true if $in_party_command && !@party_command_wait
    wait = false if $in_party_command && @party_command_wait
    # 戦闘コマンド選択中ウエイト
    wait = true if $in_command && !@command_wait
    wait = false if $in_command && @command_wait
    # ターゲット選択中ウエイト
    wait = true if $in_target && !@target_wait
    wait = false if $in_target && @target_wait
    # スキル/アイテム選択中ウエイト
    wait = true if $in_select && !@select_wait
    wait = false if $in_select && @select_wait
    # アクション中はゲージを消すか
    self.visible = @gauge.visible = true
    self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ENEMY_OFF && !@battler.actor? && @battler.union_skill_id == 0
    self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ACTOR_OFF && @battler.actor? && @battler.union_skill_id == 0
    # ゲージ表示設定
    self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.atb_on
    self.visible = @gauge.visible = @gauge_max.visible = false if @battler.actor? && $game_message.visible && N02::ATB_POSITION_HPWINDOW
    # 見えないエネミーはゲージ隠蔽
    self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.actor? && !@battler.exist?
    # ボタン入力によるゲージ制御
    wait = true if Input.press?(Input::ALT) && N02::ATB_ALT_WAIT
    wait = false if Input.press?(Input::CTRL) && N02::ATB_CTRL_ACTIVE
    # 自身のみアクションウエイト
    wait = true if @battler.act_active
    # ゲージウエイト
    return if wait
    # ステートによるゲージストップ処理
    return recover_states_freeze if @state_freeze
    # ゲージカウントアップ
    gauge_update
    # ゲージ描画
    return if @pre_width == @gauge_space + @battler.act_count / @gauge_division && !@battler.atb_count_up
    return if @pre_width == @gauge_space + @battler.at_count / @gauge_division && @battler.atb_count_up
    gauge_refresh
  end
  #--------------------------------------------------------------------------
  # ● ゲージカウントアップ
  #--------------------------------------------------------------------------
  def gauge_update
    # ACTカウントアップ
    act if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
    # ATBカウントアップ
    atb if @battler.atb_count_up
  end
  #--------------------------------------------------------------------------
  # ● ゲージリフレッシュ
  #--------------------------------------------------------------------------
  def gauge_refresh
    @gauge_max.visible = false if !@battler.act_active && !@battler.at_active
    @gauge.src_rect.width = @pre_width = @gauge_space + @battler.act_count / @gauge_division if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
    @gauge.src_rect.width = @pre_width = @gauge_space + @battler.at_count / @gauge_division if @battler.atb_count_up
  end
  #--------------------------------------------------------------------------
  # ● ゲージ隠蔽
  #--------------------------------------------------------------------------
  def off
    self.visible = @gauge.visible = @gauge_max.visible = false
  end
  #--------------------------------------------------------------------------
  # ● ゲージ表示
  #--------------------------------------------------------------------------
  def on
    self.visible = @gauge.visible = @gauge_max.visible = true
    gauge_refresh
  end
  #--------------------------------------------------------------------------
  # ● ステート管理
  #--------------------------------------------------------------------------
  def states_control
    # 1.1f, line priority shift
    self.visible = @gauge_max.visible = @gauge.visible = false if !@battler.actor? && !@battler.exist?
    if !@state_freeze && !@battler.movable?
      # 行動不能はゲージを0に
      @restriction_count = @battler.at_count
      @state_freeze = true
      @atb_dead = true if @battler.dead? && !@atb_dead
      change_atb(0)
      gauge_refresh
    # ステート復帰時
    elsif @battler.movable? && @state_freeze
      @state_freeze = false
      # 戦闘不能復帰時のゲージ処理
      return if !@atb_dead
      change_atb(N02::ATB_DEAD_COUNT * 10)
      @atb_dead = false
      gauge_refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● ステートによるゲージストップ回復
  #--------------------------------------------------------------------------
  def recover_states_freeze
    @restriction_count += @base_atb_count
    @restriction_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
    if @restriction_count >= 1000
      # ステート自然回復許可
      @battler.remove_states_auto
      @restriction_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● ATBカウント
  #--------------------------------------------------------------------------
  def atb
    if @battler.at_count <= 1000
      @gauge_max.visible = false
      @battler.at_count += @base_atb_count
      @battler.at_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
    end
    # ATBゲージMAX
    if @battler.at_count >= 1000
      # ステート自然回復
      @battler.remove_states_auto
      @battler.atb_count_up = false
      @battler.at_active = true
      @gauge.src_rect.width = 52
      return if !@battler.atb_on
      Audio.se_play("Audio/SE/" + N02::ATB_MAX_SOUND01[2], N02::ATB_MAX_SOUND01[1],  N02::ATB_MAX_SOUND01[0])
      @gauge_max.visible = true
    end
    @battler.act_active = false
  end  
  #--------------------------------------------------------------------------
  # ● ACTカウント
  #--------------------------------------------------------------------------
  def act
    if @battler.act_count <= 1000
      @gauge_max.visible = false
      @battler.act_count += @base_act_count
      @battler.at_count += @base_atb_count * 3 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
    end
    # ACTゲージMAX
    if @battler.act_count >= 1000 && !@battler.act_active
      @battler.act_active = true
      @gauge.src_rect.width = 52
      return if !@battler.atb_on
      Audio.se_play("Audio/SE/" + N02::ACT_MAX_SOUND01[2], N02::ACT_MAX_SOUND01[1],  N02::ACT_MAX_SOUND01[0])
      @gauge_max.visible = true
    end
  end  
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    @gauge.dispose
    @gauge_max.dispose
  end
  #--------------------------------------------------------------------------
  # ● Refill - puts ATB gauge back to max and prepare for command input
  # New method 1.1h
  #--------------------------------------------------------------------------
  def refill
    @battler.act_active = false
    @battler.at_active = false
    @battler.act_count = 0
    @battler.at_count = 1000
    @battler.atb_count_up = true
    @gauge.bitmap = Cache.system("atb_bar")
  end
end
#==============================================================================
# ■ Sprite_Cursor
#------------------------------------------------------------------------------
#  カーソルのスプライトです。
#==============================================================================
class Sprite_Cursor < Sprite_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super
    create_target_cursor
  end
  #--------------------------------------------------------------------------
  # ● ターゲットカーソルスプライトの作成
  #--------------------------------------------------------------------------
  def create_target_cursor
    self.bitmap = Cache.system("cursor")
    @width = self.bitmap.width
    @height = self.bitmap.height / 3
    self.src_rect.set(0, 0, @width, @height)
    @cursor_flame = 0
    self.x = @pre_x = 272
    self.y = @pre_y = 208
    self.z = 300
    self.ox = @width
    self.oy = @height
    self.visible = false
    @time = 0
    @flash_time = 0
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # カーソル画像更新
    @cursor_flame = 0 if @cursor_flame == 40
    self.src_rect.set(0,           0, @width, @height) if @cursor_flame == 0
    self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 10
    self.src_rect.set(0, 2 * @height, @width, @height) if @cursor_flame == 20
    self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 30
    @cursor_flame += 1
    # カーソル座標更新
    return if @battler == nil
    # ターゲットを光らせる
    @flash_time -= 1
    if @flash_time == 0 && @battler.exist? && !@battler.collapse
      @battler.white_flash = true
      @flash_time = 20
    end
    if @time == 0
      self.x = @battler.position_x + N01::CURSOR_X_PLUS
      return self.y = (@battler.position_y + N01::CURSOR_Y_PLUS) - @battler.graphics_width / 5
    end  
    @time -= 1
    self.x = @pre_x + (@battler.position_x + N01::CURSOR_X_PLUS - @pre_x) * (9 - @time) / 9
    self.y = @pre_y + (@battler.position_y + N01::CURSOR_Y_PLUS - @battler.graphics_width / 5 - @pre_y) * (9 - @time) / 9
  end
  #--------------------------------------------------------------------------
  # ● カーソル移動情報セット
  #--------------------------------------------------------------------------
  def set(battler)
    self.visible = true
    @battler = battler
    return if @battler == nil
    @battler.white_flash = true if @battler.exist? && !@battler.collapse
    @time = 9
    @flash_time = 20
    @pre_x = self.x
    @pre_y = self.y
  end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
#  バトラー表示用のスプライトです。
#==============================================================================
class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # ● バトラー作成
  #--------------------------------------------------------------------------
  alias make_battler_n01 make_battler
  def make_battler
    make_battler_n01

    make_atb
  end  
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  alias dispose_n01 dispose
  def dispose
    dispose_n01
    @atb_gauge.dispose if @atb_gauge != nil
  end  
  #--------------------------------------------------------------------------
  # ● Set Stand By Action
  #--------------------------------------------------------------------------
  alias stand_by_n02 stand_by
  def stand_by
    # Set battler charge animation (ATB)
    @battler.charge_start = false if @battler.charge_start && !@battler.exist?
    return @repeat_action = @battler.charge_action if @battler.charge_start
    stand_by_n02
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ作成
  #--------------------------------------------------------------------------
  def make_atb
    return if battler == nil
    battler.atb_setting
    if battler.actor? && N02::ATB_POSITION_HPWINDOW
      @atb_gauge = Sprite_ATB.new(@viewport2,battler)
    else
      @atb_gauge = Sprite_ATB.new(viewport,battler)
    end
    @atb_gauge.set(self.x, self.y)
  end  
  #--------------------------------------------------------------------------
  # ● ATBゲージビューポート作成
  #--------------------------------------------------------------------------
  def make_atb_viewport(new_viewport)
    @viewport2 = new_viewport
  end  
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_n01 update
  def update
    update_n01
    # ATB更新
    @atb_gauge.update if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ゲージ更新
  #--------------------------------------------------------------------------
  def gauge_update
    @atb_gauge.gauge_update if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ゲージリフレッシュ
  #--------------------------------------------------------------------------
  def gauge_refresh
    @atb_gauge.gauge_refresh if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ゲージ表示
  #--------------------------------------------------------------------------
  def gauge_on
    @atb_gauge.on if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ゲージ隠蔽
  #--------------------------------------------------------------------------
  def gauge_off
    @atb_gauge.off if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ切り替え
  #--------------------------------------------------------------------------
  def change_atb(restart_gauge)
    @atb_gauge.change_atb(restart_gauge) if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ACTゲージ切り替え
  #--------------------------------------------------------------------------
  def change_act(act_type)
    @atb_gauge.change_act(act_type) if @atb_gauge != nil
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ開放
  #--------------------------------------------------------------------------
  def atb_dispose
    @atb_gauge.dispose if @atb_gauge != nil
    @atb_gauge = nil
  end
  #--------------------------------------------------------------------------
  # ● Gauge Refill - new method 1.1h
  #--------------------------------------------------------------------------
  def gauge_refill
    @atb_gauge.refill
  end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
#  バトル画面のスプライトをまとめたクラスです。
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● アクタースプライトの作成
  #--------------------------------------------------------------------------
  alias create_actors_n01 create_actors
  def create_actors
    create_actors_n01
    if N02::ATB_POSITION_HPWINDOW
      for sprites in @actor_sprites + @enemy_sprites
        sprites.make_atb_viewport(@viewport4)
      end
    end  
  end
  #--------------------------------------------------------------------------
  # ● ターゲット情報リフレッシュ
  #--------------------------------------------------------------------------
  def update_target(actor, index)
    @actor_sprites[index].update_target if actor
    @enemy_sprites[index].update_target unless actor
  end
  #--------------------------------------------------------------------------
  # ● ゲージ更新
  #--------------------------------------------------------------------------
  def gauge_update
    for sprites in @actor_sprites + @enemy_sprites
      sprites.gauge_update if sprites != nil
    end
  end
  #--------------------------------------------------------------------------
  # ● ゲージリフレッシュ
  #--------------------------------------------------------------------------
  def gauge_refresh(actor, index)
    @actor_sprites[index].gauge_refresh if actor
    @enemy_sprites[index].gauge_refresh unless actor
  end
  #--------------------------------------------------------------------------
  # ● ゲージ表示
  #--------------------------------------------------------------------------
  def gauge_on
    for sprites in @actor_sprites + @enemy_sprites
      sprites.gauge_on if sprites != nil
    end
  end
  #--------------------------------------------------------------------------
  # ● ゲージ隠蔽
  #--------------------------------------------------------------------------
  def gauge_off
    for sprites in @actor_sprites + @enemy_sprites
      sprites.gauge_off if sprites != nil
    end
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ切り替え
  #--------------------------------------------------------------------------
  def change_atb(restart_gauge, actor, index)
    @actor_sprites[index].change_atb(restart_gauge) if actor
    @enemy_sprites[index].change_atb(restart_gauge) unless actor
  end
  #--------------------------------------------------------------------------
  # ● ACTゲージ切り替え
  #--------------------------------------------------------------------------
  def change_act(act_type, actor, index)
    @actor_sprites[index].change_act(act_type) if actor
    @enemy_sprites[index].change_act(act_type) unless actor
  end
  #--------------------------------------------------------------------------
  # ● ATBゲージ一斉開放
  #--------------------------------------------------------------------------
  def atb_dispose
    for sprites in @actor_sprites + @enemy_sprites
      sprites.atb_dispose if sprites != nil
    end
  end
  #--------------------------------------------------------------------------
  # ● Gauge Refill - new method 1.1h
  #--------------------------------------------------------------------------
  def gauge_refill(actor, index)
    @actor_sprites[index].gauge_refill if actor
    @enemy_sprites[index].gauge_refill unless actor
  end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
#  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画  ※再定義
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
      draw_item_name(skill, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
    end
  end
end  

#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================
class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● カーソルを下に移動  ※再定義
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
  end
  #--------------------------------------------------------------------------
  # ● カーソルを上に移動  ※再定義
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新  ※再定義
  #--------------------------------------------------------------------------
  def update
    super
    update_cursor
    call_update_help
  end
end
#==============================================================================
# ■ Window_PartyCommand2
#------------------------------------------------------------------------------
#  バトル画面で、戦うか逃げるかを選択するウィンドウです。
#==============================================================================
class Window_PartyCommand2 < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 234, 544, 56)
    @item_max = 2
    @column_max = 2
    self.contents.draw_text(32, 0, 96, WLH, "#{Vocab.fight}", 2) # 1.1b
    self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if $game_troop.can_escape # 1.1b
    self.contents.font.color.alpha = 128
    self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if !$game_troop.can_escape # 1.1b
    self.active = false
  end
end

#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
#  メニュー画面でATB設定を表示するウィンドウです。
#==============================================================================
class Window_ATB_active < Window_Selectable
  # アクティブタイムバトルのカスタマイズ項目からのテキスト
  ATB_MODE_NAME = N02::ATB_MODE_NAME
  ATB_MODE1 = N02::ATB_MODE1[0]
  ATB_MODE2 = N02::ATB_MODE2[0]
  ATB_MODE3 = N02::ATB_MODE3[0]
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 174, 544, 56)
    @item_max = 3
    @column_max = 3
    set_active
    self.active = true
    self.index = $game_party.atb_custom[0]
  end
  #--------------------------------------------------------------------------
  # ● アクティブ化
  #--------------------------------------------------------------------------
  def set_active
    self.contents.clear
    self.contents.font.size = 15
    self.contents.font.color = crisis_color
    self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
    self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0) # edited
    self.contents.font.size = 20
    self.contents.font.color = normal_color
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● アクティブ解除
  #--------------------------------------------------------------------------
  def non_active
    self.contents.clear
    self.contents.font.size = 15
    self.contents.font.color = system_color
    self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
    self.contents.font.size = 20
    self.contents.font.color = normal_color
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def refresh
    case $game_party.atb_custom[0]
    when 0
      self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
      self.contents.font.color.alpha = 100
      self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
      self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
    when 1
      self.contents.font.color.alpha = 100
      self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
      self.contents.font.color.alpha = 100
      self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
    when 2
      self.contents.font.color.alpha = 100
      self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
      self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = 140
    rect.height = 24
    rect.x = index % @column_max * rect.width + 100
    rect.y = index / @column_max * WLH
    return rect
  end
end  
#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
#  メニュー画面でATB設定を表示するウィンドウです。
#==============================================================================
class Window_ATB_speed < Window_Selectable
  # アクティブタイムバトルのカスタマイズ項目からのテキスト
  ATB_MODE_NAME = N02::ATB_SPEED_NAME
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 230, 544, 56)
    @item_max = 9
    @column_max = 9
    non_active
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # ● アクティブ化
  #--------------------------------------------------------------------------
  def set_active
    self.contents.clear
    self.contents.font.size = 15
    self.contents.font.color = crisis_color
    self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
    self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
    self.contents.font.size = 22
    self.contents.font.color = normal_color
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● アクティブ解除
  #--------------------------------------------------------------------------
  def non_active
    self.contents.clear
    self.contents.font.size = 15
    self.contents.font.color = system_color
    self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
    self.contents.font.size = 22
    self.contents.font.color = normal_color
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得 edited
  #   3.4a turned contents into a loop rather than a repeated list
  #--------------------------------------------------------------------------
  def refresh
    self.contents.font.color.alpha = 96
    for i in 0..8
      self.contents.draw_text(94 + 38 * i, 0, 140, WLH, (i + 1).to_s, 1)
    end
    self.contents.font.color.alpha = 256
    for i in 0..8
      case $game_party.atb_custom[1]
        when i;self.contents.draw_text(94 + 38 * i, 0, 140, WLH, (i + 1).to_s, 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = 38
    rect.height = 24
    rect.x = index % @column_max * rect.width + 145
    rect.y = index / @column_max * WLH
    return rect
  end
end  
#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
#  ATB設定の説明を表示するウィンドウです。
#==============================================================================
class Window_ATB_Help < Window_Base
  # アクティブタイムバトルのカスタマイズ項目からのテキスト
  ATB_MODE_NAME = N02::ATB_MODE_NAME
  ATB_MODE1 = N02::ATB_MODE1[0]
  ATB_MODE2 = N02::ATB_MODE2[0]
  ATB_MODE3 = N02::ATB_MODE3[0]
  ATB_MODE1_HELP = N02::ATB_MODE1_HELP
  ATB_MODE2_HELP = N02::ATB_MODE2_HELP
  ATB_MODE3_HELP = N02::ATB_MODE3_HELP
  ATB_SPEED_NAME = N02::ATB_SPEED_NAME
  ATB_SPEED_HELP = N02::ATB_SPEED_HELP
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 56, 544, 96)
  end
  #--------------------------------------------------------------------------
  # ● テキスト設定
  #--------------------------------------------------------------------------
  def set_text_active(index)
    text1 = ATB_MODE_NAME + "  ["
    case index
    when 0
      text1 += ATB_MODE1 + "]"
      text2 = ATB_MODE1_HELP
    when 1
      text1 += ATB_MODE2 + "]"
      text2 = ATB_MODE2_HELP
    when 2
      text1 += ATB_MODE3 + "]"
      text2 = ATB_MODE3_HELP
    end
    self.contents.clear
    self.contents.font.color = crisis_color
    self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  end
  #--------------------------------------------------------------------------
  # ● テキスト設定
  #--------------------------------------------------------------------------
  def set_text_speed
    text1 = ATB_SPEED_NAME
    text2 = ATB_SPEED_HELP
    self.contents.clear
    self.contents.font.color = crisis_color
    self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  end
end

#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
#  ATB設定タイトル・操作を表示するウィンドウです。
#==============================================================================
class Window_ATB_Title < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 544, 56)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● テキスト設定
  #--------------------------------------------------------------------------
  def refresh
    text1 = N02::ATB_CUSTOMIZE_NAME
    text2 = N02::ATB_CUSTOMIZE_HELP # 1.1b
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 96, WLH, text1, 0)
    self.contents.font.color = normal_color
    self.contents.draw_text(110, 0, 420, WLH, text2, 0)
  end
end

#==============================================================================
# ■ Scene_ATB
#------------------------------------------------------------------------------
#  ATB設定を行うクラスです。
#==============================================================================
class Scene_ATB < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @title_window = Window_ATB_Title.new
    @help_window = Window_ATB_Help.new
    @active_window = Window_ATB_active.new
    @speed_window = Window_ATB_speed.new
    @help_window.set_text_active(@active_window.index)
    @active_window_index = @active_window.index
    @speed_window_index = $game_party.atb_custom[1]
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    $game_party.atb_customize
    dispose_menu_background
    @title_window.dispose
    @help_window.dispose
    @active_window.dispose
    @speed_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 元の画面へ戻る
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @active_window.update
    @speed_window.update
    if @active_window.active
      update_active_selection
    elsif @speed_window.active
      update_speed_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の更新
  #--------------------------------------------------------------------------
  def update_active_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      $game_party.atb_custom[0] = @active_window.index
      @active_window.set_active
    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      Sound.play_cursor
      @speed_window.active = true
      @speed_window.set_active
      @speed_window.index = @speed_window_index
      @active_window.active = false
      @active_window.non_active
      @active_window_index = @active_window.index
      @active_window.index = -1
      @help_window.set_text_speed
    elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
      @help_window.set_text_active(@active_window.index)
    end
  end
  #--------------------------------------------------------------------------
  # ● ターゲット選択の更新
  #--------------------------------------------------------------------------
  def update_speed_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      $game_party.atb_custom[1] = @speed_window.index
      @speed_window.set_active
    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
      Sound.play_cursor
      @active_window.active = true
      @active_window.set_active
      @active_window.index = @active_window_index
      @speed_window.active = false
      @speed_window.non_active
      @speed_window_index = @speed_window.index
      @speed_window.index = -1
      @help_window.set_text_active(@active_window.index)
    end
  end
end[/pre]
回复

使用道具 举报

百合乡の蕾咪

梦石
0
星屑
75
在线时间
151 小时
注册时间
2011-1-12
回帖
196
发表于 2013-12-11 10:11:02 | 显示全部楼层
能给工程还是上传一个吧, 你就这么说, 我也不知道啥冲突. 就给了一个代码片段, 我也不好测试.
回复

使用道具 举报

梦石
0
星屑
539
在线时间
664 小时
注册时间
2010-6-30
回帖
198
 楼主| 发表于 2013-12-11 10:40:28 | 显示全部楼层
本帖最后由 Front 于 2013-12-11 10:49 编辑
蕾米莉亚·斯卡雷特 发表于 2013-12-11 10:11
能给工程还是上传一个吧, 你就这么说, 我也不知道啥冲突. 就给了一个代码片段, 我也不好测试. ...


我错了,稍后多转些vip给你.

Project.7z (1.35 MB, 下载次数: 32)
回复

使用道具 举报

永无止境的旅程<

梦石
0
星屑
537
在线时间
1554 小时
注册时间
2012-6-19
回帖
1162

开拓者贵宾

发表于 2013-12-11 12:40:36 | 显示全部楼层
稍微看了一下,这个
主角当怪物属性战斗 ● 的脚本已经把
ATB和横版的某些数据初始化了
敌人的位置初始化为0  所以敌人变到了左上角。
ATB时敌人的编号已经被初始化,所以敌人行动的时候ATB错误。
[url=https://rpg.blue/thread-389697-1-1.html]https://rpg.blue/https://rpg.blue/data/attachment/forum/201602/26/220128cfbxxs47xth4xkz4.jpg[/url]
&lt;font size=&quot;5&quot;&gt;[color=Green][url=https://rpg.blue/forum.php?mod=viewthread&amp;tid=396208&amp;extra=page%3D1][color=DeepSkyBlue]全新配套ACT系统,每周末一大更新,尽请期待。[/color][/url][/color]
回复

使用道具 举报

百合乡の蕾咪

梦石
0
星屑
75
在线时间
151 小时
注册时间
2011-1-12
回帖
196
发表于 2013-12-11 18:12:14 | 显示全部楼层
版主大人想要接手么?
回复

使用道具 举报

梦石
0
星屑
539
在线时间
664 小时
注册时间
2010-6-30
回帖
198
 楼主| 发表于 2013-12-17 16:14:53 | 显示全部楼层
6天自顶...
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部