AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  



Le Deal du moment :
TCL C74 Series 55C743 – TV 55” 4K QLED 144 ...
Voir le deal
499 €

Partagez
 

 Modifier une fonction

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Garruk
Aventurier Lv.16
Aventurier Lv.16
Garruk


Age : 39
Inscrit le : 03/09/2009
Messages : 1503

Modifier une fonction  Empty
MessageSujet: Modifier une fonction    Modifier une fonction  Icon_minitimeMar 24 Juil 2012 - 13:53

Bonjour. =)
Alors voilà, j'utilise script qui permet aux personnages de choisir les compétences qui seront actives en combat.
Le principal problème de ce script c'est que les compétences apprises sont automatiquement retirées, donc il faut sans cesse passer par le menu pour s'en équiper et je trouver ça assez chiant. ^^
Après je sais qui y a une commande dans le script "AUTO_EQUIP_SKILLS", mais elle ne résolue pas le problème, la compétence est dispo en combat sans être équipé donc on ne peut pas la retirer donc ça m'aide pas vraiment. ^^''
Donc je voulais savoir si une personne pouvant faire en sorte que les compétences apprises soient aussitôt équipées et actives, bien sûr si la limite autorisée est dépassée, les nouvelles compétences sont tout simplement inactives et ne sont pas dispo en combat.
Merci d'avance.

Le script en deux parties car il est très long.

Code:
#===============================================================================
#
# Yanfly Engine RD - Equip Skill Slots
# Last Date Updated: 2009.05.26
# Level: Hard
#
# I've always played RPG's that placed limits on what a player can do. I know
# I advocate player flexibility a whole lot, limiting a player within a game can
# induce more strategy and make that game deeper. This script places a limit on
# the skills actors can bring with them to battle and the player has to select
# which ones the actors will have access to. There's some new mechanics added
# to the battlefield and they are as follows:
#
# EQUIPPING SKILL SLOTS
# Choose which skills your actors will take with them to battle. Equipping a
# skill will not only allow the skill to be used in battle, but it can boost
# the actor's stats as well. Some skills when equipped can provide an automatic
# status effect, immunity to an element, and other passive effects.
#
# SKILL LIMIT TYPES
# In order to limit your actors from becoming too powerful by equipping an
# unlimited amount of skills, there are limit types that can place an actor
# within a specific threshold of power. There are several status effects that
# will affect skills with certain limit-types as well.
#
# SKILL COPY SLOTS
# During battle, some skills can allow your actors to copy another skill and
# input them in as their own for the remainder of that battle. This ability is
# made possible with this skill equip slot system and done in such a way where
# it will not interfere with the default skills learned.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.05.26 - Upgrade Pack 1
#                Adjustable max equippable slots
#                Adjustable limiter maximums (per character)
#                Limiter Types can now take up more than 1 Limiter Slot
#                Auto equip skills for classes now added
#                Improved illegal skill purging
#                Improved tagging for passive effects
#                Compatibility with Scene Status ReDux
# o 2009.05.22 - Fixed infinite MP bug.
# o 2009.05.13 - Started demo. Cancelled.
# o 2009.05.11 - Finished script.
# o 2009.05.07 - Started script.
#===============================================================================
# Instructions
#===============================================================================
#
# <limit type x>
# This determines what limit type the skill is. Limit types determine how many
# of a particular skill category an actor can equip. To have a skill belong to
# more than one limit type, insert more of this tag into the skill's notebox.
#
# <limit type x:y>
# Just like the above, this will cause the skill to require a limit type, but
# unlike the above, this will require y amount of slots for that limit type to
# be open. <limit type 3:2> will require two slots to be open for limit type 3.
#
# <anti limit type x>
# NOTE that this goes into a state's notebox. Once the state is applied, any
# skills with limit type x will be blocked from being used until state is gone.
#
# ----------------------------------------------------------------------------
#
# <equip maxhp/maxmp/atk/def/spi/agi per/set +x>
# These tags affect the base stats of the equipped actor by a percentage rate
# or a set rate. If you want a +5% bonus to atk, input <equip atk per +5>.
# To increase it by a set 5 def, input <equip def set +5>.
#
# <equip hit/eva/cri/odds per/set +x>
# These tags will affect the HECO stats of the equipped actor by a percentage
# or a set rate. If you want a +5 increase to HIT, input <equip hit set +5>.
# It works just like the previous section.
#
# <equip auto state x> or <equip auto state x,x>
# This gives state x to your actor so long as the skill is equipped. If the auto
# state is a battle only state, it will only show up in battle. Otherwise, it
# will always show up until the skill is unequipped.
#
# <equip state resist x> or <equip state resist x,x>
# This will cause the actor to be immune to state x. Once the skill is no longer
# equipped, the actor will become vulnerable to the state once again.
#
# <equip plus state x> or <equip plus state x,x>
# This will cause the actor's normal attacks to inflict state x. Once the skill
# is unequipped, the actor will no longer inflict that state.
#
# <equip plus element x> or <equip plus element x,x>
# This will give your actor's normal attacks elemental attributes. But once the
# skill is unequipped, the actor's attacks will return to normal.
#
# <equip auto battle>
# This will cause your actor to function under auto battle if the skill has been
# equipped. The effect will revert once the skill is unequipped.
#
# <equip super guard>
# This will cause the actor to take 25% of the received damage when guarding.
# The effect will revert once the skill is unequipped.
#
# <equip pharmacology>
# This will cause items used by the actor to have double the effect. The effect
# will revert once the skill is unequipped.
#
# <equip fast attack>
# This will give the actor the fast attack trait when equipped. The effect will
# revert once the skill is unequipped.
#
# <equip prevent crit>
# This will prevent the actor from being critically hit. The effect will revert
# once the skill is unequipped.
#
# <equip half mp cost>
# This will halve the MP costs for the actor. The effect will revert once the
# skill is unequipped.
#
# <equip double exp>
# This will double the amount of EXP the actor will gain. The effect will revert
# once the skill is unequipped.
#
# ----------------------------------------------------------------------------
#
# <skill copy any>
# This will all the actor to copy any skill owned by the target ally or enemy.
# The actor cannot copy skills they already know or skills designated by NOT.
#
# <skill copy type x>
# This limits the actor to only be able to copy limit types x. Add more of these
# tags to increase the range of copy types available.
#
# <skill copy not x>
# This will prevent the actor from being able to copy any of the x limit type
# skills. This will have highest priority over copy any and copy type.
#
# ----------------------------------------------------------------------------
#
# The following can be scripted through events. Make sure you enter them in
# properly or else your game will crash.
#
# $game_actors[x].max_slot_mod = y
# This will not directly change actor x's max slots, but instead, give actor x
# a bonus slot amount of y. y can be a positive amount to increase the actor's
# max slots or y can be a negative amount to reduce the actor's max slots.
#
# $game_actors[x].set_limiter_mod(y, z)
# This will change actor x's limiter y mod to z. This will not adjust the exact
# maximum or minimum for the limiter but instead, provide a bonus increase or
# decrease depending on whether the z value is positive or negative.
#
#===============================================================================
#
# Compatibility
# - Works With: KGC's Help Extension
# - Works With: Yanfly's Display Skill Query
# - Alias: Game_Battler: states, remove_state, state?
# - Alias: Game_Actor: setup, skills, state_resist?, element_set,
# - Alias: Game_Actor: plus_state_set, base_*, auto_battle,
# - Alias: Game_Actor: pharmacology, prevent_critical, half_mp_cost,
# - Alias: Game_Actor: double_exp_gain
# - Alias: Scene_Menu: create_command_window, update_command_selection
# - Alias: Scene_Menu: update_actor_selection
#
#===============================================================================
# Credits:
# KGC for Window_Command imports.
#===============================================================================
# Notes:
# This was more or less my replacement for KGC's CP System since it wasn't too
# compatible with the Subclass Selection System I have built. On top of that,
# there's a few more features I'd have liked implemented with the whole skill
# equipping thing so I've went ahead and created my own version.
#===============================================================================

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

