Exemplo n.º 1
0
        public static void TryCast(MonsterFighter fighter, ushort spellid, Fighter target)
        {
            var level = fighter.GetSpellLevel(spellid);

            if (target != null && fighter.FighterStats.Stats.ActionPoints - level.ApCost >= 0)
            {
                var refreshedTarget = fighter.Fight.GetFighter(target.CellId);
                if (refreshedTarget != null && !fighter.HaveCooldown((short)spellid) && fighter.CanCast(target.CellId, level, refreshedTarget))
                {
                    fighter.CastSpellOnCell(spellid, target.CellId);
                }
            }
        }
        public override void Execute(MonsterFighter fighter)
        {
            var summonSpell = fighter.Template.Spells.ConvertAll <SpellRecord>(x => SpellRecord.GetSpell(x)).Find(x => x.Category == SpellCategoryEnum.Summon);

            if (summonSpell != null && fighter.SummonCount <= 1)
            {
                var cells = ShapesProvider.GetSquare(fighter.CellId, false);
                var cell  = cells.Find(x => !fighter.Fight.IsObstacle(x));
                if (cell != 0)
                {
                    fighter.CastSpellOnCell(summonSpell.Id, cell);
                }
                else
                {
                    fighter.Fight.Reply("Unable to summon");
                }
            }
        }