Added The Soul trinity item.
This commit is contained in:
parent
3e441699c9
commit
803bda060b
@ -70,6 +70,7 @@ namespace Decimation.Content
|
||||
|
||||
public ICollection<int> EquippedAccessories { get; } = new List<int>();
|
||||
public bool HasShield { get; set; }
|
||||
public bool NextHitCrit { get; set; }
|
||||
|
||||
public Item AmuletSlotItem
|
||||
{
|
||||
@ -403,6 +404,44 @@ namespace Decimation.Content
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
|
||||
{
|
||||
if (NextHitCrit)
|
||||
{
|
||||
crit = true;
|
||||
NextHitCrit = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback,
|
||||
ref bool crit,
|
||||
ref int hitDirection)
|
||||
{
|
||||
if (NextHitCrit)
|
||||
{
|
||||
crit = true;
|
||||
NextHitCrit = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
if (NextHitCrit)
|
||||
{
|
||||
crit = true;
|
||||
NextHitCrit = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
if (NextHitCrit)
|
||||
{
|
||||
crit = true;
|
||||
NextHitCrit = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
|
||||
{
|
||||
_amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage);
|
||||
|
||||
@ -10,9 +10,9 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
protected override string ItemName => "The Body";
|
||||
|
||||
protected override string ItemTooltip => "I feel all...\n" +
|
||||
"Increase maximum life by 50\n" +
|
||||
"Increases maximum life by 50\n" +
|
||||
"You deal 10% more melee damage\n" +
|
||||
"Your melee critical hit chances are increase by 10%\n" +
|
||||
"Your melee critical hit chances are increased by 10%\n" +
|
||||
"Hostile projectiles have 10% chance to ricochet off you\nand target your enemies with 50% increased damage";
|
||||
|
||||
protected override void InitAccessory()
|
||||
@ -92,7 +92,6 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
}
|
||||
|
||||
if (newTarget == null) return false;
|
||||
Main.NewText(newTarget.position);
|
||||
|
||||
float speed = projectile.velocity.Length();
|
||||
Vector2 velocity = newTarget.Center - projectile.Center;
|
||||
|
||||
97
Content/Items/Accessories/Trinity/Soul.cs
Normal file
97
Content/Items/Accessories/Trinity/Soul.cs
Normal file
@ -0,0 +1,97 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Accessories/Trinity/Soul.png
Normal file
BIN
Content/Items/Accessories/Trinity/Soul.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 B |
@ -1,6 +1,7 @@
|
||||
using Decimation.Lib.Items;
|
||||
using Decimation.Lib.Util;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Content.Items.Accessories.Trinity
|
||||
{
|
||||
@ -8,7 +9,8 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
{
|
||||
public override bool CanEquipAccessory(Player player, int slot)
|
||||
{
|
||||
return !player.HasEquippedAccessory(item.type);
|
||||
return !player.HasEquippedAccessory(ModContent.ItemType<Body>()) &&
|
||||
!player.HasEquippedAccessory(ModContent.ItemType<Soul>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,5 +31,17 @@ namespace Decimation.Lib.Util
|
||||
{
|
||||
return player.GetModPlayer().AmuletSlotItem.type == amuletType;
|
||||
}
|
||||
|
||||
public static void LeechMana(this Player player, Entity target, int minMana = 5, int maxMana = 15)
|
||||
{
|
||||
int manaAmount = Main.rand.Next(minMana, maxMana + 1);
|
||||
player.ManaEffect(manaAmount);
|
||||
Main.NewText(manaAmount);
|
||||
|
||||
if (target.GetType() == typeof(Player))
|
||||
{
|
||||
((Player) target).ManaEffect(-manaAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user