UOGamers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • To obtain new Razor updates, please reinstall Razor from our new website.

[COMPLETE] Hit Chance

Status
Not open for further replies.

Nikki_Demise

Bug Hunter
[COMPLETE] Hit Chance

Hit Chance calculations have significant mistakes

http://www.uoguide.com/Honorable_Execution
http://guide.uo.com/skill_52.html
http://www.uoherald.com/guide/guide.php?guideId=62

Honorable Execution is not suppose to grant an HCI bonus.

http://www.uoguide.com/Five_on_Friday_-_October_19,_2007
http://guide.uo.com/itemproperties_0.html

Lightning Strike and HLA are added with items before 45% HCI cap.

While other hit chance modifiers aren't as clearly stated to be combined with item properties lightning strike and HLA there is evidence that the 45% cap is universal.

http://www.uoguide.com/Hit_lower_attack
http://www.uoguide.com/Hit_Lower_Defense

This Five On Friday endorses a formula that only has a single HCI/DCI variable.

http://www.uoguide.com/Five_on_Friday_-_February_29,_2008

This one links to another FOF and makes it clear that the 45% they listed under item properties is applied after other HCI modifiers(like the referenced HLA and Lightning Strike)

http://www.uoguide.com/Five_on_Friday_-_October_19,_2007

DCI/HLD also works like HCI/HLA

Code:
Index: Items/Weapons/Abilities/MovingShot.cs
===================================================================
--- Items/Weapons/Abilities/MovingShot.cs    (revision 319)
+++ Items/Weapons/Abilities/MovingShot.cs    (working copy)
@@ -13,7 +13,7 @@
         }
 
         public override int BaseMana{ get{ return 15; } }
-        public override double AccuracyScalar{ get{ return 0.75; } }
+        public override int AccuracyBonus{ get{ return -25; } }
 
         public override bool OnBeforeSwing( Mobile attacker, Mobile defender )
         {
Index: Items/Weapons/Abilities/WeaponAbility.cs
===================================================================
--- Items/Weapons/Abilities/WeaponAbility.cs    (revision 319)
+++ Items/Weapons/Abilities/WeaponAbility.cs    (working copy)
@@ -11,7 +11,7 @@
     {
         public virtual int BaseMana{ get{ return 0; } }
 
-        public virtual double AccuracyScalar{ get{ return 1.0; } }
+        public virtual int AccuracyBonus{ get{ return 0; } }
         public virtual double DamageScalar{ get{ return 1.0; } }
 
         public virtual bool RequiresSE { get { return false; } }
@@ -35,6 +35,11 @@
             return true;
         }
 
+        public virtual bool RequiresTactics( Mobile from )
+        {
+            return true;
+        }
+
         public virtual double GetRequiredSkill( Mobile from )
         {
             BaseWeapon weapon = from.Weapon as BaseWeapon;
@@ -87,7 +92,14 @@
 
             Skill skill = from.Skills[weapon.Skill];
             double reqSkill = GetRequiredSkill( from );
+            bool reqTactics = Core.ML && RequiresTactics( from );
 
+            if ( Core.ML && reqTactics && from.Skills[SkillName.Tactics].Base < reqSkill )
+            {
+                from.SendLocalizedMessage( 1079308, reqSkill.ToString() ); // You need ~1_SKILL_REQUIREMENT~ weapon and tactics skill to perform that attack
+                return false;
+            }
+
             if ( skill != null && skill.Base >= reqSkill )
                 return true;
 
@@ -96,7 +108,14 @@
                 return true;
             /* </UBWS> */
 
-            from.SendLocalizedMessage( 1060182, reqSkill.ToString() ); // You need ~1_SKILL_REQUIREMENT~ weapon skill to perform that attack
+            if ( reqTactics )
+            {
+                from.SendLocalizedMessage( 1079308, reqSkill.ToString() ); // You need ~1_SKILL_REQUIREMENT~ weapon and tactics skill to perform that attack
+            }
+            else
+            {
+                from.SendLocalizedMessage( 1060182, reqSkill.ToString() ); // You need ~1_SKILL_REQUIREMENT~ weapon skill to perform that attack
+            }
 
             return false;
         }
Index: Items/Weapons/BaseWeapon.cs
===================================================================
--- Items/Weapons/BaseWeapon.cs    (revision 319)
+++ Items/Weapons/BaseWeapon.cs    (working copy)
@@ -750,9 +750,6 @@
             double atkValue = atkWeapon.GetAttackSkillValue( attacker, defender );
             double defValue = defWeapon.GetDefendSkillValue( attacker, defender );
 
-            //attacker.CheckSkill( atkSkill.SkillName, defValue - 20.0, 120.0 );
-            //defender.CheckSkill( defSkill.SkillName, atkValue - 20.0, 120.0 );
-
             double ourValue, theirValue;
 
             int bonus = GetHitChanceBonus();
@@ -765,13 +762,8 @@
                 if ( defValue <= -20.0 )
                     defValue = -19.9;
 
-                // Hit Chance Increase = 45%
-                int atkChance = AosAttributes.GetValue( attacker, AosAttribute.AttackChance );
-                if ( atkChance > 45 )
-                    atkChance = 45;
+                bonus += AosAttributes.GetValue( attacker, AosAttribute.AttackChance );
 
-                bonus += atkChance;
-
                 if ( Spells.Chivalry.DivineFurySpell.UnderEffect( attacker ) )
                     bonus += 10; // attacker gets 10% bonus when they're under divine fury
 
@@ -781,13 +773,24 @@
                 if ( HitLower.IsUnderAttackEffect( attacker ) )
                     bonus -= 25; // Under Hit Lower Attack effect -> 25% malus
 
-                ourValue = (atkValue + 20.0) * (100 + bonus);
+                WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );
 
