zDevelopers / UHPlugin

Plugin UltraHardcore (“Kill the Patrick”), augmenté. | UHC (“KTP”) plugin, improved.
Other
32 stars 24 forks source link

Add a random team generator #18

Open AmauryCarrade opened 10 years ago

AmauryCarrade commented 10 years ago
/uh team generate → doc
/uh team generate players <numberOfPlayersPerTeam> [flags]
/uh team random teams <numberOfTeams> [flags]

Where the flags are the following.

Dev's point of view: something like this.

/**
 * Generates teams.
 *
 * @param type The way the teams are generated.
 * @param count The number of player per team or the number of teams, following the generation type.
 * @param reset If {@code true}, the teams/players in teams are reset and the teams are completely random. Else, only players out of any team are affected.
 * @param fancyNames If {@code true}, generates a name for the team, based on a list of worlds in the `plugins/UHPlugin/` directory. Else, the names are « {color} {random number} » (or only the color, if the name is available).
 * @param noColors If {@code true}, all teams will be white teams. Else, a random color is chosen.
 * 
 * @return A list of the new teams.
 */
List<UHTeam> UHTeamManager.generate(TeamGenerationType type, int count, boolean reset, boolean fancyNames, boolean noColors);

public enum TeamGenerationType {
    /**
     * Given the number of players per team, this will creates the teams needed and
     * adds the players in the teams to respect this count.
     * 
     * There may be a team with less players in it, if a perfect generation is not possible.
     */
    PLAYERS_IN_TEAMS,

    /**
     * Given the number of teams, this will creates the teams needed and
     * divides the players in these teams.
     * 
     * There may be a team with less players in it, if a perfect generation is not possible.
     */
    TEAMS_FOR_PLAYERS;
}
theminecoder commented 9 years ago

Can we have this in the api and with another option to only randomize the players that have not currently joined a team.

AmauryCarrade commented 9 years ago

with another option to only randomize the players that have not currently joined a team.

Good idea, I'll add this feature.

By the way, all these generators will be available through the API.

AmauryCarrade commented 9 years ago

I added the API I'll probably use in the description of the issue.

AmauryCarrade commented 9 years ago

This will be moved on the next version, because it's a nontrivial component with tests and I want to release a stable version :p .

This will be one of the first things I'll do in the 1.4.

AmauryCarrade commented 7 years ago

This will be one of the first things I'll do in the 1.4.

That's what he said.

s/1.4/1.6/

In addition to the above, it would be a good idea to add configuration options so the teams are automatically generated when the game starts.