Code: Select all
//Hit! Figure out how much raw damage the attack did, then modify it be tactics and strength
var raw_damage := CalculateAttackDamage ();
var modified_damage := CINT ((raw_damage * (GetAttribute (attacker, ATTRIBUTEID_TACTICS) + 50 + CINT (GetAttribute (attacker, ATTRIBUTEID_STRENGTH)/5)))/100);
//Get the defender's AR rating and reduce the damage by 50-100% of that value
var defender_ar := CINT (GetDefendersAR (defender)/2);
if (defender_ar > 0)
modified_damage := modified_damage - RandomInt (defender_ar) - defender_ar - 1;
endif
//Always do at least 1 damage
if (modified_damage < 1)
modified_damage := 1;
endif
//Now check parry, if the defender has a shield
var shield := GetEquipmentByLayer (defender, LAYER_HAND2);
if (shield and IsShield (shield))
var defender_parry_skill := GetAttribute (defender, ATTRIBUTEID_PARRY);
if (RandomInt (200) < defender_parry_skill)
//Successful parry, reduce damage
modified_damage := modified_damage - shield.ar;
SendSysMessage (defender, "You parry the attack!");
//if no damage left, quit now
if (modified_damage <= 0)
return 1;
endif
endif
endif
//Players take 1/2 damage
if (defender.acctname)
modified_damage := CINT (modified_damage/2);
endif
//Do the damage
DoDamageByType (attacker, defender, modified_damage, DAMAGETYPE_PHYSICAL);
//Check for critical hit
if (GetAttribute (attacker, ATTRIBUTEID_ANATOMY))
if (RandomInt (1000) < GetAttribute (attacker, ATTRIBUTEID_ANATOMY))
SendSysMessage (attacker, "Critical hit!");
if (CheckSkill (attacker, SKILLID_ANATOMY, 80, 0) )
DoDamageByType (attacker, defender, modified_damage, DAMAGETYPE_PHYSICAL);
else
DoDamageByType (attacker, defender, CINT (modified_damage/2), DAMAGETYPE_PHYSICAL);
endif
endif
endif
Attacker with 100 Str, 100 Tactics, and a rune blade of destruction (OLD DAMAGE before I did some changes to weapon damage (4d6+8) * 1.2 )
Defender is an Ancient Dragon (40 AR, 600 str)
Min raw damage: 14
Avg raw damage: 26
Max raw damage: 38
Min damage modified by Str and Tactics: 23
Avg damage modified by Str and Tactics: 44
Max damage modified by Str and Tactics: 64
Minimum reduction for 40 AR: 20
Average reduction for 40 AR: 30
Maximum reduction for 40 AR: 40
======
VS NPC
======
Min damage vs Maximum reduction: 1
Avg damage vs Maximum reduction: 4
Max damage vs Maximum reduction: 24
Min damage vs Average reduction: 1
Avg damage vs Average reduction: 14
Max damage vs Average reduction: 34
Min damage vs Minimum reduction: 3
Avg damage vs Minimum reduction: 24
Max damage vs Minimum reduction: 44
=========
VS PLAYER WITH 40 AR (current scripts halve damage done to players)
=========
Min damage vs Maximum reduction: 1
Avg damage vs Maximum reduction: 2
Max damage vs Maximum reduction: 12
Min damage vs Average reduction: 1
Avg damage vs Average reduction: 7
Max damage vs Average reduction: 17
Min damage vs Minimum reduction: 1
Avg damage vs Minimum reduction: 12
Max damage vs Minimum reduction: 22
=============
Now lets think of an ancient dragon...
600 str, 100 tactics, damage 7d6+12
Min raw damage: 19
Avg raw damage: 36
Max raw damage: 54
Min damage modified by Str and Tactics: 51
Avg damage modified by Str and Tactics: 97
Max damage modified by Str and Tactics: 145
======
VS NPC
======
Min damage vs Maximum reduction: 11
Avg damage vs Maximum reduction: 57
Max damage vs Maximum reduction: 105
Min damage vs Average reduction: 21
Avg damage vs Average reduction: 67
Max damage vs Average reduction: 115
Min damage vs Minimum reduction: 31
Avg damage vs Minimum reduction: 77
Max damage vs Minimum reduction: 125
=========
VS PLAYER WITH 40 AR (current scripts halve damage done to players)
=========
Min damage vs Maximum reduction: 5
Avg damage vs Maximum reduction: 28
Max damage vs Maximum reduction: 52
Min damage vs Average reduction: 10
Avg damage vs Average reduction: 33
Max damage vs Average reduction: 57
Min damage vs Minimum reduction: 15
Avg damage vs Minimum reduction: 38
Max damage vs Minimum reduction: 62
=============================================
The problem with this formula is: It doesn't scale. so strong monsters deal lots of damage and the armor absorption becomes insignificant.
I have been exploring a new proposal and will be posting it here later today.