Files
CalamityModPublic/Projectiles/Boss/OverlyDramaticDukeSummoner.cs
T
Andrew Marheine c882750bc8 1 - Reduced Boss Rush boss damage.
2 - Buffed DSA and DoG Lore by reducing the incrased damage taken. DSA went from 25% to 15% and DoG Lore went from 10% to 5%.
3 - Reduced Affliction damage boost by 2%.
4 - Trinket of Chi now gives its buff in 1 second instead of 2 seconds.
5 - Alchemical Flask and Plague Hive now disable the Plague debuff darkness effect.
6 - Increased Yharim's Insignia melee damage boost by 5%.
7 - Bloodworms have an increased chance to spawn and only spawn after the player has met the Old Duke at the end of the Acid Rain Tier 3.
8 - Amalgamated Brain damage boost decreased by 2% and the shade rain now triggers every 6 frames instead of at random.
9 - Void of Calamity now reduces damage reduction by 10% instead of 15% and the flames now rain down every 10 frames instead of at random.
10 - Heart of the Elements now boosts damage by 5% instead of 8% (7% if boobs are disabled).
11 - Rotten Brain now rains shade every 6 frames instead of at random.
12 - Amalgamated and Rotten Brain and Amalgam shade rain no longer penetrate.
13 - Samurai Badge downside removed.
14 - The Amalgam now rains shade and fire every 8 frames instead of at random.
15 - Void of Extinction rains fire down every 10 frames instead of at random.
16 - Removed Badge of Bravery from Yharim's Insignia recipe and Yharim's Insignia now takes Divine Geodes to craft.
17 - Buffed Galactus Blade damage by 25.
18 - Reduced Luxor's Gift projectile damage scaling values, the caps are still the same.
19 - Reduced Astrum Aureus HP by about 12.5%.
20 - Ceaseless Void Dark Energies now spread out.
21 - Desert Scourge out of desert enrage is more noticeable.
22 - DoG phase 1 and 2, Destroyer, Astrum Deus and Cosmic Guardians greatly increase speed when far away from their target.
23 - Hive Mind Hive Blobs die immediately when phase 1 dies.
24 - Leviathan and Anahita enrage is more noticeable.
25 - Plaguebringer Goliath Mines emit some light.
26 - Polter Clone turns invisible, aside from its glowmask, when it's lining up for its charge to convey that it doesn't deal contact damage.
27 - Ravager Flame Pillars spawn further away from the player.
28 - Detached Ravager Head stays further away from the player.
29 - SCal brothers move up and down more quickly.
30 - Cal Clone enrage is more noticeable.
31 - Astrum Aureus enrage is more noticeable.
32 - Made Eye of Cthulhu, Brain of Cthulhu, Twins and Eater of Worlds enrages more noticeable.
33 - Fixed Destroyer coiling issue.
34 - Destroyer changes color to purple during flight phase.
35 - Skeletron Prime rockets are slower.
36 - Moon Lord Phantasmal Eyes spawn slower and have a lower max velocity.
37 - Reduced damage of post-DoG moon enemies, post-Yharon eclipse enemies and post-ML dungeon enemies.
38 - Reduced many Cal Clone and Brimstone Elemental projectile-inflicted debuff durations.
39 - Cryogen projectiles turn blue during daytime.
40 - Made Ravager homing laser things hopefully more visible.
41 - Aegis Blade, Grand Guardian and Lion Heart true melee explosions deal less damage on each subsequent hit.
42 - Brimlash split projectiles home in quicker.
43 - Omage Biome Blade projectiles have less range.
44 - Death Mode Astral shader intensity reduced.
45 - Brimtone Elemental beam darts have larger gaps between them and now collide with tiles.
2020-11-01 13:58:46 -06:00

227 lines
7.4 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class OverlyDramaticDukeSummoner : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Old Duke Summoner");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = projectile.height = 1;
projectile.scale = 0.004f;
projectile.hostile = true;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.timeLeft = 1800;
}
private static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp = 100, int maxExpandDown = 100)
{
topY = startY;
bottomY = startY;
if (!WorldGen.InWorld(startX, startY, 10))
{
return;
}
int yUp = 0;
while (yUp < maxExpandUp && topY > 0 && topY >= 10 && Main.tile[startX, topY] != null)
{
topY--;
yUp++;
}
int yDown = 0;
while (yDown < maxExpandDown && bottomY < Main.maxTilesY - 10 && bottomY <= Main.maxTilesY - 10)
{
if (Main.tile[startX, bottomY] == null)
{
return;
}
bottomY++;
yDown++;
}
}
public override void AI()
{
projectile.rotation -= 0.15f * (float)(1D - (projectile.alpha / 255D));
projectile.ai[0]++;
float totalTilesToExpand = 1600f * projectile.scale / 16;
Point centerAsTileCoords = projectile.Center.ToTileCoordinates();
ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out int topY, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2));
topY++;
bottomY--;
Vector2 topVector = new Vector2(centerAsTileCoords.X, topY) * 16f + new Vector2(8f);
Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f);
Vector2 centerVector = Vector2.Lerp(topVector, bottomVector, 0.5f);
projectile.width = (int)(208 * projectile.scale);
projectile.height = (int)(bottomVector.Y - topVector.Y);
projectile.Center = centerVector;
if (projectile.ai[0] < 90f)
{
projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 90f);
projectile.scale = MathHelper.Lerp(0.004f, 1f, projectile.ai[0] / 90f);
}
// Spray gore and acid everywhere
else if (projectile.ai[0] < 480f)
{
if (projectile.ai[0] % 10f == 9f)
{
Vector2 velocity = new Vector2(0f, -18f).RotatedByRandom(0.7f);
Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity,
ModContent.ProjectileType<OldDukeSummonDrop>(), 65, 2f);
}
if (projectile.ai[0] % 35f == 34f)
{
Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), -7f - Main.rand.NextFloat(4f, 12f)).RotatedByRandom(0.5f);
Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity,
ModContent.ProjectileType<OldDukeGore>(), 65, 2f);
}
}
// Fade out and die
if (projectile.ai[0] >= 600f)
{
projectile.alpha = (int)MathHelper.Lerp(0f, 255f, (projectile.ai[0] - 600f) / 120f);
bool canSpawnBoomer = false;
for (int i = 0; i < Main.player.Length; i++)
{
if (!Main.player[i].dead && projectile.Distance(Main.player[i].Center) < 12000f)
{
canSpawnBoomer = true;
break;
}
}
// Summon the boomer duke
if (projectile.ai[0] == 660f)
{
if (canSpawnBoomer)
{
for (int i = 0; i < 160; i++)
{
Dust dust = Dust.NewDustPerfect(projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulfurousSeaAcid);
dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 23f);
dust.noGravity = true;
dust.scale = 3f;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int boomer = NPC.NewNPC((int)projectile.Top.X, (int)projectile.Top.Y + 100, ModContent.NPCType<OldDuke>());
string boomerName = Main.npc[boomer].TypeName;
if (Main.netMode == NetmodeID.SinglePlayer)
{
Main.NewText(Language.GetTextValue("Announcement.HasAwoken", boomerName), new Color(175, 75, 255));
return;
}
if (Main.netMode == NetmodeID.Server)
{
NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[]
{
Main.npc[boomer].GetTypeNetName()
}), new Color(175, 75, 255));
return;
}
CalamityUtils.BossAwakenMessage(boomer);
Main.npc[boomer].velocity = Vector2.UnitY * -12f;
Main.npc[boomer].alpha = 255;
Main.npc[boomer].Calamity().newAI[3] = 1f; // To signal that Old Duke should not deccelerate as it normally would
Main.npc[boomer].netUpdate = true;
CalamityWorld.triedToSummonOldDuke = true;
CalamityWorld.encounteredOldDuke = true;
AcidRainEvent.UpdateInvasion(false);
}
}
else
{
CalamityWorld.acidRainPoints = 0;
CalamityWorld.triedToSummonOldDuke = false;
AcidRainEvent.UpdateInvasion(false);
}
}
}
if (projectile.ai[0] >= 720f)
{
projectile.Kill();
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
float totalTilesToExpand = 1600f * projectile.scale / 16;
Point centerAsTileCoords = projectile.Center.ToTileCoordinates();
ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out _, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2));
bottomY--;
Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f);
Texture2D texture = ModContent.GetTexture(Texture);
float yMax = 1600f * projectile.scale;
for (int y = 0; y < yMax; y += 30)
{
float thetaDelta = MathHelper.Pi * y / yMax;
float scale = projectile.scale * MathHelper.Lerp(0.3f, 1.4f, y / yMax);
float alphaMultiplier = MathHelper.Lerp(1f, 0.6f, y / yMax);
spriteBatch.Draw(texture,
bottomVector - Main.screenPosition - Vector2.UnitY * y,
null,
Color.White * projectile.Opacity * 0.3f * alphaMultiplier,
projectile.rotation + thetaDelta,
texture.Size() * 0.5f,
scale,
SpriteEffects.None,
0f);
}
return false;
}
public override bool CanHitPlayer(Player target) => projectile.ai[0] >= 90f;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
return minDist <= 240f * projectile.scale;
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 420);
}
}
}