-                // Defense Chance Increase = 45%
-                bonus = AosAttributes.GetValue( defender, AosAttribute.DefendChance );
+                if ( ability != null )
+                    bonus += ability.AccuracyBonus;
+
+                SpecialMove move = SpecialMove.GetCurrentMove( attacker );
+
+                if ( move != null )
+                    bonus += move.GetAccuracyBonus( attacker );
+
+                // Max Hit Chance Increase = 45%
                 if ( bonus > 45 )
                     bonus = 45;
 
+                ourValue = (atkValue + 20.0) * (100 + bonus);
+
+                bonus = AosAttributes.GetValue( defender, AosAttribute.DefendChance );
+
                 if ( Spells.Chivalry.DivineFurySpell.UnderEffect( defender ) )
                     bonus -= 20; // defender loses 20% bonus when they're under divine fury
 
@@ -810,6 +813,10 @@
                 if ( SkillHandlers.Discordance.GetEffect( attacker, ref discordanceEffect ) )
                     bonus -= discordanceEffect;
 
+                // Defense Chance Increase = 45%
+                if ( bonus > 45 )
+                    bonus = 45;
+
                 theirValue = (defValue + 20.0) * (100 + bonus);
 
                 bonus = 0;
@@ -833,19 +840,7 @@
             if ( Core.AOS && chance < 0.02 )
                 chance = 0.02;
 
-            WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );
-
-            if ( ability != null )
-                chance *= ability.AccuracyScalar;
-
-            SpecialMove move = SpecialMove.GetCurrentMove( attacker );
-
-            if ( move != null )
-                chance *= move.GetAccuracyScalar( attacker );
-
             return attacker.CheckSkill( atkSkill.SkillName, chance );
-
-            //return ( chance >= Utility.RandomDouble() );
         }
 
         public virtual TimeSpan GetDelay( Mobile m )
Index: Spells/Base/SpecialMove.cs
===================================================================
--- Spells/Base/SpecialMove.cs    (revision 319)
+++ Spells/Base/SpecialMove.cs    (working copy)
@@ -21,9 +21,9 @@
         public virtual bool BlockedByAnimalForm{ get{ return true; } }
         public virtual bool DelayedContext{ get{ return false; } }
 
-        public virtual double GetAccuracyScalar( Mobile attacker )
+        public virtual int GetAccuracyBonus( Mobile attacker )
         {
-            return 1.0;
+            return 0;
         }
 
         public virtual double GetDamageScalar( Mobile attacker, Mobile defender )
Index: Spells/Bushido/HonorableExecution.cs
===================================================================
--- Spells/Bushido/HonorableExecution.cs    (revision 319)
+++ Spells/Bushido/HonorableExecution.cs    (working copy)
@@ -18,14 +18,6 @@
 
         public override TextDefinition AbilityMessage{ get{ return new TextDefinition( 1063122 ); } } // You better kill your enemy with your next hit or you'll be rather sorry...
 
