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] Evasion spell

Status
Not open for further replies.

Kiluad

Sorceror
[COMPLETE] Evasion spell

UPDATED AGAIN
Also includes chance to evade spells.
NEEDS TESTING!
Fixes

* Will evade spells.
* Will not evade spells while casting.
* Will not block spells if mage weapon or UBW is equipped without a shield.
* Will wait 20 seconds before allowing recast of evasion.
Important note: To Block dragons breath, add these two lines to BaseCreature.cs
Code:
int poisDamage = BreathPoisonDamage;
			int nrgyDamage = BreathEnergyDamage;
			
			[COLOR="Red"]if( Evasion.CheckSpellEvasion( target ) ) 
		        return;[/COLOR]


			if ( physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0 )
I will remove needs testing once positive testing feedback comes in.

Type: Math && Missing feature.

Basic Description: wrong evasion/parry% && won't evade spells.

Way to experience: Cast Evasion. || get hit with spells while under the effect of evasion.

Detailed Description: Casting evasion with 60.01 skill results in a bonus of 28%. instead of 16.04% what it's suppose to be. spells aren't blocked with evasion.



Links: http://update.uo.com/design_530.html
Link#2:http://www.uodemise.com/forum/showthread.php?t=115137

Code:
Code:
Index: Bushido/Evasion.cs
===================================================================
--- Bushido/Evasion.cs	(revision 319)
+++ Bushido/Evasion.cs	(working copy)
@@ -4,6 +4,7 @@
 using Server.Items;
 using Server.Mobiles;
 using Server.Targeting;
