示例#1
0
        public Views.PickResult Picks_PickPassive(Views.EntityUniquePassives passive)
        {
            if (GameServer.GetScene().Mode != SceneMode.Pick)
            {
                return(Views.PickResult.NotYourTurn);
            }
            bool myTurn          = GameServer.GetScene().PickControler.IsMyTurn(Hero.ID);
            bool isPickingActive = GameServer.GetScene().PickControler.IsPickingActive();

            Entities.EntityUniquePassives p = (Entities.EntityUniquePassives)passive;
            if (!myTurn || isPickingActive)
            {
                return(Views.PickResult.NotYourTurn);
            }

            return((Views.PickResult)GameServer.GetScene().PickControler.PickPassiveSpell(this.Hero.ID, p));
        }
示例#2
0
        /// <summary>
        /// Si c'est le tour du héros donné, pick le spell donné pour ce héros et retourne true.
        /// Si ce n'est pas le tour du héros donné, ou que le spell dont l'id est donné n'existe pas,
        /// retourne false.
        /// </summary>
        public PickResult PickPassiveSpell(int heroId, Entities.EntityUniquePassives spellId)
        {
            // Vérification : l'appel de fonction doit venir du client correspondant au
            // héros.
            if (heroId != GetPickingHeroId() || IsReadyToGo())
            {
                return(PickResult.NotYourTurn);
            }

            bool isPickingActive = IsPickingActive();

            if (isPickingActive)
            {
                return(PickResult.InvalidOperation);
            }

            if (!m_passiveSpells.Contains(spellId))
            {
                return(PickResult.SpellNotAvailable);
            }


            // Marque le dernier temps de réponse.
            m_lastControlerUpdate = DateTime.Now;
            string iaName = m_scene.GetControlerByHeroId(heroId).HeroName;

            // Ajoute le spell au héros
            m_scene.GetControlerByHeroId(heroId).Hero.UniquePassive = spellId;
            // Affiche la compétence choisie.
            m_currentMessage = iaName + " a choisi la compétence passive '" + spellId.ToString() + "'.";
            // Supprime le spell de la liste.
            m_passiveSpells.Remove(spellId);


            m_lastControlerUpdate = DateTime.Now;
            m_pickTurn++;
            return(PickResult.Success);
        }