IceDragon200

IEX - EmblemSystem

Jul 24th, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 47.39 KB | None | 0 0
  1. #==============================================================================#
  2. # ** IEX(Icy Engine Xelion) - Emblem System
  3. #------------------------------------------------------------------------------#
  4. # ** Created by    : IceDragon (http://www.rpgmakervx.net/)
  5. # ** Script-Status : Addon (Actors)
  6. # ** Script Type   : State Modifier
  7. # ** Date Created  : 11/??/2010 (DD/MM/YYYY)
  8. # ** Date Modified : 01/08/2011 (DD/MM/YYYY)
  9. # ** Script Tag    : IEX - Emblems System
  10. # ** Difficulty    : Hard, Lunatic
  11. # ** Version       : 1.1a
  12. #------------------------------------------------------------------------------#
  13. #==============================================================================#
  14. # ** INTRODUCTION
  15. #------------------------------------------------------------------------------#
  16. # This was my shot at replicating the TO - Knight of Lodis, emblem system.
  17. # If you have the IEX - Trait System, or BEM Passives and your wondering whats
  18. # the difference between all of them.
  19. # Passives - Are always active, the player chooses which passives to use.
  20. # Traits   - Uses a condition in order to be active, they are PRESET
  21. #            They become inactive wheb the condition isn't met.
  22. # Emblems  - Uses a condition in order to activate it self, once activated
  23. #            it stays on PERMANENTLY, unless negated.
  24. # All of these use states.
  25. #
  26. #------------------------------------------------------------------------------#
  27. #==============================================================================#
  28. # ** HOW TO USE
  29. #------------------------------------------------------------------------------#
  30. # V1.0 - Script Calls
  31. #------------------------------------------------------------------------------#
  32. #
  33. # $scene = IEX_Scene_Emblem.new(actor)
  34. # $scene = IEX_Scene_Emblem.new(member_index)
  35. # If you plan on using this, please have the latest version of the
  36. # ICY - WindowBaseExtended
  37. # ICY - HM_WindowSelectable
  38. #
  39. #------------------------------------------------------------------------------#
  40. # V1.0 - Notetags - States
  41. #------------------------------------------------------------------------------#
  42. # <emb id: eid>
  43. #  This is used to sort the Emblems on the actor, you can have multiple
  44. #  emblems with the same ID, but if there on the same actor, only the
  45. #  last one will be shown. Replace eid
  46. #
  47. # <emb condition: phrase>
  48. #  This is the name of the emblems condition. Replace phrase
  49. #
  50. # <emb states: id, id, id>
  51. #  In addition to itself, the emblem, you can have as many, but note
  52. #  If the state is already applied the new ones will be ignored.
  53. #
  54. # <emb noself>
  55. #  The emeblem will not be included with states
  56. #
  57. # <emb description> </emb description>
  58. #  Everything between these tags will go towards the items description
  59. #
  60. #------------------------------------------------------------------------------#
  61. # V1.1a - Notetags - States
  62. #------------------------------------------------------------------------------#
  63. # <emb negate: x> (or) <emb negates: x, x, x>
  64. #  Any emblem id marked by x will have its effect negated.
  65. #  NOTE: USE the EMBLEM'S ID, NOT the STATE'S ID
  66. #
  67. #------------------------------------------------------------------------------#
  68. #==============================================================================#
  69. # ** COMPATABLITIES
  70. #------------------------------------------------------------------------------#
  71. #
  72. # BEM, Yggdrasil, Probably Takentai not sure about GTBS
  73. #
  74. #------------------------------------------------------------------------------#
  75. #==============================================================================#
  76. # ** INSTALLATION
  77. #------------------------------------------------------------------------------#
  78. #
  79. # Below
  80. #  Materials
  81. #
  82. # Above
  83. #   Main
  84. #
  85. #------------------------------------------------------------------------------#
  86. #==============================================================================#
  87. # ** CHANGES
  88. #------------------------------------------------------------------------------#
  89. # ** - From Lunatic Mode
  90. # Classes
  91. #   ** Lunatic Changes
  92. #   Game_Battler
  93. #   **alias      :initialize
  94. #   **alias      :slip_damage_effect
  95. #   **alias      :attack_effect
  96. #   **alias      :skill_effect
  97. #   **alias      :item_effect
  98. #   **new-method :iex_dead?
  99. #   Game_Enemy
  100. #   **new-method :num_of_drops
  101. #   Game_Actor
  102. #   **alias      :setup
  103. #   **new-method :iex_reset_battle_cache
  104. #   **new-method :gain_emblem
  105. #   Game_Party
  106. #   **new-method :most_loot?(actor_id)
  107. #   **new-method :most_drops?(actor_id)
  108. #   Scene_Battle
  109. #   **alias      :process_victory
  110. #   **alias      :turn_end
  111. #
  112. #   RPG::State
  113. #     new-method :iex_emblem_cache
  114. #     new-method :stateIncludeSelf?
  115. #     new-method :emb_states
  116. #     new-method :emb_id
  117. #     new-method :emb_condition
  118. #     new-method :emb_description
  119. #     new-method :emb_negates
  120. #   Game_Battler
  121. #     alias      :states
  122. #     new-method :iex_check_condition
  123. #     new-method :emblem_states
  124. #     new-method :negate_emblem?(emb_id)
  125. #   Game_Enemy
  126. #     new-method :check_emblem_conditions
  127. #   Game_Actor
  128. #     alias      :setup
  129. #     new-method :valid_emblem_id
  130. #     new-method :emblems
  131. #     new-method :emblem_states
  132. #     new-method :check_emblem_conditions
  133. #   Scene_Title
  134. #     alias      :load_database
  135. #     new-method :load_emblem_database
  136. #   Game_Unit
  137. #     new-method :alive_members
  138. #
  139. #------------------------------------------------------------------------------#
  140. #==============================================================================#
  141. # ** CHANGE LOG
  142. #------------------------------------------------------------------------------#
  143. # (DD/MM/YYYY)
  144. #  11/??/2010 - V1.0  Finished Script
  145. #  12/20/2010 - V1.0  Fixed up Header
  146. #  12/26/2010 - V1.1  Changed Condition Writing - Now apart of Lunatic Section
  147. #  01/08/2011 - V1.1a Small Changes, Added Emblem Negation
  148. #
  149. #------------------------------------------------------------------------------#
  150. #==============================================================================#
  151. # ** KNOWN ISSUES
  152. #------------------------------------------------------------------------------#
  153. #  Non at the moment.
  154. #
  155. #------------------------------------------------------------------------------#
  156. $imported = {} if $imported == nil
  157. $imported["IEX_EmblemSystem"] = true
  158.  
  159. #==============================================================================
  160. # ** IEX::EMBLEM_SYSTEM
  161. #------------------------------------------------------------------------------
  162. #==============================================================================
  163. module IEX
  164.   module EMBLEM_SYSTEM
  165. #==============================================================================
  166. #                           Start Primary Customization
  167. #------------------------------------------------------------------------------
  168. #==============================================================================
  169.     TOTAL_EMBLEMS = 36
  170.   #--------------------------------------------------------------------------#
  171.   # * EMBLEM_SYS_ICONS
  172.   #--------------------------------------------------------------------------#
  173.   # :symbol => icon_index,
  174.   #--------------------------------------------------------------------------#
  175.     EMBLEM_SYS_ICONS = {
  176.       :unlockable => 6483,
  177.       :locked     => 6484,
  178.       :help       => 6422,
  179.       :name       => 1,
  180.       :class      => 1,
  181.       :emblem_num => 1,
  182.     } # Do Not Remove
  183.   #--------------------------------------------------------------------------#
  184.   # * EMBLEM_SYS_TEXT
  185.   #--------------------------------------------------------------------------#
  186.   # :symbol => 'string',
  187.   #--------------------------------------------------------------------------#
  188.     EMBLEM_SYS_TEXT = {
  189.       :locked     => "-Locked-",
  190.       :unavailable=> 'This emblem is not available',
  191.       :emblems    => "Emblems",
  192.       :help_text  => '',
  193.       :name       => 'Name',
  194.       :class      => 'Class',
  195.       :emblem_num => 'Emblem Count'
  196.     } # Do Not Remove
  197.   #--------------------------------------------------------------------------#
  198.   # * EMBLEM_SYS_COLORS
  199.   #--------------------------------------------------------------------------#
  200.   # :symbol => Color.new(red, green, blue, alpha*),
  201.   #--------------------------------------------------------------------------#  
  202.     EMBLEM_SYS_COLORS = {
  203.       :back       => Color.new(166, 124, 82, 128),
  204.       :border     => Color.new(126, 84, 42),
  205.     } # Do Not Remove
  206.   #--------------------------------------------------------------------------#
  207.   # * ACTOR_VALID_EMBLEMS
  208.   #--------------------------------------------------------------------------#
  209.   # Actor_ID => [id, id..range],
  210.   # Do not Remove Actor 0, it is the default for all unstated actors.
  211.   #--------------------------------------------------------------------------#
  212.     ACTOR_VALID_EMBLEMS = {
  213.     # Actor_ID => [x, x..y],
  214.       0 => [84..84+35], #[60..92], # Do Not Remove
  215.       1 => [84..84+19, 84+23..84+35],
  216.     } # Do Not Remove
  217.  
  218. #==============================================================================
  219. #                           End Primary Customization
  220. #------------------------------------------------------------------------------
  221. #==============================================================================    
  222.   end
  223. end
  224. #==============================================================================
  225. #                           Start Lunatic Mode
  226. #------------------------------------------------------------------------------
  227. #==============================================================================
  228. #==============================================================================
  229. # ** Game_Battler - Condition - Lunatic Mode
  230. #------------------------------------------------------------------------------
  231. #==============================================================================
  232. class Game_Battler
  233.  
  234.   #--------------------------------------------------------------------------#
  235.   # * iex_check_condition
  236.   #--------------------------------------------------------------------------#
  237.   # Evaluates and returns a condition
  238.   # <emb condition: cond_name>
  239.   # <emb condition: alwaystrue>
  240.   #--------------------------------------------------------------------------#
  241.   def iex_check_condition(cond_name)
  242.     can_get = false
  243.     case cond_name.to_s.upcase
  244.     #--------------------------------------------------------------------------#
  245.     # EDIT HERE
  246.     #--------------------------------------------------------------------------#
  247.     when "ALWAYSTRUE"
  248.       can_get = true
  249.     when "ALWAYSFALSE"  
  250.       can_get = false
  251.     when /(\w+)?[ ]*(?:HEAL_COUNT|heal count|healcount):?[ ]*(\d+)\+/i  
  252.       val = $2.to_i
  253.       case $1.to_s.upcase
  254.       when "ITEM"
  255.         can_get = @item_heal_count >= val
  256.       else
  257.         can_get = @heal_count >= val
  258.       end  
  259.     when /(\w+)?[ ]*(?:KILL_COUNT|kill count|killcount):?[ ]*(\d+)\+/i  
  260.       val = $2.to_i
  261.       case $1.to_s.upcase
  262.       when "SKILL", "MAGIC"
  263.         can_get = @skill_kill_count >= val
  264.       when "ITEM"
  265.         can_get = @item_kill_count >= val
  266.       else
  267.         can_get = @kill_count >= val
  268.       end  
  269.     when /(?:DODGE_COUNT|dodgecount):?[ ]*(\d+)\+/i  
  270.       can_get = @dodge_count >= $1.to_i
  271.     when /(?:HIT_COUNT|hitcount):?[ ]*(\d+)\+/i  
  272.       can_get = @hit_count >= $1.to_i
  273.     when /(?:USED_SKILLS|USED SKILLS|USEDSKILLS):?[ ]*(\d+)\+/i
  274.       can_get = @used_skills.size >= $1.to_i
  275.     when /(?:BATTLE_NO_DEATH|BATTLENODEATH|BATTLE NO DEATH):?[ ]*(\d+)\+/i
  276.       can_get = @no_death_battle_count >= $1.to_i
  277.     when /(?:HAVE_SKILLS|HAVESKILLS|HAVE SKILLS):?[ ]*(\d+)\+/i  
  278.       can_get = @skills.size >= $1.to_i
  279.     when "EATEN_ALL_BERRIES", "EATEN ALL BERRIES", "EATENALLBERRIES"  
  280.       can_get = ([51, 52, 53, 54, 55, 56] - @used_items).size == 0
  281.     when "WARLOCK"
  282.       can_get = (@skill_kill_count >= 5 && @kill_count >= 5)
  283.     when "LAST_MAN", "LASTMAN"  
  284.       can_get = @last_man
  285.     when "MOSTLOOT", "MOST_LOOT", "MOST LOOT"  
  286.       can_get = (@at_end_battle == true and $game_party.most_loot?(@actor_id))
  287.     when "MOSTDROPS", "MOST_DROPS", "MOST DROPS"
  288.       can_get = (@at_end_battle == true and $game_party.most_drops?(@actor_id))
  289.     when "HEALTHYFIGHT", "HEALTHY_FIGHT", "HEALTHY FIGHT"  
  290.       can_get = (@at_end_battle == true and @receieved_hits == 0)
  291.      
  292.     when "HEALSIBLING", "HEAL_SIBLING", "HEAL SIBLING"  
  293.       can_get = IEX::EARTHEN.sibling_heal(self)
  294.     when "SIBLINGLOVE", "SIBLING_LOVE", "SIBLING LOVE"  
  295.       can_get = IEX::EARTHEN.sibling_love(self)
  296.     when "JEALOUSY"  
  297.       can_get = IEX::EARTHEN.jealousy_check(self)
  298.     when "PARTNER"  
  299.       can_get = @actor_id == $game_party.partner(1)  
  300.     #--------------------------------------------------------------------------#
  301.     # STOP EDIT HERE
  302.     #--------------------------------------------------------------------------#
  303.     else ; can_get = false
  304.     end  
  305.     return can_get
  306.   end
  307.  
  308. end        
  309.    
  310. #==============================================================================
  311. # ** Game_Battler - Lunatic Mode
  312. #------------------------------------------------------------------------------
  313. #==============================================================================
  314. class Game_Battler
  315.  
  316.   #--------------------------------------------------------------------------
  317.   # * Public Instance Variables
  318.   #--------------------------------------------------------------------------
  319.   attr_accessor :dodge_count
  320.   attr_accessor :hit_count
  321.   attr_accessor :receieved_hits
  322.   attr_accessor :kill_count
  323.   attr_accessor :skill_kill_count
  324.   attr_accessor :heal_count
  325.   attr_accessor :item_heal_count
  326.   attr_accessor :item_kill_count
  327.   attr_accessor :last_man
  328.   attr_accessor :battle_loot
  329.   attr_accessor :battle_drop_count
  330.   attr_accessor :used_skills
  331.   attr_accessor :used_items
  332.   attr_accessor :no_death_battle_count
  333.   attr_accessor :healed_by
  334.  
  335.   #--------------------------------------------------------------------------#
  336.   # * alias - initialize
  337.   #--------------------------------------------------------------------------#
  338.   alias iex_emblem_initialize initialize unless $@
  339.   def initialize(*args)
  340.     iex_emblem_initialize(*args)
  341.     @dodge_count = 0      # This includes misses and evades
  342.     @hit_count = 0        # Number of succesful hits given a row
  343.     @receieved_hits = 0   # Hits received during battle, resets to 0 after battle
  344.     @kill_count = 0       # Kill count by normal Attack
  345.     @skill_kill_count = 0 # Kill count by Skill
  346.     @item_kill_count = 0  # Kill count by Item
  347.     @heal_count = 0       # Heal count by Skill
  348.     @item_heal_count = 0  # Heal count by Item
  349.     @last_man = false     # Changes at the end of battle
  350.     @battle_loot = 0      # Amount of gold received from a defeated enemy
  351.     @battle_drop_count = 0# Number of drops received from a defeated enemy
  352.     @used_skills = []     # Array containing the IDs of used skills
  353.     @used_items = []      # Array containing the IDs of used items
  354.     @healed_by = {}       # The key is an actor's ID, the value is a number
  355.     @item_healed_by = {}  # The key is an item's ID, the value is a number
  356.     @at_end_battle = false# At the end of battle?
  357.     @no_death_battle_count = 0
  358.     @iex_already_dead = false # Used to avoid, multi checking
  359.   end
  360.  
  361.   #--------------------------------------------------------------------------#
  362.   # * iex_dead?
  363.   #--------------------------------------------------------------------------#
  364.   # If using Melody there is a chance that conditions that require the
  365.   # target to be dead would fail, this method checks if the targets
  366.   # hp is 0 and tags it as dead, ignoring Immortality.
  367.   #--------------------------------------------------------------------------#
  368.   def iex_dead?
  369.     @iex_already_dead = false if @iex_already_dead == nil
  370.     @iex_already_dead = false if self.hp > 0
  371.     @iex_already_dead = true if self.hp <= 0
  372.     return (self.hp <= 0 and @iex_already_dead)
  373.   end
  374.  
  375.   #--------------------------------------------------------------------------#
  376.   # * alias - slip_damage
  377.   #--------------------------------------------------------------------------#
  378.   alias iex_emb_slip_damage_effect slip_damage_effect unless $@
  379.   def slip_damage_effect(*args)
  380.     iex_emb_slip_damage_effect(*args)
  381.     if self.actor? and self.dead?
  382.       self.no_death_battle_count = 0
  383.     end  
  384.   end
  385.  
  386.   #--------------------------------------------------------------------------#
  387.   # * alias - attack_effect
  388.   #--------------------------------------------------------------------------#
  389.   alias iex_emb_attack_effect attack_effect unless $@
  390.   def attack_effect(attacker)
  391.     emb_grab = iex_emb_attack_effect(attacker)
  392.     if self.actor? and self.iex_dead?
  393.       self.no_death_battle_count = 0
  394.     end  
  395.     if @evaded
  396.       @dodge_count += 1
  397.     end  
  398.     if @missed or @evaded
  399.       attacker.hit_count = 0
  400.     else
  401.       attacker.hit_count += 1
  402.     end
  403.     if attacker.actor? and self.iex_dead?
  404.       attacker.kill_count += 1
  405.       unless self.actor?
  406.         attacker.battle_loot += self.gold
  407.         attacker.battle_drop_count += num_of_drops
  408.       end  
  409.     end
  410.     unless (@skipped or @missed or @evaded)
  411.       if self.actor?
  412.         self.receieved_hits += 1
  413.       end
  414.       attacker.check_emblem_conditions
  415.       if attacker != self and self.actor?
  416.         self.check_emblem_conditions
  417.       end
  418.       @dodge_count = 0
  419.     end  
  420.     return emb_grab
  421.   end
  422.  
  423.   #--------------------------------------------------------------------------#
  424.   # * alias - skill_effect
  425.   #--------------------------------------------------------------------------#
  426.   alias iex_emb_skill_effect skill_effect unless $@
  427.   def skill_effect(user, skill)
  428.     if user.actor?
  429.       user.used_skills.push(skill.id) unless user.used_skills.include?(skill.id)
  430.     end
  431.     iex_emb_skill_effect(user, skill)
  432.     if self.actor? and self.iex_dead?
  433.       self.no_death_battle_count = 0
  434.     end  
  435.     if self.actor? and skill.base_damage < 0
  436.       user.heal_count += 1
  437.       self.healed_by[user.id] = 0 if self.healed_by[user.id] == nil
  438.       self.healed_by[user.id] += 1
  439.     end  
  440.     if self.actor? and skill.base_damage > 0
  441.       self.receieved_hits += 1
  442.     end
  443.     if user.actor? and self.iex_dead?
  444.       user.skill_kill_count += 1
  445.       unless self.actor?
  446.         user.battle_loot += self.gold
  447.         user.battle_drop_count += num_of_drops
  448.       end
  449.     end  
  450.     user.check_emblem_conditions
  451.     if user != self and self.actor?
  452.       self.check_emblem_conditions
  453.     end
  454.   end
  455.  
  456.   #--------------------------------------------------------------------------#
  457.   # * alias - item_effect
  458.   #--------------------------------------------------------------------------#
  459.   alias iex_emb_item_effect item_effect unless $@
  460.   def item_effect(user, item)
  461.     if user.actor?
  462.       user.used_items.push(item.id) unless user.used_items.include?(item.id)
  463.     end
  464.     iex_emb_item_effect(user, item)
  465.     if self.actor? and self.iex_dead?
  466.       self.no_death_battle_count = 0
  467.     end  
  468.     if user.actor? and item.base_damage < 0
  469.       user.item_heal_count += 1
  470.       self.item_healed_by[item.id] = 0 if self.item_healed_by[item.id] == nil
  471.       self.item_healed_by[item.id] += 1
  472.     end  
  473.     if user.actor? and self.iex_dead?
  474.       user.item_kill_count += 1
  475.       unless self.actor?
  476.         user.battle_loot += self.gold
  477.         user.battle_drop_count += num_of_drops
  478.       end
  479.     end  
  480.     user.check_emblem_conditions
  481.     if self.actor? and item.base_damage > 0
  482.       self.receieved_hits += 1
  483.     end  
  484.     if user != self and self.actor?
  485.       self.check_emblem_conditions
  486.     end
  487.   end
  488.  
  489. end
  490.  
  491. #==============================================================================
  492. # ** Game_Enemy - Lunatic Mode
  493. #------------------------------------------------------------------------------
  494. #==============================================================================
  495. class Game_Enemy < Game_Battler
  496.  
  497.   #--------------------------------------------------------------------------#
  498.   # * num_of_drops
  499.   #--------------------------------------------------------------------------#
  500.   # Returns the number of drops present on an enemy
  501.   #--------------------------------------------------------------------------#
  502.   def num_of_drops
  503.     size = 0
  504.     if $imported["IEX_Rand_Drop"]
  505.       size += more_drops.size
  506.     end  
  507.     size += drop_item1.kind == 0 ? 0 : 1
  508.     size += drop_item2.kind == 0 ? 0 : 1
  509.     return size
  510.   end
  511.  
  512. end
  513.  
  514. #==============================================================================
  515. # ** Game_Actor - Lunatic Mode
  516. #------------------------------------------------------------------------------
  517. #==============================================================================
  518. class Game_Actor < Game_Battler
  519.  
  520.   #--------------------------------------------------------------------------#
  521.   # * alias - setup - Lunatic
  522.   #--------------------------------------------------------------------------#
  523.   alias iex_lunEmb_setup setup unless $@
  524.   def setup(*args)
  525.     iex_lunEmb_setup(*args)
  526.     @kill_count = 0
  527.     @skill_kill_count = 0
  528.     @heal_count = 0
  529.     @item_heal_count = 0
  530.     @item_kill_count = 0
  531.     @last_man = false
  532.     @battle_loot = 0
  533.     @battle_drop_count = 0
  534.     @used_skills = []
  535.     @used_items = []
  536.     @no_death_battle_count = 0
  537.     @at_end_battle = false
  538.   end
  539.  
  540.   #--------------------------------------------------------------------------#
  541.   # * iex_reset_battle_cache
  542.   #--------------------------------------------------------------------------#
  543.   def iex_reset_battle_cache
  544.     @battle_loot = 0
  545.     @battle_drop_count = 0
  546.     @receieved_hits = 0
  547.     @last_man = false  
  548.     @at_end_battle = false
  549.     @gained_emblems = []
  550.   end
  551.  
  552.   #--------------------------------------------------------------------------#
  553.   # * gain_emblem
  554.   #--------------------------------------------------------------------------#
  555.   # Used in battle
  556.   #--------------------------------------------------------------------------#
  557.   def gain_emblem(sta)
  558.     return if sta == nil
  559.     return unless @valid_emblem_ids.include?(sta.id)
  560.     @emblem_ids[sta.emb_id - 1] = sta.id
  561.     if $game_temp.in_battle
  562.       @gained_emblems.push(sta.id)
  563.     end
  564.   end
  565.  
  566. end
  567.  
  568. #==============================================================================
  569. # ** Game_Party - Lunatic Mode
  570. #------------------------------------------------------------------------------
  571. #==============================================================================
  572. class Game_Party < Game_Unit
  573.  
  574.   #--------------------------------------------------------------------------#
  575.   # * most_loot?
  576.   #--------------------------------------------------------------------------#
  577.   # Returns the member with the most loot (Member who received the most gold from
  578.   # dead enemies)
  579.   #--------------------------------------------------------------------------#
  580.   def most_loot?(act_id)
  581.     return false unless $game_temp.in_battle
  582.     return false if members.size <= 1
  583.     loot_array = []
  584.     for mem in members
  585.       next if mem == nil
  586.       loot_array.push([mem.battle_loot, mem.id])
  587.     end  
  588.     loot_array.sort!
  589.     loot_array.reverse!
  590.     return false if loot_array[0][0] == 0
  591.     return loot_array[0][1] == act_id
  592.   end
  593.  
  594.   #--------------------------------------------------------------------------#
  595.   # * most_drops?
  596.   #--------------------------------------------------------------------------#
  597.   # Returns the member with the most drops (Member who received the most drops from
  598.   # dead enemies)
  599.   #--------------------------------------------------------------------------#
  600.   def most_drops?(act_id)
  601.     return false unless $game_temp.in_battle
  602.     return false if members.size <= 1
  603.     drop_array = []
  604.     for mem in members
  605.       next if mem == nil
  606.       drop_array.push([mem.battle_drop_count, mem.id])
  607.     end  
  608.     drop_array.sort!
  609.     drop_array.reverse!
  610.     return false if drop_array[0][0] == 0
  611.     return drop_array[0][1] == act_id
  612.   end
  613.  
  614. end
  615.  
  616. #==============================================================================
  617. # ** Scene_Battle - Lunatic Mode
  618. #------------------------------------------------------------------------------
  619. #==============================================================================
  620. class Scene_Battle < Scene_Base
  621.  
  622.   #--------------------------------------------------------------------------
  623.   # * End Turn
  624.   #--------------------------------------------------------------------------
  625.   alias iex_emblems_turn_end turn_end unless $@
  626.   def turn_end
  627.     iex_emblems_turn_end
  628.     for mem in $game_party.members ; mem.check_emblem_conditions end
  629.   end
  630.  
  631.   alias iex_emblems_process_victory process_victory unless $@
  632.   def process_victory
  633.     if $game_party.alive_members.size == 1 and not $game_party.members.size <= 1
  634.       mem = $game_party.alive_members[0]
  635.       mem.last_man = true
  636.     end
  637.     for memb in $game_party.members
  638.       memb.at_end_battle = true
  639.       unless memb.dead?
  640.         memb.no_death_battle_count += 1
  641.       else
  642.         memb.no_death_battle_count = 0
  643.       end  
  644.       memb.check_emblem_conditions
  645.     end
  646.     iex_emblems_process_victory
  647.     for memb in $game_party.members
  648.       memb.iex_reset_battle_cache
  649.     end  
  650.   end  
  651.  
  652. end
  653.  
  654. #==============================================================================
  655. #                           End Lunatic Mode
  656. #------------------------------------------------------------------------------
  657. #==============================================================================  
  658.  
  659. #==============================================================================
  660. # ** IEX::EMBLEM_SYSTEM
  661. #------------------------------------------------------------------------------
  662. #==============================================================================
  663. module IEX
  664.   module EMBLEM_SYSTEM
  665.     # Credit to Yanfly for the range to array method
  666.     module_function
  667.     #--------------------------------------------------------------------------
  668.     # convert_integer_array
  669.     #--------------------------------------------------------------------------
  670.     def convert_integer_array(array)
  671.       result = []
  672.       array.each { |i|
  673.         case i
  674.         when Range; result |= i.to_a
  675.         when Integer; result |= [i]
  676.         end }
  677.       return result
  678.     end
  679.  
  680.     #--------------------------------------------------------------------------
  681.     # converted_contants
  682.     #--------------------------------------------------------------------------
  683.     for key in ACTOR_VALID_EMBLEMS.keys
  684.       ACTOR_VALID_EMBLEMS[key] = convert_integer_array(ACTOR_VALID_EMBLEMS[key])
  685.     end
  686.    
  687.   end
  688. end
  689.  
  690. #==============================================================================
  691. # ** RPG::State
  692. #------------------------------------------------------------------------------
  693. #==============================================================================
  694. class RPG::State
  695.    
  696.   #--------------------------------------------------------------------------#
  697.   # * iex_emblem_cache
  698.   #--------------------------------------------------------------------------#
  699.   # This is the Emblem's Cache
  700.   #--------------------------------------------------------------------------#
  701.   def iex_emblem_cache
  702.     @emb_cache_complete = false
  703.     @emb_states = []
  704.     @emb_negateIds = []
  705.     @emb_id = 0
  706.     @emb_condition = "AlwaysFalse"
  707.     @emb_description = ''
  708.     @emb_includeSelf = true
  709.     emb_des_on = false
  710.     self.note.split(/[\r\n]+/).each { |line|
  711.     case line
  712.     when /<(?:EMB_|EMBLEM_|emb |emblem )(?:STATE)s?:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  713.       $1.scan(/\d+/).each { |sid|
  714.       @emb_states.push(sid.to_i) }
  715.     when /<(?:EMB_|EMBLEM_|emb |emblem )(?:NEGATE)s?:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  716.       $1.scan(/\d+/).each { |sid|
  717.       @emb_negateIds.push(sid.to_i) }
  718.     when /<(?:EMEBLEM_ID|emblem id|EMB_ID|emb id):[ ]*(\d+)>/i
  719.       @emb_id = $1.to_i
  720.     when /<(?:EMB_|EMBLEM_|emb |emblem )(?:CONDITION|cond):[ ]*(.*)>/i
  721.       @emb_condition = $1.to_s  
  722.     when /<(?:EMB_|EMBLEM_|emb |emblem )(?:DESCRIPTION|des)>/i
  723.       emb_des_on = true
  724.     when /<\/(?:EMB_|EMBLEM_|emb |emblem )(?:DESCRIPTION|des)>/i
  725.       emb_des_on = false
  726.     when /<(?:EMB_|EMBLEM_|emb |emblem )(?:NOSELF|no self|NOT_SELF|not self)>/i  
  727.       @emb_includeSelf = false
  728.     else
  729.       @emb_description += line.to_s if emb_des_on
  730.     end  }
  731.     @emb_cache_complete = true
  732.     emb_des_on = false
  733.   end
  734.  
  735.   #--------------------------------------------------------------------------#
  736.   # * stateIncludeSelf?
  737.   #--------------------------------------------------------------------------#
  738.   # Include self, with states? By default YES
  739.   #--------------------------------------------------------------------------#
  740.   def stateIncludeSelf?
  741.     iex_emblem_cache unless @emb_cache_complete
  742.     return @emb_includeSelf
  743.   end
  744.  
  745.   #--------------------------------------------------------------------------#
  746.   # * emb_states
  747.   #--------------------------------------------------------------------------#
  748.   # In addition to it self, the Emblem can include other states
  749.   # Note, if the state has already been applied it will be ignored
  750.   #--------------------------------------------------------------------------#
  751.   def emb_states
  752.     iex_emblem_cache unless @emb_cache_complete
  753.     return @emb_states
  754.   end
  755.  
  756.   #--------------------------------------------------------------------------#
  757.   # * emb_id
  758.   #--------------------------------------------------------------------------#
  759.   # Each Emblem has an ID, therefore you can have 3 different emblems
  760.   # all with the same ID but for different characters!
  761.   #--------------------------------------------------------------------------#
  762.   def emb_id
  763.     iex_emblem_cache unless @emb_cache_complete
  764.     return @emb_id
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------#
  768.   # * emb_condition
  769.   #--------------------------------------------------------------------------#
  770.   # The emblem's condition name
  771.   #--------------------------------------------------------------------------#
  772.   def emb_condition
  773.     iex_emblem_cache unless @emb_cache_complete
  774.     return @emb_condition
  775.   end
  776.  
  777.   #--------------------------------------------------------------------------#
  778.   # * emb_description
  779.   #--------------------------------------------------------------------------#
  780.   # The emblem's description
  781.   #--------------------------------------------------------------------------#
  782.   def emb_description
  783.     iex_emblem_cache unless @emb_cache_complete
  784.     return @emb_description
  785.   end
  786.  
  787.   #--------------------------------------------------------------------------#
  788.   # * emb_negates
  789.   #--------------------------------------------------------------------------#
  790.   # The emblem's negation
  791.   #--------------------------------------------------------------------------#
  792.   def emb_negates
  793.     iex_emblem_cache unless @emb_cache_complete
  794.     return @emb_negateIds
  795.   end
  796.  
  797. end
  798.  
  799. #==============================================================================
  800. # ** DummyLockedState - A dummy state used in the Emblem view window
  801. #------------------------------------------------------------------------------
  802. #==============================================================================
  803. class DummyLockedState < RPG::State
  804.  
  805.   #--------------------------------------------------------------------------#
  806.   # * initialize
  807.   #--------------------------------------------------------------------------#
  808.   def initialize
  809.     super
  810.     iex_emblem_cache
  811.     @icon_index = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:locked]
  812.     @name = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:locked]
  813.     @emb_description = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:unavailable]
  814.   end
  815.  
  816. end
  817. #==============================================================================
  818. # ** DummyHelpState - A dummy state used in the Emblem help window
  819. #------------------------------------------------------------------------------
  820. #==============================================================================
  821. class DummyHelpState < RPG::State
  822.  
  823.   #--------------------------------------------------------------------------#
  824.   # * initialize
  825.   #--------------------------------------------------------------------------#
  826.   def initialize
  827.     super
  828.     iex_emblem_cache
  829.     @icon_index = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:help]
  830.     @name = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:emblems]
  831.     @emb_description = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:help_text]
  832.   end
  833.  
  834. end
  835.  
  836. #==============================================================================
  837. # ** Scene_Title
  838. #------------------------------------------------------------------------------
  839. #==============================================================================
  840. class Scene_Title < Scene_Base
  841.  
  842.   #--------------------------------------------------------------------------#
  843.   # * alias load_database
  844.   #--------------------------------------------------------------------------#
  845.   alias iex_emb_load_database load_database unless $@
  846.   def load_database
  847.     iex_emb_load_database
  848.     load_emblem_database
  849.   end
  850.  
  851.   #--------------------------------------------------------------------------#
  852.   # * load_emblem_database
  853.   #--------------------------------------------------------------------------#
  854.   # This loads all the emblems caches so it doesn't have to during runtime
  855.   #--------------------------------------------------------------------------#
  856.   def load_emblem_database
  857.     for st in $data_states
  858.       next if st == nil
  859.       st.iex_emblem_cache
  860.     end  
  861.   end
  862.  
  863. end
  864.  
  865. #==============================================================================
  866. # ** Game_Unit
  867. #------------------------------------------------------------------------------
  868. #==============================================================================
  869. class Game_Unit
  870.  
  871.   #--------------------------------------------------------------------------
  872.   # * Get array of Alive Members
  873.   #--------------------------------------------------------------------------
  874.   def alive_members
  875.     result = []
  876.     for battler in members
  877.       next if battler.dead?
  878.       result.push(battler)
  879.     end
  880.     return result
  881.   end
  882.  
  883. end
  884.  
  885. #==============================================================================
  886. # ** Game_Battler
  887. #------------------------------------------------------------------------------
  888. #==============================================================================
  889. class Game_Battler
  890.      
  891.   #--------------------------------------------------------------------------#
  892.   # * emblem_states
  893.   #--------------------------------------------------------------------------#
  894.   # Dummy - Used for Enemies, since they don't have any emblems
  895.   # This is overwriten in the Game_Actor class.
  896.   #--------------------------------------------------------------------------#
  897.   def emblem_states ; return [] end
  898.  
  899.   #--------------------------------------------------------------------------#
  900.   # * alias - states
  901.   #--------------------------------------------------------------------------#
  902.   # Used to add the emblem states to the current set
  903.   #--------------------------------------------------------------------------#
  904.   alias iex_emblem_states states unless $@
  905.   def states
  906.     result = iex_emblem_states
  907.     result |= self.emblem_states if self.actor?
  908.     return result
  909.   end
  910.  
  911. end
  912.  
  913. #==============================================================================
  914. # ** Game_Enemy
  915. #------------------------------------------------------------------------------
  916. #==============================================================================
  917. class Game_Enemy < Game_Battler
  918.   #--------------------------------------------------------------------------#
  919.   # * check_emblem_conditions
  920.   #--------------------------------------------------------------------------#
  921.   # Dummy - Used for Enemies, since they don't have any emblems
  922.   # This is overwriten in the Game_Actor class.
  923.   #--------------------------------------------------------------------------#
  924.   def check_emblem_conditions
  925.   end
  926.  
  927. end
  928.  
  929. #==============================================================================
  930. # ** Game_Actor
  931. #------------------------------------------------------------------------------
  932. #==============================================================================
  933. class Game_Actor < Game_Battler
  934.  
  935.   #--------------------------------------------------------------------------
  936.   # * Public Instance Variables
  937.   #--------------------------------------------------------------------------
  938.   attr_accessor :emblem_ids
  939.   attr_accessor :valid_emblem_ids
  940.   attr_accessor :at_end_battle
  941.   attr_accessor :gained_emblems
  942.    
  943.   #--------------------------------------------------------------------------#
  944.   # * alias - setup
  945.   #--------------------------------------------------------------------------#
  946.   alias iex_emblems_setup setup unless $@
  947.   def setup(*args)
  948.     @emblem_ids = []
  949.     @valid_emblem_ids = []
  950.     iex_emblems_setup(*args)
  951.     if IEX::EMBLEM_SYSTEM::ACTOR_VALID_EMBLEMS.has_key?(@actor_id)
  952.       @valid_emblem_ids = IEX::EMBLEM_SYSTEM::ACTOR_VALID_EMBLEMS[@actor_id].clone
  953.     else  
  954.       @valid_emblem_ids = IEX::EMBLEM_SYSTEM::ACTOR_VALID_EMBLEMS[0].clone
  955.     end  
  956.     for i in 0...IEX::EMBLEM_SYSTEM::TOTAL_EMBLEMS
  957.       @emblem_ids[i] = 0
  958.     end  
  959.     @gained_emblems = [] # Gained During Battle
  960.   end
  961.  
  962.   #--------------------------------------------------------------------------#
  963.   # * valid_emblem_id
  964.   #--------------------------------------------------------------------------#
  965.   # Is the emblem a valid one?
  966.   #--------------------------------------------------------------------------#
  967.   def valid_emblem_id(emb_id)
  968.     for sid in @valid_emblem_ids
  969.       next if sid == nil
  970.       sta = $data_states[sid]
  971.       next if sta == nil
  972.       return true if sta.emb_id == emb_id
  973.     end  
  974.     return false
  975.   end
  976.  
  977.   #--------------------------------------------------------------------------#
  978.   # * negate_emblem?
  979.   #--------------------------------------------------------------------------#
  980.   # Should the emblems effect be negated?
  981.   #--------------------------------------------------------------------------#
  982.   def negate_emblem?(nemb)
  983.     eid = nemb
  984.     eid = nemb.emb_id if nemb.is_a?(RPG::State)
  985.     for emb in emblems
  986.       return true if emb.emb_negates.include?(eid)
  987.     end  
  988.     return false
  989.   end  
  990.  
  991.   #--------------------------------------------------------------------------#
  992.   # * emblems - returns an array containing all the obtained emblems
  993.   #--------------------------------------------------------------------------#
  994.   def emblems
  995.     result = []
  996.     for sid in @emblem_ids
  997.       result.push($data_states[sid])
  998.     end  
  999.     return result
  1000.   end
  1001.  
  1002.   #--------------------------------------------------------------------------#
  1003.   # * emblem_states
  1004.   #--------------------------------------------------------------------------#
  1005.   # Returns an array containing all the obtained emblems states
  1006.   #--------------------------------------------------------------------------#
  1007.   def emblem_states
  1008.     result = []
  1009.     for emb in emblems
  1010.       next if emb == nil
  1011.       next if negate_emblem?(emb)
  1012.       result.push(emb) if emb.stateIncludeSelf?
  1013.       for sid in emb.emb_states
  1014.         result.push($data_states[sid])
  1015.       end  
  1016.     end
  1017.     return result
  1018.   end
  1019.    
  1020.   #--------------------------------------------------------------------------#
  1021.   # * check_emblem_conditions
  1022.   #--------------------------------------------------------------------------#
  1023.   # Checks all unobtained emeblems to see if they can be collected
  1024.   #--------------------------------------------------------------------------#
  1025.   def check_emblem_conditions
  1026.     for sid in @valid_emblem_ids
  1027.       next if @emblem_ids.include?(sid)
  1028.       sta = $data_states[sid]
  1029.       next if sta == nil
  1030.       if iex_check_condition(sta.emb_condition)
  1031.         gain_emblem(sta)
  1032.       end  
  1033.     end  
  1034.   end  
  1035.  
  1036. end
  1037.  
  1038. #==============================================================================
  1039. # ** IEX_Scene_Emblem
  1040. #------------------------------------------------------------------------------
  1041. #==============================================================================
  1042. class IEX_Scene_Emblem < Scene_Base
  1043.  
  1044.   def initialize(actor, called = false)
  1045.     super()
  1046.     @index_call = false
  1047.     @act_index = 0
  1048.     if actor.kind_of?(Game_Battler)
  1049.       @actor = actor
  1050.     elsif actor != nil  
  1051.       @actor = $game_party.members[actor]
  1052.       @act_index = actor
  1053.       @index_call = true
  1054.     else
  1055.       @actor = nil
  1056.     end  
  1057.     @call_from_menu = called
  1058.     @actor.check_emblem_conditions
  1059.   end
  1060.  
  1061.   def start
  1062.     super
  1063.     create_menu_background
  1064.     @windows = {}
  1065.     win_pos = [0, Graphics.width, Graphics.width / 2, Graphics.height,
  1066.       Graphics.height / 2]
  1067.     @windows["Emblems"]  = IEX_Emblem_Window.new(@actor, win_pos[0], win_pos[0],
  1068.       win_pos[1], win_pos[4])
  1069.     @windows["Help"]     = IEX_Emblem_Help_Window.new(win_pos[0],
  1070.       @windows["Emblems"].height, win_pos[1], 96)#win_pos[4])
  1071.     @windows["Help"].set_emblem(@windows["Emblems"].current_emblem)
  1072.     ya = @windows["Help"].y + @windows["Help"].height
  1073.     @windows["Actor_Status"] = IEX_Emblem_ActStatus_Window.new(@actor,
  1074.       win_pos[0], ya, win_pos[2] + 96, win_pos[3] - ya)
  1075.     @windows["DummyHelp"]    = IEX_Emblem_Help_Window.new(
  1076.       @windows["Actor_Status"].width, ya, win_pos[2] - 96, 96)
  1077.     @windows["DummyHelp"].set_emblem(DummyHelpState.new)
  1078.   end
  1079.  
  1080.   def terminate
  1081.     super
  1082.     dispose_menu_background
  1083.     for win in @windows.values
  1084.       next if win == nil
  1085.       win.dispose
  1086.       win = nil
  1087.     end  
  1088.     @windows.clear
  1089.     @windows = {}
  1090.   end
  1091.  
  1092.   def update
  1093.     super
  1094.     if Input.trigger?(Input::C)
  1095.       #Sound.play_decision
  1096.     elsif Input.trigger?(Input::R)  
  1097.       if @index_call
  1098.         Sound.play_cursor
  1099.         @act_index = (@act_index + 1) % $game_party.members.size
  1100.         $scene = IEX_Scene_Emblem.new(@act_index)
  1101.       else
  1102.         Sound.play_buzzer
  1103.       end  
  1104.     elsif Input.trigger?(Input::L)  
  1105.       if @index_call
  1106.         Sound.play_cursor
  1107.         @act_index = (@act_index - 1) % $game_party.members.size
  1108.         $scene = IEX_Scene_Emblem.new(@act_index)
  1109.       else  
  1110.         Sound.play_buzzer
  1111.       end
  1112.     elsif Input.trigger?(Input::B)  
  1113.       Sound.play_cancel
  1114.       $scene = Scene_Map.new
  1115.     end  
  1116.     for win in @windows.values
  1117.       next if win == nil
  1118.       win.update if win.active
  1119.     end  
  1120.     @windows["Help"].set_emblem(@windows["Emblems"].current_emblem)
  1121.   end
  1122.  
  1123. end
  1124.  
  1125. #==============================================================================
  1126. # ** IEX_Emblem_ActStatus_Window
  1127. #------------------------------------------------------------------------------
  1128. #==============================================================================
  1129. class IEX_Emblem_ActStatus_Window < Window_Base
  1130.  
  1131.   def initialize(actor, x, y, width, height)
  1132.     super(x, y, width, height)
  1133.     @actor = actor
  1134.     refresh
  1135.   end
  1136.  
  1137.   def refresh
  1138.     self.contents.clear
  1139.     create_contents
  1140.     draw_actor_face(@actor, 4, 4)
  1141.     draw_actor_graphic(@actor, 96, 96)
  1142.     self.contents.font.size = Font.default_size
  1143.     self.contents.font.color = system_color
  1144.     t_x = 104
  1145.     draw_icon(IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:name], t_x, 4)
  1146.     draw_icon(IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:class], t_x, 28)
  1147.     draw_icon(IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:emblem_num], t_x, 52)
  1148.     self.contents.draw_text(t_x + 24, 4, self.contents.width, 24,
  1149.       IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:name])
  1150.     self.contents.draw_text(t_x + 24, 28, self.contents.width, 24,
  1151.       IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:class])
  1152.     self.contents.draw_text(t_x + 24, 52, self.contents.width, 24,
  1153.       IEX::EMBLEM_SYSTEM::EMBLEM_SYS_TEXT[:emblem_num])
  1154.     self.contents.font.color = normal_color
  1155.     self.contents.font.size = 18
  1156.     self.contents.draw_text(t_x + 128, 4, self.contents.width, 24, @actor.name)
  1157.     self.contents.draw_text(t_x + 128, 28, self.contents.width, 24, @actor.class.name)
  1158.     coun = 0
  1159.     @actor.emblems.each { |em| coun += 1 if em != nil}
  1160.     emblem = sprintf("%s / %s", coun, @actor.valid_emblem_ids.size)
  1161.     self.contents.draw_text(t_x + 128, 52, self.contents.width, 24, emblem)
  1162.   end
  1163.  
  1164. end
  1165.  
  1166. #==============================================================================
  1167. # ** IEX_Emblem_Help_Window
  1168. #------------------------------------------------------------------------------
  1169. #==============================================================================
  1170. class IEX_Emblem_Help_Window < Window_Base
  1171.  
  1172.   def initialize(x, y, width, height)
  1173.     super(x, y, width, height)
  1174.     @last_emblem = ''
  1175.   end
  1176.  
  1177.   def set_emblem(emb)
  1178.     return if @last_emblem == emb
  1179.     self.contents.clear
  1180.     rect = Rect.new(4, 4, 32, 32)
  1181.     self.contents.fill_rect(rect, IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:back])
  1182.     draw_border_rect(4, 4, 32, 32, 4,
  1183.       IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:border])
  1184.     if emb != nil
  1185.       draw_icon(emb.icon_index, 8, 8)
  1186.       self.contents.font.size = Font.default_size
  1187.       self.contents.font.color = system_color
  1188.       self.contents.draw_text(42, 4, self.contents.width - 42, 24, emb.name)
  1189.       self.contents.font.color = normal_color
  1190.       self.contents.font.size = 18
  1191.       self.contents.draw_text(4, 42, self.contents.width, 24, emb.emb_description)
  1192.     end  
  1193.     @last_emblem = emb
  1194.   end
  1195.  
  1196. end
  1197.  
  1198. #==============================================================================
  1199. # ** IEX_Emblem_Window
  1200. #------------------------------------------------------------------------------
  1201. #==============================================================================
  1202. class IEX_Emblem_Window < ICY_HM_Window_Selectable
  1203.  
  1204.   def initialize(actor = nil, x = 0, y = 0, width = Graphics.width, height = Graphics.height)
  1205.     super(x, y, width, height)
  1206.     @actor = actor
  1207.     @column_max = 12
  1208.     @item_sq_spacing = 42
  1209.     @rect_size = 32
  1210.     @selection_size = 38
  1211.     self.height = (@item_sq_spacing * 3) + 32
  1212.     @index = 0
  1213.     @locked_array = []
  1214.     @locked_state = DummyLockedState.new
  1215.     refresh
  1216.   end
  1217.    
  1218.   def current_emblem
  1219.     return @locked_state if @locked_array.include?(@index)
  1220.     return @data[@index]
  1221.   end
  1222.  
  1223.   def refresh
  1224.     @data = []  
  1225.     @data = @actor.emblems
  1226.     @item_max = @data.size
  1227.     self.contents.clear
  1228.     create_contents
  1229.     prep_coord_vars
  1230.     for i in 0...@data.size  
  1231.       draw_item(i)
  1232.     end
  1233.   end
  1234.  
  1235.   def draw_item(index)
  1236.     rect = Rect.new(@nw_x, @nw_y, @rect_size, @rect_size)
  1237.     if @actor.valid_emblem_id(index.to_i + 1)
  1238.       emb = @data[index]
  1239.       color1 = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:back]
  1240.       color2 = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:border]
  1241.       x_icon = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:unlockable]
  1242.       self.contents.fill_rect(rect, color1)
  1243.       draw_border_rect(@nw_x, @nw_y, @rect_size, @rect_size, 4, color2)
  1244.     else
  1245.       emb = nil    
  1246.       color1 = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:border]
  1247.       color2 = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_COLORS[:back]
  1248.       x_icon = IEX::EMBLEM_SYSTEM::EMBLEM_SYS_ICONS[:locked]
  1249.       @locked_array.push(index)
  1250.     end  
  1251.     unless emb == nil  
  1252.       draw_icon(emb.icon_index, @nw_x + 4, @nw_y + 4)
  1253.     else
  1254.       draw_icon(x_icon, @nw_x + 4, @nw_y + 4)
  1255.     end  
  1256.     advance_space
  1257.   end
  1258.  
  1259. end
Advertisement
Add Comment
Please, Sign In to add comment