查看: 2060|回复: 4

[已经过期] 有關橫版 總傷害的顯示寬度~

[复制链接]
梦石
0
星屑
65
在线时间
141 小时
注册时间
2012-4-29
回帖
32
发表于 2016-11-14 23:19:34 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 RyanBern 于 2016-11-15 10:07 编辑

各位前輩好,我用了一個橫版戰鬥的腳本,裡面也有包括傷害美化跟連擊顯示,但今天發現造成傷害後,會有個總傷害


的顯示,但是總傷害只能顯示到99999也就是5位數,我測試一下,讓傷害變成6位數後第1個數字會被切掉 == ....


後來改狠狠多次腳本,也改了圖片大小試試,都沒用...圖片大小改小它直接不顯示第6位數= =




新問題.png



這是腳本裡的總傷害那段,第750行...但怎麼改都一樣有前輩能幫忙嗎?


  1. # ● 总伤害处理
  2. #--------------------------------------------------------------------------
  3. def make_total_damage(value)
  4. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  5. @_total_damage += value
  6. # 绝对值转为字符串
  7. damage_string = @_total_damage.abs.to_s
  8. else
  9. return
  10. end
  11. # 初始化位图
  12. bitmap = Bitmap.new(350, 150)
  13. bitmap.font.name = "Arial Black"
  14. bitmap.font.size = 32
  15. # 伤害值是数值的情况下
  16. if value.is_a?(Numeric)
  17. # 分割伤害值字符串
  18. damage_array = damage_string.scan(/./)
  19. damage_x = 40 - damage_string.size * 9
  20. # 伤害值为负的情况下
  21. name=RPG::Cache.picture("total_damage")
  22. # 循环伤害值字符串
  23. for char in damage_array
  24. number = char.to_i
  25. # 显示伤害数字
  26. bitmap.blt(damage_x, 0, name,
  27. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  28. #################################################################总伤害数值
  29. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  30. #################################################################总伤害数值
  31. end
  32. end
复制代码


這是腳本:


  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #
  4. # ■ 熊式横版战斗 by 弗雷德   真移位:神思
  5. #==============================================================================
  6. #如果要需要Game_Battler3类的攻击、特技、物品的方法,请移至161-470行
  7. #因为重写过这三个方法,在原方法里改是不会生效的。





  8. #--------------------------------------------------------------------------
  9. #  ● 设定开始
  10. #--------------------------------------------------------------------------
  11. #伤害为0的时候是否显示无效文字,1为显示,0为不显示。
  12. INVALIDSWITCH = 1

  13. # 是否显示死亡图 1为显示,0为不显示。
  14. DEADPIC = 1

  15. # 是否显示总伤害 1为显示,0为不显示。
  16. SHOW_TOTAL_DAMAGE = 1

  17. # 是否显示连击数值 1为显示,0为不显示。
  18. HITSWITCH = 1

  19. # 是否显示SP伤害数值 1为显示,0为不显示。
  20. SDMGSWITCH = 1

  21. # 不是主状态的时候是否稍稍降低点透明度  1为降低,0为不降低
  22. NACTSWITCH = 0

  23. # 会心一击时的音效,不设置为不使用音效。
  24. CRIVOICE = "Critital_hit"

  25. # 会心一击是否开启画面晃动 1为开启,0为关闭
  26. CRISHAKE = 1

  27. # 会心一击是否开启画面闪烁,1为开启,0为关闭
  28. CRIFLASH = 1

  29. # 攻击时不移动的属性编号 默认为29号 参考数据库的设置
  30. # 比如职业枪兵勾上了29号属性,那么当枪兵使用普通攻击时将不会移动。技能也是如此。
  31. UNMOVE = 29

  32. # 攻击到与敌人同一水平线前的属性编号 默认为30号 参考数据库的设置
  33. HOMOVE = 30

  34. ##################################################################
  35. module Scene_BattleName
  36.   # 设定移动速度
  37.   Move_Duration = 28
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40. "佛雷德" => {
  41.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  42.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  43.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  44.   "受伤" => ["Fred_h"],
  45.   "防御" => ["Fred_d"],
  46.   "死亡" => ["Fred_die1","Fred_die2"]
  47.   },
  48.   
  49.   "女法師" => {
  50.   "待机" => ["01-1","01-2","01-3","01-4"],
  51.   "移动" => ["01-1"],
  52.   "返回" => ["01-5"],
  53.   "受伤" => ["01-7"],
  54.   "防御" => ["01-1"],
  55.   "死亡" => ["01-6"]
  56.   },
  57.   
  58.   "大熊" => {
  59.   "待机" => ["bear_s11","bear_s12","bear_s13","bear_s14"],
  60.   "移动" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  61.   "返回" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  62.   "受伤" => ["bear_h1"],
  63.   "防御" => ["bear_d1"],
  64.   "死亡" => ["bear_die11","bear_die12"]
  65.   },
  66.   
  67.   "蜘蛛" => {
  68.   "待机" => ["011","012","012","011"],
  69.   "移动" => ["011"],
  70.   "返回" => ["011"],
  71.   "受伤" => ["011"],
  72.   "防御" => ["011"],
  73.   "死亡" => ["015"]
  74.   },
  75.   
  76.   "鬼幽靈" => {
  77.   "待机" => ["ghost_s11","ghost_s12","ghost_s13","ghost_s14"],
  78.   "移动" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  79.   "返回" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  80.   "受伤" => ["ghost_h1"],
  81.   "防御" => ["ghost_d1"],
  82.   "死亡" => ["ghost_die11","ghost_die12"]
  83.   },
  84.   
  85.    "惡佛雷德" => {
  86.   "待机" => ["Fred_s11","Fred_s12","Fred_s13","Fred_s14"],
  87.   "移动" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  88.   "返回" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  89.   "受伤" => ["Fred_h1"],
  90.   "防御" => ["Fred_d1"],
  91.   "死亡" => ["Fred_die11","Fred_die12"]
  92.   },
  93.   
  94.   "惡熊" => {
  95.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  96.   "移动" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  97.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  98.   "受伤" => ["bear_h"],
  99.   "防御" => ["bear_d"],
  100.   "死亡" => ["bear_die1","bear_die2"]
  101.   },
  102.   
  103.   "惡蜘蛛" => {
  104.   "待机" => ["monster01","monster02","monster03","monster04"],
  105.   "移动" => ["monster01"],
  106.   "返回" => ["monster05"],
  107.   "受伤" => ["monster01"],
  108.   "防御" => ["monster01"],
  109.   "死亡" => ["spider_die1","spider_die2"]
  110.   },
  111.   
  112.   "巨大鬼幽靈" => {
  113.   "待机" => ["ghost_s1","ghost_s2","ghost_s3","ghost_s4"],
  114.   "移动" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  115.   "返回" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  116.   "受伤" => ["ghost_h"],
  117.   "防御" => ["ghost_d"],
  118.   "死亡" => ["ghost_die1","ghost_die2"]
  119.   },
  120. }
  121. end
  122. #至于其它的:

  123. #HP伤害数字间距偏移在602行修改。

  124. #SP伤害数字间距偏移在667行修改。

  125. #连击数字间距偏移在713行修改。

  126. #总伤害数字间距偏移在759行修改。

  127. #--------------------------------------------------------------------------
  128. #  ● 设定结束
  129. #--------------------------------------------------------------------------










  130. class Game_Battler
  131.   attr_accessor :movex                    # X坐标修正
  132.   attr_accessor :movey                    # Y坐标修正
  133.   attr_accessor :startactive              # 行为
  134.   attr_accessor :damage_sp                # 精神伤害值
  135.   alias bearrpg_initialize initialize
  136.   def initialize
  137.     bearrpg_initialize
  138.     @damage_sp = 0
  139.     @movex = 0
  140.     @movey = 0
  141.     @startactive = "待机"
  142.   end
  143.   def width #获取战斗图宽
  144.     return RPG::Cache.battler(@battler_name, @battler_hue).width
  145.   end
  146.   def height #获取战斗图高
  147.     return RPG::Cache.battler(@battler_name, @battler_hue).height
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 应用通常攻击效果
  151.   #     attacker : 攻击者 (battler)
  152.   #--------------------------------------------------------------------------
  153.   def attack_effect(attacker)
  154.     # 清除会心一击标志
  155.     self.critical = false
  156.     #######伤害开关初始化##################################################bearrpg
  157.     $damage_hp = false
  158.     $damage_sp = false
  159.     # 第一命中判定
  160.     hit_result = (rand(100) < attacker.hit)
  161.     # 命中的情况下
  162.     if hit_result == true
  163.       # 计算基本伤害
  164.       atk = [attacker.atk - self.pdef / 2, 0].max
  165.       self.damage = atk * (20 + attacker.str) / 20
  166.       # 属性修正
  167.       self.damage *= elements_correct(attacker.element_set)
  168.       self.damage /= 100
  169.       # 伤害符号正确的情况下
  170.       if self.damage > 0
  171.         # 会心一击修正
  172.         if rand(100) < 4 * attacker.dex / self.agi
  173.           self.damage *= 2
  174.           self.critical = true
  175.         end
  176.         # 防御修正
  177.         if self.guarding?
  178.           self.damage /= 2
  179.         end
  180.       end
  181.       $damage_hp = true if self.damage.is_a?(Numeric)
  182.     #  $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  183.       # 分散
  184.       if self.damage.abs > 0
  185.         amp = [self.damage.abs * 15 / 100, 1].max
  186.         self.damage += rand(amp+1) + rand(amp+1) - amp
  187.       end
  188.       # 第二命中判定
  189.       eva = 8 * self.agi / attacker.dex + self.eva
  190.       hit = self.damage < 0 ? 100 : 100 - eva
  191.       hit = self.cant_evade? ? 100 : hit
  192.       hit_result = (rand(100) < hit)
  193.     end
  194.     #####################################bearrpg
  195.     # 命中的情况下
  196.     if hit_result == true
  197.       # 状态冲击解除
  198.       remove_states_shock
  199.       # HP 的伤害计算
  200.       self.hp -= self.damage
  201.       # 状态变化
  202.       @state_changed = false
  203.       states_plus(attacker.plus_state_set)
  204.       states_minus(attacker.minus_state_set)
  205.       if self.damage == 0
  206.            self.damage = "无效" if INVALIDSWITCH >0
  207.          self.critical = false
  208.        end
  209.     # Miss 的情况下
  210.     else
  211.       # 伤害设置为 "Miss"
  212.       self.damage = "Miss"
  213.       # 清除会心一击标志
  214.       self.critical = false
  215.     end
  216.     # 过程结束
  217.     return true
  218.   end
  219.   #############################################bearrpg
  220.   #--------------------------------------------------------------------------
  221.   # ● 应用特技效果
  222.   #     user  : 特技的使用者 (battler)
  223.   #     skill : 特技
  224.   #--------------------------------------------------------------------------
  225.   def skill_effect(user, skill)
  226.     #######伤害开关初始化##################################################bearrpg
  227.     $damage_hp = false
  228.     $damage_sp = false
  229.     # 清除会心一击标志
  230.     self.critical = false
  231.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  232.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  233.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  234.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  235.       # 过程结束
  236.       return false
  237.     end
  238.     # 清除有效标志
  239.     effective = false
  240.     # 公共事件 ID 是有效的情况下,设置为有效标志
  241.     effective |= skill.common_event_id > 0
  242.     # 第一命中判定
  243.     hit = skill.hit
  244.     if skill.atk_f > 0
  245.       hit *= user.hit / 100
  246.     end
  247.     hit_result = (rand(100) < hit)
  248.     # 不确定的特技的情况下设置为有效标志
  249.     effective |= hit < 100
  250.     # 命中的情况下
  251.     if hit_result == true
  252.       # 计算威力
  253.       power = skill.power + user.atk * skill.atk_f / 100
  254.       if power > 0
  255.         power -= self.pdef * skill.pdef_f / 200
  256.         power -= self.mdef * skill.mdef_f / 200
  257.         power = [power, 0].max
  258.       end
  259.       # 计算倍率
  260.       rate = 20
  261.       rate += (user.str * skill.str_f / 100)
  262.       rate += (user.dex * skill.dex_f / 100)
  263.       rate += (user.agi * skill.agi_f / 100)
  264.       rate += (user.int * skill.int_f / 100)
  265.       # 计算基本伤害
  266.       self.damage = power * rate / 20
  267.       # 属性修正
  268.       self.damage *= elements_correct(skill.element_set)
  269.       self.damage /= 100
  270.       # 伤害符号正确的情况下
  271.       if self.damage > 0
  272.         # 防御修正
  273.         if self.guarding?
  274.           self.damage /= 2
  275.         end
  276.       end
  277.       # 分散
  278.       if skill.variance > 0 and self.damage.abs > 0
  279.         amp = [self.damage.abs * skill.variance / 100, 1].max
  280.         self.damage += rand(amp+1) + rand(amp+1) - amp
  281.       end
  282.       # 第二命中判定
  283.       eva = 8 * self.agi / user.dex + self.eva
  284.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  285.       hit = self.cant_evade? ? 100 : hit
  286.       hit_result = (rand(100) < hit)
  287.       # 不确定的特技的情况下设置为有效标志
  288.       effective |= hit < 100
  289.     end
  290.     $damage_hp = true if self.damage.is_a?(Numeric)
  291.    # $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  292.     # 命中的情况下
  293.     if hit_result == true
  294.       # 威力 0 以外的物理攻击的情况下
  295.       if skill.power != 0 and skill.atk_f > 0
  296.         # 状态冲击解除
  297.         remove_states_shock
  298.         # 设置有效标志
  299.         effective = true
  300.       end
  301.       # HP 的伤害减法运算
  302.       last_hp = self.hp
  303.       self.hp -= self.damage
  304.       effective |= self.hp != last_hp
  305.       # 状态变化
  306.       @state_changed = false
  307.       effective |= states_plus(skill.plus_state_set)
  308.       effective |= states_minus(skill.minus_state_set)
  309.       #############################################bearrpg
  310.       # 威力为 0 的场合
  311.       if skill.power == 0
  312.         # 伤害设置为空的字串
  313.         self.damage = ""
  314.         # 状态没有变化的情况下
  315.         unless @state_changed
  316.           # 伤害设置为 "Miss"
  317.           self.damage = "Miss"
  318.         end
  319.       elsif self.damage == 0
  320.         unless @state_changed
  321.            self.damage = "无效" if INVALIDSWITCH >0
  322.          else
  323.           self.damage = ""
  324.         end
  325.       end
  326.     # Miss 的情况下
  327.     else
  328.       # 伤害设置为 "Miss"
  329.       self.damage = "Miss"
  330.     end
  331.     # 不在战斗中的情况下
  332.     unless $game_temp.in_battle
  333.       # 伤害设置为 nil
  334.       self.damage = nil
  335.     end
  336.     # 过程结束
  337.     return effective
  338.   end
  339.   #############################################bearrpg
  340.   #--------------------------------------------------------------------------
  341.   # ● 应用物品效果
  342.   #     item : 物品
  343.   #--------------------------------------------------------------------------
  344.   def item_effect(item)
  345.     # 清除会心一击标志
  346.     self.critical = false
  347.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  348.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  349.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  350.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  351.       # 过程结束
  352.       return false
  353.     end
  354.     # 清除有效标志
  355.     effective = false
  356.     # 公共事件 ID 是有效的情况下,设置为有效标志
  357.     effective |= item.common_event_id > 0
  358.     # 命中判定
  359.     hit_result = (rand(100) < item.hit)
  360.     # 不确定的特技的情况下设置为有效标志
  361.     effective |= item.hit < 100
  362.     # 命中的情况
  363.     if hit_result == true
  364.       # 计算回复量
  365.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  366.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  367.       if recover_hp < 0
  368.         recover_hp += self.pdef * item.pdef_f / 20
  369.         recover_hp += self.mdef * item.mdef_f / 20
  370.         recover_hp = [recover_hp, 0].min
  371.       end
  372.       # 属性修正
  373.       recover_hp *= elements_correct(item.element_set)
  374.       recover_hp /= 100
  375.       recover_sp *= elements_correct(item.element_set)
  376.       recover_sp /= 100
  377.       # 分散
  378.       if item.variance > 0 and recover_hp.abs > 0
  379.         amp = [recover_hp.abs * item.variance / 100, 1].max
  380.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  381.       end
  382.       if item.variance > 0 and recover_sp.abs > 0
  383.         amp = [recover_sp.abs * item.variance / 100, 1].max
  384.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  385.       end
  386.       # 回复量符号为负的情况下
  387.       if recover_hp < 0
  388.         # 防御修正
  389.         if self.guarding?
  390.           recover_hp /= 2
  391.         end
  392.       end
  393.       # HP 回复量符号的反转、设置伤害值
  394.       self.damage = -recover_hp
  395.       self.damage_sp = -recover_sp  
  396.       # HP 以及 SP 的回复
  397.       last_hp = self.hp
  398.       last_sp = self.sp
  399.       self.hp += recover_hp
  400.       self.sp += recover_sp
  401.       ###################################################################bearrpg
  402.       $damage_hp = true if self.damage.is_a?(Numeric)
  403.       $damage_sp = true if self.damage_sp.is_a?(Numeric) and recover_sp != 0
  404.       ###################################################################bearrpg
  405.       effective |= self.hp != last_hp
  406.       effective |= self.sp != last_sp
  407.       # 状态变化
  408.       @state_changed = false
  409.       effective |= states_plus(item.plus_state_set)
  410.       effective |= states_minus(item.minus_state_set)
  411.       # 能力上升值有效的情况下
  412.       if item.parameter_type > 0 and item.parameter_points != 0
  413.         # 能力值的分支
  414.         case item.parameter_type
  415.         when 1  # MaxHP
  416.           @maxhp_plus += item.parameter_points
  417.         when 2  # MaxSP
  418.           @maxsp_plus += item.parameter_points
  419.         when 3  # 力量
  420.           @str_plus += item.parameter_points
  421.         when 4  # 灵巧
  422.           @dex_plus += item.parameter_points
  423.         when 5  # 速度
  424.           @agi_plus += item.parameter_points
  425.         when 6  # 魔力
  426.           @int_plus += item.parameter_points
  427.         end
  428.         # 设置有效标志
  429.         effective = true
  430.       end
  431.       # HP 回复率与回复量为 0 的情况下
  432.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  433.         # 设置伤害为空的字符串
  434.         self.damage = ""
  435.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  436.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  437.            (item.parameter_type == 0 or item.parameter_points == 0)
  438.           # 状态没有变化的情况下
  439.           unless @state_changed
  440.             # 伤害设置为 "Miss"
  441.             self.damage = "Miss"
  442.           end
  443.         end
  444.       end
  445.     # Miss 的情况下
  446.     else
  447.       # 伤害设置为 "Miss"
  448.       self.damage = "Miss"
  449.     end
  450.     # 不在战斗中的情况下
  451.     unless $game_temp.in_battle
  452.       # 伤害设置为 nil
  453.       self.damage = nil
  454.     end
  455.     # 过程结束
  456.     return effective
  457.   end
  458. end

  459. class Game_Actor
  460.   def screen_x
  461.     if self.index != nil
  462.       return (640-self.index*50)/2 + 240 + @movex
  463.     else
  464.       return 0
  465.     end
  466.   end
  467.   def screen_y
  468.     return self.index*70+self.height/2 + 55 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  469.   end
  470.   def screen_z
  471.     return self.screen_y-self.index * 10
  472.   end
  473. end
  474. class Game_Enemy
  475.   def screen_x
  476.     return $data_troops[@troop_id].members[@member_index].x + @movex
  477.   end
  478.   def screen_y
  479.     return $data_troops[@troop_id].members[@member_index].y + @movey
  480.   end
  481.   def screen_z
  482.     return self.screen_y#+self.height
  483.   end
  484. end

  485. class Sprite_Battler
  486.   include Scene_BattleName
  487. end
  488. module RPG
  489. class Sprite < ::Sprite
  490. #==========================================
  491. def initialize(viewport = nil)
  492. super(viewport)
  493. @_whiten_duration = 0
  494. @_appear_duration = 0
  495. @_escape_duration = 0
  496. @_collapse_duration = 0
  497. @_damage_duration = 0
  498. @_animation_duration = 0
  499. @_blink = false  
  500. @flash_shake = 0
  501. @_damage = []  
  502. @_damage_sp = []
  503. @_total_damage = 0
  504. @_total_damage_duration = 0
  505. @p_dam=0
  506. @hits=0
  507. end
  508. def animation_set_sprites(sprites, cell_data, position)
  509.    for i in 0..15
  510.    sprite = sprites[i]
  511.    pattern = cell_data[i, 0]
  512.    if sprite == nil or pattern == nil or pattern == -1
  513.      sprite.visible = false if sprite != nil
  514.      next
  515.    end
  516.    sprite.visible = true
  517.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  518.    if position == 3
  519.      if self.viewport != nil
  520.        sprite.x = self.viewport.rect.width / 2
  521.        sprite.y = self.viewport.rect.height - 160
  522.      else
  523.        sprite.x = 320
  524.        sprite.y = 240
  525.      end
  526.      else
  527.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  528.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  529.      sprite.y -= self.src_rect.height / 4 if position == 0
  530.      sprite.y += self.src_rect.height / 4 if position == 2
  531.    end
  532.    sprite.x += cell_data[i, 1]
  533.    sprite.y += cell_data[i, 2]
  534.    if $scene.is_a?(Scene_Battle)
  535.    sprite.z = battler.screen_z+20
  536. else
  537.    sprite.z = 9990
  538.    end
  539.    sprite.ox = 96
  540.    sprite.oy = 96
  541.    sprite.zoom_x = cell_data[i, 3] / 100.0
  542.    sprite.zoom_y = cell_data[i, 3] / 100.0
  543.    sprite.angle = cell_data[i, 4]
  544.    sprite.mirror = (cell_data[i, 5] == 1)
  545.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  546.    sprite.blend_type = cell_data[i, 7]
  547.    end
  548. end
  549. def damage(value, critical)
  550.   dispose_hit
  551.     if value.is_a?(Numeric)
  552.       damage_string = value.abs.to_s
  553.     else
  554.       damage_string = value.to_s
  555.     end
  556.     bitmap = Bitmap.new(300, 150)
  557.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  558.     bitmap.font.size = 32
  559.     if value.is_a?(Numeric)
  560.   # 分割伤害值字符串
  561.       damage_array = damage_string.scan(/./)
  562.       damage_x = 81 - damage_string.size * 9
  563.   # 会心一击标志打开的情况
  564.       if critical and value != "无效"
  565.   # 显示会心一击图画
  566.         cri_bitmap = RPG::Cache.picture("Critital")
  567.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  568.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  569.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  570.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  571.       end
  572.   # 伤害值为负的情况下
  573.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  574.       if value < 0
  575.   # 调用回复数字表
  576.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  577.       else
  578.   # 调用伤害数字表
  579.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  580.       end
  581.   # 循环伤害值字符串
  582.       for char in damage_array
  583.         number = char.to_i
  584.   # 显示伤害数字
  585.         bitmap.blt(damage_x, 32, dmg_bitmap,
  586.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  587. #################################################################普通伤害数值
  588.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  589. #################################################################普通伤害数值
  590.       end  
  591.     else
  592.       if value == "Miss"
  593.         miss_dmg = RPG::Cache.picture("miss")
  594.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  595.       elsif value == "无效"
  596.         invalid_dmg = RPG::Cache.picture("invalid")
  597.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  598.       #end
  599.       end
  600.     end
  601. # 伤害值定位
  602.     @_damage_sprite = ::Sprite.new(self.viewport)
  603.     @_damage_sprite.bitmap = bitmap
  604.     @_damage_sprite.ox = 80
  605.     @_damage_sprite.oy = 20
  606.     @_damage_sprite.x = self.x
  607.     @_damage_sprite.y = self.y - self.oy / 2
  608.     @_damage_sprite.z = 3000
  609.     @_damage_duration = 40
  610.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  611.     make_total_damage(value)
  612.   end
  613. ##################################################################sp伤害数值
  614. def damage_sp(value, critical)
  615.   dispose_hit
  616.     if value.is_a?(Numeric)
  617.       damage_string = value.abs.to_s
  618.     else
  619.       damage_string = value.to_s
  620.     end
  621.     bitmap = Bitmap.new(300, 150)
  622.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  623.     bitmap.font.size = 32
  624.     if value.is_a?(Numeric)
  625.   # 分割伤害值字符串
  626.       damage_array = damage_string.scan(/./)
  627.       damage_x = 81 - damage_string.size * 9
  628.   # 会心一击标志打开的情况
  629.       if critical and value != "无效"
  630.   # 显示会心一击图画
  631.         cri_bitmap = RPG::Cache.picture("Critital")
  632.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  633.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  634.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  635.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  636.       end
  637.   # 伤害值为负的情况下
  638.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  639.       if value < 0
  640.   # 调用回复数字表
  641.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  642.       else
  643.   # 调用伤害数字表
  644.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  645.       end
  646.   # 循环伤害值字符串
  647.       for char in damage_array
  648.         number = char.to_i
  649.   # 显示伤害数字
  650.         bitmap.blt(damage_x, 32, dmg_bitmap,
  651.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  652. #################################################################普通伤害数值
  653.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  654. #################################################################普通伤害数值
  655.       end  
  656.     else
  657.       if value == "Miss"
  658.         miss_dmg = RPG::Cache.picture("miss")
  659.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  660.       elsif value == "无效"
  661.         invalid_dmg = RPG::Cache.picture("invalid")
  662.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  663.       #end
  664.       end
  665.     end
  666. # 伤害值定位
  667.     @_damage_sprite = ::Sprite.new(self.viewport)
  668.     @_damage_sprite.bitmap = bitmap
  669.     @_damage_sprite.ox = 80
  670.     @_damage_sprite.oy = 20
  671.     @_damage_sprite.x = self.x
  672.     @_damage_sprite.y = self.y - self.oy / 2
  673.     @_damage_sprite.z = 3000
  674.     @_damage_duration = 40
  675.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  676.    # make_total_damage(value)
  677.   end  
  678. def hit
  679. # 如果伤害值是数值
  680. # 转为字符串
  681. value=@hits
  682. hits_string = value.to_s
  683. # 初始化位图
  684. bitmap = Bitmap.new(320, 64)
  685. bitmap.font.name = "Arial Black"
  686. bitmap.font.size = 32
  687. # 分割伤害值字符串
  688. hits_array = hits_string.scan(/./)
  689. hits_x = 81 - hits_string.size * 18.1
  690. rect_y = 0
  691. # 循环伤害值字符串
  692. for char in hits_array
  693. number = char.to_i
  694. # 显示伤害数字
  695. combo_num = RPG::Cache.picture("combo_num")
  696. bitmap.blt(hits_x, 0, combo_num,
  697. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  698. #################################################################连击数数值
  699. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  700. #################################################################连击数数值
  701. end
  702. combo_tx = RPG::Cache.picture("combo_text")
  703. bitmap.blt(hits_x, 0,combo_tx ,
  704. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  705. # 伤害值定位
  706. @_hits_sprite = ::Sprite.new(self.viewport)
  707. @_hits_sprite.bitmap = bitmap
  708. @_hits_sprite.ox = 81
  709. @_hits_sprite.oy = 20
  710. @_hits_sprite.x = 500
  711. @_hits_sprite.y = 100
  712. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  713. @_hits_sprite.z = 3000
  714. @_hits_duration = 40
  715. end
  716. #--------------------------------------------------------------------------
  717. # ● 总伤害处理
  718. #--------------------------------------------------------------------------
  719. def make_total_damage(value)
  720. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  721. @_total_damage += value
  722. # 绝对值转为字符串
  723. damage_string = @_total_damage.abs.to_s
  724. else
  725. return
  726. end
  727. # 初始化位图
  728. bitmap = Bitmap.new(350, 150)
  729. bitmap.font.name = "Arial Black"
  730. bitmap.font.size = 32
  731. # 伤害值是数值的情况下
  732. if value.is_a?(Numeric)
  733. # 分割伤害值字符串
  734. damage_array = damage_string.scan(/./)
  735. damage_x = 40 - damage_string.size * 9
  736. # 伤害值为负的情况下
  737. name=RPG::Cache.picture("total_damage")
  738. # 循环伤害值字符串
  739. for char in damage_array
  740. number = char.to_i
  741. # 显示伤害数字
  742. bitmap.blt(damage_x, 0, name,
  743. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  744. #################################################################总伤害数值
  745. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  746. #################################################################总伤害数值
  747. end
  748. end
  749. if @_total_damage_sprite.nil?
  750. @_total_damage_sprite = ::Sprite.new(self.viewport)
  751. @_total_damage_sprite.ox = 80
  752. @_total_damage_sprite.oy = 40
  753. @_total_damage_sprite.z = 3000
  754. end
  755. @_total_damage_sprite.bitmap = bitmap
  756. @_total_damage_sprite.zoom_x = 1.0
  757. @_total_damage_sprite.zoom_y = 1.0
  758. @_total_damage_sprite.x = self.x
  759. @_total_damage_sprite.y = self.y - self.oy / 2
  760. @_total_damage_sprite.z = 3001
  761. @_total_damage_duration = 80
  762. #hit数描绘
  763. @hits+=1
  764. if @_total_damage > 0
  765.   hit
  766. end
  767. end
  768. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  769. dispose_animation
  770. @battler_damage = battler_damage
  771. @battler_damage_sp = battler_damage_sp
  772. @battler_critical = battler_critical
  773. @_animation = animation
  774. return if @_animation == nil
  775. @_animation_hit = hit
  776. @_animation_duration = @_animation.frame_max
  777. animation_name = @_animation.animation_name
  778. animation_hue = @_animation.animation_hue
  779. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  780. for timing in @_animation.timings
  781. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  782. @all_quanzhong += quanzhong
  783. @_last_frame = timing.frame if quanzhong != 0
  784. end
  785. if @@_reference_count.include?(bitmap)
  786. @@_reference_count[bitmap] += 1
  787. else
  788. @@_reference_count[bitmap] = 1
  789. end  
  790. if $scene.is_a?(Scene_Battle)
  791. if $scene.animation1_id == @battler.animation_id
  792. @battler_damage = ""
  793. @battler_damage_sp = ""
  794. end
  795. end
  796. @_animation_sprites = []
  797. if @_animation.position != 3 or not @@_animations.include?(animation)
  798. for i in 0..15
  799. sprite = ::Sprite.new(self.viewport)
  800. sprite.bitmap = bitmap
  801. sprite.visible = false
  802. @_animation_sprites.push(sprite)
  803. end
  804. unless @@_animations.include?(animation)
  805. @@_animations.push(animation)
  806. end
  807. end
  808. update_animation
  809. end  
  810. def dispose_damage
  811. for damage in @_damage.reverse
  812. damage[0].bitmap.dispose
  813. damage[0].dispose
  814. @_damage.delete(damage)
  815. end
  816. for damage_sp in @_damage_sp.reverse
  817. damage_sp[0].bitmap.dispose
  818. damage_sp[0].dispose
  819. @_damage_sp.delete(damage_sp)
  820. end
  821. @_total_damage = 0
  822. @_last_frame = -1
  823. if @_total_damage_sprite != nil
  824. @_total_damage_duration = 0
  825. @_total_damage_sprite.bitmap.dispose
  826. @_total_damage_sprite.dispose
  827. @_total_damage_sprite = nil
  828. end
  829. end
  830. def dispose_hit
  831. if @_hits_sprite != nil
  832. @_hits_sprite.bitmap.dispose
  833. @_hits_sprite.dispose
  834. @_hits_sprite = nil
  835. end
  836. end
  837. def dispose_animation
  838. @battler_damage = nil
  839. @battler_damage_sp = nil
  840. @battler_critical = nil
  841. @all_quanzhong = 1
  842. @_total_damage = 0
  843. @_last_frame = -1
  844. if @_animation_sprites != nil
  845. sprite = @_animation_sprites[0]
  846. if sprite != nil
  847. @@_reference_count[sprite.bitmap] -= 1
  848. if @@_reference_count[sprite.bitmap] == 0
  849. sprite.bitmap.dispose
  850. end
  851. end
  852. for sprite in @_animation_sprites
  853. sprite.dispose
  854. end
  855. @_animation_sprites = nil
  856. @_animation = nil
  857. end
  858. end
  859. def update
  860. super
  861. if @_whiten_duration > 0
  862. @_whiten_duration -= 1
  863. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  864. end
  865. if @_appear_duration > 0
  866. @_appear_duration -= 1
  867. self.opacity = (16 - @_appear_duration) * 16
  868. end
  869. if @_escape_duration > 0
  870. @_escape_duration -= 1
  871. self.opacity = 256 - (32 - @_escape_duration) * 10
  872. end
  873. if @_collapse_duration > 0
  874. @_collapse_duration -= 1
  875. self.opacity = 256 - (48 - @_collapse_duration) * 6
  876. end
  877. if @_damage_duration > 0
  878. @_damage_duration -= 1
  879. for damage in @_damage
  880. damage[0].x = self.x + self.viewport.rect.x -
  881. self.ox + self.src_rect.width / 2 +
  882. (40 - damage[1]) * damage[3] / 10
  883. damage[0].y -= damage[4]+damage[1]/10
  884. damage[0].opacity = damage[1]*20
  885. damage[1] -= 1
  886. if damage[1]==0
  887. damage[0].bitmap.dispose
  888. damage[0].dispose
  889. @_damage.delete(damage)
  890. next
  891. end
  892. end
  893. for damage_sp in @_damage_sp
  894. damage_sp[0].x = self.x + self.viewport.rect.x -
  895. self.ox + self.src_rect.width / 2 +
  896. (40 - damage_sp[1]) * damage_sp[3] / 10
  897. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  898. damage_sp[0].opacity = damage_sp[1]*20
  899. damage_sp[1] -= 1
  900. if damage_sp[1]==0
  901. damage_sp[0].bitmap.dispose
  902. damage_sp[0].dispose
  903. @_damage_sp.delete(damage_sp)
  904. next
  905. end
  906. end
  907. end
  908. if @_total_damage_duration > 0
  909. @_total_damage_duration -= 1
  910. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  911. if @_total_damage_sprite.zoom_x > 1.0
  912. @_total_damage_sprite.zoom_x -= 0.05
  913. end
  914. if @_total_damage_sprite.zoom_y > 1.0
  915. @_total_damage_sprite.zoom_y -= 0.05
  916. end
  917. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  918. if @_total_damage_duration <= 0
  919. dispose_hit
  920. @_total_damage = 0
  921. @_total_damage_duration = 0
  922. @_total_damage_sprite.bitmap.dispose
  923. @_total_damage_sprite.dispose
  924. @_total_damage_sprite = nil
  925. end
  926. end
  927. #=======================================
  928.     if @_animation != nil and (Graphics.frame_count % 2 == 0)
  929.       @_animation_duration -= 1
  930.       update_animation
  931.     end
  932.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  933.       update_loop_animation
  934.       @_loop_animation_index += 1
  935.       @_loop_animation_index %= @_loop_animation.frame_max
  936.     end
  937.   if @_blink
  938.     @_blink_count = (@_blink_count + 1) % 32
  939.       if @_blink_count < 16
  940.         alpha = (16 - @_blink_count) * 6
  941.       else
  942.         alpha = (@_blink_count - 16) * 6
  943.       end
  944.       self.color.set(255, 255, 255, alpha)
  945.     end
  946.     @@_animations.clear
  947.   end
  948. def update_animation
  949.   if @_animation_duration > 0
  950.     frame_index = @_animation.frame_max - @_animation_duration
  951.     cell_data = @_animation.frames[frame_index].cell_data
  952.     position = @_animation.position
  953.     animation_set_sprites(@_animation_sprites, cell_data, position)
  954.       for timing in @_animation.timings
  955.         if timing.frame == frame_index
  956.           t = 1.0 * animation_process_timing(timing, @_animation_hit)
  957.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  958.           if timing.se.name != ""
  959.             se=timing.se
  960.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  961.           end
  962.           if @battler_damage.is_a?(Numeric) and t != 0
  963.             if @battler.guarding?
  964.               @battler.startactive = "防御" if @battler_damage > 0
  965.            else
  966.               @battler.startactive = "受伤" if @battler_damage > 0
  967.             end
  968.             t *= @battler_damage
  969.             t /= @all_quanzhong
  970.             ts *= @battler_damage_sp
  971.             ts /= @all_quanzhong
  972.             t = t.to_i
  973.             ts = ts.to_i
  974.   if frame_index != @_last_frame
  975.     @p_dam+= t
  976.   end
  977.       if frame_index == @_last_frame
  978.         t=@battler_damage-@p_dam
  979.       end
  980.     if frame_index == @_last_frame
  981.       @_total_damage = @battler_damage - t
  982.       @p_dam=0
  983.     end
  984.       damage(t,@battler_critical) if $damage_hp == true
  985.       damage_sp(ts,@battler_critical) if $damage_sp == true
  986.     if frame_index == @_last_frame
  987.       @hits=0
  988.      end
  989.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  990.         damage(@battler_damage,@battler_critical)
  991.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  992.        end
  993.       end
  994.       end
  995.     else
  996.       dispose_animation
  997.     end
  998.   end
  999. def animation_process_timing(timing, hit,dontflash=false)
  1000.   if (timing.condition == 0) or
  1001.     (timing.condition == 1 and hit == true) or
  1002.     (timing.condition == 2 and hit == false)
  1003.   case timing.flash_scope
  1004.     when 1
  1005.       unless dontflash
  1006.         self.flash(timing.flash_color, timing.flash_duration * 2)
  1007.         if @_total_damage >0
  1008.           @flash_shake_switch = true
  1009.           @flash_shake = 10
  1010.         end
  1011.       end
  1012.       return timing.flash_color.alpha * timing.flash_duration
  1013.     when 2
  1014.       unless dontflash
  1015.         if self.viewport != nil
  1016.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1017.         end
  1018.       end
  1019.       return timing.flash_color.alpha * timing.flash_duration
  1020.     when 3
  1021.       unless dontflash
  1022.         self.flash(nil, timing.flash_duration * 2)
  1023.       end
  1024.         return timing.flash_color.alpha * timing.flash_duration
  1025.       end
  1026.     end
  1027.       return 0
  1028.     end
  1029.   end
  1030. end

  1031. class Sprite_Battler < RPG::Sprite
  1032.   def initialize(viewport, battler = nil)
  1033.     super(viewport)
  1034.     @battler = battler
  1035.     @battler_visible = false
  1036.     @flash_shake_switch = true
  1037.     @number = 0#初始化编号
  1038.   end
  1039.   def update
  1040.     super
  1041.     # 战斗者为 nil 的情况下
  1042.     if @battler == nil
  1043.       self.bitmap = nil
  1044.       loop_animation(nil)
  1045.       return
  1046.     end
  1047.     # 文件名和色相与当前情况有差异的情况下
  1048.     if @battler.battler_name != @battler_name or
  1049.        @battler.battler_hue != @battler_hue
  1050.       # 获取、设置位图
  1051.       @battler_name = @battler.battler_name
  1052.       @battler_hue = @battler.battler_hue
  1053.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1054.       @width = bitmap.width
  1055.       @height = bitmap.height
  1056.       self.ox = @width / 2
  1057.       self.oy = @height
  1058.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  1059.       if @battler.dead? or @battler.hidden
  1060.         self.opacity = 0  if DEADPIC != 1
  1061.       end
  1062.     end
  1063.     ###################################万兽熊最高#########################################
  1064.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1065.       if Graphics.frame_count % 4 == 0
  1066.         unless BattlerName[@battler.name].nil?
  1067.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1068.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1069.         end
  1070.       end
  1071.     elsif @battler.startactive == "死亡"
  1072.        if Graphics.frame_count % 4 == 0
  1073.         unless BattlerName[@battler.name].nil?
  1074.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1075.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1076.           @number += 1
  1077.         else
  1078.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1079.           end
  1080.         end
  1081.       end
  1082.       else
  1083.       if Graphics.frame_count % 10 == 0
  1084.         unless BattlerName[@battler.name].nil?
  1085.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1086.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1087.         end
  1088.       end
  1089.     end
  1090.     #######################################################################################
  1091.     # 动画 ID 与当前的情况有差异的情况下
  1092.     if @battler.damage == nil and
  1093.        @battler.state_animation_id != @state_animation_id
  1094.       @state_animation_id = @battler.state_animation_id
  1095.       loop_animation($data_animations[@state_animation_id])
  1096.     end
  1097.     # 应该被显示的角色的情况下
  1098.    if NACTSWITCH > 0
  1099.     if @battler.is_a?(Game_Actor) and @battler_visible
  1100.       # 不是主状态的时候稍稍降低点透明度
  1101.       if $game_temp.battle_main_phase
  1102.         self.opacity += 3 if self.opacity < 255
  1103.       else
  1104.         self.opacity -= 3 if self.opacity > 207
  1105.       end
  1106.     end
  1107.   end
  1108.     if @battler.blink
  1109.       blink_on
  1110.     else
  1111.       blink_off
  1112.     end
  1113.     unless @battler_visible
  1114.       if not @battler.hidden and not @battler.dead? and
  1115.          (@battler.damage == nil or @battler.damage_pop)
  1116.         appear
  1117.         @battler_visible = true
  1118.       end
  1119.     end
  1120.     if @battler_visible
  1121.       if @battler.hidden
  1122.         $game_system.se_play($data_system.escape_se)
  1123.         escape
  1124.         @battler_visible = false
  1125.       end
  1126.       if @battler.white_flash
  1127.         whiten
  1128.         @battler.white_flash = false   
  1129.       end
  1130.         if @battler.animation_id != 0
  1131.         animation = $data_animations[@battler.animation_id]
  1132.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1133.         @battler.animation_id = 0
  1134.       end
  1135.       if @battler.damage_pop
  1136.         @battler.damage = nil
  1137.         @battler.damage_sp = 0
  1138.         @battler.critical = false
  1139.         @battler.damage_pop = false
  1140.       end
  1141.       if @battler.damage == nil and @battler.dead?
  1142.         if DEADPIC >0
  1143.           @battler.startactive = "死亡"
  1144.           else
  1145.         if @battler.is_a?(Game_Enemy)
  1146.           $game_system.se_play($data_system.enemy_collapse_se)
  1147.         else
  1148.           $game_system.se_play($data_system.actor_collapse_se)
  1149.         end
  1150.         collapse
  1151.         @battler_visible = false
  1152.         end
  1153.       end
  1154.     end
  1155.      self.x = @battler.screen_x
  1156.      self.y = @battler.screen_y
  1157.      self.z = @battler.screen_z
  1158.   end
  1159. end

  1160. class Spriteset_Battle
  1161. alias bearrpg_initialize initialize
  1162.   def initialize
  1163.     @enemy_sprites = []
  1164.     for enemy in $game_troop.enemies.reverse
  1165.       #####修改敌人显示端口,与角色一样。
  1166.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1167.     end
  1168.     bearrpg_initialize
  1169.   end
  1170. end

  1171. class Arrow_Enemy < Arrow_Base
  1172.   def update
  1173.     super
  1174.     $game_troop.enemies.size.times do
  1175.       break if self.enemy.exist?
  1176.       @index += 1
  1177.       @index %= $game_troop.enemies.size
  1178.     end
  1179.     if Input.repeat?(Input::UP)
  1180.       $game_system.se_play($data_system.cursor_se)
  1181.       $game_troop.enemies.size.times do
  1182.         @index += 1
  1183.         @index %= $game_troop.enemies.size
  1184.         break if self.enemy.exist?
  1185.       end
  1186.     end
  1187.     if Input.repeat?(Input::DOWN)
  1188.       $game_system.se_play($data_system.cursor_se)
  1189.       $game_troop.enemies.size.times do
  1190.         @index += $game_troop.enemies.size - 1
  1191.         @index %= $game_troop.enemies.size
  1192.         break if self.enemy.exist?
  1193.       end
  1194.     end
  1195.     if self.enemy != nil
  1196.       self.x = self.enemy.screen_x
  1197.       self.y = self.enemy.screen_y
  1198.     end
  1199.   end
  1200. end

  1201. class Arrow_Actor < Arrow_Base
  1202.   def update
  1203.     super
  1204.     if Input.repeat?(Input::UP)
  1205.       $game_system.se_play($data_system.cursor_se)
  1206.       @index += 1
  1207.       @index %= $game_party.actors.size
  1208.     end
  1209.     if Input.repeat?(Input::DOWN)
  1210.       $game_system.se_play($data_system.cursor_se)
  1211.       @index += $game_party.actors.size - 1
  1212.       @index %= $game_party.actors.size
  1213.     end
  1214.     if self.actor != nil
  1215.       self.x = self.actor.screen_x
  1216.       self.y = self.actor.screen_y
  1217.     end
  1218.   end
  1219. end

  1220. class Scene_Battle
  1221. include Scene_BattleName
  1222. attr_reader :animation1_id
  1223.   def main
  1224.     $game_temp.in_battle = true
  1225.     $game_temp.battle_turn = 0
  1226.     $game_temp.battle_event_flags.clear
  1227.     $game_temp.battle_abort = false
  1228.     $game_temp.battle_main_phase = false
  1229.     $game_temp.battleback_name = $game_map.battleback_name
  1230.     $game_temp.forcing_battler = nil
  1231.     @_move_duration = 0
  1232.     $game_system.battle_interpreter.setup(nil, 0)
  1233.     @troop_id = $game_temp.battle_troop_id
  1234.     $game_troop.setup(@troop_id)
  1235.     s1 = $data_system.words.attack
  1236.     s2 = $data_system.words.skill
  1237.     s3 = $data_system.words.guard
  1238.     s4 = $data_system.words.item
  1239.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1240.     @actor_command_window.z = 900
  1241.     @actor_command_window.y = 160
  1242.     @actor_command_window.back_opacity = 160
  1243.     @actor_command_window.active = false
  1244.     @actor_command_window.visible = false
  1245.     @party_command_window = Window_PartyCommand.new
  1246.     @party_command_window.z = 910
  1247.     @help_window = Window_Help.new
  1248.     @help_window.back_opacity = 160
  1249.     @help_window.z = 920
  1250.     @help_window.visible = false
  1251.     @status_window = Window_BattleStatus.new
  1252.     @status_window.z = 930
  1253.     @message_window = Window_Message.new
  1254.     @message_window.z = 940
  1255.     @spriteset = Spriteset_Battle.new
  1256.     @wait_count = 0
  1257.     if $data_system.battle_transition == ""
  1258.       Graphics.transition(20)
  1259.     else
  1260.       Graphics.transition(40, "Graphics/Transitions/" +
  1261.         $data_system.battle_transition)
  1262.     end
  1263.     start_phase1
  1264.     loop do
  1265.       Graphics.update
  1266.       Input.update
  1267.       update
  1268.       if $scene != self
  1269.         break
  1270.       end
  1271.     end
  1272.     $game_map.refresh
  1273.     Graphics.freeze
  1274.     @actor_command_window.dispose
  1275.     @party_command_window.dispose
  1276.     @help_window.dispose
  1277.     @status_window.dispose
  1278.     @message_window.dispose
  1279.     if @skill_window != nil
  1280.       @skill_window.dispose
  1281.     end
  1282.     if @item_window != nil
  1283.       @item_window.dispose
  1284.     end
  1285.     if @result_window != nil
  1286.       @result_window.dispose
  1287.     end
  1288.     @spriteset.dispose
  1289.     if $scene.is_a?(Scene_Title)
  1290.       Graphics.transition
  1291.       Graphics.freeze
  1292.     end
  1293.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1294.       $scene = nil
  1295.     end
  1296.   end
  1297.   def start_phase1
  1298.     # 转移到回合 1
  1299.     @phase = 1
  1300.     # 清除全体同伴的行动
  1301.     $game_party.clear_actions
  1302.     for actor in $game_party.actors
  1303.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1304.     end
  1305.     # 设置战斗事件
  1306.     setup_battle_event
  1307.   end
  1308.   alias bearrpg_start_phase5 start_phase5
  1309. def start_phase5
  1310.    bearrpg_start_phase5
  1311.     @result_window.z = 999
  1312.     @phase5_wait_count = 100
  1313.   end
  1314.   def start_enemy_select
  1315.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1316.     @enemy_arrow.help_window = @help_window
  1317.     @actor_command_window.active = false
  1318.     @actor_command_window.visible = false
  1319.   end
  1320.   alias bearrpg_start_skill_select start_skill_select
  1321.    def start_skill_select
  1322.       bearrpg_start_skill_select
  1323.       @skill_window.z = 999
  1324.     end
  1325.    alias bearrpg_start_item_select start_item_select
  1326.     def start_item_select
  1327.       bearrpg_start_item_select
  1328.       @item_window.z = 999
  1329.     end
  1330.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1331.     ta_x = target[0]
  1332.     ta_y = target[1]
  1333.     if 返回标记
  1334.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1335.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1336.     else
  1337.       if @active_battler.is_a?(Game_Enemy)
  1338.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1339.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1340.       else
  1341.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1342.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1343.       end
  1344.     end
  1345.   end
  1346.   def update_phase4_step3
  1347.     ####普通攻击的场合############################################################
  1348.     if @active_battler.current_action.basic == 0 and
  1349.       @active_battler.current_action.kind == 0
  1350.       #开始执行移动
  1351.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1352.         @active_battler.startactive = "移动"
  1353.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1354.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1355.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1356.         @_move_duration = Move_Duration/2
  1357.        while @_move_duration > 0
  1358.         Graphics.update
  1359.         Input.update
  1360.         @spriteset.update
  1361.         if @target_battlers[0].is_a?(Game_Actor)
  1362.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1363.         else
  1364.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1365.         end
  1366.         move(@active_battler, tag, ox, oy)
  1367.         @_move_duration -= 1
  1368.       end
  1369.     else
  1370.       @_move_duration = Move_Duration
  1371.         while @_move_duration > 0
  1372.         Graphics.update
  1373.         Input.update
  1374.         @spriteset.update
  1375.         if @target_battlers[0].is_a?(Game_Actor)
  1376.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1377.         else
  1378.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1379.         end
  1380.         move(@active_battler, tag, ox, oy)
  1381.         @_move_duration -= 1
  1382.       end
  1383.       end
  1384.     end
  1385.    ####普通攻击的场合############################################################
  1386.     elsif @active_battler.current_action.kind == 1
  1387.     ####使用特技的场合############################################################
  1388.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1389.         @active_battler.startactive = "移动"
  1390.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1391.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1392.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1393.         @_move_duration = Move_Duration/2
  1394.        while @_move_duration > 0
  1395.         Graphics.update
  1396.         Input.update
  1397.         @spriteset.update
  1398.         if @target_battlers[0].is_a?(Game_Actor)
  1399.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1400.         else
  1401.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1402.         end
  1403.         move(@active_battler, tag, ox, oy)
  1404.         @_move_duration -= 1
  1405.       end
  1406.     else
  1407.       @_move_duration = Move_Duration
  1408.         while @_move_duration > 0
  1409.         Graphics.update
  1410.         Input.update
  1411.         @spriteset.update
  1412.         if @target_battlers[0].is_a?(Game_Actor)
  1413.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1414.         else
  1415.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1416.         end
  1417.         move(@active_battler, tag, ox, oy)
  1418.         @_move_duration -= 1
  1419.       end
  1420.       end
  1421.     end
  1422.    #####使用特技的场合##############################################################
  1423. end
  1424. if @active_battler.startactive != "防御"
  1425.     @active_battler.startactive = "待机"
  1426.    end
  1427.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1428.     if @animation1_id == 0
  1429.       @active_battler.white_flash = true
  1430.     else
  1431.       @active_battler.animation_id = @animation1_id
  1432.       @active_battler.animation_hit = true
  1433.     end
  1434.     for target in @target_battlers
  1435.       if target.guarding? and target.damage.is_a?(Numeric)
  1436.         target.startactive = "防御" if target.damage > 0
  1437.         end
  1438.       target.animation_id = @animation2_id
  1439.       target.animation_hit = (target.damage != "Miss")
  1440.     end
  1441.     # 移至步骤 4
  1442.     @phase4_step = 4
  1443.   end
  1444.   ##############################################################################
  1445.   def update_phase4_step4
  1446.    ###########################万兽熊最高########################################
  1447.     # 对像方动画
  1448.      for target in @target_battlers
  1449.        if target.damage != nil
  1450.          target.damage_pop = true
  1451.        end
  1452.      end
  1453.     # 限制动画长度、最低 8 帧
  1454.   #  @wait_count = 8
  1455.   ##############################################################################
  1456.     # 移至步骤 5
  1457.     @phase4_step = 5
  1458.   end
  1459. ####################万兽熊最高############################
  1460.   def update_phase4_step5
  1461.     # 隐藏帮助窗口
  1462.     @help_window.visible = false
  1463.     if @active_battler.current_action.basic == 0 and
  1464.       @active_battler.current_action.kind == 0
  1465.    ####普通攻击的场合############################################################   
  1466.       #执行返回
  1467.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1468.       @active_battler.startactive = "返回"
  1469.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1470.       @_move_duration = Move_Duration/2
  1471.       else
  1472.       @_move_duration = Move_Duration   
  1473.       end
  1474.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1475.       @active_battler.screen_y - @active_battler.movey
  1476.       while @_move_duration > 0
  1477.         Graphics.update
  1478.         Input.update
  1479.         @spriteset.update
  1480.         move(@active_battler, @oldxy, ox, oy, true)
  1481.         @_move_duration -= 1
  1482.       end
  1483.     end
  1484.    ####普通攻击的场合############################################################
  1485.     elsif @active_battler.current_action.kind == 1
  1486.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1487.       @active_battler.startactive = "返回"
  1488.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1489.       @_move_duration = Move_Duration/2
  1490.       else
  1491.       @_move_duration = Move_Duration   
  1492.       end
  1493.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1494.       @active_battler.screen_y - @active_battler.movey
  1495.       while @_move_duration > 0
  1496.         Graphics.update
  1497.         Input.update
  1498.         @spriteset.update
  1499.         move(@active_battler, @oldxy, ox, oy, true)
  1500.         @_move_duration -= 1
  1501.       end
  1502.     end
  1503.    ####使用特技的场合############################################################
  1504. end
  1505. if @active_battler.startactive != "防御"
  1506.     @active_battler.startactive = "待机"
  1507.    end
  1508.     # 刷新状态窗口
  1509.     @status_window.refresh
  1510.     # 显示伤害
  1511.     for target in @target_battlers
  1512.       target.startactive = "待机"
  1513.       if target.damage != nil
  1514.         target.damage_pop = true
  1515.       end
  1516.     end
  1517.     # 移至步骤 6
  1518.     @phase4_step = 6
  1519.   end
  1520.   def update_phase4_step6
  1521.     # 清除强制行动对像的战斗者
  1522.     $game_temp.forcing_battler = nil
  1523.     @active_battler.movex = 0
  1524.     @active_battler.movey = 0
  1525.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1526.     # 公共事件 ID 有效的情况下
  1527.     if @common_event_id > 0
  1528.       # 设置事件
  1529.       common_event = $data_common_events[@common_event_id]
  1530.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1531.     end
  1532.     # 移至步骤 1
  1533.     @phase4_step = 1
  1534.   end
  1535. end
复制代码

点评

建議用 ”代碼“ 功能……  发表于 2016-11-14 23:48
梦石
0
星屑
65
在线时间
141 小时
注册时间
2012-4-29
回帖
32
 楼主| 发表于 2016-11-15 20:22:25 | 显示全部楼层
什麼意思...
回复

使用道具 举报

梦石
0
星屑
34511
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2016-11-19 11:47:31 | 显示全部楼层
把位图加宽点吧
第12行 bitmap = Bitmap.new(350, 150)
改成:bitmap = Bitmap.new(450, 150)  试试
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
65
在线时间
141 小时
注册时间
2012-4-29
回帖
32
 楼主| 发表于 2016-11-19 23:48:04 | 显示全部楼层
芯☆淡茹水 发表于 2016-11-19 11:47
把位图加宽点吧
第12行 bitmap = Bitmap.new(350, 150)
改成:bitmap = Bitmap.new(450, 150)  试试 ...

還是一樣耶...嗚嗚,感謝回復^^
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部