赞 | 7 |
VIP | 20 |
好人卡 | 0 |
积分 | 16 |
经验 | 11472 |
最后登录 | 2024-7-10 |
在线时间 | 526 小时 |
Lv3.寻梦者 宛若
- 梦石
- 0
- 星屑
- 1568
- 在线时间
- 526 小时
- 注册时间
- 2007-8-19
- 帖子
- 1493
|
- module RPG
- class Sprite < ::Sprite
- alias i initialize
- def initialize(*arg)
- i(*arg)
- @_damage = []
- @coll_time = 0
- end
- WIDTH = 18 # 文字幅
- HEIGHT = 20 # クリティカルの文字・高さ
- def dispose_damage
- for damage in @_damage.reverse
- damage[0].bitmap.dispose
- damage[0].dispose
- @_damage.delete(damage)
- end
- end
- def collapse
- @coll.dispose if @coll != nil
- @coll = Sprite.new
- @coll.bitmap = Bitmap.new("Graphics/Battlers/#{@battler_name}")
- @coll.ox = self.ox
- @coll.oy = self.oy
- @coll.opacity = 100
- @coll.z = 0
- @coll.blend_type = 1
- @coll.x = self.x
- @coll.y = self.y
- @coll_time = 42
- @_whiten_duration = 0
- @_appear_duration = 0
- @_escape_duration = 0
- end
- alias u update
- def update
- u
-
- #if @_whiten_duration > 0
- # @_whiten_duration -= 1
- # self.color.alpha = 128 - (16 - @_whiten_duration) * 10
- #end
- #if @_appear_duration > 0
- # @_appear_duration -= 1
- # self.opacity = (16 - @_appear_duration) * 16
- #end
- #if @_escape_duration > 0
- # @_escape_duration -= 1
- # self.opacity = 256 - (32 - @_escape_duration) * 10
- #end
- #if @_collapse_duration > 0
- # @_collapse_duration -= 1
- # self.opacity = 256 - (48 - @_collapse_duration) * 6
- #end
- for damage in @_damage
- if damage[1] > 0
- damage[1] -= 1
- damage[4] -= 3
- damage[2] -= damage[4]
- if self.battler.is_a?(Game_Actor)
- damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
- damage[0].y = self.y - self.oy / 2 + damage[2] / 10
- else
- damage[0].x = self.x + self.viewport.rect.x -
- self.ox + self.src_rect.width / 2 +
- (40 - damage[1]) * damage[3] / 10
- damage[0].y = self.y - self.oy * self.zoom_y / 2 +
- self.viewport.rect.y + damage[2] / 10
- damage[0].zoom_x = self.zoom_x
- damage[0].zoom_y = self.zoom_y
- end
- damage[0].z = 2960 + damage[1]
- damage[0].opacity = 256 - (12 - damage[1]) * 32
- if damage[1] == 0
- damage[0].bitmap.dispose
- damage[0].dispose
- @_damage.delete(damage)
- end
- end
- end
- if @_whiten_duration > 0
- @_whiten_duration -= 1
- self.color.alpha = 128 - (16 - @_whiten_duration) * 10
- end
- if @_appear_duration > 0
- @_appear_duration -= 1
- self.opacity = (16 - @_appear_duration) * 16
- end
- if @_escape_duration > 0
- @_escape_duration -= 1
- self.opacity = 256 - (32 - @_escape_duration) * 10
- end
- if @coll_time > 0
- @coll_time -= 1
- @coll.y = self.y - (48 - @coll_time) * 6
- self.opacity = 256 - (48 - @coll_time) * 6
- if @coll_time == 0
- @coll.dispose
- end
- end
- #for anime in @_animation
- # if (Graphics.frame_count % 2 == 0)
- # anime[2] -= 1
- # update_animation(anime)
- # end
- #end
- #if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
- # update_loop_animation
- # @_loop_animation_index += 1
- # @_loop_animation_index %= @_loop_animation.frame_max
- #end
- #if @_blink
- ## if @_blink_count < 16
- # alpha = (16 - @_blink_count) * 6
- # else
- # alpha = (@_blink_count - 16) * 6
- # end
- # self.color.set(255, 255, 255, alpha)
- #end
- #@@_animations.clear
- end
- def effect?
- @_whiten_duration > 0 or
- @_appear_duration > 0 or
- @_escape_duration > 0 or
- @_collapse_duration > 0 or
- @_damage_duration > 0 or
- @_animation_duration > 0 or
- @coll_time > 0
- end
- def damage(value, critical, type = 0)
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
- if value.is_a?(Numeric) and value >= 0
- if type == 0
- if critical
- d_bitmap = draw_damage(value, 1)
- else
- d_bitmap = draw_damage(value, 0)
- end
- else
- d_bitmap = draw_damage(value, 2)
- end
- else
- if type == 0
- d_bitmap = draw_damage(value, 3)
- else
- d_bitmap = draw_damage(value, 4)
- end
- end
- if type == 2
- d_bitmap = draw_damage(value, 5)
- end
- num = @_damage.size
- if type != 2
- @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
- else
- @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
- end
- @_damage[num][0].bitmap = d_bitmap
- @_damage[num][0].ox = d_bitmap.width / 2
- @_damage[num][0].oy = d_bitmap.height / 2
- if self.battler.is_a?(Game_Actor)
- @_damage[num][0].x = self.x + self.viewport.ox
- @_damage[num][0].y = self.y - self.oy / 2
- else
- @_damage[num][0].x = self.x + self.viewport.rect.x -
- self.ox + self.src_rect.width / 2
- @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
- self.viewport.rect.y
- @_damage[num][0].zoom_x = self.zoom_x
- @_damage[num][0].zoom_y = self.zoom_y
- @_damage[num][0].z = 3000
- end
- end
- def draw_damage(value, element)
- width = 0
- if value.is_a?(Numeric)
- value = value.abs
- fig = value.to_s.size - 1
- file = RPG::Cache.numeric("num")
- d_width = WIDTH * fig + file.rect.width / 10
- if element == 1
- critical = RPG::Cache.numeric("critical")
- d_width = [d_width, critical.rect.width].max
- d_bitmap = Bitmap.new(d_width+36, HEIGHT + file.rect.height / 5)
- d_x = 0#(width - critical.rect.width / 10) / 2
- d_bitmap.blt(d_x+fig*(fig/1.6), 0, critical, critical.rect)
- Audio.se_play("Audio/SE/"+"Clip10",100,100)
- # $game_screen.start_flash(Color.new(255,255,255),2)
- $game_screen.start_shake(3,9,2)
- else
- d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 5)
- end
- d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2
- while fig >= 0
- d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
- file.rect.width / 10, element * file.rect.height / 5,
- file.rect.width / 10, file.rect.height / 5))
- d_x += WIDTH
- value %= 10 ** fig
- fig -= 1
- end
- else
- case value
- when "Miss"
- file = RPG::Cache.numeric("miss")
- when "Level up!"
- file = RPG::Cache.numeric("levelup")
- when "New Skill!"
- file = RPG::Cache.numeric("newskill")
- when "Learning!"
- file = RPG::Cache.numeric("learning")
- else
- return Bitmap.new(1, 1)
- end
- d_bitmap = file
- end
- return d_bitmap
- end
- end
- module Cache
- def self.numeric(filename)
- self.load_bitmap("Graphics/String/", filename)
- end
- end
- end
复制代码 用此脚本覆盖Damage重定义
然后删除死亡特效脚本 |
评分
-
查看全部评分
|