Files
CalamityModPublic/Projectiles/Summon/TacticalPlagueEngineSummon.cs
T
Andrew Marheine 99fd27bd88 1 - Yharon no longer sticks to a position before doing an attack.
2 - Yharon decreases his fast charge telegraph time as he enters later phases.
3 - Ultimus Cleaver and Inferna Cutter no longer benefit from true melee boosts.
4 - Reduced the potency of defense damage.
5 - Lava and honey no longer inflict sulphur poison while in the sulphur sea.
6 - Reduced Elysian Wings move speed boost.
7 - Reduced Hadarian Wings move speed boost while wearing Astral Armor.
8 - Buffed MOAB jump speed boost.
9 - Nerfed Heart of the Elements damage in post-ML.
10 - Nerfed Holy Fire Bullet damage.
11 - Nerfed Angel Wings, Demon Wings, Butterfly Wings, Fairy Wings, Bone Wings, Flame Wings, Ghost Wings, Beetle Wings, Leaf Wings, Bat Wings and Festive Wings extra bonuses.
12 - DoG head and tail damage multiplier scales with distance from target.
13 - DoG phase 1 and 2 fire a single laser directly at the player during laser attacks in expert+.
14 - Old Duke Tooth Balls and projectiles no longer i-frame fuck the player.
15 - Increased Aquatic Scourge despawn distance from 500 tiles to 800 to prevent fear of accidental despawns.
16 - Golem Head hitbox fix, I hope.
17 - Greatly increased post-DoG event spawn rates.
18 - Increased Elemental Axe i-frames from 6 to 15.
2020-12-16 08:14:49 -06:00

179 lines
7.5 KiB
C#

using CalamityMod.Buffs.Summon;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class TacticalPlagueEngineSummon : ModProjectile
{
public static Item FalseGun = null;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Tactical Plague Jet");
Main.projFrames[projectile.type] = 3;
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 52;
projectile.height = 32;
projectile.netImportant = true;
projectile.friendly = true;
projectile.minionSlots = 1;
projectile.timeLeft = 18000;
projectile.penetrate = -1;
projectile.timeLeft *= 5;
projectile.minion = true;
projectile.tileCollide = false;
projectile.extraUpdates = 1;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (projectile.localAI[0] == 0f)
{
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 * 2f, (int)CalamityDusts.Plague, velocity);
dust.noGravity = true;
}
FalseGun = ItemLoader.GetItem(ModContent.ItemType<P90>()).item;
projectile.localAI[0] = 1f;
}
if (projectile.frameCounter++ > 6f)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 0;
}
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
{
int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
projectile.Calamity().spawnedPlayerMinionDamageValue *
player.MinionDamage());
projectile.damage = trueDamage;
}
bool isCorrectProjectile = projectile.type == ModContent.ProjectileType<TacticalPlagueEngineSummon>();
player.AddBuff(ModContent.BuffType<TacticalPlagueEngineBuff>(), 3600);
if (isCorrectProjectile)
{
if (player.dead)
{
modPlayer.plagueEngine = false;
}
if (modPlayer.plagueEngine)
{
projectile.timeLeft = 2;
}
}
NPC potentialTarget = projectile.Center.MinionHoming(1560f, player);
if (potentialTarget is null || !player.HasAmmo(FalseGun, false))
{
float acceleration = 0.1f;
Vector2 distanceVector = player.Center - projectile.Center;
if (distanceVector.Length() < 200f)
{
acceleration = 0.07f;
}
if (distanceVector.Length() < 140f)
{
acceleration = 0.035f;
}
if (distanceVector.Length() > 100f)
{
if (Math.Abs(player.Center.X - projectile.Center.X) > 20f)
{
projectile.velocity.X += acceleration * Math.Sign(player.Center.X - projectile.Center.X);
}
if (Math.Abs(player.Center.Y - projectile.Center.Y) > 10f)
{
projectile.velocity.Y += acceleration * Math.Sign(player.Center.Y - projectile.Center.Y);
}
}
else if (projectile.velocity.Length() > 4f)
{
projectile.velocity *= 0.95f;
}
if (Math.Abs(projectile.velocity.Y) < 2f)
{
projectile.velocity.Y += 0.1f * Math.Sign(player.Center.Y - projectile.Center.Y);
}
if (projectile.velocity.Length() > 9f)
{
projectile.velocity = Vector2.Normalize(projectile.velocity) * 9f;
}
if (projectile.velocity.X > 0.25f)
{
projectile.spriteDirection = 1;
}
else if (projectile.velocity.X < -0.25f)
{
projectile.spriteDirection = -1;
}
projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f);
if (distanceVector.Length() > 2700f)
{
projectile.Center = player.Center;
projectile.netUpdate = true;
}
}
else
{
projectile.spriteDirection = 1;
Vector2 idealVelocity = projectile.DirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f;
projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, 0.035f);
projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.1f);
if (projectile.ai[0]++ % 75f == 24f)
{
int damage = projectile.damage;
if (projectile.ai[1]++ % 20f == 0f)
{
int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType<MK2RocketHoming>(),
(int)(damage * 1.5), 5f, projectile.owner);
Main.projectile[idx].Calamity().forceMinion = true;
}
else
{
int shoot = 0;
float shootSpeed = 0f;
bool canShoot = true;
float knockBack = projectile.knockBack * 0.5f;
player.PickAmmo(FalseGun, ref shoot, ref shootSpeed, ref canShoot, ref damage, ref knockBack);
int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, shoot,
damage, knockBack, projectile.owner);
// There's airway for a small bug in here, but the potential alterative (that has indeed been appearing), where
// the projectile simply cannot exist, is far worse than this. If you have another solution, let me know.
if (idx >= 0 && idx < Main.projectile.Length)
{
Main.projectile[idx].Calamity().forceMinion = true;
}
}
}
projectile.MinionAntiClump(0.25f);
}
}
public override bool CanDamage() => false;
}
}