Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ability Menu by Arttroy (advised and corrected by Estheone)
- # Contact on http://www.rpg-maker.fr/index.php?page=membre&id=22277
- #
- # Instructions :
- #
- # * Modification of skills obtained and their level :
- #
- # Line 90 :
- # @ability_new_skills_id = [[3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
- #
- # The id of skills matches that of the database, modify it as you want
- #
- # Modification of the level when skill will be obtained
- #
- # Line 91 :
- # @ability_new_skills_level = [[3, 6, 10], [3, 10, 30], [3, 10, 30], [3, 10, 30]]
- #
- # You can modify the level of category when skill will be obtained.
- #
- # These two lines are matching together, if you want to add a skill you must also modify the line for the level
- #
- # * Modification of the actor parameters :
- #
- # Line 92 :
- # @augmentation = [0, 0, 0, 0, 0, 0, 0, 0]
- #
- # Read this like :
- # @augmentation = [HP, MP, Atk, Def, Mgi, M.def, Agi, Luk]
- # You will have to modify the values of the method addedstats_calculation (Line 123)
- #
- # @augmentation[2] = Random.new.rand(3..8)
- #
- # You can modify the values of random. At the same time modify the display values
- # from the line 677 (def refresh of the Scene_Ability).
- #
- #
- # If you want to modify the parameter growth
- # you will have to change the display of contents for the adds. I advise not to do this if you
- # don't know how to do this.
- #
- #
- # Do not forget to insert images in the folder Pictures
- #==============================================================================
- # ** Game_Temp
- #------------------------------------------------------------------------------
- # This class handles temporary data that is not included with save data.
- # The instance of this class is referenced by $game_temp.
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :ability_index # Index for ability menu
- #--------------------------------------------------------------------------
- # * Aliasing method initialize
- #--------------------------------------------------------------------------
- alias ability_initialize initialize
- def initialize
- @ability_index = 0
- ability_initialize
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- attr_reader :ability_level # for ability level
- attr_reader :ability_points # for new skill by levelling ability
- attr_reader :ability_new_skills_id # for new skill by levelling ability
- attr_reader :ability_new_skills_level # required level for new skills
- attr_reader :augmentation # for added stats by levelling ability
- #--------------------------------------------------------------------------
- # * Aliasing method setup(actor_id)
- #--------------------------------------------------------------------------
- alias ability_setup setup
- def setup(actor_id)
- @ability_level = [0, 0, 0, 0]
- @ability_points = 0
- @ability_new_skills_id = [[3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
- @ability_new_skills_level = [[3, 6, 10], [3, 10, 30], [3, 10, 30], [3, 10, 30]]
- @augmentation = [0, 0, 0, 0, 0, 0, 0, 0]
- ability_setup(actor_id)
- end
- #--------------------------------------------------------------------------
- # * Check if ability_level is equal to skill_level - 1
- #--------------------------------------------------------------------------
- def check_ability_skills_learning(n)
- level = @ability_level[n]
- for i in 0...@ability_new_skills_id[n].size
- required_level = @ability_new_skills_level[n][i]
- learn_skill(@ability_new_skills_id[n][i]) if level >= required_level
- end
- end
- #--------------------------------------------------------------------------
- # * Ability Maximum Level
- #--------------------------------------------------------------------------
- def ability_max_level
- return 60
- end
- #--------------------------------------------------------------------------
- # * Determine Maximum Level
- #--------------------------------------------------------------------------
- def ability_max_level?
- @ability_level >= ability_max_level
- end
- #--------------------------------------------------------------------------
- # * Calculate Stats Augmentation
- #--------------------------------------------------------------------------
- def addedstats_calculation
- case $game_temp.ability_index
- when 0
- if @ability_level[0].between?(0, 30)
- @augmentation[2] = Random.new.rand(3..8)
- @augmentation[3] = Random.new.rand(3..8)
- @augmentation[0] = Random.new.rand(50..100)
- elsif @ability_level[0].between?(31, 60)
- @augmentation[2] = Random.new.rand(15..20)
- @augmentation[3] = Random.new.rand(15..20)
- @augmentation[0] = Random.new.rand(150..250)
- end
- when 1
- if @ability_level[1].between?(0, 30)
- @augmentation[4] = Random.new.rand(3..8)
- @augmentation[0] = Random.new.rand(25..50)
- @augmentation[1] = Random.new.rand(25..75)
- elsif @ability_level[1].between?(31, 60)
- @augmentation[4] = Random.new.rand(15..20)
- @augmentation[0] = Random.new.rand(75..100)
- @augmentation[1] = Random.new.rand(100..150)
- end
- when 2
- if @ability_level[2].between?(0, 30)
- @augmentation[4] = Random.new.rand(3..8)
- @augmentation[5] = Random.new.rand(3..8)
- @augmentation[1] = Random.new.rand(50..100)
- elsif @ability_level[2].between?(31, 60)
- @augmentation[4] = Random.new.rand(15..20)
- @augmentation[5] = Random.new.rand(15..20)
- @augmentation[1] = Random.new.rand(100..150)
- end
- when 3
- if @ability_level[3].between?(0, 30)
- @augmentation[4] = Random.new.rand(3..8)
- @augmentation[5] = Random.new.rand(3..8)
- @augmentation[1] = Random.new.rand(25..50)
- elsif @ability_level[3].between?(31, 60)
- @augmentation[4] = Random.new.rand(15..20)
- @augmentation[5] = Random.new.rand(15..20)
- @augmentation[1] = Random.new.rand(75..125)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Add Stats Augmentation
- #--------------------------------------------------------------------------
- def stats_augmentation
- case $game_temp.ability_index
- when 0
- add_param(2, @augmentation[2])
- add_param(3, @augmentation[3])
- add_param(0, @augmentation[0])
- when 1
- add_param(4, @augmentation[4])
- add_param(0, @augmentation[0])
- add_param(1, @augmentation[1])
- when 2
- add_param(4, @augmentation[4])
- add_param(5, @augmentation[5])
- add_param(1, @augmentation[1])
- when 3
- add_param(4, @augmentation[4])
- add_param(5, @augmentation[5])
- add_param(1, @augmentation[1])
- end
- end
- #--------------------------------------------------------------------------
- # * Ability Points Down
- #--------------------------------------------------------------------------
- def abilitypoints_down
- @ability_points -= 1
- end
- #--------------------------------------------------------------------------
- # * Aliasing method Level Up
- #--------------------------------------------------------------------------
- alias ability_level_up level_up
- def level_up
- @ability_points += 1
- ability_level_up
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Overwrite method Adding Original Commands
- #--------------------------------------------------------------------------
- def add_original_commands
- add_command("Ability", :ability, main_commands_enabled)
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Overwrite method Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_MenuCommand.new
- @command_window.set_handler(:item, method(:command_item))
- @command_window.set_handler(:skill, method(:command_personal))
- @command_window.set_handler(:equip, method(:command_personal))
- @command_window.set_handler(:status, method(:command_personal))
- @command_window.set_handler(:ability, method(:command_ability))
- @command_window.set_handler(:formation, method(:command_formation))
- @command_window.set_handler(:save, method(:command_save))
- @command_window.set_handler(:game_end, method(:command_game_end))
- @command_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * [Ability] Command
- #--------------------------------------------------------------------------
- def command_ability
- @status_window.select_last
- @status_window.activate
- @status_window.set_handler(:ok, method(:on_ability_ok))
- @status_window.set_handler(:cancel, method(:on_ability_cancel))
- end
- #--------------------------------------------------------------------------
- # * Ability [OK]
- #--------------------------------------------------------------------------
- def on_ability_ok
- if @status_window.pending_index >= 0
- @status_window.pending_index = @status_window.index
- end
- @status_window.activate
- SceneManager.call(Scene_Ability)
- end
- #--------------------------------------------------------------------------
- # * Ability [Cancel]
- #--------------------------------------------------------------------------
- def on_ability_cancel
- if @status_window.pending_index >= 0
- @status_window.pending_index = -1
- @status_window.activate
- else
- @status_window.unselect
- @command_window.activate
- end
- end
- end
- #===============================================================================
- # ** Scene_Ability
- #-------------------------------------------------------------------------------
- # This class perform the Ability system
- #===============================================================================
- class Scene_Ability < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- $game_temp.ability_index = 0
- create_abilitystatus_window
- create_category_windows
- create_adds_windows
- create_command_window
- create_choices_windows
- create_addedstats_window
- create_showskill_window
- create_images
- @abilitymessage_window.visible = false
- @addedstats_window.visible = false
- refresh
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super
- @crystal_sprites.each(&:dispose)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if @command_window.active
- if Input.trigger?(:LEFT)
- Sound.play_cursor
- $game_temp.ability_index = ($game_temp.ability_index-1)%4
- case $game_temp.ability_index
- when 0
- if @showskill_mgib_window.height = 120
- @showskill_mgib_window.height = 20
- @showskill_mgib_window.y = 384
- @showskill_mgib_window.opacity = 0
- @showskill_mgib_window.back_opacity = 0
- @mgib_adds_window.visible = true
- end
- when 1
- if @showskill_mgin_window.height = 120
- @showskill_mgin_window.height = 20
- @showskill_mgin_window.y = 384
- @showskill_mgin_window.opacity = 0
- @showskill_mgin_window.back_opacity = 0
- @mgin_adds_window.visible = true
- end
- when 2
- if @showskill_mgic_window.height = 120
- @showskill_mgic_window.height = 20
- @showskill_mgic_window.y = 384
- @showskill_mgic_window.opacity = 0
- @showskill_mgic_window.back_opacity = 0
- @mgic_adds_window.visible = true
- end
- when 3
- if @showskill_atk_window.height = 120
- @showskill_atk_window.height = 20
- @showskill_atk_window.y = 384
- @showskill_atk_window.opacity = 0
- @showskill_atk_window.back_opacity = 0
- @atk_adds_window.visible = true
- end
- end
- elsif Input.trigger?(:RIGHT)
- Sound.play_cursor
- $game_temp.ability_index = ($game_temp.ability_index+1)%4
- case $game_temp.ability_index
- when 0
- if @showskill_mgic_window.height = 120
- @showskill_mgic_window.height = 20
- @showskill_mgic_window.y = 384
- @showskill_mgic_window.opacity = 0
- @showskill_mgic_window.back_opacity = 0
- @mgic_adds_window.visible = true
- end
- when 1
- if @showskill_atk_window.height = 120
- @showskill_atk_window.height = 20
- @showskill_atk_window.y = 384
- @showskill_atk_window.opacity = 0
- @showskill_atk_window.back_opacity = 0
- @atk_adds_window.visible = true
- end
- when 2
- if @showskill_mgib_window.height = 120
- @showskill_mgib_window.height = 20
- @showskill_mgib_window.y = 384
- @showskill_mgib_window.opacity = 0
- @showskill_mgib_window.back_opacity = 0
- @mgib_adds_window.visible = true
- end
- when 3
- if @showskill_mgin_window.height = 120
- @showskill_mgin_window.height = 20
- @showskill_mgin_window.y = 384
- @showskill_mgin_window.opacity = 0
- @showskill_mgin_window.back_opacity = 0
- @mgin_adds_window.visible = true
- end
- end
- elsif Input.trigger?(:DOWN)
- case $game_temp.ability_index
- when 0
- @showskill_atk_window.refresh
- @showskill_atk_window.height = 120
- @showskill_atk_window.y = 290
- @showskill_atk_window.opacity = 255
- @showskill_atk_window.back_opacity = 190
- @atk_adds_window.visible = false
- when 1
- @showskill_mgib_window.refresh
- @showskill_mgib_window.height = 120
- @showskill_mgib_window.y = 290
- @showskill_mgib_window.opacity = 255
- @showskill_mgib_window.back_opacity = 190
- @mgib_adds_window.visible = false
- when 2
- @showskill_mgin_window.refresh
- @showskill_mgin_window.height = 120
- @showskill_mgin_window.y = 290
- @showskill_mgin_window.opacity = 255
- @showskill_mgin_window.back_opacity = 190
- @mgin_adds_window.visible = false
- when 3
- @showskill_mgic_window.refresh
- @showskill_mgic_window.height = 120
- @showskill_mgic_window.y = 290
- @showskill_mgic_window.opacity = 255
- @showskill_mgic_window.back_opacity = 190
- @mgic_adds_window.visible = false
- end
- elsif Input.trigger?(:UP)
- case $game_temp.ability_index
- when 0
- if @showskill_atk_window.height = 120
- @showskill_atk_window.height = 20
- @showskill_atk_window.y = 384
- @showskill_atk_window.opacity = 0
- @showskill_atk_window.back_opacity = 0
- @atk_adds_window.visible = true
- end
- when 1
- if @showskill_mgib_window.height = 120
- @showskill_mgib_window.height = 20
- @showskill_mgib_window.y = 384
- @showskill_mgib_window.opacity = 0
- @showskill_mgib_window.back_opacity = 0
- @mgib_adds_window.visible = true
- end
- when 2
- if @showskill_mgin_window.height = 120
- @showskill_mgin_window.height = 20
- @showskill_mgin_window.y = 384
- @showskill_mgin_window.opacity = 0
- @showskill_mgin_window.back_opacity = 0
- @mgin_adds_window.visible = true
- end
- when 3
- if @showskill_mgic_window.height = 120
- @showskill_mgic_window.height = 20
- @showskill_mgic_window.y = 384
- @showskill_mgic_window.opacity = 0
- @showskill_mgic_window.back_opacity = 0
- @mgic_adds_window.visible = true
- end
- end
- elsif Input.trigger?(:C)
- if @actor.ability_points != 0
- @abilitymessage_window.visible = true
- @actor.addedstats_calculation
- @addedstats_window.refresh
- @addedstats_window.visible = true
- @command_window.active = false
- @abilitychoices_window.start
- else
- Sound.play_buzzer
- end
- end
- end
- 4.times do |i|
- j = $game_temp.ability_index == i ? 1 : 0
- bitmap_name = @actor.ability_level[i] == 0 ? @crystal_pictures[j] : @crystal_pictures[i*2+2+j]
- @crystal_sprites[i].bitmap = Cache.picture(bitmap_name)
- end
- pattern = (Graphics.frame_count/5)%6
- sprite = @crystal_sprites[$game_temp.ability_index]
- w, h = sprite.bitmap.width/6, sprite.bitmap.height
- sprite.src_rect.set(w*pattern, 0, w, h)
- end
- #--------------------------------------------------------------------------
- # * Ability Status Window creation
- #--------------------------------------------------------------------------
- def create_abilitystatus_window
- @abilitystatus_window = Window_AbilityStatus.new
- @abilitystatus_window.actor = @actor
- end
- #--------------------------------------------------------------------------
- # * Ability Category Window creation
- #--------------------------------------------------------------------------
- def create_category_windows
- @atk_category_window = Window_AbilityCategory.new
- @atk_category_window.x = 60
- @atk_category_window.contents.draw_text(4, 0, 60, 20, "ATK")
- @mgib_category_window = Window_AbilityCategory.new
- @mgib_category_window.x = 180
- @mgib_category_window.contents.draw_text(2, 0, 60, 20, "MGIB")
- @mgin_category_window = Window_AbilityCategory.new
- @mgin_category_window.x = 300
- @mgin_category_window.contents.draw_text(2, 0, 60, 20, "MGIN")
- @mgic_category_window = Window_AbilityCategory.new
- @mgic_category_window.x = 420
- @mgic_category_window.contents.draw_text(2, 0, 60, 20, "MGIC")
- end
- #--------------------------------------------------------------------------
- # * Ability Status Window creation
- #--------------------------------------------------------------------------
- def create_adds_windows
- @atk_adds_window = Window_AbilityAdds.new(40, 290)
- @atk_adds_window.actor = @actor
- @atk_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[0].to_s, 1)
- @mgib_adds_window = Window_AbilityAdds.new(160, 290)
- @mgib_adds_window.actor = @actor
- @mgib_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[1].to_s, 1)
- @mgin_adds_window = Window_AbilityAdds.new(280, 290)
- @mgin_adds_window.actor = @actor
- @mgin_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[2].to_s, 1)
- @mgic_adds_window = Window_AbilityAdds.new(400, 290)
- @mgic_adds_window.actor = @actor
- @mgic_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[3].to_s, 1)
- end
- #--------------------------------------------------------------------------
- # * Ability Command Window creation
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_Ability_Command.new
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # * Ability Choices Windows creation
- #--------------------------------------------------------------------------
- def create_choices_windows
- @abilitymessage_window = Window_Ability_Confirmation.new
- @abilitychoices_window = Window_Ability_ChoiceList.new
- @abilitychoices_window.set_handler(:oui, method(:add_ability_points))
- @abilitychoices_window.set_handler(:non, method(:return_category))
- @abilitychoices_window.set_handler(:cancel, method(:return_category))
- end
- def create_addedstats_window
- @addedstats_window = Window_Ability_AddedStats.new
- @addedstats_window.actor = @actor
- end
- def create_showskill_window
- @showskill_atk_window = Window_AbilitySkillList.new(40, 384, 0)
- @showskill_atk_window.actor = @actor
- @showskill_atk_window.opacity = 0
- @showskill_atk_window.back_opacity = 0
- @showskill_mgib_window = Window_AbilitySkillList.new(160, 384, 1)
- @showskill_mgib_window.actor = @actor
- @showskill_mgib_window.opacity = 0
- @showskill_mgib_window.back_opacity = 0
- @showskill_mgin_window = Window_AbilitySkillList.new(280, 384, 2)
- @showskill_mgin_window.actor = @actor
- @showskill_mgin_window.opacity = 0
- @showskill_mgin_window.back_opacity = 0
- @showskill_mgic_window = Window_AbilitySkillList.new(400, 384, 3)
- @showskill_mgic_window.actor = @actor
- @showskill_mgic_window.opacity = 0
- @showskill_mgic_window.back_opacity = 0
- end
- #--------------------------------------------------------------------------
- # * Change Actors
- #--------------------------------------------------------------------------
- def on_actor_change
- @abilitystatus_window.actor = @actor
- @addedstats_window.actor = @actor
- @atk_adds_window.actor = @actor
- @mgib_adds_window.actor = @actor
- @mgin_adds_window.actor = @actor
- @mgic_adds_window.actor = @actor
- @showskill_atk_window.actor = @actor
- @showskill_mgib_window.actor = @actor
- @showskill_mgin_window.actor = @actor
- @showskill_mgic_window.actor = @actor
- @command_window.activate
- refresh
- end
- #--------------------------------------------------------------------------
- # * Add Ability Points
- #--------------------------------------------------------------------------
- def add_ability_points
- if @actor.ability_points == 0
- Sound.play_buzzer
- else
- case $game_temp.ability_index
- when 0
- @actor.ability_level[0] += 1
- @actor.abilitypoints_down
- @actor.stats_augmentation
- @actor.check_ability_skills_learning(0)
- @atk_adds_window.refresh
- when 1
- @actor.ability_level[1] += 1
- @actor.abilitypoints_down
- @actor.stats_augmentation
- @actor.check_ability_skills_learning(1)
- @mgib_adds_window.refresh
- when 2
- @actor.ability_level[2] += 1
- @actor.abilitypoints_down
- @actor.stats_augmentation
- @actor.check_ability_skills_learning(2)
- @mgin_adds_window.refresh
- when 3
- @actor.ability_level[3] += 1
- @actor.abilitypoints_down
- @actor.stats_augmentation
- @actor.check_ability_skills_learning(3)
- @mgic_adds_window.refresh
- end
- Sound.play_cursor
- end
- refresh
- @abilitystatus_window.refresh
- @abilitymessage_window.visible = false
- @addedstats_window.visible = false
- @addedstats_window.refresh
- @abilitychoices_window.deactivate
- @abilitychoices_window.openness = 0
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * Return to category choice
- #--------------------------------------------------------------------------
- def return_category
- Sound.play_cancel
- @abilitymessage_window.visible = false
- @addedstats_window.visible = false
- @addedstats_window.refresh
- @abilitychoices_window.openness = 0
- @abilitychoices_window.deactivate
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # * Images creation
- #--------------------------------------------------------------------------
- def create_images
- @crystal_sprites = []
- 4.times do |i|
- @crystal_sprites[i] = Sprite.new
- @crystal_sprites[i].x = 60+120*i
- @crystal_sprites[i].y = 130
- end
- @crystal_pictures = ["Crystal", "Glowing_Crystal", "Red_Crystal", "Glowing_Red_Crystal", "White_Crystal", "Glowing_White_Crystal",
- "Blue_Crystal", "Glowing_Blue_Crystal", "Green_Crystal", "Glowing_Green_Crystal"]
- update
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- @command_window.index = 0
- @command_window.refresh
- @atk_adds_window.refresh
- @mgib_adds_window.refresh
- @mgin_adds_window.refresh
- @mgic_adds_window.refresh
- @atk_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[0].to_s, 1)
- @atk_adds_window.contents.draw_text(0, 30, 40, 14, "ATK")
- @atk_adds_window.contents.draw_text(0, 42, 40, 14, "DEF")
- @atk_adds_window.contents.draw_text(0, 54, 40, 14, "HP")
- if @actor.ability_level[0].between?(0, 30)
- @atk_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
- @atk_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
- @atk_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
- elsif @actor.ability_level[0].between?(31, 60)
- @atk_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
- @atk_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
- @atk_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
- end
- @mgib_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[1].to_s, 1)
- @mgib_adds_window.contents.draw_text(0, 30, 40, 14, "MAG")
- @mgib_adds_window.contents.draw_text(0, 42, 40, 14, "HP")
- @mgib_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
- if @actor.ability_level[1].between?(0, 30)
- @mgib_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
- @mgib_adds_window.contents.draw_text(10, 42, 60, 14, "+ 25/50", 2)
- @mgib_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/75", 2)
- elsif @actor.ability_level[1].between?(31, 60)
- @mgib_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
- @mgib_adds_window.contents.draw_text(10, 42, 60, 14, "+ 75/100", 2)
- @mgib_adds_window.contents.draw_text(10, 54, 60, 14, "+ 100/150", 2)
- end
- @mgin_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[2].to_s, 1)
- @mgin_adds_window.contents.draw_text(0, 30, 40, 14, "MGI")
- @mgin_adds_window.contents.draw_text(0, 42, 40, 14, "MDF")
- @mgin_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
- if @actor.ability_level[2].between?(0, 30)
- @mgin_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
- @mgin_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
- @mgin_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
- elsif @actor.ability_level[2].between?(31, 60)
- @mgin_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
- @mgin_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
- @mgin_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
- end
- @mgic_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[3].to_s, 1)
- @mgic_adds_window.contents.draw_text(0, 30, 40, 14, "MGI")
- @mgic_adds_window.contents.draw_text(0, 42, 40, 14, "MDF")
- @mgic_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
- if @actor.ability_level[3].between?(0, 30)
- @mgic_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
- @mgic_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
- @mgic_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
- elsif @actor.ability_level[3].between?(31, 60)
- @mgic_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
- @mgic_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
- @mgic_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
- end
- end
- end
- #===============================================================================
- # ** Window_AbilityStatus
- #-------------------------------------------------------------------------------
- # This class perform the status window for the Ability system
- #===============================================================================
- class Window_AbilityStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(22, 6, 500, 120)
- self.contents.font.size = 16
- @actor = nil
- @temp_actor = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 4
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_actor_face(@actor, 0, 0) if @actor
- draw_actor_name(@actor, 104, 0) if @actor
- draw_actor_hp(@actor, 104, 20, width = 60) if @actor
- draw_actor_mp(@actor, 212, 20, width = 60) if @actor
- draw_item(100, 38, 0)
- draw_ability_points(@actor, 0, 0) if @actor
- draw_actor_accessory(@actor, 0, 0) if @actor
- end
- #--------------------------------------------------------------------------
- # * Set Temporary Actor After Equipment Change
- #--------------------------------------------------------------------------
- def set_temp_actor(temp_actor)
- return if @temp_actor == temp_actor
- @temp_actor = temp_actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Draw Max Value in Fractional Format
- # max : Maximum value
- # color1 : Color of maximum value
- #--------------------------------------------------------------------------
- def draw_max_values(x, y, width, max, color1)
- xr = x + width
- if width < 96
- draw_text(xr - 40, y, 42, line_height, max, 2)
- else
- draw_text(xr - 42, y, 42, line_height, max, 2)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw HP
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 124)
- contents.font.size = 17
- draw_text(x, y, 30, line_height, Vocab::hp_a)
- draw_max_values(x + 12, y, width, actor.mhp, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Draw MP
- #--------------------------------------------------------------------------
- def draw_actor_mp(actor, x, y, width = 124)
- contents.font.size = 17
- draw_text(x, y, 30, line_height, Vocab::mp_a)
- draw_max_values(x + 22, y, width, actor.mmp, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(x, y, param_id)
- draw_param_name(x + 4, y, 2)
- draw_current_param(x + 46, y, 2) if @actor
- draw_param_name(x + 4, y + 18, 3)
- draw_current_param(x + 46, y + 18, 3) if @actor
- draw_param_name(x + 4, y + 36, 6)
- draw_current_param(x + 46, y + 36, 6) if @actor
- draw_param_name(x + 112, y, 4)
- draw_current_param(x + 164, y, 4) if @actor
- draw_param_name(x + 112, y + 18, 5)
- draw_current_param(x + 164, y + 18, 5) if @actor
- draw_param_name(x + 112, y + 36, 7)
- draw_current_param(x + 164, y + 36, 7) if @actor
- end
- #--------------------------------------------------------------------------
- # * Draw Parameter Name
- #--------------------------------------------------------------------------
- def draw_param_name(x, y, param_id)
- contents.font.size = 17
- change_color(normal_color)
- draw_text(x, y, 80, line_height, Vocab::param(param_id))
- end
- #--------------------------------------------------------------------------
- # * Draw Current Parameter
- #--------------------------------------------------------------------------
- def draw_current_param(x, y, param_id)
- contents.font.size = 17
- change_color(normal_color)
- draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
- end
- #--------------------------------------------------------------------------
- # * Draw actor ability points
- #--------------------------------------------------------------------------
- def draw_ability_points(actor, x, y)
- contents.font.size = 20
- draw_text(356, 4, 100, 20, " Ability Points :")
- draw_text(374, 24, 40, 20, actor.ability_points.to_s, 1)
- end
- #--------------------------------------------------------------------------
- # * Draw actor accessory
- #--------------------------------------------------------------------------
- def draw_actor_accessory(actor, x, y)
- contents.font.size = 20
- draw_text(346, 50, 120, line_height, " Equipped Accessory : ")
- draw_item_name(actor.equips[4], 322, 72)
- end
- #--------------------------------------------------------------------------
- # * Draw Item Name
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, width = 172)
- return unless item
- contents.font.size = 17
- change_color(normal_color, enabled)
- draw_text(x, y, width, line_height, item.name)
- end
- end
- #===============================================================================
- # ** Window_AbilityCategory
- #-------------------------------------------------------------------------------
- # This class handle the category_name for the Ability system
- #===============================================================================
- class Window_AbilityCategory < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 240, 60, 40)
- self.contents.font.size = 19
- end
- end
- #===============================================================================
- # ** Window_AbilityAdds
- #-------------------------------------------------------------------------------
- # This class handle the lvl, stats & skill added by the Ability system
- #===============================================================================
- class Window_AbilityAdds < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 100, 120)
- self.contents.font.size = 17
- @actor = nil
- @temp_actor = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.draw_text(22, 0, 100, 20, "Nv.")
- self.contents.draw_text(4, 14, 100, 20, "Nv suivant:")
- self.contents.draw_text(14, 66, 100, 20, "Skills:")
- end
- #--------------------------------------------------------------------------
- # * Set Temporary Actor After Equipment Change
- #--------------------------------------------------------------------------
- def set_temp_actor(temp_actor)
- return if @temp_actor == temp_actor
- @temp_actor = temp_actor
- refresh
- end
- end
- #==============================================================================
- # ** Window_Ability_Command
- #------------------------------------------------------------------------------
- # This class perform the Command Window for the Ability System
- #==============================================================================
- class Window_Ability_Command < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(115, 295)
- self.contents.font.size = 20
- self.opacity = 0
- self.back_opacity = 0
- cursor_rect.empty
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 150
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- end
- #--------------------------------------------------------------------------
- # * Processing When Cancel Button Is Pressed
- #--------------------------------------------------------------------------
- def process_cancel
- Sound.play_cancel
- Input.update
- deactivate
- call_cancel_handler
- cursor_rect.empty
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- clear_command_list
- make_command_list
- cursor_rect.empty
- self.arrows_visible = false
- super
- end
- end
- #==============================================================================
- # ** Window_Ability_Confirmation
- #------------------------------------------------------------------------------
- # This class perform the Confirmation Window for the Ability System
- #==============================================================================
- class Window_Ability_Confirmation < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(118,126,300,120)
- self.contents.font.size = 23
- self.z = 500
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- draw_text(28, 28, 230, 24, " Ajouter un point à cette catégorie ?")
- end
- end
- #==============================================================================
- # ** Window_Ability_ChoiceList
- #------------------------------------------------------------------------------
- # This window is used for showing choices on Ability Confirmation Window
- #==============================================================================
- class Window_Ability_ChoiceList < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(196, 190)
- self.opacity = 0
- self.back_opacity = 0
- self.z = 501
- self.openness = 0
- deactivate
- end
- #--------------------------------------------------------------------------
- # * Start Input Processing
- #--------------------------------------------------------------------------
- def start
- update_placement
- refresh
- select(0)
- open
- activate
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.width = 160
- self.height = 80
- end
- #--------------------------------------------------------------------------
- # * Get Maximum Width of Choices
- #--------------------------------------------------------------------------
- def max_choice_width
- $game_message.choices.collect {|s| text_size(s).width }.max
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command("Oui", :oui)
- add_command("Non", :non)
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- if current_item_enabled?
- Input.update
- deactivate
- call_ok_handler
- else
- Sound.play_buzzer
- end
- end
- end
- #===============================================================================
- # ** Window_AbilityAddedStats
- #-------------------------------------------------------------------------------
- # This class perform the window for the Added Stats of the Ability system
- #===============================================================================
- class Window_Ability_AddedStats < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(22, 6, 500, 120)
- self.contents.font.size = 17
- self.opacity = 0
- self.back_opacity = 0
- @actor = nil
- @temp_actor = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 4
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_added_stats(@actor, 180, 20) if @actor
- end
- #--------------------------------------------------------------------------
- # * Set Temporary Actor After Equipment Change
- #--------------------------------------------------------------------------
- def set_temp_actor(temp_actor)
- return if @temp_actor == temp_actor
- @temp_actor = temp_actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Draw Plus
- #--------------------------------------------------------------------------
- def draw_plus(x, y)
- draw_text(x, y, 22, line_height, "+", 1)
- end
- #--------------------------------------------------------------------------
- # * Draw Added Stats
- #--------------------------------------------------------------------------
- def draw_added_stats(actor, x, y)
- case $game_temp.ability_index
- when 0
- change_color(hp_gauge_color1)
- 3.times do |i|
- draw_plus(172, 20 + 18 * i)
- end
- draw_text(x, y, 30, line_height, actor.augmentation[0].to_s, 1)
- draw_text(x, y + 18, 30, line_height, actor.augmentation[2].to_s, 1)
- draw_text(x, y + 36, 30, line_height, actor.augmentation[3].to_s, 1)
- when 1
- change_color(normal_color)
- 2.times do |i|
- draw_plus(290, 20 + 18 * i)
- end
- draw_plus(172, 20)
- draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
- draw_text(x, y, 30, line_height, actor.augmentation[0].to_s, 1)
- draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
- when 2
- change_color(mp_cost_color)
- 3.times do |i|
- draw_plus(290, 20 + 18 * i)
- end
- draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
- draw_text(x + 118, y + 36, 30, line_height, actor.augmentation[5].to_s, 1)
- draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
- when 3
- change_color(power_up_color)
- 3.times do |i|
- draw_plus(290, 20 + 18 * i)
- end
- draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
- draw_text(x + 118, y + 36, 30, line_height, actor.augmentation[5].to_s, 1)
- draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
- end
- end
- end
- #==============================================================================
- # ** Window_AbilitySkillList
- #------------------------------------------------------------------------------
- # This window is for displaying a list of available skills on the skill window.
- #==============================================================================
- class Window_AbilitySkillList < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, index)
- super(x, y, 100, 20)
- self.contents.font.size = 12
- @actor = nil
- @temp_actor = nil
- @index = index
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Number of Lines to Show
- #--------------------------------------------------------------------------
- def visible_line_number
- return 3
- end
- #--------------------------------------------------------------------------
- # * Set Actor
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- return unless @actor
- for i in 0...@actor.ability_new_skills_id[@index].size
- if @actor.ability_level[@index] == @actor.ability_new_skills_level[@index][i]-1
- text = $data_skills[@actor.ability_new_skills_id[@index][i]].name
- self.contents.draw_text(2, 0, 92, 20, text)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Set Temporary Actor After Equipment Change
- #--------------------------------------------------------------------------
- def set_temp_actor(temp_actor)
- return if @temp_actor == temp_actor
- @temp_actor = temp_actor
- refresh
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement