RPGVX.net

  RPG-Maker VX => VX Technik [Frageforum] => Thema gestartet von: Zuio20 am April 05, 2011, 21:31:22

Titel: Hilfe beim YEM Equipment Overhaul!!
Beitrag von: Zuio20 am April 05, 2011, 21:31:22
Ich suche jmd der mir helfen kann!
Ich erstellt (wie wohl die miesten hier) gerade ein Spiel. :haha_zwinker:

Hierfür habe ich mir den YEM Equipment Overhaul geholt.
Die wichtigste Funktion für mein Spiel jedoch funkt nicht: Die funktion, dass der Char erst einen gewissen SPI Wert haben muss.  :cry:
1.Vermutung: Andere Scripts blockieren dieser Funtkion.
Ich habe noch folgende scripts benutzt (ich hoffe es ist nicht schlimm wenn ich jetzt mal kurz zu faul bin die Namen hinzuzuschreiben):
EXP & Gold Boost von Craze's Script Asylum
YEM Core Fixes and Upgrades
YEM New Battle Stats
HP/MP reg bei Abwehr
Schreiberweiterung von ERZENGEL
Das Final Fantasy IX Menü
Tilesteswapper von hellMinor
HP-Leiste bei Gegnern
Heilung bei Level UP
und MelekTaus' MatrixInventory

2. Im Script funkt iwas net ..

Habt ihr ne Ahnung, woran des liegen könnte???
Bitte helft mir.
 :adore:
Titel: Re: Hilfe beim YEM Equipment Overhaul!!
Beitrag von: Johny-Kk am April 06, 2011, 18:23:26
i-was klingt gut^^
beschreib doch mal dein problem bitte genauer!
fehlermeldung, etc...
Titel: Re: Hilfe beim YEM Equipment Overhaul!!
Beitrag von: Zuio20 am April 07, 2011, 08:40:35
Gibt ja keine Fehlermeldung.... die Funktion, das der Charakter z.B. SPI größer als 50 hat funkt einfach nicht ....
Titel: Re: Hilfe beim YEM Equipment Overhaul!!
Beitrag von: Domin0e am April 07, 2011, 09:53:04
Poste einfach mal den Script, wo wie du ihn in deinem Projekt hast, mit allen möglicherweise vorgenommen Änderungen und allem.
Titel: Re: Hilfe beim YEM Equipment Overhaul!!
Beitrag von: Zuio20 am April 07, 2011, 12:15:52
Yo, hier ist er schon!

#===============================================================================
#
# Yanfly Engine Zealous - Equipment Overhaul
# Last Date Updated: 2010.08.23
# Level: Normal, Hard, Lunatic
#
# This script essentially redefines the way the equipment system works while
# keeping the core without rewriting too much. It will also recalculate the
# stats applied through equipment by the order of operations properly so that
# the numbers aren't a jumbled up uncontrollable mess. In addition to fixing
# the calculation regarding the order of operations, this script also changes
# the equipment scene with a different layout and more efficient methods.
#
# Equipment can also require certain conditions to be met first before being
# able to be equipped. These conditions include reaching a certain level, having
# more or less than a certain number for their stat, or even having a switch to
# be enabled. These requirements can be done through simple tags.
#
# An aptitude system is also included in the script, where certain classes can
# receive more or less bonus from certain stat increases from equipment. For
# example, a warrior will receive less INT than a mage would from a piece of
# equipment. Aptitude is also flexible and can be adjusted through items, too.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 2010.08.23 - Bugfix regarding optimization.
# o 2010.08.16 - Bugfix regarding unequipping items with MaxHP and MaxMP.
# o 2010.06.24 - Unequip bug has been fixed.
# o 2010.06.03 - Efficiency update.
# o 2010.05.24 - Converted to Yanfly Engine Melody.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Item Tags - Insert the following tags into usable Item noteboxes.
# -----------------------------------------------------------------------------
# <stat aptitude: +x%>  or  <stat aptitude: -x%>
# This will raise or lower the stat's aptitude by x%. Replace stat with one of
# the following: MaxHP, MaxMP, ATK, DEF, SPI, RES, DEX, or AGI
#
# -----------------------------------------------------------------------------
# Equip Tags - Insert the following tags into Weapon and Armour noteboxes.
# -----------------------------------------------------------------------------
# <stat: +x>   or  <stat: -x>
# <stat: +x%>  or  <stat: -x%>
# This will allow the piece of equipment to raise or lower the stat by x in
# either a set amount or percentile amount. Note that percents are calculated
# before set values. Percents are also ignored from equip optimization. This
# tag will allow you to go past the 500 maximum value that the editor has.
# Replace stat with one of the following:
#      MaxHP, MaxMP, ATK, DEF, SPI, AGI, HIT, EVA, CRI, ODDS
#
# <trait: phrase>
# This will give your piece of equipment some unique traits. Just replace the
# word phrase inside the tag with one of the following:
#   super guard      - Guarding reduces damage by 4x instead of 2x.
#   pharmacology     - Items used will have double effect.
#   fast attack      - Early turn initiative.
#   dual attack      - Normal attacks hit twice.
#   prevent critical - Criticals cannot occur on battler.
#   half mp cost     - MP skills cost only half.
#   double exp gain  - Inflicted actor gains double exp.
#   auto hp recover  - Inflicted actor gains HP each turn and step.
#
# <auto state: x> or <auto states: x,x>
# This will cause the piece of equipment to have states x automatically on the
# actor so long as the actor has the item equipped. Once unequipped, the state
# will no longer be applied to the actor.
#
# <require above: stat x> or <require under: stat x>
# This will make your piece of equipment require certain stat conditions to be
# met. If above, it is greater than or equal to. If under, it is less than or
# equal to. Replace stat with one of the following:
#    Level, MaxHP, MaxMP, ATK, DEF, SPI, RES, DEX, AGI, HIT, EVA, CRI, ODDS
#
# <require switch: x> or <require switches: x,x>
# This will require the switch x to be on before the piece of equipment can be
# worn by the actor. If it isn't on, it'll be greyed out until available.
#
# <require variable x: above y> or <require variable x: under y>
# This will require the variable x to be above/under y in order for the item
# to become equippable by the actor.
#
# -----------------------------------------------------------------------------
# Weapon Tags - Insert the following tags into Weapon noteboxes.
# -----------------------------------------------------------------------------
# <2 hand text: phrase>
# This will replace the default two-handed text with whatever you've inserted
# for phrase. Case sensitive.
#
# -----------------------------------------------------------------------------
# Armour Tags - Insert the following tags into Armour noteboxes.
# -----------------------------------------------------------------------------
# <equip type: phrase>
# This changes the equip type of the item to whatever the phrase is. This tag
# exists for using more than the 4 types of armour equips available to RPG
# Maker. To understand how this works better, read the Equip Settings part of
# the module and adjust the settings there accordingly.
#
# -----------------------------------------------------------------------------
# Script Calls
# -----------------------------------------------------------------------------
# item = $data_armors[item_id]
# $game_actors
  • .change_equip(slot_id, item)

