1 - Torrential Tear tooltip edit.

2 - Buffed Aegis Blade, Briny Baron and Sky Dragon's Fury left clicks.
3 - Nerfed Diseased Pike, Omniblade and Golem Fist.
4 - Ares giga death beam spiral.
5 - Ares Laser Arm fires normal lasers while Ares is doing the beam spiral.
6 - Thanatos adjustments.
7 - Malice Mode Crabulon jumps a bit quicker.
8 - Ravager jumps a bit more often.
9 - Rev+ Cultist channels the lightning orb attack for more time before doing other attacks.
10 - Ravager Body resists true melee by 50%.
11 - Res Butterfly minions take half a minion slot each now, greatly reduced the fire rate of the pink butterflies.
12 - Ravager head, claws and legs use the new piercing resist function.
This commit is contained in:
Andrew Marheine committed 2021-08-24 01:53:09 -05:00
1 parent ecb0e6cace
commit 5236dc053c
27 files changed
+610 -186

No files matched your search

+5
View File
@@ -2526,6 +2526,11 @@ namespace CalamityMod
NPCType<AquaticScourgeBody>(),
NPCType<AquaticScourgeBodyAlt>(),
NPCType<AquaticScourgeTail>(),
NPCType<RavagerHead>(),
NPCType<RavagerClawLeft>(),
NPCType<RavagerClawRight>(),
NPCType<RavagerLegLeft>(),
NPCType<RavagerLegRight>(),
NPCType<AstrumDeusHeadSpectral>(),
NPCType<AstrumDeusBodySpectral>(),
NPCType<AstrumDeusTailSpectral>(),
+5 -1
View File
@@ -258,7 +258,7 @@ namespace CalamityMod.Items
break;
case ItemID.GolemFist:
item.damage = 185;
item.damage = 150;
break;
case ItemID.BreakerBlade:
@@ -443,6 +443,10 @@ namespace CalamityMod.Items
item.damage = 20;
break;
case ItemID.MonkStaffT3:
item.damage = 225;
break;
case ItemID.BookStaff:
item.mana = 10;
break;
+2 -2
View File
@@ -14,8 +14,8 @@ namespace CalamityMod.Items.Tools.ClimateChange
Tooltip.SetDefault("Summons the rain.\n" +
"Rain will start some time after this item is used.\n" +
"If used while it's raining, the rain will stop some time afterward.\n" +
"In Death Mode, using this item while it's raining will reduce the amount of time the rain lingers for\n" +
"to one minute; however, not any lower, and this will cause the rain to turn violent for that minute.");
"In Death Mode, using this item while it's raining will reduce the amount of time the rain lingers for to one minute.\n" +
"However, this will cause the rain to turn violent for that time.");
}
public override void SetDefaults()
+2 -2
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee
item.width = 58;
item.height = 58;
item.scale = 1.5f;
item.damage = 110;
item.damage = 135;
item.melee = true;
item.useAnimation = item.useTime = 15;
item.useTurn = true;
@@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<AegisBeam>(), (int)(damage * 0.37), knockBack, player.whoAmI);
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<AegisBeam>(), (int)(damage * 0.3), knockBack, player.whoAmI);
return false;
}
+2 -2
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetDefaults()
{
item.damage = 127;
item.damage = 155;
item.knockBack = 4f;
item.useAnimation = item.useTime = 15;
item.melee = true;
@@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<Razorwind>(), (int)(damage * 0.52), knockBack, player.whoAmI);
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<Razorwind>(), (int)(damage * 0.43), knockBack, player.whoAmI);
return false;
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetDefaults()
{
item.width = 62;
item.damage = 92;
item.damage = 65;
item.melee = true;
item.noMelee = true;
item.useTurn = true;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetDefaults()
{
item.width = 64;
item.damage = 138;
item.damage = 100;
item.melee = true;
item.useAnimation = 10;
item.useStyle = ItemUseStyleID.SwingThrow;
+4 -4
View File
@@ -11858,7 +11858,7 @@ namespace CalamityMod.NPCs
int iceMistAmt = phase3 ? 2 : 1;
int fireballFireRate = phase5 ? 10 : 12;
float fireballSpeed = (phase6 ? 7.5f : 6f) + (death ? 2f * (1f - lifeRatio) : 0f) - (isCultist ? 0f : 3f);
int lightningOrbFireRate = phase2 ? 35 : 40;
int lightningOrbPhaseTime = phase2 ? 150 : 180;
int ancientLightSpawnRate = phase4 ? 25 : 30;
int ancientLightAmt = phase4 ? 3 : 2;
int ancientDoomLimit = 10;
@@ -11872,7 +11872,7 @@ namespace CalamityMod.NPCs
iceMistAmt = enraged ? 4 : 3;
fireballFireRate = enraged ? 6 : 8;
fireballSpeed *= 1.2f;
lightningOrbFireRate = enraged ? 20 : 30;
lightningOrbPhaseTime = enraged ? 60 : 90;
ancientLightSpawnRate = enraged ? 15 : 20;
ancientLightAmt = enraged ? 5 : 4;
idleTime = enraged ? 15 : 30;
@@ -11907,7 +11907,7 @@ namespace CalamityMod.NPCs
calamityGlobalNPC.newAI[0] = 120f;
iceMistSpeed = 16f;
iceMistFireRate = 15;
lightningOrbFireRate = 10;
lightningOrbPhaseTime = 30;
ancientLightSpawnRate = 5;
idleTime = 10;
timeToFinishRitual = 120f;
@@ -12391,7 +12391,7 @@ namespace CalamityMod.NPCs
}
npc.ai[1] += 1f;
if (npc.ai[1] >= (20 + lightningOrbFireRate))
if (npc.ai[1] >= (20 + lightningOrbPhaseTime))
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
+12 -1
View File
@@ -3317,7 +3317,8 @@ namespace CalamityMod.NPCs
// True melee resists
if (DesertScourgeIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper ||
PerforatorIDs.Contains(npc.type) || AquaticScourgeIDs.Contains(npc.type) || DestroyerIDs.Contains(npc.type) ||
AstrumDeusIDs.Contains(npc.type) || StormWeaverIDs.Contains(npc.type) || ThanatosIDs.Contains(npc.type) || npc.type == NPCType<DarkEnergy>())
AstrumDeusIDs.Contains(npc.type) || StormWeaverIDs.Contains(npc.type) || ThanatosIDs.Contains(npc.type) ||
npc.type == NPCType<DarkEnergy>() || npc.type == NPCType<RavagerBody>())
{
if (item.melee && item.type != ItemType<UltimusCleaver>() && item.type != ItemType<InfernaCutter>())
damage = (int)(damage * 0.5);
@@ -3359,6 +3360,10 @@ namespace CalamityMod.NPCs
}
}
// Nerfed because the primary fire was buffed a lot.
if (projectile.type == ProjectileID.MonkStaffT3_AltShot || (projectile.type == ProjectileID.Electrosphere && Main.player[projectile.owner].ActiveItem().type == ItemID.MonkStaffT3))
damage /= 4;
// Nerfed because these are really overpowered.
if (projectile.type == ProjectileID.CursedDartFlame)
damage /= 2;
@@ -3379,6 +3384,12 @@ namespace CalamityMod.NPCs
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (npc.type == NPCType<RavagerBody>())
{
// 50% resist to true melee.
if (projectile.Calamity().trueMelee)
damage = (int)(damage * 0.5);
}
else if (AstrumDeusIDs.Contains(npc.type))
{
// 75% resist to Stardust Dragon Staff and Plaguenades.
+1 -1
View File
@@ -379,7 +379,7 @@ namespace CalamityMod.NPCs.Crabulon
npc.ai[1] += !revenge ? 4f : 1f;
}
float jumpGateValue = (malice ? 90f : 240f) / (enrageScale + 1f);
float jumpGateValue = (malice ? 30f : 240f) / (enrageScale + 1f);
if (npc.ai[1] >= jumpGateValue)
{
npc.ai[1] = -20f;
+29 -14
View File
@@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
@@ -64,10 +65,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
private bool armsSpawned = false;
// Total duration of the deathray telegraph
private const float deathrayTelegraphDuration = 240f;
public const float deathrayTelegraphDuration = 240f;
// Total duration of the deathrays
private const float deathrayDuration = 600f;
public const float deathrayDuration = 600f;
public override void SetStaticDefaults()
{
@@ -103,6 +104,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
{
writer.Write(npc.chaseable);
writer.Write(npc.dontTakeDamage);
writer.Write(npc.localAI[0]);
for (int i = 0; i < 4; i++)
writer.Write(npc.Calamity().newAI[i]);
}
@@ -111,6 +113,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
{
npc.chaseable = reader.ReadBoolean();
npc.dontTakeDamage = reader.ReadBoolean();
npc.localAI[0] = reader.ReadSingle();
for (int i = 0; i < 4; i++)
npc.Calamity().newAI[i] = reader.ReadSingle();
}
@@ -230,8 +233,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool anyOtherExoMechPassive = exoWormPassive || exoSpazPassive || exoRetPassive;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f;
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// If Ares doesn't go berserk
bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoSpazLifeRatio < 0.4f || exoRetLifeRatio < 0.4f;
@@ -349,7 +353,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue;
// Gate values
float deathrayPhaseGateValue = 900f;
float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f;
float deathrayDistanceGateValue = 480f;
// Passive and Immune phases
@@ -487,10 +491,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
calamityGlobalNPC.newAI[3] = 1f;
npc.velocity *= decelerationVelocityMult;
int totalProjectiles = 8;
int totalProjectiles = malice ? 12 : expertMode ? 10 : 8;
float radians = MathHelper.TwoPi / totalProjectiles;
Vector2 spinningPoint = new Vector2(0f, -1f);
Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y);
bool normalLaserRotation = npc.localAI[0] % 2f == 0f;
float velocity = 6f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity);
spinningPoint.Normalize();
calamityGlobalNPC.newAI[2] += 1f;
if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration)
@@ -510,12 +520,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (Main.netMode != NetmodeID.MultiplayerClient)
{
/*int type = ModContent.ProjectileType<AresDeathBeamTelegraph>();
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center);
int type = ModContent.ProjectileType<AresDeathBeamTelegraph>();
Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(laserSpawnPoint, velocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}*/
Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
}
@@ -526,13 +538,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
/*int type = ModContent.ProjectileType<AresDeathBeamStart>();
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center);
int type = ModContent.ProjectileType<AresDeathBeamStart>();
int damage = npc.GetProjectileDamage(type);
Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(laserSpawnPoint, velocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}*/
Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
}
@@ -542,6 +556,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
AIState = (float)Phase.Normal;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
npc.localAI[0] += 1f;
npc.TargetClosest();
}
}
+10 -24
View File
@@ -120,48 +120,25 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoSpazAlive = false;
bool exoRetAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoSpazAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
{
otherExoMechsAlive++;
exoRetAlive = true;
}
}
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoSpazLifeRatio = defaultLifeRatio;
float exoRetLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoSpazAlive)
exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
if (exoRetAlive)
exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax;
float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoSpazLifeRatio + exoRetLifeRatio;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -231,6 +208,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 rotationVector = player.Center + predictionVector - npc.Center;
float projectileVelocity = passivePhase ? 9.6f : 12f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.GaussNuke ? 0.08f : 0.04f;
Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity;
@@ -280,6 +262,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Gate values
float gaussNukePhaseGateValue = 600f;
if (lastMechAlive)
gaussNukePhaseGateValue *= 0.7f;
else if (berserk)
gaussNukePhaseGateValue *= 0.85f;
// Variable to disable deathray firing
bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
+70 -52
View File
@@ -118,48 +118,25 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoSpazAlive = false;
bool exoRetAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoSpazAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
{
otherExoMechsAlive++;
exoRetAlive = true;
}
}
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoSpazLifeRatio = defaultLifeRatio;
float exoRetLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoSpazAlive)
exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
if (exoRetAlive)
exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax;
float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoSpazLifeRatio + exoRetLifeRatio;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -220,12 +197,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
npc.Opacity = 0f;
}
// Variable to fire normal lasers
bool fireNormalLasers = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays;
// Rotate the cannon to look at the target while not firing the beam
// Rotate the cannon to look in the direction it will fire only while it's charging or while it's firing
// Rotation
bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f;
float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f;
Vector2 lookAt = AIState == (int)Phase.Deathray ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, npc.Center.Y)) : player.Center;
Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, npc.Center.Y)) : player.Center;
float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X);
if (npc.spriteDirection == 1)
@@ -238,7 +218,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation);
// Direction
int direction = Math.Sign((AIState == (int)Phase.Deathray && !horizontalLaserSweep ? lookAt.X : player.Center.X) - npc.Center.X);
int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : player.Center.X) - npc.Center.X);
if (direction != 0)
{
npc.direction = direction;
@@ -273,10 +253,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Gate values
float deathrayPhaseGateValue = 420f;
if (lastMechAlive)
deathrayPhaseGateValue *= 0.7f;
else if (berserk)
deathrayPhaseGateValue *= 0.85f;
float deathrayPhaseVelocity = passivePhase ? 12f : 15f;
if (lastMechAlive)
deathrayPhaseVelocity *= 1.2f;
else if (berserk)
deathrayPhaseVelocity *= 1.1f;
// Variable to disable deathray firing
bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && fireNormalLasers);
if (doNotFire)
{
AIState = (float)Phase.Nothing;
@@ -336,33 +325,62 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
}
else
{
// Two possible variants: 1 - Horizontal, 2 - Vertical
// Movement while firing deathray
if (horizontalLaserSweep)
desiredVelocity.X = 0f;
else
desiredVelocity.Y = 0f;
npc.SimpleFlyMovement(desiredVelocity, baseAcceleration);
npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity);
// Fire deathray
if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration)
// Fire regular Thanatos lasers if Ares is in deathray phase, otherwise, fire deathray
if (fireNormalLasers)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AresLaserBeamStart>();
int damage = npc.GetProjectileDamage(type);
float offset = 84f;
float offset2 = 16f;
Vector2 source = horizontalLaserSweep ? new Vector2(npc.Center.X - offset2 * npc.direction, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset * npc.direction, npc.Center.Y + offset2);
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source);
Vector2 laserVelocity = Vector2.Normalize(lookAt - source);
if (laserVelocity.HasNaNs())
laserVelocity = -Vector2.UnitY;
// Fly in place
if (moveToLocation)
npc.SimpleFlyMovement(desiredVelocity, baseAcceleration);
else
npc.velocity *= decelerationVelocityMult;
Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
// Fire a Thanatos laser
int numLasers = lastMechAlive ? 3 : 2;
float divisor = deathrayDuration / numLasers;
if (calamityGlobalNPC.newAI[2] % divisor == 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
int damage = npc.GetProjectileDamage(type);
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center);
Vector2 laserVelocity = Vector2.Normalize(player.Center - npc.Center);
Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f;
Projectile.NewProjectile(npc.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
else
{
// Two possible variants: 1 - Horizontal, 2 - Vertical
// Movement while firing deathray
if (horizontalLaserSweep)
desiredVelocity.X = 0f;
else
desiredVelocity.Y = 0f;
npc.SimpleFlyMovement(desiredVelocity, baseAcceleration);
npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity);
// Fire deathray
if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<AresLaserBeamStart>();
int damage = npc.GetProjectileDamage(type);
float offset = 84f;
float offset2 = 16f;
Vector2 source = horizontalLaserSweep ? new Vector2(npc.Center.X - offset2 * npc.direction, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset * npc.direction, npc.Center.Y + offset2);
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source);
Vector2 laserVelocity = Vector2.Normalize(lookAt - source);
if (laserVelocity.HasNaNs())
laserVelocity = -Vector2.UnitY;
Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}
}
}
}
+12 -26
View File
@@ -118,48 +118,25 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoSpazAlive = false;
bool exoRetAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoSpazAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
{
otherExoMechsAlive++;
exoRetAlive = true;
}
}
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoSpazLifeRatio = defaultLifeRatio;
float exoRetLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoSpazAlive)
exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
if (exoRetAlive)
exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax;
float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoSpazLifeRatio + exoRetLifeRatio;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -229,6 +206,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 rotationVector = player.Center + predictionVector - npc.Center;
float projectileVelocity = passivePhase ? 9.6f : 12f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.PlasmaBolts ? 0.08f : 0.04f;
Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity;
@@ -279,9 +261,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Gate values
bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays;
float plasmaBoltPhaseGateValue = fireMoreBolts ? 90f : 210f;
if (lastMechAlive)
plasmaBoltPhaseGateValue *= 0.7f;
else if (berserk)
plasmaBoltPhaseGateValue *= 0.85f;
// Variable to cancel plasma bolt firing
bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays);
if (doNotFire)
{
AIState = (float)Phase.Nothing;
@@ -328,7 +314,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
else
{
// Fire plasma bolts
int numPlasmaBolts = 2;
int numPlasmaBolts = lastMechAlive ? 3 : 2;
float divisor = plasmaBoltDuration / numPlasmaBolts;
if (calamityGlobalNPC.newAI[2] % divisor == 0f)
+12 -26
View File
@@ -118,48 +118,25 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
bool exoWormAlive = false;
bool exoSpazAlive = false;
bool exoRetAlive = false;
if (CalamityGlobalNPC.draedonExoMechWorm != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active)
{
otherExoMechsAlive++;
exoWormAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
{
otherExoMechsAlive++;
exoSpazAlive = true;
}
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
{
otherExoMechsAlive++;
exoRetAlive = true;
}
}
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
float exoWormLifeRatio = defaultLifeRatio;
float exoSpazLifeRatio = defaultLifeRatio;
float exoRetLifeRatio = defaultLifeRatio;
if (exoWormAlive)
exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax;
if (exoSpazAlive)
exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
if (exoRetAlive)
exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax;
float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoSpazLifeRatio + exoRetLifeRatio;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
@@ -229,6 +206,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 rotationVector = player.Center + predictionVector - npc.Center;
float projectileVelocity = passivePhase ? 7.2f : 9f;
if (lastMechAlive)
projectileVelocity *= 1.2f;
else if (berserk)
projectileVelocity *= 1.1f;
float rateOfRotation = AIState == (int)Phase.TeslaOrbs ? 0.08f : 0.04f;
Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity;
@@ -279,9 +261,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Gate values
bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays;
float teslaOrbPhaseGateValue = fireMoreOrbs ? 90f : 210f;
if (lastMechAlive)
teslaOrbPhaseGateValue *= 0.7f;
else if (berserk)
teslaOrbPhaseGateValue *= 0.85f;
// Variable to cancel tesla orb firing
bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays);
if (doNotFire)
{
AIState = (float)Phase.Nothing;
@@ -328,7 +314,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
else
{
// Fire tesla orbs
int numTeslaOrbs = 4;
int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : 4;
float divisor = teslaOrbDuration / numTeslaOrbs;
if (calamityGlobalNPC.newAI[2] % divisor == 0f)
+22 -3
View File
@@ -145,11 +145,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.localAI[2] == 0f)
npc.localAI[2] = npc.ai[0];
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
otherExoMechsAlive++;
}
// Set the AI to become more aggressive if head is berserk
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Deathray)
npc.Calamity().newAI[3] = 1f;
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool berserk = npc.Calamity().newAI[3] == 1f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
{
+22 -3
View File
@@ -145,11 +145,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.localAI[2] == 0f)
npc.localAI[2] = npc.ai[0];
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
otherExoMechsAlive++;
}
// Set the AI to become more aggressive if head is berserk
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Deathray)
npc.Calamity().newAI[3] = 1f;
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool berserk = npc.Calamity().newAI[3] == 1f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
{
+12 -10
View File
@@ -220,8 +220,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
bool anyOtherExoMechPassive = exoPrimePassive || exoSpazPassive || exoRetPassive;
// Phases
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f;
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool lastMechAlive = berserk && otherExoMechsAlive == 0;
// Set vulnerable to false by default
vulnerable = false;
@@ -335,10 +336,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Phase gate values
float velocityAdjustTime = 20f;
float speedUpTime = berserk ? 360f : 480f;
float slowDownTime = berserk ? 90f : 120f;
float speedUpTime = lastMechAlive ? 270f : berserk ? 360f : 480f;
float slowDownTime = lastMechAlive ? 60f : berserk ? 90f : 120f;
float chargePhaseGateValue = speedUpTime + slowDownTime;
float laserBarrageDuration = berserk ? 330f : 420f;
float laserBarrageDuration = lastMechAlive ? 285f : berserk ? 330f : 420f;
// Adjust opacity
bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune;
@@ -389,8 +390,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float chargeTurnSpeedMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar);
float laserBarragePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar);
float laserBarragePhaseTurnSpeedMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar);
float deathrayVelocityMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar);
float deathrayTurnSpeedMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar);
float deathrayVelocityMult = MathHelper.Lerp(0.5f, 3f, chargeVelocityScalar);
float deathrayTurnSpeedMult = MathHelper.Lerp(0.5f, 3f, chargeVelocityScalar);
// Base scale on total time spent in phase
float chargeVelocityScalarIncrement = 1f / speedUpTime;
@@ -400,7 +401,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float deathrayVelocityScalarIncrement = 1f / deathrayDuration;
// Scalar to use during laser barrage, passive and immune phases
float laserBarrageVelocityScalarIncrement = berserk ? 0.02f : 0.01f;
float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : berserk ? 0.02f : 0.01f;
float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime;
// Distance from target
@@ -571,8 +572,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
turnDistance = chargeLocationDistance;
// Gradually turn slower if within 20 tiles of the target
if (distanceFromTarget < 320f)
turnSpeed *= distanceFromTarget / 320f;
float turnSlowerDistanceGateValue = lastMechAlive ? 160f : 320f;
if (distanceFromTarget < turnSlowerDistanceGateValue)
turnSpeed *= distanceFromTarget / turnSlowerDistanceGateValue;
calamityGlobalNPC.newAI[2] += 1f;
if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue)
@@ -640,7 +642,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
vulnerable = true;
// If close enough to the target, prepare to fire deathray
float slowDownDistance = 800f;
float slowDownDistance = lastMechAlive ? 640f : 800f;
bool readyToFireDeathray = distanceFromTarget < slowDownDistance;
if (readyToFireDeathray)
npc.localAI[2] = 1f;
+22 -3
View File
@@ -144,11 +144,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.localAI[2] == 0f)
npc.localAI[2] = npc.ai[0];
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Check if the other exo mechs are alive
int otherExoMechsAlive = 0;
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
otherExoMechsAlive++;
}
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
{
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
otherExoMechsAlive++;
}
// Set the AI to become more aggressive if head is berserk
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Deathray)
npc.Calamity().newAI[3] = 1f;
bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f);
bool berserk = npc.Calamity().newAI[3] == 1f;
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f;
if (shootLasers && !invisiblePhase)
{
+2 -1
View File
@@ -333,7 +333,8 @@ namespace CalamityMod.NPCs.Ravager
npc.ai[1] += 1f;
}
if (npc.ai[1] >= 300f)
float jumpGateValue = 180f;
if (npc.ai[1] >= jumpGateValue)
npc.ai[1] = -20f;
else if (npc.ai[1] == -1f)
{
+228
View File
@@ -0,0 +1,228 @@
using CalamityMod.Events;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Enums;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class AresDeathBeamStart : ModProjectile
{
private const int maxFrames = 5;
private int frameDrawn = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Death Beam");
}
public override void SetDefaults()
{
projectile.Calamity().canBreakPlayerDefense = true;
projectile.width = 30;
projectile.height = 30;
projectile.hostile = true;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.timeLeft = 600;
cooldownSlot = 1;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(frameDrawn);
writer.Write(projectile.localAI[0]);
writer.Write(projectile.localAI[1]);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
frameDrawn = reader.ReadInt32();
projectile.localAI[0] = reader.ReadSingle();
projectile.localAI[1] = reader.ReadSingle();
}
public override void AI()
{
// Difficulty modes
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || malice;
bool revenge = CalamityWorld.revenge || malice;
bool expertMode = Main.expertMode || malice;
Vector2? vector78 = null;
if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero)
projectile.velocity = -Vector2.UnitY;
if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType<AresBody>())
{
Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - 1f, Main.npc[(int)projectile.ai[1]].Center.Y + 23f) + Vector2.Normalize(projectile.velocity) * 35f;
projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f;
}
else
projectile.Kill();
float num801 = 1f;
projectile.localAI[0] += 1f;
if (projectile.localAI[0] >= 600f)
{
projectile.Kill();
return;
}
projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 600f) * 10f * num801;
if (projectile.scale > num801)
projectile.scale = num801;
float num804 = projectile.velocity.ToRotation();
float divisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f;
num804 += MathHelper.TwoPi / divisor;
projectile.rotation = num804 - MathHelper.PiOver2;
projectile.velocity = num804.ToRotationVector2();
float num805 = 3f; //3f
float num806 = projectile.width;
Vector2 samplingPoint = projectile.Center;
if (vector78.HasValue)
samplingPoint = vector78.Value;
float[] array3 = new float[(int)num805];
Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3);
float num807 = 0f;
for (int num808 = 0; num808 < array3.Length; num808++)
{
num807 += array3[num808];
}
num807 /= num805;
// Fire laser through walls at max length if target cannot be seen
if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1))
{
num807 = 2400f;
}
float amount = 0.5f;
projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); // Length of laser, linear interpolation
// Spawn dust at the end of the beam
int dustType = 107;
Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f);
for (int i = 0; i < 2; i++)
{
float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f;
Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult);
int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, new Color(0, 255, 255), 1f);
Main.dust[dust].noGravity = true;
Main.dust[dust].scale = 1.7f;
}
if (Main.rand.NextBool(5))
{
Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width;
int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[dust].velocity *= 0.5f;
Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y);
}
DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f);
Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight));
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (projectile.velocity == Vector2.Zero)
return false;
Texture2D beamStart = Main.projectileTexture[projectile.type];
Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle");
Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd");
float drawLength = projectile.localAI[1];
Color color = new Color(250, 250, 250, 100);
if (projectile.localAI[0] % 5f == 0f)
{
frameDrawn++;
if (frameDrawn >= maxFrames)
frameDrawn = 0;
}
// Draw start of beam
Vector2 vector = projectile.Center - Main.screenPosition;
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames);
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
// Draw middle of beam
drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale;
Vector2 center = projectile.Center;
center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f;
if (drawLength > 0f)
{
float i = 0f;
int middleFrameDrawn = frameDrawn;
while (i + 1f < drawLength)
{
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames);
if (drawLength - i < rectangle.Height)
rectangle.Height = (int)(drawLength - i);
spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f);
middleFrameDrawn++;
if (middleFrameDrawn >= maxFrames)
middleFrameDrawn = 0;
i += rectangle.Height * projectile.scale;
center += projectile.velocity * rectangle.Height * projectile.scale;
rectangle.Y += beamMiddle.Height / maxFrames;
if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames)
rectangle.Y = 0;
}
}
// Draw end of beam
Vector2 vector2 = center - Main.screenPosition;
sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames);
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Vector2 unit = projectile.velocity;
Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles));
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (projHitbox.Intersects(targetHitbox))
{
return true;
}
float num6 = 0f;
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6))
{
return true;
}
return false;
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+117
View File
@@ -0,0 +1,117 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class AresDeathBeamTelegraph : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public float TelegraphDelay
{
get => projectile.ai[0];
set => projectile.ai[0] = value;
}
public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null;
public Vector2 OldVelocity;
public const float TelegraphTotalTime = 240f;
public const float TelegraphFadeTime = 15f;
public const float TelegraphWidth = 4200f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Death Beam Telegraph");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.timeLeft = 240;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.WriteVector2(OldVelocity);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
OldVelocity = reader.ReadVector2();
}
public override void AI()
{
// Determine the relative opacities for each player based on their distance.
if (projectile.localAI[0] == 0f)
{
projectile.localAI[0] = 1f;
projectile.netUpdate = true;
}
// Die if the thing to attach to disappears.
if (ThingToAttachTo is null || !ThingToAttachTo.active)
{
projectile.Kill();
return;
}
// Set start of telegraph to the npc center.
projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f);
// Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over.
if (OldVelocity == Vector2.Zero)
{
OldVelocity = projectile.velocity;
projectile.velocity = Vector2.Zero;
projectile.netUpdate = true;
projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2;
}
TelegraphDelay++;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, projectile.alpha);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (TelegraphDelay >= TelegraphTotalTime)
return true;
Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam");
float yScale = 4f;
if (TelegraphDelay < TelegraphFadeTime)
yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f);
if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime)
yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f);
Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale);
Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f);
Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f);
Color colorOuter = Color.Lerp(Color.Cyan, Color.LightGreen, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through light green and cyan once and then flash.
Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f);
colorOuter *= 0.7f;
colorInner *= 0.7f;
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f);
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f);
return false;
}
}
}
@@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Boss
projectile.tileCollide = false;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.extraUpdates = 1;
projectile.timeLeft = Lifetime;
}
+11 -3
View File
@@ -1,4 +1,5 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -144,6 +145,9 @@ namespace CalamityMod.Projectiles.Boss
return;
}
// If the Ares Laser Cannon is the owner
bool aresLaserIsOwner = ThingToAttachTo.type == ModContent.NPCType<AresLaserCannon>();
// Fade in after telegraphs have faded.
if (TelegraphDelay > TelegraphTotalTime)
{
@@ -181,6 +185,9 @@ namespace CalamityMod.Projectiles.Boss
// Set destination of the laser, the target's center.
Destination = projectile.velocity;
if (aresLaserIsOwner)
projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f;
// Calculate and store the velocity that will be used for laser telegraph rotation and beam firing.
Vector2 projectileDestination = Destination - ThingToAttachTo.Center;
Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity;
@@ -206,6 +213,9 @@ namespace CalamityMod.Projectiles.Boss
// Set start of telegraph to the npc center.
projectile.Center = ThingToAttachTo.Center;
if (aresLaserIsOwner)
projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f;
// Calculate and store the velocity that will be used for laser telegraph rotation and beam firing.
Vector2 projectileDestination = Destination - ThingToAttachTo.Center;
Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity;
@@ -231,9 +241,7 @@ namespace CalamityMod.Projectiles.Boss
public override void OnHitPlayer(Player target, int damage, bool crit)
{
if (TelegraphDelay > TelegraphTotalTime)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180);
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
@@ -249,7 +257,7 @@ namespace CalamityMod.Projectiles.Boss
lightColor.G = (byte)(255 * projectile.Opacity);
lightColor.B = (byte)(255 * projectile.Opacity);
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return true;
return false;
}
Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam");
+3 -3
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.netImportant = true;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.minionSlots = 1f;
projectile.minionSlots = 0.5f;
projectile.timeLeft = 18000;
projectile.penetrate = -1;
projectile.tileCollide = false;
@@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.ai[1] += (float)Main.rand.Next(1, 3);
// Reset timer
if (projectile.ai[1] > 70f)
if (projectile.ai[1] > 300f)
{
projectile.ai[1] = 0f;
projectile.netUpdate = true;
@@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Summon
for (int i = 0; i < numProj + 1; i++)
{
Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, targetIndex, 0f);
Projectile.NewProjectile(projectile.Center, perturbedSpeed, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, targetIndex, 0f);
}
projectile.netUpdate = true;
}
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.netImportant = true;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.minionSlots = 1f;
projectile.minionSlots = 0.5f;
projectile.timeLeft = 18000;
projectile.penetrate = -1;
projectile.tileCollide = false;
+2 -1
View File
@@ -804,8 +804,9 @@ namespace CalamityMod
{ new Tuple<int, int>(ModContent.NPCType<ThanatosBody2>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
{ new Tuple<int, int>(ModContent.NPCType<ThanatosTail>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
//{ new Tuple<int, int>(ModContent.NPCType<AresBody>(), ModContent.ProjectileType<AresDeathBeamStart>()), new int[] { 500, 752, 788, 808, 1182 } },
{ new Tuple<int, int>(ModContent.NPCType<AresBody>(), ModContent.ProjectileType<AresDeathBeamStart>()), new int[] { 500, 752, 788, 808, 1182 } },
{ new Tuple<int, int>(ModContent.NPCType<AresLaserCannon>(), ModContent.ProjectileType<AresLaserBeamStart>()), new int[] { 450, 676, 712, 732, 1068 } },
{ new Tuple<int, int>(ModContent.NPCType<AresLaserCannon>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
{ new Tuple<int, int>(ModContent.NPCType<AresPlasmaFlamethrower>(), ModContent.ProjectileType<AresPlasmaFireball>()), new int[] { 400, 600, 632, 648, 948 } },
{ new Tuple<int, int>(ModContent.NPCType<AresTeslaCannon>(), ModContent.ProjectileType<AresTeslaOrb>()), new int[] { 350, 528, 556, 572, 834 } },
{ new Tuple<int, int>(ModContent.NPCType<AresGaussNuke>(), ModContent.ProjectileType<AresGaussNukeProjectile>()), new int[] { 500, 752, 788, 808, 1182 } },