设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1333|回复: 8
打印 上一主题 下一主题

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
559
在线时间
664 小时
注册时间
2010-6-30
帖子
223
跳转到指定楼层
发表于 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天涯 叫过来殴打一顿。

Lv2.观梦者

梦石
0
星屑
559
在线时间
664 小时
注册时间
2010-6-30
帖子
223
8
 楼主| 发表于 2013-12-17 16:14:53 | 只看该作者
6天自顶...
回复

使用道具 举报

Lv1.梦旅人

百合乡の蕾咪

梦石
0
星屑
55
在线时间
151 小时
注册时间
2011-1-12
帖子
198
7
发表于 2013-12-11 18:12:14 | 只看该作者
版主大人想要接手么?
回复

使用道具 举报

Lv2.观梦者

永无止境的旅程

梦石
0
星屑
503
在线时间
1552 小时
注册时间
2012-6-19
帖子
1226

开拓者贵宾

6
发表于 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]
回复

使用道具 举报

Lv2.观梦者

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


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

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

使用道具 举报

Lv1.梦旅人

百合乡の蕾咪

梦石
0
星屑
55
在线时间
151 小时
注册时间
2011-1-12
帖子
198
4
发表于 2013-12-11 10:11:02 | 只看该作者
能给工程还是上传一个吧, 你就这么说, 我也不知道啥冲突. 就给了一个代码片段, 我也不好测试.
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
559
在线时间
664 小时
注册时间
2010-6-30
帖子
223
3
 楼主| 发表于 2013-12-11 08:10:47 | 只看该作者
蕾米莉亚·斯卡雷特 发表于 2013-12-11 00:33
#______________________________________________________________________________
# * 此脚本归66RPG -  ...

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

RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● ACTゲージ切り替え
  3.   #--------------------------------------------------------------------------
  4.   def change_act(act_type, actor, index)
  5.     @actor_sprites[index].change_act(act_type) if actor
  6.     @enemy_sprites[index].change_act(act_type) unless actor
  7.   end



RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_Battle  for ATB Ver1.2c
  3. #------------------------------------------------------------------------------
  4. #  バトル画面の処理を行うクラスです。
  5. #==============================================================================
  6. class Scene_Battle < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 開始処理
  9.   #--------------------------------------------------------------------------
  10.   alias start_n02 start
  11.   def start
  12.     $gauge_stop = true
  13.     $game_party.atb_customize
  14.     start_n02
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 終了処理
  18.   #--------------------------------------------------------------------------
  19.   alias terminate_n02 terminate # Enu code; 1.1e
  20.   def terminate
  21.     terminate_n02
  22.     # 二刀流の持ち替え処理を戻す
  23.     for member in $game_party.members
  24.       if member.two_swords_change
  25.         member.change_equip_by_id(1, member.weapon_id)
  26.         member.change_equip_by_id(0, 0)
  27.         member.two_swords_change = false
  28.       end  
  29.       member.clear_sprite_effects
  30.     end
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 戦闘開始の処理
  34.   #--------------------------------------------------------------------------
  35.   alias process_battle_start_n02 process_battle_start
  36.   def process_battle_start
  37.     @end_member = 0
  38.     preemptive if $game_troop.preemptive
  39.     surprise if $game_troop.surprise
  40.     @status_window.visible = true
  41.     process_battle_start_n02
  42.     @status_window.refresh
  43.     $gauge_stop = false
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 先制処理
  47.   #--------------------------------------------------------------------------
  48.   def preemptive
  49.     $game_troop.preemptive = false
  50.     for member in $game_party.members + $game_troop.members
  51.       member.at_count = 1000 if member.actor?
  52.       member.at_count = N02::ATB_BACKATTACK * -10 if !member.actor?
  53.     end  
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● 不意打ち処理
  57.   #--------------------------------------------------------------------------
  58.   def surprise
  59.     $game_troop.surprise = false
  60.     for member in $game_party.members + $game_troop.members
  61.       member.at_count = N02::ATB_BACKATTACK * -10 if member.actor?
  62.       member.at_count = 1000 if !member.actor?
  63.     end
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 情報表示ビューポートの解放
  67.   #--------------------------------------------------------------------------
  68.   alias dispose_info_viewport_n02 dispose_info_viewport
  69.   def dispose_info_viewport
  70.     dispose_info_viewport_n02
  71.     @cursor.dispose if @cursor != nil && !@cursor.disposed?
  72.     @help_window.dispose if @help_window != nil && !@help_window.disposed?
  73.     @help_window = nil
  74.     @help_window2.dispose if @help_window2 != nil && !@help_window2.disposed?
  75.     @help_window2 = nil
  76.     @skill_window.dispose if @skill_window != nil && !@skill_window.disposed?
  77.     @skill_window = nil
  78.     @item_window.dispose if @item_window != nil && !@item_window.disposed?
  79.     @item_window = nil # 1.1b
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● フレーム更新  ※再定義
  83.   #--------------------------------------------------------------------------
  84.   def update
  85.     super
  86.     update_basic(true)
  87.     # plays out party escape; 1.1e
  88.     do_party_escape if @escape && $game_party.inputable? unless @judge
  89.     unless $game_message.visible                # メッセージ表示中以外
  90.       return if judge_win_loss if [url=home.php?mod=space&uid=76083]@judge[/url] == nil # 勝敗判定
  91.       update_scene_change
  92.     end
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● Update Basic
  96.   # frame update, runs the show
  97.   # 1.1h - added a method to process the next common event, if necessary
  98.   #--------------------------------------------------------------------------
  99.   def update_basic(main = false)
  100.     Graphics.update unless main                 # ゲーム画面を更新
  101.     Input.update unless main                    # 入力情報を更新
  102.     $game_system.update                         # タイマーを更新
  103.     $game_troop.update                          # 敵グループを更新
  104.     @spriteset.update                           # スプライトセットを更新
  105.     @message_window.update                      # メッセージウィンドウを更新
  106.     update_info_viewport if !$gauge_stop        # 情報表示ビューポートを更新
  107.     # カーソル更新
  108.     @cursor.update if @cursor != nil && @cursor.visible
  109.     # メッセージ表示中はこれ以降処理させない
  110.     if $game_message.visible
  111.       @spriteset.gauge_off
  112.       @info_viewport.visible = false
  113.       return @message_window.visible = true
  114.     end
  115.     return if $gauge_stop
  116.     # 戦闘中断、シーン切り替えの際これ以降は処理させない
  117.     return if @judge
  118.     return if $game_temp.next_scene != nil
  119.     # ATBを更新
  120.     process_battle_event if $game_temp.common_event_id > 0 # run skill common event if necessary
  121.     update_atb
  122.     # ターゲット更新
  123.     update_target if @target_members != nil
  124.     # コマンド入力フェイズ
  125.     start_actor_command_selection if @command_members.size != 0 && !@command_phase
  126.     if @skill_window != nil
  127.       update_skill_selection                    # スキル選択
  128.     elsif @item_window != nil
  129.       update_item_selection                     # アイテム選択
  130.     elsif @party_command_window.visible && @party_command_window.active
  131.       update_party_command_selection            # パーティコマンド選択
  132.     elsif @actor_command_window.active
  133.       update_actor_command_selection            # アクターコマンド選択
  134.     end
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● ATB Update
  138.   # checks and see if any battler is ready to move into the command phase
  139.   # if there is a forcing battler present, put them into action
  140.   # if there is a battler ready to act, put them into action
  141.   #--------------------------------------------------------------------------
  142.   def update_atb
  143.     prepare_forcing_atb # Mithran Force Action fix 1.1e
  144.     if !@forcing_battlers.empty?
  145.       if @active_battler == nil
  146.         set_next_active_battler
  147.         return
  148.       end
  149.     end # end Mithran Force Action fix 1.1e
  150.     for member in $game_party.members + $game_troop.members
  151.       # ACT更新
  152. #       return start_main(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler && !member.action.forcing
  153.       # 3.4a
  154.       return set_next_action_battlers(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler && !member.action.forcing
  155.       # ATBアクター更新
  156.       if member.actor? && member.at_active && !@command_members.include?(member) && member.movable? && !member.action.forcing
  157.         # Mithran 1.1h added && !member.action.forcing
  158.         # this flag prevents the command window from being reopened to this character
  159.         return start_auto_action(member) if member.auto_action?
  160.         return @command_members.push(member)
  161.       # ATBエネミー更新
  162.       elsif !member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
  163.         return start_auto_action(member) unless member.action.forcing
  164.       end
  165.     end
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● Set Next Action Battlers *New method 3.4a
  169.   #   Was start_main(member) but now has own method name rather than using
  170.   #   an existing one (it is only used in one other method)
  171.   #--------------------------------------------------------------------------
  172.   def set_next_action_battlers(member)
  173.     return if @judge
  174.     @message_window.clear
  175.     @action_battlers.push(member) # edited
  176.     @status_window.refresh
  177.     member.charge_start = false
  178.     # アクティブバトラーがいなければ次の行動者をセット
  179.     set_next_active_battler if @active_battler == nil
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 自動行動開始
  183.   #--------------------------------------------------------------------------
  184.   def start_auto_action(member)
  185.     return if @judge
  186.     # 戦闘行動の作成
  187.     member.make_action if member.union_skill_id == 0
  188.     # チャージ設定
  189.     act_type = charge_set(member)
  190.     # 複数回行動の作成
  191.     member.act_time = member.action_time[0] if !member.actor?
  192.     # 行動ゲージに切り替え
  193.     @spriteset.change_act(act_type, member.actor?, member.index)
  194.     # チャージアクション
  195.     make_charge_action(member)
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ++ Charge Set
  199.   #--------------------------------------------------------------------------
  200.   def charge_set(member)
  201.     act_type = member.charge
  202.     # 通常攻撃(二刀のチャージ時間は双方武器の平均)
  203.     if member.actor? && member.action.attack? && member.weapon_id != 0
  204.       act_type = member.weapons[0].charge if member.weapons[0] != nil
  205.       act_type2 = member.weapons[1].charge if member.weapons[1] != nil
  206.       act_type[1] = (act_type[1] + act_type2[1]) / 2 if act_type2 != nil
  207.     elsif member.action.attack?
  208.       act_type = $data_weapons[member.weapon_id].charge if member.actor? && member.weapon_id != 0
  209.       act_type = $data_weapons[member.weapon].charge if !member.actor? && member.weapon != 0
  210.     end
  211.     act_type = $data_skills[member.action.skill_id].charge if member.action.skill?
  212.     act_type = $data_items[member.action.item_id].charge if member.action.item?
  213.     # チャージボーナス加算
  214.     if member.actor?
  215.       act_type[1] += $data_weapons[member.weapon_id].charge_bonus if member.weapon_id != 0
  216.       for i in 0...member.armors.size
  217.         act_type[1] += member.armors[i].charge_bonus if member.armors[i] != nil
  218.       end
  219.     end
  220.     # 1.2c
  221.     for i in 0...member.states.size
  222.       act_type[1] += member.states[i].charge_bonus if member.states[i] != nil
  223.     end
  224.     return act_type
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 戦闘行動者の準備  ※再定義 Original
  228.   #--------------------------------------------------------------------------
  229. #  def start_main(member)
  230. #    return if @judge
  231. #    @message_window.clear
  232. #    @action_battlers.push(member)
  233. #    @status_window.refresh
  234. #    member.charge_start = false
  235.     # アクティブバトラーがいなければ次の行動者をセット
  236. #    set_next_active_battler if @active_battler == nil
  237. #  end
  238.   #--------------------------------------------------------------------------
  239.   # ● Start Main *Rewrite
  240.   #--------------------------------------------------------------------------
  241.   def start_main
  242.     # 3.4a
  243.     # Contents from the old start_main(members) has been moved to
  244.     # set_next_action_battlers(member). This gets rid of the new argument
  245.     # tacked on to start_main.
  246.     # The original contents of start_main have moved to other methods.
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● ヘルプウインドウの表示  ※再定義
  250.   #--------------------------------------------------------------------------
  251.   def pop_help(obj)
  252.     return if @help_window == nil && obj.extension.include?("HELPHIDE")
  253.     return @help_window.visible = false if obj.extension.include?("HELPHIDE")
  254.     return if @skill_window != nil && @skill_window.visible
  255.     return if @item_window != nil && @item_window.visible
  256.     @help_window = Window_Help.new if @help_window == nil
  257.     @help_window.set_text(obj.name, 1)
  258.     @help_window.visible = true
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● チャージアクション作成
  262.   #--------------------------------------------------------------------------
  263.   def make_charge_action(member)
  264.     action = ""
  265.     case member.action.kind
  266.     when 0
  267.       if member.actor?
  268.         action = member.charge[3] if member.weapon_id == 0
  269.         action = $data_weapons[member.weapon_id].charge[3] if member.weapon_id != 0
  270.       else
  271.         action = member.charge[3] if member.weapon == 0
  272.         action = $data_weapons[member.weapon].charge[3] if member.weapon != 0
  273.       end
  274.     when 1;action = member.action.skill.charge[3]
  275.     when 2;action = member.action.item.charge[3]
  276.     end
  277.     member.charge_action = action
  278.     return if action == ""
  279.     member.charge_start = true
  280.     @spriteset.set_action(member.actor?, member.index, member.charge_action)
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● アクション実行中  ※再定義
  284.   #--------------------------------------------------------------------------
  285.   def playing_action
  286.     loop do
  287.       break if @judge
  288.       update_basic
  289.       # アクティブバトラーに格納されているアクション情報を見る
  290.       action = @active_battler.play
  291.       next if action == 0
  292.       @active_battler.play = 0
  293.       if action[0] == "Individual"
  294.         individual
  295.       elsif action == "Can Collapse"
  296.         unimmortaling
  297.       elsif action == "Cancel Action"
  298.         break action_end
  299.       elsif action == "End"
  300.         break action_end
  301.       elsif action[0] == "OBJ_ANIM"
  302.         damage_action(action[1])
  303.       end
  304.     end  
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● 戦闘アクション実行
  308.   #--------------------------------------------------------------------------
  309.   def process_action
  310.     # 合体攻撃処理
  311.     union_possibility?
  312.     process_union_skill if @active_battler.union_skill_id != 0
  313.     return set_next_active_battler if @active_battler.union_battler
  314.     # 暴走混乱処理
  315.     @active_battler.action.prepare unless @active_battler.action.forcing
  316.     # 戦闘行動開始
  317.     $in_action = true
  318.     @message_window.clear
  319.     @active_battler.white_flash = true
  320.     # ヘルプウインドウ表示
  321.     help_on
  322.     # 戦闘アクション実行
  323.     execute_action if @active_battler.action.valid? && @active_battler.restriction < 4
  324.     # ヘルプウインドウ隠蔽
  325.     help_off
  326.     # 強制行動などでバトラーが空になったら次の行動者へ
  327.     return set_next_active_battler if @active_battler == nil
  328.     # HP Slip Damage; 1.1i moved, CrimsonSeas fix
  329.     hp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
  330.     # MP Slip Damage
  331.     mp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
  332.     # 戦闘アクション終了
  333.     @message_window.clear
  334.     @active_battler.white_flash = false
  335.     $in_action = false
  336.     @spriteset.gauge_update
  337.     # 合体攻撃終了処理
  338.     end_union_skill if @active_battler.union_skill_id != 0
  339.     # スキル派生がある場合、行動続行
  340. #    return set_next_active_battler if @active_battler.derivation != 0 && !@forcing_battler # Derivation fix, 1.1e
  341.     # エネミーの複数回行動
  342.     return set_next_active_battler if enemy_order
  343.     # 戦闘行動終了
  344.     turn_end(@active_battler)
  345.     # 次の行動者へ
  346.     @action_battlers.delete(@active_battler)
  347.     set_next_active_battler
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● ヘルプウインドウ表示
  351.   #--------------------------------------------------------------------------
  352.   def help_on
  353.     @help_window = Window_Help.new if @help_window == nil
  354.     @help_window.visible = false
  355.     return @help_window.visible = true if @skill_window != nil && @skill_window.visible
  356.     return @help_window.visible = true if @item_window != nil && @item_window.visible
  357.     return @help_window.visible = true if @active_battler.action.guard?
  358.     return @help_window.visible = true if @active_battler.action.kind == 0 && @active_battler.action.basic == 2
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● ヘルプウインドウ隠蔽
  362.   #--------------------------------------------------------------------------
  363.   def help_off
  364.     return if @help_window == nil
  365.     return @help_window.visible = true if @skill_window != nil && @skill_window.visible
  366.     return @help_window.visible = true if @item_window != nil && @item_window.visible
  367.     @help_window.visible = false
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● アクション終了  ※再定義
  371.   #--------------------------------------------------------------------------
  372.   def action_end
  373.     # 初期化
  374.     @individual_target = nil
  375.     @active_battler.active = false
  376.     @active_battler.clear_action_results
  377.     # 念のため不死身化解除
  378.     unimmortaling
  379.     # 反射されていた場合
  380.     if @active_battler.reflex != nil
  381.       if @active_battler.action.skill?
  382.         obj = @active_battler.action.skill
  383.         @active_battler.perfect_skill_effect(@active_battler, obj)
  384.       elsif @active_battler.action.item?
  385.         obj = @active_battler.action.item
  386.         @active_battler.item_effect(@active_battler, obj)
  387.       else
  388.         @active_battler.perfect_attack_effect(@active_battler)
  389.       end
  390.       pop_damage(@active_battler, obj, @active_battler.reflex)
  391.       @active_battler.perform_collapse
  392.       @active_battler.reflex = nil
  393.       wait(N01::COLLAPSE_WAIT)
  394.     end
  395.     # 逆吸収で戦闘不能になった場合
  396.     if @absorb_dead
  397.       @active_battler.perform_collapse
  398.       @absorb_dead = false
  399.       wait(N01::COLLAPSE_WAIT)
  400.     end
  401.     # 次の行動までウエイトを挟む
  402.     wait(N01::ACTION_WAIT)
  403.   end  
  404.   #--------------------------------------------------------------------------
  405.   # ● 合体攻撃判定
  406.   #--------------------------------------------------------------------------
  407.   def union_skill?(member)
  408.     # スキルに合体攻撃設定があるかチェック
  409.     for union_action in member.action.skill.union_action
  410.       union_skills = union_action if union_action.size != 0 && union_action.include?(member.action.skill_id)
  411.     end
  412.     return if union_skills == nil
  413.     @partners = []
  414.     @union_targets = union_target_decision(member, member.action.skill)
  415.     @union_target_index = member.action.target_index
  416.     # 合体攻撃メンバーが使用可能かチェック
  417.     for skill_id in union_skills
  418.       for actor in $game_party.members
  419.         if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
  420.           @partners.push(actor)
  421.           actor.union_skill_id = skill_id
  422.         end
  423.       end
  424.     end
  425.     # 合体攻撃使用不可
  426.     if @partners.size != union_skills.size
  427.       for actor in @partners do actor.union_skill_id = 0 end
  428.       @partners = nil
  429.       member.action.clear if !member.action.guard?
  430.       return
  431.     end
  432.     # 合体攻撃使用可
  433.     for actor in @partners
  434.       # パートナーアクション決定
  435.       actor.action.kind = 1
  436.       actor.action.skill_id = actor.union_skill_id
  437.       actor.action.target_index = member.action.target_index
  438.       # コマンド強制キャンセル
  439.       if @command_members.include?(actor)
  440.         force_action_command_cansel(actor)
  441.         start_auto_action(member)
  442.       end
  443.     end
  444.     $in_union_action = true
  445.     @union_size = 0
  446.   end  
  447.   #--------------------------------------------------------------------------
  448.   # ● 合体攻撃可能か
  449.   #--------------------------------------------------------------------------
  450.   def union_possibility?
  451.     return if @partners == nil
  452.     for member in @partners
  453.       union_cansel = true unless member.inputable?
  454.     end
  455.     return if !union_cansel
  456.     end_union_skill
  457.     @active_battler.action.clear if !@active_battler.action.guard?
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 合体攻撃ターゲット決定
  461.   #--------------------------------------------------------------------------
  462.   def union_target_decision(member, obj)
  463.     targets = member.action.make_targets
  464.     # デフォルトの複数回攻撃が設定されていれば単体ターゲットに変換
  465.     targets = [targets[0]] if obj.for_two? or obj.for_three? or obj.dual?
  466.     # ランダムターゲットの場合、一体を選択しランダム範囲を保持
  467.     if obj.extension.include?("RANDOMTARGET")
  468.       randum_targets = targets.dup
  469.       targets = [randum_targets[rand(randum_targets.size)]]
  470.     end
  471.     # ターゲット情報をバトラースプライトに送る
  472.     @spriteset.set_target(member.actor?, member.index, targets)
  473.     return targets
  474.   end   
  475.   #--------------------------------------------------------------------------
  476.   # ● 合体攻撃処理
  477.   #--------------------------------------------------------------------------
  478.   def process_union_skill
  479.     @union_size += 1
  480.     if @union_size != @partners.size
  481.       return @active_battler.union_battler = true
  482.     end
  483.     # 合体攻撃スタート
  484.     @action_battlers.delete(@active_battler)
  485.     @active_battler.active = false
  486.     @active_battler = @partners.shift
  487.     @active_battler.act_active = true
  488.     @active_battler.active = true
  489.     @active_battler.union_battler = false
  490.     @active_battler.action.kind = 1
  491.     @active_battler.action.skill_id = @active_battler.union_skill_id
  492.     @active_battler.action.target_index = @union_target_index
  493.     for member in @partners
  494.       member.action.kind = 1
  495.       member.action.skill_id = member.union_skill_id
  496.       member.action.target_index = @union_target_index
  497.       member.mp -= member.calc_mp_cost($data_skills[member.action.skill_id]) if member != @active_battler # 3.4a
  498.       member.force_target = ["N01target_change", @union_targets]
  499.       @spriteset.update_target(true, member.index)
  500.       # アクション実行
  501.       @spriteset.set_action(true, member.index, member.action.skill.base_action)
  502.     end
  503.     @status_window.refresh # 3.4a
  504.   end  
  505.   #--------------------------------------------------------------------------
  506.   # ● 合体攻撃終了処理
  507.   #--------------------------------------------------------------------------
  508.   def end_union_skill
  509.     @active_battler.union_skill_id = 0
  510.     @active_battler.union_battler = false
  511.     for member in @partners
  512.       member.union_skill_id = 0
  513.       member.union_battler = false
  514.       member.action.clear
  515.       @action_battlers.delete(member)
  516.       turn_end(member)
  517.     end
  518.     @union_size = 0
  519.     @partners = nil
  520.     $in_union_action = false
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● エネミーの行動回数作成
  524.   #--------------------------------------------------------------------------
  525.   def enemy_order
  526.     return false if @active_battler.actor?
  527.     return false if @active_battler.act_time == 0 or !@active_battler.action.valid?
  528.     return true if rand(100) < @active_battler.action_time[1]
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ● Batter Turn End
  532.   # clears action and resets the ATB gauge
  533.   # runs 'end of turn' events as in the setup section
  534.   #--------------------------------------------------------------------------
  535.   def turn_end(member) # rewrite, ATB 1.1h
  536.     member = @active_battler
  537.     forced = member.action.forcing
  538.     member.action.forcing = false # remove forcing flag no matter what
  539.     t_index = member.action.target_index
  540.     $in_action = false
  541.     # アクション終了時のATBゲージ設定
  542.     # If you get an error on this line, it means you need to update your
  543.     # ATB Configurations script to the latest version.
  544.     if !forced || (N02::FORCE_ACTION_CONSUME_GAUGE && forced)
  545.       recharge_action(member)
  546.     elsif member.act_active && !N02::FORCE_ACTION_CONSUME_GAUGE
  547.       @spriteset.gauge_refill(member.actor?, member.index)
  548.     end
  549.     member.action.clear if !member.action.guard?
  550.     member.action.target_index = t_index # perserves target index through action clear
  551.     # needed for 'last target' to work in force action
  552.     process_battle_event
  553.     # ターン経過カウント
  554.     @end_member += 1 if !forced || (N02::FORCE_ACTION_INCREASE_TURN && forced)
  555.     passage = true if N02::ATB_TURN_COUNT == 2
  556.     if @end_member >= $game_party.members.size + $game_troop.members.size
  557.       passage = true if N02::ATB_TURN_COUNT == 0
  558.       passage = true if N02::ATB_TURN_COUNT == 1 && @end_member == 2
  559.     elsif @end_member == ($game_party.members.size + $game_troop.members.size) / 2
  560.       passage = true if N02::ATB_TURN_COUNT == 1
  561.     end
  562.     # スリップダメージ
  563.     if @slip_all_damage
  564.       for battlers in $game_party.members + $game_troop.members do mp_slip_damage(battlers) end
  565.       @slip_all_damage = false
  566.       @slip_all_damaged = true
  567.     end
  568.     return if !passage
  569.     # スリップダメージ
  570.     if N02::ATB_SLIP_DAMAGE == 1 && !@slip_all_damaged
  571.       for battlers in $game_party.members + $game_troop.members do hp_slip_damage(battlers) end
  572.       @slip_all_damage = true
  573.     end
  574.     @slip_all_damaged = false
  575.     @end_member = 0
  576.     $game_troop.increase_turn
  577.     $game_troop.turn_ending = true
  578.     process_battle_event # Mithran 1.1h - correct place for processing battle event
  579.     # otherwise, 'turn ending' events will not work
  580.     $game_troop.turn_ending = false
  581.     @status_window.refresh
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # ● アクション終了時のATBゲージ設定
  585.   #--------------------------------------------------------------------------
  586.   def recharge_action(member)
  587.     member.act_count = 0
  588.     recharge = member.recharge
  589.     # 通常攻撃(二刀のチャージ時間は双方武器の平均)
  590.     if member.actor? && member.action.attack?
  591.       recharge = member.weapons[0].recharge if member.weapons[0] != nil
  592.       recharge2 = member.weapons[1].recharge if member.weapons[1] != nil
  593.       recharge = (recharge + recharge2) / 2 if recharge2 != nil
  594.     elsif member.action.attack?
  595.       act_type = $data_weapons[member.weapon].charge if member.weapon != 0
  596.     end
  597.     recharge = $data_skills[member.action.skill_id].recharge if member.action.skill?
  598.     recharge = $data_items[member.action.item_id].recharge if member.action.item?
  599.     recharge = N02::ATB_GUARD_RESET if member.action.guard?
  600.     # ATBゲージに切り替え
  601.     @spriteset.change_atb(10 * recharge, member.actor?, member.index)
  602.     @spriteset.gauge_refresh(member.actor?, member.index)
  603.   end   
  604.   #--------------------------------------------------------------------------
  605.   # ● Set Next Active Battler
  606.   # sets the next battler to perform an action
  607.   # those that are 'forcing' an action will 'cut in line'
  608.   #--------------------------------------------------------------------------
  609.   def set_next_active_battler # Redefined 1.1e; Mithran's Force Action/escape fix
  610.     @forcing_battlers ||= []
  611.     return if $game_party.all_dead? or $game_troop.all_dead?
  612.     do_party_escape if @escape && $game_party.inputable? unless @judge # plays out party escape; 1.1e
  613.     # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  614.     prepare_forcing_atb   
  615.     # エネミー複数回行動時
  616.     @action_battlers.shift if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
  617.     loop do
  618.       if !@forcing_battlers.empty? # Force Action fix 1.1f
  619.         potential = @forcing_battlers.shift
  620.         if potential.action.valid?
  621.           @action_battlers.delete(potential)
  622.           force_action_cleanup(potential)
  623.           @active_battler = potential
  624.         else
  625.           potential.action.clear
  626.         end # Force Action fix 1.1f end
  627.       else
  628.         @active_battler = @action_battlers.shift
  629.       end
  630.       @active_battler.action.clear if @active_battler != nil && @active_battler.dead?
  631.       return if @active_battler == nil
  632.       # 戦闘行動開始
  633.       return process_action if @active_battler.index != nil
  634.     end
  635.   end
  636.   #--------------------------------------------------------------------------
  637.   # ● Process Battle Event
  638.   #--------------------------------------------------------------------------
  639.   def process_battle_event # Redefined 1.1e
  640.     @forcing_battlers ||= []
  641.     members_size = $game_party.members.size
  642.     loop do
  643.       return if judge_win_loss
  644.       return if $game_temp.next_scene != nil
  645.       $game_troop.interpreter.update
  646.       $game_troop.setup_battle_event
  647.       @message_window.update
  648.       if $game_message.visible
  649.         @message_window.visible = true
  650.         @status_window.visible = false
  651.       end
  652.       wait_for_message
  653.       @message_window.visible = false
  654.       @status_window.visible = true
  655.       reset_atb_actor if members_size != $game_party.members.size
  656.       prepare_forcing_atb
  657.       return unless $game_troop.interpreter.running?
  658.       update_basic
  659.     end
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # ● Prepare Force Action for ATB
  663.   #--------------------------------------------------------------------------
  664.   def prepare_forcing_atb # New method 1.1e; Mithran's Force Action fix
  665.     # changed in 1.1h
  666.     @forcing_battlers ||= []
  667.     if $game_troop.forcing_battler != nil
  668.       member = $game_troop.forcing_battler
  669.       $game_troop.forcing_battler = nil
  670.       force_action_cleanup(member)
  671.       @action_battlers.delete(member)
  672.       @forcing_battlers.delete(member)
  673.       # delete duplicates from the list
  674.       @forcing_battlers.push(member)
  675.     end
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ● Force Action Cleanup
  679.   # cleans up all open targeting/selection window, if necessary, in preparation
  680.   # for a force action
  681.   #--------------------------------------------------------------------------
  682.   def force_action_cleanup(member) # new method 1.1h
  683.     return if member.nil?
  684.     if @commander == member
  685.       @message_window.visible = false
  686.       @party_command_window.active = false
  687.       @party_command_window.visible = false
  688.       $in_command = $in_select = $in_target = $in_party_command = false
  689.       @target_members = nil
  690.       @actor_command_window.active = false
  691.       @cursor.visible = false unless $game_party.all_dead? or $game_troop.all_dead?
  692.       @command_phase = false
  693.       target_select_cleanup # new method 1.1h
  694.       end_skill_selection
  695.       end_item_selection
  696.       @party_command_window.active = @actor_command_window.active = false
  697.       @actor_command_window_on = false
  698.       @status_window.index = @actor_index = @actor_command_window.index = -1
  699.       @command_members.delete(@commander)
  700.       @commander = nil
  701.       @actor_command_window.active = false
  702.       @command_members.delete(member)
  703.       @commander = nil
  704.     end
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● Target Select Cleanup
  708.   # removes visible portion of target selection and unsets the global flag
  709.   #--------------------------------------------------------------------------
  710.   def target_select_cleanup # new method 1.1h
  711.     $in_target = false
  712.     @help_window2.dispose if @help_window2 != nil
  713.     @help_window2 = nil
  714.     @help_window.visible = false if @help_window != nil
  715.     @target_members = nil
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● battle_end(result) alias
  719.   #--------------------------------------------------------------------------
  720.   alias battle_end_forcefix battle_end # Force Action fix 1.1e
  721.   def battle_end(result)
  722.     @forcing_battlers = []
  723.     battle_end_forcefix(result)
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 全員の不死身化解除
  727.   #--------------------------------------------------------------------------
  728.   def member_unimmortaling # Redefined, 1.1e
  729.     for member in $game_party.members + $game_troop.members # all battlers
  730.       next if member.non_dead # stop if they are truly immortal
  731.       next if member.dead? # stop if they are already dead
  732.       member.set_temp_immortal(false) # make them not immortal
  733.     end
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # ● HPスリップダメージ
  737.   #--------------------------------------------------------------------------
  738.   def hp_slip_damage(member)
  739.     member.clear_action_results
  740.     return if !member.exist?
  741.     member.slip_damage = false
  742.     damage = 0
  743.     # 0ターン解除のステートがあるかチェック
  744.     for state in member.states
  745.       member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
  746.       # スリップダメージ実行 state = [ 対象, 定数, 割合, POP, 戦闘不能許可]
  747.       next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
  748.       for ext in state.slip_extension
  749.         if ext[0] == "hp"
  750.           base_damage = ext[1] + member.maxhp * ext[2] / 100
  751.           damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  752.           slip_pop = ext[3] unless ext[3] == nil # 3.4a
  753.           slip_dead = ext[4] unless ext[4] == nil # 3.4a
  754.           slip_damage_flug = true
  755.           member.slip_damage = true
  756.         end
  757.       end  
  758.     end
  759.     # デフォルトのスリップダメージ
  760. #    if member.slip_damage? && member.exist? && !slip_damage_flug
  761. #      damage += member.apply_variance(member.maxhp / 10, 10)
  762. #      slip_dead = false
  763. #      slip_pop = true
  764. #      slip_damage_flug = true
  765. #      member.slip_damage = true
  766. #    end
  767.     # 防具の自動回復があるか
  768.     if member.actor? && member.auto_hp_recover && member.exist?
  769.       damage -= member.maxhp / 20
  770.       slip_pop = true
  771.     end  
  772.     # 戦闘不能不許可
  773.     damage = member.hp - 1 if damage >= member.hp && slip_dead = false
  774.     member.hp -= damage
  775.     @spriteset.set_damage_pop(member.actor?, member.index, damage) if slip_pop
  776.     member.perform_collapse if member.dead? && member.slip_damage
  777.     member.clear_action_results
  778.     @status_window.refresh
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ● MPスリップダメージ
  782.   #--------------------------------------------------------------------------
  783.   def mp_slip_damage(member)
  784.     member.clear_action_results
  785.     return if !member.exist? or member.states.size == 0
  786.     member.slip_damage = false
  787.     mp_damage = 0
  788.     for state in member.states
  789.       next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
  790.       for ext in state.slip_extension
  791.         if ext[0] == "mp"
  792.           base_damage = ext[1] + member.maxmp * ext[2] / 100
  793.           mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  794.           slip_pop = ext[2]
  795.           slip_damage_flug = true
  796.         end
  797.       end
  798.     end  
  799.     member.mp_damage = mp_damage
  800.     member.mp -= mp_damage
  801.     @spriteset.set_damage_pop(member.actor?, member.index, mp_damage) if slip_pop
  802.     member.clear_action_results
  803.     @status_window.refresh
  804.   end  
  805.   #--------------------------------------------------------------------------
  806.   # ● 戦闘行動の実行 : 防御  ※再定義
  807.   #--------------------------------------------------------------------------
  808.   def execute_action_guard
  809.     @help_window.set_text(N01::GUARD_HELP_TEXT, 1)
  810.     @help_window.visible = true
  811.     # バトラーのアクティブ化を解除
  812.     @active_battler.active = false
  813.     wait(45)
  814.     @help_window.visible = false if @help_window != nil
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ● 戦闘行動の実行 : 逃走  ※再定義
  818.   #--------------------------------------------------------------------------
  819.   def execute_action_escape
  820.     @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
  821.     @help_window.set_text(N01::ESCAPED_HELP_TEXT, 1)
  822.     @help_window.visible = true
  823.     # バトラーのアクティブ化を解除
  824.     @active_battler.active = false
  825.     @active_battler.escape
  826.     Sound.play_escape
  827.     wait(45)
  828.     @help_window.visible = false if @help_window != nil
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● パーティコマンド選択の開始  ※再定義
  832.   #--------------------------------------------------------------------------
  833.   def start_party_command_selection
  834.     @info_viewport.visible = true
  835.     @status_window.index = @actor_index = -1
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● 次のアクターのコマンド入力へ  ※再定義
  839.   #--------------------------------------------------------------------------
  840.   def next_actor
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # ● 前のアクターのコマンド入力へ  ※再定義
  844.   #--------------------------------------------------------------------------
  845.   def prior_actor
  846.   end
  847.   #--------------------------------------------------------------------------
  848.   # ● アクターコマンド選択の開始  ※再定義
  849.   #--------------------------------------------------------------------------
  850.   def start_actor_command_selection
  851.     $in_command = true
  852.     @command_phase = true
  853.     @command_member_index = 0
  854.     @commander = @command_members[@command_member_index]
  855.     @status_window.active = true
  856.     @status_window.index = @commander.index
  857.     # カーソルセット
  858.     @cursor = Sprite_Cursor.new if @cursor == nil
  859.     @cursor.set(@commander)
  860.     # 動けるキャラのみコマンドアクションを
  861.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  862.     @party_command_window.active = false
  863.     @actor_command_window.setup(@commander)
  864.     @actor_command_window.active = true
  865.     @actor_command_window.index = 0
  866.     @actor_command_window_on = true
  867.     @status_window.refresh
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # ● コマンド更新  ※再定義
  871.   #--------------------------------------------------------------------------
  872.   def update_actor_command_selection
  873.     # コマンド入力できる状態でなくなればキャンセル
  874.     return reset_command unless commanding?
  875.     if Input.trigger?(Input::B)
  876.       Input.update
  877.       Sound.play_decision
  878.       start_party_command
  879.     elsif Input.trigger?(Input::C)
  880.       Input.update
  881.       case @actor_command_window.index
  882.       when 0  # 攻撃
  883.         Sound.play_decision
  884.         @commander.action.set_attack
  885.         start_target_enemy_selection
  886.       when 1  # スキル
  887.         Sound.play_decision
  888.         $in_select = true
  889.         start_skill_selection
  890.       when 2  # 防御
  891.         Sound.play_decision
  892.         @commander.action.set_guard
  893.         end_command
  894.       when 3  # アイテム
  895.         Sound.play_decision
  896.         $in_select = true
  897.         start_item_selection
  898.       end
  899.     # →キーでコマンドキャラ送り
  900.     elsif Input.trigger?(Input::RIGHT)
  901.       next_commander
  902.     # ←キーでコマンドキャラ戻し
  903.     elsif Input.trigger?(Input::LEFT)
  904.       back_commander
  905.     end
  906.   end
  907.   #--------------------------------------------------------------------------
  908.   # ● コマンド入力できる状態か
  909.   #--------------------------------------------------------------------------
  910.   def commanding?
  911.     return false if @judge or $gauge_stop
  912.     return false if @commander != nil && !@commander.inputable?
  913.     return false if @commander != nil && @commander.union_skill_id != 0
  914.     return false if @commander != nil && @commander.at_count < 1000
  915.     return true
  916.   end
  917.   #--------------------------------------------------------------------------
  918.   # ● コマンドキャラ送り
  919.   #--------------------------------------------------------------------------
  920.   def next_commander
  921.     return if @command_members.size == 1 or @commander == nil
  922.     Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
  923.     # 動けるキャラのみコマンド戻りアクションを
  924.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  925.     # コマンド待ちメンバーのインデックスが最後なら
  926.     if @command_member_index == @command_members.size - 1
  927.       @command_member_index = 0
  928.     # 次のキャラにコマンドを送る
  929.     else
  930.       @command_member_index += 1
  931.     end
  932.     @commander = @command_members[@command_member_index]
  933.     @status_window.index = @commander.index
  934.     @actor_command_window.setup(@commander) # 1.1c
  935.     # カーソルセット
  936.     @cursor.set(@commander)
  937.     # 動けるキャラのみコマンドアクションを
  938.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  939.   end  
  940.   #--------------------------------------------------------------------------
  941.   # ● コマンドキャラ戻し
  942.   #--------------------------------------------------------------------------
  943.   def back_commander
  944.     return if @command_members.size == 1 or @commander == nil
  945.     Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1],  N02::NEXT_SOUND01[0])
  946.     # 動けるキャラのみコマンド戻りアクションを
  947.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  948.     # コマンド待ちメンバーのインデックスが最初なら
  949.     if @command_member_index == 0
  950.       @command_member_index = @command_members.size - 1
  951.     # 前のキャラにコマンドを送る
  952.     else
  953.       @command_member_index -= 1
  954.     end
  955.     @commander = @command_members[@command_member_index]
  956.     @status_window.index = @commander.index
  957.     # カーソルセット
  958.     @cursor.set(@commander)
  959.     # 動けるキャラのみコマンドアクションを
  960.     @spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
  961.   end  
  962.   #--------------------------------------------------------------------------
  963.   # ● パーティコマンド選択の開始
  964.   #--------------------------------------------------------------------------
  965.   def start_party_command
  966.     $in_party_command = true
  967.     $in_command = false
  968.     @status_window.refresh
  969.     @status_window.index = @actor_index = -1
  970.     @info_viewport.visible = true
  971.     @message_window.visible = false
  972.     @pre_a_index = @actor_command_window.index
  973.     @actor_command_window.active = false
  974.     @actor_command_window.index = -1
  975.     @party_command_window.active = true
  976.     @party_command_window.index = 0
  977.     @party_command_window.visible = true
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● パーティコマンド選択の更新
  981.   #--------------------------------------------------------------------------
  982.   def update_party_command_selection
  983.     # コマンド入力できる状態でなくなればキャンセル
  984.     return reset_command unless commanding?
  985.     if Input.trigger?(Input::C)
  986.       case @party_command_window.index
  987.       when 0  # 戦う
  988.         Sound.play_decision
  989.         @status_window.index = @actor_index = -1
  990.         end_party_command
  991.       when 1  # 逃げる
  992.         return Sound.play_buzzer if $game_troop.can_escape == false
  993.         Sound.play_decision
  994.         end_party_command
  995.         process_escape if !@escape
  996.       end
  997.     elsif Input.trigger?(Input::B)
  998.       Sound.play_cancel
  999.       end_party_command
  1000.     end
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # ● パーティコマンド選択の終了
  1004.   #--------------------------------------------------------------------------
  1005.   def end_party_command
  1006.     $in_party_command = false
  1007.     $in_command = true
  1008.     @status_window.refresh
  1009.     @message_window.visible = false
  1010.     @party_command_window.active = false
  1011.     @actor_command_window.active = true
  1012.     @party_command_window.visible = false
  1013.     @actor_command_window.index = @pre_a_index
  1014.     @status_window.index = @commander.index
  1015.     @status_window.active = true
  1016.   end
  1017.   #--------------------------------------------------------------------------
  1018.   # ● 逃走の処理  ※再定義
  1019.   #--------------------------------------------------------------------------
  1020.   def process_escape # redefined by Mithran
  1021.     # escape processing method - trimmed to almost nothing
  1022.     @escape = true # sets the escape flag for later use
  1023.     closed_window # closes all windows
  1024.   end
  1025.   #--------------------------------------------------------------------------
  1026.   # ● do_party_escape
  1027.   #--------------------------------------------------------------------------
  1028.   def do_party_escape # new method 1.1e, contains most of the old content
  1029.     # of the prior escape method
  1030.     # it has been largely reordered to play out more naturally given its current
  1031.     # position in the code
  1032.     reset_atb_actor # sets the atb of all actors to zero
  1033.     if $game_troop.preemptive
  1034.       success = true
  1035.     else
  1036.       success = (rand(100) < @escape_ratio)
  1037.     end
  1038.     for actor in $game_party.members
  1039.       if !actor.non_dead
  1040.         actor.set_temp_immortal(false) # technically, line is not reached while the non_dead flag is set
  1041.         if actor.hp == 0 and not actor.state?(1)
  1042.           actor.add_state(1)
  1043.           actor.added_states.push(1)
  1044.         end
  1045.       end
  1046.       # unimmortal all battlers, kill them if necessary
  1047.     end
  1048.     if $game_party.all_dead? # if everyone is dead, end the battle with defeat
  1049.       @escape = false
  1050.       @judge = true
  1051.       process_defeat
  1052.       battle_end(2)
  1053.       return true
  1054.     end
  1055.     for actor in $game_party.members # perform run animation
  1056.       unless actor.restriction >= 4
  1057.         @spriteset.set_action(true, actor.index, success ? actor.run_success : actor.run_ng )
  1058.       end
  1059.     end
  1060.     @info_viewport.visible = false # hide the info viewport
  1061.     @message_window.visible = true # show the message window
  1062.     text = sprintf(Vocab::EscapeStart, $game_party.name) # format the escape text
  1063.     $game_message.texts.push(text) # add it to the $game_message, so the message window grabs it next update
  1064.     Sound.play_escape #play escape sound
  1065.     if !success
  1066.       $game_message.texts.push('\.' + Vocab::EscapeFailure)
  1067.       # add fail message if necessary
  1068.     end
  1069.     wait_for_message # wait for message
  1070.     if success
  1071.       @judge = true # cut battle short - it seems this flag is used to indicate that the battle is over
  1072.       # and as such, no further actions will be performed
  1073.       battle_end(1) # end battle with escape
  1074.       return true # cut short the calling method
  1075.     else
  1076.       @escape_ratio += 10 # add 10 to the escape ratio
  1077.       $game_party.clear_actions # clear all actions
  1078.       @info_viewport.visible = true # make the party display viewport again visible
  1079.       @escape = false # unset the escape flag
  1080.       for member in $game_party.members
  1081.         member.clear_sprite_effects # clear all sprite effects
  1082.       end
  1083.       return false # the calling method continues as normal
  1084.     end
  1085.   end
  1086.   #--------------------------------------------------------------------------
  1087.   # ● アクターのATBを初期化
  1088.   #--------------------------------------------------------------------------
  1089.   def reset_atb_actor
  1090.     @command_members = []
  1091.     @commander = nil
  1092.     $in_action = @command_phase = false
  1093.     $in_command = $in_target = $in_select = false
  1094.     @message_window.clear
  1095.     for member in $game_party.members
  1096.       @action_battlers.delete(member)
  1097.       member.white_flash = false
  1098.       member.action.clear
  1099.       # ATBゲージに切り替え
  1100.       @spriteset.change_atb(N02::ATB_RUN_NG * -10, member.actor?, member.index)
  1101.     end
  1102.   end
  1103.   #--------------------------------------------------------------------------
  1104.   # ● 開いているウインドウを閉じる
  1105.   #--------------------------------------------------------------------------
  1106.   def closed_window
  1107.     @cursor.dispose if @cursor != nil
  1108.     @cursor = nil
  1109.     @help_window.dispose if @help_window != nil
  1110.     @help_window = nil
  1111.     @help_window2.dispose if @help_window2 != nil
  1112.     @help_window2 = nil
  1113.     @skill_window.dispose if @skill_window != nil
  1114.     @skill_window = nil
  1115.     @item_window.dispose if @item_window != nil
  1116.     @item_window = nil
  1117.     @actor_command_window_on = false if @actor_command_window != nil
  1118.     @actor_command_window.active = false if @actor_command_window != nil
  1119.     @party_command_window.visible = false if @party_command_window != nil
  1120.     @party_command_window.active = false if @party_command_window != nil
  1121.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # ● ターゲット選択の開始  ※再定義
  1125.   #--------------------------------------------------------------------------
  1126.   def start_target_selection(actor = false)
  1127.     $in_target = true
  1128.     $in_command = $in_select = false
  1129.     @target_actors = actor
  1130.     @target_members = $game_party.members if @target_actors
  1131.     @target_members = $game_troop.members unless @target_actors
  1132.     # 不要なウインドウを消す
  1133.     @actor_command_window.active = false
  1134.     @skill_window.visible = false if @skill_window != nil
  1135.     @item_window.visible = false if @item_window != nil
  1136.     # 存在しているターゲットで最も番号の低い対象を最初に指すように
  1137.     @index = 0
  1138.     @max_index = @target_members.size - 1
  1139.     # アクターは戦闘不能者でもターゲットできるようにエネミーと区別
  1140.     unless @target_actors
  1141.       @target_members.size.times do
  1142.         break if @target_members[@index].exist?
  1143.         @index += 1
  1144.       end
  1145.     end  
  1146.     # カーソルセット
  1147.     @cursor.set(@target_members[@index])
  1148.     @help_window.visible = false if @help_window != nil
  1149.     @help_window2 = Window_Help.new if @help_window2 == nil
  1150.     @help_window2.set_text_n01add(@target_members[@index])
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # ● ターゲット選択更新  ※再定義
  1154.   #--------------------------------------------------------------------------
  1155.   def update_target
  1156.     # コマンド入力できる状態でなくなればキャンセル
  1157.     return reset_command unless commanding?
  1158.     return end_target_selection(cansel = true) if $game_troop.all_dead?
  1159.     cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist?
  1160.     if Input.trigger?(Input::B)
  1161.       Input.update
  1162.       Sound.play_cancel
  1163.       end_target_selection(cansel = true)
  1164.     elsif Input.trigger?(Input::C)
  1165.       Input.update
  1166.       Sound.play_decision
  1167.       @commander.action.target_index = @index
  1168.       end_target_selection
  1169.       end_skill_selection
  1170.       end_item_selection
  1171.       @actor_command_window.active = false
  1172.       next_actor
  1173.     end
  1174.     if Input.repeat?(Input::LEFT)
  1175.       if @target_actors
  1176.         cursor_down if $back_attack
  1177.         cursor_up unless $back_attack
  1178.       else
  1179.         cursor_up if $back_attack
  1180.         cursor_down unless $back_attack
  1181.       end  
  1182.     end
  1183.     if Input.repeat?(Input::RIGHT)
  1184.       if @target_actors
  1185.         cursor_up if $back_attack
  1186.         cursor_down unless $back_attack
  1187.       else
  1188.         cursor_down if $back_attack
  1189.         cursor_up unless $back_attack
  1190.       end
  1191.     end
  1192.     cursor_up if Input.repeat?(Input::UP)
  1193.     cursor_down if Input.repeat?(Input::DOWN)
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● カーソルを前に移動  ※再定義
  1197.   #--------------------------------------------------------------------------
  1198.   def cursor_up
  1199.     Sound.play_cursor
  1200.     @target_members.size.times do
  1201.       @index += @target_members.size - 1
  1202.       @index %= @target_members.size
  1203.       break if @target_actors
  1204.       break if @target_members[@index].exist?
  1205.     end
  1206.     # カーソルセット
  1207.     @cursor.set(@target_members[@index])
  1208.     @help_window2.set_text_n01add(@target_members[@index]) if @help_window2 != nil
  1209.   end
  1210.   #--------------------------------------------------------------------------
  1211.   # ● カーソルを次に移動  ※再定義
  1212.   #--------------------------------------------------------------------------
  1213.   def cursor_down
  1214.     Sound.play_cursor
  1215.     @target_members.size.times do
  1216.       @index += 1
  1217.       @index %= @target_members.size
  1218.       break if @target_actors
  1219.       break if @target_members[@index].exist?
  1220.     end
  1221.     # カーソルセット
  1222.     @cursor.set(@target_members[@index])
  1223.     @help_window2.set_text_n01add(@target_members[@index]) if @help_window2 != nil
  1224.   end
  1225.   #--------------------------------------------------------------------------
  1226.   # ● ターゲット選択の終了  再定義
  1227.   #--------------------------------------------------------------------------
  1228.   def end_target_selection(cansel = false)
  1229.     $in_target = false
  1230.     @help_window2.dispose if @help_window2 != nil
  1231.     @help_window2 = nil
  1232.     @help_window.visible = false if @help_window != nil
  1233.     if @skill_window != nil
  1234.       @skill_window.visible = @skill_window.active = true
  1235.       @help_window.visible = true if @help_window != nil
  1236.       @actor_command_window.active = false if cansel
  1237.       $in_select = true if cansel
  1238.     elsif @item_window != nil
  1239.       @item_window.visible = @item_window.active = true
  1240.       @help_window.visible = true if @help_window != nil
  1241.       @actor_command_window.active = false if cansel
  1242.       $in_select = true if cansel
  1243.     end
  1244.     @target_members = nil
  1245.     end_command if !cansel
  1246.     # カーソルセット
  1247.     @cursor.set(@commander) if cansel
  1248.     $in_command = true if cansel && @actor_command_window.index == 0
  1249.     @actor_command_window.active = true if cansel && @actor_command_window.index == 0
  1250.   end
  1251.   #--------------------------------------------------------------------------
  1252.   # ● コマンド初期化
  1253.   #--------------------------------------------------------------------------
  1254.   def reset_command
  1255.     @message_window.visible = false
  1256.     @party_command_window.active = false
  1257.     @commander.action.clear
  1258.     @party_command_window.visible = false
  1259.     $in_command = $in_select = $in_target = false
  1260.     @target_members = nil
  1261.     @actor_command_window.active = false
  1262.     @cursor.visible = false unless $game_party.all_dead? or $game_troop.all_dead? # bug fix 1.1b
  1263.     @command_phase = false
  1264.     end_skill_selection
  1265.     end_item_selection
  1266.     @party_command_window.active = @actor_command_window.active = false
  1267.     @actor_command_window_on = false
  1268.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1269.     @command_members.delete(@commander)
  1270.     @commander = nil
  1271.   end  
  1272.   #--------------------------------------------------------------------------
  1273.   # ● 強制行動によるコマンドキャンセル
  1274.   #--------------------------------------------------------------------------
  1275.   def force_action_command_cansel(member)
  1276.     return if !member.inputable?
  1277.     # Force Action fix 1.1e
  1278.     end_target_selection if @commander == member # 1.1f
  1279.     return if member.nil?
  1280.     @pre_a_index ||= 0
  1281.     end_party_command if @commander == member
  1282.     # end Force Action fix 1.1e
  1283.     # チャージ設定
  1284.     act_type = charge_set(member)
  1285.     # 行動ゲージに切り替え
  1286.     @spriteset.change_act(act_type, member.actor?, member.index)
  1287.     # 動けるキャラのみコマンド戻りアクションを
  1288.     @spriteset.set_action(true, member.index,member.command_a) if member.actor? && member.inputable?
  1289.     # チャージアクション
  1290.     make_charge_action(member)
  1291.     # 以下の処理はコマンド入力中のアクター限定
  1292.     return if !member.actor? or @commander != member
  1293.     # カーソル消去
  1294.     @cursor.visible = false
  1295.     @command_phase = false
  1296.     # ウインドウ初期化
  1297.     end_skill_selection
  1298.     end_item_selection
  1299.     $in_target = false
  1300.     @help_window2.dispose if @help_window2 != nil
  1301.     @help_window2 = nil
  1302.     @help_window.visible = false if @help_window != nil
  1303.     @party_command_window.active = @actor_command_window.active = false
  1304.     @actor_command_window_on = false
  1305.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1306.     @command_members.delete(member)
  1307.     @commander = nil
  1308.     @message_window.visible = false
  1309.     @party_command_window.active = false
  1310.     @party_command_window.visible = false
  1311.     $in_command = $in_select = $in_target = false
  1312.   end  
  1313.   #--------------------------------------------------------------------------
  1314.   # ● コマンド入力終了
  1315.   #--------------------------------------------------------------------------
  1316.   def end_command
  1317.     return if !@commander.inputable?
  1318.     $in_command = false
  1319.     $in_select = false
  1320.     # カーソル消去
  1321.     @cursor.visible = false if @cursor.visible != nil # 1.2a
  1322.     @command_phase = false
  1323.     # アクション実行時間チェック
  1324.     act_type = charge_set(@commander)
  1325.     # 行動ゲージに切り替え
  1326.     @spriteset.change_act(act_type, true, @commander.index)
  1327.     # 動けるキャラのみコマンド戻りアクションを
  1328.     @spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
  1329.     # チャージアクション
  1330.     make_charge_action(@commander)
  1331.     # 合体攻撃チェック
  1332.     union_skill?(@commander) if @commander.action.skill? && @partners == nil
  1333.     # ウインドウ初期化
  1334.     @party_command_window.active = @actor_command_window.active = false
  1335.     @actor_command_window_on = false
  1336.     @status_window.index = @actor_index = @actor_command_window.index = -1
  1337.     @command_members.delete(@commander)
  1338.     @commander = nil
  1339.   end
  1340.   #--------------------------------------------------------------------------
  1341.   # ● 情報表示ビューポートの作成  ※再定義
  1342.   #--------------------------------------------------------------------------
  1343.   def create_info_viewport
  1344.     @command_members = []
  1345.     @action_battlers = []
  1346.     @info_viewport = Viewport.new(0, 288, 544, 128)
  1347.     @info_viewport.z = 100
  1348.     @status_window = Window_BattleStatus.new
  1349.     @party_command_window = Window_PartyCommand2.new
  1350.     @actor_command_window = Window_ActorCommand.new
  1351.     @status_window.viewport = @info_viewport
  1352.     @actor_command_window.viewport = @info_viewport
  1353.     @status_window.x = 128
  1354.     @actor_command_window.x = 672
  1355.     @info_viewport.visible = false
  1356.     @party_command_window.visible = false
  1357.     @info_viewport.ox = 128
  1358.   end
  1359.   #--------------------------------------------------------------------------
  1360.   # ● 情報表示ビューポートの更新   ※再定義
  1361.   #--------------------------------------------------------------------------
  1362.   def update_info_viewport
  1363.     @party_command_window.update if @party_command_window.active
  1364.     @actor_command_window.update if @actor_command_window.active
  1365.     @status_window.update if @status_window.active
  1366.     @message_window.visible = false if !$game_message.visible
  1367.     @info_viewport.visible = true if !@message_window.visible
  1368.     @actor_command_window.x += 32 if @actor_command_window.x < 672 && !@actor_command_window_on
  1369.     @actor_command_window.x -= 32 if @actor_command_window.x > 544 && @actor_command_window_on
  1370.   end
  1371.   #--------------------------------------------------------------------------
  1372.   # ● スキル選択の開始  ※再定義
  1373.   #--------------------------------------------------------------------------
  1374.   def start_skill_selection
  1375.     @help_window = Window_Help.new if @help_window == nil
  1376.     @help_window.visible = true
  1377.     @skill_window = Window_Skill.new(0, 56, 544, 232, @commander)
  1378.     @skill_window.z = 1000
  1379.     @skill_window.help_window = @help_window
  1380.     @actor_command_window.active = false
  1381.   end
  1382.   #--------------------------------------------------------------------------
  1383.   # ● スキル選択の更新  ※再定義
  1384.   #--------------------------------------------------------------------------
  1385.   def update_skill_selection
  1386.     # コマンド入力できる状態でなくなればキャンセル
  1387.     return reset_command unless commanding?
  1388.     @skill_window.active = true
  1389.     @skill_window.update
  1390.     @help_window.update
  1391.     if Input.trigger?(Input::B)
  1392.       Sound.play_cancel
  1393.       end_skill_selection
  1394.       $in_command = true
  1395.     elsif Input.trigger?(Input::C)
  1396.       @skill = @skill_window.skill
  1397.       if @skill != nil
  1398.         @commander.last_skill_id = @skill.id
  1399.       end
  1400.       if @commander.skill_can_use?(@skill)
  1401.         return Sound.play_buzzer if @commander.union_skill?(@skill.id) && !@commander.union_skill_can_use?(@skill.id)
  1402.         Sound.play_decision
  1403.         determine_skill
  1404.       else
  1405.         Sound.play_buzzer
  1406.       end
  1407.     end
  1408.   end
  1409.   #--------------------------------------------------------------------------
  1410.   # ● スキルの決定  ※再定義
  1411.   #--------------------------------------------------------------------------
  1412.   def determine_skill
  1413.     @commander.action.set_skill(@skill.id)
  1414.     @skill_window.active = false
  1415.     if @skill.need_selection?
  1416.       if @skill.for_opponent?
  1417.         start_target_enemy_selection
  1418.       else
  1419.         start_target_actor_selection
  1420.       end
  1421.     else
  1422.       end_skill_selection
  1423.       end_target_selection
  1424.     end
  1425.   end
  1426.   #--------------------------------------------------------------------------
  1427.   # ● スキル選択の終了
  1428.   #--------------------------------------------------------------------------
  1429.   alias end_skill_selection_n01 end_skill_selection
  1430.   def end_skill_selection
  1431.     end_skill_selection_n01
  1432.     $in_select = false
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   # ● アイテム選択の開始  ※再定義
  1436.   #--------------------------------------------------------------------------
  1437.   def start_item_selection
  1438.     @help_window = Window_Help.new if @help_window == nil
  1439.     @help_window.visible = true
  1440.     @item_window = Window_Item.new(0, 56, 544, 232)
  1441.     @item_window.z = 1000
  1442.     @item_window.help_window = @help_window
  1443.     @actor_command_window.active = false
  1444.   end
  1445.   #--------------------------------------------------------------------------
  1446.   # ● アイテム選択の更新  ※再定義
  1447.   #--------------------------------------------------------------------------
  1448.   def update_item_selection
  1449.     # コマンド入力できる状態でなくなればキャンセル
  1450.     return reset_command unless commanding?
  1451.     @item_window.active = true
  1452.     @item_window.update
  1453.     @help_window.update
  1454.     if Input.trigger?(Input::B)
  1455.       Sound.play_cancel
  1456.       end_item_selection
  1457.       $in_command = true # 1.1b
  1458.     elsif Input.trigger?(Input::C)
  1459.       @item = @item_window.item
  1460.       if @item != nil
  1461.         $game_party.last_item_id = @item.id
  1462.       end
  1463.       if $game_party.item_can_use?(@item)
  1464.         Sound.play_decision
  1465.         determine_item
  1466.       else
  1467.         Sound.play_buzzer
  1468.       end
  1469.     end
  1470.   end
  1471.   #--------------------------------------------------------------------------
  1472.   # ● アイテムの決定  ※再定義
  1473.   #--------------------------------------------------------------------------
  1474.   def determine_item
  1475.     @commander.action.set_item(@item.id)
  1476.     @item_window.active = false
  1477.     if @item.need_selection?
  1478.       if @item.for_opponent?
  1479.         start_target_enemy_selection
  1480.       else
  1481.         start_target_actor_selection
  1482.       end
  1483.     else
  1484.       end_item_selection
  1485.       end_target_selection
  1486.     end
  1487.   end
  1488.   #--------------------------------------------------------------------------
  1489.   # ● アイテム選択の終了
  1490.   #--------------------------------------------------------------------------
  1491.   alias end_item_selection_n01 end_item_selection
  1492.   def end_item_selection
  1493.     end_item_selection_n01
  1494.     $in_select = false
  1495.   end
  1496.   #--------------------------------------------------------------------------
  1497.   # ● 勝敗判定  ※再定義
  1498.   #--------------------------------------------------------------------------
  1499.   def judge_win_loss
  1500.     return true unless $game_temp.in_battle
  1501.     if $game_party.all_dead?
  1502.       @judge = true
  1503.       $gauge_stop = true
  1504.       closed_window
  1505.       @spriteset.atb_dispose
  1506.       $game_troop.clear_actions
  1507.       $game_party.clear_actions
  1508.       process_defeat
  1509.       return true
  1510.     elsif $game_troop.all_dead?
  1511.       @judge = true
  1512.       $gauge_stop = true
  1513.       closed_window
  1514.       @spriteset.atb_dispose
  1515.       $game_troop.clear_actions
  1516.       $game_party.clear_actions
  1517.       process_victory
  1518.       return true
  1519.     else
  1520.       return false
  1521.     end
  1522.   end
  1523. end
  1524. #==============================================================================
  1525. # ■ Game_BattleAction#valid? is no longer overwritten.
  1526. #------------------------------------------------------------------------------
  1527.  
  1528. #==============================================================================
  1529. # ■ Game_Battler (分割定義 1)
  1530. #------------------------------------------------------------------------------
  1531. #  バトラーを扱うクラスです。
  1532. #==============================================================================
  1533. class Game_Battler
  1534.   #--------------------------------------------------------------------------
  1535.   # ● 公開インスタンス変数
  1536.   #--------------------------------------------------------------------------
  1537.   attr_accessor :at_count         # コマンド待ちゲージ(1000がMAX)
  1538.   attr_accessor :at_active        # コマンド入力可能
  1539.   attr_accessor :atb_count_up     # ATBカウントアップ中
  1540.   attr_accessor :act_count        # 行動待ちゲージ(1000がMAX)
  1541.   attr_accessor :act_active       # 行動可能
  1542.   attr_accessor :at_speed         # ゲージアップスピード基準値
  1543.   attr_accessor :charge_action    # チャージアクション
  1544.   attr_accessor :charge_start     # チャージ中か
  1545.   attr_accessor :union_skill_id   # 合体攻撃スキルID
  1546.   attr_accessor :union_battler    # 合体攻撃参加者か
  1547.   attr_accessor :speed_level      # 戦闘参加者の最速スピード基準
  1548.   attr_accessor :low_speed_level  # 戦闘参加者の最遅スピード基準
  1549.   #--------------------------------------------------------------------------
  1550.   # ● ステートの付加  ATBダメージ処理を追加
  1551.   #--------------------------------------------------------------------------
  1552.   alias add_state_n02 add_state
  1553.   def add_state(state_id)
  1554.     add_state_n02(state_id)
  1555.     if $data_states[state_id].atb_damage != 0
  1556.       @at_count = @at_count + $data_states[state_id].atb_damage * 10
  1557.       @at_count = 0 if @at_count < 0 && !$data_states[state_id].atb_minus_damage
  1558.       @at_count = 1000 if @at_count > 1000
  1559.       # ATBダメージでチャージキャンセル
  1560.       if $data_states[state_id].atb_damage < 0
  1561.         @act_count = 0
  1562.         @act_active = false
  1563.         @at_active = false
  1564.         @atb_count_up = true
  1565.       end
  1566.     end  
  1567.   end
  1568.   #--------------------------------------------------------------------------
  1569.   # ● 戦闘開始時のAT設定
  1570.   #--------------------------------------------------------------------------
  1571.   def atb_setting
  1572.     # 初期化
  1573.     @at_count = @act_count = @speed_level = @low_speed_level = @union_skill_id = 0
  1574.     @at_active = @act_active = @atb_count_up = @charge_start = @union_battler = false
  1575.     $in_party_command = $in_command = $in_target = $in_select = $in_action = false
  1576.     @charge_action = normal
  1577.     $in_union_action = false
  1578.     # ゲージアップスピード(戦闘速度)
  1579.     @at_speed = $game_party.atb_control[1]
  1580.     # ユーザー設定を使わない場合
  1581.     return if N02::ATB_CUSTOMIZE
  1582.     @at_speed = N02::ATB_SPEED
  1583.   end
  1584.   #--------------------------------------------------------------------------
  1585.   # ● ATBスピード基準値リフレッシュ
  1586.   #--------------------------------------------------------------------------
  1587.   def atb_base_speed_refresh
  1588.     battle_members = $game_party.members + $game_troop.members
  1589.     battle_members.sort! do |a,b|
  1590.       b.agi - a.agi
  1591.     end
  1592.     self.speed_level = battle_members[0].agi
  1593.     self.low_speed_level = battle_members[battle_members.size - 1].agi
  1594.   end
  1595.   #--------------------------------------------------------------------------
  1596.   # ● 自動行動判定
  1597.   #--------------------------------------------------------------------------
  1598.   def auto_action?
  1599.     return true if berserker? or confusion? or auto_battle or @union_skill_id != 0
  1600.     return false
  1601.   end
  1602.   #--------------------------------------------------------------------------
  1603.   # ● 合体攻撃スキル判定
  1604.   #--------------------------------------------------------------------------
  1605.   def union_skill?(skill_id)
  1606.     # スキルに合体攻撃設定があるかチェック
  1607.     for union_action in $data_skills[skill_id].union_action
  1608.       union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
  1609.     end
  1610.     return false if union_skills == nil
  1611.     return true
  1612.   end  
  1613.   #--------------------------------------------------------------------------
  1614.   # ● 合体攻撃使用可能判定
  1615.   #--------------------------------------------------------------------------
  1616.   def union_skill_can_use?(skill_id)
  1617.     return false if $in_union_action
  1618.     for union_action in $data_skills[skill_id].union_action
  1619.       union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
  1620.     end
  1621.     return false if union_skills == nil
  1622.     partners = []
  1623.     # 合体攻撃メンバーが使用可能かチェック
  1624.     for skill_id in union_skills
  1625.       for actor in $game_party.members
  1626.         if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
  1627.           partners.push(actor)
  1628.         end
  1629.       end
  1630.     end
  1631.     return false if partners.size != union_skills.size
  1632.     return true
  1633.   end
  1634. end  
  1635. #==============================================================================
  1636. # ■ Game_Party
  1637. #------------------------------------------------------------------------------
  1638. #  パーティを扱うクラスです。
  1639. #==============================================================================
  1640. class Game_Party < Game_Unit
  1641.   #--------------------------------------------------------------------------
  1642.   # ● 公開インスタンス変数
  1643.   #--------------------------------------------------------------------------
  1644.   attr_accessor   :atb_custom                       # ATBユーザー設定
  1645.   attr_accessor   :atb_control                      # ATB設定
  1646.   #--------------------------------------------------------------------------
  1647.   # ● オブジェクト初期化
  1648.   #--------------------------------------------------------------------------
  1649.   alias initialize_n02 initialize
  1650.   def initialize
  1651.     initialize_n02
  1652.     @atb_control = []
  1653.     @atb_custom = [N02::ATB_NEWGAME_MODE, N02::ATB_NEWGAME_SPEED - 1]
  1654.   end
  1655.   #--------------------------------------------------------------------------
  1656.   # ● ユーザー設定をATB設定に反映
  1657.   #--------------------------------------------------------------------------
  1658.   def atb_customize
  1659.     # ウエイト・アクティブ設定を格納
  1660.     case @atb_custom[0]
  1661.     when 0;@atb_control[0] = N02::ATB_MODE1
  1662.     when 1;@atb_control[0] = N02::ATB_MODE2
  1663.     when 2;@atb_control[0] = N02::ATB_MODE3
  1664.     end
  1665.     # 戦闘速度を格納
  1666.     @atb_control[1] = N02::ATB_SPEED_MODE[@atb_custom[1]]
  1667.     # ユーザー設定を使わない場合
  1668.     return if N02::ATB_CUSTOMIZE
  1669.     @atb_control[0] = ["",N02::ATB_PARTY_COMMAND_WAIT, N02::ATB_COMMAND_WAIT, N02::ATB_TARGET_WAIT, N02::ATB_SELECT_WAIT, N02::ATB_ACTION_WAIT]
  1670.     @atb_control[1] = N02::ATB_SPEED
  1671.   end
  1672. end
  1673. #==============================================================================
  1674. # ■ Sprite_MoveAnime
  1675. #------------------------------------------------------------------------------
  1676. #  ATBゲージ用のスプライトです。
  1677. #==============================================================================
  1678. class Sprite_ATB < Sprite_Base
  1679.   #--------------------------------------------------------------------------
  1680.   # ● 公開インスタンス変数
  1681.   #--------------------------------------------------------------------------
  1682.   attr_accessor :battler
  1683.   attr_accessor :count            # 更新カウント
  1684.   #--------------------------------------------------------------------------
  1685.   # ● オブジェクト初期化
  1686.   #--------------------------------------------------------------------------
  1687.   def initialize(viewport,battler = nil)
  1688.     super(viewport)
  1689.     @battler = battler
  1690.     @count = 0
  1691.     @base_atb_count = 1
  1692.     @restriction_count = 0
  1693.     @state_freeze = false
  1694.     @update = 0
  1695.     @pre_width = 0
  1696.     make_gauge
  1697.     start_atb
  1698.     @party_command_wait = $game_party.atb_control[0][1]
  1699.     @command_wait = $game_party.atb_control[0][2]
  1700.     @target_wait = $game_party.atb_control[0][3]
  1701.     @select_wait = $game_party.atb_control[0][4]
  1702.     @action_wait = $game_party.atb_control[0][5]
  1703.   end
  1704.   #--------------------------------------------------------------------------
  1705.   # ● ATB初期値セッティング
  1706.   #--------------------------------------------------------------------------
  1707.   def start_atb
  1708.     atb = battler.atb_base * 10 + rand(N02::ATB_BASE_ADD) * 10
  1709.     if battler.actor?
  1710.       atb1 = battler.weapons[0].atb_base * 10 if battler.weapons[0] != nil
  1711.       atb2 = battler.weapons[1].atb_base * 10 if battler.weapons[1] != nil
  1712.       atb1 = atb if atb1 == nil
  1713.       atb2 = atb1 if atb2 == nil
  1714.       atb += (atb1 + atb2) / 2
  1715.       for i in 0...battler.armors.size
  1716.         # 二刀はキャンセル
  1717.         next if battler.two_swords_style && battler.armors[0] != nil && battler.armors[0]
  1718.         atb += battler.armors[i].atb_base * 10 if battler.armors[i] != nil
  1719.       end  
  1720.     end
  1721.     change_atb(atb)
  1722.   end
  1723.   #--------------------------------------------------------------------------
  1724.   # ● ゲージ作成
  1725.   #--------------------------------------------------------------------------
  1726.   def make_gauge
  1727.     self.bitmap = Cache.system("atb_bar_skin")
  1728.     @gauge = Sprite.new(viewport)
  1729.     @gauge.bitmap = Cache.system("atb_bar")
  1730.     @gauge_max = Sprite.new(viewport)
  1731.     @gauge_max.bitmap = Cache.system("atb_bar_active")
  1732.     @gauge_max.visible = false
  1733.     @gauge_division = 1000 / N02::ATB_WIDTH
  1734.     @gauge_space = N02::ATB_SPACE
  1735.   end
  1736.   #--------------------------------------------------------------------------
  1737.   # ● 座標セット
  1738.   #--------------------------------------------------------------------------
  1739.   def set(x, y)
  1740.     self.ox = @gauge.ox = @gauge_max.ox = self.bitmap.width / 2
  1741.     self.oy = @gauge.oy = @gauge_max.oy = self.bitmap.height / 2
  1742.     self.visible = @gauge.visible = @gauge_max.visible = false
  1743.     if @battler.actor? && N02::ATB_POSITION_HPWINDOW
  1744.       self.z = @gauge.z = @gauge_max.z = 1000
  1745.       self.x = @gauge.x = @gauge_max.x = N02::ATB_PARTY_POSITION[@battler.index][0]
  1746.       self.y = @gauge.y = @gauge_max.y = N02::ATB_PARTY_POSITION[@battler.index][1]
  1747.       return
  1748.     end
  1749.     adjust = N02::ATB_POSITION_ENEMY
  1750.     adjust = N02::ATB_POSITION_ACTOR if battler.actor?
  1751.     self.x = @gauge.x = @gauge_max.x = x + adjust[0]
  1752.     self.x = @gauge.x = @gauge_max.x = x - adjust[0] if $back_attack
  1753.     self.y = @gauge.y = @gauge_max.y = y + adjust[1]
  1754.     self.z = @gauge.z = @gauge_max.z = battler.position_z + 10
  1755.     @gauge_max.z += 1
  1756.   end
  1757.   #--------------------------------------------------------------------------
  1758.   # ● ATBゲージ切り替え
  1759.   #--------------------------------------------------------------------------
  1760.   def change_atb(restart_gauge = 0)
  1761.     @battler.atb_base_speed_refresh
  1762.     case N02::ATB_BASE_SPEED
  1763.     when 0
  1764.       return @base_atb_count = @battler.at_speed * battler.agi if N02::ATB_ABSOLUTE_SPEED == 0
  1765.       @base_atb_count = @battler.at_speed * battler.agi / N02::ATB_ABSOLUTE_SPEED
  1766.     when 1
  1767.       return @base_atb_count = @battler.at_speed * battler.agi if @battler.speed_level == 0
  1768.       @base_atb_count = @battler.at_speed * battler.agi / @battler.speed_level
  1769.     when 2
  1770.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
  1771.       @base_atb_count = @battler.at_speed * @battler.agi / @battler.low_speed_level
  1772.     when 3
  1773.       return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1774.       @base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1775.     end
  1776.     @base_atb_count = 1 if @base_atb_count == 0
  1777.     @battler.at_count = restart_gauge
  1778.     @battler.act_count = 0
  1779.     @gauge.bitmap = Cache.system("atb_bar")
  1780.     @battler.act_active = false
  1781.     @battler.at_active = false
  1782.     @battler.atb_count_up = true
  1783.   end
  1784.   #--------------------------------------------------------------------------
  1785.   # ● ACTゲージ切り替え
  1786.   #--------------------------------------------------------------------------
  1787.   def change_act(act_type)
  1788.     change_atb
  1789.     case act_type[0]
  1790.     when 0
  1791.       base = @battler.at_speed * @battler.agi
  1792.       base = @battler.at_speed * @battler.agi / act_type[2] if act_type[2] != 0
  1793.     when 1
  1794.       base = @battler.at_speed * @battler.agi / @battler.speed_level
  1795.     when 2
  1796.       base = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
  1797.       base = @battler.at_speed * @battler.agi / @battler.low_speed_level
  1798.     when 3
  1799.       base = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
  1800.       base = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
  1801.     when 4
  1802.       base = @battler.at_speed
  1803.     end
  1804.     if act_type[1] <= 0
  1805.       @base_act_count = 1000
  1806.     else
  1807.       @base_act_count = base *  100 / act_type[1]
  1808.     end
  1809.     @base_act_count = 1 if @base_act_count == 0
  1810.     @battler.act_count = 0
  1811.     @gauge.bitmap = Cache.system("act_bar")
  1812.     @battler.atb_count_up = false
  1813.     @battler.at_active = false
  1814.   end
  1815.   #--------------------------------------------------------------------------
  1816.   # ● フレーム更新
  1817.   #--------------------------------------------------------------------------
  1818.   def update
  1819.     # ステート管理
  1820.     states_control
  1821.     # 強制ゲージストップ
  1822.     return if $gauge_stop or !@battler.exist? or $game_message.visible
  1823.     # アクションウエイト
  1824.     wait = true if $in_action && !@action_wait
  1825.     wait = false if $in_action && @action_wait
  1826.     # パーティコマンド選択中ウエイト
  1827.     wait = true if $in_party_command && !@party_command_wait
  1828.     wait = false if $in_party_command && @party_command_wait
  1829.     # 戦闘コマンド選択中ウエイト
  1830.     wait = true if $in_command && !@command_wait
  1831.     wait = false if $in_command && @command_wait
  1832.     # ターゲット選択中ウエイト
  1833.     wait = true if $in_target && !@target_wait
  1834.     wait = false if $in_target && @target_wait
  1835.     # スキル/アイテム選択中ウエイト
  1836.     wait = true if $in_select && !@select_wait
  1837.     wait = false if $in_select && @select_wait
  1838.     # アクション中はゲージを消すか
  1839.     self.visible = @gauge.visible = true
  1840.     self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ENEMY_OFF && !@battler.actor? && @battler.union_skill_id == 0
  1841.     self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ACTOR_OFF && @battler.actor? && @battler.union_skill_id == 0
  1842.     # ゲージ表示設定
  1843.     self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.atb_on
  1844.     self.visible = @gauge.visible = @gauge_max.visible = false if @battler.actor? && $game_message.visible && N02::ATB_POSITION_HPWINDOW
  1845.     # 見えないエネミーはゲージ隠蔽
  1846.     self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.actor? && !@battler.exist?
  1847.     # ボタン入力によるゲージ制御
  1848.     wait = true if Input.press?(Input::ALT) && N02::ATB_ALT_WAIT
  1849.     wait = false if Input.press?(Input::CTRL) && N02::ATB_CTRL_ACTIVE
  1850.     # 自身のみアクションウエイト
  1851.     wait = true if @battler.act_active
  1852.     # ゲージウエイト
  1853.     return if wait
  1854.     # ステートによるゲージストップ処理
  1855.     return recover_states_freeze if @state_freeze
  1856.     # ゲージカウントアップ
  1857.     gauge_update
  1858.     # ゲージ描画
  1859.     return if @pre_width == @gauge_space + @battler.act_count / @gauge_division && !@battler.atb_count_up
  1860.     return if @pre_width == @gauge_space + @battler.at_count / @gauge_division && @battler.atb_count_up
  1861.     gauge_refresh
  1862.   end
  1863.   #--------------------------------------------------------------------------
  1864.   # ● ゲージカウントアップ
  1865.   #--------------------------------------------------------------------------
  1866.   def gauge_update
  1867.     # ACTカウントアップ
  1868.     act if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
  1869.     # ATBカウントアップ
  1870.     atb if @battler.atb_count_up
  1871.   end
  1872.   #--------------------------------------------------------------------------
  1873.   # ● ゲージリフレッシュ
  1874.   #--------------------------------------------------------------------------
  1875.   def gauge_refresh
  1876.     @gauge_max.visible = false if !@battler.act_active && !@battler.at_active
  1877.     @gauge.src_rect.width = @pre_width = @gauge_space + @battler.act_count / @gauge_division if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
  1878.     @gauge.src_rect.width = @pre_width = @gauge_space + @battler.at_count / @gauge_division if @battler.atb_count_up
  1879.   end
  1880.   #--------------------------------------------------------------------------
  1881.   # ● ゲージ隠蔽
  1882.   #--------------------------------------------------------------------------
  1883.   def off
  1884.     self.visible = @gauge.visible = @gauge_max.visible = false
  1885.   end
  1886.   #--------------------------------------------------------------------------
  1887.   # ● ゲージ表示
  1888.   #--------------------------------------------------------------------------
  1889.   def on
  1890.     self.visible = @gauge.visible = @gauge_max.visible = true
  1891.     gauge_refresh
  1892.   end
  1893.   #--------------------------------------------------------------------------
  1894.   # ● ステート管理
  1895.   #--------------------------------------------------------------------------
  1896.   def states_control
  1897.     # 1.1f, line priority shift
  1898.     self.visible = @gauge_max.visible = @gauge.visible = false if !@battler.actor? && !@battler.exist?
  1899.     if !@state_freeze && !@battler.movable?
  1900.       # 行動不能はゲージを0に
  1901.       @restriction_count = @battler.at_count
  1902.       @state_freeze = true
  1903.       @atb_dead = true if @battler.dead? && !@atb_dead
  1904.       change_atb(0)
  1905.       gauge_refresh
  1906.     # ステート復帰時
  1907.     elsif @battler.movable? && @state_freeze
  1908.       @state_freeze = false
  1909.       # 戦闘不能復帰時のゲージ処理
  1910.       return if !@atb_dead
  1911.       change_atb(N02::ATB_DEAD_COUNT * 10)
  1912.       @atb_dead = false
  1913.       gauge_refresh
  1914.     end
  1915.   end
  1916.   #--------------------------------------------------------------------------
  1917.   # ● ステートによるゲージストップ回復
  1918.   #--------------------------------------------------------------------------
  1919.   def recover_states_freeze
  1920.     @restriction_count += @base_atb_count
  1921.     @restriction_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1922.     if @restriction_count >= 1000
  1923.       # ステート自然回復許可
  1924.       @battler.remove_states_auto
  1925.       @restriction_count = 0
  1926.     end
  1927.   end
  1928.   #--------------------------------------------------------------------------
  1929.   # ● ATBカウント
  1930.   #--------------------------------------------------------------------------
  1931.   def atb
  1932.     if @battler.at_count <= 1000
  1933.       @gauge_max.visible = false
  1934.       @battler.at_count += @base_atb_count
  1935.       @battler.at_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1936.     end
  1937.     # ATBゲージMAX
  1938.     if @battler.at_count >= 1000
  1939.       # ステート自然回復
  1940.       @battler.remove_states_auto
  1941.       @battler.atb_count_up = false
  1942.       @battler.at_active = true
  1943.       @gauge.src_rect.width = 52
  1944.       return if !@battler.atb_on
  1945.       Audio.se_play("Audio/SE/" + N02::ATB_MAX_SOUND01[2], N02::ATB_MAX_SOUND01[1],  N02::ATB_MAX_SOUND01[0])
  1946.       @gauge_max.visible = true
  1947.     end
  1948.     @battler.act_active = false
  1949.   end  
  1950.   #--------------------------------------------------------------------------
  1951.   # ● ACTカウント
  1952.   #--------------------------------------------------------------------------
  1953.   def act
  1954.     if @battler.act_count <= 1000
  1955.       @gauge_max.visible = false
  1956.       @battler.act_count += @base_act_count
  1957.       @battler.at_count += @base_atb_count * 3 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
  1958.     end
  1959.     # ACTゲージMAX
  1960.     if @battler.act_count >= 1000 && !@battler.act_active
  1961.       @battler.act_active = true
  1962.       @gauge.src_rect.width = 52
  1963.       return if !@battler.atb_on
  1964.       Audio.se_play("Audio/SE/" + N02::ACT_MAX_SOUND01[2], N02::ACT_MAX_SOUND01[1],  N02::ACT_MAX_SOUND01[0])
  1965.       @gauge_max.visible = true
  1966.     end
  1967.   end  
  1968.   #--------------------------------------------------------------------------
  1969.   # ● 解放
  1970.   #--------------------------------------------------------------------------
  1971.   def dispose
  1972.     super
  1973.     @gauge.dispose
  1974.     @gauge_max.dispose
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # ● Refill - puts ATB gauge back to max and prepare for command input
  1978.   # New method 1.1h
  1979.   #--------------------------------------------------------------------------
  1980.   def refill
  1981.     @battler.act_active = false
  1982.     @battler.at_active = false
  1983.     @battler.act_count = 0
  1984.     @battler.at_count = 1000
  1985.     @battler.atb_count_up = true
  1986.     @gauge.bitmap = Cache.system("atb_bar")
  1987.   end
  1988. end
  1989. #==============================================================================
  1990. # ■ Sprite_Cursor
  1991. #------------------------------------------------------------------------------
  1992. #  カーソルのスプライトです。
  1993. #==============================================================================
  1994. class Sprite_Cursor < Sprite_Base
  1995.   #--------------------------------------------------------------------------
  1996.   # ● オブジェクト初期化
  1997.   #--------------------------------------------------------------------------
  1998.   def initialize
  1999.     super
  2000.     create_target_cursor
  2001.   end
  2002.   #--------------------------------------------------------------------------
  2003.   # ● ターゲットカーソルスプライトの作成
  2004.   #--------------------------------------------------------------------------
  2005.   def create_target_cursor
  2006.     self.bitmap = Cache.system("cursor")
  2007.     @width = self.bitmap.width
  2008.     @height = self.bitmap.height / 3
  2009.     self.src_rect.set(0, 0, @width, @height)
  2010.     @cursor_flame = 0
  2011.     self.x = @pre_x = 272
  2012.     self.y = @pre_y = 208
  2013.     self.z = 300
  2014.     self.ox = @width
  2015.     self.oy = @height
  2016.     self.visible = false
  2017.     @time = 0
  2018.     @flash_time = 0
  2019.   end
  2020.   #--------------------------------------------------------------------------
  2021.   # ● フレーム更新
  2022.   #--------------------------------------------------------------------------
  2023.   def update
  2024.     # カーソル画像更新
  2025.     @cursor_flame = 0 if @cursor_flame == 40
  2026.     self.src_rect.set(0,           0, @width, @height) if @cursor_flame == 0
  2027.     self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 10
  2028.     self.src_rect.set(0, 2 * @height, @width, @height) if @cursor_flame == 20
  2029.     self.src_rect.set(0,     @height, @width, @height) if @cursor_flame == 30
  2030.     @cursor_flame += 1
  2031.     # カーソル座標更新
  2032.     return if @battler == nil
  2033.     # ターゲットを光らせる
  2034.     @flash_time -= 1
  2035.     if @flash_time == 0 && @battler.exist? && !@battler.collapse
  2036.       @battler.white_flash = true
  2037.       @flash_time = 20
  2038.     end
  2039.     if @time == 0
  2040.       self.x = @battler.position_x + N01::CURSOR_X_PLUS
  2041.       return self.y = (@battler.position_y + N01::CURSOR_Y_PLUS) - @battler.graphics_width / 5
  2042.     end  
  2043.     @time -= 1
  2044.     self.x = @pre_x + (@battler.position_x + N01::CURSOR_X_PLUS - @pre_x) * (9 - @time) / 9
  2045.     self.y = @pre_y + (@battler.position_y + N01::CURSOR_Y_PLUS - @battler.graphics_width / 5 - @pre_y) * (9 - @time) / 9
  2046.   end
  2047.   #--------------------------------------------------------------------------
  2048.   # ● カーソル移動情報セット
  2049.   #--------------------------------------------------------------------------
  2050.   def set(battler)
  2051.     self.visible = true
  2052.     @battler = battler
  2053.     return if @battler == nil
  2054.     @battler.white_flash = true if @battler.exist? && !@battler.collapse
  2055.     @time = 9
  2056.     @flash_time = 20
  2057.     @pre_x = self.x
  2058.     @pre_y = self.y
  2059.   end
  2060. end
  2061. #==============================================================================
  2062. # ■ Sprite_Battler
  2063. #------------------------------------------------------------------------------
  2064. #  バトラー表示用のスプライトです。
  2065. #==============================================================================
  2066. class Sprite_Battler < Sprite_Base
  2067.   #--------------------------------------------------------------------------
  2068.   # ● バトラー作成
  2069.   #--------------------------------------------------------------------------
  2070.   alias make_battler_n01 make_battler
  2071.   def make_battler
  2072.     make_battler_n01
  2073.  
  2074.     make_atb
  2075.   end  
  2076.   #--------------------------------------------------------------------------
  2077.   # ● 解放
  2078.   #--------------------------------------------------------------------------
  2079.   alias dispose_n01 dispose
  2080.   def dispose
  2081.     dispose_n01
  2082.     @atb_gauge.dispose if @atb_gauge != nil
  2083.   end  
  2084.   #--------------------------------------------------------------------------
  2085.   # ● Set Stand By Action
  2086.   #--------------------------------------------------------------------------
  2087.   alias stand_by_n02 stand_by
  2088.   def stand_by
  2089.     # Set battler charge animation (ATB)
  2090.     @battler.charge_start = false if @battler.charge_start && !@battler.exist?
  2091.     return @repeat_action = @battler.charge_action if @battler.charge_start
  2092.     stand_by_n02
  2093.   end
  2094.   #--------------------------------------------------------------------------
  2095.   # ● ATBゲージ作成
  2096.   #--------------------------------------------------------------------------
  2097.   def make_atb
  2098.     return if battler == nil
  2099.     battler.atb_setting
  2100.     if battler.actor? && N02::ATB_POSITION_HPWINDOW
  2101.       @atb_gauge = Sprite_ATB.new(@viewport2,battler)
  2102.     else
  2103.       @atb_gauge = Sprite_ATB.new(viewport,battler)
  2104.     end
  2105.     @atb_gauge.set(self.x, self.y)
  2106.   end  
  2107.   #--------------------------------------------------------------------------
  2108.   # ● ATBゲージビューポート作成
  2109.   #--------------------------------------------------------------------------
  2110.   def make_atb_viewport(new_viewport)
  2111.     @viewport2 = new_viewport
  2112.   end  
  2113.   #--------------------------------------------------------------------------
  2114.   # ● フレーム更新
  2115.   #--------------------------------------------------------------------------
  2116.   alias update_n01 update
  2117.   def update
  2118.     update_n01
  2119.     # ATB更新
  2120.     @atb_gauge.update if @atb_gauge != nil
  2121.   end
  2122.   #--------------------------------------------------------------------------
  2123.   # ● ゲージ更新
  2124.   #--------------------------------------------------------------------------
  2125.   def gauge_update
  2126.     @atb_gauge.gauge_update if @atb_gauge != nil
  2127.   end
  2128.   #--------------------------------------------------------------------------
  2129.   # ● ゲージリフレッシュ
  2130.   #--------------------------------------------------------------------------
  2131.   def gauge_refresh
  2132.     @atb_gauge.gauge_refresh if @atb_gauge != nil
  2133.   end
  2134.   #--------------------------------------------------------------------------
  2135.   # ● ゲージ表示
  2136.   #--------------------------------------------------------------------------
  2137.   def gauge_on
  2138.     @atb_gauge.on if @atb_gauge != nil
  2139.   end
  2140.   #--------------------------------------------------------------------------
  2141.   # ● ゲージ隠蔽
  2142.   #--------------------------------------------------------------------------
  2143.   def gauge_off
  2144.     @atb_gauge.off if @atb_gauge != nil
  2145.   end
  2146.   #--------------------------------------------------------------------------
  2147.   # ● ATBゲージ切り替え
  2148.   #--------------------------------------------------------------------------
  2149.   def change_atb(restart_gauge)
  2150.     @atb_gauge.change_atb(restart_gauge) if @atb_gauge != nil
  2151.   end
  2152.   #--------------------------------------------------------------------------
  2153.   # ● ACTゲージ切り替え
  2154.   #--------------------------------------------------------------------------
  2155.   def change_act(act_type)
  2156.     @atb_gauge.change_act(act_type) if @atb_gauge != nil
  2157.   end
  2158.   #--------------------------------------------------------------------------
  2159.   # ● ATBゲージ開放
  2160.   #--------------------------------------------------------------------------
  2161.   def atb_dispose
  2162.     @atb_gauge.dispose if @atb_gauge != nil
  2163.     @atb_gauge = nil
  2164.   end
  2165.   #--------------------------------------------------------------------------
  2166.   # ● Gauge Refill - new method 1.1h
  2167.   #--------------------------------------------------------------------------
  2168.   def gauge_refill
  2169.     @atb_gauge.refill
  2170.   end
  2171. end
  2172. #==============================================================================
  2173. # ■ Spriteset_Battle
  2174. #------------------------------------------------------------------------------
  2175. #  バトル画面のスプライトをまとめたクラスです。
  2176. #==============================================================================
  2177. class Spriteset_Battle
  2178.   #--------------------------------------------------------------------------
  2179.   # ● アクタースプライトの作成
  2180.   #--------------------------------------------------------------------------
  2181.   alias create_actors_n01 create_actors
  2182.   def create_actors
  2183.     create_actors_n01
  2184.     if N02::ATB_POSITION_HPWINDOW
  2185.       for sprites in @actor_sprites + @enemy_sprites
  2186.         sprites.make_atb_viewport(@viewport4)
  2187.       end
  2188.     end  
  2189.   end
  2190.   #--------------------------------------------------------------------------
  2191.   # ● ターゲット情報リフレッシュ
  2192.   #--------------------------------------------------------------------------
  2193.   def update_target(actor, index)
  2194.     @actor_sprites[index].update_target if actor
  2195.     @enemy_sprites[index].update_target unless actor
  2196.   end
  2197.   #--------------------------------------------------------------------------
  2198.   # ● ゲージ更新
  2199.   #--------------------------------------------------------------------------
  2200.   def gauge_update
  2201.     for sprites in @actor_sprites + @enemy_sprites
  2202.       sprites.gauge_update if sprites != nil
  2203.     end
  2204.   end
  2205.   #--------------------------------------------------------------------------
  2206.   # ● ゲージリフレッシュ
  2207.   #--------------------------------------------------------------------------
  2208.   def gauge_refresh(actor, index)
  2209.     @actor_sprites[index].gauge_refresh if actor
  2210.     @enemy_sprites[index].gauge_refresh unless actor
  2211.   end
  2212.   #--------------------------------------------------------------------------
  2213.   # ● ゲージ表示
  2214.   #--------------------------------------------------------------------------
  2215.   def gauge_on
  2216.     for sprites in @actor_sprites + @enemy_sprites
  2217.       sprites.gauge_on if sprites != nil
  2218.     end
  2219.   end
  2220.   #--------------------------------------------------------------------------
  2221.   # ● ゲージ隠蔽
  2222.   #--------------------------------------------------------------------------
  2223.   def gauge_off
  2224.     for sprites in @actor_sprites + @enemy_sprites
  2225.       sprites.gauge_off if sprites != nil
  2226.     end
  2227.   end
  2228.   #--------------------------------------------------------------------------
  2229.   # ● ATBゲージ切り替え
  2230.   #--------------------------------------------------------------------------
  2231.   def change_atb(restart_gauge, actor, index)
  2232.     @actor_sprites[index].change_atb(restart_gauge) if actor
  2233.     @enemy_sprites[index].change_atb(restart_gauge) unless actor
  2234.   end
  2235.   #--------------------------------------------------------------------------
  2236.   # ● ACTゲージ切り替え
  2237.   #--------------------------------------------------------------------------
  2238.   def change_act(act_type, actor, index)
  2239.     @actor_sprites[index].change_act(act_type) if actor
  2240.     @enemy_sprites[index].change_act(act_type) unless actor
  2241.   end
  2242.   #--------------------------------------------------------------------------
  2243.   # ● ATBゲージ一斉開放
  2244.   #--------------------------------------------------------------------------
  2245.   def atb_dispose
  2246.     for sprites in @actor_sprites + @enemy_sprites
  2247.       sprites.atb_dispose if sprites != nil
  2248.     end
  2249.   end
  2250.   #--------------------------------------------------------------------------
  2251.   # ● Gauge Refill - new method 1.1h
  2252.   #--------------------------------------------------------------------------
  2253.   def gauge_refill(actor, index)
  2254.     @actor_sprites[index].gauge_refill if actor
  2255.     @enemy_sprites[index].gauge_refill unless actor
  2256.   end
  2257. end
  2258. #==============================================================================
  2259. # ■ Window_Skill
  2260. #------------------------------------------------------------------------------
  2261. #  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
  2262. #==============================================================================
  2263. class Window_Skill < Window_Selectable
  2264.   #--------------------------------------------------------------------------
  2265.   # ● 項目の描画  ※再定義
  2266.   #--------------------------------------------------------------------------
  2267.   def draw_item(index)
  2268.     rect = item_rect(index)
  2269.     self.contents.clear_rect(rect)
  2270.     skill = @data[index]
  2271.     if skill != nil
  2272.       rect.width -= 4
  2273.       enabled = @actor.skill_can_use?(skill)
  2274.       enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
  2275.       draw_item_name(skill, rect.x, rect.y, enabled)
  2276.       self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
  2277.     end
  2278.   end
  2279. end  
  2280.  
  2281. #==============================================================================
  2282. # ■ Window_BattleStatus
  2283. #------------------------------------------------------------------------------
  2284. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  2285. #==============================================================================
  2286. class Window_BattleStatus < Window_Selectable
  2287.   #--------------------------------------------------------------------------
  2288.   # ● カーソルを下に移動  ※再定義
  2289.   #--------------------------------------------------------------------------
  2290.   def cursor_down(wrap = false)
  2291.   end
  2292.   #--------------------------------------------------------------------------
  2293.   # ● カーソルを上に移動  ※再定義
  2294.   #--------------------------------------------------------------------------
  2295.   def cursor_up(wrap = false)
  2296.   end
  2297.   #--------------------------------------------------------------------------
  2298.   # ● フレーム更新  ※再定義
  2299.   #--------------------------------------------------------------------------
  2300.   def update
  2301.     super
  2302.     update_cursor
  2303.     call_update_help
  2304.   end
  2305. end
  2306. #==============================================================================
  2307. # ■ Window_PartyCommand2
  2308. #------------------------------------------------------------------------------
  2309. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  2310. #==============================================================================
  2311. class Window_PartyCommand2 < Window_Selectable
  2312.   #--------------------------------------------------------------------------
  2313.   # ● オブジェクト初期化
  2314.   #--------------------------------------------------------------------------
  2315.   def initialize
  2316.     super(0, 234, 544, 56)
  2317.     @item_max = 2
  2318.     @column_max = 2
  2319.     self.contents.draw_text(32, 0, 96, WLH, "#{Vocab.fight}", 2) # 1.1b
  2320.     self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if $game_troop.can_escape # 1.1b
  2321.     self.contents.font.color.alpha = 128
  2322.     self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if !$game_troop.can_escape # 1.1b
  2323.     self.active = false
  2324.   end
  2325. end
  2326.  
  2327. #==============================================================================
  2328. # ■ Window_MenuATB
  2329. #------------------------------------------------------------------------------
  2330. #  メニュー画面でATB設定を表示するウィンドウです。
  2331. #==============================================================================
  2332. class Window_ATB_active < Window_Selectable
  2333.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2334.   ATB_MODE_NAME = N02::ATB_MODE_NAME
  2335.   ATB_MODE1 = N02::ATB_MODE1[0]
  2336.   ATB_MODE2 = N02::ATB_MODE2[0]
  2337.   ATB_MODE3 = N02::ATB_MODE3[0]
  2338.   #--------------------------------------------------------------------------
  2339.   # ● オブジェクト初期化
  2340.   #--------------------------------------------------------------------------
  2341.   def initialize
  2342.     super(0, 174, 544, 56)
  2343.     @item_max = 3
  2344.     @column_max = 3
  2345.     set_active
  2346.     self.active = true
  2347.     self.index = $game_party.atb_custom[0]
  2348.   end
  2349.   #--------------------------------------------------------------------------
  2350.   # ● アクティブ化
  2351.   #--------------------------------------------------------------------------
  2352.   def set_active
  2353.     self.contents.clear
  2354.     self.contents.font.size = 15
  2355.     self.contents.font.color = crisis_color
  2356.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
  2357.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0) # edited
  2358.     self.contents.font.size = 20
  2359.     self.contents.font.color = normal_color
  2360.     refresh
  2361.   end  
  2362.   #--------------------------------------------------------------------------
  2363.   # ● アクティブ解除
  2364.   #--------------------------------------------------------------------------
  2365.   def non_active
  2366.     self.contents.clear
  2367.     self.contents.font.size = 15
  2368.     self.contents.font.color = system_color
  2369.     self.contents.draw_text(  0, 0, 100, WLH, ATB_MODE_NAME, 0)
  2370.     self.contents.font.size = 20
  2371.     self.contents.font.color = normal_color
  2372.     refresh
  2373.   end  
  2374.   #--------------------------------------------------------------------------
  2375.   # ● 項目を描画する矩形の取得
  2376.   #--------------------------------------------------------------------------
  2377.   def refresh
  2378.     case $game_party.atb_custom[0]
  2379.     when 0
  2380.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2381.       self.contents.font.color.alpha = 100
  2382.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2383.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2384.     when 1
  2385.       self.contents.font.color.alpha = 100
  2386.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2387.       self.contents.font.color = normal_color
  2388.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2389.       self.contents.font.color.alpha = 100
  2390.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2391.     when 2
  2392.       self.contents.font.color.alpha = 100
  2393.       self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
  2394.       self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
  2395.       self.contents.font.color = normal_color
  2396.       self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
  2397.     end
  2398.   end
  2399.   #--------------------------------------------------------------------------
  2400.   # ● 項目を描画する矩形の取得
  2401.   #--------------------------------------------------------------------------
  2402.   def item_rect(index)
  2403.     rect = Rect.new(0, 0, 0, 0)
  2404.     rect.width = 140
  2405.     rect.height = 24
  2406.     rect.x = index % @column_max * rect.width + 100
  2407.     rect.y = index / @column_max * WLH
  2408.     return rect
  2409.   end
  2410. end  
  2411. #==============================================================================
  2412. # ■ Window_MenuATB
  2413. #------------------------------------------------------------------------------
  2414. #  メニュー画面でATB設定を表示するウィンドウです。
  2415. #==============================================================================
  2416. class Window_ATB_speed < Window_Selectable
  2417.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2418.   ATB_MODE_NAME = N02::ATB_SPEED_NAME
  2419.   #--------------------------------------------------------------------------
  2420.   # ● オブジェクト初期化
  2421.   #--------------------------------------------------------------------------
  2422.   def initialize
  2423.     super(0, 230, 544, 56)
  2424.     @item_max = 9
  2425.     @column_max = 9
  2426.     non_active
  2427.     self.active = false
  2428.     self.index = -1
  2429.   end
  2430.   #--------------------------------------------------------------------------
  2431.   # ● アクティブ化
  2432.   #--------------------------------------------------------------------------
  2433.   def set_active
  2434.     self.contents.clear
  2435.     self.contents.font.size = 15
  2436.     self.contents.font.color = crisis_color
  2437.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2438.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2439.     self.contents.font.size = 22
  2440.     self.contents.font.color = normal_color
  2441.     refresh
  2442.   end  
  2443.   #--------------------------------------------------------------------------
  2444.   # ● アクティブ解除
  2445.   #--------------------------------------------------------------------------
  2446.   def non_active
  2447.     self.contents.clear
  2448.     self.contents.font.size = 15
  2449.     self.contents.font.color = system_color
  2450.     self.contents.draw_text(  0, 0, 140, WLH, ATB_MODE_NAME, 0)
  2451.     self.contents.font.size = 22
  2452.     self.contents.font.color = normal_color
  2453.     refresh
  2454.   end  
  2455.   #--------------------------------------------------------------------------
  2456.   # ● 項目を描画する矩形の取得 edited
  2457.   #   3.4a turned contents into a loop rather than a repeated list
  2458.   #--------------------------------------------------------------------------
  2459.   def refresh
  2460.     self.contents.font.color.alpha = 96
  2461.     for i in 0..8
  2462.       self.contents.draw_text(94 + 38 * i, 0, 140, WLH, (i + 1).to_s, 1)
  2463.     end
  2464.     self.contents.font.color.alpha = 256
  2465.     for i in 0..8
  2466.       case $game_party.atb_custom[1]
  2467.         when i;self.contents.draw_text(94 + 38 * i, 0, 140, WLH, (i + 1).to_s, 1)
  2468.       end
  2469.     end
  2470.   end
  2471.   #--------------------------------------------------------------------------
  2472.   # ● 項目を描画する矩形の取得
  2473.   #--------------------------------------------------------------------------
  2474.   def item_rect(index)
  2475.     rect = Rect.new(0, 0, 0, 0)
  2476.     rect.width = 38
  2477.     rect.height = 24
  2478.     rect.x = index % @column_max * rect.width + 145
  2479.     rect.y = index / @column_max * WLH
  2480.     return rect
  2481.   end
  2482. end  
  2483. #==============================================================================
  2484. # ■ Window_ATB_Help
  2485. #------------------------------------------------------------------------------
  2486. #  ATB設定の説明を表示するウィンドウです。
  2487. #==============================================================================
  2488. class Window_ATB_Help < Window_Base
  2489.   # アクティブタイムバトルのカスタマイズ項目からのテキスト
  2490.   ATB_MODE_NAME = N02::ATB_MODE_NAME
  2491.   ATB_MODE1 = N02::ATB_MODE1[0]
  2492.   ATB_MODE2 = N02::ATB_MODE2[0]
  2493.   ATB_MODE3 = N02::ATB_MODE3[0]
  2494.   ATB_MODE1_HELP = N02::ATB_MODE1_HELP
  2495.   ATB_MODE2_HELP = N02::ATB_MODE2_HELP
  2496.   ATB_MODE3_HELP = N02::ATB_MODE3_HELP
  2497.   ATB_SPEED_NAME = N02::ATB_SPEED_NAME
  2498.   ATB_SPEED_HELP = N02::ATB_SPEED_HELP
  2499.   #--------------------------------------------------------------------------
  2500.   # ● オブジェクト初期化
  2501.   #--------------------------------------------------------------------------
  2502.   def initialize
  2503.     super(0, 56, 544, 96)
  2504.   end
  2505.   #--------------------------------------------------------------------------
  2506.   # ● テキスト設定
  2507.   #--------------------------------------------------------------------------
  2508.   def set_text_active(index)
  2509.     text1 = ATB_MODE_NAME + "  ["
  2510.     case index
  2511.     when 0
  2512.       text1 += ATB_MODE1 + "]"
  2513.       text2 = ATB_MODE1_HELP
  2514.     when 1
  2515.       text1 += ATB_MODE2 + "]"
  2516.       text2 = ATB_MODE2_HELP
  2517.     when 2
  2518.       text1 += ATB_MODE3 + "]"
  2519.       text2 = ATB_MODE3_HELP
  2520.     end
  2521.     self.contents.clear
  2522.     self.contents.font.color = crisis_color
  2523.     self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
  2524.     self.contents.font.color = normal_color
  2525.     self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  2526.   end
  2527.   #--------------------------------------------------------------------------
  2528.   # ● テキスト設定
  2529.   #--------------------------------------------------------------------------
  2530.   def set_text_speed
  2531.     text1 = ATB_SPEED_NAME
  2532.     text2 = ATB_SPEED_HELP
  2533.     self.contents.clear
  2534.     self.contents.font.color = crisis_color
  2535.     self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
  2536.     self.contents.font.color = normal_color
  2537.     self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
  2538.   end
  2539. end
  2540.  
  2541. #==============================================================================
  2542. # ■ Window_ATB_Help
  2543. #------------------------------------------------------------------------------
  2544. #  ATB設定タイトル・操作を表示するウィンドウです。
  2545. #==============================================================================
  2546. class Window_ATB_Title < Window_Base
  2547.   #--------------------------------------------------------------------------
  2548.   # ● オブジェクト初期化
  2549.   #--------------------------------------------------------------------------
  2550.   def initialize
  2551.     super(0, 0, 544, 56)
  2552.     refresh
  2553.   end
  2554.   #--------------------------------------------------------------------------
  2555.   # ● テキスト設定
  2556.   #--------------------------------------------------------------------------
  2557.   def refresh
  2558.     text1 = N02::ATB_CUSTOMIZE_NAME
  2559.     text2 = N02::ATB_CUSTOMIZE_HELP # 1.1b
  2560.     self.contents.clear
  2561.     self.contents.font.color = system_color
  2562.     self.contents.draw_text(4, 0, 96, WLH, text1, 0)
  2563.     self.contents.font.color = normal_color
  2564.     self.contents.draw_text(110, 0, 420, WLH, text2, 0)
  2565.   end
  2566. end
  2567.  
  2568. #==============================================================================
  2569. # ■ Scene_ATB
  2570. #------------------------------------------------------------------------------
  2571. #  ATB設定を行うクラスです。
  2572. #==============================================================================
  2573. class Scene_ATB < Scene_Base
  2574.   #--------------------------------------------------------------------------
  2575.   # ● 開始処理
  2576.   #--------------------------------------------------------------------------
  2577.   def start
  2578.     super
  2579.     create_menu_background
  2580.     @title_window = Window_ATB_Title.new
  2581.     @help_window = Window_ATB_Help.new
  2582.     @active_window = Window_ATB_active.new
  2583.     @speed_window = Window_ATB_speed.new
  2584.     @help_window.set_text_active(@active_window.index)
  2585.     @active_window_index = @active_window.index
  2586.     @speed_window_index = $game_party.atb_custom[1]
  2587.   end
  2588.   #--------------------------------------------------------------------------
  2589.   # ● 終了処理
  2590.   #--------------------------------------------------------------------------
  2591.   def terminate
  2592.     super
  2593.     $game_party.atb_customize
  2594.     dispose_menu_background
  2595.     @title_window.dispose
  2596.     @help_window.dispose
  2597.     @active_window.dispose
  2598.     @speed_window.dispose
  2599.   end
  2600.   #--------------------------------------------------------------------------
  2601.   # ● 元の画面へ戻る
  2602.   #--------------------------------------------------------------------------
  2603.   def return_scene
  2604.     $scene = Scene_Map.new
  2605.   end
  2606.   #--------------------------------------------------------------------------
  2607.   # ● フレーム更新
  2608.   #--------------------------------------------------------------------------
  2609.   def update
  2610.     super
  2611.     update_menu_background
  2612.     @help_window.update
  2613.     @active_window.update
  2614.     @speed_window.update
  2615.     if @active_window.active
  2616.       update_active_selection
  2617.     elsif @speed_window.active
  2618.       update_speed_selection
  2619.     end
  2620.   end
  2621.   #--------------------------------------------------------------------------
  2622.   # ● アイテム選択の更新
  2623.   #--------------------------------------------------------------------------
  2624.   def update_active_selection
  2625.     if Input.trigger?(Input::B)
  2626.       Sound.play_cancel
  2627.       return_scene
  2628.     elsif Input.trigger?(Input::C)
  2629.       Sound.play_decision
  2630.       $game_party.atb_custom[0] = @active_window.index
  2631.       @active_window.set_active
  2632.     elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  2633.       Sound.play_cursor
  2634.       @speed_window.active = true
  2635.       @speed_window.set_active
  2636.       @speed_window.index = @speed_window_index
  2637.       @active_window.active = false
  2638.       @active_window.non_active
  2639.       @active_window_index = @active_window.index
  2640.       @active_window.index = -1
  2641.       @help_window.set_text_speed
  2642.     elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
  2643.       @help_window.set_text_active(@active_window.index)
  2644.     end
  2645.   end
  2646.   #--------------------------------------------------------------------------
  2647.   # ● ターゲット選択の更新
  2648.   #--------------------------------------------------------------------------
  2649.   def update_speed_selection
  2650.     if Input.trigger?(Input::B)
  2651.       Sound.play_cancel
  2652.       return_scene
  2653.     elsif Input.trigger?(Input::C)
  2654.       Sound.play_decision
  2655.       $game_party.atb_custom[1] = @speed_window.index
  2656.       @speed_window.set_active
  2657.     elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  2658.       Sound.play_cursor
  2659.       @active_window.active = true
  2660.       @active_window.set_active
  2661.       @active_window.index = @active_window_index
  2662.       @speed_window.active = false
  2663.       @speed_window.non_active
  2664.       @speed_window_index = @speed_window.index
  2665.       @speed_window.index = -1
  2666.       @help_window.set_text_active(@active_window.index)
  2667.     end
  2668.   end
  2669. end
