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

Project1

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

[已经过期] 有人能帮我把这个脚本修改成敌我双方都有待机动画吗?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
183 小时
注册时间
2012-1-16
帖子
140
跳转到指定楼层
1
发表于 2012-3-24 19:05:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. =begin
  2.   #--------------------------------------------------------------------------
  3.  # ● 人物行走图做战斗图像(附加动画) ver1.02
  4.   #--------------------------------------------------------------------------
  5.   制作者 らい
  6.   翻译:忧郁的涟漪
  7.   
  8.    
  9.   图像文件的规格
  10.   
  11.   ● 巴特勒图像(似乎指的是战斗图像)
  12.   
  13.   使用步行图片。
  14.    
  15.   ● 武器的图像
  16.   
  17.   就是武器图标的图像(ICO图)  
  18.       

  19. ###############################################################################
  20. 行走图横版战斗:
  21. ------------------------------------------------------------------------------
  22. 经过了两次的修改,终于完全实现了远距离攻击的效果(弓箭、铳类)
  23. 另外,也实现了简单的回旋攻击(类似回力镖的攻击)和攻击道具(类似石头或炸弹)

  24. 这个脚本的更动分为2部分:
  25. 1)战斗动作 - 新加了数个动作,如:“弓箭攻击”、“远距离发动”等等
  26. 2)战斗动画 - 基本上是脚本原带的。只是这个功能被隐藏起来了。现在已恢复。

  27. 用法:
  28. 在相应的脚本行加入武器/技能/道具的数据库id(id之间要用“,”来分开)
  29. 如果不要某些功能的话就随便填一个外太空id就行了(没有用到的id)
  30. 1)战斗动作(角色/行走图的动作)
  31. 脚本355行:  远程武器的id  (普通攻击时使用远程射击)
  32. 脚本357行:  回旋武器的id  (普通攻击时会飞回手上的武器,如:回力镖)
  33. 脚本370行:  远程技能的id  (使用技能时是远程射击)
  34. 脚本372行:  回旋技能的id  (使用技能时,飞出的武器会飞回手上)

  35. 2)战斗动画(显示‘对象方的动画’之前先显示‘飞行武器射去敌人身上’的动画)
  36. 脚本453行:  回旋武器的id  (攻击时会显示一段类似回力镖的动画)
  37. 脚本455行:  弓箭武器的id  (攻击时会显示箭射去敌人身上的动画)
  38. 脚本457行:  铳类武器的id  (攻击时会显示子弹射去敌人身上的动画)
  39. 脚本470行:  回旋技能的id  (技能使用时会显示一段类似回力镖的动画)
  40. 脚本472行:  弓箭技能的id  (技能使用时会显示箭射去敌人身上的动画)
  41. 脚本474行:  铳类技能的id  (技能使用时会显示子弹射去敌人身上的动画)
  42. 脚本486行:  抛击道具的id  (使用该道具时,道具被丢到敌人身上)

  43. 〉注意:
  44. 〉‘飞行武器射去敌人身上’的动画是在设定id之后的那句脚本里面设置
  45. 〉例子:(脚本第455和456行)
  46. 〉       when 17,18,19,20    #远程武器1(弓箭类)的id
  47. 〉       return [101,32,false,false]
  48. 〉这样,武器17~20(都是弓箭)在显示‘对象方的动画’之前会先显示第101号动画
  49. 〉而动画的轨道是从使用者身上直到敌人身上(实现子弹射出的效果)
  50.   
  51. 还有:
  52. 战斗队伍的画面位置已经被修改过,
  53. 让角色的位置与默认的战斗背景图不会有视觉上的冲突。
  54. 如果要更改请去脚本第113-116行改改就行了。

  55. 脚本‘Arrow_Enemy’和‘Arrow_Actor’被稍微修改过(可以无视)

  56. 这个范例附带了
  57. 一张经过修改的战斗背景图(027-castle03),其他的战斗背景图可以使用默认的。
  58. 一套横版的默认敌人的战斗图(从行走图改过来的)

  59. =end                                                        #modify by darkten
  60. ###############################################################################
  61. #
  62. #待机动画添加 2009.1.2 by柳之一
  63. #
  64. module Side_view
  65.   #--------------------------------------------------------------------------
  66.   # ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
  67.   #    在Scene_Battle计算方法是否是方法synthe?
  68.   #    在自动不想认识的时候,请重写。
  69.   #--------------------------------------------------------------------------
  70.   if Scene_Battle.method_defined?("synthe?")
  71.     RTAB = true
  72.   else
  73.     RTAB = false
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 改正RATB中的位置误差 ☆自动识别
  77.   #    在自动不想认识的时候,请重写。
  78.   #--------------------------------------------------------------------------
  79.   def camera_correctness
  80.     return false if !RTAB
  81.     begin
  82.       return $scene.drive
  83.     rescue
  84.       return false
  85.     end
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 队伍中的最大人数
  89.   #--------------------------------------------------------------------------
  90.   Party_max = 4
  91.   #--------------------------------------------------------------------------
  92.   # ● 战斗图的扩大率(1.0的时候是保持原有大小)
  93.   #--------------------------------------------------------------------------
  94.   CHAR_ZOOM = 1.0
  95.   #--------------------------------------------------------------------------
  96.   # ● 光标的位置修正(基本不需要改~)
  97.   #--------------------------------------------------------------------------
  98.   ARROW_OX = 0
  99.   ARROW_OY = 64
  100.   #--------------------------------------------------------------------------
  101.   # ● 名状态作为飞行管理的排列(不知道什么意思....)
  102.   #--------------------------------------------------------------------------
  103.   FLY_STATES = ["飛行"]
  104.   #--------------------------------------------------------------------------
  105.   # ● 战斗画面的位置
  106.   #--------------------------------------------------------------------------
  107.   PARTY_X = 455     # 队伍 X 位置
  108.   PARTY_Y = 200     # 队伍 Y 位置
  109.   FORMATION_X = 15  # 各个角色之间的间隔 X
  110.   FORMATION_Y = 35  # 各个角色之间的间隔 Y
  111.   #--------------------------------------------------------------------------
  112.   # ● 自定义常数
  113.   #--------------------------------------------------------------------------
  114.   NORMAL   = "NORMAL"
  115.   WALK_R   = "WALK_R"
  116.   WALK_L   = "WALK_L"
  117.   ATTACK   = "ATTACK"
  118.   ATTACK_R = "ATTACK_R"
  119.   ATTACK_L = "ATTACK_L"
  120.   MAGIC    = "MAGIC"
  121.   ITEM     = "ITEM"
  122.   # 动画的设定
  123.   ANIME = {
  124.     # [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
  125.     NORMAL            => [1,true , 0,false, true ,""    ], # 通常待击
  126.     WALK_R            => [2,true , 2,false, false,""    ], # 右移动
  127.     WALK_L            => [1,true , 2,false, false,""    ], # 左移动
  128.     ATTACK_R          => [1,false, 2,true , false,"右手"], # 右手攻击
  129.     ATTACK_L          => [1,false, 2,true , false,"左手"], # 左手攻击
  130.     MAGIC             => [1,false, 2,false, false,""    ], # 右手攻击
  131.     ITEM              => [1,false, 2,false, false,""    ], # 左手攻击
  132.     }
  133.    
  134.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  135.   ANIME.default = [1,false,12,false,"",""]
  136.   
  137.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  138.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  139.   DUAL_WEAPONS_ANIME = [ATTACK]
  140.   
  141.   #--------------------------------------------------------------------------
  142.   # ● 摇晃的设定
  143.   #--------------------------------------------------------------------------
  144.   SHAKE_FILE = "摇晃"  # 文件名
  145.   SHAKE_POWER = 5          # 强度
  146.   SHAKE_SPEED = 5          # 速度
  147.   SHAKE_DURATION = 5      # 时间
  148.   #--------------------------------------------------------------------------
  149.   # ● 上下反转地的设定
  150.   #--------------------------------------------------------------------------
  151.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  152.   #--------------------------------------------------------------------------
  153.   # ● 左右反转地的设定
  154.   #--------------------------------------------------------------------------
  155.   REVERSE_FILE = "左右反转" # 文件名
  156.   #--------------------------------------------------------------------------
  157.   # ● 回转地的设定
  158.   #--------------------------------------------------------------------------
  159.   TURNING_FILE = "回转" # 文件名
  160.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  161.   TURNING_SPEED = 40    # 速度
  162.   TURNING_DURATION = 1  # 回转数
  163.   #--------------------------------------------------------------------------
  164.   # ● 移动的设定
  165.   #--------------------------------------------------------------------------
  166.   MOVE_FILE = "移动"             # 文件名
  167.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  168.   MOVE_SPEED = 32                # 速度
  169.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  170.   #--------------------------------------------------------------------------
  171.   # ● 动画追加的设定
  172.   #--------------------------------------------------------------------------
  173.   ADD_ANIME_FILE = "动画追加"  # 文件名
  174.   ADD_ANIME_ID = 0               # 动画的ID
  175.   #--------------------------------------------------------------------------
  176.   # ● 债务不履行声明和RTAB的数据转换
  177.   #--------------------------------------------------------------------------
  178.   def convert_battler
  179.     return RTAB ? @active_actor : @active_battler
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 债务不履行声明和RTAB的数据转换2
  183.   #--------------------------------------------------------------------------
  184.   def convert_battler2(*arg)
  185.     return RTAB ? arg[0] : @active_battler
  186.   end
  187. end

  188. #--------------------------------------------------------------------------
  189. # ● 行动設定
  190. #--------------------------------------------------------------------------
  191. module BattleActions
  192.   
  193.   # 下のものはあくまでも一例なので
  194.   # 独自に作ってください。

  195.   Actions = {

  196.   "通常攻撃" => [
  197.   
  198.   "閃きアニメ",
  199.   "アクターアニメ変更#WALK_L",
  200.   "移動#target,32,0,64,0",
  201.   "行動アニメ",
  202.   "アクターアニメ変更#ATTACK",
  203.   "遠距離アニメ",
  204.   "対象アニメ",
  205.   "アクターアニメ変更#WALK_L",
  206.   "SEの演奏#016-Jump02,80,100",
  207.   "移動#self,0,0,48,32",
  208.   "終了"
  209.   ],

  210.   "エネミー攻撃" => [
  211.   
  212.   "閃きアニメ",
  213.   "アクターアニメ変更#WALK_L",
  214.   "移動#self,-36,0,12,0",
  215.   "行動アニメ",
  216.   "アクターアニメ変更#ATTACK",
  217.   "遠距離アニメ",
  218.   "対象アニメ",
  219.   "アクターアニメ変更#WALK_L",
  220.   "移動#self,0,0,12,0",
  221.   "終了"
  222.   ],
  223.   
  224.   "術発動" => [
  225.   
  226.   "閃きアニメ",
  227.   "アクターアニメ変更#WALK_L",
  228.   "移動#self,-32,0,4,0",
  229.   "アクターアニメ変更#MAGIC",
  230.   "行動アニメ",
  231.   "ウエイト#15",
  232.   "遠距離アニメ",
  233.   "対象アニメ",
  234.   "アクターアニメ変更#WALK_L",
  235.   "移動#self,0,0,4,2",
  236.   "終了"
  237.   ],

  238.   "アイテム使用" => [
  239.   
  240.   "閃きアニメ",
  241.   "アクターアニメ変更#WALK_L",
  242.   "移動#self,-32,0,4,0",
  243.   "行動アニメ",
  244.   "アクターアニメ変更#ITEM",
  245.   "ウエイト#15",
  246.   "遠距離アニメ",
  247.   "対象アニメ",
  248.   "アクターアニメ変更#WALK_L",
  249.   "移動#self,0,0,4,2",
  250.   "終了"
  251.   ],
  252.   
  253.   "払い抜け" => [
  254.   
  255.   "閃きアニメ",
  256.   "アクターアニメ変更#WALK_L",
  257.   "移動#target_near,50,0,48,30",  
  258.   "左右反転",
  259.   "アクターアニメ固定#ATTACK#3",
  260.   "行動アニメ",
  261.   "SEの演奏#135-Light01,100,100",
  262.   "アニメーションの表示#self,42",
  263.   "ウエイト#15",
  264.   "左右反転",
  265.   "残像表示",
  266.   "移動#target_far,-50,0,48,0",
  267.   "対象アニメ",
  268.   "残像消去",
  269.   "アニメ固定解除",
  270.   "アクターアニメ変更#WALK_L",
  271.   "移動#self,0,0,48,1,0",
  272.   "終了"
  273.   ],

  274.   "弓箭攻撃" => [
  275.   
  276.   "閃きアニメ",
  277.   "アクターアニメ変更#WALK_L",
  278.   "移動#self,-32,0,4,0",
  279.   "行動アニメ",
  280.   "アクターアニメ変更#ATTACK",
  281.   "遠距離アニメ",
  282.   "対象アニメ",
  283.   "アクターアニメ変更#WALK_L",
  284.   "移動#self,0,0,4,2",
  285.   "終了"
  286.   ],

  287.   "回旋攻撃" => [
  288.   
  289.   "閃きアニメ",
  290.   "アクターアニメ変更#WALK_L",
  291.   "移動#self,-32,0,4,0",
  292.   "行動アニメ",
  293.   "アクターアニメ変更#STAND_L",  
  294.   "遠距離アニメ",
  295.   "対象アニメ",
  296.   "アクターアニメ変更#WALK_L",
  297.   "移動#self,0,0,4,2",
  298.   "終了"
  299.   ],
  300.   
  301.   "远距离発動" => [
  302.   
  303.   "閃きアニメ",
  304.   "アクターアニメ変更#WALK_L",
  305.   "移動#self,-32,0,4,0",
  306.   "アクターアニメ変更#MAGIC",
  307.   "行動アニメ",
  308.   "アクターアニメ変更#ATTACK",
  309.   "遠距離アニメ",
  310.   "対象アニメ",
  311.   "アクターアニメ変更#WALK_L",
  312.   "移動#self,0,0,4,2",
  313.   "終了"
  314.   ],
  315.   
  316.   "回旋発動" => [
  317.   
  318.   "閃きアニメ",
  319.   "アクターアニメ変更#WALK_L",
  320.   "移動#self,-32,0,4,0",
  321.   "アクターアニメ変更#MAGIC",
  322.   "行動アニメ",
  323.   "アクターアニメ変更#STAND_L",  
  324.   "遠距離アニメ",
  325.   "対象アニメ",
  326.   "アクターアニメ変更#WALK_L",
  327.   "移動#self,0,0,4,2",
  328.   "終了"
  329.   ],

  330.   } # ここで終わり 消さないでください

  331. end
  332.   
  333. module RPG
  334.   class Weapon
  335.     #--------------------------------------------------------------------------
  336.     # ● アクション設定
  337.     #--------------------------------------------------------------------------
  338.     def battle_actions
  339.       case @id
  340.       when 17,18,19,20,21,22,23,24  # 远程武器的id回旋攻撃
  341.         return BattleActions::Actions["弓箭攻撃"]
  342.       when 34                       # 回旋武器的id
  343.         return BattleActions::Actions["回旋攻撃"]
  344.       end
  345.       else
  346.       return BattleActions::Actions["通常攻撃"]
  347.     end
  348.   end
  349.   class Skill
  350.     #--------------------------------------------------------------------------
  351.     # ● アクション設定
  352.     #--------------------------------------------------------------------------
  353.     def battle_actions
  354.       case @id
  355.       when 73,74,75,76,77,78,79,80  # 远程技能的id
  356.         return BattleActions::Actions["远距离発動"]
  357.       when 82                       # 回旋技能的id
  358.         return BattleActions::Actions["回旋発動"]
  359.       end
  360.       else
  361.       if self.magic?
  362.         return BattleActions::Actions["術発動"]
  363.       else
  364.         return BattleActions::Actions["払い抜け"]
  365.       end
  366.     end
  367.   end
  368.   class Item
  369.     #--------------------------------------------------------------------------
  370.     # ● アクション設定
  371.     #--------------------------------------------------------------------------
  372.     def battle_actions
  373.       return BattleActions::Actions["アイテム使用"]
  374.     end
  375.   end
  376. end
  377. class Game_Enemy < Game_Battler
  378.   #--------------------------------------------------------------------------
  379.   # ● アクション設定
  380.   #--------------------------------------------------------------------------
  381.   def battle_actions
  382.     return BattleActions::Actions["エネミー攻撃"]
  383.   end
  384. end
  385. =begin
  386. #--------------------------------------------------------------------------
  387. # ● 遠距離アニメーション
  388. #--------------------------------------------------------------------------
  389.  ☆ 説明
  390.   
  391.    行動者から対象者にアニメを飛ばします。
  392.    飛ばすアニメを データベース‐アニメーション で作ります。
  393.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。


  394.   ● カスタマイズ方法
  395.    
  396.     case @id
  397.     when 17,18,19,20
  398.       return [101,32,false,false]
  399.     when 21,22,23,24
  400.       return [102,32,false,false]
  401.     end
  402.     return 0
  403.    
  404.     のように描くとID別に指定可能です。
  405.    
  406.    
  407.   ● アニメーションID
  408.   
  409.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
  410.   
  411.    
  412.   ● スピード
  413.   
  414.   大きいほうが早い(0だとアニメは移動しません)
  415.   
  416.   1 = 1フレームで1ドット進むと考えてください。
  417.   
  418.   ● 往復するか?
  419.   
  420.   true とした場合、ブーメランのようにアニメが戻ります。
  421.   
  422.   ● 直線(false)or曲線(true)
  423.   
  424.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  425.   false = 対象に向かって直線で、アニメが飛びます。
  426.    
  427. =end
  428. module RPG
  429.   class Weapon
  430.     #--------------------------------------------------------------------------
  431.     # ● 遠距離アニメーション
  432.     #--------------------------------------------------------------------------
  433.     def flying_anime
  434.       # ID 指定 の例(武器的id,分类是根据飞行武器的动画id)
  435.       case @id
  436.       when 34             #回旋武器(类似回力镖)的id
  437.         return [103,32,true,true]
  438.       when 17,18,19,20    #远程武器1(弓箭类)的id
  439.         return [101,32,false,false]
  440.       when 21,22,23,24    #远程武器2(铳类)的id
  441.         return [102,32,false,false]
  442.       end
  443.       return [0,0,false,false]
  444.     end
  445.   end
  446.   class Skill
  447.     #--------------------------------------------------------------------------
  448.     # ● 遠距離アニメーション
  449.     #--------------------------------------------------------------------------
  450.     def flying_anime
  451.       # ID 指定 の例(技能的id,分类是根据飞行武器的动画id)
  452.       case @id
  453.       when 82             #回旋技能(类似回力镖)的id
  454.         return [103,32,true,true]
  455.       when 73,74,75,76    #远程技能1(弓箭类)的id
  456.         return [101,32,false,false]
  457.       when 77,78,79,80    #远程技能2(铳类)的id
  458.         return [102,32,false,false]
  459.       end
  460.       return [0,0,false,false]
  461.     end
  462.   end
  463.   class Item
  464.     #--------------------------------------------------------------------------
  465.     # ● 遠距離アニメーション
  466.     #--------------------------------------------------------------------------
  467.     def flying_anime
  468.       case @id
  469.       when 34    #抛击类道具(如炸弹一类)的id
  470.         return [104,32,false,true]
  471.       end
  472.       return [0,0,false,false]
  473.     end
  474.   end
  475. end

  476. class Game_Enemy < Game_Battler
  477.   #--------------------------------------------------------------------------
  478.   # ● 遠距離アニメーション
  479.   #--------------------------------------------------------------------------
  480.   def flying_anime
  481.     return [0,0,false,false]
  482.   end
  483. end
  484. #==============================================================================
  485. # ■ Game_Battler
  486. #==============================================================================
  487. class Game_Battler
  488.   include Side_view
  489.   #--------------------------------------------------------------------------
  490.   # ● 追加・公開インスタンス変数
  491.   #--------------------------------------------------------------------------
  492.   attr_accessor :height                  # 画像の高さ
  493.   attr_accessor :real_x                  # X座標補正
  494.   attr_accessor :real_y                  # Y座標補正
  495.   attr_accessor :real_zoom               # 拡大率
  496.   attr_accessor :wait_count              # アニメーション 待ち時間
  497.   attr_accessor :wait_count2             # アニメーション 待ち時間2
  498.   attr_accessor :pattern                 # アニメーション カウント(キャラ)
  499.   attr_accessor :shake                   # シェイク開始フラッグ
  500.   attr_accessor :reverse                 # 左右反転フラッグ
  501.   attr_accessor :shadow                  # 残像フラッグ
  502.   attr_accessor :flash_flag
  503.   attr_accessor :battler_name            # 閃きフラッグ
  504.   attr_reader   :ox                      # X座標補正
  505.   attr_reader   :oy                      # Y座標補正
  506.   attr_reader   :flying_x                # 遠距離アニメX座標
  507.   attr_reader   :flying_y                # 遠距離アニメY座標
  508.   attr_reader   :flying_anime            # 遠距離アニメ
  509.   attr_reader   :animation1_on           # 行動アニメ開始フラッグ
  510.   attr_reader   :animation2_on           # 対象アニメ開始フラッグ
  511.   #--------------------------------------------------------------------------
  512.   # ● デフォルトのアニメーション待ち時間を取得
  513.   #--------------------------------------------------------------------------
  514.   def animation_duration=(animation_duration)
  515.     @_animation_duration = animation_duration
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● バトル開始時のセットアップ
  519.   #--------------------------------------------------------------------------
  520.   def start_battle
  521.     @height = 0
  522.     @real_x = 0
  523.     @real_y = 0
  524.     @real_zoom = 1.0
  525.     @battler_condition = ""
  526.     @action = nil
  527.     @battle_actions = []
  528.     @battler_action = false
  529.     @step = 0
  530.     @anime_on = false
  531.     @wait_count = 0
  532.     @wait_count2 = 0
  533.     @ox = 0
  534.     @oy = 0
  535.     @pattern = 0
  536.     @pattern_log = true
  537.     @pattern_freeze = false
  538.     @condition_freeze = false
  539.     @active = false
  540.     @move_distance = nil
  541.     @move_wait = 0
  542.     @move_coordinates = [0,0,0,0]
  543.     @flying_distance = nil
  544.     @flying_wait = 0
  545.     @flying_x = 0
  546.     @flying_y = 0
  547.     @flash_flag = {}
  548.     self.flying_clear
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ● 移動中判定
  552.   #--------------------------------------------------------------------------
  553.   def moving?
  554.     # X座標補正または、Y座標補正が0でなければ、移動中
  555.     return (@ox != 0 or @oy != 0)
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 移動終了判定
  559.   #--------------------------------------------------------------------------
  560.   def move_end?
  561.     return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● アクション開始設定
  565.   #--------------------------------------------------------------------------
  566.   def action(flag = true)
  567.     @battler_action = flag
  568.     @animation1_on = false
  569.     @animation2_on = false
  570.     @step = "setup"
  571.   end   
  572.   #--------------------------------------------------------------------------
  573.   # ● アクション中判定
  574.   #--------------------------------------------------------------------------
  575.   def action?
  576.     return @battler_action
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 閃き判定
  580.   #--------------------------------------------------------------------------
  581.   def flash?
  582.     return @flash_flg
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● 戦闘不能判定
  586.   #--------------------------------------------------------------------------
  587.   def anime_dead?
  588.     if $game_temp.in_battle and !RTAB
  589.       if [2,3,4,5].include?($scene.phase4_step)
  590.         return @last_dead
  591.       end
  592.     end
  593.     return @last_dead = self.dead?
  594.   end
  595.   #--------------------------------------------------------------------------
  596.   # ● ピンチ状態判定
  597.   #--------------------------------------------------------------------------
  598.   def crisis?
  599.     if $game_temp.in_battle and !RTAB
  600.       if [2,3,4,5].include?($scene.phase4_step)
  601.         return @last_crisis
  602.       end
  603.     end
  604.     return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● バッドステート判定
  608.   #--------------------------------------------------------------------------
  609.   def badstate?
  610.     for i in @states
  611.       unless $data_states[i].nonresistance
  612.         return true
  613.       end
  614.     end
  615.     return false
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● 飛行
  619.   #--------------------------------------------------------------------------
  620.   def fly
  621.     if @fly != nil
  622.       return @fly
  623.     end
  624.     for id in @states
  625.       if FLY_STATES.include?($data_states[id].name)
  626.         return 60
  627.       end
  628.     end
  629.     return 0
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● 遠距離アニメ目標座標の計算
  633.   #--------------------------------------------------------------------------
  634.   def flying_setup
  635.     # 二度目は実行しない
  636.     return if @flying_distance != nil && !camera_correctness
  637.     if RTAB
  638.       targets = @target
  639.     else
  640.       targets = $scene.target_battlers
  641.     end
  642.     # 目的座標を計算
  643.     @f_target_x = 0
  644.     @f_target_y = 0
  645.     for t in targets
  646.       @f_target_x += t.screen_x
  647.       @f_target_y += t.screen_y
  648.     end
  649.     if targets != []
  650.       @f_target_x /= targets.size
  651.       @f_target_y /= targets.size
  652.     else
  653.       @flying_distance = 0
  654.       return
  655.     end
  656.     # 距離の計算
  657.     @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ● 遠距離アニメ
  661.   #--------------------------------------------------------------------------
  662.   def flying_animation
  663.     # 戻る
  664.     if @step != "flying" or @flying_distance.nil?
  665.       return [false,true]
  666.     end
  667.     # あらかじめ計算
  668.     self_x = self.screen_x
  669.     self_y = self.screen_y
  670.     @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
  671.     n1 = @flying_wait / @flying_distance.to_f
  672.     if @flying_distance - @flying_wait > @flying_distance / 2
  673.       n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
  674.     else
  675.       n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
  676.     end
  677.     if !@flying_anime[4]
  678.       # 直線移動
  679.       x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  680.       y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
  681.     else
  682.       # 曲線移動
  683.       if !@flying_proceed_end
  684.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  685.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
  686.       else
  687.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  688.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
  689.       end
  690.     end
  691.     # 座標代入
  692.     @flying_x = x
  693.     @flying_y = y
  694.     # ウエイト
  695.     if !@flying_proceed_end
  696.       # 開始
  697.       @flying_proceed_start = @flying_wait == 0
  698.       @flying_wait += @flying_anime[1]
  699.       @flying_wait = [@flying_wait,@flying_distance].min
  700.       @flying_proceed_end = @flying_wait == @flying_distance
  701.     else
  702.       # 開始
  703.       @flying_return_start = @flying_wait == @flying_distance
  704.       @flying_wait -= @flying_anime[1]
  705.       @flying_wait = [@flying_wait,0].max
  706.       @flying_return_end = @flying_wait == 0
  707.     end
  708.     if @flying_anime[1] == 0
  709.       @flying_end = true
  710.     elsif !@flying_anime[2]
  711.       @flying_end = @flying_proceed_end
  712.     else
  713.       @flying_end = @flying_return_end
  714.     end
  715.     # 値を返す(アニメ開始,アニメ終了)
  716.     return [@flying_proceed_start,@flying_end]
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # ● 遠距離アニメ初期化
  720.   #--------------------------------------------------------------------------
  721.   def flying_clear
  722.     @flying_proceed_start = false
  723.     @flying_proceed_end = false
  724.     @flying_return_start = false
  725.     @flying_return_end = false
  726.     @flying_end = false
  727.     @flying_anime = [0,0,false]
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● 移動
  731.   #--------------------------------------------------------------------------
  732.   def move
  733.     # 距離の計算
  734.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  735.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  736.     if @move_distance > 0
  737.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  738.       array = @move_coordinates
  739.       # ジャンプ補正値の計算
  740.       if @move_distance - @move_wait > @move_distance / 2
  741.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  742.       else
  743.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  744.       end
  745.       jump = @move_action[4] > 0 ? -jump : jump
  746.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  747.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  748.       # ウエイト
  749.       @move_wait -= @move_action[3]
  750.       @move_wait = [@move_wait,0].max
  751.     end
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # ● 移動アクションの取得
  755.   #--------------------------------------------------------------------------
  756.   def get_move_action
  757.     string = @action.split(/#/)[1]
  758.     string = string.split(/,/)
  759.     @move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # ● アクションの取得
  763.   #--------------------------------------------------------------------------
  764.   def get_step
  765.     if @action.nil?
  766.       @step = "finish"
  767.       return
  768.     end
  769.     string = @action.split(/#/)[0]
  770.     if string =~ "移動"
  771.       @step = "moving_setup"
  772.     elsif string =~ "アクターアニメ実行"
  773.       @step = "action"
  774.     elsif string =~ "遠距離アニメ"
  775.       @step = "flying"
  776.     elsif string =~ "アクターアニメ変更"
  777.       @step = "change"
  778.     elsif string =~ "行動アニメ"
  779.       @step = "animation1"
  780.     elsif string =~ "対象アニメ"
  781.       @step = "animation2"
  782.     elsif string =~ "ウエイト"
  783.       @step = "wait"
  784.     elsif string =~ "左右反転"
  785.       @step = "reverse"
  786.     elsif string =~ "閃きアニメ"
  787.       @step = "flash"
  788.     elsif string =~ "残像表示"
  789.       @step = "shadow_on"
  790.     elsif string =~ "残像消去"
  791.       @step = "shadow_off"
  792.     elsif string =~ "アクターアニメ固定"
  793.       @step = "freeze"
  794.     elsif string =~ "アニメ固定解除"
  795.       @step = "freeze_lifting"
  796.     elsif string =~ "アニメーションの表示"
  797.       @step = "animation_start"
  798.     elsif string =~ "SEの演奏"
  799.       @step = "play_se"
  800.     else
  801.       @step = "finish"
  802.     end
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● フレーム更新 (次のアクションへ)
  806.   #--------------------------------------------------------------------------
  807.   def update_next
  808.     @action = @battle_actions.shift
  809.     @step = get_step
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # ● フレーム更新 (動作取得)
  813.   #--------------------------------------------------------------------------
  814.   def update_setup
  815.     # アクションの取得
  816.     self.get_actions
  817.     @action = @battle_actions.shift
  818.     @step = get_step
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ● フレーム更新 (移動取得)
  822.   #--------------------------------------------------------------------------
  823.   def update_moving_setup
  824.     # 移動アクションの取得
  825.     self.get_move_action
  826.     # 移動目標の設定
  827.     self.move_setup
  828.     @step = "moving"
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● フレーム更新 (移動)
  832.   #--------------------------------------------------------------------------
  833.   def update_moving
  834.     # 移動
  835.     self.move
  836.     self.condition = @battler_condition
  837.     # 移動完了したら次のステップへ
  838.     if move_end?
  839.       @wait_count = 2
  840.       @action = @battle_actions.shift
  841.       @step = get_step
  842.     end
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # ● フレーム更新 (アニメ実行)
  846.   #--------------------------------------------------------------------------
  847.   def update_action
  848.     con = @action.split(/#/)[1]
  849.     # 右手・左手を分ける
  850.     if DUAL_WEAPONS_ANIME.include?(con)
  851.       if !@first_weapon and @second_weapon
  852.         con = con + "_L"
  853.       else
  854.         con = con + "_R"
  855.       end
  856.     end
  857.     # アニメ変更
  858.     self.condition = con
  859.     # ループか否か
  860.     if !ANIME[@battler_condition][1]
  861.       self.anime_on
  862.     end
  863.     @action = @battle_actions.shift
  864.     @step = get_step
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # ● フレーム更新 (遠距離アニメ)
  868.   #--------------------------------------------------------------------------
  869.   def update_flying
  870.     # 目標の設定
  871.     self.flying_setup
  872.     # 遠距離アニメ終了
  873.     if @flying_end
  874.       self.flying_clear
  875.       @action = @battle_actions.shift
  876.       @step = get_step
  877.     end
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ● フレーム更新 (アニメ変更)
  881.   #--------------------------------------------------------------------------
  882.   def update_change
  883.     con = @action.split(/#/)[1]
  884.     # 右手・左手を分ける
  885.     if DUAL_WEAPONS_ANIME.include?(con)
  886.       if !@first_weapon and @second_weapon
  887.         con = con + "_L"
  888.       else
  889.         con = con + "_R"
  890.       end
  891.     end
  892.     # アニメ変更
  893.     self.condition = con
  894.     # ループか否か
  895.     if !ANIME[@battler_condition][1]
  896.       self.anime_on
  897.     end
  898.     @action = @battle_actions.shift
  899.     @step = get_step
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● フレーム更新 (行動アニメ)
  903.   #--------------------------------------------------------------------------
  904.   def update_animation1
  905.     @animation1_on = true
  906.     # 行動アニメの後に行動を開始する
  907.     if $scene.phase4_step == 3
  908.       id = RTAB ? @anime1 : $scene.animation1_id
  909.       animation = $data_animations[id]
  910.       frame_max = animation != nil ? animation.frame_max : 0
  911.       @wait_count2 = frame_max * 2
  912.       return
  913.     end
  914.     @action = @battle_actions.shift
  915.     @step = get_step
  916.   end
  917.   #--------------------------------------------------------------------------
  918.   # ● フレーム更新 (対象アニメ)
  919.   #--------------------------------------------------------------------------
  920.   def update_animation2
  921.     @animation2_on = true
  922.     # 行動アニメの後に行動を開始する
  923.     if $scene.phase4_step == 4
  924.       id = RTAB ? @anime2 : $scene.animation2_id
  925.       animation = $data_animations[id]
  926.       frame_max = animation != nil ? animation.frame_max : 0
  927.       @wait_count2 = frame_max * 2
  928.       return
  929.     end
  930.     @action = @battle_actions.shift
  931.     @step = get_step
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ● フレーム更新 (ウエイト)
  935.   #--------------------------------------------------------------------------
  936.   def update_wait
  937.     @wait_count2 = @action.split(/#/)[1].to_i
  938.     @action = @battle_actions.shift
  939.     @step = get_step
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ● フレーム更新 (残像表示)
  943.   #--------------------------------------------------------------------------
  944.   def update_shadow_on
  945.     @shadow = true
  946.     @action = @battle_actions.shift
  947.     @step = get_step
  948.   end
  949.   #--------------------------------------------------------------------------
  950.   # ● フレーム更新 (残像消去)
  951.   #--------------------------------------------------------------------------
  952.   def update_shadow_off
  953.     @shadow = false
  954.     @action = @battle_actions.shift
  955.     @step = get_step
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ● フレーム更新 (左右反転)
  959.   #--------------------------------------------------------------------------
  960.   def update_reverse
  961.     @reverse = @reverse ? false : true
  962.     @action = @battle_actions.shift
  963.     @step = get_step
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ● フレーム更新 (閃きアニメ)
  967.   #--------------------------------------------------------------------------
  968.   def update_flash
  969.     # 閃きアニメの後に行動を開始する
  970.     if @flash_flag["normal"]
  971.       @wait_count = $scene.flash_duration
  972.       @flash_flag["normal"] = false
  973.       return
  974.     end
  975.     @action = @battle_actions.shift
  976.     @step = get_step
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● フレーム更新 (SEの演奏)
  980.   #--------------------------------------------------------------------------
  981.   def update_play_se
  982.     data = @action.split(/#/)[1]
  983.     data = data.split(/,/)
  984.     # SE を演奏
  985.     Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
  986.     @action = @battle_actions.shift
  987.     @step = get_step
  988.   end
  989.   #--------------------------------------------------------------------------
  990.   # ● フレーム更新 (アクターアニメ固定)
  991.   #--------------------------------------------------------------------------
  992.   def update_freeze
  993.     con = @action.split(/#/)[1]
  994.     # 右手・左手を分ける
  995.     if DUAL_WEAPONS_ANIME.include?(con)
  996.       if !@first_weapon and @second_weapon
  997.         con = con + "_L"
  998.       else
  999.         con = con + "_R"
  1000.       end
  1001.     end
  1002.     # アニメ変更
  1003.     self.condition = con
  1004.     @pattern = @action.split(/#/)[2].to_i
  1005.     @pattern_freeze = true
  1006.     @condition_freeze = true
  1007.     @action = @battle_actions.shift
  1008.     @step = get_step
  1009.   end
  1010.   #--------------------------------------------------------------------------
  1011.   # ● フレーム更新 (アクターアニメ固定解除)
  1012.   #--------------------------------------------------------------------------
  1013.   def update_freeze_lifting
  1014.     @pattern_freeze = false
  1015.     @condition_freeze = false
  1016.     @action = @battle_actions.shift
  1017.     @step = get_step
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # ● フレーム更新 (アニメーションの表示)
  1021.   #--------------------------------------------------------------------------
  1022.   def update_animation_start
  1023.     data = @action.split(/#/)[1]
  1024.     data = data.split(/,/)
  1025.     target = data[0]
  1026.     animation_id = data[1].to_i
  1027.     if RTAB
  1028.       case target
  1029.       when "self"
  1030.         @animation.push([animation_id,true])
  1031.       when "target"
  1032.         for tar in @target
  1033.           tar.animation.push([animation_id, true])
  1034.         end
  1035.       end
  1036.     else
  1037.       case target
  1038.       when "self"
  1039.         @animation_id = animation_id
  1040.         @animation_hit = true
  1041.       when "target"
  1042.         for tar in $scene.target_battlers
  1043.           tar.animation_id = animation_id
  1044.           tar.animation_hit = true
  1045.         end
  1046.       end
  1047.     end
  1048.     @action = @battle_actions.shift
  1049.     @step = get_step
  1050.   end
  1051.   #--------------------------------------------------------------------------
  1052.   # ● フレーム更新 (動作終了)
  1053.   #--------------------------------------------------------------------------
  1054.   def update_finish
  1055.     # 動作終了
  1056.     @battler_action = false
  1057.     @step = "setup"
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # ● バトラーの状態 変更(バトラーグラフィックのタイプ)
  1061.   #--------------------------------------------------------------------------
  1062.   def condition=(condition)
  1063.     return if @condition_freeze
  1064.     @battler_condition = condition
  1065.     @wait_count = ANIME[condition][2]
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ● バトラーの状態(バトラーグラフィックのタイプ)
  1069.   #--------------------------------------------------------------------------
  1070.   def condition
  1071.     return @battler_condition
  1072.   end
  1073.   #--------------------------------------------------------------------------
  1074.   # ● フレーム更新
  1075.   #--------------------------------------------------------------------------
  1076.   def update
  1077.     # ウェイト中の場合
  1078.     if @wait_count > 0
  1079.       return
  1080.     end
  1081.     # パターン更新
  1082.     self.char_animation
  1083.     # ウェイト中の場合
  1084.     if @wait_count2 > 0
  1085.       return
  1086.     end
  1087.    
  1088.     # 行動アニメーション
  1089.     if @battler_action
  1090.       method("update_" + @step).call
  1091.       return
  1092.     end
  1093.    
  1094.     # データ初期化
  1095.     @animation1_on = false
  1096.     @animation2_on = false
  1097.     @action = nil
  1098.     @battle_actions = []
  1099.     @move_wait = 0
  1100.     @move_distance = nil
  1101.     @flying_wait = 0
  1102.     @flying_distance = nil
  1103.     @flash = false

  1104.     # RTAB対応
  1105.     # 通常・待機
  1106.     return self.condition = NORMAL
  1107.   end
  1108.   #--------------------------------------------------------------------------
  1109.   # ● アクションの取得
  1110.   #--------------------------------------------------------------------------
  1111.   def get_actions
  1112.     skill = $data_skills[self.current_action.skill_id]
  1113.     item = $data_items[self.current_action.item_id]
  1114.     kind = self.current_action.kind
  1115.     # 動作取得
  1116.     @battle_actions = []
  1117.     # スキル
  1118.     if skill != nil && kind == 1
  1119.       @battle_actions = skill.battle_actions.dup
  1120.       @flying_anime = skill.flying_anime
  1121.     # アイテム
  1122.     elsif item != nil && kind == 2
  1123.       @battle_actions = item.battle_actions.dup
  1124.       @flying_anime = item.flying_anime
  1125.     # 左手攻撃
  1126.     elsif !@first_weapon and @second_weapon and self.is_a?(Game_Actor)
  1127.       @battle_actions = self.battle_actions2.dup
  1128.       @flying_anime = self.flying_anime2
  1129.     # 右手攻撃
  1130.     elsif self.current_action.basic == 0 and
  1131.       self.is_a?(Game_Actor) and self.current_action.kind == 0
  1132.       @battle_actions = self.battle_actions1.dup
  1133.       @flying_anime = self.flying_anime1
  1134.     # 通常攻撃
  1135.     elsif self.current_action.basic == 0 and self.current_action.kind == 0
  1136.       @battle_actions = self.battle_actions.dup
  1137.       @flying_anime = self.flying_anime
  1138.     else
  1139.       @battle_actions = ["終了"]
  1140.       @flying_anime = [0,0,false,false]
  1141.     end
  1142.   end
  1143.   #--------------------------------------------------------------------------
  1144.   # ● ループしないアニメのセット
  1145.   #--------------------------------------------------------------------------
  1146.   def anime_on
  1147.     @pattern = 0
  1148.     @pattern_log = true
  1149.     return
  1150.   end
  1151.   #--------------------------------------------------------------------------
  1152.   # ● パターン更新
  1153.   #--------------------------------------------------------------------------
  1154.   def char_animation
  1155.     # パタン固定の場合もどる
  1156.     return if @pattern_freeze
  1157.     # ループしないアニメの場合 1234 で止まる
  1158.     if !ANIME[@battler_condition][1] && @pattern == 3
  1159.       return
  1160.     end
  1161.     # アニメさせない場合 1 で止まる
  1162.     if ANIME[@battler_condition][4]
  1163.       @pattern = 0
  1164.       return
  1165.     end
  1166.     @pattern = (@pattern + 1) % 4
  1167.   end
  1168.   #--------------------------------------------------------------------------
  1169.   # ● アニメタイプ
  1170.   #--------------------------------------------------------------------------
  1171.   def anime_type
  1172.     return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
  1173.   end
  1174. end
  1175. #==============================================================================
  1176. # ■ Game_Actor
  1177. #==============================================================================
  1178. class Game_Actor < Game_Battler
  1179.   include Side_view
  1180.   #--------------------------------------------------------------------------
  1181.   # ● セットアップ
  1182.   #--------------------------------------------------------------------------
  1183.   alias side_view_setup setup
  1184.   def setup(actor_id)
  1185.     side_view_setup(actor_id)
  1186.     start_battle
  1187.   end
  1188.   #--------------------------------------------------------------------------
  1189.   # ● 二刀武器のID取得 ※エラー回避用
  1190.   #--------------------------------------------------------------------------
  1191.   def weapon2_id
  1192.     return @weapon2_id != nil ? @weapon2_id : 0
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ● X方向 ポジション 取得 (陣形スクリプト拡張用)
  1196.   #--------------------------------------------------------------------------
  1197.   def position
  1198.     return $data_classes[@class_id].position
  1199.   end
  1200.   #--------------------------------------------------------------------------
  1201.   # ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
  1202.   #--------------------------------------------------------------------------
  1203.   def position2
  1204.     return self.index
  1205.   end
  1206.   #--------------------------------------------------------------------------
  1207.   # ● 武器アニメタイプ
  1208.   #--------------------------------------------------------------------------
  1209.   def weapon_anime_type(type)
  1210.     file_name  = weapon_anime_type0(type)
  1211.     visible   = weapon_anime_type1(type)
  1212.     z         = weapon_anime_type2(type)
  1213.     return [file_name,visible,z]
  1214.   end
  1215.   # 武器アイコン取得
  1216.   def weapon_anime_type0(type)
  1217.     type = ANIME[type][5]
  1218.     return weapon_anime1 if type == "右手"
  1219.     return weapon_anime2 if type == "左手"
  1220.     return nil
  1221.   end
  1222.   # 表示・非表示の取得
  1223.   def weapon_anime_type1(type)
  1224.     return ANIME[type][3]
  1225.   end
  1226.   # バトラーより上に表示するかどうか
  1227.   def weapon_anime_type2(type)
  1228.     type = ANIME[type][5]
  1229.     return true if type == "左手"
  1230.     return false
  1231.   end
  1232.   #--------------------------------------------------------------------------
  1233.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1234.   #--------------------------------------------------------------------------
  1235.   def true_x
  1236.     return PARTY_X + position * FORMATION_X + @ox
  1237.   end
  1238.   #--------------------------------------------------------------------------
  1239.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1240.   #--------------------------------------------------------------------------
  1241.   def true_y
  1242.     # パーティ内の並び順から Y 座標を計算して返す
  1243.     if self.index != nil
  1244.       y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
  1245.       return y
  1246.     else
  1247.       return 0
  1248.     end
  1249.   end
  1250.   #--------------------------------------------------------------------------
  1251.   # ● バトル画面 X 座標の取得
  1252.   #--------------------------------------------------------------------------
  1253.   def screen_x(true_x = self.true_x)
  1254.     return 320 + (true_x - 320) * @real_zoom + @real_x
  1255.   end
  1256.   #--------------------------------------------------------------------------
  1257.   # ● バトル画面 Y 座標の取得
  1258.   #--------------------------------------------------------------------------
  1259.   def screen_y(true_y = self.true_y)
  1260.     return true_y * @real_zoom + @real_y
  1261.   end
  1262.   #--------------------------------------------------------------------------
  1263.   # ● バトル画面 Z 座標の取得
  1264.   #--------------------------------------------------------------------------
  1265.   def screen_z
  1266.     return screen_y + 1000
  1267.   end
  1268.   #--------------------------------------------------------------------------
  1269.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1270.   #--------------------------------------------------------------------------
  1271.   def base_x
  1272.     return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
  1273.   end
  1274.   #--------------------------------------------------------------------------
  1275.   # ● バトル画面 Y 座標の取得
  1276.   #--------------------------------------------------------------------------
  1277.   def base_y
  1278.     return (true_y - @oy) * @real_zoom + @real_y
  1279.   end
  1280.   #--------------------------------------------------------------------------
  1281.   # ● バトル画面 拡大率の取得
  1282.   #--------------------------------------------------------------------------
  1283.   def zoom
  1284.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  1285.                           (true_x + @fly) / 480 + $scene.zoom_rate[0]
  1286.   end
  1287.   #--------------------------------------------------------------------------
  1288.   # ● 攻撃用、バトル画面 X 座標の取得
  1289.   #--------------------------------------------------------------------------
  1290.   def attack_x(z)
  1291.     return (320 - true_x) * z * 0.75
  1292.   end
  1293.   #--------------------------------------------------------------------------
  1294.   # ● 攻撃用、バトル画面 Y 座標の取得
  1295.   #--------------------------------------------------------------------------
  1296.   def attack_y(z)
  1297.     return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
  1298.   end
  1299.   #--------------------------------------------------------------------------
  1300.   # ● 閃き待ち時間
  1301.   #--------------------------------------------------------------------------
  1302.   def flash_duration
  1303.     return $scene.flash_duration
  1304.   end
  1305.   #--------------------------------------------------------------------------
  1306.   # ● アニメーション取得
  1307.   #--------------------------------------------------------------------------
  1308.   def battle_actions1
  1309.     weapon = $data_weapons[@weapon_id]
  1310.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1311.   end
  1312.   #--------------------------------------------------------------------------
  1313.   # ● アニメーション取得
  1314.   #--------------------------------------------------------------------------
  1315.   def battle_actions2
  1316.     weapon = $data_weapons[@weapon2_id]
  1317.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1318.   end
  1319.   #--------------------------------------------------------------------------
  1320.   # ● 武器アニメーション取得
  1321.   #--------------------------------------------------------------------------
  1322.   def weapon_anime1
  1323.     weapon = $data_weapons[@weapon_id]
  1324.     return weapon != nil ? weapon.icon_name : ""
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ● 武器アニメーション取得
  1328.   #--------------------------------------------------------------------------
  1329.   def weapon_anime2
  1330.     weapon = $data_weapons[@weapon2_id]
  1331.     return weapon != nil ? weapon.icon_name : ""
  1332.   end
  1333.   #--------------------------------------------------------------------------
  1334.   # ● 遠距離アニメーション取得
  1335.   #--------------------------------------------------------------------------
  1336.   def flying_anime1
  1337.     weapon = $data_weapons[@weapon_id]
  1338.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1339.   end
  1340.   #--------------------------------------------------------------------------
  1341.   # ● 遠距離アニメーション取得
  1342.   #--------------------------------------------------------------------------
  1343.   def flying_anime2
  1344.     weapon = $data_weapons[@weapon2_id]
  1345.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1346.   end
  1347.   #--------------------------------------------------------------------------
  1348.   # ● 移動目標座標の計算
  1349.   #--------------------------------------------------------------------------
  1350.   def move_setup
  1351.     if RTAB
  1352.       targets = @target
  1353.     else
  1354.       targets = $scene.target_battlers
  1355.     end
  1356.     case @move_action[0]
  1357.     when "self" # 自分
  1358.       @target_x = self.base_x
  1359.       @target_y = self.base_y
  1360.     when "target_near" # 一番近くのターゲット
  1361.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1362.       targets.reverse!
  1363.       if targets != []
  1364.         @target_x = targets[0].screen_x
  1365.         @target_y = targets[0].screen_y
  1366.       else
  1367.         @target_x = self.base_x
  1368.         @target_y = self.base_y
  1369.       end
  1370.     when "target_far" # 一番遠くのターゲット
  1371.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1372.       if targets != []
  1373.         @target_x = targets[0].screen_x
  1374.         @target_y = targets[0].screen_y
  1375.       else
  1376.         @target_x = self.base_x
  1377.         @target_y = self.base_y
  1378.       end
  1379.     when "target" # ターゲット中央
  1380.       @target_x = 0
  1381.       @target_y = 0
  1382.       for t in targets
  1383.         @target_x += t.screen_x
  1384.         @target_y += t.screen_y
  1385.       end
  1386.       if targets != []
  1387.         @target_x /= targets.size
  1388.         @target_y /= targets.size
  1389.       end
  1390.     when "troop" # "トループ中央"
  1391.       @target_x = 0
  1392.       @target_y = 0
  1393.       for t in $game_troop.enemies
  1394.         @target_x += t.screen_x
  1395.         @target_y += t.screen_y
  1396.       end
  1397.       if $game_troop.enemies != []
  1398.         @target_x /= $game_troop.enemies.size
  1399.         @target_y /= $game_troop.enemies.size
  1400.       end
  1401.     when "party" # "パーティ中央"
  1402.       @target_x = 0
  1403.       @target_y = 0
  1404.       for t in $game_party.actors
  1405.         @target_x += t.screen_x
  1406.         @target_y += t.screen_y
  1407.       end
  1408.       if $game_party.actors != []
  1409.         @target_x /= $game_party.actors.size
  1410.         @target_y /= $game_party.actors.size
  1411.       end
  1412.     when "screen" # "画面"
  1413.       @target_x = self.base_x
  1414.       @target_y = self.base_y
  1415.     end
  1416.     # 補正
  1417.     @target_x += @move_action[1] - self.base_x
  1418.     @target_y += @move_action[2] - self.base_y
  1419.     # 移動目標の座標をセット
  1420.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1421.     # 距離の計算(ウエイトの設定)
  1422.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1423.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1424.   end
  1425. end
  1426. #==============================================================================
  1427. # ■ Game_Enemy
  1428. #==============================================================================
  1429. class Game_Enemy < Game_Battler
  1430.   #--------------------------------------------------------------------------
  1431.   # ● セットアップ
  1432.   #--------------------------------------------------------------------------
  1433.   alias side_view_initialize initialize
  1434.   def initialize(troop_id, member_index)
  1435.     side_view_initialize(troop_id, member_index)
  1436.     start_battle
  1437.   end
  1438.   #--------------------------------------------------------------------------
  1439.   # ● 移動
  1440.   #--------------------------------------------------------------------------
  1441.   def move
  1442.     # 距離の計算
  1443.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1444.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1445.     if @move_distance > 0
  1446.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  1447.       array = @move_coordinates
  1448.       # ジャンプ補正値の計算
  1449.       if @move_distance - @move_wait > @move_distance / 2
  1450.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  1451.       else
  1452.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  1453.       end
  1454.       jump = @move_action[4] > 0 ? -jump : jump
  1455.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  1456.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  1457.       # ウエイト
  1458.       @move_wait -= @move_action[3]
  1459.       @move_wait = [@move_wait,0].max
  1460.     end
  1461.   end
  1462.   #--------------------------------------------------------------------------
  1463.   # ● 移動目標座標の計算
  1464.   #--------------------------------------------------------------------------
  1465.   def move_setup
  1466.     if RTAB
  1467.       targets = @target
  1468.     else
  1469.       targets = $scene.target_battlers
  1470.     end
  1471.     case @move_action[0]
  1472.     when "self" # 自分
  1473.       @target_x = self.base_x
  1474.       @target_y = self.base_y
  1475.     when "target_near" # 一番近くのターゲット
  1476.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1477.       if targets != []
  1478.         @target_x = targets[0].screen_x
  1479.         @target_y = targets[0].screen_y
  1480.       else
  1481.         @target_x = self.base_x
  1482.         @target_y = self.base_y
  1483.       end
  1484.     when "target_far" # 一番遠くのターゲット
  1485.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1486.       targets.reverse!
  1487.       if targets != []
  1488.         @target_x = targets[0].screen_x
  1489.         @target_y = targets[0].screen_y
  1490.       else
  1491.         @target_x = self.base_x
  1492.         @target_y = self.base_y
  1493.       end
  1494.     when "target" # ターゲット中央
  1495.       @target_x = 0
  1496.       @target_y = 0
  1497.       for t in targets
  1498.         @target_x += t.screen_x
  1499.         @target_y += t.screen_y
  1500.       end
  1501.       if targets != []
  1502.         @target_x /= targets.size
  1503.         @target_y /= targets.size
  1504.       end
  1505.     when  "party" # "トループ中央"
  1506.       @target_x = 0
  1507.       @target_y = 0
  1508.       for t in $game_troop.enemies
  1509.         @target_x += t.screen_x
  1510.         @target_y += t.screen_y
  1511.       end
  1512.       if $game_troop.enemies != []
  1513.         @target_x /= $game_troop.enemies.size
  1514.         @target_y /= $game_troop.enemies.size
  1515.       end
  1516.     when "troop" # "パーティ中央"
  1517.       @target_x = 0
  1518.       @target_y = 0
  1519.       for t in $game_party.actors
  1520.         @target_x += t.screen_x
  1521.         @target_y += t.screen_y
  1522.       end
  1523.       if $game_party.actors != []
  1524.         @target_x /= $game_party.actors.size
  1525.         @target_y /= $game_party.actors.size
  1526.       end
  1527.     when "screen" # "画面"
  1528.       @target_x = self.base_x
  1529.       @target_y = self.base_y
  1530.     end
  1531.     # 補正
  1532.     @target_x -= @move_action[1] + self.base_x
  1533.     @target_y -= @move_action[2] + self.base_y
  1534.     # 移動目標の座標をセット
  1535.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1536.     # 距離の計算(ウエイトの設定)
  1537.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1538.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1539.   end
  1540.   if RTAB
  1541.   alias original_x true_x
  1542.   alias original_y true_y
  1543.   else
  1544.   alias original_x screen_x
  1545.   alias original_y screen_y
  1546.   end
  1547.   #--------------------------------------------------------------------------
  1548.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1549.   #--------------------------------------------------------------------------
  1550.   def true_x
  1551.     return original_x + @ox
  1552.   end
  1553.   #--------------------------------------------------------------------------
  1554.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1555.   #--------------------------------------------------------------------------
  1556.   def true_y
  1557.     return original_y - @height / 2 + @oy
  1558.   end
  1559.   #--------------------------------------------------------------------------
  1560.   # ● バトル画面 X 座標の取得
  1561.   #--------------------------------------------------------------------------
  1562.   def screen_x(true_x = self.true_x)
  1563.     return true_x * @real_zoom + @real_x
  1564.   end
  1565.   #--------------------------------------------------------------------------
  1566.   # ● バトル画面 Y 座標の取得
  1567.   #--------------------------------------------------------------------------
  1568.   def screen_y(true_y = self.true_y)
  1569.     return true_y * @real_zoom + @real_y
  1570.   end
  1571.   #--------------------------------------------------------------------------
  1572.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1573.   #--------------------------------------------------------------------------
  1574.   def base_x(true_x = self.true_x)
  1575.     return (true_x - @ox) * @real_zoom + @real_x
  1576.   end
  1577.   #--------------------------------------------------------------------------
  1578.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  1579.   #--------------------------------------------------------------------------
  1580.   def base_y(true_y = self.true_y)
  1581.     return (true_y - @oy) * @real_zoom + @real_y
  1582.   end
  1583. end
  1584. #==============================================================================
  1585. # ■ Game_Party
  1586. #==============================================================================
  1587. class Game_Party
  1588.   #--------------------------------------------------------------------------
  1589.   # ● アクターを加える
  1590.   #     actor_id : アクター ID
  1591.   #--------------------------------------------------------------------------
  1592.   alias side_view_add_actor add_actor
  1593.   def add_actor(actor_id)
  1594.     # アクターを取得
  1595.     actor = $game_actors[actor_id]
  1596.     # サイドビューデータの初期化
  1597.     actor.start_battle
  1598.     # 戻す
  1599.     side_view_add_actor(actor_id)
  1600.   end
  1601. end
  1602. #==============================================================================
  1603. # ■ Scene_Battle
  1604. #==============================================================================
  1605. class Scene_Battle
  1606.   include Side_view
  1607.   #--------------------------------------------------------------------------
  1608.   # ● 公開インスタンス変数
  1609.   #--------------------------------------------------------------------------
  1610.   attr_reader   :phase            # フェーズ
  1611.   attr_reader   :phase4_step      # フェーズ4ステップ
  1612.   attr_reader   :active_battler   # 対象の配列
  1613.   attr_reader   :target_battlers  # 対象の配列
  1614.   attr_reader   :animation1_id    # 行動アニメID
  1615.   attr_reader   :animation2_id    # 対象アニメID
  1616.   #--------------------------------------------------------------------------
  1617.   # ● メイン処理
  1618.   #--------------------------------------------------------------------------
  1619.   alias side_view_main main
  1620.   def main
  1621.     # バトラー初期化
  1622.     for battler in $game_party.actors + $game_troop.enemies
  1623.       battler.start_battle
  1624.     end
  1625.     # 戻す
  1626.     side_view_main
  1627.   end
  1628.   #--------------------------------------------------------------------------
  1629.   # ● 閃き判定
  1630.   #--------------------------------------------------------------------------
  1631.   def flash?
  1632.     return @flash_flag ? true : false
  1633.   end  
  1634.   #--------------------------------------------------------------------------
  1635.   # ● 閃きアニメ待ち時間取得
  1636.   #--------------------------------------------------------------------------
  1637.   def flash_duration
  1638.     animation = nil
  1639.     if FLASH_ANIME
  1640.       animation = $data_animations[FLASH_ANIMATION_ID]
  1641.     end
  1642.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  1643.   end
  1644.   #--------------------------------------------------------------------------
  1645.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1646.   #--------------------------------------------------------------------------
  1647.   alias side_view_update_phase4_step2 update_phase4_step2
  1648.   def update_phase4_step2(*arg)
  1649.     battler = convert_battler2(*arg)
  1650.     battler.action
  1651.     side_view_update_phase4_step2(*arg)
  1652.   end
  1653.   #--------------------------------------------------------------------------
  1654.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  1655.   #--------------------------------------------------------------------------
  1656.   alias side_view_update_phase4_step3 update_phase4_step3
  1657.   def update_phase4_step3(*arg)
  1658.     battler = convert_battler2(*arg)
  1659.     return if !battler.animation1_on and battler.action? and !battler.flash?
  1660.     if battler.flash? and FLASH_ANIME
  1661.       battler.flash_flag["normal"] = true
  1662.     end
  1663.     side_view_update_phase4_step3(*arg)
  1664.   end
  1665.   #--------------------------------------------------------------------------
  1666.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  1667.   #--------------------------------------------------------------------------
  1668.   alias side_view_update_phase4_step4 update_phase4_step4
  1669.   def update_phase4_step4(*arg)
  1670.     battler = convert_battler2(*arg)
  1671.     targets = RTAB ? battler.target : @target_battlers
  1672.     return if !battler.animation2_on and battler.action?
  1673.     side_view_update_phase4_step4(*arg)
  1674.     for target in targets
  1675.       if RTAB
  1676.         value = nil
  1677.         if target.damage_sp.include?(battler)
  1678.           value = target.damage_sp[battler]
  1679.         end
  1680.         if target.damage.include?(battler)
  1681.           if value == nil or value == "Miss"
  1682.             value = target.damage[battler]
  1683.           elsif value.is_a?(Numeric) && value > 0
  1684.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  1685.           end
  1686.         end
  1687.       else
  1688.         value = target.damage
  1689.       end
  1690.       if target.is_a?(Game_Actor)
  1691.         # ダメージの場合
  1692.         if value.is_a?(Numeric) && value > 0
  1693.           # シェイクを開始
  1694.           target.shake = true
  1695.         end
  1696.       elsif target.is_a?(Game_Enemy)
  1697.         # ダメージの場合
  1698.         if value.is_a?(Numeric) && value > 0
  1699.           # シェイクを開始
  1700.           target.shake = true
  1701.         end
  1702.       end
  1703.     end
  1704.   end
  1705.   #--------------------------------------------------------------------------
  1706.   # ● プレバトルフェーズ開始
  1707.   #--------------------------------------------------------------------------
  1708.   alias start_phase1_correct start_phase1
  1709.   def start_phase1
  1710.     # カメラの設定
  1711.     # 元々フロントビュー向けの数値になっているため
  1712.     @zoom_rate = [1.0, 1.0]
  1713.     start_phase1_correct
  1714.   end
  1715.   #--------------------------------------------------------------------------
  1716.   # ● アクターコマンドフェーズ開始
  1717.   #--------------------------------------------------------------------------
  1718.   alias start_phase3_correct start_phase3
  1719.   def start_phase3
  1720.     battler = convert_battler
  1721.     start_phase3_correct
  1722.     if RTAB
  1723.       # カメラの設定
  1724.       # 元々フロントビュー向けの数値になっているため
  1725.       @camera = "command"
  1726.       @spriteset.screen_target(0, 0, 1.0)
  1727.     end
  1728.   end
  1729. end

  1730. class Spriteset_Battle
  1731.   include Side_view
  1732.   #--------------------------------------------------------------------------
  1733.   # ● オブジェクト初期化
  1734.   #--------------------------------------------------------------------------
  1735.   alias side_veiw_initialize initialize
  1736.   def initialize
  1737.     side_veiw_initialize
  1738.     # アクタースプライトを解放
  1739.     for sprite in @actor_sprites
  1740.       sprite.dispose
  1741.     end
  1742.     # アクタースプライトを作成
  1743.     @actor_sprites = []
  1744.     for i in 1..Party_max
  1745.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1746.     end
  1747.     update
  1748.   end
  1749.   #--------------------------------------------------------------------------
  1750.   # ● 画面のスクロール
  1751.   #--------------------------------------------------------------------------
  1752.   if method_defined?("screen_scroll")
  1753.   alias side_view_screen_scroll screen_scroll
  1754.   def screen_scroll
  1755.     side_view_screen_scroll
  1756.     # アクターの位置補正
  1757.     for actor in $game_party.actors
  1758.       actor.real_x = @real_x
  1759.       actor.real_y = @real_y
  1760.       actor.real_zoom = @real_zoom
  1761.     end
  1762.   end
  1763.   end
  1764. end

  1765. class Sprite_Battler < RPG::Sprite
  1766.   include Side_view
  1767.   #--------------------------------------------------------------------------
  1768.   # ● オブジェクト初期化
  1769.   #     viewport : ビューポート
  1770.   #     battler  : バトラー (Game_Battler)
  1771.   #--------------------------------------------------------------------------
  1772.   def initialize(viewport, battler = nil)
  1773.     super(viewport)
  1774.     @battler = battler
  1775.     @battler_visible = false
  1776.     @weapon = Sprite_Weapon.new(viewport, battler)
  1777.     @flying = Sprite_Flying.new(viewport, battler)
  1778.     @nx = 0
  1779.    @xbit = 0

  1780.     @shadow = []
  1781.     @fly = 0
  1782.     @fly_direction = 1
  1783.     @rand = rand(10)
  1784.     self.effect_clear
  1785.   end
  1786.   #--------------------------------------------------------------------------
  1787.   # ● 解放
  1788.   #--------------------------------------------------------------------------
  1789.   alias side_view_dispose dispose
  1790.   def dispose
  1791.     side_view_dispose
  1792.     @weapon.dispose
  1793.     @flying.dispose
  1794.     if @_target_sprite != nil
  1795.       @_target_sprite.bitmap.dispose
  1796.       @_target_sprite.dispose
  1797.       @_target_sprite = nil
  1798.     end
  1799.   end
  1800.   #--------------------------------------------------------------------------
  1801.   # ● フレーム更新
  1802.   #--------------------------------------------------------------------------
  1803.   def update
  1804.     super
  1805.     # バトラーが nil の場合
  1806.     if @battler == nil
  1807.       self.bitmap = nil
  1808.       @weapon.bitmap = nil
  1809.       loop_animation(nil)
  1810.       return
  1811.     end
  1812.     # バトラー更新
  1813.     @battler.update
  1814.     # バトラーアニメのデータ取得
  1815.     @anime_type = @battler.anime_type
  1816.     # ファイル名か色相が現在のものと異なる場合
  1817.     if @battler.is_a?(Game_Actor)
  1818.       change = (@battler.character_name != @battler_name or @battler.character_hue != @battler_hue)
  1819.     elsif @battler.is_a?(Game_Enemy)
  1820.       change = (@battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue)
  1821.     else
  1822.       return
  1823.     end
  1824.     if change
  1825.       # ビットマップを取得、設定
  1826.       if @battler.is_a?(Game_Actor)
  1827.         @battler_name = @battler.character_name
  1828.         @battler_hue = @battler.character_hue
  1829.         self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
  1830.         @width = bitmap.width / 4
  1831.         @height = bitmap.height / 4
  1832.         
  1833.         
  1834.         
  1835.       else
  1836.         @battler_name = @battler.battler_name
  1837.         @battler_hue = @battler.battler_hue
  1838.         self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1839.         @width = bitmap.width
  1840.         @height = bitmap.height
  1841.       end
  1842.       self.ox = @width / 2
  1843.       self.oy = @height / 2
  1844.       @battler.height = @height
  1845.       @flag = true
  1846.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  1847.       if @battler.dead? or @battler.hidden
  1848.         self.opacity = 0
  1849.       end
  1850.     end
  1851.     if @battler.is_a?(Game_Actor) and
  1852.       (@battler.anime_type != @anime_type or @battler.pattern != @pattern or @flag)
  1853.       # ビットマップを取得、設定
  1854.       @pattern = @battler.pattern
  1855.       self.ox = @width / 2
  1856.       self.oy = @height / 2
  1857.       @sx = @pattern * @width
  1858.       @sy = @anime_type % 4 * @height
  1859.       self.src_rect.set(@sx, @sy, @width, @height)
  1860.       self.zoom_x = CHAR_ZOOM
  1861.       self.zoom_y = CHAR_ZOOM
  1862.       @battler.height = @height
  1863.       @flag = false
  1864.     end
  1865.     if @battler.is_a?(Game_Actor)
  1866.      @nx += 1
  1867.      @nx %= 40 #每帧+1,40帧一个循环
  1868.      @xbit = @nx / 10 * self.bitmap.width/4 #获得当前的图像坐标
  1869.      self.src_rect.set(@xbit, self.bitmap.height/4, self.bitmap.width/4, self.bitmap.height/4) #设置当前战斗图的图像
  1870.    end
  1871.    
  1872.     # 飛行
  1873.     update_fly
  1874.     # シェイク
  1875.     update_shake
  1876.     # 回転
  1877.     update_turning
  1878.     # 反転
  1879.     update_reverse   
  1880.     # 移動
  1881.     update_moving
  1882.     # 追加アニメ
  1883.     update_add_anime
  1884.     # エフェクト効果の適用
  1885.     update_effect
  1886.     # アニメーション ID が現在のものと異なる場合
  1887.     flag = RTAB ? true : @battler.damage == nil
  1888.     if flag and @battler.state_animation_id != @state_animation_id
  1889.       @state_animation_id = @battler.state_animation_id
  1890.       loop_animation($data_animations[@state_animation_id])
  1891.     end
  1892.     # シェイク
  1893.     if @battler.shake
  1894.       self.start_shake(5, 5, 5)
  1895.       @battler.shake = false
  1896.     end
  1897.     # 明滅
  1898.     if @battler.blink
  1899.       blink_on
  1900.     else
  1901.       blink_off
  1902.     end
  1903.     # 不可視の場合
  1904.     unless @battler_visible
  1905.       flag = RTAB ? (@battler.damage.size < 2 or @battler.damage_pop.size < 2) :
  1906.                     (@battler.damage == nil or @battler.damage_pop)
  1907.       # 出現
  1908.       if not @battler.hidden and not @battler.dead? and flag
  1909.         appear
  1910.         @battler_visible = true
  1911.       end
  1912.     end
  1913.     if RTAB
  1914.     # ダメージ
  1915.     for battler in @battler.damage_pop
  1916.       if battler[0].class == Array
  1917.         if battler[0][1] >= 0
  1918.           $scene.skill_se
  1919.         else
  1920.           $scene.levelup_se
  1921.         end
  1922.         damage(@battler.damage[battler[0]], false, 2)
  1923.       else
  1924.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  1925.       end
  1926.       if @battler.damage_sp.include?(battler[0])
  1927.         damage(@battler.damage_sp[battler[0]],
  1928.                 @battler.critical[battler[0]], 1)
  1929.         @battler.damage_sp.delete(battler[0])
  1930.       end
  1931.       @battler.damage_pop.delete(battler[0])
  1932.       @battler.damage.delete(battler[0])
  1933.       @battler.critical.delete(battler[0])
  1934.     end
  1935.     end
  1936.     # 可視の場合
  1937.     if @battler_visible
  1938.       # 武器アニメ
  1939.       @weapon.battler = @battler
  1940.       @weapon.update
  1941.       # 遠距離アニメ
  1942.       @flying.battler = @battler
  1943.       @flying.update
  1944.       # 逃走
  1945.       if @battler.hidden
  1946.         $game_system.se_play($data_system.escape_se)
  1947.         escape
  1948.         @battler_visible = false
  1949.       end
  1950.       # 白フラッシュ
  1951.       if @battler.white_flash
  1952.         whiten
  1953.         @battler.white_flash = false
  1954.       end
  1955.       if RTAB
  1956.       # アニメーション
  1957.       if [email protected]?
  1958.         for animation in @battler.animation.reverse
  1959.           if animation[2]
  1960.             animation($data_animations[animation[0]], animation[1], true)
  1961.           else
  1962.             animation($data_animations[animation[0]], animation[1])
  1963.           end
  1964.           @battler.animation.delete(animation)
  1965.         end
  1966.       end
  1967.       else
  1968.       # アニメーション
  1969.       if @battler.animation_id != 0
  1970.         animation = $data_animations[@battler.animation_id]
  1971.         animation(animation, @battler.animation_hit)
  1972.         @battler.animation_id = 0
  1973.       end
  1974.       end
  1975.       # ダメージ
  1976.       if !RTAB and @battler.damage_pop
  1977.         damage(@battler.damage, @battler.critical)
  1978.         @battler.damage = nil
  1979.         @battler.critical = false
  1980.         @battler.damage_pop = false
  1981.       end
  1982.       flag = RTAB ? (@battler.damage.empty? and $scene.dead_ok?(@battler)) :
  1983.                      @battler.damage == nil
  1984.       # コラプス
  1985.       if flag and @battler.dead?
  1986.         if @battler.is_a?(Game_Actor)
  1987.           $game_system.se_play($data_system.actor_collapse_se)
  1988.         elsif @battler.is_a?(Game_Enemy)
  1989.           $game_system.se_play($data_system.enemy_collapse_se)
  1990.         end
  1991.         collapse
  1992.         @battler_visible = false
  1993.       end
  1994.     end
  1995.     # スプライトの座標を設定
  1996.     self.x = @battler.screen_x + @effect_ox
  1997.     self.y = @battler.screen_y + @effect_oy
  1998.     self.z = @battler.screen_z
  1999.     self.zoom_x = @battler.real_zoom
  2000.     self.zoom_y = @battler.real_zoom
  2001.     # ウェイトカウントを減らす
  2002.     @battler.wait_count -= 1
  2003.     @battler.wait_count2 -= 1
  2004.     # アニメーション待ち時間取得
  2005.     @battler.animation_duration = @_animation_duration
  2006.     if @battler.is_a?(Game_Actor)
  2007.       self.zoom_x *= CHAR_ZOOM
  2008.       self.zoom_y *= CHAR_ZOOM
  2009.       @weapon.x = self.x + 2
  2010.       @weapon.y = self.y + 6
  2011.       @weapon.angle = 75 - (4 - @battler.pattern) * 45
  2012.       if self.mirror
  2013.         @weapon.angle += @weapon.angle - 180
  2014.       end
  2015.     end
  2016.     # 残像
  2017.     if @battler.shadow
  2018.       if Graphics.frame_count % 2 == 0
  2019.         shadow = ::Sprite.new(self.viewport)
  2020.         shadow.bitmap = self.bitmap.dup
  2021.         shadow.x = self.x
  2022.         shadow.y = self.y
  2023.         shadow.ox = self.ox
  2024.         shadow.oy = self.oy
  2025.         shadow.mirror = self.mirror
  2026.         shadow.angle = self.angle
  2027.         shadow.opacity = 160
  2028.         shadow.zoom_x = self.zoom_x
  2029.         shadow.zoom_y = self.zoom_y
  2030.         if @battler.is_a?(Game_Actor)
  2031.           shadow.src_rect.set(@sx, @sy, @width, @height)
  2032.         else
  2033.           shadow.src_rect.set(0, 0, @width, @height)
  2034.         end
  2035.         @shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
  2036.       end
  2037.     end
  2038.     for s in @shadow
  2039.       if !s[0].disposed?
  2040.         s[0].update
  2041.         s[1] -= 1
  2042.         if s[1] < 1
  2043.           if s[0].bitmap != nil
  2044.             s[0].bitmap.dispose
  2045.           end
  2046.           s[0].dispose
  2047.         else
  2048.           s[0].x = @battler.screen_x(s[2])
  2049.           s[0].y = @battler.screen_y(s[3])
  2050.         end
  2051.       else
  2052.         s = nil
  2053.       end
  2054.     end
  2055.     @shadow.compact!
  2056.   end
  2057.   #--------------------------------------------------------------------------
  2058.   # ● エフェクトによる座標系の更新
  2059.   #--------------------------------------------------------------------------
  2060.   def update_effect
  2061.     # 角度の修正
  2062.     if @_upside_down
  2063.       self.angle = (@_turning + 180) % 360
  2064.     else
  2065.       self.angle = @_turning
  2066.     end
  2067.     # X 座標の修正値
  2068.     @effect_ox = @_shake + @_moving[0]
  2069.     # Y 座標の修正値
  2070.     @effect_oy = -@fly + @_moving[1]
  2071.     if  @_animation == nil or (RTAB and @_animation.empty?)
  2072.       self.effect_clear
  2073.     end
  2074.   end
  2075.   #--------------------------------------------------------------------------
  2076.   # ● シェイク更新
  2077.   #--------------------------------------------------------------------------
  2078.   def update_shake
  2079.     if @_shake_duration >= 1 or @_shake != 0
  2080.       delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
  2081.       if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
  2082.         @_shake = 0
  2083.       else
  2084.         @_shake += delta
  2085.       end
  2086.       if @_shake > @_shake_power * 2
  2087.         @_shake_direction = -1
  2088.       end
  2089.       if @_shake < - @_shake_power * 2
  2090.         @_shake_direction = 1
  2091.       end
  2092.       if @_shake_duration >= 1
  2093.         @_shake_duration -= 1
  2094.       end
  2095.     end
  2096.   end
  2097.   #--------------------------------------------------------------------------
  2098.   # ● 飛行更新
  2099.   #--------------------------------------------------------------------------
  2100.   def update_fly
  2101.     if @rand > 0
  2102.       @rand -= 1
  2103.       return
  2104.     end
  2105.     if @battler.fly != 0
  2106.       if @fly < @battler.fly / 4
  2107.         @fly_direction = 1
  2108.       elsif @fly > @battler.fly / 2
  2109.         @fly_direction = -1
  2110.       end
  2111.       @fly += 0.5 * @fly_direction
  2112.     end
  2113.   end
  2114.   #--------------------------------------------------------------------------
  2115.   # ● 回転更新
  2116.   #--------------------------------------------------------------------------
  2117.   def update_turning
  2118.     if @_turning_duration > 0 or @_turning != 0
  2119.       @_turning += @_turning_direction * @_turning_speed / 2.0
  2120.       # 残り回転数を減らす
  2121.       if @_turning_direction == -1
  2122.         if @_turning_duration > 0 and @_turning < 0
  2123.           @_turning_duration -= 1
  2124.         end
  2125.       elsif @_turning_direction == 1
  2126.         if @_turning_duration > 0 and @_turning >= 360
  2127.           @_turning_duration -= 1
  2128.         end
  2129.       end
  2130.       # 以下補正
  2131.       while @_turning < 0
  2132.         @_turning += 360
  2133.       end
  2134.       if @_turning_duration <= 0
  2135.         @_turning = 0
  2136.       end
  2137.       @_turning %= 360
  2138.     end
  2139.   end
  2140.   #--------------------------------------------------------------------------
  2141.   # ● 左右反転更新
  2142.   #--------------------------------------------------------------------------
  2143.   def update_reverse
  2144.     if @last_reverse != (@_reverse or @battler.reverse)
  2145.       self.mirror = (@_reverse or @battler.reverse)
  2146.       @last_reverse = (@_reverse or @battler.reverse)
  2147.     end
  2148.   end
  2149.   #--------------------------------------------------------------------------
  2150.   # ● 移動更新
  2151.   #--------------------------------------------------------------------------
  2152.   def update_moving
  2153.     @move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2154.                      (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2155.     if @move_distance > 0
  2156.       return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
  2157.       array = @_move_coordinates
  2158.       x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2159.       y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  2160.       @_moving = [x, y]
  2161.       if @_move_quick_return and @_move_duration == 0
  2162.         @_move_coordinates = [0,0,array[0],array[1]]
  2163.         @_move_duration = @move_distance
  2164.       end
  2165.       @_move_duration -= @_move_speed
  2166.       @_move_duration = [@_move_duration, 0].max
  2167.     end
  2168.   end
  2169.   #--------------------------------------------------------------------------
  2170.   # ● 追加アニメ更新 (RTAB限定機能)
  2171.   #--------------------------------------------------------------------------
  2172.   def update_add_anime
  2173.     if RTAB
  2174.     # アニメーション
  2175.     if @_add_anime_id != 0
  2176.       animation = $data_animations[@_add_anime_id]
  2177.       animation(animation, true)
  2178.       @_add_anime_id = 0
  2179.     end
  2180.     end
  2181.   end
  2182.   #--------------------------------------------------------------------------
  2183.   # ● エフェクト初期化
  2184.   #--------------------------------------------------------------------------
  2185.   def effect_clear
  2186.     @_effect_ox = 0
  2187.     @_effect_oy = 0
  2188.     @_shake_power = 0
  2189.     @_shake_speed = 0
  2190.     @_shake_duration = 0
  2191.     @_shake_direction = 1
  2192.     @_shake = 0
  2193.     @_upside_down = false
  2194.     @_reverse = false
  2195.     @_turning_direction = 1
  2196.     @_turning_speed = 0
  2197.     @_turning_duration = 0
  2198.     @_turning = 0
  2199.     @_move_quick_return = true
  2200.     @_move_speed = 0
  2201.     @_move_coordinates = [0,0,0,0]
  2202.     @_move_jump = false
  2203.     @_move_duration = 0
  2204.     @_moving = [0,0]
  2205.     @_add_anime_id = 0
  2206.   end
  2207.   #--------------------------------------------------------------------------
  2208.   # ● シェイクの開始
  2209.   #     power    : 強さ
  2210.   #     speed    : 速さ
  2211.   #     duration : 時間
  2212.   #--------------------------------------------------------------------------
  2213.   def start_shake(power, speed, duration)
  2214.     @_shake_power = power
  2215.     @_shake_speed = speed
  2216.     @_shake_duration = duration
  2217.   end
  2218.   #--------------------------------------------------------------------------
  2219.   # ● 上下反転を開始
  2220.   #--------------------------------------------------------------------------
  2221.   def start_upside_down
  2222.     @_upside_down = @_upside_down ? false : true
  2223.   end
  2224.   #--------------------------------------------------------------------------
  2225.   # ● 左右反転を開始
  2226.   #--------------------------------------------------------------------------
  2227.   def start_reverse
  2228.     @_reverse = @_reverse ? false : true
  2229.   end
  2230.   #--------------------------------------------------------------------------
  2231.   # ● 回転を開始
  2232.   #     direction: 方向
  2233.   #     speed    : 速さ
  2234.   #     duration : 時間
  2235.   #--------------------------------------------------------------------------
  2236.   def start_turning(direction, speed, duration)
  2237.     @_turning_direction = direction
  2238.     @_turning_speed = speed
  2239.     @_turning_duration = duration
  2240.     @_turning = @_turning_direction == 1 ? 0 : 360
  2241.   end
  2242.   #--------------------------------------------------------------------------
  2243.   # ● 移動を開始
  2244.   #     quick_return : 戻るかどうか
  2245.   #     speed        : 速さ
  2246.   #     x            : X 座標
  2247.   #     y            : Y 座標
  2248.   #--------------------------------------------------------------------------
  2249.   def start_moving(quick_return, speed, x, y)
  2250.     @_move_quick_return = quick_return == 0 ? false : true
  2251.     @_move_speed = speed
  2252.     @_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
  2253.     distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  2254.                (@_move_coordinates[3] - @_move_coordinates[1]).abs
  2255.     @_move_duration = distance
  2256.   end
  2257.   #--------------------------------------------------------------------------
  2258.   # ● アニメ追加を開始
  2259.   #     id           : ID
  2260.   #     hit          : 命中フラッグ
  2261.   #--------------------------------------------------------------------------
  2262.   def start_add_anime(id)
  2263.     @_add_anime_id = id
  2264.   end
  2265.   #--------------------------------------------------------------------------
  2266.   # ● 各種エフェクトの開始判定
  2267.   #--------------------------------------------------------------------------
  2268.   if !method_defined?("side_view_animation_process_timing")
  2269.     alias side_view_animation_process_timing animation_process_timing
  2270.   end
  2271.   def animation_process_timing(timing, hit)
  2272.     side_view_animation_process_timing(timing, hit)
  2273.     if (timing.condition == 0) or
  2274.        (timing.condition == 1 and hit == true) or
  2275.        (timing.condition == 2 and hit == false)
  2276.       if timing.se.name =~ SHAKE_FILE
  2277.         names = timing.se.name.split(/#/)
  2278.         power    = names[1].nil? ? SHAKE_POWER    : names[1].to_i
  2279.         speed    = names[2].nil? ? SHAKE_SPEED    : names[2].to_i
  2280.         duration = names[3].nil? ? SHAKE_DURATION : names[3].to_i
  2281.         # シェイクを開始
  2282.         self.start_shake(power, speed, duration)
  2283.       end
  2284.       if timing.se.name == UPSIDE_DOWN_FILE
  2285.         # 上下反転を開始
  2286.         self.start_upside_down
  2287.       end
  2288.       if timing.se.name == REVERSE_FILE
  2289.         # 左右反転を開始
  2290.         self.start_reverse
  2291.       end
  2292.       if timing.se.name =~ TURNING_FILE
  2293.         names = timing.se.name.split(/#/)
  2294.         direction = names[1].nil? ? TURNING_DIRECTION : names[1].to_i
  2295.         speed     = names[2].nil? ? TURNING_SPEED     : names[2].to_i
  2296.         duration  = names[3].nil? ? TURNING_DURATION  : names[3].to_i
  2297.         # 回転を開始
  2298.         self.start_turning(direction, speed, duration)
  2299.       end
  2300.       if timing.se.name =~ MOVE_FILE
  2301.         names = timing.se.name.split(/#/)
  2302.         quick_return= names[1].nil? ? MOVE_RETURN      : names[1].to_i
  2303.         speed       = names[2].nil? ? MOVE_SPEED       : names[2].to_i
  2304.         x           = names[3].nil? ? MOVE_COORDINATES[0] : names[3].to_i
  2305.         y           = names[3].nil? ? MOVE_COORDINATES[1] : names[4].to_i
  2306.         # 移動を開始
  2307.         self.start_moving(quick_return, speed, x, y)
  2308.       end
  2309.       if timing.se.name =~ ADD_ANIME_FILE
  2310.         names = timing.se.name.split(/#/)
  2311.         id = names[1].nil? ? ADD_ANIME_ID      : names[1].to_i
  2312.         # アニメ追加を開始
  2313.         self.start_add_anime(id)
  2314.       end
  2315.     end
  2316.   end
  2317. end
  2318. #==============================================================================
  2319. # ■ Sprite_Weapon
  2320. #------------------------------------------------------------------------------
  2321. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2322. # スプライトの状態を自動的に変化させます。
  2323. #==============================================================================

  2324. class Sprite_Weapon < RPG::Sprite
  2325.   include Side_view
  2326.   #--------------------------------------------------------------------------
  2327.   # ● 公開インスタンス変数
  2328.   #--------------------------------------------------------------------------
  2329.   attr_accessor :battler                  # バトラー
  2330.   attr_reader   :cw                       # グラフィックの幅
  2331.   attr_reader   :ch                       # グラフィックの高さ
  2332.   #--------------------------------------------------------------------------
  2333.   # ● オブジェクト初期化
  2334.   #     viewport : ビューポート
  2335.   #     battler  : バトラー (Game_Battler)
  2336.   #--------------------------------------------------------------------------
  2337.   def initialize(viewport, battler = nil)
  2338.     super(viewport)
  2339.     @battler = battler
  2340.     @battler_visible = false
  2341.   end
  2342.   #--------------------------------------------------------------------------
  2343.   # ● 解放
  2344.   #--------------------------------------------------------------------------
  2345.   def dispose
  2346.     if self.bitmap != nil
  2347.       self.bitmap.dispose
  2348.     end
  2349.     super
  2350.   end
  2351.   #--------------------------------------------------------------------------
  2352.   # ● フレーム更新
  2353.   #--------------------------------------------------------------------------
  2354.   def update
  2355.     super
  2356.     # バトラーが nil の場合
  2357.     if @battler == nil or [email protected]_a?(Game_Actor)
  2358.       self.bitmap = nil
  2359.       return
  2360.     end
  2361.     # ウエポンアニメのデータ取得
  2362.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  2363.     # 設定が「非表示」の場合
  2364.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  2365.       self.visible = false
  2366.       return
  2367.     else
  2368.       self.visible = true
  2369.     end
  2370.     # ファイル名が現在のものと異なる場合
  2371.     if @weapon_anime_type[0] != @weapon_name
  2372.       @weapon_name = @weapon_anime_type[0]
  2373.       # ビットマップを取得、設定
  2374.       self.bitmap = RPG::Cache.icon(@weapon_name)
  2375.       @width = bitmap.width
  2376.       @height = bitmap.height
  2377.       @flag = true
  2378.     end
  2379.     # 現在アニメパターンが現在のものと異なる場合
  2380.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  2381.       @pattern = @battler.pattern
  2382.       @condition = @battler.condition
  2383.       self.ox = @width
  2384.       self.oy = @height
  2385.       self.z = battler.screen_z
  2386.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  2387.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  2388.       self.src_rect.set(0, 0, @width, @height)
  2389.       self.opacity = 255
  2390.       # バトラーより手前に表示
  2391.       if @weapon_anime_type[2]
  2392.         self.z += 10
  2393.       # バトラーより奥に表示
  2394.       else
  2395.         self.z -= 10
  2396.       end
  2397.       @flag = false
  2398.     end
  2399.   end
  2400. end

  2401. #==============================================================================
  2402. # ■ Sprite_Flying
  2403. #------------------------------------------------------------------------------
  2404. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2405. # スプライトの状態を自動的に変化させます。
  2406. #==============================================================================

  2407. class Sprite_Flying < RPG::Sprite
  2408.   include Side_view
  2409.   #--------------------------------------------------------------------------
  2410.   # ● 公開インスタンス変数
  2411.   #--------------------------------------------------------------------------
  2412.   attr_accessor :battler                  # バトラー
  2413.   #--------------------------------------------------------------------------
  2414.   # ● オブジェクト初期化
  2415.   #     viewport : ビューポート
  2416.   #     battler  : バトラー (Game_Battler)
  2417.   #--------------------------------------------------------------------------
  2418.   def initialize(viewport, battler = nil)
  2419.     super(viewport)
  2420.     @battler = battler
  2421.     @battler_visible = false
  2422.   end
  2423.   #--------------------------------------------------------------------------
  2424.   # ● 解放
  2425.   #--------------------------------------------------------------------------
  2426.   def dispose
  2427.     if self.bitmap != nil
  2428.       self.bitmap.dispose
  2429.     end
  2430.     super
  2431.   end
  2432.   #--------------------------------------------------------------------------
  2433.   # ● フレーム更新
  2434.   #--------------------------------------------------------------------------
  2435.   def update
  2436.     super
  2437.     # バトラーが nil の場合
  2438.     if @battler == nil
  2439.       self.bitmap = nil
  2440.       loop_animation(nil)
  2441.       return
  2442.     end
  2443.     # 遠距離アニメ
  2444.     flying_animation = @battler.flying_animation
  2445.     flying_start = flying_animation[0]
  2446.     flying_end   = flying_animation[1]
  2447.     # アニメーション ID が現在のものと異なる場合
  2448.     if @anime_id != @battler.flying_anime[0]
  2449.       @anime_id = @battler.flying_anime[0]
  2450.       @animation = $data_animations[@anime_id]
  2451.     end
  2452.     # アニメーション 開始
  2453.     if flying_start
  2454.       loop_animation(@animation)
  2455.     elsif flying_end
  2456.       loop_animation(nil)
  2457.     end
  2458.     self.x = @battler.flying_x
  2459.     self.y = @battler.flying_y
  2460.     self.z = @battler.screen_z + 1000
  2461.   end
  2462. end

  2463. module RPG
  2464.   class Skill
  2465.     #--------------------------------------------------------------------------
  2466.     # ● 魔法かどうかの判断
  2467.     #--------------------------------------------------------------------------
  2468.     def magic?
  2469.       if @atk_f == 0
  2470.         return true
  2471.       else
  2472.         return false
  2473.       end
  2474.     end
  2475.   end
  2476. end

  2477. # アローカーソルの位置修正

  2478. class Arrow_Actor < Arrow_Base
  2479.   include Side_view
  2480.   #--------------------------------------------------------------------------
  2481.   # ● フレーム更新
  2482.   #--------------------------------------------------------------------------
  2483.   alias side_view_update update
  2484.   def update
  2485.     side_view_update
  2486.     # スプライトの座標を設定
  2487.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  2488.       self.x = self.actor.screen_x + ARROW_OX
  2489.       self.y = self.actor.screen_y + ARROW_OY
  2490.     end
  2491.   end
  2492. end
  2493. class Arrow_Enemy < Arrow_Base
  2494.   include Side_view
  2495.   #--------------------------------------------------------------------------
  2496.   # ● フレーム更新
  2497.   #--------------------------------------------------------------------------
  2498.   alias side_view_update update
  2499.   def update
  2500.     side_view_update
  2501.     # スプライトの座標を設定
  2502.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  2503.       self.x = self.enemy.screen_x
  2504.       self.y = self.enemy.screen_y + self.enemy.height/2
  2505.     end
  2506.   end
  2507. end
复制代码
昨天自己尝试修改了一下
基本的都修改好了
但是攻击的时候就报错了
恳请大家帮帮忙
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-11 17:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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