Skip to content

Commit

Permalink
competitive mode from lobby options
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Mar 6, 2023
1 parent 5b47691 commit 69bdb23
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 18 deletions.
25 changes: 25 additions & 0 deletions sc2randomizer.SC2Mod/Attributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Attributes>
<Attribute>
<Id Value="1"/>
<Type Value="Global"/>
<Name Value="Attribute001/Name"/>
<Availability Value="All"/>
<Visibility Value="All"/>
<Access Value="Host"/>
<Value>
<Id Value="1"/>
<Name Value="Attribute001/Value001/Name"/>
</Value>
<Value>
<Id Value="2"/>
<Name Value="Attribute001/Value002/Name"/>
<Description Value="Attribute001/Value002/Desc"/>
</Value>
<Default>
<Slot Id="Global"/>
<Value Id="1"/>
</Default>
</Attribute>
<DefaultVariants Value="1"/>
</Attributes>
Binary file added sc2randomizer.SC2Mod/Attributes.version
Binary file not shown.
1 change: 1 addition & 0 deletions sc2randomizer.SC2Mod/ComponentList.SC2Components
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<DataComponent Type="text" Locale="enUS">GameText</DataComponent>
<DataComponent Type="info">DocumentInfo</DataComponent>
<DataComponent Type="trig">Triggers</DataComponent>
<DataComponent Type="attr">Attributes</DataComponent>
</Components>
Binary file modified sc2randomizer.SC2Mod/DocumentHeader
Binary file not shown.
Binary file modified sc2randomizer.SC2Mod/GameText.version
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
DocInfo/DescLong=This is an extension mod that randomizes the stats of units for StarCraft 2 multiplayer. Now you can blame your losses on RNG! See if you can find a seed more balanced than the real game.<n/><n/>Created by Raymonster aka Die4Ever
Attribute001/Name=Randomizer Mode
Attribute001/Value001/Name=Normal
Attribute001/Value002/Desc=Competitive Mode skips the host's settings screen since they will likely be a spectator, 3 factions, 1 ban, and longer timeouts on the menus.
Attribute001/Value002/Name=Competitive Mode
DocInfo/DescLong=This is an extension mod that randomizes the stats of units for StarCraft 2 multiplayer. Now you can blame your losses on RNG! See if you can find a seed more balanced than the real game.<n/><n/>Created by Raymonster aka Die4Ever
DocInfo/DescShort=Any
DocInfo/HowToPlayBasic00=If bans are enabled, ban what faction(s) you think are the strongest! Your bans only affect your opponents.
DocInfo/HowToPlayBasic01=Then you will pick which faction you think is the strongest from whatever wasn't banned.
Expand Down
1 change: 1 addition & 0 deletions sc2randomizer.SC2Mod/scripts/globals.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int min_starting_workers;
int max_starting_workers;
fixed buffs_nerfs;
bool crowd_control_enabled = false;
string rando_mode = "normal";

