查看: 2022|回复: 5

[已经过期] 求一个脚本,米娜桑来帮帮忙吧

[复制链接]
梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
发表于 2014-10-19 00:02:33 | 显示全部楼层 |阅读模式

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

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

×
我想在战斗之前加入一个队友选择系统,就是说每次开始战斗之前可以自己选择除主角之外的战斗人员。
我对脚本一窍不通,想请高手帮忙设计一个这样的脚本好哦?
P.S.队伍人数四个,游戏里装了队友仓库和横版战斗系统,队友选择系统最好是可以自己设定在哪些战斗之前可以启动的......难度好像有点大哦,但各位大触还是帮帮忙吧,感激不尽!

点评

最好把队员仓库和横版脚本发上来,以便根据其修改。  发表于 2014-10-19 19:56
梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
 楼主| 发表于 2014-10-24 22:21:13 | 显示全部楼层
本帖最后由 RyanBern 于 2014-10-25 09:36 编辑
  1. =begin
  2. ###############################################################################

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

  8.    修正与RTAB并用的bug

  9. 1.01  与RTAB并用无bug完整版~

  10. 1.02  支持敌人远程攻击

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

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

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

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

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

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

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

  50. =end                                                        #modify by darkten

  51. ###############################################################################

  52. =begin

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

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

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

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

  212.   Actions = {

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

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

  255.   "アイテム使用" => [
  256.   
  257.   "閃きアニメ",
  258.   "アクターアニメ変更#WALK_L",
  259.   "移動#self,-32,0,4,0",
  260.   "行動アニメ",
  261.   "アクターアニメ変更#ITEM",
  262.   "ウエイト#15",
  263.   "遠距離アニメ",
  264.   "対象アニメ",
  265.   "アクターアニメ変更#WALK_L",
  266.   "移動#self,0,0,4,2",
  267.   "終了"
  268.   ],
  269.   
  270.   "払い抜け" => [
  271.   
  272.   "閃きアニメ",
  273.   "アクターアニメ変更#WALK_L",
  274.   "移動#target_near,50,0,48,30",  
  275.   "左右反転",
  276.   "アクターアニメ固定#ATTACK#3",
  277.   "行動アニメ",
  278.   "SEの演奏#135-Light01,100,100",
  279.   "アニメーションの表示#self,42",
  280.   "ウエイト#15",
  281.   "左右反転",
  282.   "残像表示",
  283.   "移動#target_far,-50,0,48,0",
  284.   "対象アニメ",
  285.   "残像消去",
  286.   "アニメ固定解除",
  287.   "アクターアニメ変更#WALK_L",
  288.   "移動#self,0,0,48,1,0",
  289.   "終了"
  290.   ],

  291.   "弓箭攻撃" => [
  292.   
  293.   "閃きアニメ",
  294.   "アクターアニメ変更#WALK_L",
  295.   "移動#self,-32,0,4,0",
  296.   "行動アニメ",
  297.   "アクターアニメ変更#ATTACK",
  298.   "遠距離アニメ",
  299.   "対象アニメ",
  300.   "アクターアニメ変更#WALK_L",
  301.   "移動#self,0,0,4,2",
  302.   "終了"
  303.   ],

  304.   "回旋攻撃" => [
  305.   
  306.   "閃きアニメ",
  307.   "アクターアニメ変更#WALK_L",
  308.   "移動#self,-32,0,4,0",
  309.   "行動アニメ",
  310.   "アクターアニメ変更#STAND_L",  
  311.   "遠距離アニメ",
  312.   "対象アニメ",
  313.   "アクターアニメ変更#WALK_L",
  314.   "移動#self,0,0,4,2",
  315.   "終了"
  316.   ],
  317.   
  318.   "远距离発動" => [
  319.   
  320.   "閃きアニメ",
  321.   "アクターアニメ変更#WALK_L",
  322.   "移動#self,-32,0,4,0",
  323.   "アクターアニメ変更#MAGIC",
  324.   "行動アニメ",
  325.   "アクターアニメ変更#ATTACK",
  326.   "遠距離アニメ",
  327.   "対象アニメ",
  328.   "アクターアニメ変更#WALK_L",
  329.   "移動#self,0,0,4,2",
  330.   "終了"
  331.   ],
  332.   
  333.   "回旋発動" => [
  334.   
  335.   "閃きアニメ",
  336.   "アクターアニメ変更#WALK_L",
  337.   "移動#self,-32,0,4,0",
  338.   "アクターアニメ変更#MAGIC",
  339.   "行動アニメ",
  340.   "アクターアニメ変更#STAND_L",  
  341.   "遠距離アニメ",
  342.   "対象アニメ",
  343.   "アクターアニメ変更#WALK_L",
  344.   "移動#self,0,0,4,2",
  345.   "終了"
  346.   ],

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

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


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

  493. #class Game_Enemy < Game_Battler
  494.   #--------------------------------------------------------------------------
  495.   # ● 遠距離アニメーション
  496.   #--------------------------------------------------------------------------
  497. #~  def flying_anime
  498. #~    return [0,0,false,false]
  499. #~  end
  500. #end



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

  1121.     # RTAB対応
  1122.     # 通常・待機
  1123.     return self.condition = NORMAL
  1124.   end
  1125.   #--------------------------------------------------------------------------
  1126.   # ● アクションの取得
  1127.   #--------------------------------------------------------------------------
  1128.   def get_actions
  1129.     skill = $data_skills[self.current_action.skill_id]
  1130.     item = $data_items[self.current_action.item_id]
  1131.     kind = self.current_action.kind
  1132.     # 動作取得
  1133.     @battle_actions = []
  1134.     # スキル
  1135.     if skill != nil && kind == 1
  1136.       @battle_actions = skill.battle_actions.dup
  1137.       @flying_anime = skill.flying_anime
  1138.     # アイテム
  1139.     elsif item != nil && kind == 2
  1140.       @battle_actions = item.battle_actions.dup
  1141.       @flying_anime = item.flying_anime
  1142.     # 左手攻撃
  1143.     elsif !@first_weapon and @second_weapon and (self.is_a?(Game_Actor) or (!self.is_a?(Game_Actor) and !self.nce))

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

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

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

  1747. class Spriteset_Battle
  1748.   include Side_view
  1749.   #--------------------------------------------------------------------------
  1750.   # ● オブジェクト初期化
  1751.   #--------------------------------------------------------------------------
  1752.   alias side_veiw_initialize initialize
  1753.   def initialize
  1754.     side_veiw_initialize
  1755.     # アクタースプライトを解放
  1756.     for sprite in @actor_sprites
  1757.       sprite.dispose
  1758.     end
  1759.     # アクタースプライトを作成
  1760.     @actor_sprites = []
  1761.     for i in 1..Party_max
  1762.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  1763.     end
  1764.     update
  1765.   end
  1766.   #--------------------------------------------------------------------------
  1767.   # ● 画面のスクロール
  1768.   #--------------------------------------------------------------------------
  1769.   if method_defined?("screen_scroll")
  1770.   alias side_view_screen_scroll screen_scroll
  1771.   def screen_scroll
  1772.     side_view_screen_scroll
  1773.     # アクターの位置補正
  1774.     for actor in $game_party.actors
  1775.       actor.real_x = @real_x
  1776.       actor.real_y = @real_y
  1777.       actor.real_zoom = @real_zoom
  1778.     end
  1779.   end
  1780.   end
  1781. end

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

  2332. #==============================================================================
  2333. # ■ Sprite_Weapon
  2334. #------------------------------------------------------------------------------
  2335. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2336. # スプライトの状態を自動的に変化させます。
  2337. #==============================================================================

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

  2415. #==============================================================================
  2416. # ■ Sprite_Flying
  2417. #------------------------------------------------------------------------------
  2418. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  2419. # スプライトの状態を自動的に変化させます。
  2420. #==============================================================================

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

  2477. module RPG
  2478.   class Skill
  2479.     #--------------------------------------------------------------------------
  2480.     # ● 魔法かどうかの判断
  2481.     #--------------------------------------------------------------------------
  2482.     def magic?
  2483.       if @atk_f == 0
  2484.         return true
  2485.       else
  2486.         return false
  2487.       end
  2488.     end
  2489.   end
  2490. end

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

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

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


  2702.   def action_phase(battler)
  2703.     # action が 1 の場合、バトラーが行動中かどうか確認
  2704.     if @action == 1 and battler.phase < 3
  2705.       for target in battler.target
  2706.         speller = synthe?(target)
  2707.         if speller == nil
  2708.           # ターゲットが通常行動中の場合
  2709.           if @action_battlers.include?(target)
  2710.             if target.phase > 2
  2711.               return
  2712.             end
  2713.           end
  2714.         else
  2715.           # ターゲットが連携スキル発動中の場合
  2716.           for spell in speller
  2717.             if @action_battlers.include?(spell)
  2718.               if spell.phase > 2
  2719.                 return
  2720.               end
  2721.             end
  2722.           end
  2723.         end
  2724.       end
  2725.     end
  2726. case battler.phase
  2727.   when 1
  2728.     update_phase4_step1(battler)
  2729.   when 2
  2730.     update_phase4_step2(battler)
  2731.   when 3  
  2732.     update_phase4_step3(battler) if !(!battler.animation1_on and battler.action? and !battler.flash?)
  2733.   when 4
  2734.     update_phase4_step4(battler) if !(!battler.animation2_on and battler.action?)
  2735.   when 5
  2736.     update_phase4_step5(battler)
  2737.   when 6
  2738.     update_phase4_step6(battler)
  2739.   end
  2740. end
  2741. end
复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
 楼主| 发表于 2014-10-24 22:21:36 | 显示全部楼层
本帖最后由 RyanBern 于 2014-10-25 09:35 编辑
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # [url]http://zhuchao.go1.icpcn.com[/url]
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable
  13.   def initialize
  14.     super(0, 0, 320, 224)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     refresh
  18.   end
  19.   def actor
  20.     return @actors[self.index]
  21.   end
  22.   def refresh
  23.     if self.contents != nil
  24.       self.contents.dispose
  25.       self.contents = nil
  26.     end
  27.     @actors = []
  28.     for i in 0...$game_party.actors.size
  29.       @actors.push($game_party.actors[i])
  30.     end
  31.    
  32.     @item_max = 4
  33.     if @item_max > 0
  34.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  35.       for i in 0...@item_max
  36.         draw_item(i)
  37.       end
  38.     end
  39.   end
  40.   def draw_item(index)
  41.     if @actors[index] != nil
  42.       actor = @actors[index]
  43.       text = @actors[index].name
  44.       lv = @actors[index].level.to_s + " "
  45.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  46.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  47.       else
  48.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  49.       end
  50.       self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
  51.       self.contents.font.color = normal_color
  52.       self.contents.font.size = 16
  53.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  "Level:   ", 2)
  54.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  55.       colory = [255.0000 / 60 * @actors[index].level,255].min
  56.       self.contents.font.color = Color.new(colorx, colory, 0)
  57.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  lv, 2)
  58.       self.contents.font.color = normal_color
  59.       self.contents.font.size = 22
  60.     else
  61.       self.contents.draw_text(4, index * 32 + 32, 288, 32,  "Nobody")
  62.     end
  63.   end
  64.   def update_cursor_rect
  65.     if @index < 0
  66.       self.cursor_rect.empty
  67.       return
  68.     end
  69.     row = @index / @column_max
  70.     if row < self.top_row
  71.       self.top_row = row
  72.     end
  73.     if row > self.top_row + (self.page_row_max - 1)
  74.       self.top_row = row - (self.page_row_max - 1)
  75.     end
  76.     cursor_width = self.width / @column_max - 32
  77.     x = @index % @column_max * (cursor_width + 32)
  78.     y = @index / @column_max * 32 - self.oy + 32
  79.     self.cursor_rect.set(x, y, cursor_width, 32)
  80.   end
  81.   def item_max
  82.     return @item_max
  83.   end
  84.   def actor?(index)
  85.     return @actors[index] == nil ? false : true
  86.   end
  87.   def set_index(x)
  88.     @index = x
  89.   end
  90. end

  91. #------------------------------------------------------------------------------

  92. class Chaochao_Window_PartyRight < Window_Selectable
  93.   def initialize
  94.     super(320, 0, 320, 224)
  95.     self.contents = Bitmap.new(width - 32, height - 32)
  96.     self.index = -1
  97.     refresh
  98.   end
  99.   def actor
  100.     return @actors[self.index]
  101.   end
  102.   def refresh
  103.     if self.contents != nil
  104.       self.contents.dispose
  105.       self.contents = nil
  106.     end
  107.     @actors = []
  108.     for i in 0...$game_party.actors2.size
  109.       @actors.push($game_party.actors2[i])
  110.     end
  111.    
  112.     @item_max = $game_party.actors2.size
  113.     if @item_max > 0
  114.       self.contents = Bitmap.new(width - 32, row_max * 32)
  115.       for i in 0...@item_max
  116.         draw_item(i)
  117.       end
  118.     elsif @item_max == 0
  119.       
  120.     end
  121.   end
  122.   def draw_item(index)
  123.     actor = @actors[index]
  124.     text = @actors[index].name
  125.     lv = @actors[index].level.to_s + " "
  126.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  127.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  128.       else
  129.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  130.       end
  131.     self.contents.draw_text(4, index * 32, 288, 32, text)
  132.     self.contents.font.color = normal_color
  133.     self.contents.font.size = 16
  134.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  135.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  136.     colory = [255.0000 / 60 * @actors[index].level,255].min
  137.     self.contents.font.color = Color.new(colorx, colory, 0)
  138.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  139.     self.contents.font.color = normal_color
  140.     self.contents.font.size = 22
  141.   end
  142.   def update_cursor_rect
  143.     if @index < 0
  144.       self.cursor_rect.empty
  145.       return
  146.     end
  147.     row = @index / @column_max
  148.     if row < self.top_row
  149.       self.top_row = row
  150.     end
  151.     if row > self.top_row + (self.page_row_max - 1)
  152.       self.top_row = row - (self.page_row_max - 1)
  153.     end
  154.     cursor_width = self.width / @column_max - 32
  155.     x = @index % @column_max * (cursor_width + 32)
  156.     y = @index / @column_max * 32 - self.oy
  157.     self.cursor_rect.set(x, y, cursor_width, 32)
  158.   end
  159.   def item_max
  160.     return @item_max
  161.   end
  162.   def actor?(index)
  163.     return @actors[index] == nil ? false : true
  164.   end
  165.   def set_index(x)
  166.     @index = x
  167.   end
  168. end

  169. #------------------------------------------------------------------------------

  170. class Chaochao_Window_PartyData < Window_Base
  171.   
  172.   def initialize
  173.     super(0, 224, 640, 256)
  174.     self.contents = Bitmap.new(width - 32, height - 32)
  175.     @actor = nil
  176.   end
  177.   
  178.   def set_actor(actor)
  179.     self.contents.clear
  180.     draw_actor_name(actor, 4, 0)
  181.     draw_actor_state(actor, 140, 0)
  182.     draw_actor_hp(actor, 284, 0)
  183.     draw_actor_sp(actor, 460, 0)
  184.     @actor = actor
  185.     self.visible = true
  186.   end
  187.   def clear
  188.     self.contents.clear
  189.   end
  190. end

  191. #------------------------------------------------------------------------------

  192. class Game_Party
  193.   attr_reader   :actors2
  194.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  195.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  196.   def initialize
  197.     @actors = []
  198.     @gold = 0
  199.     @steps = 0
  200.     @items = {}
  201.     @weapons = {}
  202.     @armors = {}
  203.     @actors2 = []
  204.     [url=home.php?mod=space&uid=9543]@chaochao[/url] = []
  205.     @chaochao2 = []
  206.   end
  207.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  208.     case type
  209.     when 1
  210.       if $game_actors[actor_id] != nil
  211.         actor = $game_actors[actor_id]
  212.         #如果队伍没有满和队伍中没有此角色
  213.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  214.           @actors.push(actor)
  215.           $game_player.refresh
  216.         end
  217.       end
  218.     when 2
  219.       if $game_actors[actor_id] != nil
  220.         actor = $game_actors[actor_id]
  221.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  222.         #向备用角色中添加角色
  223.         if not @actors.include?(actor) and not @actors2.include?(actor)
  224.           @actors2.push(actor)
  225.           $game_player.refresh
  226.         end
  227.       end
  228.     end
  229.   end
  230.   
  231.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  232.     actor = $game_actors[index]
  233.     case type
  234.     when 1
  235.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  236.         @actors.push(actor)
  237.         @actors2.delete(actor)
  238.         $game_system.se_play($data_system.decision_se)
  239.         $game_player.refresh
  240.       end
  241.     when 2
  242.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  243.         @actors2.push(actor)
  244.         @actors.delete(actor)
  245.         $game_system.se_play($data_system.decision_se)
  246.         $game_player.refresh
  247.       end
  248.     end
  249.   end
  250.   
  251.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  252.   #type2,1是添加不能移动的,2是删除不能移动的。
  253.   def yidong(actor_id,type1,type2=1)
  254.     case type2
  255.     when 1
  256.       case type1
  257.       when 1
  258.         @chaochao.push(actor_id)
  259.       when 2
  260.         @chaochao2.push(actor_id)
  261.       end
  262.     when 2
  263.       case type1
  264.       when 1
  265.         @chaochao.delete(actor_id)
  266.       when 2
  267.         @chaochao2.delete(actor_id)
  268.       end
  269.     end
  270.   end
  271.   
  272.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  273.   def remove_actor(actor_id,type=1)
  274.     actor = $game_actors[actor_id]
  275.     case type
  276.     when 1
  277.       @actors.delete(actor)
  278.       $game_player.refresh
  279.     when 2
  280.       @actors2.delete(actor)
  281.       $game_player.refresh
  282.     when 3
  283.       @actors.delete(actor)
  284.       @actors2.delete(actor)
  285.       $game_player.refresh
  286.     end
  287.   end
  288.   
  289.   def refresh
  290.     new_actors = []
  291.     new_actors2 = []
  292.     for i in [email]0...@actors.size[/email]
  293.       if $data_actors[@actors[i].id] != nil
  294.         new_actors.push($game_actors[@actors[i].id])
  295.       end
  296.     end
  297.     @actors = new_actors
  298.     for i in [email]0...@actors2.size[/email]
  299.       if $data_actors[@actors2[i].id] != nil
  300.         new_actors2.push($game_actors[@actors2[i].id])
  301.       end
  302.     end
  303.     @actors2 = new_actors2
  304.   end
  305. end

  306. #------------------------------------------------------------------------------

  307. class Chaochao_Scene_Party
  308.   def main
  309.     @left_temp_command = 0
  310.     @right_temp_command = 0
  311.     [url=home.php?mod=space&uid=263426]@temp[/url] = 0
  312.     @left_window = Chaochao_Window_PartyLeft.new
  313.     @left_window.active = true
  314.     @right_window = Chaochao_Window_PartyRight.new
  315.     @right_window.active = false
  316.     @data_window = Chaochao_Window_PartyData.new
  317.     update_data
  318.     Graphics.transition
  319.     loop do
  320.       Graphics.update
  321.       Input.update
  322.       update
  323.       if $scene != self
  324.         break
  325.       end
  326.     end
  327.     Graphics.freeze
  328.     @left_window.dispose
  329.     @right_window.dispose
  330.     @data_window.dispose
  331.   end
  332.   
  333.   def update
  334.     @left_window.update
  335.     @right_window.update
  336.     @data_window.update
  337.     update_command
  338.     update_data
  339.   end
  340.   
  341.   def update_command
  342.     if Input.trigger?(Input::B)
  343.       $game_system.se_play($data_system.cancel_se)
  344.       #画面切换
  345.       $scene = Scene_Map.new
  346.       return
  347.     end
  348.     if @left_window.active
  349.       update_left
  350.       return
  351.     end
  352.     if @right_window.active
  353.       update_right
  354.       return
  355.     end
  356.   end
  357.   
  358.   def update_left
  359.     if Input.trigger?(Input::RIGHT)
  360.       if @right_window.item_max > 0
  361.         @left_temp_command = @left_window.index
  362.         @left_window.set_index(-1)
  363.         $game_system.se_play($data_system.cursor_se)
  364.         @left_window.active = false
  365.         @right_window.active = true
  366.         @left_window.refresh
  367.         @right_window.refresh
  368.         @right_window.set_index(@right_temp_command)
  369.         return
  370.       else
  371.         $game_system.se_play($data_system.buzzer_se)
  372.         return
  373.       end
  374.     end
  375.     if Input.trigger?(Input::C)
  376.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  377.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  378.         @left_window.refresh
  379.         @right_window.refresh
  380.       else
  381.         $game_system.se_play($data_system.buzzer_se)
  382.       end
  383.     end
  384.     return
  385.   end
  386.   
  387.   def update_right
  388.     if Input.trigger?(Input::LEFT)
  389.       if @left_window.item_max > 0
  390.         @right_temp_command = @right_window.index
  391.         @right_window.set_index(-1)
  392.         $game_system.se_play($data_system.cursor_se)
  393.         @left_window.active = true
  394.         @right_window.active = false
  395.         @left_window.refresh
  396.         @right_window.refresh
  397.         @left_window.set_index(@left_temp_command)
  398.         return
  399.       else
  400.         $game_system.se_play($data_system.buzzer_se)
  401.         return
  402.       end
  403.     end
  404.     if Input.trigger?(Input::C)
  405.       if $game_party.actors.size >= 4
  406.         $game_system.se_play($data_system.buzzer_se)
  407.         return
  408.       end
  409.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  410.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  411.         if $game_party.actors2.size == 0
  412.           @right_temp_command = @right_window.index
  413.           @right_window.set_index(-1)
  414.           $game_system.se_play($data_system.cursor_se)
  415.           @left_window.active = true
  416.           @right_window.active = false
  417.           @left_window.refresh
  418.           @right_window.refresh
  419.           @left_window.set_index(@left_temp_command)
  420.         end
  421.         if @right_window.index > 0
  422.           @right_window.set_index(@right_window.index-1)
  423.         end
  424.         @left_window.refresh
  425.         @right_window.refresh
  426.       else
  427.         $game_system.se_play($data_system.buzzer_se)
  428.       end
  429.     end
  430.     return
  431.   end
  432.   
  433.   def update_data
  434.     if @left_window.active
  435.       if $game_party.actors[@left_window.index] != nil
  436.         @data_window.set_actor($game_party.actors[@left_window.index])
  437.       else
  438.         @data_window.clear
  439.       end
  440.       return
  441.     end
  442.     if @right_window.active
  443.       if $game_party.actors2[@right_window.index] != nil
  444.         @data_window.set_actor($game_party.actors2[@right_window.index])
  445.       else
  446.         @data_window.clear
  447.       end
  448.       return
  449.     end
  450.   end
  451. end
复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
 楼主| 发表于 2014-10-24 22:25:27 | 显示全部楼层
这两个就是偶现在用的脚本,那个...可以直接改的话当然很好,但我还放了几个字幕地图名得失物品提示嘲讽技能名字输入血条显示装备界面改良等等等等的脚本,不知道会不会不兼容,所以还是觉得重新写比较好......突然觉得自己有点作死诶......不过真的很麻烦各位大师,先谢谢你们啦!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
 楼主| 发表于 2014-10-24 22:57:37 | 显示全部楼层
附注:所需脚本效果:
1:战斗前选择出战队友
2:因为要有选择所以人物仓库上限至少45人
3:选择队友的系统可以自己设定在哪场战斗前启用
4:队友选择界面显示人物行走图和携带技能,因为我的设定是一个角色带一个技能,等级和职业就不用了因为都是固定的(嘿嘿剧情需要嘛)

难度似乎很高哈......又在做死了我.....也许还有其他的需要看情况再说好了......
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-3-9
回帖
30
 楼主| 发表于 2014-10-25 22:55:47 | 显示全部楼层
自顶一个好了...怕没人看见......
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部