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

Project1

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

[已经解决] 关于持续伤害致死的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2011-10-2
帖子
25
跳转到指定楼层
1
发表于 2014-6-22 17:06:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我又来问问题了
虽然有好多问题我自己能解决
但是还是遇到了无从下手的问题
我用了这个彩虹神剑的脚本
  1. =begin
  2. ==============================================================================
  3. 彩虹神剑(伤害分段显示)显示总伤害版 v1.0d
  4. ==============================================================================
  5. 彩虹神剑 -柳柳
  6. 6-20-2006 v1.0 -叶子
  7. 在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的
  8. v1.0a -叶子
  9. 修正了显示伤害和实际伤害有差别的问题
  10. 修正了miss的情况下显示miss混乱的问题
  11. 修正了对己方技能重复显示伤害的问题
  12. 未修正播放目标动画第一帧时目标有时无端跳动的BUG
  13. v1.0b -叶子
  14. 修改了总伤害数字的位置和z坐标
  15. 未修正播放目标动画第一帧时目标有时无端跳动的BUG
  16. v1.0c -柳柳
  17. ? ? ?
  18. v1.0d -柳柳
  19. 1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法
  20. 7-24-2006 v1.0e -叶子
  21. 修正全屏幕闪烁弹出伤害错误的问题
  22. 修正连续伤害不会弹出伤害的问题
  23. 仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG
  24. 我鼓起很大勇气才敢动偶像们的脚本的,不知道会不会出问题啊...... -cftx
  25. 修正了总伤害显示
  26. 增加了伤害美化和HIT数显示
  27. 修正了两次音效
  28. ==============================================================================
  29. =end
  30. # 核心的说明:
  31. # damage_pop 不再附带damage()的功能,这个放到animation里面去了
  32. module RPG
  33. #--------------------------------------------------------------------------
  34. # ● 常量设定
  35. #--------------------------------------------------------------------------
  36. # 是否显示总伤害
  37. SHOW_TOTAL_DAMAGE = true
  38. # 角色受攻击时是否跳一下
  39. BATTLER_JUMP = false
  40. # 连续伤害的动画ID
  41. SLIP_DAMAGE_ANIMATION_ID = 106
  42. class Sprite < ::Sprite
  43. #==========================================
  44. # 修改说明:
  45. # @flash_shake用来制作挨打时候跳跃
  46. # @_damage 用来记录每次打击之后弹出数字
  47. # @_total_damage 记录总伤害
  48. # @_total_damage_duration 总伤害持续帧
  49. #==========================================
  50. #alias 66RPG_rainbow_initialize : initialize
  51. def initialize(viewport = nil)
  52. #66RPG_rainbow_initialize(viewport)
  53. super(viewport)
  54. @_whiten_duration = 0
  55. @_appear_duration = 0
  56. @_escape_duration = 0
  57. @_collapse_duration = 0
  58. @_damage_duration = 0
  59. @_animation_duration = 0
  60. @_blink = false
  61. # 挨打时候跳跃
  62. @flash_shake = 0
  63. # 伤害记录数组
  64. @_damage = []
  65. # 总伤害数字
  66. @_total_damage = 0
  67. # 总伤害持续帧
  68. @_total_damage_duration = 0
  69. #记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  70. @p_dam=0
  71. @hits=0
  72. end
  73. #美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  74. def damage(value, critical)
  75. # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  76. #dispose_damage
  77. #清除hit数
  78. dispose_hit
  79. # 如果伤害值是数值
  80. if value.is_a?(Numeric)
  81. # 绝对值转为字符串
  82. damage_string = value.abs.to_s
  83. else
  84. # 转为字符串
  85. damage_string = value.to_s
  86. end
  87. # 初始化位图
  88. bitmap = Bitmap.new(162, 64)
  89. bitmap.font.name = ["黑体","华文行楷", "宋体"]
  90. bitmap.font.size = 32
  91. # 伤害值是数值的情况下
  92. if value.is_a?(Numeric)
  93. # 分割伤害值字符串
  94. damage_array = damage_string.scan(/./)
  95. damage_x = 81 - damage_string.size * 9
  96. # 伤害值为负的情况下
  97. if value < 0
  98. # 调用回复数字表
  99. rect_y = 32
  100. else
  101. # 调用伤害数字表
  102. rect_y = 0
  103. end
  104. # 循环伤害值字符串
  105. for char in damage_array
  106. number = char.to_i
  107. # 显示伤害数字
  108. bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
  109. Rect.new(number * 18, rect_y, 18, 32))
  110. # 后移一位
  111. damage_x += 18
  112. end
  113. # 伤害值不是数值的情况
  114. else
  115. # 如果伤害值不是 Miss
  116. unless value == "Miss"
  117. # 系统默认描画字符串
  118. bitmap.font.color.set(0, 0, 0)
  119. bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  120. bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  121. bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  122. bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  123. bitmap.font.color.set(255, 255, 255)
  124. bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  125. # Miss 的情况下
  126. else
  127. # 显示未击中图画
  128. bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
  129. end
  130. end
  131. # 会心一击标志打开的情况
  132. if critical
  133. # 显示会心一击图画
  134. bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
  135. end
  136. # 伤害值定位
  137. @_damage_sprite = ::Sprite.new(self.viewport)
  138. @_damage_sprite.bitmap = bitmap
  139. @_damage_sprite.ox = 81
  140. @_damage_sprite.oy = 20
  141. @_damage_sprite.x = self.x
  142. @_damage_sprite.y = self.y - self.oy / 2
  143. @_damage_sprite.z = 3000
  144. @_damage_duration = 40
  145. @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  146. make_total_damage(value)
  147. end
  148. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  149. # hit数的美化描绘
  150. def hit
  151. # 如果伤害值是数值
  152. # 转为字符串
  153. value=@hits
  154. hits_string = value.to_s
  155. # 初始化位图
  156. bitmap = Bitmap.new(320, 64)
  157. bitmap.font.name = "Arial Black"
  158. bitmap.font.size = 32
  159. # 分割伤害值字符串
  160. hits_array = hits_string.scan(/./)
  161. hits_x = 81 - hits_string.size * 18.1
  162. rect_y = 0
  163. # 循环伤害值字符串
  164. for char in hits_array
  165. number = char.to_i
  166. # 显示伤害数字
  167. bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  168. Rect.new(number * 36.2, rect_y, 36.2, 50))
  169. # 后移一位
  170. hits_x += 36.2
  171. end
  172. bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  173. Rect.new(0, -21, 90, 50))
  174. # 伤害值定位
  175. @_hits_sprite = ::Sprite.new(self.viewport)
  176. @_hits_sprite.bitmap = bitmap
  177. @_hits_sprite.ox = 81
  178. @_hits_sprite.oy = 20
  179. @_hits_sprite.x = 500
  180. @_hits_sprite.y = 100
  181. @_hits_sprite.z = 3000
  182. @_hits_duration = 40
  183. end
  184. #--------------------------------------------------------------------------
  185. # ● 总伤害处理
  186. #--------------------------------------------------------------------------
  187. def make_total_damage(value)
  188. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  189. @_total_damage += value
  190. # 绝对值转为字符串
  191. damage_string = @_total_damage.abs.to_s
  192. else
  193. return
  194. end
  195. # 初始化位图
  196. bitmap = Bitmap.new(300, 150)
  197. bitmap.font.name = "Arial Black"
  198. bitmap.font.size = 32
  199. # 伤害值是数值的情况下
  200. if value.is_a?(Numeric)
  201. # 分割伤害值字符串
  202. damage_array = damage_string.scan(/./)
  203. damage_x = 40 - damage_string.size * 9
  204. # 伤害值为负的情况下
  205. if value < 0
  206. # 调用回复数字表
  207. name="Number3"
  208. else
  209. # 调用伤害数字表
  210. name="Number2"
  211. end
  212. # 循环伤害值字符串
  213. for char in damage_array
  214. number = char.to_i
  215. # 显示伤害数字
  216. bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  217. Rect.new(number * 36.2, 0, 36.2, 50))
  218. # 后移一位
  219. damage_x += 36.2
  220. end
  221. end


  222. # if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  223. # @_total_damage += value
  224. # else
  225. # return
  226. # end
  227. # bitmap = Bitmap.new(300, 150)
  228. # bitmap.font.name = "Arial Black"
  229. # bitmap.font.size = 40
  230. # bitmap.font.color.set(0, 0, 0)
  231. # bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
  232. # if @_total_damage < 0
  233. # bitmap.font.color.set(80, 255, 00)
  234. # else
  235. # bitmap.font.color.set(255, 140, 0)
  236. # end
  237. # bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
  238. # bitmap.font.color.set(55, 55,255)

  239. if @_total_damage_sprite.nil?
  240. @_total_damage_sprite = ::Sprite.new(self.viewport)
  241. @_total_damage_sprite.ox = 80
  242. @_total_damage_sprite.oy = 20
  243. @_total_damage_sprite.z = 3000
  244. end
  245. @_total_damage_sprite.bitmap = bitmap
  246. @_total_damage_sprite.zoom_x = 0.8
  247. @_total_damage_sprite.zoom_y = 0.8
  248. @_total_damage_sprite.x = self.x
  249. @_total_damage_sprite.y = self.y - self.oy / 2 - 64
  250. @_total_damage_sprite.z = 3001
  251. @_total_damage_duration = 80
  252. #hit数描绘
  253. @hits+=1
  254. if @_total_damage > 0
  255. hit
  256. end
  257. end

  258. def animation(animation, hit, battler_damage="", battler_critical=false)
  259. dispose_animation
  260. #=======================================
  261. # 修改:记录伤害和critical
  262. #=======================================
  263. @battler_damage = battler_damage
  264. @battler_critical = battler_critical
  265. @_animation = animation
  266. return if @_animation == nil
  267. @_animation_hit = hit
  268. @_animation_duration = @_animation.frame_max
  269. animation_name = @_animation.animation_name
  270. animation_hue = @_animation.animation_hue
  271. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  272. #=======================================
  273. # 修改:计算总闪光权限值
  274. #=======================================
  275. for timing in @_animation.timings
  276. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  277. @all_quanzhong += quanzhong
  278. # 记录最后一次闪光
  279. @_last_frame = timing.frame if quanzhong != 0
  280. end
  281. if @@_reference_count.include?(bitmap)
  282. @@_reference_count[bitmap] += 1
  283. else
  284. @@_reference_count[bitmap] = 1
  285. end
  286. #=======================================
  287. # 修改:行动方动画不显示伤害
  288. #=======================================
  289. if $scene.is_a?(Scene_Battle)
  290. if $scene.animation1_id == @battler.animation_id
  291. @battler_damage = ""
  292. end
  293. end
  294. @_animation_sprites = []
  295. if @_animation.position != 3 or not @@_animations.include?(animation)
  296. for i in 0..15
  297. sprite = ::Sprite.new(self.viewport)
  298. sprite.bitmap = bitmap
  299. sprite.visible = false
  300. @_animation_sprites.push(sprite)
  301. end
  302. unless @@_animations.include?(animation)
  303. @@_animations.push(animation)
  304. end
  305. end
  306. update_animation
  307. end
  308. #=======================================
  309. # 修改:更换清除伤害的算法,以防万一
  310. # 本内容在脚本中没有使用过
  311. #=======================================
  312. def dispose_damage
  313. for damage in @_damage.reverse
  314. damage[0].bitmap.dispose
  315. damage[0].dispose
  316. @_damage.delete(damage)
  317. end
  318. @_total_damage = 0
  319. @_last_frame = -1
  320. if @_total_damage_sprite != nil
  321. @_total_damage_duration = 0
  322. @_total_damage_sprite.bitmap.dispose
  323. @_total_damage_sprite.dispose
  324. @_total_damage_sprite = nil
  325. end
  326. end
  327. #=======================================
  328. # 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  329. #=======================================
  330. def dispose_hit
  331. if @_hits_sprite != nil
  332. @_hits_sprite.bitmap.dispose
  333. @_hits_sprite.dispose
  334. @_hits_sprite = nil
  335. end
  336. end
  337. def dispose_animation
  338. #=======================================
  339. # 修改:清除记录的伤害,清除权重记录
  340. #=======================================
  341. @battler_damage = nil
  342. @battler_critical = nil
  343. @all_quanzhong = 1
  344. @_total_damage = 0
  345. @_last_frame = -1
  346. if @_animation_sprites != nil
  347. sprite = @_animation_sprites[0]
  348. if sprite != nil
  349. @@_reference_count[sprite.bitmap] -= 1
  350. if @@_reference_count[sprite.bitmap] == 0
  351. sprite.bitmap.dispose
  352. end
  353. end
  354. for sprite in @_animation_sprites
  355. sprite.dispose
  356. end
  357. @_animation_sprites = nil
  358. @_animation = nil
  359. end
  360. end
  361. def update
  362. super
  363. if @_whiten_duration > 0
  364. @_whiten_duration -= 1
  365. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  366. end
  367. if @_appear_duration > 0
  368. @_appear_duration -= 1
  369. self.opacity = (16 - @_appear_duration) * 16
  370. end
  371. if @_escape_duration > 0
  372. @_escape_duration -= 1
  373. self.opacity = 256 - (32 - @_escape_duration) * 10
  374. end
  375. if @_collapse_duration > 0
  376. @_collapse_duration -= 1
  377. self.opacity = 256 - (48 - @_collapse_duration) * 6
  378. end
  379. #=======================================
  380. # 修改:更新算法,更新弹出
  381. #=======================================
  382. if @_damage_duration > 0
  383. @_damage_duration -= 1
  384. for damage in @_damage
  385. damage[0].x = self.x + self.viewport.rect.x -
  386. self.ox + self.src_rect.width / 2 +
  387. (40 - damage[1]) * damage[3] / 10
  388. damage[0].y -= damage[4]+damage[1]/10
  389. damage[0].opacity = damage[1]*20
  390. damage[1] -= 1
  391. if damage[1]==0
  392. damage[0].bitmap.dispose
  393. damage[0].dispose
  394. @_damage.delete(damage)
  395. next
  396. end
  397. end
  398. end
  399. #=======================================
  400. # 添加:弹出总伤害
  401. #=======================================
  402. if @_total_damage_duration > 0
  403. @_total_damage_duration -= 1
  404. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  405. if @_total_damage_sprite.zoom_x > 1.0
  406. @_total_damage_sprite.zoom_x -= 0.05
  407. end
  408. if @_total_damage_sprite.zoom_y > 1.0
  409. @_total_damage_sprite.zoom_y -= 0.05
  410. end
  411. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  412. if @_total_damage_duration <= 0
  413. dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  414. @_total_damage = 0
  415. @_total_damage_duration = 0
  416. @_total_damage_sprite.bitmap.dispose
  417. @_total_damage_sprite.dispose
  418. @_total_damage_sprite = nil
  419. end
  420. end
  421. #=======================================
  422. if @_animation != nil and (Graphics.frame_count % 2 == 0)
  423. @_animation_duration -= 1
  424. update_animation
  425. end
  426. if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  427. update_loop_animation
  428. @_loop_animation_index += 1
  429. @_loop_animation_index %= @_loop_animation.frame_max
  430. end
  431. if @_blink
  432. @_blink_count = (@_blink_count + 1) % 32
  433. if @_blink_count < 16
  434. alpha = (16 - @_blink_count) * 6
  435. else
  436. alpha = (@_blink_count - 16) * 6
  437. end
  438. self.color.set(255, 255, 255, alpha)
  439. end
  440. @@_animations.clear
  441. end
  442. def update_animation
  443. if @_animation_duration > 0
  444. frame_index = @_animation.frame_max - @_animation_duration
  445. cell_data = @_animation.frames[frame_index].cell_data
  446. position = @_animation.position
  447. animation_set_sprites(@_animation_sprites, cell_data, position)
  448. #=======================================
  449. # 修改:弹出伤害,权重计算
  450. #=======================================
  451. for timing in @_animation.timings
  452. if timing.frame == frame_index
  453. t = 1.0 * animation_process_timing(timing, @_animation_hit)
  454. if timing.se.name != ""
  455. se=timing.se
  456. Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  457. end
  458. #p t,"当前权重", @all_quanzhong,"总权重"
  459. if @battler_damage.is_a?(Numeric) and t != 0
  460. t *= @battler_damage
  461. t /= @all_quanzhong
  462. t = t.to_i
  463. #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  464. if frame_index != @_last_frame
  465. @p_dam+= t
  466. end
  467. #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  468. #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  469. if frame_index == @_last_frame
  470. t=@battler_damage-@p_dam
  471. end
  472. #p t,"当前伤害",@battler_damage,"总伤害"
  473. # 最后一次闪光的话,伤害修正
  474. if frame_index == @_last_frame
  475. @_total_damage = @battler_damage - t
  476. @p_dam=0 #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  477. end
  478. #p t,@battler_damage,@all_quanzhong
  479. damage(t,@battler_critical)
  480. #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  481. if frame_index == @_last_frame
  482. @hits=0
  483. end
  484. # 防止重复播放miss
  485. elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  486. damage(@battler_damage,@battler_critical)
  487. end
  488. end
  489. end
  490. else
  491. dispose_animation
  492. end
  493. end
  494. #=======================================
  495. # 修改:敌人跳跃的功能 + 添加返回数值
  496. #=======================================
  497. def animation_process_timing(timing, hit,dontflash=false)
  498. if (timing.condition == 0) or
  499. (timing.condition == 1 and hit == true) or
  500. (timing.condition == 2 and hit == false)
  501. case timing.flash_scope
  502. when 1
  503. unless dontflash
  504. self.flash(timing.flash_color, timing.flash_duration * 2)
  505. if @_total_damage >0
  506. @flash_shake_switch = true
  507. @flash_shake = 10
  508. end
  509. end
  510. return timing.flash_color.alpha * timing.flash_duration
  511. when 2
  512. unless dontflash
  513. if self.viewport != nil
  514. self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  515. end
  516. end
  517. return timing.flash_color.alpha * timing.flash_duration
  518. when 3
  519. unless dontflash
  520. self.flash(nil, timing.flash_duration * 2)
  521. end
  522. return timing.flash_color.alpha * timing.flash_duration
  523. end
  524. end
  525. return 0
  526. end
  527. end
  528. end
  529. #==============================================================================
  530. # ■ Sprite_Battler
  531. #==============================================================================
  532. class Sprite_Battler < RPG::Sprite
  533. #--------------------------------------------------------------------------
  534. # ● 初始化对像
  535. # 添加跳跃记录
  536. #--------------------------------------------------------------------------
  537. def initialize(viewport, battler = nil)
  538. super(viewport)
  539. @battler = battler
  540. @battler_visible = false
  541. @flash_shake_switch = true
  542. end
  543. #--------------------------------------------------------------------------
  544. # ● 刷新画面
  545. # 增添跳跃功能
  546. #--------------------------------------------------------------------------
  547. def update
  548. super
  549. # 战斗者为 nil 的情况下
  550. if @battler == nil
  551. self.bitmap = nil
  552. loop_animation(nil)
  553. return
  554. end
  555. # 文件名和色相与当前情况有差异的情况下
  556. if @battler.battler_name != @battler_name or
  557. @battler.battler_hue != @battler_hue
  558. # 获取、设置位图
  559. @battler_name = @battler.battler_name
  560. @battler_hue = @battler.battler_hue
  561. self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  562. @width = bitmap.width
  563. @height = bitmap.height
  564. self.ox = @width / 2
  565. self.oy = @height
  566. # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  567. if @battler.dead? or @battler.hidden
  568. self.opacity = 0
  569. end
  570. end
  571. # 动画 ID 与当前的情况有差异的情况下
  572. if @battler.damage == nil and
  573. @battler.state_animation_id != @state_animation_id
  574. @state_animation_id = @battler.state_animation_id
  575. loop_animation($data_animations[@state_animation_id])
  576. end
  577. # 应该被显示的角色的情况下
  578. if @battler.is_a?(Game_Actor) and @battler_visible
  579. # 不是主状态的时候稍稍降低点透明度
  580. if $game_temp.battle_main_phase
  581. self.opacity += 3 if self.opacity < 255
  582. else
  583. self.opacity -= 3 if self.opacity > 207
  584. end
  585. end
  586. # 明灭
  587. if @battler.blink
  588. blink_on
  589. else
  590. blink_off
  591. end
  592. # 不可见的情况下
  593. unless @battler_visible
  594. # 出现
  595. if not @battler.hidden and not @battler.dead? and
  596. (@battler.damage == nil or @battler.damage_pop)
  597. appear
  598. @battler_visible = true
  599. end
  600. end
  601. # 可见的情况下
  602. if @battler_visible
  603. # 逃跑
  604. if @battler.hidden
  605. $game_system.se_play($data_system.escape_se)
  606. escape
  607. @battler_visible = false
  608. end
  609. # 白色闪烁
  610. if @battler.white_flash
  611. whiten
  612. @battler.white_flash = false
  613. end
  614. # 动画
  615. if @battler.animation_id != 0
  616. animation = $data_animations[@battler.animation_id]
  617. animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  618. @battler.animation_id = 0
  619. end
  620. # 伤害
  621. if @battler.damage_pop
  622. @battler.damage = nil
  623. @battler.critical = false
  624. @battler.damage_pop = false
  625. end
  626. # korapusu
  627. if @battler.damage == nil and @battler.dead?
  628. if @battler.is_a?(Game_Enemy)
  629. $game_system.se_play($data_system.enemy_collapse_se)
  630. else
  631. $game_system.se_play($data_system.actor_collapse_se)
  632. end
  633. collapse
  634. @battler_visible = false
  635. end
  636. end
  637. # 设置活动块的坐标
  638. if @flash_shake_switch == true
  639. self.x = @battler.screen_x
  640. self.y = @battler.screen_y
  641. self.z = @battler.screen_z
  642. @flash_shake_switch = false
  643. end
  644. if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  645. case @flash_shake
  646. when 9..10
  647. self.x = @battler.screen_x
  648. self.y -=4
  649. self.z = @battler.screen_z
  650. when 6..8
  651. self.x = @battler.screen_x
  652. self.y -=2
  653. self.z = @battler.screen_z
  654. when 3..5
  655. self.x = @battler.screen_x
  656. self.y +=2
  657. self.z = @battler.screen_z
  658. when 2
  659. self.x = @battler.screen_x
  660. self.y += 4
  661. self.z = @battler.screen_z
  662. when 1
  663. self.x = @battler.screen_x
  664. self.y = @battler.screen_y
  665. self.z = @battler.screen_z
  666. end
  667. @flash_shake -= 1
  668. end
  669. end
  670. end
  671. #==============================================================================
  672. # ■ Scene_Battle
  673. #------------------------------------------------------------------------------
  674. #  处理战斗画面的类。
  675. #==============================================================================
  676. class Scene_Battle
  677. #--------------------------------------------------------------------------
  678. # ● 定义实例变量
  679. #--------------------------------------------------------------------------
  680. attr_reader :animation1_id # 行动方动画ID
  681. end
  682. #==============================================================================
  683. # ■ Game_Battler
  684. #------------------------------------------------------------------------------
  685. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  686. # 超级类来使用。
  687. #==============================================================================
  688. class Game_Battler
  689. #--------------------------------------------------------------------------
  690. # ● 应用连续伤害效果
  691. #--------------------------------------------------------------------------
  692. alias rainbow_sword_slip_damage_effect slip_damage_effect
  693. def slip_damage_effect
  694. self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
  695. self.animation_hit = true
  696. rainbow_sword_slip_damage_effect
  697. end
  698. end