module YE
  module EQUIPSKILL
   
    #---This section governs all of the basic functions of the equip system.
      # Everything seen here is pretty much global for all parts of the script.
     
    # This part affects all of the string data seen inside the Equip Skill menu.
    MENU_TITLE = "Slots"
    EMPTY_SLOT = "-Vide-"
    UNEQUIP_TX = "-Sort-"
    EMPTY_ICON = 97
    STAT_PARAM = ["MaxHP", "MaxSP", "Force", "Vitalité", "Magie", "Dextérité"]
    STAT_ICONS = [    11664,    11665,    11603,    11604,    11605,    11606]
   
    # This switch will enable/disable the Slots menu inside your game.
    ENABLE_SLOTS_SWITCH = 69
   
    # This determines the default amount of maximum skills an actor can equip.
    # The base is how much the actors will start with. Ever is the final amount
    # that can never be raised any further.
    MAX_SKILLS_BASE = 4
    MAX_SKILLS_EVER = 16
   
    # The following will allow you to create formulas for the growth rate of
    # equippable slots total. Make sure that actor 0 exists as it is the common
    # formula for all actors that aren't included on this list. If the actor's
    # ID is included on this list, it will take that formula instead of the
    # actor 0 formula.
    MAX_SKILLS_FORMULA = {
    # ActorID => "formula"
          0 => "level * 0.10 + 4",
     
    } # Do not remove this.
   
    # This affects the display type for new stats.
    # Type 1 - Shows the new stat itself.
    # Type 2 - Shows the increase/decrease in the stat.
    ES_SDISPLAY = 1
   
    # This adjusts how the stats and arrows will appear.
    ES_USE_ICON = false
    ES_ARROW    = ">"
    ES_ICON    = 142
   
    # This part adjusts the text shown for each trait.
    ES_AUTO_STATE  = "Passif"
    ES_STATE_RESIST = "Anti-State"
    ES_PLUS_STATE  = "Added Effect"
    ES_PLUS_ELEMENT = "Add Element"
    ES_AUTO_BATTLE  = "Auto Battle"
    ES_SUPER_GUARD  = "Super Guard"
    ES_PHARMACOLOGY = "Item Boost"
    ES_FAST_ATTACK  = "Quick Attack"
    ES_PREVENT_CRIT = "Anti-Critical"
    ES_HALF_MP_COST = "Half MP Cost"
    ES_DOUBLE_EXP  = "Double EXP"
   
    # This part adjusts the element icons used for the script. If an element ID
    # is not included here, it will not show up under plus elements.
    ES_ELEMENT_ICONS = { 1 => 104, 2 => 105, 3 => 106, 4 => 107,
                        5 => 108, 6 => 109, 7 => 110, 8 => 111,
                      } # Do not remove this.
   
    #---This part adjusts the limit type information. There are multiple limit
      # types at which you can change rules for. Of the things you can modify
      # within the limit hash involve the maximum number of limit types you can
      # equip, whether or not it's shown, and the name affiliated with it.
    LIMIT_HASH ={
    # LimitID => [Icon, Max, Show?, Icon?, Name]
            0 => [ 9782,  99,  true,  true, "En possession de :"],
          1 => [  6465,  99,  true,  true, "Physique"],
            2 => [ 6481,  99,  true,  true, "Magique"],
            3 => [ 6529,  99,  true,  true, "Négatif"],
            4 => [ 6433, 99,  true,  true, "Boost +"],
            5=> [  6452,  1,  true,  true, "Boost -"],
            6 => [  96,  3,  true,  true, "Break"],
            7 => [  6417,  5,  true,  true, "Passive"],
         
         
    } # Do not remove.
   
    # This part adjusts the display for the equipped skills over the maximum.
    LIMIT_DISPLAY = "%d/%d"
   
    #---This part adjusts the skills that actors don't need to equip. These
      # skills will be automatically equipped in battle and will not be given
      # an option to be equipped in the equip slots menus. They also do not take
      # up any equip slots but they will cost limit slots.
    AUTO_EQUIP_SKILLS ={
    # ActorID => [Skill ID's]
            1 => [],
            2 => [],
            3 => [],
            4 => [],
    } # Do not remove this.
   
    #---This part works just like the above but functions individually for
      # classes instead. Note that if you have the Subclass Selection System
      # included with your script list, this will not include the subclasses.
    AUTO_CLASS_SKILLS ={
    # ClassID => [Skill ID's]
            1 => [],
            2 => [],
            3 => [],
            4 => [],
    } # Do not remove this.
   
    #---This part is for skill copying. Copied slots will replace the slots that
      # have cast a copy skill. Copy skills can only copy skills that it allows
      # and cannot copy skills outside of its boundaries. Copy skills also can't
      # copy other copy skills.
   
    SHOW_UNCOPIABLE  = true
    SKILL_COPY_HELP  = "Please select a skill to copy."
    SKILL_COPY_TYPES = "Valid Copy Types"
   
    #---------------------------------------------------------------------------
    # COMPATIBILITY ADD-ONS
    #---------------------------------------------------------------------------
   
    # This following section is to determine compatibility showing for Display
    # Skill Query if you wish for that to be enabled.
    ENABLE_SKILL_QUERY  = true
    SHOW_QUERY_BUTTON  = Input::A
    SHOW_QUERY_HELP_WIN = true
    QUERY_HELP_WIN_TEXT = "Press Shift to view info."
   
  end
end

#===============================================================================
# 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 BASEITEM
     
      # This adjusts limit type.
      LIMIT_TYPE      = /<(?:LIMIT_TYPE|limit type)[ ]*(\d+)>/i
      LIMIT_TYPE_MORE = /<(?:LIMIT_TYPE|limit type)[ ]*(\d+):(\d+)>/i
     
      # This adjusts skill copy.
      SKILL_COPY_ANY  = /<(?:SKILL_COPY_ANY|skill copy any)>/i
      SKILL_COPY_TYPE = /<(?:SKILL_COPY_TYPE|skill copy type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      SKILL_COPY_NOT  = /<(?:SKILL_COPY_NOT|skill copy not)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
     
      # This adjusts percentage bonuses.
      EQUIP_HP_PER  = /<(?:EQUIP_MAXHP_PER|equip maxhp per)[ ]*([\+\-]\d+)>/i
      EQUIP_MP_PER  = /<(?:EQUIP_MAXMP_PER|equip maxmp per)[ ]*([\+\-]\d+)>/i
      EQUIP_ATK_PER = /<(?:EQUIP_ATK_PER|equip atk per)[ ]*([\+\-]\d+)>/i
      EQUIP_DEF_PER = /<(?:EQUIP_DEF_PER|equip def per)[ ]*([\+\-]\d+)>/i
      EQUIP_SPI_PER = /<(?:EQUIP_SPI_PER|equip spi per)[ ]*([\+\-]\d+)>/i
      EQUIP_AGI_PER = /<(?:EQUIP_AGI_PER|equip agi per)[ ]*([\+\-]\d+)>/i
     
      # This adjusts set bonuses for HP/MP and ADSA.
      EQUIP_HP_SET  = /<(?:EQUIP_MAXHP_SET|equip maxhp set)[ ]*([\+\-]\d+)>/i
      EQUIP_MP_SET  = /<(?:EQUIP_MAXMP_SET|equip maxmp set)[ ]*([\+\-]\d+)>/i
      EQUIP_ATK_SET = /<(?:EQUIP_ATK_SET|equip atk set)[ ]*([\+\-]\d+)>/i
      EQUIP_DEF_SET = /<(?:EQUIP_DEF_SET|equip def set)[ ]*([\+\-]\d+)>/i
      EQUIP_SPI_SET = /<(?:EQUIP_SPI_SET|equip spi set)[ ]*([\+\-]\d+)>/i
      EQUIP_AGI_SET = /<(?:EQUIP_AGI_SET|equip agi set)[ ]*([\+\-]\d+)>/i
     
      # This adjusts set bonuses for HECO.
      EQUIP_HIT_PER  = /<(?:EQUIP_HIT_PER|equip hit per)[ ]*([\+\-]\d+)>/i
      EQUIP_EVA_PER  = /<(?:EQUIP_EVA_PER|equip eva per)[ ]*([\+\-]\d+)>/i
      EQUIP_CRI_PER  = /<(?:EQUIP_CRI_PER|equip cri per)[ ]*([\+\-]\d+)>/i
      EQUIP_ODDS_PER = /<(?:EQUIP_ODDS_PER|equip odds per)[ ]*([\+\-]\d+)>/i
      EQUIP_HIT_SET  = /<(?:EQUIP_HIT_SET|equip hit set)[ ]*([\+\-]\d+)>/i
      EQUIP_EVA_SET  = /<(?:EQUIP_EVA_SET|equip eva set)[ ]*([\+\-]\d+)>/i
      EQUIP_CRI_SET  = /<(?:EQUIP_CRI_SET|equip cri set)[ ]*([\+\-]\d+)>/i
      EQUIP_ODDS_SET = /<(?:EQUIP_ODDS_SET|equip odds set)[ ]*([\+\-]\d+)>/i
     
      # This part adjusts misc effects.
      EQUIP_AUTO_STATE  =
      /<(?:EQUIP_AUTO_STATE|equip auto state)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      EQUIP_STATE_RESIST =
      /<(?:EQUIP_STATE_RESIST|equip state resist)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      EQUIP_PLUS_STATE  =
      /<(?:EQUIP_PLUS_STATE|equip plus state)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      EQUIP_PLUS_ELEMENT =
      /<(?:EQUIP_PLUS_ELEMENT|equip plus element)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
      EQUIP_AUTO_BATTLE  = /<(?:EQUIP_AUTO_BATTLE|equip auto battle)>/i
      EQUIP_SUPER_GUARD  = /<(?:EQUIP_SUPER_GUARD|equip super guard)>/i
      EQUIP_PHARMACOLOGY = /<(?:EQUIP_PHARMACOLOGY|equip pharmacology)>/i
      EQUIP_FAST_ATTACK  = /<(?:EQUIP_FAST_ATTACK|equip fast attack)>/i
      EQUIP_PREVENT_CRIT = /<(?:EQUIP_PREVENT_CRIT|equip prevent crit)>/i
      EQUIP_HALF_MP_COST = /<(?:EQUIP_HALF_MP_COST|equip half mp cost)>/i
      EQUIP_DOUBLE_EXP  = /<(?:EQUIP_DOUBLE_EXP|equip double exp)>/i
     
    end # BASEITEM
    module STATE
     
      ANTI_LIMIT_TYPE = /<(?:ANTI_LIMIT_TYPE|anti limit type)[ ]*(\d+)>/i
     
    end # STATE
  end
end

#===============================================================================
# RPG::State
#===============================================================================

class RPG::State
 
  #--------------------------------------------------------------------------
  # Yanfly_Cache_State_ESS
  #--------------------------------------------------------------------------
  def yanfly_cache_state_ess
    @anti_limit_type = []
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YE::REGEXP::STATE::ANTI_LIMIT_TYPE
        @anti_limit_type.push($1.to_i)
      end
    }
  end
 
  #--------------------------------------------------------------------------
  # definitions
  #--------------------------------------------------------------------------
  def anti_limit_type
    yanfly_cache_state_ess if @anti_limit_type == nil
    return @anti_limit_type
  end
 
end

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

class RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # Yanfly_Cache_BaseItem_ESS
  #--------------------------------------------------------------------------
  def yanfly_cache_baseitem_ess
    @limit_type = []; @limit_use = {}
   
    @equip_hp_per=100; @equip_mp_per=100; @equip_hp_set=0; @equip_mp_set=0
    @equip_atk_per=100;@equip_def_per=100;@equip_spi_per=100;@equip_agi_per=100
    @equip_atk_set=0; @equip_def_set=0; @equip_spi_set=0; @equip_agi_set=0;
    @equip_hit_per=100;@equip_eva_per=100;@equip_cri_per=100;@equip_odds_per=100
    @equip_hit_set=0; @equip_eva_set=0; @equip_cri_set=0; @equip_odds_set=0;
   
    @equip_auto_state = []; @equip_state_resist = [];
    @equip_plus_state = []; @equip_plus_element = []; @equip_auto_battle = false
    @equip_super_guard = false; @equip_pharma = false; @equip_fast_attack = false
    @equip_prevent_crit = false; @equip_half_mp = false; @equip_double_exp = false
   
    @skill_copy = false; @skill_copy_all = false; @copy_types = []
    @copy_not = [];
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YE::REGEXP::BASEITEM::LIMIT_TYPE
        unless $1.to_i == 0
          @limit_type.push($1.to_i)
          @limit_use[$1.to_i] = 1
        end
      when YE::REGEXP::BASEITEM::LIMIT_TYPE_MORE
        unless $1.to_i == 0
          @limit_type.push($1.to_i)
          @limit_use[$1.to_i] = $2.to_i
        end
      when YE::REGEXP::BASEITEM::SKILL_COPY_ANY
        @skill_copy = true
        @skill_copy_all = true
      when YE::REGEXP::BASEITEM::SKILL_COPY_TYPE
        @skill_copy = true
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @copy_types.push(num.to_i)
        end }
      when YE::REGEXP::BASEITEM::SKILL_COPY_NOT
        @skill_copy = true
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @copy_not.push(num.to_i)
        end }
      when YE::REGEXP::BASEITEM::EQUIP_HP_PER
        @equip_hp_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_HP_SET
        @equip_hp_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_MP_PER
        @equip_mp_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_MP_SET
        @equip_mp_set += $1.to_i
       
      when YE::REGEXP::BASEITEM::EQUIP_ATK_PER
        @equip_atk_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_DEF_PER
        @equip_def_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_SPI_PER
        @equip_spi_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_AGI_PER
        @equip_agi_per += $1.to_i
       
      when YE::REGEXP::BASEITEM::EQUIP_ATK_SET
        @equip_atk_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_DEF_SET
        @equip_def_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_SPI_SET
        @equip_spi_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_AGI_SET
        @equip_agi_set += $1.to_i
       
      when YE::REGEXP::BASEITEM::EQUIP_HIT_PER
        @equip_hit_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_EVA_PER
        @equip_eva_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_CRI_PER
        @equip_cri_per += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_ODDS_PER
        @equip_odds_per += $1.to_i
       
      when YE::REGEXP::BASEITEM::EQUIP_HIT_SET
        @equip_hit_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_EVA_SET
        @equip_eva_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_CRI_SET
        @equip_cri_set += $1.to_i
      when YE::REGEXP::BASEITEM::EQUIP_ODDS_SET
        @equip_odds_set += $1.to_i
       
      when YE::REGEXP::BASEITEM::EQUIP_AUTO_STATE
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @equip_auto_state.push(num.to_i)
        end }
      when YE::REGEXP::BASEITEM::EQUIP_STATE_RESIST
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @equip_state_resist.push(num.to_i)
        end }
      when YE::REGEXP::BASEITEM::EQUIP_PLUS_STATE
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @equip_plus_state.push(num.to_i)
        end }
      when YE::REGEXP::BASEITEM::EQUIP_PLUS_ELEMENT
        $1.scan(/\d+/).each { |num|
        if num.to_i > 0
          @equip_plus_element.push(num.to_i)
        end }
       
      when YE::REGEXP::BASEITEM::EQUIP_AUTO_BATTLE
        @equip_auto_battle = true
      when YE::REGEXP::BASEITEM::EQUIP_SUPER_GUARD
        @equip_super_guard = true
      when YE::REGEXP::BASEITEM::EQUIP_PHARMACOLOGY
        @equip_pharma = true
      when YE::REGEXP::BASEITEM::EQUIP_FAST_ATTACK
        @equip_fast_attack = true
      when YE::REGEXP::BASEITEM::EQUIP_PREVENT_CRIT
        @equip_prevent_crit = true
      when YE::REGEXP::BASEITEM::EQUIP_HALF_MP_COST
        @equip_half_mp = true
      when YE::REGEXP::BASEITEM::EQUIP_DOUBLE_EXP
        @equip_double_exp = true
       
      end
    }
  end
 
  #--------------------------------------------------------------------------
  # limit definitions
  #--------------------------------------------------------------------------
  def limit_type
    yanfly_cache_baseitem_ess if @limit_type == nil
    return @limit_type
  end
  def limit_use
    yanfly_cache_baseitem_ess if @limit_use == nil
    return @limit_use
  end
 
  #--------------------------------------------------------------------------
  # copy definitions
  #--------------------------------------------------------------------------
  def skill_copy?
    yanfly_cache_baseitem_ess if @skill_copy == nil
    return @skill_copy
  end
 
  def skill_copy_any
    yanfly_cache_baseitem_ess if @skill_copy_all == nil
    return @skill_copy_all
  end
 
  def copy_types
    yanfly_cache_baseitem_ess if @copy_types == nil
    return @copy_types
  end
 
  def copy_not
    yanfly_cache_baseitem_ess if @copy_not == nil
    return @copy_not
  end
 
  #--------------------------------------------------------------------------
  # equip definitions
  #--------------------------------------------------------------------------
  def equip_hp_per
    yanfly_cache_baseitem_ess if @equip_hp_per == nil
    return @equip_hp_per
  end
  def equip_hp_set
    yanfly_cache_baseitem_ess if @equip_hp_set == nil
    return @equip_hp_set
  end
  def equip_mp_per
    yanfly_cache_baseitem_ess if @equip_mp_per == nil
    return @equip_mp_per
  end
  def equip_mp_set
    yanfly_cache_baseitem_ess if @equip_mp_set == nil
    return @equip_mp_set
  end
  #---
  def equip_atk_per
    yanfly_cache_baseitem_ess if @equip_atk_per == nil
    return @equip_atk_per
  end
  def equip_def_per
    yanfly_cache_baseitem_ess if @equip_def_per == nil
    return @equip_def_per
  end
  def equip_spi_per
    yanfly_cache_baseitem_ess if @equip_spi_per == nil
    return @equip_spi_per
  end
  def equip_agi_per
    yanfly_cache_baseitem_ess if @equip_agi_per == nil
    return @equip_agi_per
  end
  #---
  def equip_atk_set
    yanfly_cache_baseitem_ess if @equip_atk_set == nil
    return @equip_atk_set
  end
  def equip_def_set
    yanfly_cache_baseitem_ess if @equip_def_set == nil
    return @equip_def_set
  end
  def equip_spi_set
    yanfly_cache_baseitem_ess if @equip_spi_set == nil
    return @equip_spi_set
  end
  def equip_agi_set
    yanfly_cache_baseitem_ess if @equip_agi_set == nil
    return @equip_agi_set
  end
  #---
  def equip_hit_per
    yanfly_cache_baseitem_ess if @equip_hit_per == nil
    return @equip_hit_per
  end
  def equip_eva_per
    yanfly_cache_baseitem_ess if @equip_eva_per == nil
    return @equip_eva_per
  end
  def equip_cri_per
    yanfly_cache_baseitem_ess if @equip_cri_per == nil
    return @equip_cri_per
  end
  def equip_odds_per
    yanfly_cache_baseitem_ess if @equip_odds_per == nil
    return @equip_odds_per
  end
  #---
  def equip_hit_set
    yanfly_cache_baseitem_ess if @equip_hit_set == nil
    return @equip_hit_set
  end
  def equip_eva_set
    yanfly_cache_baseitem_ess if @equip_eva_set == nil
    return @equip_eva_set
  end
  def equip_cri_set
    yanfly_cache_baseitem_ess if @equip_cri_set == nil
    return @equip_cri_set
  end
  def equip_odds_set
    yanfly_cache_baseitem_ess if @equip_odds_set == nil
    return @equip_odds_set
  end
  #---
  def equip_auto_state
    yanfly_cache_baseitem_ess if @equip_auto_state == nil
    return @equip_auto_state
  end
  def equip_state_resist
    yanfly_cache_baseitem_ess if @equip_state_resist == nil
    return @equip_state_resist
  end
  def equip_plus_state
    yanfly_cache_baseitem_ess if @equip_plus_state == nil
    return @equip_plus_state
  end
  def equip_plus_element
    yanfly_cache_baseitem_ess if @equip_plus_element == nil
    return @equip_plus_element
  end
  #---
  def equip_auto_battle
    yanfly_cache_baseitem_ess if @equip_auto_battle == nil
    return @equip_auto_battle
  end
  def equip_super_guard
    yanfly_cache_baseitem_ess if @equip_super_guard == nil
    return @equip_super_guard
  end
  def equip_pharmacology
    yanfly_cache_baseitem_ess if @equip_pharma == nil
    return @equip_pharma
  end
  def equip_fast_attack
    yanfly_cache_baseitem_ess if @equip_fast_attack == nil
    return @equip_fast_attack
  end
  def equip_prevent_crit
    yanfly_cache_baseitem_ess if @equip_prevent_crit == nil
    return @equip_prevent_crit
  end
  def equip_half_mp_cost
    yanfly_cache_baseitem_ess if @equip_half_mp == nil
    return @equip_half_mp
  end
  def equip_double_exp
    yanfly_cache_baseitem_ess if @equip_double_exp == nil
    return @equip_double_exp
  end
 
end

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

