Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -62,8 +62,8 @@ namespace Server.Factions
|
|||
Faction ourFaction = m_Faction;
|
||||
Faction theirFaction = Faction.Find( m );
|
||||
|
||||
if ( theirFaction == null && m is BaseFactionGuard )
|
||||
theirFaction = ((BaseFactionGuard)m).Faction;
|
||||
if ( theirFaction == null && m is BaseFactionGuard guard )
|
||||
theirFaction = guard.Faction;
|
||||
|
||||
if ( ourFaction != null && theirFaction != null && ourFaction != theirFaction )
|
||||
{
|
||||
|
|
@ -72,22 +72,14 @@ namespace Server.Factions
|
|||
if ( reactionType == ReactionType.Attack )
|
||||
return true;
|
||||
|
||||
if ( theirFaction != null )
|
||||
List<AggressorInfo> list = m.Aggressed;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
List<AggressorInfo> list = m.Aggressed;
|
||||
AggressorInfo ai = list[i];
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
AggressorInfo ai = list[i];
|
||||
|
||||
if ( ai.Defender is BaseFactionGuard )
|
||||
{
|
||||
BaseFactionGuard bf = (BaseFactionGuard)ai.Defender;
|
||||
|
||||
if ( bf.Faction == ourFaction )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ( ai.Defender is BaseFactionGuard bf && bf.Faction == ourFaction )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue