src/main/java/cursor/rybak/game/UserInteraction.java
/**
     * upgrade particular hero's characteristic
     *
     * @param remainedPoints total points
     * @param characteristic concrete key needs to upgrade
     * @param hero           instance of particular hero
     * @return remained points
     */
upgrade particular hero's characteristic
@param remainedPoints total points
@param characteristic concrete key needs to upgrade
@param hero           instance of particular hero
@return remained points
upgrade particular hero ' s characteristic @param remainedPoints total points @param characteristic concrete key needs to upgrade @param hero instance of particular hero @return remained points
private static int upgradeHeroKey(int remainedPoints, String characteristic, AbstractRace hero) {
        while (true) {
            String userInput = in.nextLine();
            if (!userInput.isEmpty()
                    && userInput.matches("\\d+")
                    && parseInt(userInput) > 0
                    && parseInt(userInput) <= remainedPoints) {
                updateXp(hero, parseInt(userInput));
                upgradeCharacteristic(characteristic, hero, parseInt(userInput));
                remainedPoints -= parseInt(userInput);
                Message.printUpgradeInfo(userInput, characteristic, hero.getHeroName());
                if (remainedPoints != 0) Message.printRemainedInfo(remainedPoints);
                return remainedPoints;
            } else {
                ErrorMessage.errorOutOfBound(remainedPoints);
            }
        }
    }
private static int upgradeHeroKey ( int remainedPoints , String characteristic , AbstractRace hero ) { while ( true ) { String userInput = in . nextLine ( ) ; if ( ! userInput . isEmpty ( ) && userInput . matches ( "\\d+" ) && parseInt ( userInput ) > 0 && parseInt ( userInput ) <= remainedPoints ) { updateXp ( hero , parseInt ( userInput ) ) ; upgradeCharacteristic ( characteristic , hero , parseInt ( userInput ) ) ; remainedPoints -= parseInt ( userInput ) ; Message . printUpgradeInfo ( userInput , characteristic , hero . getHeroName ( ) ) ; if ( remainedPoints != 0 ) Message . printRemainedInfo ( remainedPoints ) ; return remainedPoints ; } else { ErrorMessage . errorOutOfBound ( remainedPoints ) ; } } }
upgrade particular hero's characteristic
 @param remainedPoints total points
 @param characteristic concrete key needs to upgrade
 @param hero           instance of particular hero
 @return remained points
upgrade particular hero ' s characteristic @param remainedPoints total points @param characteristic concrete key needs to upgrade @param hero instance of particular hero @return remained points