class Game_Battler
 
  #--------------------------------------------------------------------------
  # alias states
  #--------------------------------------------------------------------------
  alias states_ess states unless $@
  def states
    result = states_ess
    if self.actor?
      for state_id in self.equipped_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_ess remove_state unless $@
  def remove_state(state_id)
    return if self.actor? and self.equipped_auto_states.include?(state_id)
    remove_state_ess(state_id)
  end
 
  #--------------------------------------------------------------------------
  # equippped auto state?
  #--------------------------------------------------------------------------
  def equipped_auto_state?(checkstate)
    if self.actor?
      for state_id in self.equipped_auto_states
        return true if checkstate == state_id
      end
    end
    return false
  end
 
  #--------------------------------------------------------------------------
  # alias state?
  #--------------------------------------------------------------------------
  alias state_question_ess state? unless $@
  def state?(state_id)
    return (state_question_ess(state_id) || equipped_auto_state?(state_id))
  end
 
unless $imported["CustomSkillEffects"]
  #--------------------------------------------------------------------------
  # alias skill can use?
  #--------------------------------------------------------------------------
  alias skill_can_use_ess skill_can_use? unless $@
  def skill_can_use?(skill)
    return false unless can_use_limit_type?(skill)
    return skill_can_use_ess(skill)
  end
end

  #--------------------------------------------------------------------------
  # can use limit type?
  #--------------------------------------------------------------------------
  def can_use_limit_type?(skill)
    anti_type = []
    for state in states
      anti_type += state.anti_limit_type
    end
    for l_type in skill.limit_type
      return false if anti_type.include?(l_type)
    end
    return true
  end
 
end # Game Battler

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

class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :max_slot_mod
 
  #--------------------------------------------------------------------------
  # alias setup
  #--------------------------------------------------------------------------
  alias setup_ess setup unless $@
  def setup(actor_id)
    setup_ess(actor_id)
    @max_slot_mod = 0
    @limiter_mod = {}
    @equipped_skills = {}
    @replaced_skills = {}
  end
 
  #--------------------------------------------------------------------------
  # max_slots
  #--------------------------------------------------------------------------
  def max_slots
    mintotal = YE::EQUIPSKILL::MAX_SKILLS_BASE
    maxtotal = YE::EQUIPSKILL::MAX_SKILLS_EVER
    if YE::EQUIPSKILL::MAX_SKILLS_FORMULA.include?(self.id)
      calc_slots = Integer(eval(YE::EQUIPSKILL::MAX_SKILLS_FORMULA[self.id]))
    else
      calc_slots = Integer(eval(YE::EQUIPSKILL::MAX_SKILLS_FORMULA[0]))
    end
    result = calc_slots
    @max_slot_mod = 0 if @max_slot_mod == nil
    result += @max_slot_mod
    return [[Integer(result), maxtotal].min, mintotal].max
  end
 
  #--------------------------------------------------------------------------
  # limiter mod
  #--------------------------------------------------------------------------
  def limiter_mod(limiter_id)
    @limiter_mod = {} if @limiter_mod == nil
    @limiter_mod[limiter_id] = 0 if @limiter_mod[limiter_id] == nil
    return @limiter_mod[limiter_id]
  end
 
  #--------------------------------------------------------------------------
  # set limiter mod
  #--------------------------------------------------------------------------
  def set_limiter_mod(limiter_id, value)
    @limiter_mod = {} if @limiter_mod == nil
    @limiter_mod[limiter_id] = value
    purge_unequippable_skills
  end
 
  #--------------------------------------------------------------------------
  # alias skills
  #--------------------------------------------------------------------------
  alias skills_ess skills unless $@
  def skills
    if $scene.is_a?(Scene_Battle) and !$BTEST
      return combat_skills
    else
      return skills_ess
    end
  end
 
  #--------------------------------------------------------------------------
  # alias skill_can_use?
  #--------------------------------------------------------------------------
  alias skill_can_use_actor_ess skill_can_use? unless $@
  def skill_can_use?(skill)
    if equipped_skill?(skill)
      return super
    else
      return skill_can_use_actor_ess(skill)
    end
  end
 
  #--------------------------------------------------------------------------
  # alias learn skill
  #--------------------------------------------------------------------------
  alias learn_skill_ess learn_skill unless $@
  def learn_skill(skill_id)
    learn_skill_ess(skill_id)
    unless @skills.include?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end
 
  #--------------------------------------------------------------------------
  # equipped_skill?
  #--------------------------------------------------------------------------
  def equipped_skill?(skill)
    @replaced_skills = {} if @replaced_skills == nil
    @equipped_skills = {} if @equipped_skills == nil
    for i in 1..(self.max_slots)
      return true if @replaced_skills[i] == skill.id
      return true if @equipped_skills[i] == skill.id
    end
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(self.id)
      return true if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[self.id].include?(skill.id)
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(self.class.id)
      return true if YE::EQUIPSKILL::AUTO_CLASS_SKILLS[self.class.id].include?(skill.id)
    end
    return false
  end
 
  #--------------------------------------------------------------------------
  # combat skills
  #--------------------------------------------------------------------------
  def combat_skills
    @replaced_skills = {} if @replaced_skills == nil
    @equipped_skills = {} if @equipped_skills == nil
    result = []
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(self.id)
      for skill_id in YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[self.id]
        skill = $data_skills[skill_id]
        result.push(skill) if self.skill_learn?(skill)
      end
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(self.class.id)
      for skill_id in YE::EQUIPSKILL::AUTO_CLASS_SKILLS[self.class.id]
        skill = $data_skills[skill_id]
        result.push(skill) if self.skill_learn?(skill)
      end
    end
    for i in 1..(self.max_slots)
      if @replaced_skills[i] != nil
        result.push(replacement_slot(i).clone)
      else
        next if @equipped_skills[i] == nil
        result.push(skill_in_slot(i))
      end
    end
    return result
  end
 
  #--------------------------------------------------------------------------
  # equipped skills
  #--------------------------------------------------------------------------
  def equipped_skills
    @equipped_skills = {} if @equipped_skills == nil
    result = []
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(self.id)
      for skill_id in YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[self.id]
        skill = $data_skills[skill_id]
        result.push(skill) if self.skill_learn?(skill)
      end
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(self.class.id)
      for skill_id in YE::EQUIPSKILL::AUTO_CLASS_SKILLS[self.class.id]
        skill = $data_skills[skill_id]
        result.push(skill) if self.skill_learn?(skill)
      end
    end
    for i in 1..(self.max_slots)
      next if @equipped_skills[i] == nil
      result.push($data_skills[@equipped_skills[i]])
    end
    return result
  end
 
  #--------------------------------------------------------------------------
  # skill_in_slot
  #--------------------------------------------------------------------------
  def skill_in_slot(value)
    @equipped_skills = {} if @equipped_skills == nil
    if @equipped_skills[value] != nil
      result = $data_skills[@equipped_skills[value]]
    else
      result = nil
    end
    return result
  end
 
  #--------------------------------------------------------------------------
  # replacement_slot
  #--------------------------------------------------------------------------
  def replacement_slot(value)
    @replaced_skills = {} if @replaced_skills == nil
    if @replaced_skills[value] != nil
      result = $data_skills[@replaced_skills[value]]
    else
      result = nil
    end
    return result
  end
 
  #--------------------------------------------------------------------------
  # which slot?
  #--------------------------------------------------------------------------
  def which_slot?(skill_id)
    @equipped_skills = {} if @equipped_skills == nil
    for i in 1..(self.max_slots)
      return i if skill_in_slot(i) == $data_skills[skill_id]
    end
    return 0
  end
 
  #--------------------------------------------------------------------------
  # change_slot
  #--------------------------------------------------------------------------
  def change_slot(slot_id, skill)
    if skill != self.skill_in_slot(slot_id)
      return if self.equipped_skills.include?(skill)
      return unless self.can_equip_skill?(skill,slot_id)
    else
      skill = nil
    end
    hp_per = self.hp * 100 / self.maxhp
    mp_per = self.mp * 100 / self.maxmp unless self.maxmp == 0
    @equipped_skills = {} if @equipped_skills == nil
    if skill == nil
      @equipped_skills[slot_id] = nil
    else
      @equipped_skills[slot_id] = skill.id
    end
    self.hp = hp_per * self.maxhp / 100
    self.mp = mp_per * self.maxmp / 100 unless self.maxmp == 0
  end
 
  #--------------------------------------------------------------------------
  # replace_slot
  #--------------------------------------------------------------------------
  def replace_slot(slot_id, skill)
    @replaced_skills = {} if @replaced_skills == nil
    if skill == nil
      @replaced_skills[slot_id] = nil
    else
      @replaced_skills[slot_id] = skill.id
    end
  end
 
  #--------------------------------------------------------------------------
  # purge_unequippable_skills
  #--------------------------------------------------------------------------
  def purge_unequippable_skills
    @equipped_skills = {} if @equipped_skills == nil
    for key in @equipped_skills
      next if key == nil
      i = key[0]
      if @equipped_skills[i] != nil
        skill = $data_skills[@equipped_skills[i]]
      else
        skill = nil
      end
      @equipped_skills[i] = nil if i.is_a?(Integer) and i > max_slots
      @equipped_skills[i] = nil unless can_equip_skill?(skill, i)
      @equipped_skills[i] = nil unless self.skills.include?(skill)
    end
  end
 
  #--------------------------------------------------------------------------
  # purge_all_slots
  #--------------------------------------------------------------------------
  def purge_all_slots
    @equipped_skills = {}
  end
 
  #--------------------------------------------------------------------------
  # purge_all_replacements
  #--------------------------------------------------------------------------
  def purge_all_replacements
    @replaced_skills = {}
  end
 
  #--------------------------------------------------------------------------
  # limits equipped
  #--------------------------------------------------------------------------
  def limits_equipped(l_type)
    result = 0
    if l_type == 0
      result = equipped_skills.size
    else
      for skill in equipped_skills
        next if skill == nil
        result += skill.limit_use[l_type] if skill.limit_type.include?(l_type)
      end
    end
    return result
  end
 
  #--------------------------------------------------------------------------
  # can equip skill?
  #--------------------------------------------------------------------------
  def can_equip_skill?(skill, slot = nil)
    return true if skill == nil
    return true if skill.limit_type == []
    if slot != nil
      replace_skill = skill_in_slot(slot)
    end
    for l_type in skill.limit_type
      narray = YE::EQUIPSKILL::LIMIT_HASH[l_type]
      if replace_skill != nil and replace_skill.limit_type.include?(l_type)
        modifier = replace_skill.limit_use[l_type]
      else
        modifier = 0
      end
      if limits_equipped(l_type) >= narray[0] + modifier + limiter_mod(l_type)
        return false
      end
    end
    return true
  end
 
  #--------------------------------------------------------------------------
  # equipped auto states
  #--------------------------------------------------------------------------
  def equipped_auto_states
    if $game_temp.in_battle
      return battle_auto_states
    else
      return always_auto_states
    end
  end
 
  #--------------------------------------------------------------------------
  # battle auto states
  #--------------------------------------------------------------------------
  def battle_auto_states
    result = []
    for skill in equipped_skills
      for state_id in skill.equip_auto_state
        result.push(state_id)
      end
    end
    return result.uniq
  end
 
  #--------------------------------------------------------------------------
  # always auto states
  #--------------------------------------------------------------------------
  def always_auto_states
    result = []
    for skill in equipped_skills
      for state_id in skill.equip_auto_state
        result.push(state_id) unless $data_states[state_id].battle_only
      end
    end
    return result.uniq
  end
 
