generate General from tradition

Issue #7 resolved
Guanlong created an issue

I have code ready to generate a general from tradition:

public void generate (int tradition)
    // calculate pipPool
    int pipPool;
    pipPool = java.util.concurrent.ThreadLocalRandom.current().nextInt(6) + 1;
    pipPool += tradition / 20.0;
    for (int tempTradition = tradition; tempTradition > 0; tempTradition -= 20){
        if (java.util.concurrent.ThreadLocalRandom.current().nextInt(100) < tempTradition){
            pipPool += 1;
        }
    }
    if (java.util.concurrent.ThreadLocalRandom.current().nextInt(100) < 50){
        pipPool++;
    }

    // distribute pipPool
    while (pipPool > 10){
        fire++;
        shock++;
        maneuver++;
        siege++;
        pipPool-=4;
    }
    int increaseTarget;
    while (pipPool > 0){
        increaseTarget = java.util.concurrent.ThreadLocalRandom.current().nextInt(10);
        if (increaseTarget == 0 && siege < 6){
            siege++;
            pipPool--;
        } else if (increaseTarget < 4 && shock < 6){
            shock++;
            pipPool--;
        } else if (increaseTarget < 7 && fire < 6){
            fire++;
            pipPool--;
        } else if (maneuver < 6){
            maneuver++;
            pipPool--;
        }
    }
}

If you want to combine it with pip bonuses from ideas, the bonuses should be applied first and the generation should run second.

PS: still figuring out how source control works and how to initiate a pull request.

Comments (2)

  1. OceanFlex

    The best way to initiate a pull request is to fork the reposetory, then modify your fork, then click "create pull request" on the sidebar of this repo. Choose your fork on the right, select appropriate branches. I don't think you can pull without a fork.

  2. Log in to comment