Updated the Mind.
This commit is contained in:
parent
a2935f61ce
commit
66e8daedec
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Decimation.Content.Projectiles.Item.Accessory.Trinity;
|
using Decimation.Content.Projectiles.Item.Accessory.Trinity;
|
||||||
using Decimation.Lib.Util;
|
using Decimation.Lib.Util;
|
||||||
using Microsoft.Xna.Framework;
|
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 damage by 10%\n" +
|
||||||
"Increases ranged and thrown critical hit chances by 10%\n" +
|
"Increases ranged and thrown critical hit chances by 10%\n" +
|
||||||
"Increases view range\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()
|
protected override void InitAccessory()
|
||||||
{
|
{
|
||||||
@ -41,6 +44,13 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
||||||
player.scope = true;
|
player.scope = true;
|
||||||
|
|
||||||
|
if (_trinityBeamCounter >= 60)
|
||||||
|
{
|
||||||
|
MindEffect(player);
|
||||||
|
_trinityBeamCounter = 0;
|
||||||
|
}
|
||||||
|
_trinityBeamCounter++;
|
||||||
|
|
||||||
base.UpdateAccessory(player, hideVisual);
|
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);
|
||||||
{
|
}
|
||||||
bool targetIsPlayer = target.GetType() == typeof(Player);
|
|
||||||
|
|
||||||
// Target
|
public override void NetRecieve(BinaryReader reader)
|
||||||
Entity projTarget = null;
|
{
|
||||||
|
_trinityBeamCounter = reader.ReadInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void MindEffect(Player player)
|
||||||
|
{
|
||||||
|
if (Main.rand.NextBool(25))
|
||||||
|
{
|
||||||
|
NPC target = null;
|
||||||
float lastDistance = float.MaxValue;
|
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++)
|
for (int n = 0; n < Main.npc.Length; n++)
|
||||||
{
|
{
|
||||||
NPC npcTarget = Main.npc[n];
|
NPC npcTarget = Main.npc[n];
|
||||||
if (npcTarget != null)
|
if (npcTarget != null)
|
||||||
{
|
{
|
||||||
float distance = npcTarget.Distance(target.position);
|
float distance = npcTarget.Distance(player.position);
|
||||||
if (npcTarget.active && !npcTarget.friendly && (targetIsPlayer || npcTarget.whoAmI != target.whoAmI) &&
|
if (npcTarget.active && !npcTarget.friendly && distance < 1000f && distance < lastDistance)
|
||||||
distance < 1000f && distance < lastDistance)
|
|
||||||
{
|
{
|
||||||
projTarget = npcTarget;
|
target = npcTarget;
|
||||||
lastDistance = distance;
|
lastDistance = distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projTarget != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
Vector2 velocity = projTarget.Center - target.Center;
|
Vector2 velocity = target.Center - player.Center;
|
||||||
velocity.Normalize();
|
velocity.Normalize();
|
||||||
velocity *= TrinityBeamSpeed;
|
velocity *= TrinityBeamSpeed;
|
||||||
|
|
||||||
Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType<TrinityBeam>(), TrinityBeamDamage, 2f,
|
Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType<TrinityBeam>(),
|
||||||
|
TrinityBeamDamage, 2f,
|
||||||
player.whoAmI);
|
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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Decimation.Content.Items.Misc.ConcentratedSouls;
|
using Decimation.Content.Items.Misc.ConcentratedSouls;
|
||||||
using Decimation.Content.Tiles;
|
using Decimation.Content.Tiles;
|
||||||
|
using Decimation.Lib.Util;
|
||||||
using Decimation.Lib.Util.Builder;
|
using Decimation.Lib.Util.Builder;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
@ -21,11 +23,13 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
"Increases all critical hit chances by 10%\n" +
|
"Increases all critical hit chances by 10%\n" +
|
||||||
"Increases minions knockback by 10%\n" +
|
"Increases minions knockback by 10%\n" +
|
||||||
"Increases view range\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" +
|
"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 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";
|
"Hostile projectiles have 10% chance to ricochet off you\nand target your enemies with 50% increased damage";
|
||||||
|
|
||||||
|
private int _trinityBeamCounter;
|
||||||
|
|
||||||
protected override void InitAccessory()
|
protected override void InitAccessory()
|
||||||
{
|
{
|
||||||
item.width = 34;
|
item.width = 34;
|
||||||
@ -57,6 +61,17 @@ namespace Decimation.Content.Items.Accessories.Trinity
|
|||||||
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
player.thrownCrit = (int) (player.thrownCrit * 1.10f);
|
||||||
player.scope = true;
|
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);
|
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()
|
protected override ModRecipe GetRecipe()
|
||||||
{
|
{
|
||||||
return new RecipeBuilder(this)
|
return new RecipeBuilder(this)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user