111 lines
4.1 KiB
C#
111 lines
4.1 KiB
C#
using System.Collections.Generic;
|
|
using Decimation.Lib.Util;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using Terraria.UI.Chat;
|
|
|
|
namespace Decimation.Content.Items.Accessories.Trinity
|
|
{
|
|
public class Soul : TrinityAccessory
|
|
{
|
|
protected override string ItemName => "The Soul";
|
|
protected override string ItemTooltip => "I am all...\n" +
|
|
"Increases maximum mana by 50\n" +
|
|
"Increases magic and minion damage by 10%\n" +
|
|
"Increases magic critical hit chances by 10%\n" +
|
|
"Increases minions knockback by 10%" +
|
|
"Criticals hits leech mana\n" +
|
|
"Hostile projectiles have 10% chance to phase through you,\nnegating all damage and causing your next attack to be a critical hit";
|
|
|
|
protected override void InitAccessory()
|
|
{
|
|
item.width = 10;
|
|
item.height = 16;
|
|
item.expert = true;
|
|
item.rare = Rarity.Rainbow.GetRarityValue();
|
|
item.value = Item.sellPrice(gold: 5);
|
|
}
|
|
|
|
public override void UpdateAccessory(Player player, bool hideVisual)
|
|
{
|
|
player.statManaMax2 += 50;
|
|
player.magicDamage *= 1.10f;
|
|
player.magicCrit *= (int) (player.magicCrit * 1.10f);
|
|
player.minionDamage *= 1.10f;
|
|
player.minionKB *= 1.10f;
|
|
|
|
base.UpdateAccessory(player, hideVisual);
|
|
}
|
|
|
|
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
|
{
|
|
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
|
{
|
|
overrideColor = ChatManager.WaveColor(Color.Blue)
|
|
});
|
|
}
|
|
|
|
public static void SoulHitEffect(Player target, ref int damage)
|
|
{
|
|
DecimationPlayer targetModPlayer = target.GetModPlayer();
|
|
if (Main.rand.NextBool(10) && (targetModPlayer.HasEquippedAccessory(ModContent.ItemType<Soul>()) || targetModPlayer.HasEquippedAccessory(ModContent.ItemType<Trinity>())))
|
|
{
|
|
damage = 0;
|
|
targetModPlayer.NextHitCrit = true;
|
|
}
|
|
}
|
|
|
|
public static void SoulEffect(Player player, Entity target, bool crit)
|
|
{
|
|
if (crit && player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
player.LeechMana(target);
|
|
}
|
|
}
|
|
}
|
|
|
|
class SoulItemEffects : GlobalItem
|
|
{
|
|
public override void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
|
|
{
|
|
Soul.SoulEffect(player, target, crit);
|
|
}
|
|
|
|
public override void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
|
|
{
|
|
Soul.SoulEffect(player, target, crit);
|
|
}
|
|
}
|
|
|
|
class SoulProjectileEffects : GlobalProjectile
|
|
{
|
|
public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Player owner = Main.player[projectile.owner];
|
|
if (owner != null && owner.active && !owner.dead)
|
|
{
|
|
Soul.SoulEffect(owner, target, crit);
|
|
}
|
|
}
|
|
|
|
public override void OnHitPvp(Projectile projectile, Player target, int damage, bool crit)
|
|
{
|
|
Player owner = Main.player[projectile.owner];
|
|
if (owner != null && owner.active && !owner.dead)
|
|
{
|
|
Soul.SoulEffect(owner, target, crit);
|
|
}
|
|
}
|
|
|
|
public override void ModifyHitPvp(Projectile projectile, Player target, ref int damage, ref bool crit)
|
|
{
|
|
Soul.SoulHitEffect(target, ref damage);
|
|
}
|
|
|
|
public override void ModifyHitPlayer(Projectile projectile, Player target, ref int damage, ref bool crit)
|
|
{
|
|
Soul.SoulHitEffect(target, ref damage);
|
|
}
|
|
}
|
|
} |