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

Project1

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

[已经过期] XP的横版战斗怎么设置技能?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
257 小时
注册时间
2012-7-16
帖子
86
跳转到指定楼层
1
发表于 2013-6-30 15:58:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个XP横版战斗怎么设置技能?




RUBY 代码复制
  1. =begin
  2.   #--------------------------------------------------------------------------
  3.  # ● 人物行走图做战斗图像(附加动画) ver1.02
  4.   #--------------------------------------------------------------------------
  5.   制作者 らい
  6.   翻译:忧郁的涟漪
  7.  
  8.     
  9.   图像文件的规格
  10.  
  11.   ● 巴特勒图像(似乎指的是战斗图像)
  12.  
  13.   使用步行图片。
  14.    
  15.   ● 武器的图像
  16.  
  17.   就是武器图标的图像(ICO图)  
  18.       
  19. =end
  20.  
  21.  
  22. module Side_view
  23.   #--------------------------------------------------------------------------
  24.   # ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
  25.   #    在Scene_Battle计算方法是否是方法synthe?
  26.   #    在自动不想认识的时候,请重写。
  27.   #--------------------------------------------------------------------------
  28.   if Scene_Battle.method_defined?("synthe?")
  29.     RTAB = true
  30.   else
  31.     RTAB = false
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 改正RATB中的位置误差 ☆自动识别
  35.   #    在自动不想认识的时候,请重写。
  36.   #--------------------------------------------------------------------------
  37.   def camera_correctness
  38.     return false if !RTAB
  39.     begin
  40.       return $scene.drive
  41.     rescue
  42.       return false
  43.     end
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 队伍中的最大人数
  47.   #--------------------------------------------------------------------------
  48.   Party_max = 4
  49.   #--------------------------------------------------------------------------
  50.   # ● 战斗图的扩大率(1.0的时候是保持原有大小)
  51.   #--------------------------------------------------------------------------
  52.   CHAR_ZOOM = 1.0
  53.   #--------------------------------------------------------------------------
  54.   # ● 光标的位置修正(基本不需要改~)
  55.   #--------------------------------------------------------------------------
  56.   ARROW_OX = 0
  57.   ARROW_OY = 64
  58.   #--------------------------------------------------------------------------
  59.   # ● 名状态作为飞行管理的排列(不知道什么意思....)
  60.   #--------------------------------------------------------------------------
  61.   FLY_STATES = ["飛行"]
  62.   #--------------------------------------------------------------------------
  63.   # ● 战斗画面的位置
  64.   #--------------------------------------------------------------------------
  65.   PARTY_X = 480     # 队伍 X 位置
  66.   PARTY_Y = 120     # 队伍 Y 位置
  67.   FORMATION_X = 32  # 各个角色之间的间隔 X
  68.   FORMATION_Y = 48  # 各个角色之间的间隔 Y
  69.   #--------------------------------------------------------------------------
  70.   # ● 自定义常数
  71.   #--------------------------------------------------------------------------
  72.   NORMAL   = "NORMAL"
  73.   WALK_R   = "WALK_R"
  74.   WALK_L   = "WALK_L"
  75.   ATTACK   = "ATTACK"
  76.   ATTACK_R = "ATTACK_R"
  77.   ATTACK_L = "ATTACK_L"
  78.   MAGIC    = "MAGIC"
  79.   ITEM     = "ITEM"
  80.   # 动画的设定
  81.   ANIME = {
  82.     # [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
  83.     NORMAL            => [1,true , 0,false, true ,""    ], # 通常待击
  84.     WALK_R            => [2,true , 2,false, false,""    ], # 右移动
  85.     WALK_L            => [1,true , 2,false, false,""    ], # 左移动
  86.     ATTACK_R          => [1,false, 2,true , false,"右手"], # 右手攻击
  87.     ATTACK_L          => [1,false, 2,true , false,"左手"], # 左手攻击
  88.     MAGIC             => [1,false, 2,false, false,""    ], # 右手攻击
  89.     ITEM              => [1,false, 2,false, false,""    ], # 左手攻击
  90.     }
  91.  
  92.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  93.   ANIME.default = [1,false,12,false,"",""]
  94.  
  95.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  96.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  97.   DUAL_WEAPONS_ANIME = [ATTACK]
  98.  
  99.   #--------------------------------------------------------------------------
  100.   # ● 摇晃的设定
  101.   #--------------------------------------------------------------------------
  102.   SHAKE_FILE = "摇晃"  # 文件名
  103.   SHAKE_POWER = 5          # 强度
  104.   SHAKE_SPEED = 5          # 速度
  105.   SHAKE_DURATION = 5      # 时间
  106.   #--------------------------------------------------------------------------
  107.   # ● 上下反转地的设定
  108.   #--------------------------------------------------------------------------
  109.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  110.   #--------------------------------------------------------------------------
  111.   # ● 左右反转地的设定
  112.   #--------------------------------------------------------------------------
  113.   REVERSE_FILE = "左右反转" # 文件名
  114.   #--------------------------------------------------------------------------
  115.   # ● 回转地的设定
  116.   #--------------------------------------------------------------------------
  117.   TURNING_FILE = "回转" # 文件名
  118.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  119.   TURNING_SPEED = 40    # 速度
  120.   TURNING_DURATION = 1  # 回转数
  121.   #--------------------------------------------------------------------------
  122.   # ● 移动的设定
  123.   #--------------------------------------------------------------------------
  124.   MOVE_FILE = "移动"             # 文件名
  125.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  126.   MOVE_SPEED = 32                # 速度
  127.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  128.   #--------------------------------------------------------------------------
  129.   # ● 动画追加的设定
  130.   #--------------------------------------------------------------------------
  131.   ADD_ANIME_FILE = "动画追加"  # 文件名
  132.   ADD_ANIME_ID = 0               # 动画的ID
  133.   #--------------------------------------------------------------------------
  134.   # ● 债务不履行声明和RTAB的数据转换
  135.   #--------------------------------------------------------------------------
  136.   def convert_battler
  137.     return RTAB ? @active_actor : @active_battler
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 债务不履行声明和RTAB的数据转换2
  141.   #--------------------------------------------------------------------------
  142.   def convert_battler2(*arg)
  143.     return RTAB ? arg[0] : @active_battler
  144.   end
  145. end
  146.  
  147. #--------------------------------------------------------------------------
  148. # ● 行动設定
  149. #--------------------------------------------------------------------------
  150. module BattleActions
  151.  
  152.   # 下のものはあくまでも一例なので
  153.   # 独自に作ってください。
  154.  
  155.   Actions = {
  156.  
  157.   "通常攻撃" => [
  158.  
  159.   "閃きアニメ",
  160.   "アクターアニメ変更#WALK_L",
  161.   "移動#target,32,0,64,0",
  162.   "行動アニメ",
  163.   "アクターアニメ変更#ATTACK",
  164.   "遠距離アニメ",
  165.   "対象アニメ",
  166.   "アクターアニメ変更#WALK_L",
  167.   "SEの演奏#016-Jump02,80,100",
  168.   "移動#self,0,0,48,32",
  169.   "終了"
  170.   ],
  171.  
  172.   "エネミー攻撃" => [
  173.  
  174.   "閃きアニメ",
  175.   "アクターアニメ変更#WALK_L",
  176.   "移動#self,-36,0,12,0",
  177.   "行動アニメ",
  178.   "アクターアニメ変更#ATTACK",
  179.   "遠距離アニメ",
  180.   "対象アニメ",
  181.   "アクターアニメ変更#WALK_L",
  182.   "移動#self,0,0,12,0",
  183.   "終了"
  184.   ],
  185.  
  186.  
  187.   "術発動" => [
  188.  
  189.   "閃きアニメ",
  190.   "アクターアニメ変更#WALK_L",
  191.   "移動#self,-32,0,4,0",
  192.   "アクターアニメ変更#MAGIC",
  193.   "行動アニメ",
  194.   "ウエイト#15",
  195.   "遠距離アニメ",
  196.   "対象アニメ",
  197.   "アクターアニメ変更#WALK_L",
  198.   "移動#self,0,0,4,2",
  199.   "終了"
  200.   ],
  201.  
  202.   "アイテム使用" => [
  203.  
  204.   "閃きアニメ",
  205.   "アクターアニメ変更#WALK_L",
  206.   "移動#self,-32,0,4,0",
  207.   "行動アニメ",
  208.   "アクターアニメ変更#ITEM",
  209.   "ウエイト#15",
  210.   "遠距離アニメ",
  211.   "対象アニメ",
  212.   "アクターアニメ変更#WALK_L",
  213.   "移動#self,0,0,4,2",
  214.   "終了"
  215.   ],
  216.  
  217.   "払い抜け" => [
  218.  
  219.   "閃きアニメ",
  220.   "アクターアニメ変更#WALK_L",
  221.   "移動#target_near,50,0,48,30",  
  222.   "左右反転",
  223.   "アクターアニメ固定#ATTACK#3",
  224.   "行動アニメ",
  225.   "SEの演奏#135-Light01,100,100",
  226.   "アニメーションの表示#self,42",
  227.   "ウエイト#15",
  228.   "左右反転",
  229.   "残像表示",
  230.   "移動#target_far,-50,0,48,0",
  231.   "対象アニメ",
  232.   "残像消去",
  233.   "アニメ固定解除",
  234.   "アクターアニメ変更#WALK_L",
  235.   "移動#self,0,0,48,1,0",
  236.   "終了"
  237.   ],
  238.   } # ここで終わり 消さないでください
  239.  
  240. end
  241.  
  242. module RPG
  243.   class Weapon
  244.     #--------------------------------------------------------------------------
  245.     # ● アクション設定
  246.     #--------------------------------------------------------------------------
  247.     def battle_actions
  248.       case @id
  249.       when 1 # ブロンズソード
  250.         return BattleActions::Actions["通常攻撃"]
  251.       end
  252.       return BattleActions::Actions["通常攻撃"]
  253.     end
  254.   end
  255.   class Skill
  256.     #--------------------------------------------------------------------------
  257.     # ● アクション設定
  258.     #--------------------------------------------------------------------------
  259.     def battle_actions
  260.       if self.magic?
  261.         return BattleActions::Actions["術発動"]
  262.       else
  263.         return BattleActions::Actions["払い抜け"]
  264.       end
  265.     end
  266.   end
  267.   class Item
  268.     #--------------------------------------------------------------------------
  269.     # ● アクション設定
  270.     #--------------------------------------------------------------------------
  271.     def battle_actions
  272.       return BattleActions::Actions["アイテム使用"]
  273.     end
  274.   end
  275. end
  276. class Game_Enemy < Game_Battler
  277.   #--------------------------------------------------------------------------
  278.   # ● アクション設定
  279.   #--------------------------------------------------------------------------
  280.   def battle_actions
  281.     return BattleActions::Actions["エネミー攻撃"]
  282.   end
  283. end
  284. =begin
  285. #--------------------------------------------------------------------------
  286. # ● 遠距離アニメーション
  287. #--------------------------------------------------------------------------
  288.  ☆ 説明
  289.  
  290.    行動者から対象者にアニメを飛ばします。
  291.    飛ばすアニメを データベース‐アニメーション で作ります。
  292.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。
  293.  
  294.  
  295.   ● カスタマイズ方法
  296.     
  297.     case @id
  298.     when 17,18,19,20
  299.       return [101,32,false,false]
  300.     when 21,22,23,24
  301.       return [102,32,false,false]
  302.     end
  303.     return 0
  304.     
  305.     のように描くとID別に指定可能です。
  306.     
  307.     
  308.   ● アニメーションID
  309.  
  310.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
  311.  
  312.     
  313.   ● スピード
  314.  
  315.   大きいほうが早い(0だとアニメは移動しません)
  316.  
  317.   1 = 1フレームで1ドット進むと考えてください。
  318.  
  319.   ● 往復するか?
  320.  
  321.   true とした場合、ブーメランのようにアニメが戻ります。
  322.  
  323.   ● 直線(false)or曲線(true)
  324.  
  325.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  326.   false = 対象に向かって直線で、アニメが飛びます。
  327.     
  328. =end
  329. module RPG
  330.   class Weapon
  331.     #--------------------------------------------------------------------------
  332.     # ● 遠距離アニメーション
  333.     #--------------------------------------------------------------------------
  334.     def flying_anime
  335.       # ID 指定 の例
  336.       #case @id
  337.       #when 34 # ブーメランっぽいやつ
  338.       #  return [103,32,true,true]
  339.       #when 17,18,19,20
  340.       #  return [101,32,false,false]
  341.       #when 21,22,23,24
  342.       #  return [102,32,false,false]
  343.       #end
  344.       return [0,0,false,false]
  345.     end
  346.   end
  347.   class Skill
  348.     #--------------------------------------------------------------------------
  349.     # ● 遠距離アニメーション
  350.     #--------------------------------------------------------------------------
  351.     def flying_anime
  352.       return [0,0,false,false]
  353.     end
  354.   end
  355.   class Item
  356.     #--------------------------------------------------------------------------
  357.     # ● 遠距離アニメーション
  358.     #--------------------------------------------------------------------------
  359.     def flying_anime
  360.       return [0,0,false,false]
  361.     end
  362.   end
  363. end
  364.  
  365. class Game_Enemy < Game_Battler
  366.   #--------------------------------------------------------------------------
  367.   # ● 遠距離アニメーション
  368.   #--------------------------------------------------------------------------
  369.   def flying_anime
  370.     return [0,0,false,false]
  371.   end
  372. end
  373. #==============================================================================
  374. # ■ Game_Battler
  375. #==============================================================================
  376. class Game_Battler
  377.   include Side_view
  378.   #--------------------------------------------------------------------------
  379.   # ● 追加・公開インスタンス変数
  380.   #--------------------------------------------------------------------------
  381.   attr_accessor :height                  # 画像の高さ
  382.   attr_accessor :real_x                  # X座標補正
  383.   attr_accessor :real_y                  # Y座標補正
  384.   attr_accessor :real_zoom               # 拡大率
  385.   attr_accessor :wait_count              # アニメーション 待ち時間
  386.   attr_accessor :wait_count2             # アニメーション 待ち時間2
  387.   attr_accessor :pattern                 # アニメーション カウント(キャラ)
  388.   attr_accessor :shake                   # シェイク開始フラッグ
  389.   attr_accessor :reverse                 # 左右反転フラッグ
  390.   attr_accessor :shadow                  # 残像フラッグ
  391.   attr_accessor :flash_flag              # 閃きフラッグ
  392.   attr_reader   :ox                      # X座標補正
  393.   attr_reader   :oy                      # Y座標補正
  394.   attr_reader   :flying_x                # 遠距離アニメX座標
  395.   attr_reader   :flying_y                # 遠距離アニメY座標
  396.   attr_reader   :flying_anime            # 遠距離アニメ
  397.   attr_reader   :animation1_on           # 行動アニメ開始フラッグ
  398.   attr_reader   :animation2_on           # 対象アニメ開始フラッグ
  399.   #--------------------------------------------------------------------------
  400.   # ● デフォルトのアニメーション待ち時間を取得
  401.   #--------------------------------------------------------------------------
  402.   def animation_duration=(animation_duration)
  403.     @_animation_duration = animation_duration
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● バトル開始時のセットアップ
  407.   #--------------------------------------------------------------------------
  408.   def start_battle
  409.     [url=home.php?mod=space&uid=291977]@height[/url] = 0
  410.     @real_x = 0
  411.     @real_y = 0
  412.     @real_zoom = 1.0
  413.     @battler_condition = ""
  414.     @action = nil
  415.     @battle_actions = []
  416.     @battler_action = false
  417.     @step = 0
  418.     @anime_on = false
  419.     @wait_count = 0
  420.     @wait_count2 = 0
  421.     @ox = 0
  422.     @oy = 0
  423.     @pattern = 0
  424.     @pattern_log = true
  425.     @pattern_freeze = false
  426.     @condition_freeze = false
  427.     @active = false
  428.     @move_distance = nil
  429.     @move_wait = 0
  430.     @move_coordinates = [0,0,0,0]
  431.     @flying_distance = nil
  432.     @flying_wait = 0
  433.     @flying_x = 0
  434.     @flying_y = 0
  435.     @flash_flag = {}
  436.     self.flying_clear
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 移動中判定
  440.   #--------------------------------------------------------------------------
  441.   def moving?
  442.     # X座標補正または、Y座標補正が0でなければ、移動中
  443.     return (@ox != 0 or @oy != 0)
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # ● 移動終了判定
  447.   #--------------------------------------------------------------------------
  448.   def move_end?
  449.     return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● アクション開始設定
  453.   #--------------------------------------------------------------------------
  454.   def action(flag = true)
  455.     @battler_action = flag
  456.     @animation1_on = false
  457.     @animation2_on = false
  458.     @step = "setup"
  459.   end   
  460.   #--------------------------------------------------------------------------
  461.   # ● アクション中判定
  462.   #--------------------------------------------------------------------------
  463.   def action?
  464.     return @battler_action
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 閃き判定
  468.   #--------------------------------------------------------------------------
  469.   def flash?
  470.     return @flash_flg
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 戦闘不能判定
  474.   #--------------------------------------------------------------------------
  475.   def anime_dead?
  476.     if $game_temp.in_battle and !RTAB
  477.       if [2,3,4,5].include?($scene.phase4_step)
  478.         return @last_dead
  479.       end
  480.     end
  481.     return @last_dead = self.dead?
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● ピンチ状態判定
  485.   #--------------------------------------------------------------------------
  486.   def crisis?
  487.     if $game_temp.in_battle and !RTAB
  488.       if [2,3,4,5].include?($scene.phase4_step)
  489.         return @last_crisis
  490.       end
  491.     end
  492.     return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● バッドステート判定
  496.   #--------------------------------------------------------------------------
  497.   def badstate?
  498.     for i in @states
  499.       unless $data_states[i].nonresistance
  500.         return true
  501.       end
  502.     end
  503.     return false
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 飛行
  507.   #--------------------------------------------------------------------------
  508.   def fly
  509.     if [url=home.php?mod=space&uid=14121]@fly[/url] != nil
  510.       return @fly
  511.     end
  512.     for id in @states
  513.       if FLY_STATES.include?($data_states[id].name)
  514.         return 60
  515.       end
  516.     end
  517.     return 0
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● 遠距離アニメ目標座標の計算
  521.   #--------------------------------------------------------------------------
  522.   def flying_setup
  523.     # 二度目は実行しない
  524.     return if @flying_distance != nil && !camera_correctness
  525.     if RTAB
  526.       targets = @target
  527.     else
  528.       targets = $scene.target_battlers
  529.     end
  530.     # 目的座標を計算
  531.     @f_target_x = 0
  532.     @f_target_y = 0
  533.     for t in targets
  534.       @f_target_x += t.screen_x
  535.       @f_target_y += t.screen_y
  536.     end
  537.     if targets != []
  538.       @f_target_x /= targets.size
  539.       @f_target_y /= targets.size
  540.     else
  541.       @flying_distance = 0
  542.       return
  543.     end
  544.     # 距離の計算
  545.     @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● 遠距離アニメ
  549.   #--------------------------------------------------------------------------
  550.   def flying_animation
  551.     # 戻る
  552.     if @step != "flying" or @flying_distance.nil?
  553.       return [false,true]
  554.     end
  555.     # あらかじめ計算
  556.     self_x = self.screen_x
  557.     self_y = self.screen_y
  558.     @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
  559.     n1 = @flying_wait / @flying_distance.to_f
  560.     if @flying_distance - @flying_wait > @flying_distance / 2
  561.       n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
  562.     else
  563.       n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
  564.     end
  565.     if !@flying_anime[4]
  566.       # 直線移動
  567.       x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  568.       y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
  569.     else
  570.       # 曲線移動
  571.       if !@flying_proceed_end
  572.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  573.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
  574.       else
  575.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  576.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
  577.       end
  578.     end
  579.     # 座標代入
  580.     @flying_x = x
  581.     @flying_y = y
  582.     # ウエイト
  583.     if !@flying_proceed_end
  584.       # 開始
  585.       @flying_proceed_start = @flying_wait == 0
  586.       @flying_wait += @flying_anime[1]
  587.       @flying_wait = [@flying_wait,@flying_distance].min
  588.       @flying_proceed_end = @flying_wait == @flying_distance
  589.     else
  590.       # 開始
  591.       @flying_return_start = @flying_wait == @flying_distance
  592.       @flying_wait -= @flying_anime[1]
  593.       @flying_wait = [@flying_wait,0].max
  594.       @flying_return_end = @flying_wait == 0
  595.     end
  596.     if @flying_anime[1] == 0
  597.       @flying_end = true
  598.     elsif !@flying_anime[2]
  599.       @flying_end = @flying_proceed_end
  600.     else
  601.       @flying_end = @flying_return_end
  602.     end
  603.     # 値を返す(アニメ開始,アニメ終了)
  604.     return [@flying_proceed_start,@flying_end]
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● 遠距離アニメ初期化
  608.   #--------------------------------------------------------------------------
  609.   def flying_clear
  610.     @flying_proceed_start = false
  611.     @flying_proceed_end = false
  612.     @flying_return_start = false
  613.     @flying_return_end = false
  614.     @flying_end = false
  615.     @flying_anime = [0,0,false]
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● 移動
  619.   #--------------------------------------------------------------------------
  620.   def move
  621.     # 距離の計算
  622.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  623.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  624.     if @move_distance > 0
  625.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  626.       array = @move_coordinates
  627.       # ジャンプ補正値の計算
  628.       if @move_distance - @move_wait > @move_distance / 2
  629.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  630.       else
  631.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  632.       end
  633.       jump = @move_action[4] > 0 ? -jump : jump
  634.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  635.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  636.       # ウエイト
  637.       @move_wait -= @move_action[3]
  638.       @move_wait = [@move_wait,0].max
  639.     end
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● 移動アクションの取得
  643.   #--------------------------------------------------------------------------
  644.   def get_move_action
  645.     string = @action.split(/#/)[1]
  646.     string = string.split(/,/)
  647.     @move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ● アクションの取得
  651.   #--------------------------------------------------------------------------
  652.   def get_step
  653.     if @action.nil?
  654.       @step = "finish"
  655.       return
  656.     end
  657.     string = @action.split(/#/)[0]
  658.     if string =~ "移動"
  659.       @step = "moving_setup"
  660.     elsif string =~ "アクターアニメ実行"
  661.       @step = "action"
  662.     elsif string =~ "遠距離アニメ"
  663.       @step = "flying"
  664.     elsif string =~ "アクターアニメ変更"
  665.       @step = "change"
  666.     elsif string =~ "行動アニメ"
  667.       @step = "animation1"
  668.     elsif string =~ "対象アニメ"
  669.       @step = "animation2"
  670.     elsif string =~ "ウエイト"
  671.       @step = "wait"
  672.     elsif string =~ "左右反転"
  673.       @step = "reverse"
  674.     elsif string =~ "閃きアニメ"
  675.       @step = "flash"
  676.     elsif string =~ "残像表示"
  677.       @step = "shadow_on"
  678.     elsif string =~ "残像消去"
  679.       @step = "shadow_off"
  680.     elsif string =~ "アクターアニメ固定"
  681.       @step = "freeze"
  682.     elsif string =~ "アニメ固定解除"
  683.       @step = "freeze_lifting"
  684.     elsif string =~ "アニメーションの表示"
  685.       @step = "animation_start"
  686.     elsif string =~ "SEの演奏"
  687.       @step = "play_se"
  688.     else
  689.       @step = "finish"
  690.     end
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # ● フレーム更新 (次のアクションへ)
  694.   #--------------------------------------------------------------------------
  695.   def update_next
  696.     @action = @battle_actions.shift
  697.     @step = get_step
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # ● フレーム更新 (動作取得)
  701.   #--------------------------------------------------------------------------
  702.   def update_setup
  703.     # アクションの取得
  704.     self.get_actions
  705.     @action = @battle_actions.shift
  706.     @step = get_step
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● フレーム更新 (移動取得)
  710.   #--------------------------------------------------------------------------
  711.   def update_moving_setup
  712.     # 移動アクションの取得
  713.     self.get_move_action
  714.     # 移動目標の設定
  715.     self.move_setup
  716.     @step = "moving"
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # ● フレーム更新 (移動)
  720.   #--------------------------------------------------------------------------
  721.   def update_moving
  722.     # 移動
  723.     self.move
  724.     self.condition = @battler_condition
  725.     # 移動完了したら次のステップへ
  726.     if move_end?
  727.       @wait_count = 2
  728.       @action = @battle_actions.shift
  729.       @step = get_step
  730.     end
  731.   end
  732.   #--------------------------------------------------------------------------
  733.   # ● フレーム更新 (アニメ実行)
  734.   #--------------------------------------------------------------------------
  735.   def update_action
  736.     con = @action.split(/#/)[1]
  737.     # 右手・左手を分ける
  738.     if DUAL_WEAPONS_ANIME.include?(con)
  739.       if !@first_weapon and @second_weapon
  740.         con = con + "_L"
  741.       else
  742.         con = con + "_R"
  743.       end
  744.     end
  745.     # アニメ変更
  746.     self.condition = con
  747.     # ループか否か
  748.     if !ANIME[@battler_condition][1]
  749.       self.anime_on
  750.     end
  751.     @action = @battle_actions.shift
  752.     @step = get_step
  753.   end
  754.   #--------------------------------------------------------------------------
  755.   # ● フレーム更新 (遠距離アニメ)
  756.   #--------------------------------------------------------------------------
  757.   def update_flying
  758.     # 目標の設定
  759.     self.flying_setup
  760.     # 遠距離アニメ終了
  761.     if @flying_end
  762.       self.flying_clear
  763.       @action = @battle_actions.shift
  764.       @step = get_step
  765.     end
  766.   end
  767.   #--------------------------------------------------------------------------
  768.   # ● フレーム更新 (アニメ変更)
  769.   #--------------------------------------------------------------------------
  770.   def update_change
  771.     con = @action.split(/#/)[1]
  772.     # 右手・左手を分ける
  773.     if DUAL_WEAPONS_ANIME.include?(con)
  774.       if !@first_weapon and @second_weapon
  775.         con = con + "_L"
  776.       else
  777.         con = con + "_R"
  778.       end
  779.     end
  780.     # アニメ変更
  781.     self.condition = con
  782.     # ループか否か
  783.     if !ANIME[@battler_condition][1]
  784.       self.anime_on
  785.     end
  786.     @action = @battle_actions.shift
  787.     @step = get_step
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # ● フレーム更新 (行動アニメ)
  791.   #--------------------------------------------------------------------------
  792.   def update_animation1
  793.     @animation1_on = true
  794.     # 行動アニメの後に行動を開始する
  795.     if $scene.phase4_step == 3
  796.       id = RTAB ? @anime1 : $scene.animation1_id
  797.       animation = $data_animations[id]
  798.       frame_max = animation != nil ? animation.frame_max : 0
  799.       @wait_count2 = frame_max * 2
  800.       return
  801.     end
  802.     @action = @battle_actions.shift
  803.     @step = get_step
  804.   end
  805.   #--------------------------------------------------------------------------
  806.   # ● フレーム更新 (対象アニメ)
  807.   #--------------------------------------------------------------------------
  808.   def update_animation2
  809.     @animation2_on = true
  810.     # 行動アニメの後に行動を開始する
  811.     if $scene.phase4_step == 4
  812.       id = RTAB ? @anime2 : $scene.animation2_id
  813.       animation = $data_animations[id]
  814.       frame_max = animation != nil ? animation.frame_max : 0
  815.       @wait_count2 = frame_max * 2
  816.       return
  817.     end
  818.     @action = @battle_actions.shift
  819.     @step = get_step
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● フレーム更新 (ウエイト)
  823.   #--------------------------------------------------------------------------
  824.   def update_wait
  825.     @wait_count2 = @action.split(/#/)[1].to_i
  826.     @action = @battle_actions.shift
  827.     @step = get_step
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ● フレーム更新 (残像表示)
  831.   #--------------------------------------------------------------------------
  832.   def update_shadow_on
  833.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  834.     @action = @battle_actions.shift
  835.     @step = get_step
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● フレーム更新 (残像消去)
  839.   #--------------------------------------------------------------------------
  840.   def update_shadow_off
  841.     @shadow = false
  842.     @action = @battle_actions.shift
  843.     @step = get_step
  844.   end
  845.   #--------------------------------------------------------------------------
  846.   # ● フレーム更新 (左右反転)
  847.   #--------------------------------------------------------------------------
  848.   def update_reverse
  849.     [url=home.php?mod=space&uid=30269]@reverse[/url] = @reverse ? false : true
  850.     @action = @battle_actions.shift
  851.     @step = get_step
  852.   end
  853.   #--------------------------------------------------------------------------
  854.   # ● フレーム更新 (閃きアニメ)
  855.   #--------------------------------------------------------------------------
  856.   def update_flash
  857.     # 閃きアニメの後に行動を開始する
  858.     if @flash_flag["normal"]
  859.       @wait_count = $scene.flash_duration
  860.       @flash_flag["normal"] = false
  861.       return
  862.     end
  863.     @action = @battle_actions.shift
  864.     @step = get_step
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # ● フレーム更新 (SEの演奏)
  868.   #--------------------------------------------------------------------------
  869.   def update_play_se
  870.     data = @action.split(/#/)[1]
  871.     data = data.split(/,/)
  872.     # SE を演奏
  873.     Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
  874.     @action = @battle_actions.shift
  875.     @step = get_step
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● フレーム更新 (アクターアニメ固定)
  879.   #--------------------------------------------------------------------------
  880.   def update_freeze
  881.     con = @action.split(/#/)[1]
  882.     # 右手・左手を分ける
  883.     if DUAL_WEAPONS_ANIME.include?(con)
  884.       if !@first_weapon and @second_weapon
  885.         con = con + "_L"
  886.       else
  887.         con = con + "_R"
  888.       end
  889.     end
  890.     # アニメ変更
  891.     self.condition = con
  892.     @pattern = @action.split(/#/)[2].to_i
  893.     @pattern_freeze = true
  894.     @condition_freeze = true
  895.     @action = @battle_actions.shift
  896.     @step = get_step
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ● フレーム更新 (アクターアニメ固定解除)
  900.   #--------------------------------------------------------------------------
  901.   def update_freeze_lifting
  902.     @pattern_freeze = false
  903.     @condition_freeze = false
  904.     @action = @battle_actions.shift
  905.     @step = get_step
  906.   end
  907.   #--------------------------------------------------------------------------
  908.   # ● フレーム更新 (アニメーションの表示)
  909.   #--------------------------------------------------------------------------
  910.   def update_animation_start
  911.     data = @action.split(/#/)[1]
  912.     data = data.split(/,/)
  913.     target = data[0]
  914.     animation_id = data[1].to_i
  915.     if RTAB
  916.       case target
  917.       when "self"
  918.         @animation.push([animation_id,true])
  919.       when "target"
  920.         for tar in @target
  921.           tar.animation.push([animation_id, true])
  922.         end
  923.       end
  924.     else
  925.       case target
  926.       when "self"
  927.         @animation_id = animation_id
  928.         @animation_hit = true
  929.       when "target"
  930.         for tar in $scene.target_battlers
  931.           tar.animation_id = animation_id
  932.           tar.animation_hit = true
  933.         end
  934.       end
  935.     end
  936.     @action = @battle_actions.shift
  937.     @step = get_step
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # ● フレーム更新 (動作終了)
  941.   #--------------------------------------------------------------------------
  942.   def update_finish
  943.     # 動作終了
  944.     @battler_action = false
  945.     @step = "setup"
  946.   end
  947.   #--------------------------------------------------------------------------
  948.   # ● バトラーの状態 変更(バトラーグラフィックのタイプ)
  949.   #--------------------------------------------------------------------------
  950.   def condition=(condition)
  951.     return if @condition_freeze
  952.     @battler_condition = condition
  953.     @wait_count = ANIME[condition][2]
  954.   end
  955.   #--------------------------------------------------------------------------
  956.   # ● バトラーの状態(バトラーグラフィックのタイプ)
  957.   #--------------------------------------------------------------------------
  958.   def condition
  959.     return @battler_condition
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● フレーム更新
  963.   #--------------------------------------------------------------------------
  964.   def update
  965.     # ウェイト中の場合
  966.     if @wait_count > 0
  967.       return
  968.     end
  969.     # パターン更新
  970.     self.char_animation
  971.     # ウェイト中の場合
  972.     if @wait_count2 > 0
  973.       return
  974.     end
  975.  
  976.     # 行動アニメーション
  977.     if @battler_action
  978.       method("update_" + @step).call
  979.       return
  980.     end
  981.  
  982.     # データ初期化
  983.     @animation1_on = false
  984.     @animation2_on = false
  985.     @action = nil
  986.     @battle_actions = []
  987.     @move_wait = 0
  988.     @move_distance = nil
  989.     @flying_wait = 0
  990.     @flying_distance = nil
  991.     [url=home.php?mod=space&uid=14082]@Flash[/url] = false
  992.  
  993.     # RTAB対応
  994.     # 通常・待機
  995.     return self.condition = NORMAL
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # ● アクションの取得
  999.   #--------------------------------------------------------------------------
  1000.   def get_actions
  1001.     skill = $data_skills[self.current_action.skill_id]
  1002.     item = $data_items[self.current_action.item_id]
  1003.     kind = self.current_action.kind
  1004.     # 動作取得
  1005.     @battle_actions = []
  1006.     # スキル
  1007.     if skill != nil && kind == 1
  1008.       @battle_actions = skill.battle_actions.dup
  1009.       @flying_anime = skill.flying_anime
  1010.     # アイテム
  1011.     elsif item != nil && kind == 2
  1012.       @battle_actions = item.battle_actions.dup
  1013.       @flying_anime = item.flying_anime
  1014.     # 左手攻撃
  1015.     elsif !@first_weapon and @second_weapon and self.is_a?(Game_Actor)
  1016.       @battle_actions = self.battle_actions2.dup
  1017.       @flying_anime = self.flying_anime2
  1018.     # 右手攻撃
  1019.     elsif self.current_action.basic == 0 and
  1020.       self.is_a?(Game_Actor) and self.current_action.kind == 0
  1021.       @battle_actions = self.battle_actions1.dup
  1022.       @flying_anime = self.flying_anime1
  1023.     # 通常攻撃
  1024.     elsif self.current_action.basic == 0 and self.current_action.kind == 0
  1025.       @battle_actions = self.battle_actions.dup
  1026.       @flying_anime = self.flying_anime
  1027.     else
  1028.       @battle_actions = ["終了"]
  1029.       @flying_anime = [0,0,false,false]
  1030.     end
  1031.   end
  1032.   #--------------------------------------------------------------------------
  1033.   # ● ループしないアニメのセット
  1034.   #--------------------------------------------------------------------------
  1035.   def anime_on
  1036.     @pattern = 0
  1037.     @pattern_log = true
  1038.     return
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # ● パターン更新
  1042.   #--------------------------------------------------------------------------
  1043.   def char_animation
  1044.     # パタン固定の場合もどる
  1045.     return if @pattern_freeze
  1046.     # ループしないアニメの場合 1234 で止まる
  1047.     if !ANIME[@battler_condition][1] && @pattern == 3
  1048.       return
  1049.     end
  1050.     # アニメさせない場合 1 で止まる
  1051.     if ANIME[@battler_condition][4]
  1052.       @pattern = 0
  1053.       return
  1054.     end
  1055.     @pattern = (@pattern + 1) % 4
  1056.   end
  1057.   #--------------------------------------------------------------------------
  1058.   # ● アニメタイプ
  1059.   #--------------------------------------------------------------------------
  1060.   def anime_type
  1061.     return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
  1062.   end
  1063. end
  1064. #==============================================================================
  1065. # ■ Game_Actor
  1066. #==============================================================================
  1067. class Game_Actor < Game_Battler
  1068.   include Side_view
  1069.   #--------------------------------------------------------------------------
  1070.   # ● セットアップ
  1071.   #--------------------------------------------------------------------------
  1072.   alias side_view_setup setup
  1073.   def setup(actor_id)
  1074.     side_view_setup(actor_id)
  1075.     start_battle
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ● 二刀武器のID取得 ※エラー回避用
  1079.   #--------------------------------------------------------------------------
  1080.   def weapon2_id
  1081.     return @weapon2_id != nil ? @weapon2_id : 0
  1082.   end
  1083.   #--------------------------------------------------------------------------
  1084.   # ● X方向 ポジション 取得 (陣形スクリプト拡張用)
  1085.   #--------------------------------------------------------------------------
  1086.   def position
  1087.     return $data_classes[@class_id].position
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
  1091.   #--------------------------------------------------------------------------
  1092.   def position2
  1093.     return self.index
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 武器アニメタイプ
  1097.   #--------------------------------------------------------------------------
  1098.   def weapon_anime_type(type)
  1099.     file_name  = weapon_anime_type0(type)
  1100.     visible   = weapon_anime_type1(type)
  1101.     z         = weapon_anime_type2(type)
  1102.     return [file_name,visible,z]
  1103.   end
  1104.   # 武器アイコン取得
  1105.   def weapon_anime_type0(type)
  1106.     type = ANIME[type][5]
  1107.     return weapon_anime1 if type == "右手"
  1108.     return weapon_anime2 if type == "左手"
  1109.     return nil
  1110.   end
  1111.   # 表示・非表示の取得
  1112.   def weapon_anime_type1(type)
  1113.     return ANIME[type][3]
  1114.   end
  1115.   # バトラーより上に表示するかどうか
  1116.   def weapon_anime_type2(type)
  1117.     type = ANIME[type][5]
  1118.     return true if type == "左手"
  1119.     return false
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1123.   #--------------------------------------------------------------------------
  1124.   def true_x
  1125.     return PARTY_X + position * FORMATION_X + @ox
  1126.   end
  1127.   #--------------------------------------------------------------------------
  1128.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1129.   #--------------------------------------------------------------------------
  1130.   def true_y
  1131.     # パーティ内の並び順から Y 座標を計算して返す
  1132.     if self.index != nil
  1133.       y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
  1134.       return y
  1135.     else
  1136.       return 0
  1137.     end
  1138.   end
  1139.   #--------------------------------------------------------------------------
  1140.   # ● バトル画面 X 座標の取得
  1141.   #--------------------------------------------------------------------------
  1142.   def screen_x(true_x = self.true_x)
  1143.     return 320 + (true_x - 320) * @real_zoom + @real_x
  1144.   end
  1145.   #--------------------------------------------------------------------------
  1146.   # ● バトル画面 Y 座標の取得
  1147.   #--------------------------------------------------------------------------
  1148.   def screen_y(true_y = self.true_y)
  1149.     return true_y * @real_zoom + @real_y
  1150.   end
  1151.   #--------------------------------------------------------------------------
  1152.   # ● バトル画面 Z 座標の取得
  1153.   #--------------------------------------------------------------------------
  1154.   def screen_z
  1155.     return screen_y + 1000
  1156.   end
  1157.   #--------------------------------------------------------------------------
  1158.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1159.   #--------------------------------------------------------------------------
  1160.   def base_x
  1161.     return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
  1162.   end
  1163.   #--------------------------------------------------------------------------
  1164.   # ● バトル画面 Y 座標の取得
  1165.   #--------------------------------------------------------------------------
  1166.   def base_y
  1167.     return (true_y - @oy) * @real_zoom + @real_y
  1168.   end
  1169.   #--------------------------------------------------------------------------
  1170.   # ● バトル画面 拡大率の取得
  1171.   #--------------------------------------------------------------------------
  1172.   def zoom
  1173.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  1174.                           (true_x + @fly) / 480 + $scene.zoom_rate[0]
  1175.   end
  1176.   #--------------------------------------------------------------------------
  1177.   # ● 攻撃用、バトル画面 X 座標の取得
  1178.   #--------------------------------------------------------------------------
  1179.   def attack_x(z)
  1180.     return (320 - true_x) * z * 0.75
  1181.   end
  1182.   #--------------------------------------------------------------------------
  1183.   # ● 攻撃用、バトル画面 Y 座標の取得
  1184.   #--------------------------------------------------------------------------
  1185.   def attack_y(z)
  1186.     return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
  1187.   end
  1188.   #--------------------------------------------------------------------------
  1189.   # ● 閃き待ち時間
  1190.   #--------------------------------------------------------------------------
  1191.   def flash_duration
  1192.     return $scene.flash_duration
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ● アニメーション取得
  1196.   #--------------------------------------------------------------------------
  1197.   def battle_actions1
  1198.     weapon = $data_weapons[@weapon_id]
  1199.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1200.   end
  1201.   #--------------------------------------------------------------------------
  1202.   # ● アニメーション取得
  1203.   #--------------------------------------------------------------------------
  1204.   def battle_actions2
  1205.     weapon = $data_weapons[@weapon2_id]
  1206.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1207.   end
  1208.   #--------------------------------------------------------------------------
  1209.   # ● 武器アニメーション取得
  1210.   #--------------------------------------------------------------------------
  1211.   def weapon_anime1
  1212.     weapon = $data_weapons[@weapon_id]
  1213.     return weapon != nil ? weapon.icon_name : ""
  1214.   end
  1215.   #--------------------------------------------------------------------------
  1216.   # ● 武器アニメーション取得
  1217.   #--------------------------------------------------------------------------
  1218.   def weapon_anime2
  1219.     weapon = $data_weapons[@weapon2_id]
  1220.     return weapon != nil ? weapon.icon_name : ""
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 遠距離アニメーション取得
  1224.   #--------------------------------------------------------------------------
  1225.   def flying_anime1
  1226.     weapon = $data_weapons[@weapon_id]
  1227.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● 遠距離アニメーション取得
  1231.   #--------------------------------------------------------------------------
  1232.   def flying_anime2
  1233.     weapon = $data_weapons[@weapon2_id]
  1234.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1235.   end
  1236.   #--------------------------------------------------------------------------
  1237.   # ● 移動目標座標の計算
  1238.   #--------------------------------------------------------------------------
  1239.   def move_setup
  1240.     if RTAB
  1241.       targets = @target
  1242.     else
  1243.       targets = $scene.target_battlers
  1244.     end
  1245.     case @move_action[0]
  1246.     when "self" # 自分
  1247.       @target_x = self.base_x
  1248.       @target_y = self.base_y
  1249.     when "target_near" # 一番近くのターゲット
  1250.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1251.       targets.reverse!
  1252.       if targets != []
  1253.         @target_x = targets[0].screen_x
  1254.         @target_y = targets[0].screen_y
  1255.       else
  1256.         @target_x = self.base_x
  1257.         @target_y = self.base_y
  1258.       end
  1259.     when "target_far" # 一番遠くのターゲット
  1260.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1261.       if targets != []
  1262.         @target_x = targets[0].screen_x
  1263.         @target_y = targets[0].screen_y
  1264.       else
  1265.         @target_x = self.base_x
  1266.         @target_y = self.base_y
  1267.       end
  1268.     when "target" # ターゲット中央
  1269.       @target_x = 0
  1270.       @target_y = 0
  1271.       for t in targets
  1272.         @target_x += t.screen_x
  1273.         @target_y += t.screen_y
  1274.       end
  1275.       if targets != []
  1276.         @target_x /= targets.size
  1277.         @target_y /= targets.size
  1278.       end
  1279.     when "troop" # "トループ中央"
  1280.       @target_x = 0
  1281.       @target_y = 0
  1282.       for t in $game_troop.enemies
  1283.         @target_x += t.screen_x
  1284.         @target_y += t.screen_y
  1285.       end
  1286.       if $game_troop.enemies != []
  1287.         @target_x /= $game_troop.enemies.size
  1288.         @target_y /= $game_troop.enemies.size
  1289.       end
  1290.     when "party" # "パーティ中央"
  1291.       @target_x = 0
  1292.       @target_y = 0
  1293.       for t in $game_party.actors
  1294.         @target_x += t.screen_x
  1295.         @target_y += t.screen_y
  1296.       end
  1297.       if $game_party.actors != []
  1298.         @target_x /= $game_party.actors.size
  1299.         @target_y /= $game_party.actors.size
  1300.       end
  1301.     when "screen" # "画面"
  1302.       @target_x = self.base_x
  1303.       @target_y = self.base_y
  1304.     end
  1305.     # 補正
  1306.     @target_x += @move_action[1] - self.base_x
  1307.     @target_y += @move_action[2] - self.base_y
  1308.     # 移動目標の座標をセット
  1309.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1310.     # 距離の計算(ウエイトの設定)
  1311.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1312.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1313.   end
  1314. end
  1315. #==============================================================================
  1316. # ■ Game_Enemy
  1317. #==============================================================================
  1318. class Game_Enemy < Game_Battler
  1319.   #--------------------------------------------------------------------------
  1320.   # ● セットアップ
  1321.   #--------------------------------------------------------------------------
  1322.   alias side_view_initialize initialize
  1323.   def initialize(troop_id, member_index)
  1324.     side_view_initialize(troop_id, member_index)
  1325.     start_battle
  1326.   end
  1327.   #--------------------------------------------------------------------------
  1328.   # ● 移動
  1329.   #--------------------------------------------------------------------------
  1330.   def move
  1331.     # 距離の計算
  1332.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1333.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1334.     if @move_distance > 0
  1335.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  1336.       array = @move_coordinates
  1337.       # ジャンプ補正値の計算
  1338.       if @move_distance - @move_wait > @move_distance / 2
  1339.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  1340.       else
  1341.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  1342.       end
  1343.       jump = @move_action[4] > 0 ? -jump : jump
  1344.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  1345.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  1346.       # ウエイト
  1347.       @move_wait -= @move_action[3]
  1348.       @move_wait = [@move_wait,0].max
  1349.     end
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # ● 移動目標座標の計算
  1353.   #--------------------------------------------------------------------------
  1354.   def move_setup
  1355.     if RTAB
  1356.       targets = @target
  1357.     else
  1358.       targets = $scene.target_battlers
  1359.     end
  1360.     case @move_action[0]
  1361.     when "self" # 自分
  1362.       @target_x = self.base_x
  1363.       @target_y = self.base_y
  1364.     when "target_near" # 一番近くのターゲット
  1365.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1366.       if targets != []
  1367.         @target_x = targets[0].screen_x
  1368.         @target_y = targets[0].screen_y
  1369.       else
  1370.         @target_x = self.base_x
  1371.         @target_y = self.base_y
  1372.       end
  1373.     when "target_far" # 一番遠くのターゲット
  1374.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1375.       targets.reverse!
  1376.       if targets != []
  1377.         @target_x = targets[0].screen_x
  1378.         @target_y = targets[0].screen_y
  1379.       else
  1380.         @target_x = self.base_x
  1381.         @target_y = self.base_y
  1382.       end
  1383.     when "target" # ターゲット中央
  1384.       @target_x = 0
  1385.       @target_y = 0
  1386.       for t in targets
  1387.         @target_x += t.screen_x
  1388.         @target_y += t.screen_y
  1389.       end
  1390.       if targets != []
  1391.         @target_x /= targets.size
  1392.         @target_y /= targets.size
  1393.       end
  1394.     when  "party" # "トループ中央"
  1395.       @target_x = 0
  1396.       @target_y = 0
  1397.       for t in $game_troop.enemies
  1398.         @target_x += t.screen_x
  1399.         @target_y += t.screen_y
  1400.       end
  1401.       if $game_troop.enemies != []
  1402.         @target_x /= $game_troop.enemies.size
  1403.         @target_y /= $game_troop.enemies.size
  1404.       end
  1405.     when "troop" # "パーティ中央"
  1406.       @target_x = 0
  1407.       @target_y = 0
  1408.       for t in $game_party.actors
  1409.         @target_x += t.screen_x
  1410.         @target_y += t.screen_y
  1411.       end
  1412.       if $game_party.actors != []
  1413.         @target_x /= $game_party.actors.size
  1414.         @target_y /= $game_party.actors.size
  1415.       end
  1416.     when "screen" # "画面"
  1417.       @target_x = self.base_x
  1418.       @target_y = self.base_y
  1419.     end
  1420.     # 補正
  1421.     @target_x -= @move_action[1] + self.base_x
  1422.     @target_y -= @move_action[2] + self.base_y
  1423.     # 移動目標の座標をセット
  1424.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1425.     # 距離の計算(ウエイトの設定)
  1426.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1427.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1428.   end
  1429.   if RTAB
  1430.   alias original_x true_x
  1431.   alias original_y true_y
  1432.   else
  1433.   alias original_x screen_x
  1434.   alias original_y screen_y
  1435.   end
  1436.   #--------------------------------------------------------------------------
  1437.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1438.   #--------------------------------------------------------------------------
  1439.   def true_x
  1440.     return original_x + @ox
  1441.   end
  1442.   #--------------------------------------------------------------------------
  1443.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1444.   #--------------------------------------------------------------------------
  1445.   def true_y
  1446.     return original_y - @height / 2 + @oy
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● バトル画面 X 座標の取得
  1450.   #--------------------------------------------------------------------------
  1451.   def screen_x(true_x = self.true_x)
  1452.     return true_x * @real_zoom + @real_x
  1453.   end
  1454.   #--------------------------------------------------------------------------
  1455.   # ● バトル画面 Y 座標の取得
  1456.   #--------------------------------------------------------------------------
  1457.   def screen_y(true_y = self.true_y)
  1458.     return true_y * @real_zoom + @real_y
  1459.   end
  1460.   #--------------------------------------------------------------------------
  1461.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1462.   #--------------------------------------------------------------------------
  1463.   def base_x(true_x = self.true_x)
  1464.     return (true_x - @ox) * @real_zoom + @real_x
  1465.   end
  1466.   #--------------------------------------------------------------------------
  1467.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  1468.   #--------------------------------------------------------------------------
  1469.   def base_y(true_y = self.true_y)
  1470.     return (true_y - @oy) * @real_zoom + @real_y
  1471.   end
  1472. end
  1473. #==============================================================================
  1474. # ■ Game_Party
  1475. #==============================================================================
  1476. class Game_Party
  1477.   #--------------------------------------------------------------------------
  1478.   # ● アクターを加える
  1479.   #     actor_id : アクター ID
  1480.   #--------------------------------------------------------------------------
  1481.   alias side_view_add_actor add_actor
  1482.   def add_actor(actor_id)
  1483.     # アクターを取得
  1484.     actor = $game_actors[actor_id]
  1485.     # サイドビューデータの初期化
  1486.     actor.start_battle
  1487.     # 戻す
  1488.     side_view_add_actor(actor_id)
  1489.   end
  1490. end
  1491. #==============================================================================
  1492. # ■ Scene_Battle
  1493. #==============================================================================
  1494. class Scene_Battle
  1495.   include Side_view
  1496.   #--------------------------------------------------------------------------
  1497.   # ● 公開インスタンス変数
  1498.   #--------------------------------------------------------------------------
  1499.   attr_reader   :phase            # フェーズ
  1500.   attr_reader   :phase4_step      # フェーズ4ステップ
  1501.   attr_reader   :active_battler   # 対象の配列
  1502.   attr_reader   :target_battlers  # 対象の配列
  1503.   attr_reader   :animation1_id    # 行動アニメID
  1504.   attr_reader   :animation2_id    # 対象アニメID
  1505.   #--------------------------------------------------------------------------
  1506.   # ● メイン処理
  1507.   #--------------------------------------------------------------------------
  1508.   alias side_view_main main
  1509.   def main
  1510.     # バトラー初期化
  1511.     for battler in $game_party.actors + $game_troop.enemies
  1512.       battler.start_battle
  1513.     end
  1514.     # 戻す
  1515.     side_view_main
  1516.   end
  1517.   #--------------------------------------------------------------------------
  1518.   # ● 閃き判定
  1519.   #--------------------------------------------------------------------------
  1520.   def flash?
  1521.     return @flash_flag ? true : false
  1522.   end  
  1523.   #--------------------------------------------------------------------------
  1524.   # ● 閃きアニメ待ち時間取得
  1525.   #--------------------------------------------------------------------------
  1526.   def flash_duration
  1527.     animation = nil
  1528.     if FLASH_ANIME
  1529.       animation = $data_animations[FLASH_ANIMATION_ID]
  1530.     end
  1531.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1535.   #--------------------------------------------------------------------------
  1536.   alias side_view_update_phase4_step2 update_phase4_step2
  1537.   def update_phase4_step2(*arg)
  1538.     battler = convert_battler2(*arg)
  1539.     battler.action
  1540.     side_view_update_phase4_step2(*arg)
  1541.   end
  1542.   #--------------------------------------------------------------------------
  1543.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  1544.   #--------------------------------------------------------------------------
  1545.   alias side_view_update_phase4_step3 update_phase4_step3
  1546.   def update_phase4_step3(*arg)
  1547.     battler = convert_battler2(*arg)
  1548.     return if !battler.animation1_on and battler.action? and !battler.flash?
  1549.     if battler.flash? and FLASH_ANIME
  1550.       battler.flash_flag["normal"] = true
  1551.     end
  1552.     side_view_update_phase4_step3(*arg)
  1553.   end
  1554.   #--------------------------------------------------------------------------
  1555.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  1556.   #--------------------------------------------------------------------------
  1557.   alias side_view_update_phase4_step4 update_phase4_step4
  1558.   def update_phase4_step4(*arg)
  1559.     battler = convert_battler2(*arg)
  1560.     targets = RTAB ? battler.target : @target_battlers
  1561.     return if !battler.animation2_on and battler.action?
  1562.     side_view_update_phase4_step4(*arg)
  1563.     for target in targets
  1564.       if RTAB
  1565.         value = nil
  1566.         if target.damage_sp.include?(battler)
  1567.           value = target.damage_sp[battler]
  1568.         end
  1569.         if target.damage.include?(battler)
  1570.           if value == nil or value == "Miss"
  1571.             value = target.damage[battler]
  1572.           elsif value.is_a?(Numeric) && value > 0
  1573.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  1574.           end
  1575.         end
  1576.       else
  1577.         value = target.damage
  1578.       end
  1579.       if target.is_a?(Game_Actor)
  1580.         # ダメージの場合
  1581.         if value.is_a?(Numeric) && value > 0
  1582.           # シェイクを開始
  1583.           target.shake = true
  1584.         end
  1585.       elsif target.is_a?(Game_Enemy)
  1586.         # ダメージの場合
  1587.         if value.is_a?(Numeric) && value > 0
  1588.           # シェイクを開始
  1589.           target.shake = true
  1590.         end
  1591.       end
  1592.     end
  1593.   end
  1594.   #--------------------------------------------------------------------------
  1595.   # ● プレバトルフェーズ開始
  1596.   #--------------------------------------------------------------------------
  1597.   alias start_phase1_correct start_phase1
  1598.   def start_phase1
  1599.     # カメラの設定
  1600.     # 元々フロントビュー向けの数値になっているため
  1601.     @zoom_rate = [1.0, 1.0]
  1602.     start_phase1_correct
  1603.   end
  1604.   #--------------------------------------------------------------------------
  1605.   # ● アクターコマンドフェーズ開始
  1606.   #--------------------------------------------------------------------------
  1607.   alias start_phase3_correct start_phase3
  1608.   def start_phase3
  1609.     battler = convert_battler
  1610.     start_phase3_correct
  1611.     if RTAB
  1612.       # カメラの設定
  1613.       # 元々フロントビュー向けの数値になっているため
  1614.       @camera = "command"
  1615.       @spriteset.screen_target(0, 0, 1.0)
  1616.     end
  1617.   end
  1618. end
  1619.  
  1620. class Spriteset_Battle
  1621.   include Side_view
  1622.   #--------------------------------------------------------------------------
  1623.   # ● オブジェクト初期化
  1624.   #--------------------------------------------------------------------------
  1625.   alias side_veiw_initialize initialize
  1626.   def initialize
  1627.     side_veiw_initialize
  1628.     # アクタースプライトを解放
  1629.     for sprite in @actor_sprites
  1630.       sprite.dispose
  1631.     end
  1632.     # アクタースプライトを作成
  1633.     @actor_sprites = []
  1634.     for i in 1..Party_max
  1635.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1636.     end
  1637.     update
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # ● 画面のスクロール
  1641.   #--------------------------------------------------------------------------
  1642.   if method_defined?("screen_scroll")
  1643.   alias side_view_screen_scroll screen_scroll
  1644.   def screen_scroll
  1645.     side_view_screen_scroll
  1646.     # アクターの位置補正
  1647.     for actor in $game_party.actors
  1648.       actor.real_x = @real_x
  1649.       actor.real_y = @real_y
  1650.       actor.real_zoom = @real_zoom
  1651.     end
  1652.   end
  1653.   end
  1654. end
  1655.  
  1656. class Sprite_Battler < RPG::Sprite
  1657.   include Side_view
  1658.   #--------------------------------------------------------------------------
  1659.   # ● オブジェクト初期化
  1660.   #     viewport : ビューポート
  1661.   #     battler  : バトラー (Game_Battler)
  1662.   #--------------------------------------------------------------------------
  1663.   def initialize(viewport, battler = nil)
  1664.     super(viewport)
  1665.     @battler = battler
  1666.     @battler_visible = false
  1667.     @weapon = Sprite_Weapon.new(viewport, battler)
  1668.     @flying = Sprite_Flying.new(viewport, battler)
  1669.     @shadow = []
  1670.     @fly = 0
  1671.     @fly_direction = 1
  1672.     @rand = rand(10)
  1673.     self.effect_clear
  1674.   end
  1675.   #--------------------------------------------------------------------------
  1676.   # ● 解放
  1677.   #--------------------------------------------------------------------------
  1678.   alias side_view_dispose dispose
  1679.   def dispose
  1680.     side_view_dispose
  1681.     @weapon.dispose
  1682.     @flying.dispose
  1683.     if @_target_sprite != nil
  1684.       @_target_sprite.bitmap.dispose
  1685.       @_target_sprite.dispose
  1686.       @_target_sprite = nil
  1687.     end
  1688.   end
  1689.   #--------------------------------------------------------------------------
  1690.   # ● フレーム更新
  1691.   #--------------------------------------------------------------------------
  1692.   def update
  1693.     super
  1694.     # バトラーが nil の場合
  1695.     if @battler == nil
  1696.       self.bitmap = nil
  1697.       @weapon.bitmap = nil
  1698.       loop_animation(nil)
  1699.       return
  1700.     end
  1701.     # バトラー更新
  1702.     @battler.update
  1703.     # バトラーアニメのデータ取得
  1704.     @anime_type = @battler.anime_type
  1705.     # ファイル名か色相が現在のものと異なる場合
  1706.     if @battler.is_a?(Game_Actor)
  1707.       change = (@battler.character_name != @battler_name or @battler.character_hue != @battler_hue)
  1708.     elsif @battler.is_a?(Game_Enemy)
  1709.       change = (@battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue)
  1710.     else
  1711.       return
  1712.     end
  1713.     if change
  1714.       # ビットマップを取得、設定
  1715.       if @battler.is_a?(Game_Actor)
  1716.         @battler_name = @battler.character_name
  1717.         @battler_hue = @battler.character_hue
  1718.         self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
  1719.         @width = bitmap.width / 4
  1720.         @height = bitmap.height / 4
  1721.       else
  1722.         @battler_name = @battler.battler_name
  1723.         @battler_hue = @battler.battler_hue
  1724.         self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1725.         @width = bitmap.width
  1726.         @height = bitmap.height
  1727.       end
  1728.       self.ox = @width / 2
  1729.       self.oy = @height / 2
  1730.       @battler.height = @height
  1731.       @flag = true
  1732.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  1733.       if @battler.dead? or @battler.hidden
  1734.         self.opacity = 0
  1735.       end
  1736.     end
  1737.     if @battler.is_a?(Game_Actor) and
  1738.       (@battler.anime_type != @anime_type or @battler.pattern != @pattern or @flag)
  1739.       # ビットマップを取得、設定
  1740.       @pattern = @battler.pattern
  1741.       self.ox = @width / 2
  1742.       self.oy = @height / 2
  1743.       @sx = @pattern * @width
  1744.       @sy = @anime_type % 4 * @height
  1745.       self.src_rect.set(@sx, @sy, @width, @height)
  1746.       self.zoom_x = CHAR_ZOOM
  1747.       self.zoom_y = CHAR_ZOOM
  1748.       @battler.height = @height
  1749.       @flag = false
  1750.     end
  1751.     # 飛行
  1752.     update_fly
  1753.     # シェイク
  1754.     update_shake
  1755.     # 回転
  1756.     update_turning
  1757.     # 反転
  1758.     update_reverse   
  1759.     # 移動
  1760.     update_moving
  1761.     # 追加アニメ
  1762.     update_add_anime
  1763.     # エフェクト効果の適用
  1764.     update_effect
  1765.     # アニメーション ID が現在のものと異なる場合
  1766.     flag = RTAB ? true : @battler.damage == nil
  1767.     if flag and @battler.state_animation_id != @state_animation_id
  1768.       @state_animation_id = @battler.state_animation_id
  1769.       loop_animation($data_animations[@state_animation_id])
  1770.     end
  1771.     # シェイク
  1772.     if @battler.shake
  1773.       self.start_shake(5, 5, 5)
  1774.       @battler.shake = false
  1775.     end
  1776.     # 明滅
  1777.     if @battler.blink
  1778.       blink_on
  1779.     else
  1780.       blink_off
  1781.     end
  1782.     # 不可視の場合
  1783.     unless @battler_visible
  1784.       flag = RTAB ? (@battler.damage.size < 2 or @battler.damage_pop.size < 2) :
  1785.                     (@battler.damage == nil or @battler.damage_pop)
  1786.       # 出現
  1787.       if not @battler.hidden and not @battler.dead? and flag
  1788.         appear
  1789.         @battler_visible = true
  1790.       end
  1791.     end
  1792.     if RTAB
  1793.     # ダメージ
  1794.     for battler in @battler.damage_pop
  1795.       if battler[0].class == Array
  1796.         if battler[0][1] >= 0
  1797.           $scene.skill_se
  1798.         else
  1799.           $scene.levelup_se
  1800.         end
  1801.         damage(@battler.damage[battler[0]], false, 2)
  1802.       else
  1803.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  1804.       end
  1805.       if @battler.damage_sp.include?(battler[0])
  1806.         damage(@battler.damage_sp[battler[0]],
  1807.                 @battler.critical[battler[0]], 1)
  1808.         @battler.damage_sp.delete(battler[0])
  1809.       end
  1810.       @battler.damage_pop.delete(battler[0])
  1811.       @battler.damage.delete(battler[0])
  1812.       @battler.critical.delete(battler[0])
  1813.     end
  1814.     end
  1815.     # 可視の場合
  1816.     if @battler_visible
  1817.       # 武器アニメ
  1818.       @weapon.battler = @battler
  1819.       @weapon.update
  1820.       # 遠距離アニメ
  1821.       @flying.battler = @battler
  1822.       @flying.update
  1823.       # 逃走
  1824.       if @battler.hidden
  1825.         $game_system.se_play($data_system.escape_se)
  1826.         escape
  1827.         @battler_visible = false
  1828.       end
  1829.       # 白フラッシュ
  1830.       if @battler.white_flash
  1831.         whiten
  1832.         @battler.white_flash = false
  1833.       end
  1834.       if RTAB
  1835.       # アニメーション
  1836.       if !@battler.animation.empty?
  1837.         for animation in @battler.animation.reverse
  1838.           if animation[2]
  1839.             animation($data_animations[animation[0]], animation[1], true)
  1840.           else
  1841.             animation($data_animations[animation[0]], animation[1])
  1842.           end
  1843.           @battler.animation.delete(animation)
  1844.         end
  1845.       end
  1846.       else
  1847.       # アニメーション
  1848.       if @battler.animation_id != 0
  1849.         animation = $data_animations[@battler.animation_id]
  1850.         animation(animation, @battler.animation_hit)
  1851.         @battler.animation_id = 0
  1852.       end
  1853.       end
  1854.       # ダメージ
  1855.       if !RTAB and @battler.damage_pop
  1856.         damage(@battler.damage, @battler.critical)
  1857.         @battler.damage = nil
  1858.         @battler.critical = false
  1859.         @battler.damage_pop = false
  1860.       end
  1861.       flag = RTAB ? (@battler.damage.empty? and $scene.dead_ok?(@battler)) :
  1862.                      @battler.damage == nil
  1863.       # コラプス
  1864.       if flag and @battler.dead?
  1865.         if @battler.is_a?(Game_Actor)
  1866.           $game_system.se_play($data_system.actor_collapse_se)
  1867.         elsif @battler.is_a?(Game_Enemy)
  1868.           $game_system.se_play($data_system.enemy_collapse_se)
  1869.         end
  1870.         collapse
  1871.         @battler_visible = false
  1872.       end
  1873.     end
  1874.     # スプライトの座標を設定
  1875.     self.x = @battler.screen_x + @effect_ox
  1876.     self.y = @battler.screen_y + @effect_oy
  1877.     self.z = @battler.screen_z
  1878.     self.zoom_x = @battler.real_zoom
  1879.     self.zoom_y = @battler.real_zoom
  1880.     # ウェイトカウントを減らす
  1881.     @battler.wait_count -= 1
  1882.     @battler.wait_count2 -= 1
  1883.     # アニメーション待ち時間取得
  1884.     @battler.animation_duration = @_animation_duration
  1885.     if @battler.is_a?(Game_Actor)
  1886.       self.zoom_x *= CHAR_ZOOM
  1887.       self.zoom_y *= CHAR_ZOOM
  1888.       @weapon.x = self.x + 2
  1889.       @weapon.y = self.y + 6
  1890.       @weapon.angle = 75 - (4 - @battler.pattern) * 45
  1891.       if self.mirror
  1892.         @weapon.angle += @weapon.angle - 180
  1893.       end
  1894.     end
  1895.     # 残像
  1896.     if @battler.shadow
  1897.       if Graphics.frame_count % 2 == 0
  1898.         shadow = ::Sprite.new(self.viewport)
  1899.         shadow.bitmap = self.bitmap.dup
  1900.         shadow.x = self.x
  1901.         shadow.y = self.y
  1902.         shadow.ox = self.ox
  1903.         shadow.oy = self.oy
  1904.         shadow.mirror = self.mirror
  1905.         shadow.angle = self.angle
  1906.         shadow.opacity = 160
  1907.         shadow.zoom_x = self.zoom_x
  1908.         shadow.zoom_y = self.zoom_y
  1909.         if @battler.is_a?(Game_Actor)
  1910.           shadow.src_rect.set(@sx, @sy, @width, @height)
  1911.         else
  1912.           shadow.src_rect.set(0, 0, @width, @height)
  1913.         end
  1914.         @shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
  1915.       end
  1916.     end
  1917.     for s in @shadow
  1918.       if !s[0].disposed?
  1919.         s[0].update
  1920.         s[1] -= 1
  1921.         if s[1] < 1
  1922.           if s[0].bitmap != nil
  1923.             s[0].bitmap.dispose
  1924.           end
  1925.           s[0].dispose
  1926.         else
  1927.           s[0].x = @battler.screen_x(s[2])
  1928.           s[0].y = @battler.screen_y(s[3])
  1929.         end
  1930.       else
  1931.         s = nil
  1932.       end
  1933.     end
  1934.     @shadow.compact!
  1935.   end
  1936.   #--------------------------------------------------------------------------
  1937.   # ● エフェクトによる座標系の更新
  1938.   #--------------------------------------------------------------------------
  1939.   def update_effect
  1940.     # 角度の修正
  1941.     if @_upside_down
  1942.       self.angle = (@_turning + 180) % 360
  1943.     else
  1944.       self.angle = @_turning
  1945.     end
  1946.     # X 座標の修正値
  1947.     @effect_ox = @_shake + @_moving[0]
  1948.     # Y 座標の修正値
  1949.     @effect_oy = -@fly + @_moving[1]
  1950.     if  @_animation == nil or (RTAB and @_animation.empty?)
  1951.       self.effect_clear
  1952.     end
  1953.   end
  1954.   #--------------------------------------------------------------------------
  1955.   # ● シェイク更新
  1956.   #--------------------------------------------------------------------------
  1957.   def update_shake
  1958.     if @_shake_duration >= 1 or @_shake != 0
  1959.       delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
  1960.       if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
  1961.         @_shake = 0
  1962.       else
  1963.         @_shake += delta
  1964.       end
  1965.       if @_shake > @_shake_power * 2
  1966.         @_shake_direction = -1
  1967.       end
  1968.       if @_shake < - @_shake_power * 2
  1969.         @_shake_direction = 1
  1970.       end
  1971.       if @_shake_duration >= 1
  1972.         @_shake_duration -= 1
  1973.       end
  1974.     end
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # ● 飛行更新
  1978.   #--------------------------------------------------------------------------
  1979.   def update_fly
  1980.     if @rand > 0
  1981.       @rand -= 1
  1982.       return
  1983.     end
  1984.     if @battler.fly != 0
  1985.       if @fly < @battler.fly / 4
  1986.         @fly_direction = 1
  1987.       elsif @fly > @battler.fly / 2
  1988.         @fly_direction = -1
  1989.       end
  1990.       @fly += 0.5 * @fly_direction
  1991.     end
  1992.   end
  1993.   #--------------------------------------------------------------------------
  1994.   # ● 回転更新
  1995.   #--------------------------------------------------------------------------
  1996.   def update_turning
  1997.     if @_turning_duration > 0 or @_turning != 0
  1998.       @_turning += @_turning_direction * @_turning_speed / 2.0
  1999.       # 残り回転数を減らす
  2000.       if @_turning_direction == -1
  2001.         if @_turning_duration > 0 and @_turning < 0
  2002.           @_turning_duration -= 1
  2003.         end
  2004.       elsif @_turning_direction == 1
  2005.         if @_turning_duration > 0 and @_turning >= 360
  2006.           @_turning_duration -= 1
  2007.         end
  2008.       end
  2009.       # 以下補正
  2010.       while @_turning < 0
  2011.         @_turning += 360
  2012.       end
  2013.       if @_turning_duration <= 0
  2014.         @_turning = 0
  2015.       end
  2016.       @_turning %= 360
  2017.     end
  2018.   end
  2019.   #--------------------------------------------------------------------------
  2020.   # ● 左右反転更新
  2021.   #--------------------------------------------------------------------------
  2022.   def update_reverse
  2023.     if @last_reverse != (@_reverse or @battler.reverse)
  2024.       self.mirror = (@_reverse or @battler.reverse)
  2025.       @last_reverse = (@_reverse or @battler.reverse)
  2026.     end
  2027.   end
  2028.   #--------------------------------------------------------------------------
  2029.   # ● 移動更新
  2030.   #--------------------------------------------------------------------------
  2031.   def update_moving
  2032.     @move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2033.                      (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2034.     if @move_distance > 0
  2035.       return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
  2036.       array = @_move_coordinates
  2037.       x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2038.       y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2039.       @_moving = [x, y]
  2040.       if @_move_quick_return and @_move_duration == 0
  2041.         @_move_coordinates = [0,0,array[0],array[1]]
  2042.         @_move_duration = @move_distance
  2043.       end
  2044.       @_move_duration -= @_move_speed
  2045.       @_move_duration = [@_move_duration, 0].max
  2046.     end
  2047.   end
  2048.   #--------------------------------------------------------------------------
  2049.   # ● 追加アニメ更新 (RTAB限定機能)
  2050.   #--------------------------------------------------------------------------
  2051.   def update_add_anime
  2052.     if RTAB
  2053.     # アニメーション
  2054.     if @_add_anime_id != 0
  2055.       animation = $data_animations[@_add_anime_id]
  2056.       animation(animation, true)
  2057.       @_add_anime_id = 0
  2058.     end
  2059.     end
  2060.   end
  2061.   #--------------------------------------------------------------------------
  2062.   # ● エフェクト初期化
  2063.   #--------------------------------------------------------------------------
  2064.   def effect_clear
  2065.     @_effect_ox = 0
  2066.     @_effect_oy = 0
  2067.     @_shake_power = 0
  2068.     @_shake_speed = 0
  2069.     @_shake_duration = 0
  2070.     @_shake_direction = 1
  2071.     @_shake = 0
  2072.     @_upside_down = false
  2073.     @_reverse = false
  2074.     @_turning_direction = 1
  2075.     @_turning_speed = 0
  2076.     @_turning_duration = 0
  2077.     @_turning = 0
  2078.     @_move_quick_return = true
  2079.     @_move_speed = 0
  2080.     @_move_coordinates = [0,0,0,0]
  2081.     @_move_jump = false
  2082.     @_move_duration = 0
  2083.     @_moving = [0,0]
  2084.     @_add_anime_id = 0
  2085.   end
  2086.   #--------------------------------------------------------------------------
  2087.   # ● シェイクの開始
  2088.   #     power    : 強さ
  2089.   #     speed    : 速さ
  2090.   #     duration : 時間
  2091.   #--------------------------------------------------------------------------
  2092.   def start_shake(power, speed, duration)
  2093.     @_shake_power = power
  2094.     @_shake_speed = speed
  2095.     @_shake_duration = duration
  2096.   end
  2097.   #--------------------------------------------------------------------------
  2098.   # ● 上下反転を開始
  2099.   #--------------------------------------------------------------------------
  2100.   def start_upside_down
  2101.     @_upside_down = @_upside_down ? false : true
  2102.   end
  2103.   #--------------------------------------------------------------------------
  2104.   # ● 左右反転を開始
  2105.   #--------------------------------------------------------------------------
  2106.   def start_reverse
  2107.     @_reverse = @_reverse ? false : true
  2108.   end
  2109.   #--------------------------------------------------------------------------
  2110.   # ● 回転を開始
  2111.   #     direction: 方向
  2112.   #     speed    : 速さ
  2113.   #     duration : 時間
  2114.   #--------------------------------------------------------------------------
  2115.   def start_turning(direction, speed, duration)
  2116.     @_turning_direction = direction
  2117.     @_turning_speed = speed
  2118.     @_turning_duration = duration
  2119.     @_turning = @_turning_direction == 1 ? 0 : 360
  2120.   end
  2121.   #--------------------------------------------------------------------------
  2122.   # ● 移動を開始
  2123.   #     quick_return : 戻るかどうか
  2124.   #     speed        : 速さ
  2125.   #     x            : X 座標
  2126.   #     y            : Y 座標
  2127.   #--------------------------------------------------------------------------
  2128.   def start_moving(quick_return, speed, x, y)
  2129.     @_move_quick_return = quick_return == 0 ? false : true
  2130.     @_move_speed = speed
  2131.     @_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
  2132.     distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2133.                (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2134.     @_move_duration = distance
  2135.   end
  2136.   #--------------------------------------------------------------------------
  2137.   # ● アニメ追加を開始
  2138.   #     id           : ID
  2139.   #     hit          : 命中フラッグ
  2140.   #--------------------------------------------------------------------------
  2141.   def start_add_anime(id)
  2142.     @_add_anime_id = id
  2143.   end
  2144.   #--------------------------------------------------------------------------
  2145.   # ● 各種エフェクトの開始判定
  2146.   #--------------------------------------------------------------------------
  2147.   if !method_defined?("side_view_animation_process_timing")
  2148.     alias side_view_animation_process_timing animation_process_timing
  2149.   end
  2150.   def animation_process_timing(timing, hit)
  2151.     side_view_animation_process_timing(timing, hit)
  2152.     if (timing.condition == 0) or
  2153.        (timing.condition == 1 and hit == true) or
  2154.        (timing.condition == 2 and hit == false)
  2155.       if timing.se.name =~ SHAKE_FILE
  2156.         names = timing.se.name.split(/#/)
  2157.         power    = names[1].nil? ? SHAKE_POWER    : names[1].to_i
  2158.         speed    = names[2].nil? ? SHAKE_SPEED    : names[2].to_i
  2159.         duration = names[3].nil? ? SHAKE_DURATION : names[3].to_i
  2160.         # シェイクを開始
  2161.         self.start_shake(power, speed, duration)
  2162.       end
  2163.       if timing.se.name == UPSIDE_DOWN_FILE
  2164.         # 上下反転を開始
  2165.         self.start_upside_down
  2166.       end
  2167.       if timing.se.name == REVERSE_FILE
  2168.         # 左右反転を開始
  2169.         self.start_reverse
  2170.       end
  2171.       if timing.se.name =~ TURNING_FILE
  2172.         names = timing.se.name.split(/#/)
  2173.         direction = names[1].nil? ? TURNING_DIRECTION : names[1].to_i
  2174.         speed     = names[2].nil? ? TURNING_SPEED     : names[2].to_i
  2175.         duration  = names[3].nil? ? TURNING_DURATION  : names[3].to_i
  2176.         # 回転を開始
  2177.         self.start_turning(direction, speed, duration)
  2178.       end
  2179.       if timing.se.name =~ MOVE_FILE
  2180.         names = timing.se.name.split(/#/)
  2181.         quick_return= names[1].nil? ? MOVE_RETURN      : names[1].to_i
  2182.         speed       = names[2].nil? ? MOVE_SPEED       : names[2].to_i
  2183.         x           = names[3].nil? ? MOVE_COORDINATES[0] : names[3].to_i
  2184.         y           = names[3].nil? ? MOVE_COORDINATES[1] : names[4].to_i
  2185.         # 移動を開始
  2186.         self.start_moving(quick_return, speed, x, y)
  2187.       end
  2188.       if timing.se.name =~ ADD_ANIME_FILE
  2189.         names = timing.se.name.split(/#/)
  2190.         id = names[1].nil? ? ADD_ANIME_ID      : names[1].to_i
  2191.         # アニメ追加を開始
  2192.         self.start_add_anime(id)
  2193.       end
  2194.     end
  2195.   end
  2196. end
  2197. #==============================================================================
  2198. # ■ Sprite_Weapon
  2199. #------------------------------------------------------------------------------
  2200. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2201. # スプライトの状態を自動的に変化させます。
  2202. #==============================================================================
  2203.  
  2204. class Sprite_Weapon < RPG::Sprite
  2205.   include Side_view
  2206.   #--------------------------------------------------------------------------
  2207.   # ● 公開インスタンス変数
  2208.   #--------------------------------------------------------------------------
  2209.   attr_accessor :battler                  # バトラー
  2210.   attr_reader   :cw                       # グラフィックの幅
  2211.   attr_reader   :ch                       # グラフィックの高さ
  2212.   #--------------------------------------------------------------------------
  2213.   # ● オブジェクト初期化
  2214.   #     viewport : ビューポート
  2215.   #     battler  : バトラー (Game_Battler)
  2216.   #--------------------------------------------------------------------------
  2217.   def initialize(viewport, battler = nil)
  2218.     super(viewport)
  2219.     @battler = battler
  2220.     @battler_visible = false
  2221.   end
  2222.   #--------------------------------------------------------------------------
  2223.   # ● 解放
  2224.   #--------------------------------------------------------------------------
  2225.   def dispose
  2226.     if self.bitmap != nil
  2227.       self.bitmap.dispose
  2228.     end
  2229.     super
  2230.   end
  2231.   #--------------------------------------------------------------------------
  2232.   # ● フレーム更新
  2233.   #--------------------------------------------------------------------------
  2234.   def update
  2235.     super
  2236.     # バトラーが nil の場合
  2237.     if @battler == nil or !@battler.is_a?(Game_Actor)
  2238.       self.bitmap = nil
  2239.       return
  2240.     end
  2241.     # ウエポンアニメのデータ取得
  2242.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  2243.     # 設定が「非表示」の場合
  2244.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  2245.       self.visible = false
  2246.       return
  2247.     else
  2248.       self.visible = true
  2249.     end
  2250.     # ファイル名が現在のものと異なる場合
  2251.     if @weapon_anime_type[0] != @weapon_name
  2252.       @weapon_name = @weapon_anime_type[0]
  2253.       # ビットマップを取得、設定
  2254.       self.bitmap = RPG::Cache.icon(@weapon_name)
  2255.       @width = bitmap.width
  2256.       @height = bitmap.height
  2257.       @flag = true
  2258.     end
  2259.     # 現在アニメパターンが現在のものと異なる場合
  2260.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  2261.       @pattern = @battler.pattern
  2262.       @condition = @battler.condition
  2263.       self.ox = @width
  2264.       self.oy = @height
  2265.       self.z = battler.screen_z
  2266.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  2267.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  2268.       self.src_rect.set(0, 0, @width, @height)
  2269.       self.opacity = 255
  2270.       # バトラーより手前に表示
  2271.       if @weapon_anime_type[2]
  2272.         self.z += 10
  2273.       # バトラーより奥に表示
  2274.       else
  2275.         self.z -= 10
  2276.       end
  2277.       @flag = false
  2278.     end
  2279.   end
  2280. end
  2281.  
  2282. #==============================================================================
  2283. # ■ Sprite_Flying
  2284. #------------------------------------------------------------------------------
  2285. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2286. # スプライトの状態を自動的に変化させます。
  2287. #==============================================================================
  2288.  
  2289. class Sprite_Flying < RPG::Sprite
  2290.   include Side_view
  2291.   #--------------------------------------------------------------------------
  2292.   # ● 公開インスタンス変数
  2293.   #--------------------------------------------------------------------------
  2294.   attr_accessor :battler                  # バトラー
  2295.   #--------------------------------------------------------------------------
  2296.   # ● オブジェクト初期化
  2297.   #     viewport : ビューポート
  2298.   #     battler  : バトラー (Game_Battler)
  2299.   #--------------------------------------------------------------------------
  2300.   def initialize(viewport, battler = nil)
  2301.     super(viewport)
  2302.     @battler = battler
  2303.     @battler_visible = false
  2304.   end
  2305.   #--------------------------------------------------------------------------
  2306.   # ● 解放
  2307.   #--------------------------------------------------------------------------
  2308.   def dispose
  2309.     if self.bitmap != nil
  2310.       self.bitmap.dispose
  2311.     end
  2312.     super
  2313.   end
  2314.   #--------------------------------------------------------------------------
  2315.   # ● フレーム更新
  2316.   #--------------------------------------------------------------------------
  2317.   def update
  2318.     super
  2319.     # バトラーが nil の場合
  2320.     if @battler == nil
  2321.       self.bitmap = nil
  2322.       loop_animation(nil)
  2323.       return
  2324.     end
  2325.     # 遠距離アニメ
  2326.     flying_animation = @battler.flying_animation
  2327.     flying_start = flying_animation[0]
  2328.     flying_end   = flying_animation[1]
  2329.     # アニメーション ID が現在のものと異なる場合
  2330.     if @anime_id != @battler.flying_anime[0]
  2331.       @anime_id = @battler.flying_anime[0]
  2332.       @animation = $data_animations[@anime_id]
  2333.     end
  2334.     # アニメーション 開始
  2335.     if flying_start
  2336.       loop_animation(@animation)
  2337.     elsif flying_end
  2338.       loop_animation(nil)
  2339.     end
  2340.     self.x = @battler.flying_x
  2341.     self.y = @battler.flying_y
  2342.     self.z = @battler.screen_z + 1000
  2343.   end
  2344. end
  2345.  
  2346. module RPG
  2347.   class Skill
  2348.     #--------------------------------------------------------------------------
  2349.     # ● 魔法かどうかの判断
  2350.     #--------------------------------------------------------------------------
  2351.     def magic?
  2352.       if @atk_f == 0
  2353.         return true
  2354.       else
  2355.         return false
  2356.       end
  2357.     end
  2358.   end
  2359. end
  2360.  
  2361. # アローカーソルの位置修正
  2362.  
  2363. class Arrow_Actor < Arrow_Base
  2364.   include Side_view
  2365.   #--------------------------------------------------------------------------
  2366.   # ● フレーム更新
  2367.   #--------------------------------------------------------------------------
  2368.   alias side_view_update update
  2369.   def update
  2370.     side_view_update
  2371.     # スプライトの座標を設定
  2372.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  2373.       self.x = self.actor.screen_x + ARROW_OX
  2374.       self.y = self.actor.screen_y + ARROW_OY
  2375.     end
  2376.   end
  2377. end
  2378. class Arrow_Enemy < Arrow_Base
  2379.   include Side_view
  2380.   #--------------------------------------------------------------------------
  2381.   # ● フレーム更新
  2382.   #--------------------------------------------------------------------------
  2383.   alias side_view_update update
  2384.   def update
  2385.     side_view_update
  2386.     # スプライトの座標を設定
  2387.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  2388.       self.x = self.enemy.screen_x
  2389.       self.y = self.enemy.screen_y + self.enemy.height/2
  2390.     end
  2391.   end
  2392. end

Lv1.梦旅人

梦石
0
星屑
60
在线时间
257 小时
注册时间
2012-7-16
帖子
86
2
 楼主| 发表于 2013-7-2 20:25:37 | 只看该作者
没有人回答吗?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 20:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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