Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.9 kB
0
Indexable
Never
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
using Terraria.Localization;
using AncientLegacy.Content.Other.Classes;

using AncientLegacy.Content.Items.Weapons.Midnight;

namespace AncientLegacy.Content.Other
{
	public class ForgottenKnowledges : ModPrefix
	{
		public virtual float Power => 1f;
		public override PrefixCategory Category => PrefixCategory.AnyWeapon;
		
		public override float RollChance(Item item) 
		{
			return 100f;
		}
		
		public override void SetStaticDefaults() 
		{
			PowerTooltip = Mod.GetLocalization($"{LocalizationCategory}.{nameof(PowerTooltip)}");
			// This seemingly useless code is required to properly register the key for AdditionalTooltip
			_ = AdditionalTooltip;
		}
		
		public override bool CanRoll(Item item) 
		{
			if (item.CountsAsClass<ForbiddenClass>()) return true;
			return false;
		}
		
		public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) 
		{
			damageMult *= 1f - 0.33f * Power;
			useTimeMult *= 1f - 0.33f * Power;
		}
		
		public override void ModifyValue(ref float valueMult) 
		{
			valueMult *= 1f + 0.1f * Power;
		}
		public static LocalizedText PowerTooltip 
		{
			get; private set; 
		}
		public LocalizedText AdditionalTooltip => this.GetLocalization(nameof(AdditionalTooltip));
		
		public override IEnumerable<TooltipLine> GetTooltipLines(Item item)
		{
			yield return new TooltipLine(Mod, "PrefixWeaponAwesome", PowerTooltip.Format(Power)) {
				IsModifier = true, // Sets the color to the positive modifier color.
			};
			yield return new TooltipLine(Mod, "PrefixWeaponAwesomeDescription", AdditionalTooltip.Value) {
				IsModifier = true,
			};
		}
	}
}
Leave a Comment