-        public override double GetAccuracyScalar( Mobile attacker )
-        {
-            double bushido = attacker.Skills[SkillName.Bushido].Value;
-
-            // TODO: 4 -> Perfection / 5
-            return 1.0 + ( bushido / 10.0 + 4 ) / 100.0;
-        }
-
         public override double GetDamageScalar( Mobile attacker, Mobile defender )
         {
             double bushido = attacker.Skills[SkillName.Bushido].Value;
Index: Spells/Bushido/LightningStrike.cs
===================================================================
--- Spells/Bushido/LightningStrike.cs    (revision 319)
+++ Spells/Bushido/LightningStrike.cs    (working copy)
@@ -20,12 +20,9 @@
 
         public override bool DelayedContext{ get{ return true; } }
 
-        public override double GetAccuracyScalar( Mobile attacker )
+        public override int GetAccuracyBonus( Mobile attacker )
         {
-            if ( GetContext( attacker, typeof( Bushido.LightningStrike ) ) )
-                return 1.1;
-
-            return 1.5;
+            return 50;
         }
 
         public override bool IgnoreArmor( Mobile attacker )
 

Attachments

  • CheckHit.zip
    2 KB · Views: 6

gilgamash

Knight
Re: Hit Chance

Greets Nikki,

the inconsistency within the usage of Integer and Float numbers in general
in calculations within the runuo-sources is a problem as error-prone, as I noticed
when working on my implementations

Maybe we should (counter)-check ahellofalot more things.

Greets,
G.
 

LadyCrimson

Wanderer
Re: Hit Chance

related to HCI (I believe this needs checked before a bug report is made) is that HCI no longer is a property for shields (or maybe swords).... one or the other is without HCI now.
 
Re: Hit Chance

LadyCrimson;562403 said:
related to HCI (I believe this needs checked before a bug report is made) is that HCI no longer is a property for shields (or maybe swords).... one or the other is without HCI now.

Yes, it was already reported:
  • You can't have HCI as a mod while crafting shields [need to know of which expansion this belongs]

I knew it was about shields, I dunno about swords.
 

LadyCrimson

Wanderer
Re: Hit Chance

k, then it is shields - I knew it was one OR the other, not both. Let me hit up the staff bug thread, I am pretty sure there is a link to patch notes.

*edit*
ok, quoting the staff thread:
this is a difference that will really piss some people off...

Hit chance increase does NOT spawn on shields anymore. it was replaced by reflect physical damage. This includes crafted shields as well. I'm looking for the specific time it happened but I know it was either SE or ML.

Old prepatch shields were not updated. you can still find pre-patch shields with HCI on player vendors.

cap for reflect physical dmg on shields is 15%

I dug up this thread discussing it on stratics:
http://boards.stratics.com/php-bin/u...=1#Post7335401

sounds like this was a change just before the ML release.

Unfortunately, this thread leads to the OLD stratics forums so it was purged out :/ I trust the statement of the staff member who read and reported it so I would say ML since it wasn't the entire SE release.... could say SE since that's when it went in tho.
 
Re: Hit Chance

LadyCrimson;562435 said:
I trust the statement of the staff member who read and reported it so I would say ML since it wasn't the entire SE release.... could say SE since that's when it went in tho.

Hmmm... so, Publish 33 or 34?

If it is Publish 33 -> SE
If it is Publish 34 -> ML

Well... I'd classify this as ML so we don't run in troubles :)
 

Sly-demise

Sorceror
Re: Hit Chance

Here's some info on HCI taken from http://www.uoguide.com/Hit_Chance_Increase

Hit Chance Increase on Shields
HCI used to occur on non-artifact shields, but that is no longer the case. For this reason, the price for such shields is relatively high.

In a discussion of HCI on shields in the Five on Friday (FoF) of November 3, 2006 (Number 35), developer MrTact said, "Unless someone gives me a good reason why that property was removed from shields, I see no reason not to put it back." However, the FoF continued by noting that the developers believe that the way HCI and Hit Lower Attack are implemented needs to be rebalanced. Therefore, the FoF concludes, HCI will not be added back to shields until such balance issues are addressed.

It seems to me that looking in the rear mirror they regret having removed HCI on shields and are looking to balance things out in order to be able to implement it again. If this is the case, should Demise as an OSI clone also remove HCI even if removing it on OSI might have been a bad move? Should this fix maybe be put in a waiting list while the balancing on OSI is being done so you won't have to remove HCI on shields only to later reimplement it?
 

LadyCrimson

Wanderer
Re: Hit Chance

Considering the date on the FoF answer, unless we can find something that indicates it was put back, I would day remove it. From that date, HCI hasn't been on shields for 2 and a half years on OSI. Did they put it back? Any patch after Nov 2006 needs reviewed to see if it was put back. If it was put back, it shouldn't be changed. If it wasn't put back, then it needs to come off.
 

emoooo

Sorceror
Re: Hit Chance

Lightning strike should override GetAccuracyBonus instead of GetAccuracyScalar. The way that it is now, Lighning strike multiplies your hit chance and it goes over the cap.

Code:
		public override double GetAccuracyScalar( Mobile attacker )
		{
			if ( GetContext( attacker, typeof( Bushido.LightningStrike ) ) )
				return 1.1;

			return 1.5;
		}


Code:
-            SpecialMove move = SpecialMove.GetCurrentMove( attacker );
-
-            if ( move != null )
-                chance *= move.GetAccuracyScalar( attacker );
 

Nikki_Demise

Bug Hunter
Re: Hit Chance

emoooo;568979 said:
Lightning strike should override GetAccuracyBonus instead of GetAccuracyScalar. The way that it is now, Lighning strike multiplies your hit chance and it goes over the cap.

Read the provided links Lightning Strike should not go over cap.
 

emoooo

Sorceror
Re: Hit Chance

Nikki_Demise;568995 said:
Read the provided links Lightning Strike should not go over cap.

that is correct. now it goes over the cap and it has to be fixed. I'll look at it tomorrow after work.
 
Status
Not open for further replies.
Top