public virtual bool IsInSameDivision(IFactionMember opponent) { if (opponent is Character) { return(((Character)opponent).IsInSameDivision(this)); } return(IsAlliedWith(opponent)); }
public virtual bool MayAttack(IFactionMember opponent) { if (HasMaster) { if (ReferenceEquals(Master, opponent)) { return(false); } return(Master.MayAttack(opponent)); } if ((opponent is WorldObject && ((WorldObject)opponent).HasMaster)) { opponent = ((WorldObject)opponent).Master; } if (opponent == null) { return(false); } if (ReferenceEquals(opponent, this)) { return(false); } var victim = opponent as Unit; //var attacker = this as Unit; if (victim != null && !victim.IsVisible) { return(false); } var character = opponent as Character; if (character != null && this is NPC && !character.Client.IsConnected) { return(false); } if (character != null) { return(character.MayAttack(this)); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opFaction) { return(false); } if (faction != null && opFaction != null && faction.Enemies.Contains(opFaction)) { return(true); } return(false); }
/// <summary> /// Indicates whether the 2 units are neutral towards each other. /// </summary> /// <returns></returns> public virtual bool IsAtLeastNeutralWith(IFactionMember opponent) { if (IsFriendlyWith(opponent)) { return(true); } var faction = Faction; var opFaction = opponent.Faction; if (faction != null && opFaction != null && faction.Neutrals.Contains(opFaction)) { return(true); } return(false); }
public virtual bool MayAttack(IFactionMember opponent) { if (HasMaster) { if (ReferenceEquals(Master, opponent)) { return(false); } return(Master.MayAttack(opponent)); } if ((opponent is WorldObject && ((WorldObject)opponent).HasMaster)) { opponent = ((WorldObject)opponent).Master; } if (opponent == null) { return(false); } if (ReferenceEquals(opponent, this)) { return(false); } if (opponent is Character) { return(((Character)opponent).MayAttack(this)); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opFaction) { return(false); } if (faction != null && opFaction != null && faction.Enemies.Contains(opFaction)) { return(true); } return(false); }
public virtual bool IsAlliedWith(IFactionMember opponent) { if (HasMaster) { if (ReferenceEquals(Master, opponent)) { return(true); } return(Master.IsAlliedWith(opponent)); } if ((opponent is WorldObject && ((WorldObject)opponent).HasMaster)) { opponent = ((WorldObject)opponent).Master; } if (ReferenceEquals(opponent, this)) { return(true); } if (opponent is Character) { return(((Character)opponent).IsAlliedWith(this)); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opponent.Faction) { return(true); } if (faction != null && opponent.Faction != null) { return(faction.Friends.Contains(opFaction)); } return(false); }
public void InitFactionMember(IFactionMember factionMember) { factionMember.onFactionChange = new FactionChangeEvent(); factionMember.currentDirectory = GetComponentInParent <Directory>(); }
public override bool MayAttack(IFactionMember opponent) { if (ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } if (opponent is Character) { return CanPvP((Character)opponent); } var opFaction = opponent.Faction; return m_faction.Enemies.Contains(opFaction) || (!m_faction.Friends.Contains(opFaction) && m_reputations.CanAttack(opFaction)); }
public override bool IsAtLeastNeutralWith(IFactionMember opponent) { if (IsFriendlyWith(opponent)) { return true; } var opFaction = opponent.Faction; var rep = m_reputations[opFaction.ReputationIndex]; if (rep != null) { return rep.Standing >= Standing.Neutral; } return m_faction.Neutrals.Contains(opFaction); }
/// <summary> /// One can only cast beneficial spells on people that we are allied with /// </summary> /// <param name="opponent"></param> /// <returns></returns> public override bool IsAlliedWith(IFactionMember opponent) { if (opponent == this || (opponent is Unit && ((Unit)opponent).Master == this)) { return true; } if (opponent is Character) { if (IsInBattleground) { return Battlegrounds.Team == ((Character)opponent).Battlegrounds.Team; } var group = Group; if (group != null && ((Character)opponent).Group == group) { // cannot ally with duelists return DuelOpponent == null && ((Character)opponent).DuelOpponent == null; } } return false; }
public override bool IsFriendlyWith(IFactionMember opponent) { if (IsAlliedWith(opponent)) { return true; } var rep = m_reputations[opponent.Faction.ReputationIndex]; return rep != null && rep.Standing >= Standing.Friendly; }
public virtual bool IsAlliedWith(IFactionMember opponent) { if (HasMaster) { if (ReferenceEquals(Master, opponent)) return true; return Master.IsAlliedWith(opponent); } if ((opponent is WorldObject && ((WorldObject)opponent).HasMaster)) { opponent = ((WorldObject)opponent).Master; } if (ReferenceEquals(opponent, this)) { return true; } if (opponent is Character) { return ((Character)opponent).IsAlliedWith(this); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opponent.Faction) { return true; } if (faction != null && opponent.Faction != null) return faction.Friends.Contains(opFaction); return false; }
/// <summary> /// Indicates whether the 2 units are neutral towards each other. /// </summary> /// <returns></returns> public virtual bool IsAtLeastNeutralWith(IFactionMember opponent) { if (IsFriendlyWith(opponent)) { return true; } var faction = Faction; var opFaction = opponent.Faction; if (faction != null && opFaction != null && faction.Neutrals.Contains(opFaction)) { return true; } return false; }
public void ChangeFaction(IFactionMember factionMember, FactionType newFaction) { factionMember.onFactionChange.Invoke(factionMember, factionMember.faction, newFaction); factionMember.faction = newFaction; }
public bool UserMod(IFactionMember origin, IFactionMember target, FactionType newFaction) { return(true); }
public override bool MayAttack(IFactionMember opponent) { if (ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } if (opponent is Character) { return CanPvP((Character)opponent); } return m_reputations.CanAttack(opponent.Faction); }
public override bool IsHostileWith(IFactionMember opponent) { return m_creator.IsHostileWith(opponent); }
public override bool IsHostileWith(IFactionMember opponent) { if (object.ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } if (opponent is Character) { var chr = (Character)opponent; return CanPvP(chr); } return m_reputations.IsHostile(opponent.Faction); }
public override bool IsAlliedWith(IFactionMember opponent) { return m_creator.IsAlliedWith(opponent); }
public virtual bool MayAttack(IFactionMember opponent) { if (HasMaster) { if (ReferenceEquals(Master, opponent)) return false; return Master.MayAttack(opponent); } if ((opponent is WorldObject && ((WorldObject)opponent).HasMaster)) { opponent = ((WorldObject)opponent).Master; } if (opponent == null) { return false; } if (ReferenceEquals(opponent, this)) { return false; } if (opponent is Character) { return ((Character)opponent).MayAttack(this); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opFaction) { return false; } if (faction != null && opFaction != null && faction.Enemies.Contains(opFaction)) { return true; } return false; }
public override bool IsFriendlyWith(IFactionMember opponent) { return m_creator.IsFriendlyWith(opponent); }
public virtual bool IsInSameDivision(IFactionMember opponent) { if (opponent is Character) { return ((Character)opponent).IsInSameDivision(this); } return IsAlliedWith(opponent); }
public override bool MayAttack(IFactionMember opponent) { // TODO: Sometimes we are hostile with someone but cannot attack return IsHostileWith(opponent); }
public override bool MayAttack(IFactionMember opponent) { if (opponent == this || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } if (opponent is Character) { var chr = (Character)opponent; return CanPvP(chr); } return m_reputations.CanAttack(opponent.Faction); }
/// <summary> /// Indicates whether the 2 units are hostile towards each other. /// </summary> /// <returns></returns> public virtual bool IsHostileWith(IFactionMember opponent) { if ( object.ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } var faction = Faction; var opFaction = opponent.Faction; if (faction == opFaction) { return false; } if (faction != null && opFaction != null && faction.Enemies.Contains(opFaction)) { return true; } if (opponent is Character) { return ((Character)opponent).IsHostileWith(this); } return false; }
public override bool IsFriendlyWith(IFactionMember opponent) { if (IsAlliedWith(opponent)) { return true; } var opFaction = opponent.Faction; var rep = m_reputations[opFaction.ReputationIndex]; if (rep != null) { return rep.Standing >= Standing.Friendly; } return m_faction.IsFriendlyTowards(opFaction); }
public virtual bool MayAttack(IFactionMember opponent) { if (!opponent.IsInWorld || ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } var faction = Faction; var opFaction = opponent.Faction; if (faction == opFaction) { return false; } if (faction != null && opFaction != null) { if (faction.Enemies.Contains(opFaction)) { return true; } if (faction.Friends.Contains(opFaction)) { return false; } } if (opponent is Character) { return ((Character)opponent).MayAttack(this); } return false; }
public override bool IsHostileWith(IFactionMember opponent) { if (ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return false; } if (opponent is Character) { return CanPvP((Character)opponent); } var opFaction = opponent.Faction; if (opponent is NPC && opFaction.Neutrals.Contains(m_faction)) { return ((NPC)opponent).ThreatCollection.HasAggressor(this); } if(m_faction.Friends.Contains(opFaction)) return false; return m_faction.Enemies.Contains(opFaction) && m_reputations.CanAttack(opFaction); }
public virtual bool IsAlliedWith(IFactionMember opponent) { if ( object.ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this) || object.ReferenceEquals(Master, opponent) ) { return true; } if (opponent is Character) { return ((Character)opponent).IsAlliedWith(this); } var faction = Faction; var opFaction = opponent.Faction; if (faction == opponent.Faction) { return true; } if (faction != null && opponent.Faction != null) return faction.Friends.Contains(opFaction); return false; }
public override bool IsInSameDivision(IFactionMember opponent) { if (ReferenceEquals(opponent, this) || (opponent is Unit && ((Unit)opponent).Master == this)) { return true; } if (!(opponent is Character) && opponent is WorldObject) { opponent = ((WorldObject)opponent).Master; } if (opponent is Character) { if (IsInBattleground) { return Battlegrounds.Team == ((Character)opponent).Battlegrounds.Team; } var group = SubGroup; if (group != null && ((Character)opponent).SubGroup == group) { // cannot ally with duelists return DuelOpponent == null && ((Character)opponent).DuelOpponent == null; } } return false; }
public override bool IsNeutralWith(IFactionMember opponent) { return m_master.IsNeutralWith(opponent); }