Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # * Version 1.0: Release Script
- # * Version 1.1: Fixed Bug
- #==============================================================================
- module DMTK
- module TOTAL_DAMAGE
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- RULES = ["HP_DMG"]
- end
- end
- #==============================================================================
- # *
- #==============================================================================
- $imported = {} if $imported.nil?
- unless $imported["YEA-BattleEngine"]
- msgbox("Please place DMTK Total Damage Addon below YEA Battle Engine")
- exit
- end
- $imported["DMTK-TD-Addon"] = true
- #==============================================================================
- # *
- #==============================================================================
- module YEA
- module BATTLE
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- # [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
- POPUP_RULES["TOTAL"] = [ 1.0, 2.0, 32, true, false, 255, 255, 0, DEFAULT]
- end
- end
- #==============================================================================
- # *
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias dmtk_td_create_new_popup create_new_popup
- def create_new_popup(*array)
- dmtk_td_create_new_popup(*array)
- if DMTK::TOTAL_DAMAGE::RULES.include?(array[1])
- psize = @popups.inject(0) {|r, p|
- r += 1 if DMTK::TOTAL_DAMAGE::RULES.include?(p.rules)
- r}
- if psize == 1
- @total_damage = array[0].to_i
- @total_popup = nil
- else
- return if array[0].to_i.nil?
- @total_damage += array[0].to_i
- if @total_popup && !@total_popup.disposed?
- @total_popup.value = @total_damage.to_s
- @popups[-1].y -= 24
- else
- create_new_popup(@total_damage.to_s, "TOTAL", [])
- end
- end
- elsif array[1] == "TOTAL"
- @total_popup = @popups[-1]
- end
- end
- end
- #==============================================================================
- # *
- #==============================================================================
- class Sprite_Popup < Sprite_Base
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- attr_reader :rules
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def value=(new_value)
- if @value != new_value
- @value = new_value
- refresh_popup_bitmap
- end
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def refresh_popup_bitmap
- return create_popup_bitmap if self.bitmap.disposed?
- rules_array = YEA::BATTLE::POPUP_RULES[@rules]
- bw = Graphics.width
- bh = self.bitmap.height
- self.bitmap.clear
- self.bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
- self.bitmap.draw_text(0, 0, bw, bh, @value, 1)
- #------------------------------------------------------------------------
- self.x = @battler.screen_x
- self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
- self.x -= SceneManager.scene.spriteset.viewport1.ox
- self.y = @battler.screen_y - @battler.sprite.oy/2
- self.y -= @battler.sprite.oy/2 if @battler.actor?
- self.y -= SceneManager.scene.spriteset.viewport1.oy
- self.ox = bw/2; self.oy = bh/2
- self.zoom_x = self.zoom_y = rules_array[0]
- @target_zoom = rules_array[1]
- self.z = 501
- end
- end
- #==============================================================================
- # *
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement