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

Project1

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

[已经过期] 请教简单横版战斗问题,求解释一下这是什么意思

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
606 小时
注册时间
2011-6-11
帖子
225
跳转到指定楼层
1
发表于 2019-1-7 12:56:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 guoxiaomi 于 2019-1-9 20:40 编辑

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

CD2Z6FBP5D$9}P$8G{E_D1W.png (48.37 KB, 下载次数: 1)

错误

错误

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
606 小时
注册时间
2011-6-11
帖子
225
2
 楼主| 发表于 2019-1-7 12:59:30 | 只看该作者
自己研究了几个小时 还是没整明白 求给点方向

Data.zip

413.86 KB, 下载次数: 52

回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

3
发表于 2019-1-7 13:29:15 | 只看该作者
Scene_Battle 4里面的71行和99行注释掉试试看……
没细看代码,但觉得类里还给加个同名类的操作非常sao……
回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
606 小时
注册时间
2011-6-11
帖子
225
4
 楼主| 发表于 2019-1-7 13:42:57 | 只看该作者
cinderelmini 发表于 2019-1-7 13:29
Scene_Battle 4里面的71行和99行注释掉试试看……
没细看代码,但觉得类里还给加个同名类的操作非常sao…… ...

不会错误了,大神,能不能告诉我是什么原理!
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

5
发表于 2019-1-7 17:18:47 | 只看该作者
qq595006041 发表于 2019-1-7 13:42
不会错误了,大神,能不能告诉我是什么原理!

不太了解类内套类的原理,这里又是套了个同名的类,
不过就是因为这样的格式,导致里边那个更新方法被放到了另一个次元于是读不到了。

其实默认工程的代码不是这样的,肯定是什么时候你把它改了。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
606 小时
注册时间
2011-6-11
帖子
225
6
 楼主| 发表于 2019-1-7 17:26:23 | 只看该作者
@cinderelmini结果这样了 大神

_[`7O7GUJUIWA)H%PP9(ZYN.png (41.38 KB, 下载次数: 0)

_[`7O7GUJUIWA)H%PP9(ZYN.png

点评

你要从簡单學起啊  发表于 2019-1-17 15:54
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 01:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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