Project1

标题: 请大神看一下,这两个脚本有冲突在什么地方怎么改,谢..... [打印本页]

作者: H海GG    时间: 2016-8-21 21:34
标题: 请大神看一下,这两个脚本有冲突在什么地方怎么改,谢.....
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Game_Actors
  3. #------------------------------------------------------------------------------
  4. #  处理角色排列的类。本类的实例请参考
  5. #  $game_actors。
  6. #==============================================================================
  7.  
  8. class Game_Actors
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对像[        DISCUZ_CODE_0        ]
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     @data = []
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 获取角色
  17.   #     actor_id : 角色 ID
  18.   #--------------------------------------------------------------------------
  19.   def [](actor_id)
  20.     if actor_id > 999 or $data_actors[actor_id] == nil
  21.       return nil
  22.     end
  23.     if @data[actor_id] == nil
  24.       @data[actor_id] = Game_Actor.new(actor_id)
  25.     end
  26.     return @data[actor_id]
  27.   end
  28. end








这两个,懂的看一下,本人不懂脚本,谢谢!!!!
作者: H海GG    时间: 2016-8-21 21:35
  1. #==============================================================================

  2. # ■ 全动画战斗(修改版)

  3. #------------------------------------------------------------------------------

  4. #  By whbm

  5. #   应用脚本 彩虹神剑 By 66

  6. #==============================================================================

  7.      $fangyu = 0

  8. #   修改内容:

  9. #   1.修改 战斗失败继续后被怪打就出现死亡静态BUG

  10. #   2.改变防御方式,虽然有点不自然,但应该比原来好吧。

  11. #                                        by 星云

  12. #==============================================================================

  13. #简要介绍:

  14. #    本脚本实现了战斗的动态效果,其中包含了待机、攻击、防御、挨打、胜利、死亡。类似于超级横版、超级战斗。但是本系统特色在于所有效果的实现并不是靠庞大的战斗图,而是使用了数据库中的动画。这样不仅突破了不同人不同祯数量的限制,并且方便了单动画单祯的修改。

  15. #使用方法:

  16. #    个人觉得还是比较简单,但是大量的怪物还是会令人头痛。

  17. #    1.数据库的设置

  18. #      敌人必要的动画有待机、挨打、死亡三个必要的动画

  19. #      角色必要的动画有待机、挨打、防御、死亡动态、胜利动态、死亡静态、胜利静态

  20. #

  21. #      死亡静态与胜利静态:动画中只有1祯,为相应动态动画的最后一祯

  22. #      

  23. #      剩下的就是人物攻击的动画,和正常的动画是一样设置

  24. #      如图中的攻击等待动画只是为了在播放攻击动画的同时消除人物本身(素材原因,人物攻击的时候离开了原位,如果是在原位置放魔法是用不上的)

  25. #    2.战斗图的设置

  26. #      战斗图其实只是一个透明的图片,它只是用来描述一个敌人或者角色的大小,并与相应的战斗动画编号相衔接。

  27. #      战斗图的文件名格式如下:

  28. #          名字★待机★防御★挨打★死亡动态★死亡静态★胜利动态★胜利静态.png

  29. #          (其中“名字”一项与动画无关)

  30. #          例如:

  31. #          紫烟★140★141★148★149★150★144★145.png

  32. #      对于敌人无胜利动画或者防御动画,请保持该位置为空,例如:

  33. #          蓝若冰★124★★126★127★★★.png

  34. #    综上,设置就这么完成了。

  35. #注意事项:

  36. #    1.由于系统中待机由动画实现,所以无法使用状态附带动画的功能。

  37. #    2.可以在脚本中使用Ctrl+Shift+F通篇搜索“小改动”,可以修改某些窗口的Z值。

  38. #    3.当您将此系统向您的工程中移植的时候也要注意事项2中的“小改动”。

  39. #    4.系统是从游戏“石焚刃暖”中提取出来的,或许会有疏漏与多余的东西,BUG也是不免的。大家尽管提便是。     

  40. #==============================================================================

  41. class Spriteset_Battle

  42.    #--------------------------------------------------------------------------

  43.    # ● 初始化变量

  44.    #--------------------------------------------------------------------------

  45.    def initialize

  46.      # 生成显示端口

  47.      @viewport1 = Viewport.new(0, 0, 640, 480)

  48.      @viewport2 = Viewport.new(0, 0, 640, 480)

  49.      @viewport3 = Viewport.new(0, 0, 640, 480)

  50.      @viewport4 = Viewport.new(0, 0, 640, 480)

  51.      @viewport2.z = 101

  52.      @viewport3.z = 200

  53.      @viewport4.z = 5000

  54.      # 生成战斗背景活动块

  55.      @battleback_sprite = Sprite.new(@viewport1)

  56.      # 生成敌人活动块

  57.      @enemy_sprites = []

  58.      for enemy in $game_troop.enemies.reverse

  59.        @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))

  60.      end

  61.      # 生成敌人活动块

  62.      @actor_sprites = []

  63.      @actor_sprites.push(Sprite_Battler.new(@viewport2))

  64.      @actor_sprites.push(Sprite_Battler.new(@viewport2))

  65.      @actor_sprites.push(Sprite_Battler.new(@viewport2))

  66.      @actor_sprites.push(Sprite_Battler.new(@viewport2))

  67.      # 生成天候

  68.      @weather = RPG::Weather.new(@viewport1)

  69.      # 生成图片活动块

  70.      @picture_sprites = []

  71.      for i in 51..100

  72.        @picture_sprites.push(Sprite_Picture.new(@viewport3,

  73.          $game_screen.pictures[i]))

  74.      end

  75.      # 生成计时器块

  76.      @timer_sprite = Sprite_Timer.new

  77.      # 刷新画面

  78.      update

  79.    end

  80.    #..........................................................................

  81.    #--------------------------------------------------------------------------

  82.    # ● 胜利图

  83.    #--------------------------------------------------------------------------

  84.    def win

  85.      for sprite in @actor_sprites

  86.        sprite.win

  87.      end

  88.    end

  89.    #..........................................................................

  90.    #--------------------------------------------------------------------------

  91.    # ● 刷新画面

  92.    #--------------------------------------------------------------------------

  93.    def update

  94.      # 刷新角色的活动块 (对应角色的替换)

  95.      @actor_sprites[0].battler = $game_party.actors[0]

  96.      @actor_sprites[1].battler = $game_party.actors[1]

  97.      @actor_sprites[2].battler = $game_party.actors[2]

  98.      @actor_sprites[3].battler = $game_party.actors[3]

  99.      # 战斗背景的文件名与现在情况有差异的情况下

  100.      if @battleback_name != $game_temp.battleback_name

  101.        @battleback_name = $game_temp.battleback_name

  102.        if @battleback_sprite.bitmap != nil

  103.          @battleback_sprite.bitmap.dispose

  104.        end

  105.        @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)

  106.        @battleback_sprite.src_rect.set(0, 0, 640, 480)

  107.      end

  108.      # 刷新战斗者的活动块

  109.      for sprite in @enemy_sprites + @actor_sprites

  110.        sprite.update

  111.      end

  112.      # 刷新天气图形

  113.      @weather.type = $game_screen.weather_type

  114.      @weather.max = $game_screen.weather_max

  115.      @weather.update

  116.      # 刷新图片活动块

  117.      for sprite in @picture_sprites

  118.        sprite.update

  119.      end

  120.      # 刷新计时器活动块

  121.      @timer_sprite.update

  122.      # 设置画面的色调与震动位置

  123.      @viewport1.tone = $game_screen.tone

  124.      @viewport1.ox = $game_screen.shake

  125.      # 设置画面的闪烁色

  126.      @viewport4.color = $game_screen.flash_color

  127.      # 刷新显示端口

  128.      @viewport1.update

  129.      @viewport2.update

  130.      @viewport4.update

  131.    end

  132. end

  133. class Arrow_Enemy < Arrow_Base

  134.    #--------------------------------------------------------------------------

  135.    # ● 获取光标指向的敌人

  136.    #--------------------------------------------------------------------------

  137.    def enemy

  138.      return $game_troop.enemies[@index]

  139.    end

  140.    #--------------------------------------------------------------------------

  141.    # ● 刷新画面

  142.    #--------------------------------------------------------------------------

  143.    def update

  144.      super

  145.      # 如果指向不存在的敌人就离开

  146.      $game_troop.enemies.size.times do

  147.        break if self.enemy.exist?

  148.        @index += 1

  149.        @index %= $game_troop.enemies.size

  150.      end

  151.      # 光标右

  152.      if Input.repeat?(Input::RIGHT)

  153.        $game_system.se_play($data_system.cursor_se)

  154.        $game_troop.enemies.size.times do

  155.          @index += 1

  156.          @index %= $game_troop.enemies.size

  157.          break if self.enemy.exist?

  158.        end

  159.      end

  160.      # 光标左

  161.      if Input.repeat?(Input::LEFT)

  162.        $game_system.se_play($data_system.cursor_se)

  163.        $game_troop.enemies.size.times do

  164.          @index += $game_troop.enemies.size - 1

  165.          @index %= $game_troop.enemies.size

  166.          break if self.enemy.exist?

  167.        end

  168.      end

  169.      # 设置活动块坐标

  170.      if self.enemy != nil

  171.        self.x = self.enemy.screen_x + self.ox

  172.        self.y = self.enemy.screen_y + self.oy

  173.      end

  174.    end

  175. end

  176. class Arrow_Actor < Arrow_Base

  177.    #--------------------------------------------------------------------------

  178.    # ● 获取光标指向的角色

  179.    #--------------------------------------------------------------------------

  180.    def actor

  181.      return $game_party.actors[@index]

  182.    end

  183.    #--------------------------------------------------------------------------

  184.    # ● 刷新画面

  185.    #--------------------------------------------------------------------------

  186.    def update

  187.      super

  188.      # 光标右

  189.      if Input.repeat?(Input::RIGHT)

  190.        $game_system.se_play($data_system.cursor_se)

  191.        @index += 1

  192.        @index %= $game_party.actors.size

  193.      end

  194.      # 光标左

  195.      if Input.repeat?(Input::LEFT)

  196.        $game_system.se_play($data_system.cursor_se)

  197.        @index += $game_party.actors.size - 1

  198.        @index %= $game_party.actors.size

  199.      end

  200.      # 设置活动块坐标

  201.      if self.actor != nil

  202.        self.x = self.actor.screen_x + self.ox

  203.        self.y = self.actor.screen_y + self.oy

  204.      end

  205.    end

  206. end

  207. class Scene_Battle

  208.    #--------------------------------------------------------------------------

  209.    # ● 刷新画面 (主回合步骤 3 : 行动方动画)

  210.    #--------------------------------------------------------------------------

  211.    def update_phase4_step3

  212.      # 行动方动画 (ID 为 0 的情况下是白色闪烁)

  213.      if @animation1_id == 0

  214.        @active_battler.white_flash = true

  215.      else

  216.        @active_battler.animation_id = @animation1_id

  217.        @active_battler.animation_hit = true

  218.      end

  219.      # 对像方动画

  220.      for target in @target_battlers

  221.        target.animation_id = @animation2_id

  222.        target.animation_hit = (target.damage != "Miss")

  223.        #.......................................................................

  224.        if target.is_a?(Game_Actor)

  225.          ##############

  226.          if target.guarding?

  227.            $fangyu = 1

  228.         end

  229.          ##############

  230.         if target.current_action.kind == 0 and target.current_action.basic == 1

  231.             target.setup_battler_ani(target.battler_name.split(/★/)[2])

  232.          else

  233.           target.setup_battler_hurt_ani(0)

  234.          end

  235.        end

  236.        if target.is_a?(Game_Enemy)

  237.          if target.current_action.kind == 0 and target.current_action.basic == 1

  238.            target.setup_battler_ani(target.battler_name.split(/★/)[1])

  239.          else

  240.            target.setup_battler_hurt_ani(0)

  241.          end

  242.        end

  243.        #.......................................................................

  244.      end

  245.      # 对像方动画

  246.      for target in @target_battlers

  247.        target.animation_id = @animation2_id

  248.        target.animation_hit = (target.damage != "Miss")

  249.        #......................................................................

  250.      end

  251.      # 限制动画长度、最低 8 帧

  252.      @wait_count = 8

  253.      # 移至步骤 5

  254.      @phase4_step = 5

  255.    end

  256.    #--------------------------------------------------------------------------

  257.    # ● 刷新画面 (主回合步骤 4 : 对像方动画) ★

  258.    #--------------------------------------------------------------------------

  259.    def update_phase4_step4

  260.      # 限制动画长度、最低 8 帧

  261.      @wait_count = 8

  262.      # 移至步骤 5

  263.      @phase4_step = 5

  264.    end

  265. end

  266. class Game_Actor < Game_Battler

  267.    #--------------------------------------------------------------------------

  268.    # ● 取得战斗画面的 X 坐标

  269.    #--------------------------------------------------------------------------

  270.    def screen_x

  271.      # 返回计算后的队伍 X 坐标的排列顺序

  272.      if self.index != nil

  273.        #......................................................................

  274.        return self.index * 90 + 500

  275.        #......................................................................

  276.      else

  277.        return 0

  278.      end

  279.    end

  280.    #--------------------------------------------------------------------------

  281.    # ● 取得战斗画面的 Y 坐标

  282.    #--------------------------------------------------------------------------

  283.    def screen_y

  284.      #........................................................................

  285.      return 464 - self.index * 110

  286.      #........................................................................

  287.    end

  288.    #--------------------------------------------------------------------------

  289.    # ● 取得战斗画面的 Z 坐标

  290.    #--------------------------------------------------------------------------

  291.    def screen_z

  292.      # 返回计算后的队伍 Z 坐标的排列顺序

  293.      if self.index != nil

  294.        return 4 - self.index

  295.      else

  296.        return 0

  297.      end

  298.    end

  299. end

  300. class Scene_Battle

  301.    #..........................................................................

  302.    #--------------------------------------------------------------------------

  303.    # ● 返回phase

  304.    #--------------------------------------------------------------------------

  305.    def phase

  306.      return @phase

  307.    end

  308.    #--------------------------------------------------------------------------

  309.    # ● 返回phase4_step

  310.    #--------------------------------------------------------------------------

  311.    def phase4_step

  312.      return @phase4_step

  313.    end

  314.    #--------------------------------------------------------------------------

  315.    # ● 返回phase4_step

  316.    #--------------------------------------------------------------------------

  317.    def actor_command_active?

  318.      return @actor_command_window.active

  319.    end

  320.    #..........................................................................

  321. end

  322. class Game_Battler

  323.    #..........................................................................

  324.    #--------------------------------------------------------------------------

  325.    # ● 获取循环的动画 ID

  326.    #--------------------------------------------------------------------------  

  327.    def show_damage(value)

  328.      @show_damage_value = value

  329.    end

  330.    #--------------------------------------------------------------------------

  331.    # ● 获取循环的动画 ID

  332.    #--------------------------------------------------------------------------

  333.    def show_damage_value

  334.      return @show_damage_value

  335.    end

  336.    #--------------------------------------------------------------------------

  337.    # ● 获取循环的动画 ID

  338.    #--------------------------------------------------------------------------

  339.    def battler_ani

  340.      return @battler_ani

  341.    end

  342.    #--------------------------------------------------------------------------

  343.    # ● 获取循环的动画 ID

  344.    #--------------------------------------------------------------------------

  345.    def setup_battler_ani(battler_ani, once = 0)

  346.      @battler_ani = battler_ani

  347.      @once = once

  348.    end

  349.    #--------------------------------------------------------------------------

  350.    # ● 获取循环的动画 ID

  351.    #--------------------------------------------------------------------------

  352.    def setup_battler_hurt_ani(hurt)

  353.      @hurt = hurt

  354.    end  

  355.    #--------------------------------------------------------------------------

  356.    # ● 获取循环的动画 ID

  357.    #--------------------------------------------------------------------------

  358.    def setup_battler_dead_ani(over)

  359.      @over = over

  360.    end

  361.    #--------------------------------------------------------------------------

  362.    # ● 获取循环的动画 ID

  363.    #--------------------------------------------------------------------------

  364.    def battler_dead_ani

  365.      return @over

  366.    end

  367.    #--------------------------------------------------------------------------

  368.    # ● 获取循环的动画 ID

  369.    #--------------------------------------------------------------------------

  370.    def battler_ani_once

  371.      return @once

  372.    end

  373.    #--------------------------------------------------------------------------

  374.    # ● 获取循环的动画 ID

  375.    #--------------------------------------------------------------------------

  376.    def battler_hurt_ani

  377.      return @hurt

  378.    end

  379.    #..........................................................................

  380. end

  381. class Sprite_Battler < RPG::Sprite

  382.    #..........................................................................

  383.    #--------------------------------------------------------------------------

  384.    # ● 胜利图

  385.    #--------------------------------------------------------------------------

  386.    def win

  387.      if @battler_name != nil and not @battler.hidden and not @battler.dead?

  388.        @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)

  389.      end

  390.    end

  391.    #..........................................................................

  392.    #--------------------------------------------------------------------------

  393.    # ● 释放

  394.    #--------------------------------------------------------------------------

  395.    def dispose

  396.      if self.bitmap != nil

  397.        self.bitmap.dispose

  398.      end

  399.      super

  400.    end

  401.    #--------------------------------------------------------------------------

  402.    # ● 刷新画面

  403.    #--------------------------------------------------------------------------

  404.    def update

  405.      super

  406.      # 战斗者为 nil 的情况下

  407.      if [url=home.php?mod=space&uid=133701]@battler[/url] == nil

  408.        self.bitmap = nil

  409.        loop_animation(nil)

  410.        return

  411.      end

  412.      # 文件名和色相与当前情况有差异的情况下

  413.      if @battler.battler_name != @battler_name or

  414.         @battler.battler_hue != @battler_hue

  415.        @battler_hue = @battler.battler_hue

  416.        # 获取、设置位图

  417.        @battler_name = @battler.battler_name

  418.        self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)

  419.        #.......................................................................

  420.        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])

  421.        #.......................................................................

  422.        @width = bitmap.width

  423.        [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height

  424.        self.ox = @width / 2

  425.        self.oy = @height

  426.        # 如果是战斗不能或者是隐藏状态就把透明度设置成 0

  427.        if @battler.is_a?(Game_Enemy)

  428.          if @battler.dead? or @battler.hidden

  429.            self.opacity = 0

  430.          end

  431.        end

  432.      end

  433.      # 动画 ID 与当前的情况有差异的情况下

  434.      #.........................................................................

  435.      if @battler.battler_ani != @battler_ani

  436.        @battler_ani = @battler.battler_ani

  437.        loop_animation($data_animations[@battler_ani.to_i])

  438.      end

  439.      #.........................................................................

  440.      # 应该被显示的角色的情况下

  441.      if @battler.is_a?(Game_Actor) and @battler_visible

  442.        # 不是主状态的时候稍稍降低点透明度

  443.        if $game_temp.battle_main_phase

  444.          self.opacity += 3 if self.opacity < 255

  445.        else

  446.          self.opacity -= 3 if self.opacity > 207

  447.        end

  448.      end

  449.      # 明灭

  450.      if @battler.blink

  451.        blink_on

  452.      else

  453.        blink_off

  454.      end

  455.      # 不可见的情况下

  456.      unless @battler_visible

  457.        # 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

  458.        if not @battler.hidden and not @battler.dead? and

  459.           (@battler.damage == nil or @battler.damage_pop)

  460.          if @battler.is_a?(Game_Enemy)

  461.            appear

  462.          else

  463.            @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])

  464.          end

  465.          @battler_visible = true

  466.        end

  467.      end

  468.      # 可见的情况下

  469.      if @battler_visible

  470.        # 逃跑

  471.        if @battler.hidden

  472.          $game_system.se_play($data_system.escape_se)

  473.          escape

  474.          @battler_visible = false

  475.        end

  476.        # 白色闪烁

  477.        if @battler.white_flash

  478.          whiten

  479.          @battler.white_flash = false

  480.        end

  481.        # 动画

  482.        if @battler.animation_id != 0

  483.          animation = $data_animations[@battler.animation_id]

  484.          animation(animation, @battler.animation_hit)

  485.          @battler.animation_id = 0

  486.        end

  487.        # 伤害

  488.        if @battler.damage_pop

  489.          damage(@battler.damage, @battler.critical)

  490.          @battler.damage = nil

  491.          @battler.critical = false

  492.          @battler.damage_pop = false

  493.        end

  494.        # korapusu

  495.        if @battler.damage == nil and @battler.dead?

  496.          #....................................................................

  497.          if @battler.is_a?(Game_Enemy)

  498.            $game_system.se_play($data_system.enemy_collapse_se)

  499.            #collapse

  500.          else

  501.            $game_system.se_play($data_system.actor_collapse_se)

  502.          end

  503.          #....................................................................

  504.          @battler_visible = false

  505.        end

  506.      end

  507.      # 设置活动块的坐标

  508.      self.x = @battler.screen_x

  509.      self.y = @battler.screen_y

  510.      self.z = @battler.screen_z

  511.    end

  512. end

  513. module RPG

  514.    class Sprite < ::Sprite

  515.      def damage(value, critical)

  516.        dispose_damage

  517.        if value.is_a?(Numeric)

  518.          damage_string = value.abs.to_s

  519.        else

  520.          damage_string = value.to_s

  521.        end

  522.        bitmap = Bitmap.new(160, 48)

  523.        bitmap.font.name = "Arial Black"

  524.        bitmap.font.size = 32

  525.        bitmap.font.color.set(0, 0, 0)

  526.        bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)

  527.        bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)

  528.        bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)

  529.        bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)

  530.        if value.is_a?(Numeric) and value < 0

  531.          bitmap.font.color.set(176, 255, 144)

  532.        else

  533.          bitmap.font.color.set(255, 255, 255)

  534.        end

  535.        bitmap.draw_text(0, 12, 160, 36, damage_string, 1)

  536.        if critical

  537.          bitmap.font.size = 20

  538.          bitmap.font.color.set(0, 0, 0)

  539.          bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)

  540.          bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)

  541.          bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)

  542.          bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)

  543.          bitmap.font.color.set(255, 255, 255)

  544.          bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)

  545.        end

  546.        @_damage_sprite = ::Sprite.new(self.viewport)

  547.        @_damage_sprite.bitmap = bitmap

  548.        @_damage_sprite.ox = 80

  549.        @_damage_sprite.oy = 20

  550.        @_damage_sprite.x = self.x
  551.        @_damage_sprite.x -= self.bitmap.width/2 if @battler.is_a?(Game_Actor)

  552.        @_damage_sprite.y = self.y - self.oy / 2

  553.        @_damage_sprite.z = 3000

  554.        @_damage_duration = 40

  555.      end

  556.    end

  557. end

  558. module RPG

  559. #--------------------------------------------------------------------------

  560. # ● 常量设定

  561. #--------------------------------------------------------------------------

  562. # 是否显示总伤害

  563. SHOW_TOTAL_DAMAGE = true

  564. # 角色受攻击时是否跳一下

  565. BATTLER_JUMP = true


  566. class Sprite < ::Sprite

  567.     #==========================================

  568.     # 修改说明:

  569.     # @flash_shake用来制作挨打时候跳跃

  570.     # @_damage    用来记录每次打击之后弹出数字

  571.     # @_total_damage 记录总伤害

  572.     # @_total_damage_duration 总伤害持续帧

  573.     #==========================================

  574.     #alias 66RPG_rainbow_initialize : initialize

  575.     def initialize(viewport = nil)

  576.       #66RPG_rainbow_initialize(viewport)

  577.       super(viewport)

  578.       @_whiten_duration = 0

  579.       @_appear_duration = 0

  580.       @_escape_duration = 0

  581.       @_collapse_duration = 0

  582.       @_damage_duration = 0

  583.       @_animation_duration = 0

  584.       @_blink = false

  585.       # 挨打时候跳跃

  586.       @flash_shake = 0

  587.       # 伤害记录数组

  588.       @_damage = []

  589.       # 总伤害数字

  590.       @_total_damage = 0

  591.       # 总伤害持续帧

  592.       @_total_damage_duration = 0

  593.       #.........................................................................

  594.       @hits = 0

  595.       #.........................................................................

  596.     end

  597.     def damage(value, critical)

  598.       #.........................................................................

  599.       #清除hit数

  600.       dispose_hit

  601.       #.........................................................................

  602.       if value.is_a?(Numeric)

  603.         damage_string = value.abs.to_s

  604.       else

  605.         damage_string = value.to_s

  606.       end

  607.       bitmap = Bitmap.new(160, 48)

  608.       bitmap.font.name = "Arial Black"

  609.       bitmap.font.size = 32

  610.       bitmap.font.color.set(0, 0, 0)

  611.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)

  612.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)

  613.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)

  614.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)

  615.       #=======================================

  616.       # 修改:颜色

  617.       #=======================================

  618.       if value.is_a?(Numeric) and value < 0

  619.         bitmap.font.color.set(176, 255, 144)

  620.       else

  621.         bitmap.font.color.set(255, 55, 55)

  622.       end

  623.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)

  624.       if critical

  625.         bitmap.font.size = 20

  626.         bitmap.font.color.set(0, 0, 0)

  627.         bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)

  628.         bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)

  629.         bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)

  630.         bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)

  631.         bitmap.font.color.set(255, 255, 255)

  632.         bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)

  633.       end

  634.       @_damage_sprite = ::Sprite.new#(self.viewport)

  635.       @_damage_sprite.bitmap = bitmap

  636.       @_damage_sprite.ox = 80

  637.       @_damage_sprite.oy = 20

  638.       @_damage_sprite.x = self.x

  639.       @_damage_sprite.y = self.y - self.oy / 2

  640.       @_damage_sprite.z = 3000

  641.       @_damage_duration = 40

  642.       #=======================================

  643.       # 修改:推入新的伤害

  644.       #=======================================

  645.       @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])

  646.       # 总伤害处理

  647.       make_total_damage(value)

  648.     end

  649.     #--------------------------------------------------------------------------

  650.     # ● 返回 @hits

  651.     #--------------------------------------------------------------------------

  652.     def get_hit

  653.       return @hits

  654.     end

  655.     #--------------------------------------------------------------------------

  656.     # ● hit数的美化描绘

  657.     #--------------------------------------------------------------------------

  658.     #..........................................................................

  659.     def hit

  660.       # 如果伤害值是数值

  661.       # 转为字符串

  662.       value=@hits

  663.       hits_string = value.to_s

  664.       # 初始化位图

  665.       bitmap = Bitmap.new(320, 64)

  666.       bitmap.font.name = "Arial Black"

  667.       bitmap.font.size = 32

  668.       # 分割伤害值字符串

  669.       hits_array = hits_string.scan(/./)

  670.       hits_x = - 36.2#hits_string.size * 18.1 # 81 - hits_string.size * 18.1

  671.       rect_y = 0

  672.       # 循环伤害值字符串

  673.       for char in hits_array

  674.         # 后移一位

  675.         hits_x += 36.2

  676.         number = char.to_i

  677.         # 显示伤害数字

  678.         bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  679.         Rect.new(number * 36.2, rect_y, 36.2, 50))

  680.       end

  681.       hits_x += 18.1

  682.       bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  683.                  Rect.new(0, -21, 90, 50))

  684.       # 伤害值定位

  685.       @_hits_sprite = ::Sprite.new(self.viewport)

  686.       @_hits_sprite.bitmap = bitmap

  687.       @_hits_sprite.x = 560 - hits_string.size * 36.2

  688.       @_hits_sprite.y = 70

  689.       @_hits_sprite.z = 3000

  690.       @_hits_duration = 40

  691.     end

  692.     #..........................................................................
  693.     #--------------------------------------------------------------------------
  694. # ● 总伤害处理
  695. #--------------------------------------------------------------------------
  696. def make_total_damage(value)
  697. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  698. @_total_damage += value
  699. else
  700. return
  701. end
  702. bitmap = Bitmap.new(300, 150)
  703. bitmap.font.name = "Arial Black"
  704. bitmap.font.size = 48
  705. bitmap.font.color.set(0, 0, 0)
  706. bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
  707. if @_total_damage < 0
  708. bitmap.font.color.set(80, 255, 00)
  709. else
  710. bitmap.font.color.set(255, 140, 0)
  711. end
  712. bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
  713. if @_total_damage_sprite.nil?
  714. @_total_damage_sprite = ::Sprite.new#(self.viewport)
  715. @_total_damage_sprite.ox = 80
  716. @_total_damage_sprite.oy = 20
  717. @_total_damage_sprite.z = 3000
  718. end
  719. @_total_damage_sprite.bitmap = bitmap
  720. @_total_damage_sprite.zoom_x = 1.5
  721. @_total_damage_sprite.zoom_y = 1.5
  722. @_total_damage_sprite.x = self.x
  723. @_total_damage_sprite.y = self.y - self.oy / 2 - 64
  724. @_total_damage_sprite.z = 3001
  725. #.........................................................................
  726. @_total_damage_duration = 40
  727. #.........................................................................
  728. #.........................................................................
  729. #hit数描绘
  730. @hits+=1
  731. hit
  732. #.........................................................................
  733. end
  734. def animation(animation, hit, battler_damage="", battler_critical=false)
  735. dispose_animation
  736. #=======================================
  737. # 修改:记录伤害和critical
  738. #=======================================
  739. @battler_damage = battler_damage
  740. @battler_critical = battler_critical
  741. @_animation = animation
  742. return if @_animation == nil
  743. @_animation_hit = hit
  744. @_animation_duration = @_animation.frame_max
  745. animation_name = @_animation.animation_name
  746. animation_hue = @_animation.animation_hue
  747. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  748. #=======================================
  749. # 修改:计算总闪光权限值
  750. #=======================================
  751. for timing in @_animation.timings
  752. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  753. @all_quanzhong += quanzhong
  754. # 记录最后一次闪光
  755. @_last_frame = timing.frame if quanzhong != 0
  756. end
  757. #.........................................................................
  758. @last_frame = @_last_frame
  759. #.........................................................................
  760. if @@_reference_count.include?(bitmap)
  761. @@_reference_count[bitmap] += 1
  762. else
  763. @@_reference_count[bitmap] = 1
  764. end
  765. #=======================================
  766. # 修改:行动方动画不显示伤害
  767. #=======================================
  768. if $scene.is_a?(Scene_Battle)
  769. if $scene.animation1_id == @battler.animation_id
  770. @battler_damage = ""
  771. end
  772. end
  773. @_animation_sprites = []
  774. if @_animation.position != 3 or not @@_animations.include?(animation)
  775. for i in 0..15
  776. sprite = ::Sprite.new(self.viewport)
  777. sprite.bitmap = bitmap
  778. sprite.visible = false
  779. @_animation_sprites.push(sprite)
  780. end
  781. unless @@_animations.include?(animation)
  782. @@_animations.push(animation)
  783. end
  784. end
  785. update_animation
  786. end
  787. #=======================================
  788. # 修改:更换清除伤害的算法,以防万一
  789. # 本内容在脚本中没有使用过
  790. #=======================================
  791. def dispose_damage
  792. for damage in @_damage.reverse
  793. damage[0].bitmap.dispose
  794. damage[0].dispose
  795. @_damage.delete(damage)
  796. end
  797. @_total_damage = 0
  798. @_last_frame = -1
  799. if @_total_damage_sprite != nil
  800. @_total_damage_duration = 0
  801. @_total_damage_sprite.bitmap.dispose
  802. @_total_damage_sprite.dispose
  803. @_total_damage_sprite = nil
  804. end
  805. end
  806. #=======================================
  807. # 清除hit数
  808. #=======================================
  809. #...........................................................................
  810. def dispose_hit
  811. if @_hits_sprite != nil
  812. @_hits_sprite.bitmap.dispose
  813. @_hits_sprite.dispose
  814. @_hits_sprite = nil
  815. end
  816. end
  817. #...........................................................................
  818. def dispose_animation
  819. #=======================================
  820. # 修改:清除记录的伤害,清除权重记录
  821. #=======================================
  822. @battler_damage = nil
  823. @battler_critical = nil
  824. @all_quanzhong = 1
  825. @_total_damage = 0
  826. @_last_frame = -1
  827. #.........................................................................
  828. @hits = 0
  829. #.........................................................................
  830. if @_animation_sprites != nil
  831. sprite = @_animation_sprites[0]
  832. if sprite != nil
  833. @@_reference_count[sprite.bitmap] -= 1
  834. if @@_reference_count[sprite.bitmap] == 0
  835. sprite.bitmap.dispose
  836. end
  837. end
  838. for sprite in @_animation_sprites
  839. sprite.dispose
  840. end
  841. @_animation_sprites = nil
  842. @_animation = nil
  843. end
  844. end
  845. def update
  846. super
  847. if @_whiten_duration > 0
  848. @_whiten_duration -= 1
  849. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  850. end
  851. if @_appear_duration > 0
  852. @_appear_duration -= 1
  853. self.opacity = (16 - @_appear_duration) * 16
  854. end
  855. if @_escape_duration > 0
  856. @_escape_duration -= 1
  857. self.opacity = 256 - (32 - @_escape_duration) * 10
  858. end
  859. if @_collapse_duration > 0
  860. @_collapse_duration -= 1
  861. self.opacity = 256 - (48 - @_collapse_duration) * 6
  862. end
  863. #=======================================
  864. # 修改:更新算法,更新弹出
  865. #=======================================
  866. if @_damage_duration > 0
  867. @_damage_duration -= 1
  868. for damage in @_damage
  869. damage[0].x = self.x + self.viewport.rect.x -
  870. self.ox + self.src_rect.width / 2 +
  871. (40 - damage[1]) * damage[3] / 10
  872. damage[0].y -= damage[4]+damage[1]/10
  873. damage[0].opacity = damage[1]*20
  874. damage[1] -= 1
  875. if damage[1]==0
  876. damage[0].bitmap.dispose
  877. damage[0].dispose
  878. @_damage.delete(damage)
  879. next
  880. end
  881. end
  882. end
  883. #=======================================
  884. # 添加:弹出总伤害
  885. #=======================================
  886. if @_total_damage_duration > 0
  887. @_total_damage_duration -= 1
  888. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  889. if @_total_damage_sprite.zoom_x > 1.0
  890. @_total_damage_sprite.zoom_x -= 0.05
  891. end
  892. if @_total_damage_sprite.zoom_y > 1.0
  893. @_total_damage_sprite.zoom_y -= 0.05
  894. end
  895. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  896. #......................................................................
  897. if @_total_damage_duration <= 7 and @_total_damage_duration > 0
  898. @_hits_sprite.opacity -= 32
  899. @_hits_sprite.x += 1
  900. end
  901. #......................................................................
  902. if @_total_damage_duration <= 0
  903. #.....................................................................
  904. dispose_hit
  905. #.....................................................................
  906. @_total_damage = 0
  907. @_total_damage_duration = 0
  908. @_total_damage_sprite.bitmap.dispose
  909. @_total_damage_sprite.dispose
  910. @_total_damage_sprite = nil
  911. end
  912. end
  913. #=======================================
  914. if @_animation != nil and (Graphics.frame_count % 2 == 0)
  915. @_animation_duration -= 1
  916. update_animation
  917. end
  918. if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  919. update_loop_animation
  920. @_loop_animation_index += 1
  921. #......................................................................
  922. @loop_animation_once = 0
  923. @loop_animation_once = 1 if @once == 1 and @_loop_animation_index == @_loop_animation.frame_max
  924. #......................................................................
  925. @_loop_animation_index %= @_loop_animation.frame_max
  926. end
  927. if @_blink
  928. @_blink_count = (@_blink_count + 1) % 32
  929. if @_blink_count < 16
  930. alpha = (16 - @_blink_count) * 6
  931. else
  932. alpha = (@_blink_count - 16) * 6
  933. end
  934. self.color.set(255, 255, 255, alpha)
  935. end
  936. @@_animations.clear
  937. end
  938. #..........................................................................
  939. def loop_animation_once
  940. return @_loop_animation_once
  941. end
  942. #..........................................................................
  943. def update_animation
  944. if @_animation_duration > 0
  945. frame_index = @_animation.frame_max - @_animation_duration
  946. @frame_index = frame_index
  947. cell_data = @_animation.frames[frame_index].cell_data
  948. position = @_animation.position
  949. animation_set_sprites(@_animation_sprites, cell_data, position)
  950. #=======================================
  951. # 修改:弹出伤害,权重计算
  952. #=======================================
  953. for timing in @_animation.timings
  954. if timing.frame == frame_index
  955. t = 1.0 * animation_process_timing(timing, @_animation_hit)
  956. #p t,"当前权重", @all_quanzhong,"总权重"
  957. if @battler_damage.is_a?(Numeric) and t != 0
  958. t *= @battler_damage
  959. t /= @all_quanzhong
  960. #p t,"当前伤害",@battler_damage,"总伤害"
  961. t = t.to_i
  962. # 最后一次闪光的话,伤害修正
  963. if frame_index == @_last_frame
  964. @_total_damage = @battler_damage - t
  965. end
  966. #p t,@battler_damage,@all_quanzhong
  967. damage(t,@battler_critical)
  968. # 防止重复播放miss
  969. elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  970. damage(@battler_damage,@battler_critical)
  971. end
  972. end
  973. end
  974. else
  975. dispose_animation
  976. end
  977. end
  978. #=======================================
  979. # 修改:敌人跳跃的功能 + 添加返回数值
  980. #=======================================
  981. def update_loop_animation
  982. frame_index = @_loop_animation_index
  983. cell_data = @_loop_animation.frames[frame_index].cell_data
  984. position = @_loop_animation.position
  985. #·改·
  986. if @wait_count.to_i <= 0
  987. @wait_count = 0
  988. animation_set_sprites(@_loop_animation_sprites, cell_data, position)
  989. else
  990. @wait_count -= 1
  991. for sprite in @_loop_animation_sprites
  992. sprite.visible = false
  993. end
  994. end
  995. if @wait_flash.to_i <= 0
  996. @wait_flash = 0
  997. else
  998. @wait_flash -= 1
  999. for sprite in @_loop_animation_sprites
  1000. sprite.blend_type = 1
  1001. end
  1002. end
  1003. #·改·
  1004. for timing in @_loop_animation.timings
  1005. if timing.frame == frame_index
  1006. animation_process_timing(timing, true)
  1007. end
  1008. end
  1009. end
  1010. #=======================================
  1011. # 修改:敌人跳跃的功能 + 添加返回数值
  1012. #=======================================
  1013. def loop_animation(animation)
  1014. return if animation == @_loop_animation
  1015. dispose_loop_animation
  1016. @_loop_animation = animation
  1017. return if @_loop_animation == nil
  1018. @_loop_animation_index = 0
  1019. animation_name = @_loop_animation.animation_name
  1020. animation_hue = @_loop_animation.animation_hue
  1021. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  1022. if @@_reference_count.include?(bitmap)
  1023. @@_reference_count[bitmap] += 1
  1024. else
  1025. @@_reference_count[bitmap] = 1
  1026. end
  1027. @_loop_animation_sprites = []
  1028. for i in 0..15
  1029. sprite = ::Sprite.new
  1030. sprite.bitmap = bitmap
  1031. sprite.visible = false
  1032. @_loop_animation_sprites.push(sprite)
  1033. end
  1034. update_loop_animation
  1035. end
  1036. #=======================================
  1037. # 修改:敌人跳跃的功能 + 添加返回数值
  1038. #=======================================
  1039. def animation_process_timing(timing, hit,dontflash=false)
  1040. if (timing.condition == 0) or
  1041. (timing.condition == 1 and hit == true) or
  1042. (timing.condition == 2 and hit == false)
  1043. unless dontflash
  1044. if timing.se.name != ""
  1045. se = timing.se
  1046. Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  1047. end
  1048. end
  1049. case timing.flash_scope
  1050. when 1
  1051. unless dontflash
  1052. self.flash(timing.flash_color, timing.flash_duration * 2)
  1053. #....................................................................
  1054. @wait_flash = timing.flash_duration
  1055. #....................................................................
  1056. if @_total_damage >0
  1057. @flash_shake_switch = true
  1058. @flash_shake = 0
  1059. end
  1060. end
  1061. return timing.flash_color.alpha * timing.flash_duration
  1062. when 2
  1063. unless dontflash
  1064. if self.viewport != nil
  1065. self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1066. return timing.flash_color.alpha * timing.flash_duration
  1067. end
  1068. end
  1069. when 3
  1070. unless dontflash
  1071. self.flash(nil, timing.flash_duration * 2)
  1072. #@_loop_animation_count = 1
  1073. #·改·
  1074. @wait_count = timing.flash_duration
  1075. #·改·
  1076. end
  1077. return timing.flash_color.alpha * timing.flash_duration
  1078. end
  1079. end
  1080. return 0
  1081. end
  1082. end
  1083. end
  1084. #==============================================================================
  1085. # ■ Sprite_Battler
  1086. #==============================================================================
  1087. class Sprite_Battler < RPG::Sprite
  1088. #--------------------------------------------------------------------------
  1089. # ● 初始化对像
  1090. # 添加跳跃记录
  1091. #--------------------------------------------------------------------------
  1092. def initialize(viewport, battler = nil)
  1093. super(viewport)
  1094. @battler = battler
  1095. @battler_visible = false
  1096. @flash_shake_switch = true
  1097. #........................................................................
  1098. @once = 0
  1099. @frame_index = -1
  1100. @last_frame = 0
  1101. #........................................................................
  1102. end
  1103. #--------------------------------------------------------------------------
  1104. # ● 刷新画面
  1105. # 增添跳跃功能
  1106. #--------------------------------------------------------------------------
  1107. def update
  1108. super
  1109. # 战斗者为 nil 的情况下
  1110. if @battler == nil
  1111. self.bitmap = nil
  1112. loop_animation(nil)
  1113. return
  1114. end
  1115. # 文件名和色相与当前情况有差异的情况下
  1116. if @battler.battler_name != @battler_name or
  1117. @battler.battler_hue != @battler_hue
  1118. # 获取、设置位图
  1119. @battler_name = @battler.battler_name
  1120. @battler_hue = @battler.battler_hue
  1121. self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1122. #.......................................................................
  1123. if not @battler.hidden and not @battler.dead?
  1124. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1125. end
  1126. #.......................................................................
  1127. @width = bitmap.width
  1128. @height = bitmap.height
  1129. self.ox = @width / 2
  1130. self.oy = @height
  1131. end
  1132. #.......................................................................
  1133. update_actor_animation
  1134. update_enemy_animation
  1135. #.......................................................................
  1136. # 动画 ID 与当前的情况有差异的情况下
  1137. #.........................................................................
  1138. if @battler.is_a?(Game_Enemy)
  1139. if @once == 1 and @loop_animation_once == 1 and
  1140. @battler.battler_dead_ani == 1
  1141. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1142. elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1143. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1144. end
  1145. end
  1146. if @battler.is_a?(Game_Actor)
  1147. ####################################################################
  1148. if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
  1149. @battler.battler_dead_ani == 1 and @battler.dead?
  1150. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1151. #######################################################################
  1152. elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1153. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1154. #################################################################
  1155. $fangyu = 0
  1156. @battler.setup_battler_dead_ani(0)
  1157. ########################################################
  1158. elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
  1159. not @battler.dead?
  1160. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7])
  1161. ######################################################
  1162. $fangyu = 0
  1163. @battler.setup_battler_dead_ani(0)
  1164. ######################################################
  1165. end
  1166. end
  1167. if @battler.battler_ani != @battler_ani
  1168. @battler_ani = @battler.battler_ani
  1169. @once = @battler.battler_ani_once
  1170. loop_animation($data_animations[@battler_ani.to_i])
  1171. end
  1172. #.........................................................................
  1173. # 应该被显示的角色的情况下
  1174. #if @battler.is_a?(Game_Actor) and @battler_visible
  1175. # 不是主状态的时候稍稍降低点透明度
  1176. # if $game_temp.battle_main_phase
  1177. # self.opacity += 10 if self.opacity < 255
  1178. # else
  1179. # self.opacity -= 10 if self.opacity > 207
  1180. # end
  1181. # end
  1182. # 明灭
  1183. if @battler.blink
  1184. blink_on
  1185. else
  1186. blink_off
  1187. end
  1188. # 不可见的情况下
  1189. unless @battler_visible
  1190. # 出现
  1191. if not @battler.hidden and not @battler.dead? and
  1192. (@battler.damage == nil or @battler.damage_pop)
  1193. #.......................................................................
  1194. if @battler.is_a?(Game_Enemy)
  1195. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1196. #appear
  1197. else
  1198. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1199. end
  1200. #.......................................................................
  1201. @battler_visible = true
  1202. end
  1203. end
  1204. # 可见的情况下
  1205. if @battler_visible
  1206. # 逃跑
  1207. if @battler.hidden
  1208. $game_system.se_play($data_system.escape_se)
  1209. escape
  1210. @battler_visible = false
  1211. end
  1212. # 白色闪烁
  1213. if @battler.white_flash
  1214. whiten
  1215. @battler.white_flash = false
  1216. end
  1217. # 动画
  1218. if @battler.animation_id != 0
  1219. animation = $data_animations[@battler.animation_id]
  1220. animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  1221. @battler.animation_id = 0
  1222. end
  1223. # 伤害
  1224. if @battler.damage_pop
  1225. @battler.damage = nil
  1226. @battler.critical = false
  1227. @battler.damage_pop = false
  1228. end
  1229. # korapusu
  1230. if @battler.damage == nil and @battler.dead?
  1231. if @battler.is_a?(Game_Enemy)
  1232. if @battler.battler_dead_ani != 1
  1233. #p "Battler Death Error"
  1234. $game_system.se_play($data_system.enemy_collapse_se)
  1235. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1236. @battler.setup_battler_dead_ani(1)
  1237. end
  1238. #.....................................................................
  1239. collapse
  1240. #.....................................................................
  1241. else
  1242. #.....................................................................
  1243. if @battler.battler_dead_ani != 1
  1244. #p "Battler Death Error"
  1245. $game_system.se_play($data_system.enemy_collapse_se)
  1246. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1247. @battler.setup_battler_dead_ani(1)
  1248. end
  1249. #.....................................................................
  1250. end
  1251. @battler_visible = false
  1252. end
  1253. end
  1254. # 设置活动块的坐标
  1255. if @flash_shake_switch == true
  1256. self.x = @battler.screen_x
  1257. self.y = @battler.screen_y
  1258. self.z = @battler.screen_z
  1259. @flash_shake_switch = false
  1260. end
  1261. if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  1262. if @battler.is_a?(Game_Enemy)
  1263. case @flash_shake
  1264. when 9..10
  1265. self.x -=4
  1266. self.y -=4
  1267. self.z = @battler.screen_z
  1268. when 6..8
  1269. self.x -=2
  1270. self.y -=2
  1271. self.z = @battler.screen_z
  1272. when 3..5
  1273. self.x +=2
  1274. self.y +=2
  1275. self.z = @battler.screen_z
  1276. when 1..2
  1277. self.x +=4
  1278. self.y +=4
  1279. self.z = @battler.screen_z
  1280. end
  1281. end
  1282. if @battler.is_a?(Game_Actor)
  1283. case @flash_shake
  1284. when 9..10
  1285. self.x +=4
  1286. self.y +=4
  1287. self.z = @battler.screen_z
  1288. when 6..8
  1289. self.x +=2
  1290. self.y +=2
  1291. self.z = @battler.screen_z
  1292. when 3..5
  1293. self.x -=2
  1294. self.y -=2
  1295. self.z = @battler.screen_z
  1296. when 1..2
  1297. self.x -=4
  1298. self.y -=4
  1299. self.z = @battler.screen_z
  1300. end
  1301. end
  1302. @flash_shake -= 1
  1303. end
  1304. end
  1305. end
  1306. #==============================================================================
  1307. # ■ Scene_Battle
  1308. #------------------------------------------------------------------------------
  1309. #  处理战斗画面的类。
  1310. #==============================================================================
  1311. class Scene_Battle
  1312. #--------------------------------------------------------------------------
  1313. # ● 定义实例变量
  1314. #--------------------------------------------------------------------------
  1315. attr_reader :animation1_id # 行动方动画ID
  1316. end
  1317. class Sprite_Battler < RPG::Sprite
  1318. #--------------------------------------------------------------------------
  1319. # ● 处理角色动作
  1320. #--------------------------------------------------------------------------
  1321. def update_actor_animation
  1322. if @battler.is_a?(Game_Actor)
  1323. if @battler.show_damage_value != nil
  1324. self.damage(@battler.show_damage_value, false)
  1325. @battler.show_damage(nil)
  1326. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1327. @battler.setup_battler_hurt_ani(1)
  1328. end
  1329. if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1330. ######################################################################
  1331. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1332. @battler.setup_battler_hurt_ani(1)
  1333. ####################################################################
  1334. else
  1335. if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  1336. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1337. @battler.setup_battler_hurt_ani(1)
  1338. ########################################################################
  1339. elsif @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu == 1
  1340. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1341. @battler.setup_battler_hurt_ani(1)
  1342. #################################################################
  1343. elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1344. for actor in $game_party.actors
  1345. if @battler != actor
  1346. actor.add_state(6)
  1347. end
  1348. end
  1349. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1350. @battler.setup_battler_dead_ani(1)
  1351. end
  1352. end
  1353. end
  1354. end
  1355. #--------------------------------------------------------------------------
  1356. # ● 处理敌人动作
  1357. #--------------------------------------------------------------------------
  1358. def update_enemy_animation
  1359. if @battler.is_a?(Game_Enemy)
  1360. if @battler.show_damage_value != nil
  1361. self.damage(@battler.show_damage_value, false)
  1362. @battler.show_damage(nil)
  1363. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1364. @battler.setup_battler_hurt_ani(1)
  1365. end
  1366. if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1367. else
  1368. if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1369. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1370. @battler.setup_battler_hurt_ani(1)
  1371. elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1372. @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1373. @battler.setup_battler_dead_ani(1)
  1374. collapse
  1375. end
  1376. end
  1377. end
  1378. end
  1379. end
复制代码

作者: H海GG    时间: 2016-8-21 21:35
进入游戏时提醒第一个脚本的第24行出现了问题!
作者: H海GG    时间: 2016-8-21 21:37
第二个脚本能不能改成只留下连击的作用呢? 别的东西不需要,会的麻烦下,谢谢!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1