コード例 #1
0
        public override void PreUpdate()
        {
            var mymod = (InjuryMod)this.mod;

            if (!mymod.Config.Enabled)
            {
                return;
            }

            this.Logic.UpdateBleeding(this.player);

            // Fall impact staggering
            if (this.player.velocity.Y == 0f)
            {
                int dmg = PlayerHelpers.ComputeImpendingFallDamage(this.player);
                if (dmg != 0)
                {
                    this.player.AddBuff(mod.BuffType("ImpactTrauma"), (int)((float)dmg * mymod.Config.FallLimpDurationMultiplier));
                }
            }

            this.Logic.UpdateHarm(this.player);
            this.Logic.UpdateTemporaryHealth(this.player);

            if (this.HeartstringsEffectDuration > 0)
            {
                this.HeartstringsEffectDuration--;
            }
            if (this.LifeVestPresence > 0)
            {
                this.LifeVestPresence--;
            }

            if (mymod.Config.InjuryOnDeath)
            {
                if (!this.AmDead)
                {
                    if (player.dead)
                    {
                        this.AmDead = true;

                        float harmBufferPercent = this.Logic.ComputeHarmBufferPercent(this.player);
                        float harm = this.Logic.ComputeHarmBufferCapacity(player) * (1f - harmBufferPercent);

                        this.Logic.AfflictHarm(this.player, harm + 0.001f);
                    }
                }
                else if (!player.dead)
                {
                    this.AmDead = false;
                }
            }
        }