# This file sets the bonus for the various attributes, removing
# the hard coded values from the server.
# 
# The default provided here match the old values as closely as possible,
# but there may be minor differences due to the way the calculations
# are done.
#
# Because the parsing is not super intelligent, format is as follows:
# table name to fill in
# opening brace
# stat values - they are comma separated, but any non digit will
# act as a seperator when the values are read in.
# closing brace
#
# Repeat for all stats.  If the server has an issue reading them,
# it will generate an error, and should abort.
#
# The names are also more consistent in this file - basically,
# stat name_type of bonus_bonus
# In the old living.c file, there was a mix - con_bonus (really hp),
# sp_bonus, etc.  The idea of putting in the stat name is to try and
# provide more information on what does what so when wants to make adjustments,
# one has a better idea what is being adjusted.
#
# Note that all stats must be fully filled in, eg, you can not fill in only
# the first 20 entries of a stat if the maximum in 30 - all 30 must be
# filled in.  All stats use the same max_stat value.
#
# Note also that the loader does not do anything to make sure the
# stat bonus make any real sense, eg, a bonus for a higher stat could be
# lower (worse) than if the stat was one less.  The loader can not
# really check for these, because it does not have any good idea to
# know what is good or bad - for some stats, low numbers are better,
# for others, high numbers are better

# max_stat must be declared before any of the stat bonuses.
max_stat 30

# How many extra HP a character gets per level (first 10).  Old
# living.c file was for every 2 levels, which is why these bonuses
# are roughly half the old ones.
con_hp_bonus
{
    -3,
    -2.5, -2, -1.5, -1, -0.5,
    -0.5, 0, 0, 0, 0,
    0.5, 1, 1.5, 2, 2.5,
    3, 3.5, 4, 4.5, 5,
    6, 7, 8, 9, 10,
    11, 12.5, 15, 20, 25 
}


# SP (mana) bonus.  Bonus the character gets is 2/3 pow, 1/3 int.
# Note that in old file, the formula used to be (2*pow + int) / 12 -
# effectively diving old results by 4 (eg, table had 30 for a 26 stat,
# which effectively meant a 7.5 bonus) - that logic is removed,
# so these bonuses are real bonuses for each level, presuming both
# stats were same value - if pow gets bonus of 6, int bonus of 2,
# that would be (2*6 + 4)/ 3, or 5.
# Note that for first level, character get double this bonus - this
# is hard coded into the server.

pow_int_sp_bonus
{
    -2.5,
    -2.5, -2.25, -2, -1.75, -1.5,
    -1.25, -1, -0.75, -0.5, -0.25, 
    0, 0.25, 0.5, .75, 1,
    1.25, 1.5, 1.75, 2, 2.25, 
    2.5, 3, 3.75, 5, 6.25,
    7.5, 10, 12.5, 17.5, 25
}

# This is exactly like pow_int_sp_bonus above,
# but is 2/3 wis, 1/3 power.  In fact, table is exactly
# the same, and like sp bonus, character gets double value at
# first level.

wis_pow_grace_bonus
{
    -2.5,
    -2.5, -2.25, -2, -1.75, -1.5,
    -1.25, -1, -0.75, -0.5, -0.25, 
    0, 0.25, 0.5, .75, 1,
    1.25, 1.5, 1.75, 2, 2.25, 
    2.5, 3, 3.75, 5, 6.25,
    7.5, 10, 12.5, 17.5, 25
}

# There are lots of factors into shop pricing, cha
# being one of them.  Old system was a float,
# and the relevant formula was (bonus-1)/(bonus+1)
# Values below are converted with that formula
# and muliplied by 100 to make them integers.
# Note that due to rounding, some minor adjustments
# over the literal translated values have been made
# to make the changes smoother.
#
# If one really wants to know shop prices:
# adjustment is .4 + .5*((bonus below)/100)
#
# Cost to buy is 1*(1+adjustment), cost to sell is (1-adjusment)
# Thus, if the value below is 20, character pays 50% above
# and gets 50% of value (.4 + .5*(20/100) = .5
#
# That .4 mentioned above could get all the way down to .1
# with maximum bargaining skill.
#
# Best way to think of it: Bonus below are percentage discount/
# premium for buying/selling on the charisma side of things.
# If there was no bargaining in the game and only cha was used,
# the values below would be the total percent values, eg, a value
# of 50 means if you bought an item of value 100, you would pay
# 150, and get 50 if sold.
#
# Note: These values should probably really be re-done -
# I believe the formula that original values were based on changed
# at some point - it is also interesting to note that this is
# probably one of the few attributes where the effective
# bonus one gets at higher levels is lower (eg, difference
# in price for 26 to 20 is not as big a savings as 41 to 33).
# With revised shop code, max bonus should probably be much closer
# to zero (still would be 10% price difference even with max
# bargaining)

cha_shop_bonus
{
        81,
        81, 80, 78, 75, 71,
        67, 63, 60, 55, 50,
        49, 47, 46, 44, 43,
        41, 39, 37, 35, 33,
        32, 31, 30, 28, 27,
        26, 24, 23, 21, 20
}

