Custom Low Stats Battle Algorithm

Started by ArcaneAlchemy, January 11, 2013, 09:56:10 am

Previous topic - Next topic

ArcaneAlchemy

January 11, 2013, 09:56:10 am Last Edit: July 12, 2013, 11:54:30 pm by ArcaneAlchemy
#------------------------------------------------------------------------------
If you were looking for something similar to that of Final Fantasy IV or VI, then this is gonna get you pretty close without having to decrypt and encrypt the database which can be really taxing after while. The damage is based on player and enemy level, as well as a few other things which create a nice smooth dynamic while keeping the stats low. There are a few other features in this script that will help out or you might just use them on their own.

Features include:



  • Custom Algorithm

  • Static Evasion Setting per class

  • Magic Evasion

  • Stamina instead of retarded dexterity attribute

  • Fixed critical damage for enemies and players

  • Capped damage

  • Custom Hp/Sp curve generation

  • Set Static enemy levels

  • Enemies Adapt To Average Party Level(think Skyrim/Oblivion)

  • A few debug tools






Anyway, this is my first script on here, so let me know if I need to do more or help anything look better.

Static STATS

# There are a few important things to note about this script. The default  setup of this script will work well with static settings for str, int, dex, agi, and evade. This means that when you use the database, in the Actors tab, double-click on each of these attributes(except for evade, that comes later) and select the 'generate curve' option. From the ranges of level 1 to level 99,
you should set the values to be the same on both ends. This means that only  weapons, armor, items, and level will increase.

Spoiler: ShowHide


HP/SP Curve

The next point to note is that if you are using the HP/SP curve generation, you will want to note that your HP/SP inside the database
will be completely useless. This was based on FF6 and how every character started with a "bonus" hp/mp and progressed based on the same
curve for all characters. If this is shut off, then the database will take over this setting. You will find the array for each curve value inside the script.

Setting the Static EVA

Look familiar? Yeah, again based on FF6 algorithm...well except for that fact that this ACTUALLY WORKS. Can't win 'em all Square. So, you will just have to set these values statically in the array here. Each array index corresponds with the index of the classes. So, class 1(Fighter) has 20 evade%, class 2(Lancer) has 50% evade and class 3(Warrior) had 100% evade.

001: Fighter
002: Lancer
003: Warrior


   $static_eva_percentage = [20,50,100]


Setting Enemy Level

In order to keep from having to modify data files, I decided to let the user add the enemy level by appending it to the enemy name in the enemy list inside the database. Since there is no 'level' attribute, this seemed like the best way I could think of so that you don't have to encrypt/decrypt over and over and over. It's not that tricky, but it does need explaining.
So, for instance if you want to make a vampire at level 1, you would name it:

vampire_01

Spoiler: ShowHide


Notice the underscore between the name and the level number. Also take equal note of the zero before the 1.
You must put both an underscore and two decimal places. For level 1 it's _01 for level 6, it's _06 like the thief below:

Spoiler: ShowHide


Now, here is an example of a level 99 bat:

Spoiler: ShowHide


Well, that's about it. Everything else should be in the script. Enjoy!

Here is the code:


#------------------------------------------------------------------------------
#
#                  ***** Customized Battle Algorithm *****
#
#------------------------------------------------------------------------------
#
# There are a few important things to note about this script. The default
# setup of this script will work well with static settings for str, int, dex,
# agi, and evade. This means that when you use the database, in the Actors tab,
# double-click on each of these attributes(except for evade, that comes later)
# and select the 'generate curve' option. From the ranges of level 1 to level 99,
# you should set the values to be the same on both ends. This means that only
# weapons, armor, items, and level will increase. Also, by the default system,
# something like unarmed combat will be based on the static str value and level
# at the time. You can find the actual modification below, but it looks like
# this:
#
#   self.damage = atk * (20 + attacker.str) / 20 * attacker.level / 2
#
# As you might notice, this also applied to the enemy. The enemy does not have
# a level attribute by default, this is why when naming an enemy, it is VERY
# VITAL that you append the enemy's name with the level value. This will have
# a great bearing on how strong or weak the enemy will be. So, naming a few
# enemies would look like this:
#
#  ** (NOTICE LEVELS 1 - 9 NEED A "0" BEFORE THE SINGLE DIGIT) **
#
#   slime_01 <= Level one slime
#
#   vampire_09 <= Level 9 vampire
#
#   boss_23 <= Level 23 boss

