查看: 2104|回复: 0

[已经过期] 菜鸟横版modified 脚本如何改魔法释放也能显示武器

[复制链接]
梦石
0
星屑
102
在线时间
43 小时
注册时间
2014-6-16
回帖
21
发表于 2014-12-4 22:15:12 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 RyanBern 于 2014-12-4 22:17 编辑

菜鸟横版modified脚本设定: 在数据库特技中 攻击力为大于0则为除魔法以外的特技,在脚本释放动作中 就会跳到敌人面前,旋转。
      那么问题来了,设定为0的话 就是魔法 释放的时候就只是往前走一步,而且  不显示武器!  辛苦多年寻找的素材就无法得到显示

有人能看懂这个脚本,请别吝啬对新人的帮助。  可以教我 也能自己写  ,但我更希望你能教我,告诉我该修改的地方在哪,语句的意思和修改方法,感激不尽!
脚本如下
  1. =begin
  2. ###############################################################################

  3. 全局行走图战斗 v1.1
  4. 本版本只经低测试,可能存在某些bug。
  5. 请注意更新
  6. [url]http://rpg.blue/viewthread.php?tid=129875&extra=page%3D1[/url]
  7. --烁灵 整合彩虹神剑
  8. ###############################################################################
  9. ------------------------------------------------------------------------------
  10. 经过了两次的修改,终于完全实现了远距离攻击的效果(弓箭、铳类)
  11. 另外,也实现了简单的回旋攻击(类似回力镖的攻击)和攻击道具(类似石头或炸弹)

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

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

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

  31. 战图转行走图 在横版战斗157下修改。#BalzacLi

  32. 〉注意:
  33. 〉‘飞行武器射去敌人身上’的动画是在设定id之后的那句脚本里面设置
  34. 〉例子:(脚本第455和456行)
  35. 〉       when 17,18,19,20    #远程武器1(弓箭类)的id
  36. 〉       return [101,32,false,false]
  37. 〉这样,武器17~20(都是弓箭)在显示‘对象方的动画’之前会先显示第101号动画
  38. 〉而动画的轨道是从使用者身上直到敌人身上(实现子弹射出的效果)

  39. 还有:
  40. 战斗队伍的画面位置已经被修改过,
  41. 让角色的位置与默认的战斗背景图不会有视觉上的冲突。
  42. 如果要更改请去脚本第113-116行改改就行了。

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

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

  47. =end                                                        #modify by darkten

  48. ###############################################################################

  49. =begin

  50. 此版本更新了以下几点:
  51. 1.支持敌人行走图战斗
  52. 2.修正与RTAB并用的bug。
  53. 3.支持敌人也玩小石头

  54. 使用方法:
  55. 1.敌人的战斗图名称要与敌人的行走图名称相一致,具体查看本范例编号为2的敌人。
  56. 2.请自行设置 160 ~ 173 行的内容。

  57.                                                                   by ONEWateR
  58. =end
  59. ###############################################################################

  60. module Side_view
  61.   #--------------------------------------------------------------------------
  62.   # ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
  63.   #    在Scene_Battle计算方法是否是方法synthe?
  64.   #    在自动不想认识的时候,请重写。
  65.   #--------------------------------------------------------------------------
  66.   if Scene_Battle.method_defined?("synthe?")
  67.     RTAB = true
  68.   else
  69.     RTAB = false
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 改正RATB中的位置误差 ☆自动识别
  73.   #    在自动不想认识的时候,请重写。
  74.   #--------------------------------------------------------------------------
  75.   def camera_correctness
  76.     return false if !RTAB
  77.     begin
  78.       return $scene.drive
  79.     rescue
  80.       return false
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 队伍中的最大人数
  85.   #--------------------------------------------------------------------------
  86.   Party_max = 4
  87.   #--------------------------------------------------------------------------
  88.   # ● 战斗图的扩大率(1.0的时候是保持原有大小)
  89.   #--------------------------------------------------------------------------
  90.   CHAR_ZOOM = 1.2
  91.   #--------------------------------------------------------------------------
  92.   # ● 光标的位置修正(基本不需要改~)
  93.   #--------------------------------------------------------------------------
  94.   ARROW_OX = 0
  95.   ARROW_OY = 64
  96.   #--------------------------------------------------------------------------
  97.   # ● 名状态作为飞行管理的排列(不知道什么意思....)
  98.   #--------------------------------------------------------------------------
  99.   FLY_STATES = ["飛行"]
  100.   #--------------------------------------------------------------------------
  101.   # ● 战斗画面的位置
  102.   #--------------------------------------------------------------------------
  103.   PARTY_X = 455     # 队伍 X 位置
  104.   PARTY_Y = 200     # 队伍 Y 位置
  105.   FORMATION_X = 30  # 各个角色之间的间隔 X
  106.   FORMATION_Y = 35  # 各个角色之间的间隔 Y
  107.   #--------------------------------------------------------------------------
  108.   # ● 自定义常数
  109.   #--------------------------------------------------------------------------
  110.   NORMAL   = "NORMAL"
  111.   WALK_R   = "WALK_R"
  112.   WALK_L   = "WALK_L"
  113.   ATTACK   = "ATTACK"
  114.   ATTACK_R = "ATTACK_R"
  115.   ATTACK_L = "ATTACK_L"
  116.   MAGIC    = "MAGIC"
  117.   ITEM     = "ITEM"
  118.   # 动画的设定
  119.   ANIME = {
  120.     # [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
  121.     NORMAL            => [1,true , 0,false, true ,""    ], # 通常待击
  122.     WALK_R            => [2,true , 2,false, false,""    ], # 右移动
  123.     WALK_L            => [1,true , 2,false, false,""    ], # 左移动
  124.     ATTACK_R          => [1,false, 2,true , false,"右手"], # 右手攻击
  125.     ATTACK_L          => [1,false, 2,true , false,"左手"], # 左手攻击
  126.     MAGIC             => [1,false, 2,false, false,""    ], # 右手攻击
  127.     ITEM              => [1,false, 2,false, false,""    ], # 左手攻击
  128.     }

  129.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  130.   ANIME.default = [1,false,12,false,"",""]

  131.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  132.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  133.   DUAL_WEAPONS_ANIME = [ATTACK]


  134.   #--------------------------------------------------------------------------
  135.   # ● 战斗图不是行走图的敌人编号
  136.   #--------------------------------------------------------------------------
  137.   NOT_CHARACTER_EMEMY = [3]
  138.   #--------------------------------------------------------------------------
  139.   # ● 敌人使用的武器
  140.   #    敌人编号=>武器编号
  141.   #--------------------------------------------------------------------------
  142.   EMEMY_WEAPO = {2=>5,7=>17}
  143.   #--------------------------------------------------------------------------
  144.   # ● 敌人使用的武器 (二刀流)
  145.   #    敌人编号=>武器编号
  146.   #--------------------------------------------------------------------------
  147.   EMEMY_WEAPO2 = {}


  148.   #--------------------------------------------------------------------------
  149.   # ● 摇晃的设定
  150.   #--------------------------------------------------------------------------
  151.   SHAKE_FILE = "摇晃"  # 文件名
  152.   SHAKE_POWER = 5          # 强度
  153.   SHAKE_SPEED = 5          # 速度
  154.   SHAKE_DURATION = 5      # 时间
  155.   #--------------------------------------------------------------------------
  156.   # ● 上下反转地的设定
  157.   #--------------------------------------------------------------------------
  158.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  159.   #--------------------------------------------------------------------------
  160.   # ● 左右反转地的设定
  161.   #--------------------------------------------------------------------------
  162.   REVERSE_FILE = "左右反转" # 文件名
  163.   #--------------------------------------------------------------------------
  164.   # ● 回转地的设定
  165.   #--------------------------------------------------------------------------
  166.   TURNING_FILE = "回转" # 文件名
  167.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  168.   TURNING_SPEED = 40    # 速度
  169.   TURNING_DURATION = 1  # 回转数
  170.   #--------------------------------------------------------------------------
  171.   # ● 移动的设定
  172.   #--------------------------------------------------------------------------
  173.   MOVE_FILE = "移动"             # 文件名
  174.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  175.   MOVE_SPEED = 32                # 速度
  176.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  177.   #--------------------------------------------------------------------------
  178.   # ● 动画追加的设定
  179.   #--------------------------------------------------------------------------
  180.   ADD_ANIME_FILE = "动画追加"  # 文件名
  181.   ADD_ANIME_ID = 0               # 动画的ID
  182.   #--------------------------------------------------------------------------
  183.   # ● 债务不履行声明和RTAB的数据转换
  184.   #--------------------------------------------------------------------------
  185.   def convert_battler
  186.     return RTAB ? @active_actor : @active_battler
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 债务不履行声明和RTAB的数据转换2
  190.   #--------------------------------------------------------------------------
  191.   def convert_battler2(*arg)
  192.     return RTAB ? arg[0] : @active_battler
  193.   end
  194. end

  195. #--------------------------------------------------------------------------
  196. # ● 行动設定
  197. #--------------------------------------------------------------------------
  198. module BattleActions

  199.   # 下のものはあくまでも一例なので
  200.   # 独自に作ってください。

  201.   Actions = {

  202.   "通常攻撃" => [

  203.   "閃きアニメ",
  204.   "アクターアニメ変更#WALK_L",
  205.   "移動#target,32,0,64,0",
  206.   "行動アニメ",
  207.   "アクターアニメ変更#ATTACK",
  208.   "遠距離アニメ",
  209.   "対象アニメ",
  210.   "アクターアニメ変更#WALK_L",
  211.   "SEの演奏#016-Jump02,80,100",
  212.   "移動#self,0,0,48,32",
  213.   "終了"
  214.   ],

  215.   "エネミー攻撃" => [

  216.   "閃きアニメ",
  217.   "アクターアニメ変更#WALK_L",
  218.   "移動#self,-36,0,12,0",
  219.   "行動アニメ",
  220.   "アクターアニメ変更#ATTACK",
  221.   "遠距離アニメ",
  222.   "対象アニメ",
  223.   "アクターアニメ変更#WALK_L",
  224.   "移動#self,0,0,12,0",
  225.   "終了"
  226.   ],

  227.   "術発動" => [

  228.   "閃きアニメ",
  229.   "アクターアニメ変更#WALK_L",
  230.   "移動#self,-32,0,4,0",
  231.   "アクターアニメ変更#MAGIC",
  232.   "行動アニメ",
  233.   "ウエイト#15",
  234.   "遠距離アニメ",
  235.   "対象アニメ",
  236.   "アクターアニメ変更#WALK_L",
  237.   "移動#self,0,0,4,2",
  238.   "終了"
  239.   ],

  240.   "アイテム使用" => [

  241.   "閃きアニメ",
  242.   "アクターアニメ変更#WALK_L",
  243.   "移動#self,-32,0,4,0",
  244.   "行動アニメ",
  245.   "アクターアニメ変更#ITEM",
  246.   "ウエイト#15",
  247.   "遠距離アニメ",
  248.   "対象アニメ",
  249.   "アクターアニメ変更#WALK_L",
  250.   "移動#self,0,0,4,2",
  251.   "終了"
  252.   ],

  253.   "払い抜け" => [

  254.   "閃きアニメ",
  255.   "アクターアニメ変更#WALK_L",
  256.   "移動#target_near,50,0,48,30",  
  257.   "左右反転",
  258.   "アクターアニメ固定#ATTACK#3",
  259.   "行動アニメ",
  260.   "SEの演奏#135-Light01,100,100",
  261.   "アニメーションの表示#self,42",
  262.   "ウエイト#15",
  263.   "左右反転",
  264.   "残像表示",
  265.   "移動#target_far,-50,0,48,0",
  266.   "対象アニメ",
  267.   "残像消去",
  268.   "アニメ固定解除",
  269.   "アクターアニメ変更#WALK_L",
  270.   "移動#self,0,0,48,1,0",
  271.   "終了"
  272.   ],

  273.   "弓箭攻撃" => [

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

  285.   "回旋攻撃" => [

  286.   "閃きアニメ",
  287.   "アクターアニメ変更#WALK_L",
  288.   "移動#self,-32,0,4,0",
  289.   "行動アニメ",
  290.   "アクターアニメ変更#STAND_L",  
  291.   "遠距離アニメ",
  292.   "対象アニメ",
  293.   "アクターアニメ変更#WALK_L",
  294.   "移動#self,0,0,4,2",
  295.   "終了"
  296.   ],

  297.   "远距离発動" => [

  298.   "閃きアニメ",
  299.   "アクターアニメ変更#WALK_L",
  300.   "移動#self,-32,0,4,0",
  301.   "アクターアニメ変更#MAGIC",
  302.   "行動アニメ",
  303.   "アクターアニメ変更#ATTACK",
  304.   "遠距離アニメ",
  305.   "対象アニメ",
  306.   "アクターアニメ変更#WALK_L",
  307.   "移動#self,0,0,4,2",
  308.   "終了"
  309.   ],

  310.   "回旋発動" => [

  311.   "閃きアニメ",
  312.   "アクターアニメ変更#WALK_L",
  313.   "移動#self,-32,0,4,0",
  314.   "アクターアニメ変更#MAGIC",
  315.   "行動アニメ",
  316.   "アクターアニメ変更#STAND_L",  
  317.   "遠距離アニメ",
  318.   "対象アニメ",
  319.   "アクターアニメ変更#WALK_L",
  320.   "移動#self,0,0,4,2",
  321.   "終了"
  322.   ],

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

  324. end

  325. module RPG
  326.   class Weapon
  327.     #--------------------------------------------------------------------------
  328.     # ● アクション設定
  329.     #--------------------------------------------------------------------------
  330.     def battle_actions
  331.       case @id
  332.       when 17,18,19,20,21,22,23,24  # 远程武器的id回旋攻撃
  333.         return BattleActions::Actions["弓箭攻撃"]
  334.       when 34                       # 回旋武器的id
  335.         return BattleActions::Actions["回旋攻撃"]
  336.       end
  337.       else
  338.       return BattleActions::Actions["通常攻撃"]
  339.     end
  340.   end
  341.   class Skill
  342.     #--------------------------------------------------------------------------
  343.     # ● アクション設定
  344.     #--------------------------------------------------------------------------
  345.     def battle_actions
  346.       case @id
  347.       when 73,74,75,76,77,78,79,80  # 远程技能的id
  348.         return BattleActions::Actions["远距离発動"]
  349.       when 82                       # 回旋技能的id
  350.         return BattleActions::Actions["回旋発動"]
  351.       end
  352.       else
  353.       if self.magic?
  354.         return BattleActions::Actions["術発動"]
  355.       else
  356.         return BattleActions::Actions["払い抜け"]
  357.       end
  358.     end
  359.   end
  360.   class Item
  361.     #--------------------------------------------------------------------------
  362.     # ● アクション設定
  363.     #--------------------------------------------------------------------------
  364.     def battle_actions
  365.       return BattleActions::Actions["アイテム使用"]
  366.     end
  367.   end
  368. end
  369. #class Game_Enemy < Game_Battler
  370.   #--------------------------------------------------------------------------
  371.   # ● アクション設定
  372.   #--------------------------------------------------------------------------
  373. #~  def battle_actions
  374. #~    return BattleActions::Actions["エネミー攻撃"]
  375. #~  end
  376. #end
  377. =begin
  378. #--------------------------------------------------------------------------
  379. # ● 遠距離アニメーション
  380. #--------------------------------------------------------------------------
  381.  ☆ 説明

  382.    行動者から対象者にアニメを飛ばします。
  383.    飛ばすアニメを データベース‐アニメーション で作ります。
  384.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。


  385.   ● カスタマイズ方法

  386.     case @id
  387.     when 17,18,19,20
  388.       return [101,32,false,false]
  389.     when 21,22,23,24
  390.       return [102,32,false,false]
  391.     end
  392.     return 0

  393.     のように描くとID別に指定可能です。


  394.   ● アニメーションID

  395.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。


  396.   ● スピード

  397.   大きいほうが早い(0だとアニメは移動しません)

  398.   1 = 1フレームで1ドット進むと考えてください。

  399.   ● 往復するか?

  400.   true とした場合、ブーメランのようにアニメが戻ります。

  401.   ● 直線(false)or曲線(true)

  402.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  403.   false = 対象に向かって直線で、アニメが飛びます。

  404. =end
  405. module RPG
  406.   class Weapon
  407.     #--------------------------------------------------------------------------
  408.     # ● 遠距離アニメーション
  409.     #--------------------------------------------------------------------------
  410.     def flying_anime
  411.       # ID 指定 の例(武器的id,分类是根据飞行武器的动画id)
  412.       case @id
  413.       when 34             #回旋武器(类似回力镖)的id
  414.         return [103,32,true,true]
  415.       when 17,18,19,20    #远程武器1(弓箭类)的id
  416.         return [101,32,false,false]
  417.       when 21,22,23,24    #远程武器2(铳类)的id
  418.         return [102,32,false,false]
  419.       end
  420.       return [0,0,false,false]
  421.     end
  422.   end
  423.   class Skill
  424.     #--------------------------------------------------------------------------
  425.     # ● 遠距離アニメーション
  426.     #--------------------------------------------------------------------------
  427.     def flying_anime
  428.       # ID 指定 の例(技能的id,分类是根据飞行武器的动画id)
  429.       case @id
  430.       when 82             #回旋技能(类似回力镖)的id
  431.         return [103,32,true,true]
  432.       when 73,74,75,76    #远程技能1(弓箭类)的id
  433.         return [101,32,false,false]
  434.       when 77,78,79,80    #远程技能2(铳类)的id
  435.         return [102,32,false,false]
  436.       end
  437.       return [0,0,false,false]
  438.     end
  439.   end
  440.   class Item
  441.     #--------------------------------------------------------------------------
  442.     # ● 遠距離アニメーション
  443.     #--------------------------------------------------------------------------
  444.     def flying_anime
  445.       case @id
  446.       when 34    #抛击类道具(如炸弹一类)的id
  447.         return [104,32,false,true]
  448.       end
  449.       return [0,0,false,false]
  450.     end
  451.   end
  452. end

  453. #class Game_Enemy < Game_Battler
  454.   #--------------------------------------------------------------------------
  455.   # ● 遠距離アニメーション
  456.   #--------------------------------------------------------------------------
  457. #~  def flying_anime
  458. #~    return [0,0,false,false]
  459. #~  end
  460. #end



  461. #==============================================================================
  462. # ■ Game_Battler
  463. #==============================================================================
  464. class Game_Battler
  465.   include Side_view
  466.   #--------------------------------------------------------------------------
  467.   # ● 追加・公開インスタンス変数
  468.   #--------------------------------------------------------------------------
  469.   attr_accessor :height                  # 画像の高さ
  470.   attr_accessor :real_x                  # X座標補正
  471.   attr_accessor :real_y                  # Y座標補正
  472.   attr_accessor :real_zoom               # 拡大率
  473.   attr_accessor :wait_count              # アニメーション 待ち時間
  474.   attr_accessor :wait_count2             # アニメーション 待ち時間2
  475.   attr_accessor :pattern                 # アニメーション カウント(キャラ)
  476.   attr_accessor :shake                   # シェイク開始フラッグ
  477.   attr_accessor :reverse                 # 左右反転フラッグ
  478.   attr_accessor :shadow                  # 残像フラッグ
  479.   attr_accessor :flash_flag              # 閃きフラッグ
  480.   attr_reader   :ox                      # X座標補正
  481.   attr_reader   :oy                      # Y座標補正
  482.   attr_reader   :flying_x                # 遠距離アニメX座標
  483.   attr_reader   :flying_y                # 遠距離アニメY座標
  484.   attr_reader   :flying_anime            # 遠距離アニメ
  485.   attr_reader   :animation1_on           # 行動アニメ開始フラッグ
  486.   attr_reader   :animation2_on           # 対象アニメ開始フラッグ
  487.   #--------------------------------------------------------------------------
  488.   # ● デフォルトのアニメーション待ち時間を取得
  489.   #--------------------------------------------------------------------------
  490.   def animation_duration=(animation_duration)
  491.     @_animation_duration = animation_duration
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # ● バトル開始時のセットアップ
  495.   #--------------------------------------------------------------------------
  496.   def start_battle
  497.     [url=home.php?mod=space&uid=291977]@height[/url] = 0
  498.     @real_x = 0
  499.     @real_y = 0
  500.     @real_zoom = 1.0
  501.     @battler_condition = ""
  502.     @action = nil
  503.     @battle_actions = []
  504.     @battler_action = false
  505.     [url=home.php?mod=space&uid=2129346]@step[/url] = 0
  506.     @anime_on = false
  507.     @wait_count = 0
  508.     @wait_count2 = 0
  509.     @ox = 0
  510.     @oy = 0
  511.     @pattern = 0
  512.     @pattern_log = true
  513.     @pattern_freeze = false
  514.     @condition_freeze = false
  515.     @active = false
  516.     @move_distance = nil
  517.     @move_wait = 0
  518.     @move_coordinates = [0,0,0,0]
  519.     @flying_distance = nil
  520.     @flying_wait = 0
  521.     @flying_x = 0
  522.     @flying_y = 0
  523.     @flash_flag = {}
  524.     self.flying_clear
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● 移動中判定
  528.   #--------------------------------------------------------------------------
  529.   def moving?
  530.     # X座標補正または、Y座標補正が0でなければ、移動中
  531.     return (@ox != 0 or @oy != 0)
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ● 移動終了判定
  535.   #--------------------------------------------------------------------------
  536.   def move_end?
  537.     return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● アクション開始設定
  541.   #--------------------------------------------------------------------------
  542.   def action(flag = true)
  543.     @battler_action = flag
  544.     @animation1_on = false
  545.     @animation2_on = false
  546.     [url=home.php?mod=space&uid=2129346]@step[/url] = "setup"
  547.   end   
  548.   #--------------------------------------------------------------------------
  549.   # ● アクション中判定
  550.   #--------------------------------------------------------------------------
  551.   def action?
  552.     return @battler_action
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 閃き判定
  556.   #--------------------------------------------------------------------------
  557.   def flash?
  558.     return @flash_flg
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # ● 戦闘不能判定
  562.   #--------------------------------------------------------------------------
  563.   def anime_dead?
  564.     if $game_temp.in_battle and !RTAB
  565.       if [2,3,4,5].include?($scene.phase4_step)
  566.         return @last_dead
  567.       end
  568.     end
  569.     return @last_dead = self.dead?
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● ピンチ状態判定
  573.   #--------------------------------------------------------------------------
  574.   def crisis?
  575.     if $game_temp.in_battle and !RTAB
  576.       if [2,3,4,5].include?($scene.phase4_step)
  577.         return @last_crisis
  578.       end
  579.     end
  580.     return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ● バッドステート判定
  584.   #--------------------------------------------------------------------------
  585.   def badstate?
  586.     for i in @states
  587.       unless $data_states[i].nonresistance
  588.         return true
  589.       end
  590.     end
  591.     return false
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ● 飛行
  595.   #--------------------------------------------------------------------------
  596.   def fly
  597.     if [url=home.php?mod=space&uid=14121]@fly[/url] != nil
  598.       return @fly
  599.     end
  600.     for id in @states
  601.       if FLY_STATES.include?($data_states[id].name)
  602.         return 60
  603.       end
  604.     end
  605.     return 0
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● 遠距離アニメ目標座標の計算
  609.   #--------------------------------------------------------------------------
  610.   def flying_setup
  611.     # 二度目は実行しない
  612.     return if @flying_distance != nil && !camera_correctness
  613.     if RTAB
  614.       targets = @target
  615.     else
  616.       targets = $scene.target_battlers
  617.     end
  618.     # 目的座標を計算
  619.     @f_target_x = 0
  620.     @f_target_y = 0
  621.     for t in targets
  622.       @f_target_x += t.screen_x
  623.       @f_target_y += t.screen_y
  624.     end
  625.     if targets != []
  626.       @f_target_x /= targets.size
  627.       @f_target_y /= targets.size
  628.     else
  629.       @flying_distance = 0
  630.       return
  631.     end
  632.     # 距離の計算
  633.     @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 遠距離アニメ
  637.   #--------------------------------------------------------------------------
  638.   def flying_animation
  639.     # 戻る
  640.     if @step != "flying" or @flying_distance.nil?
  641.       return [false,true]
  642.     end
  643.     # あらかじめ計算
  644.     self_x = self.screen_x
  645.     self_y = self.screen_y
  646.     @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
  647.     n1 = @flying_wait / @flying_distance.to_f
  648.     if @flying_distance - @flying_wait > @flying_distance / 2
  649.       n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
  650.     else
  651.       n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
  652.     end
  653.     if !@flying_anime[4]
  654.       # 直線移動
  655.       x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  656.       y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
  657.     else
  658.       # 曲線移動
  659.       if !@flying_proceed_end
  660.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  661.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
  662.       else
  663.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  664.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
  665.       end
  666.     end
  667.     # 座標代入
  668.     @flying_x = x
  669.     @flying_y = y
  670.     # ウエイト
  671.     if !@flying_proceed_end
  672.       # 開始
  673.       @flying_proceed_start = @flying_wait == 0
  674.       @flying_wait += @flying_anime[1]
  675.       @flying_wait = [@flying_wait,@flying_distance].min
  676.       @flying_proceed_end = @flying_wait == @flying_distance
  677.     else
  678.       # 開始
  679.       @flying_return_start = @flying_wait == @flying_distance
  680.       @flying_wait -= @flying_anime[1]
  681.       @flying_wait = [@flying_wait,0].max
  682.       @flying_return_end = @flying_wait == 0
  683.     end
  684.     if @flying_anime[1] == 0
  685.       @flying_end = true
  686.     elsif !@flying_anime[2]
  687.       @flying_end = @flying_proceed_end
  688.     else
  689.       @flying_end = @flying_return_end
  690.     end
  691.     # 値を返す(アニメ開始,アニメ終了)
  692.     return [@flying_proceed_start,@flying_end]
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 遠距離アニメ初期化
  696.   #--------------------------------------------------------------------------
  697.   def flying_clear
  698.     @flying_proceed_start = false
  699.     @flying_proceed_end = false
  700.     @flying_return_start = false
  701.     @flying_return_end = false
  702.     @flying_end = false
  703.     @flying_anime = [0,0,false]
  704.   end
  705.   #--------------------------------------------------------------------------
  706.   # ● 移動
  707.   #--------------------------------------------------------------------------
  708.   def move
  709.     # 距離の計算
  710.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  711.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  712.     if @move_distance > 0
  713.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  714.       array = @move_coordinates
  715.       # ジャンプ補正値の計算
  716.       if @move_distance - @move_wait > @move_distance / 2
  717.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2        
  718.       else
  719.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  720.       end
  721.       jump = @move_action[4] > 0 ? -jump : jump
  722.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i

  723.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  724.       # ウエイト
  725.       @move_wait -= @move_action[3]
  726.       @move_wait = [@move_wait,0].max
  727.     end
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● 移動アクションの取得
  731.   #--------------------------------------------------------------------------
  732.   def get_move_action
  733.     string = @action.split(/#/)[1]
  734.     string = string.split(/,/)
  735.     @move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● アクションの取得
  739.   #--------------------------------------------------------------------------
  740.   def get_step
  741.     if @action.nil?
  742.       @step = "finish"
  743.       return
  744.     end
  745.     string = @action.split(/#/)[0]
  746.     if string =~ "移動"
  747.       @step = "moving_setup"
  748.     elsif string =~ "アクターアニメ実行"
  749.       @step = "action"
  750.     elsif string =~ "遠距離アニメ"
  751.       @step = "flying"
  752.     elsif string =~ "アクターアニメ変更"
  753.       @step = "change"
  754.     elsif string =~ "行動アニメ"
  755.       @step = "animation1"
  756.     elsif string =~ "対象アニメ"
  757.       @step = "animation2"
  758.     elsif string =~ "ウエイト"
  759.       @step = "wait"
  760.     elsif string =~ "左右反転"
  761.       @step = "reverse"
  762.     elsif string =~ "閃きアニメ"
  763.       @step = "flash"
  764.     elsif string =~ "残像表示"
  765.       @step = "shadow_on"
  766.     elsif string =~ "残像消去"
  767.       @step = "shadow_off"
  768.     elsif string =~ "アクターアニメ固定"
  769.       @step = "freeze"
  770.     elsif string =~ "アニメ固定解除"
  771.       @step = "freeze_lifting"
  772.     elsif string =~ "アニメーションの表示"
  773.       @step = "animation_start"
  774.     elsif string =~ "SEの演奏"
  775.       @step = "play_se"
  776.     else
  777.       @step = "finish"
  778.     end
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ● フレーム更新 (次のアクションへ)
  782.   #--------------------------------------------------------------------------
  783.   def update_next
  784.     @action = @battle_actions.shift
  785.     @step = get_step
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ● フレーム更新 (動作取得)
  789.   #--------------------------------------------------------------------------
  790.   def update_setup
  791.     # アクションの取得
  792.     self.get_actions
  793.     @action = @battle_actions.shift
  794.     @step = get_step
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● フレーム更新 (移動取得)
  798.   #--------------------------------------------------------------------------
  799.   def update_moving_setup
  800.     # 移動アクションの取得
  801.     self.get_move_action
  802.     # 移動目標の設定
  803.     self.move_setup
  804.     @step = "moving"
  805.   end
  806.   #--------------------------------------------------------------------------
  807.   # ● フレーム更新 (移動)
  808.   #--------------------------------------------------------------------------
  809.   def update_moving
  810.     # 移動
  811.     self.move
  812.     self.condition = @battler_condition
  813.     # 移動完了したら次のステップへ
  814.     if move_end?
  815.       @wait_count = 2
  816.       @action = @battle_actions.shift
  817.       @step = get_step
  818.     end
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ● フレーム更新 (アニメ実行)
  822.   #--------------------------------------------------------------------------
  823.   def update_action
  824.     con = @action.split(/#/)[1]
  825.     # 右手・左手を分ける
  826.     if DUAL_WEAPONS_ANIME.include?(con)
  827.       if !@first_weapon and @second_weapon
  828.         con = con + "_L"
  829.       else
  830.         con = con + "_R"
  831.       end
  832.     end
  833.     # アニメ変更
  834.     self.condition = con
  835.     # ループか否か
  836.     if !ANIME[@battler_condition][1]
  837.       self.anime_on
  838.     end
  839.     @action = @battle_actions.shift
  840.     @step = get_step
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # ● フレーム更新 (遠距離アニメ)
  844.   #--------------------------------------------------------------------------
  845.   def update_flying
  846.     # 目標の設定
  847.     self.flying_setup
  848.     # 遠距離アニメ終了
  849.     if @flying_end
  850.       self.flying_clear
  851.       @action = @battle_actions.shift
  852.       @step = get_step
  853.     end
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● フレーム更新 (アニメ変更)
  857.   #--------------------------------------------------------------------------
  858.   def update_change
  859.     con = @action.split(/#/)[1]
  860.     # 右手・左手を分ける
  861.     if DUAL_WEAPONS_ANIME.include?(con)
  862.       if !@first_weapon and @second_weapon
  863.         con = con + "_L"
  864.       else
  865.         con = con + "_R"
  866.       end
  867.     end
  868.     # アニメ変更
  869.     self.condition = con
  870.     # ループか否か
  871.     if !ANIME[@battler_condition][1]
  872.       self.anime_on
  873.     end
  874.     @action = @battle_actions.shift
  875.     @step = get_step
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● フレーム更新 (行動アニメ)
  879.   #--------------------------------------------------------------------------
  880.   def update_animation1
  881.     @animation1_on = true
  882.     # 行動アニメの後に行動を開始する
  883.     if $scene.phase4_step == 3
  884.       id = RTAB ? @anime1 : $scene.animation1_id
  885.       animation = $data_animations[id]
  886.       frame_max = animation != nil ? animation.frame_max : 0
  887.       @wait_count2 = frame_max * 2
  888.       return
  889.     end
  890.     @action = @battle_actions.shift
  891.     @step = get_step
  892.   end
  893.   #--------------------------------------------------------------------------
  894.   # ● フレーム更新 (対象アニメ)
  895.   #--------------------------------------------------------------------------
  896.   def update_animation2
  897.     @animation2_on = true
  898.     # 行動アニメの後に行動を開始する
  899.     if $scene.phase4_step == 4
  900.       id = RTAB ? @anime2 : $scene.animation2_id
  901.       animation = $data_animations[id]
  902.       frame_max = animation != nil ? animation.frame_max : 0
  903.       @wait_count2 = frame_max * 2
  904.       return
  905.     end
  906.     @action = @battle_actions.shift
  907.     @step = get_step
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● フレーム更新 (ウエイト)
  911.   #--------------------------------------------------------------------------
  912.   def update_wait
  913.     @wait_count2 = @action.split(/#/)[1].to_i
  914.     @action = @battle_actions.shift
  915.     @step = get_step
  916.   end
  917.   #--------------------------------------------------------------------------
  918.   # ● フレーム更新 (残像表示)
  919.   #--------------------------------------------------------------------------
  920.   def update_shadow_on
  921.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  922.     @action = @battle_actions.shift
  923.     @step = get_step
  924.   end
  925.   #--------------------------------------------------------------------------
  926.   # ● フレーム更新 (残像消去)
  927.   #--------------------------------------------------------------------------
  928.   def update_shadow_off
  929.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = false
  930.     @action = @battle_actions.shift
  931.     @step = get_step
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ● フレーム更新 (左右反転)
  935.   #--------------------------------------------------------------------------
  936.   def update_reverse
  937.     [url=home.php?mod=space&uid=30269]@reverse[/url] = [url=home.php?mod=space&uid=30269]@reverse[/url] ? false : true
  938.     @action = @battle_actions.shift
  939.     @step = get_step
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ● フレーム更新 (閃きアニメ)
  943.   #--------------------------------------------------------------------------
  944.   def update_flash
  945.     # 閃きアニメの後に行動を開始する
  946.     if @flash_flag["normal"]
  947.       @wait_count = $scene.flash_duration
  948.       @flash_flag["normal"] = false
  949.       return
  950.     end
  951.     @action = @battle_actions.shift
  952.     @step = get_step
  953.   end
  954.   #--------------------------------------------------------------------------
  955.   # ● フレーム更新 (SEの演奏)
  956.   #--------------------------------------------------------------------------
  957.   def update_play_se
  958.     data = @action.split(/#/)[1]
  959.     data = data.split(/,/)
  960.     # SE を演奏
  961.     Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
  962.     @action = @battle_actions.shift
  963.     @step = get_step
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ● フレーム更新 (アクターアニメ固定)
  967.   #--------------------------------------------------------------------------
  968.   def update_freeze
  969.     con = @action.split(/#/)[1]
  970.     # 右手・左手を分ける
  971.     if DUAL_WEAPONS_ANIME.include?(con)
  972.       if !@first_weapon and @second_weapon
  973.         con = con + "_L"
  974.       else
  975.         con = con + "_R"
  976.       end
  977.     end
  978.     # アニメ変更
  979.     self.condition = con
  980.     @pattern = @action.split(/#/)[2].to_i
  981.     @pattern_freeze = true
  982.     @condition_freeze = true
  983.     @action = @battle_actions.shift
  984.     @step = get_step
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ● フレーム更新 (アクターアニメ固定解除)
  988.   #--------------------------------------------------------------------------
  989.   def update_freeze_lifting
  990.     @pattern_freeze = false
  991.     @condition_freeze = false
  992.     @action = @battle_actions.shift
  993.     @step = get_step
  994.   end
  995.   #--------------------------------------------------------------------------
  996.   # ● フレーム更新 (アニメーションの表示)
  997.   #--------------------------------------------------------------------------
  998.   def update_animation_start
  999.     data = @action.split(/#/)[1]
  1000.     data = data.split(/,/)
  1001.     target = data[0]
  1002.     animation_id = data[1].to_i
  1003.     if RTAB
  1004.       case target
  1005.       when "self"
  1006.         @animation.push([animation_id,true])
  1007.       when "target"
  1008.         for tar in @target
  1009.           tar.animation.push([animation_id, true])
  1010.         end
  1011.       end
  1012.     else
  1013.       case target
  1014.       when "self"
  1015.         @animation_id = animation_id
  1016.         @animation_hit = true
  1017.       when "target"
  1018.         for tar in $scene.target_battlers
  1019.           tar.animation_id = animation_id
  1020.           tar.animation_hit = true
  1021.         end
  1022.       end
  1023.     end
  1024.     @action = @battle_actions.shift
  1025.     @step = get_step
  1026.   end
  1027.   #--------------------------------------------------------------------------
  1028.   # ● フレーム更新 (動作終了)
  1029.   #--------------------------------------------------------------------------
  1030.   def update_finish
  1031.     # 動作終了
  1032.     @battler_action = false
  1033.     @step = "setup"
  1034.   end
  1035.   #--------------------------------------------------------------------------
  1036.   # ● バトラーの状態 変更(バトラーグラフィックのタイプ)
  1037.   #--------------------------------------------------------------------------
  1038.   def condition=(condition)
  1039.     return if @condition_freeze
  1040.     @battler_condition = condition
  1041.     @wait_count = ANIME[condition][2]
  1042.   end
  1043.   #--------------------------------------------------------------------------
  1044.   # ● バトラーの状態(バトラーグラフィックのタイプ)
  1045.   #--------------------------------------------------------------------------
  1046.   def condition
  1047.     return @battler_condition
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ● フレーム更新
  1051.   #--------------------------------------------------------------------------
  1052.   def update
  1053.     # ウェイト中の場合
  1054.     if @wait_count > 0
  1055.       return
  1056.     end
  1057.     # パターン更新
  1058.     self.char_animation
  1059.     # ウェイト中の場合
  1060.     if @wait_count2 > 0
  1061.       return
  1062.     end

  1063.     # 行動アニメーション
  1064.     if @battler_action
  1065.       method("update_" + @step).call
  1066.       return
  1067.     end

  1068.     # データ初期化
  1069.     @animation1_on = false
  1070.     @animation2_on = false
  1071.     @action = nil
  1072.     @battle_actions = []
  1073.     @move_wait = 0
  1074.     @move_distance = nil
  1075.     @flying_wait = 0
  1076.     @flying_distance = nil
  1077.     [url=home.php?mod=space&uid=14082]@Flash[/url] = false

  1078.     # RTAB対応
  1079.     # 通常・待機
  1080.     return self.condition = NORMAL
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # ● アクションの取得
  1084.   #--------------------------------------------------------------------------
  1085.   def get_actions
  1086.     skill = $data_skills[self.current_action.skill_id]
  1087.     item = $data_items[self.current_action.item_id]
  1088.     kind = self.current_action.kind
  1089.     # 動作取得
  1090.     @battle_actions = []
  1091.     # スキル
  1092.     if skill != nil && kind == 1
  1093.       @battle_actions = skill.battle_actions.dup
  1094.       @flying_anime = skill.flying_anime
  1095.     # アイテム
  1096.     elsif item != nil && kind == 2
  1097.       @battle_actions = item.battle_actions.dup
  1098.       @flying_anime = item.flying_anime
  1099.     # 左手攻撃
  1100.     elsif !@first_weapon and @second_weapon and (self.is_a?(Game_Actor) or (!self.is_a?(Game_Actor) and !self.nce))

  1101.       @battle_actions = self.battle_actions2.dup
  1102.       @flying_anime = self.flying_anime2
  1103.     # 右手攻撃
  1104.     elsif self.current_action.basic == 0 and
  1105.       (self.is_a?(Game_Actor) or (!self.is_a?(Game_Actor) and !self.nce)) and self.current_action.kind == 0
  1106.       @battle_actions = self.battle_actions1.dup
  1107.       @flying_anime = self.flying_anime1
  1108.     # 通常攻撃
  1109.     elsif self.current_action.basic == 0 and self.current_action.kind == 0
  1110.       # 这里啊~~ =。=b
  1111.       if !self.is_a?(Game_Actor) and !self.nce
  1112.         @battle_actions = self.battle_actions1.dup
  1113.       else
  1114.         @battle_actions = BattleActions::Actions["エネミー攻撃"].dup
  1115.       end
  1116.       @flying_anime = self.flying_anime
  1117.     else
  1118.       @battle_actions = ["終了"]
  1119.       @flying_anime = [0,0,false,false]
  1120.     end
  1121.   end
  1122.   #--------------------------------------------------------------------------
  1123.   # ● ループしないアニメのセット
  1124.   #--------------------------------------------------------------------------
  1125.   def anime_on
  1126.     @pattern = 0
  1127.     @pattern_log = true
  1128.     return
  1129.   end
  1130.   #--------------------------------------------------------------------------
  1131.   # ● パターン更新
  1132.   #--------------------------------------------------------------------------
  1133.   def char_animation
  1134.     # パタン固定の場合もどる
  1135.     return if @pattern_freeze
  1136.     # ループしないアニメの場合 1234 で止まる
  1137.     if !ANIME[@battler_condition][1] && @pattern == 3
  1138.       return
  1139.     end
  1140.     # アニメさせない場合 1 で止まる
  1141.     if ANIME[@battler_condition][4]
  1142.       @pattern = 0
  1143.       return
  1144.     end
  1145.     @pattern = (@pattern + 1) % 4
  1146.   end
  1147.   #--------------------------------------------------------------------------
  1148.   # ● アニメタイプ
  1149.   #--------------------------------------------------------------------------
  1150.   def anime_type
  1151.     return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
  1152.   end
  1153. end
  1154. #==============================================================================
  1155. # ■ Game_Actor
  1156. #==============================================================================
  1157. class Game_Actor < Game_Battler
  1158.   include Side_view
  1159.   #--------------------------------------------------------------------------
  1160.   # ● セットアップ
  1161.   #--------------------------------------------------------------------------
  1162.   alias side_view_setup setup
  1163.   def setup(actor_id)
  1164.     side_view_setup(actor_id)
  1165.     start_battle
  1166.   end
  1167.   #--------------------------------------------------------------------------
  1168.   # ● 二刀武器のID取得 ※エラー回避用
  1169.   #--------------------------------------------------------------------------
  1170.   def weapon2_id
  1171.     return @weapon2_id != nil ? @weapon2_id : 0
  1172.   end
  1173.   #--------------------------------------------------------------------------
  1174.   # ● X方向 ポジション 取得 (陣形スクリプト拡張用)
  1175.   #--------------------------------------------------------------------------
  1176.   def position
  1177.     return $data_classes[@class_id].position
  1178.   end
  1179.   #--------------------------------------------------------------------------
  1180.   # ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
  1181.   #--------------------------------------------------------------------------
  1182.   def position2
  1183.     return self.index
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ● 武器アニメタイプ
  1187.   #--------------------------------------------------------------------------
  1188.   def weapon_anime_type(type)
  1189.     file_name  = weapon_anime_type0(type)
  1190.     visible   = weapon_anime_type1(type)
  1191.     z         = weapon_anime_type2(type)
  1192.     return [file_name,visible,z]
  1193.   end
  1194.   # 武器アイコン取得
  1195.   def weapon_anime_type0(type)
  1196.     type = ANIME[type][5]
  1197.     return weapon_anime1 if type == "右手"
  1198.     return weapon_anime2 if type == "左手"
  1199.     return nil
  1200.   end
  1201.   # 表示・非表示の取得
  1202.   def weapon_anime_type1(type)
  1203.     return ANIME[type][3]
  1204.   end
  1205.   # バトラーより上に表示するかどうか
  1206.   def weapon_anime_type2(type)
  1207.     type = ANIME[type][5]
  1208.     return true if type == "左手"
  1209.     return false
  1210.   end
  1211.   #--------------------------------------------------------------------------
  1212.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1213.   #--------------------------------------------------------------------------
  1214.   def true_x
  1215.     return PARTY_X + position * FORMATION_X + @ox
  1216.   end
  1217.   #--------------------------------------------------------------------------
  1218.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1219.   #--------------------------------------------------------------------------
  1220.   def true_y
  1221.     # パーティ内の並び順から Y 座標を計算して返す
  1222.     if self.index != nil
  1223.       y = position2 * FORMATION_Y + PARTY_Y + @oy - [url=home.php?mod=space&uid=291977]@height[/url] / 2
  1224.       return y
  1225.     else
  1226.       return 0
  1227.     end
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● バトル画面 X 座標の取得
  1231.   #--------------------------------------------------------------------------
  1232.   def screen_x(true_x = self.true_x)
  1233.     return 320 + (true_x - 320) * @real_zoom + @real_x
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● バトル画面 Y 座標の取得
  1237.   #--------------------------------------------------------------------------
  1238.   def screen_y(true_y = self.true_y)
  1239.     return true_y * @real_zoom + @real_y
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # ● バトル画面 Z 座標の取得
  1243.   #--------------------------------------------------------------------------
  1244.   def screen_z
  1245.     return screen_y + 1000
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1249.   #--------------------------------------------------------------------------
  1250.   def base_x
  1251.     return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
  1252.   end
  1253.   #--------------------------------------------------------------------------
  1254.   # ● バトル画面 Y 座標の取得
  1255.   #--------------------------------------------------------------------------
  1256.   def base_y
  1257.     return (true_y - @oy) * @real_zoom + @real_y
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # ● バトル画面 拡大率の取得
  1261.   #--------------------------------------------------------------------------
  1262.   def zoom
  1263.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  1264.                           (true_x + @fly) / 480 + $scene.zoom_rate[0]
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● 攻撃用、バトル画面 X 座標の取得
  1268.   #--------------------------------------------------------------------------
  1269.   def attack_x(z)
  1270.     return (320 - true_x) * z * 0.75
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # ● 攻撃用、バトル画面 Y 座標の取得
  1274.   #--------------------------------------------------------------------------
  1275.   def attack_y(z)
  1276.     return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # ● 閃き待ち時間
  1280.   #--------------------------------------------------------------------------
  1281.   def flash_duration
  1282.     return $scene.flash_duration
  1283.   end
  1284.   #--------------------------------------------------------------------------
  1285.   # ● アニメーション取得
  1286.   #--------------------------------------------------------------------------
  1287.   def battle_actions1
  1288.     weapon = $data_weapons[@weapon_id]
  1289.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1290.   end
  1291.   #--------------------------------------------------------------------------
  1292.   # ● アニメーション取得
  1293.   #--------------------------------------------------------------------------
  1294.   def battle_actions2
  1295.     weapon = $data_weapons[@weapon2_id]
  1296.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1297.   end
  1298.   #--------------------------------------------------------------------------
  1299.   # ● 武器アニメーション取得
  1300.   #--------------------------------------------------------------------------
  1301.   def weapon_anime1
  1302.     weapon = $data_weapons[@weapon_id]
  1303.     return weapon != nil ? weapon.icon_name : ""
  1304.   end
  1305.   #--------------------------------------------------------------------------
  1306.   # ● 武器アニメーション取得
  1307.   #--------------------------------------------------------------------------
  1308.   def weapon_anime2
  1309.     weapon = $data_weapons[@weapon2_id]
  1310.     return weapon != nil ? weapon.icon_name : ""
  1311.   end
  1312.   #--------------------------------------------------------------------------
  1313.   # ● 遠距離アニメーション取得
  1314.   #--------------------------------------------------------------------------
  1315.   def flying_anime1
  1316.     weapon = $data_weapons[@weapon_id]
  1317.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1318.   end
  1319.   #--------------------------------------------------------------------------
  1320.   # ● 遠距離アニメーション取得
  1321.   #--------------------------------------------------------------------------
  1322.   def flying_anime2
  1323.     weapon = $data_weapons[@weapon2_id]
  1324.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ● 移動目標座標の計算
  1328.   #--------------------------------------------------------------------------
  1329.   def move_setup
  1330.     if RTAB
  1331.       targets = @target
  1332.     else
  1333.       targets = $scene.target_battlers
  1334.     end
  1335.     case @move_action[0]
  1336.     when "self" # 自分
  1337.       @target_x = self.base_x
  1338.       @target_y = self.base_y
  1339.     when "target_near" # 一番近くのターゲット
  1340.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1341.       targets.reverse!
  1342.       if targets != []
  1343.         @target_x = targets[0].screen_x
  1344.         @target_y = targets[0].screen_y
  1345.       else
  1346.         @target_x = self.base_x
  1347.         @target_y = self.base_y
  1348.       end
  1349.     when "target_far" # 一番遠くのターゲット
  1350.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1351.       if targets != []
  1352.         @target_x = targets[0].screen_x
  1353.         @target_y = targets[0].screen_y
  1354.       else
  1355.         @target_x = self.base_x
  1356.         @target_y = self.base_y
  1357.       end
  1358.     when "target" # ターゲット中央
  1359.       @target_x = 0
  1360.       @target_y = 0
  1361.       for t in targets
  1362.         @target_x += t.screen_x
  1363.         @target_y += t.screen_y
  1364.       end
  1365.       if targets != []
  1366.         @target_x /= targets.size
  1367.         @target_y /= targets.size
  1368.       end
  1369.     when "troop" # "トループ中央"
  1370.       @target_x = 0
  1371.       @target_y = 0
  1372.       for t in $game_troop.enemies
  1373.         @target_x += t.screen_x
  1374.         @target_y += t.screen_y
  1375.       end
  1376.       if $game_troop.enemies != []
  1377.         @target_x /= $game_troop.enemies.size
  1378.         @target_y /= $game_troop.enemies.size
  1379.       end
  1380.     when "party" # "パーティ中央"
  1381.       @target_x = 0
  1382.       @target_y = 0
  1383.       for t in $game_party.actors
  1384.         @target_x += t.screen_x
  1385.         @target_y += t.screen_y
  1386.       end
  1387.       if $game_party.actors != []
  1388.         @target_x /= $game_party.actors.size
  1389.         @target_y /= $game_party.actors.size
  1390.       end
  1391.     when "screen" # "画面"
  1392.       @target_x = self.base_x
  1393.       @target_y = self.base_y
  1394.     end
  1395.     # 補正
  1396.     @target_x += @move_action[1] - self.base_x
  1397.     @target_y += @move_action[2] - self.base_y
  1398.     # 移動目標の座標をセット
  1399.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1400.     # 距離の計算(ウエイトの設定)
  1401.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1402.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1403.   end
  1404. end
  1405. #==============================================================================
  1406. # ■ Game_Enemy
  1407. #==============================================================================
  1408. class Game_Enemy < Game_Battler
  1409.   attr_reader   :nce
  1410.   #--------------------------------------------------------------------------
  1411.   # ● セットアップ
  1412.   #--------------------------------------------------------------------------
  1413.   alias side_view_initialize initialize
  1414.   def initialize(troop_id, member_index)
  1415.     side_view_initialize(troop_id, member_index)
  1416.     start_battle
  1417.     @nce = NOT_CHARACTER_EMEMY.include? @enemy_id
  1418.     @weapon_id  = EMEMY_WEAPO[@enemy_id] != nil ? EMEMY_WEAPO[@enemy_id] : 0
  1419.     @weapon_id2  = EMEMY_WEAPO2[@enemy_id] != nil ? EMEMY_WEAPO2[@enemy_id] : 0
  1420.   end
  1421.   def character_name
  1422.     return self.battler_name
  1423.   end
  1424.   def character_hue
  1425.     return self.battler_hue
  1426.   end
  1427.   #--------------------------------------------------------------------------
  1428.   # ● 移動
  1429.   #--------------------------------------------------------------------------
  1430.   def move
  1431.     # 距離の計算
  1432.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1433.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1434.     if @move_distance > 0
  1435.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  1436.       array = @move_coordinates
  1437.       # ジャンプ補正値の計算
  1438.       if @move_distance - @move_wait > @move_distance / 2
  1439.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2        
  1440.       else
  1441.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  1442.       end
  1443.       jump = @move_action[4] > 0 ? -jump : jump
  1444.       jump = 0 if @weapon_id + @weapon_id2 == 0
  1445.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  1446.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  1447.       # ウエイト
  1448.       @move_wait -= @move_action[3]
  1449.       @move_wait = [@move_wait,0].max
  1450.     end
  1451.   end
  1452.   #--------------------------------------------------------------------------
  1453.   # ● 武器アニメタイプ
  1454.   #--------------------------------------------------------------------------
  1455.   def weapon_anime_type(type)
  1456.     file_name  = weapon_anime_type0(type)
  1457.     visible   = weapon_anime_type1(type)
  1458.     z         = weapon_anime_type2(type)
  1459.     return [file_name,visible,z]
  1460.   end
  1461.   # 武器アイコン取得
  1462.   def weapon_anime_type0(type)
  1463.     type = ANIME[type][5]
  1464.     return weapon_anime1 if type == "右手"
  1465.     return weapon_anime2 if type == "左手"
  1466.     return nil
  1467.   end
  1468.   # 表示・非表示の取得
  1469.   def weapon_anime_type1(type)
  1470.     return ANIME[type][3]
  1471.   end
  1472.   # バトラーより上に表示するかどうか
  1473.   def weapon_anime_type2(type)
  1474.     type = ANIME[type][5]
  1475.     return true if type == "左手"
  1476.     return false
  1477.   end

  1478.   #--------------------------------------------------------------------------
  1479.   # ● 移動目標座標の計算
  1480.   #--------------------------------------------------------------------------
  1481.   def move_setup
  1482.     if RTAB
  1483.       targets = @target
  1484.     else
  1485.       targets = $scene.target_battlers
  1486.     end
  1487.     case @move_action[0]
  1488.     when "self" # 自分
  1489.       @target_x = self.base_x
  1490.       @target_y = self.base_y
  1491.     when "target_near" # 一番近くのターゲット
  1492.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1493.       if targets != []
  1494.         @target_x = targets[0].screen_x
  1495.         @target_y = targets[0].screen_y
  1496.       else
  1497.         @target_x = self.base_x
  1498.         @target_y = self.base_y
  1499.       end
  1500.     when "target_far" # 一番遠くのターゲット
  1501.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1502.       targets.reverse!
  1503.       if targets != []
  1504.         @target_x = targets[0].screen_x
  1505.         @target_y = targets[0].screen_y
  1506.       else
  1507.         @target_x = self.base_x
  1508.         @target_y = self.base_y
  1509.       end
  1510.     when "target" # ターゲット中央
  1511.       @target_x = 0
  1512.       @target_y = 0
  1513.       for t in targets
  1514.         @target_x += t.screen_x
  1515.         @target_y += t.screen_y
  1516.       end
  1517.       if targets != []
  1518.         @target_x /= targets.size
  1519.         @target_y /= targets.size
  1520.       end
  1521.     when  "party" # "トループ中央"
  1522.       @target_x = 0
  1523.       @target_y = 0
  1524.       for t in $game_troop.enemies
  1525.         @target_x += t.screen_x
  1526.         @target_y += t.screen_y
  1527.       end
  1528.       if $game_troop.enemies != []
  1529.         @target_x /= $game_troop.enemies.size
  1530.         @target_y /= $game_troop.enemies.size
  1531.       end
  1532.     when "troop" # "パーティ中央"
  1533.       @target_x = 0
  1534.       @target_y = 0
  1535.       for t in $game_party.actors
  1536.         @target_x += t.screen_x
  1537.         @target_y += t.screen_y
  1538.       end
  1539.       if $game_party.actors != []
  1540.         @target_x /= $game_party.actors.size
  1541.         @target_y /= $game_party.actors.size
  1542.       end
  1543.     when "screen" # "画面"
  1544.       @target_x = self.base_x
  1545.       @target_y = self.base_y
  1546.     end
  1547.     # 補正
  1548.     @target_x -= @move_action[1] + self.base_x
  1549.     @target_y -= @move_action[2] + self.base_y
  1550.     # 移動目標の座標をセット
  1551.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1552.     # 距離の計算(ウエイトの設定)
  1553.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1554.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1555.   end
  1556.   if RTAB
  1557.   alias original_x true_x
  1558.   alias original_y true_y
  1559.   else
  1560.   alias original_x screen_x
  1561.   alias original_y screen_y
  1562.   end
  1563.   #--------------------------------------------------------------------------
  1564.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1565.   #--------------------------------------------------------------------------
  1566.   def true_x
  1567.     return original_x + @ox
  1568.   end
  1569.   #--------------------------------------------------------------------------
  1570.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1571.   #--------------------------------------------------------------------------
  1572.   def true_y
  1573.     return original_y - @height / 2 + @oy
  1574.   end
  1575.   #--------------------------------------------------------------------------
  1576.   # ● バトル画面 X 座標の取得
  1577.   #--------------------------------------------------------------------------
  1578.   def screen_x(true_x = self.true_x)
  1579.     return true_x * @real_zoom + @real_x
  1580.   end
  1581.   #--------------------------------------------------------------------------
  1582.   # ● バトル画面 Y 座標の取得
  1583.   #--------------------------------------------------------------------------
  1584.   def screen_y(true_y = self.true_y)
  1585.     return true_y * @real_zoom + @real_y
  1586.   end
  1587.   #--------------------------------------------------------------------------
  1588.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1589.   #--------------------------------------------------------------------------
  1590.   def base_x(true_x = self.true_x)
  1591.     return (true_x - @ox) * @real_zoom + @real_x
  1592.   end
  1593.   #--------------------------------------------------------------------------
  1594.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  1595.   #--------------------------------------------------------------------------
  1596.   # ● アニメーション取得
  1597.   #--------------------------------------------------------------------------
  1598.   def battle_actions1
  1599.     weapon = $data_weapons[@weapon_id]
  1600.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1601.   end
  1602.   #--------------------------------------------------------------------------
  1603.   # ● アニメーション取得
  1604.   #--------------------------------------------------------------------------
  1605.   def battle_actions2
  1606.     weapon = $data_weapons[@weapon2_id]
  1607.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1608.   end
  1609.   #--------------------------------------------------------------------------
  1610.   # ● 武器アニメーション取得
  1611.   #--------------------------------------------------------------------------
  1612.   def weapon_anime1
  1613.     weapon = $data_weapons[@weapon_id]
  1614.     return weapon != nil ? weapon.icon_name : ""
  1615.   end
  1616.   #--------------------------------------------------------------------------
  1617.   # ● 武器アニメーション取得
  1618.   #--------------------------------------------------------------------------
  1619.   def weapon_anime2
  1620.     weapon = $data_weapons[@weapon2_id]
  1621.     return weapon != nil ? weapon.icon_name : ""
  1622.   end
  1623.   #--------------------------------------------------------------------------
  1624.   # ● 遠距離アニメーション取得
  1625.   #--------------------------------------------------------------------------
  1626.   def flying_anime1
  1627.     weapon = $data_weapons[@weapon_id]
  1628.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # ● 遠距離アニメーション取得
  1632.   #--------------------------------------------------------------------------
  1633.   def flying_anime2
  1634.     weapon = $data_weapons[@weapon2_id]
  1635.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1636.   end
  1637.   def base_y(true_y = self.true_y)
  1638.     return (true_y - @oy) * @real_zoom + @real_y
  1639.   end
  1640.   #--------------------------------------------------------------------------



  1641.   #--------------------------------------------------------------------------
  1642.   # ● アニメーション取得
  1643.   #--------------------------------------------------------------------------
  1644.   def battle_actions1
  1645.     weapon = $data_weapons[@weapon_id]
  1646.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1647.   end
  1648.   #--------------------------------------------------------------------------
  1649.   # ● アニメーション取得
  1650.   #--------------------------------------------------------------------------
  1651.   def battle_actions2
  1652.     weapon = $data_weapons[@weapon2_id]
  1653.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1654.   end
  1655.   #--------------------------------------------------------------------------
  1656.   # ● 武器アニメーション取得
  1657.   #--------------------------------------------------------------------------
  1658.   def weapon_anime1
  1659.     weapon = $data_weapons[@weapon_id]
  1660.     return weapon != nil ? weapon.icon_name : ""
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● 武器アニメーション取得
  1664.   #--------------------------------------------------------------------------
  1665.   def weapon_anime2
  1666.     weapon = $data_weapons[@weapon2_id]
  1667.     return weapon != nil ? weapon.icon_name : ""
  1668.   end
  1669.   #--------------------------------------------------------------------------
  1670.   # ● 遠距離アニメーション取得
  1671.   #--------------------------------------------------------------------------
  1672.   def flying_anime1
  1673.     weapon = $data_weapons[@weapon_id]
  1674.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1675.   end
  1676.   #--------------------------------------------------------------------------
  1677.   # ● 遠距離アニメーション取得
  1678.   #--------------------------------------------------------------------------
  1679.   def flying_anime2
  1680.     weapon = $data_weapons[@weapon2_id]
  1681.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1682.   end  
  1683. end
  1684. #==============================================================================
  1685. # ■ Game_Party
  1686. #==============================================================================
  1687. class Game_Party
  1688.   #--------------------------------------------------------------------------
  1689.   # ● アクターを加える
  1690.   #     actor_id : アクター ID
  1691.   #--------------------------------------------------------------------------
  1692.   alias side_view_add_actor add_actor
  1693.   def add_actor(actor_id)
  1694.     # アクターを取得
  1695.     actor = $game_actors[actor_id]
  1696.     # サイドビューデータの初期化
  1697.     actor.start_battle
  1698.     # 戻す
  1699.     side_view_add_actor(actor_id)
  1700.   end
  1701. end

  1702. class Spriteset_Battle
  1703.   include Side_view
  1704.   #--------------------------------------------------------------------------
  1705.   # ● オブジェクト初期化
  1706.   #--------------------------------------------------------------------------
  1707.   alias side_veiw_initialize initialize
  1708.   def initialize
  1709.     side_veiw_initialize
  1710.     # アクタースプライトを解放
  1711.     for sprite in @actor_sprites
  1712.       sprite.dispose
  1713.     end
  1714.     # アクタースプライトを作成
  1715.     @actor_sprites = []
  1716.     for i in 1..Party_max
  1717.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1718.     end
  1719.     update
  1720.   end
  1721.   #--------------------------------------------------------------------------
  1722.   # ● 画面のスクロール
  1723.   #--------------------------------------------------------------------------
  1724.   if method_defined?("screen_scroll")
  1725.   alias side_view_screen_scroll screen_scroll
  1726.   def screen_scroll
  1727.     side_view_screen_scroll
  1728.     # アクターの位置補正
  1729.     for actor in $game_party.actors
  1730.       actor.real_x = @real_x
  1731.       actor.real_y = @real_y
  1732.       actor.real_zoom = @real_zoom
  1733.     end
  1734.   end
  1735.   end
  1736. end

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

  2291. #==============================================================================
  2292. # ■ Sprite_Weapon
  2293. #------------------------------------------------------------------------------
  2294. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2295. # スプライトの状態を自動的に変化させます。
  2296. #==============================================================================

  2297. class Sprite_Weapon < RPG::Sprite
  2298.   include Side_view
  2299.   #--------------------------------------------------------------------------
  2300.   # ● 公開インスタンス変数
  2301.   #--------------------------------------------------------------------------
  2302.   attr_accessor :battler                  # バトラー
  2303.   attr_reader   :cw                       # グラフィックの幅
  2304.   attr_reader   :ch                       # グラフィックの高さ
  2305.   #--------------------------------------------------------------------------
  2306.   # ● オブジェクト初期化
  2307.   #     viewport : ビューポート
  2308.   #     battler  : バトラー (Game_Battler)
  2309.   #--------------------------------------------------------------------------
  2310.   def initialize(viewport, battler = nil)
  2311.     super(viewport)
  2312.     @battler = battler
  2313.     @battler_visible = false
  2314.   end
  2315.   #--------------------------------------------------------------------------
  2316.   # ● 解放
  2317.   #--------------------------------------------------------------------------
  2318.   def dispose
  2319.     if self.bitmap != nil
  2320.       self.bitmap.dispose
  2321.     end
  2322.     super
  2323.   end
  2324.   #--------------------------------------------------------------------------
  2325.   # ● フレーム更新
  2326.   #--------------------------------------------------------------------------
  2327.   def update
  2328.     super
  2329.     # バトラーが nil の場合
  2330.     if @battler == nil or (!@battler.is_a?(Game_Actor) and @battler.nce)
  2331.       self.bitmap = nil
  2332.       return
  2333.     end
  2334.     # ウエポンアニメのデータ取得
  2335.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  2336.     # 設定が「非表示」の場合
  2337.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  2338.       self.visible = false
  2339.       return
  2340.     else
  2341.       self.visible = true
  2342.     end
  2343.     # ファイル名が現在のものと異なる場合
  2344.     if @weapon_anime_type[0] != @weapon_name
  2345.       @weapon_name = @weapon_anime_type[0]
  2346.       # ビットマップを取得、設定
  2347.       self.bitmap = RPG::Cache.icon(@weapon_name)
  2348.       @width = bitmap.width
  2349.       @height = bitmap.height
  2350.       @flag = true
  2351.     end
  2352.     # 現在アニメパターンが現在のものと異なる場合
  2353.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  2354.       @pattern = @battler.pattern
  2355.       @condition = @battler.condition
  2356.       self.ox = @width
  2357.       self.oy = @height
  2358.       self.z = battler.screen_z
  2359.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  2360.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  2361.       self.src_rect.set(0, 0, @width, @height)
  2362.       self.opacity = 255
  2363.       # バトラーより手前に表示
  2364.       if @weapon_anime_type[2]
  2365.         self.z += 10
  2366.       # バトラーより奥に表示
  2367.       else
  2368.         self.z -= 10
  2369.       end
  2370.       @flag = false
  2371.     end
  2372.   end
  2373. end

  2374. #==============================================================================
  2375. # ■ Sprite_Flying
  2376. #------------------------------------------------------------------------------
  2377. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2378. # スプライトの状態を自動的に変化させます。
  2379. #==============================================================================

  2380. class Sprite_Flying < RPG::Sprite
  2381.   include Side_view
  2382.   #--------------------------------------------------------------------------
  2383.   # ● 公開インスタンス変数
  2384.   #--------------------------------------------------------------------------
  2385.   attr_accessor :battler                  # バトラー
  2386.   #--------------------------------------------------------------------------
  2387.   # ● オブジェクト初期化
  2388.   #     viewport : ビューポート
  2389.   #     battler  : バトラー (Game_Battler)
  2390.   #--------------------------------------------------------------------------
  2391.   def initialize(viewport, battler = nil)
  2392.     super(viewport)
  2393.     @battler = battler
  2394.     @battler_visible = false
  2395.   end
  2396.   #--------------------------------------------------------------------------
  2397.   # ● 解放
  2398.   #--------------------------------------------------------------------------
  2399.   def dispose
  2400.     if self.bitmap != nil
  2401.       self.bitmap.dispose
  2402.     end
  2403.     super
  2404.   end
  2405.   #--------------------------------------------------------------------------
  2406.   # ● フレーム更新
  2407.   #--------------------------------------------------------------------------
  2408.   def update
  2409.     super
  2410.     # バトラーが nil の場合
  2411.     if @battler == nil
  2412.       self.bitmap = nil
  2413.       loop_animation(nil)
  2414.       return
  2415.     end
  2416.     # 遠距離アニメ
  2417.     flying_animation = @battler.flying_animation
  2418.     flying_start = flying_animation[0]
  2419.     flying_end   = flying_animation[1]
  2420.     # アニメーション ID が現在のものと異なる場合
  2421.     if @anime_id != @battler.flying_anime[0]
  2422.       @anime_id = @battler.flying_anime[0]
  2423.       @animation = $data_animations[@anime_id]
  2424.     end
  2425.     # アニメーション 開始
  2426.     if flying_start
  2427.       loop_animation(@animation)
  2428.     elsif flying_end
  2429.       loop_animation(nil)
  2430.     end
  2431.     self.x = @battler.flying_x
  2432.     self.y = @battler.flying_y
  2433.     self.z = @battler.screen_z + 1000
  2434.   end
  2435. end

  2436. module RPG
  2437.   class Skill
  2438.     #--------------------------------------------------------------------------
  2439.     # ● 魔法かどうかの判断
  2440.     #--------------------------------------------------------------------------
  2441.     def magic?
  2442.       if @atk_f == 0
  2443.         return true
  2444.       else
  2445.         return false
  2446.       end
  2447.     end
  2448.   end
  2449. end

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

  2451. class Arrow_Actor < Arrow_Base
  2452.   include Side_view
  2453.   #--------------------------------------------------------------------------
  2454.   # ● フレーム更新
  2455.   #--------------------------------------------------------------------------
  2456.   alias side_view_update update
  2457.   def update
  2458.     side_view_update
  2459.     # スプライトの座標を設定
  2460.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  2461.       self.x = self.actor.screen_x + ARROW_OX
  2462.       self.y = self.actor.screen_y + ARROW_OY
  2463.     end
  2464.   end
  2465. end
  2466. class Arrow_Enemy < Arrow_Base
  2467.   include Side_view
  2468.   #--------------------------------------------------------------------------
  2469.   # ● フレーム更新
  2470.   #--------------------------------------------------------------------------
  2471.   alias side_view_update update
  2472.   def update
  2473.     side_view_update
  2474.     # スプライトの座標を設定
  2475.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  2476.       self.x = self.enemy.screen_x
  2477.       self.y = self.enemy.screen_y + self.enemy.height/2
  2478.     end
  2479.   end
  2480. end
  2481. module Rtab_use
  2482.   def update_phase4_step3(battler)
  2483.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2484.     case battler.current_action.kind
  2485.     when 0  # 基本
  2486.       if battler.current_action.basic == 1
  2487.         @help_window.set_text($data_system.words.guard, 1)
  2488.         @help_wait = @help_time
  2489.       end
  2490.       if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  2491.         @help_window.set_text("逃げる", 1)
  2492.         @help_wait = @help_time
  2493.       end
  2494.     when 1  # スキル
  2495.       skill =  $data_skills[battler.current_action.skill_id]
  2496.       @help_window.set_text(skill.name, 1)
  2497.       @help_wait = @help_time
  2498.     when 2  # アイテム
  2499.       item = $data_items[battler.current_action.item_id]
  2500.       @help_window.set_text(item.name, 1)
  2501.       @help_wait = @help_time
  2502.     end
  2503.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2504.     if battler.anime1 == 0
  2505.       battler.white_flash = true
  2506.       battler.wait = 5
  2507.       # カメラ設定
  2508.       if battler.target[0].is_a?(Game_Enemy)
  2509.         camera_set(battler)
  2510.       end
  2511.     else
  2512.       battler.animation.push([battler.anime1, true])
  2513.       speller = synthe?(battler)
  2514.       if speller != nil
  2515.         for spell in speller
  2516.           if spell != battler
  2517.             if spell.current_action.spell_id == 0
  2518.               spell.animation.push([battler.anime1, true])
  2519.             else
  2520.               skill = spell.current_action.spell_id
  2521.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2522.               spell.current_action.spell_id = 0
  2523.             end
  2524.           end
  2525.         end
  2526.       end
  2527.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2528.       battler.anime1 = 0
  2529.     end
  2530.     # ステップ 4 に移行
  2531.     battler.phase = 4 if !(!battler.animation1_on and battler.action? and !battler.flash?)
  2532.   end
  2533. end

  2534. #==============================================================================
  2535. # ■ Scene_Battle
  2536. #==============================================================================
  2537. class Scene_Battle
  2538.   include Side_view
  2539.   include Rtab_use if RTAB
  2540.   #--------------------------------------------------------------------------
  2541.   # ● 公開インスタンス変数
  2542.   #--------------------------------------------------------------------------
  2543.   attr_reader   :phase            # フェーズ
  2544.   attr_reader   :phase4_step      # フェーズ4ステップ
  2545.   attr_reader   :active_battler   # 対象の配列
  2546.   attr_reader   :target_battlers  # 対象の配列
  2547.   attr_reader   :animation1_id    # 行動アニメID
  2548.   attr_reader   :animation2_id    # 対象アニメID
  2549.   #--------------------------------------------------------------------------
  2550.   # ● メイン処理
  2551.   #--------------------------------------------------------------------------
  2552.   alias side_view_main main
  2553.   def main
  2554.     # バトラー初期化
  2555.     for battler in $game_party.actors + $game_troop.enemies
  2556.       battler.start_battle
  2557.     end
  2558.     # 戻す
  2559.     side_view_main
  2560.   end
  2561.   #--------------------------------------------------------------------------
  2562.   # ● 閃き判定
  2563.   #--------------------------------------------------------------------------
  2564.   def flash?
  2565.     return @flash_flag ? true : false
  2566.   end  
  2567.   #--------------------------------------------------------------------------
  2568.   # ● 閃きアニメ待ち時間取得
  2569.   #--------------------------------------------------------------------------
  2570.   def flash_duration
  2571.     animation = nil
  2572.     if FLASH_ANIME
  2573.       animation = $data_animations[FLASH_ANIMATION_ID]
  2574.     end
  2575.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  2576.   end
  2577.   #--------------------------------------------------------------------------
  2578.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  2579.   #--------------------------------------------------------------------------
  2580.   alias side_view_update_phase4_step2 update_phase4_step2
  2581.   def update_phase4_step2(*arg)
  2582.     battler = convert_battler2(*arg)
  2583.     battler.action
  2584.     side_view_update_phase4_step2(*arg)
  2585.   end
  2586.   #--------------------------------------------------------------------------
  2587.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2588.   #--------------------------------------------------------------------------
  2589.   alias side_view_update_phase4_step3 update_phase4_step3
  2590.   def update_phase4_step3(*arg)
  2591.     battler = convert_battler2(*arg)
  2592.     if battler.flash? and FLASH_ANIME
  2593.       battler.flash_flag["normal"] = true
  2594.     end
  2595.     side_view_update_phase4_step3(*arg)
  2596.   end
  2597.   #--------------------------------------------------------------------------
  2598.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2599.   #--------------------------------------------------------------------------
  2600.   alias side_view_update_phase4_step4 update_phase4_step4
  2601.   def update_phase4_step4(*arg)
  2602.     battler = convert_battler2(*arg)
  2603.     targets = RTAB ? battler.target : @target_battlers
  2604.     return if !battler.animation2_on and battler.action? if !RTAB
  2605.     side_view_update_phase4_step4(*arg)
  2606.     for target in targets
  2607.       if RTAB
  2608.         value = nil
  2609.         if target.damage_sp.include?(battler)
  2610.           value = target.damage_sp[battler]
  2611.         end
  2612.         if target.damage.include?(battler)
  2613.           if value == nil or value == "Miss"
  2614.             value = target.damage[battler]
  2615.           elsif value.is_a?(Numeric) && value > 0
  2616.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  2617.           end
  2618.         end
  2619.       else
  2620.         value = target.damage
  2621.       end
  2622.       if target.is_a?(Game_Actor)
  2623.         # ダメージの場合
  2624.         if value.is_a?(Numeric) && value > 0
  2625.           # シェイクを開始
  2626.           target.shake = true
  2627.         end
  2628.       elsif target.is_a?(Game_Enemy)
  2629.         # ダメージの場合
  2630.         if value.is_a?(Numeric) && value > 0
  2631.           # シェイクを開始
  2632.           target.shake = true
  2633.         end
  2634.       end
  2635.     end
  2636.   end
  2637.   #--------------------------------------------------------------------------
  2638.   # ● プレバトルフェーズ開始
  2639.   #--------------------------------------------------------------------------
  2640.   alias start_phase1_correct start_phase1
  2641.   def start_phase1
  2642.     # カメラの設定
  2643.     # 元々フロントビュー向けの数値になっているため
  2644.     @zoom_rate = [1.0, 1.0]
  2645.     start_phase1_correct
  2646.   end
  2647.   #--------------------------------------------------------------------------
  2648.   # ● アクターコマンドフェーズ開始
  2649.   #--------------------------------------------------------------------------
  2650.   alias start_phase3_correct start_phase3
  2651.   def start_phase3
  2652.     battler = convert_battler
  2653.     start_phase3_correct
  2654.     if RTAB
  2655.       # カメラの設定
  2656.       # 元々フロントビュー向けの数値になっているため
  2657.       @camera = "command"
  2658. #      @spriteset.screen_target(0, 0, 1.0)
  2659.     end
  2660.   end


  2661.   def action_phase(battler)
  2662.     # action が 1 の場合、バトラーが行動中かどうか確認
  2663.     if @action == 1 and battler.phase < 3
  2664.       for target in battler.target
  2665.         speller = synthe?(target)
  2666.         if speller == nil
  2667.           # ターゲットが通常行動中の場合
  2668.           if @action_battlers.include?(target)
  2669.             if target.phase > 2
  2670.               return
  2671.             end
  2672.           end
  2673.         else
  2674.           # ターゲットが連携スキル発動中の場合
  2675.           for spell in speller
  2676.             if @action_battlers.include?(spell)
  2677.               if spell.phase > 2
  2678.                 return
  2679.               end
  2680.             end
  2681.           end
  2682.         end
  2683.       end
  2684.     end
  2685. case battler.phase
  2686.   when 1
  2687.     update_phase4_step1(battler)
  2688.   when 2
  2689.     update_phase4_step2(battler)
  2690.   when 3  
  2691.     update_phase4_step3(battler) if !(!battler.animation1_on and battler.action? and !battler.flash?)
  2692.   when 4
  2693.     update_phase4_step4(battler) if !(!battler.animation2_on and battler.action?)
  2694.   when 5
  2695.     update_phase4_step5(battler)
  2696.   when 6
  2697.     update_phase4_step6(battler)
  2698.   end
  2699. end
  2700. end
复制代码


  
QQ截图20141204215149.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部