IEnumerator WaitForPlayerBody(ShrineBloodBehavior instance) { yield return(new WaitForSeconds(2)); foreach (var playerCharacterMasterController in PlayerCharacterMasterController.instances) { var body = playerCharacterMasterController.master.GetBody(); if (body) { var maxHealth = body.healthComponent.fullCombinedHealth; if (maxHealth > teamMaxHealth) { teamMaxHealth = (int)maxHealth; } } } float baseCost = 25 * Mathf.Pow(Run.instance.difficultyCoefficient, 1.25f); float maxMoneyTotal = baseCost * ChestAmount.Value; float maxMulti = maxMoneyTotal / teamMaxHealth / 2.18f;; if (maxMulti > 0.5f) { instance.goldToPaidHpRatio = maxMulti; } }
public ShrineBloodData(ShrineBloodBehavior shrine) { var purchaseInteraction = shrine.GetComponent <PurchaseInteraction>(); transform = new SerializableTransform(shrine.transform); purchaseCount = shrine.GetFieldValue <int>("purchaseCount"); cost = purchaseInteraction.cost; available = purchaseInteraction.available; }
private void ShrineBloodBehavior_Start(On.RoR2.ShrineBloodBehavior.orig_Start orig, ShrineBloodBehavior self) { orig(self); if (NetworkServer.active) { StartCoroutine(WaitForPlayerBody(self)); } }
//Blood Shrine private static void ShrineBloodBehavior_AddShrineStack(On.RoR2.ShrineBloodBehavior.orig_AddShrineStack orig, ShrineBloodBehavior self, Interactor interactor) { orig(self, interactor); var characterBody = interactor.GetComponent <CharacterBody>(); if (characterBody) { var inv = characterBody.inventory; if (inv) { if (inv.GetItemCount(ExtraShrineRollItemIndex) > 0 && Util.CheckRoll(ItemProcChance * inv.GetItemCount(ExtraShrineRollItemIndex), characterBody.master)) { var purchaseInteraction = self.GetFieldValue <PurchaseInteraction>("purchaseInteraction"); uint amount = (uint)(characterBody.healthComponent.fullCombinedHealth * (float)purchaseInteraction.cost / 100f * self.goldToPaidHpRatio); if (characterBody.master) { characterBody.master.GiveMoney(amount); Chat.AddMessage($"<color=\"green\">Lucky Default Sphere <style=cShrine>has given you an additonal {amount} gold.</style>"); } } } } }