Full Version : Damage, AbsorbDamage
xmlspawner >>Scripting Support >>Damage, AbsorbDamage


<< Prev | Next >>

Dian- 02-02-2006
Okay, heres the deal.. It is my belief that the RunUO system is way off on damage. I have been trying several things, increasing mobs Dex, skills and whatnot.. but in the end, a warrior that has armor on reduces damage way too far.

I am trying to figure out what/where the actual calculation is that reduces damage as to how much Armor a character has.. this is in BaseWepon.cs and is about the only real thing I have found that seems to be calculating this.

CODE
public virtual int AbsorbDamage( Mobile attacker, Mobile defender, int damage )
 {
  if ( Core.AOS )
   return AbsorbDamageAOS( attacker, defender, damage );

  double chance = Utility.RandomDouble();
  BaseArmor armor;

  if ( chance < 0.07 )
   armor = defender.NeckArmor as BaseArmor;
  else if ( chance < 0.14 )
   armor = defender.HandArmor as BaseArmor;
  else if ( chance < 0.28 )
   armor = defender.ArmsArmor as BaseArmor;
  else if ( chance < 0.43 )
   armor = defender.HeadArmor as BaseArmor;
  else if ( chance < 0.65 )
   armor = defender.LegsArmor as BaseArmor;
  else
   armor = defender.ChestArmor as BaseArmor;

  if ( armor != null )
   damage = armor.OnHit( this, damage );

  BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
  if ( shield != null )
   damage = shield.OnHit( this, damage );

  // XmlAttachment check for OnArmorHit
  damage -= Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, armor, this, damage);
  damage -= Server.Engines.XmlSpawner2.XmlAttach.OnArmorHit(attacker, defender, shield, this, damage);

  int virtualArmor = defender.VirtualArmor + defender.VirtualArmorMod;

  if ( virtualArmor > 0 )
  {
   double scalar;

   if ( chance < 0.14 )
    scalar = 0.07;
   else if ( chance < 0.28 )
    scalar = 0.14;
   else if ( chance < 0.43 )
    scalar = 0.15;
   else if ( chance < 0.65 )
    scalar = 0.22;
   else
    scalar = 0.35;

   int from = (int)(virtualArmor * scalar) / 2;
   int to = (int)(virtualArmor * scalar);

   damage -= Utility.Random( from, (to - from) + 1 );
  }

  return damage;
 }


Is this the right spot? I have made changes, but nothing seems to alter anything in game.

I just want to reduce the amount of damage that is absorbed by armor. Any help?

ArteGordon- 02-03-2006
do you have AOS enabled? You may be seeing the effect of resistances lowering AOS damage.
AbsorbDamage doesnt handle that. You need to look in AOS.cs at the Damage method.


Dian- 02-03-2006
damn I meant to put that in, no AOS / SE disabled (not that SE does anything atm)

ArteGordon- 02-03-2006
and is this with 1.0?

You want to look at BaseMeleeWeapon in BaseMeleeWeapon.cs which overrides AbsorbDamage. If you arent using 1.0 then there was an issue in which it was not correctly dealing with damage absorption.

Dian- 02-03-2006
Yeah, I use 1.0

I dont see anything in BaseMeleeWepon that calculates amount of damage to give depending on what armor rating a character has, though..


*edit

I dont get it, I have been making changes in several areas, and still.. no difference.

It seems with a full suit of Plate (normal iron) armor rating of 40, earth elly or lich for example, only does 1 damage from a melee hit. thats not right.

I even tested it on a fresh RunUO 1.0 and get the same result unmodified.

ArteGordon- 02-03-2006
is this what your AbsorbDamage method looks like in BaseMeleeWeapon?

CODE

 public override int AbsorbDamage( Mobile attacker, Mobile defender, int damage )
 {
  damage = base.AbsorbDamage( attacker, defender, damage );

  if ( Core.AOS )
   return damage;

  int absorb = defender.MeleeDamageAbsorb;

  if ( absorb > 0 )
  {
   if ( absorb > damage )
   {
    int react = damage / 5;

    if ( react <= 0 )
     react = 1;

    defender.MeleeDamageAbsorb -= damage;
    damage = 0;

    attacker.Damage( react, defender );

    attacker.PlaySound( 0x1F1 );
    attacker.FixedEffect( 0x374A, 10, 16 );
   }
   else
   {
    defender.MeleeDamageAbsorb = 0;
    defender.SendLocalizedMessage( 1005556 ); // Your reactive armor spell has been nullified.
    DefensiveSpell.Nullify( defender );
   }
  }

  return damage;
 }

Dian- 02-03-2006
yes, thats right. same

Dian- 02-03-2006
Am I not reading it right? I dont see anything in that override that determins how much damage is reduced from the armor rating (virtualArmor) a character has. As far as I see, it returns back to base.AbsorbDamage (BaseWepon.AbsorbDamage) to determin this.. every mod I have made in that, and i have made some severe ones, just trying to get somthing to change.. still only returns 1 damage on a melee hit from a lich, or earth elly. Of course Higher end mobs will start making impact on damage.. but still, a lich should damage more than that.

I have even raised Lich and elly wrestle skills, dex to hit faster, and damage min/max levels. Unless I go extreme, wich would compare to like, dragon, it has no difference in that 1 damage a player character gets from them.

this is frustrating.

ArteGordon- 02-03-2006
I've played around with the damage issue that you mention in the past, but I have forgotten what I did to get around the 1 damage. I'll have to check it out again.

Dian- 02-03-2006
Just a stab in the dark, so to speak.. but I made this alteration in BaseArmor..

CODE
public virtual int OnHit( BaseWeapon weapon, int damageTaken )
 {
  double HalfAr = ArmorRating / 2.0;
  int Absorbed = (int)(HalfAr + HalfAr*Utility.RandomDouble());


to this..

CODE
double QuarterAr = ArmorRating * 0.25;
  int Absorbed = (int)QuarterAr / 2;


and have the first actual difference in game. now, an elly is giving me 8-11 damage with that iron plate suit on.. but seems no different with no armor. Like I said, it was just a stab at trying to get a noticable difference in game.

Yeah, call me ignorant since I am not completly understanding all of this, but I cant let it go untill I do.. so thats a start.

Dian- 02-03-2006
edited post above I made the change in OnHit to this..

CODE
double QuarterAr = ArmorRating * 0.3;
  int Absorbed = (int)QuarterAr / 2;


Now There seems to be a fair difference between no armor and full standard iron plate.. and getting soem actual damage with the armor on, with elly.. going to continue testing some different armors, and mobs though.


***edit again***

Thats obviously not the correct formula, but it does make a difference. My concern is, if that will efect armor damage itself as well.. ot other things besides the damage that is done depending on your armor rating. Man, why is this so tough?

Dian- 02-04-2006
Anything found on this issue? Or at best, is the area I have changed going to efect other areas that dont specificly relate to the amount of damage reduced from the amount of armor a character/Mob has?

-Dian

ArteGordon- 02-04-2006
I havent checked this out yet but that looks a lot like the changes that I had explored so I think that is on the right track.