Death Mode lightning telegraph.

This commit is contained in:
Andrew Marheine committed 2020-03-02 17:50:50 -06:00
1 parent 8706fdb298
commit d4675efcc8
6 files changed
+128 -25

No files matched your search

+24 -15
View File
@@ -16,6 +16,7 @@ using CalamityMod.NPCs.Crags;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
@@ -518,22 +519,30 @@ namespace CalamityMod.CalPlayer
}
// Ice shards, lightning and sharknadoes
if (player.ZoneOverworldHeight && !CalamityPlayer.areThereAnyDamnBosses && !player.InSpace())
if (player.ZoneOverworldHeight && !CalamityPlayer.areThereAnyDamnBosses && Main.invasionType == 0 && NPC.MoonLordCountdown == 0 && !player.InSpace())
{
Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - (float)Main.rand.Next(300, 701), player.Center.Y - (float)Main.rand.Next(700, 801));
if (point.X > Main.maxTilesX / 2)
sharknadoSpawnPoint.X = player.Center.X + (float)Main.rand.Next(300, 701);
if (Main.raining)
{
float frequencyMult = 1f - Main.cloudAlpha; // 1 to 0.11
Vector2 spawnPoint = new Vector2(player.Center.X + (float)Main.rand.Next(-1000, 1001), player.Center.Y - (float)Main.rand.Next(700, 801));
Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f));
if (player.ZoneSnow)
{
int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult);
float windVelocity = (float)Math.Sqrt((double)Math.Abs(Main.windSpeed)) * (float)Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f;
Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat());
if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3))
Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType<IceRain>(), 20, 0f, player.whoAmI, 1f, 0f);
if (!tileSafely.active())
{
int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult);
float windVelocity = (float)Math.Sqrt((double)Math.Abs(Main.windSpeed)) * (float)Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f;
Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat());
if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3))
Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType<IceRain>(), 20, 0f, player.whoAmI, 1f, 0f);
}
}
else
{
@@ -570,18 +579,18 @@ namespace CalamityMod.CalPlayer
Main.projectile[num336].netUpdate = true;
}
}
int randomFrequency2 = (int)(20f * frequencyMult);
if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2))
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)spawnPoint.X, (int)spawnPoint.Y);
float randomVelocity = Main.rand.NextFloat() - 0.5f;
Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900);
Vector2 ai0 = fireTo - spawnPoint;
float ai = (float)Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.78539818525314331)) * 7f;
int proj = Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, 50, 0f, player.whoAmI, ai0.ToRotation(), ai);
Main.projectile[proj].extraUpdates += 6;
Main.projectile[proj].friendly = true;
if (!tileSafely.active())
{
float randomVelocity = Main.rand.NextFloat() - 0.5f;
Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f);
Vector2 ai0 = fireTo - spawnPoint;
Vector2 velocity = Vector2.Normalize(ai0) * 12f;
Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType<LightningMark>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
+1 -1
View File
@@ -4940,7 +4940,7 @@ namespace CalamityMod.NPCs
target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail &&
target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 &&
target.type != ModContent.NPCType<Reaper>() && target.type != ModContent.NPCType<Mauler>() && target.type != ModContent.NPCType<EidolonWyrmHead>() &&
target.type != ModContent.NPCType<EidolonWyrmHeadHuge>() && target.type != ModContent.NPCType<ColossalSquid>() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(npc.type))
target.type != ModContent.NPCType<EidolonWyrmHeadHuge>() && target.type != ModContent.NPCType<ColossalSquid>() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type))
{
return true;
}
+1 -3
View File
@@ -48,14 +48,12 @@ namespace CalamityMod.Projectiles.Enemy
if (projectile.owner == Main.myPlayer)
{
int num320 = Main.rand.Next(15, 21);
int num3;
for (int num321 = 0; num321 < num320; num321 = num3 + 1)
for (int num321 = 0; num321 < num320; num321++)
{
Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
vector15.Normalize();
vector15 *= (float)Main.rand.Next(50, 401) * 0.01f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType<InkPoisonCloud>() + Main.rand.Next(3), (int)((double)projectile.damage * 0.66), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1));
num3 = num321;
}
}
projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
+92
View File
@@ -0,0 +1,92 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Enemy
{
public class LightningMark : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lightning Mark");
}
public override void SetDefaults()
{
projectile.width = 6;
projectile.height = 12;
projectile.hostile = true;
projectile.penetrate = -1;
projectile.timeLeft = 1800;
projectile.extraUpdates = 10;
}
public override void AI()
{
if (projectile.timeLeft <= 600)
{
if (projectile.ai[0] == 0f && projectile.owner == Main.myPlayer)
{
projectile.ai[0] = 1f;
Vector2 fireFrom = new Vector2(projectile.Center.X, projectile.Center.Y - 900f);
int tries = 0;
while (Framing.GetTileSafely((int)(fireFrom.X / 16f), (int)(fireFrom.Y / 16f)).active())
{
fireFrom.Y += 16f;
tries += 1;
if (tries > 25)
return;
}
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.Center.X, (int)projectile.Center.Y);
Vector2 ai0 = projectile.Center - fireFrom;
float ai = (float)Main.rand.Next(100);
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.78539818525314331)) * 7f;
int proj = Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, 50, 0f, projectile.owner, ai0.ToRotation(), ai);
Main.projectile[proj].extraUpdates += 6;
Main.projectile[proj].friendly = true;
}
}
else if (projectile.velocity.Y == 0f)
{
Lighting.AddLight(projectile.Center, 0.6f, 0.9f, 1f);
if (Main.rand.NextBool(3))
{
int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 226, 0f, 0f, 100, default, 1f);
Main.dust[num199].position.X -= 2f;
Main.dust[num199].position.Y += 2f;
Main.dust[num199].scale = 0.7f;
Main.dust[num199].noGravity = true;
Main.dust[num199].velocity.Y -= 2f;
}
if (Main.rand.NextBool(15))
{
int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f);
Main.dust[num200].position.X -= 2f;
Main.dust[num200].position.Y += 2f;
Main.dust[num200].scale = 0.7f;
Main.dust[num200].noGravity = true;
Main.dust[num200].velocity *= 0.1f;
}
}
if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f)
projectile.velocity.Y *= -0.5f;
projectile.velocity.Y += 0.2f;
if (projectile.velocity.Y > 16f)
projectile.velocity.Y = 16f;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

+10 -6
View File
@@ -74,17 +74,17 @@ namespace CalamityMod.Projectiles.Magic
if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
{
projectile.alpha -= 30;
if (projectile.alpha < 225)
if (projectile.alpha < 60)
{
projectile.alpha = 225;
projectile.alpha = 60;
}
}
else
{
projectile.alpha += 30;
if (projectile.alpha > 245)
if (projectile.alpha > 150)
{
projectile.alpha = 245;
projectile.alpha = 150;
}
}
if (projectile.ai[0] > 0f)
@@ -117,8 +117,12 @@ namespace CalamityMod.Projectiles.Magic
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 53, projectile.alpha);
}
if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
{
return new Color(128, 128, 26, 255 - projectile.alpha);
}
return new Color(64, 64, 13, 255 - projectile.alpha);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{