# dex_bonus is used for several things for players -
# AC, bonus to hit with bows, bonus to damage with
# bows, and bonus to hit with thrown weapons.
# As such, name just remains dex bonus for now, but
# arguably, all of these different bonuses should probably
# get broken out to other tables.

dex_bonus
{ 
    -4,
    -3, -2, -2, -1, -1,
    -1, 0, 0, 0, 0,
     0, 0, 0, 1, 1,
     1, 2, 2, 2, 3,
     3, 3, 4, 4, 4,
     5, 5, 6, 6, 7
}

# How much faster the character moves or attacks.
# These are the usual tick counts.
# Note - I made some adjustments to smooth these out -
# I don't see a good reason to go from .15 to .20, repeat
# 4 times, then jump to 0.25.  With this change, at
# some points, the bonus is slightly higher (.02) than
# before, at other points, slightly lower.
#
dex_speed_bonus
{
   -0.1,
   -0.09, -0.08, -0.07, -0.06, -0.05,
   -0.025, 0.00, 0.00,  0.00, 0.00,
    0.025, 0.05, 0.07, 0.09, 0.10,
    0.11, 0.12,  0.13, 0.14, 0.15,
    0.16, 0.17, 0.18, 0.19, 0.20,
    0.21, 0.22, 0.23, 0.24, 0.25
}

#
# damage bonus from strength
#
str_damage_bonus
{
    -2,
    -2, -2, -1, -1, -1,
    0, 0, 0, 0, 0,
    0, 1, 1, 1, 2,
    2, 2, 3, 3, 3,
    4, 4, 5, 5, 6,
    6, 7, 8, 9, 10
}

# bonus to hit from strength.
# renamed from thaco_bonus, since thaco (really thac0) is an acronym
# for 'to hit AC 0' - in old AD&D, it was a literal number.  This bonus
# here is to hit any ac.
#
str_hit_bonus
{
    -2,
    -2, -2, -2, -1, -1,
    -1, -1, 0, 0, 0,
    0, 1, 1, 1, 1,
    2, 2, 2, 2, 2,
    3, 3, 3, 3, 4,
    4, 4, 4, 5, 5
}

# This determines how much the character can carry -
# note that characters start to get penalties to movement before
# reaching maximum.
#
str_weight_limit
{
    200000,
    250000, 300000, 350000, 400000, 500000,
    600000, 700000, 800000, 900000, 1000000,
    1100000, 1200000, 1300000, 1400000, 1500000,
    1650000, 1800000, 1950000, 2100000, 2250000,
    2400000, 2550000, 2700000, 2850000, 3000000,
    3250000, 3500000, 3750000, 4000000, 4500000
}

#
# Chance to learn a spell from a spellbook.  Note that
# overall level also increases these odds by a minor amount
# (level/5).  int or wis is used depending on the type of spell.
#
int_wis_learn_spell
{
    0,
    0, 0, 1, 2, 4,
    8, 12, 16, 25, 36,
    45, 55, 65, 70, 75,
    80, 85, 90, 95, 100,
    100, 100, 100, 100, 100,
    100, 100, 100, 100, 100
}

#
# Chance for a cleric to fail casting a spell.
# The chance is random(0,99) < ((spell_level * chance) / char_level)
# Thus, if chance is 0, character never fails.  If chance is 10,
# then if the character is same level as spell, 10% chance of
# of failure - if character is double level of the spell, 5% chance
# of failure.
#
wis_cleric_chance
{
    100,
    100, 100, 100, 90, 80,
    70, 60, 50, 40, 35,
    30, 25, 20, 15, 14,
    13, 12, 11, 10, 9,
    8, 7, 6, 5, 4,
    3, 2, 1, 0, 0
}

# Bonus for turning (scarring) undead with various prayers.
# The bonus effectively increase the character level.
# To scare a creature, the characters turn level has to be
# higher than the creatures level, so this bonus can be
# pretty important.  Note if the creature being turned is not
# an enemy of the characters god, turn bonus has to greater than
# twice the creatures level

wis_turn_bonus
{
    -1,
    -1, -1, -1, -1, -1,
    -1, -1, 0, 0, 0,
    1, 1, 1, 2, 2,
    2, 3, 3, 3, 4,
    4, 5, 5, 6, 7,
    8, 9, 10, 12, 15
}

# fear bonus increases the duration for fear
# spells (it does not affect other fear attacks,
# like those from weapons.)
# Note: The comment in living.c, that these are bonuses
# to fear resistance for players, seems incorrect/no longer
# valid - the only place where get_fear_bonus() is called
# is from cast_cone()
#
# These bonuses are as they were in the living.c
# file - the only rationale I can think of for low stats
# giving the bonus is idea of really ugly characters
# being more fearsome - however, this goes against
# the idea of higher stat is better.
#
cha_fear_bonus
{
    3,
    3, 3, 3, 2, 2,
    2, 1, 1, 1, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0
}
