Armor Absorb

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Armor Absorb

Postby Shursan » Thu Feb 18, 2010 3:38 pm

Hi all,
I have searched a long time for the part of code and the only implementation i have find is for the arrow (arrow.cs)

Actually there's no absorb Armor in PVP and PVE. a unstyled, styled, or stealth attack seems to do the same damage on a mage and a puretank.

I have decided to make it available and the result is verry good i think.
I have no idea on how Mythic do this calcul.

That's a know problems ?

The part of code is in test on my server.

I post the result (log) if you want to take a look.

On a GameNPC

Code: Select all
12:18:38,256 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :50.On a un bonus d'Armure qui retire =22
12:18:41,944 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :63.On a un bonus d'Armure qui retire =28
12:18:49,319 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :70.On a un bonus d'Armure qui retire =31
12:18:51,756 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :37.Sur une base de dégats (Styled) de :23.On a un bonus d'Armure qui retire =8
12:18:59,006 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :1.On a un bonus d'Armure qui retire =0
12:19:00,397 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :49.On a un bonus d'Armure qui retire =22
12:19:04,084 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :67.On a un bonus d'Armure qui retire =30
12:19:05,600 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :1.On a un bonus d'Armure qui retire =0
12:19:06,006 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :37.Sur une base de dégats (Styled) de :1.On a un bonus d'Armure qui retire =0
12:19:07,772 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :62.On a un bonus d'Armure qui retire =27
12:19:11,459 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :70.On a un bonus d'Armure qui retire =31
12:19:11,569 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :37.Sur une base de dégats (Styled) de :8.On a un bonus d'Armure qui retire =2
12:19:15,147 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :45.Sur une base de dégats (Styled) de :68.On a un bonus d'Armure qui retire =30
12:19:16,584 - [RegionTime2] - DEBUG - DOL.GS.Styles.StyleProcessor - Bonus d'absorb Armure de :37.Sur une base de dégats (Styled) de :9.On a un bonus d'Armure qui retire =3


I want to test it correctly before commit the code, if you want it.
Origins/Genesis Administrator
Shursan
Server Representative
 
Posts: 375
Joined: Mon Jun 22, 2009 8:25 pm
Location: France

Re: Armor Absorb

Postby Shursan » Fri Jun 25, 2010 11:56 am

Well, this patch make armor abs active for unstyled and styled damage.
works for pve and pvp damage.

I have tested it a long time before, and i think the result is verry good.
Attachments
ArmorABS.patch
(7.89 KiB) Downloaded 17 times
Origins/Genesis Administrator
Shursan
Server Representative
 
Posts: 375
Joined: Mon Jun 22, 2009 8:25 pm
Location: France

Re: Armor Absorb

Postby Graveen » Fri Jun 25, 2010 12:25 pm

i'm surprised it is not in - anyone noticed this problem ?
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Armor Absorb

Postby Tolakram » Fri Jun 25, 2010 2:01 pm

Calculator is ArmorAbsorption now, is it not?
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: Armor Absorb

Postby Shursan » Fri Jun 25, 2010 2:45 pm

In fact, i have searched a long time for a code and finally i don't find it.

In game, all my test confirm me that's not implemented (or buggued ? so i have searched, and searched ... and don't find ..)
just test wear different absorb armor on different character or with a self abs spell (mage), and nothing appears to affect the damage.

the another missing party off missing absorb is natural resist off type of armor for type off damage.
Origins/Genesis Administrator
Shursan
Server Representative
 
Posts: 375
Joined: Mon Jun 22, 2009 8:25 pm
Location: France

Re: Armor Absorb

Postby Tolakram » Fri Jun 25, 2010 3:08 pm

GameLiving.cs MakeAttack, line 1579


