Fixed game win bug for discovering city, v1.3.1

This commit is contained in:
Nicola Sovic 2022-07-07 12:03:13 +02:00
parent 1dad0e5751
commit ae85d02ea2
3 changed files with 37 additions and 31 deletions

View File

@ -199,61 +199,61 @@ namespace Assets.Scripts
index = calculateIndex(indexes); index = calculateIndex(indexes);
switch (index) switch (index)
{ {
case 0: case 1:
if (i == 0) if (i == 0)
{ {
itemName = "luck"; itemName = "luck";
} }
attributes.Add("LCK", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); attributes.Add("LCK", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break;
case 1:
if (i == 0)
{
itemName = "intelligence";
}
attributes.Add("INT", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1)));
break; break;
case 2: case 2:
if (i == 0) if (i == 0)
{ {
itemName = "dexterity"; itemName = "intelligence";
} }
attributes.Add("DEX", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); attributes.Add("INT", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
case 3: case 3:
if (i == 0) if (i == 0)
{ {
itemName = "strength"; itemName = "dexterity";
} }
attributes.Add("STR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); attributes.Add("DEX", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
case 4: case 4:
if (i == 0) if (i == 0)
{ {
itemName = "health"; itemName = "strength";
} }
attributes.Add("HP", Mathf.RoundToInt((float)(10 - (2 * i) + luck * 0.1))); attributes.Add("STR", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
case 5: case 5:
if (i == 0) if (i == 0)
{ {
itemName = "mana"; itemName = "health";
} }
attributes.Add("MP", Mathf.RoundToInt((float)(10 - (2 * i) + luck * 0.1))); attributes.Add("HP", Mathf.RoundToInt((float)(10 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
case 6: case 6:
if (i == 0) if (i == 0)
{ {
itemName = "health regeneration"; itemName = "mana";
} }
attributes.Add("HPR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); attributes.Add("MP", Mathf.RoundToInt((float)(10 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
case 7: case 7:
if (i == 0)
{
itemName = "health regeneration";
}
attributes.Add("HPR", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break;
case 8:
if (i == 0) if (i == 0)
{ {
itemName = "mana regeneration"; itemName = "mana regeneration";
} }
attributes.Add("MPR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); attributes.Add("MPR", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
break; break;
} }
indexes[i] = index; indexes[i] = index;
@ -261,14 +261,15 @@ namespace Assets.Scripts
} }
else else
{ {
attributes.Add("MPR", Mathf.RoundToInt((float)(3 + luck * 0.1))); int bonus = rand.Next(luck);
attributes.Add("HPR", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("MPR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("MP", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("HPR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("HP", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("MP", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("STR", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("HP", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("DEX", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("STR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("INT", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("DEX", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("LCK", Mathf.RoundToInt((float)(3 + luck * 0.1))); attributes.Add("INT", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
attributes.Add("LCK", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
} }
} }
@ -278,7 +279,7 @@ namespace Assets.Scripts
int index = 0; int index = 0;
while (true) while (true)
{ {
index = rand.Next(8); index = rand.Next(8) + 1;
counter = 0; counter = 0;
for (int j = 0; j < indexes.Length; j++) for (int j = 0; j < indexes.Length; j++)
{ {

View File

@ -194,6 +194,7 @@ namespace Assets.Scripts
getRotation(); getRotation();
regeneratePlayer(); regeneratePlayer();
uihandler.adjustInformation(this); uihandler.adjustInformation(this);
gameFinished();
} }
} }
@ -464,6 +465,11 @@ namespace Assets.Scripts
uihandler.showMessage("SUCCESS;You killed your enemy!"); uihandler.showMessage("SUCCESS;You killed your enemy!");
killcount++; killcount++;
SteamWorksHandler.getSlimeAchievement(killcount); SteamWorksHandler.getSlimeAchievement(killcount);
gameFinished();
}
public void gameFinished()
{
if (killcount >= 30 * (difficulty + 1) && GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().gameWon()) if (killcount >= 30 * (difficulty + 1) && GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().gameWon())
{ {
uihandler.showMessage("SUCCESS;You won the game!"); uihandler.showMessage("SUCCESS;You won the game!");

View File

@ -101,6 +101,7 @@ public class WorldGenerator : MonoBehaviour
name = city.name; name = city.name;
cityAmount--; cityAmount--;
SteamWorksHandler.getStandardAchievement("CityAchievement"); SteamWorksHandler.getStandardAchievement("CityAchievement");
} }
else else
{ {
@ -108,7 +109,6 @@ public class WorldGenerator : MonoBehaviour
name = tile.name; name = tile.name;
noise.applyNoise(newTile); noise.applyNoise(newTile);
} }
} }
else else
{ {
@ -116,7 +116,6 @@ public class WorldGenerator : MonoBehaviour
name = tile.name; name = tile.name;
noise.applyNoise(newTile); noise.applyNoise(newTile);
} }
if (name.Contains("_")) if (name.Contains("_"))
{ {
name = name.Split('_')[0]; name = name.Split('_')[0];