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

View File

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

View File

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