SphereCommunity
Combat & damage - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Combat & damage (/Thread-Combat-damage)



Combat & damage - Crusader - 03-03-2013 08:49 PM

I have some concerns about combat system, i activated the following flags:
Code:
// COMBAT_NODIRCHANGE              00001 // Not rotate player when fighting (like was in 0.51a)
// COMBAT_FACECOMBAT               00002 // Allow faced combat only (recommended)
// COMBAT_PREHIT                   00004 // allow prehit for close combat. first hit is instant (delay 0.1sec)
// COMBAT_USE_RESISTANCE           00008 // use character props RES* against oldfashioned damage types
// COMBAT_SPECIALDAMAGE            00010 // use character tags TAG.*DAMAGE to apply additional damage
// COMBAT_DCLICKSELF_UNMOUNTS      00020 // unmount horse when dclicking self while in warmode
// COMBAT_ALLOWHITFROMSHIP         00040 // Allow attacking opponents from ships
// COMBAT_OSIDAMAGEMOD             00080 // modify weapon damage OSI-style (taking anatomy, tactics, lumberjacking into account)
// COMBAT_ARCHERYCANMOVE           00100 // firing bow while moving
// COMBAT_STAYINRANGE              00200 // abort attack swing when out of range instead of waiting to come back in range
//
// COMBAT_STACKARMOR               01000 // If a region is covered by more than one armor part, all AR will count
// COMBAT_TARGETTEDHIT             02000 // Allows setting of preferred hit area by TAG.HITPREFERENCE
CombatFlags=08|010|080

so, using the OSI formula i should have for my damage:

//Tactics Damage Bonus% = Tactics /1.6 (Add 6.25% if Tactics >= 100)
//Anatomy Damage Bonus% = (Anatomy / 2) + 5
//Lumberjack Damage Bonus% = Lumberjack /5 (Add 10% if Lumberjacking >= 100)
//Strength Damage Bonus% = Strength * 0.3 (Add 5% if Strength >= 100)
//Final Damage Bonus% = Tactics Bonus + Anatomy Bonus + Lumber Bonus + Strangth Bonus + Damage Increase Items*
// Final Damage = Base Damage + (Base Damage * Final Damage Bonus%)


Now, using a char with 100.0 in all skills, and a weapon that deal 38-38 damage.

My final damage according with this formula should be 109.
But when i attack a zombie with no armor and 10 dex, the result of the this:
ON=@HIT
serv.log <ARGN1>

is a medium damage that goes from 51 to 68-70 while i should deal around 110.


why?


RE: Combat & damage - Gil Amarth - 03-03-2013 08:55 PM

Because Sphere donĀ“t follow OSI rules? Tongue

Sphere is not a exact copy of OSI servers, RunUo it is. You can script your combat system to be a exact copy os OSI if you want.


RE: Combat & damage - Crusader - 03-03-2013 08:58 PM

yes but, flag 080 says that the damage is calculated EXACTLY as OSI, in fact in the revision changelog we have:

Quote:05-10-2006, Nazghul
- Added: INI flag OF_OSIDamageMod (0x04)
Modifying weapon damage OSI style, according to this formulas (originally provided by ClouD_Br):
Tactics Damage Bonus% = Tactics : 1.6 (Add 6.25% if Tactics >= 100)
Anatomy Damage Bonus% = (Anatomy : 2) + 5
Lumberjack Damage Bonus% = Lumberjack : 2 (Add 10% if Lumberjacking >= 100) // besides, this is wrong, is lumberjacking :5 not :2
Strength Damage Bonus% = Strength * 0.3 (Add 5% if Strength >= 100)
Final Damage Bonus% = Tactics Bonus + Anatomy Bonus + Lumber Bonus + Strangth Bonus + Damage Increase Items*
Final Damage = Base Damage + (Base Damage * Final Damage Bonus%)
* Damage Increase is capped at 100%.