Revenir en haut Aller en bas
Garruk
Aventurier Lv.16
Aventurier Lv.16
Garruk


Age : 39
Inscrit le : 03/09/2009
Messages : 1503

Modifier une fonction  Empty
MessageSujet: Re: Modifier une fonction    Modifier une fonction  Icon_minitimeMar 24 Juil 2012 - 13:53

La suite

Code:

  #--------------------------------------------------------------------------
  # alias state_resist?
  #--------------------------------------------------------------------------
  alias state_resist_ess state_resist? unless $@
  def state_resist?(state_id)
    for skill in equipped_skills
      return true if skill.equip_state_resist.include?(state_id)
    end
    state_resist_ess(state_id)
  end
 
  #--------------------------------------------------------------------------
  # alias element set
  #--------------------------------------------------------------------------
  alias element_set_ess element_set unless $@
  def element_set
    result = element_set_ess
    for skill in equipped_skills
      result += skill.equip_plus_element
    end
    return result.uniq
  end
 
  #--------------------------------------------------------------------------
  # alias plus state set
  #--------------------------------------------------------------------------
  alias plus_state_set_ess plus_state_set unless $@
  def plus_state_set
    result = plus_state_set_ess
    for skill in equipped_skills
      result += skill.equip_plus_state
    end
    return result.uniq
  end
 
  #--------------------------------------------------------------------------
  # alias base maxhp
  #--------------------------------------------------------------------------
  alias base_maxhp_ess base_maxhp unless $@
  def base_maxhp
    n = base_maxhp_ess
    for skill in equipped_skills
      n *= skill.equip_hp_per
      n /= 100
      n += skill.equip_hp_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias base maxmp
  #--------------------------------------------------------------------------
  alias base_maxmp_ess base_maxmp unless $@
  def base_maxmp
    n = base_maxmp_ess
    for skill in equipped_skills
      n *= skill.equip_mp_per
      n /= 100
      n += skill.equip_mp_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias base atk
  #--------------------------------------------------------------------------
  alias base_atk_ess base_atk unless $@
  def base_atk
    n = base_atk_ess
    for skill in equipped_skills
      n *= skill.equip_atk_per
      n /= 100
      n += skill.equip_atk_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias base def
  #--------------------------------------------------------------------------
  alias base_def_ess base_def unless $@
  def base_def
    n = base_def_ess
    for skill in equipped_skills
      n *= skill.equip_def_per
      n /= 100
      n += skill.equip_def_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias base spi
  #--------------------------------------------------------------------------
  alias base_spi_ess base_spi unless $@
  def base_spi
    n = base_spi_ess
    for skill in equipped_skills
      n *= skill.equip_spi_per
      n /= 100
      n += skill.equip_spi_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias base agi
  #--------------------------------------------------------------------------
  alias base_agi_ess base_agi unless $@
  def base_agi
    n = base_agi_ess
    for skill in equipped_skills
      n *= skill.equip_agi_per
      n /= 100
      n += skill.equip_agi_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias hit
  #--------------------------------------------------------------------------
  alias hit_ess hit unless $@
  def hit
    n = hit_ess
    for skill in equipped_skills
      n *= skill.equip_hit_per
      n /= 100
      n += skill.equip_hit_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias eva
  #--------------------------------------------------------------------------
  alias eva_ess eva unless $@
  def eva
    n = eva_ess
    for skill in equipped_skills
      n *= skill.equip_eva_per
      n /= 100
      n += skill.equip_eva_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias cri
  #--------------------------------------------------------------------------
  alias cri_ess cri unless $@
  def cri
    n = cri_ess
    for skill in equipped_skills
      n *= skill.equip_cri_per
      n /= 100
      n += skill.equip_cri_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias odds
  #--------------------------------------------------------------------------
  alias odds_ess odds unless $@
  def odds
    n = odds_ess
    for skill in equipped_skills
      n *= skill.equip_odds_per
      n /= 100
      n += skill.equip_odds_set
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # alias auto battle
  #--------------------------------------------------------------------------
  alias auto_battle_ess auto_battle unless $@
  def auto_battle
    for skill in equipped_skills
      return true if skill.equip_auto_battle
    end
    auto_battle_ess
  end
 
  #--------------------------------------------------------------------------
  # alias super guard
  #--------------------------------------------------------------------------
  alias super_guard_ess super_guard unless $@
  def super_guard
    for skill in equipped_skills
      return true if skill.equip_super_guard
    end
    super_guard_ess
  end
 
  #--------------------------------------------------------------------------
  # alias pharmacology
  #--------------------------------------------------------------------------
  alias pharmacology_ess pharmacology unless $@
  def pharmacology
    for skill in equipped_skills
      return true if skill.equip_pharmacology
    end
    pharmacology_ess
  end
 
  #--------------------------------------------------------------------------
  # alias fast attack
  #--------------------------------------------------------------------------
  alias fast_attack_ess fast_attack unless $@
  def fast_attack
    for skill in equipped_skills
      return true if skill.equip_fast_attack
    end
    fast_attack_ess
  end
 
  #--------------------------------------------------------------------------
  # alias prevent critical
  #--------------------------------------------------------------------------
  alias prevent_critical_ess prevent_critical unless $@
  def prevent_critical
    for skill in equipped_skills
      return true if skill.equip_prevent_crit
    end
    prevent_critical_ess
  end
 
  #--------------------------------------------------------------------------
  # alias half mp cost
  #--------------------------------------------------------------------------
  alias half_mp_cost_ess half_mp_cost unless $@
  def half_mp_cost
    for skill in equipped_skills
      return true if skill.equip_half_mp_cost
    end
    half_mp_cost_ess
  end
 
  #--------------------------------------------------------------------------
  # alias double_exp_gain
  #--------------------------------------------------------------------------
  alias double_exp_gain_ess double_exp_gain unless $@
  def double_exp_gain
    for skill in equipped_skills
      return true if skill.equip_double_exp
    end
    double_exp_gain_ess
  end
 
end # Game Actor

#==============================================================================
# Window_Command (imported from KGC)
#==============================================================================

class Window_Command < Window_Selectable
unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # add command
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # refresh command
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # insert command
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # remove command
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
end
end

#===============================================================================
# Scene Menu
#===============================================================================

class Scene_Menu < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias create command window
  #--------------------------------------------------------------------------
  alias create_command_window_ess create_command_window unless $@
  def create_command_window
    create_command_window_ess
    return if $imported["CustomMenuCommand"]
    if $game_switches[YE::EQUIPSKILL::ENABLE_SLOTS_SWITCH]
      ses_text = YE::EQUIPSKILL::MENU_TITLE
      @command_equip_skill = @command_window.add_command(ses_text)
      if @command_window.oy > 0
        @command_window.oy -= Window_Base::WLH
      end
    end
    @command_window.index = @menu_index
  end
 
  #--------------------------------------------------------------------------
  # alias update command selection
  #--------------------------------------------------------------------------
  alias update_command_selection_ess update_command_selection unless $@
  def update_command_selection
    call_yerd_command = 0
    if Input.trigger?(Input::C)
      case @command_window.index
      when @command_equip_skill
        call_yerd_command = 1
      end
    end
    if call_yerd_command == 1
      if $game_party.members.size == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      start_actor_selection
      return
    end
    update_command_selection_ess
  end
 
  #--------------------------------------------------------------------------
  # alias update actor selection
  #--------------------------------------------------------------------------
  alias update_actor_selection_ess update_actor_selection unless $@
  def update_actor_selection
    if Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when @command_equip_skill
        $scene = Scene_Equip_Skill.new(@status_window.index,
        @command_equip_skill)
        return
      end
    end
    update_actor_selection_ess
  end
 
end # Scene Menu

#===============================================================================
# Scene Battle
#===============================================================================

