장비

YERD - Extra Equipment Options ReDONE

by 훈덕 posted Nov 08, 2009
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

장비에 보너스 스텟을 부여하거나

장비하면 자동으로 특정 상태가 된다거나(무조건 공격, 자동 가속 등등)

장비하는데 필요한 조건을 부여하거나

저주받은 장비를 만들 수 있습니다.

 

#===============================================================================
#
# Yanfly Engine RD - Extra Equipment Options ReDONE
# Last Date Updated: 2009.06.14
# Level: Normal, Hard
#
# This is a rewrite of my former Extra Equipment Options script so if you have
# that one, discard it and use this one. This script provides equipment more
# flexibility and options.
#
# BONUS STATS
# By default, VX gave equipment a maximum stat increase of 500. For those who
# love insanely huge numbers or has a game that provides insanely huge numbers,
# equipment creation becomes a problem. The script allows you to bypass the
# maximum increase and also allows you to give equipment stat boosts to MaxHP,
# MaxMP, Hit, Eva, Cri, and Odds, which weren't originally available.
#
# TRAITS
# Some equipment traits were limited to just weapons or armours. Some weren't
# even available at all. Equipment traits will allow you give weapons and armour
# more traits than what was originally available for them such as autobattling
# and auto-states.
#
# REQUIREMENTS
# If you don't want equipment to be worn immediately right away, you can set
# certain requirements on them to be met first before allowing actors to wear
# them. Should at any time the actor fall below the requirements, the pieces
# of unwearable equipment will be purged.
#
# CURSED ITEMS
# Some items can now curse equipment slots. If a piece of equipment is cursed,
# the player cannot unequip it until the actor is purified or an event manually
# changes the equipment worn.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.06 - Improved efficiency when checking equipment purging.
# o 2009.06.02 - Added percentile increase.
# o 2009.06.01 - Started version 2.0 and finished.
# o 2009.04.26 - Temporarily removed buggy features.
# o 2009.04.23 - Started on script and finished.
#===============================================================================
# Instructions
#===============================================================================
#
# The following tags go into your weapon and armour's noteboxes.
#
# <bonus stat +x>
# This will raise the stat by x value. If "+" then x will increase. If "-"
# then x will decrease. The "stat" can be replaced by maxhp, maxmp, atk, def,
# spi, agi, hit, eva, cri, or odds. This also lets you surpass the default 500
# value limit when using x.

# <bonus stat +x%>
# This will raise the stat by x percent. If "+" then x will increase. If "-"
# then x will decrease. The "stat" can be replaced by maxhp, maxmp, atk, def,
# spi, agi, hit, eva, cri, or odds. <bonus atk +5%> will raise atk by 5%.
#
# <trait x>
# This will allow you to give your actors specific traits when equipping a piece
# of equipment. Add more of the tag to have more traits. Traits are as follows:
#    auto battle => Makes the actor automatically fight in battle
#    super guard => Gives the actor more damage reduction when guarding
#   pharmacology => Items used by the actor give double effect
#    fast attack => Actor attacks faster in battle
#    dual attack => Actor attacks twice in battle
#    prevent cri => Actor cannot suffer critical hits
#   half mp cost => Actor consumes half mp when casting skills
#     double exp => Actor gains double exp in battle
#    auto hp rec => Actor regenerates HP in battle
#
# <auto state x> or <auto state x,x>
# This will automatically place state x on your actors when that piece of
# equipment is worn. To make a piece of equipment have more than one auto state,
# place more of the autostate tags or use the x,x tag.
#
# <require more stat x>
# This will cause the piece of equipment to require more than x amount of stat
# before it can be worn. The "stat" can be replaced by maxhp, maxmp, atk, def,
# spi, agi, hit, eva, cri, or odds.
#
# <require less stat x>
# This will cause the piece of equipment to require less than x amount of stat
# before it can be worn. The "stat" can be replaced by maxhp, maxmp, atk, def,
# spi, agi, hit, eva, cri, or odds.
#
# <require switch x> or <require switch x,x>
# This will cause the piece of equipment to requires the switches x to be on
# before it can be worn. To require multiple switches, add more tags or use the
# x,x tag instead.
#
# <cursed item>
# When the actor equips this item, the equipment slot will become cursed until
# the item is unequipped through an event or a purifying item is used on the
# actor. Once purified, the cursed equipment will still be on the actor, still
# provide stat bonuses, but can be finally unequipped. Note that actors only
# become cursed when the player equips the item. If the item is equipped via
# event, it will not be cursed. You can also force curse a slot by using the
# following event script: $game_actors[1].set_cursed_slot(0)
#
# <purify item>
# NOTE: This is for usable items only. This will completely uncurse the target
# ally and any cursed equipment previously on the before-cursed ally can now be
# unequipped. Cursed equipment stat bonuses still remain. For those who would
# like to event script purification, it's $game_actors[1].purify_curses
#
#===============================================================================
#
# Compatibility
# - Works With: KGC's EquipExtension, ExtendedEquipScene
# - Alias: Game_Battler: states, stats=, item_effect, item_test
# - Alias: Game_Actor: base_stats, HECO, level_up, level_down, traits
# - Alias: Game_Actor: change_equip
# - Alias: Game_Interpreter: command_121
# - Alias: Scene_Equip: update, update_equip_selection, update_item_selection
#
#===============================================================================

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

