Example #1
0
        public void PlayerWantMove(Fighter fighter, string path)
        {
            if (this.State == FightState.Fighting && this.TimeLine.CurrentFighter.ID == fighter.ID)
            {
                Engines.Pathfinding pathfinding = new Engines.Pathfinding(path, this.Map.Map,
                                                                        fighter.CellID, fighter.Dir);

                int distance = pathfinding.GetDistanceBetween(fighter.CellID, pathfinding.Destination);

                if (fighter.CurrentMP >= distance)
                {
                    string remakePath = pathfinding.GetStartPath + pathfinding.RemakePath();

                    if (fighter.ByWearFighter != null)
                    {
                        fighter.UnWear();
                    }

                    fighter.Send("GAS" + fighter.ID);
                    this.Send("GA0;1;" + fighter.ID + ";" + remakePath);

                    /* Remove MP */
                    fighter.CurrentMP -= distance;

                    fighter.NextCell = pathfinding.Destination;
                    fighter.NextDir = pathfinding.NewDirection;
                }
                else
                {
                    fighter.Send("BN");
                }
            }
            else
            {
                fighter.Send("BN");
            }
        }