コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 private void ShrineBloodBehavior_Start(On.RoR2.ShrineBloodBehavior.orig_Start orig, ShrineBloodBehavior self)
 {
     orig(self);
     if (NetworkServer.active)
     {
         StartCoroutine(WaitForPlayerBody(self));
     }
 }
コード例 #4
0
        //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>");
                        }
                    }
                }
            }
        }