#   ** Make sure and DON'T FORGET THE UNDERSCORE! "_" **
#
# How high you set the level is ultimately up to you, but keeping the levels
# close to your party average is a relatively good gauge because of the level's
# impact on the attacker's strength. Also, this will only read between levels
# 1 - 99. If you want to use 3 digit levels, it's a pretty easy fix. I wouldn't
# suggest the damage cap at 9999 for that however..

# One last thing, dexterity is stamina now if you want it to be. So, you can use
# it like FF6 stamina of you want to and make instant death spells and what not
# be effected by it. It is against a rand(127) number right now but you can
# easily change that.
#
#       I will give detailed step by step instructions below.
#------------------------------------------------------------------------------
#                             Compatibility
#------------------------------------------------------------------------------
#
# This script will be compatible with anything that hasn't changed the name
# of attributes on any of the data. So,

#
#------------------------------------------------------------------------------
#                             Debug
#------------------------------------------------------------------------------
# To view your evade run: Custom_Algo_Debug.show_player_evade
#
# To view your enemy level, make a common event and put this script inside it.
#
#   Custom_Algo_Debug.show_enemy_levels
#
# Then, create an item and call it "Debug". Have the item run the common event
# you just created during battle. This will list the enemy levels to make sure
# that everything is running smoothly.
#------------------------------------------------------------------------------
#                           Configuration
#------------------------------------------------------------------------------
# This is where you can customize the following elements:
#
# - Set enemy level
# - Set a Damage Cap
# - custom hp/sp growth curve
# - custom static evasion % attribute
# - custom static magic evade % attribute for starting char and armors
# - "stamina" attribute replaces retarded dexterity attribute.
# - Enemies Adapt To Average Party Level(think Skyrim/Oblivion)
#
#
#------------------------------------------------------------------------------
# SET ENEMY LEVEL BY NAME
#
# To set enemy level by name, put the enemy name in the database followed by
# an underscore and the two-digit level number. There is a detailed explanation
# above, but here is a quick example anyway.
# slime_09 = slime, level 9
# vampire_23 = vampire, level 23
#
  SET_ENEMY_LEVEL = true #use this to turn on and off.
  #CANNOT BE USED WITH ADAPTIVE ENEMY LEVEL!!!!!!!
#
# if set to false, the enemy level will default to 1. DO NOT MIX WITH
# ADAPTIVE_ENEMY_LEVEL switch!!! If so, you will see a warning and the game will
# not run properly and return to default settings.
#------------------------------------------------------------------------------
# ADAPTIVE ENEMY LEVEL
#
  ADAPTIVE_ENEMY_LEVEL = false #turn this on and off here.
  #CANNOT BE USED WITH SET_ENEMY_LEVEL!!!!!!!!!!!!
 
# This will make each enemy level adapt to your party average.
# I will be adding a random variance feature in the near future.
#------------------------------------------------------------------------------
# CAP DAMAGE
#
# To set a damage cap so that anything (< or = x) will be at a cap_damage_limit
#
CAP_DAMAGE = true  #set to false to turn off or true to turn on.

CAP_DAMAGE_LIMIT = 9999 # the number to cap the damage at.
#------------------------------------------------------------------------------
# CUSTOM BASE HP/SP and GROWTH CURVE

  SET_HP_SP_GAIN_CURVE = true #to turn this feature on and off.

#This is to set your starting HP/SP. The elements are referenced by class_id.
#There should be as many elements as there are classes in your game. You can
#easily add an element by adding a value and seperating it with a comma. I
#would suggest setting a base hp and mp at the same time, otherwise it will
#default to the database.
# If you choose to use this, it will override the
# database hp and sp values and they will be rendered useless.
 
  $custom_max_hp_base = [40, 50, 60,20,30,40,30,40]
 
  $custom_max_sp_base = [16, 50, 60, 20,30,40,30,20]
 
# This is to set the growth speed. Each element represents what is added to
# the max hp/sp after a level up. Each array element corresponds to its level.
# NOTICE the first element is a ZERO. KEEP THE FIRST ELEMENT A ZERO or you will
# possibly break stuff.
 
  $custom_level_growth_hp = [0,11,12,14,17,20,22,24,26,27,
  28,30,35,39,44,50,54,57,61,65,
  67,69,72,76,79,82,86,90,95,99,
  100,101,102,102,103,104,106,107,108,110,
  111,113,114,116,117,119,120,122,125,128,
  130,131,133,134,136,137,139,142,144,145,
  147,148,150,152,153,155,156,158,160,162,
  160,155,151,145,140,136,132,126,120,117,
  113,110,108,105,102,100,98,95,92,90,
  88,87,85,83,82,80,83,86,88]

  $custom_level_growth_sp = [0,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,16,16,16,15,15,15,14,14,14,14,13,13,13,13,12,12,12,12,11,11,11,11,11,11,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,10,8,8,8,8,8,8,8,8,8,8,10,10,7,6,5,4,5,6,7,8,9,8,7,6,5,6,7,5,6,7,8,9,10,8,8,9,10,11,13]
