1 - Ares and Thanos hopefully update their HP values every frame to match the part with the lowest HP.

2 - Animated Thanos and Ares lasers.
3 - Post-DoG moon/eclipse event enemies no longer use a different i-frame slot.
4 - Various other small fixes.
This commit is contained in:
Andrew Marheine committed 2021-08-07 10:44:51 -05:00
1 parent 01179b2715
commit 6636deaeff
30 files changed
+730 -113

No files matched your search

-10
View File
@@ -1752,20 +1752,10 @@ namespace CalamityMod.NPCs
#region Can Hit Player
public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot)
{
if (!npc.boss && !npc.friendly && !npc.dontTakeDamage)
{
if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse))
{
cooldownSlot = 1;
}
}
if (target.Calamity().prismaticHelmet && !CalamityPlayer.areThereAnyDamnBosses)
{
if (npc.lifeMax < 500)
{
return false;
}
}
return true;
+46 -36
View File
@@ -67,15 +67,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Max distance from the target before they are unable to hear sound telegraphs
private const float soundDistance = 2800f;
// Variable used to stop the arm spawning loop
private bool armsSpawned = false;
// Total duration of the deathray telegraph
private const float deathrayTelegraphDuration = 240f;
// Total duration of the deathrays
private const float deathrayDuration = 600f;
// Whether or not the other exo mechs have been spawned
private bool otherExoMechsSpawned = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("XF-09 Ares");
@@ -134,38 +134,51 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
bool revenge = CalamityWorld.revenge || malice;
bool expertMode = Main.expertMode || malice;
// Spawn arms
if (npc.ai[0] == 0f)
{
int totalArms = 4;
for (int i = 0; i < totalArms; i++)
{
int lol = 0;
switch (i)
{
case 0:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresLaserCannon>(), npc.whoAmI);
break;
case 1:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresPlasmaFlamethrower>(), npc.whoAmI);
break;
case 2:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresTeslaCannon>(), npc.whoAmI);
break;
case 3:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresGaussNuke>(), npc.whoAmI);
break;
default:
break;
}
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
Main.npc[lol].realLife = npc.whoAmI;
Main.npc[lol].ai[0] = npc.whoAmI;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0);
// Spawn arms
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (!armsSpawned && npc.ai[0] == 0f)
{
int totalArms = 4;
int Previous = npc.whoAmI;
for (int i = 0; i < totalArms; i++)
{
int lol = 0;
switch (i)
{
case 0:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresLaserCannon>(), npc.whoAmI);
break;
case 1:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresPlasmaFlamethrower>(), npc.whoAmI);
break;
case 2:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresTeslaCannon>(), npc.whoAmI);
break;
case 3:
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AresGaussNuke>(), npc.whoAmI);
break;
default:
break;
}
Main.npc[lol].realLife = npc.whoAmI;
Main.npc[lol].ai[2] = npc.whoAmI;
Main.npc[lol].ai[1] = Previous;
Main.npc[Previous].ai[0] = lol;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0);
Previous = lol;
}
armsSpawned = true;
}
npc.ai[0] = 1f;
}
if (npc.life > Main.npc[(int)npc.ai[0]].life)
npc.life = Main.npc[(int)npc.ai[0]].life;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
@@ -241,9 +254,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Target variable
Player player = Main.player[npc.target];
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
// Despawn if target is dead
bool targetDead = false;
if (player.dead)
@@ -262,14 +272,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if ((double)npc.position.Y < Main.topWorld + 16f)
npc.velocity.Y -= 2f;
/*if ((double)npc.position.Y < Main.topWorld + 16f)
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<AresLaserCannon>() || Main.npc[a].type == ModContent.NPCType<AresGaussNuke>() || Main.npc[a].type == ModContent.NPCType<AresPlasmaFlamethrower>() || Main.npc[a].type == ModContent.NPCType<AresTeslaCannon>())
Main.npc[a].active = false;
}
}*/
}
}
}
+10 -6
View File
@@ -174,8 +174,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
if (npc.ai[0] > 0f)
npc.realLife = (int)npc.ai[0];
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Despawn if target is dead
bool targetDead = false;
@@ -195,18 +198,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if ((double)npc.position.Y < Main.topWorld + 16f)
npc.velocity.Y -= 2f;
/*if ((double)npc.position.Y < Main.topWorld + 16f)
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<AresBody>() || Main.npc[a].type == ModContent.NPCType<AresTeslaCannon>() || Main.npc[a].type == ModContent.NPCType<AresPlasmaFlamethrower>() || Main.npc[a].type == ModContent.NPCType<AresLaserCannon>())
Main.npc[a].active = false;
}
}*/
}
}
}
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[0]].Calamity();
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity();
// Adjust opacity
bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
@@ -340,7 +343,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
int type = ModContent.ProjectileType<AresGaussNukeProjectile>();
int damage = npc.GetProjectileDamage(type);
Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * 40f, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
float offset = 40f;
Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
// Recoil
npc.velocity -= gaussNukeVelocity;
+17 -12
View File
@@ -172,8 +172,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
if (npc.ai[0] > 0f)
npc.realLife = (int)npc.ai[0];
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Despawn if target is dead
bool targetDead = false;
@@ -193,18 +196,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if ((double)npc.position.Y < Main.topWorld + 16f)
npc.velocity.Y -= 2f;
/*if ((double)npc.position.Y < Main.topWorld + 16f)
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<AresBody>() || Main.npc[a].type == ModContent.NPCType<AresGaussNuke>() || Main.npc[a].type == ModContent.NPCType<AresPlasmaFlamethrower>() || Main.npc[a].type == ModContent.NPCType<AresTeslaCannon>())
Main.npc[a].active = false;
}
}*/
}
}
}
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[0]].Calamity();
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity();
// Adjust opacity
bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
@@ -341,7 +344,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
{
// Two possible variants: 1 - Left to right, 2 - Top to bottom
npc.velocity = calamityGlobalNPC.newAI[3] == 0f ? new Vector2(deathrayPhaseVelocity, 0f) : new Vector2(0f, deathrayPhaseVelocity);
Vector2 laserVelocity = calamityGlobalNPC.newAI[3] == 0f ? Vector2.UnitY : Vector2.UnitX;
calamityGlobalNPC.newAI[3] += 1f;
if (calamityGlobalNPC.newAI[3] > 1f)
@@ -349,13 +351,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (Main.netMode != NetmodeID.MultiplayerClient)
{
/*int type = ModContent.ProjectileType<AresLaserBeamStart>();
int type = ModContent.ProjectileType<AresLaserBeamStart>();
int damage = npc.GetProjectileDamage(type);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(npc.Center, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI);
}*/
float offset = 40f;
Vector2 source = calamityGlobalNPC.newAI[3] == 0f ? new Vector2(npc.Center.X, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset, npc.Center.Y);
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);
}
}
}
+11 -7
View File
@@ -172,8 +172,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
if (npc.ai[0] > 0f)
npc.realLife = (int)npc.ai[0];
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Despawn if target is dead
bool targetDead = false;
@@ -193,18 +196,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if ((double)npc.position.Y < Main.topWorld + 16f)
npc.velocity.Y -= 2f;
/*if ((double)npc.position.Y < Main.topWorld + 16f)
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<AresBody>() || Main.npc[a].type == ModContent.NPCType<AresGaussNuke>() || Main.npc[a].type == ModContent.NPCType<AresTeslaCannon>() || Main.npc[a].type == ModContent.NPCType<AresLaserCannon>())
Main.npc[a].active = false;
}
}*/
}
}
}
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[0]].Calamity();
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity();
// Adjust opacity
bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
@@ -340,9 +343,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center);
float projectileVelocity = 12f;
Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
/*int type = ModContent.ProjectileType<AresPlasmaFireball>();
int type = ModContent.ProjectileType<AresPlasmaFireball>();
int damage = npc.GetProjectileDamage(type);
Projectile.NewProjectile(npc.Center + Vector2.Normalize(plasmaBoltVelocity) * 40f, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);*/
float offset = 40f;
Projectile.NewProjectile(npc.Center + Vector2.Normalize(plasmaBoltVelocity) * offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
}
}
}
+8 -5
View File
@@ -172,8 +172,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
// Target variable
Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target];
if (npc.ai[0] > 0f)
npc.realLife = (int)npc.ai[0];
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Despawn if target is dead
bool targetDead = false;
@@ -193,18 +196,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if ((double)npc.position.Y < Main.topWorld + 16f)
npc.velocity.Y -= 2f;
/*if ((double)npc.position.Y < Main.topWorld + 16f)
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<AresBody>() || Main.npc[a].type == ModContent.NPCType<AresGaussNuke>() || Main.npc[a].type == ModContent.NPCType<AresPlasmaFlamethrower>() || Main.npc[a].type == ModContent.NPCType<AresLaserCannon>())
Main.npc[a].active = false;
}
}*/
}
}
}
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[0]].Calamity();
CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity();
// Adjust opacity
bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune;
+3
View File
@@ -84,6 +84,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Difficulty modes
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || malice;
+3
View File
@@ -84,6 +84,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Difficulty modes
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || malice;
+3
View File
@@ -273,6 +273,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
}
}
if (npc.life > Main.npc[(int)npc.ai[0]].life)
npc.life = Main.npc[(int)npc.ai[0]].life;
// Despawn if target is dead
bool targetDead = false;
if (player.dead)
+3
View File
@@ -83,6 +83,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (npc.ai[2] > 0f)
npc.realLife = (int)npc.ai[2];
if (npc.life > Main.npc[(int)npc.ai[1]].life)
npc.life = Main.npc[(int)npc.ai[1]].life;
// Difficulty modes
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || malice;
+9 -3
View File
@@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 480;
cooldownSlot = 1;
projectile.timeLeft = 480;
projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true;
}
@@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss
Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]);
Color color = Color.Lerp(Color.White, Color.GreenYellow, 0.5f) * projectile.Opacity;
Color color = Color.Lerp(Color.White, Color.GreenYellow, 0.5f);
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f);
@@ -181,5 +182,10 @@ namespace CalamityMod.Projectiles.Boss
}
}
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
@@ -53,6 +53,7 @@ namespace CalamityMod.Projectiles.Boss
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
cooldownSlot = 1;
projectile.timeLeft = Lifetime;
}
@@ -89,6 +90,11 @@ namespace CalamityMod.Projectiles.Boss
CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(Radius * projectile.scale), (int)(Radius * projectile.scale));
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.OnFire, 480);
}
public override void Kill(int timeLeft)
{
CalamityWorld.ScreenShakeSpots.Remove(Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); // Remove the explosion associated with this projectile's UUID.
@@ -139,5 +145,10 @@ namespace CalamityMod.Projectiles.Boss
return minDist <= Radius * projectile.scale * 0.5f;
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
@@ -24,15 +24,23 @@ namespace CalamityMod.Projectiles.Boss
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.Opacity = 0f;
cooldownSlot = 1;
projectile.penetrate = -1;
projectile.timeLeft = 600;
projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true;
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.timeLeft < 15)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 15f, 0f, 1f);
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 595) / 5f), 0f, 1f);
Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.125f * projectile.Opacity, 0.025f * projectile.Opacity);
projectile.frameCounter++;
if (projectile.frameCounter > 4)
{
projectile.frame++;
@@ -40,18 +48,23 @@ namespace CalamityMod.Projectiles.Boss
}
if (projectile.frame > 3)
projectile.frame = 0;
if (projectile.alpha > 0)
projectile.alpha -= 50;
if (projectile.alpha < 0)
projectile.alpha = 0;
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2;
}
public override Color? GetAlpha(Color lightColor)
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override void OnHitPlayer(Player target, int damage, bool crit)
{
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.OnFire, 180);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, projectile.alpha);
return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
@@ -59,5 +72,10 @@ namespace CalamityMod.Projectiles.Boss
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+223
View File
@@ -0,0 +1,223 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.Dusts;
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 AresLaserBeamStart : ModProjectile
{
private int frameDrawn = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Laser 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()
{
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<AresLaserCannon>())
{
float offset = 40f;
Vector2 fireFrom = Main.npc[(int)projectile.ai[1]].Calamity().newAI[3] == 0f ? new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y + offset) : new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + offset, Main.npc[(int)projectile.ai[1]].Center.Y);
projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f;
}
else
projectile.Kill();
float num801 = 1f;
projectile.localAI[0] += 1f;
if (projectile.localAI[0] >= 60f)
{
projectile.Kill();
return;
}
if (projectile.localAI[0] % 5f == 0f)
{
frameDrawn++;
if (frameDrawn >= 5)
frameDrawn = 0;
}
projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801;
if (projectile.scale > num801)
projectile.scale = num801;
float num804 = projectile.velocity.ToRotation();
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
Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f);
for (int num809 = 0; num809 < 2; num809++)
{
float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
float num811 = (float)Main.rand.NextDouble() * 2f + 2f;
Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811);
int num812 = Dust.NewDust(vector79, 0, 0, (int)CalamityDusts.Brimstone, vector80.X, vector80.Y, 0, default, 1f);
Main.dust[num812].noGravity = true;
Main.dust[num812].scale = 1.7f;
}
if (Main.rand.NextBool(5))
{
Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width;
int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f);
Dust dust = Main.dust[num813];
dust.velocity *= 0.5f;
Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].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/AresLaserBeamMiddle");
Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd");
float drawLength = projectile.localAI[1];
Color color = new Color(250, 100, 100, 0);
// Draw start of beam
Vector2 vector = projectile.Center - Main.screenPosition;
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / 5 * frameDrawn, beamStart.Width, beamStart.Height / 5);
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / 5) / 2f, projectile.scale, SpriteEffects.None, 0f);
// Draw middle of beam
drawLength -= (beamStart.Height / 5 / 2 + beamEnd.Height / 5) * projectile.scale;
Vector2 center = projectile.Center;
center += projectile.velocity * projectile.scale * beamStart.Height / 5f / 2f;
if (drawLength > 0f)
{
float i = 0f;
int middleFrameDrawn = frameDrawn;
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / 5 * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / 5);
while (i + 1f < drawLength)
{
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 >= 5)
middleFrameDrawn = 0;
i += rectangle.Height * projectile.scale;
center += projectile.velocity * rectangle.Height * projectile.scale;
rectangle.Y += beamMiddle.Height / 5;
if (rectangle.Y + rectangle.Height > beamMiddle.Height / 5)
rectangle.Y = 0;
}
}
// Draw end of beam
Vector2 vector2 = center - Main.screenPosition;
sourceRectangle = new Rectangle(0, beamEnd.Height / 5 * frameDrawn, beamEnd.Width, beamEnd.Height / 5);
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / 5) / 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 OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 300);
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+83
View File
@@ -0,0 +1,83 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class AresPlasmaBolt : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Plasma Bolt");
Main.projFrames[projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.Calamity().canBreakPlayerDefense = true;
projectile.width = 18;
projectile.height = 18;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.Opacity = 0f;
cooldownSlot = 1;
projectile.penetrate = -1;
projectile.timeLeft = 600;
projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true;
}
public override void AI()
{
if (projectile.timeLeft < 15)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 15f, 0f, 1f);
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 595) / 5f), 0f, 1f);
Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f);
projectile.frameCounter++;
if (projectile.frameCounter > 4)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 3)
projectile.frame = 0;
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2;
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override void OnHitPlayer(Player target, int damage, bool crit)
{
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.OnFire, 180);
target.AddBuff(BuffID.CursedInferno, 90);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+217
View File
@@ -0,0 +1,217 @@
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class AresPlasmaFireball : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Plasma Fireball");
Main.projFrames[projectile.type] = 6;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.Calamity().canBreakPlayerDefense = true;
projectile.width = 36;
projectile.height = 36;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.Opacity = 0f;
cooldownSlot = 1;
projectile.timeLeft = 480;
projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true;
}
public override void AI()
{
Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]);
if (Vector2.Distance(targetLocation, projectile.Center) < 80f)
projectile.tileCollide = true;
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 475) / 5f), 0f, 1f);
Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f);
projectile.frameCounter++;
if (projectile.frameCounter > 4)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 5)
projectile.frame = 0;
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2;
if (projectile.localAI[0] == 0f)
{
projectile.localAI[0] = 1f;
float speed1 = 1.8f;
float speed2 = 2.8f;
float angleRandom = 0.35f;
for (int num53 = 0; num53 < 40; num53++)
{
float dustSpeed = Main.rand.NextFloat(speed1, speed2);
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation());
dustVel = dustVel.RotatedBy(-angleRandom);
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
int randomDustType = Main.rand.NextBool(2) ? 107 : 110;
int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f);
Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f;
Main.dust[num54].noGravity = true;
Dust dust = Main.dust[num54];
dust.velocity *= 3f;
dust = Main.dust[num54];
num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f);
Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f;
dust = Main.dust[num54];
dust.velocity *= 2f;
Main.dust[num54].noGravity = true;
Main.dust[num54].fadeIn = 1f;
Main.dust[num54].color = Color.Green * 0.5f;
dust = Main.dust[num54];
}
for (int num55 = 0; num55 < 20; num55++)
{
float dustSpeed = Main.rand.NextFloat(speed1, speed2);
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation());
dustVel = dustVel.RotatedBy(-angleRandom);
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
int randomDustType = Main.rand.NextBool(2) ? 107 : 110;
int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f);
Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f;
Main.dust[num56].noGravity = true;
Dust dust = Main.dust[num56];
dust.velocity *= 0.5f;
dust = Main.dust[num56];
}
}
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override void OnHitPlayer(Player target, int damage, bool crit)
{
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.OnFire, 360);
target.AddBuff(BuffID.CursedInferno, 180);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}
public override void Kill(int timeLeft)
{
int height = 90;
projectile.position = projectile.Center;
projectile.width = projectile.height = height;
projectile.Center = projectile.position;
projectile.Damage();
Main.PlaySound(SoundID.Item93, projectile.Center);
if (Main.myPlayer == projectile.owner)
{
// Plasma bolts
int totalProjectiles = CalamityWorld.malice ? 12 : 8;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<AresPlasmaBolt>();
float velocity = 12f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(projectile.Center, velocity2, type, (int)(projectile.damage * 0.8), 0f, Main.myPlayer);
}
}
for (int num640 = 0; num640 < 200; num640++)
{
float num641 = 16f;
if (num640 < 150)
num641 = 12f;
if (num640 < 100)
num641 = 8f;
if (num640 < 50)
num641 = 4f;
int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f);
float num644 = Main.dust[num643].velocity.X;
float num645 = Main.dust[num643].velocity.Y;
if (num644 == 0f && num645 == 0f)
num644 = 1f;
float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645);
num646 = num641 / num646;
num644 *= num646;
num645 *= num646;
float scale = 1f;
switch ((int)num641)
{
case 4:
scale = 1.2f;
break;
case 8:
scale = 1.1f;
break;
case 12:
scale = 1f;
break;
case 16:
scale = 0.9f;
break;
default:
break;
}
Dust dust = Main.dust[num643];
dust.velocity *= 0.5f;
dust.velocity.X = dust.velocity.X + num644;
dust.velocity.Y = dust.velocity.Y + num645;
dust.scale = scale;
dust.noGravity = true;
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss
projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType<SupremeCalamitas>());
}
Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f);
Lighting.AddLight(projectile.Center, 0.75f * projectile.Opacity, 0f, 0f);
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
+1 -1
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 60) / 60f), 0f, 1f);
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f);
Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f);
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
+1 -1
View File
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice;
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f);
Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f);
if (projectile.ai[1] == 1f)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
+2 -2
View File
@@ -44,10 +44,10 @@ namespace CalamityMod.Projectiles.Boss
{
projectile.frame = 0;
}
Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f);
if (projectile.timeLeft < 51)
{
projectile.alpha += 5;
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f);
projectile.Opacity -= 0.02f;
}
if (projectile.ai[1] == 0f)
{
+1 -1
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1440) / 60f), 0f, 1f);
Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f);
Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f);
if (projectile.velocity.X < 0f)
{
+1 -1
View File
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice;
bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice;
Lighting.AddLight(projectile.Center, 3f, 0f, 0f);
Lighting.AddLight(projectile.Center, 3f * projectile.Opacity, 0f, 0f);
float inertia = (revenge ? 4.5f : 5f) + speedAdd;
float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f);
+1 -1
View File
@@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1170) / 30f), 0f, 1f);
Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f);
Lighting.AddLight(projectile.Center, 0.5f * projectile.Opacity, 0f, 0f);
if (projectile.velocity.X < 0f)
projectile.spriteDirection = 1;
+6 -1
View File
@@ -122,5 +122,10 @@ namespace CalamityMod.Projectiles.Boss
Main.dust[num624].velocity *= 2f;
}
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+24 -9
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Boss
public ref float LengthOfLaser => ref projectile.localAI[1];
public const int Lifetime = 180;
public const float BeamPosOffset = 16f;
private int frameDrawn = 0;
public override void SetStaticDefaults()
{
@@ -41,13 +42,15 @@ namespace CalamityMod.Projectiles.Boss
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(Time);
writer.Write(frameDrawn);
writer.Write(Time);
writer.Write(LengthOfLaser);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
Time = reader.ReadSingle();
frameDrawn = reader.ReadInt32();
Time = reader.ReadSingle();
LengthOfLaser = reader.ReadSingle();
}
@@ -86,6 +89,13 @@ namespace CalamityMod.Projectiles.Boss
return;
}
if (Time % 5 == 0)
{
frameDrawn++;
if (frameDrawn >= 4)
frameDrawn = 0;
}
float scale = 1f;
projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale;
if (projectile.scale > scale)
@@ -199,8 +209,8 @@ namespace CalamityMod.Projectiles.Boss
// Draw start of beam
Vector2 vector = projectile.Center - Main.screenPosition;
Rectangle? sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamStart.Width, 30);
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(32f, 30f) / 2f, projectile.scale, SpriteEffects.None, 0f);
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / 4 * frameDrawn, beamStart.Width, beamStart.Height / 4);
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / 4) / 2f, projectile.scale, SpriteEffects.None, 0f);
// Draw middle of beam
drawLength -= (beamStart.Height / 4 / 2 + beamEnd.Height / 4) * projectile.scale;
@@ -209,18 +219,23 @@ namespace CalamityMod.Projectiles.Boss
if (drawLength > 0f)
{
float i = 0f;
Rectangle rectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamMiddle.Width, 30);
while (i + 1f < drawLength)
int middleFrameDrawn = frameDrawn;
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / 4 * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / 4);
while (i + 1f < drawLength)
{
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 >= 4)
middleFrameDrawn = 0;
i += rectangle.Height * projectile.scale;
center += projectile.velocity * rectangle.Height * projectile.scale;
rectangle.Y += 30;
rectangle.Y += beamMiddle.Height / 4;
if (rectangle.Y + rectangle.Height > beamMiddle.Height / 4)
rectangle.Y = 0;
}
@@ -228,8 +243,8 @@ namespace CalamityMod.Projectiles.Boss
// Draw end of beam
Vector2 vector2 = center - Main.screenPosition;
sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamEnd.Width, 30);
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(28f, 30f) / 2f, projectile.scale, SpriteEffects.None, 0f);
sourceRectangle = new Rectangle(0, beamEnd.Height / 4 * frameDrawn, beamEnd.Width, beamEnd.Height / 4);
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / 4) / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
+1
View File
@@ -109,6 +109,7 @@ namespace CalamityMod.Projectiles.Boss
projectile.velocity *= 1.02f;
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2;
Lighting.AddLight(projectile.Center, 0f, 0.35f * projectile.Opacity, 0.35f * projectile.Opacity);
}
+6 -1
View File
@@ -70,5 +70,10 @@ namespace CalamityMod.Projectiles.Boss
if (projectile.timeLeft >= 180)
target.AddBuff(ModContent.BuffType<Irradiated>(), 240, true);
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+6 -1
View File
@@ -49,5 +49,10 @@ namespace CalamityMod.Projectiles.Boss
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
{
target.Calamity().lastProjectileHit = projectile;
}
}
}
+1
View File
@@ -66,6 +66,7 @@ namespace CalamityMod.Projectiles.Boss
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f);
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2;
Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f * projectile.Opacity);
}
+2 -3
View File
@@ -812,9 +812,8 @@ namespace CalamityMod
{ 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<AresLaserCannon>(), ModContent.ProjectileType<AresLaserBeamStart>()), new int[] { 450, 676, 712, 732, 1068 } },
//{ new Tuple<int, int>(ModContent.NPCType<AresPlasmaFlamethrower>(), ModContent.ProjectileType<AresPlasmaFireball>()), new int[] { 400, 600, 632, 648, 948 } },
//{ new Tuple<int, int>(ModContent.NPCType<AresPlasmaFlamethrower>(), ModContent.ProjectileType<AresPlasmaBolt>()), new int[] { 350, 528, 556, 572, 834 } },
{ new Tuple<int, int>(ModContent.NPCType<AresLaserCannon>(), ModContent.ProjectileType<AresLaserBeamStart>()), new int[] { 450, 676, 712, 732, 1068 } },
{ 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 } },