Added The Trinity.
This commit is contained in:
parent
e61040d1e5
commit
df5b7c2b43
@ -3,6 +3,7 @@ using Decimation.Lib.Util;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.UI.Chat;
|
||||||
|
|
||||||
namespace Decimation.Content.Items.Accessories.Trinity
|
namespace Decimation.Content.Items.Accessories.Trinity
|
||||||
{
|
{
|
||||||
@ -39,7 +40,7 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
{
|
{
|
||||||
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
||||||
{
|
{
|
||||||
overrideColor = Color.Red
|
overrideColor = ChatManager.WaveColor(Color.Red)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,59 +61,12 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool Ricochet(Projectile projectile, Player target, bool isPlayer, ref int damage)
|
private bool Ricochet(Projectile projectile, Player player, bool fromPlayer, ref int damage)
|
||||||
{
|
{
|
||||||
if (Main.expertMode && Main.rand.NextBool(10) &&
|
if (Main.expertMode && Main.rand.NextBool(10) &&
|
||||||
target.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Body>()))
|
player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Body>()))
|
||||||
{
|
{
|
||||||
Entity newTarget = null;
|
return projectile.Richochet(player, fromPlayer, ref damage);
|
||||||
float lastDistance = float.MaxValue;
|
|
||||||
if (isPlayer)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Main.player.Length; i++)
|
|
||||||
{
|
|
||||||
Player player = Main.player[i];
|
|
||||||
if (player != null && player.active && !player.dead && player.whoAmI != target.whoAmI)
|
|
||||||
{
|
|
||||||
float distance = projectile.Distance(player.Center);
|
|
||||||
if (distance < 1000f && distance < lastDistance)
|
|
||||||
{
|
|
||||||
lastDistance = distance;
|
|
||||||
newTarget = player;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Main.npc.Length; i++)
|
|
||||||
{
|
|
||||||
NPC npc = Main.npc[i];
|
|
||||||
if (npc != null && npc.active && !npc.friendly)
|
|
||||||
{
|
|
||||||
float distance = projectile.Distance(npc.Center);
|
|
||||||
if (distance < 1000f && distance < lastDistance)
|
|
||||||
{
|
|
||||||
lastDistance = distance;
|
|
||||||
newTarget = npc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newTarget == null) return false;
|
|
||||||
|
|
||||||
float speed = projectile.velocity.Length();
|
|
||||||
Vector2 velocity = newTarget.Center - projectile.Center;
|
|
||||||
velocity.Normalize();
|
|
||||||
velocity *= speed;
|
|
||||||
|
|
||||||
projectile.velocity = velocity;
|
|
||||||
projectile.damage = (int) (projectile.damage * 1.5f);
|
|
||||||
|
|
||||||
damage = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.UI.Chat;
|
||||||
|
|
||||||
namespace Decimation.Content.Items.Accessories.Trinity
|
namespace Decimation.Content.Items.Accessories.Trinity
|
||||||
{
|
{
|
||||||
@ -45,7 +46,7 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
{
|
{
|
||||||
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
||||||
{
|
{
|
||||||
overrideColor = Color.Yellow
|
overrideColor = ChatManager.WaveColor(Color.Yellow)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using Decimation.Lib.Util;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.UI.Chat;
|
||||||
|
|
||||||
namespace Decimation.Content.Items.Accessories.Trinity
|
namespace Decimation.Content.Items.Accessories.Trinity
|
||||||
{
|
{
|
||||||
@ -41,7 +42,7 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
{
|
{
|
||||||
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
||||||
{
|
{
|
||||||
overrideColor = Color.Blue
|
overrideColor = ChatManager.WaveColor(Color.Blue)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
149
Content/Items/Accessories/Trinity/Trinity.cs
Normal file
149
Content/Items/Accessories/Trinity/Trinity.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Decimation.Lib.Util;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.UI.Chat;
|
||||||
|
|
||||||
|
namespace Decimation.Content.Items.Accessories.Trinity
|
||||||
|
{
|
||||||
|
public class Trinity : TrinityAccessory
|
||||||
|
{
|
||||||
|
protected override string ItemName => "The Trinity";
|
||||||
|
|
||||||
|
protected override string ItemTooltip => "True Equilibrium...\n" +
|
||||||
|
"Increases maximum life by 50\n" +
|
||||||
|
"Increases maximum mana by 50\n" +
|
||||||
|
"Increases all damage by 10%\n" +
|
||||||
|
"Increases all critical hit chances by 10%\n" +
|
||||||
|
"Increases minions knockback by 10%\n" +
|
||||||
|
"Allows you to see nearby danger sources\n" +
|
||||||
|
"Shows the location of treasure and ore\n" +
|
||||||
|
"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\n" +
|
||||||
|
"Hostile projectiles have 10% chance to ricochet off you\nand target your enemies with 50% increased damage";
|
||||||
|
|
||||||
|
protected override void InitAccessory()
|
||||||
|
{
|
||||||
|
item.width = 34;
|
||||||
|
item.height = 28;
|
||||||
|
item.expert = true;
|
||||||
|
item.value = Item.sellPrice(gold: 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||||
|
{
|
||||||
|
// Soul
|
||||||
|
player.statManaMax2 += 50;
|
||||||
|
player.magicDamage *= 1.10f;
|
||||||
|
player.magicCrit *= (int) (player.magicCrit * 1.10f);
|
||||||
|
player.minionDamage *= 1.10f;
|
||||||
|
player.minionKB *= 1.10f;
|
||||||
|
|
||||||
|
// Body
|
||||||
|
player.statLifeMax2 += 50;
|
||||||
|
player.meleeDamage *= 1.10f;
|
||||||
|
player.meleeCrit = (int) (player.meleeCrit * 1.10f);
|
||||||
|
|
||||||
|
// Mind
|
||||||
|
player.pickSpeed *= 1.10f;
|
||||||
|
player.tileSpeed *= 1.10f;
|
||||||
|
player.rangedDamage *= 1.10f;
|
||||||
|
player.rangedCrit = (int) (player.rangedCrit * 1.10f);
|
||||||
|
player.thrownDamage *= 1.10f;
|
||||||
|
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
||||||
|
|
||||||
|
player.AddBuff(BuffID.Spelunker, 1);
|
||||||
|
player.AddBuff(BuffID.Dangersense, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||||
|
{
|
||||||
|
tooltips.Add(new TooltipLine(mod, "trinity", "Trinity")
|
||||||
|
{
|
||||||
|
overrideColor = ChatManager.WaveColor(Color.Orange)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TrinityItemEffects : GlobalItem
|
||||||
|
{
|
||||||
|
public override void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
|
||||||
|
{
|
||||||
|
if (crit && player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Trinity>()))
|
||||||
|
{
|
||||||
|
player.LeechMana(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
|
||||||
|
{
|
||||||
|
if (crit && player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Trinity>()))
|
||||||
|
{
|
||||||
|
player.LeechMana(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TrinityProjectileEffects : 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<Trinity>()))
|
||||||
|
{
|
||||||
|
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<Trinity>()))
|
||||||
|
{
|
||||||
|
owner.LeechMana(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyHitPvp(Projectile projectile, Player target, ref int damage, ref bool crit)
|
||||||
|
{
|
||||||
|
Ricochet(projectile, target, true, ref damage);
|
||||||
|
IgnoreHit(target, ref damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyHitPlayer(Projectile projectile, Player target, ref int damage, ref bool crit)
|
||||||
|
{
|
||||||
|
if (Ricochet(projectile, target, false, ref damage))
|
||||||
|
{
|
||||||
|
projectile.hostile = false;
|
||||||
|
projectile.friendly = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IgnoreHit(target, ref damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Ricochet(Projectile projectile, Player player, bool fromPlayer, ref int damage)
|
||||||
|
{
|
||||||
|
if (Main.expertMode && Main.rand.NextBool(10) &&
|
||||||
|
player.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Trinity>()))
|
||||||
|
{
|
||||||
|
return projectile.Richochet(player, fromPlayer, ref damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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/Trinity.png
Normal file
BIN
Content/Items/Accessories/Trinity/Trinity.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
64
Lib/Util/ProjectileUtils.cs
Normal file
64
Lib/Util/ProjectileUtils.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Terraria;
|
||||||
|
|
||||||
|
namespace Decimation.Lib.Util
|
||||||
|
{
|
||||||
|
public static class ProjectileUtils
|
||||||
|
{
|
||||||
|
public static bool Richochet(this Terraria.Projectile projectile, Player player, bool fromPlayer,
|
||||||
|
ref int damage)
|
||||||
|
{
|
||||||
|
// if (Main.expertMode && Main.rand.NextBool(10) &&
|
||||||
|
// target.GetModPlayer().HasEquippedAccessory(ModContent.ItemType<Body>()))
|
||||||
|
// {
|
||||||
|
Entity newTarget = null;
|
||||||
|
float lastDistance = float.MaxValue;
|
||||||
|
if (fromPlayer)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Main.player.Length; i++)
|
||||||
|
{
|
||||||
|
Player targetPlayer = Main.player[i];
|
||||||
|
if (player != null && player.active && !player.dead && player.whoAmI != targetPlayer.whoAmI)
|
||||||
|
{
|
||||||
|
float distance = projectile.Distance(player.Center);
|
||||||
|
if (distance < 1000f && distance < lastDistance)
|
||||||
|
{
|
||||||
|
lastDistance = distance;
|
||||||
|
newTarget = player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Main.npc.Length; i++)
|
||||||
|
{
|
||||||
|
NPC npc = Main.npc[i];
|
||||||
|
if (npc != null && npc.active && !npc.friendly)
|
||||||
|
{
|
||||||
|
float distance = projectile.Distance(npc.Center);
|
||||||
|
if (distance < 1000f && distance < lastDistance)
|
||||||
|
{
|
||||||
|
lastDistance = distance;
|
||||||
|
newTarget = npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newTarget == null) return false;
|
||||||
|
|
||||||
|
float speed = projectile.velocity.Length();
|
||||||
|
Vector2 velocity = newTarget.Center - projectile.Center;
|
||||||
|
velocity.Normalize();
|
||||||
|
velocity *= speed;
|
||||||
|
|
||||||
|
projectile.velocity = velocity;
|
||||||
|
projectile.damage = (int) (projectile.damage * 1.5f);
|
||||||
|
|
||||||
|
damage = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user