bool[max_factions * 4 * 16] players_bans;
int[16] players_picks;
Expand Down
40 changes: 23 additions & 17 deletions sc2randomizer.SC2Mod/scripts/gui.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ bool review_button_pressed(bool testConds, bool runActions) {
int create_dialog_pick_faction() {
playergroup players;
int button;
int timeout_minutes = 3;

info("create_dialog_pick_faction");
if( num_factions <= 1 ) {
Expand All @@ -491,6 +492,10 @@ int create_dialog_pick_faction() {
return 0;
}

if(rando_mode=="competitive") {
timeout_minutes = 5;
}

players = PlayerGroupAll();

dialog_pick_faction = DialogCreate(500, 500, c_anchorCenter, 0, 0, true);
Expand Down Expand Up @@ -521,8 +526,8 @@ int create_dialog_pick_faction() {
TriggerDestroy(dialog_timeout);
dialog_timeout = TriggerCreate("review_timeout");

TriggerAddEventTimeElapsed( dialog_timeout, 180, c_timeReal );
DialogControlAddItem(changes_list, players, StringToText("You have 3 minutes to choose") );
TriggerAddEventTimeElapsed( dialog_timeout, timeout_minutes*60, c_timeReal );
DialogControlAddItem(changes_list, players, StringToText("You have "+IntToString(timeout_minutes)+" minutes to choose") );
DialogControlAddItem(changes_list, players, StringToText("You are allowed to change your choice while this menu is open") );

DialogSetVisible(dialog_pick_faction, players, true);
Expand Down Expand Up @@ -551,8 +556,10 @@ void start_pick_factions() {
}

clear_waiting();
DialogSetVisible(dialog_bans, PlayerGroupAll(), false);
DialogDestroy(dialog_bans);
if(dialog_bans) {
DialogSetVisible(dialog_bans, PlayerGroupAll(), false);
DialogDestroy(dialog_bans);
}

create_dialog_pick_faction();
}
Expand Down Expand Up @@ -590,6 +597,7 @@ bool bans_done_button_pressed(bool testConds, bool runActions) {
int create_dialog_bans() {
int width;
int height;
int timeout_minutes = 5;
//int race;
playergroup players;
int button;
Expand All @@ -600,6 +608,9 @@ int create_dialog_bans() {
// TODO: bans remaining 2 / 3
// timer

if(rando_mode=="competitive") {
timeout_minutes = 10;
}
dialog_bans = DialogCreate(500, 500, c_anchorCenter, 0, 0, true);
DialogSetTitle(dialog_bans, StringToText(dialog_title) );
DialogSetFullscreen(dialog_bans, true);
Expand All @@ -618,14 +629,14 @@ int create_dialog_bans() {
DialogControlAddItem(changes_list, players, StringToText("Select a race/faction to see the changes") );
DialogControlAddItem(changes_list, players, StringToText("Click on the Ban button to disallow your opponents from picking that faction") );
DialogControlAddItem(changes_list, players, StringToText("Make sure to also read the General Changes") );
DialogControlAddItem(changes_list, players, StringToText("You have 5 minutes to choose bans") );
DialogControlAddItem(changes_list, players, StringToText("You have "+IntToString(timeout_minutes)+" minutes to choose bans") );
DialogControlAddItem(changes_list, players, StringToText("You are allowed to change your bans by clicking on Unban") );

create_continue_button(dialog_bans, "Continue", "bans_done_button_pressed");

TriggerDestroy(dialog_timeout);
dialog_timeout = TriggerCreate("ban_factions_timeout");
TriggerAddEventTimeElapsed( dialog_timeout, 300, c_timeReal );
TriggerAddEventTimeElapsed( dialog_timeout, timeout_minutes*60, c_timeReal );

DialogSetVisible(dialog_bans, players, true);

Expand Down Expand Up @@ -853,14 +864,6 @@ int create_dialog_settings() {

num_players = PlayerGroupCount(PlayerGroupActive());
// TODO: timeouts for dialogs with countdown
//if( num_players > 4 ) {
// num_bans = 0;
// num_factions = 3;
//}
//else {
// num_bans = 0;
// num_factions = MaxI(2, num_players);
//}

dialog_start = DialogCreate(500, 500, c_anchorCenter, 0, 0, true);
DialogSetTitle(dialog_start, StringToText(dialog_title) );
Expand All @@ -886,9 +889,12 @@ int create_dialog_settings() {
create_continue_button(dialog_start, "Continue", "start_rando_button_pressed");

dialog_timeout = TriggerCreate("start_rando_button_pressed");
TriggerAddEventTimeElapsed( dialog_timeout, 60, c_timeReal );

DialogSetVisible(dialog_start, players, true);
if(rando_mode=="competitive") {
start_rando_button_pressed(true, true);
} else {
TriggerAddEventTimeElapsed( dialog_timeout, 60, c_timeReal );
DialogSetVisible(dialog_start, players, true);
}

return dialog_start;
}
Expand Down
7 changes: 7 additions & 0 deletions sc2randomizer.SC2Mod/scripts/init.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ void sc2randoinit() {
max_starting_workers = 14;
buffs_nerfs = 75.0;

rando_mode = "normal";
if(GameAttributeGameValue("1") == "0002") {
rando_mode = "competitive";
num_factions = 3;
num_bans = 1;
}

TriggerDebugOutputEnable(true);
TriggerDebugSetTypeFile(1, "SC2Rando.txt");
run_tests();
Expand Down

0 comments on commit 69bdb23

Please sign in to comment.