# This allows you to equip armours to the newly made slots. Make sure you find
# the appropriate item_id for the armour.
#
# $game_actors
  • .lock_equip(slot_id)

# This locks that actor's equipment slot from being changable. Does not give
# overrides to fixed equipment trait.
#
# $game_actors
  • .unlock_equip(slot_id)

# This unlocks that actor's equipment slot to being changable. Does not give
# overrides to fixed equipment trait.
#
# array = [:other, :other, :other]
# $game_actors
  • .equip_type = array

# This changes the actors equip types to set array. Any unequippable items will
# be purged and thrown back into the inventory. This does not include weapon
# and weapon will be automatically excluded to maintain compatibility.
#
# $game_actors
  • .add_equip_type(type)

# This adds an equip type onto the pre-existing equip types. It opens up an
# extra expanded slot at the very end of the list. This does not include
# weapon and weapon will be automatically excluded to maintain comptability.
#
# $game_actors
  • .delete_last_equip_type

# This removes the last type in the current equip types. The item in the
# previous types are dropped. This will not delete weapon types to maintain
# compatibility.
#
# -----------------------------------------------------------------------------
# Debug Shortcuts - Only during $TEST and $BTEST mode
# -----------------------------------------------------------------------------
# During testplay mode, pressing F5 inside of the equip screen will allow you
# to force equip an item that isn't normally equippable. Pressing F7 and F8
# decreases and increases the number of an item. Inside aptitude, F5 will force
# use an aptitude item even if it's been consumed. F6 will reset aptitudes. F7
# and F8 will increase and decrease aptitude items.
#===============================================================================

$imported = {} if $imported == nil
$imported["EquipmentOverhaul"] = true

