Últimos temas
» [VX/Ace]PersonajesEscolares
por mdk3dd Hoy a las 3:30 pm

» Chaos of Destiny - The Origin
por mdk3dd Ayer a las 9:24 pm

» Laminación [VXACE] [NUEVO LAVADO DE CARA!]
por Pocari Ayer a las 8:22 pm

» [Avance] Chaos of Destiny - The origin
por IvalteK_Dev Ayer a las 7:11 pm

» Proyecto: "En busca del biberón perdido"
por IvalteK_Dev Ayer a las 6:59 pm

» Muz-taller: Charas
por Ruben_modder Ayer a las 2:30 pm

» 2 Dudas: Compatibilidad maker PC y Android
por Ruben_modder Ayer a las 1:36 pm

» Duda Bases Maker MV
por Ruben_modder Ayer a las 11:46 am

» [MV] Precognition
por JapoZero Sáb Dic 08, 2018 8:06 am

» ("TCG") Que RPG Maker es el recomendado?
por JKLmaster Vie Dic 07, 2018 7:48 pm

» Problema con los charas
por mdk3dd Dom Dic 02, 2018 5:55 pm

» Heartland | IGMC 2018
por InvariableZ Dom Dic 02, 2018 11:20 am


(Ace-Script) Límite de Daño y Regeneración

Ir abajo

(Ace-Script) Límite de Daño y Regeneración

Mensaje por JapoZero el Sáb Dic 13, 2014 9:30 pm

Con este script se puede ajustar un límite de daño y regeneración de vida a cualquier objeto, y en general a toda la base de datos del juego.

¿Cómo usar?

  • Para añadir un límite de daño a cualquier objeto de la base de datos, se pone el comentario:

Código:
<damage limit: n> Donde N es el valor máximo.

  • Para hacer que un objeto tenga valores máximos para regenerar (excluyendo técnicas y objetos) se pone el comentario:

Código:
<regen limit: n> Donde N es el valor máximo.

  • Para añadir un valor por defecto de daño o regeneración máxima, ir a la línea 91 del script.

Código:
#==============================================================================
    
    DefaultDamageLimit = 99999
    DefaultRegenLimit = 99999

Si se quiere desactivar el límite por defecto, remplaza "99999" por nil o 0.
Créditos al script:  Shadowmaster/Shadowmaster9000/Shadowpasta.
Libre para usar en proyectos comerciales y no comerciales.
Script:
Código:
=begin
===============================================================================
 Damage Limit V3.2 (03/9/2014)
-------------------------------------------------------------------------------
 Created By: Shadowmaster/Shadowmaster9000/Shadowpasta
 (www.crimson-castle.co.uk)
 
===============================================================================
 Information
-------------------------------------------------------------------------------
 This script sets up the maximum limit for how much damage a battler and skill
 can deal, along with equipments and states being able to change these limits.
 
===============================================================================
 How to Use
-------------------------------------------------------------------------------
 Place this script under Materials. It is also recommended to place this
 script below any other scripts that overwrites the make_damage methods in
 the Game_ActionResult and Game_Battler classes.
 
 Tag any database object with:
 
    <damage limit: n>
    
 Where n is the damage limit number.
 
 If you want to set a database object (excluding skills and items) with a
 limit for regenative and poison effects, use the tag below:
 
    <regen limit: n>
    
 Where n is the regen limit number.
 
 When a battler is using damage limit tags from multiple database objects,
 the highest value will be used. There are also options down below which allow
 you to set a Default Damage Limit, as well as damage limit priorities for each
 type of database item.

===============================================================================
 Required
-------------------------------------------------------------------------------
 Nothing.
 
===============================================================================
 Change log
-------------------------------------------------------------------------------
 v3.2: Fixed an error that caused Regen Limits to not work. (7/10/2014)
 v3.1: Fixed an error that caused the Default Limits to no longer work. Also
 reduced the number of lines of code to improve efficiency. (27/9/2014)
 v3.0: Added notetags for regen limits so each database object can now have
 different regen limits. Also added the ability to set priorities for database
 objects, so the database objects with higher priority have their limits
 override the database objects of lower priority regardless of if the limit
 is higher or lower. (27/05/2014)
 v2.1: Fixed a bug with the notetags not being read correctly. (24/10/2013)
 v2.0: Feature Manager no longer required. Also given Regen effects their own
 damage limit. (16/10/2013)
 v1.0: First release. (18/01/2013)

===============================================================================
 Terms of Use
-------------------------------------------------------------------------------
 * Free to use for both commercial and non-commerical projects.
 * Credit me if used.
 * Do not claim this as your own.
 * You're free to post this on other websites, but please credit me and keep
 the header intact.
 * If you want to release any modifications/add-ons for this script, you must
 use the same Terms of Use as this script uses.
 * If you want to use your own seperate Terms of Use for your version or
 add-ons of this script, you must contact me at http://www.rpgmakervxace.net
 or www.crimson-castle.co.uk

===============================================================================
=end
$imported = {} if $imported.nil?
$imported["DamageLimit"] = true

module DamageLimit

#==============================================================================
# ** Default Damage & Regen Limit
#------------------------------------------------------------------------------
#  Sets the default damage for all attacks if the user/item/skill does
#  not have any damage limit tags, as well as the default regen limit for all
#  battlers if they do not have any regen limit tags. If you don't want to use
#  a default damage limit or default regen limit, set the value as either 0 or
#  nil.
#==============================================================================
    
    DefaultDamageLimit = 99999
    DefaultRegenLimit = 99999
    
#==============================================================================
# ** Limit Priority
#------------------------------------------------------------------------------
#  If Default Skill Priority is set to true, any damage limits set for skills
#  and items will override any other damage limits the battler is carrying
#  even if the damage limit for said skill/item is lower. This can be ignored
#  if setting your own priorities for database objects.
#
#  If Set Database Priority set to true, instead of using the highest limit
#  available to the battler through multiple database objects, the database
#  objects will be prioritized, so the database object with higher priority
#  will override the damage limits from the database objects with lower
#  priority.
#
#  For regen limits, priorities for the skill and item database objects will
#  be ignored as regen limits can't be applied to skills or items.
#
#  The database objects are organized as:
#
#  "Battler" - affects both actors and enemies
#
#  "Class" - Class database objects
#
#  "Equip" - Equipment database objects, when multiple Equipment pieces
#  with limit tags are being used, the highest one will be selected
#
#  "State" - State database objects, when multiple States with limit tags are
#  being used, the highest one will be selected
#
#  "Skill" - affects both skills and items, this database object is ignored
#  by regen limits
#
#  Each database object is stored within an array. The objects put in last
#  will have higher priority than the database objects put in first.
#==============================================================================
  
   DefaultSkillPriority = true
   SetDatabasePriority = false
  
   ObjectArray = ["Battler","Class","Equip","State","Skill"]
    
#==============================================================================
# ** DO NOT edit anything below this unless if you know what you're doing!
#==============================================================================

end

module DataManager
  #--------------------------------------------------------------------------
  # * Load Database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_damagelimit load_database; end
  def self.load_database
    load_database_damagelimit
    load_notetags_damagelimit
  end
  #--------------------------------------------------------------------------
  # * Load Notetags for Damage Limit
  #--------------------------------------------------------------------------
  def self.load_notetags_damagelimit
    groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
    $data_enemies, $data_states, $data_skills, $data_items]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_damagelimit
      end
    end
  end
end

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
#  A superclass of actor, class, skill, item, weapon, armor, enemy, and state.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :damagelimit
  attr_accessor :regenlimit
  #--------------------------------------------------------------------------
  # Defining Attributes
  #--------------------------------------------------------------------------
  def load_notetags_damagelimit
    @damagelimit = 0
    @regenlimit = 0
    if @note =~ /<damage limit: (.*)>/i
      @damagelimit = $1.to_i
    end
    if @note =~ /<regen limit: (.*)>/i
      @regenlimit = $1.to_i
    end
  end
