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

Project1

 找回密码
 注册会员
搜索
查看: 1583|回复: 0

[已经过期] RTAB战斗系统与被动技能冲突

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2010-6-29
帖子
241
发表于 2010-8-26 15:21:28 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 沉夜 于 2010-8-26 15:31 编辑

先发下两个脚本。
大家看看,为啥冲突……
帮解决下……
这是被动技能
  1. #--------------------------------------------------------------------------
  2. # □ RPG::Skill
  3. #--------------------------------------------------------------------------
  4. module RPG
  5. class Skill
  6.    #--------------------------------------------------------------------------
  7.    # ● 特技类型 (0 : 攻击, 1 : 回复, 2 : 支援, 3 : 被动)
  8.    #--------------------------------------------------------------------------
  9.    def type
  10.      if @occasion == 3
  11.        return 3
  12.      elsif @power == 0 and @atk_f == 0
  13.        return 2
  14.      elsif @power < 0
  15.        return 1
  16.      else
  17.        return 0
  18.      end
  19.    end
  20.    #--------------------------------------------------------------------------
  21.    # ● 被动技判定
  22.    #--------------------------------------------------------------------------
  23.    def innate?
  24.      return (type == 3)
  25.    end
  26.    #--------------------------------------------------------------------------
  27.    # ● 获得被动特技类型
  28.    #     skill : 特技
  29.    #--------------------------------------------------------------------------
  30.    def innate_type
  31.      # 不是被动特技的情况下
  32.      if not innate?
  33.        return -1
  34.      end
  35.      case @scope
  36.      when 0
  37.        # 属性防御类特技
  38.        if @element_set != []
  39.          return 1
  40.        # 状态防御类特技
  41.        elsif @minus_state_set != [] or @plus_state_set != []
  42.          return 2
  43.        # 数值加成类特技
  44.        else
  45.          return 0
  46.        end
  47.      when 1
  48.        return 3
  49.      end
  50.    end
  51.    #--------------------------------------------------------------------------
  52.    # ● 判断增加或减少
  53.    #     index : 判断项目
  54.    #--------------------------------------------------------------------------
  55.    def sign(index)
  56.      unless innate?
  57.        return 0
  58.      end
  59.      if index >= 0
  60.        return (@sp_cost & (2 ** index) == 2 ** index) ? -1 : 1
  61.      else
  62.        case innate_type
  63.        when 0
  64.          return 0
  65.        when 1
  66.          return @minus_state_set.include?(-index) ? -0.5 : 1
  67.        when 2
  68.          return (@sp_cost & 1024 == 1024) ? true : false
  69.        end
  70.      end
  71.    end
  72.    #--------------------------------------------------------------------------
  73.    # ● 最大 HP 上升量
  74.    #--------------------------------------------------------------------------
  75.    def maxhp_plus
  76.      return (innate? and innate_type <= 2) ? @hit * sign(6) : 0
  77.    end
  78.    #--------------------------------------------------------------------------
  79.    # ● 最大 SP 上升量
  80.    #--------------------------------------------------------------------------
  81.    def maxsp_plus
  82.      return (innate? and innate_type <= 2) ? @variance * sign(9) : 0
  83.    end
  84.    #--------------------------------------------------------------------------
  85.    # ● 力量上升量
  86.    #--------------------------------------------------------------------------
  87.    def str_plus
  88.      return (innate? and innate_type <= 2) ? @str_f * sign(2) : 0
  89.    end
  90.    #--------------------------------------------------------------------------
  91.    # ● 灵巧上升量
  92.    #--------------------------------------------------------------------------
  93.    def dex_plus
  94.      return (innate? and innate_type <= 2) ? @dex_f * sign(3): 0
  95.    end
  96.    #--------------------------------------------------------------------------
  97.    # ● 速度上升量
  98.    #--------------------------------------------------------------------------
  99.    def agi_plus
  100.      return (innate? and innate_type <= 2) ? @agi_f * sign(4) : 0
  101.    end
  102.    #--------------------------------------------------------------------------
  103.    # ● 魔力上升量
  104.    #--------------------------------------------------------------------------
  105.    def int_plus
  106.      return (innate? and innate_type <= 2) ? @int_f * sign(5) : 0
  107.    end
  108.    #--------------------------------------------------------------------------
  109.    # ● 攻击力上升量
  110.    #--------------------------------------------------------------------------
  111.    def atk_plus
  112.      return (innate? and innate_type <= 2) ? @atk_f * sign(0) : 0
  113.    end
  114.    #--------------------------------------------------------------------------
  115.    # ● 防御力上升量
  116.    #--------------------------------------------------------------------------
  117.    def pdef_plus
  118.      return (innate? and innate_type <= 2) ? @pdef_f * sign(7) : 0
  119.    end
  120.    #--------------------------------------------------------------------------
  121.    # ● 魔防力上升量
  122.    #--------------------------------------------------------------------------
  123.    def mdef_plus
  124.      return (innate? and innate_type <= 2) ? @mdef_f * sign(8) : 0
  125.    end
  126.    #--------------------------------------------------------------------------
  127.    # ● 回避修正上升量
  128.    #--------------------------------------------------------------------------
  129.    def eva_plus
  130.      return (innate? and innate_type <= 2) ? @eva_f * sign(1) : 0
  131.    end
  132.    #--------------------------------------------------------------------------
  133.    # ● 属性防御上升量
  134.    #     element_id : 属性ID
  135.    #--------------------------------------------------------------------------
  136.    def element_plus(element_id)
  137.      unless innate? and innate_type == 1
  138.        return 0
  139.      else
  140.        if @element_set.include?(element_id)
  141.          return Integer(@power * sign(-element_id))
  142.        else
  143.          return 0
  144.        end
  145.      end
  146.    end
  147.    #--------------------------------------------------------------------------
  148.    # ● 状态防御上升量
  149.    #     state_id : 状态ID
  150.    #--------------------------------------------------------------------------
  151.    def state_plus(state_id)
  152.      unless innate? and innate_type == 2 and not sign(-1)
  153.        return 0
  154.      else
  155.        if @plus_state_set.include?(state_id)
  156.          return @power
  157.        elsif @minus_state_set.include?(state_id)
  158.          return -@power
  159.        else
  160.          return 0
  161.        end
  162.      end
  163.    end
  164.    #--------------------------------------------------------------------------
  165.    # ● 状态防御集合
  166.    #--------------------------------------------------------------------------
  167.    def guard_state_set
  168.      return (innate? and innate_type == 2 and sign(-1)) ? @minus_state_set : []
  169.    end
  170.    #--------------------------------------------------------------------------
  171.    # ● 自动状态集合
  172.    #--------------------------------------------------------------------------
  173.    def auto_states
  174.      return (innate? and innate_type == 2 and sign(-1)) ? @plus_state_set : []
  175.    end
  176. end
  177. end
  178. #==============================================================================
  179. # ■ Game_Actor (分割定义 2)
  180. #------------------------------------------------------------------------------
  181. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  182. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  183. #==============================================================================

  184. class Game_Actor
  185. #--------------------------------------------------------------------------
  186. # ● 定义实例变量
  187. #--------------------------------------------------------------------------
  188. attr_reader   :innate_skills            # 被动特技
  189. alias sailcat_setup setup
  190. alias sailcat_learn_skill learn_skill
  191. alias sailcat_forget_skill forget_skill
  192. alias sailcat_base_maxhp base_maxhp
  193. alias sailcat_base_maxsp base_maxsp
  194. alias sailcat_base_str base_str
  195. alias sailcat_base_dex base_dex
  196. alias sailcat_base_agi base_agi
  197. alias sailcat_base_int base_int
  198. alias sailcat_base_atk base_atk
  199. alias sailcat_base_pdef base_pdef
  200. alias sailcat_base_mdef base_mdef
  201. alias sailcat_base_eva base_eva
  202. alias sailcat_element_rate element_rate
  203. alias sailcat_state_guard? state_guard?
  204. alias sailcat_hit hit
  205. #--------------------------------------------------------------------------
  206. # ● 设置
  207. #     actor_id : 角色 ID
  208. #--------------------------------------------------------------------------
  209. def setup(actor_id)
  210.    @innate_skills = []
  211.    sailcat_setup(actor_id)
  212. end
  213. #--------------------------------------------------------------------------
  214. # ● 领悟特技
  215. #     skill_id : 特技 ID
  216. #--------------------------------------------------------------------------
  217. def learn_skill(skill_id)
  218.    sailcat_learn_skill(skill_id)
  219.    unless @innate_skills.include?(skill_id)
  220.      @innate_skills.push(skill_id)
  221.      @innate_skills.sort!
  222.      update_skill_state(nil, $data_skills[skill_id])
  223.    end
  224. end
  225. #--------------------------------------------------------------------------
  226. # ● 遗忘特技
  227. #     skill_id : 特技 ID
  228. #--------------------------------------------------------------------------
  229. def forget_skill(skill_id)
  230.    sailcat_forget_skill(skill_id)
  231.    @innate_skills.delete(skill_id)
  232.    update_skill_state($data_skills[skill_id], nil)
  233. end
  234. #--------------------------------------------------------------------------
  235. # ● 更新被动特技的自动状态
  236. #     old_skill : 去除的特技
  237. #     new_skill : 设定的特技
  238. #--------------------------------------------------------------------------
  239. def update_skill_state(old_skill, new_skill)
  240.    if old_skill != nil and old_skill.auto_states != []
  241.      for state in old_skill.auto_states
  242.        remove_state(state, true)
  243.      end
  244.    end
  245.    if new_skill != nil and new_skill.auto_states != []
  246.      for state in new_skill.auto_states
  247.        add_state(state, true)
  248.      end
  249.    end
  250. end
  251. #--------------------------------------------------------------------------
  252. # ● 获取基本 MaxHP
  253. #--------------------------------------------------------------------------
  254. def base_maxhp
  255.    m = n = sailcat_base_maxhp
  256.    for skill_id in @innate_skills
  257.      skill = $data_skills[skill_id]
  258.      n += m * (skill != nil ? skill.maxhp_plus : 0) / 100
  259.    end
  260.    return n
  261. end
  262. #--------------------------------------------------------------------------
  263. # ● 获取基本 MaxSP
  264. #--------------------------------------------------------------------------
  265. def base_maxsp
  266.    m = n = sailcat_base_maxsp
  267.    for skill_id in @innate_skills
  268.      skill = $data_skills[skill_id]
  269.      n += m * (skill != nil ? skill.maxsp_plus : 0) / 100
  270.    end
  271.    return n
  272. end
  273. #--------------------------------------------------------------------------
  274. # ● 获取基本力量
  275. #--------------------------------------------------------------------------
  276. def base_str
  277.    m = n = sailcat_base_str
  278.    for skill_id in @innate_skills
  279.      skill = $data_skills[skill_id]
  280.      n += m * (skill != nil ? skill.str_plus : 0) / 100
  281.    end
  282.    return [n, 999].min
  283. end
  284. #--------------------------------------------------------------------------
  285. # ● 获取基本灵巧
  286. #--------------------------------------------------------------------------
  287. def base_dex
  288.    m = n = sailcat_base_dex
  289.    for skill_id in @innate_skills
  290.      skill = $data_skills[skill_id]
  291.      n += m * (skill != nil ? skill.dex_plus : 0) / 100
  292.    end
  293.    return [n, 999].min
  294. end
  295. #--------------------------------------------------------------------------
  296. # ● 获取基本速度
  297. #--------------------------------------------------------------------------
  298. def base_agi
  299.    m = n = sailcat_base_agi
  300.    for skill_id in @innate_skills
  301.      skill = $data_skills[skill_id]
  302.      n += m * (skill != nil ? skill.agi_plus : 0) / 100
  303.    end
  304.    return [n, 999].min
  305. end
  306. #--------------------------------------------------------------------------
  307. # ● 获取基本魔力
  308. #--------------------------------------------------------------------------
  309. def base_int
  310.    m = n = sailcat_base_int
  311.    for skill_id in @innate_skills
  312.      skill = $data_skills[skill_id]
  313.      n += m * (skill != nil ? skill.int_plus : 0) / 100
  314.    end
  315.    return [n, 999].min
  316. end
  317. #--------------------------------------------------------------------------
  318. # ● 获取基本攻击力
  319. #--------------------------------------------------------------------------
  320. def base_atk
  321.    m = n = sailcat_base_atk
  322.    for skill_id in @innate_skills
  323.      skill = $data_skills[skill_id]
  324.      n += m * (skill != nil ? skill.atk_plus : 0) / 100
  325.    end
  326.    return [n, 999].min
  327. end
  328. #--------------------------------------------------------------------------
  329. # ● 获取基本物理防御
  330. #--------------------------------------------------------------------------
  331. def base_pdef
  332.    m = n = sailcat_base_pdef
  333.    for skill_id in @innate_skills
  334.      skill = $data_skills[skill_id]
  335.      n += m * (skill != nil ? skill.pdef_plus : 0) / 100
  336.    end
  337.    return [n, 999].min
  338. end
  339. #--------------------------------------------------------------------------
  340. # ● 获取基本魔法防御
  341. #--------------------------------------------------------------------------
  342. def base_mdef
  343.    m = n = sailcat_base_mdef
  344.    for skill_id in @innate_skills
  345.      skill = $data_skills[skill_id]
  346.      n += m * (skill != nil ? skill.mdef_plus : 0) / 100
  347.    end
  348.    return [n, 999].min
  349. end
  350. #--------------------------------------------------------------------------
  351. # ● 获取基本回避修正
  352. #--------------------------------------------------------------------------
  353. def base_eva
  354.    n = sailcat_base_eva
  355.    for skill_id in @innate_skills
  356.      skill = $data_skills[skill_id]
  357.      n += skill != nil ? skill.eva_plus : 0
  358.    end
  359.    return [n, 100].min
  360. end
  361. #--------------------------------------------------------------------------
  362. # ● 获取命中率
  363. #--------------------------------------------------------------------------
  364. def hit
  365.    n = sailcat_hit
  366.    for skill_id in @innate_skills
  367.      skill = $data_skills[skill_id]
  368.      n = (skill != nil and skill.sign(12) == -1) ? 100 : n
  369.    end
  370.    return n
  371. end
  372. #--------------------------------------------------------------------------
  373. # ● 判定防御状态
  374. #     state_id : 状态 ID
  375. #--------------------------------------------------------------------------
  376. def state_guard?(state_id)
  377.    n = sailcat_state_guard?(state_id)
  378.    for skill_id in @innate_skills
  379.      skill = $data_skills[skill_id]
  380.      n |= skill.guard_state_set.include?(state_id) if skill != nil
  381.    end
  382.    return n
  383. end
  384. #--------------------------------------------------------------------------
  385. # ● 取得属性修正值
  386. #     element_id : 属性 ID
  387. #--------------------------------------------------------------------------
  388. def element_rate(element_id)
  389.    result = sailcat_element_rate(element_id)
  390.    for skill_id in @innate_skills
  391.      skill = $data_skills[skill_id]
  392.      if skill != nil
  393.        result -= skill.element_plus(element_id)
  394.        result = [[result, 300].min, -200].max
  395.      end
  396.    end
  397.    return result
  398. end
  399. #--------------------------------------------------------------------------
  400. # ● 取得状态修正值
  401. #     state_id : 状态 ID
  402. #--------------------------------------------------------------------------
  403. def state_rate(state_id)
  404.    table = [0,100,80,60,40,20,0]
  405.    result = table[self.state_ranks[state_id]]
  406.    for skill_id in @innate_skills
  407.      skill = $data_skills[skill_id]
  408.      if skill != nil
  409.        result -= skill.state_plus(state_id)
  410.        result = [[result, 100].min, 0].max
  411.      end
  412.    end
  413.    return result
  414. end
  415. end
  416. class Game_Battler
  417. #--------------------------------------------------------------------------
  418. # ● 状态变化 (+) 的适用
  419. #     plus_state_set  : 状态变化 (+)
  420. #--------------------------------------------------------------------------
  421. def states_plus(plus_state_set)
  422.    # 清除有效标志
  423.    effective = false
  424.    # 循环 (附加状态)
  425.    for i in plus_state_set
  426.      # 无法防御本状态的情况下
  427.      unless self.state_guard?(i)
  428.        # 这个状态如果不是 full 的话就设置有效标志
  429.        effective |= self.state_full?(i) == false
  430.        # 状态为 [不能抵抗] 的情况下
  431.        if $data_states[i].nonresistance
  432.          # 设置状态变化标志
  433.          @state_changed = true
  434.          # 附加状态
  435.          add_state(i)
  436.        # 这个状态不是 full 的情况下
  437.        elsif self.state_full?(i) == false
  438.          # 将状态的有效度变换为概率、与随机数比较
  439.          if rand(100) < self.state_rate(i)
  440.            # 设置状态变化标志
  441.            @state_changed = true
  442.            # 附加状态
  443.            add_state(i)
  444.          end
  445.        end
  446.      end
  447.    end
  448.    # 过程结束
  449.    return effective
  450. end
  451. end
  452. class Game_Enemy
  453. #--------------------------------------------------------------------------
  454. # ● 获取状态修正值
  455. #     state_id : 状态 ID
  456. #--------------------------------------------------------------------------
  457. def state_rate(state_id)
  458.    return [0,100,80,60,40,20,0][self.state_ranks[state_id]]
  459. end
  460. end