module YEM
  module EQUIP
   
    #===========================================================================
    # Section I. Basic Settings
    # --------------------------------------------------------------------------
    # The following below will adjust the basic settings and vocabulary that
    # will display throughout the script. Change them as you see fit.
    #===========================================================================
   
    # This adjusts the commands used within the equip scene. The command window
    # is the window that lets you switch between various equip scene options.
    COMMANDS =[
      :manual,      # Manually equips weapons and armours.
      :optimize,    # Optimize equipping automatically.
      :aptitude,    # Enter aptitude attuning menu.
    ] # Do not remove this.
   
    # The following determines the vocabulary used for the remade equip scene.
    # Adjust it accordingly to set the way text is displayed.
    VOCAB ={
      :manual   => "Ausrüsten",
      :optimize => "Optimum",
      :aptitude => "Attribute",
      :mastery  => "Weaponry",
      :twohand  => "2-Hand",
      :arrow    => "?",
      :noequip  => "<No Equipment>",
      :unequip  => "Unequip",
      :amount   => ":%2d",
      :apt_rate => "%s Rate",
    } # Do not remove this.
   
    # Some of the more unusual stats do not have defined vocabulary to go
    # along with it. Adjust the following hash to give them names.
    STAT_VOCAB ={
      :hit  => "HIT", # Stat that modifies hit rate.
      :eva  => "EVA", # Stat that modifies evasion rate.
      :cri  => "CRI", # Stat that modifies critical rate.
      :odds => "AGR", # Stat that modifies aggro rate.
    } # Do not remove this.
   
    # These are the stats shown inside of the equip scene menu and they order
    # they'll appear in. If a stat applied by a script doesn't exist, it'll be
    # ignored and the next command will be shifted up by one.
    #   Legal Stats:
    #   :hp, :mp, :atk, :def, :spi, :res, :dex, :agi, :hit, :eva, :cri, :odds
    SHOWN_STATS = [:maxhp, :maxmp, :atk, :def, :spi, :res, :dex, :agi]
   
    # This is the icon used for unequipping items.
    UNEQUIP_ICON = 98
   
    # This adjusts the font size used for the equip type categories.
    CATEGORY_FONT_SIZE = 16
   
    # This adjusts the font size used for the stat types.
    STAT_FONT_SIZE = 16
   
    #===========================================================================
    # Section II. Equip Settings
    # --------------------------------------------------------------------------
    # The following allows you to adjust the rules and such governing equipping
    # and unequipping items. Here, you can add additional item slots, remove
    # them, and even change the rules for some. To label certain armours as
    # different equip types, use the <equip type: phrase> and replace it with
    # the named category item within the TYPE_RULES hash.
    #===========================================================================
   
    # This determines the order of equipment inside the equipment scene. Note
    # that this does not include weapons as they're automatically the first
    # piece of equipment by default.
    TYPE_LIST =[
      :shield,   # Shield slot for equippable shield type armours.
      :helmet,   # Helmet slot for equippable headgear type armours.
      :armour,   # Armour slot for equippable bodygear type armours.
      :cloak,    # Cloak slot for equippable mantle type armours.
      :other,    # 1st Accessory slot for misc armours.
      :other,    # 2nd Accessory slot for misc armours.
      :other,    # 3rd Accessory slot for misc armours.
    ] # Do not remove this
   
    # Adjust the following below to determine the ruleset adjusted for equip
    # equip type following the pre-made template. Here's what each does:
    #     Name - The name of the equip type. When using tag, refer to this.
    #     Kind - The kind number associated with the equip type.
    #   Empty? - Whether or not the equipment slot can be empty.
    # Optimize - When optimizing, include this equipment type or not.
    TYPE_RULES ={
    # Type     => [     Name, Kind, Empty?, Optimize],
      :weapon  => [ "Weapon",  nil,  true,     true],
      :shield  => [ "Shield",    0,   true,     true],
      :helmet  => [ "Helmet",    1,   true,     true],
      :armour  => [ "Armour",    2,   true,     true],
      :other   => [  "Other",    3,   true,    false],
      :cloak   => [  "Cloak",    4,   true,     true],
    } # Do not remove this.
   
    # This will determine the stat order at which items are optimized for each
    # equipment type. If type is unlisted, it will pull from the :unlisted
    # category which can also be defined here.
    OPTIMIZE_SETTINGS ={ # Do not delete :unlisted from the keys.
      :unlisted => [:def, :res, :maxhp, :spi, :maxmp, :agi, :atk],
      :weapon   => [:atk, :maxmp, :spi, :agi, :maxhp, :def, :res],
    } # Do not remove this.
   
    #===========================================================================
    # Section III. Base Stat Settings
    # --------------------------------------------------------------------------
    # For those who would love to redefine the way their game calculates their
    # base stats, edit the following options below and use a formula you prefer.
    # Otherwise, leave this alone as they are the default settings. The settings
    # below are only the MaxHP, MaxMP, ADSA, and HECO stats available. This will
    # allow you to modify them without needing to alter the base scripts.
    #===========================================================================
   
    # The following hash contains the basic stat retrieval formula. Modify it
    # if you wish, but make sure they remain in quote format to work.
    BASE_STAT ={
      :maxhp => "actor.parameters[0, @level]",
      :maxmp => "actor.parameters[1, @level]",
      :atk   => "actor.parameters[2, @level]",
      :def   => "actor.parameters[3, @level]",
      :spi   => "actor.parameters[4, @level]",
      :agi   => "actor.parameters[5, @level]",
      :hit   => "95",
      :eva   => "5",
      :cri   => "4 + ((actor.critical_bonus) ? 4 : 0)",
      :odds  => "4 - self.class.position",
    } # Do not remove this.
   
    #===========================================================================
    # Section IV. Aptitude Settings
    # --------------------------------------------------------------------------
    # The following allows you to adjust how much benefit and gain each class
    # gains for each stat when equipping weapons and armours. For instance, a
    # warrior will only benefit from 80% of an SPI boost compared to a mage.
    #===========================================================================
   
    # Set this to true if you wish to use the aptitude system for your game.
    USE_APTITUDE_SYSTEM = true
   
    # This hash adjusts the starting aptitude rates for each class. These
    # rates determine how much of a stat bonus is applied to each individual
    # stat for each piece of equipment.
    APTITUDE ={ # Class 0 is the common class. Do not delete it.
    # ClassID => [MaxHP, MaxMP,   ATK,   DEF,   SPI,   RES,   DEX,   AGI]
            0 => [  100,   100,   100,   100,   100,   100,   100,   100],
            1 => [   90,   110,   100,    80,   110,   120,   100,   130],
            2 => [  140,    80,   120,   110,    80,    70,   110,    80],
            3 => [  120,   105,   110,   110,   110,   110,   110,   110],
            4 => [   80,   130,    80,    80,   120,   190,   110,   200],
            5 => [  105,    95,   105,   100,   105,   110,    90,    90],
            6 => [   95,   105,   105,   100,   110,   105,    90,    90],
            7 => [  120,    80,   120,    90,    90,    80,   120,   100],
            8 => [   90,   110,    90,    80,   110,    80,   120,   120],
    } # Do not remove this.
   
    # This determines the maximum and minimum aptitudes possible. Anything
    # more or anything less will be treated as the minimum or maximum.
    MINIMUM_APTITUDE = 50
    MAXIMUM_APTITUDE = 300
   
    # This will reveal all aptitude boost items for your game if your game
    # has any. Set this to false and it will only reveal aptitude boosts that
    # the player has.
    SHOW_APT_BOOSTS = true
   
  end # EQUIP 
