Add Golden Berry
This commit is contained in:
@@ -21,17 +21,19 @@ public class PlayMenu : MonoBehaviour
|
||||
[SerializeField] private TMP_InputField speedyBerryChance;
|
||||
[SerializeField] private TMP_InputField randomBerryChance;
|
||||
[SerializeField] private TMP_InputField antiBerryChance;
|
||||
[SerializeField] private TMP_InputField goldenBerryChance;
|
||||
[SerializeField] private TMP_InputField nothingBerryChance;
|
||||
|
||||
[SerializeField] private TMP_Text validateTotalText;
|
||||
|
||||
private readonly float defaultNormalBerryChance = 47.5f;
|
||||
private readonly float defaultNormalBerryChance = 32.5f;
|
||||
private readonly float defaultPoisonBerryChance = 12.5f;
|
||||
private readonly float defaultSlowBerryChance = 10f;
|
||||
private readonly float defaultUltraBerryChance = 10f;
|
||||
private readonly float defaultSpeedyBerryChance = 10f;
|
||||
private readonly float defaultRandomBerryChance = 5f;
|
||||
private readonly float defaultAntiBerryChance = 5f;
|
||||
private readonly float defaultGoldenBerryChance = 5f;
|
||||
private readonly float defaultNothingBerryChance = 0f;
|
||||
|
||||
void Awake()
|
||||
@@ -55,6 +57,7 @@ public class PlayMenu : MonoBehaviour
|
||||
speedyBerryChance.text = defaultSpeedyBerryChance.ToString();
|
||||
randomBerryChance.text = defaultRandomBerryChance.ToString();
|
||||
antiBerryChance.text = defaultAntiBerryChance.ToString();
|
||||
goldenBerryChance.text = defaultGoldenBerryChance.ToString();
|
||||
nothingBerryChance.text = defaultNothingBerryChance.ToString();
|
||||
ValidateTotal();
|
||||
if (DiscordRPCHandler.Instance != null)
|
||||
@@ -69,6 +72,7 @@ public class PlayMenu : MonoBehaviour
|
||||
float speedyBerry = GetValueFrom(speedyBerryChance);
|
||||
float randomBerry = GetValueFrom(randomBerryChance);
|
||||
float antiBerry = GetValueFrom(antiBerryChance);
|
||||
float goldenBerry = GetValueFrom(goldenBerryChance);
|
||||
float nothingBerry = GetValueFrom(nothingBerryChance);
|
||||
|
||||
int divideBy = 0;
|
||||
@@ -80,9 +84,10 @@ public class PlayMenu : MonoBehaviour
|
||||
divideBy += speedyBerry > 0 ? 1 : 0;
|
||||
divideBy += randomBerry > 0 ? 1 : 0;
|
||||
divideBy += antiBerry > 0 ? 1 : 0;
|
||||
divideBy += goldenBerry > 0 ? 1 : 0;
|
||||
divideBy += nothingBerry > 0 ? 1 : 0;
|
||||
|
||||
float addedChances = normalBerry + poisonBerry + slowBerry + ultraBerry + speedyBerry + randomBerry + antiBerry + nothingBerry;
|
||||
float addedChances = normalBerry + poisonBerry + slowBerry + ultraBerry + speedyBerry + randomBerry + antiBerry + goldenBerry + nothingBerry;
|
||||
float difference = addedChances - 100f;
|
||||
|
||||
if (normalBerry > 0) NormalizeOne(normalBerryChance, normalBerry, divideBy, difference);
|
||||
@@ -92,6 +97,7 @@ public class PlayMenu : MonoBehaviour
|
||||
if (speedyBerry > 0) NormalizeOne(speedyBerryChance, speedyBerry, divideBy, difference);
|
||||
if (randomBerry > 0) NormalizeOne(randomBerryChance, randomBerry, divideBy, difference);
|
||||
if (antiBerry > 0) NormalizeOne(antiBerryChance, antiBerry, divideBy, difference);
|
||||
if (goldenBerry > 0) NormalizeOne(goldenBerryChance, goldenBerry, divideBy, difference);
|
||||
if (nothingBerry > 0) NormalizeOne(nothingBerryChance, nothingBerry, divideBy, difference);
|
||||
|
||||
normalBerry = GetValueFrom(normalBerryChance);
|
||||
@@ -101,6 +107,7 @@ public class PlayMenu : MonoBehaviour
|
||||
speedyBerry = GetValueFrom(speedyBerryChance);
|
||||
randomBerry = GetValueFrom(randomBerryChance);
|
||||
antiBerry = GetValueFrom(antiBerryChance);
|
||||
goldenBerry = GetValueFrom(goldenBerryChance);
|
||||
nothingBerry = GetValueFrom(nothingBerryChance);
|
||||
|
||||
if (normalBerry > 0) normalBerry = (float)Math.Floor(normalBerry);
|
||||
@@ -110,9 +117,10 @@ public class PlayMenu : MonoBehaviour
|
||||
if (speedyBerry > 0) speedyBerry = (float)Math.Floor(speedyBerry);
|
||||
if (randomBerry > 0) randomBerry = (float)Math.Floor(randomBerry);
|
||||
if (antiBerry > 0) antiBerry = (float)Math.Floor(antiBerry);
|
||||
if (goldenBerry > 0) goldenBerry = (float)Math.Floor(goldenBerry);
|
||||
if (nothingBerry > 0) nothingBerry = (float)Math.Floor(nothingBerry);
|
||||
|
||||
float addedChances2 = normalBerry + poisonBerry + slowBerry + ultraBerry + speedyBerry + randomBerry + antiBerry + nothingBerry;
|
||||
float addedChances2 = normalBerry + poisonBerry + slowBerry + ultraBerry + speedyBerry + randomBerry + antiBerry + goldenBerry + nothingBerry;
|
||||
float difference2 = addedChances2 - 100f;
|
||||
bool fixedValues = false;
|
||||
|
||||
@@ -151,6 +159,11 @@ public class PlayMenu : MonoBehaviour
|
||||
NormalizeTwo(antiBerryChance, fixedValues, antiBerry, difference2);
|
||||
fixedValues = true;
|
||||
}
|
||||
if (goldenBerry > 0)
|
||||
{
|
||||
NormalizeTwo(goldenBerryChance, fixedValues, goldenBerry, difference2);
|
||||
fixedValues = true;
|
||||
}
|
||||
if (nothingBerry > 0)
|
||||
{
|
||||
NormalizeTwo(nothingBerryChance, fixedValues, nothingBerry, difference2);
|
||||
@@ -171,6 +184,7 @@ public class PlayMenu : MonoBehaviour
|
||||
customGameTempData.speedyBerryChance = GetValueFrom(speedyBerryChance);
|
||||
customGameTempData.randomBerryChance = GetValueFrom(randomBerryChance);
|
||||
customGameTempData.antiBerryChance = GetValueFrom(antiBerryChance);
|
||||
customGameTempData.goldenBerryChance = GetValueFrom(goldenBerryChance);
|
||||
customGameTempData.nothingBerryChance = GetValueFrom(nothingBerryChance);
|
||||
await SceneManager.LoadSceneAsync("CustomGamePlayer");
|
||||
});
|
||||
@@ -189,6 +203,8 @@ public class PlayMenu : MonoBehaviour
|
||||
randomBerryChance.onDeselect.AddListener((value) => OnDeselect(value, randomBerryChance));
|
||||
antiBerryChance.onSelect.AddListener((value) => OnSelect(value, antiBerryChance));
|
||||
antiBerryChance.onDeselect.AddListener((value) => OnDeselect(value, antiBerryChance));
|
||||
goldenBerryChance.onSelect.AddListener((value) => OnSelect(value, goldenBerryChance));
|
||||
goldenBerryChance.onDeselect.AddListener((value) => OnDeselect(value, goldenBerryChance));
|
||||
nothingBerryChance.onSelect.AddListener((value) => OnSelect(value, nothingBerryChance));
|
||||
nothingBerryChance.onDeselect.AddListener((value) => OnDeselect(value, nothingBerryChance));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user