Add Nullified debuff, add Transcendent weapons and tool
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentBladeShard : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 12;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.penetrate = 4;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.alpha = 40;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
Lighting.AddLight(Projectile.Center, 0.35f, 0.25f, 0.55f);
|
||||
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.localAI[0] = 1f;
|
||||
Projectile.velocity *= 1.1f;
|
||||
}
|
||||
|
||||
NPC target = FindTarget(720f);
|
||||
if (target != null)
|
||||
{
|
||||
float homingStrength = 0.18f;
|
||||
float desiredSpeed = 20f;
|
||||
Vector2 desiredVelocity = Projectile.DirectionTo(target.Center) * desiredSpeed;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, homingStrength);
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
int dustIndex = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 150, default, 1.2f);
|
||||
Dust dust = Main.dust[dustIndex];
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Projectile.velocity * 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
private NPC FindTarget(float maxDetectDistance)
|
||||
{
|
||||
NPC selected = null;
|
||||
float sqr = maxDetectDistance * maxDetectDistance;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.CanBeChasedBy())
|
||||
{
|
||||
float dist = Vector2.DistanceSquared(npc.Center, Projectile.Center);
|
||||
if (dist < sqr)
|
||||
{
|
||||
sqr = dist;
|
||||
selected = npc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return selected;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Daybreak, 300);
|
||||
target.AddBuff(ModContent.BuffType<Content.Buffs.Debuffs.TypeNull>(), 300);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,93 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentNova : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 28;
|
||||
Projectile.height = 28;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.08f;
|
||||
Projectile.velocity *= 0.97f;
|
||||
Lighting.AddLight(Projectile.Center, 0.55f, 0.35f, 0.75f);
|
||||
|
||||
if (Projectile.localAI[0]++ > 20f && Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.GemAmethyst, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 150, default, 1.3f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity += Projectile.velocity * 0.1f;
|
||||
}
|
||||
|
||||
if (Projectile.localAI[1]++ >= 8f)
|
||||
{
|
||||
Projectile.localAI[1] = 0f;
|
||||
int healAmount = 1;
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
if (owner.active && !owner.dead && owner.Distance(Projectile.Center) < 400f)
|
||||
{
|
||||
owner.statLife = Math.Min(owner.statLife + healAmount, owner.statLifeMax2);
|
||||
owner.HealEffect(healAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Daybreak, 300);
|
||||
target.AddBuff(ModContent.BuffType<Content.Buffs.Debuffs.TypeNull>(), 300);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
Vector2 dustVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6f, 12f);
|
||||
Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.GemAmethyst, dustVelocity.X, dustVelocity.Y, 120, default, 1.6f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int shardCount = 6;
|
||||
for (int i = 0; i < shardCount; i++)
|
||||
{
|
||||
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(7f, 12f);
|
||||
Projectile.NewProjectile(
|
||||
Projectile.GetSource_FromThis(),
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<TranscendentBladeShard>(),
|
||||
(int)(Projectile.damage * 0.85f),
|
||||
Projectile.knockBack,
|
||||
Projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,92 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
||||
{
|
||||
public class TranscendentRailBolt : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 3;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.penetrate = 8;
|
||||
Projectile.timeLeft = 240;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.light = 0.6f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.localAI[0] = 1f;
|
||||
SoundEngine.PlaySound(SoundID.Item72, Projectile.position);
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.5f, 0.55f, 0.8f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Vector2 dustVelocity = Projectile.velocity * 0.2f;
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, dustVelocity.X, dustVelocity.Y, 150, default, 1.2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
SplitIntoShards();
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SplitIntoShards();
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 1.3f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void SplitIntoShards()
|
||||
{
|
||||
if (Projectile.owner != Main.myPlayer)
|
||||
return;
|
||||
|
||||
int shardCount = 3;
|
||||
for (int i = 0; i < shardCount; i++)
|
||||
{
|
||||
Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(25f)) * 0.7f;
|
||||
if (velocity.LengthSquared() < 1f)
|
||||
{
|
||||
velocity = new Vector2(0f, -6f);
|
||||
}
|
||||
|
||||
Projectile.NewProjectile(
|
||||
Projectile.GetSource_FromThis(),
|
||||
Projectile.Center,
|
||||
velocity,
|
||||
ModContent.ProjectileType<TranscendentBladeShard>(),
|
||||
(int)(Projectile.damage * 0.7f),
|
||||
Projectile.knockBack * 0.6f,
|
||||
Projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 B |
Reference in New Issue
Block a user