PLUS, i'm adding my Damage function calculation that should be correct (at least i double checked with http://uo.stratics.com/content/arms-armor/combat.php#damage and it works)
Code:
[FUNCTION FINDDAMAGE]
//Tactics Damage Bonus% = Tactics /1.6 (Add 6.25% if Tactics >= 100)
//Anatomy Damage Bonus% = (Anatomy / 2) + 5
//Lumberjack Damage Bonus% = Lumberjack /5 (Add 10% if Lumberjacking >= 100)
//Strength Damage Bonus% = Strength * 0.3 (Add 5% if Strength >= 100)
//Final Damage Bonus% = Tactics Bonus + Anatomy Bonus + Lumber Bonus + Strangth Bonus + Damage Increase Items*
// Final Damage = Base Damage + (Base Damage * Final Damage Bonus%)

LOCAL.TACTICSBONUS=<FLOATVAL <TACTICS>/1.6>
IF (<EVAL <TACTICS>> > 999)
        LOCAL.TACTICSBONUS = <FLOATVAL <LOCAL.TACTICSBONUS>+6,25>
ENDIF
//SERV.LOG TACT: <FLOATVAL <LOCAL.TACTICSBONUS>>
LOCAL.ANATOMYBONUS=<FVAL (<ANATOMY>/2)+5.0>
//SERV.LOG ANAT: <FLOATVAL <LOCAL.ANATOMYBONUS>>
LOCAL.STRBONUS=<FVAL <STR>*0.3>
IF (<STR> > 99)
        LOCAL.STRBONUS += 5.0
ENDIF
//SERV.LOG STR: <FVAL <LOCAL.STRBONUS>>
IF (<FINDLAYER.1.TYPE>==T_WEAPON_AXE) || (<FINDLAYER.2.TYPE>==T_WEAPON_AXE)
        LOCAL.LUMBERBONUS=<FVAL <LUMBERJACKING>/5>
        IF (<EVAL <LUMBERJACKING>> > 999)
                LOCAL.LUMBERBONUS += 10.0
        ENDIF
ENDIF
//SERV.LOG LUMB: <FVAL <LOCAL.LUMBERBONUS>>
LOCAL.FINALDMGXCENT=<FLOATVAL <LOCAL.TACTICSBONUS>+<FVAL <LOCAL.STRBONUS>>+<FVAL <LOCAL.ANATOMYBONUS>>+<FVAL <LOCAL.LUMBERBONUS>>>
//serv.log <FLOATVAL <LOCAL.FINALDMGXCENT>>%
LOCAL.BASEDMG =<FLOATVAL (<STR>/10)+1>
//serv.log <FLOATVAL <LOCAL.BASEDMG>>
IF (<FINDLAYER.1.TYPE>==t_weapon_bow) || (<FINDLAYER.1.TYPE>==t_weapon_sword) || (<FINDLAYER.1.TYPE>==t_weapon_fence) || (<FINDLAYER.1.TYPE>==t_weapon_mace_smith) || (<FINDLAYER.1.TYPE>==t_weapon_mace_sharp) || (<FINDLAYER.1.TYPE>==t_weapon_mace_staff) || (<FINDLAYER.1.TYPE>==t_weapon_mace_crook) || (<FINDLAYER.1.TYPE>==t_weapon_mace_pick) || (<FINDLAYER.1.TYPE>==t_weapon_axe)  || (<FINDLAYER.1.TYPE>==t_weapon_xbow)
        LOCAL.MAXDMG=<FLOATVAL ((<FINDLAYER.1.DAM.HI>*<LOCAL.FINALDMGXCENT>)/100) +<FINDLAYER.1.DAM.HI>>
        LOCAL.MINDMG=<FLOATVAL ((<FINDLAYER.1.DAM.LO>*<LOCAL.FINALDMGXCENT>)/100) +<FINDLAYER.1.DAM.LO>>
ELIF (<FINDLAYER.2.TYPE>==t_weapon_bow) || (<FINDLAYER.2.TYPE>==t_weapon_sword) || (<FINDLAYER.2.TYPE>==t_weapon_fence) || (<FINDLAYER.2.TYPE>==t_weapon_mace_smith) || (<FINDLAYER.2.TYPE>==t_weapon_mace_sharp)  || (<FINDLAYER.2.TYPE>==t_weapon_mace_staff) || (<FINDLAYER.2.TYPE>==t_weapon_mace_crook) || (<FINDLAYER.2.TYPE>==t_weapon_mace_pick) || (<FINDLAYER.2.TYPE>==t_weapon_axe)  || (<FINDLAYER.2.TYPE>==t_weapon_xbow)
        LOCAL.MAXDMG=<FLOATVAL ((<FINDLAYER.2.DAM.HI>*<LOCAL.FINALDMGXCENT>)/100) +<FINDLAYER.2.DAM.HI>>
        LOCAL.MINDMG=<FLOATVAL ((<FINDLAYER.2.DAM.LO>*<LOCAL.FINALDMGXCENT>)/100) +<FINDLAYER.2.DAM.LO>>