module YE
  module EQUIP
     
    # Set this option to true if you want unequippable items to be purged
    # each time after a change in levels, stats, or switches.
    PURGE_UNEQUIPPABLE_ITEMS = true
   
    # This determines whether or not equipment will purge in battle. I highly
    # recommend that you don't enable this.
    ALLOW_PURGE_IN_BATTLE = false
   
    # This pops up a window to alert the player that a cursed item has been
    # equipped on the actor. Also, you may adjust other settings here, too.
    CURSED_WINDOW  = true
    CURSED_SOUND   = RPG::SE.new("Down", 80, 150)
    CURSED_WIDTH   = 360
    CURSED_WIN_Y   = 180
    CURSED_MESSAGE = "%s equips a cursed item!"
     
  end # EQUIP
end # YE

#===============================================================================
# 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 YE
  module REGEXP
    module EQUIP
     
      if $imported["LimitBreak"]
        HECOLIMIT = KGC::LimitBreak::ACTOR_PARAMETER_LIMIT
      else
        HECOLIMIT = 999
      end
      BONUS_PARAM  = /^<(?:BONUS|bonus)[ ]*(.*)[ ]([+-]d+)>/i
      BONUS_PARAMP = /^<(?:BONUS|bonus)[ ]*(.*)[ ]([+-]d+)([%%])>/i
     
      REQUIRE_MORE = /^<(?:REQUIRE_MORE|require more)[ ]*(.*)[ ](d+)>/i
      REQUIRE_LESS = /^<(?:REQUIRE_LESS|require less)[ ]*(.*)[ ](d+)>/i
      REQUIRE_SWITCH = /^<(?:REQUIRE_SWITCH|require switch)[ ]*(d+(?:s*,s*d+)*)>/i
     
      AUTO_STATE   = /<(?:AUTO_STATE|auto state|autostate)[ ]*(d+(?:s*,s*d+)*)>/i
     
      AUTO_BATTLE  = /^<(?:TRAIT|trait|bonus trait)[ ](?:AUTO_BATTLE|auto battle)>/i
      SUPER_GUARD  = /^<(?:TRAIT|trait|bonus trait)[ ](?:SUPER_GUARD|super guard)>/i
      ITEM_BOOST   = /^<(?:TRAIT|trait|bonus trait)[ ](?:PHARMACOLOGY|item boost)>/i
      FAST_ATTACK  = /^<(?:TRAIT|trait|bonus trait)[ ](?:FAST_ATTACK|fast attack)>/i
      DUAL_ATTACK  = /^<(?:TRAIT|trait|bonus trait)[ ](?:DUAL_ATTACK|dual attack)>/i
      PREVENT_CRI  = /^<(?:TRAIT|trait|bonus trait)[ ](?:PREVENT_CRI|prevent cri)>/i
      HALF_MP_COST = /^<(?:TRAIT|trait|bonus trait)[ ](?:HALF_MP_COST|half mp cost)>/i
      DOUBLE_EXP   = /^<(?:TRAIT|trait|bonus trait)[ ](?:DOUBLE_EXP|double exp)>/i
      AUTO_HP_REC  = /^<(?:TRAIT|trait|bonus trait)[ ](?:AUTO_HP_REC|auto_hp_rec)>/i
     
      CURSED_ITEM  = /^<(?:CURSED_ITEM|cursed item|cursed)>/i
      PURIFY_ITEM  = /^<(?:PURIFY_ITEM|purify item|purify)>/i
     
    end
  end
