Exemple #1
0
        private bool CanUseIdol(PlayerIdol idol, FightPvM fight)
        {
            if (!idol.Template.IdolSpellId.HasValue)
            {
                return(false);
            }
            else if (ActiveIdols.Count(x => x.Id == idol.Id) > 1)
            {
                return(false);
            }
            else if (fight.MonsterTeam.Fighters.OfType <MonsterFighter>().Any(x => idol.Template.IncompatibleMonsters.Contains(x.Monster.Template.Id)))
            {
                return(false);
            }
            else if (fight.MonsterTeam.Fighters.OfType <MonsterFighter>().Any(x => x.Monster.Template.AllIdolsDisabled))
            {
                return(false);
            }
            else if (idol.Template.GroupOnly && (fight.PlayerTeam.Fighters.Count < 4 || fight.MonsterTeam.Fighters.Count < 4))
            {
                return(false);
            }
            else if (!idol.Owner.Inventory.HasItem(idol.Template.IdolItem))
            {
                return(false);
            }
            else if (!idol.Owner.IsInFight() || idol.Owner.Fight.Id != fight.Id)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public bool Remove(PlayerIdol idol)
        {
            var result = ActiveIdols.Remove(idol);

            if (!result)
            {
                return(false);
            }

            IdolHandler.SendIdolSelectedMessage(IsPartyIdols ? Party.Clients : Owner.Client, false, IsPartyIdols, (short)idol.Id);

            if (!Owner.IsInFight() || Owner.Fight.State != FightState.Placement)
            {
                return(true);
            }

            IdolHandler.SendIdolFightPreparationUpdate(Owner.Fight.Clients, ActiveIdols.Select(x => x.GetNetworkIdol()));

            return(true);
        }