ELSE
        LOCAL.MINDMG=0.0000000
        LOCAL.MAXDMG=<FLOATVAL ((<LOCAL.BASEDMG>*<LOCAL.FINALDMGXCENT>)/100) +<LOCAL.BASEDMG>>
ENDIF
LOCAL.NMIN=<STRPOS 0 . <LOCAL.MINDMG>>
LOCAL.NMAX=<STRPOS 0 . <LOCAL.MAXDMG>>
LOCAL.MINFDMG=<STRSUB 0 <LOCAL.NMIN> <LOCAL.MINDMG>>
LOCAL.MAXFDMG=<STRSUB 0 <LOCAL.NMAX> <LOCAL.MAXDMG>>
RETURN <DLOCAL.MAXFDMG>,<DLOCAL.MINFDMG>



I made the following try:
i tried to attack the same zombie with same stats and same armor, with and without that 080 combat flag. Damage is totally the same; no changes at all


RE: Combat & damage - Crusader - 03-06-2013 11:16 AM

i tried the new commit with osi damage fix, but...
all skills to 100.0, axe weapon (i_axe_battle_large 45-43 damage), 100 STR and osi damage active.
My damage (checked with @Hit)
Code:
02:05:(erehwon_player_events.scp,88)61
02:05:(erehwon_player_events.scp,88)61
02:05:(erehwon_player_events.scp,88)51
02:05:(erehwon_player_events.scp,88)64
02:05:(erehwon_player_events.scp,88)59
02:05:(erehwon_player_events.scp,88)67
02:05:(erehwon_player_events.scp,88)54
02:05:(erehwon_player_events.scp,88)55
02:05:(erehwon_player_events.scp,88)54
02:05:(erehwon_player_events.scp,88)56
02:05:(erehwon_player_events.scp,88)54
02:05:(erehwon_player_events.scp,88)54
02:06:(erehwon_player_events.scp,88)54
02:06:(erehwon_player_events.scp,88)57
02:06:(erehwon_player_events.scp,88)60
02:06:(erehwon_player_events.scp,88)57
02:06:(erehwon_player_events.scp,88)58
02:06:(erehwon_player_events.scp,88)53

and my damage with allskills 0.0
Code:
02:07:1:'Crusader' commands 'allskills 0'=1
02:08:(erehwon_player_events.scp,88)63
02:08:(erehwon_player_events.scp,88)59
02:08:(erehwon_player_events.scp,88)55
02:08:(erehwon_player_events.scp,88)64
02:08:(erehwon_player_events.scp,88)59
02:08:(erehwon_player_events.scp,88)50
02:08:(erehwon_player_events.scp,88)55
02:09:(erehwon_player_events.scp,88)63
02:09:(erehwon_player_events.scp,88)66
02:09:(erehwon_player_events.scp,88)67
02:09:(erehwon_player_events.scp,88)70
02:09:(erehwon_player_events.scp,88)53
02:09:(erehwon_player_events.scp,88)60
02:09:(erehwon_player_events.scp,88)57
02:09:(erehwon_player_events.scp,88)63
02:09:(erehwon_player_events.scp,88)62
02:09:(erehwon_player_events.scp,88)68

My damage with combat flag not active and allskills to 100.0
Code:
02:11:(erehwon_player_events.scp,88)61
02:11:(erehwon_player_events.scp,88)70
02:11:(erehwon_player_events.scp,88)51
02:11:(erehwon_player_events.scp,88)66
02:11:(erehwon_player_events.scp,88)75
02:11:(erehwon_player_events.scp,88)67
02:11:(erehwon_player_events.scp,88)57
02:12:(erehwon_player_events.scp,88)59
02:12:(erehwon_player_events.scp,88)70
02:12:(erehwon_player_events.scp,88)54
02:12:(erehwon_player_events.scp,88)62
02:12:(erehwon_player_events.scp,88)68
02:12:(erehwon_player_events.scp,88)61
02:12:(erehwon_player_events.scp,88)62
02:12:(erehwon_player_events.scp,88)67
02:12:(erehwon_player_events.scp,88)60
02:12:(erehwon_player_events.scp,88)66
02:12:(erehwon_player_events.scp,88)60
02:12:(erehwon_player_events.scp,88)61
02:12:(erehwon_player_events.scp,88)72


