implemented lobby options for GemGrabbers

issue1247
Maikel de Vries 2014-09-26 21:49:51 +02:00
parent c09764b3fd
commit 6f7b8027f0
5 changed files with 136 additions and 25 deletions

View File

@ -10,23 +10,20 @@
#include Library_Map
// Scenario properties which can be set later by the lobby options.
static const SCENOPT_MapSize = 1;
// Called be the engine: draw the complete map here.
protected func InitializeMap(proplist map)
{
// Retrieve the settings according to the MapSize setting.
var map_size, main_size, nr_islands;
if (SCENOPT_MapSize == 1)
if (SCENPAR_MapSize == 1)
{
map_size = [240, 200]; main_size = 80; nr_islands = RandomX(6, 7);
}
if (SCENOPT_MapSize == 2)
if (SCENPAR_MapSize == 2)
{
map_size = [280, 220]; main_size = 90; nr_islands = RandomX(7, 8);
}
if (SCENOPT_MapSize == 3)
if (SCENPAR_MapSize == 3)
{
map_size = [320, 240]; main_size = 100; nr_islands = RandomX(8, 9);
}

View File

@ -0,0 +1,63 @@
[ParameterDef]
Name=$Difficulty$
Description=$DescDifficulty$
ID=Difficulty
Default=1
[Options]
[Option]
Name=$DiffNormal$
Description=$DescDiffNormal$
Value=1
[Option]
Name=$DiffHard$
Description=$DescDiffHard$
Value=2
[Option]
Name=$DiffInsane$
Description=$DescDiffInsane$
Value=3
[ParameterDef]
Name=$MapSize$
Description=$DescMapSize$
ID=MapSize
Default=1
[Options]
[Option]
Name=$MapSmall$
Description=$DescMapSmall$
Value=1
[Option]
Name=$MapAverage$
Description=$DescMapAverage$
Value=2
[Option]
Name=$MapLarge$
Description=$DescMapLarge$
Value=3
[ParameterDef]
ID=Done
Achievement=Done
[Options]
[Option]
Description=$AchievementNormal$
Value=1
[Option]
Description=$AchievementHard$
Value=2
[Option]
Description=$AchievementInsane$
Value=3

View File

@ -13,11 +13,6 @@
*/
// Scenario properties which can be set later by the lobby options.
static const SCENOPT_Material = 3; // Amount of material available from start.
static const SCENOPT_MapSize = 1; // Size of the map.
static const SCENOPT_Difficulty = 2; // Difficulty settings.
protected func Initialize()
{
// Rules: team account and buying at flagpole.
@ -27,21 +22,28 @@ protected func Initialize()
// Goal: Sell Gems, amount depends on difficulty and initial availability.
var gems = (4 * GetMaterialCount(Material("Ruby"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Ruby")));
gems += (4 * GetMaterialCount(Material("Amethyst"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Amethyst")));
var percentage = 55 + 15 * SCENOPT_Difficulty;
var percentage = 55 + 15 * SCENPAR_Difficulty;
var goal = CreateObject(Goal_SellGems);
goal->SetTargetAmount((gems * percentage) / 100);
// Initialize different parts of the scenario.
InitEnvironment();
InitEnvironment(SCENPAR_Difficulty);
InitVegetation();
InitAnimals();
InitResources();
InitMainIsland(SCENOPT_Material);
InitIslands(SCENOPT_Material);
InitResources(SCENPAR_Difficulty);
InitMainIsland(4 - SCENPAR_Difficulty);
InitIslands(4 - SCENPAR_Difficulty);
return;
}
protected func OnGoalsFulfilled()
{
// Give the remaining players their achievement.
GainScenarioAchievement("Done", BoundBy(SCENPAR_Difficulty, 1, 3));
return false;
}
/*-- Player Initialization --*/
@ -69,8 +71,8 @@ protected func InitializePlayer(int plr)
RemovePlayerSpecificKnowledge(plr, [InventorsLab, Shipyard, WallKit]);
// Only clonks for sale at the homebase, depending on diffuculty: 3, 5, 10 available.
var nr_clonks = Max(9 - 2 * SCENOPT_Difficulty, 1);
if (SCENOPT_Difficulty == 1)
var nr_clonks = Max(9 - 2 * SCENPAR_Difficulty, 1);
if (SCENPAR_Difficulty == 1)
nr_clonks += 3;
SetBaseMaterial(plr, Clonk, nr_clonks);
SetBaseProduction(plr, Clonk, nr_clonks);
@ -86,7 +88,7 @@ protected func InitializePlayer(int plr)
/*-- Scenario Initialization --*/
// Initializes environment and disasters.
private func InitEnvironment()
private func InitEnvironment(int difficulty)
{
// Set time to almost night and have stars.
CreateObject(Environment_Celestial);
@ -96,7 +98,7 @@ private func InitEnvironment()
// Clouds and rain.
Cloud->Place(15);
Cloud->SetPrecipitation("Water", 100 + 25 * SCENOPT_Difficulty);
Cloud->SetPrecipitation("Water", 100 + 25 * difficulty);
for (var cloud in FindObjects(Find_ID(Cloud)))
{
while (cloud->RemoveVertex())
@ -113,8 +115,8 @@ private func InitEnvironment()
SetSkyParallax(0, 20, 20);
// Disasters: meteors and lightning.
Meteor->SetChance(2 * SCENOPT_Difficulty);
Cloud->SetLightning(8 * SCENOPT_Difficulty);
Meteor->SetChance(2 * difficulty);
Cloud->SetLightning(8 * difficulty);
return;
}
@ -162,10 +164,11 @@ private func InitAnimals()
}
// Initializes the growth of gem stalactites.
private func InitResources()
private func InitResources(int difficulty)
{
// Add an effect to ensure gem stalactites are grown when the player seems unable to complete the goal.
AddEffect("GrowGemStalactites", nil, 100, 60 * 36, nil);
var effect = AddEffect("GrowGemStalactites", nil, 100, 60 * 36, nil, nil, difficulty);
effect.difficulty = difficulty;
return;
}
@ -179,7 +182,7 @@ global func FxGrowGemStalactitesTimer(object target, proplist effect, int time)
if (!goal)
return 1;
// The comparison depends on the difficulty settings.
if (gems - goal->GetTargetAmount() > 5 * (4 - SCENOPT_Difficulty))
if (gems - goal->GetTargetAmount() > 5 * (4 - effect.difficulty))
return 1;
// Find a location to grow a stalactite, possible away from others and clonks.

View File

@ -0,0 +1,24 @@
# Scenario parameters: difficulty
Difficulty=Schwierigkeit
DescDifficulty=Setzt die Schwierigkeit dieser Runde.
DiffNormal=Normal
DescDiffNormal=Die Schwierigkeit dieser Runde ist normal.
DiffHard=Schwer
DescDiffHard=Die Schwierigkeit dieser Runde ist schwer.
DiffInsane=Insane
DescDiffInsane=Die Schwierigkeit dieser Runde ist insane.
# Scenario parameters: map size
MapSize=Kartengröße
DescMapSize=Setzt die Kartengröße dieser Runde.
MapSmall=Klein
DescMapSmall=Die Karte dieser Runde wird klein sein
MapAverage=Durchschnittlich
DescMapAverage=Die Karte dieser Runde wird durchschnittlich sein.
MapLarge=Groß
DescMapLarge=Die Karte dieser Runde wird groß sein.
# Scenario parameters: achievements
AchievementNormal=Runde auf einfach geschafft.
AchievementHard=Runde auf schwer geschafft.
AchievementInsane=Runde auf insane geschafft.

View File

@ -0,0 +1,24 @@
# Scenario parameters: difficulty
Difficulty=Difficulty
DescDifficulty=Sets this round's difficulty.
DiffNormal=Normal
DescDiffNormal=This round's difficulty will be set to normal.
DiffHard=Hard
DescDiffHard=This round's difficulty will be set to hard.
DiffInsane=Insane
DescDiffInsane=This round's difficulty will be set to insane.
# Scenario parameters: map size
MapSize=Map size
DescMapSize=Sets this round's map size.
MapSmall=Small
DescMapSmall=This round's map will be small.
MapAverage=Average
DescMapAverage=This round's map will be average.
MapLarge=Large
DescMapLarge=This round's map will be large.
# Scenario parameters: achievements
AchievementNormal=Finished round with difficulty normal.
AchievementHard=Finished round with difficulty hard.
AchievementInsane=Finished round with difficulty insane.