复制代码
这里的持续伤害使敌人HP降到0之后
敌人的战斗图不会消失
也无法再选择这个敌人为攻击对象
我想让这个被持续伤害致死的敌人消失该怎么做?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2011-10-2
帖子
25
2
 楼主| 发表于 2014-6-23 00:15:09 | 只看该作者
  1. class Game_Battler
  2.    # 声明一个实例变量判断是否需要显示固定伤害
  3.    attr_accessor :battle_solid_damage
  4. end

  5. class Scene_Battle
  6.    def update_phase4_step1
  7.      # 隐藏帮助窗口
  8.      @help_window.visible = false
  9.      # 判定胜败
  10.      if judge
  11.        # 胜利或者失败的情况下 : 过程结束
  12.        return
  13.      end
  14.      # 强制行动的战斗者不存在的情况下
  15.      if $game_temp.forcing_battler == nil
  16.        # 设置战斗事件
  17.        setup_battle_event
  18.        # 执行战斗事件中的情况下
  19.        if $game_system.battle_interpreter.running?
  20.          return
  21.        end
  22.      end
  23.      # 强制行动的战斗者存在的情况下
  24.      if $game_temp.forcing_battler != nil
  25.        # 在头部添加后移动
  26.        @action_battlers.delete($game_temp.forcing_battler)
  27.        @action_battlers.unshift($game_temp.forcing_battler)
  28.      end
  29.      # 未行动的战斗者不存在的情况下 (全员已经行动)
  30.      if @action_battlers.size == 0
  31.        # 开始同伴命令回合
  32.        start_phase2
  33.        return
  34.      end
  35.      # 初始化动画 ID 和公共事件 ID
  36.      @animation1_id = 0
  37.      @animation2_id = 0
  38.      @common_event_id = 0
  39.      # 未行动的战斗者移动到序列的头部
  40.      @active_battler = @action_battlers.shift
  41.      # 如果已经在战斗之外的情况下
  42.      if @active_battler.index == nil
  43.        return
  44.      end
  45.      # 连续伤害
  46.      if @active_battler.hp > 0 and @active_battler.slip_damage?
  47.        @active_battler.slip_damage_effect
  48.        @active_battler.damage_pop = true
  49.        @active_battler.battle_solid_damage = true
  50.      end
  51.      # 自然解除状态
  52.      @active_battler.remove_states_auto
  53.      # 刷新状态窗口
  54.      @status_window.refresh
  55.      # 移至步骤 2
  56.      @phase4_step = 2
  57.    end
  58. end

  59. class Sprite_Battler < RPG::Sprite
  60.    def update
  61.      super
  62.      # 战斗者为 nil 的情况下
  63.      if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  64.        self.bitmap = nil
  65.        loop_animation(nil)
  66.        return
  67.      end
  68.      # 文件名和色相与当前情况有差异的情况下
  69.      if @battler.battler_name != @battler_name or
  70.         @battler.battler_hue != @battler_hue
  71.        # 获取、设置位图
  72.        @battler_name = @battler.battler_name
  73.        @battler_hue = @battler.battler_hue
  74.        self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  75.        @width = bitmap.width
  76.        [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  77.        self.ox = @width / 2
  78.        self.oy = @height
  79.        # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  80.        if @battler.dead? or @battler.hidden
  81.          self.opacity = 0
  82.        end
  83.      end
  84.      # 动画 ID 与当前的情况有差异的情况下
  85.      if @battler.damage == nil and
  86.         @battler.state_animation_id != @state_animation_id
  87.        @state_animation_id = @battler.state_animation_id
  88.        loop_animation($data_animations[@state_animation_id])
  89.      end
  90.      # 应该被显示的角色的情况下
  91.      if @battler.is_a?(Game_Actor) and @battler_visible
  92.        # 不是主状态的时候稍稍降低点透明度
  93.        if $game_temp.battle_main_phase
  94.          self.opacity += 3 if self.opacity < 255
  95.        else
  96.          self.opacity -= 3 if self.opacity > 207
  97.        end
  98.      end
  99.      # 明灭
  100.      if @battler.blink
  101.        blink_on
  102.      else
  103.        blink_off
  104.      end
  105.      # 不可见的情况下
  106.      unless @battler_visible
  107.        # 出现
  108.        if not @battler.hidden and not @battler.dead? and
  109.           (@battler.damage == nil or @battler.damage_pop)
  110.          appear
  111.          @battler_visible = true
  112.        end
  113.      end
  114.      # 可见的情况下
  115.      if @battler_visible
  116.        # 逃跑
  117.        if @battler.hidden
  118.          $game_system.se_play($data_system.escape_se)
  119.          escape
  120.          @battler_visible = false
  121.        end
  122.        # 白色闪烁
  123.        if @battler.white_flash
  124.          whiten
  125.          @battler.white_flash = false
  126.        end
  127.        # 动画
  128.        if @battler.animation_id != 0
  129.          animation = $data_animations[@battler.animation_id]
  130.          animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  131.          @battler.animation_id = 0
  132.        end
  133.        # 伤害
  134.        if @battler.damage_pop
  135.          # 显示固定伤害
  136.          if @battler.battle_solid_damage
  137.            damage(@battler.damage, @battler.critical)
  138.            @battler.battle_solid_damage = false
  139.          end
  140.          @battler.damage = nil
  141.          @battler.critical = false
  142.          @battler.damage_pop = false
  143.        end
  144.        # korapusu
  145.        if @battler.damage == nil and @battler.dead?
  146.          if @battler.is_a?(Game_Enemy)
  147.            $game_system.se_play($data_system.enemy_collapse_se)
  148.          else
  149.            $game_system.se_play($data_system.actor_collapse_se)
  150.          end
  151.          collapse
  152.          @battler_visible = false
  153.        end
  154.      end
  155.      # 设置活动块的坐标
  156.      if @flash_shake_switch == true
  157.        self.x = @battler.screen_x
  158.        self.y = @battler.screen_y
  159.        self.z = @battler.screen_z
  160.        @flash_shake_switch = false
  161.      end
  162.      if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  163.        case @flash_shake
  164.        when 9..10
  165.          self.x +=3
  166.          self.y = @battler.screen_y
  167.          self.z = @battler.screen_z
  168.        when 6..8
  169.          self.x -=3
  170.          self.y = @battler.screen_y
  171.          self.z = @battler.screen_z
  172.        when 3..5
  173.          self.x +=3
  174.          self.y = @battler.screen_y
  175.          self.z = @battler.screen_z
  176.        when 2
  177.          self.x -=3
  178.          self.y = @battler.screen_y
  179.          self.z = @battler.screen_z
  180.        when 1
  181.          self.x +=3
  182.          self.y = @battler.screen_y
  183.          self.z = @battler.screen_z
  184.        end
  185.        @flash_shake -= 1
  186.      end
  187.    end
  188. end

  189. class Interpreter
  190.    def command_338
  191.      # 获取操作值
  192.      value = operate_value(0, @parameters[2], @parameters[3])
  193.      # 处理循环
  194.      iterate_battler(@parameters[0], @parameters[1]) do |battler|
  195.        # 战斗者存在的情况下
  196.        if battler.exist?
  197.          # 更改 HP
  198.          battler.hp -= value
  199.          # 如果在战斗中
  200.          if $game_temp.in_battle
  201.            # 设置伤害
  202.            battler.damage = value
  203.            battler.damage_pop = true
  204.            battler.battle_solid_damage = true
  205.          end
  206.        end
  207.      end
  208.      # 继续
  209.      return true
  210.    end
  211. end
复制代码
已解决  上面这段加在彩虹神剑后面替换
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 23:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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