Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -185,7 +185,7 @@ namespace Server.Spells.Necromancy
Corpse c = obj as Corpse;
if( c == null )
if ( c == null )
{
Caster.SendLocalizedMessage( 1061084 ); // You cannot animate that.
}
@ -193,12 +193,12 @@ namespace Server.Spells.Necromancy
{
Type type = null;
if( c.Owner != null )
if ( c.Owner != null )
{
type = c.Owner.GetType();
}
if( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
{
Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate.
}
@ -206,18 +206,18 @@ namespace Server.Spells.Necromancy
{
CreatureGroup group = FindGroup( type );
if( group != null )
if ( group != null )
{
if( group.m_Entries.Length == 0 || type == typeof( DemonKnight ) )
if ( group.m_Entries.Length == 0 || type == typeof( DemonKnight ) )
{
Caster.SendLocalizedMessage( 1061086 ); // You cannot animate undead remains.
}
else if( CheckSequence() )
else if ( CheckSequence() )
{
Point3D p = c.GetWorldLocation();
Map map = c.Map;
if( map != null )
if ( map != null )
{
Effects.PlaySound( p, map, 0x1FB );
Effects.SendLocationParticles( EffectItem.Create( p, map, EffectItem.DefaultDuration ), 0x3789, 1, 40, 0x3F, 3, 9907, 0 );

View file

@ -143,13 +143,13 @@ namespace Server.Spells.Necromancy
}
public void DoExpire()
{
if( m_OathTable.Contains( m_Caster ) )
if ( m_OathTable.Contains( m_Caster ) )
{
m_Caster.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
m_OathTable.Remove ( m_Caster );
}
if( m_OathTable.Contains( m_Target ) )
if ( m_OathTable.Contains( m_Target ) )
{
m_Target.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
m_OathTable.Remove ( m_Target );

View file

@ -31,7 +31,7 @@ namespace Server.Spells.Necromancy
public override bool CheckCast()
{
if( Caster.Skills.SpiritSpeak.Value < 100.0 )
if ( Caster.Skills.SpiritSpeak.Value < 100.0 )
{
Caster.SendLocalizedMessage( 1072112 ); // You must have GM Spirit Speak to use this spell
return false;
@ -54,20 +54,20 @@ namespace Server.Spells.Necromancy
{
ChampionSpawnRegion r = Caster.Region.GetRegion( typeof( ChampionSpawnRegion ) ) as ChampionSpawnRegion;
if( r == null || !Caster.InRange( r.ChampionSpawn, Range ) )
if ( r == null || !Caster.InRange( r.ChampionSpawn, Range ) )
{
Caster.SendLocalizedMessage( 1072111 ); // You are not in a valid exorcism region.
}
else if( CheckSequence() )
else if ( CheckSequence() )
{
Map map = Caster.Map;
if( map != null )
if ( map != null )
{
List<Mobile> targets = new List<Mobile>();
foreach( Mobile m in r.ChampionSpawn.GetMobilesInRange( Range ) )
if( IsValidTarget( m ) )
if ( IsValidTarget( m ) )
targets.Add( m );
for( int i = 0; i < targets.Count; ++i )
@ -86,18 +86,18 @@ namespace Server.Spells.Necromancy
private bool IsValidTarget( Mobile m )
{
if( !m.Player || m.Alive )
if ( !m.Player || m.Alive )
return false;
Corpse c = m.Corpse as Corpse;
Map map = m.Map;
if( c != null && !c.Deleted && map != null && c.Map == map )
if ( c != null && !c.Deleted && map != null && c.Map == map )
{
if( SpellHelper.IsAnyT2A( map, c.Location ) && SpellHelper.IsAnyT2A( map, m.Location ) )
if ( SpellHelper.IsAnyT2A( map, c.Location ) && SpellHelper.IsAnyT2A( map, m.Location ) )
return false; //Same Map, both in T2A, ie, same 'sub server'.
if( m.Region.IsPartOf( typeof( DungeonRegion ) ) == Region.Find( c.Location, map ).IsPartOf( typeof( DungeonRegion ) ) )
if ( m.Region.IsPartOf( typeof( DungeonRegion ) ) == Region.Find( c.Location, map ).IsPartOf( typeof( DungeonRegion ) ) )
return false; //Same Map, both in Dungeon region OR They're both NOT in a dungeon region.
//Just an approximation cause RunUO doens't divide up the world the same way OSI does ;p
@ -106,24 +106,24 @@ namespace Server.Spells.Necromancy
Party p = Party.Get( m );
if( p != null && p.Contains( Caster ) )
if ( p != null && p.Contains( Caster ) )
return false;
if( m.Guild != null && Caster.Guild != null )
if ( m.Guild != null && Caster.Guild != null )
{
Guild mGuild = m.Guild as Guild;
Guild cGuild = Caster.Guild as Guild;
if( mGuild.IsAlly( cGuild ) )
if ( mGuild.IsAlly( cGuild ) )
return false;
if( mGuild == cGuild )
if ( mGuild == cGuild )
return false;
}
Faction f = Faction.Find( m );
if( Faction.Facet == m.Map && f != null && f == Faction.Find( Caster ) )
if ( Faction.Facet == m.Map && f != null && f == Faction.Find( Caster ) )
return false;
return true;
@ -136,13 +136,13 @@ namespace Server.Spells.Necromancy
Point3D[] locList;
if( map == Map.Felucca || map == Map.Trammel )
if ( map == Map.Felucca || map == Map.Trammel )
locList = m_BritanniaLocs;
else if( map == Map.Ilshenar )
else if ( map == Map.Ilshenar )
locList = m_IllshLocs;
else if( map == Map.Tokuno )
else if ( map == Map.Tokuno )
locList = m_TokunoLocs;
else if( map == Map.Malas )
else if ( map == Map.Malas )
locList = m_MalasLocs;
else
locList = new Point3D[0];
@ -155,7 +155,7 @@ namespace Server.Spells.Necromancy
Point3D p = locList[i];
double dist = m.GetDistanceToSqrt( p );
if( minDist > dist )
if ( minDist > dist )
{
closest = p;
minDist = dist;

View file

@ -42,10 +42,10 @@ namespace Server.Spells.Necromancy
public override bool ConsumeReagents()
{
if( base.ConsumeReagents() )
if ( base.ConsumeReagents() )
return true;
if( ArcaneGem.ConsumeCharges( Caster, 1 ) )
if ( ArcaneGem.ConsumeCharges( Caster, 1 ) )
return true;
return false;

View file

@ -57,12 +57,12 @@ namespace Server.Spells.Necromancy
TimeSpan buffTime = TimeSpan.FromSeconds( 10.0 );
if( m_Table.Contains( m ) )
if ( m_Table.Contains( m ) )
{
damage = Utility.RandomMinMax( 3, 7 );
Timer t = m_Table[m] as Timer;
if( t != null )
if ( t != null )
{
t.Delay += TimeSpan.FromSeconds( 2.0 );

View file

@ -35,7 +35,7 @@ namespace Server.Spells.Necromancy
public void Target( Mobile m )
{
if( CheckHSequence( m ) )
if ( CheckHSequence( m ) )
{
SpellHelper.Turn( Caster, m );
@ -60,7 +60,7 @@ namespace Server.Spells.Necromancy
Map map = m.Map;
if( map != null )
if ( map != null )
{
List<Mobile> targets = new List<Mobile>();
@ -68,8 +68,8 @@ namespace Server.Spells.Necromancy
targets.Add( m );
foreach( Mobile targ in m.GetMobilesInRange( 2 ) )
if(!(Caster is BaseCreature && targ is BaseCreature ))
if( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) )
if (!(Caster is BaseCreature && targ is BaseCreature ))
if ( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) )
targets.Add( targ );
for( int i = 0; i < targets.Count; ++i )
@ -77,9 +77,9 @@ namespace Server.Spells.Necromancy
Mobile targ = targets[i];
int num;
if( targ.InRange( m.Location, 0 ) )
if ( targ.InRange( m.Location, 0 ) )
num = 1;
else if( targ.InRange( m.Location, 1 ) )
else if ( targ.InRange( m.Location, 1 ) )
num = 2;
else
num = 3;
@ -105,7 +105,7 @@ namespace Server.Spells.Necromancy
protected override void OnTarget( Mobile from, object o )
{
if( o is Mobile )
if ( o is Mobile )
m_Owner.Target( (Mobile)o );
}

View file

@ -26,7 +26,7 @@ namespace Server.Spells.Necromancy
public override bool CheckCast()
{
if( !TransformationSpellHelper.CheckCast( Caster, this ) )
if ( !TransformationSpellHelper.CheckCast( Caster, this ) )
return false;
return base.CheckCast();

View file

@ -31,7 +31,7 @@ namespace Server.Spells.Necromancy
public override void OnCast()
{
if( CheckSequence() )
if ( CheckSequence() )
{
/* Creates a withering frost around the Caster,
* which deals Cold Damage to all valid targets in a radius of 5 tiles.
@ -39,7 +39,7 @@ namespace Server.Spells.Necromancy
Map map = Caster.Map;
if( map != null )
if ( map != null )
{
List<Mobile> targets = new List<Mobile>();
@ -48,7 +48,7 @@ namespace Server.Spells.Necromancy
foreach( Mobile m in Caster.GetMobilesInRange( Core.ML ? 4 : 5 ) )
{
if( Caster != m && Caster.InLOS( m ) && ( isMonster || SpellHelper.ValidIndirectTarget( Caster, m ) ) && Caster.CanBeHarmful( m, false ) )
if ( Caster != m && Caster.InLOS( m ) && ( isMonster || SpellHelper.ValidIndirectTarget( Caster, m ) ) && Caster.CanBeHarmful( m, false ) )
{
if ( isMonster )
{
@ -88,7 +88,7 @@ namespace Server.Spells.Necromancy
int sdiBonus = AosAttributes.GetValue( Caster, AosAttribute.SpellDamage );
// PvP spell damage increase cap of 15% from an item<65>s magic property in Publish 33(SE)
if( Core.SE && m.Player && Caster.Player && sdiBonus > 15 )
if ( Core.SE && m.Player && Caster.Player && sdiBonus > 15 )
sdiBonus = 15;
damage *= ( 100 + sdiBonus );