end # YEM

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

module YEM
  module REGEXP
    module BASEITEM
     
      STAT_SET = /<(.*):[ ]*([\+\-]\d+)>/i
      STAT_PER = /<(.*):[ ]*([\+\-]\d+)([%%])>/i
      TRAITS   = /<(?:TRAITS|trait):[ ](.*)>/i
      REQ_SWITCH = /<(?:REQUIRE SWITCH||require switches):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      REQ_STRING = /<(?:REQUIRE|req)[ ](.*):[ ](\d+)[ ](.*)[ ](\d+)>/i
      REQUIRE    = /<(?:REQUIRE|req)[ ](.*):[ ](.*)[ ](\d+)>/i
      AUTOSTATES = /<(?:AUTO_STATE|auto state|auto states):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      APT_GROWTH = /<(.*)[ ](?:APTITUDE|apt):[ ]([\+\-]\d+)([%%])>/i
     
      TWO_HAND = /<(?:2_HAND_TEXT|2 hand text):[ ](.*)>/i
      EQUIP_TYPE = /<(?:EQUIP_TYPE|equip type):[ ](.*)>/i
     
    end # BASEITEM
    module STATE
     
      EQUIP_CANCEL = /<(?:EQUIP_CANCEL|equip cancel):[ ](.*)>/i
     
    end # STATE
  end # REGEXP
  module EQUIP
   
    # Compare Parameters Processing
    COMP_PARAM_PROC = {
      :maxhp => Proc.new { |a, b| b.maxhp - a.maxhp },
      :maxmp => Proc.new { |a, b| b.maxmp - a.maxmp },
      :atk => Proc.new { |a, b| b.atk - a.atk },
      :def => Proc.new { |a, b| b.def - a.def },
      :spi => Proc.new { |a, b| b.spi - a.spi },
      :res => Proc.new { |a, b| b.res - a.res },
      :dex => Proc.new { |a, b| b.dex - a.dex },
      :agi => Proc.new { |a, b| b.agi - a.agi }, }
    # Obtain Parameters Processing
    GET_PARAM_PROC = {
      :maxhp => Proc.new { |n| n.maxhp },
      :maxmp => Proc.new { |n| n.maxmp },
      :atk => Proc.new { |n| n.atk },
      :def => Proc.new { |n| n.def },
      :spi => Proc.new { |n| n.spi },
      :res => Proc.new { |n| n.res },
      :dex => Proc.new { |n| n.dex },
      :agi => Proc.new { |n| n.agi }, }
   
  end # EQUIP
end # YEM

#===============================================================================
# RPG::BaseItem
#===============================================================================

class RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :maxhp
  attr_accessor :maxmp
  attr_accessor :atk
  attr_accessor :def
  attr_accessor :spi
  attr_accessor :agi
  attr_accessor :hit
  attr_accessor :eva
  attr_accessor :cri
  attr_accessor :odds
  attr_accessor :stat_per
  attr_accessor :traits
  attr_accessor :autostates
  attr_accessor :apt_growth
  attr_accessor :requirements
  attr_accessor :required_switches
  attr_accessor :req_variables_above
  attr_accessor :req_variables_under
  attr_accessor :req_weaponlvl_above
  attr_accessor :req_weaponlvl_under
 
  #--------------------------------------------------------------------------
  # common cache: yem_cache_baseitem_eo
  #--------------------------------------------------------------------------
  def yem_cache_baseitem_eo
    return if @cached_baseitem_eo; @cached_baseitem_eo = true
    @maxhp = 0; @maxmp = 0; @cri = 0; @odds = 0
    @hit = 0 if @hit == nil; @eva = 0 if @eva == nil
    @stat_per ={ :hp => 0, :mp => 0, :atk => 0, :def => 0, :spi => 0,
      :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0}
    @autostates = []; @apt_growth = {}; @traits = []
    @requirements = {}; @required_switches = []
    @req_variables_above = {}; @req_variables_under = {}
    @req_weaponlvl_above = {}; @req_weaponlvl_under = {}
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEM::REGEXP::BASEITEM::TRAITS
        case $1.upcase
        when "SUPER GUARD", "SUPER_GUARD", "SUPERGUARD"
          @traits.push(:super_guard)
        when "PHARMACOLOGY", "PHARMA", "ITEM BOOST", "ITEM_BOOST"
          @traits.push(:pharmacology)
        when "FAST ATTACK", "FAST_ATTACK", "FASTATTACK"
          @traits.push(:fast_attack)
        when "DUAL ATTACK", "DUALATTACK", "DUAL_ATTACK"
          @traits.push(:dual_attack)
        when "PREVENT_CRITICAL", "PREVENT CRITICAL", "PREVENT CRI"
          @traits.push(:prevent_critical)
        when "HALF MP COST", "HALF_MP_COST", "HALF MP", "HALF_MP", "HALFMP"
          @traits.push(:half_mp_cost)
        when "DOUBLE EXP GAIN", "DOUBLE_EXP_GAIN", "DOUBLE EXP", "DOUBLE_EXP"
          @traits.push(:double_exp_gain)
        when "AUTO_HP_RECOVER", "AUTO HP RECOVER", "AUTO HP", "AUTO_HP"
          @traits.push(:auto_hp_recover)
        when "ANTI HP REGEN", "ANTI_HP_REGEN"
          @traits.push(:anti_hp_regen)
        when "ANTI HP DEGEN", "ANTI_HP_DEGEN"
          @traits.push(:anti_hp_degen)
        when "ANTI MP REGEN", "ANTI_MP_REGEN"
          @traits.push(:anti_mp_regen)
        when "ANTI MP DEGEN", "ANTI_MP_DEGEN"
          @traits.push(:anti_mp_degen)
        else; next
        end
      #---
      when YEM::REGEXP::BASEITEM::APT_GROWTH
        case $1.upcase
        when "HP","MAXHP"; @apt_growth[:hp] = $2.to_i
        when "MP","MAXMP"; @apt_growth[:mp] = $2.to_i
        when "ATK"; @apt_growth[:atk] = $2.to_i
        when "DEF"; @apt_growth[:def] = $2.to_i
        when "SPI"; @apt_growth[:spi] = $2.to_i
        when "RES"; @apt_growth[:res] = $2.to_i
        when "DEX"; @apt_growth[:dex] = $2.to_i
        when "AGI"; @apt_growth[:agi] = $2.to_i
        end
      #---
      when YEM::REGEXP::BASEITEM::AUTOSTATES
        $1.scan(/\d+/).each { |num|
        @autostates.push(num.to_i) if num.to_i > 0 }
      #---
      when YEM::REGEXP::BASEITEM::REQ_SWITCH
        $1.scan(/\d+/).each { |num|
        @required_switches.push(num.to_i) if num.to_i > 0 }
        @requirements["SWITCH"] = true
      #---
      when YEM::REGEXP::BASEITEM::REQ_STRING
        case $1.upcase
        when "VARIABLE", "VAR"
          text = "VARIABLE"
          case $3.upcase
          when "ABOVE", "AT LEAST" "OVER", "GREATER THAN"
            text += " ABOVE"
            @req_variables_above[$2.to_i] = $4.to_i
          when "UNDER", "BELOW", "AT MOST", "LESS THAN"
            text += " UNDER"
            @req_variables_under[$2.to_i] = $4.to_i
          else; next
          end
        when "WEAPON LEVEL", "MASTERY", "WEAPON LVL", "WLVL"
          text = "WEAPON LEVEL"
          case $3.upcase
          when "ABOVE", "AT LEAST" "OVER", "GREATER THAN"
            text += " ABOVE"
            @req_weaponlvl_above[$2.to_i] = $4.to_i
          when "UNDER", "BELOW", "AT MOST", "LESS THAN"
            text += " UNDER"
            @req_weaponlvl_under[$2.to_i] = $4.to_i
          else; next
          end
        else; next
        end
        @requirements[text] = true
      #---
      when YEM::REGEXP::BASEITEM::REQUIRE
        case $2.upcase
        when "ABOVE", "AT LEAST" "OVER", "GREATER THAN"
          text = "ABOVE"
        when "UNDER", "BELOW", "AT MOST", "LESS THAN"
          text = "UNDER"
        else; next
        end
        text += " "
        case $1.upcase
        when "LEVEL", "LV", "LVL"
          text += "LEVEL"
        when "HP", "MAXHP"
          text += "MAXHP"
        when "MP", "MAXMP", "SP", "MAXSP"
          text += "MAXMP"
        when "INT", "MAG"
          text += "INT"
        when "AGG", "AGGRO"
          text += "ODDS"
        when "ATK", "DEF", "SPI", "INT", "RES", "DEX", "AGI"
          next if $1.upcase == "DEX" and !$imported["DEX Stat"]
          next if $1.upcase == "RES" and !$imported["RES Stat"]
          text += $1.upcase
        when "HIT", "EVA", "CRI", "ODDS"
          text += $1.upcase
        else; next
        end
        @requirements[text] = $3.to_i
      #---
      when YEM::REGEXP::BASEITEM::STAT_SET
        case $1.upcase
        when "HP","MAXHP"; @maxhp = $2.to_i
        when "MP","MAXMP"; @maxmp = $2.to_i
        when "ATK"; @atk = $2.to_i
        when "DEF"; @def = $2.to_i
        when "SPI"; @spi = $2.to_i
        when "AGI"; @agi = $2.to_i
        when "HIT"; @hit = $2.to_i
        when "EVA"; @eva = $2.to_i
        when "CRI"; @cri = $2.to_i
        when "ODDS"; @odds = $2.to_i
        end
      #---
      when YEM::REGEXP::BASEITEM::STAT_PER
        case $1.upcase
        when "HP","MAXHP"; @stat_per[:hp] = $2.to_i
        when "MP","MAXMP"; @stat_per[:mp] = $2.to_i
        when "ATK"; @stat_per[:atk] = $2.to_i
        when "DEF"; @stat_per[:def] = $2.to_i
        when "SPI"; @stat_per[:spi] = $2.to_i
        when "AGI"; @stat_per[:agi] = $2.to_i
        when "HIT"; @stat_per[:hit] = $2.to_i
        when "EVA"; @stat_per[:eva] = $2.to_i
        when "CRI"; @stat_per[:cri] = $2.to_i
        when "ODDS"; @stat_per[:odds] = $2.to_i
        end
      #---
      end
    } # end self.note.split
    @requirements["NONE"] = 0 if @requirements == {}
  end # yem_cache_baseitem_eo
 
  #--------------------------------------------------------------------------
  # anti-crash methods
  #--------------------------------------------------------------------------
  unless $imported["DEX Stat"]; def dex; return 0; end; end
  unless $imported["RES Stat"]; def res; return 0; end; end
 
end # RPG::BaseItem

#===============================================================================
# RPG::Weapon
#===============================================================================

class RPG::Weapon < RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # public instance variable
  #--------------------------------------------------------------------------
  attr_accessor :two_hand_text
 
  #--------------------------------------------------------------------------
  # common cache: yem_cache_weapon_eo
  #--------------------------------------------------------------------------
  def yem_cache_weapon_eo
    return if @cached_weapon_eo; @cached_weapon_eo = true
    @two_hand_text = YEM::EQUIP::VOCAB[:twohand]
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YEM::REGEXP::BASEITEM::TWO_HAND
        @two_hand_text = $1.to_s
      end
    } # end self.note.split
  end # yem_cache_weapon_eo
 
end # RPG::Weapon

#===============================================================================
# RPG::Armor
#===============================================================================

class RPG::Armor < RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :kind
  attr_accessor :equip_type
 
  #--------------------------------------------------------------------------
  # common cache: yem_cache_armour_eo
  #--------------------------------------------------------------------------
  def yem_cache_armour_eo
    @equip_type = @kind
    for key in YEM::EQUIP::TYPE_RULES
      next if key[1][1] != @kind
      @equip_type = key[1][0].upcase
    end
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YEM::REGEXP::BASEITEM::EQUIP_TYPE
        for key in YEM::EQUIP::TYPE_RULES
          next if key[1][0].upcase != $1.upcase
          @kind = key[1][1]; break
          @equip_type = $1.upcase
        end
      end
    } # end self.note.split
  end # yem_cache_armour_eo
 
end # RPG::Armor
 
#===============================================================================
# RPG::State
#===============================================================================

class RPG::State
 
  #--------------------------------------------------------------------------
  # common cache: yem_cache_state_eo
  #--------------------------------------------------------------------------
  def yem_cache_state_eo
    @equip_cancel = []
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YEM::REGEXP::STATE::EQUIP_CANCEL
        text = $1.to_s
        @equip_cancel.push(text.upcase)
      end
    } # # end self.note.split
  end # yem_cache_state_eo
 
  #--------------------------------------------------------------------------
  # new method: equip_cancel
  #--------------------------------------------------------------------------
  def equip_cancel
    yem_cache_state_eo if @equip_cancel == nil
    return @equip_cancel
  end
 
end # RPG::State

#===============================================================================
# Vocab
#===============================================================================

module Vocab
 
  #--------------------------------------------------------------------------
  # self.hit
  #--------------------------------------------------------------------------
  def self.hit; return YEM::EQUIP::STAT_VOCAB[:hit]; end
 
  #--------------------------------------------------------------------------
  # self.eva
  #--------------------------------------------------------------------------
  def self.eva; return YEM::EQUIP::STAT_VOCAB[:eva]; end
 
  #--------------------------------------------------------------------------
  # self.cri
  #--------------------------------------------------------------------------
  def self.cri; return YEM::EQUIP::STAT_VOCAB[:cri]; end
   
  #--------------------------------------------------------------------------
  # self.odds
  #--------------------------------------------------------------------------
  def self.odds; return YEM::EQUIP::STAT_VOCAB[:odds]; end
 
end # Vocab

#===============================================================================
# module Icon
#===============================================================================
if !$imported["BattleEngineMelody"] and !$imported["IconModuleLibrary"]
module Icon
 
  #--------------------------------------------------------------------------
  # self.stat
  #--------------------------------------------------------------------------
  def self.stat(actor, item); return 0; end
 
end # Icon
end # !$imported["BattleEngineMelody"] and !$imported["IconModuleLibrary"]

#===============================================================================
# Scene_Title
#===============================================================================

class Scene_Title < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias method: load_bt_database
  #--------------------------------------------------------------------------
  alias load_bt_database_eo load_bt_database unless $@
  def load_bt_database
    load_bt_database_eo
    load_eo_cache
  end
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  alias load_database_eo load_database unless $@
  def load_database
    load_database_eo
    load_eo_cache
  end
 
  #--------------------------------------------------------------------------
  # new method: load_eo_cache
  #--------------------------------------------------------------------------
  def load_eo_cache
    groups = [$data_items, $data_weapons, $data_armors]
    for group in groups
      for obj in group
        next if obj == nil
        obj.yem_cache_baseitem_eo if obj.is_a?(RPG::BaseItem)
        obj.yem_cache_weapon_eo if obj.is_a?(RPG::Weapon)
        obj.yem_cache_armour_eo if obj.is_a?(RPG::Armor)
      end
    end
  end
 
end # Scene_Title

#===============================================================================
# Game_Temp
#===============================================================================

class Game_Temp
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :equip_last
 
  #--------------------------------------------------------------------------
  # new method: aptitude_items
  #--------------------------------------------------------------------------
  def aptitude_items
    return @aptitude_items if @aptitude_items != nil
    @aptitude_items = []
    for item in $data_items
      next if item == nil
      next if item.apt_growth == {}
      @aptitude_items.push(item)
    end
    return @aptitude_items
  end
 
end # Game_Temp
 
#===============================================================================
# Game_Battler
#===============================================================================

class Game_Battler
 
  #--------------------------------------------------------------------------
  # alias method: states
  #--------------------------------------------------------------------------
  alias states_eo states unless $@
  def states
    list = states_eo
    list += equip_autostates if actor?
    list.uniq.sort! { |state_a,state_b|
      if state_a.priority != state_b.priority
        state_b.priority <=> state_a.priority
      else
        state_a.id <=> state_b.id
      end }
    return list.uniq
  end
 
  #--------------------------------------------------------------------------
  # alias method: item_test
  #--------------------------------------------------------------------------
  alias item_test_eo item_test unless $@
  def item_test(user, item)
    return true if item.apt_growth != {}
    return item_test_eo(user, item)
  end
 
  #--------------------------------------------------------------------------
  # alias method: item_growth_effect
  #--------------------------------------------------------------------------
  alias item_growth_effect_eo item_growth_effect unless $@
  def item_growth_effect(user, item)
    if item.apt_growth != {} and actor?
      create_aptitude_bonus
      for key in item.apt_growth
        type = key[0]; value = key[1]
        case type
        when :hp, :mp, :atk, :def, :spi, :res, :dex, :agi
          @bonus_apt[type] += value
        else; next
        end
      end
      purge_unequippable
    end
    item_growth_effect_eo(user, item)
  end
 
  #--------------------------------------------------------------------------
  # new method: traits
  #--------------------------------------------------------------------------
  unless # $imported["BattleEngineMelody"]
  def traits
    return @cache_traits if @cache_traits != nil
    @cache_traits = []
    for state in states; @cache_traits |= state.traits; end
    if actor?
      for equip in equips.compact; @cache_traits |= equip.traits; end
    end
    return @cache_traits
  end
  end # $imported["BattleEngineMelody"]
 
end # Game_Battler

#===============================================================================
# Game_Actor
#===============================================================================

