Exemplo n.º 1
0
        //handles draining energy/stamina on successful transmute
        public static void HandleAlchemyEnergyDeduction(double energyCost, bool isForcedStaminaDrain)
        {
            double remainingStaminaCost = energyCost;

            // if the stamina drain is "forced" it means you can't pay for this transaction with energy
            // the *entire* cost goes to stamina.
            if (!isForcedStaminaDrain)
            {
                //if you have any alkahestry energy, it will try to use as much as it can
                double alkahestryCost = (double)Math.Min(EquivalentExchange.CurrentEnergy, energyCost);

                //and deduct that from whatever stamina cost might be left over (which may be all of it)
                remainingStaminaCost -= alkahestryCost;

                Alchemy.ReduceAlkahestryEnergy(alkahestryCost);
            }
            Game1.player.Stamina -= (float)remainingStaminaCost;
            EquivalentExchange.AddAlchemyExperience((int)Math.Floor(Math.Max(energyCost, 1D)));
        }