复制代码
这是RTAB战斗系统 Ver 1.16
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # http://members.jcom.home.ne.jp/cogwheel/

  4. class Scene_Battle
  5.   #--------------------------------------------------------------------------
  6.   # ● 公開インスタンス変数
  7.   #--------------------------------------------------------------------------
  8.   attr_reader   :status_window            # ステータスウィンドウ
  9.   attr_reader   :spriteset                # バトルスプライト
  10.   attr_reader   :scroll_time              # スクリーン移動基本時間
  11.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  12.   attr_reader   :drive                    # カメラ駆動
  13.   attr_accessor :force                    # アクション強制度
  14.   attr_accessor :camera                   # 現在のカメラ所持者
  15.   #--------------------------------------------------------------------------
  16.   # ● ATB基礎セットアップ
  17.   #--------------------------------------------------------------------------
  18.   def atb_setup
  19.     # ATB初期化
  20.     # speed   : バトルスピード決定。値が小さいほど早い
  21.     # @active : アクティブ度設定
  22.     #           3 : 常にアクティブ状態
  23.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  24.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  25.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  26.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  27.     #           3 : 自分が行動不能でない限り限り許す
  28.     #           2 : 自分がダメージを受けていない限り許す
  29.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  30.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  31.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  32.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  33.     # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
  34.     #               [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
  35.     # @enemy_speed : 敵の思考速度。1なら即時行動。
  36.     #                1フレーム毎に、1/@enemy_speedの確率で行動を起こす
  37.     # @force : 強制アクションでスキル使用時の強制具合
  38.     #          2:スキルは全て詠唱せず、必ず即時実行
  39.     #          1:単独スキルは詠唱し、連携スキルのみ即時実行
  40.     #          0:全スキル詠唱を行うだけ
  41.     # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
  42.     # @drive : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
  43.     # @scroll_time : スクリーン移動に要する基本時間
  44.     # @zoom_rate = [i, j] : エネミーのズーム率
  45.     #                       i が画面最上部に配置した時の拡大率
  46.     #                       j が画面最下部に配置した時の拡大率
  47.     #                       1 倍としたいときも、1.0 と必ず小数で設定すること
  48.     speed = 150
  49.     @active = 1
  50.     @action = 0
  51.     @anime_wait = false
  52.     @damage_wait = 10
  53.     @after_wait = [80, 0]
  54.     @enemy_speed = 40
  55.     @force = 2
  56.     @drive = true
  57.     @scroll_time = 15
  58.     @zoom_rate = [0.2, 1.0]
  59.     @help_time = 40
  60.     @escape == false
  61.     @camera = nil
  62.     @max = 0
  63.     @turn_cnt = 0
  64.     @help_wait = 0
  65.     @action_battlers = []
  66.     @synthe = []
  67.     @spell_p = {}
  68.     @spell_e = {}
  69.     @command_a = false
  70.     @command = []
  71. #------------------------------------------------------------------------------   
  72. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  73. #    @party = false
  74. #------------------------------------------------------------------------------
  75.     for battler in $game_party.actors + $game_troop.enemies
  76.       spell_reset(battler)
  77.       battler.at = battler.agi * rand(speed / 2)
  78.       battler.damage_pop = {}
  79.       battler.damage = {}
  80.       battler.damage_sp = {}
  81.       battler.critical = {}
  82.       battler.recover_hp = {}
  83.       battler.recover_sp = {}
  84.       battler.state_p = {}
  85.       battler.state_m = {}
  86.       battler.animation = []
  87.       if battler.is_a?(Game_Actor)
  88.         @max += battler.agi
  89.       end
  90.     end
  91.     @max *= speed
  92.     @max /= $game_party.actors.size
  93.     for battler in $game_party.actors + $game_troop.enemies
  94.       battler.atp = 100 * battler.at / @max
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● ATゲージMax時SE
  99.   #--------------------------------------------------------------------------
  100.   def fullat_se
  101.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● レベルアップSE
  105.   #--------------------------------------------------------------------------
  106.   def levelup_se
  107.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● スキル習得SE
  111.   #--------------------------------------------------------------------------
  112.   def skill_se
  113.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  114.   end
  115. end

  116. class Window_Base < Window
  117.   #--------------------------------------------------------------------------
  118.   # ● ATG の描画
  119.   #     actor : アクター
  120.   #     x     : 描画先 X 座標
  121.   #     y     : 描画先 Y 座標
  122.   #     width : 描画先の幅
  123.   #--------------------------------------------------------------------------
  124.   def draw_actor_atg(actor, x, y, width = 144)
  125.     if @at_gauge == nil
  126.       # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  127.       # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  128.       # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  129.       # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  130.       # align3:ゲージタイプ 0:左詰め 1:右詰め
  131.       @plus_x = 0
  132.       @rate_x = 0
  133.       @plus_y = 16
  134.       @plus_width = 0
  135.       @rate_width = 100
  136.       @width = @plus_width + width * @rate_width / 100
  137.       @height = 16
  138.       @align1 = 0
  139.       @align2 = 1
  140.       @align3 = 0
  141.       # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  142.       # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
  143.       grade1 = 1
  144.       grade2 = 0
  145.       # 色設定。color1:最外枠,color2:中枠
  146.       # color3:空枠ダークカラー,color4:空枠ライトカラー
  147.       color1 = Color.new(0, 0, 0)
  148.       color2 = Color.new(255, 255, 192)
  149.       color3 = Color.new(0, 0, 0, 192)
  150.       color4 = Color.new(0, 0, 64, 192)
  151.       # ゲージの色設定
  152.       # 通常時の色設定
  153.       color5 = Color.new(0, 64, 80)
  154.       color6 = Color.new(0, 128, 160)
  155.       # ゲージがMAXの時の色設定
  156.       color7 = Color.new(80, 0, 0)
  157.       color8 = Color.new(240, 0, 0)
  158.       # 連携スキル使用時の色設定
  159.       color9 = Color.new(80, 64, 32)
  160.       color10 = Color.new(240, 192, 96)
  161.       # スキル詠唱時の色設定
  162.       color11 = Color.new(80, 0, 64)
  163.       color12 = Color.new(240, 0, 192)
  164.       # ゲージの描画
  165.       gauge_rect_at(@width, @height, @align3, color1, color2,
  166.                   color3, color4, color5, color6, color7, color8,
  167.                   color9, color10, color11, color12, grade1, grade2)
  168.     end
  169.     # 変数atに描画するゲージの幅を代入
  170.     if actor.rtp == 0
  171.       at = (width + @plus_width) * actor.atp * @rate_width / 10000
  172.     else
  173.       at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
  174.     end
  175.     if at > width
  176.       at = width
  177.     end
  178.     # ゲージの左詰・中央構え等の補正
  179.     case @align1
  180.     when 1
  181.       x += (@rect_width - width) / 2
  182.     when 2
  183.       x += @rect_width - width
  184.     end
  185.     case @align2
  186.     when 1
  187.       y -= @height / 2
  188.     when 2
  189.       y -= @height
  190.     end
  191.     self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
  192.                       @at_gauge, Rect.new(0, 0, @width, @height))
  193.     if @align3 == 0
  194.       rect_x = 0
  195.     else
  196.       x += @width - at - 1
  197.       rect_x = @width - at - 1
  198.     end
  199.     # ゲージの色設定
  200.     if at == width
  201.         # MAX時のゲージ描画
  202.       self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  203.                         @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
  204.     else
  205.       if actor.rtp == 0
  206.         # 通常時のゲージ描画
  207.         self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  208.                           @at_gauge, Rect.new(rect_x, @height, at, @height))
  209.       else
  210.         if actor.spell == true
  211.           # 連携スキル使用時のゲージ描画
  212.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  213.                         @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
  214.         else
  215.           # スキル詠唱時のゲージ描画
  216.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  217.                         @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
  218.         end
  219.       end
  220.     end
  221.   end
  222. end

  223. #==============================================================================
  224. # ■ Scene_Battle (分割定義 1)
  225. #------------------------------------------------------------------------------
  226. #  バトル画面の処理を行うクラスです。
  227. #==============================================================================

  228. class Scene_Battle
  229.   #--------------------------------------------------------------------------
  230.   # ● メイン処理
  231.   #--------------------------------------------------------------------------
  232.   def main
  233.     # 戦闘用の各種一時データを初期化
  234.    # Graphics.frame_rate = 60
  235.     $game_temp.in_battle = true
  236.     $game_temp.battle_turn = 0
  237.     $game_temp.battle_event_flags.clear
  238.     $game_temp.battle_abort = false
  239.     $game_temp.battle_main_phase = false
  240.     $game_temp.battleback_name = $game_map.battleback_name
  241.     $game_temp.forcing_battler = nil
  242.     # バトルイベント用インタプリタを初期化
  243.     $game_system.battle_interpreter.setup(nil, 0)
  244.     # トループを準備
  245.     @troop_id = $game_temp.battle_troop_id
  246.     $game_troop.setup(@troop_id)
  247.     atb_setup
  248.     # アクターコマンドウィンドウを作成
  249. #==============================================================================
  250. #RTAB观光游第三站,战斗菜单增加逃跑选项
  251. #==============================================================================   
  252.     s1 = $data_system.words.attack
  253.     s2 = $data_system.words.skill
  254.     s3 = $data_system.words.guard
  255.     s4 = $data_system.words.item
  256.     s5 = "逃跑"
  257.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])   
  258. #   @actor_command_window.y = 160
  259.     @actor_command_window.y = 128
  260.     @actor_command_window.back_opacity = 160
  261.     @actor_command_window.active = false
  262.     @actor_command_window.visible = false
  263. #==============================================================================   
  264.     # その他のウィンドウを作成
  265. #------------------------------------------------------------------------------
  266. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  267. #    @party_command_window = Window_PartyCommand.new
  268. #------------------------------------------------------------------------------   
  269.     @help_window = Window_Help.new
  270.     @help_window.back_opacity = 160
  271.     @help_window.visible = false
  272.     @status_window = Window_BattleStatus.new
  273.     @message_window = Window_Message.new
  274.     # スプライトセットを作成
  275.     @spriteset = Spriteset_Battle.new
  276.     # ウェイトカウントを初期化
  277.     @wait_count = 0
  278.     # トランジション実行
  279.     if $data_system.battle_transition == ""
  280.       Graphics.transition(20)
  281.     else
  282.       Graphics.transition(40, "Graphics/Transitions/" +
  283.         $data_system.battle_transition)
  284.     end
  285.     # プレバトルフェーズ開始
  286.     start_phase1
  287.     # メインループ
  288.     loop do
  289.       # ゲーム画面を更新
  290.       Graphics.update
  291.       # 入力情報を更新
  292.       Input.update
  293.       # フレーム更新
  294.       update
  295.       # 画面が切り替わったらループを中断
  296.       if $scene != self
  297.         break
  298.       end
  299.     end
  300.     # マップをリフレッシュ
  301.     $game_map.refresh
  302.     # トランジション準備
  303.     Graphics.freeze
  304.     # ウィンドウを解放
  305.     @actor_command_window.dispose
  306. #------------------------------------------------------------------------------
  307. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  308. #    @party_command_window.dispose
  309. #------------------------------------------------------------------------------   
  310.     @help_window.dispose
  311.     @status_window.dispose
  312.     @message_window.dispose
  313.     if @skill_window != nil
  314.       @skill_window.dispose
  315.     end
  316.     if @item_window != nil
  317.       @item_window.dispose
  318.     end
  319.     if @result_window != nil
  320.       @result_window.dispose
  321.     end
  322.     # スプライトセットを解放
  323.     @spriteset.dispose
  324.     # タイトル画面に切り替え中の場合
  325.     if $scene.is_a?(Scene_Title)
  326.       # 画面をフェードアウト
  327.       Graphics.transition
  328.       Graphics.freeze
  329.     end
  330.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  331.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  332.       $scene = nil
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 勝敗判定
  337.   #--------------------------------------------------------------------------
  338.   def judge
  339.     # 全滅判定が真、またはパーティ人数が 0 人の場合
  340.     if $game_party.all_dead? or $game_party.actors.size == 0
  341.       # 敗北可能の場合
  342.       if $game_temp.battle_can_lose
  343.         # バトル開始前の BGM に戻す
  344.         $game_system.bgm_play($game_temp.map_bgm)
  345.         # バトル終了
  346.         battle_end(2)
  347.         # true を返す
  348.         return true
  349.       end
  350.       # ゲームオーバーフラグをセット
  351.       $game_temp.gameover = true
  352.       # true を返す
  353.       return true
  354.     end
  355.     # エネミーが 1 体でも存在すれば false を返す
  356.     for enemy in $game_troop.enemies
  357.       if enemy.exist?
  358.         return false
  359.       end
  360.     end
  361.     # アフターバトルフェーズ開始 (勝利)
  362.     start_phase5
  363.     # true を返す
  364.     return true
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● フレーム更新
  368.   #--------------------------------------------------------------------------
  369.   def update
  370.     # バトルイベント実行中の場合
  371.     if $game_system.battle_interpreter.running?
  372.       if @command.size > 0
  373.         @command_a = false
  374.         @command = []
  375.         command_delete
  376.       end
  377.       @status_window.at_refresh
  378.       # インタプリタを更新
  379.       $game_system.battle_interpreter.update
  380.       # アクションを強制されているバトラーが存在しない場合
  381.       if $game_temp.forcing_battler == nil
  382.         # バトルイベントの実行が終わった場合
  383.         unless $game_system.battle_interpreter.running?
  384.           # バトルイベントのセットアップを再実行
  385.           @status_window.refresh
  386.           setup_battle_event
  387.         end
  388.       end
  389.     end
  390.     # システム (タイマー)、画面を更新
  391.     $game_system.update
  392.     $game_screen.update
  393.     # タイマーが 0 になった場合
  394.     if $game_system.timer_working and $game_system.timer == 0
  395.       # バトル中断
  396.       $game_temp.battle_abort = true
  397.     end
  398.     # ウィンドウを更新
  399.     @help_window.update
  400. #------------------------------------------------------------------------------
  401. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  402. #    @party_command_window.update
  403. #------------------------------------------------------------------------------
  404.     @actor_command_window.update
  405.     @status_window.update
  406.     @message_window.update
  407.     # スプライトセットを更新
  408.     @spriteset.update
  409.     # トランジション処理中の場合
  410.     if $game_temp.transition_processing
  411.       # トランジション処理中フラグをクリア
  412.       $game_temp.transition_processing = false
  413.       # トランジション実行
  414.       if $game_temp.transition_name == ""
  415.         Graphics.transition(20)
  416.       else
  417.         Graphics.transition(40, "Graphics/Transitions/" +
  418.           $game_temp.transition_name)
  419.       end
  420.     end
  421.     # メッセージウィンドウ表示中の場合
  422.     if $game_temp.message_window_showing
  423.       return
  424.     end
  425.     # ゲームオーバーの場合
  426.     if $game_temp.gameover
  427.       # ゲームオーバー画面に切り替え
  428.       $scene = Scene_Gameover.new
  429.       return
  430.     end
  431.     # タイトル画面に戻す場合
  432.     if $game_temp.to_title
  433.       # タイトル画面に切り替え
  434.       $scene = Scene_Title.new
  435.       return
  436.     end
  437.     # バトル中断の場合
  438.     if $game_temp.battle_abort
  439.       # バトル開始前の BGM に戻す
  440.       $game_system.bgm_play($game_temp.map_bgm)
  441.       # バトル終了
  442.       battle_end(1)
  443.       return
  444.     end
  445.     # ヘルプウィンドウ表示中の場合
  446.     if @help_wait > 0
  447.       @help_wait -= 1
  448.       if @help_wait == 0
  449.         # ヘルプウィンドウを隠す
  450.         @help_window.visible = false
  451.       end
  452.     end
  453.     # アクションを強制されているバトラーが存在せず、
  454.     # かつバトルイベントが実行中の場合
  455.     if $game_temp.forcing_battler == nil and
  456.        $game_system.battle_interpreter.running?
  457.       return
  458.     end
  459.     # フェーズによって分岐
  460.     case @phase
  461.     when 0  # ATゲージ更新フェーズ
  462.       if anime_wait_return
  463.         update_phase0
  464.       end
  465.     when 1  # プレバトルフェーズ
  466.       update_phase1
  467.       return
  468.     when 2  # パーティコマンドフェーズ
  469.       update_phase2
  470.       return
  471.     when 5  # アフターバトルフェーズ
  472.       update_phase5
  473.       return
  474.     end
  475.     if $scene != self
  476.       return
  477.     end
  478.     if @phase == 0
  479.       if @command.size != 0  # アクターコマンドフェーズ
  480.         if @command_a == false
  481.           start_phase3
  482.         end
  483.         update_phase3
  484.       end
  485.       # ウェイト中の場合
  486.       if @wait_count > 0
  487.         # ウェイトカウントを減らす
  488.         @wait_count -= 1
  489.         return
  490.       end
  491.       update_phase4
  492.     end
  493.   end

  494. #==============================================================================
  495. # ■ Scene_Battle (分割定義 2)
  496. #------------------------------------------------------------------------------
  497. #  バトル画面の処理を行うクラスです。
  498. #==============================================================================

  499.   #--------------------------------------------------------------------------
  500.   # ● フレーム更新 (ATゲージ更新フェーズ)
  501.   #--------------------------------------------------------------------------
  502.   def update_phase0
  503.     if $game_temp.battle_turn == 0
  504.       $game_temp.battle_turn = 1
  505.     end
  506.     # B ボタンが押された場合
  507.   #  if @command_a == false and @party == false
  508.    #   if Input.trigger?(Input::B)
  509.         # キャンセル SE を演奏
  510.    #     $game_system.se_play($data_system.cancel_se)
  511.    #     @party = true
  512.    #   end
  513.    # end
  514.    # if @party == true and
  515.    #     ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  516.    #     (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  517.       # パーティコマンドフェーズへ
  518.    #   start_phase2
  519.    #   return
  520.    # end
  521.     # ATゲージ増加処理
  522.     cnt = 0
  523.     for battler in $game_party.actors + $game_troop.enemies
  524.       active?(battler)
  525.       if battler.rtp == 0
  526.         if battler.at >= @max
  527.           if battler.is_a?(Game_Actor)
  528.             if battler.inputable?
  529.               unless @action_battlers.include?(battler) or
  530.                   @command.include?(battler) or @escape == true
  531.                 if battler.current_action.forcing
  532.                   fullat_se
  533.                   force_action(battler)
  534.                   action_start(battler)
  535.                 else
  536.                   fullat_se
  537.                   @command.push(battler)
  538.                 end
  539.               end
  540.             else
  541.               unless @action_battlers.include?(battler) or
  542.                       battler == @command[0]
  543.                 battler.current_action.clear
  544.                 if @command.include?(battler)
  545.                   @command.delete(battler)
  546.                 else
  547.                   if battler.movable?
  548.                     fullat_se
  549.                   end
  550.                 end
  551.                 action_start(battler)
  552.               end
  553.             end
  554.           else
  555.             unless @action_battlers.include?(battler)
  556.               if battler.current_action.forcing
  557.                 force_action(battler)
  558.                 action_start(battler)
  559.               else
  560.                 if @enemy_speed != 0
  561.                   if rand(@enemy_speed) == 0
  562.                     number = cnt - $game_party.actors.size
  563.                     enemy_action(number)
  564.                   end
  565.                 else
  566.                   number = cnt - $game_party.actors.size
  567.                   enemy_action(number)
  568.                 end
  569.               end
  570.             end
  571.           end
  572.         else
  573.           battler.at += battler.agi
  574.           if battler.guarding?
  575.             battler.at += battler.agi
  576.           end
  577.           if battler.movable?
  578.             battler.atp = 100 * battler.at / @max
  579.           end
  580.         end
  581.       else
  582.         if battler.rt >= battler.rtp
  583.           speller = synthe?(battler)
  584.           if speller != nil
  585.             battler = speller[0]
  586.           end
  587.           unless @action_battlers.include?(battler)
  588.             if battler.is_a?(Game_Actor)
  589.               fullat_se
  590.             end
  591.             battler.rt = battler.rtp
  592.             action_start(battler)
  593.           end
  594.         else
  595.           battler.rt += battler.agi
  596.           speller = synthe?(battler)
  597.           if speller != nil
  598.             for spell in speller
  599.               if spell != battler
  600.                 spell.rt += battler.agi
  601.               end
  602.             end
  603.           end
  604.         end
  605.       end
  606.       cnt += 1
  607.     end
  608.     # ATゲージをリフレッシュ
  609.     @status_window.at_refresh
  610.     # 逃走処理
  611.     if @escape == true and
  612.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  613.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  614.       temp = false
  615.       for battler in $game_party.actors
  616.         if battler.inputable?
  617.           temp = true
  618.         end
  619.       end
  620.       if temp == true
  621.         for battler in $game_party.actors
  622.           if battler.at < @max and battler.inputable?
  623.             temp = false
  624.             break
  625.           end
  626.         end
  627.         if temp == true
  628.           @escape = false
  629.           for battler in $game_party.actors
  630.             battler.at %= @max
  631.           end
  632.           $game_temp.battle_main_phase = false
  633.           update_phase2_escape
  634.         end
  635.       end
  636.     end
  637.   end
  638. #------------------------------------------------------------------------------
  639. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  640.   #--------------------------------------------------------------------------
  641.   # ● パーティコマンドフェーズ開始
  642.   #--------------------------------------------------------------------------
  643. #  def start_phase2
  644.     # フェーズ 2 に移行
  645. #    @phase = 2
  646. #    @party = false
  647.     # パーティコマンドウィンドウを有効化
  648. #    @party_command_window.active = true
  649. #    @party_command_window.visible = true
  650.     # アクターを非選択状態に設定
  651. #    @actor_index = -1
  652.     # アクターコマンドウィンドウを無効化
  653. #    @actor_command_window.active = false
  654. #    @actor_command_window.visible = false
  655. #    if @command.size != 0
  656.       # アクターの明滅エフェクト OFF
  657. #      if @active_actor != nil
  658. #        @active_actor.blink = false
  659. #      end
  660. #    end
  661.     # カメラセット
  662. #    @camera == "party"
  663. #    @spriteset.screen_target(0, 0, 1)
  664.     # メインフェーズフラグをクリア
  665. #    $game_temp.battle_main_phase = false
  666. #  end
  667. #------------------------------------------------------------------------------
  668.   #--------------------------------------------------------------------------
  669.   # ● フレーム更新 (パーティコマンドフェーズ)
  670.   #--------------------------------------------------------------------------
  671.   def update_phase2
  672. #------------------------------------------------------------------------------
  673. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  674.     # C ボタンが押された場合
  675.    # 去掉“战斗/逃跑”选项
  676. #    if Input.trigger?(Input::C)
  677.       # パーティコマンドウィンドウのカーソル位置で分岐
  678. #      case @party_command_window.index
  679. #      when 0  # 戦う
  680.         # パーティコマンドウィンドウを無効化
  681. #        @party_command_window.active = false
  682. #        @party_command_window.visible = false
  683.         # 決定 SE を演奏
  684. #        $game_system.se_play($data_system.decision_se)
  685. #------------------------------------------------------------------------------
  686.         @escape = false
  687.         @phase = 0
  688.         if $game_temp.battle_turn == 0
  689.           $game_temp.battle_turn = 1
  690.         end
  691.         if @command_a == true
  692.           # アクターコマンドフェーズ開始
  693.           start_phase3
  694.         else
  695.           $game_temp.battle_main_phase = true
  696.         end
  697. end         
  698. #------------------------------------------------------------------------------
  699. #RTAB观光游第一站,去除“战斗/逃跑”选项部分         
  700. #      when 1  # 逃げる
  701.         # 逃走可能ではない場合
  702. #        if $game_temp.battle_can_escape == false
  703.           # ブザー SE を演奏
  704. #          $game_system.se_play($data_system.buzzer_se)
  705. #          return
  706. #        end
  707.         # 決定 SE を演奏
  708. #        $game_system.se_play($data_system.decision_se)
  709. #        @phase = 0
  710.         # パーティコマンドウィンドウを無効化
  711. #        @party_command_window.active = false
  712. #        @party_command_window.visible = false
  713. #        $game_temp.battle_main_phase = true
  714. #        if $game_temp.battle_turn == 0
  715. #          update_phase2_escape
  716. #          $game_temp.battle_turn = 1
  717. #        for battler in $game_party.actors
  718. #           battler.at -= @max / 2
  719. #         end
  720. #         return
  721. #      end
  722.         # 決定 SE を演奏
  723. #       $game_system.se_play($data_system.decision_se)
  724. #       @escape = true
  725. #       for battler in $game_party.actors
  726. #         @command_a = false
  727. #         @command.delete(battler)
  728. #         @action_battlers.delete(battler)
  729. #         skill_reset(battler)
  730. #       end
  731. #     end
  732. #     return
  733. #   end
  734. #end
  735. #------------------------------------------------------------------------------
  736.   #--------------------------------------------------------------------------
  737.   # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  738.   #--------------------------------------------------------------------------
  739.   def update_phase2_escape
  740.     # エネミーの素早さ平均値を計算
  741.     enemies_agi = 0
  742.     enemies_number = 0
  743.     for enemy in $game_troop.enemies
  744.       if enemy.exist?
  745.         enemies_agi += enemy.agi
  746.         enemies_number += 1
  747.       end
  748.     end
  749.     if enemies_number > 0
  750.       enemies_agi /= enemies_number
  751.     end
  752.     # アクターの素早さ平均値を計算
  753.     actors_agi = 0
  754.     actors_number = 0
  755.     for actor in $game_party.actors
  756.       if actor.exist?
  757.         actors_agi += actor.agi
  758.         actors_number += 1
  759.       end
  760.     end
  761.     if actors_number > 0
  762.       actors_agi /= actors_number
  763.     end
  764.     # 逃走成功判定
  765.     success = rand(100) < 50 * actors_agi / enemies_agi
  766.     # 逃走成功の場合
  767.     if success
  768.       # 逃走 SE を演奏
  769.       $game_system.se_play($data_system.escape_se)
  770.       # バトル開始前の BGM に戻す
  771.       $game_system.bgm_play($game_temp.map_bgm)
  772.       # バトル終了
  773.       battle_end(1)
  774.     # 逃走失敗の場合
  775.     else
  776.       @help_window.set_text("逃走失敗", 1)
  777.       @help_wait = @help_time
  778.       # パーティ全員のアクションをクリア
  779.       $game_party.clear_actions
  780.       # メインフェーズ開始
  781.       start_phase4
  782.     end
  783.   end
  784.   #--------------------------------------------------------------------------
  785.   # ● アフターバトルフェーズ開始
  786.   #--------------------------------------------------------------------------
  787.   def start_phase5
  788.     # フェーズ 5 に移行
  789.     @phase = 5
  790.     # バトル終了 ME を演奏
  791.     $game_system.me_play($game_system.battle_end_me)
  792.     # バトル開始前の BGM に戻す
  793.     $game_system.bgm_play($game_temp.map_bgm)
  794.     # EXP、ゴールド、トレジャーを初期化
  795.     exp = 0
  796.     gold = 0
  797.     treasures = []
  798.     if @active_actor != nil
  799.       @active_actor.blink = false
  800.     end
  801.     # メインフェーズフラグをセット
  802.     $game_temp.battle_main_phase = true
  803. #------------------------------------------------------------------------------
  804. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  805.     # パーティコマンドウィンドウを無効化
  806. #    @party_command_window.active = false
  807. #    @party_command_window.visible = false
  808. #------------------------------------------------------------------------------
  809.     # アクターコマンドウィンドウを無効化
  810.     @actor_command_window.active = false
  811.     @actor_command_window.visible = false
  812.     if @skill_window != nil
  813.       # スキルウィンドウを解放
  814.       @skill_window.dispose
  815.       @skill_window = nil
  816.     end
  817.     if @item_window != nil
  818.       # アイテムウィンドウを解放
  819.       @item_window.dispose
  820.       @item_window = nil
  821.     end
  822.     # ヘルプウィンドウを隠す
  823.     @help_window.visible = false
  824.     # ループ
  825.     for enemy in $game_troop.enemies
  826.       # エネミーが隠れ状態でない場合
  827.       unless enemy.hidden
  828.         # 獲得 EXP、ゴールドを追加
  829.         exp += enemy.exp
  830.         gold += enemy.gold
  831.         # トレジャー出現判定
  832.         if rand(100) < enemy.treasure_prob
  833.           if enemy.item_id > 0
  834.             treasures.push($data_items[enemy.item_id])
  835.           end
  836.           if enemy.weapon_id > 0
  837.             treasures.push($data_weapons[enemy.weapon_id])
  838.           end
  839.           if enemy.armor_id > 0
  840.             treasures.push($data_armors[enemy.armor_id])
  841.           end
  842.         end
  843.       end
  844.     end
  845.     # トレジャーの数を 6 個までに限定
  846.     treasures = treasures[0..5]
  847.     # EXP 獲得
  848.     for i in 0...$game_party.actors.size
  849.       actor = $game_party.actors[i]
  850.       if actor.cant_get_exp? == false
  851.         last_level = actor.level
  852.         actor.exp += exp
  853.         if actor.level > last_level
  854.           @status_window.level_up(i)
  855.           actor.damage[[actor, -1]] = "Level up!"
  856.           actor.up_level = actor.level - last_level
  857.         end
  858.       end
  859.     end
  860.     # ゴールド獲得
  861.     $game_party.gain_gold(gold)
  862.     # トレジャー獲得
  863.     for item in treasures
  864.       case item
  865.       when RPG::Item
  866.         $game_party.gain_item(item.id, 1)
  867.       when RPG::Weapon
  868.         $game_party.gain_weapon(item.id, 1)
  869.       when RPG::Armor
  870.         $game_party.gain_armor(item.id, 1)
  871.       end
  872.     end
  873.     # バトルリザルトウィンドウを作成
  874.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  875.     # ウェイトカウントを設定
  876.     @phase5_wait_count = 100
  877.   end
  878.   #--------------------------------------------------------------------------
  879.   # ● フレーム更新 (アフターバトルフェーズ)
  880.   #--------------------------------------------------------------------------
  881.   def update_phase5
  882.     # ウェイトカウントが 0 より大きい場合
  883.     if @phase5_wait_count > 0
  884.       # ウェイトカウントを減らす
  885.       @phase5_wait_count -= 1
  886.       # ウェイトカウントが 0 になった場合
  887.       if @phase5_wait_count == 0
  888.         # リザルトウィンドウを表示
  889.         @result_window.visible = true
  890.         # メインフェーズフラグをクリア
  891.         $game_temp.battle_main_phase = false
  892.         # ステータスウィンドウをリフレッシュ
  893.         @status_window.refresh
  894.         for actor in $game_party.actors
  895.           if actor.damage.include?([actor, 0])
  896.             @phase5_wait_count = 20
  897.             actor.damage_pop[[actor, 0]] = true
  898.           end
  899.           if actor.damage.include?([actor, -1])
  900.             @phase5_wait_count = 20
  901.             actor.damage_pop[[actor, -1]] = true
  902.             for level in actor.level - actor.up_level + 1..actor.level
  903.               for skill in $data_classes[actor.class_id].learnings
  904.                 if level == skill.level and not actor.skill_learn?(skill.id)
  905.                   actor.damage[[actor, 0]] = "New Skill!"
  906.                   break
  907.                 end
  908.               end
  909.             end
  910.           end
  911.         end
  912.       end
  913.       return
  914.     end
  915.     # C ボタンが押された場合
  916.     if Input.trigger?(Input::C)
  917.       # バトル終了
  918.       battle_end(0)
  919.     end
  920.   end

  921. #==============================================================================
  922. # ■ Scene_Battle (分割定義 3)
  923. #------------------------------------------------------------------------------
  924. #  バトル画面の処理を行うクラスです。
  925. #==============================================================================

  926.   #--------------------------------------------------------------------------
  927.   # ● アクターコマンドフェーズ開始
  928.   #--------------------------------------------------------------------------
  929.   def start_phase3
  930.     if victory?
  931.       return
  932.     end
  933.     # メインフェーズフラグをクリア
  934.     $game_temp.battle_main_phase = false
  935.     @command_a = true
  936.     @active_actor = @command[0]
  937.     cnt = 0
  938.     for actor in $game_party.actors
  939.       if actor == @active_actor
  940.         @actor_index = cnt
  941.       end
  942.       cnt += 1
  943.     end
  944.     @active_actor.blink = true
  945.     unless @active_actor.inputable?
  946.       @active_actor.current_action.clear
  947.       phase3_next_actor
  948.       return
  949.     end
  950.     phase3_setup_command_window
  951.     # カメラの設定
  952.     @camera = "command"
  953.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  954.     y = [(plus.abs - 1.5) * 10 , 0].min
  955.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ● アクターのコマンド入力終了
  959.   #--------------------------------------------------------------------------
  960.   def phase3_next_actor
  961.     @command.shift
  962.     @command_a = false
  963.     # メインフェーズフラグをセット
  964.     $game_temp.battle_main_phase = true
  965.     # アクターコマンドウィンドウを無効化
  966.     @actor_command_window.active = false
  967.     @actor_command_window.visible = false
  968.     # アクターの明滅エフェクト OFF
  969.     if @active_actor != nil
  970.       @active_actor.blink = false
  971.     end
  972.     action_start(@active_actor)
  973.     # カメラを元に戻す
  974.     if @camera == "command"
  975.       @spriteset.screen_target(0, 0, 1)
  976.     end
  977.     return
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● アクターコマンドウィンドウのセットアップ
  981.   #--------------------------------------------------------------------------
  982.   def phase3_setup_command_window
  983. #------------------------------------------------------------------------------
  984. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  985.     # パーティコマンドウィンドウを無効化
  986. #    @party_command_window.active = false
  987. #    @party_command_window.visible = false
  988. #------------------------------------------------------------------------------  
  989.     # アクターコマンドウィンドウを有効化
  990.     @actor_command_window.active = true
  991.     @actor_command_window.visible = true
  992.     # アクターコマンドウィンドウの位置を設定
  993.     @actor_command_window.x = @actor_index * 160 +
  994.                               (4 - $game_party.actors.size) * 80
  995.     # インデックスを 0 に設定
  996.     @actor_command_window.index = 0
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ● エネミーアクション作成
  1000.   #--------------------------------------------------------------------------
  1001.   def enemy_action(number)
  1002.     enemy = $game_troop.enemies[number]
  1003.     unless enemy.current_action.forcing
  1004.       enemy.make_action
  1005.     end
  1006.     action_start(enemy)
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ● フレーム更新 (アクターコマンドフェーズ)
  1010.   #--------------------------------------------------------------------------
  1011.   def update_phase3
  1012.     if victory? and @command_a
  1013.       command_delete
  1014.       @command.push(@active_actor)
  1015.       return
  1016.     end
  1017.     # エネミーアローが有効の場合
  1018.     if @enemy_arrow != nil
  1019.       update_phase3_enemy_select
  1020.     # アクターアローが有効の場合
  1021.     elsif @actor_arrow != nil
  1022.       update_phase3_actor_select
  1023.     # スキルウィンドウが有効の場合
  1024.     elsif @skill_window != nil
  1025.       update_phase3_skill_select
  1026.     # アイテムウィンドウが有効の場合
  1027.     elsif @item_window != nil
  1028.       update_phase3_item_select
  1029.     # アクターコマンドウィンドウが有効の場合
  1030.     elsif @actor_command_window.active
  1031.       update_phase3_basic_command
  1032.     end
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  1036.   #--------------------------------------------------------------------------
  1037.   def update_phase3_basic_command
  1038.     unless @active_actor.inputable?
  1039.       @active_actor.current_action.clear
  1040.       phase3_next_actor
  1041.       return
  1042.     end
  1043. #--------------------------------------------------------------------------
  1044. #RTAB观光游第一站,去除“战斗/逃跑”选项部分
  1045. # B ボタンが押された場合
  1046. #   if Input.trigger?(Input::B) and @party == false
  1047.       # キャンセル SE を演奏
  1048. #     $game_system.se_play($data_system.cancel_se)
  1049. #     @party = true
  1050. #   end
  1051. #   if @party == true and
  1052. #       ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  1053. #       (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  1054.       # パーティコマンドフェーズへ
  1055. #     start_phase2
  1056. #     return
  1057. #   end
  1058. #==============================================================================
  1059. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1060. #==============================================================================
  1061.     # A : SKILL
  1062.     if Input.trigger?(Input::X)
  1063.       # 決定 SE を演奏
  1064.       $game_system.se_play($data_system.decision_se)
  1065.       # スキルの選択を開始
  1066.       start_skill_select
  1067.       return
  1068.     end
  1069.     # S : 防御
  1070.     if Input.trigger?(Input::Y)
  1071.       # 決定 SE を演奏
  1072.       $game_system.se_play($data_system.decision_se)
  1073.       # アクションを設定
  1074.       @active_actor.current_action.kind = 0
  1075.       @active_actor.current_action.basic = 1
  1076.       # 次のアクターのコマンド入力へ
  1077.       phase3_next_actor
  1078.       return
  1079.     end
  1080.     # D : ITEM
  1081.     if Input.trigger?(Input::Z)
  1082.       # 決定 SE を演奏
  1083.       $game_system.se_play($data_system.decision_se)
  1084.       # アイテムの選択を開始
  1085.       start_item_select
  1086.       return
  1087.     end
  1088. #==============================================================================
  1089.     # C ボタンが押された場合
  1090.     if Input.trigger?(Input::C)
  1091. #------------------------------------------------------------------------------
  1092. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1093. #      @party = false
  1094. #------------------------------------------------------------------------------
  1095.       # アクターコマンドウィンドウのカーソル位置で分岐
  1096.       case @actor_command_window.index
  1097.       when 0  # 攻撃
  1098. #==============================================================================
  1099. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1100. #==============================================================================        
  1101.         if victory?
  1102.           # ブザー SE を演奏
  1103.           $game_system.se_play($data_system.buzzer_se)
  1104.           return
  1105.         end
  1106. #==============================================================================        
  1107.         # 決定 SE を演奏
  1108.         $game_system.se_play($data_system.decision_se)
  1109.         # エネミーの選択を開始
  1110.         start_enemy_select
  1111.       when 1  # スキル
  1112.         # 決定 SE を演奏
  1113.         $game_system.se_play($data_system.decision_se)
  1114.         # スキルの選択を開始
  1115.         start_skill_select
  1116.       when 2  # 防御
  1117.         # 決定 SE を演奏
  1118.         $game_system.se_play($data_system.decision_se)
  1119.         # アクションを設定
  1120.         @active_actor.current_action.kind = 0
  1121.         @active_actor.current_action.basic = 1
  1122.         # 次のアクターのコマンド入力へ
  1123.         phase3_next_actor
  1124.       when 3  # アイテム
  1125.         # 決定 SE を演奏
  1126.         $game_system.se_play($data_system.decision_se)
  1127.         # アイテムの選択を開始
  1128.         start_item_select
  1129. #==============================================================================
  1130. #RTAB观光游第三站,战斗菜单增加逃跑选项
  1131. #==============================================================================
  1132.       when 4 #逃跑(添加内容)
  1133.         if $game_temp.battle_can_escape == false
  1134.           # ブザー SE を演奏
  1135.           $game_system.se_play($data_system.buzzer_se)
  1136.           return
  1137.        end
  1138.         # 決定 SE を演奏
  1139.         $game_system.se_play($data_system.decision_se)
  1140.        @phase = 0
  1141.         # パーティコマンドウィンドウを無効化
  1142.         @actor_command_window.active = false
  1143.         @actor_command_window.visible = false
  1144.         $game_temp.battle_main_phase = true
  1145.         if $game_temp.battle_turn == 0
  1146.           update_phase2_escape
  1147.          $game_temp.battle_turn = 1
  1148.          for battler in $game_party.actors
  1149.             battler.at -= @max / 2
  1150.           end
  1151.           return
  1152.        end
  1153.        # 決定 SE を演奏
  1154.         $game_system.se_play($data_system.decision_se)
  1155.         @escape = true
  1156.         for battler in $game_party.actors
  1157.           @command_a = false
  1158.           @command.delete(battler)
  1159.           @action_battlers.delete(battler)
  1160.           skill_reset(battler)
  1161.         end
  1162. #==============================================================================        
  1163.       end
  1164.       return
  1165.     end
  1166.     # キャラチェンジ
  1167.     if @command.size > 1
  1168.       # R ボタンが押された場合
  1169.       if Input.trigger?(Input::L)
  1170.         $game_system.se_play($data_system.cursor_se)
  1171. #------------------------------------------------------------------------------
  1172. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1173.        # @party = false
  1174. #------------------------------------------------------------------------------      
  1175.         # アクターの明滅エフェクト OFF
  1176.         if @active_actor != nil
  1177.           @active_actor.blink = false
  1178.         end
  1179.         @command.push(@command[0])
  1180.         @command.shift
  1181.         @command_a = false
  1182.         # 新たなコマンドウィンドウの立ち上げ
  1183.         start_phase3
  1184.       end
  1185.       # L ボタンが押された場合
  1186.       if Input.trigger?(Input::R)
  1187.         $game_system.se_play($data_system.cursor_se)
  1188. #------------------------------------------------------------------------------
  1189. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1190.      #   @party = false
  1191. #------------------------------------------------------------------------------      
  1192.         # アクターの明滅エフェクト OFF
  1193.         if @active_actor != nil
  1194.           @active_actor.blink = false
  1195.         end
  1196.         @command.unshift(@command[@command.size - 1])
  1197.         @command.delete_at(@command.size - 1)
  1198.         @command_a = false
  1199.         # 新たなコマンドウィンドウの立ち上げ
  1200.         start_phase3
  1201.       end
  1202.       # 右 ボタンが押された場合
  1203.       if Input.trigger?(Input::RIGHT)
  1204.         $game_system.se_play($data_system.cursor_se)
  1205. #------------------------------------------------------------------------------
  1206. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1207.    #     @party = false
  1208. #------------------------------------------------------------------------------      
  1209.         # アクターの明滅エフェクト OFF
  1210.         if @active_actor != nil
  1211.           @active_actor.blink = false
  1212.         end
  1213.         actor = $game_party.actors[@actor_index]
  1214.         while actor == @command[0] or (not @command.include?(actor))
  1215.           @actor_index += 1
  1216.           @actor_index %= $game_party.actors.size
  1217.           actor = $game_party.actors[@actor_index]
  1218.           if actor == @command[0]
  1219.             break
  1220.           end
  1221.         end
  1222.         while actor != @command[0]
  1223.           @command.push(@command.shift)
  1224.         end
  1225.         @command_a = false
  1226.         # 新たなコマンドウィンドウの立ち上げ
  1227.         start_phase3
  1228.       end
  1229.       # 左 ボタンが押された場合
  1230.       if Input.trigger?(Input::LEFT)
  1231.         $game_system.se_play($data_system.cursor_se)
  1232. #------------------------------------------------------------------------------
  1233. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1234.    #     @party = false
  1235. #------------------------------------------------------------------------------
  1236.         # アクターの明滅エフェクト OFF
  1237.         if @active_actor != nil
  1238.           @active_actor.blink = false
  1239.         end
  1240.         actor = $game_party.actors[@actor_index]
  1241.         while actor == @command[0] or (not @command.include?(actor))
  1242.           @actor_index -= 1
  1243.           @actor_index %= $game_party.actors.size
  1244.           actor = $game_party.actors[@actor_index]
  1245.           if actor == @command[0]
  1246.             break
  1247.           end
  1248.         end
  1249.         while actor != @command[0]
  1250.           @command.push(@command.shift)
  1251.         end
  1252.         @command_a = false
  1253.         # 新たなコマンドウィンドウの立ち上げ
  1254.         start_phase3
  1255.       end
  1256.     end
  1257.   end
  1258.   #--------------------------------------------------------------------------
  1259.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1260.   #--------------------------------------------------------------------------
  1261.   def update_phase3_skill_select
  1262.     # コマンド選択中に行動不能になった場合
  1263.     unless @active_actor.inputable?
  1264.       @active_actor.current_action.clear
  1265.       command_delete
  1266.       # 次のアクターのコマンド入力へ
  1267.       phase3_next_actor
  1268.       return
  1269.     end
  1270.     # スキルウィンドウを可視状態にする
  1271.     @skill_window.visible = true
  1272.     # スキルウィンドウを更新
  1273.     @skill_window.update
  1274.     # B ボタンが押された場合
  1275.     if Input.trigger?(Input::B)
  1276.       # キャンセル SE を演奏
  1277.       $game_system.se_play($data_system.cancel_se)
  1278.       # スキルの選択を終了
  1279.       end_skill_select
  1280.       return
  1281.     end
  1282.     # C ボタンが押された場合
  1283.     if Input.trigger?(Input::C)
  1284.       # スキルウィンドウで現在選択されているデータを取得
  1285.       @skill = @skill_window.skill
  1286.       # 使用できない場合
  1287.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1288.         # ブザー SE を演奏
  1289.         $game_system.se_play($data_system.buzzer_se)
  1290.         return
  1291.       end
  1292.       # 決定 SE を演奏
  1293.       $game_system.se_play($data_system.decision_se)
  1294.       # アクションを設定
  1295.       @active_actor.current_action.skill_id = @skill.id
  1296.       # スキルウィンドウを不可視状態にする
  1297.       @skill_window.visible = false
  1298.       # 効果範囲が敵単体の場合
  1299.       if @skill.scope == 1
  1300.         # エネミーの選択を開始
  1301.         start_enemy_select
  1302.       # 効果範囲が味方単体の場合
  1303.       elsif @skill.scope == 3 or @skill.scope == 5
  1304.         # アクターの選択を開始
  1305.         start_actor_select
  1306.       # 効果範囲が単体ではない場合
  1307.       else
  1308.         # アクションを設定
  1309.         @active_actor.current_action.kind = 1
  1310.         # スキルの選択を終了
  1311.         end_skill_select
  1312.         # 次のアクターのコマンド入力へ
  1313.         phase3_next_actor
  1314.       end
  1315.       return
  1316.     end
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1320.   #--------------------------------------------------------------------------
  1321.   def update_phase3_item_select
  1322.     # コマンド選択中に行動不能になった場合
  1323.     unless @active_actor.inputable?
  1324.       @active_actor.current_action.clear
  1325.       command_delete
  1326.       # 次のアクターのコマンド入力へ
  1327.       phase3_next_actor
  1328.       return
  1329.     end
  1330.     # アイテムウィンドウを可視状態にする
  1331.     @item_window.visible = true
  1332.     # アイテムウィンドウを更新
  1333.     @item_window.update
  1334.     # B ボタンが押された場合
  1335.     if Input.trigger?(Input::B)
  1336.       # キャンセル SE を演奏
  1337.       $game_system.se_play($data_system.cancel_se)
  1338.       # アイテムの選択を終了
  1339.       end_item_select
  1340.       return
  1341.     end
  1342.     # C ボタンが押された場合
  1343.     if Input.trigger?(Input::C)
  1344.       # アイテムウィンドウで現在選択されているデータを取得
  1345.       @item = @item_window.item
  1346.       # 使用できない場合
  1347.       unless $game_party.item_can_use?(@item.id)
  1348.         # ブザー SE を演奏
  1349.         $game_system.se_play($data_system.buzzer_se)
  1350.         return
  1351.       end
  1352.       # 決定 SE を演奏
  1353.       $game_system.se_play($data_system.decision_se)
  1354.       # アクションを設定
  1355.       @active_actor.current_action.item_id = @item.id
  1356.       # アイテムウィンドウを不可視状態にする
  1357.       @item_window.visible = false
  1358.       # 効果範囲が敵単体の場合
  1359.       if @item.scope == 1
  1360.         # エネミーの選択を開始
  1361.         start_enemy_select
  1362.       # 効果範囲が味方単体の場合
  1363.       elsif @item.scope == 3 or @item.scope == 5
  1364.         # アクターの選択を開始
  1365.         start_actor_select
  1366.       # 効果範囲が単体ではない場合
  1367.       else
  1368.         # アクションを設定
  1369.         @active_actor.current_action.kind = 2
  1370.         # アイテムの選択を終了
  1371.         end_item_select
  1372.         # 次のアクターのコマンド入力へ
  1373.         phase3_next_actor
  1374.       end
  1375.       return
  1376.     end
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1380.   #--------------------------------------------------------------------------
  1381.   def update_phase3_enemy_select
  1382.     # コマンド選択中に行動不能になった場合
  1383.     unless @active_actor.inputable?
  1384.       # カメラを元に戻す
  1385.       if @camera == "select"
  1386.         @spriteset.screen_target(0, 0, 1)
  1387.       end
  1388.       @active_actor.current_action.clear
  1389.       command_delete
  1390.       # 次のアクターのコマンド入力へ
  1391.       phase3_next_actor
  1392.       return
  1393.     end
  1394.     # エネミーアローを更新
  1395.     @enemy_arrow.update
  1396.     # B ボタンが押された場合
  1397.     if Input.trigger?(Input::B)
  1398.       # キャンセル SE を演奏
  1399.       $game_system.se_play($data_system.cancel_se)
  1400.       # カメラを元に戻す
  1401.       if @camera == "select"
  1402.         # カメラの設定
  1403.         @camera = "command"
  1404.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1405.         y = [(plus.abs - 1.5) * 10 , 0].min
  1406.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1407.       end
  1408.       # エネミーの選択を終了
  1409.       end_enemy_select
  1410.       return
  1411.     end
  1412.     # C ボタンが押された場合
  1413.     if Input.trigger?(Input::C)
  1414.       # 決定 SE を演奏
  1415.       $game_system.se_play($data_system.decision_se)
  1416.       # アクションを設定
  1417.       @active_actor.current_action.kind = 0
  1418.       @active_actor.current_action.basic = 0
  1419.       @active_actor.current_action.target_index = @enemy_arrow.index
  1420.       # スキルウィンドウ表示中の場合
  1421.       if @skill_window != nil
  1422.         # アクションを再設定
  1423.         @active_actor.current_action.kind = 1
  1424.         # スキルの選択を終了
  1425.         end_skill_select
  1426.       end
  1427.       # アイテムウィンドウ表示中の場合
  1428.       if @item_window != nil
  1429.         # アクションを再設定
  1430.         @active_actor.current_action.kind = 2
  1431.         # アイテムの選択を終了
  1432.         end_item_select
  1433.       end
  1434.       # エネミーの選択を終了
  1435.       end_enemy_select
  1436.       # 次のアクターのコマンド入力へ
  1437.       phase3_next_actor
  1438.     end
  1439.   end
  1440.   #--------------------------------------------------------------------------
  1441.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1442.   #--------------------------------------------------------------------------
  1443.   def update_phase3_actor_select
  1444.     # コマンド選択中に行動不能になった場合
  1445.     unless @active_actor.inputable?
  1446.       @active_actor.current_action.clear
  1447.       command_delete
  1448.       # 次のアクターのコマンド入力へ
  1449.       phase3_next_actor
  1450.       return
  1451.     end
  1452.     # アクターアローを更新
  1453.     @actor_arrow.update
  1454.     # B ボタンが押された場合
  1455.     if Input.trigger?(Input::B)
  1456.       # キャンセル SE を演奏
  1457.       $game_system.se_play($data_system.cancel_se)
  1458.       # アクターの選択を終了
  1459.       end_actor_select
  1460.       return
  1461.     end
  1462.     # C ボタンが押された場合
  1463.     if Input.trigger?(Input::C)
  1464.       # 決定 SE を演奏
  1465.       $game_system.se_play($data_system.decision_se)
  1466.       # アクションを設定
  1467.       @active_actor.current_action.kind = 0
  1468.       @active_actor.current_action.basic = 0
  1469.       @active_actor.current_action.target_index = @actor_arrow.index
  1470.       # アクターの選択を終了
  1471.       end_actor_select
  1472.       # スキルウィンドウ表示中の場合
  1473.       if @skill_window != nil
  1474.         # アクションを再設定
  1475.         @active_actor.current_action.kind = 1
  1476.         # スキルの選択を終了
  1477.         end_skill_select
  1478.       end
  1479.       # アイテムウィンドウ表示中の場合
  1480.       if @item_window != nil
  1481.         # アクションを再設定
  1482.         @active_actor.current_action.kind = 2
  1483.         # アイテムの選択を終了
  1484.         end_item_select
  1485.       end
  1486.       # 次のアクターのコマンド入力へ
  1487.       phase3_next_actor
  1488.     end
  1489.   end
  1490.   #--------------------------------------------------------------------------
  1491.   # ● エネミー選択開始
  1492.   #--------------------------------------------------------------------------
  1493.   alias :start_enemy_select_rtab :start_enemy_select
  1494.   def start_enemy_select
  1495.     @camera = "select"
  1496.     for enemy in $game_troop.enemies
  1497.       if enemy.exist?
  1498.         zoom = 1 / enemy.zoom
  1499.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1500.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1501.         break
  1502.       end
  1503.     end
  1504.     # オリジナルの処理
  1505.     start_enemy_select_rtab
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # ● エネミー選択終了
  1509.   #--------------------------------------------------------------------------
  1510.   alias :end_enemy_select_rtab :end_enemy_select
  1511.   def end_enemy_select
  1512.     # オリジナルの処理
  1513.     end_enemy_select_rtab
  1514.     if (@action == 0 and not @action_battlers.empty?) or
  1515.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1516.                                             @active_actor.animation1_id != 0))
  1517.       @spriteset.screen_target(0, 0, 1)
  1518.     end
  1519.   end
  1520.   #--------------------------------------------------------------------------
  1521.   # ● スキル選択開始
  1522.   #--------------------------------------------------------------------------
  1523.   def start_skill_select
  1524.     # スキルウィンドウを作成
  1525.     @skill_window = Window_Skill.new(@active_actor)
  1526.     # ヘルプウィンドウを関連付け
  1527.     @skill_window.help_window = @help_window
  1528.     # アクターコマンドウィンドウを無効化
  1529.     @actor_command_window.active = false
  1530.     @actor_command_window.visible = false
  1531.   end

  1532. #==============================================================================
  1533. # ■ Scene_Battle (分割定義 4)
  1534. #------------------------------------------------------------------------------
  1535. #  バトル画面の処理を行うクラスです。
  1536. #==============================================================================

  1537.   #--------------------------------------------------------------------------
  1538.   # ● メインフェーズ開始
  1539.   #--------------------------------------------------------------------------
  1540.   def start_phase4
  1541.     $game_temp.battle_main_phase = true
  1542.   end
  1543.   #--------------------------------------------------------------------------
  1544.   # ● フレーム更新 (メインフェーズ)
  1545.   #--------------------------------------------------------------------------
  1546.   def update_phase4
  1547.     # アクションを強制されているバトラーが存在する場合
  1548.     if $game_temp.forcing_battler != nil
  1549.       battler = $game_temp.forcing_battler
  1550.       if battler.current_action.forcing == false
  1551.         if @action_battlers.include?(battler)
  1552.           if @action > 0 or @action_battlers[0].phase == 1
  1553.             @action_battlers.delete(battler)
  1554.             @action_battlers.push(battler)
  1555.           end
  1556.           if battler.phase == 1
  1557.             battler.current_action.forcing = true
  1558.             force_action(battler)
  1559.           end
  1560.         else
  1561.           battler.current_action.forcing = true
  1562.           force_action(battler)
  1563.           action_start(battler)
  1564.           @action_battlers.delete(battler)
  1565.           @action_battlers.push(battler)
  1566.         end
  1567.         battler.at = @max
  1568.         battler.atp = 100 * battler.at / @max
  1569.       end
  1570.     end
  1571.     # action が1以上の場合、一斉に行動を起こす
  1572.     for battler in @action_battlers.reverse
  1573.       # ウェイト中の場合
  1574.       if battler.wait > 0
  1575.         # ウェイトカウントを減らす
  1576.         battler.wait -= 1
  1577.         break if @action == 0
  1578.         next
  1579.       end
  1580.       unless fin? and battler.phase < 3 and
  1581.           not $game_system.battle_interpreter.running?
  1582.         action_phase(battler)
  1583.       end
  1584.       break if @action == 0
  1585.     end
  1586.     # アクションを強制されているバトラーが存在しない場合
  1587.     if $game_temp.forcing_battler == nil
  1588.       # バトルイベントをセットアップ
  1589.       setup_battle_event
  1590.       # バトルイベント実行中の場合
  1591.       if $game_system.battle_interpreter.running?
  1592.         return
  1593.       end
  1594.     end
  1595.     # 勝敗を決した際の処理
  1596.     if fin?
  1597.       # 敗北時、指定時間ウェイト
  1598.       if $game_party.all_dead? and @after_wait[0] > 0
  1599.         @after_wait[0] -= 1
  1600.         return
  1601.       end
  1602.       # 勝利時、指定時間ウェイト
  1603.       if victory? and @after_wait[1] > 0
  1604.         @after_wait[1] -= 1
  1605.         return
  1606.       end
  1607.       # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1608.       for battler in @action_battlers.reverse
  1609.         if battler.phase < 3 and not $game_system.battle_interpreter.running?
  1610.           @action_battlers.delete(battler)
  1611.         end
  1612.       end
  1613.       # 勝敗判定
  1614.       if @action_battlers.empty? and
  1615.           not $game_system.battle_interpreter.running?
  1616.         judge
  1617.       end
  1618.     end
  1619.   end
  1620.   #--------------------------------------------------------------------------
  1621.   # ● アクション更新 (メインフェーズ)
  1622.   #--------------------------------------------------------------------------
  1623.   def action_phase(battler)
  1624.     # action が 1 の場合、バトラーが行動中かどうか確認
  1625.     if @action == 1 and battler.phase <= 3
  1626.       for target in battler.target
  1627.         speller = synthe?(target)
  1628.         if speller == nil
  1629.           # ターゲットが通常行動中の場合
  1630.           if @action_battlers.include?(target)
  1631.             if target.phase > 2
  1632.               return
  1633.             end
  1634.           end
  1635.         else
  1636.           # ターゲットが連携スキル発動中の場合
  1637.           for spell in speller
  1638.             if @action_battlers.include?(spell)
  1639.               if spell.phase > 2
  1640.                 return
  1641.               end
  1642.             end
  1643.           end
  1644.         end
  1645.       end
  1646.     end
  1647.     case battler.phase
  1648.     when 1
  1649.       update_phase4_step1(battler)
  1650.     when 2
  1651.       update_phase4_step2(battler)
  1652.     when 3
  1653.       update_phase4_step3(battler)
  1654.     when 4
  1655.       update_phase4_step4(battler)
  1656.     when 5
  1657.       update_phase4_step5(battler)
  1658.     when 6
  1659.       update_phase4_step6(battler)
  1660.     end
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1664.   #--------------------------------------------------------------------------
  1665.   def update_phase4_step1(battler)
  1666.     # すでに戦闘から外されている場合
  1667.     if battler.index == nil
  1668.       @action_battlers.delete(battler)
  1669.       anime_wait_return
  1670.       return
  1671.     end
  1672.     speller = synthe?(battler)
  1673.     if speller == nil
  1674.       # ダメージ食らい中の場合
  1675.       unless battler.damage.empty? or @action > 2
  1676.         return
  1677.       end
  1678.       # 行動可能かどうか判定
  1679.       unless battler.movable?
  1680.         battler.phase = 6
  1681.         return
  1682.       end
  1683.     else
  1684.       # ダメージ食らい中の場合
  1685.       for spell in speller
  1686.         unless spell.damage.empty? or @action > 2
  1687.           return
  1688.         end
  1689.         # 行動可能かどうか判定
  1690.         unless spell.movable?
  1691.           battler.phase = 6
  1692.           return
  1693.         end
  1694.       end
  1695.     end
  1696.     # スキル使用時、詠唱時間設定
  1697.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1698.     if battler.current_action.kind == 1 and
  1699.       (not battler.current_action.forcing or @force != 2)
  1700.       if battler.rtp == 0
  1701.         # スキル詠唱中ならば、解除
  1702.         skill_reset(battler)
  1703.         # スキル詠唱時間設定
  1704.         recite_time(battler)
  1705.         # 連携技設定
  1706.         synthe_spell(battler)
  1707.         # スキルを詠唱する場合
  1708.         if battler.rtp > 0
  1709.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1710.           speller = synthe?(battler)
  1711.           if battler.current_action.forcing and @force > 0 and speller != nil
  1712.             for spell in speller
  1713.               spell.rt = spell.rtp
  1714.             end
  1715.           else
  1716.             battler.blink = true
  1717.             if battler.current_action.forcing
  1718.               $game_temp.forcing_battler = nil
  1719.               battler.current_action.forcing = false
  1720.             end
  1721.             @action_battlers.delete(battler)
  1722.             return
  1723.           end
  1724.         end
  1725.       end
  1726.     end
  1727.     # アクターの明滅エフェクト OFF
  1728.     if battler != nil
  1729.       battler.blink = false
  1730.     end
  1731.     speller = synthe?(battler)
  1732.     if speller == nil
  1733.       @spell_p.delete(battler)
  1734.       @spell_e.delete(battler)
  1735.     else
  1736.       for spell in speller
  1737.         spell.blink = false
  1738.         @spell_p.delete(spell)
  1739.         @spell_e.delete(spell)
  1740.       end
  1741.     end
  1742.     # ステップ 2 に移行
  1743.     battler.phase = 2
  1744.   end
  1745.   #--------------------------------------------------------------------------
  1746.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1747.   #--------------------------------------------------------------------------
  1748.   def update_phase4_step2(battler)
  1749.     # 強制アクションでなければ
  1750.     unless battler.current_action.forcing
  1751.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1752.       if battler.restriction == 2 or battler.restriction == 3
  1753.         # アクションに攻撃を設定
  1754.         battler.current_action.kind = 0
  1755.         battler.current_action.basic = 0
  1756.       end
  1757.     end
  1758.     # アクションの種別で分岐
  1759.     case battler.current_action.kind
  1760.     when 0  # 基本
  1761.       if fin?
  1762.         battler.phase = 6
  1763.         return
  1764.       end
  1765.       make_basic_action_result(battler)
  1766.     when 1  # スキル
  1767.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1768.         battler.phase = 6
  1769.         return
  1770.       end
  1771.       make_skill_action_result(battler)
  1772.     when 2  # アイテム
  1773.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1774.         battler.phase = 6
  1775.         return
  1776.       end
  1777.       make_item_action_result(battler)
  1778.     end
  1779.     if battler.phase == 2
  1780.       # ステップ 3 に移行
  1781.       battler.phase = 3
  1782.     end
  1783.   end
  1784.   #--------------------------------------------------------------------------
  1785.   # ● 基本アクション 結果作成
  1786.   #--------------------------------------------------------------------------
  1787.   def make_basic_action_result(battler)
  1788.     # 攻撃の場合
  1789.     if battler.current_action.basic == 0
  1790.       # アニメーション ID を設定
  1791.       battler.anime1 = battler.animation1_id
  1792.       battler.anime2 = battler.animation2_id
  1793.       # 行動側バトラーがエネミーの場合
  1794.       if battler.is_a?(Game_Enemy)
  1795.         if battler.restriction == 3
  1796.           target = $game_troop.random_target_enemy
  1797.         elsif battler.restriction == 2
  1798.           target = $game_party.random_target_actor
  1799.         else
  1800.           index = battler.current_action.target_index
  1801.           target = $game_party.smooth_target_actor(index)
  1802.         end
  1803.       end
  1804.       # 行動側バトラーがアクターの場合
  1805.       if battler.is_a?(Game_Actor)
  1806.         if battler.restriction == 3
  1807.           target = $game_party.random_target_actor
  1808.         elsif battler.restriction == 2
  1809.           target = $game_troop.random_target_enemy
  1810.         else
  1811.           index = battler.current_action.target_index
  1812.           target = $game_troop.smooth_target_enemy(index)
  1813.         end
  1814.       end
  1815.       # 対象側バトラーの配列を設定
  1816.       battler.target = [target]
  1817.       # 通常攻撃の効果を適用
  1818.       for target in battler.target
  1819.         target.attack_effect(battler)
  1820.       end
  1821.       return
  1822.     end
  1823.     # 防御の場合
  1824.     if battler.current_action.basic == 1
  1825.       return
  1826.     end
  1827.     # 逃げるの場合
  1828. #    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1829.       # 逃げる
  1830. #      @help_window.set_text("逃げる", 1)
  1831. #      @help_wait = @help_time
  1832. #      battler.escape
  1833. #      return
  1834. #    end
  1835. #========RTAB 1.16=====================================================   
  1836.     # 逃げるの場合
  1837.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1838.       return
  1839.     end
  1840. #======================================================================
  1841.     # 何もしないの場合
  1842.     if battler.current_action.basic == 3
  1843.       # ステップ 6 に移行
  1844.       battler.phase = 6
  1845.       return
  1846.     end
  1847.   end
  1848.   #--------------------------------------------------------------------------
  1849.   # ● スキルまたはアイテムの対象側バトラー設定
  1850.   #     scope : スキルまたはアイテムの効果範囲
  1851.   #--------------------------------------------------------------------------
  1852.   def set_target_battlers(scope, battler)
  1853.     # 行動側バトラーがエネミーの場合
  1854.     if battler.is_a?(Game_Enemy)
  1855.       # 効果範囲で分岐
  1856.       case scope
  1857.       when 1  # 敵単体
  1858.         index =battler.current_action.target_index
  1859.         battler.target.push($game_party.smooth_target_actor(index))
  1860.       when 2  # 敵全体
  1861.         for actor in $game_party.actors
  1862.           if actor.exist?
  1863.             battler.target.push(actor)
  1864.           end
  1865.         end
  1866.       when 3  # 味方単体
  1867.         index = battler.current_action.target_index
  1868.         battler.target.push($game_troop.smooth_target_enemy(index))
  1869.       when 4  # 味方全体
  1870.         for enemy in $game_troop.enemies
  1871.           if enemy.exist?
  1872.             battler.target.push(enemy)
  1873.           end
  1874.         end
  1875.       when 5  # 味方単体 (HP 0)
  1876.         index = battler.current_action.target_index
  1877.         enemy = $game_troop.enemies[index]
  1878.         if enemy != nil and enemy.hp0?
  1879.           battler.target.push(enemy)
  1880.         end
  1881.       when 6  # 味方全体 (HP 0)
  1882.         for enemy in $game_troop.enemies
  1883.           if enemy != nil and enemy.hp0?
  1884.             battler.target.push(enemy)
  1885.           end
  1886.         end
  1887.       when 7  # 使用者
  1888.         battler.target.push(battler)
  1889.       end
  1890.     end
  1891.     # 行動側バトラーがアクターの場合
  1892.     if battler.is_a?(Game_Actor)
  1893.       # 効果範囲で分岐
  1894.       case scope
  1895.       when 1  # 敵単体
  1896.         index = battler.current_action.target_index
  1897.         battler.target.push($game_troop.smooth_target_enemy(index))
  1898.       when 2  # 敵全体
  1899.         for enemy in $game_troop.enemies
  1900.           if enemy.exist?
  1901.             battler.target.push(enemy)
  1902.           end
  1903.         end
  1904.       when 3  # 味方単体
  1905.         index = battler.current_action.target_index
  1906.         battler.target.push($game_party.smooth_target_actor(index))
  1907.       when 4  # 味方全体
  1908.         for actor in $game_party.actors
  1909.           if actor.exist?
  1910.             battler.target.push(actor)
  1911.           end
  1912.         end
  1913.       when 5  # 味方単体 (HP 0)
  1914.         index = battler.current_action.target_index
  1915.         actor = $game_party.actors[index]
  1916.         if actor != nil and actor.hp0?
  1917.           battler.target.push(actor)
  1918.         end
  1919.       when 6  # 味方全体 (HP 0)
  1920.         for actor in $game_party.actors
  1921.           if actor != nil and actor.hp0?
  1922.             battler.target.push(actor)
  1923.           end
  1924.         end
  1925.       when 7  # 使用者
  1926.         battler.target.push(battler)
  1927.       end
  1928.     end
  1929.   end
  1930.   #--------------------------------------------------------------------------
  1931.   # ● スキルアクション 結果作成
  1932.   #--------------------------------------------------------------------------
  1933.   def make_skill_action_result(battler)
  1934.     # スキルを取得
  1935.     @skill = $data_skills[battler.current_action.skill_id]
  1936.     # 連携スキルであるかどうか確認
  1937.     speller = synthe?(battler)
  1938.     # 強制アクションでなければ
  1939.     unless battler.current_action.forcing
  1940.       # SP 切れなどで使用できなくなった場合
  1941.       if speller == nil
  1942.         unless battler.skill_can_use?(@skill.id)
  1943.           # ステップ 6 に移行
  1944.           battler.phase = 6
  1945.          return
  1946.         end
  1947.       end
  1948.     end
  1949.     # SP 消費
  1950.     temp = false
  1951.     if speller != nil
  1952.       for spell in speller
  1953.         if spell.current_action.spell_id == 0
  1954.           spell.sp -= @skill.sp_cost
  1955.         else
  1956.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1957.         end
  1958.         # ステータスウィンドウをリフレッシュ
  1959.         status_refresh(spell)
  1960.       end
  1961.     else
  1962.       battler.sp -= @skill.sp_cost
  1963.       # ステータスウィンドウをリフレッシュ
  1964.       status_refresh(battler)
  1965.     end
  1966.     # アニメーション ID を設定
  1967.     battler.anime1 = @skill.animation1_id
  1968.     battler.anime2 = @skill.animation2_id
  1969.     # コモンイベント ID を設定
  1970.     battler.event = @skill.common_event_id
  1971.     # 対象側バトラーを設定
  1972.     set_target_battlers(@skill.scope, battler)
  1973.     # スキルの効果を適用
  1974.     for target in battler.target
  1975.       if speller != nil
  1976.         damage = 0
  1977.         d_result = false
  1978.         effective = false
  1979.         state_p = []
  1980.         state_m = []
  1981.         for spell in speller
  1982.           if spell.current_action.spell_id != 0
  1983.             @skill = $data_skills[spell.current_action.spell_id]
  1984.           end
  1985.           effective |= target.skill_effect(spell, @skill)
  1986.           if target.damage[spell].class != String
  1987.             d_result = true
  1988.             damage += target.damage[spell]
  1989.           elsif effective
  1990.             effect = target.damage[spell]
  1991.           end
  1992.           state_p += target.state_p[spell]
  1993.           state_m += target.state_m[spell]
  1994.           target.damage.delete(spell)
  1995.           target.state_p.delete(spell)
  1996.           target.state_m.delete(spell)
  1997.         end
  1998.         if d_result
  1999.           target.damage[battler] = damage
  2000.         elsif effective
  2001.           target.damage[battler] = effect
  2002.         else
  2003.           target.damage[battler] = 0
  2004.         end
  2005.         target.state_p[battler] = state_p
  2006.         target.state_m[battler] = state_m
  2007.       else
  2008.         target.skill_effect(battler, @skill)
  2009.       end
  2010.     end
  2011.   end
  2012.   #--------------------------------------------------------------------------
  2013.   # ● アイテムアクション 結果作成
  2014.   #--------------------------------------------------------------------------
  2015.   def make_item_action_result(battler)
  2016.     # アイテムを取得
  2017.     @item = $data_items[battler.current_action.item_id]
  2018.     # アイテム切れなどで使用できなくなった場合
  2019.     unless $game_party.item_can_use?(@item.id)
  2020.       # ステップ 6 に移行
  2021.       battler.phase = 6
  2022.       return
  2023.     end
  2024.     # 消耗品の場合
  2025.     if @item.consumable
  2026.       # 使用したアイテムを 1 減らす
  2027.       $game_party.lose_item(@item.id, 1)
  2028.     end
  2029.     # アニメーション ID を設定
  2030.     battler.anime1 = @item.animation1_id
  2031.     battler.anime2 = @item.animation2_id
  2032.     # コモンイベント ID を設定
  2033.     battler.event = @item.common_event_id
  2034.     # 対象を決定
  2035.     index = battler.current_action.target_index
  2036.     target = $game_party.smooth_target_actor(index)
  2037.     # 対象側バトラーを設定
  2038.     set_target_battlers(@item.scope, battler)
  2039.     # アイテムの効果を適用
  2040.     for target in battler.target
  2041.       target.item_effect(@item, battler)
  2042.     end
  2043.   end
  2044.   #--------------------------------------------------------------------------
  2045.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2046.   #--------------------------------------------------------------------------
  2047.   def update_phase4_step3(battler)
  2048.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2049.     case battler.current_action.kind
  2050.     when 0  # 基本
  2051.       if battler.current_action.basic == 1
  2052.         @help_window.set_text($data_system.words.guard, 1)
  2053.         @help_wait = @help_time
  2054.       end
  2055. #========RTAB 1.16==================================      
  2056.       if battler.current_action.basic == 2
  2057.         # 逃げる
  2058.         @help_window.set_text("逃げる", 1)
  2059.         @help_wait = @help_time
  2060.         battler.escape
  2061.         battler.phase = 4
  2062.         return
  2063.       end
  2064. #===================================================        
  2065.     when 1  # スキル
  2066.       skill =  $data_skills[battler.current_action.skill_id]
  2067.       @help_window.set_text(skill.name, 1)
  2068.       @help_wait = @help_time
  2069.     when 2  # アイテム
  2070.       item = $data_items[battler.current_action.item_id]
  2071.       @help_window.set_text(item.name, 1)
  2072.       @help_wait = @help_time
  2073.     end
  2074.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2075.     if battler.anime1 == 0
  2076.       battler.white_flash = true
  2077.       battler.wait = 5
  2078.       # カメラ設定
  2079.       if battler.target[0].is_a?(Game_Enemy)
  2080.         camera_set(battler)
  2081.       end
  2082.     else
  2083.       battler.animation.push([battler.anime1, true])
  2084.       speller = synthe?(battler)
  2085.       if speller != nil
  2086.         for spell in speller
  2087.           if spell != battler
  2088.             if spell.current_action.spell_id == 0
  2089.               spell.animation.push([battler.anime1, true])
  2090.             else
  2091.               skill = spell.current_action.spell_id
  2092.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2093.               spell.current_action.spell_id = 0
  2094.             end
  2095.           end
  2096.         end
  2097.       end
  2098.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2099.     end
  2100.     # ステップ 4 に移行
  2101.     battler.phase = 4
  2102.   end
  2103.   #--------------------------------------------------------------------------
  2104.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2105.   #--------------------------------------------------------------------------
  2106.   def update_phase4_step4(battler)
  2107.     # カメラ設定
  2108.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2109.        camera_set(battler)
  2110.     end
  2111.     # 対象側アニメーション
  2112.     for target in battler.target
  2113.       target.animation.push([battler.anime2,
  2114.                                           (target.damage[battler] != "Miss")])
  2115.       unless battler.anime2 == 0
  2116.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2117.       end
  2118.     end
  2119.     # ステップ 5 に移行
  2120.     battler.phase = 5
  2121.   end
  2122.   #--------------------------------------------------------------------------
  2123.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2124.   #--------------------------------------------------------------------------
  2125.   def update_phase4_step5(battler)
  2126.     # ダメージ表示
  2127.     for target in battler.target
  2128.       if target.damage[battler] != nil
  2129.         target.damage_pop[battler] = true
  2130.         target.damage_effect(battler, battler.current_action.kind)
  2131.         battler.wait = @damage_wait
  2132.         # ステータスウィンドウをリフレッシュ
  2133.         status_refresh(target)
  2134.       end
  2135.     end
  2136.     # ステップ 6 に移行
  2137.     battler.phase = 6
  2138.   end
  2139.   #--------------------------------------------------------------------------
  2140.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2141.   #--------------------------------------------------------------------------
  2142.   def update_phase4_step6(battler)
  2143.     # カメラを戻す
  2144.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2145.       @spriteset.screen_target(0, 0, 1)
  2146.     end
  2147.     # スキルラーニング
  2148.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2149.       for target in battler.target
  2150.         skill_learning(target, target.class_id,
  2151.                         battler.current_action.skill_id)
  2152.       end
  2153.     end
  2154.     # アクション強制対象のバトラーをクリア
  2155.     if battler.current_action.forcing == true and
  2156.         battler.current_action.force_kind == 0 and
  2157.         battler.current_action.force_basic == 0 and
  2158.         battler.current_action.force_skill_id == 0
  2159.       $game_temp.forcing_battler = nil
  2160.       battler.current_action.forcing = false
  2161.     end
  2162.     refresh_phase(battler)
  2163.     speller = synthe?(battler)
  2164.     if speller != nil
  2165.       for spell in speller
  2166.         if spell != battler
  2167.           refresh_phase(spell)
  2168.         end
  2169.       end
  2170.       synthe_delete(speller)
  2171.     end
  2172.     # コモンイベント ID が有効の場合
  2173.     if battler.event > 0
  2174.       # イベントをセットアップ
  2175.       common_event = $data_common_events[battler.event]
  2176.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2177.     end
  2178.     act = 0
  2179.     for actor in $game_party.actors + $game_troop.enemies
  2180.       if actor.movable?
  2181.         act += 1
  2182.       end
  2183.     end
  2184.     if @turn_cnt >= act and act > 0
  2185.       @turn_cnt %= act
  2186.       $game_temp.battle_turn += 1
  2187.       # バトルイベントの全ページを検索
  2188.       for index in 0...$data_troops[@troop_id].pages.size
  2189.         # イベントページを取得
  2190.         page = $data_troops[@troop_id].pages[index]
  2191.         # このページのスパンが [ターン] の場合
  2192.         if page.span == 1
  2193.           # 実行済みフラグをクリア
  2194.           $game_temp.battle_event_flags[index] = false
  2195.         end
  2196.       end
  2197.     end
  2198.     battler.phase = 1
  2199.     @action_battlers.delete(battler)
  2200.   end
  2201.   #--------------------------------------------------------------------------
  2202.   # ● リフレッシュ
  2203.   #--------------------------------------------------------------------------
  2204.   def refresh_phase(battler)
  2205.     battler.at -= @max
  2206.     if battler.movable?
  2207.       battler.atp = 100 * battler.at / @max
  2208.     end
  2209.     spell_reset(battler)
  2210.     # スリップダメージ
  2211.     if battler.hp > 0 and battler.slip_damage?
  2212.       battler.slip_damage_effect
  2213.       battler.damage_pop["slip"] = true
  2214.     end
  2215.     # ステート自然解除
  2216.     battler.remove_states_auto
  2217.     # ステータスウィンドウをリフレッシュ
  2218.     status_refresh(battler, true)
  2219.     unless battler.movable?
  2220.       return
  2221.     end
  2222.     # ターン数カウント
  2223.     @turn_cnt += 1
  2224.   end
  2225.   #--------------------------------------------------------------------------
  2226.   # ● バトラーアクションスタート
  2227.   #--------------------------------------------------------------------------
  2228.   def action_start(battler)
  2229.     battler.phase = 1
  2230.     battler.anime1 = 0
  2231.     battler.anime2 = 0
  2232.     battler.target = []
  2233.     battler.event = 0
  2234.     @action_battlers.unshift(battler)
  2235.   end
  2236.   #--------------------------------------------------------------------------
  2237.   # ● ステータスウィンドウをリフレッシュ
  2238.   #--------------------------------------------------------------------------
  2239.   def status_refresh(battler, at = false)
  2240.     if battler.is_a?(Game_Actor)
  2241.       for i in 0...$game_party.actors.size
  2242.         if battler == $game_party.actors[i]
  2243.           number = i + 1
  2244.         end
  2245.       end
  2246.       @status_window.refresh(number)
  2247.       if at == true
  2248.         @status_window.at_refresh(number)
  2249.       end
  2250.     end
  2251.   end
  2252.   #--------------------------------------------------------------------------
  2253.   # ● アニメウェイト判断処理
  2254.   #--------------------------------------------------------------------------
  2255.   def anime_wait_return
  2256.     if (@action_battlers.empty? or @anime_wait == false) and
  2257.         not $game_system.battle_interpreter.running?
  2258.       # エネミーアローが有効の場合
  2259.       if @enemy_arrow != nil
  2260.         return [@active - 2, 0].min == 0
  2261.       # アクターアローが有効の場合
  2262.       elsif @actor_arrow != nil
  2263.         return [@active - 2, 0].min == 0
  2264.       # スキルウィンドウが有効の場合
  2265.       elsif @skill_window != nil
  2266.         return [@active - 3, 0].min == 0
  2267.       # アイテムウィンドウが有効の場合
  2268.       elsif @item_window != nil
  2269.         return [@active - 3, 0].min == 0
  2270.       # アクターコマンドウィンドウが有効の場合
  2271.       elsif @actor_command_window.active
  2272.         return [@active - 1, 0].min == 0
  2273.       else
  2274.         return true
  2275.       end
  2276.     else
  2277.       return false
  2278.     end
  2279.   end
  2280.   #--------------------------------------------------------------------------
  2281.   # ● アクターコマンド消去判断
  2282.   #--------------------------------------------------------------------------
  2283.   def command_delete
  2284.     # エネミーアローが有効の場合
  2285.     if @enemy_arrow != nil
  2286.       end_enemy_select
  2287.     # アクターアローが有効の場合
  2288.     elsif @actor_arrow != nil
  2289.       end_actor_select
  2290.     end
  2291.     # スキルウィンドウが有効の場合
  2292.     if @skill_window != nil
  2293.       end_skill_select
  2294.     # アイテムウィンドウが有効の場合
  2295.     elsif @item_window != nil
  2296.       end_item_select
  2297.     end
  2298.     # アクターコマンドウィンドウが有効の場合
  2299.     if @actor_command_window.active
  2300.       @command.shift
  2301.       @command_a = false
  2302.       # メインフェーズフラグをセット
  2303.       $game_temp.battle_main_phase = true
  2304.       # アクターコマンドウィンドウを無効化
  2305.       @actor_command_window.active = false
  2306.       @actor_command_window.visible = false
  2307.       # アクターの明滅エフェクト OFF
  2308.       if @active_actor != nil
  2309.         @active_actor.blink = false
  2310.       end
  2311.     end
  2312.   end
  2313.   #--------------------------------------------------------------------------
  2314.   # ● 強制アクション設定
  2315.   #--------------------------------------------------------------------------
  2316.   def force_action(battler)
  2317.     battler.current_action.kind = battler.current_action.force_kind
  2318.     battler.current_action.basic = battler.current_action.force_basic
  2319.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2320.     battler.current_action.force_kind = 0
  2321.     battler.current_action.force_basic = 0
  2322.     battler.current_action.force_skill_id = 0
  2323.   end
  2324.   #--------------------------------------------------------------------------
  2325.   # ● カメラセット
  2326.   #--------------------------------------------------------------------------
  2327.   def camera_set(battler)
  2328.     @camera = battler
  2329.     if battler.target.size == 1
  2330.       if battler.current_action.kind == 0
  2331.         zoom = 1.2 / battler.target[0].zoom
  2332.       elsif synthe?(battler) == nil
  2333.         zoom = 1.5 / battler.target[0].zoom
  2334.       else
  2335.         zoom = 2.0 / battler.target[0].zoom
  2336.       end
  2337.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2338.                                 battler.target[0].attack_y(zoom), zoom)
  2339.     else
  2340.       @spriteset.screen_target(0, 0, 0.75)
  2341.     end
  2342.   end
  2343.   #--------------------------------------------------------------------------
  2344.   # ● スキル詠唱タイム作成
  2345.   #--------------------------------------------------------------------------
  2346.   def recite_time(battler)
  2347.   end
  2348.   #--------------------------------------------------------------------------
  2349.   # ● 連携スキル判別
  2350.   #--------------------------------------------------------------------------
  2351.   def synthe_spell(battler)
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # ● スキルラーニングシステム
  2355.   #--------------------------------------------------------------------------
  2356.   def skill_learning(actor, class_id, skill_id)
  2357.   end
  2358.   #--------------------------------------------------------------------------
  2359.   # ● 行動可能判定
  2360.   #--------------------------------------------------------------------------
  2361.   def active?(battler)
  2362.     speller = synthe?(battler)
  2363.     if speller != nil
  2364.       if synthe_delete?(speller)
  2365.         return false
  2366.       end
  2367.     else
  2368.       unless battler.inputable?
  2369.         spell_reset(battler)
  2370.         unless battler.movable?
  2371.           battler.atp = 0
  2372.           return false
  2373.         end
  2374.       end
  2375.       if battler.current_action.forcing
  2376.         spell_reset(battler)
  2377.       end
  2378.     end
  2379.     return true
  2380.   end
  2381.   #--------------------------------------------------------------------------
  2382.   # ● 合成スキル詠唱中か?
  2383.   #--------------------------------------------------------------------------
  2384.   def synthe?(battler)
  2385.     for speller in @synthe
  2386.       if speller.include?(battler)
  2387.         return speller
  2388.       end
  2389.     end
  2390.     return nil
  2391.   end
  2392.   #--------------------------------------------------------------------------
  2393.   # ● 合成スキル消去判断
  2394.   #--------------------------------------------------------------------------
  2395.   def synthe_delete?(speller)
  2396.     for battler in speller
  2397.       if not battler.inputable? and dead_ok?(battler)
  2398.         synthe_delete(speller)
  2399.         return true
  2400.       end
  2401.     end
  2402.     return false
  2403.   end
  2404.   #--------------------------------------------------------------------------
  2405.   # ● 合成スキル消去
  2406.   #--------------------------------------------------------------------------
  2407.   def synthe_delete(speller)
  2408.     for battler in speller
  2409.       spell_reset(battler)
  2410.       if dead_ok?(battler)
  2411.         @action_battlers.delete(battler)
  2412.       end
  2413.     end
  2414.     @synthe.delete(speller)
  2415.   end
  2416.   #--------------------------------------------------------------------------
  2417.   # ● 連携含むスキル詠唱解除
  2418.   #--------------------------------------------------------------------------
  2419.   def skill_reset(battler)
  2420.     speller = synthe?(battler)
  2421.     if speller != nil
  2422.       synthe_delete(speller)
  2423.     else
  2424.       spell_reset(battler)
  2425.     end
  2426.   end
  2427.   #--------------------------------------------------------------------------
  2428.   # ● スキル詠唱解除
  2429.   #--------------------------------------------------------------------------
  2430.   def spell_reset(battler)
  2431.     battler.rt = 0
  2432.     battler.rtp = 0
  2433.     battler.blink = false
  2434.     battler.spell = false
  2435.     battler.current_action.spell_id = 0
  2436.     @spell_p.delete(battler)
  2437.     @spell_e.delete(battler)
  2438.   end
  2439.   #--------------------------------------------------------------------------
  2440.   # ● 戦闘終了判定
  2441.   #--------------------------------------------------------------------------
  2442.   def fin?
  2443.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2444.   end
  2445.   #--------------------------------------------------------------------------
  2446.   # ● 敵全滅判定
  2447.   #--------------------------------------------------------------------------
  2448.   def victory?
  2449.     for battler in $game_troop.enemies
  2450.       if not battler.hidden and (battler.rest_hp > 0 or
  2451.           battler.immortal or battler.damage_pop.size > 0)
  2452.         return false
  2453.       end
  2454.     end
  2455.     return true
  2456.   end
  2457.   #--------------------------------------------------------------------------
  2458.   # ● 死亡許可判定
  2459.   #--------------------------------------------------------------------------
  2460.   def dead_ok?(battler)
  2461.     speller = synthe?(battler)
  2462.     if speller == nil
  2463.       if @action_battlers.include?(battler)
  2464.         if battler.phase > 2
  2465.           return false
  2466.         end
  2467.       end
  2468.     else
  2469.       for battler in speller
  2470.         if @action_battlers.include?(battler)
  2471.           if battler.phase > 2
  2472.             return false
  2473.           end
  2474.         end
  2475.       end
  2476.     end
  2477.     return true
  2478.   end
  2479. end

  2480. #==============================================================================
  2481. # ■ Game_Actor
  2482. #------------------------------------------------------------------------------
  2483. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2484. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2485. #==============================================================================

  2486. class Game_Actor < Game_Battler
  2487.   #--------------------------------------------------------------------------
  2488.   # ● バトル画面 X 座標の取得
  2489.   #--------------------------------------------------------------------------
  2490.   def screen_x
  2491.     # パーティ内の並び順から X 座標を計算して返す
  2492.     if self.index != nil
  2493.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2494.     else
  2495.       return 0
  2496.     end
  2497.   end
  2498. end

  2499. #==============================================================================
  2500. # ■ Spriteset_Battle
  2501. #------------------------------------------------------------------------------
  2502. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2503. # スの内部で使用されます。
  2504. #==============================================================================

  2505. class Spriteset_Battle
  2506.   #--------------------------------------------------------------------------
  2507.   # ● 公開インスタンス変数
  2508.   #--------------------------------------------------------------------------
  2509.   attr_reader   :real_x                   # x座標補正(現在値)
  2510.   attr_reader   :real_y                   # y座標補正(現在値)
  2511.   attr_reader   :real_zoom                # 拡大率(現在値)
  2512.   #--------------------------------------------------------------------------
  2513.   # ● オブジェクト初期化
  2514.   #--------------------------------------------------------------------------
  2515.   def initialize
  2516.     # ビューポートを作成
  2517.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2518.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2519.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2520.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2521.     @viewport2.z = 101
  2522.     @viewport3.z = 200
  2523.     @viewport4.z = 5000
  2524.     @wait = 0
  2525.     @real_x = 0
  2526.     @real_y = 0
  2527.     @real_zoom = 1.0
  2528.     @target_x = 0
  2529.     @target_y = 0
  2530.     @target_zoom = 1.0
  2531.     @gap_x = 0
  2532.     @gap_y = 0
  2533.     @gap_zoom = 0.0
  2534.     # バトルバックスプライトを作成
  2535.     @battleback_sprite = Sprite.new(@viewport1)
  2536.     # エネミースプライトを作成
  2537.     @enemy_sprites = []
  2538.     for enemy in $game_troop.enemies.reverse
  2539.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2540.     end
  2541.     # アクタースプライトを作成
  2542.     @actor_sprites = []
  2543.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2544.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2545.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2546.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2547.     # 天候を作成
  2548.     @weather = RPG::Weather.new(@viewport1)
  2549.     # ピクチャスプライトを作成
  2550.     @picture_sprites = []
  2551.     for i in 51..100
  2552.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2553.         $game_screen.pictures[i]))
  2554.     end
  2555.     # タイマースプライトを作成
  2556.     @timer_sprite = Sprite_Timer.new
  2557.     # フレーム更新
  2558.     update
  2559.   end
  2560.   #--------------------------------------------------------------------------
  2561.   # ● フレーム更新
  2562.   #--------------------------------------------------------------------------
  2563.   def update
  2564.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2565.     @actor_sprites[0].battler = $game_party.actors[0]
  2566.     @actor_sprites[1].battler = $game_party.actors[1]
  2567.     @actor_sprites[2].battler = $game_party.actors[2]
  2568.     @actor_sprites[3].battler = $game_party.actors[3]
  2569.     # バトルバックのファイル名が現在のものと違う場合
  2570.     if @battleback_name != $game_temp.battleback_name
  2571.       make_battleback
  2572.     end
  2573.     # 画面のスクロール
  2574.     screen_scroll
  2575.     # モンスターの位置補正
  2576.     for enemy in $game_troop.enemies
  2577.       enemy.real_x = @real_x
  2578.       enemy.real_y = @real_y
  2579.       enemy.real_zoom = @real_zoom
  2580.     end
  2581.     # バトラースプライトを更新
  2582.     for sprite in @enemy_sprites + @actor_sprites
  2583.       sprite.update
  2584.     end
  2585.     # 天候グラフィックを更新
  2586.     @weather.type = $game_screen.weather_type
  2587.     @weather.max = $game_screen.weather_max
  2588.     @weather.update
  2589.     # ピクチャスプライトを更新
  2590.     for sprite in @picture_sprites
  2591.       sprite.update
  2592.     end
  2593.     # タイマースプライトを更新
  2594.     @timer_sprite.update
  2595.     # 画面の色調とシェイク位置を設定
  2596.     @viewport1.tone = $game_screen.tone
  2597.     @viewport1.ox = $game_screen.shake
  2598.     # 画面のフラッシュ色を設定
  2599.     @viewport4.color = $game_screen.flash_color
  2600.     # ビューポートを更新
  2601.     @viewport1.update
  2602.     @viewport2.update
  2603.     @viewport4.update
  2604.   end
  2605.   #--------------------------------------------------------------------------
  2606.   # ● バトル背景の設定
  2607.   #--------------------------------------------------------------------------
  2608.   def make_battleback
  2609.     @battleback_name = $game_temp.battleback_name
  2610.     if @battleback_sprite.bitmap != nil
  2611.       @battleback_sprite.bitmap.dispose
  2612.     end
  2613.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2614.     if @battleback_sprite.bitmap.width == 640 and
  2615.        @battleback_sprite.bitmap.height == 320
  2616.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2617.       @base_zoom = 2.0
  2618.       @battleback_sprite.zoom_x = @base_zoom
  2619.       @battleback_sprite.zoom_y = @base_zoom
  2620.       @real_y = 4
  2621.       @battleback_sprite.x = 320
  2622.       @battleback_sprite.y = @real_y
  2623.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2624.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2625.     elsif @battleback_sprite.bitmap.width == 640 and
  2626.           @battleback_sprite.bitmap.height == 480
  2627.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2628.       @base_zoom = 1.5
  2629.       @battleback_sprite.zoom_x = @base_zoom
  2630.       @battleback_sprite.zoom_y = @base_zoom
  2631.       @battleback_sprite.x = 320
  2632.       @battleback_sprite.y = 0
  2633.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2634.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2635.     else
  2636.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2637.                                       @battleback_sprite.bitmap.height)
  2638.       @base_zoom = 1.0
  2639.       @battleback_sprite.zoom_x = @base_zoom
  2640.       @battleback_sprite.zoom_y = @base_zoom
  2641.       @battleback_sprite.x = 320
  2642.       @battleback_sprite.y = 0
  2643.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2644.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2645.     end
  2646.   end
  2647.   #--------------------------------------------------------------------------
  2648.   # ● 画面のスクロール目標の位置・拡大率設定
  2649.   #--------------------------------------------------------------------------
  2650.   def screen_target(x, y, zoom)
  2651.     return unless $scene.drive
  2652.     @wait = $scene.scroll_time
  2653.     @target_x = x
  2654.     @target_y = y
  2655.     @target_zoom = zoom
  2656.     screen_over
  2657.     @gap_x = @target_x - @real_x
  2658.     @gap_y = @target_y - @real_y
  2659.     @gap_zoom = @target_zoom - @real_zoom
  2660.   end
  2661.   #--------------------------------------------------------------------------
  2662.   # ● 画面のスクロール
  2663.   #--------------------------------------------------------------------------
  2664.   def screen_scroll
  2665.     if @wait > 0
  2666.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2667.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2668.       @real_zoom = @target_zoom -
  2669.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2670.       @battleback_sprite.x = 320 + @real_x
  2671.       @battleback_sprite.y = @real_y
  2672.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2673.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2674.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2675.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2676.       @wait -= 1
  2677.     end
  2678.   end
  2679.   #--------------------------------------------------------------------------
  2680.   # ● スクリーンが画面外に出た時の補正処理
  2681.   #--------------------------------------------------------------------------
  2682.   def screen_over
  2683.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2684.     unless 324 + @target_x > width and 324 - @target_x > width
  2685.       if 324 + @target_x > width
  2686.         @target_x = width - 324
  2687.       elsif 324 - @target_x > width
  2688.         @target_x = 324 - width
  2689.       end
  2690.     end
  2691.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2692.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2693.       if @target_y > height - 4
  2694.         @target_y = height - 4
  2695.       elsif 484 - @target_y > 3 * height
  2696.         @target_y = 484 - 3 * height
  2697.       end
  2698.     end
  2699.   end
  2700. end

  2701. #==============================================================================
  2702. # ■ Game_Battler (分割定義 1)
  2703. #------------------------------------------------------------------------------
  2704. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2705. # スのスーパークラスとして使用されます。
  2706. #==============================================================================

  2707. class Game_Battler
  2708.   #--------------------------------------------------------------------------
  2709.   # ● 公開インスタンス変数追加
  2710.   #--------------------------------------------------------------------------
  2711.   attr_accessor :up_level                  # レベルアップ数
  2712.   attr_accessor :at                        # AT(タイムゲージ)
  2713.   attr_accessor :atp                       # AT(表示用)
  2714.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2715.   attr_accessor :rtp                       # RP(詠唱必要量)
  2716.   attr_accessor :spell                     # 合成スキル発動中
  2717.   attr_accessor :recover_hp                # HP回復量
  2718.   attr_accessor :recover_sp                # SP回復量
  2719.   attr_accessor :state_p                   # ステータス異常配列
  2720.   attr_accessor :state_m                   # ステータス異常配列
  2721.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2722.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2723.   attr_accessor :phase
  2724.   attr_accessor :wait
  2725.   attr_accessor :target
  2726.   attr_accessor :anime1
  2727.   attr_accessor :anime2
  2728.   attr_accessor :event
  2729.   #--------------------------------------------------------------------------
  2730.   # ● オブジェクト初期化
  2731.   #--------------------------------------------------------------------------
  2732.   alias :initialize_rtab :initialize
  2733.   def initialize
  2734.     initialize_rtab
  2735.     @damage_pop = {}
  2736.     @damage = {}
  2737.     @damage_sp = {}
  2738.     @critical = {}
  2739.     @recover_hp = {}
  2740.     @recover_sp = {}
  2741.     @state_p = {}
  2742.     @state_m = {}
  2743.     @animation = []
  2744.     @phase = 1
  2745.     @wait = 0
  2746.     @target = []
  2747.     @anime1 = 0
  2748.     @anime2 = 0
  2749.     @event = 0
  2750.   end
  2751.   #--------------------------------------------------------------------------
  2752.   # ● 存在判定
  2753.   #--------------------------------------------------------------------------
  2754.   def exist?
  2755.     return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
  2756.   end
  2757.   #--------------------------------------------------------------------------
  2758.   # ● 残HP予測
  2759.   #--------------------------------------------------------------------------
  2760.   def rest_hp
  2761.     # rest_hp に現HPを代入
  2762.     rest_hp = @hp
  2763.     # バトラーが受ける全ダメージをrest_hpに反映させる
  2764.     for pre_damage in @damage
  2765.       if pre_damage[1].is_a?(Numeric)
  2766.         rest_hp -= pre_damage[1]
  2767.       end
  2768.     end
  2769.     return rest_hp
  2770.   end
  2771.   #--------------------------------------------------------------------------
  2772.   # ● ステートの解除
  2773.   #     state_id : ステート ID
  2774.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2775.   #--------------------------------------------------------------------------
  2776.   def remove_state(state_id, force = false)
  2777.     # このステートが付加されている場合
  2778.     if state?(state_id)
  2779.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2780.       if @states_turn[state_id] == -1 and not force
  2781.         # メソッド終了
  2782.         return
  2783.       end
  2784.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2785.       if @hp == 0 and $data_states[state_id].zero_hp
  2786.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2787.         zero_hp = false
  2788.         for i in @states
  2789.           if i != state_id and $data_states[i].zero_hp
  2790.             zero_hp = true
  2791.           end
  2792.         end
  2793.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2794.         if zero_hp == false
  2795.           @hp = 1
  2796.         end
  2797.       end
  2798.       unless self.movable?
  2799.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2800.         @states.delete(state_id)
  2801.         @states_turn.delete(state_id)
  2802.         if self.movable?
  2803.           self.at = 0
  2804.         end
  2805.       else
  2806.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2807.         @states.delete(state_id)
  2808.         @states_turn.delete(state_id)
  2809.       end
  2810.     end
  2811.     # HP および SP の最大値チェック
  2812.     @hp = [@hp, self.maxhp].min
  2813.     @sp = [@sp, self.maxsp].min
  2814.   end
  2815.   #--------------------------------------------------------------------------
  2816.   # ● 通常攻撃の効果適用
  2817.   #     attacker : 攻撃者 (バトラー)
  2818.   #--------------------------------------------------------------------------
  2819.   def attack_effect(attacker)
  2820.     # クリティカルフラグをクリア
  2821.     self.critical[attacker] = false
  2822.     state_p[attacker] = []
  2823.     state_m[attacker] = []
  2824.     # 第一命中判定
  2825.     hit_result = (rand(100) < attacker.hit)
  2826.     # 命中の場合
  2827.     if hit_result == true
  2828.       # 基本ダメージを計算
  2829.       atk = [attacker.atk - self.pdef / 2, 0].max
  2830.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2831.       # 属性修正
  2832.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2833.       self.damage[attacker] /= 100
  2834.       # ダメージの符号が正の場合
  2835.       if self.damage[attacker] > 0
  2836.         # クリティカル修正
  2837.         if rand(100) < 4 * attacker.dex / self.agi
  2838.           self.damage[attacker] *= 2
  2839.           self.critical[attacker] = true
  2840.         end
  2841.         # 防御修正
  2842.         if self.guarding?
  2843.           self.damage[attacker] /= 2
  2844.         end
  2845.       end
  2846.       # 分散
  2847.       if self.damage[attacker].abs > 0
  2848.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2849.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2850.       end
  2851.       # 第二命中判定
  2852.       eva = 8 * self.agi / attacker.dex + self.eva
  2853.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2854.       hit = self.cant_evade? ? 100 : hit
  2855.       hit_result = (rand(100) < hit)
  2856.     end
  2857.     # 命中の場合
  2858.     if hit_result == true
  2859.       # ステート衝撃解除
  2860.       remove_states_shock
  2861.       # HP からダメージを減算
  2862.       # ステート変化
  2863.       @state_changed = false
  2864.       states_plus(attacker, attacker.plus_state_set)
  2865.       states_minus(attacker, attacker.minus_state_set)
  2866.     # ミスの場合
  2867.     else
  2868.       # ダメージに "Miss" を設定
  2869.       self.damage[attacker] = "Miss"
  2870.       # クリティカルフラグをクリア
  2871.       self.critical[attacker] = false
  2872.     end
  2873.     # メソッド終了
  2874.     return true
  2875.   end
  2876.   #--------------------------------------------------------------------------
  2877.   # ● スキルの効果適用
  2878.   #     user  : スキルの使用者 (バトラー)
  2879.   #     skill : スキル
  2880.   #--------------------------------------------------------------------------
  2881.   def skill_effect(user, skill)
  2882.     # クリティカルフラグをクリア
  2883.     self.critical[user] = false
  2884.     state_p[user] = []
  2885.     state_m[user] = []
  2886.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2887.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2888.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
  2889.   #     ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2890.       # メソッド終了
  2891.       return false
  2892.     end
  2893.     # 有効フラグをクリア
  2894.     effective = false
  2895.     # コモンイベント ID が有効の場合は有効フラグをセット
  2896.     effective |= skill.common_event_id > 0
  2897.     # 第一命中判定
  2898.     hit = skill.hit
  2899.     if skill.atk_f > 0
  2900.       hit *= user.hit / 100
  2901.     end
  2902.     hit_result = (rand(100) < hit)
  2903.     # 不確実なスキルの場合は有効フラグをセット
  2904.     effective |= hit < 100
  2905.     # 命中の場合
  2906.     if hit_result == true
  2907.       # 威力を計算
  2908.       power = skill.power + user.atk * skill.atk_f / 100
  2909.       if power > 0
  2910.         power -= self.pdef * skill.pdef_f / 200
  2911.         power -= self.mdef * skill.mdef_f / 200
  2912.         power = [power, 0].max
  2913.       end
  2914.       # 倍率を計算
  2915.       rate = 20
  2916.       rate += (user.str * skill.str_f / 100)
  2917.       rate += (user.dex * skill.dex_f / 100)
  2918.       rate += (user.agi * skill.agi_f / 100)
  2919.       rate += (user.int * skill.int_f / 100)
  2920.       # 基本ダメージを計算
  2921.       self.damage[user] = power * rate / 20
  2922.       # 属性修正
  2923.       self.damage[user] *= elements_correct(skill.element_set)
  2924.       self.damage[user] /= 100
  2925.       # ダメージの符号が正の場合
  2926.       if self.damage[user] > 0
  2927.         # 防御修正
  2928.         if self.guarding?
  2929.           self.damage[user] /= 2
  2930.         end
  2931.       end
  2932.       # 分散
  2933.       if skill.variance > 0 and self.damage[user].abs > 0
  2934.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  2935.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  2936.       end
  2937.       # 第二命中判定
  2938.       eva = 8 * self.agi / user.dex + self.eva
  2939.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  2940.       hit = self.cant_evade? ? 100 : hit
  2941.       hit_result = (rand(100) < hit)
  2942.       # 不確実なスキルの場合は有効フラグをセット
  2943.       effective |= hit < 100
  2944.     end
  2945.     # 命中の場合
  2946.     if hit_result == true
  2947.       # 威力 0 以外の物理攻撃の場合
  2948.       if skill.power != 0 and skill.atk_f > 0
  2949.         # ステート衝撃解除
  2950.         remove_states_shock
  2951.         # 有効フラグをセット
  2952.         effective = true
  2953.       end
  2954.       # HP の変動判定
  2955.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  2956.       # 効果判定
  2957.       effective |= self.hp != last_hp
  2958.       # ステート変化
  2959.       @state_changed = false
  2960.       effective |= states_plus(user, skill.plus_state_set)
  2961.       effective |= states_minus(user, skill.minus_state_set)
  2962.       unless $game_temp.in_battle
  2963.         self.damage_effect(user, 1, skill)
  2964.       end
  2965.       # 威力が 0 の場合
  2966.       if skill.power == 0
  2967.         # ダメージに空文字列を設定
  2968.         self.damage[user] = ""
  2969.         # ステートに変化がない場合
  2970.         unless @state_changed
  2971.           # ダメージに "Miss" を設定
  2972.           self.damage[user] = "Miss"
  2973.         end
  2974.       end
  2975.     # ミスの場合
  2976.     else
  2977.       # ダメージに "Miss" を設定
  2978.       self.damage[user] = "Miss"
  2979.     end
  2980.     # 戦闘中でない場合
  2981.     unless $game_temp.in_battle
  2982.       # ダメージに nil を設定
  2983.       self.damage[user] = nil
  2984.     end
  2985.     # メソッド終了
  2986.     return effective
  2987.   end
  2988.   #--------------------------------------------------------------------------
  2989.   # ● アイテムの効果適用
  2990.   #     item : アイテム
  2991.   #--------------------------------------------------------------------------
  2992.   def item_effect(item, user = $game_party.actors[0])
  2993.     # クリティカルフラグをクリア
  2994.     self.critical[user] = false
  2995.     state_p[user] = []
  2996.     state_m[user] = []
  2997.     self.recover_hp[user] = 0
  2998.     self.recover_sp[user] = 0
  2999.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  3000.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  3001.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0)# or
  3002.     #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  3003.       # メソッド終了
  3004.       return false
  3005.     end
  3006.     # 有効フラグをクリア
  3007.     effective = false
  3008.     # コモンイベント ID が有効の場合は有効フラグをセット
  3009.     effective |= item.common_event_id > 0
  3010.     # 命中判定
  3011.     hit_result = (rand(100) < item.hit)
  3012.     # 不確実なスキルの場合は有効フラグをセット
  3013.     effective |= item.hit < 100
  3014.     # 命中の場合
  3015.     if hit_result == true
  3016.       # 回復量を計算
  3017.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  3018.                               item.recover_hp
  3019.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  3020.                               item.recover_sp
  3021.       if self.recover_hp[user] < 0
  3022.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  3023.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  3024.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  3025.       end
  3026.       # 属性修正
  3027.       self.recover_hp[user] *= elements_correct(item.element_set)
  3028.       self.recover_hp[user] /= 100
  3029.       self.recover_sp[user] *= elements_correct(item.element_set)
  3030.       self.recover_sp[user] /= 100
  3031.       # 分散
  3032.       if item.variance > 0 and self.recover_hp[user].abs > 0
  3033.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  3034.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  3035.       end
  3036.       if item.variance > 0 and self.recover_sp[user].abs > 0
  3037.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  3038.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  3039.       end
  3040.       # 回復量の符号が負の場合
  3041.       if self.recover_hp[user] < 0
  3042.         # 防御修正
  3043.         if self.guarding?
  3044.           self.recover_hp[user] /= 2
  3045.         end
  3046.       end
  3047.       # HP 回復量の符号を反転し、ダメージの値に設定
  3048.       self.damage[user] = -self.recover_hp[user]
  3049.       # HP および SP の変動判定
  3050.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  3051.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  3052.       effective |= self.hp != last_hp
  3053.       effective |= self.sp != last_sp
  3054.       # ステート変化
  3055.       @state_changed = false
  3056.       effective |= states_plus(user, item.plus_state_set)
  3057.       effective |= states_minus(user, item.minus_state_set)
  3058.       unless $game_temp.in_battle
  3059.         self.damage_effect(user, 2, nil)
  3060.       end
  3061.       # パラメータ上昇値が有効の場合
  3062.       if item.parameter_type > 0 and item.parameter_points != 0
  3063.         # パラメータで分岐
  3064.         case item.parameter_type
  3065.         when 1  # MaxHP
  3066.           @maxhp_plus += item.parameter_points
  3067.         when 2  # MaxSP
  3068.           @maxsp_plus += item.parameter_points
  3069.         when 3  # 腕力
  3070.           @str_plus += item.parameter_points
  3071.         when 4  # 器用さ
  3072.           @dex_plus += item.parameter_points
  3073.         when 5  # 素早さ
  3074.           @agi_plus += item.parameter_points
  3075.         when 6  # 魔力
  3076.           @int_plus += item.parameter_points
  3077.         end
  3078.         # 有効フラグをセット
  3079.         effective = true
  3080.       end
  3081.       # HP 回復率と回復量が 0 の場合
  3082.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  3083.         # ダメージに空文字列を設定
  3084.         self.damage[user] = ""
  3085.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  3086.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  3087.            (item.parameter_type == 0 or item.parameter_points == 0)
  3088.           # ステートに変化がない場合
  3089.           unless @state_changed
  3090.             # ダメージに "Miss" を設定
  3091.             self.damage[user] = "Miss"
  3092.           end
  3093.         end
  3094.       end
  3095.     # ミスの場合
  3096.     else
  3097.       # ダメージに "Miss" を設定
  3098.       self.damage[user] = "Miss"
  3099.     end
  3100.     # 戦闘中でない場合
  3101.     unless $game_temp.in_battle
  3102.       # ダメージに nil を設定
  3103.       self.damage[user] = nil
  3104.     end
  3105.     # メソッド終了
  3106.     return effective
  3107.   end
  3108.   #--------------------------------------------------------------------------
  3109.   # ● ステート変化 (+) の適用
  3110.   #     plus_state_set  : ステート変化 (+)
  3111.   #--------------------------------------------------------------------------
  3112.   def states_plus(battler, plus_state_set)
  3113.     # 有効フラグをクリア
  3114.     effective = false
  3115.     # ループ (付加するステート)
  3116.     for i in plus_state_set
  3117.       # このステートが防御されていない場合
  3118.       unless self.state_guard?(i)
  3119.         # このステートがフルでなければ有効フラグをセット
  3120.         effective |= self.state_full?(i) == false
  3121.         # ステートが [抵抗しない] の場合
  3122.         if $data_states[i].nonresistance
  3123.           # ステート変化フラグをセット
  3124.           @state_changed = true
  3125.           # ステートを付加
  3126.           self.state_p[battler].push(i)
  3127.         # このステートがフルではない場合
  3128.         elsif self.state_full?(i) == false
  3129.           # ステート有効度を確率に変換し、乱数と比較
  3130.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  3131.             # ステート変化フラグをセット
  3132.             @state_changed = true
  3133.             # ステートを付加
  3134.             self.state_p[battler].push(i)
  3135.           end
  3136.         end
  3137.       end
  3138.     end
  3139.     # メソッド終了
  3140.     return effective
  3141.   end
  3142.   #--------------------------------------------------------------------------
  3143.   # ● ステート変化 (-) の適用
  3144.   #     minus_state_set : ステート変化 (-)
  3145.   #--------------------------------------------------------------------------
  3146.   def states_minus(battler, minus_state_set)
  3147.     # 有効フラグをクリア
  3148.     effective = false
  3149.     # ループ (解除するステート)
  3150.     for i in minus_state_set
  3151.       # このステートが付加されていれば有効フラグをセット
  3152.       effective |= self.state?(i)
  3153.       # ステート変化フラグをセット
  3154.       @state_changed = true
  3155.       # ステートを解除
  3156.       self.state_m[battler].push(i)
  3157.     end
  3158.     # メソッド終了
  3159.     return effective
  3160.   end
  3161.   #--------------------------------------------------------------------------
  3162.   # ● ダメージ演算
  3163.   #--------------------------------------------------------------------------
  3164.   def damage_effect(battler, item)
  3165.     if item == 2
  3166.       self.hp += self.recover_hp[battler]
  3167.       self.sp += self.recover_sp[battler]
  3168.       if self.recover_sp[battler] != 0
  3169.         self.damage_sp[battler] = -self.recover_sp[battler]
  3170.       end
  3171.       self.recover_hp.delete(battler)
  3172.       self.recover_sp.delete(battler)
  3173.     else
  3174.       if self.damage[battler].class != String
  3175.         self.hp -= self.damage[battler]
  3176.       end
  3177.     end
  3178.     for i in self.state_p[battler]
  3179.       add_state(i)
  3180.     end
  3181.     for i in self.state_m[battler]
  3182.       remove_state(i)
  3183.     end
  3184.   end
  3185.   #--------------------------------------------------------------------------
  3186.   # ● スリップダメージの効果適用
  3187.   #--------------------------------------------------------------------------
  3188.   def slip_damage_effect
  3189.     # ダメージを設定
  3190.     self.damage["slip"] = self.maxhp / 10
  3191.     # 分散
  3192.     if self.damage["slip"].abs > 0
  3193.       amp = [self.damage["slip"].abs * 15 / 100, 1].max
  3194.       self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
  3195.     end
  3196.     # HP からダメージを減算
  3197.     self.hp -= self.damage["slip"]
  3198.     # メソッド終了
  3199.     return true
  3200.   end
  3201. end

  3202. #==============================================================================
  3203. # ■ Game_BattleAction
  3204. #------------------------------------------------------------------------------
  3205. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3206. # スの内部で使用されます。
  3207. #==============================================================================

  3208. class Game_BattleAction
  3209.   #--------------------------------------------------------------------------
  3210.   # ● 公開インスタンス変数
  3211.   #--------------------------------------------------------------------------
  3212.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3213.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3214.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3215.   attr_accessor :force_skill_id           # スキル ID
  3216.   #--------------------------------------------------------------------------
  3217.   # ● 有効判定
  3218.   #--------------------------------------------------------------------------
  3219.   def valid?
  3220.     return (not (@force_kind == 0 and @force_basic == 3))
  3221.   end
  3222. end

  3223. #==============================================================================
  3224. # ■ Game_Actor
  3225. #------------------------------------------------------------------------------
  3226. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3227. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3228. #==============================================================================

  3229. class Game_Actor < Game_Battler
  3230.   def skill_can_use?(skill_id)
  3231.     return super
  3232.   end
  3233. end

  3234. #==============================================================================
  3235. # ■ Game_Enemy
  3236. #------------------------------------------------------------------------------
  3237. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3238. # 内部で使用されます。
  3239. #==============================================================================

  3240. class Game_Enemy < Game_Battler
  3241.   #--------------------------------------------------------------------------
  3242.   # ● 公開インスタンス変数
  3243.   #--------------------------------------------------------------------------
  3244.   attr_accessor :height                  # 画像の高さ
  3245.   attr_accessor :real_x                  # X座標補正
  3246.   attr_accessor :real_y                  # Y座標補正
  3247.   attr_accessor :real_zoom               # 拡大率
  3248.   #--------------------------------------------------------------------------
  3249.   # ● オブジェクト初期化
  3250.   #     troop_id     : トループ ID
  3251.   #     member_index : トループメンバーのインデックス
  3252.   #--------------------------------------------------------------------------
  3253.   def initialize(troop_id, member_index)
  3254.     super()
  3255.     @troop_id = troop_id
  3256.     @member_index = member_index
  3257.     troop = $data_troops[@troop_id]
  3258.     @enemy_id = troop.members[@member_index].enemy_id
  3259.     enemy = $data_enemies[@enemy_id]
  3260.     @battler_name = enemy.battler_name
  3261.     @battler_hue = enemy.battler_hue
  3262.     @hp = maxhp
  3263.     @sp = maxsp
  3264.     @real_x = 0
  3265.     @real_y = 0
  3266.     @real_zoom = 1.0
  3267.     @fly = 0
  3268.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3269.     @hidden = troop.members[@member_index].hidden
  3270.     @immortal = troop.members[@member_index].immortal
  3271.   end
  3272.   alias :true_x :screen_x
  3273.   alias :true_y :screen_y
  3274.   #--------------------------------------------------------------------------
  3275.   # ● バトル画面 X 座標の取得
  3276.   #--------------------------------------------------------------------------
  3277.   def screen_x
  3278.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3279.   end
  3280.   #--------------------------------------------------------------------------
  3281.   # ● バトル画面 Y 座標の取得
  3282.   #--------------------------------------------------------------------------
  3283.   def screen_y
  3284.     return true_y * @real_zoom + @real_y
  3285.   end
  3286.   #--------------------------------------------------------------------------
  3287.   # ● バトル画面 Z 座標の取得
  3288.   #--------------------------------------------------------------------------
  3289.   def screen_z
  3290.     return true_y + @fly
  3291.   end
  3292.   #--------------------------------------------------------------------------
  3293.   # ● バトル画面 拡大率の取得
  3294.   #--------------------------------------------------------------------------
  3295.   def zoom
  3296.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3297.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3298.   end
  3299.   #--------------------------------------------------------------------------
  3300.   # ● 攻撃用、バトル画面 X 座標の取得
  3301.   #--------------------------------------------------------------------------
  3302.   def attack_x(z)
  3303.     return (320 - true_x) * z * 0.75
  3304.   end
  3305.   #--------------------------------------------------------------------------
  3306.   # ● 攻撃用、バトル画面 Y 座標の取得
  3307.   #--------------------------------------------------------------------------
  3308.   def attack_y(z)
  3309.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3310.   end
  3311.   #--------------------------------------------------------------------------
  3312.   # ● アクション作成
  3313.   #--------------------------------------------------------------------------
  3314.   def make_action
  3315.     # カレントアクションをクリア
  3316.     self.current_action.clear
  3317.     # 動けない場合
  3318.     unless self.inputable?
  3319.       # メソッド終了
  3320.       return
  3321.     end
  3322.     # 現在有効なアクションを抽出
  3323.     available_actions = []
  3324.     rating_max = 0
  3325.     for action in self.actions
  3326.       # ターン 条件確認
  3327.       n = $game_temp.battle_turn
  3328.       a = action.condition_turn_a
  3329.       b = action.condition_turn_b
  3330.       if (b == 0 and n != a) or
  3331.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3332.         next
  3333.       end
  3334.       # HP 条件確認
  3335.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3336.         next
  3337.       end
  3338.       # レベル 条件確認
  3339.       if $game_party.max_level < action.condition_level
  3340.         next
  3341.       end
  3342.       # スイッチ 条件確認
  3343.       switch_id = action.condition_switch_id
  3344.       if switch_id > 0 and $game_switches[switch_id] == false
  3345.         next
  3346.       end
  3347.       # スキル使用可能 条件確認
  3348.       if action.kind == 1
  3349.         unless self.skill_can_use?(action.skill_id)
  3350.           next
  3351.         end
  3352.       end
  3353.       # 条件に該当 : このアクションを追加
  3354.       available_actions.push(action)
  3355.       if action.rating > rating_max
  3356.         rating_max = action.rating
  3357.       end
  3358.     end
  3359.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3360.     ratings_total = 0
  3361.     for action in available_actions
  3362.       if action.rating > rating_max - 3
  3363.         ratings_total += action.rating - (rating_max - 3)
  3364.       end
  3365.     end
  3366.     # レーティングの合計が 0 ではない場合
  3367.     if ratings_total > 0
  3368.       # 乱数を作成
  3369.       value = rand(ratings_total)
  3370.       # 作成した乱数に対応するものをカレントアクションに設定
  3371.       for action in available_actions
  3372.         if action.rating > rating_max - 3
  3373.           if value < action.rating - (rating_max - 3)
  3374.             self.current_action.kind = action.kind
  3375.             self.current_action.basic = action.basic
  3376.             self.current_action.skill_id = action.skill_id
  3377.             self.current_action.decide_random_target_for_enemy
  3378.             return
  3379.           else
  3380.             value -= action.rating - (rating_max - 3)
  3381.           end
  3382.         end
  3383.       end
  3384.     end
  3385.   end
  3386. end

  3387. #==============================================================================
  3388. # ■ Game_Party
  3389. #------------------------------------------------------------------------------
  3390. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3391. # ラスのインスタンスは $game_party で参照されます。
  3392. #==============================================================================

  3393. class Game_Party
  3394.   #--------------------------------------------------------------------------
  3395.   # ● 全滅判定
  3396.   #--------------------------------------------------------------------------
  3397.   def all_dead?
  3398.     # パーティ人数が 0 人の場合
  3399.     if $game_party.actors.size == 0
  3400.       return false
  3401.     end
  3402.     # HP 0 以上のアクターがパーティにいる場合
  3403.     for actor in @actors
  3404.       if actor.rest_hp > 0
  3405.         return false
  3406.       end
  3407.     end
  3408.     # 全滅
  3409.     return true
  3410.   end
  3411.   #--------------------------------------------------------------------------
  3412.   # ● 対象アクターのランダムな決定
  3413.   #     hp0 : HP 0 のアクターに限る
  3414.   #--------------------------------------------------------------------------
  3415.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3416.   alias :random_target_actor_rtab :random_target_actor
  3417.   def random_target_actor(hp0 = false)
  3418.     # ルーレットを初期化
  3419.     roulette = []
  3420.     # ループ
  3421.     for actor in @actors
  3422.       # 条件に該当する場合
  3423.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3424.           (hp0 and actor.hp0?)
  3425.         # アクターのクラスの [位置] を取得
  3426.         position = $data_classes[actor.class_id].position
  3427.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3428.         n = 4 - position
  3429.         # ルーレットにアクターを n 回追加
  3430.         n.times do
  3431.           roulette.push(actor)
  3432.         end
  3433.       end
  3434.     end
  3435.     # ルーレットのサイズが 0 の場合
  3436.     if roulette.size == 0
  3437.       return random_target_actor_rtab(hp0)
  3438.     end
  3439.     # ルーレットを回し、アクターを決定
  3440.     return roulette[rand(roulette.size)]
  3441.   end
  3442.   #--------------------------------------------------------------------------
  3443.   # ● 対象アクターのスムーズな決定
  3444.   #     actor_index : アクターインデックス
  3445.   #--------------------------------------------------------------------------
  3446.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3447.   alias :smooth_target_actor_rtab :smooth_target_actor
  3448.   def smooth_target_actor(actor_index)
  3449.     # アクターを取得
  3450.     actor = @actors[actor_index]
  3451.     # アクターが存在する場合
  3452.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3453.       return actor
  3454.     end
  3455.     # ループ
  3456.     for actor in @actors
  3457.       # アクターが存在する場合
  3458.       if actor.exist? and actor.rest_hp > 0
  3459.         return actor
  3460.       end
  3461.     end
  3462.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3463.     return smooth_target_actor_rtab(actor_index)
  3464.   end
  3465. end

  3466. #==============================================================================
  3467. # ■ Game_Troop
  3468. #------------------------------------------------------------------------------
  3469. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3470. # れます。
  3471. #==============================================================================

  3472. class Game_Troop
  3473.   #--------------------------------------------------------------------------
  3474.   # ● 対象エネミーのランダムな決定
  3475.   #     hp0 : HP 0 のエネミーに限る
  3476.   #--------------------------------------------------------------------------
  3477.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3478.   alias :random_target_enemy_rtab :random_target_enemy
  3479.   def random_target_enemy(hp0 = false)
  3480.     # ルーレットを初期化
  3481.     roulette = []
  3482.     # ループ
  3483.     for enemy in @enemies
  3484.       # 条件に該当する場合
  3485.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3486.           (hp0 and enemy.hp0?)
  3487.         # ルーレットにエネミーを追加
  3488.         roulette.push(enemy)
  3489.       end
  3490.     end
  3491.     # ルーレットのサイズが 0 の場合
  3492.     if roulette.size == 0
  3493.       return random_target_enemy_rtab(hp0)
  3494.     end
  3495.     # ルーレットを回し、エネミーを決定
  3496.     return roulette[rand(roulette.size)]
  3497.   end
  3498.   #--------------------------------------------------------------------------
  3499.   # ● 対象エネミーのスムーズな決定
  3500.   #     enemy_index : エネミーインデックス
  3501.   #--------------------------------------------------------------------------
  3502.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3503.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3504.   def smooth_target_enemy(enemy_index)
  3505.     # エネミーを取得
  3506.     enemy = @enemies[enemy_index]
  3507.     # エネミーが存在する場合
  3508.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3509.       return enemy
  3510.     end
  3511.     # ループ
  3512.     for enemy in @enemies
  3513.       # エネミーが存在する場合
  3514.       if enemy.exist? and enemy.rest_hp > 0
  3515.         return enemy
  3516.       end
  3517.     end
  3518.     # 敵が全滅している場合、再度敵の検索を行う
  3519.     return smooth_target_enemy_rtab(enemy_index)
  3520.   end
  3521. end

  3522. #==============================================================================
  3523. # ■ Sprite_Battler
  3524. #------------------------------------------------------------------------------
  3525. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3526. # スプライトの状態を自動的に変化させます。
  3527. #==============================================================================

  3528. class Sprite_Battler < RPG::Sprite
  3529.   #--------------------------------------------------------------------------
  3530.   # ● フレーム更新
  3531.   #--------------------------------------------------------------------------
  3532.   def update
  3533.     super
  3534.     # バトラーが nil の場合
  3535.     if @battler == nil
  3536.       self.bitmap = nil
  3537.       loop_animation(nil)
  3538.       return
  3539.     end
  3540.     # ファイル名か色相が現在のものと異なる場合
  3541.     if @battler.battler_name != @battler_name or
  3542.        @battler.battler_hue != @battler_hue
  3543.       # ビットマップを取得、設定
  3544.       @battler_name = @battler.battler_name
  3545.       @battler_hue = @battler.battler_hue
  3546.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3547.       @width = bitmap.width
  3548.       @height = bitmap.height
  3549.       self.ox = @width / 2
  3550.       self.oy = @height
  3551.       if @battler.is_a?(Game_Enemy)
  3552.         @battler.height = @height
  3553.       end
  3554.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3555.       if @battler.dead? or @battler.hidden
  3556.         self.opacity = 0
  3557.       end
  3558.     end
  3559.     # アニメーション ID が現在のものと異なる場合
  3560.     if @battler.state_animation_id != @state_animation_id
  3561.       @state_animation_id = @battler.state_animation_id
  3562.       loop_animation($data_animations[@state_animation_id])
  3563.     end
  3564.     # 表示されるべきアクターの場合
  3565.     if @battler.is_a?(Game_Actor) and @battler_visible
  3566.       # メインフェーズでないときは不透明度をやや下げる
  3567.       if $game_temp.battle_main_phase
  3568.         self.opacity += 3 if self.opacity < 255
  3569.       else
  3570.         self.opacity -= 3 if self.opacity > 207
  3571.       end
  3572.     end
  3573.     # 明滅
  3574.     if @battler.blink
  3575.       blink_on
  3576.     else
  3577.       blink_off
  3578.     end
  3579.     # 不可視の場合
  3580.     unless @battler_visible
  3581.       # 出現
  3582.       if not @battler.hidden and not @battler.dead? and
  3583.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3584.         appear
  3585.         @battler_visible = true
  3586.       end
  3587.     end
  3588.     # ダメージ
  3589.     for battler in @battler.damage_pop
  3590.       if battler[0].class == Array
  3591.         if battler[0][1] >= 0
  3592.           $scene.skill_se
  3593.         else
  3594.           $scene.levelup_se
  3595.         end
  3596.         damage(@battler.damage[battler[0]], false, 2)
  3597.       else
  3598.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3599.       end
  3600.       if @battler.damage_sp.include?(battler[0])
  3601.         damage(@battler.damage_sp[battler[0]],
  3602.                 @battler.critical[battler[0]], 1)
  3603.         @battler.damage_sp.delete(battler[0])
  3604.       end
  3605.       @battler.damage_pop.delete(battler[0])
  3606.       @battler.damage.delete(battler[0])
  3607.       @battler.critical.delete(battler[0])
  3608.     end
  3609.     # 可視の場合
  3610.     if @battler_visible
  3611.       # 逃走
  3612.       if @battler.hidden
  3613.         $game_system.se_play($data_system.escape_se)
  3614.         escape
  3615.         @battler_visible = false
  3616.       end
  3617.       # 白フラッシュ
  3618.       if @battler.white_flash
  3619.         whiten
  3620.         @battler.white_flash = false
  3621.       end
  3622.       # アニメーション
  3623.       unless @battler.animation.empty?
  3624.         for animation in @battler.animation.reverse
  3625.           animation($data_animations[animation[0]], animation[1])
  3626.           @battler.animation.delete(animation)
  3627.         end
  3628.       end
  3629.       # コラプス
  3630.       if @battler.damage.empty? and @battler.dead?
  3631.         if $scene.dead_ok?(@battler)
  3632.           if @battler.is_a?(Game_Enemy)
  3633.             $game_system.se_play($data_system.enemy_collapse_se)
  3634.           else
  3635.             $game_system.se_play($data_system.actor_collapse_se)
  3636.           end
  3637.           collapse
  3638.           @battler_visible = false
  3639.         end
  3640.       end
  3641.     end
  3642.     # スプライトの座標を設定
  3643.     self.x = @battler.screen_x
  3644.     self.y = @battler.screen_y
  3645.     self.z = @battler.screen_z
  3646.     if @battler.is_a?(Game_Enemy)
  3647.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3648.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3649.     end
  3650.   end
  3651. end

  3652. #==============================================================================
  3653. # ■ Window_Base
  3654. #------------------------------------------------------------------------------
  3655. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3656. #==============================================================================

  3657. class Window_Base < Window
  3658.   #--------------------------------------------------------------------------
  3659.   # ● ゲージの描画
  3660.   #--------------------------------------------------------------------------
  3661.   def gauge_rect_at(width, height, align3,
  3662.                     color1, color2, color3, color4, color5, color6, color7,
  3663.                     color8, color9, color10, color11, color12, grade1, grade2)
  3664.     # 枠描画
  3665.     @at_gauge = Bitmap.new(width, height * 5)
  3666.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3667.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3668.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3669.       color = color3
  3670.       color3 = color4
  3671.       color4 = color
  3672.     end
  3673.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3674.       color = color5
  3675.       color5 = color6
  3676.       color6 = color
  3677.       color = color7
  3678.       color7 = color8
  3679.       color8 = color
  3680.       color = color9
  3681.       color9 = color10
  3682.       color10 = color
  3683.       color = color11
  3684.       color11 = color12
  3685.       color12 = color
  3686.     end
  3687.     if align3 == 0
  3688.       if grade1 == 2
  3689.         grade1 = 3
  3690.       end
  3691.       if grade2 == 2
  3692.         grade2 = 3
  3693.       end
  3694.     end
  3695.     # 空ゲージの描画 縦にグラデーション表示
  3696.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3697.                                   color3, color4, grade1)
  3698.     # 実ゲージの描画
  3699.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3700.                                   color5, color6, grade2)
  3701.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3702.                                   color7, color8, grade2)
  3703.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3704.                                   color9, color10, grade2)
  3705.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3706.                                   color11, color12, grade2)
  3707.   end
  3708. end

  3709. #==============================================================================
  3710. # ■ Window_Help
  3711. #------------------------------------------------------------------------------
  3712. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3713. #==============================================================================

  3714. class Window_Help < Window_Base
  3715.   #--------------------------------------------------------------------------
  3716.   # ● エネミー設定
  3717.   #     enemy : 名前とステートを表示するエネミー
  3718.   #--------------------------------------------------------------------------
  3719.   def set_enemy(enemy)
  3720.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3721.     state_text = make_battler_state_text(enemy, 112, false)
  3722.     if state_text != ""
  3723.       text += "  " + state_text
  3724.     end
  3725.     set_text(text, 1)
  3726.   end
  3727. end

  3728. #==============================================================================
  3729. # ■ Window_BattleStatus
  3730. #------------------------------------------------------------------------------
  3731. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3732. #==============================================================================

  3733. class Window_BattleStatus < Window_Base
  3734.   #--------------------------------------------------------------------------
  3735.   # ● オブジェクト初期化
  3736.   #--------------------------------------------------------------------------
  3737.   def initialize
  3738.     x = (4 - $game_party.actors.size) * 80
  3739.     width = $game_party.actors.size * 160
  3740.     super(x, 320, width, 160)
  3741.     self.back_opacity = 160
  3742.     @actor_window = []
  3743.     for i in 0...$game_party.actors.size
  3744.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3745.     end
  3746.     @level_up_flags = [false, false, false, false]
  3747.     refresh
  3748.   end
  3749.   #--------------------------------------------------------------------------
  3750.   # ● 解放
  3751.   #--------------------------------------------------------------------------
  3752.   def dispose
  3753.     for window in @actor_window
  3754.       window.dispose
  3755.     end
  3756.     super
  3757.   end
  3758.   #--------------------------------------------------------------------------
  3759.   # ● リフレッシュ
  3760.   #--------------------------------------------------------------------------
  3761.   def refresh(number = 0)
  3762.     if number == 0
  3763.       cnt = 0
  3764.       for window in @actor_window
  3765.         window.refresh(@level_up_flags[cnt])
  3766.         cnt += 1
  3767.       end
  3768.     else
  3769.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3770.     end
  3771.   end
  3772.   #--------------------------------------------------------------------------
  3773.   # ● ATゲージリフレッシュ
  3774.   #--------------------------------------------------------------------------
  3775.   def at_refresh(number = 0)
  3776.     if number == 0
  3777.       for window in @actor_window
  3778.         window.at_refresh
  3779.       end
  3780.     else
  3781.       @actor_window[number - 1].at_refresh
  3782.     end
  3783.   end
  3784.   #--------------------------------------------------------------------------
  3785.   # ● フレーム更新
  3786.   #--------------------------------------------------------------------------
  3787.   def update
  3788.     super
  3789.     if self.x != (4 - $game_party.actors.size) * 80
  3790.       self.x = (4 - $game_party.actors.size) * 80
  3791.       self.width = $game_party.actors.size * 160
  3792.       for window in @actor_window
  3793.         window.dispose
  3794.       end
  3795.       @actor_window = []
  3796.       for i in 0...$game_party.actors.size
  3797.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3798.       end
  3799.       refresh
  3800.     end
  3801.     for window in @actor_window
  3802.       window.update
  3803.     end
  3804.   end
  3805. end

  3806. #==============================================================================
  3807. # ■ Window_ActorStatus
  3808. #------------------------------------------------------------------------------
  3809. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3810. #==============================================================================

  3811. class Window_ActorStatus < Window_Base
  3812.   #--------------------------------------------------------------------------
  3813.   # ● オブジェクト初期化
  3814.   #--------------------------------------------------------------------------
  3815.   def initialize(id, x)
  3816.     @actor_num = id
  3817.     super(x, 320, 160, 160)
  3818.     self.contents = Bitmap.new(width - 32, height - 32)
  3819.     self.opacity = 0
  3820.     self.back_opacity = 0
  3821.     actor = $game_party.actors[@actor_num]
  3822.     @actor_nm = actor.name
  3823.     @actor_mhp = actor.maxhp
  3824.     @actor_msp = actor.maxsp
  3825.     @actor_hp = actor.hp
  3826.     @actor_sp = actor.sp
  3827.     @actor_st = make_battler_state_text(actor, 120, true)
  3828.     @status_window = []
  3829.     for i in 0...5
  3830.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3831.     end
  3832.     refresh(false)
  3833.   end
  3834.   #--------------------------------------------------------------------------
  3835.   # ● 解放
  3836.   #--------------------------------------------------------------------------
  3837.   def dispose
  3838.     for i in 0...5
  3839.       @status_window[i].dispose
  3840.     end
  3841.     super
  3842.   end
  3843.   #--------------------------------------------------------------------------
  3844.   # ● リフレッシュ
  3845.   #--------------------------------------------------------------------------
  3846.   def refresh(level_up_flags)
  3847.     self.contents.clear
  3848.     actor = $game_party.actors[@actor_num]
  3849.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3850.     @status_window[1].refresh(actor) if
  3851.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3852.     @status_window[2].refresh(actor) if
  3853.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3854.     @status_window[3].refresh(actor, level_up_flags) if
  3855.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3856.     @actor_nm = actor.name
  3857.     @actor_mhp = actor.maxhp
  3858.     @actor_msp = actor.maxsp
  3859.     @actor_hp = actor.hp
  3860.     @actor_sp = actor.sp
  3861.     @actor_st = make_battler_state_text(actor, 120, true)
  3862.   end
  3863.   #--------------------------------------------------------------------------
  3864.   # ● ATゲージリフレッシュ
  3865.   #--------------------------------------------------------------------------
  3866.   def at_refresh
  3867.     @status_window[4].refresh($game_party.actors[@actor_num])
  3868.   end
  3869.   #--------------------------------------------------------------------------
  3870.   # ● フレーム更新
  3871.   #--------------------------------------------------------------------------
  3872.   def update
  3873.     for window in @status_window
  3874.       window.update
  3875.     end
  3876.   end
  3877. end

  3878. #==============================================================================
  3879. # ■ Window_DetailsStatus
  3880. #------------------------------------------------------------------------------
  3881. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3882. #==============================================================================

  3883. class Window_DetailsStatus < Window_Base
  3884.   #--------------------------------------------------------------------------
  3885.   # ● オブジェクト初期化
  3886.   #--------------------------------------------------------------------------
  3887.   def initialize(actor, id, x)
  3888.     @status_id = id
  3889.     super(x, 320 + id * 26, 160, 64)
  3890.     self.contents = Bitmap.new(width - 32, height - 32)
  3891.     self.opacity = 0
  3892.     self.back_opacity = 0
  3893.     refresh(actor, false)
  3894.   end
  3895.   #--------------------------------------------------------------------------
  3896.   # ● 解放
  3897.   #--------------------------------------------------------------------------
  3898.   def dispose
  3899.     super
  3900.   end
  3901.   #--------------------------------------------------------------------------
  3902.   # ● リフレッシュ
  3903.   #--------------------------------------------------------------------------
  3904.   def refresh(actor, level_up_flags = false)
  3905.     self.contents.clear
  3906.     case @status_id
  3907.     when 0
  3908.       draw_actor_name(actor, 4, 0)
  3909.     when 1
  3910.       draw_actor_hp(actor, 4, 0, 120)
  3911.     when 2
  3912.       draw_actor_sp(actor, 4, 0, 120)
  3913.     when 3
  3914.       if level_up_flags
  3915.         self.contents.font.color = normal_color
  3916.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3917.       else
  3918.         draw_actor_state(actor, 4, 0)
  3919.       end
  3920.     when 4
  3921.       draw_actor_atg(actor, 4, 0, 120)
  3922.     end
  3923.   end
  3924.   #--------------------------------------------------------------------------
  3925.   # ● フレーム更新
  3926.   #--------------------------------------------------------------------------
  3927.   def update
  3928.     # メインフェーズのときは不透明度をやや下げる
  3929.     if $game_temp.battle_main_phase
  3930.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3931.     else
  3932.       self.contents_opacity += 4 if self.contents_opacity < 255
  3933.     end
  3934.   end
  3935. end

  3936. #==============================================================================
  3937. # ■ Arrow_Base
  3938. #------------------------------------------------------------------------------
  3939. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3940. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3941. #==============================================================================

  3942. class Arrow_Base < Sprite
  3943.   #--------------------------------------------------------------------------
  3944.   # ● オブジェクト初期化
  3945.   #     viewport : ビューポート
  3946.   #--------------------------------------------------------------------------
  3947.   def initialize(viewport)
  3948.     super(viewport)
  3949.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3950.     self.ox = 16
  3951.     self.oy = 32
  3952.     self.z = 2500
  3953.     @blink_count = 0
  3954.     @index = 0
  3955.     @help_window = nil
  3956.     update
  3957.   end
  3958. end

  3959. #==============================================================================
  3960. # ■ Arrow_Enemy
  3961. #------------------------------------------------------------------------------
  3962. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3963. # スを継承します。
  3964. #==============================================================================

  3965. class Arrow_Enemy < Arrow_Base
  3966.   #--------------------------------------------------------------------------
  3967.   # ● フレーム更新
  3968.   #--------------------------------------------------------------------------
  3969.   def update
  3970.     super
  3971.     # 存在しないエネミーを指していたら飛ばす
  3972.     $game_troop.enemies.size.times do
  3973.       break if self.enemy.exist?
  3974.       @index += 1
  3975.       @index %= $game_troop.enemies.size
  3976.     end
  3977.     # カーソル右
  3978.     if Input.repeat?(Input::RIGHT)
  3979.       $game_system.se_play($data_system.cursor_se)
  3980.       $game_troop.enemies.size.times do
  3981.         @index += 1
  3982.         @index %= $game_troop.enemies.size
  3983.         break if self.enemy.exist?
  3984.       end
  3985.       $scene.camera = "select"
  3986.       zoom = 1 / self.enemy.zoom
  3987.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3988.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  3989.     end
  3990.     # カーソル左
  3991.     if Input.repeat?(Input::LEFT)
  3992.       $game_system.se_play($data_system.cursor_se)
  3993.       $game_troop.enemies.size.times do
  3994.         @index += $game_troop.enemies.size - 1
  3995.         @index %= $game_troop.enemies.size
  3996.         break if self.enemy.exist?
  3997.       end
  3998.       $scene.camera = "select"
  3999.       zoom = 1 / self.enemy.zoom
  4000.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4001.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4002.     end
  4003.     # スプライトの座標を設定
  4004.     if self.enemy != nil
  4005.       self.x = self.enemy.screen_x
  4006.       self.y = self.enemy.screen_y
  4007.     end
  4008.   end
  4009. end

  4010. #==============================================================================
  4011. # ■ Interpreter
  4012. #------------------------------------------------------------------------------
  4013. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4014. # スや Game_Event クラスの内部で使用されます。
  4015. #==============================================================================

  4016. class Interpreter
  4017.   #--------------------------------------------------------------------------
  4018.   # ● アクターの入れ替え
  4019.   #--------------------------------------------------------------------------
  4020.   def command_129
  4021.     # アクターを取得
  4022.     actor = $game_actors[@parameters[0]]
  4023.     # アクターが有効の場合
  4024.     if actor != nil
  4025.       # 操作で分岐
  4026.       if @parameters[1] == 0
  4027.         if @parameters[2] == 1
  4028.           $game_actors[@parameters[0]].setup(@parameters[0])
  4029.         end
  4030.         $game_party.add_actor(@parameters[0])
  4031.         if $game_temp.in_battle
  4032.           $game_actors[@parameters[0]].at = 0
  4033.           $game_actors[@parameters[0]].atp = 0
  4034.           $scene.spell_reset($game_actors[@parameters[0]])
  4035.           $game_actors[@parameters[0]].damage_pop = {}
  4036.           $game_actors[@parameters[0]].damage = {}
  4037.           $game_actors[@parameters[0]].damage_sp = {}
  4038.           $game_actors[@parameters[0]].critical = {}
  4039.           $game_actors[@parameters[0]].recover_hp = {}
  4040.           $game_actors[@parameters[0]].recover_sp = {}
  4041.           $game_actors[@parameters[0]].state_p = {}
  4042.           $game_actors[@parameters[0]].state_m = {}
  4043.           $game_actors[@parameters[0]].animation = []
  4044.         end
  4045.       else
  4046.         $game_party.remove_actor(@parameters[0])
  4047.       end
  4048.     end
  4049.     if $game_temp.in_battle
  4050.       $scene.status_window.update
  4051.     end
  4052.     # 継続
  4053.     return true
  4054.   end
  4055.   #--------------------------------------------------------------------------
  4056.   # ● HP の増減
  4057.   #--------------------------------------------------------------------------
  4058.   alias :command_311_rtab :command_311
  4059.   def command_311
  4060.     command_311_rtab
  4061.     if $game_temp.in_battle
  4062.       $scene.status_window.refresh
  4063.     end
  4064.   end
  4065.   #--------------------------------------------------------------------------
  4066.   # ● SP の増減
  4067.   #--------------------------------------------------------------------------
  4068.   alias :command_312_rtab :command_312
  4069.   def command_312
  4070.     command_312_rtab
  4071.     if $game_temp.in_battle
  4072.       $scene.status_window.refresh
  4073.     end
  4074.   end
  4075.   #--------------------------------------------------------------------------
  4076.   # ● ステートの変更
  4077.   #--------------------------------------------------------------------------
  4078.   alias :command_313_rtab :command_313
  4079.   def command_313
  4080.     command_313_rtab
  4081.     if $game_temp.in_battle
  4082.       $scene.status_window.refresh
  4083.     end
  4084.   end
  4085.   #--------------------------------------------------------------------------
  4086.   # ● 全回復
  4087.   #--------------------------------------------------------------------------
  4088.   alias :command_314_rtab :command_314
  4089.   def command_314
  4090.     command_314_rtab
  4091.     if $game_temp.in_battle
  4092.       $scene.status_window.refresh
  4093.     end
  4094.   end
  4095.   #--------------------------------------------------------------------------
  4096.   # ● EXP の増減
  4097.   #--------------------------------------------------------------------------
  4098.   alias :command_315_rtab :command_315
  4099.   def command_315
  4100.     command_315_rtab
  4101.     if $game_temp.in_battle
  4102.       $scene.status_window.refresh
  4103.     end
  4104.   end
  4105.   #--------------------------------------------------------------------------
  4106.   # ● レベルの増減
  4107.   #--------------------------------------------------------------------------
  4108.   alias :command_316_rtab :command_316
  4109.   def command_316
  4110.     command_316_rtab
  4111.     if $game_temp.in_battle
  4112.       $scene.status_window.refresh
  4113.     end
  4114.   end
  4115.   #--------------------------------------------------------------------------
  4116.   # ● パラメータの増減
  4117.   #--------------------------------------------------------------------------
  4118.   alias :command_317_rtab :command_317
  4119.   def command_317
  4120.     command_317_rtab
  4121.     if $game_temp.in_battle
  4122.       $scene.status_window.refresh
  4123.     end
  4124.   end
  4125.   #--------------------------------------------------------------------------
  4126.   # ● 装備の変更
  4127.   #--------------------------------------------------------------------------
  4128.   alias :command_319_rtab :command_319
  4129.   def command_319
  4130.     command_319_rtab
  4131.     if $game_temp.in_battle
  4132.       $scene.status_window.refresh
  4133.     end
  4134.   end
  4135.   #--------------------------------------------------------------------------
  4136.   # ● アクターの名前変更
  4137.   #--------------------------------------------------------------------------
  4138.   alias :command_320_rtab :command_320
  4139.   def command_320
  4140.     command_320_rtab
  4141.     if $game_temp.in_battle
  4142.       $scene.status_window.refresh
  4143.     end
  4144.   end
  4145.   #--------------------------------------------------------------------------
  4146.   # ● アクターのクラス変更
  4147.   #--------------------------------------------------------------------------
  4148.   alias :command_321_rtab :command_321
  4149.   def command_321
  4150.     command_321_rtab
  4151.     if $game_temp.in_battle
  4152.       $scene.status_window.refresh
  4153.     end
  4154.   end
  4155.   #--------------------------------------------------------------------------
  4156.   # ● アニメーションの表示
  4157.   #--------------------------------------------------------------------------
  4158.   def command_337
  4159.     # イテレータで処理
  4160.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4161.       # バトラーが存在する場合
  4162.       if battler.exist?
  4163.         # アニメーション ID を設定
  4164.         battler.animation.push([@parameters[2], true])
  4165.       end
  4166.     end
  4167.     # 継続
  4168.     return true
  4169.   end
  4170.   #--------------------------------------------------------------------------
  4171.   # ● ダメージの処理
  4172.   #--------------------------------------------------------------------------
  4173.   def command_338
  4174.     # 操作する値を取得
  4175.     value = operate_value(0, @parameters[2], @parameters[3])
  4176.     # イテレータで処理
  4177.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4178.       # バトラーが存在する場合
  4179.       if battler.exist?
  4180.         # HP を変更
  4181.         battler.hp -= value
  4182.         # 戦闘中なら
  4183.         if $game_temp.in_battle
  4184.           # ダメージを設定
  4185.           battler.damage["event"] = value
  4186.           battler.damage_pop["event"] = true
  4187.         end
  4188.       end
  4189.     end
  4190.     if $game_temp.in_battle
  4191.       $scene.status_window.refresh
  4192.     end
  4193.     # 継続
  4194.     return true
  4195.   end
  4196.   #--------------------------------------------------------------------------
  4197.   # ● アクションの強制
  4198.   #--------------------------------------------------------------------------
  4199.   def command_339
  4200.     # 戦闘中でなければ無視
  4201.     unless $game_temp.in_battle
  4202.       return true
  4203.     end
  4204.     # ターン数が 0 なら無視
  4205.     if $game_temp.battle_turn == 0
  4206.       return true
  4207.     end
  4208.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4209.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4210.       # バトラーが存在する場合
  4211.       if battler.exist?
  4212.         # アクションを設定
  4213.         battler.current_action.force_kind = @parameters[2]
  4214.         if battler.current_action.force_kind == 0
  4215.           battler.current_action.force_basic = @parameters[3]
  4216.         else
  4217.           battler.current_action.force_skill_id = @parameters[3]
  4218.         end
  4219.         # 行動対象を設定
  4220.         if @parameters[4] == -2
  4221.           if battler.is_a?(Game_Enemy)
  4222.             battler.current_action.decide_last_target_for_enemy
  4223.           else
  4224.             battler.current_action.decide_last_target_for_actor
  4225.           end
  4226.         elsif @parameters[4] == -1
  4227.           if battler.is_a?(Game_Enemy)
  4228.             battler.current_action.decide_random_target_for_enemy
  4229.           else
  4230.             battler.current_action.decide_random_target_for_actor
  4231.           end
  4232.         elsif @parameters[4] >= 0
  4233.           battler.current_action.target_index = @parameters[4]
  4234.         end
  4235.         # アクションが有効かつ [すぐに実行] の場合
  4236.         if battler.current_action.valid? and @parameters[5] == 1
  4237.           # 強制対象のバトラーを設定
  4238.           $game_temp.forcing_battler = battler
  4239.           # インデックスを進める
  4240.           @index += 1
  4241.           # 終了
  4242.           return false
  4243.         elsif battler.current_action.valid? and @parameters[5] == 0
  4244.           battler.current_action.forcing = true
  4245.         end
  4246.       end
  4247.     end
  4248.     # 継続
  4249.     return true
  4250.   end
  4251. end

  4252. #==============================================================================
  4253. # ■ Spriteモジュール
  4254. #------------------------------------------------------------------------------
  4255. #  アニメーションの管理を行うモジュールです。
  4256. #==============================================================================

  4257. module RPG
  4258.   class Sprite < ::Sprite
  4259.     def initialize(viewport = nil)
  4260.       super(viewport)
  4261.       @_whiten_duration = 0
  4262.       @_appear_duration = 0
  4263.       @_escape_duration = 0
  4264.       @_collapse_duration = 0
  4265.       @_damage = []
  4266.       @_animation = []
  4267.       @_animation_duration = 0
  4268.       @_blink = false
  4269.     end
  4270.     def damage(value, critical, type = 0)
  4271.       if value.is_a?(Numeric)
  4272.         damage_string = value.abs.to_s
  4273.       else
  4274.         damage_string = value.to_s
  4275.       end
  4276.       bitmap = Bitmap.new(160, 48)
  4277.       bitmap.font.name = "Arial Black"
  4278.       bitmap.font.size = 32
  4279.       bitmap.font.color.set(0, 0, 0)
  4280.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4281.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4282.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4283.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4284.       if value.is_a?(Numeric) and value < 0
  4285.         if type == 0
  4286.           bitmap.font.color.set(176, 255, 144)
  4287.         else
  4288.           bitmap.font.color.set(176, 144, 255)
  4289.         end
  4290.       else
  4291.         if type == 0
  4292.           bitmap.font.color.set(255, 255, 255)
  4293.         else
  4294.           bitmap.font.color.set(255, 176, 144)
  4295.         end
  4296.       end
  4297.       if type == 2
  4298.         bitmap.font.color.set(255, 224, 128)
  4299.       end
  4300.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4301.       if critical
  4302.         string = "CRITICAL"
  4303.         bitmap.font.size = 20
  4304.         bitmap.font.color.set(0, 0, 0)
  4305.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4306.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4307.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4308.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4309.         bitmap.font.color.set(255, 255, 255)
  4310.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4311.       end
  4312.       num = @_damage.size
  4313.       if type != 2
  4314.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4315.       else
  4316.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4317.       end
  4318.       @_damage[num][0].bitmap = bitmap
  4319.       @_damage[num][0].ox = 80 + self.viewport.ox
  4320.       @_damage[num][0].oy = 20 + self.viewport.oy
  4321.       if self.battler.is_a?(Game_Actor)
  4322.         @_damage[num][0].x = self.x
  4323.         @_damage[num][0].y = self.y - self.oy / 2
  4324.       else
  4325.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4326.                             self.ox + self.src_rect.width / 2
  4327.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4328.                             self.viewport.rect.y
  4329.         @_damage[num][0].zoom_x = self.zoom_x
  4330.         @_damage[num][0].zoom_y = self.zoom_y
  4331.         @_damage[num][0].z = 3000
  4332.       end
  4333.     end
  4334.     def animation(animation, hit)
  4335.       return if animation == nil
  4336.       num = @_animation.size
  4337.       @_animation.push([animation, hit, animation.frame_max, []])
  4338.       bitmap = RPG::Cache.animation(animation.animation_name,
  4339.                                     animation.animation_hue)
  4340.       if @@_reference_count.include?(bitmap)
  4341.         @@_reference_count[bitmap] += 1
  4342.       else
  4343.         @@_reference_count[bitmap] = 1
  4344.       end
  4345.       if @_animation[num][0].position != 3 or
  4346.           not @@_animations.include?(animation)
  4347.         for i in 0..15
  4348.           sprite = ::Sprite.new
  4349.           sprite.bitmap = bitmap
  4350.           sprite.visible = false
  4351.           @_animation[num][3].push(sprite)
  4352.         end
  4353.         unless @@_animations.include?(animation)
  4354.           @@_animations.push(animation)
  4355.         end
  4356.       end
  4357.       update_animation(@_animation[num])
  4358.     end
  4359.     def loop_animation(animation)
  4360.       return if animation == @_loop_animation
  4361.       dispose_loop_animation
  4362.       @_loop_animation = animation
  4363.       return if @_loop_animation == nil
  4364.       @_loop_animation_index = 0
  4365.       animation_name = @_loop_animation.animation_name
  4366.       animation_hue = @_loop_animation.animation_hue
  4367.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4368.       if @@_reference_count.include?(bitmap)
  4369.         @@_reference_count[bitmap] += 1
  4370.       else
  4371.         @@_reference_count[bitmap] = 1
  4372.       end
  4373.       @_loop_animation_sprites = []
  4374.       for i in 0..15
  4375.         sprite = ::Sprite.new
  4376.         sprite.bitmap = bitmap
  4377.         sprite.visible = false
  4378.         @_loop_animation_sprites.push(sprite)
  4379.       end
  4380.       # update_loop_animation
  4381.     end
  4382.     def dispose_damage
  4383.       for damage in @_damage.reverse
  4384.         damage[0].bitmap.dispose
  4385.         damage[0].dispose
  4386.         @_damage.delete(damage)
  4387.       end
  4388.     end
  4389.     def dispose_animation
  4390.       for anime in @_animation.reverse
  4391.         sprite = anime[3][0]
  4392.         if sprite != nil
  4393.           @@_reference_count[sprite.bitmap] -= 1
  4394.           if @@_reference_count[sprite.bitmap] == 0
  4395.             sprite.bitmap.dispose
  4396.           end
  4397.         end
  4398.         for sprite in anime[3]
  4399.           sprite.dispose
  4400.         end
  4401.         @_animation.delete(anime)
  4402.       end
  4403.     end
  4404.     def effect?
  4405.       @_whiten_duration > 0 or
  4406.       @_appear_duration > 0 or
  4407.       @_escape_duration > 0 or
  4408.       @_collapse_duration > 0 or
  4409.       @_damage.size == 0 or
  4410.       @_animation.size == 0
  4411.     end
  4412.     def update
  4413.       super
  4414.       if @_whiten_duration > 0
  4415.         @_whiten_duration -= 1
  4416.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4417.       end
  4418.       if @_appear_duration > 0
  4419.         @_appear_duration -= 1
  4420.         self.opacity = (16 - @_appear_duration) * 16
  4421.       end
  4422.       if @_escape_duration > 0
  4423.         @_escape_duration -= 1
  4424.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4425.       end
  4426.       if @_collapse_duration > 0
  4427.         @_collapse_duration -= 1
  4428.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4429.       end
  4430.       for damage in @_damage
  4431.         if damage[1] > 0
  4432.           damage[1] -= 1
  4433.           damage[4] -= 3
  4434.           damage[2] -= damage[4]
  4435.           if self.battler.is_a?(Game_Actor)
  4436.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4437.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4438.           else
  4439.             damage[0].x = self.x + self.viewport.rect.x -
  4440.                           self.ox + self.src_rect.width / 2 +
  4441.                           (40 - damage[1]) * damage[3] / 10
  4442.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4443.                           self.viewport.rect.y + damage[2] / 10
  4444.             damage[0].zoom_x = self.zoom_x
  4445.             damage[0].zoom_y = self.zoom_y
  4446.           end
  4447.           damage[0].z = 2960 + damage[1]
  4448.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4449.           if damage[1] == 0
  4450.             damage[0].bitmap.dispose
  4451.             damage[0].dispose
  4452.             @_damage.delete(damage)
  4453.           end
  4454.         end
  4455.       end
  4456.       for anime in @_animation
  4457.         if (Graphics.frame_count % 2 == 0)
  4458.           anime[2] -= 1
  4459.           update_animation(anime)
  4460.         end
  4461.       end
  4462.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4463.         update_loop_animation
  4464.         @_loop_animation_index += 1
  4465.         @_loop_animation_index %= @_loop_animation.frame_max
  4466.       end
  4467.       if @_blink
  4468.         @_blink_count = (@_blink_count + 1) % 32
  4469.         if @_blink_count < 16
  4470.           alpha = (16 - @_blink_count) * 6
  4471.         else
  4472.           alpha = (@_blink_count - 16) * 6
  4473.         end
  4474.         self.color.set(255, 255, 255, alpha)
  4475.       end
  4476.       @@_animations.clear
  4477.     end
  4478.     def update_animation(anime)
  4479.       if anime[2] > 0
  4480.         frame_index = anime[0].frame_max - anime[2]
  4481.         cell_data = anime[0].frames[frame_index].cell_data
  4482.         position = anime[0].position
  4483.         animation_set_sprites(anime[3], cell_data, position)
  4484.         for timing in anime[0].timings
  4485.           if timing.frame == frame_index
  4486.             animation_process_timing(timing, anime[1])
  4487.           end
  4488.         end
  4489.       else
  4490.         @@_reference_count[anime[3][0].bitmap] -= 1
  4491.         if @@_reference_count[anime[3][0].bitmap] == 0
  4492.             anime[3][0].bitmap.dispose
  4493.         end
  4494.         for sprite in anime[3]
  4495.           sprite.dispose
  4496.         end
  4497.         @_animation.delete(anime)
  4498.       end
  4499.     end
  4500.     def animation_set_sprites(sprites, cell_data, position)
  4501.       for i in 0..15
  4502.         sprite = sprites[i]
  4503.         pattern = cell_data[i, 0]
  4504.         if sprite == nil or pattern == nil or pattern == -1
  4505.           sprite.visible = false if sprite != nil
  4506.           next
  4507.         end
  4508.         sprite.visible = true
  4509.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4510.         if position == 3
  4511.           if self.viewport != nil
  4512.             sprite.x = self.viewport.rect.width / 2
  4513.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4514.               sprite.y = self.viewport.rect.height - 320
  4515.             else
  4516.               sprite.y = self.viewport.rect.height - 160
  4517.             end
  4518.           else
  4519.             sprite.x = 320
  4520.             sprite.y = 240
  4521.           end
  4522.         else
  4523.           sprite.x = self.x + self.viewport.rect.x -
  4524.                       self.ox + self.src_rect.width / 2
  4525.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4526.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4527.                         self.viewport.rect.y
  4528.             if position == 0
  4529.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4530.             elsif position == 2
  4531.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4532.             end
  4533.           else
  4534.             sprite.y = self.y + self.viewport.rect.y -
  4535.                         self.oy + self.src_rect.height / 2
  4536.             sprite.y -= self.src_rect.height / 4 if position == 0
  4537.             sprite.y += self.src_rect.height / 4 if position == 2
  4538.           end
  4539.         end
  4540.         sprite.x += cell_data[i, 1]
  4541.         sprite.y += cell_data[i, 2]
  4542.         sprite.z = 2000
  4543.         sprite.ox = 96
  4544.         sprite.oy = 96
  4545.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4546.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4547.         if position != 3
  4548.           sprite.zoom_x *= self.zoom_x
  4549.           sprite.zoom_y *= self.zoom_y
  4550.         end
  4551.         sprite.angle = cell_data[i, 4]
  4552.         sprite.mirror = (cell_data[i, 5] == 1)
  4553.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4554.         sprite.blend_type = cell_data[i, 7]
  4555.       end
  4556.     end
  4557.     def x=(x)
  4558.       sx = x - self.x
  4559.       if sx != 0
  4560.         for anime in @_animation
  4561.           if anime[3] != nil
  4562.             for i in 0..15
  4563.               anime[3][i].x += sx
  4564.             end
  4565.           end
  4566.         end
  4567.         if @_loop_animation_sprites != nil
  4568.           for i in 0..15
  4569.             @_loop_animation_sprites[i].x += sx
  4570.           end
  4571.         end
  4572.       end
  4573.       super
  4574.     end
  4575.     def y=(y)
  4576.       sy = y - self.y
  4577.       if sy != 0
  4578.         for anime in @_animation
  4579.           if anime[3] != nil
  4580.             for i in 0..15
  4581.               anime[3][i].y += sy
  4582.             end
  4583.           end
  4584.         end
  4585.         if @_loop_animation_sprites != nil
  4586.           for i in 0..15
  4587.             @_loop_animation_sprites[i].y += sy
  4588.           end
  4589.         end
  4590.       end
  4591.       super
  4592.     end
  4593.   end
  4594. end

  4595. #------------------------------------------------------------------------------
  4596. #  Bitmapクラスに新たな機能を追加します。
  4597. #==============================================================================

  4598. class Bitmap
  4599.   #--------------------------------------------------------------------------
  4600.   # ● 矩形をグラデーション表示
  4601.   #     color1 : スタートカラー
  4602.   #     color2 : エンドカラー
  4603.   #     align  :  0:横にグラデーション
  4604.   #               1:縦にグラデーション
  4605.   #               2:斜めにグラデーション(激重につき注意)
  4606.   #--------------------------------------------------------------------------
  4607.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4608.     if align == 0
  4609.       for i in x...x + width
  4610.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4611.         green = color1.green +
  4612.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4613.         blue  = color1.blue +
  4614.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4615.         alpha = color1.alpha +
  4616.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4617.         color = Color.new(red, green, blue, alpha)
  4618.         fill_rect(i, y, 1, height, color)
  4619.       end
  4620.     elsif align == 1
  4621.       for i in y...y + height
  4622.         red   = color1.red +
  4623.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4624.         green = color1.green +
  4625.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4626.         blue  = color1.blue +
  4627.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4628.         alpha = color1.alpha +
  4629.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4630.         color = Color.new(red, green, blue, alpha)
  4631.         fill_rect(x, i, width, 1, color)
  4632.       end
  4633.     elsif align == 2
  4634.       for i in x...x + width
  4635.         for j in y...y + height
  4636.           red   = color1.red + (color2.red - color1.red) *
  4637.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4638.           green = color1.green + (color2.green - color1.green) *
  4639.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4640.           blue  = color1.blue + (color2.blue - color1.blue) *
  4641.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4642.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4643.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4644.           color = Color.new(red, green, blue, alpha)
  4645.           set_pixel(i, j, color)
  4646.         end
  4647.       end
  4648.     elsif align == 3
  4649.       for i in x...x + width
  4650.         for j in y...y + height
  4651.           red   = color1.red + (color2.red - color1.red) *
  4652.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4653.           green = color1.green + (color2.green - color1.green) *
  4654.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4655.           blue  = color1.blue + (color2.blue - color1.blue) *
  4656.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4657.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4658.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4659.           color = Color.new(red, green, blue, alpha)
  4660.           set_pixel(i, j, color)
  4661.         end
  4662.       end
  4663.     end
  4664.   end
  4665. end
复制代码
[img]http://rpg.blue/data/attachment/forum/201008/11/105320eudv222d7jgvg24p.gif[img]
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-3-28 20:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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