@Override
    public void doCard(Player player) 
    {
        if (player == null)
            throw new NullPointerException("player is null");
        

        switch (_target) 
        {
            case START:
                
                // move event
                Event playerMoveToStartEvent =
                        EventsFactory.createPlayerMovedEvent(_game.getName(), player, Game.START_SQUARE, Game.TELEPORT_MOVE);
                _game.addEvent(playerMoveToStartEvent);

                player.setPosition(Game.START_SQUARE);
                _game.getSquareByIndex(Game.START_SQUARE).playerArrived(player);
                break;

            case JAIL:
                
                // move and jail events
                Event playerSentToJailEvent 
                        = EventsFactory.createGoToJailEvent(_game.getName(), player.getName());
                Event playerMoveToJailEvent 
                        = EventsFactory.createPlayerMovedEvent(_game.getName(), player, Game.JAIL_OR_FREE_PASS_SQUARE, Game.TELEPORT_MOVE);
                _game.addEvent(playerSentToJailEvent);
                _game.addEvent(playerMoveToJailEvent);

                player.setPosition(Game.GO_TO_JAIL_SQUARE);
                _game.getSquareByIndex(Game.GO_TO_JAIL_SQUARE).playerArrived(player);
                break;

            case NEXT:

                boolean moved = false;
                int playerPos = player.getPosition();
                Square curr = _game.getSquareByIndex(playerPos);

                for (int i = playerPos + 1; moved == false; i++) 
                {
                    i = i % Game.BOARD_SIZE;
                    
                    // if its a surprise and we passed start player gets money
                    if (_type == ActionSquare.SURPRISE) 
                    {
                        // if we passed start
                        if (_game.getSquareByIndex(i) == _game.getSquareByIndex(Game.START_SQUARE)) 
                        {
                            _game.passedStartOnTheWay(player);
                        }
                    }
                    
                    // go to the closest surprise/warrant square
                    if (_game.getSquareByIndex(i) == curr) 
                    {
                        // move event
                        Event playerMoveToNextEvent = 
                                EventsFactory.createPlayerMovedEvent(_game.getName(), player, i, Game.TELEPORT_MOVE);
                        _game.addEvent(playerMoveToNextEvent);

                        player.setPosition(i);
                        _game.getSquareByIndex(i).playerArrived(player);
                        moved = true;
                    }
                }

            default:
                
                break;

        }
    }