Example #1
0
 public override void Execute()
 {
     foreach (var effect in CUSTOM_EFFECTS)
     {
         Zone zone    = effect.GetZone(CastPoint.OrientationTo(Source.Point, false));
         var  targets = SpellEffectsManager.Instance.GetAffectedFighters(Source, zone, CastPoint, effect.TargetMask);
         Handler(effect, CastPoint, targets);
     }
 }
Example #2
0
        public override void Execute()
        {
            var zone = new Zone(ZONE_SHAPE, ZONE_RADIUS, CastPoint.OrientationTo(Source.Point, false));

            foreach (var effect in GetEffects())
            {
                var targets = SpellEffectsManager.Instance.GetAffectedFighters(Source, zone, CastPoint, effect.TargetMask);
                Handler(effect, CastPoint, targets);
            }
        }
Example #3
0
        protected override bool InternalApply()
        {
            var orientation = CastPoint.OrientationTo(TargetedPoint);
            var target      = Fight.GetFirstFighter <FightActor>(entry => entry.Position.Cell.Id == CastPoint.GetCellInDirection(orientation, 1).CellId);

            if (target == null)
            {
                return(false);
            }

            if (!target.CanBePushed())
            {
                return(false);
            }

            var startCell = target.Cell;
            var endCell   = TargetedCell;
            var cells     = new MapPoint(startCell).GetCellsOnLineBetween(TargetedPoint);

            for (var index = 0; index < cells.Length; index++)
            {
                var cell = cells[index];
                if (!Fight.IsCellFree(Fight.Map.Cells[cell.CellId]))
                {
                    endCell = index > 0 ? Fight.Map.Cells[cells[index - 1].CellId] : startCell;
                    break;
                }

                if (!Fight.ShouldTriggerOnMove(Fight.Map.Cells[cell.CellId], target))
                {
                    continue;
                }

                endCell = Fight.Map.Cells[cell.CellId];
                break;
            }

            if (target.IsCarrying())
            {
                target.ThrowActor(Map.Cells[startCell.Id], true);
            }

            if (target.IsAlive())
            {
                foreach (var character in Fight.GetCharactersAndSpectators().Where(target.IsVisibleFor))
                {
                    ActionsHandler.SendGameActionFightSlideMessage(character.Client, Caster, target, startCell.Id, endCell.Id);
                }
            }

            target.Cell = endCell;
            target.TriggerBuffs(Caster, BuffTriggerType.OnMoved);

            return(true);
        }
Example #4
0
        protected override bool InternalApply()
        {
            var distance  = CastPoint.ManhattanDistanceTo(TargetedPoint);
            var direction = CastPoint.OrientationTo(TargetedPoint, false);
            var isEven    = (short)direction % 2 == 0;

            Caster.Position.Cell = TargetedCell;

            Caster.SetInvisibilityState(GameActionFightInvisibilityStateEnum.INVISIBLE);

            Fight.ForEach(entry => ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(entry.Client, Caster, Caster,
                                                                                              entry.Fighter.IsFriendlyWith(Caster) ? TargetedCell : new Cell {
                Id = -1
            }), false);

            foreach (var dir in (DirectionsEnum[])Enum.GetValues(typeof(DirectionsEnum)))
            {
                if (isEven != ((short)dir % 2 == 0))
                {
                    continue;
                }

                var cell = CastPoint.GetCellInDirection(dir, (short)distance);
                if (cell == null)
                {
                    continue;
                }

                var dstCell = Map.GetCell(cell.CellId);

                if (dstCell == null)
                {
                    continue;
                }

                if ((!Fight.IsCellFree(dstCell) && dstCell != TargetedCell) || !dstCell.Walkable)
                {
                    continue;
                }

                var summon = new SummonedImage(Fight.GetNextContextualId(), Caster, dstCell)
                {
                    SummoningEffect = this
                };

                foreach (var character in Fight.GetAllCharacters(true))
                {
                    if (direction != dir || character.Fighter == null || !character.Fighter.IsFriendlyWith(Caster))
                    {
                        ActionsHandler.SendGameActionFightSummonMessage(character.Client, summon);
                    }
                }

                Caster.AddSummon(summon);
                Caster.Team.AddFighter(summon);

                Fight.TriggerMarks(summon.Cell, summon, TriggerType.MOVE);
            }

            return(true);
        }