Пример #1
0
        ////////////////

        public override void Load()
        {
            if (!Main.dedServ)
            {
                InfectionDeBuff.LoadTextures();
            }
        }
        ////

        public static void UpdateLifeEffectsIfInfection(Player player)
        {
            if (player.HasBuff(ModContent.BuffType <InfectionDeBuff>()))
            {
                InfectionDeBuff.UpdateLifeEffects(player);
            }
        }
        public static bool ApplyInfectionIf(GreenHellPlayer myplayer, double damage, bool syncIfServer)
        {
            if (!myplayer.player.ZoneJungle || myplayer.HasVerdantBlessing())
            {
                return(false);
            }

            var   config = GreenHellConfig.Instance;
            float infectionChancePerChunk = config.Get <float>(nameof(config.InfectionChancePer10LifeLostInJungle));

            for ( ; damage > 10d; damage -= 10d)
            {
                if (Main.rand.NextFloat() < infectionChancePerChunk)
                {
                    InfectionDeBuff.GiveTo(myplayer, syncIfServer);
                    return(true);
                }
            }

            return(false);
        }