+using Server.Spells;
 
 namespace Server.Spells.Bushido
 {
@@ -26,24 +27,29 @@
 				return base.CheckCast();
 
 			return false;
-		}
+		}    
 
 		public static bool VerifyCast( Mobile Caster, bool messages )
 		{
 			if( Caster == null )	//sanity
 				return false;
 
-			if( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
-				return true;
+			/* //if( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
+				//return true;  
 
-			//Intentional having a Shield check override all.
+			//Intentional having a Shield check override all.  
 
+
+			overrides the 20 second delay if shield is equipped, thus removed.
+
+			*/
+
 			BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
 
 			if( weap == null )
 				weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
 
-			if( weap != null )
+			if( weap != null || Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
 			{
 				if( Core.ML && Caster.Skills[weap.Skill].Base < 50 )
 				{
@@ -71,15 +77,35 @@
 
 		public static bool CheckSpellEvasion( Mobile defender )
 		{
-			if( IsEvading( defender ) && VerifyCast( defender, false ) && BaseWeapon.CheckParry( defender ) ) //As per OSI, uses the exact same parry code
+			
+
+			BaseWeapon weap = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
+
+			if( weap == null )
+				weap = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
+
+			
+			if( Core.ML && defender.Spell != null && defender.Spell.IsCasting )
 			{
+				return false;
+			}
+
+								
+			else if( Core.ML && IsEvading( defender ) && BaseWeapon.CheckParry( defender ) && defender.Skills[weap.Skill].Base > 50 && ( weap != null || defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null) ) 
+			{
 				defender.Emote( "*evades*" );	//Yes.  Eew.  Blame OSI.
 				defender.FixedEffect( 0x37B9, 10, 16 );
 				return true;
 			}
-
+			else if( !Core.ML && IsEvading( defender ) &&  BaseWeapon.CheckParry( defender ) && (weap != null || defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null) )
+			{	
+				defender.Emote( "*evades*" );	//Yes.  Eew.  Blame OSI.
+				defender.FixedEffect( 0x37B9, 10, 16 );
+				return true;
+			}
 			return false;
 		}
+			
 
 		public Evasion( Mobile caster, Item scroll )
 			: base( caster, scroll, m_Info )
@@ -144,6 +170,7 @@
 			return TimeSpan.FromSeconds( (int)seconds );
 		}
 
+
 		public static double GetParryScalar( Mobile m )
 		{
 			/* Evasion modifier to parry now scales with Bushido skill
@@ -158,15 +185,15 @@
 			if( !Core.ML )
 				return 1.5;
 
-			double bonus = 80;
+			double bonus = 0;
 
-			if( m.Skills.Bushido.Value > 60 )
-				bonus += m.Skills.Bushido.Value;
+			if( m.Skills.Bushido.Value >= 60 )
+                		bonus += ( (m.Skills.Bushido.Value - 60 *.004) +  0.16);
 
-			if( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 &&  m.Skills.Bushido.Value > 100 )	//Bushido being HIGHER than 100 for bonus is intended
-				bonus += 50;
+            		if( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 &&  m.Skills.Bushido.Value > 100 )    //Bushido being HIGHER than 100 for bonus is intended
+                		bonus += 0.10;
 
-			return 1.0 + bonus/500;
+            		return 1.0 + bonus;
 		}
 
 		public static void BeginEvasion( Mobile m )
@@ -191,7 +218,7 @@
 				t.Stop();
 
 			m_Table.Remove( m );
-
+		
 			OnEffectEnd( m, typeof( Evasion ) );
 		}
 

LadyCrimson

Wanderer
Re: Evasion spell

Being a QA Analyst/Programmer - may I suggest the person who wrote the code is not the person to test it :) Standard protocol in business.

LC
 

Kiluad

Sorceror
Re: Evasion spell

by all means.

ADD

defender.SendMessage(String.Format("chance to evade is {0}", chance));

to baseweapon.cs around where it checks for evasion.
 

Kiluad

Sorceror
Re: Evasion spell

I decided to update this thread because the math that needs fixed is also in the evasion.cs file, it should evade spells now, the way it's suppose to. test away. I believe tam and OSD fixed the actual spell though.


works works and works again.
 

EwKa

Page
Re: Evasion spell

LadyCrimson;560311 said:
Being a QA Analyst/Programmer - may I suggest the person who wrote the code is not the person to test it :) Standard protocol in business.

LC
Following the best practices... ;)
 
Re: Evasion spell

I have thought about a simple tweak from "false" to "true"... I'm checking now.

That VerifyCast should also mean you could not evade while casting spells or using special moves (see http://www.uodemise.com/forum/showthread.php?t=115820).

Ok, enough words... testing...

EDIT: nope. Now you can't evade neither with 1000 bushido :(

If you delete that check VerifyCast( defender, false ), you can evade. But you can evade also while casting flamestrike :p
 

Kiluad

Sorceror
Re: Evasion spell

osd_daedalus;561955 said:
I have thought about a simple tweak from "false" to "true"... I'm checking now.

That VerifyCast should also mean you could not evade while casting spells or using special moves (see http://www.uodemise.com/forum/showthread.php?t=115820).

Ok, enough words... testing...

EDIT: nope. Now you can't evade neither with 1000 bushido :(

If you delete that check VerifyCast( defender, false ), you can evade. But you can evade also while casting flamestrike :p

what's wrong with evading while casting flame strike? why can't people evade while casting spells?
 
Re: Evasion spell

Kiluad;562051 said:
what's wrong with evading while casting flame strike? why can't people evade while casting spells?

because it's not meant you evade an arrow while you are reading a book (or a spellbook), and because OSI decided so in Publish 46.
 

Kiluad

Sorceror
Re: Evasion spell

It won't evade when casting spells now.

Fixed fixed and fixed, someone test it please.
 
Re: Evasion spell

I have just tested. Looks like it works well!

Someone other wants to test?

ADD: I have noticed your patch is not mergeable by TortoisePatch now. Looks like you edited the patch you posted here directly by editing the post, and now I read that chunks are not equal.

I have prepared a cumulative patch :)
Code:
Index: Scripts/Engines/AI/Creature/BaseCreature.cs
===================================================================
--- Scripts/Engines/AI/Creature/BaseCreature.cs    (revision 319)
+++ Scripts/Engines/AI/Creature/BaseCreature.cs    (working copy)
@@ -529,6 +529,10 @@
             int poisDamage = BreathPoisonDamage;
             int nrgyDamage = BreathEnergyDamage;
 
+            if (Evasion.CheckSpellEvasion(target))
+                return;
+
+
             if ( physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0 )
             { // Unresistable damage even in AOS
                 target.Damage( BreathComputeDamage(), this );
Index: Scripts/Spells/Bushido/Evasion.cs
===================================================================
--- Scripts/Spells/Bushido/Evasion.cs    (revision 319)
+++ Scripts/Spells/Bushido/Evasion.cs    (working copy)
@@ -4,7 +4,9 @@
 using Server.Items;
 using Server.Mobiles;
 using Server.Targeting;
+using Server.Spells;
 
+
 namespace Server.Spells.Bushido
 {
     public class Evasion : SamuraiSpell
@@ -33,17 +35,21 @@
             if( Caster == null )    //sanity
                 return false;
 
-            if( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
-                return true;
+            /* //if( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
+                //return true;
 
             //Intentional having a Shield check override all.
 
+            overrides the 20 second delay if shield is equipped, thus removed.
+
+            */
+
             BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
 
             if( weap == null )
                 weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
 
-            if( weap != null )
+            if (weap != null || Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield != null)
             {
                 if( Core.ML && Caster.Skills[weap.Skill].Base < 50 )
                 {
@@ -71,13 +77,33 @@
 
         public static bool CheckSpellEvasion( Mobile defender )
         {
-            if( IsEvading( defender ) && VerifyCast( defender, false ) && BaseWeapon.CheckParry( defender ) ) //As per OSI, uses the exact same parry code
+            
+
+            BaseWeapon weap = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
+
+            if( weap == null )
+                weap = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
+
+            
+            if( Core.ML && defender.Spell != null && defender.Spell.IsCasting )
+             {
+                return false;
+            }
+
+                                
+            else if( Core.ML && IsEvading( defender ) && BaseWeapon.CheckParry( defender ) && defender.Skills[weap.Skill].Base > 50 && ( weap != null || defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null) )             
             {
                 defender.Emote( "*evades*" );    //Yes.  Eew.  Blame OSI.
                 defender.FixedEffect( 0x37B9, 10, 16 );
                 return true;
             }
-
+            
+            else if( !Core.ML && IsEvading( defender ) &&  BaseWeapon.CheckParry( defender ) && (weap != null || defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null) )
+            {    
+                defender.Emote( "*evades*" );    //Yes.  Eew.  Blame OSI.
+                defender.FixedEffect( 0x37B9, 10, 16 );
+                return true;
+            }
             return false;
         }
 
@@ -158,15 +184,15 @@
             if( !Core.ML )
                 return 1.5;
 
-            double bonus = 80;
+            double bonus = 0;
 
-            if( m.Skills.Bushido.Value > 60 )
-                bonus += m.Skills.Bushido.Value;
+            if( m.Skills.Bushido.Value >= 60 )
+                bonus += ( (m.Skills.Bushido.Value - 60 *.004) +  0.16);
 
-            if( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 &&  m.Skills.Bushido.Value > 100 )    //Bushido being HIGHER than 100 for bonus is intended
-                bonus += 50;
+            if (m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100)    //Bushido being HIGHER than 100 for bonus is intended
+                bonus += 0.10;
 
-            return 1.0 + bonus/500;
+            return 1.0 + bonus;
         }
 
         public static void BeginEvasion( Mobile m )
 
Status
Not open for further replies.
Top