Exemplo n.º 1
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            if (!DamageInfos.IsCAC)
            {
                return(-1);
            }

            DamageValue = 0; // Annihilation des dommages;

            var SubInfos  = new EffectCast(EffectEnum.PushBack, 0, 0, 0, 0, 0, 0, 0, DamageInfos.Caster, null);
            var Direction = Pathfinder.GetDirection(Target.Fight.Map, DamageInfos.Caster.CellId, Target.CellId);

            // Application du push
            return(EffectPush.ApplyPush(SubInfos, this.Target, Direction, 1, true));
        }
Exemplo n.º 2
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.ObjectType == FightObjectType.OBJECT_STATIC)
                {
                    continue;
                }

                int Direction = 0;

                switch (CastInfos.EffectType)
                {
                case EffectEnum.PushBack:
                    if (Pathfinder.InLine(Target.Fight.Map, CastInfos.CellId, Target.CellId) && CastInfos.CellId != Target.CellId)
                    {
                        Direction = Pathfinder.GetDirection(Target.Fight.Map, CastInfos.CellId, Target.CellId);
                    }
                    else if (Pathfinder.InLine(Target.Fight.Map, CastInfos.Caster.CellId, Target.CellId))
                    {
                        Direction = Pathfinder.GetDirection(Target.Fight.Map, CastInfos.Caster.CellId, Target.CellId);
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case EffectEnum.PushFront:
                    Direction = Pathfinder.GetDirection(Target.Fight.Map, Target.CellId, CastInfos.Caster.CellId);
                    break;
                }

                if (EffectPush.ApplyPush(CastInfos, Target, Direction, CastInfos.Value1) == -3)
                {
                    return(-3);
                }
            }

            return(-1);
        }
Exemplo n.º 3
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            int  Direction = 0;
            char d         = Pathfinder.getDirBetweenTwoCase(CastInfos.Caster.CellId, CastInfos.CellId, CastInfos.Caster.Fight.Map, true);
            int  tcellID   = Pathfinder.DirToCellID(CastInfos.Caster.CellId, d, CastInfos.Caster.Fight.Map, true);

            var cell = CastInfos.Caster.Fight.GetCell(tcellID);

            Logger.Error("Cell => " + cell);
            if (cell == null)
            {
                return(-1);
            }

            if (!cell.HasGameObject(FightObjectType.OBJECT_FIGHTER))
            {
                return(-1);
            }

            var Target = cell.GetObjects <Fighter>().FirstOrDefault();

            if (Target.ObjectType == FightObjectType.OBJECT_STATIC)
            {
                return(-1);
            }
            Logger.Error("TargetName => " + Target.Name);

            Direction = Pathfinder.GetDirection(Target.Fight.Map, CastInfos.Caster.CellId, Target.CellId);
            Logger.Error("Direction => " + Direction);

            if (EffectPush.ApplyPush(CastInfos, Target, Direction, Pathfinder.GoalDistance(Target.Fight.Map, Target.CellId, CastInfos.CellId)) == -3)
            {
                return(-3);
            }

            return(-1);
        }
Exemplo n.º 4
0
        public static int ApplyPush(EffectCast CastInfos, Fighter Target, int Direction, int Length, bool isDerobade = false)
        {
            var GameAction = (int)GameActionTypeEnum.MAP_PUSHBACK;
            var LastCell   = Target.Cell;

            for (int i = 0; i < Length; i++)
            {
                if (isDerobade && i != 0)
                {
                    continue;
                }
                var NextCell = Target.Fight.GetCell(Pathfinder.NextCell(Target.Fight.Map, LastCell.Id, Direction));
                if (LastCell.HasGameObject(FightObjectType.OBJECT_TRAP) && i > 0)
                {
                    break;
                }
                if (NextCell != null && NextCell.IsWalkable())
                {
                    // Un objet deriere lui ?
                    if (NextCell.HasGameObject(FightObjectType.OBJECT_FIGHTER) || NextCell.HasGameObject(FightObjectType.OBJECT_STATIC) || Target.States.HasState(FighterStateEnum.STATE_ENRACINER))
                    {
                        if (i != 0)
                        {
                            Target.Fight.SendToFight(new GameActionMessage(GameAction, Target.ActorId, Target.ActorId + "," + LastCell.Id));

                            var PushTime = 200 + (i * 200);

                            System.Threading.Thread.Sleep(PushTime);

                            // Affecte la cell
                            var CellResult = Target.SetCell(LastCell);

                            LastCell.GetObjects <FightGroundLayer>().ForEach(x => x.onWalkOnLayer(Target, LastCell));

                            // Persos mort ou fin de combat ?
                            if (CellResult == -3 || CellResult == -2)
                            {
                                return(CellResult);
                            }
                        }

                        // Application des dommages
                        if (CastInfos.EffectType == EffectEnum.PushBack)
                        {
                            return(EffectPush.ApplyPushBackDamages(CastInfos, Target, Length, i));
                        }

                        return(-1);
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        Target.Fight.SendToFight(new GameActionMessage(GameAction, Target.ActorId, Target.ActorId + "," + LastCell.Id));

                        var PushTime = 200 + (i * 200);

                        System.Threading.Thread.Sleep(PushTime);

                        // Affecte la cell
                        var CellResult = Target.SetCell(LastCell);

                        LastCell.GetObjects <FightGroundLayer>().ForEach(x => x.onWalkOnLayer(Target, LastCell));

                        // Persos mort ou fin de combat ?
                        if (CellResult == -3 || CellResult == -2)
                        {
                            return(CellResult);
                        }
                    }

                    // Application des dommages
                    if (CastInfos.EffectType == EffectEnum.PushBack)
                    {
                        return(EffectPush.ApplyPushBackDamages(CastInfos, Target, Length, i));
                    }

                    return(-1);
                }

                LastCell = NextCell;
            }

            Target.Fight.SendToFight(new GameActionMessage(GameAction, Target.ActorId, Target.ActorId + "," + LastCell.Id));

            if (Length > 0)
            {
                System.Threading.Thread.Sleep(200 + (Length * 200));
                var CallResult = Target.SetCell(LastCell);
                LastCell.GetObjects <FightGroundLayer>().ForEach(x => x.onWalkOnLayer(Target, LastCell));
                return(CallResult);
            }
            return(-1);
        }