Exemple #1
0
        ////////////////

        private void ApplyBrambleEffects()
        {
            var    config    = CursedBramblesConfig.Instance;
            string timerName = "CursedBrambleHurt_" + this.player.whoAmI;

            if (this.player.velocity.LengthSquared() > 0.1f)
            {
                this.player.velocity *= 1f - config.Get <float>(nameof(config.BrambleStickiness));
            }

            if (Timers.GetTimerTickDuration(timerName) <= 0)
            {
                Timers.SetTimer(timerName, config.Get <int>(nameof(config.BrambleTicksPerDamage)), false, () => {
                    PlayerLibraries.RawHurt(
                        player: this.player,
                        deathReason: PlayerDeathReason.ByCustomReason(this.player.name + " was devoured by cursed brambles"),
                        damage: config.Get <int>(nameof(config.BrambleDamage)),
                        direction: 0,
                        pvp: false,
                        quiet: true,
                        crit: false
                        );
                    return(false);
                });

                this.player.AddBuff(BuffID.Venom, 60);
            }
        }
        public override void ReceiveOnClient()
        {
            Player player = Main.player[this.PlayerWho];

            if (player == null || !player.active)
            {
                LogLibraries.Alert("Inactive player indexed as " + this.PlayerWho);
                return;
            }

            PlayerLibraries.ApplyPermaDeathState(player, this.Msg);
        }