Finish set bonuses, add more options to the Avali Trader
@@ -0,0 +1,126 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Players;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Avali
|
||||
{
|
||||
public class AvaliHuntingDrone : ModProjectile
|
||||
{
|
||||
private const float OrbitSpeed = 0.045f;
|
||||
private const float OrbitRadius = 96f;
|
||||
private const int ShootCooldown = 28;
|
||||
private const float TargetRange = 920f;
|
||||
private const float ShotSpeed = 19.5f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = false;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 26;
|
||||
Projectile.height = 26;
|
||||
Projectile.friendly = false;
|
||||
Projectile.minion = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.damage = 0;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
AvaliVanguardPlayer modPlayer = owner.GetModPlayer<AvaliVanguardPlayer>();
|
||||
if (!owner.active || owner.dead || !modPlayer.HuntingDronesActive)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
float index = Projectile.ai[0];
|
||||
float total = Projectile.ai[1];
|
||||
if (total <= 0f)
|
||||
{
|
||||
total = 3f;
|
||||
}
|
||||
|
||||
float rotation = (Main.GameUpdateCount * OrbitSpeed) + index * MathHelper.TwoPi / total;
|
||||
Vector2 offset = rotation.ToRotationVector2() * OrbitRadius;
|
||||
Projectile.Center = owner.Center + offset;
|
||||
Projectile.velocity = owner.velocity;
|
||||
Projectile.rotation = (owner.Center - Projectile.Center).ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.35f, 0.6f, 1f);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
if (Projectile.localAI[0] >= ShootCooldown)
|
||||
{
|
||||
Projectile.localAI[0] = 0f;
|
||||
NPC target = AcquireTarget(owner, Projectile.Center, TargetRange);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 velocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * ShotSpeed;
|
||||
int damage = AvaliVanguardPlayer.GetDroneBaseDamage(owner);
|
||||
var source = Projectile.GetSource_FromAI();
|
||||
Projectile.NewProjectile(
|
||||
source,
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<AvaliHuntingDroneShot>(),
|
||||
damage,
|
||||
2f,
|
||||
owner.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item12 with { Volume = 0.6f }, Projectile.Center);
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Player owner, Vector2 center, float range)
|
||||
{
|
||||
if (owner.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC target = Main.npc[owner.MinionAttackTargetNPC];
|
||||
if (target.CanBeChasedBy())
|
||||
{
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
NPC closest = null;
|
||||
float squaredRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (distance <= squaredRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
squaredRange = distance;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Avali
|
||||
{
|
||||
public class AvaliHuntingDroneShot : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 12;
|
||||
Projectile.height = 12;
|
||||
Projectile.friendly = true;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.alpha = 40;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Lighting.AddLight(Projectile.Center, 0.4f, 0.7f, 1.2f);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 120, default, 1.1f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item93 with { Volume = 0.4f }, Projectile.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,115 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Protogen
|
||||
{
|
||||
public class ProtogenOperativeNanite : ModProjectile
|
||||
{
|
||||
private const float DetectionRange = 640f;
|
||||
private const float HomingStrength = 0.14f;
|
||||
private const float DesiredSpeed = 14f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = false;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 20;
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
if (!owner.active || owner.dead)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile.rotation += 0.2f * Projectile.direction;
|
||||
Lighting.AddLight(Projectile.Center, 0.25f, 0.55f, 0.75f);
|
||||
|
||||
NPC target = AcquireTarget(owner, Projectile.Center, DetectionRange);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 desiredVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * DesiredSpeed;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, HomingStrength);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity *= 0.98f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, default, 1.1f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
int healAmount = (int)(damageDone * 0.5f);
|
||||
if (healAmount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
owner.statLife = Utils.Clamp(owner.statLife + healAmount, 0, owner.statLifeMax2);
|
||||
owner.HealEffect(healAmount);
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Player owner, Vector2 center, float range)
|
||||
{
|
||||
if (owner.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC target = Main.npc[owner.MinionAttackTargetNPC];
|
||||
if (target.CanBeChasedBy())
|
||||
{
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
NPC closest = null;
|
||||
float squaredRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (distance <= squaredRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
squaredRange = distance;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,124 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Players;
|
||||
using ForgottenWawiTech.Content.GlobalProjectiles;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Protogen
|
||||
{
|
||||
public class ProtogenSentinelCore : ModProjectile
|
||||
{
|
||||
private const float HoverRadius = 70f;
|
||||
private const float HoverSpeed = 0.035f;
|
||||
private const int FireCooldown = 32;
|
||||
private const float TargetRange = 950f;
|
||||
private const float BeamVelocity = 18f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = false;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 36;
|
||||
Projectile.height = 36;
|
||||
Projectile.friendly = false;
|
||||
Projectile.minion = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.damage = 0;
|
||||
Projectile.minionSlots = 0f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
ProtogenSentinelPlayer modPlayer = owner.GetModPlayer<ProtogenSentinelPlayer>();
|
||||
if (!owner.active || owner.dead || !modPlayer.SentinelCoreActive)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
float rotation = ((float)Main.GameUpdateCount * HoverSpeed) % MathHelper.TwoPi;
|
||||
Vector2 desiredOffset = new Vector2(0f, -HoverRadius).RotatedBy(rotation);
|
||||
Vector2 desiredPosition = owner.Center + desiredOffset;
|
||||
Projectile.Center = Vector2.Lerp(Projectile.Center, desiredPosition, 0.2f);
|
||||
Projectile.velocity = owner.velocity;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.2f, 0.6f, 0.9f);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
if (Projectile.localAI[0] >= FireCooldown)
|
||||
{
|
||||
Projectile.localAI[0] = 0f;
|
||||
NPC target = AcquireTarget(owner, Projectile.Center, TargetRange);
|
||||
if (target != null)
|
||||
{
|
||||
FireBeam(owner, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FireBeam(Player owner, NPC target)
|
||||
{
|
||||
Vector2 velocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * BeamVelocity;
|
||||
int damage = ProtogenSentinelPlayer.GetCoreDamage(owner);
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
Projectile beam = Projectile.NewProjectileDirect(
|
||||
source,
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<ProtogenSentinelCoreBeam>(),
|
||||
damage,
|
||||
3f,
|
||||
owner.whoAmI);
|
||||
beam.GetGlobalProjectile<ProtogenSentinelGlobalProjectile>().DisableSentinelSplit = true;
|
||||
SoundEngine.PlaySound(SoundID.Item33 with { Volume = 0.7f, Pitch = 0.15f }, Projectile.Center);
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Player owner, Vector2 center, float range)
|
||||
{
|
||||
if (owner.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC target = Main.npc[owner.MinionAttackTargetNPC];
|
||||
if (target.CanBeChasedBy())
|
||||
{
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
NPC closest = null;
|
||||
float squaredRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (distance <= squaredRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
squaredRange = distance;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,50 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.GlobalProjectiles;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Protogen
|
||||
{
|
||||
public class ProtogenSentinelCoreBeam : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.friendly = true;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Lighting.AddLight(Projectile.Center, 0.35f, 0.9f, 1.2f);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 150, default, 1.1f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Projectile.velocity * 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Projectile.GetGlobalProjectile<ProtogenSentinelGlobalProjectile>().DisableSentinelSplit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,87 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.GlobalProjectiles;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Protogen
|
||||
{
|
||||
public class ProtogenSentinelFragment : ModProjectile
|
||||
{
|
||||
private const float HomingRange = 560f;
|
||||
private const float HomingStrength = 0.18f;
|
||||
private const float DesiredSpeed = 15f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 240;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 15;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Lighting.AddLight(Projectile.Center, 0.3f, 0.8f, 1.15f);
|
||||
|
||||
NPC target = AcquireTarget(Projectile.Center, HomingRange);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 desiredVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * DesiredSpeed;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, HomingStrength);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity *= 0.99f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 120, default, 1.05f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Projectile.GetGlobalProjectile<ProtogenSentinelGlobalProjectile>().DisableSentinelSplit = true;
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Vector2 center, float range)
|
||||
{
|
||||
NPC closest = null;
|
||||
float squaredRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (distance <= squaredRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
squaredRange = distance;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,123 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Players;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Singularity
|
||||
{
|
||||
public class SingularityOrb : ModProjectile
|
||||
{
|
||||
private const float OrbitRadius = 90f;
|
||||
private const float OrbitSpeed = 0.04f;
|
||||
private const int FireCooldown = 22;
|
||||
private const float TargetRange = 1000f;
|
||||
private const float BeamSpeed = 21f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = false;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = false;
|
||||
Projectile.minion = true;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.minionSlots = 0f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
SingularityPlayer modPlayer = owner.GetModPlayer<SingularityPlayer>();
|
||||
if (!owner.active || owner.dead || !modPlayer.SingularityOrbActive)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
float rotation = ((float)Main.GameUpdateCount * OrbitSpeed) + Projectile.identity * 0.2f;
|
||||
Vector2 offset = new Vector2(0f, -OrbitRadius).RotatedBy(rotation);
|
||||
Vector2 desiredPos = owner.Center + offset;
|
||||
Projectile.Center = Vector2.Lerp(Projectile.Center, desiredPos, 0.28f);
|
||||
Projectile.velocity = owner.velocity;
|
||||
Projectile.rotation += 0.03f * Projectile.direction;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.55f, 0.2f, 0.65f);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
if (Projectile.localAI[0] >= FireCooldown)
|
||||
{
|
||||
Projectile.localAI[0] = 0f;
|
||||
NPC target = AcquireTarget(owner, Projectile.Center, TargetRange);
|
||||
if (target != null)
|
||||
{
|
||||
FireBeam(owner, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FireBeam(Player owner, NPC target)
|
||||
{
|
||||
Vector2 velocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * BeamSpeed;
|
||||
int damage = SingularityPlayer.GetOrbDamage(owner);
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
Projectile.NewProjectile(
|
||||
source,
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<SingularityOrbBeam>(),
|
||||
damage,
|
||||
2f,
|
||||
owner.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item91 with { Volume = 0.7f, Pitch = 0.35f }, Projectile.Center);
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Player owner, Vector2 center, float range)
|
||||
{
|
||||
if (owner.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC forced = Main.npc[owner.MinionAttackTargetNPC];
|
||||
if (forced.CanBeChasedBy())
|
||||
{
|
||||
return forced;
|
||||
}
|
||||
}
|
||||
|
||||
NPC closest = null;
|
||||
float sqrRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (dist <= sqrRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
sqrRange = dist;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Singularity
|
||||
{
|
||||
public class SingularityOrbBeam : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 16;
|
||||
Projectile.height = 16;
|
||||
Projectile.friendly = true;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.penetrate = 3;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 8;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Lighting.AddLight(Projectile.Center, 0.7f, 0.25f, 0.85f);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.PinkTorch, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 150, default, 1.2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,76 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentAscendantBolt : ModProjectile
|
||||
{
|
||||
private const float HomingRange = 720f;
|
||||
private const float HomingStrength = 0.2f;
|
||||
private const float DesiredSpeed = 20f;
|
||||
|
||||
/* public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
} */
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.friendly = true;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Lighting.AddLight(Projectile.Center, 0.6f, 0.55f, 1.2f);
|
||||
|
||||
NPC target = AcquireTarget(Projectile.Center, HomingRange);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 desiredVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * DesiredSpeed;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, HomingStrength);
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Enchanted_Pink, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 150, default, 1.15f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Vector2 center, float range)
|
||||
{
|
||||
NPC closest = null;
|
||||
float sqrRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (dist <= sqrRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
sqrRange = dist;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,130 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Players;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentAscendantDrone : ModProjectile
|
||||
{
|
||||
private const float OrbitRadius = 136f;
|
||||
private const float OrbitSpeed = 0.055f;
|
||||
private const int FireCooldown = 18;
|
||||
private const float TargetRange = 1100f;
|
||||
private const float BoltSpeed = 19f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = false;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
//ProjectileID.Sets.Minion[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 28;
|
||||
Projectile.height = 28;
|
||||
Projectile.friendly = false;
|
||||
Projectile.minion = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.minionSlots = 0f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
TranscendentPlayer modPlayer = owner.GetModPlayer<TranscendentPlayer>();
|
||||
if (!owner.active || owner.dead || !modPlayer.HasTranscendentSet)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
float index = Projectile.ai[0];
|
||||
float total = Projectile.ai[1];
|
||||
if (total <= 0f)
|
||||
{
|
||||
total = 4f;
|
||||
}
|
||||
|
||||
float rotation = ((float)Main.GameUpdateCount * OrbitSpeed) + index * MathHelper.TwoPi / total;
|
||||
Vector2 offset = rotation.ToRotationVector2() * OrbitRadius;
|
||||
Projectile.Center = owner.Center + offset;
|
||||
Projectile.velocity = owner.velocity;
|
||||
Projectile.rotation = (owner.Center - Projectile.Center).ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.45f, 0.6f, 1.05f);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
if (Projectile.localAI[0] >= FireCooldown)
|
||||
{
|
||||
Projectile.localAI[0] = 0f;
|
||||
NPC target = AcquireTarget(owner, Projectile.Center, TargetRange);
|
||||
if (target != null)
|
||||
{
|
||||
FireBolt(owner, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FireBolt(Player owner, NPC target)
|
||||
{
|
||||
Vector2 velocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * BoltSpeed;
|
||||
int damage = TranscendentPlayer.GetAscendantDroneDamage(owner);
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
Projectile.NewProjectile(
|
||||
source,
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<TranscendentAscendantBolt>(),
|
||||
damage,
|
||||
4f,
|
||||
owner.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item33 with { Volume = 0.6f, Pitch = 0.2f }, Projectile.Center);
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Player owner, Vector2 center, float range)
|
||||
{
|
||||
if (owner.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC forced = Main.npc[owner.MinionAttackTargetNPC];
|
||||
if (forced.CanBeChasedBy())
|
||||
{
|
||||
return forced;
|
||||
}
|
||||
}
|
||||
|
||||
NPC closest = null;
|
||||
float sqrRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (dist <= sqrRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
sqrRange = dist;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,81 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentNaniteShard : ModProjectile
|
||||
{
|
||||
private const float HomingRange = 680f;
|
||||
private const float HomingStrength = 0.22f;
|
||||
private const float DesiredSpeed = 18f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 220;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 12;
|
||||
Projectile.alpha = 60;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.35f * Projectile.direction;
|
||||
Lighting.AddLight(Projectile.Center, 0.45f, 0.8f, 1.15f);
|
||||
|
||||
NPC target = AcquireTarget(Projectile.Center, HomingRange);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 desiredVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * DesiredSpeed;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, HomingStrength);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity *= 0.98f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 120, default, 1.05f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static NPC AcquireTarget(Vector2 center, float range)
|
||||
{
|
||||
NPC closest = null;
|
||||
float sqrRange = range * range;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (!npc.active || npc.friendly || npc.dontTakeDamage || npc.life <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = Vector2.DistanceSquared(npc.Center, center);
|
||||
if (dist <= sqrRange && Collision.CanHitLine(center, 0, 0, npc.Center, 0, 0))
|
||||
{
|
||||
sqrRange = dist;
|
||||
closest = npc;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |