private void ApplyBonus(string pickupname) { switch (pickupname) { case "SummonPlus2": if (statl.GetDetrizideBank() < 30000) { GetComponent <AudioSource>().PlayOneShot(sl.GetSummonUpgrade()); } altar.SetResCost(altar.GetResCost() + resIncreaseFactor); altar.SetResMax(altar.GetResMax() + 2); break; case "Scythes": if (statl.GetDetrizideBank() < 30000) { GetComponent <AudioSource>().PlayOneShot(sl.GetScythe()); } //replace bonebag with upgraded bonebag if (player.GetPlayerOwnedWeapons().Contains(sc.provideGameObject("Snubnose"))) { player.AnimateSwapWeapon(player.GetCurrentWeapon(), "Snubnose"); } else { player.AnimateSwapWeapon(player.GetCurrentWeapon(), "BoneBag"); } sc.SetBoneBag(newBonebag); break; case "Health": Unit unit = player.GetComponent <Unit>(); unit.SetMaxHealth(unit.GetMaxHealth() * 2); unit.SetHealth(unit.GetMaxHealth()); break; } }
private void CalculateCosts() { int timefactor = 3; temphealthcost = unit.GetMaxHealth() - unit.GetHealth(); temphealthcost /= unit.GetMaxHealth(); temphealthcost *= 100.0f; temphealthcost += Altar.GetTimeSinceStart() / timefactor; healthcost = Mathf.FloorToInt(Mathf.Clamp(temphealthcost, 0, costlimit)); rescost = Mathf.Clamp(altar.GetResCost() + Mathf.FloorToInt(Altar.GetTimeSinceStart() / timefactor), 0, costlimit); if (unit.GetHealth() < unit.GetMaxHealth() && statl.GetDetrizide() > healthcost) { spellavailable = true; healavailable = true; } else if (unit.GetHealth() == unit.GetMaxHealth() && statl.GetDetrizide() > rescost && CountFriends("Friendlies") < altar.GetResMax()) { spellavailable = true; summonavailable = true; healavailable = false; } else if (unit.GetHealth() == unit.GetMaxHealth() && statl.GetDetrizide() > 0) { spellavailable = true; bankavailable = true; summonavailable = false; healavailable = false; } else { spellavailable = false; bankavailable = false; summonavailable = false; healavailable = false; } }