Code: Select all
            // Badge Of Valor Calculation 1+ absorb or 1- absorb
            if (ad.Attacker.EffectList.GetOfType(typeof(BadgeOfValorEffect)) != null)
            {
               damage *= 1.0 + Math.Min(0.85, ad.Target.GetArmorAbsorb(ad.ArmorHitLocation));
            }
            else
            {
               damage *= 1.0 - Math.Min(0.85, ad.Target.GetArmorAbsorb(ad.ArmorHitLocation));
            }
            damage *= (lowerboundary + Util.Random(50)) * 0.01;
            ad.Modifier = (int)(damage * (ad.Target.GetResist(ad.DamageType) + SkillBase.GetArmorResist(armor, ad.DamageType)) * -0.01);
            damage += ad.Modifier;
            // RA resist check
            int resist = (int)(damage * ad.Target.GetDamageResist(GetResistTypeForDamage(ad.DamageType)) * -0.01);

            eProperty property = ad.Target.GetResistTypeForDamage(ad.DamageType);
            int secondaryResistModifier = ad.Target.SpecBuffBonusCategory[(int)property];
            int resistModifier = 0;
            resistModifier += (int)((ad.Damage + (double)resistModifier) * (double)secondaryResistModifier * -0.01);

            damage += resist;
            damage += resistModifier;
            ad.Modifier += resist;
            ad.Damage = (int)damage;

            // apply total damage cap
            ad.UncappedDamage = ad.Damage;
            ad.Damage = Math.Min(ad.Damage, (int)(UnstyledDamageCap(weapon) * effectiveness));

            if ((this is GamePlayer || (this is GameNPC && (this as GameNPC).Brain is IControlledBrain && this.Realm != 0)) && target is GamePlayer)
            {
               ad.Damage = (int)((double)ad.Damage * ServerProperties.Properties.PVP_DAMAGE);
            }
            else if ((this is GamePlayer || (this is GameNPC && (this as GameNPC).Brain is IControlledBrain && this.Realm != 0)) && target is GameNPC)
            {
               ad.Damage = (int)((double)ad.Damage * ServerProperties.Properties.PVE_DAMAGE);
            }

            ad.UncappedDamage = ad.Damage;

            //Eden - Conversion Bonus (Crocodile Ring)  - tolakram - critical damage is always 0 here, needs to be moved
            if (ad.Target is GamePlayer && ad.Target.GetModified(eProperty.Conversion) > 0)
            {
               int manaconversion = (int)Math.Round(((double)ad.Damage + (double)ad.CriticalDamage) * (double)ad.Target.GetModified(eProperty.Conversion) / 100);
               //int enduconversion=(int)Math.Round((double)manaconversion*(double)ad.Target.MaxEndurance/(double)ad.Target.MaxMana);
               int enduconversion = (int)Math.Round(((double)ad.Damage + (double)ad.CriticalDamage) * (double)ad.Target.GetModified(eProperty.Conversion) / 100);
               if (ad.Target.Mana + manaconversion > ad.Target.MaxMana) manaconversion = ad.Target.MaxMana - ad.Target.Mana;
               if (ad.Target.Endurance + enduconversion > ad.Target.MaxEndurance) enduconversion = ad.Target.MaxEndurance - ad.Target.Endurance;
               if (manaconversion < 1) manaconversion = 0;
               if (enduconversion < 1) enduconversion = 0;
               if (manaconversion >= 1) (ad.Target as GamePlayer).Out.SendMessage("You gain " + manaconversion + " power points", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
               if (enduconversion >= 1) (ad.Target as GamePlayer).Out.SendMessage("You gain " + enduconversion + " endurance points", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
               ad.Target.Endurance += enduconversion; if (ad.Target.Endurance > ad.Target.MaxEndurance) ad.Target.Endurance = ad.Target.MaxEndurance;
               ad.Target.Mana += manaconversion; if (ad.Target.Mana > ad.Target.MaxMana) ad.Target.Mana = ad.Target.MaxMana;
            }

            // patch to missed when 0 damage
            if (ad.Damage == 0)
            {
               if (log.IsDebugEnabled)
               {
                  log.ErrorFormat("Possible Damage Error: {0} Damage = 0 -> miss vs {1}.  AttackDamage {2}, weapon name {3}", Name, (ad.Target == null ? "null" : ad.Target.Name), AttackDamage(weapon), (weapon == null ? "None" : weapon.Name));
               }

               ad.AttackResult = eAttackResult.Missed;
            }
         }

         //Add styled damage if style hits and remove endurance if missed
         if (StyleProcessor.ExecuteStyle(this, ad, weapon))
         {
            ad.AttackResult = GameLiving.eAttackResult.HitStyle;
         }

         if ((ad.AttackResult == eAttackResult.HitUnstyled || ad.AttackResult == eAttackResult.HitStyle))
         {
            ad.CriticalDamage = GetMeleeCriticalDamage(ad, weapon);
         }

...


ABS reduction is calculated on base damage (at the top of that code block), then the style is executed which adds to that damage (at the bottom of the code block). Is ABS supposed to modify style damage? I assume it is, but maybe not?

Of most concern is the fact that this will reduce PvP damage even more than it is now. Most testing, perhaps all testing, was done without styling, but this may require us to adjust the style damage bonuses if styled damage becomes too low.

It's an interesting discovery, for sure.

As far as the patch goes, get the damage modification out of styleprocessor, it should go into makeattack where other armor calculations are done. This is one reason why the code is so hard to maintain, we end up having to look in 50 places for damage calcs. StyleProcessor should calculate if a style executes and how much damage it does, and nothing more.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest