コード例 #1
0
ファイル: SpellManager.cs プロジェクト: Urthawen/codebreak
        /// <summary>
        ///
        /// </summary>
        /// <param name="spellId"></param>
        /// <param name="spellLevel"></param>
        /// <returns></returns>
        public SpellLevel GetSpellLevel(int spellId, int spellLevel)
        {
            SpellTemplate spell = null;
            SpellLevel    level = null;

            if (m_templateById.TryGetValue(spellId, out spell))
            {
                level = spell.GetLevel(spellLevel);
            }
            return(level);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="activeType"></param>
        /// <param name="fight"></param>
        /// <param name="caster"></param>
        /// <param name="castInfos"></param>
        /// <param name="cell"></param>
        /// <param name="duration"></param>
        /// <param name="actionId"></param>
        /// <param name="canGoThrough"></param>
        /// <param name="canStack"></param>
        /// <param name="hide"></param>
        protected AbstractActivableObject(FightObstacleTypeEnum type, ActiveType activeType, AbstractFight fight, AbstractFighter caster, CastInfos castInfos, int cell, int duration, int actionId, bool canGoThrough, bool canStack, bool hide = false)
        {
            m_fight        = fight;
            m_caster       = caster;
            m_spellId      = castInfos.SpellId;
            m_actionSpell  = SpellManager.Instance.GetTemplate(castInfos.Value1);
            m_actionEffect = m_actionSpell.GetLevel(castInfos.Value2);

            Cell           = fight.GetCell(cell);
            ObstacleType   = type;
            ActivationType = activeType;
            CanGoThrough   = canGoThrough;
            CanStack       = canStack;
            Color          = castInfos.Value3;
            Targets        = new List <AbstractFighter>();
            Length         = Pathfinding.GetDirection(castInfos.RangeType[1]);
            AffectedCells  = new List <FightCell>();
            Duration       = duration;
            ActionId       = actionId;
            Hide           = hide;

            foreach (var effect in m_actionEffect.Effects)
            {
                if (CastInfos.IsDamageEffect(effect.TypeEnum))
                {
                    Priority--;
                }
            }

            // On ajout l'objet a toutes les cells qu'il affecte
            foreach (var cellId in CellZone.GetCircleCells(fight.Map, cell, Length))
            {
                var fightCell = m_fight.GetCell(cellId);
                if (fightCell != null)
                {
                    fightCell.AddObject(this);
                    AffectedCells.Add(fightCell);
                }
            }

            if (Hide)
            {
                Appear(caster.Team);
            }
            else
            {
                AppearForAll();
            }
        }