end

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

class RPG::BaseItem

  #--------------------------------------------------------------------------
  # Yanfly_Cache_BaseItem_EEO
  #--------------------------------------------------------------------------
  def yanfly_cache_baseitem_eeo
    @requirements = false
    @bonus_param = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
      :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0 }
    @bonus_paramp = { :maxhp => 100, :maxmp => 100, :atk => 100, :def => 100,
    :spi => 100, :agi => 100, :hit => 100, :eva => 100, :cri => 100, :odds => 100 }
    @require_more = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
      :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0, :level => 0, :switch => false }
    @require_less = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
      :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0, :level => 0, :switch => false }
    @bonus_trait = []; @require_switch = []; @auto_state = []; @cursed = false
    @purify = false
   
    self.note.split(/[rn]+/).each { |line|
      case line
      when YE::REGEXP::EQUIP::BONUS_PARAM
        case $1.to_s
        when "maxhp","MAXHP"; @bonus_param[:maxhp] += $2.to_i
        when "maxmp","MAXMP"; @bonus_param[:maxmp] += $2.to_i
        when "atk","ATK";     @bonus_param[:atk]   += $2.to_i
        when "def","DEF";     @bonus_param[:def]   += $2.to_i
        when "spi","SPI";     @bonus_param[:spi]   += $2.to_i
        when "agi","AGI";     @bonus_param[:agi]   += $2.to_i
        when "hit","HIT";     @bonus_param[:hit]   += $2.to_i
        when "eva","EVA";     @bonus_param[:eva]   += $2.to_i
        when "cri","CRI";     @bonus_param[:cri]   += $2.to_i
        when "odds","ODDS";   @bonus_param[:odds]  += $2.to_i
        end
      when YE::REGEXP::EQUIP::BONUS_PARAMP
        case $1.to_s
        when "maxhp","MAXHP"; @bonus_paramp[:maxhp] += $2.to_i
        when "maxmp","MAXMP"; @bonus_paramp[:maxmp] += $2.to_i
        when "atk","ATK";     @bonus_paramp[:atk]   += $2.to_i
        when "def","DEF";     @bonus_paramp[:def]   += $2.to_i
        when "spi","SPI";     @bonus_paramp[:spi]   += $2.to_i
        when "agi","AGI";     @bonus_paramp[:agi]   += $2.to_i
        when "hit","HIT";     @bonus_paramp[:hit]   += $2.to_i
        when "eva","EVA";     @bonus_paramp[:eva]   += $2.to_i
        when "cri","CRI";     @bonus_paramp[:cri]   += $2.to_i
        when "odds","ODDS";   @bonus_paramp[:odds]  += $2.to_i
        end
       
      when YE::REGEXP::EQUIP::AUTO_BATTLE
        @bonus_trait.push("auto battle")
      when YE::REGEXP::EQUIP::SUPER_GUARD
        @bonus_trait.push("super guard")
      when YE::REGEXP::EQUIP::ITEM_BOOST
        @bonus_trait.push("item boost")
      when YE::REGEXP::EQUIP::FAST_ATTACK
        @bonus_trait.push("fast attack")
      when YE::REGEXP::EQUIP::DUAL_ATTACK
        @bonus_trait.push("dual attack")
      when YE::REGEXP::EQUIP::PREVENT_CRI
        @bonus_trait.push("prevent cri")
      when YE::REGEXP::EQUIP::HALF_MP_COST
        @bonus_trait.push("half mp cost")
      when YE::REGEXP::EQUIP::DOUBLE_EXP
        @bonus_trait.push("double exp")
      when YE::REGEXP::EQUIP::AUTO_HP_REC
        @bonus_trait.push("auto hp rec")
       
      when YE::REGEXP::EQUIP::REQUIRE_MORE
        @requirements = true
        @require_more[:switch] = true
        case $1.to_s
        when "level","LEVEL"; @require_more[:level] = $2.to_i
        when "maxhp","MAXHP"; @require_more[:maxhp] = $2.to_i
        when "maxmp","MAXMP"; @require_more[:maxmp] = $2.to_i
        when "atk","ATK";     @require_more[:atk]   = $2.to_i
        when "def","DEF";     @require_more[:def]   = $2.to_i
        when "spi","SPI";     @require_more[:spi]   = $2.to_i
        when "agi","AGI";     @require_more[:agi]   = $2.to_i
        when "hit","HIT";     @require_more[:hit]   = $2.to_i
        when "eva","EVA";     @require_more[:eva]   = $2.to_i
        when "cri","CRI";     @require_more[:cri]   = $2.to_i
        when "odds","ODDS";   @require_more[:odds]  = $2.to_i
        end
      when YE::REGEXP::EQUIP::REQUIRE_LESS
        @requirements = true
        @require_less[:switch] = true
        case $1.to_s
        when "level","LEVEL"; @require_less[:level] = $2.to_i
        when "maxhp","MAXHP"; @require_less[:maxhp] = $2.to_i
        when "maxmp","MAXMP"; @require_less[:maxmp] = $2.to_i
        when "atk","ATK";     @require_less[:atk]   = $2.to_i
        when "def","DEF";     @require_less[:def]   = $2.to_i
        when "spi","SPI";     @require_less[:spi]   = $2.to_i
        when "agi","AGI";     @require_less[:agi]   = $2.to_i
        when "hit","HIT";     @require_less[:hit]   = $2.to_i
        when "eva","EVA";     @require_less[:eva]   = $2.to_i
        when "cri","CRI";     @require_less[:cri]   = $2.to_i
        when "odds","ODDS";   @require_less[:odds]  = $2.to_i
        end
      when YE::REGEXP::EQUIP::REQUIRE_SWITCH
        $1.scan(/d+/).each { |num|
        if num.to_i > 0
          @require_switch.push(num.to_i)
        end }
      when YE::REGEXP::EQUIP::AUTO_STATE
        $1.scan(/d+/).each { |num|
        if num.to_i > 0
          @auto_state.push(num.to_i)
        end }
      when YE::REGEXP::EQUIP::CURSED_ITEM
        @cursed = true
      when YE::REGEXP::EQUIP::PURIFY_ITEM
        @purify = true
      end
    }
  end
 
  #--------------------------------------------------------------------------
  # Definitions
  #--------------------------------------------------------------------------
  def bonus_param
    yanfly_cache_baseitem_eeo if @bonus_param == nil
    return @bonus_param
  end
  def bonus_paramp
    yanfly_cache_baseitem_eeo if @bonus_paramp == nil
    return @bonus_paramp
  end
  def bonus_trait
    yanfly_cache_baseitem_eeo if @bonus_trait == nil
    return @bonus_trait
  end
  def requirements
    yanfly_cache_baseitem_eeo if @requirements == nil
    return @requirements
  end
  def require_more
    yanfly_cache_baseitem_eeo if @require_more == nil
    return @require_more
  end
  def require_less
    yanfly_cache_baseitem_eeo if @require_less == nil
    return @require_less
  end
  def require_switch
    yanfly_cache_baseitem_eeo if @require_switch == nil
    return @require_switch
  end
  def auto_state
    yanfly_cache_baseitem_eeo if @auto_state == nil
    return @auto_state
  end
  def cursed
    yanfly_cache_baseitem_eeo if @cursed == nil
    return @cursed
  end
  def purify
    yanfly_cache_baseitem_eeo if @purify == nil
    return @purify
  end
 
end # RPG::BaseItem

#===============================================================================
# Game Battler
#===============================================================================

class Game_Battler

  #--------------------------------------------------------------------------
  # alias states
  #--------------------------------------------------------------------------
  alias states_eeo states unless $@
  def states
    result = states_eeo
    if self.actor?
      for state_id in self.equipment_auto_states
        unless result.include?($data_states[state_id])
          result.push($data_states[state_id])
        end
      end
    end
    result.sort! { |a, b| b.priority <=> a.priority }
    return result
  end

  #--------------------------------------------------------------------------
  # alias remove_state
  #--------------------------------------------------------------------------
  alias remove_state_eeo remove_state unless $@
  def remove_state(state_id)
    return if self.actor? and self.equipment_auto_states.include?(state_id)
    remove_state_eeo(state_id)
  end
 
  #--------------------------------------------------------------------------
  # overwrite state?
  #--------------------------------------------------------------------------
  def state?(state_id)
    return states.include?($data_states[state_id])
  end

  #--------------------------------------------------------------------------
  # alias maxhp=
  #--------------------------------------------------------------------------
  alias maxhpset_eeo maxhp= unless $@
  def maxhp=(newvalue)
    maxhpset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end
 
  #--------------------------------------------------------------------------
  # alias maxmp=
  #--------------------------------------------------------------------------
  alias maxmpset_eeo maxmp= unless $@
  def maxmp=(newvalue)
    maxmpset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end
 
  #--------------------------------------------------------------------------
  # alias atk=
  #--------------------------------------------------------------------------
  alias atkset_eeo atk= unless $@
  def atk=(newvalue)
    atkset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end
 
  #--------------------------------------------------------------------------
  # alias def=
  #--------------------------------------------------------------------------
  alias defset_eeo def= unless $@
  def def=(newvalue)
    defset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end
 
  #--------------------------------------------------------------------------
  # alias spi=
  #--------------------------------------------------------------------------
  alias spiset_eeo spi= unless $@
  def spi=(newvalue)
    spiset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end
 
  #--------------------------------------------------------------------------
  # alias agi=
  #--------------------------------------------------------------------------
  alias agiset_eeo agi= unless $@
  def agi=(newvalue)
    agiset_eeo(newvalue)
    self.purge_unequippables if self.actor?
  end

  #--------------------------------------------------------------------------
  # alias item_effect
  #--------------------------------------------------------------------------
  alias item_effect_eeo item_effect unless $@
  def item_effect(user, item)
    clear_action_results
    if item.purify and self.actor?
      self.purify_curses
    end
    item_effect_eeo(user, item)
  end
 
  #--------------------------------------------------------------------------
  # alias item_test
  #--------------------------------------------------------------------------
  alias item_test_eeo item_test unless $@
  def item_test(user, item)
    return true if item.purify and self.actor?
    return item_test_eeo(user, item)
  end

