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
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 )