Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 22nd, 2011  |  syntax: Ruby  |  size: 26.05 KB  |  hits: 606  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #==============================================================================
  2. # * Módulo Lums V 1.0
  3. #------------------------------------------------------------------------------
  4. #  COnfigure the lum system here
  5. #==============================================================================
  6.  
  7. module Lums
  8.  
  9. #------------------------------------------------------------------------------
  10. # * The main part of elements
  11. #-----------------------------------------------------------------------------
  12. # element id => "Element's name",
  13. #------------------------------------------------------------------------------  
  14.  
  15.   ELEMENT_NAMES = {
  16.  
  17.   1=>"Water",
  18.   2=>"Fire",
  19.   }
  20.  
  21. #------------------------------------------------------------------------------
  22. # * ELEMENT ICON
  23. # element id => text color(from windowskin);
  24. #-----------------------------------------------------------------------------
  25.  
  26.   ELEMENT_COLORS = {
  27.  
  28.   1=>3,
  29.   2=>1,
  30.  
  31.   }
  32.  
  33. #------------------------------------------------------------------------------
  34. # * ELEMENT ICON
  35. # element id => icon index;
  36. #-----------------------------------------------------------------------------  
  37.  
  38.   ELEMENT_ICON = {
  39.  
  40.   -1=>0,
  41.   1=>55,
  42.   2=>56,
  43.  
  44.   }
  45.  
  46.  
  47. #------------------------------------------------------------------------------
  48. # * Class change for lums:
  49. # class id => {element id 1 => lums needed, element id 2 => lums needed, etc}
  50. #-----------------------------------------------------------------------------    
  51.  
  52.   CLASS_CHANGE = {
  53.  
  54.   2 => {1=>1},
  55.   3 => {2=>1},
  56.  
  57.   }
  58.  
  59. #------------------------------------------------------------------------------
  60. # * When someone exchanges Lums, renew the class's skills ?
  61. #-----------------------------------------------------------------------------      
  62.  
  63.   RENEW_SKILLS = true
  64.  
  65.  
  66. #------------------------------------------------------------------------------
  67. # * Name for the Lums (Singular)
  68. #-----------------------------------------------------------------------------  
  69.  
  70.   LUM_NAME   = "Lum"
  71.  
  72. #------------------------------------------------------------------------------
  73. # * Plural name of Lums
  74. #-----------------------------------------------------------------------------  
  75.  
  76.   LUM_PLURAL = "Lums"
  77.  
  78. #------------------------------------------------------------------------------
  79. # * Text than you use in the menu and when a lum joins you
  80. #-----------------------------------------------------------------------------  
  81.  
  82.   JOIN_TEXT = "The %s with %s powers, \\c[%s]%s\\c[0]\x00 is with %s now."
  83.   HELP_CHANGE = "Choose Lum to exchange."
  84.   HELP_CHANGE2 = "Exchange for?"
  85.   HELP_CHANGE3 = "Sure? 'C' = YEAH 'B' = NO"
  86.  
  87. end
  88. </pre>
  89.  
  90. '''System'''
  91. <pre>
  92. #==============================================================================
  93. # ** Lum
  94. #------------------------------------------------------------------------------
  95. #  Contiene toda la informacion de las criaturas
  96. #==============================================================================
  97. class Lum
  98.  
  99. #------------------------------------------------------------------------------
  100. # * Publicación de variables
  101. #------------------------------------------------------------------------------  
  102.  
  103.  attr_reader :element
  104.  attr_reader :name
  105.  attr_reader :skill
  106.  attr_reader :atk
  107.  attr_reader :def
  108.  attr_reader :spi
  109.  attr_reader :agi
  110.  
  111. #------------------------------------------------------------------------------
  112. # * Inicio de objetos
  113. #------------------------------------------------------------------------------
  114.  
  115.  def initialize(element,name,skill,atk,df,spi,agi)
  116.    @element = element
  117.    @name    = name
  118.    @skill   = skill
  119.    @atk     = atk
  120.    @def     = df
  121.    @spi     = spi
  122.    @agi     = agi
  123.  end
  124.  
  125. end  
  126.  
  127. #==============================================================================
  128. # ** Game_Actor
  129. #------------------------------------------------------------------------------
  130. #  Contiene toda la información sobre los Actores
  131. #==============================================================================
  132.  
  133. class Game_Actor < Game_Battler
  134.  
  135.   #--------------------------------------------------------------------------
  136.   # * Publicación de variables
  137.   #--------------------------------------------------------------------------
  138.  
  139.   attr_accessor :lums
  140.   attr_reader   :org_class_id                 # class ID
  141.   #--------------------------------------------------------------------------
  142.   # * Metodos con alias
  143.   #--------------------------------------------------------------------------  
  144.  
  145.   alias ramiro_lum_game_actor_setup setup
  146.   alias ramiro_lum_base_atk base_atk
  147.   alias ramiro_lum_base_def base_def
  148.   alias ramiro_lum_base_spi base_spi
  149.   alias ramiro_lum_base_agi base_agi
  150.   alias ramiro_lum_learned skill_learn?
  151.  
  152.   #--------------------------------------------------------------------------
  153.   # * Iicio del actor
  154.   #--------------------------------------------------------------------------  
  155.  
  156.   def setup(actor_id)
  157.     @lums = []
  158.     ramiro_lum_game_actor_setup(actor_id)
  159.     @org_class_id = @class_id
  160.   end
  161.  
  162.   #--------------------------------------------------------------------------
  163.   # * Determine if Finished Learning Skill
  164.   #     skill : skill
  165.   #--------------------------------------------------------------------------
  166.   def skill_learn?(skill)
  167.     value = ramiro_lum_learned(skill)
  168.     for lum in @lums
  169.       value = true if lum.skill == skill.id
  170.     end  
  171.     return value
  172.   end  
  173.  
  174.   #--------------------------------------------------------------------------
  175.   # * Get Basic Attack
  176.   #--------------------------------------------------------------------------
  177.   def base_atk
  178.     plus = 0
  179.     for lum in @lums.compact do plus += lum.atk end
  180.     return ramiro_lum_base_atk + plus
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # * Get Basic Defense
  184.   #--------------------------------------------------------------------------
  185.   def base_def
  186.     plus = 0
  187.     for lum in @lums.compact do plus += lum.def end
  188.     return ramiro_lum_base_def + plus    
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # * Get Basic Spirit
  192.   #--------------------------------------------------------------------------
  193.   def base_spi
  194.     plus = 0
  195.     for lum in @lums.compact do plus += lum.spi end
  196.     return ramiro_lum_base_spi + plus    
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # * Get Basic Agility
  200.   #--------------------------------------------------------------------------
  201.   def base_agi
  202.     plus = 0
  203.     for lum in @lums.compact do plus += lum.agi end
  204.     return ramiro_lum_base_agi + plus    
  205.   end  
  206.  
  207.   #--------------------------------------------------------------------------
  208.   # * Añadir un lum al Actor
  209.   #--------------------------------------------------------------------------  
  210.  
  211.   def add_lum(lum)
  212.     @lums.push(lum)
  213.   end
  214.  
  215.   #--------------------------------------------------------------------------
  216.   # * Determine Usable Skills
  217.   #     skill : skill
  218.   #--------------------------------------------------------------------------
  219.   def lum_can_use?(skill)
  220.     return false unless skill.is_a?(RPG::Skill)
  221.     return false unless movable?
  222.     return false if silent? and skill.spi_f > 0
  223.     return false if (calc_mp_cost(skill) > mp)
  224.     if $game_temp.in_battle
  225.       return skill.battle_ok?
  226.     else
  227.       return skill.menu_ok?
  228.     end
  229.   end  
  230.  
  231.   #--------------------------------------------------------------------------
  232.   # * Fits the actor to a new class
  233.   #--------------------------------------------------------------------------  
  234.  
  235.   def fit_class
  236.     total = {}
  237.     for lum in @lums
  238.       total[lum.element] = 0 if total[lum.element] == nil
  239.       total[lum.element] += 1
  240.     end  
  241.  
  242.     for key in Lums::CLASS_CHANGE.keys
  243.      get = Lums::CLASS_CHANGE[key]
  244.      if get.keys == total.keys and get.values == total.values
  245.        @class_id = key
  246.        break
  247.        return
  248.      end
  249.        @class_id = @org_class_id
  250.     end
  251.  
  252.     if Lums::RENEW_SKILLS
  253.       @skills = []
  254.       for i in self.class.learnings
  255.         learn_skill(i.skill_id) if i.level <= @level
  256.       end    
  257.     end
  258.  
  259.   end
  260.  
  261. end  
  262.  
  263. #==============================================================================
  264. # ** Game_party
  265. #------------------------------------------------------------------------------
  266. #  Contiene informacion sobre  el grupo de actores
  267. #==============================================================================
  268.  
  269. class Game_Party < Game_Unit
  270.   include Lums
  271.   #--------------------------------------------------------------------------
  272.   # * Adds automatically a Lum to the party
  273.   #--------------------------------------------------------------------------  
  274.   def join_lum(lum)
  275.     size = -1
  276.     memeb = members.sort {|a,b| a.lums.size<=>b.lums.size }
  277.     memeb[0].add_lum(lum)
  278.     $game_message.texts  =  []
  279.     $game_message.texts.push(sprintf(JOIN_TEXT,
  280.     LUM_NAME,
  281.     ELEMENT_NAMES[lum.element],
  282.     ELEMENT_COLORS[lum.element], lum.name,
  283.     memeb[0].name))
  284.     $game_message.face_name   = memeb[0].face_name        
  285.     $game_message.face_index  = memeb[0].face_index    
  286.     memeb[0].fit_class
  287.   end  
  288.  
  289.   def max_lums
  290.     memeb = members.sort {|a,b| b.lums.size<=>a.lums.size }
  291.     return memeb[0].lums.size
  292.   end
  293.  
  294. end  
  295.  
  296. #==============================================================================
  297. # ** Scene_Battle
  298. #------------------------------------------------------------------------------
  299. #  This class performs battle screen processing.
  300. #==============================================================================
  301.  
  302. class Scene_Battle < Scene_Base
  303.   #--------------------------------------------------------------------------
  304.   # * Update Actor Command Selection
  305.   #--------------------------------------------------------------------------
  306.   def update_actor_command_selection
  307.     if Input.trigger?(Input::B)
  308.       Sound.play_cancel
  309.       prior_actor
  310.     elsif Input.trigger?(Input::C)
  311.       case @actor_command_window.commands[@actor_command_window.index]
  312.       when  Vocab::attack  # Attack
  313.         Sound.play_decision
  314.         @active_battler.action.set_attack
  315.         start_target_enemy_selection
  316.       when Vocab::skill, @active_battler.class.skill_name  # Skill
  317.         Sound.play_decision
  318.         start_skill_selection
  319.       when Vocab::guard  # Guard
  320.         Sound.play_decision
  321.         @active_battler.action.set_guard
  322.         next_actor
  323.       when Vocab::item  # Item
  324.         Sound.play_decision
  325.         start_item_selection
  326.       when Lums::LUM_PLURAL  # Lums
  327.         Sound.play_decision
  328.         start_lum_selection        
  329.       end
  330.     end
  331.   end  
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # * Start Lum Selection
  335.   #--------------------------------------------------------------------------
  336.   def start_lum_selection  
  337.     @help_window = Window_Help.new
  338.     @lum_window = Window_Lums.new(0, 56, 544, 232, @active_battler)
  339.     @lum_window.help_window = @help_window
  340.     @actor_command_window.active = false
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # * End Lum Selection
  344.   #--------------------------------------------------------------------------
  345.   def end_lum_selection  
  346.     if @lum_window != nil
  347.       @lum_window.dispose
  348.       @lum_window = nil
  349.       @help_window.dispose
  350.       @help_window = nil
  351.     end
  352.     @actor_command_window.active = true
  353.   end  
  354.  
  355.   #--------------------------------------------------------------------------
  356.   # * Update Skill Selection
  357.   #--------------------------------------------------------------------------
  358.   def update_lum_selection
  359.     @lum_window.active = true
  360.     @lum_window.update
  361.     @help_window.update
  362.     if Input.trigger?(Input::B)
  363.       Sound.play_cancel
  364.       end_lum_selection
  365.     elsif Input.trigger?(Input::C)
  366.       @skill = @lum_window.skill
  367.       if @active_battler.lum_can_use?(@skill)
  368.         Sound.play_decision
  369.         determine_lum
  370.       else
  371.         Sound.play_buzzer
  372.       end
  373.     end
  374.   end    
  375.  
  376.   #--------------------------------------------------------------------------
  377.   # * Frame Update
  378.   #--------------------------------------------------------------------------
  379.   def update
  380.     super
  381.     update_basic(true)
  382.     update_info_viewport                  # Update information viewport
  383.     if $game_message.visible
  384.       @info_viewport.visible = false
  385.       @message_window.visible = true
  386.     end
  387.     unless $game_message.visible          # Unless displaying a message
  388.       return if judge_win_loss            # Determine win/loss results
  389.       update_scene_change
  390.       if @target_enemy_window != nil
  391.         update_target_enemy_selection     # Select target enemy
  392.       elsif @target_actor_window != nil
  393.         update_target_actor_selection     # Select target actor
  394.       elsif @lum_window != nil  
  395.         update_lum_selection            # Select lum
  396.       elsif @skill_window != nil
  397.         update_skill_selection            # Select skill
  398.       elsif @item_window != nil
  399.         update_item_selection             # Select item
  400.       elsif @party_command_window.active
  401.         update_party_command_selection    # Select party command
  402.       elsif @actor_command_window.active
  403.         update_actor_command_selection    # Select actor command
  404.       else
  405.         process_battle_event              # Battle event processing
  406.         process_action                    # Battle action
  407.         process_battle_event              # Battle event processing
  408.       end
  409.     end
  410.   end  
  411.  
  412.   #--------------------------------------------------------------------------
  413.   # * Confirm Lum
  414.   #--------------------------------------------------------------------------
  415.   def determine_lum
  416.     @active_battler.action.set_skill(@skill.id)
  417.     @lum_window.active = false
  418.     if @skill.need_selection?
  419.       if @skill.for_opponent?
  420.         start_target_enemy_selection
  421.       else
  422.         start_target_actor_selection
  423.       end
  424.     else
  425.       end_lum_selection
  426.       next_actor
  427.     end
  428.   end
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # * Update Target Enemy Selection
  432.   #--------------------------------------------------------------------------
  433.   def update_target_enemy_selection
  434.     @target_enemy_window.update
  435.     if Input.trigger?(Input::B)
  436.       Sound.play_cancel
  437.       end_target_enemy_selection
  438.     elsif Input.trigger?(Input::C)
  439.       Sound.play_decision
  440.       @active_battler.action.target_index = @target_enemy_window.enemy.index
  441.       end_target_enemy_selection
  442.       end_skill_selection
  443.       end_item_selection
  444.       end_lum_selection
  445.       next_actor
  446.     end
  447.   end    
  448.  
  449. end
  450.  
  451. #==============================================================================
  452. # ** Window_ActorCommand
  453. #------------------------------------------------------------------------------
  454. #  This window is used to select actor commands, such as "Attack" or "Skill".
  455. #==============================================================================
  456.  
  457. class Window_ActorCommand < Window_Command
  458.   attr_accessor :commands
  459.   #--------------------------------------------------------------------------
  460.   # * Object Initialization
  461.   #--------------------------------------------------------------------------
  462.   def initialize
  463.     super(128, [], 1, 4)
  464.     self.active = false
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # * Setup
  468.   #     actor : actor
  469.   #--------------------------------------------------------------------------
  470.   def setup(actor)
  471.     s1 = Vocab::attack
  472.     s2 = Vocab::skill
  473.     s3 = Vocab::guard
  474.     s4 = Vocab::item
  475.     if actor.class.skill_name_valid     # Skill command name is valid?
  476.       s2 = actor.class.skill_name       # Replace command name
  477.     end
  478.     @commands = [s1, s2, s3, s4]
  479.     @commands.push(Lums::LUM_PLURAL) if actor.lums.size > 0
  480.     @item_max = @commands.size
  481.     create_contents
  482.     refresh
  483.     self.index = 0
  484.   end
  485. end
  486.  
  487. #==============================================================================
  488. # ** Window_Lums
  489. #------------------------------------------------------------------------------
  490. #  Muestra las habilidades de los lums
  491. #==============================================================================
  492.  
  493. class  Window_Lums < Window_Selectable
  494.   #--------------------------------------------------------------------------
  495.   # * Object Initialization
  496.   #     x      : window x-coordinate
  497.   #     y      : window y-coordinate
  498.   #     width  : window width
  499.   #     height : window height
  500.   #     actor  : actor
  501.   #--------------------------------------------------------------------------
  502.   def initialize(x, y, width, height, actor)
  503.     super(x, y, width, height)
  504.     @actor = actor
  505.     @column_max = 2
  506.     self.index = 0
  507.     refresh
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # * Get Skill
  511.   #--------------------------------------------------------------------------
  512.   def skill
  513.     return @data[self.index]
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # * Refresh
  517.   #--------------------------------------------------------------------------
  518.   def refresh
  519.     @data = []
  520.     skills = []
  521.     for lum in @actor.lums
  522.       skills.push($data_skills[lum.skill])
  523.     end
  524.     for skill in skills
  525.       @data.push(skill)
  526.       if skill.id == @actor.last_skill_id
  527.         self.index = @data.size - 1
  528.       end
  529.     end
  530.     @item_max = @data.size
  531.     create_contents
  532.     for i in 0...@item_max
  533.       draw_item(i)
  534.     end
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # * Draw Item
  538.   #     index : item number
  539.   #--------------------------------------------------------------------------
  540.   def draw_item(index)
  541.     rect = item_rect(index)
  542.     self.contents.clear_rect(rect)
  543.     skill = @data[index]
  544.     if skill != nil
  545.       rect.width -= 4
  546.       enabled = @actor.lum_can_use?(skill)
  547.       draw_item_name(skill, rect.x, rect.y, enabled)
  548.       self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
  549.     end
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # * Update Help Text
  553.   #--------------------------------------------------------------------------
  554.   def update_help
  555.     @help_window.set_text(skill == nil ? "" : skill.description)
  556.   end  
  557.  
  558.  
  559.  
  560. end
  561.  
  562. #==============================================================================
  563. # ** Window_ActorLum
  564. #------------------------------------------------------------------------------
  565. #  Controla a los actores
  566. #==============================================================================
  567.  
  568. class Window_ActorLum < Window_Selectable
  569.   def initialize
  570.     super(0,56+WLH,544,WLH+32)
  571.     self.back_opacity = 0
  572.     self.opacity = 0
  573.     self.index = 0
  574.     self.active = true
  575.     @column_max = 4
  576.     @item_max = $game_party.members.size
  577.     refresh
  578.   end
  579.  
  580.   def refresh
  581.     contents.font.size = 16
  582.     for i in 0...@item_max
  583.       rect = item_rect(i)
  584.       actor = $game_party.members[i]
  585.       draw_actor_graphic(actor,rect.x+16,rect.y+32)
  586.       contents.draw_text(rect.x+32,rect.y,rect.width-32,rect.height,actor.name,1)
  587.     end
  588.   end
  589.  
  590. end
  591.  
  592.  
  593. #==============================================================================
  594. # ** Window_LumControl
  595. #------------------------------------------------------------------------------
  596. #  Controla a los lums
  597. #==============================================================================
  598.  
  599. class Window_LumControl < Window_Selectable
  600.   def initialize(actor)
  601.     super(actor.index * (544 / 4),56*2,(544 / 4),416-(WLH*2+64))
  602.     self.back_opacity = 0
  603.     self.opacity = 0
  604.     self.active = false
  605.     self.index = 0
  606.     @column_max = 1
  607.     @actor = actor
  608.     @item_max = $game_party.max_lums
  609.     refresh
  610.   end    
  611.  
  612.   def refresh
  613.     @item_max = $game_party.max_lums
  614.     contents.font.size = 16
  615.     self.contents.clear
  616.     for i in 0...@actor.lums.size
  617.       lum = @actor.lums[i]
  618.       next if !lum
  619.       x = 0
  620.       y = i * WLH
  621.       draw_icon(Lums::ELEMENT_ICON[lum.element],x,y)
  622.       contents.draw_text(x+32,y,contents.width-32,WLH,lum.name,1)
  623.     end
  624.   end
  625.  
  626. end
  627.  
  628. #==============================================================================
  629. # ** Window_LumExchange
  630. #------------------------------------------------------------------------------
  631. #  Muestra que Lums se intercambian
  632. #==============================================================================
  633.  
  634. class Window_LumExchange < Window_Base
  635.   def initialize(actor1,actor2,old_lum,new_lum)
  636.     super(0,56,544,416-56)
  637.     @actor1      = actor1
  638.     @actor2      = actor2
  639.     @actor1_lum  = old_lum
  640.     @actor2_lum  = new_lum
  641.     refresh
  642.   end    
  643.  
  644.   def refresh
  645.     self.contents.clear
  646.     x = 0
  647.     y = 0
  648.     draw_actor_changes(@actor1,@actor1_lum,@actor2_lum,x,y+32)
  649.     x += contents.width / 2
  650.     draw_actor_changes(@actor2,@actor2_lum,@actor1_lum,x,y+32)
  651.  
  652.   end
  653.  
  654.   def draw_actor_changes(actor,lum_less,lum_more,x,y)
  655.  
  656.     if lum_less == nil
  657.       lum_less = Lum.new(-1,"",0,0,0,0,0)
  658.     end
  659.  
  660.     if lum_more == nil
  661.       lum_more = Lum.new(-1,"",0,0,0,0,0)
  662.     end    
  663.  
  664.  
  665.     self.contents.font.color = normal_color
  666.  
  667.     draw_actor_face(actor,x,y)
  668.     draw_actor_name(actor,x+96,y+32*2)
  669.  
  670.     self.contents.font.color = system_color
  671.  
  672.     self.contents.draw_text(x,  y+96+WLH    ,96,WLH,Vocab.atk)
  673.     self.contents.draw_text(x,  y+96+WLH*2  ,96,WLH,Vocab.def)
  674.     self.contents.draw_text(x,  y+96+WLH*3  ,96,WLH,Vocab.spi)
  675.     self.contents.draw_text(x,  y+96+WLH*4  ,96,WLH,Vocab.agi)
  676.  
  677.     self.contents.font.color = normal_color
  678.     x += 96
  679.  
  680.     self.contents.draw_text(x,  y+96+WLH,   96,WLH,actor.atk)
  681.     self.contents.draw_text(x,  y+96+WLH*2, 96,WLH,actor.def)
  682.     self.contents.draw_text(x,  y+96+WLH*3, 96,WLH,actor.spi)
  683.     self.contents.draw_text(x,  y+96+WLH*4, 96,WLH,actor.agi)
  684.  
  685.     self.contents.font.color = system_color
  686.     x += 64
  687.  
  688.     self.contents.draw_text(x,y+96+WLH,     96,WLH,"->")
  689.     self.contents.draw_text(x,y+96+WLH*2,   96,WLH,"->")
  690.     self.contents.draw_text(x,y+96+WLH*3,   96,WLH,"->")
  691.     self.contents.draw_text(x,y+96+WLH*4,   96,WLH,"->")    
  692.  
  693.     self.contents.font.color = normal_color
  694.     x += 32
  695.  
  696.     new_atk = actor.atk+lum_more.atk-lum_less.atk
  697.     new_def = actor.def+lum_more.def-lum_less.def
  698.     new_spi = actor.spi+lum_more.spi-lum_less.spi
  699.     new_agi = actor.agi+lum_more.agi-lum_less.agi
  700.  
  701.     renew_colour(actor.atk,new_atk)
  702.     self.contents.draw_text(x,y+96+WLH,   96,WLH,new_atk)
  703.     renew_colour(actor.def,new_def)
  704.     self.contents.draw_text(x,y+96+WLH*2, 96,WLH,new_def)
  705.     renew_colour(actor.spi,new_spi)
  706.     self.contents.draw_text(x,y+96+WLH*3, 96,WLH,new_spi)
  707.     renew_colour(actor.agi,new_agi)
  708.     self.contents.draw_text(x,y+96+WLH*4, 96,WLH,new_agi)
  709.  
  710.     self.contents.font.color = normal_color
  711.  
  712.   end
  713.  
  714.   def renew_colour(old,new)
  715.     if (old > new)
  716.       contents.font.color = knockout_color
  717.     elsif (old < new)
  718.       contents.font.color = crisis_color
  719.     else
  720.       contents.font.color = normal_color
  721.     end
  722.   end
  723.  
  724. end
  725.  
  726.  
  727. #==============================================================================
  728. # ** Scene_Lums
  729. #------------------------------------------------------------------------------
  730. #  Controla a los lums
  731. #==============================================================================
  732.  
  733. class Scene_Lums < Scene_Base
  734.   include Lums
  735.   def start
  736.     @help_window = Window_Help.new
  737.     @dummy_window = Window_Base.new(0,56,544,416-56)
  738.     @lum_windows = []
  739.     for actor in $game_party.members
  740.       @lum_windows.push(Window_LumControl.new(actor))
  741.     end
  742.     @actor_window = Window_ActorLum.new
  743.     @actor_window.update
  744.     @changing = false
  745.   end
  746.  
  747.   def update
  748.     @actor_window.update
  749.     for i in 0...@lum_windows.size
  750.       @lum_windows[i].active = (@actor_window.index == i)
  751.       @lum_windows[i].update
  752.     end  
  753.     if @changing
  754.       update_change
  755.     else
  756.       update_selection
  757.     end  
  758.   end
  759.  
  760.   def update_change
  761.     @help_window.set_text(HELP_CHANGE2,1)
  762.     if Input.trigger?(Input::C)
  763.       return Sound.play_buzzer if @actor == $game_party.members[@actor_window.index]
  764.       @new_actor = $game_party.members[@actor_window.index]
  765.       @new_lum = @new_actor.lums[@lum_windows[@actor_window.index].index]      
  766.       @exchange_window = Window_LumExchange.new(@actor,@new_actor,@selected_lum,@new_lum)
  767.       while @changing
  768.         Graphics.update
  769.         Input.update
  770.         confirm_exchange
  771.       end  
  772.       @exchange_window.dispose
  773.     elsif Input.trigger?(Input::B)
  774.       Sound.play_cancel
  775.       @changing = false
  776.     end      
  777.   end
  778.  
  779.   def confirm_exchange
  780.     @help_window.set_text(HELP_CHANGE3,1)
  781.     if Input.trigger?(Input::C)
  782.       Sound.play_decision
  783.       @actor.lums.push(@new_lum)
  784.       @new_actor.lums.push(@selected_lum)
  785.       @new_actor.lums.delete(@new_lum)
  786.       @actor.lums.delete(@selected_lum)
  787.       @new_actor.lums.compact!
  788.       @actor.lums.compact!      
  789.       @changing = false    
  790.       for w in @lum_windows
  791.         w.refresh
  792.       end
  793.  
  794.       @actor = nil
  795.       @stored_index = nil
  796.       @selected_lum = nil
  797.       @new_actor = nil
  798.       @new_lum = nil
  799.  
  800.     elsif Input.trigger?(Input::B)
  801.       Sound.play_cancel
  802.       @changing = false
  803.     end
  804.   end
  805.  
  806.   def update_selection
  807.     @help_window.set_text(HELP_CHANGE,1)
  808.     if Input.trigger?(Input::C)
  809.       @changing = true
  810.       @actor = $game_party.members[@actor_window.index]
  811.       @stored_index = @actor_window.index
  812.       @selected_lum = @actor.lums[@lum_windows[@actor_window.index].index]
  813.     elsif Input.trigger?(Input::B)
  814.       Sound.play_cancel
  815.       $scene = Scene_Map.new
  816.     end  
  817.   end
  818.  
  819.   def terminate
  820.     @dummy_window.dispose
  821.     for w in @lum_windows
  822.       w.dispose
  823.     end  
  824.     @help_window.dispose
  825.     @actor_window.dispose
  826.   end  
  827.  
  828. end