public CharacterFeatures GetEnemy(CharacterFeatures fighter) { CharacterFeatures enemy; if (fighter is Pretre) { enemy = Fighters.FirstOrDefault(x => x.IsUndead); if (enemy != null) { return(enemy); } } do { var otherFighters = Fighters .Where(x => x.Id != fighter.Id && !x.IsDead() && x.CurrentLife > 0 && !x.IsHide).ToList(); //AfficherListeEnnemi(otherFighters); if (otherFighters.Count == 0) { otherFighters = Fighters .Where(x => x.Id != fighter.Id && !x.IsDead() && x.CurrentLife > 0 && x.IsHide).ToList(); } var randomEnemy = Random.Next(otherFighters.Count(f => f.Id != fighter.Id && !f.IsDead())); enemy = otherFighters[randomEnemy]; } while (enemy.Id == fighter.Id); return(enemy); }
public void AddStatus(Status status) { IEnumerable <IFighter> aliveFighters = Fighters.Where(f => f.IsAlive()); foreach (IFighter fighter in aliveFighters) { fighter.AddStatus(status); } }
internal void SetIsEnabled(Fighter swipedFighter) { if (swipedFighter != null) { Fighters.Where(o => o.Name != swipedFighter.Name).ForEach(o => o.IsEnabled = false); // I Disable all SwipeViews excepts the one selected } else { Fighters.Where(o => o.IsEnabled == false).ForEach(o => o.IsEnabled = true); // I enable all SwipeViews } }
public CharacterFeatures GetDeadEnemy(CharacterFeatures fighter) { CharacterFeatures enemy; do { var otherFighters = Fighters.Where(x => x.Id != fighter.Id && x.IsDead() && !x.IsDevoured).ToList(); var randomEnemy = Random.Next(otherFighters.Count(f => f.Id != fighter.Id)); enemy = otherFighters[randomEnemy]; } while (enemy.Id == fighter.Id); return(enemy); }
public override FighterRefusedReasonEnum CanJoin(Character character) { if (IsRestrictedToParty) { if (!Leader.Character.IsInParty(PartyTypeEnum.PARTY_TYPE_CLASSICAL) || !Leader.Character.Party.IsInGroup(character)) { return(FighterRefusedReasonEnum.TEAM_LIMITED_BY_MAINCHARACTER); } } if (Fight.IsMultiAccountRestricted && Fighters.Where(x => x is CharacterFighter).Any(x => (x as CharacterFighter).Character.Client.IP == character.Client.IP)) { return(FighterRefusedReasonEnum.MULTIACCOUNT_NOT_ALLOWED); } return(base.CanJoin(character)); }
public override FighterRefusedReasonEnum CanJoin(Character character) { if (Fight is FightPvT fightPvT && character.Guild == fightPvT.TaxCollector.TaxCollectorNpc.Guild) { return(FighterRefusedReasonEnum.WRONG_GUILD); } if (Fighters.Where(x => x is CharacterFighter).Any(x => (x as CharacterFighter).Character.Client.IP == character.Client.IP)) { return(FighterRefusedReasonEnum.MULTIACCOUNT_NOT_ALLOWED); } if (Fighters.Count >= FightPvT.PvTMaxFightersSlots) { return(FighterRefusedReasonEnum.TEAM_FULL); } return(base.CanJoin(character)); }