end

#===============================================================================
# Game Actor
#===============================================================================

class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # alias base maxhp
  #--------------------------------------------------------------------------
  alias base_maxhp_eeo base_maxhp unless $@
  def base_maxhp
    n = base_maxhp_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:maxhp]
      n *= item.bonus_paramp[:maxhp] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias base maxmp
  #--------------------------------------------------------------------------
  alias base_maxmp_eeo base_maxmp unless $@
  def base_maxmp
    n = base_maxmp_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:maxmp]
      n *= item.bonus_paramp[:maxmp] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias base atk
  #--------------------------------------------------------------------------
  alias base_atk_eeo base_atk unless $@
  def base_atk
    n = base_atk_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:atk]
      n *= item.bonus_paramp[:atk] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias base def
  #--------------------------------------------------------------------------
  alias base_def_eeo base_def unless $@
  def base_def
    n = base_def_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:def]
      n *= item.bonus_paramp[:def] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias base spi
  #--------------------------------------------------------------------------
  alias base_spi_eeo base_spi unless $@
  def base_spi
    n = base_spi_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:spi]
      n *= item.bonus_paramp[:spi] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias base agi
  #--------------------------------------------------------------------------
  alias base_agi_eeo base_agi unless $@
  def base_agi
    n = base_agi_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:agi]
      n *= item.bonus_paramp[:agi] / 100.0
    }
    return Integer(n)
  end
 
  #--------------------------------------------------------------------------
  # alias hit
  #--------------------------------------------------------------------------
  alias hit_eeo hit unless $@
  def hit
    n = hit_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:hit]
      n *= item.bonus_paramp[:hit] / 100.0
    }
    limit = YE::REGEXP::EQUIP::HECOLIMIT
    n = [[Integer(n), 0].max, limit].min
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias eva
  #--------------------------------------------------------------------------
  alias eva_eeo eva unless $@
  def eva
    n = eva_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:eva]
      n *= item.bonus_paramp[:eva] / 100.0
    }
    limit = YE::REGEXP::EQUIP::HECOLIMIT
    n = [[Integer(n), 0].max, limit].min
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias cri
  #--------------------------------------------------------------------------
  alias cri_eeo cri unless $@
  def cri
    n = cri_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:cri]
      n *= item.bonus_paramp[:cri] / 100.0
    }
    limit = YE::REGEXP::EQUIP::HECOLIMIT
    n = [[Integer(n), 0].max, limit].min
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias odds
  #--------------------------------------------------------------------------
  alias odds_eeo odds unless $@
  def odds
    n = odds_eeo
    equips.compact.each { |item|
      n += item.bonus_param[:odds]
      n *= item.bonus_paramp[:odds] / 100.0
    }
    limit = YE::REGEXP::EQUIP::HECOLIMIT
    n = [[Integer(n), 0].max, limit].min
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias level_up
  #--------------------------------------------------------------------------
  alias level_up_eeo level_up unless $@
  def level_up
    level_up_eeo
    purge_unequippables
  end
 
  #--------------------------------------------------------------------------
  # alias level_down
  #--------------------------------------------------------------------------
  alias level_down_eeo level_down unless $@
  def level_down
    level_down_eeo
    purge_unequippables
  end
 
  #--------------------------------------------------------------------------
  # alias auto_battle
  #--------------------------------------------------------------------------
  alias auto_battle_eeo auto_battle unless $@
  def auto_battle
    for item in equips.compact
      return true if item.bonus_trait.include?("auto battle")
    end
    return auto_battle_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias super_guard
  #--------------------------------------------------------------------------
  alias super_guard_eeo super_guard unless $@
  def super_guard
    for item in equips.compact
      return true if item.bonus_trait.include?("super guard")
    end
    return super_guard_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias pharmacology
  #--------------------------------------------------------------------------
  alias pharmacology_eeo pharmacology unless $@
  def pharmacology
    for item in equips.compact
      return true if item.bonus_trait.include?("item boost")
    end
    return pharmacology_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias fast_attack
  #--------------------------------------------------------------------------
  alias fast_attack_eeo fast_attack unless $@
  def fast_attack
    for item in equips.compact
      return true if item.bonus_trait.include?("fast attack")
    end
    return fast_attack_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias dual_attack
  #--------------------------------------------------------------------------
  alias dual_attack_eeo dual_attack unless $@
  def dual_attack
    for item in equips.compact
      return true if item.bonus_trait.include?("dual attack")
    end
    return dual_attack_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias prevent_critical
  #--------------------------------------------------------------------------
  alias prevent_critical_eeo prevent_critical unless $@
  def prevent_critical
    for item in equips.compact
      return true if item.bonus_trait.include?("prevent cri")
    end
    return prevent_critical_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias half_mp_cost
  #--------------------------------------------------------------------------
  alias half_mp_cost_eeo half_mp_cost unless $@
  def half_mp_cost
    for item in equips.compact
      return true if item.bonus_trait.include?("half mp cost")
    end
    return half_mp_cost_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias double_exp_gain
  #--------------------------------------------------------------------------
  alias double_exp_gain_eeo double_exp_gain unless $@
  def double_exp_gain
    for item in equips.compact
      return true if item.bonus_trait.include?("double exp")
    end
    return double_exp_gain_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias auto_hp_recover
  #--------------------------------------------------------------------------
  alias auto_hp_recover_eeo auto_hp_recover unless $@
  def auto_hp_recover
    for item in equips.compact
      return true if item.bonus_trait.include?("auto hp rec")
    end
    return auto_hp_recover_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias equippable?
  #--------------------------------------------------------------------------
  alias equippable_eeo equippable? unless $@
  def equippable?(item)
    if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
      return false unless meet_requirements(item)
    end
    return equippable_eeo(item)
  end
 
  #--------------------------------------------------------------------------
  # meet_requirements
  #--------------------------------------------------------------------------
  def meet_requirements(item)
    return true unless item.requirements
    for switch_id in item.require_switch
      return false unless $game_switches[switch_id]
    end
    if item.require_more[:switch] = true
      return false if self.level <= item.require_more[:level]
      return false if self.maxhp <= item.require_more[:maxhp]
      return false if self.maxmp <= item.require_more[:maxmp]
      return false if self.atk <= item.require_more[:atk]
      return false if self.def <= item.require_more[:def]
      return false if self.spi <= item.require_more[:spi]
      return false if self.agi <= item.require_more[:agi]
      return false if self.hit <= item.require_more[:hit]
      return false if self.eva <= item.require_more[:eva]
      return false if self.odds <= item.require_more[:odds]
    end
    #---
    if item.require_less[:switch] = true
      return false if self.level >= item.require_less[:level] and
      item.require_less[:level] != 0
      return false if self.maxhp >= item.require_less[:maxhp] and
      item.require_less[:maxhp] != 0
      return false if self.maxmp >= item.require_less[:maxmp] and
      item.require_less[:maxmp] != 0
      return false if self.atk >= item.require_less[:atk] and
      item.require_less[:atk] != 0
      return false if self.def >= item.require_less[:def] and
      item.require_less[:def] != 0
      return false if self.spi >= item.require_less[:spi] and
      item.require_less[:spi] != 0
      return false if self.agi >= item.require_less[:agi] and
      item.require_less[:agi] != 0
      return false if self.hit >= item.require_less[:hit] and
      item.require_less[:hit] != 0
      return false if self.eva >= item.require_less[:eva] and
      item.require_less[:eva] != 0
      return false if self.cri >= item.require_less[:cri] and
      item.require_less[:cri] != 0
      return false if self.odds >= item.require_less[:odds] and
      item.require_less[:odds] != 0
    end
    #---
    return true
  end
 
  #--------------------------------------------------------------------------
  # purge_unequippables
  #--------------------------------------------------------------------------
  def purge_unequippables(test = false)
    return unless YE::EQUIP::PURGE_UNEQUIPPABLE_ITEMS
    return if $game_temp.in_battle and !YE::EQUIP::ALLOW_PURGE_IN_BATTLE
    @purge_on = true
    for i in 0..4
      change_equip(i, nil, test) unless equippable?(equips[i])
    end
    if $imported["EquipExtension"]
      return if extra_armor_number == 0
      for i in 5..armor_number
        change_equip(i, nil, test) unless equippable?(equips[i])
      end
    end
    @purge_on = nil
  end
 
  #--------------------------------------------------------------------------
  # alias change_equip
  #--------------------------------------------------------------------------
  alias change_equip_eeo change_equip unless $@
  def change_equip(equip_type, item, test = false)
    change_equip_eeo(equip_type, item, test)
    if $imported["ExtendedEquipScene"] or $imported["SceneEquipReDux"]
      purge_unequippables(test) if @purge_on != true and !test
    else
      purge_unequippables(test) if @purge_on != true and !test
    end
  end
 
  #--------------------------------------------------------------------------
  # equipment_auto_states
  #--------------------------------------------------------------------------
  def equipment_auto_states
    result = []
    if $game_temp.in_battle
      for item in equips.compact
        for state_id in item.auto_state
          result.push(state_id)
        end
      end
    else
      for item in equips.compact
        for state_id in item.auto_state
          result.push(state_id) unless $data_states[state_id].battle_only
        end
      end
    end
    return result.uniq
  end
 
  #--------------------------------------------------------------------------
  # cursed_slot
  #--------------------------------------------------------------------------
  def cursed_slot?(slot)
    @cursed_slot = {} if @cursed_slot == nil
    @cursed_slot[slot] = false if @cursed_slot[slot] == nil
    return @cursed_slot[slot]
  end
 
  #--------------------------------------------------------------------------
  # set_cursed_slot
  #--------------------------------------------------------------------------
  def set_cursed_slot(slot, curse = true)
    @cursed_slot = {} if @cursed_slot == nil
    @cursed_slot[slot] = curse
  end
 
  #--------------------------------------------------------------------------
  # purify_curses
  #--------------------------------------------------------------------------
  def purify_curses
    @cursed_slot = {}
  end
 
