Finish set bonuses, add more options to the Avali Trader
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
Reference in New Issue
Block a user