end

#==============================================================================
# ** Game_ActionResult
#------------------------------------------------------------------------------
#  This class handles the results of battle actions. It is used internally for
# the Game_Battler class.
#==============================================================================

class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Create Damage
  #--------------------------------------------------------------------------
  alias :make_damage_limit :make_damage
  def make_damage(value, item)
    if @battler.max_damage != 0
      limit = @battler.max_damage
      if value > 0
        value = [value, limit].min
      else
        value = [value, -limit].max
      end
    end
    make_damage_limit(value, item)
  end
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :max_damage
  #--------------------------------------------------------------------------
  # * Defines the battler damage limit
  #--------------------------------------------------------------------------
  def battler_damage_limit
    @battlerdmglimit = 0
    if actor?
      if self.actor.damagelimit > 0
        @battlerdmglimit = self.actor.damagelimit
      end
    else
      if self.enemy.damagelimit > 0
        @battlerdmglimit = self.enemy.damagelimit
      end
    end
    @battlerdmglimit
  end
  #--------------------------------------------------------------------------
  # * Defines the class damage limit
  #--------------------------------------------------------------------------
  def class_damage_limit
    @classdmglimit = 0
    if actor?
      if self.class.damagelimit > 0
        @classdmglimit = self.class.damagelimit
      end
    end
    @classdmglimit
  end
  #--------------------------------------------------------------------------
  # * Defines the equipment damage limit
  #--------------------------------------------------------------------------
  def equip_damage_limit
    @equipdmglimit = 0
    if actor?
      for equip in equips
        next if equip.nil?
        if equip.damagelimit > @equipdmglimit
          @equipdmglimit = equip.damagelimit
        end
      end
    end
    @equipdmglimit
  end
  #--------------------------------------------------------------------------
  # * Defines the state damage limit
  #--------------------------------------------------------------------------
  def state_damage_limit
    @statedmglimit = 0
    for state in states
      next if state.nil?
      if state.damagelimit > @statedmglimit
        @statedmglimit = state.damagelimit
      end
    end
    @statedmglimit
  end
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias :make_damage_value_limit :make_damage_value
  def make_damage_value(user, item)
    @max_damage = 0
    @max_damage = DamageLimit::DefaultDamageLimit if DamageLimit::DefaultDamageLimit != nil
    if DamageLimit::SetDatabasePriority
      for dbobject in DamageLimit::ObjectArray
        @max_damage = user.battler_damage_limit if user.battler_damage_limit > 0 && dbobject == "Battler"
        @max_damage = user.class_damage_limit if user.class_damage_limit > 0 && dbobject == "Class"
        @max_damage = user.equip_damage_limit if user.equip_damage_limit > 0 && dbobject == "Equip"
        @max_damage = user.state_damage_limit if user.state_damage_limit > 0 && dbobject == "State"
        @max_damage = item.damagelimit if item.damagelimit > 0 && dbobject == "Skill"
      end
    else
      @max_damage = user.battler_damage_limit if user.battler_damage_limit > @max_damage
      @max_damage = user.class_damage_limit if user.class_damage_limit > @max_damage
      @max_damage = user.equip_damage_limit if user.equip_damage_limit > @max_damage
      @max_damage = user.state_damage_limit if user.state_damage_limit > @max_damage
      if DamageLimit::DefaultSkillPriority == true
        @max_damage = item.damagelimit if item.damagelimit > 0
      else
        @max_damage = item.damagelimit if item.damagelimit > @max_damage
      end
    end
    make_damage_value_limit(user, item)
  end
  #--------------------------------------------------------------------------
  # * Defines the battler regen limit
  #--------------------------------------------------------------------------
  def battler_regen_limit
    @battlerrgnlimit = 0
    if actor?
      if self.actor.regenlimit > 0
        @battlerrgnlimit = self.actor.regenlimit
      end
    else
      if self.enemy.damagelimit > 0
        @battlerrgnlimit = self.enemy.regenlimit
      end
    end
    @battlerrgnlimit
  end
  #--------------------------------------------------------------------------
  # * Defines the class regen limit
  #--------------------------------------------------------------------------
  def class_regen_limit
    @classrgnlimit = 0
    if actor?
      if self.class.regenlimit > 0
        @classrgnlimit = self.class.regenlimit
      end
    end
    @classrgnlimit
  end
  #--------------------------------------------------------------------------
  # * Defines the equipment regen limit
  #--------------------------------------------------------------------------
  def equip_regen_limit
    @equiprgnlimit = 0
    if actor?
      for equip in equips
        next if equip.nil?
        if equip.regenlimit > @equiprgnlimit
          @equiprgnlimit = equip.regenlimit
        end
      end
    end
    @equiprgnlimit
  end
  #--------------------------------------------------------------------------
  # * Defines the state regen limit
  #--------------------------------------------------------------------------
  def state_regen_limit
    @statergnlimit = 0
    for state in states
      next if state.nil?
      if state.regenlimit > @statergnlimit
        @statergnlimit = state.regenlimit
      end
    end
    @statergnlimit
  end
  #--------------------------------------------------------------------------
  # * Defines all of the regen limits
  #--------------------------------------------------------------------------
  def all_regen_limits
    @allrgnlimit = 0
    if DamageLimit::DefaultRegenLimit != 0 || DamageLimit::DefaultRegenLimit != nil
      @allrgnlimit = DamageLimit::DefaultRegenLimit
    end
    if DamageLimit::SetDatabasePriority
      for dbobject in DamageLimit::ObjectArray
        @allrgnlimit = battler_regen_limit if battler_regen_limit > 0 && dbobject == "Battler"
        @allrgnlimit = class_regen_limit if class_regen_limit > 0 && dbobject == "Class"
        @allrgnlimit = equip_regen_limit if equip_regen_limit > 0 && dbobject == "Equip"
        @allrgnlimit = state_regen_limit if state_regen_limit > 0 && dbobject == "State"
      end
    else
      @allrgnlimit = battler_regen_limit if battler_regen_limit > regenlimit
      @allrgnlimit = class_regen_limit if battler_regen_limit > regenlimit
      @allrgnlimit = equip_regen_limit if battler_regen_limit > regenlimit
      @allrgnlimit = state_regen_limit if battler_regen_limit > regenlimit
    end
    @allrgnlimit
  end
  #--------------------------------------------------------------------------
  # * Regenerate HP
  #--------------------------------------------------------------------------
  alias :regenerate_hp_limit :regenerate_hp
  def regenerate_hp
    regenlimit = all_regen_limits
    if regenlimit > 0
      damage = (mhp * hrg).to_i
      damage = regenlimit if damage > regenlimit
      perform_map_damage_effect if $game_party.in_battle && damage > 0
      @result.hp_damage = [-damage, max_slip_damage].min
      self.hp -= @result.hp_damage
    else
      regenerate_hp_limit
    end
  end
  #--------------------------------------------------------------------------
  # * Regenerate MP
  #--------------------------------------------------------------------------
  alias :regenerate_mp_limit :regenerate_mp
  def regenerate_mp
    regenlimit = all_regen_limits
    if regenlimit > 0
      damage = (mmp * mrg).to_i
      damage = regenlimit if damage > regenlimit
      @result.mp_damage = -damage
      self.mp -= @result.mp_damage
    else
      regenerate_mp_limit
    end
  end
end
Espero les sirva.
Salu2
avatar
JapoZero
PJ Principal
PJ Principal

Masculino
Chile
RPG Maker : MV
Mensajes : 674
Monedas : 3588
Reputación : 268
Localización : Chile

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.