//////////////// public static void UpdateLifeEffects(Player player) { if (player.dead || player.velocity.Y != 0) { return; } var myplayer = player.GetModPlayer <GreenHellPlayer>(); int dmg = InfectionDeBuff.ComputeDamage(player, myplayer.InfectionStage); //DebugHelpers.Print( "infection", "dmg: "+dmg.ToString()+", stage: "+myplayer.InfectionStage+", vel: "+vel ); player.lifeRegen = -dmg; /*player.Hurt( * damageSource: PlayerDeathReason.ByCustomReason("didn't wash their hands"), * Damage: dmg, * hitDirection: 0, * pvp: false, * quiet: true, * Crit: false * );*/ if (dmg > 0) { if (Timers.GetTimerTickDuration("GreenHellInfectionAlert") == 0) { Timers.SetTimer("GreenHellInfectionAlert", 60 * 10, false, () => false); Main.NewText("Movements agitate your condition.", Color.OrangeRed); } } }
internal static void GiveTo(GreenHellPlayer myplayer, bool syncIfServer) { var config = GreenHellConfig.Instance; int duration = config.Get <int>(nameof(config.InfectionTickDuration)); myplayer.player.AddBuff(ModContent.BuffType <InfectionDeBuff>(), duration, !syncIfServer); if (myplayer.InfectionStage < InfectionDeBuff.Stages) { myplayer.InfectionStage++; } if (syncIfServer && Main.netMode == NetmodeID.Server) { PlayerStatePayload.SendToClients(myplayer.player.whoAmI); } InfectionDeBuff.UpdateIcon(myplayer); }