Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #================================================
- # Level Up Box
- #================================================
- #V 2
- #By Akxiv
- #Modified at 27. June 2006
- #==============================================================================
- # ย Class Scene Battle
- #==============================================================================
- class Scene_Battle
- LEVEL_UP_SE = "" # Soundeffect for Level UP
- LEVEL_UP_ME = "Audio/ME/join" # Audio Sound for Level UP
- end
- class Window_SkillLearning < Window_Base
- SKILLLEARN_SE = "Audio/SE/itemobtained" # Soundeffect if Skill learning
- end
- #==============================================================================
- # Window_LevelUpWindow
- #------------------------------------------------------------------------------
- #==============================================================================
- class Window_LevelUpWindow < Window_Base
- #--------------------------------------------------------------------------
- def initialize(x, y, actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
- # super(x, y, 160, 192)
- # super(x-x, y-64, 160, 192+64)
- super(x-x, y-128, 320, 320)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.visible = false
- self.back_opacity = 160
- refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
- end
- #--------------------------------------------------------------------------
- def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.size = 25
- self.contents.font.name = "EsbeltaINTL"
- self.contents.draw_text( 20, 0, 160, 24, " Level UP!")
- self.contents.font.size = 25
- self.contents.font.name = "EsbeltaINTL"
- self.contents.draw_text( 0, 28+64, 160, 24, $data_system.words.hp)
- self.contents.draw_text( 0, 50+64, 160, 24, $data_system.words.sp)
- self.contents.font.size = 25
- self.contents.font.name = "EsbeltaINTL"
- self.contents.draw_text( 0, 0+64, 128, 24, "Level")
- self.contents.draw_text( 0, 72+64, 144, 24, "Strength")
- self.contents.draw_text( 0, 94+64, 144, 24, "Dexterity")
- self.contents.draw_text( 0, 116+64, 144, 24, "Agility")
- self.contents.draw_text( 0, 138+64, 144, 24, "Intelligence")
- self.contents.font.size = 25
- self.contents.font.color = normal_color
- #self.contents.draw_text( 0, 0+64, 72, 24, "+" + (actor.level-last_lv).to_s, 2)
- self.contents.draw_text( 96, 28+64, 72, 24, "+" + up_hp.to_s, 2)
- self.contents.draw_text( 96, 50+64, 72, 24, "+" + up_sp.to_s, 2)
- self.contents.draw_text( 96, 72+64, 72, 24, "+" + up_str.to_s, 2)
- self.contents.draw_text( 96, 94+64, 72, 24, "+" + up_dex.to_s, 2)
- self.contents.draw_text( 96, 116+64, 72, 24, "+" + up_agi.to_s, 2)
- self.contents.draw_text( 96, 138+64, 72, 24, "+" + up_int.to_s, 2)
- self.contents.font.size = 25
- self.contents.font.name = "EsbeltaINTL"
- self.contents.draw_text( 96, 0+64, 128, 24, actor.level.to_s, 2)
- self.contents.draw_text( 96, 26+64, 128, 24, actor.maxhp.to_s, 2)
- self.contents.draw_text( -40, 26, 128, 24, actor.name, 2)
- self.contents.draw_text( 96, 48+64, 128, 24, actor.maxsp.to_s, 2)
- self.contents.draw_text( 96, 70+64, 128, 24, actor.str.to_s, 2)
- self.contents.draw_text( 96, 92+64, 128, 24, actor.dex.to_s, 2)
- self.contents.draw_text( 96, 114+64, 128, 24, actor.agi.to_s, 2)
- self.contents.draw_text( 96, 136+64, 128, 24, actor.int.to_s, 2)
- # Make actor graphic
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.picture(actor.name)
- end
- end
- #==============================================================================
- # ยยก Window_SkillLearning
- #==============================================================================
- class Window_SkillLearning < Window_Base
- #--------------------------------------------------------------------------
- attr_reader :learned
- #--------------------------------------------------------------------------
- def initialize(class_id, last_lv, now_lv)
- # super(160, 64-32, 320, 64)
- super(320, 0, 320, 64)
- self.contents = Bitmap.new(width - 32, height - 28)
- self.visible = false
- self.back_opacity = 160
- @learned = false
- refresh(class_id, last_lv, now_lv)
- # Dispose of actor graphic
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- def refresh(class_id, last_lv, now_lv)
- for i in 0...$data_classes[class_id].learnings.size
- learn_lv = $data_classes[class_id].learnings[i].level
- if learn_lv > last_lv and learn_lv <= now_lv
- @learned = true
- if SKILLLEARN_SE != "" #SE for Skilllearning
- Audio.se_play(SKILLLEARN_SE)
- end
- skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
- self.contents.clear
- self.contents.font.name = "EsbeltaINTL"
- self.contents.draw_text(0,0,448,32, "Learned " + skill_name + "! (Press Z)") #Skillname and then your text (here is for example Cut learned !!)
- self.visible = true
- loop do
- Graphics.update
- Input.update
- update
- if @learned == false
- break
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- def update
- if Input.trigger?(Input::A)
- @learned = false
- self.visible = false
- end
- end
- end
- #==============================================================================
- # Window_BattleStatus
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- attr_accessor :level_up_flags # LEVEL UP!
- end
- #==============================================================================
- # Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- alias xrxs_bp10_start_phase5 start_phase5
- def start_phase5
- xrxs_bp10_start_phase5
- @exp_gained = battle_exp
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp -= @exp_gained
- if actor.level < last_level
- @status_window.level_up_flags[i] = false
- end
- end
- end
- @exp_gain_actor = -1
- @result_window.visible = true
- end
- #--------------------------------------------------------------------------
- alias xrxs_bp10_update_phase5 update_phase5
- def update_phase5
- @level_up_phase_done = false if @level_up_phase_done != true
- if Input.trigger?(Input::A)
- @levelup_window.visible = false if @levelup_window != nil
- @status_window.level_up_flags[@exp_gain_actor] = false
- @level_up_phase_done = phase5_next_levelup
- end
- if @level_up_phase_done
- if @phase5_wait_count < 2
- @result_window.opacity = 0
- @result_window.back_opacity = 0
- @result_window.contents_opacity = 0
- end
- xrxs_bp10_update_phase5
- battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
- end
- end
- #--------------------------------------------------------------------------
- def phase5_next_levelup
- begin
- @exp_gain_actor += 1
- if @exp_gain_actor >= $game_party.actors.size
- return true
- end
- actor = $game_party.actors[@exp_gain_actor]
- if actor.cant_get_exp? == false
- last_level = actor.level
- last_maxhp = actor.maxhp
- last_maxsp = actor.maxsp
- last_str = actor.str
- last_dex = actor.dex
- last_agi = actor.agi
- last_int = actor.int
- actor.exp += @exp_gained
- if actor.level > last_level
- @status_window.level_up(@exp_gain_actor)
- @result_window.visible = false
- if LEVEL_UP_SE != ""
- Audio.se_play(LEVEL_UP_SE)
- end
- if LEVEL_UP_ME != ""
- Audio.me_stop
- Audio.me_play(LEVEL_UP_ME)
- end
- actors_size = [$game_party.actors.size, 4].max
- x_shift = 160 + (640 - 160*actors_size)/(actors_size - 1)
- x = x_shift * @exp_gain_actor
- y = 128
- @levelup_window = Window_LevelUpWindow.new(x, y, actor, last_level,
- actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
- actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
- @levelup_window.visible = true
- @status_window.refresh
- @skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
- @phase5_wait_count = 40
- return false
- end
- end
- end until false
- end
- def battle_exp
- bexp = 0
- for enemy in $game_troop.enemies
- unless enemy.hidden
- bexp += enemy.exp
- end
- end
- return bexp
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement