Example #1
0
        ////////////////

        private void RecentManaStarPickup()
        {
            var config = PowerfulMagicConfig.Instance;

            PowerfulMagicItem.OnManaPickup(this.player, this.ManaBeforePickup);

            for (int idx = 0; idx < Main.combatText.Length; idx++)
            {
                CombatText txt = Main.combatText[idx];
                if (txt == null || !txt.active)
                {
                    continue;
                }
                if (!txt.text.Equals("100"))
                {
                    continue;
                }

                if (PowerfulMagicConfig.Instance.DebugModeInfo)
                {
                    Main.NewText("Old mana heal? amount from recent pickup: 100");
                }

                float manaHealScale = config.Get <float>(nameof(PowerfulMagicConfig.ManaHealScale));

                txt.text = (int)((float)100 * manaHealScale) + "";

                break;
            }
        }
Example #2
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);
                }
            }
        }
Example #3
0
        public override Color?GetAlpha(Item item, Color lightColor)
        {
            if (this.Temperature > 0f)
            {
                return(PowerfulMagicItem.GetTemperatureColor(lightColor, this.Temperature));
            }

            return(base.GetAlpha(item, lightColor));
        }
        ////////////////

        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);
        }
Example #5
0
        ////

        private void ApplyMeteorArmorShootBehaviorIf(Item shootItem)
        {
            PowerfulMagicItem.IsPoweredUp(shootItem, out bool isTreatedAsSpecialSpaceWeapon);
            if (!isTreatedAsSpecialSpaceWeapon)
            {
                return;
            }

            this.MeteorArmorTemperature += 2f;
            if (this.MeteorArmorTemperature > 125f)
            {
                this.MeteorArmorTemperature = 125f;
            }
        }
Example #6
0
        public static float?GetItemDamageScale(Item item, int manaSicknessTicks)
        {
            if (!item.magic)
            {
                return(null);
            }

            var config = PowerfulMagicConfig.Instance;

            //

            // Laser weapons + meteor armor = no mana = no damage increase
            PowerfulMagicItem.IsPoweredUp(item, out bool isTreatedAsSpecialSpaceWeapon);
            if (isTreatedAsSpecialSpaceWeapon)
            {
                return(null);
            }

            //

            float maxManaSickDmgScale = config.Get <float>(nameof(config.MaxManaSicknessDamageScale));

            float scale = ((float)manaSicknessTicks / 300f) * maxManaSickDmgScale;

            scale = 1f - scale;

            if (scale <= 0.25f)
            {
                return(0.25f);
            }

            //

            var itemDef         = new ItemDefinition(item.type);
            var perItemDmgScale = config.Get <Dictionary <ItemDefinition, ItemMagicScale> >(
                nameof(PowerfulMagicConfig.PerItemDamageScale)
                );

            if (perItemDmgScale.ContainsKey(itemDef))
            {
                return(perItemDmgScale[itemDef].Scale * scale);
            }

            //

            return(config.Get <float>(nameof(PowerfulMagicConfig.BaseDamageScale)) * scale);
        }
Example #7
0
        ////////////////

        private void ApplyMeteorArmorAppearanceIf(ref PlayerDrawInfo drawInfo)
        {
            Item head = this.player.armor[0];
            Item body = this.player.armor[1];
            Item legs = this.player.armor[2];

            if (!head.active || head.type != ItemID.MeteorHelmet ||
                !body.active || body.type != ItemID.MeteorSuit ||
                !legs.active || legs.type != ItemID.MeteorLeggings)
            {
                return;
            }

            float temp = this.MeteorArmorTemperature;

            drawInfo.lowerArmorColor  = PowerfulMagicItem.GetTemperatureColor(drawInfo.lowerArmorColor, temp);
            drawInfo.middleArmorColor = PowerfulMagicItem.GetTemperatureColor(drawInfo.middleArmorColor, temp);
            drawInfo.upperArmorColor  = PowerfulMagicItem.GetTemperatureColor(drawInfo.upperArmorColor, temp);
        }
        ////////////////

        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);
        }