2 - Provi darkness is now at max distance during all attacks while any guardian is alive. 3 - Elemental Quiver increases ranged damage by 15% instead of 10%. 4 - Increased Frequency Manipulator damage by 13 and made it throw the spear sooner. 5 - Increased Galvanizing Glaive damage by 16 and made the spear itself ignore more i-frames. 6 - Increased Gauss Dagger size by 50% and allowed the player to turn while using it. 7 - Decreased Gauss Pistol damage by 20 and made the projectile stay still for half the time. 8 - Increased Plasma Grenade damage by 1000 and gave it an impact sound. 9 - Increased Pulse Rifle damage by 2000. 10 - Increased Snake Eyes damage by 15 and made the leash distance longer. 11 - Decreased Taser damage by 6 and increased the velocity of it. 12 - Increased Tesla Cannon damage by 5000 and increased split beam damage by 10%. 13 - Tripled Wave Pounder damage. 14 - Reduced Shadowdrop Staff projectiles from 20 per use to 6 and reduced spread by 75%. 15 - Increased Ancient Crusher size by 50% again. 16 - Increased Astral Blade damage due to how dangerous it is to use at times. 17 - Gave Brimlance, Earthen Pike, Fulguration Halberd, Goldplume Spear, Hellion Flower Spear, Marnite Spear, Sausage Maker, Starnight Lance, Urchin Spear and Yateveo Bloom autoswing. 18 - Increased Earthen Pike, Majestic Guard and Fulguration Halberd size by 50%. 19 - Decreased Insidious Impaler damage by 40. 20 - Ultimus Cleaver explodes on hit now and increased size by 50%. 21 - Decreased Arterial Assault damage by 32. 22 - Onyxia onyx shard travels further. 23 - Increased God's Bellows range. 24 - Made SCal bullet hell 5 feel less rng with how full or empty it can sometimes feel. 25 - Reduced how often Supreme Catastrophe fires projectiles. 26 - Reduced how insane Old Duke is in Boss Rush. 27 - Reduced Rev+ Destroyer laser speed again from 14 to 12. 28 - Fixed a bug with Rev+ Destroyer flying phase lights where they'd show even when broken. 29 - Dark Energies resist piercing. 30 - Skeletron Head is now immune to all debuffs. 31 - Storm Weaver phase 2 resists Wave Pounder. 32 - Increased Volt Crasher Voltage Stream damage. 33 - Destroyer and Aquatic Scourge resist Volt Crasher. 34 - Gauss Rifle dust particles are smaller and the explosion no longer vanishes when tiles are near it, made the explosion pierce infinitely. 35 - Pole Warpers ignore more i-frames. 36 - Gave Pulse Dragon an extra update. 37 - Decreased Tracking Disk laser damage. 38 - Matter Modulator projectiles now deal a third of their damage if they haven't hit a tile yet to avoid confusion. 39 - Astral Pike stars now home in. 40 - Gilded Proboscis heals less often. 41 - Increased Goldplume Spear feather damage. 42 - Increased Avalanche ice shard damage. 43 - Gave Mourningstar an extra update and made it ignore more i-frames. 44 - True Caustic Edge projectiles no longer gain damage on tile collision. 45 - Version bump.
190 lines
7.5 KiB
C#
190 lines
7.5 KiB
C#
using CalamityMod.Buffs.Summon;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.DraedonsArsenal
|
|
{
|
|
public class PoleWarperSummon : ModProjectile
|
|
{
|
|
public float AngularOffset = 0f;
|
|
public const float MaximumRepulsionSpeed = 13f;
|
|
public float Time
|
|
{
|
|
get => projectile.ai[0];
|
|
set => projectile.ai[0] = value;
|
|
}
|
|
public bool North
|
|
{
|
|
get => projectile.ai[1] == 1f;
|
|
set => projectile.ai[1] = value.ToInt();
|
|
}
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Pole Warper");
|
|
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
|
|
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = projectile.height = 22;
|
|
projectile.netImportant = true;
|
|
projectile.friendly = true;
|
|
projectile.minionSlots = 0.5f;
|
|
projectile.timeLeft = 18000;
|
|
projectile.penetrate = -1;
|
|
projectile.timeLeft *= 5;
|
|
projectile.minion = true;
|
|
projectile.tileCollide = false;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 12;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Player player = Main.player[projectile.owner];
|
|
if (projectile.localAI[0] == 0f)
|
|
{
|
|
Initialize(player);
|
|
projectile.localAI[0] = 1f;
|
|
}
|
|
GrantBuffs(player);
|
|
NPC potentialTarget = projectile.Center.MinionHoming(900f, player);
|
|
if (potentialTarget is null)
|
|
{
|
|
PlayerMovement(player);
|
|
RepelMovement();
|
|
}
|
|
else
|
|
{
|
|
NPCMovement(potentialTarget);
|
|
if (Time % 90f < 60f)
|
|
{
|
|
RepelMovement();
|
|
}
|
|
}
|
|
Time++;
|
|
}
|
|
|
|
public void Initialize(Player player)
|
|
{
|
|
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
|
|
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
|
|
for (int i = 0; i < 45; i++)
|
|
{
|
|
float angle = MathHelper.TwoPi / 45f * i;
|
|
Vector2 velocity = angle.ToRotationVector2() * 4f;
|
|
Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 261, velocity);
|
|
dust.noGravity = true;
|
|
}
|
|
}
|
|
|
|
// While this projectile cannot attack, the projectiles it shoots derive from the damage.
|
|
public void AdjustDamage(Player player)
|
|
{
|
|
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
|
{
|
|
int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
|
|
projectile.Calamity().spawnedPlayerMinionDamageValue *
|
|
player.MinionDamage());
|
|
projectile.damage = trueDamage;
|
|
}
|
|
}
|
|
|
|
public void GrantBuffs(Player player)
|
|
{
|
|
bool isCorrectProjectile = projectile.type == ModContent.ProjectileType<PoleWarperSummon>();
|
|
player.AddBuff(ModContent.BuffType<PoleWarperBuff>(), 3600);
|
|
if (isCorrectProjectile)
|
|
{
|
|
if (player.dead)
|
|
{
|
|
player.Calamity().poleWarper = false;
|
|
}
|
|
if (player.Calamity().poleWarper)
|
|
{
|
|
projectile.timeLeft = 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void PlayerMovement(Player player)
|
|
{
|
|
Vector2 destination = player.Center + Vector2.UnitY.RotatedBy(Time / 16f + AngularOffset + (!North).ToInt() * MathHelper.Pi) * 180f;
|
|
projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f;
|
|
projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 10f;
|
|
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
|
}
|
|
|
|
public void NPCMovement(NPC npc)
|
|
{
|
|
for (int i = 0; i < Main.projectile.Length; i++)
|
|
{
|
|
if (Main.projectile[i].type == projectile.type &&
|
|
Main.projectile[i].active &&
|
|
projectile.owner == projectile.owner)
|
|
{
|
|
PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile;
|
|
if (otherPole.Time != Time && otherPole.Time != Time + 1)
|
|
{
|
|
otherPole.Time = Time;
|
|
}
|
|
}
|
|
}
|
|
if (Time % 90f < 40f)
|
|
{
|
|
float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi;
|
|
Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f;
|
|
projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f;
|
|
projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 23f;
|
|
projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2;
|
|
}
|
|
else if (Time % 90f < 60f)
|
|
{
|
|
projectile.velocity *= 0.96f;
|
|
projectile.rotation += 0.05f;
|
|
}
|
|
else if (Time % 90f == 60f)
|
|
{
|
|
projectile.velocity = projectile.DirectionTo(npc.Center) * 26f;
|
|
projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2;
|
|
}
|
|
}
|
|
|
|
public void RepelMovement()
|
|
{
|
|
// This does not incorporate attraction on purpose. Doing so causes the minions to very easily become distracted.
|
|
for (int i = 0; i < Main.projectile.Length; i++)
|
|
{
|
|
if (Main.projectile[i].type == projectile.type &&
|
|
Main.projectile[i].active &&
|
|
projectile.Distance(Main.projectile[i].Center) < 40f)
|
|
{
|
|
PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile;
|
|
if (otherPole.North != North)
|
|
{
|
|
float distanceFromOtherPole = projectile.Distance(Main.projectile[i].Center) + 1f;
|
|
if (float.IsNaN(distanceFromOtherPole) || distanceFromOtherPole < 1f)
|
|
{
|
|
distanceFromOtherPole = 1f;
|
|
}
|
|
float repulsionSpeed = MaximumRepulsionSpeed * (float)Math.Pow(3f, -distanceFromOtherPole / 27f);
|
|
projectile.velocity -= (Main.projectile[i].Center - projectile.Center).SafeNormalize(Vector2.UnitY) * repulsionSpeed;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, 1, 2);
|
|
return false;
|
|
}
|
|
}
|
|
}
|