コード例 #1
0
        public virtual void Move(List <short> keys, short cellid, sbyte direction)
        {
            if (Fight.Ended)
            {
                return;
            }

            List <short> path = Pathfinding.FightMove(PathParser.ReturnDispatchedCells(keys)).Keys.ToList();

            path.Insert(0, CellId);
            path = CheckMarks(path);
            ApplyFighterEvent(FighterEventType.BEFORE_MOVE, path);
            this.Fight.TryStartSequence(ContextualId, 5);
            this.Fight.Send(new GameMapMovementMessage(path, ContextualId));
            this.AddToLastPosition(path);
            short mpcost = (short)PathHelper.GetDistanceBetween(CellId, path.Last());

            FighterStats.Stats.MovementPoints -= mpcost;
            this.CellId    = path.Last();
            this.Direction = direction;
            RefreshStats();
            GameActionFightPointsVariation(ActionsEnum.ACTION_CHARACTER_MOVEMENT_POINTS_USE, (short)-mpcost);
            this.Fight.TryEndSequence(5, 5);
            ApplyFighterEvent(FighterEventType.AFTER_MOVE, mpcost, path);
            if (CharacterRecord.GetCharacterRecordById(this.ContextualId) != null && CharacterRecord.GetCharacterRecordById(this.ContextualId).GodMod)
            {
                FighterStats.Stats.MovementPoints += mpcost;
                GameActionFightPointsVariation(ActionsEnum.ACTION_CHARACTER_MOVEMENT_POINTS_WIN, (short)mpcost);
            }
        }
コード例 #2
0
 public static void HandleMapMovementRequest(GameMapMovementRequestMessage message, WorldClient client)
 {
     if (client.Character.Fighting)
     {
         if (client.Character.Fighter.Fight.Started && client.Character.Fighter.IsFighterTurn)
         {
             List <short> path = PathParser.FightMove(PathParser.ReturnDispatchedCells(message.keyMovements)).Keys.ToList();
             path.Insert(0, client.Character.Fighter.CellId);
             client.Character.Fighter.Move(path);
         }
     }
     else
     {
         if (!client.Character.ChangeMap && client.Character.Map.Id == message.mapId && !client.Character.Collecting)
         {
             client.Character.MoveOnMap(message.keyMovements);
         }
         else
         {
             client.Character.NoMove();
         }
     }
 }