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

Project1

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

[已经过期] 伤害美化和回蓝状态冲突如图

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1237
在线时间
163 小时
注册时间
2019-10-4
帖子
217
跳转到指定楼层
1
发表于 2023-1-7 22:45:31 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. # ğÁ›ė֜ΦʼѢ©ӊЭѭӬذª ver0.90
  2.  
  3. class Scene_Battle
  4.   alias :main_original :main
  5.   def atb_setup
  6.     for path in ["num_n", "num_c", "num_rh"]
  7.       for i in 0..9
  8.         RPG::Cache.numeric(path + i.to_s)
  9.       end
  10.     end
  11.     for path in ["critical", "miss"]
  12.       RPG::Cache.numeric(path)
  13.     end
  14.     main
  15.   end
  16. end
  17.  
  18. module RPG
  19.   class Sprite < ::Sprite
  20.     def damage(value, critical)
  21.       dispose_damage
  22.       if value.is_a?(Numeric)
  23.         damage_string = value.abs.to_s
  24.       else
  25.         damage_string = value.to_s
  26.       end
  27.       if value.is_a?(Numeric)
  28.         damage_string = value.abs.to_s
  29.       else
  30.         damage_string = value.to_s
  31.       end
  32.       bitmap = Bitmap.new(160, 48)
  33.       if value.is_a?(Numeric)
  34.         if value >= 0
  35.           if critical
  36.             bitmap.draw_numlic(0, 12, 160, 36, value, 1, 1)
  37.           else
  38.             bitmap.draw_numlic(0, 12, 160, 36, value, 0, 1)
  39.           end
  40.         else
  41.           bitmap.draw_numlic(0, 12, 160, 36, value, 2, 1)
  42.         end
  43.       else
  44.         bitmap.draw_numlic(0, 12, 160, 36, value, 3, 1)
  45.       end
  46.       @_damage_sprite = ::Sprite.new
  47.       @_damage_sprite.bitmap = bitmap
  48.       @_damage_sprite.ox = 80 + self.viewport.ox
  49.       @_damage_sprite.oy = 20 + self.viewport.oy
  50.       @_damage_sprite.x = self.x + self.viewport.rect.x
  51.       @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  52.       @_damage_sprite.z = 3000
  53.       @_damage_duration = 40
  54.     end
  55.   end
  56. end
  57.  
  58. class Bitmap
  59.   def draw_numlic(x, y, width, height, value, element, align = 0)
  60.     if value.is_a?(Numeric)
  61.       value = value.abs
  62.       if value > 0
  63.         log = Math.log10(value).to_i
  64.       else
  65.         log = 0
  66.       end
  67.       filename = "num_"
  68.       case element
  69.       when 0
  70.         filename += "n"
  71.       when 1
  72.         file = RPG::Cache.numeric("critical")
  73.         blt(x + width / 2 - file.rect.width / 2, y - 12, file, file.rect)
  74.         filename += "c"
  75.       when 2
  76.         filename += "rh"
  77.       end
  78.       if align == 1
  79.         x += width / 2 - 13 - 9 * (log)
  80.       end
  81.       while log >= 0
  82.         case value / (10 ** log)
  83.         when 0
  84.           file = RPG::Cache.numeric(filename + "0")
  85.         when 1
  86.           file = RPG::Cache.numeric(filename + "1")
  87.         when 2
  88.           file = RPG::Cache.numeric(filename + "2")
  89.         when 3
  90.           file = RPG::Cache.numeric(filename + "3")
  91.         when 4
  92.           file = RPG::Cache.numeric(filename + "4")
  93.         when 5
  94.           file = RPG::Cache.numeric(filename + "5")
  95.         when 6
  96.           file = RPG::Cache.numeric(filename + "6")
  97.         when 7
  98.           file = RPG::Cache.numeric(filename + "7")
  99.         when 8
  100.           file = RPG::Cache.numeric(filename + "8")
  101.         when 9
  102.           file = RPG::Cache.numeric(filename + "9")
  103.         end
  104.         blt(x, y, file, file.rect)
  105.         x += 18
  106.         value %= 10 ** log
  107.         log -= 1
  108.       end
  109.     else
  110.       case value
  111.       when ""
  112.         return
  113.       when "Miss"
  114.         file = RPG::Cache.numeric("miss")
  115.       else
  116.         file = RPG::Cache.numeric(value)
  117.       end
  118.       if align == 1
  119.         x += width / 2 - file.rect.width / 2
  120.       end
  121.       blt(x, y, file, file.rect)
  122.     end
  123.   end
  124. end
  125.  
  126. module RPG
  127.   module Cache
  128.     def self.numeric(filename)
  129.       self.load_bitmap("Graphics/String/", filename)
  130.     end
  131.   end


RUBY 代码复制
  1. elsif self.state?(34)
  2.  
  3.       # 设置伤害
  4.  
  5.       #self.damage = -self.maxhp / 30
  6.  
  7.       recover_sp = self.maxsp / 20
  8.  
  9.       # HP 的伤害减法运算
  10.  
  11.       #self.hp -= self.damage
  12.  
  13.       self.sp += recover_sp

Lv4.逐梦者

梦石
2
星屑
13088
在线时间
2273 小时
注册时间
2011-6-4
帖子
613
2
发表于 2023-1-8 16:20:51 | 只看该作者
本帖最后由 真·可乐 于 2023-1-8 16:23 编辑

粗暴的方法:似乎有潜在的问题,已移除回答。

点评

其实是怎么说呢,就是缺少了SP回复的图片显示。但是我不会写,我希望就是能跳过不显示SP也好,只希望持续回复蓝量而不报错  发表于 2023-1-8 16:39
BUG反馈请加QQ 529283039
水友群 917854767

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7946
在线时间
1182 小时
注册时间
2007-7-29
帖子
2055
3
发表于 2023-1-8 17:21:16 | 只看该作者
在21行后加入:
  1. return if value == nil
复制代码
强行不显示nil的伤害。

PS:无测试,仅理论可行。

点评

还是放弃回蓝效果了 出现了另外一个BUG 不使用持续回蓝的 情况下还是不会报错出现nil的。 不过还是表示感谢  发表于 2023-1-13 17:41
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 01:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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