Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Release Archive

Custom Script Release Archive This is a pre-script database archive of what our users had released.

 
 
Thread Tools Display Modes
Old 02-15-2006, 12:55 PM   #1 (permalink)
Forum Newbie
 
Join Date: Feb 2006
Posts: 7
Exclamation Ouch! Painful problem with macing weapons

The following problem exists in both BaseWeapon.cs and BaseArmor.cs.

The code that determines the amount of damage that Bashing-type weapons do to armor and shields is the same whether or not AOS is enabled. This is a problem because the method and manner in which damage is calculated under AOS in RunUO is completely different than the way it's done with AOS disabled.

After dumping the values of 'wear' out to the console, I saw that the damage being done to shields/armor could go up to 30 points of durability per hit with AOS enabled, which is way way way too high (it should generally be between 4-9).

First Off, here's the original code for OnHit() in BaseArmor.cs:

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

			damageTaken -= Absorbed;
			if ( damageTaken < 0 ) 
				damageTaken = 0;

			if ( Absorbed < 2 )
				Absorbed = 2;


It should be something more like:

Code:
       public virtual int OnHit( BaseWeapon weapon, int damageTaken )
		{
			int Absorbed = 0;

			if (!Core.AOS)
			{
				double HalfAr = ArmorRating / 2.0;
				Absorbed = (int)(HalfAr + HalfAr*Utility.RandomDouble());

				damageTaken -= Absorbed;
			}
			else
				Absorbed = damageTaken;

			if ( damageTaken < 0 )
				damageTaken = 0;
			if ( Absorbed < 2 )
				Absorbed = 2;

'damageTaken' can be ignored under AOS because the damage calculations are done elsewhere (and under AOS its return value is ignored). For the same reason, under AOS, 'Absorbed' should equal 'damageTaken' because the proper armor resistance calculations have already been done before OnHit() is even called.


Now find this section of AbsorbDamageAOS() inside BaseWeapon.cs:

Code:
                                if ( blocked )
				{
					defender.FixedEffect( 0x37B9, 10, 16 );
					damage = 0;

					if ( shield != null )
					{
						double halfArmor = shield.ArmorRating / 2.0;
						int absorbed = (int)(halfArmor + (halfArmor*Utility.RandomDouble()));

						if ( absorbed < 2 )
							absorbed = 2;

it should be more like:

Code:
                                if ( blocked )
				{
					defender.FixedEffect( 0x37B9, 10, 16 );
					
					int absorbed = damage;
					damage = 0;

					if ( shield != null )
					{
						/* Under AOS these lines should never be executed!
						double halfArmor = shield.ArmorRating / 2.0;
						int absorbed = (int)(halfArmor + (halfArmor*Utility.RandomDouble()));
						*/
						
						if ( absorbed < 2 )
							absorbed = 2;

There's of course no reason for the same kind of Core.AOS check in AbsorbDamageAOS() since it shouldn't be executing if AOS is disabled. The offending code has been commented out.

I decided to post this because I can't be the only person out there who wants the featureset of AOS, but who also wants to bring 'item decay'/'wear and tear' back into the picture. Regardless, I'm sure no one running an AOS server wants shields/armor to be taking litarally 5x the damage they should be.

Anyway...hope this helps someone out there.
Apocrypha is offline  
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5