end # Game_Actor

#===============================================================================
# Scene_Equip
#===============================================================================

class Scene_Equip < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias update
  #--------------------------------------------------------------------------
  alias update_equip_eeo update unless $@
  def update
    if @cursed_window != nil
      update_cursed_window
    else
      update_equip_eeo
    end
  end
 
  #--------------------------------------------------------------------------
  # alias update_equip_selection
  #--------------------------------------------------------------------------
  alias update_equip_selection_eeo update_equip_selection unless $@
  def update_equip_selection
    if Input.trigger?(Input::C) and cursed_slot?
      Sound.play_buzzer
      return
    elsif Input.trigger?(Input::A) and cursed_slot?
      Sound.play_buzzer
      return
    end
    update_equip_selection_eeo
  end
 
  #--------------------------------------------------------------------------
  # alias update_item_selection
  #--------------------------------------------------------------------------
  alias update_item_selection_eeo update_item_selection unless $@
  def update_item_selection
    if Input.trigger?(Input::C)
      if @item_window.item != nil and @item_window.item.cursed
        @actor.set_cursed_slot(@equip_window.index)
        create_cursed_window
      end
    end
    update_item_selection_eeo
  end
 
  #--------------------------------------------------------------------------
  # update_cursed_window
  #--------------------------------------------------------------------------
  def update_cursed_window
    if Input.trigger?(Input::C) or Input.trigger?(Input::B)
      @cursed_window.dispose
      @cursed_window = nil
    end
  end
 
  #--------------------------------------------------------------------------
  # cursed_slot?
  #--------------------------------------------------------------------------
  def cursed_slot?
    if @equip_window.item == nil
      @actor.set_cursed_slot(@equip_window.index, false)
    end
    if @actor.cursed_slot?(@equip_window.index)
      if @equip_window.item.cursed
        return true
      else
        @actor.set_cursed_slot(@equip_window.index, false)
      end
    end
    return false
  end
 
  #--------------------------------------------------------------------------
  # create_cursed_window
  #--------------------------------------------------------------------------
  def create_cursed_window
    return unless YE::EQUIP::CURSED_WINDOW
    dx = (544 - YE::EQUIP::CURSED_WIDTH) / 2
    dy = YE::EQUIP::CURSED_WIN_Y
    dw = YE::EQUIP::CURSED_WIDTH
    text = sprintf(YE::EQUIP::CURSED_MESSAGE, @actor.name)
    @cursed_window = Window_Base.new(dx, dy, dw, 56)
    @cursed_window.back_opacity = 255
    @cursed_window.contents.draw_text(4, 0, dw-40, 24, text, 1)
    YE::EQUIP::CURSED_SOUND.play if YE::EQUIP::CURSED_SOUND != nil
  end
 
end # Scene_Equip

#===============================================================================
#
# END OF FILE
#
#===============================================================================

TAG •