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

Project1

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

[已经过期] 求高人解决。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
49
在线时间
124 小时
注册时间
2012-3-20
帖子
19
跳转到指定楼层
1
发表于 2012-9-8 18:22:06 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 54792798 于 2012-9-9 14:29 编辑

我修改了这个脚本
  1. =begin
  2. ###############################################################################

  3. 全局行走图战斗 v1.1
  4. 本版本只经低测试,可能存在某些bug。
  5. 请注意更新
  6. http://rpg.blue/viewthread.php?tid=129875&extra=page%3D1

  7. ###############################################################################
  8. ------------------------------------------------------------------------------
  9. 经过了两次的修改,终于完全实现了远距离攻击的效果(弓箭、铳类)
  10. 另外,也实现了简单的回旋攻击(类似回力镖的攻击)和攻击道具(类似石头或炸弹)

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

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

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

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

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

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

  46. =end                                                        #modify by darkten

  47. ###############################################################################

  48. =begin

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

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

  56.                                                                   by ONEWateR
  57. =end
  58. ###############################################################################
  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.0
  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 = 15  # 各个角色之间的间隔 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.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  131.   ANIME.default = [1,false,12,false,"",""]
  132.   
  133.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  134.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  135.   DUAL_WEAPONS_ANIME = [ATTACK]
  136.   
  137.   
  138.   #--------------------------------------------------------------------------
  139.   # ● 战斗图不是行走图的敌人编号
  140.   #--------------------------------------------------------------------------
  141.   NOT_CHARACTER_EMEMY = [3]
  142.   #--------------------------------------------------------------------------
  143.   # ● 敌人使用的武器
  144.   #    敌人编号=>武器编号
  145.   #--------------------------------------------------------------------------
  146.   EMEMY_WEAPO = {2=>1,7=>17}
  147.   #--------------------------------------------------------------------------
  148.   # ● 敌人使用的武器 (二刀流)
  149.   #    敌人编号=>武器编号
  150.   #--------------------------------------------------------------------------
  151.   EMEMY_WEAPO2 = {}
  152.   
  153.   
  154.   #--------------------------------------------------------------------------
  155.   # ● 摇晃的设定
  156.   #--------------------------------------------------------------------------
  157.   SHAKE_FILE = "摇晃"  # 文件名
  158.   SHAKE_POWER = 5          # 强度
  159.   SHAKE_SPEED = 5          # 速度
  160.   SHAKE_DURATION = 5      # 时间
  161.   #--------------------------------------------------------------------------
  162.   # ● 上下反转地的设定
  163.   #--------------------------------------------------------------------------
  164.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  165.   #--------------------------------------------------------------------------
  166.   # ● 左右反转地的设定
  167.   #--------------------------------------------------------------------------
  168.   REVERSE_FILE = "左右反转" # 文件名
  169.   #--------------------------------------------------------------------------
  170.   # ● 回转地的设定
  171.   #--------------------------------------------------------------------------
  172.   TURNING_FILE = "回转" # 文件名
  173.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  174.   TURNING_SPEED = 40    # 速度
  175.   TURNING_DURATION = 1  # 回转数
  176.   #--------------------------------------------------------------------------
  177.   # ● 移动的设定
  178.   #--------------------------------------------------------------------------
  179.   MOVE_FILE = "移动"             # 文件名
  180.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  181.   MOVE_SPEED = 32                # 速度
  182.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  183.   #--------------------------------------------------------------------------
  184.   # ● 动画追加的设定
  185.   #--------------------------------------------------------------------------
  186.   ADD_ANIME_FILE = "动画追加"  # 文件名
  187.   ADD_ANIME_ID = 0               # 动画的ID
  188.   #--------------------------------------------------------------------------
  189.   # ● 债务不履行声明和RTAB的数据转换
  190.   #--------------------------------------------------------------------------
  191.   def convert_battler
  192.     return RTAB ? @active_actor : @active_battler
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● 债务不履行声明和RTAB的数据转换2
  196.   #--------------------------------------------------------------------------
  197.   def convert_battler2(*arg)
  198.     return RTAB ? arg[0] : @active_battler
  199.   end
  200. end

  201. #--------------------------------------------------------------------------
  202. # ● 行动設定
  203. #--------------------------------------------------------------------------
  204. module BattleActions
  205.   
  206.   # 下のものはあくまでも一例なので
  207.   # 独自に作ってください。

  208.   Actions = {

  209.   "通常攻撃" => [
  210.   
  211.   "閃きアニメ",
  212.   "アクターアニメ変更#WALK_L",
  213.   "移動#target,32,0,64,0",
  214.   "行動アニメ",
  215.   "アクターアニメ変更#ATTACK",
  216.   "遠距離アニメ",
  217.   "対象アニメ",
  218.   "アクターアニメ変更#WALK_L",
  219.   "SEの演奏#016-Jump02,80,100",
  220.   "移動#self,0,0,48,32",
  221.   "終了"
  222.   ],

  223.   "エネミー攻撃" => [
  224.   
  225.   "閃きアニメ",
  226.   "アクターアニメ変更#WALK_L",
  227.   "移動#self,-36,0,12,0",
  228.   "行動アニメ",
  229.   "アクターアニメ変更#ATTACK",
  230.   "遠距離アニメ",
  231.   "対象アニメ",
  232.   "アクターアニメ変更#WALK_L",
  233.   "移動#self,0,0,12,0",
  234.   "終了"
  235.   ],
  236.   
  237.   "術発動" => [
  238.   
  239.   "閃きアニメ",
  240.   "アクターアニメ変更#WALK_L",
  241.   "移動#self,-32,0,4,0",
  242.   "アクターアニメ変更#MAGIC",
  243.   "行動アニメ",
  244.   "ウエイト#15",
  245.   "遠距離アニメ",
  246.   "対象アニメ",
  247.   "アクターアニメ変更#WALK_L",
  248.   "移動#self,0,0,4,2",
  249.   "終了"
  250.   ],

  251.   "アイテム使用" => [
  252.   
  253.   "閃きアニメ",
  254.   "アクターアニメ変更#WALK_L",
  255.   "移動#self,-32,0,4,0",
  256.   "行動アニメ",
  257.   "アクターアニメ変更#ITEM",
  258.   "ウエイト#15",
  259.   "遠距離アニメ",
  260.   "対象アニメ",
  261.   "アクターアニメ変更#WALK_L",
  262.   "移動#self,0,0,4,2",
  263.   "終了"
  264.   ],
  265.   
  266.   "払い抜け" => [
  267.   
  268.   "閃きアニメ",
  269.   "アクターアニメ変更#WALK_L",
  270.   "移動#target_near,50,0,48,30",  
  271.   "左右反転",
  272.   "アクターアニメ固定#ATTACK#3",
  273.   "行動アニメ",
  274.   "SEの演奏#135-Light01,100,100",
  275.   "アニメーションの表示#self,42",
  276.   "ウエイト#15",
  277.   "左右反転",
  278.   "残像表示",
  279.   "移動#target_far,-50,0,48,0",
  280.   "対象アニメ",
  281.   "残像消去",
  282.   "アニメ固定解除",
  283.   "アクターアニメ変更#WALK_L",
  284.   "移動#self,0,0,48,1,0",
  285.   "終了"
  286.   ],
  287.   
  288.    "剑气攻擊" => [
  289.   
  290.   "閃きアニメ",
  291.   "アクターアニメ変更#WALK_L",
  292.   "移動#self,-32,0,4,0",
  293.   "行動アニメ",
  294.   "アクターアニメ変更#ATTACK",
  295.   "遠距離アニメ",
  296.   "対象アニメ",
  297.   "アクターアニメ変更#WALK_L",
  298.   "移動#self,0,0,4,2",
  299.   "終了"
  300.   ],
  301.   
  302.   "弓箭攻撃" => [
  303.   
  304.   "閃きアニメ",
  305.   "アクターアニメ変更#WALK_L",
  306.   "移動#self,-32,0,4,0",
  307.   "行動アニメ",
  308.   "アクターアニメ変更#ATTACK",
  309.   "遠距離アニメ",
  310.   "対象アニメ",
  311.   "アクターアニメ変更#WALK_L",
  312.   "移動#self,0,0,4,2",
  313.   "終了"
  314.   ],

  315.   "回旋攻撃" => [
  316.   
  317.   "閃きアニメ",
  318.   "アクターアニメ変更#WALK_L",
  319.   "移動#self,-32,0,4,0",
  320.   "行動アニメ",
  321.   "アクターアニメ変更#STAND_L",  
  322.   "遠距離アニメ",
  323.   "対象アニメ",
  324.   "アクターアニメ変更#WALK_L",
  325.   "移動#self,0,0,4,2",
  326.   "終了"
  327.   ],
  328.   
  329.   "远距离発動" => [
  330.   
  331.   "閃きアニメ",
  332.   "アクターアニメ変更#WALK_L",
  333.   "移動#self,-32,0,4,0",
  334.   "アクターアニメ変更#MAGIC",
  335.   "行動アニメ",
  336.   "アクターアニメ変更#ATTACK",
  337.   "遠距離アニメ",
  338.   "対象アニメ",
  339.   "アクターアニメ変更#WALK_L",
  340.   "移動#self,0,0,4,2",
  341.   "終了"
  342.   ],
  343.   
  344.   "回旋発動" => [
  345.   
  346.   "閃きアニメ",
  347.   "アクターアニメ変更#WALK_L",
  348.   "移動#self,-32,0,4,0",
  349.   "アクターアニメ変更#MAGIC",
  350.   "行動アニメ",
  351.   "アクターアニメ変更#STAND_L",  
  352.   "遠距離アニメ",
  353.   "対象アニメ",
  354.   "アクターアニメ変更#WALK_L",
  355.   "移動#self,0,0,4,2",
  356.   "終了"
  357.   ],

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

  359. end
  360.   
  361. module RPG
  362.   class Weapon
  363.     #--------------------------------------------------------------------------
  364.     # ● アクション設定
  365.     #--------------------------------------------------------------------------
  366.     def battle_actions
  367.       case @id
  368.       when 17,18,19,20,21,22,23,24,56   # 远程武器的id回旋攻撃
  369.         return BattleActions::Actions["弓箭攻撃"]
  370.       when 34                       # 回旋武器的id
  371.         return BattleActions::Actions["回旋攻撃"]
  372.       when 65
  373.         return BattleActions::Actions["剑气攻擊"]
  374.       end
  375.       return BattleActions::Actions["通常攻撃"]
  376.     end
  377.   end
  378.   class Skill
  379.     #--------------------------------------------------------------------------
  380.     # ● アクション設定
  381.     #--------------------------------------------------------------------------
  382.     def battle_actions
  383.       case @id
  384.       when 73,74,75,76,77,78,79,80  # 远程技能的id
  385.         return BattleActions::Actions["远距离発動"]
  386.       when 82                       # 回旋技能的id
  387.         return BattleActions::Actions["回旋発動"]
  388.       end
  389.       else
  390.       if self.magic?
  391.         return BattleActions::Actions["術発動"]
  392.       else
  393.         return BattleActions::Actions["払い抜け"]
  394.       end
  395.     end
  396.   end
  397.   class Item
  398.     #--------------------------------------------------------------------------
  399.     # ● アクション設定
  400.     #--------------------------------------------------------------------------
  401.     def battle_actions
  402.       return BattleActions::Actions["アイテム使用"]
  403.     end
  404.   end
  405. end
  406. #class Game_Enemy < Game_Battler
  407.   #--------------------------------------------------------------------------
  408.   # ● アクション設定
  409.   #--------------------------------------------------------------------------
  410. #~  def battle_actions
  411. #~    return BattleActions::Actions["エネミー攻撃"]
  412. #~  end
  413. #end
  414. =begin
  415. #--------------------------------------------------------------------------
  416. # ● 遠距離アニメーション
  417. #--------------------------------------------------------------------------
  418.  ☆ 説明
  419.   
  420.    行動者から対象者にアニメを飛ばします。
  421.    飛ばすアニメを データベース‐アニメーション で作ります。
  422.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。


  423.   ● カスタマイズ方法
  424.    
  425.     case @id
  426.     when 17,18,19,20
  427.       return [101,32,false,false]
  428.     when 21,22,23,24
  429.       return [102,32,false,false]
  430.     end
  431.     return 0
  432.    
  433.     のように描くとID別に指定可能です。
  434.    
  435.    
  436.   ● アニメーションID
  437.   
  438.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
  439.   
  440.    
  441.   ● スピード
  442.   
  443.   大きいほうが早い(0だとアニメは移動しません)
  444.   
  445.   1 = 1フレームで1ドット進むと考えてください。
  446.   
  447.   ● 往復するか?
  448.   
  449.   true とした場合、ブーメランのようにアニメが戻ります。
  450.   
  451.   ● 直線(false)or曲線(true)
  452.   
  453.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  454.   false = 対象に向かって直線で、アニメが飛びます。
  455.    
  456. =end
  457. module RPG
  458.   class Weapon
  459.     #--------------------------------------------------------------------------
  460.     # ● 遠距離アニメーション
  461.     #--------------------------------------------------------------------------
  462.     def flying_anime
  463.       # ID 指定 の例(武器的id,分类是根据飞行武器的动画id)
  464.       case @id
  465.       when 34             #回旋武器(类似回力镖)的id
  466.         return [103,32,true,true]
  467.       when 17,18,19,20    #远程武器1(弓箭类)的id
  468.         return [101,32,false,false]
  469.       when 21,22,23,24,56      #远程武器2(铳类)的id
  470.         return [102,32,false,false]
  471.       when 65                  #远程武器3(剑气)的id  
  472.       return [115,32,false,false]
  473.       end
  474.     end
  475.   end
  476.   class Skill
  477.     #--------------------------------------------------------------------------
  478.     # ● 遠距離アニメーション
  479.     #--------------------------------------------------------------------------
  480.     def flying_anime
  481.       # ID 指定 の例(技能的id,分类是根据飞行武器的动画id)
  482.       case @id
  483.       when 82             #回旋技能(类似回力镖)的id
  484.         return [103,32,true,true]
  485.       when 73,74,75,76    #远程技能1(弓箭类)的id
  486.         return [101,32,false,false]
  487.       when 77,78,79,80    #远程技能2(铳类)的id
  488.         return [102,32,false,false]
  489.       end
  490.       return [0,0,false,false]
  491.     end
  492.   end
  493.   class Item
  494.     #--------------------------------------------------------------------------
  495.     # ● 遠距離アニメーション
  496.     #--------------------------------------------------------------------------
  497.     def flying_anime
  498.       case @id
  499.       when 34    #抛击类道具(如炸弹一类)的id
  500.         return [104,32,false,true]
  501.       end
  502.       return [0,0,false,false]
  503.     end
  504.   end
  505. end

  506. #class Game_Enemy < Game_Battler
  507.   #--------------------------------------------------------------------------
  508.   # ● 遠距離アニメーション
  509.   #--------------------------------------------------------------------------
  510. #~  def flying_anime
  511. #~    return [0,0,false,false]
  512. #~  end
  513. #end



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

  1134.     # RTAB対応
  1135.     # 通常・待機
  1136.     return self.condition = NORMAL
  1137.   end
  1138.   #--------------------------------------------------------------------------
  1139.   # ● アクションの取得
  1140.   #--------------------------------------------------------------------------
  1141.   def get_actions
  1142.     skill = $data_skills[self.current_action.skill_id]
  1143.     item = $data_items[self.current_action.item_id]
  1144.     kind = self.current_action.kind
  1145.     # 動作取得
  1146.     @battle_actions = []
  1147.     # スキル
  1148.     if skill != nil && kind == 1
  1149.       @battle_actions = skill.battle_actions.dup
  1150.       @flying_anime = skill.flying_anime
  1151.     # アイテム
  1152.     elsif item != nil && kind == 2
  1153.       @battle_actions = item.battle_actions.dup
  1154.       @flying_anime = item.flying_anime
  1155.     # 左手攻撃
  1156.     elsif !@first_weapon and @second_weapon and (self.is_a?(Game_Actor) or (!self.is_a?(Game_Actor) and !self.nce))

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

  1534.   #--------------------------------------------------------------------------
  1535.   # ● 移動目標座標の計算
  1536.   #--------------------------------------------------------------------------
  1537.   def move_setup
  1538.     if RTAB
  1539.       targets = @target
  1540.     else
  1541.       targets = $scene.target_battlers
  1542.     end
  1543.     case @move_action[0]
  1544.     when "self" # 自分
  1545.       @target_x = self.base_x
  1546.       @target_y = self.base_y
  1547.     when "target_near" # 一番近くのターゲット
  1548.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1549.       if targets != []
  1550.         @target_x = targets[0].screen_x
  1551.         @target_y = targets[0].screen_y
  1552.       else
  1553.         @target_x = self.base_x
  1554.         @target_y = self.base_y
  1555.       end
  1556.     when "target_far" # 一番遠くのターゲット
  1557.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  1558.       targets.reverse!
  1559.       if targets != []
  1560.         @target_x = targets[0].screen_x
  1561.         @target_y = targets[0].screen_y
  1562.       else
  1563.         @target_x = self.base_x
  1564.         @target_y = self.base_y
  1565.       end
  1566.     when "target" # ターゲット中央
  1567.       @target_x = 0
  1568.       @target_y = 0
  1569.       for t in targets
  1570.         @target_x += t.screen_x
  1571.         @target_y += t.screen_y
  1572.       end
  1573.       if targets != []
  1574.         @target_x /= targets.size
  1575.         @target_y /= targets.size
  1576.       end
  1577.     when  "party" # "トループ中央"
  1578.       @target_x = 0
  1579.       @target_y = 0
  1580.       for t in $game_troop.enemies
  1581.         @target_x += t.screen_x
  1582.         @target_y += t.screen_y
  1583.       end
  1584.       if $game_troop.enemies != []
  1585.         @target_x /= $game_troop.enemies.size
  1586.         @target_y /= $game_troop.enemies.size
  1587.       end
  1588.     when "troop" # "パーティ中央"
  1589.       @target_x = 0
  1590.       @target_y = 0
  1591.       for t in $game_party.actors
  1592.         @target_x += t.screen_x
  1593.         @target_y += t.screen_y
  1594.       end
  1595.       if $game_party.actors != []
  1596.         @target_x /= $game_party.actors.size
  1597.         @target_y /= $game_party.actors.size
  1598.       end
  1599.     when "screen" # "画面"
  1600.       @target_x = self.base_x
  1601.       @target_y = self.base_y
  1602.     end
  1603.     # 補正
  1604.     @target_x -= @move_action[1] + self.base_x
  1605.     @target_y -= @move_action[2] + self.base_y
  1606.     # 移動目標の座標をセット
  1607.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  1608.     # 距離の計算(ウエイトの設定)
  1609.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  1610.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  1611.   end
  1612.   if RTAB
  1613.   alias original_x true_x
  1614.   alias original_y true_y
  1615.   else
  1616.   alias original_x screen_x
  1617.   alias original_y screen_y
  1618.   end
  1619.   #--------------------------------------------------------------------------
  1620.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  1621.   #--------------------------------------------------------------------------
  1622.   def true_x
  1623.     return original_x + @ox
  1624.   end
  1625.   #--------------------------------------------------------------------------
  1626.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  1627.   #--------------------------------------------------------------------------
  1628.   def true_y
  1629.     return original_y - @height / 2 + @oy
  1630.   end
  1631.   #--------------------------------------------------------------------------
  1632.   # ● バトル画面 X 座標の取得
  1633.   #--------------------------------------------------------------------------
  1634.   def screen_x(true_x = self.true_x)
  1635.     return true_x * @real_zoom + @real_x
  1636.   end
  1637.   #--------------------------------------------------------------------------
  1638.   # ● バトル画面 Y 座標の取得
  1639.   #--------------------------------------------------------------------------
  1640.   def screen_y(true_y = self.true_y)
  1641.     return true_y * @real_zoom + @real_y
  1642.   end
  1643.   #--------------------------------------------------------------------------
  1644.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  1645.   #--------------------------------------------------------------------------
  1646.   def base_x(true_x = self.true_x)
  1647.     return (true_x - @ox) * @real_zoom + @real_x
  1648.   end
  1649.   #--------------------------------------------------------------------------
  1650.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  1651.   #--------------------------------------------------------------------------
  1652.   # ● アニメーション取得
  1653.   #--------------------------------------------------------------------------
  1654.   def battle_actions1
  1655.     weapon = $data_weapons[@weapon_id]
  1656.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1657.   end
  1658.   #--------------------------------------------------------------------------
  1659.   # ● アニメーション取得
  1660.   #--------------------------------------------------------------------------
  1661.   def battle_actions2
  1662.     weapon = $data_weapons[@weapon2_id]
  1663.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1664.   end
  1665.   #--------------------------------------------------------------------------
  1666.   # ● 武器アニメーション取得
  1667.   #--------------------------------------------------------------------------
  1668.   def weapon_anime1
  1669.     weapon = $data_weapons[@weapon_id]
  1670.     return weapon != nil ? weapon.icon_name : ""
  1671.   end
  1672.   #--------------------------------------------------------------------------
  1673.   # ● 武器アニメーション取得
  1674.   #--------------------------------------------------------------------------
  1675.   def weapon_anime2
  1676.     weapon = $data_weapons[@weapon2_id]
  1677.     return weapon != nil ? weapon.icon_name : ""
  1678.   end
  1679.   #--------------------------------------------------------------------------
  1680.   # ● 遠距離アニメーション取得
  1681.   #--------------------------------------------------------------------------
  1682.   def flying_anime1
  1683.     weapon = $data_weapons[@weapon_id]
  1684.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1685.   end
  1686.   #--------------------------------------------------------------------------
  1687.   # ● 遠距離アニメーション取得
  1688.   #--------------------------------------------------------------------------
  1689.   def flying_anime2
  1690.     weapon = $data_weapons[@weapon2_id]
  1691.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1692.   end
  1693.   def base_y(true_y = self.true_y)
  1694.     return (true_y - @oy) * @real_zoom + @real_y
  1695.   end
  1696.   #--------------------------------------------------------------------------

  1697.   
  1698.   
  1699.   #--------------------------------------------------------------------------
  1700.   # ● アニメーション取得
  1701.   #--------------------------------------------------------------------------
  1702.   def battle_actions1
  1703.     weapon = $data_weapons[@weapon_id]
  1704.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1705.   end
  1706.   #--------------------------------------------------------------------------
  1707.   # ● アニメーション取得
  1708.   #--------------------------------------------------------------------------
  1709.   def battle_actions2
  1710.     weapon = $data_weapons[@weapon2_id]
  1711.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  1712.   end
  1713.   #--------------------------------------------------------------------------
  1714.   # ● 武器アニメーション取得
  1715.   #--------------------------------------------------------------------------
  1716.   def weapon_anime1
  1717.     weapon = $data_weapons[@weapon_id]
  1718.     return weapon != nil ? weapon.icon_name : ""
  1719.   end
  1720.   #--------------------------------------------------------------------------
  1721.   # ● 武器アニメーション取得
  1722.   #--------------------------------------------------------------------------
  1723.   def weapon_anime2
  1724.     weapon = $data_weapons[@weapon2_id]
  1725.     return weapon != nil ? weapon.icon_name : ""
  1726.   end
  1727.   #--------------------------------------------------------------------------
  1728.   # ● 遠距離アニメーション取得
  1729.   #--------------------------------------------------------------------------
  1730.   def flying_anime1
  1731.     weapon = $data_weapons[@weapon_id]
  1732.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1733.   end
  1734.   #--------------------------------------------------------------------------
  1735.   # ● 遠距離アニメーション取得
  1736.   #--------------------------------------------------------------------------
  1737.   def flying_anime2
  1738.     weapon = $data_weapons[@weapon2_id]
  1739.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  1740.   end  
  1741. end
  1742. #==============================================================================
  1743. # ■ Game_Party
  1744. #==============================================================================
  1745. class Game_Party
  1746.   #--------------------------------------------------------------------------
  1747.   # ● アクターを加える
  1748.   #     actor_id : アクター ID
  1749.   #--------------------------------------------------------------------------
  1750.   alias side_view_add_actor add_actor
  1751.   def add_actor(actor_id)
  1752.     # アクターを取得
  1753.     actor = $game_actors[actor_id]
  1754.     # サイドビューデータの初期化
  1755.     actor.start_battle
  1756.     # 戻す
  1757.     side_view_add_actor(actor_id)
  1758.   end
  1759. end

  1760. class Spriteset_Battle
  1761.   include Side_view
  1762.   #--------------------------------------------------------------------------
  1763.   # ● オブジェクト初期化
  1764.   #--------------------------------------------------------------------------
  1765.   alias side_veiw_initialize initialize
  1766.   def initialize
  1767.     side_veiw_initialize
  1768.     # アクタースプライトを解放
  1769.     for sprite in @actor_sprites
  1770.       sprite.dispose
  1771.     end
  1772.     # アクタースプライトを作成
  1773.     @actor_sprites = []
  1774.     for i in 1..Party_max
  1775.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1776.     end
  1777.     update
  1778.   end
  1779.   #--------------------------------------------------------------------------
  1780.   # ● 画面のスクロール
  1781.   #--------------------------------------------------------------------------
  1782.   if method_defined?("screen_scroll")
  1783.   alias side_view_screen_scroll screen_scroll
  1784.   def screen_scroll
  1785.     side_view_screen_scroll
  1786.     # アクターの位置補正
  1787.     for actor in $game_party.actors
  1788.       actor.real_x = @real_x
  1789.       actor.real_y = @real_y
  1790.       actor.real_zoom = @real_zoom
  1791.     end
  1792.   end
  1793.   end
  1794. end

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

  2345. #==============================================================================
  2346. # ■ Sprite_Weapon
  2347. #------------------------------------------------------------------------------
  2348. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2349. # スプライトの状態を自動的に変化させます。
  2350. #==============================================================================

  2351. class Sprite_Weapon < RPG::Sprite
  2352.   include Side_view
  2353.   #--------------------------------------------------------------------------
  2354.   # ● 公開インスタンス変数
  2355.   #--------------------------------------------------------------------------
  2356.   attr_accessor :battler                  # バトラー
  2357.   attr_reader   :cw                       # グラフィックの幅
  2358.   attr_reader   :ch                       # グラフィックの高さ
  2359.   #--------------------------------------------------------------------------
  2360.   # ● オブジェクト初期化
  2361.   #     viewport : ビューポート
  2362.   #     battler  : バトラー (Game_Battler)
  2363.   #--------------------------------------------------------------------------
  2364.   def initialize(viewport, battler = nil)
  2365.     super(viewport)
  2366.     @battler = battler
  2367.     @battler_visible = false
  2368.   end
  2369.   #--------------------------------------------------------------------------
  2370.   # ● 解放
  2371.   #--------------------------------------------------------------------------
  2372.   def dispose
  2373.     if self.bitmap != nil
  2374.       self.bitmap.dispose
  2375.     end
  2376.     super
  2377.   end
  2378.   #--------------------------------------------------------------------------
  2379.   # ● フレーム更新
  2380.   #--------------------------------------------------------------------------
  2381.   def update
  2382.     super
  2383.     # バトラーが nil の場合
  2384.     if @battler == nil or ([email protected]_a?(Game_Actor) and @battler.nce)
  2385.       self.bitmap = nil
  2386.       return
  2387.     end
  2388.     # ウエポンアニメのデータ取得
  2389.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  2390.     # 設定が「非表示」の場合
  2391.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  2392.       self.visible = false
  2393.       return
  2394.     else
  2395.       self.visible = true
  2396.     end
  2397.     # ファイル名が現在のものと異なる場合
  2398.     if @weapon_anime_type[0] != @weapon_name
  2399.       @weapon_name = @weapon_anime_type[0]
  2400.       # ビットマップを取得、設定
  2401.       self.bitmap = RPG::Cache.icon(@weapon_name)
  2402.       @width = bitmap.width
  2403.       @height = bitmap.height
  2404.       @flag = true
  2405.     end
  2406.     # 現在アニメパターンが現在のものと異なる場合
  2407.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  2408.       @pattern = @battler.pattern
  2409.       @condition = @battler.condition
  2410.       self.ox = @width
  2411.       self.oy = @height
  2412.       self.z = battler.screen_z
  2413.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  2414.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  2415.       self.src_rect.set(0, 0, @width, @height)
  2416.       self.opacity = 255
  2417.       # バトラーより手前に表示
  2418.       if @weapon_anime_type[2]
  2419.         self.z += 10
  2420.       # バトラーより奥に表示
  2421.       else
  2422.         self.z -= 10
  2423.       end
  2424.       @flag = false
  2425.     end
  2426.   end
  2427. end

  2428. #==============================================================================
  2429. # ■ Sprite_Flying
  2430. #------------------------------------------------------------------------------
  2431. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2432. # スプライトの状態を自動的に変化させます。
  2433. #==============================================================================

  2434. class Sprite_Flying < RPG::Sprite
  2435.   include Side_view
  2436.   #--------------------------------------------------------------------------
  2437.   # ● 公開インスタンス変数
  2438.   #--------------------------------------------------------------------------
  2439.   attr_accessor :battler                  # バトラー
  2440.   #--------------------------------------------------------------------------
  2441.   # ● オブジェクト初期化
  2442.   #     viewport : ビューポート
  2443.   #     battler  : バトラー (Game_Battler)
  2444.   #--------------------------------------------------------------------------
  2445.   def initialize(viewport, battler = nil)
  2446.     super(viewport)
  2447.     @battler = battler
  2448.     @battler_visible = false
  2449.   end
  2450.   #--------------------------------------------------------------------------
  2451.   # ● 解放
  2452.   #--------------------------------------------------------------------------
  2453.   def dispose
  2454.     if self.bitmap != nil
  2455.       self.bitmap.dispose
  2456.     end
  2457.     super
  2458.   end
  2459.   #--------------------------------------------------------------------------
  2460.   # ● フレーム更新
  2461.   #--------------------------------------------------------------------------
  2462.   def update
  2463.     super
  2464.     # バトラーが nil の場合
  2465.     if @battler == nil
  2466.       self.bitmap = nil
  2467.       loop_animation(nil)
  2468.       return
  2469.     end
  2470.     # 遠距離アニメ
  2471.     flying_animation = @battler.flying_animation
  2472.     flying_start = flying_animation[0]
  2473.     flying_end   = flying_animation[1]
  2474.     # アニメーション ID が現在のものと異なる場合
  2475.     if @anime_id != @battler.flying_anime[0]
  2476.       @anime_id != @battler.flying_anime[0]
  2477.       @animation != $data_animations[@anime_id]
  2478.       end
  2479.     end
  2480.     # アニメーション 開始
  2481.     if flying_start
  2482.       loop_animation(@animation)
  2483.     elsif flying_end
  2484.       loop_animation(nil)
  2485.     end
  2486.     self.x = @battler.flying_x
  2487.     self.y = @battler.flying_y
  2488.     self.z = @battler.screen_z + 1000
  2489.   end
  2490.   
  2491. module RPG
  2492.   class Skill
  2493.     #--------------------------------------------------------------------------
  2494.     # ● 魔法かどうかの判断
  2495.     #--------------------------------------------------------------------------
  2496.     def magic?
  2497.       if @atk_f == 0
  2498.         return true
  2499.       else
  2500.         return false
  2501.       end
  2502.     end
  2503.   end
  2504. end

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

  2506. class Arrow_Actor < Arrow_Base
  2507.   include Side_view
  2508.   #--------------------------------------------------------------------------
  2509.   # ● フレーム更新
  2510.   #--------------------------------------------------------------------------
  2511.   alias side_view_update update
  2512.   def update
  2513.     side_view_update
  2514.     # スプライトの座標を設定
  2515.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  2516.       self.x = self.actor.screen_x + ARROW_OX
  2517.       self.y = self.actor.screen_y + ARROW_OY
  2518.     end
  2519.   end
  2520. end
  2521. class Arrow_Enemy < Arrow_Base
  2522.   include Side_view
  2523.   #--------------------------------------------------------------------------
  2524.   # ● フレーム更新
  2525.   #--------------------------------------------------------------------------
  2526.   alias side_view_update update
  2527.   def update
  2528.     side_view_update
  2529.     # スプライトの座標を設定
  2530.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  2531.       self.x = self.enemy.screen_x
  2532.       self.y = self.enemy.screen_y + self.enemy.height/2
  2533.     end
  2534.   end
  2535. end
  2536. module Rtab_use
  2537.   def update_phase4_step3(battler)
  2538.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2539.     case battler.current_action.kind
  2540.     when 0  # 基本
  2541.       if battler.current_action.basic == 1
  2542.         @help_window.set_text($data_system.words.guard, 1)
  2543.         @help_wait = @help_time
  2544.       end
  2545.       if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  2546.         @help_window.set_text("逃げる", 1)
  2547.         @help_wait = @help_time
  2548.       end
  2549.     when 1  # スキル
  2550.       skill =  $data_skills[battler.current_action.skill_id]
  2551.       @help_window.set_text(skill.name, 1)
  2552.       @help_wait = @help_time
  2553.     when 2  # アイテム
  2554.       item = $data_items[battler.current_action.item_id]
  2555.       @help_window.set_text(item.name, 1)
  2556.       @help_wait = @help_time
  2557.     end
  2558.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2559.     if battler.anime1 == 0
  2560.       battler.white_flash = true
  2561.       battler.wait = 5
  2562.       # カメラ設定
  2563.       if battler.target[0].is_a?(Game_Enemy)
  2564.         camera_set(battler)
  2565.       end
  2566.     else
  2567.       battler.animation.push([battler.anime1, true])
  2568.       speller = synthe?(battler)
  2569.       if speller != nil
  2570.         for spell in speller
  2571.           if spell != battler
  2572.             if spell.current_action.spell_id == 0
  2573.               spell.animation.push([battler.anime1, true])
  2574.             else
  2575.               skill = spell.current_action.spell_id
  2576.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2577.               spell.current_action.spell_id = 0
  2578.             end
  2579.           end
  2580.         end
  2581.       end
  2582.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2583.       battler.anime1 = 0
  2584.     end
  2585.     # ステップ 4 に移行
  2586.     battler.phase = 4 if !(!battler.animation1_on and battler.action? and !battler.flash?)
  2587.   end
  2588. end

  2589. #==============================================================================
  2590. # ■ Scene_Battle
  2591. #==============================================================================
  2592. class Scene_Battle
  2593.   include Side_view
  2594.   include Rtab_use if RTAB
  2595.   #--------------------------------------------------------------------------
  2596.   # ● 公開インスタンス変数
  2597.   #--------------------------------------------------------------------------
  2598.   attr_reader   :phase            # フェーズ
  2599.   attr_reader   :phase4_step      # フェーズ4ステップ
  2600.   attr_reader   :active_battler   # 対象の配列
  2601.   attr_reader   :target_battlers  # 対象の配列
  2602.   attr_reader   :animation1_id    # 行動アニメID
  2603.   attr_reader   :animation2_id    # 対象アニメID
  2604.   #--------------------------------------------------------------------------
  2605.   # ● メイン処理
  2606.   #--------------------------------------------------------------------------
  2607.   alias side_view_main main
  2608.   def main
  2609.     # バトラー初期化
  2610.     for battler in $game_party.actors + $game_troop.enemies
  2611.       battler.start_battle
  2612.     end
  2613.     # 戻す
  2614.     side_view_main
  2615.   end
  2616.   #--------------------------------------------------------------------------
  2617.   # ● 閃き判定
  2618.   #--------------------------------------------------------------------------
  2619.   def flash?
  2620.     return @flash_flag ? true : false
  2621.   end  
  2622.   #--------------------------------------------------------------------------
  2623.   # ● 閃きアニメ待ち時間取得
  2624.   #--------------------------------------------------------------------------
  2625.   def flash_duration
  2626.     animation = nil
  2627.     if FLASH_ANIME
  2628.       animation = $data_animations[FLASH_ANIMATION_ID]
  2629.     end
  2630.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  2631.   end
  2632.   #--------------------------------------------------------------------------
  2633.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  2634.   #--------------------------------------------------------------------------
  2635.   alias side_view_update_phase4_step2 update_phase4_step2
  2636.   def update_phase4_step2(*arg)
  2637.     battler = convert_battler2(*arg)
  2638.     battler.action
  2639.     side_view_update_phase4_step2(*arg)
  2640.   end
  2641.   #--------------------------------------------------------------------------
  2642.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2643.   #--------------------------------------------------------------------------
  2644.   alias side_view_update_phase4_step3 update_phase4_step3
  2645.   def update_phase4_step3(*arg)
  2646.     battler = convert_battler2(*arg)
  2647.     if battler.flash? and FLASH_ANIME
  2648.       battler.flash_flag["normal"] = true
  2649.     end
  2650.     side_view_update_phase4_step3(*arg)
  2651.   end
  2652.   #--------------------------------------------------------------------------
  2653.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2654.   #--------------------------------------------------------------------------
  2655.   alias side_view_update_phase4_step4 update_phase4_step4
  2656.   def update_phase4_step4(*arg)
  2657.     battler = convert_battler2(*arg)
  2658.     targets = RTAB ? battler.target : @target_battlers
  2659.     return if !battler.animation2_on and battler.action? if !RTAB
  2660.     side_view_update_phase4_step4(*arg)
  2661.     for target in targets
  2662.       if RTAB
  2663.         value = nil
  2664.         if target.damage_sp.include?(battler)
  2665.           value = target.damage_sp[battler]
  2666.         end
  2667.         if target.damage.include?(battler)
  2668.           if value == nil or value == "Miss"
  2669.             value = target.damage[battler]
  2670.           elsif value.is_a?(Numeric) && value > 0
  2671.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  2672.           end
  2673.         end
  2674.       else
  2675.         value = target.damage
  2676.       end
  2677.       if target.is_a?(Game_Actor)
  2678.         # ダメージの場合
  2679.         if value.is_a?(Numeric) && value > 0
  2680.           # シェイクを開始
  2681.           target.shake = true
  2682.         end
  2683.       elsif target.is_a?(Game_Enemy)
  2684.         # ダメージの場合
  2685.         if value.is_a?(Numeric) && value > 0
  2686.           # シェイクを開始
  2687.           target.shake = true
  2688.         end
  2689.       end
  2690.     end
  2691.   end
  2692.   #--------------------------------------------------------------------------
  2693.   # ● プレバトルフェーズ開始
  2694.   #--------------------------------------------------------------------------
  2695.   alias start_phase1_correct start_phase1
  2696.   def start_phase1
  2697.     # カメラの設定
  2698.     # 元々フロントビュー向けの数値になっているため
  2699.     @zoom_rate = [1.0, 1.0]
  2700.     start_phase1_correct
  2701.   end
  2702.   #--------------------------------------------------------------------------
  2703.   # ● アクターコマンドフェーズ開始
  2704.   #--------------------------------------------------------------------------
  2705.   alias start_phase3_correct start_phase3
  2706.   def start_phase3
  2707.     battler = convert_battler
  2708.     start_phase3_correct
  2709.     if RTAB
  2710.       # カメラの設定
  2711.       # 元々フロントビュー向けの数値になっているため
  2712.       @camera = "command"
  2713. #      @spriteset.screen_target(0, 0, 1.0)
  2714.     end
  2715.   end


  2716.   def action_phase(battler)
  2717.     # action が 1 の場合、バトラーが行動中かどうか確認
  2718.     if @action == 1 and battler.phase < 3
  2719.       for target in battler.target
  2720.         speller = synthe?(target)
  2721.         if speller == nil
  2722.           # ターゲットが通常行動中の場合
  2723.           if @action_battlers.include?(target)
  2724.             if target.phase > 2
  2725.               return
  2726.             end
  2727.           end
  2728.         else
  2729.           # ターゲットが連携スキル発動中の場合
  2730.           for spell in speller
  2731.             if @action_battlers.include?(spell)
  2732.               if spell.phase > 2
  2733.                 return
  2734.               end
  2735.             end
  2736.           end
  2737.         end
  2738.       end
  2739.     end
  2740. case battler.phase
  2741.   when 1
  2742.     update_phase4_step1(battler)
  2743.   when 2
  2744.     update_phase4_step2(battler)
  2745.   when 3  
  2746.     update_phase4_step3(battler) if !(!battler.animation1_on and battler.action? and !battler.flash?)
  2747.   when 4
  2748.     update_phase4_step4(battler) if !(!battler.animation2_on and battler.action?)
  2749.   when 5
  2750.     update_phase4_step5(battler)
  2751.   when 6
  2752.     update_phase4_step6(battler)
  2753.   end
  2754.   end
  2755. end
复制代码
使其多一种远程攻击,后来经过大神指点,又修改了一些,可是测试的时候....就变成这样了。真心求各位大触解决

评分

参与人数 1星屑 +400 梦石 +2 收起 理由
hcm + 400 + 2 补回

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
帖子
1305
2
发表于 2012-9-10 09:16:49 | 只看该作者
  1.     # アニメーション ID が現在のものと異なる場合

  2.     if @anime_id != @battler.flying_anime[0]

  3.       @anime_id != @battler.flying_anime[0]

  4.       @animation != $data_animations[@anime_id]

  5.       end

  6.     end

  7.     # アニメーション 開始

  8.     if flying_start

  9.       loop_animation(@animation)

  10.     elsif flying_end

  11.       loop_animation(nil)

  12.     end

  13.     self.x = @battler.flying_x

  14.     self.y = @battler.flying_y

  15.     self.z = @battler.screen_z + 1000

  16.   end
复制代码
这段改成
  1.     # アニメーション ID が現在のものと異なる場合

  2.     if @anime_id != @battler.flying_anime[0]

  3.       @anime_id != @battler.flying_anime[0]

  4.       @animation != $data_animations[@anime_id]

  5.       

  6.     end

  7.     # アニメーション 開始

  8.     if flying_start

  9.       loop_animation(@animation)

  10.     elsif flying_end

  11.       loop_animation(nil)

  12.     end

  13.     self.x = @battler.flying_x

  14.     self.y = @battler.flying_y

  15.     self.z = @battler.screen_z + 1000

  16.   end

  17. end
复制代码

点评

你这脚本只是改了end的位置了而已,脚本错误的提示没解决啊。  发表于 2012-9-10 19:55
好歹当年也当过大魔王过,orz
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
124 小时
注册时间
2012-3-20
帖子
19
3
 楼主| 发表于 2012-9-10 18:45:17 | 只看该作者
zhangbanxian 发表于 2012-9-10 09:16
这段改成

我按照你说的改了,可是测试的时候变成了这样
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
帖子
1305
4
发表于 2012-9-14 16:37:50 手机端发表。 | 只看该作者
目测是改法有问题,重下原版吧,建议看懂再改- -b
好歹当年也当过大魔王过,orz
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 13:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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