コード例 #1
0
        ////////////////

        public override void ModifyManaCost(Item item, Player player, ref float reduce, ref float mult)
        {
            if (!item.magic)
            {
                return;
            }

            reduce *= PowerfulMagicConfig.Instance.Get <float>(nameof(PowerfulMagicConfig.WeaponManaConsumeMulitplier));

            if (player.controlUseItem && player.whoAmI == Main.myPlayer)
            {
                int manaUse = (int)((float)item.mana * reduce * mult);

                if (manaUse > 0 && manaUse <= player.statMana)
                {
                    int buffIdx = player.FindBuffIndex(BuffID.ManaSickness);
                    int manaSicknessDuration = buffIdx < 0 ? 0 : player.buffTime[buffIdx];

                    float dmgScale = PowerfulMagicItem.GetItemDamageScale(item, manaSicknessDuration)
                                     ?? 1f;
                    int damage = (int)((float)item.damage * dmgScale);

                    this.ApplyPlayerSpellFx(damage);
                }
            }
        }
コード例 #2
0
        ////////////////

        private void ModifyMagicWeaponDamage(Item item, ref float afterScale)
        {
            int manaSicknessBuffIdx = this.player.FindBuffIndex(BuffID.ManaSickness);
            int manaSicknessTicks   = manaSicknessBuffIdx != -1
                                ? this.player.buffTime[manaSicknessBuffIdx]
                                : 0;

            afterScale *= PowerfulMagicItem.GetItemDamageScale(item, manaSicknessTicks)
                          ?? 1f;
            //afterScale *= 1f - ((manaSicknessTicks / 300) * PowerfulMagicConfig.Instance.MaxManaSicknessDamageScale);
        }
コード例 #3
0
        ////////////////

        private void ModifyTooltips_MagicIf(
            string modName,
            Item item,
            List <TooltipLine> tooltips,
            ref int tipIdx)
        {
            if (!item.magic)
            {
                return;
            }

            float?dmgScale = PowerfulMagicItem.GetItemDamageScale(item, 0);

            if (!dmgScale.HasValue)
            {
                return;
            }

            var config = PowerfulMagicConfig.Instance;

            if (config == null)
            {
                return;
            }

            //int newDmg = Main.LocalPlayer.GetWeaponDamage( item );
            int dmgPercent  = (int)(dmgScale * 100f);
            int manaPercent = (int)(config.Get <float>(nameof(PowerfulMagicConfig.WeaponManaConsumeMulitplier)) * 100f);

            string tip1Text = modName + "Magic increased " + dmgPercent + "% of base amount";
            var    tip1     = new TooltipLine(this.mod, "PowerfulMagicDmgUpTip", tip1Text);
            //tip1.overrideColor = Color.Lerp( Color.Black, Color.Lime, 0.8f + (0.2f * mymod.Oscillate) );

            string tip2Text = modName + "Mana use increased " + manaPercent + "% of base amount";
            var    tip2     = new TooltipLine(this.mod, "PowerfulMagicManaUpTip", tip2Text);

            //tip2.overrideColor = Color.Lerp( Color.Black, Color.Lime, 0.8f + (0.2f * mymod.Oscillate) );

            tooltips.Insert(tipIdx++, tip1);
            tooltips.Insert(tipIdx++, tip2);
        }