class Scene_Battle < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias battle end
  #--------------------------------------------------------------------------
  alias battle_end_ess battle_end unless $@
  def battle_end(result)
    for actor in $game_party.members
      actor.purge_all_replacements
    end
    battle_end_ess(result)
  end
 
  #--------------------------------------------------------------------------
  # alias update
  #--------------------------------------------------------------------------
  alias update_ess update unless $@
  def update
    if @skill_copy_window != nil
      super
      update_basic(true)
      update_info_viewport
      update_skill_copy
    else
      update_ess
    end
  end
 
  #--------------------------------------------------------------------------
  # update skill copy
  #--------------------------------------------------------------------------
  def update_skill_copy
    @skill_copy_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_skill_copy_selection
    elsif Input.trigger?(Input::C)
      skill = @skill_copy_window.skill
      if allow_copy?(skill)
        Sound.play_decision
        determine_copy(skill)
      else
        Sound.play_buzzer
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # determine copy
  #--------------------------------------------------------------------------
  def determine_copy(skill)
    slot = @active_battler.which_slot?(@originalskill.id)
    @active_battler.replace_slot(slot, skill)
    end_skill_copy_selection
  end
 
  #--------------------------------------------------------------------------
  # allow copy?
  #--------------------------------------------------------------------------
  def allow_copy?(skill)
    return false if skill == nil
    return false if @active_battler.equipped_skill?(skill)
    return false if skill == @originalskill
    return false if skill.skill_copy?
    enabled = false
    enabled = true if @originalskill.skill_copy_any
    unless enabled
      for l_type in skill.limit_type
        if @originalskill.copy_types.include?(l_type)
          enabled = true
        end
      end
    end
    if enabled
      for l_type in skill.limit_type
        if @originalskill.copy_not.include?(l_type)
          return false
        end
      end
    end
    return enabled
  end
 
  #--------------------------------------------------------------------------
  # create skill copy window
  #--------------------------------------------------------------------------
  def create_skill_copy_window(skill, targets)
    @originalskill = skill
    skillset = []
    for target in targets
      if target.actor?
        for obj in target.skills
          unless YE::EQUIPSKILL::SHOW_UNCOPIABLE
            next unless allow_copy?(obj)
          end
          skillset.push(obj) unless skillset.include?(obj)
        end
      else
        for action in target.enemy.actions
          if action.kind == 1
            obj = $data_skills[action.skill_id]
            unless YE::EQUIPSKILL::SHOW_UNCOPIABLE
              next unless allow_copy?(obj)
            end
            skillset.push(obj) unless skillset.include?(obj)
          end
        end
      end
    end
    @help_window = Window_Help.new
    text = YE::EQUIPSKILL::SKILL_COPY_HELP
    @help_window.contents.draw_text(4, 0, 504, 24, text, 1)
    @skill_copy_window = Window_Skill_Copy.new(skill, skillset, @active_battler)
    @skill_status_window = Window_Copy_Status.new(skill, @active_battler)
    @message_window.visible = false
  end
 
  #--------------------------------------------------------------------------
  # end skill copy selection
  #--------------------------------------------------------------------------
  def end_skill_copy_selection
    @skill_copy_window.dispose
    @skill_copy_window = nil
    @help_window.dispose
    @help_window = nil
    @skill_status_window.dispose
    @skill_status_window = nil
    @message_window.visible = true
    if $imported["CustomSkillEffects"]
      $game_temp.common_event_id = @originalskill.common_event_id
    end
  end
 
  #--------------------------------------------------------------------------
  # alias execute_action_skill
  #--------------------------------------------------------------------------
unless $imported["CustomSkillEffects"]
  alias execute_action_skill_ess execute_action_skill unless $@
  def execute_action_skill
    execute_action_skill_ess
    skill = @active_battler.action.skill
    if skill.skill_copy? and @active_battler.actor?
      targets = @active_battler.action.make_targets
      create_skill_copy_window(skill, targets)
    end
  end
end
 
end

#===============================================================================
# Scene Title
#===============================================================================

class Scene_Title < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias create game objects
  #--------------------------------------------------------------------------
  alias create_game_objects_ess create_game_objects unless $@
  def create_game_objects
    create_game_objects_ess
    $game_switches[YE::EQUIPSKILL::ENABLE_SLOTS_SWITCH] = true
  end
 
end # Scene_Title

#===============================================================================
# Scene Equip Skill
#===============================================================================

class Scene_Equip_Skill < Scene_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor_index, menu_index = 0)
    @actor_index = actor_index
    @actor = $game_party.members[@actor_index]
    @menu_index = menu_index
    @auto_equip = 0
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(@actor.id)
      for skill_id in YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[@actor.id]
        next unless @actor.skill_learn?($data_skills[skill_id])
        @auto_equip += 1
      end
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(@actor.class.id)
      for skill_id in YE::EQUIPSKILL::AUTO_CLASS_SKILLS[@actor.class.id]
        next unless @actor.skill_learn?($data_skills[skill_id])
        @auto_equip += 1
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # start process
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @help_window = Window_Help.new
    if $imported["HelpExtension"]
      @help_window.row_max = KGC::HelpExtension::ROW_MAX
    end
    dy = @help_window.height
    dh = 416 - @help_window.height
    @slot_equip_window = Window_Slot_Equip.new(0, dy, 272, dh, @actor)
    @slot_equip_window.help_window = @help_window
    if $imported["DisplaySkillQuery"] and YE::EQUIPSKILL::ENABLE_SKILL_QUERY and
    YE::EQUIPSKILL::SHOW_QUERY_HELP_WIN
      dy += 56; dh -= 56
    end
    @slot_status_window = Window_Slot_Status.new(272, dy, 272, dh, @actor)
    if $imported["DisplaySkillQuery"] and YE::EQUIPSKILL::ENABLE_SKILL_QUERY and
    YE::EQUIPSKILL::SHOW_QUERY_HELP_WIN
      dy -= 56; dh += 56
    end
    dh -= 128
    @equipped_skills_window = Window_Equipped_Skills.new(0, dy, 544, dh, @actor)
    @equipped_skills_window.help_window = @help_window
    @equipped_status_window = Window_Equipped_Status.new(@actor)
    skill = @slot_equip_window.skill
    slot = @equipped_skills_window.index + 1 - @auto_equip
    oldskill = @equipped_skills_window.skill
    create_skill_query
    @last_slot_index = @slot_equip_window.index
    @slot_status_window.refresh(skill, oldskill, slot)
    @slot_status_window.visible = false
  end
 
  #--------------------------------------------------------------------------
  # create skill query
  #--------------------------------------------------------------------------
  def create_skill_query
    return unless $imported["DisplaySkillQuery"]
    return unless YE::EQUIPSKILL::ENABLE_SKILL_QUERY
    return unless YE::EQUIPSKILL::SHOW_QUERY_HELP_WIN
    sdy = @help_window.height
    sdh = 416 - sdy
    @skill_data_window = Window_Skill_Data.new(0, sdy, 272, sdh)
    @skill_data_window.active = false
    @help_info_window = Window_Base.new(272, sdy, 272, 56)
    text = YE::EQUIPSKILL::QUERY_HELP_WIN_TEXT
    @help_info_window.contents.draw_text(2, 0, 240, 24, text, 1)
    @help_info_window.visible = false
  end
 
  #--------------------------------------------------------------------------
  # terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_info_window.dispose if @help_info_window != nil
    @skill_data_window.dispose if @skill_data_window != nil
    @help_window.dispose
    @slot_status_window.dispose
    @slot_equip_window.dispose
    @equipped_skills_window.dispose
    @equipped_status_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # return scene
  #--------------------------------------------------------------------------
  def return_scene
    if $imported["SceneStatusReDux"] and $game_temp.status_menu_flag
      $scene = Scene_Status.new(@actor_index, $game_temp.status_menu_index)
    else
      $scene = Scene_Status.new(@actor_index)#$scene = Scene_Menu.new(@menu_index)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Switch to Next Actor Screen
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip_Skill.new(@actor_index, @menu_index)
  end
 
  #--------------------------------------------------------------------------
  # * Switch to Previous Actor Screen
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip_Skill.new(@actor_index, @menu_index)
  end
 
  #--------------------------------------------------------------------------
  # frame update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    if $imported["DisplaySkillQuery"] and @skill_data_window.active
      update_skill_query_window
    elsif @equipped_skills_window.active
      update_equipped_skills
    elsif @slot_equip_window.active
      update_slot_equip
    end
  end
 
  #--------------------------------------------------------------------------
  # update_skill_query_window
  #--------------------------------------------------------------------------
  def update_skill_query_window
    @skill_data_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @skill_data_window.disappear
      @slot_equip_window.active = true
    elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
      @skill_data_window.previous_page
    elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
      @skill_data_window.next_page
    elsif Input.trigger?(Input::L)
      @skill_data_window.top_page
    elsif Input.trigger?(Input::R)
      @skill_data_window.bottom_page
    end
  end
 
  #--------------------------------------------------------------------------
  # update equipped skills
  #--------------------------------------------------------------------------
  def update_equipped_skills
    @equipped_skills_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::C)
      slot = @equipped_skills_window.index + 1 - @auto_equip
      if slot <= 0
        allowed = false
      else
        allowed = true
      end
      if allowed
        Sound.play_decision
        change_to_equip_select
      else
        Sound.play_buzzer
      end
     
    elsif Input.trigger?(Input::A)
      slot = @equipped_skills_window.index + 1 - @auto_equip
      if slot <= 0
        allowed = false
      else
        allowed = true
      end
      if allowed
        Sound.play_equip
        @actor.change_slot(slot, nil)
        @equipped_skills_window.refresh
        @equipped_status_window.refresh
      else
        Sound.play_buzzer
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # update slot equip
  #--------------------------------------------------------------------------
  def update_slot_equip
    @slot_equip_window.update
   
    if @last_slot_index != @slot_equip_window.index
      skill = @slot_equip_window.skill
      slot = @equipped_skills_window.index + 1 - @auto_equip
      oldskill = @equipped_skills_window.skill
      @last_slot_index = @slot_equip_window.index
      @slot_status_window.refresh(skill, oldskill, slot)
    end
   
    if Input.trigger?(Input::B)
      Sound.play_cancel
      change_to_slot_select
    elsif Input.trigger?(Input::C)
      determine_slot_select
    elsif $imported["DisplaySkillQuery"] and
    Input.trigger?(YE::EQUIPSKILL::SHOW_QUERY_BUTTON)
      if @slot_equip_window.skill == nil
        skill = nil
      else
        skill = @slot_equip_window.skill
      end
      if skill != nil
        Sound.play_decision
        @skill_data_window.appear(skill, @slot_equip_window, @actor, 2)
        @slot_equip_window.active = false
      else
        Sound.play_buzzer
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # change to equip select
  #--------------------------------------------------------------------------
  def change_to_equip_select
    @slot_equip_window.refresh(@equipped_skills_window.index + 1 - @auto_equip)
    @equipped_skills_window.active = false
    @equipped_skills_window.visible = false
    @equipped_status_window.visible = false
    @slot_status_window.visible = true
    @slot_equip_window.visible = true
    @slot_equip_window.active = true
    @help_info_window.visible = true if @help_info_window != nil
  end
 
  #--------------------------------------------------------------------------
  # change to slot select
  #--------------------------------------------------------------------------
  def change_to_slot_select
    @last_slot_index = @slot_equip_window.item_max + 1
    @equipped_skills_window.refresh
    @equipped_status_window.refresh
    @equipped_skills_window.active = true
    @equipped_skills_window.visible = true
    @equipped_status_window.visible = true
    @slot_status_window.visible = false
    @slot_equip_window.visible = false
    @slot_equip_window.active = false
    @help_info_window.visible = false if @help_info_window != nil
  end
 
  #--------------------------------------------------------------------------
  # determine slot select
  #--------------------------------------------------------------------------
  def determine_slot_select
    skill = @slot_equip_window.skill
    slot = @equipped_skills_window.index + 1 - @auto_equip
    if skill == @actor.skill_in_slot(slot)
      Sound.play_equip
      @actor.change_slot(slot, skill)
      change_to_slot_select
    elsif !@actor.can_equip_skill?(skill, slot)
      Sound.play_buzzer
    elsif @actor.equipped_skills.include?(skill)
      Sound.play_buzzer
    else
      Sound.play_equip
      @actor.change_slot(slot, skill)
      change_to_slot_select
    end
  end
 
end

#==============================================================================
# Window_Equipped_Skills
#==============================================================================

class Window_Equipped_Skills < Window_Selectable
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(wx, wy, ww, wh, actor)
    super(wx, wy, ww, wh)
    @actor = actor
    @actor.purge_unequippable_skills
    @column_max = 2
    self.index = 0
    self.active = true
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    auto_equip = 0
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(@actor.id)
      for skill_id in YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[@actor.id]
        next unless @actor.skill_learn?($data_skills[skill_id])
        auto_equip += 1
        skill = $data_skills[skill_id]
        @data.push(skill)
      end
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(@actor.class.id)
      for skill_id in YE::EQUIPSKILL::AUTO_CLASS_SKILLS[@actor.class.id]
        next unless @actor.skill_learn?($data_skills[skill_id])
        auto_equip += 1
        skill = $data_skills[skill_id]
        @data.push(skill)
      end
    end
    for i in 1..(@actor.max_slots)
      @data.push(@actor.skill_in_slot(i))
    end
    @item_max = (@actor.max_slots) + auto_equip
    create_contents
    for i in 0..(@item_max - 1)
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    rect = item_rect(index)
    enabled = true
    self.contents.clear_rect(rect)
    rect.width -= 4
    dx = rect.x
    dy = rect.y
    dw = rect.width
    dh = rect.height
    sw = self.width - 32
    if skill == nil
      text = YE::EQUIPSKILL::EMPTY_SLOT
      icon = YE::EQUIPSKILL::EMPTY_ICON
      enabled = false
    else
      text = skill.name
      icon = skill.icon_index
    end
    draw_icon(icon, dx, dy, enabled)
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(dx+24, dy, dw-72, dh, text, 0)
    if skill != nil and skill.limit_type != []
      dx = rect.x + rect.width - 24
      for l_type in skill.limit_type
        narray = YE::EQUIPSKILL::LIMIT_HASH[l_type]
        next unless narray[2]
        next unless narray[3]
        icon = narray[0]
        draw_icon(icon, dx, rect.y, enabled)
        dx -= 24
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
 
  #--------------------------------------------------------------------------
  # Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
 
end #Window_Equipped_Skills

#==============================================================================
# Window_Slot_Equip
#==============================================================================

