Advertisement
Zouzaka

Pierre Stats

Feb 9th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.64 KB | None | 0 0
  1. =begin
  2. Auteur : Zouzaka
  3. Description : Ce Scripte permet de modifier les stats d'un hero grace a une
  4. pierre ou autre objet ...
  5. =end
  6. module P_Stats
  7.   # ID de l'objet requis pour modifier les stats
  8.   Pierre_id = 17
  9.   Voc_no_pierre = "Tu n'a pas la pierre"
  10. end
  11. class Scene_Pierre < Scene_Base
  12.   def start
  13.     super
  14.     create_background
  15.     creat_window_help
  16.     creat_window_choix_actor
  17.     creat_window_stone
  18.   end
  19.   def update
  20.     super
  21.     @stone_window.contents.clear
  22.     @stone_window.contents.draw_text(0,0,200,50,"#{$game_party.item_number($data_items[P_Stats::Pierre_id])} #{$data_items[P_Stats::Pierre_id].name}")
  23.     if Input.trigger?(:B)
  24.       if @window_actors.open?
  25.         SceneManager.return
  26.       else @window_choix.open?
  27.         @window_choix.close
  28.         @window_info.close
  29.         @window_actors.open
  30.         @window_actors.activate
  31.       end
  32.     end
  33.   end
  34.   def create_background
  35.     @background_sprite = Sprite.new
  36.     @background_sprite.bitmap = SceneManager.background_bitmap
  37.     @background_sprite.color.set(16, 16, 16, 128)
  38.   end
  39.   def creat_window_choix
  40.     @window_choix = Window_Choix.new(0,@window_help.height)
  41.     @window_choix.set_handler(:sym,      method(:cmd_change))
  42.   end
  43.   def creat_window_hero_info
  44.     @window_info = Window_Base.new(@window_choix.width,@window_help.height,Graphics.width - @window_choix.width,Graphics.height-(@window_help.height + @stone_window.height))
  45.     @window_info.draw_actor_face(@hero_selected, 10, 10)
  46.     @window_info.draw_actor_hp(@hero_selected, 114, 10)
  47.     @window_info.draw_actor_mp(@hero_selected, 114, 30)
  48.     6.times {|i| @window_info.draw_actor_param(@hero_selected, 10, 120+(i*25), i + 2) }
  49.   end
  50.   def window_hero_info_refresh
  51.     @window_info.contents.clear
  52.     @window_info.draw_actor_face(@hero_selected, 10, 10)
  53.     @window_info.draw_actor_hp(@hero_selected, 114, 10)
  54.     @window_info.draw_actor_mp(@hero_selected, 114, 30)
  55.     6.times {|i| @window_info.draw_actor_param(@hero_selected, 10, 120+(i*25), i + 2) }
  56.   end
  57.   def creat_window_help
  58.     @window_help = Window_Help.new(1)
  59.     @window_help.set_text("Menu de Spécialisation")
  60.   end
  61.   def creat_window_choix_actor
  62.     @window_actors = Window_Choix_Actor.new(350,50)
  63.     @window_actors.x = Graphics.width - @window_actors.width
  64.     @window_actors.y = @window_help.height
  65.     @window_actors.set_handler(:hero,      method(:cmd_hero))
  66.   end
  67.   #Commands Select Actor ...
  68.   def cmd_hero
  69.     @hero_selected = $game_party.battle_members[@window_actors.index]
  70.     creat_window_choix
  71.     creat_window_hero_info
  72.     @window_actors.close
  73.   end
  74.   #Commands Params
  75.   def cmd_change
  76.     if $game_party.item_number($data_items[P_Stats::Pierre_id]) >= 1
  77.       $game_party.gain_item($data_items[P_Stats::Pierre_id], -1)
  78.       $game_actors[@hero_selected.id].add_param(@window_choix.index, 10) if @window_choix.index <= 1
  79.       $game_actors[@hero_selected.id].add_param(@window_choix.index, 3) if @window_choix.index >= 2
  80.       @window_help.set_text(Vocab.param(@window_choix.index)+" Augmenté")
  81.       @window_choix.activate
  82.       window_hero_info_refresh
  83.     else
  84.       @window_help.set_text(P_Stats::Voc_no_pierre)
  85.       @window_choix.activate
  86.     end
  87.   end
  88.   def creat_window_stone
  89.     @stone_window = Window_Base.new(Graphics.width-250,Graphics.height-60,250,60)
  90.   end
  91. end
  92. class Window_Choix < Window_Command
  93.   def window_width
  94.     return 200
  95.   end
  96.   def make_command_list
  97.     8.times{|vo| add_command("Ajouter "+Vocab.param(vo),   :sym)}
  98.   end
  99. end
  100. class Window_Choix_Actor < Window_Command
  101.   def make_command_list
  102.     $game_party.battle_members.each{|actor| add_command(actor.name,   :hero)}
  103.   end
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement