Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Verus Tempus Ballum - HUD
- #==============================================================================
- Show_Switch = 0
- Text_Skills = "Skills"
- Text_Items = "Items"
- Text_Allies = "Party"
- Attack_Icon = 1
- Defend_Icon = 52
- Skill_Icon = 119
- Heal_Icon = 128
- X_Position = 0
- Y_Position = 320
- #------------------------------------------------------------------------------
- class Game_Party < Game_Unit
- alias verus_tempus_proelium_gparty_lose_item lose_item
- def lose_item(item, n, include_equip = false)
- verus_tempus_proelium_gparty_lose_item(item, n, include_equip)
- if members[0].item_hotkeys.include?(item.id)
- $refresh_hud = true
- end
- end
- end
- #------------------------------------------------------------------------------
- class Sprite_HUD < Sprite
- def initialize(viewport)
- super(viewport)
- self.bitmap = Bitmap.new(132, 84)
- update
- end
- def update
- return if $game_party.members.size <= 0
- self.visible = (Show_Switch <= 0 or (Show_Switch > 0 and $game_switches[Show_Switch]))
- super
- if $game_player.screen_x <= self.bitmap.width+10 and
- $game_player.screen_y <= self.bitmap.height+10
- self.opacity -= 10 if self.opacity > 0
- elsif self.opacity < 255
- self.opacity += 10
- end
- refresh if something_changed?
- end
- def refresh
- @actor = $game_party.members[0]
- @hp = @actor.hp
- @mp = @actor.mp
- self.bitmap.clear
- base = Cache.system("Bar Base")
- hpbar = Cache.system("HP Bar")
- mpbar = Cache.system("MP Bar")
- expbar = Cache.system("Exp Bar")
- self.bitmap.blt(4, 4, base, base.rect)
- self.bitmap.blt(4, 22, base, base.rect)
- self.bitmap.blt(4, 40, base, base.rect)
- hprect = Rect.new(0, 0, hpbar.width*@actor.hp/@actor.maxhp, hpbar.height)
- mprect = Rect.new(0, 0, mpbar.width*@actor.mp/@actor.maxmp, mpbar.height)
- exprect = Rect.new(0, 0, expbar.width*@actor.current_exp/@actor.next_exp, expbar.height)
- self.bitmap.blt(4, 4, hpbar, hprect)
- self.bitmap.blt(4, 22, mpbar, mprect)
- self.bitmap.blt(4, 40, expbar, exprect)
- self.bitmap.font.size = 16
- self.bitmap.draw_outlined_text(5, 3, 26, 18, Vocab.hp_a)
- self.bitmap.draw_outlined_text(5, 21, 26, 18, Vocab.mp_a)
- self.bitmap.draw_outlined_text(5, 39, 26, 18, "Exp")
- end
- def something_changed?
- return true if @actor != $game_party.members[0]
- return true if @hp != $game_party.members[0].hp
- return true if @mp != $game_party.members[0].mp
- return false
- end
- end
- #------------------------------------------------------------------------------
- class Sprite_Hotkeys < Sprite
- def initialize(viewport)
- super(viewport)
- self.x = X_Position
- self.y = Y_Position
- self.opacity = 0
- @base = Cache.system("Hotkeys Base")
- self.bitmap = Bitmap.new(@base.width, @base.height)
- @items = {}
- @members = $game_party.members
- update
- end
- def update
- return if $game_party.members.size <= 0
- super
- if $game_player.ally_action != nil
- self.opacity = 64
- return
- end
- if show?
- self.visible = true unless self.visible
- self.opacity += 10 if self.opacity < 255
- elsif self.visible and !show?
- self.opacity -= 10
- if self.opacity <= 10
- self.visible = false
- @draw_skills = false
- @draw_items = false
- @draw_allies = false
- end
- end
- if $game_player.selecting_skill and !@draw_skills
- @draw_items = false
- @draw_skills = true
- @draw_allies = false
- refresh
- elsif $game_player.selecting_item and !@draw_items
- @draw_skills = false
- @draw_items = true
- @draw_allies = false
- refresh
- elsif $game_player.selecting_action and !@draw_allies
- @draw_allies = true
- @draw_skills = false
- @draw_items = false
- refresh
- end
- if @draw_items and $refresh_hud
- refresh
- $refresh_hud = false
- end
- if @draw_allies
- if @members != $game_party.members
- @members = $game_party.members
- refresh
- end
- end
- end
- def refresh
- self.bitmap.clear
- self.bitmap.font.size = 16
- self.bitmap.blt(0, 0, @base, @base.rect)
- if @draw_skills
- $game_player.actor.skill_hotkeys.each { |k, v|
- i = (k == 2 ? 7 : k == 8 ? 1 : k == 4 ? 3 : k == 6 ? 5 : 0)
- draw_icon($data_skills[v].icon_index, i%3*32+4, i/3*32+4)
- }
- self.bitmap.font.color = Color.new(132,170,255)
- self.bitmap.draw_text(32, 40, 32, 16, Text_Skills, 1)
- elsif @draw_items
- $game_player.actor.item_hotkeys.each { |k, v|
- i = (k == 2 ? 7 : k == 8 ? 1 : k == 4 ? 3 : k == 6 ? 5 : 0)
- draw_icon($data_items[v].icon_index, i%3*32+4, i/3*32+4)
- n = $game_party.item_number($data_items[v])
- @items[v] = n
- self.bitmap.font.color = Color.new(255,255,255)
- self.bitmap.draw_outlined_text(i%3*32+4, i/3*32+16, 24, 16, n.to_s, 1)
- }
- self.bitmap.font.color = Color.new(132,170,255)
- self.bitmap.draw_text(32, 40, 32, 16, Text_Items, 1)
- elsif @draw_allies
- for ally in $game_allies.compact
- a = ally.actor.index
- i = (a == 1 ? 1 : a == 2 ? 3 : a == 3 ? 5 : 0)
- draw_face(ally.actor, i%3*32, i/3*32)
- end
- self.bitmap.font.color = Color.new(132,170,255)
- self.bitmap.draw_text(32, 40, 32, 16, Text_Allies, 1)
- end
- end
- def show?
- return true if $game_player.selecting_skill
- return true if $game_player.selecting_item
- return true if $game_player.selecting_action
- return false
- end
- end
- #------------------------------------------------------------------------------
- class Sprite_Actions < Sprite
- def initialize(viewport)
- super(viewport)
- self.x = X_Position + 9
- self.y = Y_Position + 9
- @base = Cache.system("Actions Base")
- self.bitmap = Bitmap.new(@base.width, @base.height)
- self.visible = false
- self.opacity = 0
- update
- end
- def update
- return if $game_party.members.size <= 0
- super
- if $game_player.ally_action != nil
- unless self.visible
- self.visible = true
- refresh
- end
- self.opacity += 10 if self.opacity < 255
- elsif self.visible
- self.opacity -= 10
- self.visible = false if self.opacity <= 0
- end
- if $game_player.ally_action != nil and
- @action != $game_player.ally_action.action
- refresh
- end
- end
- def refresh
- @action = $game_player.ally_action.action
- self.bitmap.clear
- self.bitmap.blt(0, 0, @base, @base.rect)
- bitmap = Cache.system("Iconset")
- opacity = ($game_player.ally_action.action)
- draw_icon(Attack_Icon, 28, 2, icon_opacity(0))
- draw_icon(Defend_Icon, 2, 28, icon_opacity(2))
- draw_icon(Skill_Icon, 54, 28, icon_opacity(1))
- draw_icon(Heal_Icon, 28, 54, icon_opacity(3))
- draw_face($game_player.ally_action.actor, 23, 23)
- end
- def icon_opacity(i)
- return ($game_player.ally_action.action == i ? 255 : 96)
- end
- end
- #------------------------------------------------------------------------------
- class Spriteset_Map
- alias vtphud_spmap_initialize initialize
- alias vtphud_spmap_update update
- alias vtphud_spmap_dispose dispose
- def initialize
- vtphud_spmap_initialize
- @sprite_hud = Sprite_HUD.new(@viewport3)
- @sprite_hotkeys = Sprite_Hotkeys.new(@viewport3)
- @sprite_actions = Sprite_Actions.new(@viewport3)
- end
- def update
- vtphud_spmap_update
- @sprite_hud.update if @sprite_hud != nil
- @sprite_hotkeys.update if @sprite_hotkeys != nil
- @sprite_actions.update if @sprite_actions != nil
- end
- def dispose
- vtphud_spmap_dispose
- @sprite_hud.dispose if @sprite_hud != nil
- @sprite_hotkeys.dispose if @sprite_hotkeys != nil
- @sprite_actions.dispose if @sprite_actions != nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement