Pokemon Statistic System
By Jet
Summary
This script is the Pokemon Statistics System that will mimic the Pokemon Stat calculations. This means IVs, EVs, Base Stats, Natures and Level will all be taken into account when calculating attack, defence, spirit, and agility. Agility is considered the equivalent of speed, and Spirit is both Special Attack and Special Defence combined. Spirit being both, I now some of you are thinking "But some natures lower one and higher the other! BAHHHHH!" Well, I did not do anything about that =(
Anyways, enjoy the script, and credit if used.
Features
[spoiler]Mimics the Pokemon stat calculations
Adds natures to players
Items give raise EV of characters
Enemies also give EV
And more...[/spoiler]
Script
[spoiler]
#===============================================================================
# Pokemon Statistics System
# By Jet10985
#===============================================================================
# This script is not open for distribution to other sites without permission
# from me, Jet10985. Please credit me if you use this script.
#===============================================================================
# This script will change the way all stats other then mp and hp are calculated.
# It will mimic the Pokemon stat calculating system, and assign each party
# member will have a random nature and stat IV.
# This script has: 1 customization options.
#===============================================================================
=begin
This script is compatable with the stat changes brought on by my Hunger/Thirst
script and my time system. Just place this script below both of them, and toggle
the compatability option in the time system script for hunger/thirst and/or
alignment
--------------------------------------------------------------------------------
To start, this is the formula for stats:
nature * [[stat_iv + (2 * base_stat) + (stat_ev / 4)] * [level / 100] + 5]
for hp:
[[stat_iv + (2 * base_stat) + (stat_ev / 4)] * [level / 100] + 10 + level]
nature = nature difference of the stat
stat_iv = a random number from 0-31 generated the first time the stat is checked
base_stat = the stat generate by the databse. The one that you set.
For the base stat, i recommend setting it a singular number from level 1-99
If they should have a high number in that stat, try something like 23 all the
way through. If a low number, try 13 or so.
stat_ev = a statistic increased when the player beats specific enemies or uses
certain items.
level = the character's leve, obviously.
--------------------------------------------------------------------------------
How to have enemies give EV:
In the enemy's notebox, add one or more of these tags to it's notebox:
<atk ev ##>
<def ev ##>
<agi ev ##>
<spi ev ##>
<hp ev ##>
where ## is obviously a number.
--------------------------------------------------------------------------------
How to make items increase ev stats:
Follow the above instructions of how the give enmies EV, it is the same.
--------------------------------------------------------------------------------
The below configuration:
Below is the set up for player's natures.
When a stat is mentioned, it means the it will be multiplied by the number input
The format to set them is as follows;
id => ["name", atk, def, spi, agi]
If you plan to add more, you must make sure to have a comma after the finishing
bracket (the ] part)
=end
module JetPokemonStatSystem
NATURES = {
0 => ["Hardy", 1, 1, 1, 1], # id => ["name", atk, def, spi, agi]
1 => ["Lonely", 1.1, 0.9, 1, 1], # id => ["name", atk, def, spi, agi]
2 => ["Brave", 1.1, 1, 1, 0.9], # id => ["name", atk, def, spi, agi]
3 => ["Adamant", 1.1, 1, 0.9, 1],
4 => ["Naughty", 1.1, 1, 0.9, 1],
5 => ["Bold", 0.9, 1.1, 1, 1],
6 => ["Docile", 1, 1, 1, 1],
7 => ["Relaxed", 1, 1.1, 1, 0.9],
8 => ["Impish", 1, 1.1, 0.9, 1],
9 => ["Lax", 1, 1.1, 0.9, 1],
10 => ["Timid", 0.9, 1, 1, 1.1],
11 => ["Hasty", 1, 0.9, 1, 1.1],
12 => ["Serious", 1, 1, 1 ,1],
13 => ["Jolly", 1, 1, 0.9, 1.1],
14 => ["Naive", 1, 1, 0.9, 1.1],
15 => ["Modest", 0.9, 1, 1.1, 1],
16 => ["Mild", 1, 0.9, 1.1, 1],
17 => ["Quiet", 1, 1, 1.1, 0.9],
18 => ["Bashful", 1, 1, 1, 1],
19 => ["Rash", 1, 1, (0.9 || 1.1), 1],
20 => ["Calm", 0.9, 1, 1.1, 1],
21 => ["Gentle", 1, 0.9, 1.1, 1],
22 => ["Sassy", 1, 1, 1.1, 0.9],
23 => ["Careful", 1, 1, (0.9 || 1.1), 1],
24 => ["Quirky", 1, 1, 1, 1]
}
# This is the maximum amount of EV points the player can have all together.
# This is ALL of the EV from all the stats put together.
MAX_EV = 510
# This is the individual amount of EV any 1 stat can have.
INDIVIDUAL_MAX_EV = 255
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
class Game_Actor
include JetPokemonStatSystem
attr_accessor :hpiv, :hpev, :atkiv, :defiv, :spiiv, :agiiv, :nature, :atkev, :defev, :spiev, :agiev
alias jet8902_initialize initialize unless $@
def initialize(*args)
@hpiv = nil
@atkiv = nil
@defiv = nil
@spiiv = nil
@agiiv = nil
@nature = rand(NATURES.keys.size - 1)
@hpev = 0
@atkev = 0
@defev = 0
@spiev = 0
@agiev = 0
jet8902_initialize(*args)
end
end
class Game_Battler
include JetPokemonStatSystem
def total_ev
return (self.atkev + self.defev + self.agiev + self.spiev + self.hpev)
end
alias jet8913_item_effective? item_effective? unless $@
def item_effective?(user, item)
return false if user.total_ev == MAX_EV || user.total_ev + item.atk_ev > MAX_EV || user.total_ev + item.def_ev > MAX_EV || user.total_ev + item.agi_ev > MAX_EV || user.total_ev + item.spi_ev > MAX_EV || user.total_ev + item.hp_ev > MAX_EV
return true if item.atk_ev > 0 || item.def_ev > 0 || item.agi_ev > 0 || item.spi_ev > 0
jet8913_item_effective?
end
alias jet8123_item_effect item_effect unless $@
def item_effect(user, item)
if user.total_ev != MAX_EV && user.atkev + item.atk_ev <= MAX_EV && user.defev + item.def_ev <= MAX_EV && user.agiev + item.agi_ev <= MAX_EV && user.spiev + item.spi_ev <= MAX_EV && user.hpev + item.hp_ev <= MAX_EV
user.atkev += item.atk_ev unless user.total_ev + item.atk_ev > MAX_EV || user.atkev + item.atk_ev > INDIVIDUAL_MAX_EV
user.hpev += item.hp_ev unless user.total_ev + item.hp_ev > MAX_EV || user.hpev + item.hp_ev > INDIVIDUAL_MAX_EV
user.defev += item.def_ev unless user.total_ev + item.def_ev > MAX_EV || user.defev + item.def_ev > INDIVIDUAL_MAX_EV
user.agiev += item.agi_ev unless user.total_ev + item.agi_ev > MAX_EV || user.agiev + item.agi_ev > INDIVIDUAL_MAX_EV
user.spiev += item.spi_ev unless user.total_ev + item.spi_ev > MAX_EV || user.spiev + item.spi_ev > INDIVIDUAL_MAX_EV
elsif item.atk_ev > 0 && user.total_ev < MAX_EV
user.atkev += MAX_EV - user.total_ev
elsif item.def_ev > 0 && user.total_ev < MAX_EV
user.defev += MAX_EV - user.total_ev
elsif item.agi_ev > 0 && user.total_ev < MAX_EV
user.agiev += MAX_EV - user.total_ev
elsif item.spi_ev > 0 && user.total_ev < MAX_EV
user.spiev += MAX_EV - user.total_ev
elsif item.hp_ev > 0 && user.total_ev < MAX_EV
user.spiev += MAX_EV - user.total_ev
end
jet8123_item_effect(user, item)
end
alias jet8921_maxhp maxhp unless $@
def maxhp
if self.is_a?(Game_Actor)
if self.hpiv.nil?
self.hpiv = rand(31)
end
n = self.hpiv + (2 * base_maxhp) + (self.hpev / 4) * (self.level / 100) + 10 + self.level
return n.round
else
jet8921_maxhp
end
end
alias jet0129_atk atk unless $@
def atk
if self.is_a?(Game_Actor)
if self.atkiv.nil?
self.atkiv = rand(31)
end
part1 = self.atkiv + (2 * base_atk) + (self.atkev / 4)
part2 = NATURES[self.nature][1]
part3 = self.level / 100 + 5
n = (part2 * part1 * part3)
unless $game_time.nil?
if Jet_DayNight::ALIGNMENT_SYSTEM_COMPATABILITY
if AlignmentOptions::WHOLE_PARTY_ALIGNMENT
if $game_system.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[0]
elsif $game_system.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[0]
end
else
if self.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[0]
elsif self.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[0]
end
end
end
if Jet_DayNight::HUNGER_THIRST_EFFECT_STATS_COMPATABILITY
if self.hunger >= HungerThirst::LOWER_STATS_HUNGER
n *= HungerThirst::HUNGER_LOWERED_STATS[0]
end
if self.thirst >= LOWER_STATS_THIRST
n *= HungerThirst::THIRST_LOWERED_STATS[0]
end
end
end
return n.round
else
jet0129_atk
end
end
alias jet0912_def def unless $@
def def
if self.is_a?(Game_Actor)
if self.defiv.nil?
self.defiv = rand(31)
end
part1 = self.defiv + (2 * base_def) + (self.defev / 4)
part2 = NATURES[self.nature][2]
part3 = self.level / 100 + 5
n = (part2 * part1 * part3)
unless $game_time.nil?
if Jet_DayNight::ALIGNMENT_SYSTEM_COMPATABILITY
if AlignmentOptions::WHOLE_PARTY_ALIGNMENT
if $game_system.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[1]
elsif $game_system.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[1]
end
else
if self.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[1]
elsif self.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[1]
end
end
end
if Jet_DayNight::HUNGER_THIRST_EFFECT_STATS_COMPATABILITY
if self.hunger >= HungerThirst::LOWER_STATS_HUNGER
n *= HungerThirst::HUNGER_LOWERED_STATS[1]
end
if self.thirst >= LOWER_STATS_THIRST
n *= HungerThirst::THIRST_LOWERED_STATS[1]
end
end
end
return n.round
else
jet0912_def
end
end
alias jet0913_spi spi unless $@
def spi
if self.is_a?(Game_Actor)
if self.spiiv.nil?
self.spiiv = rand(31)
end
part1 = self.spiiv + (2 * base_spi) + (self.spiev / 4)
part2 = NATURES[self.nature][3]
part3 = self.level / 100 + 5
n = (part2 * part1 * part3)
unless $game_time.nil?
if Jet_DayNight::ALIGNMENT_SYSTEM_COMPATABILITY
if AlignmentOptions::WHOLE_PARTY_ALIGNMENT
if $game_system.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[2]
elsif $game_system.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[2]
end
else
if self.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[2]
elsif self.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[2]
end
end
end
if Jet_DayNight::HUNGER_THIRST_EFFECT_STATS_COMPATABILITY
if self.hunger >= HungerThirst::LOWER_STATS_HUNGER
n *= HungerThirst::HUNGER_LOWERED_STATS[2]
end
if self.thirst >= LOWER_STATS_THIRST
n *= HungerThirst::THIRST_LOWERED_STATS[2]
end
end
end
return n.round
else
jet0913_spi
end
end
alias jet0914_agi agi unless $@
def agi
if self.is_a?(Game_Actor)
if self.agiiv.nil?
self.agiiv = rand(31)
end
part1 = self.agiiv + (2 * base_agi) + (self.agiev / 4)
part2 = NATURES[self.nature][1]
part3 = self.level / 100 + 5
n = (part2 * part1 * part3)
unless $game_time.nil?
if Jet_DayNight::ALIGNMENT_SYSTEM_COMPATABILITY
if AlignmentOptions::WHOLE_PARTY_ALIGNMENT
if $game_system.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[3]
elsif $game_system.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[3]
end
else
if self.alignment < 0 && $light_switch
n *= Jet_DayNight::BAD_BONUSES[3]
elsif self.alignment > 0 && !$light_switch
n *= Jet_DayNight::GOOD_BONUSES[3]
end
end
end
if Jet_DayNight::HUNGER_THIRST_EFFECT_STATS_COMPATABILITY
if self.hunger >= HungerThirst::LOWER_STATS_HUNGER
n *= HungerThirst::HUNGER_LOWERED_STATS[3]
end
if self.thirst >= LOWER_STATS_THIRST
n *= HungerThirst::THIRST_LOWERED_STATS[3]
end
end
end
return n.round
else
jet0914_agi
end
end
end
module Jet
def self.check_tag_number(obj, tag)
obj.note.split(/[\r\n]+/).each { |notetag|
case notetag
when tag
@result = $1.to_i
end }
return @result
end
end
module RPG
class Enemy
def hp_ev
if @hpev.nil?
txt = Jet.check_tag_number(self, /<(?:hp ev)[ ]*(\d+)>/i)
@hpev = txt.nil? ? 0 : txt.to_i
end
return @hpev
end
def atk_ev
if @atkev.nil?
txt = Jet.check_tag_number(self, /<(?:atk ev)[ ]*(\d+)>/i)
@atkev = txt.nil? ? 0 : txt.to_i
end
return @atkev
end
def def_ev
if @defev.nil?
txt = Jet.check_tag_number(self, /<(?:def ev)[ ]*(\d+)>/i)
@defev = txt.nil? ? 0 : txt.to_i
end
return @defev
end
def agi_ev
if @agiev.nil?
txt = Jet.check_tag_number(self, /<(?:agi ev)[ ]*(\d+)>/i)
@agiev = txt.nil? ? 0 : txt.to_i
end
return @agiev
end
def spi_ev
if @spiev.nil?
txt = Jet.check_tag_number(self, /<(?:spi ev)[ ]*(\d+)>/i)
@spiev = txt.nil? ? 0 : txt.to_i
end
return @spiev
end
end
class Item
def hp_ev
if @hpev.nil?
txt = Jet.check_tag_number(self, /<(?:hp ev)[ ]*(\d+)>/i)
@hpev = txt.nil? ? 0 : txt.to_i
end
return @hpev
end
def atk_ev
if @atkev.nil?
txt = Jet.check_tag_number(self, /<(?:atk ev)[ ]*(\d+)>/i)
@atkev = txt.nil? ? 0 : txt.to_i
end
return @atkev
end
def def_ev
if @defev.nil?
txt = Jet.check_tag_number(self, /<(?:def ev)[ ]*(\d+)>/i)
@defev = txt.nil? ? 0 : txt.to_i
end
return @defev
end
def agi_ev
if @agiev.nil?
txt = Jet.check_tag_number(self, /<(?:agi ev)[ ]*(\d+)>/i)
@agiev = txt.nil? ? 0 : txt.to_i
end
return @agiev
end
def spi_ev
if @spiev.nil?
txt = Jet.check_tag_number(self, /<(?:spi ev)[ ]*(\d+)>/i)
@spiev = txt.nil? ? 0 : txt.to_i
end
return @spiev
end
end
end
class Game_Troop
def hp_ev_total
hp_ev = 0
for enemy in dead_members
hp_ev += enemy.enemy.hp_ev unless enemy.hidden
end
return hp_ev
end
def atk_ev_total
atk_ev = 0
for enemy in dead_members
atk_ev += enemy.enemy.atk_ev unless enemy.hidden
end
return atk_ev
end
def def_ev_total
def_ev = 0
for enemy in dead_members
def_ev += enemy.enemy.def_ev unless enemy.hidden
end
return def_ev
end
def agi_ev_total
agi_ev = 0
for enemy in dead_members
agi_ev += enemy.enemy.agi_ev unless enemy.hidden
end
return agi_ev
end
def spi_ev_total
spi_ev = 0
for enemy in dead_members
spi_ev += enemy.enemy.spi_ev unless enemy.hidden
end
return spi_ev
end
end
class Scene_Battle
include JetPokemonStatSystem
alias jet2890_process_victory process_victory unless $@
def process_victory
for actor in $game_party.existing_members
if actor.atkev + $game_troop.atk_ev_total > MAX_EV && actor.atkev < INDIVIDUAL_MAX_EV && actor.total_ev != MAX_EV
actor.atkev = MAX_EV - actor.total_ev
elsif actor.atkev + $game_troop.atk_ev_total > INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.atk_ev_total <= MAX_EV
actor.atkev = INDIVIDUAL_MAX_EV
elsif actor.atkev + $game_troop.atk_ev_total <= INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.atk_ev_total <= MAX_EV
actor.atkev += $game_troop.atk_ev_total
end
if actor.defev + $game_troop.def_ev_total > MAX_EV && actor.defev < INDIVIDUAL_MAX_EV && actor.total_ev != MAX_EV
actor.defev = MAX_EV - actor.total_ev
elsif actor.defev + $game_troop.def_ev_total > INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.def_ev_total <= MAX_EV
actor.defev = INDIVIDUAL_MAX_EV
elsif actor.defev + $game_troop.def_ev_total <= INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.def_ev_total <= MAX_EV
actor.defev += $game_troop.def_ev_total
end
if actor.agiev + $game_troop.agi_ev_total > MAX_EV && actor.agiev < INDIVIDUAL_MAX_EV && actor.total_ev != MAX_EV
actor.agiev = MAX_EV - actor.total_ev
elsif actor.agiev + $game_troop.agi_ev_total > INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.agi_ev_total <= MAX_EV
actor.agiev = INDIVIDUAL_MAX_EV
elsif actor.agiev + $game_troop.agi_ev_total <= INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.agi_ev_total <= MAX_EV
actor.agiev += $game_troop.agi_ev_total
end
if actor.spiev + $game_troop.spi_ev_total > MAX_EV && actor.spiev < INDIVIDUAL_MAX_EV && actor.total_ev != MAX_EV
actor.spiev = MAX_EV - actor.total_ev
elsif actor.spiev + $game_troop.spi_ev_total > INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.spi_ev_total <= MAX_EV
actor.spiev = INDIVIDUAL_MAX_EV
elsif actor.spiev + $game_troop.spi_ev_total <= INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.spi_ev_total <= MAX_EV
actor.spiev += $game_troop.spi_ev_total
end
if actor.hpev + $game_troop.hp_ev_total > MAX_EV && actor.hpev < INDIVIDUAL_MAX_EV && actor.total_ev != MAX_EV
actor.hpev = MAX_EV - actor.total_ev
elsif actor.hpev + $game_troop.hp_ev_total > INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.hp_ev_total <= MAX_EV
actor.hpev = INDIVIDUAL_MAX_EV
elsif actor.hpev + $game_troop.hp_ev_total <= INDIVIDUAL_MAX_EV && actor.total_ev + $game_troop.hp_ev_total <= MAX_EV
actor.hpev += $game_troop.hp_ev_total
end
end
jet2890_process_victory
end
end
unless $engine_scripts.nil?
JetEngine.active("Pokemon Statistics System", 1.5)
end [/spoiler]
Credit
Jet
A lot of people will probably get a lot of use out of this script. Good job jet!
Hey Jet! I think this is an awesome script, but, I realized this is only the personality aspect of pokemon games... I was hoping this was for the element too...
If at all possible can you make a version of this script So each element ID has good and bad elements? Something like this:
#Element ID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 => [C, D, F, B, A, C, C, A, B, F, C, C, F, B, A, D],
And so on?
BTW as I was adding the last few numbers above the letters(did that last) I noticed the last 3 letter were B, A, and D which spells bad... hopefully it will not be...