#------------------------------------------------------------------------------
# CUSTOM STARTING/STATIC EVA PERCENTAGE

  SET_STATIC_EVADE = true #put false to turn this feature off.
 
# This will set a constant eva value for each class that will be there without
# weapons or armor. Weapons and armor will still add a bonus accordingly.
# Each element in the array is referenced by class_id. To add an element,
# simply add another value seperated by a comma as shown below.

    $static_eva_percentage = [0,0,0,0,0,0,0,0]
   
#------------------------------------------------------------------------------
#Works the same way as Static EVA for setting by class
#
# to set the magic evade for armor, weapon, or item by id.. fill in the
#corresponding value in the array created for the value below. Armor with the
# id of 2 should have the 2nd array value filled with its mag eva amount.
SET_STATIC_MAGIC_EVADE = true

$static_mag_eva_percentage_for_actor_by_class_id = [0,0,0,0,0,0,0,0]

$set_mag_eva_for_armor_by_id = [0, #leave as is, refers to nothing. Filler num. 
90, 0, 0, 0, 0, 0, 0, 0, 0, 0, #  1 - 10
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 11 - 20
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 21 - 30
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 31 - 40
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 41 - 50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 51 - 60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 61 - 70
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 71 - 80
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 81 - 90
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 91 - 100
] #End mag evade for armor database entry.

$set_mag_eva_intf_for_skill_by_id = [0, #leave as is, refers to nothing. Filler num. 
0, 0, 0, 0, 0, 0, 100, 0, 0, 0, #  1 - 10
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 11 - 20
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 21 - 30
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 31 - 40
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 41 - 50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 51 - 60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 61 - 70
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 71 - 80
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 81 - 90
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 91 - 100
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 101 - 110
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 111 - 120
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 121 - 130
] #End mag evade for skill database entry.

$set_mag_eva_percentage_for_enemy_by_id = [0,
50, 0, 0, 0, 0, 0, 0, 0, 0, 0, #  1 - 10
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 11 - 20
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 21 - 30
0, 0, 0, 0, 0, 0, 0, 0, 0, 55, # 31 - 40
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 41 - 50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 51 - 60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 61 - 70
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 71 - 80
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 81 - 90
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 91 - 100
] #End mag evade for enemy database entry.
#------------------------------------------------------------------------------
#                         Suggestions / Notes
#------------------------------------------------------------------------------
#
# My notes/suggestions
#-------------------------------------------------------------------------------
# DEXTERITY IS POINTLESS - as of now, it is worth jack shit.
#
#Physical Attack Addition:
#
# Much like some FF games, the level plays a part in the progression.
#
# Here is the physical attack formula:
#
#      self.damage = atk * (20 + attacker.str) / 20 * attacker.level / 2
#
#
#-------------------------------------------------------------------------------
# PHYSICAL ATTACKS:

# Physical Attack vs. Physical Defense

# 1. Physical defense that is 200% of Attack yields   0% damage.
# 2. Physical defense that is 150% of Attack yields 25% damage.
# 3. Physical defense that is 100% of Attack yields 50% damage.
# 4. Physical defense that is   50% of Attack yields 75% damage.
# 5. Physical defense that is   1% of Attack yields 100% damage.
#------------------------------------------------------------------------------
# CRITICAL PERCENTAGES:

#Attacker Dexterity vs. Defender Agility

# 1. if agility is same as dex, critical% = 4
# 2. if agility is 1/2 of dex, critical% = 8
# 3. if agility is 1/4 of dex, critical% = 16
# 4. if agility is 1/8 of dex,  critical% = 32
# 5. and so on..
#------------------------------------------------------------------------------
# EVADE PERCENTAGES:

#Evade pretty much stays the same regardless of Dexterity.

# Evade value = rough percentage of chance to evade attack.
#------------------------------------------------------------------------------
# SKILL POWER BREAKDOWN:

#we are using:
# power * rate / 20 * user.level / 2

#Skill power with no -F(forces) added is exactly (power *  level / 2)
#------------------------------------------------------------------------------
# MAGIC BASED ATTACKING SKILLS:

#Attack Skills with INT-F added:

#For magic, I suggest using a INT-F setting of 50.

# 1. Skill power with INT-F of 100% yields a degradation of 1/6 per 10
#  attribute points.
# 2. Skill power with INT-F of 50% yields a degradation of 1/8 per 10
#  attribute points.
# 3. Skill power with INT-F of 25% yields a degradation of 1/10 per 10
#  attribute points.
#------------------------------------------------------------------------------
# PHYSICAL BASED ATTACKING SKILLS:

#For skills that slightly strenghthen attacks do the following, or something
#close to it:

#Power = 10
#ATK-F = 100
#EVA-F = ? If you want them to be evaded possibly, then set to 100.
#STR-F = 100
#DEX-F = 0
#INT-F = 0
#Hit Rate = ? This is useless if set_static_evade = true
#PDEF-F = 100
#MDEF-F = 0
#Variable = 15
# This type of setting is good for skills that grow with the player.
#  They will be a bit strong at first, but  they won't become obsolete quickly
#  or at all like in a lot of games.

# If you desire a more tier style layout, try laying off of the ATK-F and maybe
#  the PDEF-F as well...
#------------------------------------------------------------------------------
# HEALING BASED SKILLS
#
# Healing Skills will render almost exactly the same negative damage(Healing)
# as an attacking spell will render with positive damage(attack). This is
# obviously taking into account that the INT-F is the same in both cases.
#
#------------------------------------------------------------------------------
# INSTANT DEATH SKILLS
# Set the dextertity INT-F to anything above 100, it doesn't matter. This will
# take dexterity/"stamina" into account and run a lottery aganst the value of
# the recipient's dexterity/"stamina". Make sure you set this to something
# between 0 - 60 for any character. 60 = about 50% chance of being effected
# before any state efficiency has been added.
#
#
#-------------------------------------------------------------------------------
# Minimum and Maximum ranges for stuff:

#Mininum would be someone weaker with a certain attribute like INT for a knight
#or STR for a wizard.
#Max is opposite. I'm sure there's not much need for explanation here, but these
#are to be static values with the exception of ATK, Hitpoints, and Skill Points.

# Battler stats:

#Attack - min = 3 / max = 255 or more but 255 is pretty good.

#Str - min 12 / max = (maybe around 40 - 50)

#Def - min 1 / max = shoot for around 200 or so.

#Dex - min around 15 / max around 60 #will protect from instant death if that
#setting is used. 60 = about a 50% chance of success of instant death, ect.

#Agility - min around 20 / max around 40

#Evade - min around 3-5 / max around 15 to 21

#Intelligence - min around 25 / max around 40

#Hit points level 1 min - 40 - 60 / max 6000 - 8000(we could use accesories to
#add bonus at level up)

#Skill points level 1 min - 9 to 16  / max 400 - 600 (we could use accessory to
#add at level up)
#------------------------------------------------------------------------------
  #
  # Do not edit the code below unless you know what you're doing.
  #
###############################################################################
#                          **** CODE BELOW ****
###############################################################################

#------------------------------------------------------------------------------
#                Game Battler part 3
#------------------------------------------------------------------------------
class Game_Battler


  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects
  #     attacker : battler
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # Clear critical flag
    self.critical = false
    # First hit detection
    hit_result = (rand(100) < attacker.hit)
    # If hit occurs
    if hit_result == true
      # Calculate basic damage
      atk = [attacker.atk - self.pdef / 2, 0].max
                                            ###### Mod by Level Here
      self.damage = atk * (20 + attacker.str) / 20 * attacker.level / 2
      # Element correction
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # If damage value is strictly positive
      if self.damage > 0
        ###################################################
        # Critical correction
        #if rand(100) < 4 * attacker.dex / self.agi ORIGINAL
       
        if (rand(32) + 1) == 1
          self.damage *= 2
          self.critical = true
        end
        ###################################################
        # Guard correction
        if self.guarding?
          self.damage /= 2
        end
      end
      # Dispersion
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second hit detection
      #eva = 100
      #############################################
      #eva = 8 * self.agi / attacker.dex + self.eva
      # evasion correction:
     
      eva = self.eva
      #############################################
     
      hit = self.damage < 0 ? 100 : 100 - eva #ternary operator if true 100, if
      #false, 100 - eva.
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end

    #######################################
    # Damage Cap #
    ##############
    if CAP_DAMAGE == true
     
      if self.damage >= CAP_DAMAGE_LIMIT
        self.damage = CAP_DAMAGE_LIMIT
      end
    end  #### End damage Cap
    ########################################
    # If hit occurs
    if hit_result == true
      # State Removed by Shock
      remove_states_shock
      # Substract damage from HP
      self.hp -= self.damage
      # State change
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # When missing
    else
      # Set damage to "Miss"
      self.damage = "Miss"
      # Clear critical flag
      self.critical = false
    end
    # End Method
    return true
  end
 
 
# End Physical Attack mod






  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    ##########################
    stamina = self.dex
    #renaming skill.dex_f to stamina
    ##########################
   
   
    # Clear critical flag
    self.critical = false
    # If skill scope is for ally with 1 or more HP, and your own HP = 0,
    # or skill scope is for ally with 0, and your own HP = 1 or more
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # End Method
      return false
    end
    # Clear effective flag
    effective = false
    # Set effective flag if common ID is effective
    effective |= skill.common_event_id > 0
    # First hit detection
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # Set effective flag if skill is uncertain
    effective |= hit < 100
    # If hit occurs
    if hit_result == true
      # Calculate power
       power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # Calculate rate
      rate = 20
      rate += (user.str * skill.str_f / 100)
      #######################################
      #rate += (user.dex * skill.dex_f / 100) #removed because it's pointless
      #rate += (user.agi * skill.agi_f / 100) #removed because it's pointless
      # and this would mess with the dexterity = stamina thing.
      #######################################
      rate += (user.int * skill.int_f / 100)
      # Calculate basic damage
      self.damage = power * rate / 20 * user.level / 2 ######## level mod
      # Element correction
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # If damage value is strictly positive
      if self.damage > 0
        # Guard correction
        if self.guarding?
          self.damage /= 2
        end
      end
      # Dispersion
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second hit detection
     
      #########################################################
      #eva = 8 * self.agi / user.dex + self.eva
      #
      # MAG EVA AND EVA CORRECTION
      # Setting eva = eva % and mag_eva = mag_eva %
      eva = self.eva
      mag_eva = self.mag_eva
     
      if skill.eva_f > 0
        hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
       
      else
        hit = self.damage < 0 ? 100 : 100 - mag_eva * skill.mag_eva_int_f / 100
       
        ########################
        #dexterity = stamina. If this is the case, this is for attacks blocked
        #by stamina. This is for attacks that are like 'death' attacks and 'demi'
        # and such.
        if skill.dex_f > 0
          if rand(127) <= self.dex
            hit = 0
          end
        end
       
      end
      ###########################
     
      #hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100 #ORIGINAL
      ##########################################################
     

      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # Set effective flag if skill is uncertain
      effective |= hit < 100
    end
    # If hit occurs
    if hit_result == true
     
      #######################################
    # Damage Cap #
    ##############
    if CAP_DAMAGE == true
     
      if self.damage >= CAP_DAMAGE_LIMIT
        self.damage = CAP_DAMAGE_LIMIT
      elsif self.damage < (CAP_DAMAGE_LIMIT * -1)
        self.damage = (CAP_DAMAGE_LIMIT * -1)
      end
    end  #### End damage Cap
    ########################################
   
      # If physical attack has power other than 0
      if skill.power != 0 and skill.atk_f > 0
        # State Removed by Shock
        remove_states_shock
        # Set to effective flag
        effective = true
      end
      # Substract damage from HP
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      # State change
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      # If power is 0
      if skill.power == 0
        # Set damage to an empty string
        self.damage = ""
        # If state is unchanged
        unless @state_changed
          # Set damage to "Miss"
          self.damage = "Miss"
        end
      end
    # If miss occurs
    else
      # Set damage to "Miss"
      self.damage = "Miss"
    end
    # If not in battle
    unless $game_temp.in_battle
      # Set damage to nil
      self.damage = nil
    end
    # End Method
    return effective
   

   
  end #end skill effect method
 

   
  #End Skill Effect mod
 
end ##end game battler class
#------------------------------------------------------------------------------
#               End of Game Battler part 3
#------------------------------------------------------------------------------

  class Game_Enemy < Game_Battler
   
    def is_a_character
      return false
    end
   
  end
 
  class Game_Actor < Game_Battler
   
    def is_a_character
      return true
    end
   
  end


#------------------------------------------------------------------------------
#                           SET ENEMY LEVEL
#------------------------------------------------------------------------------

if SET_ENEMY_LEVEL == true and ADAPTIVE_ENEMY_LEVEL == false
  #if SET_ENEMY_LEVEL switch is on do this below as long as Adaptive isn't on.
 
  class Game_Enemy < Game_Battler

    def level #sets enemy level based on value that appends to the enemy name.
 
    first_num = $data_enemies[@enemy_id].name[-2].chr #add first number after name
    second_num = $data_enemies[@enemy_id].name[-1].chr #now add second number
    one_and_two = first_num.to_s + second_num.to_s #display numbers as a string
    return one_and_two.to_i #convert the number into an integer
   
    end
 
    def name #show enemy name but remove the underscore and level numbers from
      #display.
    return $data_enemies[@enemy_id].name[0..-4]
    end
 
  end #end Game_Enemy class here

else #if enemy switch is not on, make level = 1 so things will be back to normal.
class Game_Enemy < Game_Battler
  def level
    return 1
  end
end
end #end if SET_ENEMY_LEVEL statement
#------------------------------------------------------------------------------
#                      End of SET ENEMY LEVEL
#------------------------------------------------------------------------------
#
#
#------------------------------------------------------------------------------
#                      ADAPTIVE ENEMY LEVEL
#------------------------------------------------------------------------------
if ADAPTIVE_ENEMY_LEVEL == true and SET_ENEMY_LEVEL == false
  class Game_Enemy < Game_Battler

    def level_average
     
      i = 1
      x = 0
      for i in 1..$game_party.actors.size
        x += $game_actors[i].level
      end
      average = x/i # setting average party level
   
      return average

    end
 
    def level_variance
     
    positive_or_negative = [1,-1]
   
    variance_max = 15
   
    variance_calculation = rand(variance_max) * positive_or_negative[rand(2)]
   
    return variance_calculation
   
    end

  ############
  def level
 
    return level_average #+ level_variance
 
  end


  end #end Game_Enemy class here
 
  elsif SET_ENEMY_LEVEL == false and ADAPTIVE_ENEMY_LEVEL == false #if conditions are not met for ADAPTIVE_ENEMY_LEVEL...
 
  class Game_Enemy < Game_Battler
  def level
    return 1
  end
  end

end
#------------------------------------------------------------------------------
#                    END OF ADAPTIVE ENEMY LEVEL
#------------------------------------------------------------------------------
#
#
#------------------------------------------------------------------------------
#                Game Actor Class (Actor Evade Attribute)
#------------------------------------------------------------------------------

  #--------------------------------------------------------------------------
  # * Get Basic Evasion Correction
  #--------------------------------------------------------------------------
if SET_STATIC_EVADE == true
 
  class Game_Actor < Game_Battler
 
    def base_eva
      armor1 = $data_armors[@armor1_id]
      armor2 = $data_armors[@armor2_id]
      armor3 = $data_armors[@armor3_id]
      armor4 = $data_armors[@armor4_id]
      eva1 = armor1 != nil ? armor1.eva : 0
      eva2 = armor2 != nil ? armor2.eva : 0
      eva3 = armor3 != nil ? armor3.eva : 0
      eva4 = armor4 != nil ? armor4.eva : 0
   
    return eva1 + eva2 + eva3 + eva4 + $static_eva_percentage[@class_id - 1]#static_evasion_value
                                        #adding custom evade value bonus
    end

  end #end this class

else #if SET_STATIC_EVADE == false
end #end if statement

#------------------------------------------------------------------------------
#             End of Game Actor Class (Actor Evade Attribute)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
#             Creating Magic Evade for Armors Class
#------------------------------------------------------------------------------
module RPG
  class Armor
    alias custom_armor_initialize initialize
    #aliasing old initialize and adding in my mag_eva here.
    def initialize
      @mag_eva = 0
    end
    attr_accessor :mag_eva #same with this attr_accessor
   
    def mag_eva
        return $set_mag_eva_for_armor_by_id[@id]
    end
   
   
  end
end


#------------------------------------------------------------------------------
#             END Creating Magic Evade for Armors Class
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#                Game Actor Class (Actor MAGIC Evade Attribute)
#------------------------------------------------------------------------------


  #--------------------------------------------------------------------------
  # * Get Basic MAGIC Evasion Correction
  #--------------------------------------------------------------------------
if SET_STATIC_MAGIC_EVADE == true
 
  class Game_Actor < Game_Battler
   
    def base_magic_eva
      armor1 = $data_armors[@armor1_id]
      armor2 = $data_armors[@armor2_id]
      armor3 = $data_armors[@armor3_id]
      armor4 = $data_armors[@armor4_id]
      mag_eva1 = armor1 != nil ? armor1.mag_eva : 0
      mag_eva2 = armor2 != nil ? armor2.mag_eva : 0
      mag_eva3 = armor3 != nil ? armor3.mag_eva : 0
      mag_eva4 = armor4 != nil ? armor4.mag_eva : 0
   
    return mag_eva1 + mag_eva2 + mag_eva3 + mag_eva4 + $static_mag_eva_percentage_for_actor_by_class_id[@class_id - 1]#static_magic_evasion_value
                                                       #adding custom magic evade value bonus
    end

  end #end this class

else #if SET_STATIC_MAGIC_EVADE == false
end #end if statement

#------------------------------------------------------------------------------
#             End of Game Actor Class (Actor MAGIC Evade Attribute)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
#             Setting up Magic Evade for Game Actor
#------------------------------------------------------------------------------
if SET_STATIC_MAGIC_EVADE == true
 
  class Game_Actor < Game_Battler
   
    def mag_eva
      return base_magic_eva
    end
   
  end
 
end #end if statement
#------------------------------------------------------------------------------
#             END OF Setting up Magic Evade for Game Actor
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
#             Setting up Magic Evade for Game Enemy
#------------------------------------------------------------------------------

  class Game_Enemy < Game_Battler
   
    def mag_eva
      return $set_mag_eva_percentage_for_enemy_by_id[@enemy_id]
    end
   
  end

#------------------------------------------------------------------------------
#             END OF Setting up Magic Evade for Game Actor
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
#             Setting up Skill Int-F for Magic Evade
#------------------------------------------------------------------------------

module RPG
 
  class Skill
   
    alias custom_mag_eva_skill_initialize initialize
    def initialize
      @mag_eva_int_f = 0
    end
   
    attr_accessor :mag_eva_int_f
   
    def mag_eva_int_f
      return $set_mag_eva_intf_for_skill_by_id[@id]
    end
   
  end
 
end



#------------------------------------------------------------------------------
#             END OF Setting up Skill Int-F for Magic Evade
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
#                      Custom HP/MP Gain Curve System
#------------------------------------------------------------------------------
if SET_HP_SP_GAIN_CURVE == true # if HP/SP gain switch is on..

  class Game_Actor < Game_Battler
 
#####  HP Gain CURVE  ####
 

      def level_hp_bonus_sum
       
        i = 0
        add_level_bonus_array_elements_together = 0
       
        while i < @level
          add_level_bonus_array_elements_together += $custom_level_growth_hp[i]
          i += 1
        end 
        return add_level_bonus_array_elements_together
      end

      def base_maxhp
       
        if @class_id > $custom_max_hp_base.size or @level > $custom_level_growth_hp.size
       
          return  $data_actors[@actor_id].parameters[0, @level]
        else
          return $custom_max_hp_base[@class_id - 1] + level_hp_bonus_sum
        end

     
      end #### END HP Gain CURVE
     
     
#####  sp Gain CURVE  ####
 

      def level_sp_bonus_sum
       
        i = 0
        add_level_bonus_array_elements_together = 0
       
        while i < @level
          add_level_bonus_array_elements_together += $custom_level_growth_sp[i]
          i += 1
        end 
        return add_level_bonus_array_elements_together
      end

      def base_maxsp
       
        if @class_id > $custom_max_sp_base.size or @level > $custom_level_growth_sp.size
       
          return  $data_actors[@actor_id].parameters[0, @level]
        else
          return $custom_max_sp_base[@class_id - 1] + level_sp_bonus_sum
        end

     
      end #### END sp Gain CURVE
   
  end #end Game Actor Class

else #if hp/sp swtich is off, then do nothing and resume to normal.
end
   
#------------------------------------------------------------------------------
#                     END OF Custom HP/MP Gain Curve System
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
#
#                A Little HP/MP Growth Helper Module
#
#------------------------------------------------------------------------------
#
# This will give you a text file of either hp or mp growth that you can put
# inside your data file or manually input the values into your hp/sp array above.
# The second option is suggested for use of this script. You can simply skip this
# and modify the array in the configuration setting, but you can use this tool
# to modify the values in your own way. For instance, if you wanted to gain 5
# points per level, the you could just do starting_hp += 5 to show those results.
# This tool was mainly for me, but you might be able to make use of it for you.
#
# To request results, make a map event and give one of the two following
# commands:
#   
#   Give_Results.give_hp_results(PUT_STARTING_VALUE_HERE_AS_AN_INTEGER)
#
#   Give_Results.give_mp_results(PUT_STARTING_VALUE_HERE_AS_AN_INTEGER)

module Give_Results
 
module_function

  def give_hp_results(starting_hp) #please give me starting hp value
 
    print "*HINT* It is a good idea to make it between 35 and 60."

    $level_growth_hp = [0,11,12,14,17,20,22,24,26,27,28,30,35,39,44,50,54,57,61,65,67,69,72,76,79,82,86,90,95,99,100,101,102,102,103,104,106,107,108,110,111,113,114,116,117,119,120,122,125,128,130,131,133,134,136,137,139,142,144,145,147,148,150,152,153,155,156,158,160,162,160,155,151,145,140,136,132,126,120,117,113,110,108,105,102,100,98,95,92,90,88,87,85,83,82,80,83,86,88]

    i = 0
    File.open('hp_results.txt', 'w') do |f1|
      while i < 99
        starting_hp += $level_growth_hp[i]
        f1.print starting_hp
          if i < $level_growth_hp.size - 1
          f1.print ','
          end
        i += 1
      end
    end
  end

  def give_mp_results # please give me starting mp value

    print "*HINT* It is a good idea to make it between 35 and 60."
 
    starting_mp = gets.to_i
    $level_growth_mp = [0,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,16,16,16,15,15,15,14,14,14,14,13,13,13,13,12,12,12,12,11,11,11,11,11,11,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,10,8,8,8,8,8,8,8,8,8,8,10,10,7,6,5,4,5,6,7,8,9,8,7,6,5,6,7,5,6,7,8,9,10,8,8,9,10,11,13]

    i = 0
    File.open('hp_results.txt', 'w') do |f1|
      while i < 99
        starting_mp += $level_growth_mp[i]
        f1.print starting_mp
          if i < $level_growth_mp.size
            f1.print ','
          end
        i += 1
      end
    end
  end

end
#------------------------------------------------------------------------------
#                  END OF Little HP/MP Growth Helper Module
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#                           Debug Windows/Tools
#------------------------------------------------------------------------------
module Custom_Algo_Debug
 
  module_function
 
      def char_test
        for i in 0...$game_troop.enemies.size
      print $game_troop.enemies[i].is_a_character
        end
      end
   
  def show_enemy_levels
      Enemy_Level_Window.new
  end
 
  def show_player_evade
    i = 1
    for i in 1..$game_party.actors.size
      print "Name: " + $game_actors[i].name.to_s + "\nEvade: " + $game_actors[i].eva.to_s
    end
  end
 
  def average_player_levels
    i = 1
    x = 0
    for i in 1..$game_party.actors.size
      x += $game_actors[i].level
    end
    average = x/i
    print average.to_s
  end
 
end

class  Enemy_Level_Window < Window_Base

  #BLOCK 1
  def initialize
    super(0, 0, 440,380)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
   
    #BLOCK 2
       for i in 0...$game_troop.enemies.size
        enemy_index = i + 1
        x = 0
        y = i * 30
         if i >= 2
          x=250
          y -= 300
         end       
        enemy = $game_troop.enemies[i]
        self.contents.font.color = text_color(6)
        self.contents.draw_text(x, y, 200, 32, enemy_index.to_s + ". " + enemy.name.to_s + " Level: " + enemy.level.to_s)

      end
    end
 
end
 

def show_enemy_mag_eva
  Enemy_Mag_Def_Window.new
end
 


class  Enemy_Mag_Def_Window < Window_Base

  #BLOCK 1
  def initialize
    super(0, 0, 440,380)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
   
    #BLOCK 2
       for i in 0...$game_troop.enemies.size
        enemy_index = i + 1
        x = 0
        y = i * 30
         if i >= 2
          x=250
          y -= 300
         end       
        enemy = $game_troop.enemies[i]
        self.contents.font.color = text_color(6)
        self.contents.draw_text(x, y, 200, 32, enemy_index.to_s + ". " + enemy.name.to_s + " MagEVA: " + enemy.mag_eva.to_s)

      end
    end
 

end
 
 
################################################################################
"Wait? Do I look like a waiter?" -Kefka

Blizzard

*fixes post* Please use spoilers for images in the future.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ArcaneAlchemy

"Wait? Do I look like a waiter?" -Kefka