97 lines
3.6 KiB
C#
97 lines
3.6 KiB
C#
using Decimation.Lib.Util;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
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" +
|
|
"You deal 10% more magic damage\n" +
|
|
"Your magic critical hit chances are increased by 10%\n" +
|
|
"Your criticals hits leech mana\n" +
|
|
"Hostile projectiles have 10% 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);
|
|
|
|
base.UpdateAccessory(player, hideVisual);
|
|
}
|
|
}
|
|
|
|
class SoulItemEffects : GlobalItem
|
|
{
|
|
public override void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
|
|
{
|
|
if (crit && player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
player.LeechMana(target);
|
|
}
|
|
}
|
|
|
|
public override void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
|
|
{
|
|
if (crit && player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
player.LeechMana(target);
|
|
}
|
|
}
|
|
}
|
|
|
|
class SoulProjectileEffects : GlobalProjectile
|
|
{
|
|
public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Player owner = Main.player[projectile.owner];
|
|
if (crit && owner != null && owner.active && !owner.dead &&
|
|
owner.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
owner.LeechMana(target);
|
|
}
|
|
}
|
|
|
|
public override void OnHitPvp(Projectile projectile, Player target, int damage, bool crit)
|
|
{
|
|
Player owner = Main.player[projectile.owner];
|
|
if (crit && owner != null && owner.active && !owner.dead &&
|
|
owner.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
owner.LeechMana(target);
|
|
}
|
|
}
|
|
|
|
public override void ModifyHitPvp(Projectile projectile, Player target, ref int damage, ref bool crit)
|
|
{
|
|
IgnoreHit(target, ref damage);
|
|
}
|
|
|
|
public override void ModifyHitPlayer(Projectile projectile, Player target, ref int damage, ref bool crit)
|
|
{
|
|
IgnoreHit(target, ref damage);
|
|
}
|
|
|
|
private void IgnoreHit(Player target, ref int damage)
|
|
{
|
|
DecimationPlayer targetModPlayer = target.GetModPlayer();
|
|
if (Main.rand.NextBool(10) && targetModPlayer.HasEquippedAccessory(ModContent.ItemType<Soul>()))
|
|
{
|
|
damage = 0;
|
|
targetModPlayer.NextHitCrit = true;
|
|
}
|
|
}
|
|
}
|
|
} |