class Window_Slot_Equip < Window_Selectable
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(wx, wy, ww, wh, actor)
    super(wx, wy, ww, wh)
    @actor = actor
    @slot = nil
    @column_max = 1
    self.index = 0
    self.active = false
    self.visible = false
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(slot = nil)
    @slot = slot
    @data = [nil] + @actor.skills
    @item_max = @data.size
    create_contents
    for i in 0..(@item_max-1)
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    rect = item_rect(index)
    enabled = true
    enabled = @actor.can_equip_skill?(skill, @slot)
    self.contents.clear_rect(rect)
    enabled = false if @actor.equipped_skills.include?(skill)
    if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(@actor.id)
      enabled = false if
      YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[@actor.id].include?(skill.id)
    end
    if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(@actor.class.id)
      enabled = false if
      YE::EQUIPSKILL::AUTO_CLASS_SKILLS[@actor.class.id].include?(skill.id)
    end
    rect.width -= 4
    if skill != nil
      rect.width -= 4
      draw_icon(skill.icon_index, rect.x, rect.y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(rect.x + 24, rect.y, 168, WLH, skill.name, 0)
      if skill.limit_type != []
        dx = self.width - 56
        for l_type in skill.limit_type
          narray = YE::EQUIPSKILL::LIMIT_HASH[l_type]
          next unless narray[2]
          next unless narray[3]
          icon = narray[0]
          draw_icon(icon, dx, rect.y, enabled)
          dx -= 24
        end
      end
    else
      enabled = true
      rect.width -= 4
      draw_icon(YE::EQUIPSKILL::EMPTY_ICON, rect.x, rect.y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      text = YE::EQUIPSKILL::UNEQUIP_TX
      self.contents.draw_text(rect.x + 24, rect.y, 216, WLH, text)
    end
  end
 
  #--------------------------------------------------------------------------
  # skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
 
  #--------------------------------------------------------------------------
  # Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
 
end #Window_Slot_Equip

#==============================================================================
# Window_Equipped_Status
#==============================================================================

class Window_Equipped_Status < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 288, 544, 128)
    @actor = actor
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_face(@actor, 0, 0)
    dx = 96
    dy = 0
    name = @actor.name
    self.contents.draw_text(0, dy, 96, WLH, name, 0)
    hash = YE::EQUIPSKILL::LIMIT_HASH
    hash = hash.sort {|x,y| x[0] <=> y[0] }
    for key in hash
      l_type = key[0]
      narray = key[1]
      next unless narray[2]
      icon = narray[0]
      draw_icon(icon, dx, dy)
      text = narray[4]
      self.contents.draw_text(dx+24, dy, 116, WLH, text, 0)
      max = narray[1] + @actor.limiter_mod(l_type)
      text = YE::EQUIPSKILL::LIMIT_DISPLAY
      text = "%d" if (max >= @actor.max_slots) or (max == 0)
      text = sprintf(text, @actor.limits_equipped(l_type), max)
      self.contents.draw_text(dx+140, dy, 60, WLH, text, 2)
      dy += WLH
      if dy + WLH > self.height - 32
        dy = 0
        dx += 208
      end
    end
  end
 
end #Window_Equipped_Status

#==============================================================================
# Window_Slot_Status
#==============================================================================

class Window_Slot_Status < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(wx, wy, ww, wh, actor)
    super(wx, wy, ww, wh)
    @actor = actor
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh(newskill = nil, oldskill = nil, slot = nil)
    self.contents.clear
    sw = self.width - 32
    dx = 0
    dy = 0
    draw_actor_face(@actor, dx, dy)
    self.contents.font.color = normal_color
    name = @actor.name
    self.contents.draw_text(96, dy, 96, WLH, name, 0)
    #---
    dy += WLH
    if $imported["SubclassSelectionSystem"]
      icon = YE::SUBCLASS::CLASS_ICONS[@actor.class.id]
      draw_icon(icon, 96, dy)
      text = @actor.class.name
      self.contents.draw_text(120, dy, sw-120, WLH, text, 0)
      if @actor.subclass != nil
        dy += WLH
        icon = YE::SUBCLASS::CLASS_ICONS[@actor.subclass.id]
        draw_icon(icon, 96, dy)
        text = @actor.subclass.name
        self.contents.draw_text(120, dy, sw-120, WLH, text, 0)
      end
    else
      draw_actor_class(@actor, 96, dy)
    end
    #---
    dx = 0
    sy = WLH * 4
    dy = sy
    self.contents.font.color = system_color
    for i in 0..5
      text = YE::EQUIPSKILL::STAT_PARAM[i]
      icon = YE::EQUIPSKILL::STAT_ICONS[i]
      draw_icon(icon, dx, dy)
      self.contents.draw_text(dx+24, dy, 60, WLH, text, 0)
      dy += WLH
    end
    dx += 80
    dy = sy
    self.contents.font.color = normal_color
    for i in 0..5
      case i
      when 0; text = @actor.maxhp
      when 1; text = @actor.maxmp
      when 2; text = @actor.atk
      when 3; text = @actor.def
      when 4; text = @actor.spi
      when 5; text = @actor.agi
      end
      self.contents.draw_text(dx, dy, 60, WLH, text, 2)
      dy += WLH
    end
    dx += 60
    dy = sy
    self.contents.font.color = system_color
    if YE::EQUIPSKILL::ES_USE_ICON
      icon = YE::EQUIPSKILL::ES_ICON
      for i in 0..5
        draw_icon(icon, dx+3, dy)
        dy += WLH
      end
    else
      text = YE::EQUIPSKILL::ES_ARROW
      for i in 0..5
        self.contents.draw_text(dx, dy, 30, WLH, text, 1)
        dy += WLH
      end
    end
    dx += 30
    dy = sy
    for i in 0..5
      fake = @actor.clone
      fixhp = @actor.hp
      fixmp = @actor.mp
      case i
      when 0
        old = @actor.maxhp
        fake.change_slot(slot,newskill)
        new = fake.maxhp
      when 1
        old = @actor.maxmp
        fake.change_slot(slot,newskill)
        new = fake.maxmp
      when 2
        old = @actor.atk
        fake.change_slot(slot,newskill)
        new = fake.atk
      when 3
        old = @actor.def
        fake.change_slot(slot,newskill)
        new = fake.def
      when 4
        old = @actor.spi
        fake.change_slot(slot,newskill)
        new = fake.spi
      when 5
        old = @actor.agi
        fake.change_slot(slot,newskill)
        new = fake.agi
      end
      self.contents.font.color = new_parameter_color(old, new)
      if YE::EQUIPSKILL::ES_SDISPLAY == 1
        text = new
      else
        text = sprintf("%+d", new - old)
      end
      self.contents.draw_text(dx, dy, 60, WLH, text, 0)
      dy += WLH
      fake.change_slot(slot,oldskill)
      @actor.hp = fixhp
      @actor.mp = fixmp
    end
    #---
    return if newskill == nil
    self.contents.font.color = system_color
    #---
    if newskill.equip_auto_state != []
      dx = 0
      text = YE::EQUIPSKILL::ES_AUTO_STATE
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
      dx = sw
      for state_id in newskill.equip_auto_state
        state = $data_states[state_id]
        next if state.icon_index == 0
        dx -= 24
        draw_icon(state.icon_index, dx, dy)
      end
    end
    #---
    if newskill.equip_state_resist != []
      dx = 0
      text = YE::EQUIPSKILL::ES_STATE_RESIST
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
      dx = sw
      for state_id in newskill.equip_state_resist
        state = $data_states[state_id]
        next if state.icon_index == 0
        dx -= 24
        draw_icon(state.icon_index, dx, dy)
      end
    end
    #---
    if newskill.equip_plus_state != []
      dx = 0
      text = YE::EQUIPSKILL::ES_PLUS_STATE
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
      dx = sw
      for state_id in newskill.equip_plus_state
        state = $data_states[state_id]
        next if state.icon_index == 0
        dx -= 24
        draw_icon(state.icon_index, dx, dy)
      end
    end
    #---
    if newskill.equip_plus_element != []
      dx = 0
      text = YE::EQUIPSKILL::ES_PLUS_ELEMENT
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
      dx = sw
      for ele_id in newskill.equip_plus_element
        next unless YE::EQUIPSKILL::ES_ELEMENT_ICONS.include?(ele_id)
        dx -= 24
        draw_icon(YE::EQUIPSKILL::ES_ELEMENT_ICONS[ele_id], dx, dy)
      end
    end
    #---
    if newskill.equip_auto_battle
      dx = 0
      text = YE::EQUIPSKILL::ES_AUTO_BATTLE
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_super_guard
      dx = 0
      text = YE::EQUIPSKILL::ES_SUPER_GUARD
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_pharmacology
      dx = 0
      text = YE::EQUIPSKILL::ES_PHARMACOLOGY
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_fast_attack
      dx = 0
      text = YE::EQUIPSKILL::ES_FAST_ATTACK
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_prevent_crit
      dx = 0
      text = YE::EQUIPSKILL::ES_PREVENT_CRIT
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_half_mp_cost
      dx = 0
      text = YE::EQUIPSKILL::ES_HALF_MP_COST
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
    #---
    if newskill.equip_double_exp
      dx = 0
      text = YE::EQUIPSKILL::ES_DOUBLE_EXP
      self.contents.draw_text(dx, dy, sw, WLH, text, 0)
    end
  end
 
  #--------------------------------------------------------------------------
  # New Parameter Colour
  #--------------------------------------------------------------------------
  def new_parameter_color(old_value, new_value)
    if new_value > old_value
      return power_up_color
    elsif new_value == old_value
      return normal_color
    else
      return power_down_color
    end
  end
 
end #Window_Slot_Status

#==============================================================================
# Window_Skill_Copy
#==============================================================================

class Window_Skill_Copy < Window_Selectable
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(skill, skillset, actor)
    super(0, 56, 544, 232)
    @originalskill = skill
    @skills = skillset
    @skills = @skills.sort {|a,b| a.name <=> b.name}
    @actor = actor
    @column_max = 2
    self.index = 0
    self.active = true
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = @skills
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    skill = @data[index]
    enabled = false
    enabled = true if @originalskill.skill_copy_any
    unless enabled
      for l_type in skill.limit_type
        if @originalskill.copy_types.include?(l_type)
          enabled = true
          break
        end
      end
    end
    if enabled
      for l_type in skill.limit_type
        if @originalskill.copy_not.include?(l_type)
          enabled = false
          break
        end
      end
      enabled = false if @actor.equipped_skill?(skill)
      enabled = false if skill == @originalskill
      enabled = false if skill.skill_copy?
    end
    self.contents.clear_rect(rect)
    if skill != nil
      rect.width -= 4
      draw_item_name(skill, rect.x, rect.y, rect.width, enabled)
    end
  end
 
  #--------------------------------------------------------------------------
  # draw item
  #--------------------------------------------------------------------------
  def draw_item_name(skill, x, y, rw, enabled = true)
    if skill != nil
      draw_icon(skill.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, rw-24, WLH, skill.name)
    end
  end
 
  #--------------------------------------------------------------------------
  # skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
 
end # Window Skill Copy

#==============================================================================
# Window_Copy_Status
#==============================================================================

class Window_Copy_Status < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(skill, actor)
    super(0, 288, 544, 128)
    @skill = skill
    @actor = actor
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_face(@actor, 0, 0)
    dx = 96
    dy = 0
    draw_actor_name(@actor, 0, dy)
    hash = YE::EQUIPSKILL::LIMIT_HASH
    hash = hash.sort {|x,y| x[0] <=> y[0] }
    for key in hash
      l_type = key[0]
      narray = key[1]
      next unless narray[2]
      enabled = false
      enabled = true if @skill.skill_copy_any
      enabled = true if @skill.copy_types.include?(l_type)
      enabled = false if @skill.copy_not.include?(l_type)
      enabled = true if l_type == 0
      icon = narray[0]
      draw_icon(icon, dx, dy, enabled)
      text = narray[4]
      if l_type == 0
        text = YE::EQUIPSKILL::SKILL_COPY_TYPES
      end
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(dx+24, dy, 184, WLH, text, 0)
      dy += WLH
      if dy + WLH > self.height - 32
        dy = 0
        dx += 208
      end
    end
  end
 
end #Window_Copy_Status

#===============================================================================
#
# END OF FILE
#
#===============================================================================
Revenir en haut Aller en bas
Gunslinger
Poulet trizo Lv.3
Poulet trizo Lv.3
Gunslinger


Masculin Age : 29
Inscrit le : 31/10/2011
Messages : 31

Modifier une fonction  Empty
MessageSujet: Re: Modifier une fonction    Modifier une fonction  Icon_minitimeMar 24 Juil 2012 - 16:36

Bonjour Garruk !!

Je ne connais pas trés bien ce script mais
il existe un script de KGC, qui a les même
fonctions que ton script.

Il s'ajit du script KGC_SkillCPSystem :

Le script de KGC place directement tes
compétence apprise tant que tu ne dépasses pas
le nombre de point attribué pour l'équipement
des compétences. Et il est fonctionnel
avec de nombreux script de Yanfly.

En espérant que ceci peut t'aider, si tu as besoin du script,
dit le moi et je te l'envois.

Amicalement
Gunslinger
Revenir en haut Aller en bas
Garruk
Aventurier Lv.16
Aventurier Lv.16
Garruk


Age : 39
Inscrit le : 03/09/2009
Messages : 1503

Modifier une fonction  Empty
MessageSujet: Re: Modifier une fonction    Modifier une fonction  Icon_minitimeMar 24 Juil 2012 - 17:31

Il manque beaucoup de fonction dans celui de KGC et j'ai un problème de compatibilité, donc je préfère modifier une fonction qui appartient déjà au script que de créer un patch.
Mais c'est très sympa de me l'avoir proposé. =)
Revenir en haut Aller en bas
Angellan
Admindictatrice
Admindictatrice
Angellan


Féminin Age : 33
Inscrit le : 27/02/2009
Messages : 2855

Modifier une fonction  Empty
MessageSujet: Re: Modifier une fonction    Modifier une fonction  Icon_minitimeLun 6 Aoû 2012 - 14:10

Personne n'a de solution ?
Revenir en haut Aller en bas
http://bonheur-du-yaoi.forumsactifs.com
Contenu sponsorisé




Modifier une fonction  Empty
MessageSujet: Re: Modifier une fonction    Modifier une fonction  Icon_minitime

Revenir en haut Aller en bas
 

Modifier une fonction

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» Modifier titre
» Modifier le scripte PHS
» Modifier l'apparence des barres HP et MP
» [Resolu]Modifier le menu!
» Modifier le script de menu

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker VX :: Entraide :: Problèmes et Solutions :: Abandonné-
Créer un forum | ©phpBB | Forum gratuit d'entraide | Signaler un abus | Forum gratuit