public static void Teleport(Fight fight, Fighter caster, int cell)
 {
     if (fight.GetFighterOnCell(cell) == null)
     {
         fight.Send("GA0;4;" + caster.ID + ";" + caster.ID + "," + cell);
         caster.CellID = cell;
     }
 }
 public static void SummonCreature(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID)
 {
     if (fight.GetFighterOnCell(cellID) == null)
     {
         Database.Records.MonstersTemplateRecord template = World.Helper.MonsterHelper.GetMonsterTemplate(effect.Value);
         if (template != null)
         {
             Database.Records.MonsterLevelRecord level = template.Levels.FirstOrDefault(x => x.Level == spellLevel.Level);
             if (level != null)
             {
                 Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, level, null);
                 summonedCreature.CellID = cellID;
                 summonedCreature.SummonOwner = caster.ID;
                 summonedCreature.IsInvoc = true;
                 fight.CurrentEntityTempID--;
                 fight.AddPlayer(summonedCreature, caster.Team.ID, cellID);
                 fight.TimeLine.RemixTimeLine();
                 fight.TimelineDisplay();
             }
         }
     }
 }
        public static void PushFront(Fight fight, Fighter caster, List<Fighter> targets, int cellID, Engines.Spells.SpellEffect effect)
        {
            int power = effect.Value;
            foreach (Fighter target in targets)
            {
                int dirPush = 0;
                if (target.CellID != cellID)
                {
                    dirPush = fight.Map.PathfindingMaker.GetDirection(target.CellID, cellID);
                }
                else
                {
                    dirPush = fight.Map.PathfindingMaker.GetDirection(target.CellID, caster.CellID);
                }

                int remoteCell = Engines.Pathfinding.GetRemoteCaseInThisDir(dirPush, power, target.CellID, fight.Map.Map);
                List<int> cellsPushed = Engines.Pathfinding.GetAllCellsForThisLinePath(dirPush, target.CellID, remoteCell, fight.Map.Map);

                foreach (int cell in cellsPushed)
                {
                    Fighter fighterOnCell = fight.GetFighterOnCell(cell);
                    if (fighterOnCell != null) break;
                    if (!fight.Map.IsFree(cell)) break;
                    target.CellID = cell;
                }

                target.Team.Fight.Send("GA0;5;" + caster.ID + ";" + target.ID + "," + target.CellID);
            }
        }
        public static void PushFear(Fight fight, Fighter caster, int cellID, Engines.Spells.SpellEffect effect)
        {
            int dirPush = 0;

            if (caster.CellID != cellID)
            {
                dirPush = fight.Map.PathfindingMaker.GetDirection(caster.CellID, cellID);
            }
                else
            {
                dirPush = fight.Map.PathfindingMaker.GetDirection(caster.CellID, caster.CellID);
            }

            int nextCell = fight.Map.PathfindingMaker.NextCell(caster.CellID, dirPush);
            int power = fight.Map.PathfindingMaker.GetDistanceBetween(nextCell, cellID);

            Fighter target = fight.GetFighterOnCell(nextCell);
            if (target != null)
            {
                List<int> cellsPushed = Engines.Pathfinding.GetAllCellsForThisLinePath(dirPush, target.CellID, fight.Map.PathfindingMaker.NextCell(cellID, dirPush), fight.Map.Map);

                foreach (int cell in cellsPushed)
                {
                    Fighter fighterOnCell = fight.GetFighterOnCell(cell);
                    if (fighterOnCell != null) break;
                    if (!fight.Map.IsFree(cell)) break;
                    target.CellID = cell;
                }

                target.Team.Fight.Send("GA0;5;" + caster.ID + ";" + target.ID + "," + target.CellID);
            }
        }
        public static void PushBack(Fight fight, Fighter caster, List<Fighter> targets, int cellID, Engines.Spells.SpellEffect effect)
        {
            int power = effect.Value;
            foreach (Fighter target in targets)
            {
                int dirPush = 0;
                if (target.CellID != cellID)
                {
                    dirPush = fight.Map.PathfindingMaker.GetDirection(cellID, target.CellID);
                }
                else
                {
                    dirPush = fight.Map.PathfindingMaker.GetDirection(caster.CellID, target.CellID);
                }

                int remoteCell = Engines.Pathfinding.GetRemoteCaseInThisDir(dirPush, power, target.CellID, fight.Map.Map);
                List<int> cellsPushed = Engines.Pathfinding.GetAllCellsForThisLinePath(dirPush, target.CellID, remoteCell, fight.Map.Map);

                if (target.ByWearFighter == null)
                {
                    foreach (int cell in cellsPushed)
                    {
                        if (target.IsDead)
                            break;
                        Fighter fighterOnCell = fight.GetFighterOnCell(cell);
                        if (fighterOnCell != null)
                        {
                            target.TakeDamages(target.ID, -(power * 10), 0);
                            fighterOnCell.TakeDamages(fighterOnCell.ID, -(power * 7), 0);
                            break;
                        }
                        if (!fight.Map.IsFree(cell))
                        {
                            target.TakeDamages(target.ID, -(power * 10), 0);
                            break;
                        }
                        target.CellID = cell;
                    }
                }
                if (target.WearedFighter != null)
                {
                    target.WearedFighter.CellID = target.CellID;
                }

                target.Team.Fight.Send("GA0;5;" + caster.ID + ";" + target.ID + "," + target.CellID);
            }
        }
 public static void LaunchWeared(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets, int cellID)
 {
     if (fight.GetFighterOnCell(cellID) == null)
     {
         if (caster.WearedFighter != null)
         {
             caster.WearedFighter.CellID = cellID;
             caster.WearedFighter.UnWear();
             fight.Send("GA0;51;" + caster.ID + ";" + cellID);
         }
         else
         {
             fight.Send("GA;950;" + caster.ID + ";" + caster.ID + "," + (int)FighterState.Porteur + ",0");
             caster.WearedFighter = null;
             fight.Send("GA0;51;" + caster.ID + ";" + cellID);
         }
     }
 }