Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,124 +3,124 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server
|
||||
{
|
||||
public class OppositionGroup
|
||||
{
|
||||
private Type[][] m_Types;
|
||||
public class OppositionGroup
|
||||
{
|
||||
private Type[][] m_Types;
|
||||
|
||||
public OppositionGroup( Type[][] types )
|
||||
{
|
||||
m_Types = types;
|
||||
}
|
||||
public OppositionGroup(Type[][] types)
|
||||
{
|
||||
m_Types = types;
|
||||
}
|
||||
|
||||
public bool IsEnemy( object from, object target )
|
||||
{
|
||||
int fromGroup = IndexOf( from );
|
||||
int targGroup = IndexOf( target );
|
||||
public static OppositionGroup TerathansAndOphidians{ get; } = new OppositionGroup(new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof(TerathanAvenger),
|
||||
typeof(TerathanDrone),
|
||||
typeof(TerathanMatriarch),
|
||||
typeof(TerathanWarrior)
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof(OphidianArchmage),
|
||||
typeof(OphidianKnight),
|
||||
typeof(OphidianMage),
|
||||
typeof(OphidianMatriarch),
|
||||
typeof(OphidianWarrior)
|
||||
}
|
||||
});
|
||||
|
||||
return ( fromGroup != -1 && targGroup != -1 && fromGroup != targGroup );
|
||||
}
|
||||
public static OppositionGroup SavagesAndOrcs{ get; } = new OppositionGroup(new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof(Orc),
|
||||
typeof(OrcBomber),
|
||||
typeof(OrcBrute),
|
||||
typeof(OrcCaptain),
|
||||
typeof(OrcishLord),
|
||||
typeof(OrcishMage),
|
||||
typeof(SpawnedOrcishLord)
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof(Savage),
|
||||
typeof(SavageRider),
|
||||
typeof(SavageRidgeback),
|
||||
typeof(SavageShaman)
|
||||
}
|
||||
});
|
||||
|
||||
public int IndexOf( object obj )
|
||||
{
|
||||
if ( obj == null )
|
||||
return -1;
|
||||
public static OppositionGroup FeyAndUndead{ get; } = new OppositionGroup(new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof(Centaur),
|
||||
typeof(EtherealWarrior),
|
||||
typeof(Kirin),
|
||||
typeof(LordOaks),
|
||||
typeof(Pixie),
|
||||
typeof(Silvani),
|
||||
typeof(Unicorn),
|
||||
typeof(Wisp),
|
||||
typeof(Treefellow),
|
||||
typeof(MLDryad),
|
||||
typeof(Satyr)
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof(AncientLich),
|
||||
typeof(Bogle),
|
||||
typeof(LichLord),
|
||||
typeof(Shade),
|
||||
typeof(Spectre),
|
||||
typeof(Wraith),
|
||||
typeof(BoneKnight),
|
||||
typeof(Ghoul),
|
||||
typeof(Mummy),
|
||||
typeof(SkeletalKnight),
|
||||
typeof(Skeleton),
|
||||
typeof(Zombie),
|
||||
typeof(ShadowKnight),
|
||||
typeof(DarknightCreeper),
|
||||
typeof(RevenantLion),
|
||||
typeof(LadyOfTheSnow),
|
||||
typeof(RottingCorpse),
|
||||
typeof(SkeletalDragon),
|
||||
typeof(Lich)
|
||||
}
|
||||
});
|
||||
|
||||
Type type = obj.GetType();
|
||||
public bool IsEnemy(object from, object target)
|
||||
{
|
||||
int fromGroup = IndexOf(from);
|
||||
int targGroup = IndexOf(target);
|
||||
|
||||
for ( int i = 0; i < m_Types.Length; ++i )
|
||||
{
|
||||
Type[] group = m_Types[i];
|
||||
return fromGroup != -1 && targGroup != -1 && fromGroup != targGroup;
|
||||
}
|
||||
|
||||
bool contains = false;
|
||||
public int IndexOf(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return -1;
|
||||
|
||||
for ( int j = 0; !contains && j < group.Length; ++j )
|
||||
contains = group[j].IsAssignableFrom( type );
|
||||
Type type = obj.GetType();
|
||||
|
||||
if ( contains )
|
||||
return i;
|
||||
}
|
||||
for (int i = 0; i < m_Types.Length; ++i)
|
||||
{
|
||||
Type[] group = m_Types[i];
|
||||
|
||||
return -1;
|
||||
}
|
||||
bool contains = false;
|
||||
|
||||
public static OppositionGroup TerathansAndOphidians { get; } = new OppositionGroup( new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof( TerathanAvenger ),
|
||||
typeof( TerathanDrone ),
|
||||
typeof( TerathanMatriarch ),
|
||||
typeof( TerathanWarrior )
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof( OphidianArchmage ),
|
||||
typeof( OphidianKnight ),
|
||||
typeof( OphidianMage ),
|
||||
typeof( OphidianMatriarch ),
|
||||
typeof( OphidianWarrior )
|
||||
}
|
||||
} );
|
||||
for (int j = 0; !contains && j < group.Length; ++j)
|
||||
contains = group[j].IsAssignableFrom(type);
|
||||
|
||||
public static OppositionGroup SavagesAndOrcs { get; } = new OppositionGroup( new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof( Orc ),
|
||||
typeof( OrcBomber ),
|
||||
typeof( OrcBrute ),
|
||||
typeof( OrcCaptain ),
|
||||
typeof( OrcishLord ),
|
||||
typeof( OrcishMage ),
|
||||
typeof( SpawnedOrcishLord )
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof( Savage ),
|
||||
typeof( SavageRider ),
|
||||
typeof( SavageRidgeback ),
|
||||
typeof( SavageShaman )
|
||||
}
|
||||
} );
|
||||
if (contains)
|
||||
return i;
|
||||
}
|
||||
|
||||
public static OppositionGroup FeyAndUndead { get; } = new OppositionGroup( new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
typeof( Centaur ),
|
||||
typeof( EtherealWarrior ),
|
||||
typeof( Kirin ),
|
||||
typeof( LordOaks ),
|
||||
typeof( Pixie ),
|
||||
typeof( Silvani ),
|
||||
typeof( Unicorn ),
|
||||
typeof( Wisp ),
|
||||
typeof( Treefellow ),
|
||||
typeof( MLDryad ),
|
||||
typeof( Satyr )
|
||||
},
|
||||
new[]
|
||||
{
|
||||
typeof( AncientLich ),
|
||||
typeof( Bogle ),
|
||||
typeof( LichLord ),
|
||||
typeof( Shade ),
|
||||
typeof( Spectre ),
|
||||
typeof( Wraith ),
|
||||
typeof( BoneKnight ),
|
||||
typeof( Ghoul ),
|
||||
typeof( Mummy ),
|
||||
typeof( SkeletalKnight ),
|
||||
typeof( Skeleton ),
|
||||
typeof( Zombie ),
|
||||
typeof( ShadowKnight ),
|
||||
typeof( DarknightCreeper ),
|
||||
typeof( RevenantLion ),
|
||||
typeof( LadyOfTheSnow ),
|
||||
typeof( RottingCorpse ),
|
||||
typeof( SkeletalDragon ),
|
||||
typeof( Lich )
|
||||
}
|
||||
} );
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue