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

Project1

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

梦大陆物语的战斗系统

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2007-5-31
帖子
89
跳转到指定楼层
1
发表于 2007-7-6 00:52:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
谁能帮我从梦大陆物语里
提取游戏的战斗系统
我不要下载(要好几个小时,我家网路慢)

拜托各位大人了
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2007-5-31
帖子
89
2
 楼主| 发表于 2007-7-6 00:52:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
谁能帮我从梦大陆物语里
提取游戏的战斗系统
我不要下载(要好几个小时,我家网路慢)

拜托各位大人了
版务信息:本贴由楼主自主结贴~

Lv3.寻梦者

梦石
0
星屑
1564
在线时间
146 小时
注册时间
2007-4-1
帖子
4263

开拓者贵宾

3
发表于 2007-7-6 01:09:30 | 只看该作者
那个是未加密的吧。。。。楼主直接从脚本库里把战斗脚本拿走就可以了。
回归,重拾一下绘图工房的管理,先让我熟悉一下,请多指教 ( ´▽` )ノ
新加分规则试行中,如发现问题欢迎提出
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2007-2-18
帖子
2464
4
发表于 2007-7-6 01:10:09 | 只看该作者
那东西真 不错,超华丽的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

┿动サ漫FANS

梦石
0
星屑
50
在线时间
2 小时
注册时间
2007-7-6
帖子
508
5
发表于 2007-7-8 07:21:09 | 只看该作者
是嗎?
我沒看過
[fly][/fly]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

Dancer-

梦石
0
星屑
105
在线时间
78 小时
注册时间
2006-5-15
帖子
3306
6
发表于 2007-7-8 07:54:15 | 只看该作者
以下引用kaze于2007-7-5 17:10:09的发言:

那东西真 不错,超华丽的


日本的战斗系统,全套都是。
幻森有汉化。
一个机缘巧合后,被改变了人生的第八年。
养着两只猫,可是我对猫过敏。
为了那终将到来的一天。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-8
帖子
20
7
发表于 2007-7-8 09:07:29 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2007-3-7
帖子
140
8
发表于 2007-7-9 23:37:46 | 只看该作者
好多字的脚本,帖子字数:最大 32768 字符,我分成3份,第一份
注意!三份要粘贴在一起!
  1. =begin
  2.   #--------------------------------------------------------------------------
  3.  # ● 人物行走图做战斗图像(附加动画) ver1.02
  4.   #--------------------------------------------------------------------------
  5.   制作者 らい
  6.   翻译:忧郁的涟漪
  7.   
  8.    
  9.   图像文件的规格
  10.   
  11.   ● 巴特勒图像(似乎指的是战斗图像)
  12.   
  13.   使用步行图片。
  14.    
  15.   ● 武器的图像
  16.   
  17.   就是武器图标的图像(ICO图)  
  18.       
  19. =end

  20.   
  21. module Side_view
  22.   #--------------------------------------------------------------------------
  23.   # ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
  24.   #    在Scene_Battle计算方法是否是方法synthe?
  25.   #    在自动不想认识的时候,请重写。
  26.   #--------------------------------------------------------------------------
  27.   if Scene_Battle.method_defined?("synthe?")
  28.     RTAB = false
  29.   else
  30.     RTAB = false
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 改正RATB中的位置误差 ☆自动识别
  34.   #    在自动不想认识的时候,请重写。
  35.   #--------------------------------------------------------------------------
  36.   def camera_correctness
  37.     return false if !RTAB
  38.     begin
  39.       return $scene.drive
  40.     rescue
  41.       return false
  42.     end
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 队伍中的最大人数
  46.   #--------------------------------------------------------------------------
  47.   Party_max = 4
  48.   #--------------------------------------------------------------------------
  49.   # ● 战斗图的扩大率(1.0的时候是保持原有大小)
  50.   #--------------------------------------------------------------------------
  51.   CHAR_ZOOM = 1.0
  52.   #--------------------------------------------------------------------------
  53.   # ● 光标的位置修正(基本不需要改~)
  54.   #--------------------------------------------------------------------------
  55.   ARROW_OX = 0
  56.   ARROW_OY = 64
  57.   #--------------------------------------------------------------------------
  58.   # ● 名状态作为飞行管理的排列(不知道什么意思....)
  59.   #--------------------------------------------------------------------------
  60.   FLY_STATES = ["飞行"]
  61.   #--------------------------------------------------------------------------
  62.   # ● 战斗画面的位置
  63.   #--------------------------------------------------------------------------
  64.   PARTY_X = 420     # 队伍 X 位置
  65.   PARTY_Y = 230     # 队伍 Y 位置120
  66.   FORMATION_X = 30  # 各个角色之间的间隔 X
  67.   FORMATION_Y = 30  # 各个角色之间的间隔 Y48
  68.   #--------------------------------------------------------------------------
  69.   # ● 自定义常数
  70.   #--------------------------------------------------------------------------
  71.   NORMAL   = "NORMAL"
  72.   WALK_R   = "WALK_R"
  73.   WALK_L   = "WALK_L"
  74.   ATTACK   = "ATTACK"
  75.   ATTACK_R = "ATTACK_R"
  76.   ATTACK_L = "ATTACK_L"
  77.   MAGIC    = "MAGIC"
  78.   ITEM     = "ITEM"
  79.   # 动画的设定
  80.   ANIME = {
  81.     # [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
  82.     NORMAL            => [1,true , 0,false, true ,""    ], # 通常待击
  83.     WALK_R            => [2,true , 2,false, false,""    ], # 右移动2
  84.     WALK_L            => [1,true , 2,true, false,""    ], # 左移动2
  85.     ATTACK_R          => [1,false, 2,true , false,"右手"], # 右手攻击
  86.     ATTACK_L          => [1,false, 2,true , false,"左手"], # 左手攻击
  87.     MAGIC             => [1,false, 2,false, false,""    ], # 右手攻击
  88.     ITEM              => [1,false, 2,false, false,""    ], # 左手攻击
  89.     }
  90.    
  91.   # 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)  
  92.   ANIME.default = [1,false,12,false,"",""]
  93.   
  94.   # 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
  95.   # "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
  96.   DUAL_WEAPONS_ANIME = [ATTACK]
  97.   
  98.   #--------------------------------------------------------------------------
  99.   # ● 摇晃的设定
  100.   #--------------------------------------------------------------------------
  101.   SHAKE_FILE = "摇晃"  # 文件名
  102.   SHAKE_POWER = 5          # 强度
  103.   SHAKE_SPEED = 5          # 速度
  104.   SHAKE_DURATION = 5      # 时间
  105.   #--------------------------------------------------------------------------
  106.   # ● 上下反转地的设定
  107.   #--------------------------------------------------------------------------
  108.   UPSIDE_DOWN_FILE = "上下反转" # 文件名
  109.   #--------------------------------------------------------------------------
  110.   # ● 左右反转地的设定
  111.   #--------------------------------------------------------------------------
  112.   REVERSE_FILE = "左右反转" # 文件名
  113.   #--------------------------------------------------------------------------
  114.   # ● 回转地的设定
  115.   #--------------------------------------------------------------------------
  116.   TURNING_FILE = "回转" # 文件名
  117.   TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
  118.   TURNING_SPEED = 35    # 速度
  119.   TURNING_DURATION = 1  # 回转数
  120.   #--------------------------------------------------------------------------
  121.   # ● 移动的设定
  122.   #--------------------------------------------------------------------------
  123.   MOVE_FILE = "移动"             # 文件名
  124.   MOVE_RETURN = 1                # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
  125.   MOVE_SPEED = 2                # 速度
  126.   MOVE_COORDINATES = [0,-640]    # 原来位置的相对坐标
  127.   #--------------------------------------------------------------------------
  128.   # ● 动画追加的设定
  129.   #--------------------------------------------------------------------------
  130.   ADD_ANIME_FILE = "动画追加"  # 文件名
  131.   ADD_ANIME_ID = 0               # 动画的ID
  132.   #--------------------------------------------------------------------------
  133.   # ● 债务不履行声明和RTAB的数据转换
  134.   #--------------------------------------------------------------------------
  135.   def convert_battler
  136.     return RTAB ? @active_actor : @active_battler
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 债务不履行声明和RTAB的数据转换2
  140.   #--------------------------------------------------------------------------
  141.   def convert_battler2(*arg)
  142.     return RTAB ? arg[0] : @active_battler
  143.   end
  144. end

  145. #--------------------------------------------------------------------------
  146. # ● 行动設定
  147. #--------------------------------------------------------------------------
  148. module BattleActions
  149.   
  150.   # 下のものはあくまでも一例なので
  151.   # 独自に作ってください。

  152.   Actions = {

  153.   "通常攻撃" => [
  154.   
  155.   "閃きアニメ",
  156.   "アクターアニメ変更#WALK_L",
  157.   "移動#target,32,0,64,0",
  158.   "行動アニメ",
  159.   "アクターアニメ変更#ATTACK",
  160.   "遠距離アニメ",
  161.   "対象アニメ",
  162.   "アクターアニメ変更#WALK_L",
  163.   "SEの演奏#016-Jump02,80,100",
  164.   "移動#self,0,0,48,32",
  165.   "終了"
  166.   ],
  167.   
  168.   "エネミー攻撃" => [
  169.   
  170.   "閃きアニメ",
  171.   "アクターアニメ変更#WALK_L",
  172.   "移動#self,-36,0,12,0",
  173.   "行動アニメ",
  174.   "アクターアニメ変更#ATTACK",
  175.   "遠距離アニメ",
  176.   "対象アニメ",
  177.   "アクターアニメ変更#WALK_L",
  178.   "移動#self,0,0,12,0",
  179.   "終了"
  180.   ],
  181.   
  182.   
  183.   "術発動" => [
  184.   
  185.   "閃きアニメ",
  186.   "アクターアニメ変更#WALK_L",
  187.   "移動#self,-32,0,4,0",
  188.   "アクターアニメ変更#MAGIC",
  189.   "行動アニメ",
  190.   "ウエイト#15",
  191.   "遠距離アニメ",
  192.   "対象アニメ",
  193.   "アクターアニメ変更#WALK_L",
  194.   "移動#self,0,0,4,2",
  195.   "終了"
  196.   ],

  197.   "アイテム使用" => [
  198.   
  199.   "閃きアニメ",
  200.   "アクターアニメ変更#WALK_L",
  201.   "移動#self,-32,0,4,0",
  202.   "行動アニメ",
  203.   "アクターアニメ変更#ITEM",
  204.   "ウエイト#15",
  205.   "遠距離アニメ",
  206.   "対象アニメ",
  207.   "アクターアニメ変更#WALK_L",
  208.   "移動#self,0,0,4,2",
  209.   "終了"
  210.   ],
  211.   
  212.   "払い抜け" => [
  213.   
  214.   "閃きアニメ",
  215.   "アクターアニメ変更#WALK_L",
  216.   "移動#target_near,50,0,48,30",  
  217.   "アクターアニメ固定#ATTACK#3",
  218.   "行動アニメ",
  219.   "遠距離アニメ",
  220.   "残像表示",
  221.   "移動#target_far,-50,0,48,0",
  222.   "対象アニメ",
  223.   "残像消去",
  224.   "アニメ固定解除",
  225.   "アクターアニメ変更#WALK_L",
  226.   "移動#self,0,0,48,1,0",
  227.   "終了"
  228.   ],
  229.   } # ここで終わり 消さないでください

  230. end
  231.   
  232. module RPG
  233.   class Weapon
  234.     #--------------------------------------------------------------------------
  235.     # ● アクション設定
  236.     #--------------------------------------------------------------------------
  237.     def battle_actions
  238.       case @id
  239.       when 1 # ブロンズソード
  240.         return BattleActions::Actions["通常攻撃"]
  241.       end
  242.       return BattleActions::Actions["通常攻撃"]
  243.     end
  244.   end
  245.   class Skill
  246.     #--------------------------------------------------------------------------
  247.     # ● アクション設定
  248.     #--------------------------------------------------------------------------
  249.     def battle_actions
  250.       if self.magic?
  251.         return BattleActions::Actions["術発動"]
  252.       else
  253.         return BattleActions::Actions["払い抜け"]
  254.       end
  255.     end
  256.   end
  257.   class Item
  258.     #--------------------------------------------------------------------------
  259.     # ● アクション設定
  260.     #--------------------------------------------------------------------------
  261.     def battle_actions
  262.       return BattleActions::Actions["アイテム使用"]
  263.     end
  264.   end
  265. end
  266. class Game_Enemy < Game_Battler
  267.   #--------------------------------------------------------------------------
  268.   # ● アクション設定
  269.   #--------------------------------------------------------------------------
  270.   def battle_actions
  271.     return BattleActions::Actions["エネミー攻撃"]
  272.   end
  273. end
  274. =begin
  275. #--------------------------------------------------------------------------
  276. # ● 遠距離アニメーション
  277. #--------------------------------------------------------------------------
  278.  ☆ 説明
  279.   
  280.    行動者から対象者にアニメを飛ばします。
  281.    飛ばすアニメを データベース‐アニメーション で作ります。
  282.     [アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。


  283.   ● カスタマイズ方法
  284.    
  285.     case @id
  286.     when 17,18,19,20
  287.       return [101,32,false,false]
  288.     when 21,22,23,24
  289.       return [102,32,false,false]
  290.     end
  291.     return 0
  292.    
  293.     のように描くとID別に指定可能です。
  294.    
  295.    
  296.   ● アニメーションID
  297.   
  298.   飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
  299.   
  300.    
  301.   ● スピード
  302.   
  303.   大きいほうが早い(0だとアニメは移動しません)
  304.   
  305.   1 = 1フレームで1ドット進むと考えてください。
  306.   
  307.   ● 往復するか?
  308.   
  309.   true とした場合、ブーメランのようにアニメが戻ります。
  310.   
  311.   ● 直線(false)or曲線(true)
  312.   
  313.   true  = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
  314.   false = 対象に向かって直線で、アニメが飛びます。
  315.    
  316. =end
  317. module RPG
  318.   class Weapon#★★★★★★★★★★★★★★★★★★★★★
  319.     #--------------------------------------------------------------------------
  320.     # ● 遠距離アニメーション(本来是远距动画的,现在当成给武器的属性吧)
  321.     #--------------------------------------------------------------------------
  322.     def flying_anime
  323.       case @id
  324.       when 7,23,105   #火
  325.         return [224,2,false,false]
  326.       when 39,53,89   #水
  327.         return [231,2,false,false]
  328.       when 5,38,54,88 #土
  329.         return [228,2,false,false]
  330.       when 22,87,117  #风
  331.         return [227,2,false,false]
  332.       when 8,25,57,101#雷
  333.         return [226,2,false,false]
  334.       when 9,37,102   #冰
  335.         return [225,2,false,false]
  336.       when 6,56,85,120    #光
  337.         return [229,2,false,false]
  338.       when 21,55,71,121   #暗
  339.         return [230,2,false,false]
  340.       end
  341.       return [0,0,false,false]
  342.     end
  343.   end
  344.   class Skill
  345.     #--------------------------------------------------------------------------
  346.     # ● 遠距離アニメーション(可以作为远距魔法)
  347.     #--------------------------------------------------------------------------
  348.     def flying_anime
  349.       #case @id
  350.       #when 132 # ブーメランっぽいやつ
  351.      #   return [170,10,true,false]
  352.      # end
  353.       return [0,0,false,false]
  354.     end
  355.   end
  356.   class Item
  357.     #--------------------------------------------------------------------------
  358.     # ● 遠距離アニメーション(远距离道具,手榴弹??)
  359.     #--------------------------------------------------------------------------
  360.     def flying_anime
  361.       case @id
  362.       when 23
  363.         return [159,15,false,true]
  364.       when 73
  365.         return [192,15,false,true]
  366.       end
  367.       return [0,0,false,false]
  368.     end
  369.   end
  370. end

  371. class Game_Enemy < Game_Battler
  372.   #--------------------------------------------------------------------------
  373.   # ● 遠距離アニメーション
  374.   #--------------------------------------------------------------------------
  375.   def flying_anime
  376.     return [0,0,false,false]
  377.   end
  378. end
  379. #==============================================================================
  380. # ■ Game_Battler
  381. #==============================================================================
  382. class Game_Battler
  383.   include Side_view
  384.   #--------------------------------------------------------------------------
  385.   # ● 追加・公開インスタンス変数
  386.   #--------------------------------------------------------------------------
  387.   attr_accessor :height                  # 画像の高さ
  388.   attr_accessor :real_x                  # X座標補正
  389.   attr_accessor :real_y                  # Y座標補正
  390.   attr_accessor :real_zoom               # 拡大率
  391.   attr_accessor :wait_count              # アニメーション 待ち時間
  392.   attr_accessor :wait_count2             # アニメーション 待ち時間2
  393.   attr_accessor :pattern                 # アニメーション カウント(キャラ)
  394.   attr_accessor :shake                   # シェイク開始フラッグ
  395.   attr_accessor :reverse                 # 左右反転フラッグ
  396.   attr_accessor :shadow                  # 残像フラッグ
  397.   attr_accessor :flash_flag              # 閃きフラッグ
  398.   attr_reader   :ox                      # X座標補正
  399.   attr_reader   :oy                      # Y座標補正
  400.   attr_reader   :flying_x                # 遠距離アニメX座標
  401.   attr_reader   :flying_y                # 遠距離アニメY座標
  402.   attr_reader   :flying_anime            # 遠距離アニメ
  403.   attr_reader   :animation1_on           # 行動アニメ開始フラッグ
  404.   attr_reader   :animation2_on           # 対象アニメ開始フラッグ
  405.   #--------------------------------------------------------------------------
  406.   # ● デフォルトのアニメーション待ち時間を取得
  407.   #--------------------------------------------------------------------------
  408.   def animation_duration=(animation_duration)
  409.     @_animation_duration = animation_duration
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● バトル開始時のセットアップ
  413.   #--------------------------------------------------------------------------
  414.   def start_battle
  415.     @height = 0
  416.     @real_x = 0
  417.     @real_y = 0
  418.     @real_zoom = 1.0
  419.     @battler_condition = ""
  420.     @action = nil
  421.     @battle_actions = []
  422.     @battler_action = false
  423.     @step = 0
  424.     @anime_on = false
  425.     @wait_count = 0
  426.     @wait_count2 = 0
  427.     @ox = 0
  428.     @oy = 0
  429.     @pattern = 0
  430.     @pattern_log = true
  431.     @pattern_freeze = false
  432.     @condition_freeze = false
  433.     @active = false
  434.     @move_distance = nil
  435.     @move_wait = 0
  436.     @move_coordinates = [0,0,0,0]
  437.     @flying_distance = nil
  438.     @flying_wait = 0
  439.     @flying_x = 0
  440.     @flying_y = 0
  441.     @flash_flag = {}
  442.     self.flying_clear
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 移動中判定
  446.   #--------------------------------------------------------------------------
  447.   def moving?
  448.     # X座標補正または、Y座標補正が0でなければ、移動中
  449.     return (@ox != 0 or @oy != 0)
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 移動終了判定
  453.   #--------------------------------------------------------------------------
  454.   def move_end?
  455.     return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● アクション開始設定
  459.   #--------------------------------------------------------------------------
  460.   def action(flag = true)
  461.     @battler_action = flag
  462.     @animation1_on = false
  463.     @animation2_on = false
  464.     @step = "setup"
  465.   end   
  466.   #--------------------------------------------------------------------------
  467.   # ● アクション中判定
  468.   #--------------------------------------------------------------------------
  469.   def action?
  470.     return @battler_action
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 閃き判定
  474.   #--------------------------------------------------------------------------
  475.   def flash?
  476.     return @flash_flg
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 戦闘不能判定
  480.   #--------------------------------------------------------------------------
  481.   def anime_dead?
  482.     if $game_temp.in_battle and !RTAB
  483.       if [2,3,4,5].include?($scene.phase4_step)
  484.         return @last_dead
  485.       end
  486.     end
  487.     return @last_dead = self.dead?
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● ピンチ状態判定
  491.   #--------------------------------------------------------------------------
  492.   def crisis?
  493.     if $game_temp.in_battle and !RTAB
  494.       if [2,3,4,5].include?($scene.phase4_step)
  495.         return @last_crisis
  496.       end
  497.     end
  498.     return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● バッドステート判定
  502.   #--------------------------------------------------------------------------
  503.   def badstate?
  504.     for i in @states
  505.       unless $data_states[i].nonresistance
  506.         return true
  507.       end
  508.     end
  509.     return false
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● 飛行
  513.   #--------------------------------------------------------------------------
  514.   def fly
  515.     if @fly != nil
  516.       return @fly
  517.     end
  518.     for id in @states
  519.       if FLY_STATES.include?($data_states[id].name)
  520.         return 60
  521.       end
  522.     end
  523.     return 0
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● 遠距離アニメ目標座標の計算
  527.   #--------------------------------------------------------------------------
  528.   def flying_setup
  529.     # 二度目は実行しない
  530.     return if @flying_distance != nil && !camera_correctness
  531.     if RTAB
  532.       targets = @target
  533.     else
  534.       targets = $scene.target_battlers
  535.     end
  536.     # 目的座標を計算
  537.     @f_target_x = 0
  538.     @f_target_y = 0
  539.     for t in targets
  540.       @f_target_x += t.screen_x
  541.       @f_target_y += t.screen_y
  542.     end
  543.     if targets != []
  544.       @f_target_x /= targets.size
  545.       @f_target_y /= targets.size
  546.     else
  547.       @flying_distance = 0
  548.       return
  549.     end
  550.     # 距離の計算
  551.     @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # ● 遠距離アニメ
  555.   #--------------------------------------------------------------------------
  556.   def flying_animation
  557.     # 戻る
  558.     if @step != "flying" or @flying_distance.nil?
  559.       return [false,true]
  560.     end
  561.     # あらかじめ計算
  562.     self_x = self.screen_x
  563.     self_y = self.screen_y
  564.     @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
  565.     n1 = @flying_wait / @flying_distance.to_f
  566.     if @flying_distance - @flying_wait > @flying_distance / 2
  567.       n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
  568.     else
  569.       n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
  570.     end
  571.     if !@flying_anime[4]
  572.       # 直線移動
  573.       x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  574.       y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
  575.     else
  576.       # 曲線移動
  577.       if !@flying_proceed_end
  578.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  579.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
  580.       else
  581.         x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
  582.         y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
  583.       end
  584.     end
  585.     # 座標代入
  586.     @flying_x = x
  587.     @flying_y = y
  588.     # ウエイト
  589.     if !@flying_proceed_end
  590.       # 開始
  591.       @flying_proceed_start = @flying_wait == 0
  592.       @flying_wait += @flying_anime[1]
  593.       @flying_wait = [@flying_wait,@flying_distance].min
  594.       @flying_proceed_end = @flying_wait == @flying_distance
  595.     else
  596.       # 開始
  597.       @flying_return_start = @flying_wait == @flying_distance
  598.       @flying_wait -= @flying_anime[1]
  599.       @flying_wait = [@flying_wait,0].max
  600.       @flying_return_end = @flying_wait == 0
  601.     end
  602.     if @flying_anime[1] == 0
  603.       @flying_end = true
  604.     elsif !@flying_anime[2]
  605.       @flying_end = @flying_proceed_end
  606.     else
  607.       @flying_end = @flying_return_end
  608.     end
  609.     # 値を返す(アニメ開始,アニメ終了)
  610.     return [@flying_proceed_start,@flying_end]
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● 遠距離アニメ初期化
  614.   #--------------------------------------------------------------------------
  615.   def flying_clear
  616.     @flying_proceed_start = false
  617.     @flying_proceed_end = false
  618.     @flying_return_start = false
  619.     @flying_return_end = false
  620.     @flying_end = false
  621.     @flying_anime = [0,0,false]
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ● 移動
  625.   #--------------------------------------------------------------------------
  626.   def move
  627.     # 距離の計算
  628.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  629.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  630.     if @move_distance > 0
  631.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  632.       array = @move_coordinates
  633.       # ジャンプ補正値の計算
  634.       if @move_distance - @move_wait > @move_distance / 2
  635.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  636.       else
  637.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  638.       end
  639.       jump = @move_action[4] > 0 ? -jump : jump
  640.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  641.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  642.       # ウエイト
  643.       @move_wait -= @move_action[3]
  644.       @move_wait = [@move_wait,0].max
  645.     end
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● 移動アクションの取得
  649.   #--------------------------------------------------------------------------
  650.   def get_move_action
  651.     string = @action.split(/#/)[1]
  652.     string = string.split(/,/)
  653.     @move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● アクションの取得
  657.   #--------------------------------------------------------------------------
  658.   def get_step
  659.     if @action.nil?
  660.       @step = "finish"
  661.       return
  662.     end
  663.     string = @action.split(/#/)[0]
  664.     if string =~ "移動"
  665.       @step = "moving_setup"
  666.     elsif string =~ "アクターアニメ実行"
  667.       @step = "action"
  668.     elsif string =~ "遠距離アニメ"
  669.       @step = "flying"
  670.     elsif string =~ "アクターアニメ変更"
  671.       @step = "change"
  672.     elsif string =~ "行動アニメ"
  673.       @step = "animation1"
  674.     elsif string =~ "対象アニメ"
  675.       @step = "animation2"
  676.     elsif string =~ "ウエイト"
  677.       @step = "wait"
  678.     elsif string =~ "左右反転"
  679.       @step = "reverse"
  680.     elsif string =~ "閃きアニメ"
  681.       @step = "flash"
  682.     elsif string =~ "残像表示"
  683.       @step = "shadow_on"
  684.     elsif string =~ "残像消去"
  685.       @step = "shadow_off"
  686.     elsif string =~ "アクターアニメ固定"
  687.       @step = "freeze"
  688.     elsif string =~ "アニメ固定解除"
  689.       @step = "freeze_lifting"
  690.     elsif string =~ "アニメーションの表示"
  691.       @step = "animation_start"
  692.     elsif string =~ "SEの演奏"
  693.       @step = "play_se"
  694.     else
  695.       @step = "finish"
  696.     end
  697.   end
复制代码
来论坛混了3年多了,有2年半 潜水
— —的确我发现我注册的真早
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2007-3-7
帖子
140
9
发表于 2007-7-9 23:38:38 | 只看该作者
第二份

  1.   #--------------------------------------------------------------------------
  2.   # ● フレーム更新 (次のアクションへ)
  3.   #--------------------------------------------------------------------------
  4.   def update_next
  5.     @action = @battle_actions.shift
  6.     @step = get_step
  7.   end
  8.   #--------------------------------------------------------------------------
  9.   # ● フレーム更新 (動作取得)
  10.   #--------------------------------------------------------------------------
  11.   def update_setup
  12.     # アクションの取得
  13.     self.get_actions
  14.     @action = @battle_actions.shift
  15.     @step = get_step
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● フレーム更新 (移動取得)
  19.   #--------------------------------------------------------------------------
  20.   def update_moving_setup
  21.     # 移動アクションの取得
  22.     self.get_move_action
  23.     # 移動目標の設定
  24.     self.move_setup
  25.     @step = "moving"
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● フレーム更新 (移動)
  29.   #--------------------------------------------------------------------------
  30.   def update_moving
  31.     # 移動
  32.     self.move
  33.     self.condition = @battler_condition
  34.     # 移動完了したら次のステップへ
  35.     if move_end?
  36.       @wait_count = 2
  37.       @action = @battle_actions.shift
  38.       @step = get_step
  39.     end
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● フレーム更新 (アニメ実行)
  43.   #--------------------------------------------------------------------------
  44.   def update_action
  45.     con = @action.split(/#/)[1]
  46.     # 右手・左手を分ける
  47.     if DUAL_WEAPONS_ANIME.include?(con)
  48.       if !@first_weapon and @second_weapon
  49.         con = con + "_L"
  50.       else
  51.         con = con + "_R"
  52.       end
  53.     end
  54.     # アニメ変更
  55.     self.condition = con
  56.     # ループか否か
  57.     if !ANIME[@battler_condition][1]
  58.       self.anime_on
  59.     end
  60.     @action = @battle_actions.shift
  61.     @step = get_step
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● フレーム更新 (遠距離アニメ)
  65.   #--------------------------------------------------------------------------
  66.   def update_flying
  67.     # 目標の設定
  68.     self.flying_setup
  69.     # 遠距離アニメ終了
  70.     if @flying_end
  71.       self.flying_clear
  72.       @action = @battle_actions.shift
  73.       @step = get_step
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● フレーム更新 (アニメ変更)
  78.   #--------------------------------------------------------------------------
  79.   def update_change
  80.     con = @action.split(/#/)[1]
  81.     # 右手・左手を分ける
  82.     if DUAL_WEAPONS_ANIME.include?(con)
  83.       if !@first_weapon and @second_weapon
  84.         con = con + "_L"
  85.       else
  86.         con = con + "_R"
  87.       end
  88.     end
  89.     # アニメ変更
  90.     self.condition = con
  91.     # ループか否か
  92.     if !ANIME[@battler_condition][1]
  93.       self.anime_on
  94.     end
  95.     @action = @battle_actions.shift
  96.     @step = get_step
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● フレーム更新 (行動アニメ)
  100.   #--------------------------------------------------------------------------
  101.   def update_animation1
  102.     @animation1_on = true
  103.     # 行動アニメの後に行動を開始する
  104.     if $scene.phase4_step == 3
  105.       id = RTAB ? @anime1 : $scene.animation1_id
  106.       animation = $data_animations[id]
  107.       frame_max = animation != nil ? animation.frame_max : 0
  108.       @wait_count2 = frame_max * 2
  109.       return
  110.     end
  111.     @action = @battle_actions.shift
  112.     @step = get_step
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● フレーム更新 (対象アニメ)
  116.   #--------------------------------------------------------------------------
  117.   def update_animation2
  118.     @animation2_on = true
  119.     # 行動アニメの後に行動を開始する
  120.     if $scene.phase4_step == 4
  121.       id = RTAB ? @anime2 : $scene.animation2_id
  122.       animation = $data_animations[id]
  123.       frame_max = animation != nil ? animation.frame_max : 0
  124.       @wait_count2 = frame_max * 2
  125.       return
  126.     end
  127.     @action = @battle_actions.shift
  128.     @step = get_step
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● フレーム更新 (ウエイト)
  132.   #--------------------------------------------------------------------------
  133.   def update_wait
  134.     @wait_count2 = @action.split(/#/)[1].to_i
  135.     @action = @battle_actions.shift
  136.     @step = get_step
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● フレーム更新 (残像表示)
  140.   #--------------------------------------------------------------------------
  141.   def update_shadow_on
  142.     @shadow = true
  143.     @action = @battle_actions.shift
  144.     @step = get_step
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● フレーム更新 (残像消去)
  148.   #--------------------------------------------------------------------------
  149.   def update_shadow_off
  150.     @shadow = false
  151.     @action = @battle_actions.shift
  152.     @step = get_step
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● フレーム更新 (左右反転)
  156.   #--------------------------------------------------------------------------
  157.   def update_reverse
  158.     @reverse = @reverse ? false : true
  159.     @action = @battle_actions.shift
  160.     @step = get_step
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● フレーム更新 (閃きアニメ)
  164.   #--------------------------------------------------------------------------
  165.   def update_flash
  166.     # 閃きアニメの後に行動を開始する
  167.     if @flash_flag["normal"]
  168.       @wait_count = $scene.flash_duration
  169.       @flash_flag["normal"] = false
  170.       return
  171.     end
  172.     @action = @battle_actions.shift
  173.     @step = get_step
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● フレーム更新 (SEの演奏)
  177.   #--------------------------------------------------------------------------
  178.   def update_play_se
  179.     data = @action.split(/#/)[1]
  180.     data = data.split(/,/)
  181.     # SE を演奏
  182.     Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
  183.     @action = @battle_actions.shift
  184.     @step = get_step
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● フレーム更新 (アクターアニメ固定)
  188.   #--------------------------------------------------------------------------
  189.   def update_freeze
  190.     con = @action.split(/#/)[1]
  191.     # 右手・左手を分ける
  192.     if DUAL_WEAPONS_ANIME.include?(con)
  193.       if !@first_weapon and @second_weapon
  194.         con = con + "_L"
  195.       else
  196.         con = con + "_R"
  197.       end
  198.     end
  199.     # アニメ変更
  200.     self.condition = con
  201.     @pattern = @action.split(/#/)[2].to_i
  202.     @pattern_freeze = true
  203.     @condition_freeze = true
  204.     @action = @battle_actions.shift
  205.     @step = get_step
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● フレーム更新 (アクターアニメ固定解除)
  209.   #--------------------------------------------------------------------------
  210.   def update_freeze_lifting
  211.     @pattern_freeze = false
  212.     @condition_freeze = false
  213.     @action = @battle_actions.shift
  214.     @step = get_step
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● フレーム更新 (アニメーションの表示)
  218.   #--------------------------------------------------------------------------
  219.   def update_animation_start
  220.     data = @action.split(/#/)[1]
  221.     data = data.split(/,/)
  222.     target = data[0]
  223.     animation_id = data[1].to_i
  224.     if RTAB
  225.       case target
  226.       when "self"
  227.         @animation.push([animation_id,true])
  228.       when "target"
  229.         for tar in @target
  230.           tar.animation.push([animation_id, true])
  231.         end
  232.       end
  233.     else
  234.       case target
  235.       when "self"
  236.         @animation_id = animation_id
  237.         @animation_hit = true
  238.       when "target"
  239.         for tar in $scene.target_battlers
  240.           tar.animation_id = animation_id
  241.           tar.animation_hit = true
  242.         end
  243.       end
  244.     end
  245.     @action = @battle_actions.shift
  246.     @step = get_step
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● フレーム更新 (動作終了)
  250.   #--------------------------------------------------------------------------
  251.   def update_finish
  252.     # 動作終了
  253.     @battler_action = false
  254.     @step = "setup"
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● バトラーの状態 変更(バトラーグラフィックのタイプ)
  258.   #--------------------------------------------------------------------------
  259.   def condition=(condition)
  260.     return if @condition_freeze
  261.     @battler_condition = condition
  262.     @wait_count = ANIME[condition][2]
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # ● バトラーの状態(バトラーグラフィックのタイプ)
  266.   #--------------------------------------------------------------------------
  267.   def condition
  268.     return @battler_condition
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● フレーム更新
  272.   #--------------------------------------------------------------------------
  273.   def update
  274.     # ウェイト中の場合
  275.     if @wait_count > 0
  276.       return
  277.     end
  278.     # パターン更新
  279.     self.char_animation
  280.     # ウェイト中の場合
  281.     if @wait_count2 > 0
  282.       return
  283.     end
  284.    
  285.     # 行動アニメーション
  286.     if @battler_action
  287.       method("update_" + @step).call
  288.       return
  289.     end
  290.    
  291.     # データ初期化
  292.     @animation1_on = false
  293.     @animation2_on = false
  294.     @action = nil
  295.     @battle_actions = []
  296.     @move_wait = 0
  297.     @move_distance = nil
  298.     @flying_wait = 0
  299.     @flying_distance = nil
  300.     @flash = false

  301.     # RTAB対応
  302.     # 通常・待機
  303.     return self.condition = NORMAL
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● アクションの取得
  307.   #--------------------------------------------------------------------------
  308.   def get_actions
  309.     skill = $data_skills[self.current_action.skill_id]
  310.     item = $data_items[self.current_action.item_id]
  311.     kind = self.current_action.kind
  312.     # 動作取得
  313.     @battle_actions = []
  314.     # スキル
  315.     if skill != nil && kind == 1
  316.       @battle_actions = skill.battle_actions.dup
  317.       @flying_anime = skill.flying_anime
  318.     # アイテム
  319.     elsif item != nil && kind == 2
  320.       @battle_actions = item.battle_actions.dup
  321.       @flying_anime = item.flying_anime
  322.     # 左手攻撃
  323.     elsif !@first_weapon and @second_weapon and self.is_a?(Game_Actor)
  324.       @battle_actions = self.battle_actions2.dup
  325.       @flying_anime = self.flying_anime2
  326.     # 右手攻撃
  327.     elsif self.current_action.basic == 0 and
  328.       self.is_a?(Game_Actor) and self.current_action.kind == 0
  329.       @battle_actions = self.battle_actions1.dup
  330.       @flying_anime = self.flying_anime1
  331.     # 通常攻撃
  332.     elsif self.current_action.basic == 0 and self.current_action.kind == 0
  333.       @battle_actions = self.battle_actions.dup
  334.       @flying_anime = self.flying_anime
  335.     else
  336.       @battle_actions = ["終了"]
  337.       @flying_anime = [0,0,false,false]
  338.     end
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # ● ループしないアニメのセット
  342.   #--------------------------------------------------------------------------
  343.   def anime_on
  344.     @pattern = 0
  345.     @pattern_log = true
  346.     return
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● パターン更新
  350.   #--------------------------------------------------------------------------
  351.   def char_animation
  352.     # パタン固定の場合もどる
  353.     return if @pattern_freeze
  354.     # ループしないアニメの場合 1234 で止まる
  355.     if !ANIME[@battler_condition][1] && @pattern == 3
  356.       return
  357.     end
  358.     # アニメさせない場合 1 で止まる
  359.     if ANIME[@battler_condition][4]
  360.       @pattern = 0
  361.       return
  362.     end
  363.     @pattern = (@pattern + 1) % 4
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● アニメタイプ
  367.   #--------------------------------------------------------------------------
  368.   def anime_type
  369.     return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
  370.   end
  371. end
  372. #==============================================================================
  373. # ■ Game_Actor
  374. #==============================================================================
  375. class Game_Actor < Game_Battler
  376.   include Side_view
  377.   #--------------------------------------------------------------------------
  378.   # ● セットアップ
  379.   #--------------------------------------------------------------------------
  380.   alias side_view_setup setup
  381.   def setup(actor_id)
  382.     side_view_setup(actor_id)
  383.     start_battle
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 二刀武器のID取得 ※エラー回避用
  387.   #--------------------------------------------------------------------------
  388.   def weapon2_id
  389.     return @weapon2_id != nil ? @weapon2_id : 0
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● X方向 ポジション 取得 (陣形スクリプト拡張用)
  393.   #--------------------------------------------------------------------------
  394.   def position
  395.     return $data_classes[@class_id].position
  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
  399.   #--------------------------------------------------------------------------
  400.   def position2
  401.     return self.index
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● 武器アニメタイプ
  405.   #--------------------------------------------------------------------------
  406.   def weapon_anime_type(type)
  407.     file_name  = weapon_anime_type0(type)
  408.     visible   = weapon_anime_type1(type)
  409.     z         = weapon_anime_type2(type)
  410.     return [file_name,visible,z]
  411.   end
  412.   # 武器アイコン取得
  413.   def weapon_anime_type0(type)
  414.     type = ANIME[type][5]
  415.     return weapon_anime1 if type == "右手"
  416.     return weapon_anime2 if type == "左手"
  417.     return nil
  418.   end
  419.   # 表示・非表示の取得
  420.   def weapon_anime_type1(type)
  421.     return ANIME[type][3]
  422.   end
  423.   # バトラーより上に表示するかどうか
  424.   def weapon_anime_type2(type)
  425.     type = ANIME[type][5]
  426.     return true if type == "左手"
  427.     return false
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  431.   #--------------------------------------------------------------------------
  432.   def true_x
  433.     return PARTY_X + position * FORMATION_X + @ox
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  437.   #--------------------------------------------------------------------------
  438.   def true_y
  439.     # パーティ内の並び順から Y 座標を計算して返す
  440.     if self.index != nil
  441.       y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
  442.       return y
  443.     else
  444.       return 0
  445.     end
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● バトル画面 X 座標の取得
  449.   #--------------------------------------------------------------------------
  450.   def screen_x(true_x = self.true_x)
  451.     return 320 + (true_x - 320) * @real_zoom + @real_x
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● バトル画面 Y 座標の取得
  455.   #--------------------------------------------------------------------------
  456.   def screen_y(true_y = self.true_y)
  457.     return true_y * @real_zoom + @real_y
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● バトル画面 Z 座標の取得
  461.   #--------------------------------------------------------------------------
  462.   def screen_z
  463.     return screen_y + 1000
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  467.   #--------------------------------------------------------------------------
  468.   def base_x
  469.     return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● バトル画面 Y 座標の取得
  473.   #--------------------------------------------------------------------------
  474.   def base_y
  475.     return (true_y - @oy) * @real_zoom + @real_y
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ● バトル画面 拡大率の取得
  479.   #--------------------------------------------------------------------------
  480.   def zoom
  481.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  482.                           (true_x + @fly) / 480 + $scene.zoom_rate[0]
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● 攻撃用、バトル画面 X 座標の取得
  486.   #--------------------------------------------------------------------------
  487.   def attack_x(z)
  488.     return (320 - true_x) * z * 0.75
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● 攻撃用、バトル画面 Y 座標の取得
  492.   #--------------------------------------------------------------------------
  493.   def attack_y(z)
  494.     return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 閃き待ち時間
  498.   #--------------------------------------------------------------------------
  499.   def flash_duration
  500.     return $scene.flash_duration
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● アニメーション取得
  504.   #--------------------------------------------------------------------------
  505.   def battle_actions1
  506.     weapon = $data_weapons[@weapon_id]
  507.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ● アニメーション取得
  511.   #--------------------------------------------------------------------------
  512.   def battle_actions2
  513.     weapon = $data_weapons[@weapon2_id]
  514.     return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 武器アニメーション取得
  518.   #--------------------------------------------------------------------------
  519.   def weapon_anime1
  520.     weapon = $data_weapons[@weapon_id]
  521.     return weapon != nil ? weapon.icon_name : ""
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● 武器アニメーション取得
  525.   #--------------------------------------------------------------------------
  526.   def weapon_anime2
  527.     weapon = $data_weapons[@weapon2_id]
  528.     return weapon != nil ? weapon.icon_name : ""
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ● 遠距離アニメーション取得
  532.   #--------------------------------------------------------------------------
  533.   def flying_anime1
  534.     weapon = $data_weapons[@weapon_id]
  535.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # ● 遠距離アニメーション取得
  539.   #--------------------------------------------------------------------------
  540.   def flying_anime2
  541.     weapon = $data_weapons[@weapon2_id]
  542.     return weapon != nil ? weapon.flying_anime : [0,0,false,false]
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 移動目標座標の計算
  546.   #--------------------------------------------------------------------------
  547.   def move_setup
  548.     if RTAB
  549.       targets = @target
  550.     else
  551.       targets = $scene.target_battlers
  552.     end
  553.     case @move_action[0]
  554.     when "self" # 自分
  555.       @target_x = self.base_x
  556.       @target_y = self.base_y
  557.     when "target_near" # 一番近くのターゲット
  558.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  559.       targets.reverse!
  560.       if targets != []
  561.         @target_x = targets[0].screen_x
  562.         @target_y = targets[0].screen_y
  563.       else
  564.         @target_x = self.base_x
  565.         @target_y = self.base_y
  566.       end
  567.     when "target_far" # 一番遠くのターゲット
  568.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  569.       if targets != []
  570.         @target_x = targets[0].screen_x
  571.         @target_y = targets[0].screen_y
  572.       else
  573.         @target_x = self.base_x
  574.         @target_y = self.base_y
  575.       end
  576.     when "target" # ターゲット中央
  577.       @target_x = 0
  578.       @target_y = 0
  579.       for t in targets
  580.         @target_x += t.screen_x
  581.         @target_y += t.screen_y
  582.       end
  583.       if targets != []
  584.         @target_x /= targets.size
  585.         @target_y /= targets.size
  586.       end
  587.     when "troop" # "トループ中央"
  588.       @target_x = 0
  589.       @target_y = 0
  590.       for t in $game_troop.enemies
  591.         @target_x += t.screen_x
  592.         @target_y += t.screen_y
  593.       end
  594.       if $game_troop.enemies != []
  595.         @target_x /= $game_troop.enemies.size
  596.         @target_y /= $game_troop.enemies.size
  597.       end
  598.     when "party" # "パーティ中央"
  599.       @target_x = 0
  600.       @target_y = 0
  601.       for t in $game_party.actors
  602.         @target_x += t.screen_x
  603.         @target_y += t.screen_y
  604.       end
  605.       if $game_party.actors != []
  606.         @target_x /= $game_party.actors.size
  607.         @target_y /= $game_party.actors.size
  608.       end
  609.     when "screen" # "画面"
  610.       @target_x = self.base_x
  611.       @target_y = self.base_y
  612.     end
  613.     # 補正
  614.     @target_x += @move_action[1] - self.base_x
  615.     @target_y += @move_action[2] - self.base_y
  616.     # 移動目標の座標をセット
  617.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  618.     # 距離の計算(ウエイトの設定)
  619.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  620.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  621.   end
  622. end
  623. #==============================================================================
  624. # ■ Game_Enemy
  625. #==============================================================================
  626. class Game_Enemy < Game_Battler
  627.   #--------------------------------------------------------------------------
  628.   # ● セットアップ
  629.   #--------------------------------------------------------------------------
  630.   alias side_view_initialize initialize
  631.   def initialize(troop_id, member_index)
  632.     side_view_initialize(troop_id, member_index)
  633.     start_battle
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 移動
  637.   #--------------------------------------------------------------------------
  638.   def move
  639.     # 距離の計算
  640.     @move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
  641.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  642.     if @move_distance > 0
  643.       return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
  644.       array = @move_coordinates
  645.       # ジャンプ補正値の計算
  646.       if @move_distance - @move_wait > @move_distance / 2
  647.         jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
  648.       else
  649.         jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
  650.       end
  651.       jump = @move_action[4] > 0 ? -jump : jump
  652.       @ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
  653.       @oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
  654.       # ウエイト
  655.       @move_wait -= @move_action[3]
  656.       @move_wait = [@move_wait,0].max
  657.     end
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ● 移動目標座標の計算
  661.   #--------------------------------------------------------------------------
  662.   def move_setup
  663.     if RTAB
  664.       targets = @target
  665.     else
  666.       targets = $scene.target_battlers
  667.     end
  668.     case @move_action[0]
  669.     when "self" # 自分
  670.       @target_x = self.base_x
  671.       @target_y = self.base_y
  672.     when "target_near" # 一番近くのターゲット
  673.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  674.       if targets != []
  675.         @target_x = targets[0].screen_x
  676.         @target_y = targets[0].screen_y
  677.       else
  678.         @target_x = self.base_x
  679.         @target_y = self.base_y
  680.       end
  681.     when "target_far" # 一番遠くのターゲット
  682.       targets.sort!{|a,b| a.screen_x<=>b.screen_x }
  683.       targets.reverse!
  684.       if targets != []
  685.         @target_x = targets[0].screen_x
  686.         @target_y = targets[0].screen_y
  687.       else
  688.         @target_x = self.base_x
  689.         @target_y = self.base_y
  690.       end
  691.     when "target" # ターゲット中央
  692.       @target_x = 0
  693.       @target_y = 0
  694.       for t in targets
  695.         @target_x += t.screen_x
  696.         @target_y += t.screen_y
  697.       end
  698.       if targets != []
  699.         @target_x /= targets.size
  700.         @target_y /= targets.size
  701.       end
  702.     when  "party" # "トループ中央"
  703.       @target_x = 0
  704.       @target_y = 0
  705.       for t in $game_troop.enemies
  706.         @target_x += t.screen_x
  707.         @target_y += t.screen_y
  708.       end
  709.       if $game_troop.enemies != []
  710.         @target_x /= $game_troop.enemies.size
  711.         @target_y /= $game_troop.enemies.size
  712.       end
  713.     when "troop" # "パーティ中央"
  714.       @target_x = 0
  715.       @target_y = 0
  716.       for t in $game_party.actors
  717.         @target_x += t.screen_x
  718.         @target_y += t.screen_y
  719.       end
  720.       if $game_party.actors != []
  721.         @target_x /= $game_party.actors.size
  722.         @target_y /= $game_party.actors.size
  723.       end
  724.     when "screen" # "画面"
  725.       @target_x = self.base_x
  726.       @target_y = self.base_y
  727.     end
  728.     # 補正
  729.     @target_x -= @move_action[1] + self.base_x
  730.     @target_y -= @move_action[2] + self.base_y
  731.     # 移動目標の座標をセット
  732.     @move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
  733.     # 距離の計算(ウエイトの設定)
  734.     @move_wait     = (@move_coordinates[2] - @move_coordinates[0]).abs +
  735.                      (@move_coordinates[3] - @move_coordinates[1]).abs
  736.   end
  737.   if RTAB
  738.   alias original_x true_x
  739.   alias original_y true_y
  740.   else
  741.   alias original_x screen_x
  742.   alias original_y screen_y
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # ● バトル画面 X 座標の取得(カメラ補正無し)
  746.   #--------------------------------------------------------------------------
  747.   def true_x
  748.     return original_x + @ox
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # ● バトル画面 Y 座標の取得(カメラ補正無し)
  752.   #--------------------------------------------------------------------------
  753.   def true_y
  754.     return original_y - @height / 2 + @oy
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● バトル画面 X 座標の取得
  758.   #--------------------------------------------------------------------------
  759.   def screen_x(true_x = self.true_x)
  760.     return true_x * @real_zoom + @real_x
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # ● バトル画面 Y 座標の取得
  764.   #--------------------------------------------------------------------------
  765.   def screen_y(true_y = self.true_y)
  766.     return true_y * @real_zoom + @real_y
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # ● バトル画面 X 座標の取得(移動などしていない場合)
  770.   #--------------------------------------------------------------------------
  771.   def base_x(true_x = self.true_x)
  772.     return (true_x - @ox) * @real_zoom + @real_x
  773.   end
  774.   #--------------------------------------------------------------------------
  775.   # ● バトル画面 Y 座標の取得(移動などしていない場合)
  776.   #--------------------------------------------------------------------------
  777.   def base_y(true_y = self.true_y)
  778.     return (true_y - @oy) * @real_zoom + @real_y
  779.   end
  780. end
复制代码
来论坛混了3年多了,有2年半 潜水
— —的确我发现我注册的真早
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2007-3-7
帖子
140
10
发表于 2007-7-9 23:39:08 | 只看该作者
第三份
  1. #==============================================================================
  2. # ■ Game_Party
  3. #==============================================================================
  4. class Game_Party
  5.   #--------------------------------------------------------------------------
  6.   # ● アクターを加える
  7.   #     actor_id : アクター ID
  8.   #--------------------------------------------------------------------------
  9.   alias side_view_add_actor add_actor
  10.   def add_actor(actor_id)
  11.     # アクターを取得
  12.     actor = $game_actors[actor_id]
  13.     # サイドビューデータの初期化
  14.     actor.start_battle
  15.     # 戻す
  16.     side_view_add_actor(actor_id)
  17.   end
  18. end
  19. #==============================================================================
  20. # ■ Scene_Battle
  21. #==============================================================================
  22. class Scene_Battle
  23.   include Side_view
  24.   #--------------------------------------------------------------------------
  25.   # ● 公開インスタンス変数
  26.   #--------------------------------------------------------------------------
  27.   attr_reader   :phase            # フェーズ
  28.   attr_reader   :phase4_step      # フェーズ4ステップ
  29.   attr_reader   :active_battler   # 対象の配列
  30.   attr_reader   :target_battlers  # 対象の配列
  31.   attr_reader   :animation1_id    # 行動アニメID
  32.   attr_reader   :animation2_id    # 対象アニメID
  33.   #--------------------------------------------------------------------------
  34.   # ● メイン処理
  35.   #--------------------------------------------------------------------------
  36.   alias side_view_main main
  37.   def main
  38.     # バトラー初期化
  39.     for battler in $game_party.actors + $game_troop.enemies
  40.       battler.start_battle
  41.     end
  42.     # 戻す
  43.     side_view_main
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 閃き判定
  47.   #--------------------------------------------------------------------------
  48.   def flash?
  49.     return @flash_flag ? true : false
  50.   end  
  51.   #--------------------------------------------------------------------------
  52.   # ● 閃きアニメ待ち時間取得
  53.   #--------------------------------------------------------------------------
  54.   def flash_duration
  55.     animation = nil
  56.     if FLASH_ANIME
  57.       animation = $data_animations[FLASH_ANIMATION_ID]
  58.     end
  59.     return animation != nil ? animation.frame_max * 2 + 2 : 0
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  63.   #--------------------------------------------------------------------------
  64.   alias side_view_update_phase4_step2 update_phase4_step2
  65.   def update_phase4_step2(*arg)
  66.     battler = convert_battler2(*arg)
  67.     battler.action
  68.     side_view_update_phase4_step2(*arg)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  72.   #--------------------------------------------------------------------------
  73.   alias side_view_update_phase4_step3 update_phase4_step3
  74.   def update_phase4_step3(*arg)
  75.     battler = convert_battler2(*arg)
  76.     return if !battler.animation1_on and battler.action? and !battler.flash?
  77.     if battler.flash? and FLASH_ANIME
  78.       battler.flash_flag["normal"] = true
  79.     end
  80.     side_view_update_phase4_step3(*arg)
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  84.   #--------------------------------------------------------------------------
  85.   alias side_view_update_phase4_step4 update_phase4_step4
  86.   def update_phase4_step4(*arg)
  87.     battler = convert_battler2(*arg)
  88.     targets = RTAB ? battler.target : @target_battlers
  89.     return if !battler.animation2_on and battler.action?
  90.     side_view_update_phase4_step4(*arg)
  91.     for target in targets
  92.       if RTAB
  93.         value = nil
  94.         if target.damage_sp.include?(battler)
  95.           value = target.damage_sp[battler]
  96.         end
  97.         if target.damage.include?(battler)
  98.           if value == nil or value == "Miss"
  99.             value = target.damage[battler]
  100.           elsif value.is_a?(Numeric) && value > 0
  101.             value = target.damage[battler] == "Miss" ? value : target.damage[battler]
  102.           end
  103.         end
  104.       else
  105.         value = target.damage
  106.       end
  107.       if target.is_a?(Game_Actor)
  108.         # ダメージの場合
  109.         if value.is_a?(Numeric) && value > 0
  110.           # シェイクを開始
  111.           target.shake = true
  112.         end
  113.       elsif target.is_a?(Game_Enemy)
  114.         # ダメージの場合
  115.         if value.is_a?(Numeric) && value > 0
  116.           # シェイクを開始
  117.           target.shake = true
  118.         end
  119.       end
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● プレバトルフェーズ開始
  124.   #--------------------------------------------------------------------------
  125.   alias start_phase1_correct start_phase1
  126.   def start_phase1
  127.     # カメラの設定
  128.     # 元々フロントビュー向けの数値になっているため
  129.     @zoom_rate = [1.0, 1.0]
  130.     start_phase1_correct
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● アクターコマンドフェーズ開始
  134.   #--------------------------------------------------------------------------
  135.   alias start_phase3_correct start_phase3
  136.   def start_phase3
  137.     battler = convert_battler
  138.     start_phase3_correct
  139.     if RTAB
  140.       # カメラの設定
  141.       # 元々フロントビュー向けの数値になっているため
  142.       @camera = "command"
  143.       @spriteset.screen_target(0, 0, 1.0)
  144.     end
  145.   end
  146. end

  147. class Spriteset_Battle
  148.   include Side_view
  149.   #--------------------------------------------------------------------------
  150.   # ● オブジェクト初期化
  151.   #--------------------------------------------------------------------------
  152.   alias side_veiw_initialize initialize
  153.   def initialize
  154.     side_veiw_initialize
  155.     # アクタースプライトを解放
  156.     for sprite in @actor_sprites
  157.       sprite.dispose
  158.     end
  159.     # アクタースプライトを作成
  160.     @actor_sprites = []
  161.     for i in 1..Party_max
  162.       @actor_sprites.push(Sprite_Battler.new(@viewport1))
  163.     end
  164.     update
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 画面のスクロール
  168.   #--------------------------------------------------------------------------
  169.   if method_defined?("screen_scroll")
  170.   alias side_view_screen_scroll screen_scroll
  171.   def screen_scroll
  172.     side_view_screen_scroll
  173.     # アクターの位置補正
  174.     for actor in $game_party.actors
  175.       actor.real_x = @real_x
  176.       actor.real_y = @real_y
  177.       actor.real_zoom = @real_zoom
  178.     end
  179.   end
  180.   end
  181. end

  182. class Sprite_Battler < RPG::Sprite
  183.   include Side_view
  184.   #--------------------------------------------------------------------------
  185.   # ● オブジェクト初期化
  186.   #     viewport : ビューポート
  187.   #     battler  : バトラー (Game_Battler)
  188.   #--------------------------------------------------------------------------
  189.   def initialize(viewport, battler = nil)
  190.     super(viewport)
  191.     @battler = battler
  192.     @battler_visible = false
  193.     @weapon = Sprite_Weapon.new(viewport, battler)
  194.     @flying = Sprite_Flying.new(viewport, battler)
  195.     @shadow = []
  196.     @fly = 0
  197.     @fly_direction = 1
  198.     @rand = rand(10)
  199.     self.effect_clear
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 解放
  203.   #--------------------------------------------------------------------------
  204.   alias side_view_dispose dispose
  205.   def dispose
  206.     side_view_dispose
  207.     @weapon.dispose
  208.     @flying.dispose
  209.     if @_target_sprite != nil
  210.       @_target_sprite.bitmap.dispose
  211.       @_target_sprite.dispose
  212.       @_target_sprite = nil
  213.     end
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● フレーム更新
  217.   #--------------------------------------------------------------------------
  218.   def update
  219.     super
  220.     # バトラーが nil の場合
  221.     if @battler == nil
  222.       self.bitmap = nil
  223.       @weapon.bitmap = nil
  224.       loop_animation(nil)
  225.       return
  226.     end
  227.     # バトラー更新
  228.     @battler.update
  229.     # バトラーアニメのデータ取得
  230.     @anime_type = @battler.anime_type
  231.     # ファイル名か色相が現在のものと異なる場合
  232.     if @battler.is_a?(Game_Actor)
  233.       change = (@battler.character_name != @battler_name or @battler.character_hue != @battler_hue)
  234.     elsif @battler.is_a?(Game_Enemy)
  235.       change = (@battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue)
  236.     else
  237.       return
  238.     end
  239.     if change
  240.       # ビットマップを取得、設定
  241.       if @battler.is_a?(Game_Actor)
  242.         @battler_name = @battler.character_name
  243.         @battler_hue = @battler.character_hue
  244.         self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
  245.         @width = bitmap.width / 4
  246.         @height = bitmap.height / 4
  247.       else
  248.         @battler_name = @battler.battler_name
  249.         @battler_hue = @battler.battler_hue
  250.         self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  251.         @width = bitmap.width
  252.         @height = bitmap.height
  253.       end
  254.       self.ox = @width / 2
  255.       self.oy = @height / 2
  256.       @battler.height = @height
  257.       @flag = true
  258.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  259.       if @battler.dead? or @battler.hidden
  260.         self.opacity = 0
  261.       end
  262.     end
  263.     if @battler.is_a?(Game_Actor) and
  264.       (@battler.anime_type != @anime_type or @battler.pattern != @pattern or @flag)
  265.       # ビットマップを取得、設定
  266.       @pattern = @battler.pattern
  267.       self.ox = @width / 2
  268.       self.oy = @height / 2
  269.       @sx = @pattern * @width
  270.       @sy = @anime_type % 4 * @height
  271.       self.src_rect.set(@sx, @sy, @width, @height)
  272.       self.zoom_x = CHAR_ZOOM
  273.       self.zoom_y = CHAR_ZOOM
  274.       @battler.height = @height
  275.       @flag = false
  276.     end
  277.     # 飛行
  278.     update_fly
  279.     # シェイク
  280.     update_shake
  281.     # 回転
  282.     update_turning
  283.     # 反転
  284.     update_reverse   
  285.     # 移動
  286.     update_moving
  287.     # 追加アニメ
  288.     update_add_anime
  289.     # エフェクト効果の適用
  290.     update_effect
  291.     # アニメーション ID が現在のものと異なる場合
  292.     flag = RTAB ? true : @battler.damage == nil
  293.     if flag and @battler.state_animation_id != @state_animation_id
  294.       @state_animation_id = @battler.state_animation_id
  295.       loop_animation($data_animations[@state_animation_id])
  296.     end
  297.     # シェイク
  298.     if @battler.shake
  299.       self.start_shake(5, 5, 5)
  300.       @battler.shake = false
  301.     end
  302.     # 明滅
  303.     if @battler.blink
  304.       blink_on
  305.     else
  306.       blink_off
  307.     end
  308.     # 不可視の場合
  309.     unless @battler_visible
  310.       flag = RTAB ? (@battler.damage.size < 2 or @battler.damage_pop.size < 2) :
  311.                     (@battler.damage == nil or @battler.damage_pop)
  312.       # 出現
  313.       if not @battler.hidden and not @battler.dead? and flag
  314.         appear
  315.         @battler_visible = true
  316.       end
  317.     end
  318.     if RTAB
  319.     # ダメージ
  320.     for battler in @battler.damage_pop
  321.       if battler[0].class == Array
  322.         if battler[0][1] >= 0
  323.           $scene.skill_se
  324.         else
  325.           $scene.levelup_se
  326.         end
  327.         damage(@battler.damage[battler[0]], false, 2)
  328.       else
  329.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  330.       end
  331.       if @battler.damage_sp.include?(battler[0])
  332.         damage(@battler.damage_sp[battler[0]],
  333.                 @battler.critical[battler[0]], 1)
  334.         @battler.damage_sp.delete(battler[0])
  335.       end
  336.       @battler.damage_pop.delete(battler[0])
  337.       @battler.damage.delete(battler[0])
  338.       @battler.critical.delete(battler[0])
  339.     end
  340.     end
  341.     # 可視の場合
  342.     if @battler_visible
  343.       # 武器アニメ
  344.       @weapon.battler = @battler
  345.       @weapon.update
  346.       # 遠距離アニメ
  347.       @flying.battler = @battler
  348.       @flying.update
  349.       # 逃走
  350.       if @battler.hidden
  351.         $game_system.se_play($data_system.escape_se)
  352.         escape
  353.         @battler_visible = false
  354.       end
  355.       # 白フラッシュ
  356.       if @battler.white_flash
  357.         whiten
  358.         @battler.white_flash = false
  359.       end
  360.       if RTAB
  361.       # アニメーション
  362.       if [email protected]?
  363.         for animation in @battler.animation.reverse
  364.           if animation[2]
  365.             animation($data_animations[animation[0]], animation[1], true)
  366.           else
  367.             animation($data_animations[animation[0]], animation[1])
  368.           end
  369.           @battler.animation.delete(animation)
  370.         end
  371.       end
  372.       else
  373.       # アニメーション
  374.       if @battler.animation_id != 0
  375.         animation = $data_animations[@battler.animation_id]
  376.         animation(animation, @battler.animation_hit)
  377.         @battler.animation_id = 0
  378.       end
  379.       end
  380.       # ダメージ
  381.       if !RTAB and @battler.damage_pop
  382.         damage(@battler.damage, @battler.critical)
  383.         @battler.damage = nil
  384.         @battler.critical = false
  385.         @battler.damage_pop = false
  386.       end
  387.       flag = RTAB ? (@battler.damage.empty? and $scene.dead_ok?(@battler)) :
  388.                      @battler.damage == nil
  389.       # コラプス
  390.       if flag and @battler.dead?
  391.         if @battler.is_a?(Game_Actor)
  392.           $game_system.se_play($data_system.actor_collapse_se)
  393.         elsif @battler.is_a?(Game_Enemy)
  394.           $game_system.se_play($data_system.enemy_collapse_se)
  395.         end
  396.         collapse
  397.         @battler_visible = false
  398.       end
  399.     end
  400.     # スプライトの座標を設定
  401.     self.x = @battler.screen_x + @effect_ox
  402.     self.y = @battler.screen_y + @effect_oy
  403.     self.z = @battler.screen_z
  404.     self.zoom_x = @battler.real_zoom
  405.     self.zoom_y = @battler.real_zoom
  406.     # ウェイトカウントを減らす
  407.     @battler.wait_count -= 1
  408.     @battler.wait_count2 -= 1
  409.     # アニメーション待ち時間取得
  410.     @battler.animation_duration = @_animation_duration
  411.     if @battler.is_a?(Game_Actor)
  412.       self.zoom_x *= CHAR_ZOOM
  413.       self.zoom_y *= CHAR_ZOOM
  414.       @weapon.x = self.x + 2
  415.       @weapon.y = self.y + 6
  416.       @weapon.angle = 75 - (4 - @battler.pattern) * 45
  417.       if self.mirror
  418.         @weapon.angle += @weapon.angle - 180
  419.       end
  420.     end
  421.     # 残像
  422.     if @battler.shadow
  423.       if Graphics.frame_count % 2 == 0
  424.         shadow = ::Sprite.new(self.viewport)
  425.         shadow.bitmap = self.bitmap.dup
  426.         shadow.x = self.x
  427.         shadow.y = self.y
  428.         shadow.ox = self.ox
  429.         shadow.oy = self.oy
  430.         shadow.mirror = self.mirror
  431.         shadow.angle = self.angle
  432.         shadow.opacity = 160
  433.         shadow.zoom_x = self.zoom_x
  434.         shadow.zoom_y = self.zoom_y
  435.         if @battler.is_a?(Game_Actor)
  436.           shadow.src_rect.set(@sx, @sy, @width, @height)
  437.         else
  438.           shadow.src_rect.set(0, 0, @width, @height)
  439.         end
  440.         @shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
  441.       end
  442.     end
  443.     for s in @shadow
  444.       if !s[0].disposed?
  445.         s[0].update
  446.         s[1] -= 1
  447.         if s[1] < 1
  448.           if s[0].bitmap != nil
  449.             s[0].bitmap.dispose
  450.           end
  451.           s[0].dispose
  452.         else
  453.           s[0].x = @battler.screen_x(s[2])
  454.           s[0].y = @battler.screen_y(s[3])
  455.         end
  456.       else
  457.         s = nil
  458.       end
  459.     end
  460.     @shadow.compact!
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● エフェクトによる座標系の更新
  464.   #--------------------------------------------------------------------------
  465.   def update_effect
  466.     # 角度の修正
  467.     if @_upside_down
  468.       self.angle = (@_turning + 180) % 360
  469.     else
  470.       self.angle = @_turning
  471.     end
  472.     # X 座標の修正値
  473.     @effect_ox = @_shake + @_moving[0]
  474.     # Y 座標の修正値
  475.     @effect_oy = -@fly + @_moving[1]
  476.     if  @_animation == nil or (RTAB and @_animation.empty?)
  477.       self.effect_clear
  478.     end
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● シェイク更新
  482.   #--------------------------------------------------------------------------
  483.   def update_shake
  484.     if @_shake_duration >= 1 or @_shake != 0
  485.       delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
  486.       if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
  487.         @_shake = 0
  488.       else
  489.         @_shake += delta
  490.       end
  491.       if @_shake > @_shake_power * 2
  492.         @_shake_direction = -1
  493.       end
  494.       if @_shake < - @_shake_power * 2
  495.         @_shake_direction = 1
  496.       end
  497.       if @_shake_duration >= 1
  498.         @_shake_duration -= 1
  499.       end
  500.     end
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● 飛行更新
  504.   #--------------------------------------------------------------------------
  505.   def update_fly
  506.     if @rand > 0
  507.       @rand -= 1
  508.       return
  509.     end
  510.     if @battler.fly != 0
  511.       if @fly < @battler.fly / 4
  512.         @fly_direction = 1
  513.       elsif @fly > @battler.fly / 2
  514.         @fly_direction = -1
  515.       end
  516.       @fly += 0.5 * @fly_direction
  517.     end
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● 回転更新
  521.   #--------------------------------------------------------------------------
  522.   def update_turning
  523.     if @_turning_duration > 0 or @_turning != 0
  524.       @_turning += @_turning_direction * @_turning_speed / 2.0
  525.       # 残り回転数を減らす
  526.       if @_turning_direction == -1
  527.         if @_turning_duration > 0 and @_turning < 0
  528.           @_turning_duration -= 1
  529.         end
  530.       elsif @_turning_direction == 1
  531.         if @_turning_duration > 0 and @_turning >= 360
  532.           @_turning_duration -= 1
  533.         end
  534.       end
  535.       # 以下補正
  536.       while @_turning < 0
  537.         @_turning += 360
  538.       end
  539.       if @_turning_duration <= 0
  540.         @_turning = 0
  541.       end
  542.       @_turning %= 360
  543.     end
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ● 左右反転更新
  547.   #--------------------------------------------------------------------------
  548.   def update_reverse
  549.     if @last_reverse != (@_reverse or @battler.reverse)
  550.       self.mirror = (@_reverse or @battler.reverse)
  551.       @last_reverse = (@_reverse or @battler.reverse)
  552.     end
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 移動更新
  556.   #--------------------------------------------------------------------------
  557.   def update_moving
  558.     @move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  559.                      (@_move_coordinates[3] - @_move_coordinates[1]).abs
  560.     if @move_distance > 0
  561.       return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
  562.       array = @_move_coordinates
  563.       x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  564.       y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
  565.       @_moving = [x, y]
  566.       if @_move_quick_return and @_move_duration == 0
  567.         @_move_coordinates = [0,0,array[0],array[1]]
  568.         @_move_duration = @move_distance
  569.       end
  570.       @_move_duration -= @_move_speed
  571.       @_move_duration = [@_move_duration, 0].max
  572.     end
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 追加アニメ更新 (RTAB限定機能)
  576.   #--------------------------------------------------------------------------
  577.   def update_add_anime
  578.     if RTAB
  579.     # アニメーション
  580.     if @_add_anime_id != 0
  581.       animation = $data_animations[@_add_anime_id]
  582.       animation(animation, true)
  583.       @_add_anime_id = 0
  584.     end
  585.     end
  586.   end
  587.   #--------------------------------------------------------------------------
  588.   # ● エフェクト初期化
  589.   #--------------------------------------------------------------------------
  590.   def effect_clear
  591.     @_effect_ox = 0
  592.     @_effect_oy = 0
  593.     @_shake_power = 0
  594.     @_shake_speed = 0
  595.     @_shake_duration = 0
  596.     @_shake_direction = 1
  597.     @_shake = 0
  598.     @_upside_down = false
  599.     @_reverse = false
  600.     @_turning_direction = 1
  601.     @_turning_speed = 0
  602.     @_turning_duration = 0
  603.     @_turning = 0
  604.     @_move_quick_return = true
  605.     @_move_speed = 0
  606.     @_move_coordinates = [0,0,0,0]
  607.     @_move_jump = false
  608.     @_move_duration = 0
  609.     @_moving = [0,0]
  610.     @_add_anime_id = 0
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● シェイクの開始
  614.   #     power    : 強さ
  615.   #     speed    : 速さ
  616.   #     duration : 時間
  617.   #--------------------------------------------------------------------------
  618.   def start_shake(power, speed, duration)
  619.     @_shake_power = power
  620.     @_shake_speed = speed
  621.     @_shake_duration = duration
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ● 上下反転を開始
  625.   #--------------------------------------------------------------------------
  626.   def start_upside_down
  627.     @_upside_down = @_upside_down ? false : true
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 左右反転を開始
  631.   #--------------------------------------------------------------------------
  632.   def start_reverse
  633.     @_reverse = @_reverse ? false : true
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 回転を開始
  637.   #     direction: 方向
  638.   #     speed    : 速さ
  639.   #     duration : 時間
  640.   #--------------------------------------------------------------------------
  641.   def start_turning(direction, speed, duration)
  642.     @_turning_direction = direction
  643.     @_turning_speed = speed
  644.     @_turning_duration = duration
  645.     @_turning = @_turning_direction == 1 ? 0 : 360
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● 移動を開始
  649.   #     quick_return : 戻るかどうか
  650.   #     speed        : 速さ
  651.   #     x            : X 座標
  652.   #     y            : Y 座標
  653.   #--------------------------------------------------------------------------
  654.   def start_moving(quick_return, speed, x, y)
  655.     @_move_quick_return = quick_return == 0 ? false : true
  656.     @_move_speed = speed
  657.     @_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
  658.     distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
  659.                (@_move_coordinates[3] - @_move_coordinates[1]).abs
  660.     @_move_duration = distance
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● アニメ追加を開始
  664.   #     id           : ID
  665.   #     hit          : 命中フラッグ
  666.   #--------------------------------------------------------------------------
  667.   def start_add_anime(id)
  668.     @_add_anime_id = id
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ● 各種エフェクトの開始判定
  672.   #--------------------------------------------------------------------------
  673.   if !method_defined?("side_view_animation_process_timing")
  674.     alias side_view_animation_process_timing animation_process_timing
  675.   end
  676.   def animation_process_timing(timing, hit)
  677.     side_view_animation_process_timing(timing, hit)
  678.     if (timing.condition == 0) or
  679.        (timing.condition == 1 and hit == true) or
  680.        (timing.condition == 2 and hit == false)
  681.       if timing.se.name =~ SHAKE_FILE
  682.         names = timing.se.name.split(/#/)
  683.         power    = names[1].nil? ? SHAKE_POWER    : names[1].to_i
  684.         speed    = names[2].nil? ? SHAKE_SPEED    : names[2].to_i
  685.         duration = names[3].nil? ? SHAKE_DURATION : names[3].to_i
  686.         # シェイクを開始
  687.         self.start_shake(power, speed, duration)
  688.       end
  689.       if timing.se.name == UPSIDE_DOWN_FILE
  690.         # 上下反転を開始
  691.         self.start_upside_down
  692.       end
  693.       if timing.se.name == REVERSE_FILE
  694.         # 左右反転を開始
  695.         self.start_reverse
  696.       end
  697.       if timing.se.name =~ TURNING_FILE
  698.         names = timing.se.name.split(/#/)
  699.         direction = names[1].nil? ? TURNING_DIRECTION : names[1].to_i
  700.         speed     = names[2].nil? ? TURNING_SPEED     : names[2].to_i
  701.         duration  = names[3].nil? ? TURNING_DURATION  : names[3].to_i
  702.         # 回転を開始
  703.         self.start_turning(direction, speed, duration)
  704.       end
  705.       if timing.se.name =~ MOVE_FILE
  706.         names = timing.se.name.split(/#/)
  707.         quick_return= names[1].nil? ? MOVE_RETURN      : names[1].to_i
  708.         speed       = names[2].nil? ? MOVE_SPEED       : names[2].to_i
  709.         x           = names[3].nil? ? MOVE_COORDINATES[0] : names[3].to_i
  710.         y           = names[3].nil? ? MOVE_COORDINATES[1] : names[4].to_i
  711.         # 移動を開始
  712.         self.start_moving(quick_return, speed, x, y)
  713.       end
  714.       if timing.se.name =~ ADD_ANIME_FILE
  715.         names = timing.se.name.split(/#/)
  716.         id = names[1].nil? ? ADD_ANIME_ID      : names[1].to_i
  717.         # アニメ追加を開始
  718.         self.start_add_anime(id)
  719.       end
  720.     end
  721.   end
  722. end
  723. #==============================================================================
  724. # ■ Sprite_Weapon
  725. #------------------------------------------------------------------------------
  726. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  727. # スプライトの状態を自動的に変化させます。
  728. #==============================================================================

  729. class Sprite_Weapon < RPG::Sprite
  730.   include Side_view
  731.   #--------------------------------------------------------------------------
  732.   # ● 公開インスタンス変数
  733.   #--------------------------------------------------------------------------
  734.   attr_accessor :battler                  # バトラー
  735.   attr_reader   :cw                       # グラフィックの幅
  736.   attr_reader   :ch                       # グラフィックの高さ
  737.   #--------------------------------------------------------------------------
  738.   # ● オブジェクト初期化
  739.   #     viewport : ビューポート
  740.   #     battler  : バトラー (Game_Battler)
  741.   #--------------------------------------------------------------------------
  742.   def initialize(viewport, battler = nil)
  743.     super(viewport)
  744.     @battler = battler
  745.     @battler_visible = false
  746.   end
  747.   #--------------------------------------------------------------------------
  748.   # ● 解放
  749.   #--------------------------------------------------------------------------
  750.   def dispose
  751.     if self.bitmap != nil
  752.       self.bitmap.dispose
  753.     end
  754.     super
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● フレーム更新
  758.   #--------------------------------------------------------------------------
  759.   def update
  760.     super
  761.     # バトラーが nil の場合
  762.     if @battler == nil or [email protected]_a?(Game_Actor)
  763.       self.bitmap = nil
  764.       return
  765.     end
  766.     # ウエポンアニメのデータ取得
  767.     @weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
  768.     # 設定が「非表示」の場合
  769.     if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
  770.       self.visible = false
  771.       return
  772.     else
  773.       self.visible = true
  774.     end
  775.     # ファイル名が現在のものと異なる場合
  776.     if @weapon_anime_type[0] != @weapon_name
  777.       @weapon_name = @weapon_anime_type[0]
  778.       # ビットマップを取得、設定
  779.       self.bitmap = RPG::Cache.icon(@weapon_name)
  780.       @width = bitmap.width
  781.       @height = bitmap.height
  782.       @flag = true
  783.     end
  784.     # 現在アニメパターンが現在のものと異なる場合
  785.     if @pattern != @battler.pattern or @flag or @condition != @battler.condition
  786.       @pattern = @battler.pattern
  787.       @condition = @battler.condition
  788.       self.ox = @width
  789.       self.oy = @height
  790.       self.z = battler.screen_z
  791.       self.zoom_x = @battler.real_zoom * CHAR_ZOOM
  792.       self.zoom_y = @battler.real_zoom * CHAR_ZOOM
  793.       self.src_rect.set(0, 0, @width, @height)
  794.       self.opacity = 255
  795.       # バトラーより手前に表示
  796.       if @weapon_anime_type[2]
  797.         self.z += 10
  798.       # バトラーより奥に表示
  799.       else
  800.         self.z -= 10
  801.       end
  802.       @flag = false
  803.     end
  804.   end
  805. end

  806. #==============================================================================
  807. # ■ Sprite_Flying
  808. #------------------------------------------------------------------------------
  809. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  810. # スプライトの状態を自動的に変化させます。
  811. #==============================================================================

  812. class Sprite_Flying < RPG::Sprite
  813.   include Side_view
  814.   #--------------------------------------------------------------------------
  815.   # ● 公開インスタンス変数
  816.   #--------------------------------------------------------------------------
  817.   attr_accessor :battler                  # バトラー
  818.   #--------------------------------------------------------------------------
  819.   # ● オブジェクト初期化
  820.   #     viewport : ビューポート
  821.   #     battler  : バトラー (Game_Battler)
  822.   #--------------------------------------------------------------------------
  823.   def initialize(viewport, battler = nil)
  824.     super(viewport)
  825.     @battler = battler
  826.     @battler_visible = false
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # ● 解放
  830.   #--------------------------------------------------------------------------
  831.   def dispose
  832.     if self.bitmap != nil
  833.       self.bitmap.dispose
  834.     end
  835.     super
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● フレーム更新
  839.   #--------------------------------------------------------------------------
  840.   def update
  841.     super
  842.     # バトラーが nil の場合
  843.     if @battler == nil
  844.       self.bitmap = nil
  845.       loop_animation(nil)
  846.       return
  847.     end
  848.     # 遠距離アニメ
  849.     flying_animation = @battler.flying_animation
  850.     flying_start = flying_animation[0]
  851.     flying_end   = flying_animation[1]
  852.     # アニメーション ID が現在のものと異なる場合
  853.     if @anime_id != @battler.flying_anime[0]
  854.       @anime_id = @battler.flying_anime[0]
  855.       @animation = $data_animations[@anime_id]
  856.     end
  857.     # アニメーション 開始
  858.     if flying_start
  859.       loop_animation(@animation)
  860.     elsif flying_end
  861.       loop_animation(nil)
  862.     end
  863.     self.x = @battler.flying_x
  864.     self.y = @battler.flying_y
  865.     self.z = @battler.screen_z + 1000
  866.   end
  867. end

  868. module RPG
  869.   class Skill
  870.     #--------------------------------------------------------------------------
  871.     # ● 魔法かどうかの判断
  872.     #--------------------------------------------------------------------------
  873.     def magic?
  874.       if @atk_f == 0
  875.         return true
  876.       else
  877.         return false
  878.       end
  879.     end
  880.   end
  881. end

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

  883. class Arrow_Actor < Arrow_Base
  884.   include Side_view
  885.   #--------------------------------------------------------------------------
  886.   # ● フレーム更新
  887.   #--------------------------------------------------------------------------
  888.   alias side_view_update update
  889.   def update
  890.     side_view_update
  891.     # スプライトの座標を設定
  892.     if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
  893.       self.x = self.actor.screen_x + ARROW_OX
  894.       self.y = self.actor.screen_y + ARROW_OY
  895.     end
  896.   end
  897. end
  898. class Arrow_Enemy < Arrow_Base
  899.   include Side_view
  900.   #--------------------------------------------------------------------------
  901.   # ● フレーム更新
  902.   #--------------------------------------------------------------------------
  903.   alias side_view_update update
  904.   def update
  905.     side_view_update
  906.     # スプライトの座標を設定
  907.     if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
  908.       self.x = self.enemy.screen_x
  909.       self.y = self.enemy.screen_y + self.enemy.height/2
  910.     end
  911.   end
  912. end
复制代码
来论坛混了3年多了,有2年半 潜水
— —的确我发现我注册的真早
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-9-22 03:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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