and with allskills to 0.

Code:
02:13:(erehwon_player_events.scp,88)64
02:13:(erehwon_player_events.scp,88)57
02:13:(erehwon_player_events.scp,88)57
02:13:(erehwon_player_events.scp,88)67
02:13:(erehwon_player_events.scp,88)61
02:14:(erehwon_player_events.scp,88)66
02:14:(erehwon_player_events.scp,88)54
02:14:(erehwon_player_events.scp,88)57
02:14:(erehwon_player_events.scp,88)75
02:14:(erehwon_player_events.scp,88)58
02:14:(erehwon_player_events.scp,88)55
02:14:(erehwon_player_events.scp,88)70
02:14:(erehwon_player_events.scp,88)64
02:15:(erehwon_player_events.scp,88)75
02:15:(erehwon_player_events.scp,88)71
02:15:(erehwon_player_events.scp,88)72
02:15:(erehwon_player_events.scp,88)66
02:15:(erehwon_player_events.scp,88)60
02:15:(erehwon_player_events.scp,88)67



=///// like no difference


RE: Combat & damage - Ben - 03-06-2013 12:03 PM

Well I found your problem...
In @Hit, Argn is the base damage only (wich includes an str or dex bonus depending on skill used)... The OSI bonus is calculated after in the @GetHit trigger.
Check in @GetHit to see the results...

I think I might have to disable the str and dex bonus in @Hit when OSI damage is enabled...


RE: Combat & damage - Crusader - 03-06-2013 12:13 PM

with flag:
Code:
03:11:(erehwon_non_morti.scp,195)210
03:11:(erehwon_non_morti.scp,195)189
03:11:(erehwon_non_morti.scp,195)207
03:11:(erehwon_non_morti.scp,195)198
03:11:(erehwon_non_morti.scp,195)213
03:11:(erehwon_non_morti.scp,195)180
03:11:(erehwon_non_morti.scp,195)204
03:12:(erehwon_non_morti.scp,195)192
03:12:(erehwon_non_morti.scp,195)183
03:12:(erehwon_non_morti.scp,195)183
03:12:(erehwon_non_morti.scp,195)174
03:12:(erehwon_non_morti.scp,195)207
03:12:(erehwon_non_morti.scp,195)165
03:12:(erehwon_non_morti.scp,195)168
03:12:(erehwon_non_morti.scp,195)180
03:12:(erehwon_non_morti.scp,195)183

without flag:
Code:
03:08:(erehwon_non_morti.scp,195)58
03:08:(erehwon_non_morti.scp,195)62
03:08:(erehwon_non_morti.scp,195)75
03:08:(erehwon_non_morti.scp,195)59
03:08:(erehwon_non_morti.scp,195)66
03:08:(erehwon_non_morti.scp,195)64
03:08:(erehwon_non_morti.scp,195)60
03:08:(erehwon_non_morti.scp,195)72
03:08:(erehwon_non_morti.scp,195)71
03:08:(erehwon_non_morti.scp,195)66
03:08:(erehwon_non_morti.scp,195)53
03:08:(erehwon_non_morti.scp,195)55
03:09:(erehwon_non_morti.scp,195)62
03:09:(erehwon_non_morti.scp,195)66
03:09:(erehwon_non_morti.scp,195)60
03:09:(erehwon_non_morti.scp,195)64


Seems to work fine now Big Grin i'm gonna check the calculus soon, if there are some issue i'll post again but hopefully everything is correct!


RE: Combat & damage - Ben - 03-06-2013 12:19 PM

I'm prety sure there are some calculation errors... since there seems to be bonus added at many different places in the code lol
I'm looking throught it right now to figure out where I would possibly need to disable some bonus when OSI damage is enabled