Beispiel #1
0
        ////////////////

        private void ApplyBrambleEffects()
        {
            string timerName = "AmbushesCursedBrambleHurt_" + this.player.whoAmI;

            if (this.player.velocity.LengthSquared() > 0.1f)
            {
                this.player.velocity *= 1f - AmbushesMod.Config.BrambleStickiness;
            }

            if (Timers.GetTimerTickDuration(timerName) <= 0)
            {
                Timers.SetTimer(timerName, AmbushesMod.Config.BrambleTicksPerDamage, () => {
                    PlayerHelpers.RawHurt(
                        player: this.player,
                        deathReason: PlayerDeathReason.ByCustomReason(" was devoured by cursed brambles"),
                        damage: AmbushesMod.Config.BrambleDamage,
                        direction: 0,
                        pvp: false,
                        quiet: true,
                        crit: false
                        );
                    return(false);
                });

                this.player.AddBuff(BuffID.Venom, 60);
            }
        }
        public override bool UseItem(Item item, Player player)
        {
            var config    = WICLibConfig.Instance;
            var warpItems = config.Get <List <ItemDefinition> >(nameof(config.WarpItems));

            //switch( item.type ) {
            //case ItemID.MagicMirror:
            //case ItemID.CellPhone:
            //case ItemID.IceMirror:
            //case ItemID.RecallPotion:
            if (warpItems.Contains(new ItemDefinition(item.type)))
            {
                if (player.HasBuff(BuffID.ChaosState))
                {
                    int hurtAmt = config.Get <int>(nameof(config.ChaosStateHurtsFromWarpItems));

                    if (hurtAmt > 0)
                    {
                        PlayerHelpers.RawHurt(
                            player: player,
                            deathReason: PlayerDeathReason.ByCustomReason(" disintegrated"),
                            damage: hurtAmt,
                            direction: 0
                            );
                        return(false);
                    }
                }

                int duration = config.Get <int>(nameof(config.ChaosStateTickDurationFromWarp));
                if (duration > 0)
                {
                    player.AddBuff(BuffID.ChaosState, duration);
                }
            }

            return(base.UseItem(item, player));
        }