#==============================================================================
# Scene_Learn : Apprentissage d'une compétence
#------------------------------------------------------------------------------
# Créé par Raven -
ravenevans@hotmail.com pour RPG Creative
# Date: 16/02/07
#==============================================================================
class Window_LearnHelp < Window_Base
#--------------------------------------------------------------------------
# ● Création de la fenêtre
# skill_index : Id du Skill
#--------------------------------------------------------------------------
def initialize(skill_index = 0)
super(120, 75, 400, 70)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = 'Arial'
self.contents.font.size = 20
skill = $data_skills[skill_index]
text = skill.description
sp = skill.sp_cost.to_s
@text = text + " - MP : " + sp
refresh
end
#--------------------------------------------------------------------------
# ● Affichage du titre
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 500, 40, @text)
end
end
class Window_LearnName < Window_Base
#--------------------------------------------------------------------------
# ● Création de la fenêtre
# skill_index : Id du Skill
#--------------------------------------------------------------------------
def initialize(skill_index = 0)
super(170, 10, 300, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = 'Arial'
self.contents.font.size = 22
@skill = $data_skills[skill_index]
text = @skill.name
@text = text
refresh
end
#--------------------------------------------------------------------------
# ● Affichage du titre
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.icon(@skill.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(34, 0, 300, 30, @text)
end
end
class Scene_Learn
#--------------------------------------------------------------------------
# ● Initialisation
# skill_index : Id du Skill
#--------------------------------------------------------------------------
def initialize(skill_index = 0)
@skill_index = skill_index
end
#--------------------------------------------------------------------------
# ● Principal
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@help_window = Window_LearnHelp.new(@skill_index)
@name_window = Window_LearnName.new(@skill_index)
list=[]
for i in 0..$game_party.actors.size - 1
actor = $game_party.actors[i]
list.push(actor.name)
end
@command_window = Window_Command.new(200, list)
@help_window.opacity = 170
@name_window.opacity = 170
@command_window.opacity = 170
@command_window.active = true
@command_window.index = 0
@command_window.x = 220
@command_window.y = 180
Graphics.transition
if $game_party.actors.size == 0
$scene = Scene_Map.new
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@name_window.dispose
@command_window.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
# ● Mise à jour
#--------------------------------------------------------------------------
def update
@help_window.update
@name_window.update
@command_window.update
if Input.trigger?(Input::B)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.shop_se)
$game_party.actors[@command_window.index].learn_skill(@skill_index)
$scene = Scene_Map.new
end
end
end