Updated the Mind.
This commit is contained in:
parent
a2935f61ce
commit
66e8daedec
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Decimation.Content.Projectiles.Item.Accessory.Trinity;
|
||||
using Decimation.Lib.Util;
|
||||
using Microsoft.Xna.Framework;
|
||||
@ -20,7 +21,9 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
"Increases ranged and thrown damage by 10%\n" +
|
||||
"Increases ranged and thrown critical hit chances by 10%\n" +
|
||||
"Increases view range\n" +
|
||||
"Melee attacks have 4% chance to fire a Trinity Beam";
|
||||
"Each second, there is 4% chance to fire a Trinity Beam toward a near enemy";
|
||||
|
||||
private int _trinityBeamCounter;
|
||||
|
||||
protected override void InitAccessory()
|
||||
{
|
||||
@ -41,6 +44,13 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
||||
player.scope = true;
|
||||
|
||||
if (_trinityBeamCounter >= 60)
|
||||
{
|
||||
MindEffect(player);
|
||||
_trinityBeamCounter = 0;
|
||||
}
|
||||
_trinityBeamCounter++;
|
||||
|
||||
base.UpdateAccessory(player, hideVisual);
|
||||
}
|
||||
|
||||
@ -52,72 +62,47 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
});
|
||||
}
|
||||
|
||||
public static void MindEffect(Player player, Entity target)
|
||||
public override void NetSend(BinaryWriter writer)
|
||||
{
|
||||
if (Main.rand.NextBool(25) && (player.HasEquippedAccessory(ModContent.ItemType<Mind>()) || player.HasEquippedAccessory(ModContent.ItemType<Trinity>())))
|
||||
writer.Write(_trinityBeamCounter);
|
||||
}
|
||||
|
||||
public override void NetRecieve(BinaryReader reader)
|
||||
{
|
||||
_trinityBeamCounter = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public static void MindEffect(Player player)
|
||||
{
|
||||
if (Main.rand.NextBool(25))
|
||||
{
|
||||
bool targetIsPlayer = target.GetType() == typeof(Player);
|
||||
|
||||
// Target
|
||||
Entity projTarget = null;
|
||||
NPC target = null;
|
||||
float lastDistance = float.MaxValue;
|
||||
if (targetIsPlayer)
|
||||
{
|
||||
for (int p = 0; p < Main.player.Length; p++)
|
||||
{
|
||||
Player playerTarget = Main.player[p];
|
||||
if (playerTarget != null)
|
||||
{
|
||||
float distance = playerTarget.Distance(target.position);
|
||||
if (playerTarget.active && !playerTarget.dead &&
|
||||
playerTarget.whoAmI != player.whoAmI && playerTarget.whoAmI != target.whoAmI &&
|
||||
distance < 1000f && distance < lastDistance)
|
||||
{
|
||||
projTarget = playerTarget;
|
||||
lastDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int n = 0; n < Main.npc.Length; n++)
|
||||
{
|
||||
NPC npcTarget = Main.npc[n];
|
||||
if (npcTarget != null)
|
||||
{
|
||||
float distance = npcTarget.Distance(target.position);
|
||||
if (npcTarget.active && !npcTarget.friendly && (targetIsPlayer || npcTarget.whoAmI != target.whoAmI) &&
|
||||
distance < 1000f && distance < lastDistance)
|
||||
float distance = npcTarget.Distance(player.position);
|
||||
if (npcTarget.active && !npcTarget.friendly && distance < 1000f && distance < lastDistance)
|
||||
{
|
||||
projTarget = npcTarget;
|
||||
target = npcTarget;
|
||||
lastDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (projTarget != null)
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 velocity = projTarget.Center - target.Center;
|
||||
Vector2 velocity = target.Center - player.Center;
|
||||
velocity.Normalize();
|
||||
velocity *= TrinityBeamSpeed;
|
||||
|
||||
Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType<TrinityBeam>(), TrinityBeamDamage, 2f,
|
||||
Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType<TrinityBeam>(),
|
||||
TrinityBeamDamage, 2f,
|
||||
player.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MindItemEffects : GlobalItem
|
||||
{
|
||||
public override void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
|
||||
{
|
||||
Mind.MindEffect(player, target);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
Mind.MindEffect(player, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Decimation.Content.Items.Misc.ConcentratedSouls;
|
||||
using Decimation.Content.Tiles;
|
||||
using Decimation.Lib.Util;
|
||||
using Decimation.Lib.Util.Builder;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@ -21,11 +23,13 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
"Increases all critical hit chances by 10%\n" +
|
||||
"Increases minions knockback by 10%\n" +
|
||||
"Increases view range\n" +
|
||||
"Melee attacks have 4% chance to fire a Trinity Beam\n" +
|
||||
"Each second, there is 4% chance to fire a Trinity Beam toward a near enemy\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";
|
||||
|
||||
private int _trinityBeamCounter;
|
||||
|
||||
protected override void InitAccessory()
|
||||
{
|
||||
item.width = 34;
|
||||
@ -57,6 +61,17 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
||||
player.scope = true;
|
||||
|
||||
if (_trinityBeamCounter >= 60)
|
||||
{
|
||||
Mind.MindEffect(player);
|
||||
_trinityBeamCounter = 0;
|
||||
}
|
||||
_trinityBeamCounter++;
|
||||
|
||||
player.EquipAccessory(ModContent.ItemType<Body>());
|
||||
player.EquipAccessory(ModContent.ItemType<Soul>());
|
||||
player.EquipAccessory(ModContent.ItemType<Mind>());
|
||||
|
||||
base.UpdateAccessory(player, hideVisual);
|
||||
}
|
||||
|
||||
@ -68,6 +83,16 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
||||
});
|
||||
}
|
||||
|
||||
public override void NetSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(_trinityBeamCounter);
|
||||
}
|
||||
|
||||
public override void NetRecieve(BinaryReader reader)
|
||||
{
|
||||
_trinityBeamCounter = reader.ReadInt32();
|
||||
}
|
||||
|
||||
protected override ModRecipe GetRecipe()
|
||||
{
|
||||
return new RecipeBuilder(this)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user