mob/proc/Attack(mob/attacker,mob/defender)
var/damage = (attacker.precision - defender.protection)/(attacker.precision + defender.protection)
var/aim = (attacker.precision/defender.swiftness)*100
if(prob(aim))
world << "[damage] is damage!"
else
world << "[attacker] misses [defender]!"
Okay, thats the battle proc.
mob/var
toughness = 1//Damage multiplier
protection = 1//Damage divider
precision = 1//how much of a chance you have for hitting
vitality = 20// how much life points you have
max_vitality = 20//maximum life
swiftness = 1// how fast you can attack,ability to evade
recovery = 1// how fast you regen health
endurance = 1// how long you can last
max_endurance = 1//maximum endurance
Those are the stats.
Okay, now I made an enemy with a swiftness of 5. Using a "newbie" type character, it outputs this when I attack:
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
0 is damage!
0 is damage!
0 is damage!
Sariat misses the enemy!
Sariat misses the enemy!
0 is damage!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
Sariat misses the enemy!
0 is damage!
The newbie gets in about less than 10-20% of the hits...
And they both have all the newbie stats (1 protection, 1 toughness) and it jus outputs 0 damage...how can I make my battle system more.... "uncalculated" ?
Like every time you attack, you have a chance of:
Falling on your face
Slipping on a rock and accidentaly dealing lots of dmg to the enemy
Stunning the enemy for a short period of time (thus negating missing or dodging.. its pretty easy to hit a stationary target unless your dealing in ranged weps)
Sure you could think of more ^_^ Combat in games is always too simplistic IMO, at least to the effect that the more time you spend you -always- get better. There's always that randomness of environment after all ^_^
El