回复

使用道具 举报

Lv1.梦旅人

百合乡の蕾咪

梦石
0
星屑
55
在线时间
151 小时
注册时间
2011-1-12
帖子
198
2
发表于 2013-12-11 00:33:32 | 只看该作者
RUBY 代码复制
  1. #______________________________________________________________________________
  2. # * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
  3. #______________________________________________________________________________
  4.  
  5. #==============================================================================
  6. # ■ 接入包 - Access Package
  7. #------------------------------------------------------------------------------
  8. #   遵守协议:66RPG - Idiot Script Association(ISA)
  9. #   当前版本:1.0.0.0
  10. #------------------------------------------------------------------------------
  11. #   更新日记:忧雪の伤(2011.3.11)
  12. #             - 初始化
  13. #==============================================================================
  14.  
  15. #--------------------------------------------------------------------------
  16. # ● Start
  17. #--------------------------------------------------------------------------
  18.  
  19. module ISA
  20.    Use = {}
  21.    System = {}
  22.    Switch = {}
  23.    Actor = load_data("Data/Actors.rvdata")
  24. end
  25.  
  26. #--------------------------------------------------------------------------
  27. # ● 资料记录
  28. #--------------------------------------------------------------------------
  29.  
  30. module ISA
  31.    Use["接入包"] = [true, "1.0.0.0"]
  32. end
  33.  
  34. #_____________________________________________________________________________
  35. # * 此脚本归66RPG - Idiot Script Association(ISA)及坏人协会所有,谢绝任何形式转载。
  36. #-----------------------------------------------------------------------------
  37.  
  38. #==============================================================================
  39. # ■ 主角当怪物属性战斗 - Actor Change Enemy
  40. #------------------------------------------------------------------------------
  41. #   遵守协议:66RPG - Idiot Script Association(ISA)
  42. #             66RPG - 坏人协会
  43. #   初始脚本:退屈无聊
  44. #   更新优化:无
  45. #   当前版本:1.0.0.1
  46. #------------------------------------------------------------------------------
  47. #   更新日记:退屈无聊(2011.3.26)
  48. #             - 初始化
  49. #             退屈无聊(2011.3.26)
  50. #             - 修正level2计算时的BUG
  51. #             退屈无聊(2011.3.27)
  52. #             - 修正获取actor等级的BUG
  53. #==============================================================================
  54.  
  55. #--------------------------------------------------------------------------
  56. # ● 资料记录
  57. #--------------------------------------------------------------------------
  58.  
  59. module ISA
  60.    Use["主角当怪物战斗"] = [true, "1.0.0.1"]
  61.    System["主角当怪物战斗"] = {}
  62. end
  63.  
  64. #--------------------------------------------------------------------------
  65. # ● 设定部分
  66. #--------------------------------------------------------------------------
  67.  
  68. module ISA
  69.   System["主角当怪物战斗"]["难度"] = 1
  70.   System["主角当怪物战斗"]["怪物名改为角色名"] = true
  71.   System["主角当怪物战斗"]["显示怪物等级"] = true
  72. end
  73.  
  74. class Game_Enemy < Game_Battler
  75.   attr_accessor :level                         # 怪物等级
  76.   include ISA
  77.   def initialize(index, enemy_id)
  78.     super()
  79.     [url=home.php?mod=space&uid=370741]@Index[/url] = index
  80.     @enemy_id = enemy_id
  81.     enemy = $data_enemies[@enemy_id]
  82.     @original_name = enemy.name
  83.     @letter = ''
  84.     @plural = false
  85.     @screen_x = 0
  86.     @screen_y = 0
  87.     @battler_name = enemy.battler_name
  88.     @battler_hue = enemy.battler_hue
  89.     @original_name, @enemy_actor_id, set_level = *enemy.name.split("_")
  90.     if set_level
  91.       level1 = 0
  92.       level2 = 10000
  93.       for i in 1..$game_party.members.size
  94.         actor = $game_party.members[i-1]
  95.         level1 = actor.level if level1 < actor.level
  96.         level2 = actor.level if level2 > actor.level
  97.       end
  98.       [url=home.php?mod=space&uid=22147]@level[/url] = level2.to_i + rand(level2 - level1) + System["主角当怪物战斗"]["难度"]
  99.       @level = [@level.to_i, 99].min
  100.     else
  101.       @level = set_level.to_i
  102.     end
  103.     @cp = 65535
  104.     @exp_list = Array.new(101)
  105.     make_exp_list
  106.     @hp = maxhp
  107.     @mp = maxmp
  108.   end
  109.  
  110.   def name
  111.     return @original_name unless @enemy_actor_id
  112.     if System["主角当怪物战斗"]["怪物名改为角色名"]
  113.       if System["主角当怪物战斗"]["显示怪物等级"]
  114.         return $data_actors[@enemy_actor_id.to_i].name + @level.to_s + "级"
  115.       else
  116.         return $data_actors[@enemy_actor_id.to_i].name
  117.       end
  118.     else
  119.       if System["主角当怪物战斗"]["显示怪物等级"]
  120.         return @original_name + @level.to_s + "级"
  121.       else
  122.         return @original_name
  123.       end
  124.     end
  125.   end
  126.  
  127.   def base_maxhp
  128.     return enemy.maxhp unless @enemy_actor_id
  129.     return $data_actors[@enemy_actor_id.to_i].parameters[0, @level].to_i / 3
  130.   end
  131.   def base_maxmp
  132.     return enemy.maxmp unless @enemy_actor_id
  133.     return $data_actors[@enemy_actor_id.to_i].parameters[1, @level]
  134.   end
  135.   def base_atk # 获取基本攻击力
  136.     return enemy.atk unless @enemy_actor_id
  137.     return $data_actors[@enemy_actor_id.to_i].parameters[2, @level]
  138.   end
  139.   def base_def # 获取基本防御力
  140.     return enemy.def unless @enemy_actor_id
  141.     return $data_actors[@enemy_actor_id.to_i].parameters[3, @level]
  142.   end
  143.   def base_spi # 获取基本防御力
  144.     return enemy.spi unless @enemy_actor_id
  145.     return $data_actors[@enemy_actor_id.to_i].parameters[4, @level]
  146.   end
  147.   def base_agi # 获取基本敏捷
  148.     return enemy.agi unless @enemy_actor_id
  149.     return $data_actors[@enemy_actor_id.to_i].parameters[5, @level]
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # 命中率、会心一击率、闪躲率、受伤率、属性修正、状态有效需要自己在怪物界面写
  153.   #--------------------------------------------------------------------------
  154.   #--------------------------------------------------------------------------
  155.   # ● 计算经验值
  156.   #--------------------------------------------------------------------------
  157.   def make_exp_list
  158.     return unless @enemy_actor_id
  159.     @exp_list[1] = @exp_list[100] = 0
  160.     m = $data_actors[@enemy_actor_id.to_i].exp_basis
  161.     n = 0.75 + $data_actors[@enemy_actor_id.to_i].exp_inflation / 200.0;
  162.     for i in 2..99
  163.       @exp_list[i] = @exp_list[i-1] + Integer(m)
  164.       m *= 1 + n;
  165.       n *= 0.9;
  166.     end
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 获取经验值
  170.   #--------------------------------------------------------------------------
  171.   def exp
  172.     return enemy.exp unless @enemy_actor_id
  173.     return (@exp_list[@level+1] / 7).to_i
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 获取金钱
  177.   #--------------------------------------------------------------------------
  178.   def gold
  179.     return enemy.gold unless @enemy_actor_id
  180.     return rand(@level + 1) + rand(10) + 10
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # 掉落物品也在怪物界面设置
  184.   #--------------------------------------------------------------------------
  185. end

评分

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

查看全部评分

回复

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
42344
在线时间
7599 小时
注册时间
2009-7-6
帖子
13506

开拓者贵宾

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

评分

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

查看全部评分

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-15 15:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表