赞 | 3 |
VIP | 37 |
好人卡 | 8 |
积分 | 0 |
经验 | 22564 |
最后登录 | 2017-5-16 |
在线时间 | 491 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 491 小时
- 注册时间
- 2012-1-27
- 帖子
- 421
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
地图上显示数字|文字,可用于arpg伤害显示
- #地图上显示文字,使用方法,在事件中使用脚本damage_popup(STRING)
- #例如damage_popup("988")
- # damage_popup("66rpg")
- #原作者moghunter修改by狱冥幻翼 解决和sideview的冲突
- #==============================================================================
- # +++ MOG - DAMAGEPOPUP (v2.0) +++
- #==============================================================================
- # By Moghunter
- # http://www.atelier-rgss.com/
- #==============================================================================
- # Apresenta danos dos alvos em imagens.
- #==============================================================================
- # Será necessário ter a imagem Damage_Number.png na pasta /GRAPHICS/SYSTEM/
- #==============================================================================
- #==============================================================================
- # DAMAGE POPUP ON CHARACTERS (Events)
- #==============================================================================
- # Basta usar o código abaixo para apresentar o dano nos eventos.
- #
- # damage_popup(STRING)
- #
- # STRING = valor do dano (Texto).
- #
- #
- # Para ativar o dano no jogador use o código abaixo
- #
- # $game_player.damage_popup(STRING)
- #
- #==============================================================================
- #==============================================================================
- # ● Histórico (Version History)
- #==============================================================================
- # v 2.0 - Apresentar o texto de recuperar nos efeitos de regenerar.
- # v 1.9 - Corrigido o erro de apresentar as condições sendo removidas quando a
- # batalha termina.
- # - Corrigido a centralização da string em danos do tipo texto.
- # - Corrigido o "erro" de apresentar a condição de Death.
- # v 1.8 - Corrigido o erro de apresentar os textos das condições (Status) quando
- # o battler estiver morto.
- # v 1.7 - Melhor codificação e compatibilidade.
- # v 1.6 - Corrigido o erro da opacidade do dano em EXP e GOLD.
- # v 1.5 - Possibilidade de ativar o dano nos eventos no mapa.
- # v 1.4 - Corrigido o erro do efeito drain.
- # v 1.3 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
- # v 1.2 - Corrigido o limite do tamanho da string em palavras longas.
- # v 1.1 - Opção de definir a prioridade do dano.
- # v 1.0 - Primeiro lançamento.
- #==============================================================================
- module MOG_DAMAGEPOP
- #Definição do espaço entre a palavra MP/TP e o numero de dano.
- MP_TP_STRING_SPACE = 32
- #Correção da posição do dano.
- DAMAGE_POSITION_CORRECTION = [0 ,0]
- #Apresentar a exp e ouro do inimigo.
- EXP_POPUP = true
- #Definição da prioridade do dano na tela.
- DAMAGE_Z = 60
- end
- #==============================================================================
- # ■ BattleManager
- #==============================================================================
- module BattleManager
- #--------------------------------------------------------------------------
- # ● Escape?
- #--------------------------------------------------------------------------
- def self.escape?
- @phase == nil
- end
-
- end
- #==============================================================================
- # ■ Damage Sprite
- #==============================================================================
- class Damage_Sprite < Sprite
- include MOG_DAMAGEPOP
- attr_accessor :duration
-
- #--------------------------------------------------------------------------
- # ● Initialize
- #--------------------------------------------------------------------------
- def initialize(viewport = nil,x = 0,y = 0,value = 0,index)
- super(viewport)
- dispose
- @image = Cache.system("Damage_Number")
- @x = x
- @y = y
- @value = value[0]
- @type = value[1]
- @critical = (value[2] and @value.to_i >= 0) ? true : false
- @state_index = value[3]
- @duration = 80 + (10 * index)
- @cw = @image.width / 10
- @ch = @image.height / 7
- @center_x = 0
- @mp_space = (@type == "MP" or @type == "TP") ? MP_TP_STRING_SPACE : 0
- if @value.is_a?(Numeric)
- create_damage_number
- elsif @value == "Missed" or @value == "Evaded"
- create_damage_miss
- else
- create_damage_string
- end
- self.x = @x - (@center_x * (@cw / 2)) + DAMAGE_POSITION_CORRECTION[0]
- self.y = @y + DAMAGE_POSITION_CORRECTION[1]
- self.opacity = 1
- zx = self.viewport != nil ? self.viewport.z : 0
- self.z = DAMAGE_Z + zx
- self.visible = false
- damage_dir = rand(2)
- @speed_x = straight_pop? ? 0 : damage_dir == 1 ? -rand(2) : rand(2)
- @speed_y = 0
- end
-
- #--------------------------------------------------------------------------
- # ● Straight Pop
- #--------------------------------------------------------------------------
- def straight_pop?
- case @type
- when "Gold"; return true
- when "Exp"; return true
- when "Level_UP"; return true
- end
- return false
- end
-
- #--------------------------------------------------------------------------
- # ● Create Damage Number
- #--------------------------------------------------------------------------
- def create_damage_miss
- dam = @value == "Missed" ? 5 : 6
- self.bitmap = Bitmap.new(@cw * 5, @ch)
- src_rect = Rect.new(0, dam * @ch, @cw * 10, @ch)
- self.bitmap.blt(0, 0, @image, src_rect)
- @center_x += 5
- end
-
- #--------------------------------------------------------------------------
- # ● Create Damage Number
- #--------------------------------------------------------------------------
- def create_damage_number
- dam = @critical ? @ch * 2 : @value >= 0 ? 0 : @ch
- f = @value >= 0 ? 0 : 1
- number_value = @value.to_s.split(//)
- self.bitmap = Bitmap.new(@mp_space + (@cw * number_value.size),@ch * 4)
- for r in f...number_value.size
- number_value_abs = number_value[r].to_i
- src_rect = Rect.new(@cw * number_value_abs, dam, @cw, @ch)
- self.bitmap.blt(@mp_space + (@cw * r), 0, @image, src_rect)
- @center_x += 1
- end
- if @type == "MP" or @type == "TP"
- ty = @type == "MP" ? 3 : 4
- src_rect = Rect.new(0, @ch * ty, @cw * 10, @ch)
- self.bitmap.blt(0, 0, @image, src_rect)
- @center_x += 2
- end
- @center_x += 1 if @value < 0
- end
-
- #--------------------------------------------------------------------------
- # ● Create Damage String
- #--------------------------------------------------------------------------
- def create_damage_string
- string_size = @value.to_s.split(//)
- @stg_size = string_size.size > 0 ? ((1 + string_size.size) * 24) : 32
- self.bitmap = Bitmap.new(@stg_size,32)
- self.bitmap.font.size = 28
- self.bitmap.font.bold = true
- @center_x = 2 + (string_size.size / 2)
- if @state_index != nil
- draw_states
- else
- execute_font_color
- damage_string = @value.to_s
- self.bitmap.draw_text(0, 0, @stg_size, 32, damage_string,0)
- end
- end
-
- #--------------------------------------------------------------------------
- # ● Execute Font Color
- #--------------------------------------------------------------------------
- def execute_font_color
- case @type
- when "Gold"
- @duration = 160
- self.bitmap.font.color = Color.new(255,255,100)
- when "Exp"
- @duration = 120
- self.bitmap.font.color = Color.new(0,255,100)
- when "Level_UP"
- self.bitmap.font.color = Color.new(50,155,255)
- else
- self.bitmap.font.color = Color.new(255,255,255)
- end
- end
-
- #--------------------------------------------------------------------------
- # ● Draw States
- #--------------------------------------------------------------------------
- def draw_states
- icon_image = Cache.system("Iconset")
- if @type == "States Plus"
- self.bitmap.font.color = Color.new(200,150,50)
- damage_string = "+ " + @value.to_s
- elsif @type == "States Minus"
- self.bitmap.font.color = Color.new(100,100,100)
- damage_string = "- " + @value.to_s
- end
- rect = Rect.new(@state_index % 16 * 24, @state_index / 16 * 24, 24, 24)
- self.bitmap.blt(0, 0, icon_image, rect)
- self.bitmap.draw_text(26, 0, @stg_size - 24, 32, damage_string,0)
- @center_x += 5
- icon_image.dispose
- icon_image = nil
- end
-
- #--------------------------------------------------------------------------
- # ● Dispose
- #--------------------------------------------------------------------------
- def dispose
- return if @image == nil
- @image.dispose
- @image = nil
- self.bitmap.dispose
- self.bitmap = nil
- @duration = -1
- end
-
- #--------------------------------------------------------------------------
- # ● Update
- #--------------------------------------------------------------------------
- def update
- return if self.bitmap == nil
- @duration -= 1 if @duration > 0
- self.visible = @duration > 80 ? false : true
- case @duration
- when 65..80
- self.opacity += 5
- self.x += @speed_x
- self.y -= 5
- critical_effect(0.05)
- when 50..65
- self.opacity = 255
- self.y -= 3
- self.x += @speed_x
- critical_effect(0.05)
- when 35..50
- self.opacity = 255
- self.y += 3
- critical_effect(-0.05)
- when 0..35
- self.opacity -= 7
- self.y -= 1
- critical_effect(-0.05)
- end
- dispose if self.opacity <= 0
- end
-
- #--------------------------------------------------------------------------
- # ● Critical Effect
- #--------------------------------------------------------------------------
- def critical_effect(value)
- return if !@critical
- self.zoom_x += value
- self.zoom_y = self.zoom_x
- end
-
- end
- #==============================================================================
- # ■ Game Interpreter
- #==============================================================================
- class Game_Interpreter
-
- #--------------------------------------------------------------------------
- # ● damage Popup
- #--------------------------------------------------------------------------
- def damage_popup(value,type = nil, critical = false)
- type = (type == nil and value.is_a?(Numeric)) ? "HP" : type
- $game_map.events[@event_id].damage.push([value,type,critical]) if same_map? && @event_id > 0
- end
-
- end
- #==============================================================================
- # ■ Game Character
- #==============================================================================
- class Game_CharacterBase
-
- attr_accessor :damage
-
- #--------------------------------------------------------------------------
- # ● Initialize
- #--------------------------------------------------------------------------
- alias mog_damage_popup_initialize initialize
- def initialize
- @damage = []
- mog_damage_popup_initialize
- end
-
- #--------------------------------------------------------------------------
- # ● damage Popup
- #--------------------------------------------------------------------------
- def damage_popup(value,type = nil, critical = false)
- type = (type == nil and value.is_a?(Numeric)) ? "HP" : type
- @damage.push([value,type,critical])
- end
-
- end
- #==============================================================================
- # ■ Sprite Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ● Initialize
- #--------------------------------------------------------------------------
- alias mog_damage_popup_initialize initialize
- def initialize(viewport, character = nil)
- mog_damage_popup_initialize(viewport, character)
- create_damage_sprite
- end
-
- #--------------------------------------------------------------------------
- # ● Create Damage Sprite
- #--------------------------------------------------------------------------
- def create_damage_sprite
- dispose_damage_sprite
- @damage_sprites = []
- end
-
- #--------------------------------------------------------------------------
- # ● Dispose
- #--------------------------------------------------------------------------
- alias mog_damage_popup_dispose dispose
- def dispose
- mog_damage_popup_dispose
- dispose_damage_sprite
- end
-
- #--------------------------------------------------------------------------
- # ● Dispose Damage Sprite
- #--------------------------------------------------------------------------
- def dispose_damage_sprite
- return if @damage_sprites == nil
- @damage_sprites.each {|sprite| sprite.dispose }
- @damage_sprites.clear
- @character.damage.clear
- $game_temp.dispose_damage_sprite = false
- end
-
- #--------------------------------------------------------------------------
- # ● Update
- #--------------------------------------------------------------------------
- alias mog_damage_popup_update update
- def update
- mog_damage_popup_update
- update_damage_sprite
- end
-
- #--------------------------------------------------------------------------
- # ● Create Damage
- #--------------------------------------------------------------------------
- def create_damage
- index = 0
- sx = self.x
- sy = self.y + @ch
- @damage_sprites = [] if @damage_sprites == nil
- for i in @character.damage
- @damage_sprites.push(Damage_Sprite.new(nil,sx,sy,i,index))
- index += 1
- end
- @character.damage.clear
- end
-
- #--------------------------------------------------------------------------
- # ● Update Damage Sprite
- #--------------------------------------------------------------------------
- def update_damage_sprite
- return if @damage_sprites == nil
- if @initial_damage == nil
- @initial_damage = true
- @character.damage.clear
- return
- end
- create_damage if [email protected]?
- if !@damage_sprites.empty?
- clear = 0
- for sprite in @damage_sprites
- sprite.update
- if sprite.duration == 0
- sprite.dispose
- end
- clear += 1 if sprite.duration > 0
- end
- clear_damage if clear == 0
- end
- end
-
- #--------------------------------------------------------------------------
- # ● Update Damage Sprite
- #--------------------------------------------------------------------------
- def clear_damage
- @damage_sprites.each {|sprite| sprite.dispose }
- @damage_sprites.clear
- @character.damage.clear
- end
-
- end
- #=============================================================================
- # ■ Game_Temp
- #=============================================================================
- class Game_Temp
-
- attr_accessor :dispose_damage_sprite
-
- #--------------------------------------------------------------------------
- # ● Initialize
- #--------------------------------------------------------------------------
- alias mog_dispose_damage_initialize initialize
- def initialize
- @dispose_damage_sprite = true
- mog_dispose_damage_initialize
- end
-
- end
- #=============================================================================
- # ■ Scene Manager
- #=============================================================================
- class << SceneManager
-
- #--------------------------------------------------------------------------
- # ● Call
- #--------------------------------------------------------------------------
- alias mog_damage_pop_call call
- def call(scene_class)
- $game_temp.dispose_damage_sprite = true
- mog_damage_pop_call(scene_class)
- end
-
- end
- #=============================================================================
- # ■ Scene Map
- #=============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● Update Scene
- #--------------------------------------------------------------------------
- alias mog_dispose_damage_sprites_update update_scene
- def update_scene
- @spriteset.dispose_damage_sprites
- mog_dispose_damage_sprites_update
- end
- end
- #=============================================================================
- # ■ Spriteset Map
- #=============================================================================
- class Spriteset_Map
-
- #--------------------------------------------------------------------------
- # ● Dispose Damage Sprites
- #--------------------------------------------------------------------------
- def dispose_damage_sprites
- return if !$game_temp.dispose_damage_sprite
- return if @character_sprites == nil
- @character_sprites.each {|sprite| sprite.dispose_damage_sprite }
- $game_temp.dispose_damage_sprite = false
- end
- end
- $mog_rgss3_damage_pop = true
复制代码 |
|