class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # alias method: setup
  #--------------------------------------------------------------------------
  alias setup_eo setup unless $@
  def setup(actor_id)
    setup_eo(actor_id)
    @extra_armor_id = []
    @locked_equips = []
    @equip_type = nil
    @bonus_apt = nil
    create_aptitude_bonus
    purge_unequippable
  end

  #--------------------------------------------------------------------------
  # overwrite method: base_maxhp
  #--------------------------------------------------------------------------
  def base_maxhp
    n = eval(YEM::EQUIP::BASE_STAT[:maxhp])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:hp], :hp)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.maxhp, :hp)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: base_maxmp
  #--------------------------------------------------------------------------
  def base_maxmp
    n = eval(YEM::EQUIP::BASE_STAT[:maxmp])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:mp], :mp)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.maxmp, :mp)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: base_atk
  #--------------------------------------------------------------------------
  def base_atk
    n = eval(YEM::EQUIP::BASE_STAT[:atk])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:atk], :atk)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.atk, :atk)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: base_def
  #--------------------------------------------------------------------------
  def base_def
    n = eval(YEM::EQUIP::BASE_STAT[:def])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:def], :def)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.def, :def)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: base_spi
  #--------------------------------------------------------------------------
  def base_spi
    n = eval(YEM::EQUIP::BASE_STAT[:spi])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:spi], :spi)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.spi, :spi)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: base_agi
  #--------------------------------------------------------------------------
  def base_agi
    n = eval(YEM::EQUIP::BASE_STAT[:agi])
    percent = 100
    for item in equips.compact
      percent += aptitude(item.stat_per[:agi], :agi)
    end
    n *= percent / 100.0
    for item in equips.compact
      n += aptitude(item.agi, :agi)
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: hit
  #--------------------------------------------------------------------------
  def hit
    n = eval(YEM::EQUIP::BASE_STAT[:hit])
    if two_swords_style
      n1 = weapons[0] == nil ? n : weapons[0].hit
      n2 = weapons[1] == nil ? n : weapons[1].hit
      n = [n1, n2].min
    else
      n = weapons[0] == nil ? n : weapons[0].hit
    end
    percent = 100
    for item in equips.compact
      percent += item.stat_per[:hit]
    end
    n *= percent / 100.0
    for item in armors.compact
      n += item.hit
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: eva
  #--------------------------------------------------------------------------
  def eva
    n = eval(YEM::EQUIP::BASE_STAT[:eva])
    for item in equips.compact
      n += item.eva
    end
    percent = 100
    for item in equips.compact
      percent += item.stat_per[:eva]
    end
    n *= percent / 100.0
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: cri
  #--------------------------------------------------------------------------
  def cri
    n = eval(YEM::EQUIP::BASE_STAT[:cri])
    for weapon in weapons.compact
      n += 4 if weapon.critical_bonus
    end
    percent = 100
    for item in equips.compact
      percent += item.stat_per[:cri]
    end
    n *= percent / 100.0
    for item in equips.compact
      n += item.cri
    end
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: odds
  #--------------------------------------------------------------------------
  def odds
    n = $imported["AggroAI"] ? base_aggro : eval(YEM::EQUIP::BASE_STAT[:odds])
    for item in equips.compact
      n += item.odds
    end
    percent = 100
    for item in equips.compact
      percent += item.stat_per[:odds]
    end
    n *= percent / 100.0
    return [Integer(n), 1].max
  end
 
  #--------------------------------------------------------------------------
  # new method: aptitude
  #--------------------------------------------------------------------------
  def aptitude(n, type)
    return n unless YEM::EQUIP::USE_APTITUDE_SYSTEM
    multiplier = aptitude_rate(type)
    n = n * multiplier / 100
    return n
  end
 
  #--------------------------------------------------------------------------
  # new method: aptitude_rate
  #--------------------------------------------------------------------------
  def aptitude_rate(type)
    if YEM::EQUIP::APTITUDE.include?(@class_id)
      array = YEM::EQUIP::APTITUDE[@class_id]
    else
      array = YEM::EQUIP::APTITUDE[0]
    end
    type = :hp if type == :maxhp
    type = :mp if type == :maxmp
    create_aptitude_bonus
    multiplier = 0
    case type
    when :hp;  multiplier = array[0]
    when :mp;  multiplier = array[1]
    when :atk; multiplier = array[2]
    when :def; multiplier = array[3]
    when :spi; multiplier = array[4]
    when :res; multiplier = array[5]
    when :dex; multiplier = array[6]
    when :agi; multiplier = array[7]
    end
    multiplier += @bonus_apt[type]
    multiplier = [multiplier, YEM::EQUIP::MINIMUM_APTITUDE].max
    multiplier = [multiplier, YEM::EQUIP::MAXIMUM_APTITUDE].min
    return multiplier
  end
 
  #--------------------------------------------------------------------------
  # new method: reset_aptitudes
  #--------------------------------------------------------------------------
  def reset_aptitudes
    @bonus_apt = nil
    create_aptitude_bonus
  end
 
  #--------------------------------------------------------------------------
  # new method: create_aptitude_bonus
  #--------------------------------------------------------------------------
  def create_aptitude_bonus
    @bonus_apt = {} if @bonus_apt == nil
    @bonus_apt[:hp]  = 0 if @bonus_apt[:hp] == nil
    @bonus_apt[:mp]  = 0 if @bonus_apt[:mp] == nil
    @bonus_apt[:atk] = 0 if @bonus_apt[:atk] == nil
    @bonus_apt[:def] = 0 if @bonus_apt[:def] == nil
    @bonus_apt[:spi] = 0 if @bonus_apt[:spi] == nil
    @bonus_apt[:res] = 0 if @bonus_apt[:res] == nil
    @bonus_apt[:dex] = 0 if @bonus_apt[:dex] == nil
    @bonus_apt[:agi] = 0 if @bonus_apt[:agi] == nil
  end
 
  #--------------------------------------------------------------------------
  # new method: equip_type
  #--------------------------------------------------------------------------
  def equip_type
    if @equip_type.is_a?(Array)
      return @equip_type
    else
      return YEM::EQUIP::TYPE_LIST
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: equip_type=
  #--------------------------------------------------------------------------
  def equip_type=(array)
    if array == nil
      @equip_type = nil
      purge_unequippable
      return
    end
    return unless array.is_a?(Array)
    array.delete(:weapon)
    @equip_type = YEM::EQUIP::TYPE_LIST if @equip_type == nil
    if @equip_type.size > array.size
      for i in array.size..@equip_type.size; change_equip(i, nil); end
    end
    @equip_type = array
    purge_unequippable
  end
 
  #--------------------------------------------------------------------------
  # new method: add_equip_type
  #--------------------------------------------------------------------------
  def add_equip_type(type)
    return unless YEM::EQUIP::TYPE_RULES.include?(type)
    return if type == :weapon
    @equip_type = YEM::EQUIP::TYPE_LIST if @equip_type == nil
    @equip_type.push(type)
    purge_unequippable
  end
 
  #--------------------------------------------------------------------------
  # new method: delete_last_equip_type
  #--------------------------------------------------------------------------
  def delete_last_equip_type
    @equip_type = YEM::EQUIP::TYPE_LIST if @equip_type == nil
    return if @equip_type.size <= 0
    change_equip(@equip_type.size, nil)
    @equip_type.pop
  end
 
  #--------------------------------------------------------------------------
  # new method: armor_number
  #--------------------------------------------------------------------------
  def armor_number
    return equip_type.size
  end
 
  #--------------------------------------------------------------------------
  # new method: extra_armor_number
  #--------------------------------------------------------------------------
  def extra_armor_number
    return [armor_number - 4, 0].max
  end
 
  #--------------------------------------------------------------------------
  # new method: extra_armor_id
  #--------------------------------------------------------------------------
  def extra_armor_id
    @extra_armor_id = [] if @extra_armor_id == nil
    return @extra_armor_id
  end
 
  #--------------------------------------------------------------------------
  # alias method: armors
  #--------------------------------------------------------------------------
 
SimplePortal 2.3.3 © 2008-2010, SimplePortal