clam
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using CalamityMod.Items.Placeables.Furniture;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.Waters;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.BiomeManagers
|
||||
{
|
||||
public class ClamDenBiome : ModBiome
|
||||
{
|
||||
public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance;
|
||||
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/SunkenSeaBGStyle");
|
||||
public override int BiomeTorchItemType => ModContent.ItemType<NavyPrismTorch>();
|
||||
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight;
|
||||
public override SceneEffectPriority Priority => SceneEffectPriority.Environment;
|
||||
public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon";
|
||||
// Placeholder until we get a dedicated Sunken Sea background
|
||||
public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1";
|
||||
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1";
|
||||
|
||||
// todo make this condition different than the normal burrows
|
||||
public override bool IsBiomeActive(Player player)
|
||||
{
|
||||
bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles;
|
||||
bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles;
|
||||
|
||||
return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 && MoreThanReefs && MoreThanPolyp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1525,11 +1525,12 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion
|
||||
|
||||
#region Biome
|
||||
public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneBasaltGully;
|
||||
public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneClamDen || ZoneBasaltGully;
|
||||
public bool ZoneTimelessShores => Player.InModBiome<TimelessShoresBiome>();
|
||||
public bool ZonePolypForest => Player.InModBiome<PolypForestBiome>();
|
||||
public bool ZoneRadiantReefs => Player.InModBiome<RadiantReefsBiome>();
|
||||
public bool ZoneGleamingBurrows => Player.InModBiome<GleamingBurrowsBiome>();
|
||||
public bool ZoneClamDen => Player.InModBiome<ClamDenBiome>();
|
||||
public bool ZoneBasaltGully => Player.InModBiome<BasaltGullyBiome>();
|
||||
|
||||
public bool ZoneSulphur => Player.InModBiome<SulphurousSeaBiome>();
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace CalamityMod.Enums
|
||||
PolypForest = 8,
|
||||
GleamingBurrows = 16,
|
||||
BasaltGully = 32,
|
||||
ClamDen = 64
|
||||
}
|
||||
}
|
||||
@@ -110,3 +110,8 @@ TimelessShoresBiome: {
|
||||
DisplayName: Timeless Shores Biome
|
||||
TownNPCDialogueName: the Timeless Shores Biome
|
||||
}
|
||||
|
||||
ClamDenBiome: {
|
||||
DisplayName: Clam Den Biome
|
||||
TownNPCDialogueName: the Clam Den Biome
|
||||
}
|
||||
@@ -3,7 +3,15 @@ using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Placeables.SunkenSea;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -12,9 +20,54 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
public class Clam : ModNPC
|
||||
{
|
||||
private int hitAmount = 0;
|
||||
private bool hasBeenHit = false;
|
||||
private bool statChange = false;
|
||||
public enum PersonalityTypes
|
||||
{
|
||||
Reefs = 0,
|
||||
Burrows = 1,
|
||||
Den = 2
|
||||
}
|
||||
|
||||
public enum PhaseType
|
||||
{
|
||||
Idle = 0,
|
||||
Attacking = 1,
|
||||
Squirt = 2
|
||||
}
|
||||
|
||||
public Player Target => Main.player[NPC.target];
|
||||
|
||||
public ref float CurrentPhase => ref NPC.ai[0];
|
||||
|
||||
public ref float Timer => ref NPC.ai[1];
|
||||
|
||||
public ref float Personality => ref NPC.ai[3];
|
||||
|
||||
public ref float ShellRotation => ref NPC.localAI[0];
|
||||
|
||||
#region Textures
|
||||
|
||||
public static Asset<Texture2D> bottomJawTex;
|
||||
|
||||
public static Asset<Texture2D> bottomJawTexAlgae;
|
||||
|
||||
public static Asset<Texture2D> bottomJawTexCoral;
|
||||
|
||||
public static Asset<Texture2D> algaeTex;
|
||||
|
||||
public static Asset<Texture2D> coralTex;
|
||||
|
||||
public static Asset<Texture2D> backTex;
|
||||
#endregion
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
backTex = ModContent.Request<Texture2D>(Texture + "Back");
|
||||
bottomJawTex = ModContent.Request<Texture2D>(Texture + "Bottom");
|
||||
bottomJawTexAlgae = ModContent.Request<Texture2D>(Texture + "BottomAlgae");
|
||||
bottomJawTexCoral = ModContent.Request<Texture2D>(Texture + "BottomCoral");
|
||||
algaeTex = ModContent.Request<Texture2D>(Texture + "Algae");
|
||||
coralTex = ModContent.Request<Texture2D>(Texture + "Coral");
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -29,8 +82,8 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.damage = Main.hardMode ? 60 : 30;
|
||||
NPC.width = 56;
|
||||
NPC.height = 38;
|
||||
NPC.width = 50;
|
||||
NPC.height = 30;
|
||||
NPC.defense = 9999;
|
||||
NPC.DR_NERD(0.25f);
|
||||
NPC.lifeMax = Main.hardMode ? 300 : 150;
|
||||
@@ -42,9 +95,10 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
AIType = -1;
|
||||
NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0);
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.knockBackResist = 0.05f;
|
||||
NPC.knockBackResist = 0;
|
||||
Banner = NPC.type;
|
||||
BannerItem = ModContent.ItemType<ClamBanner>();
|
||||
NPC.GravityIgnoresLiquid = true;
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
NPC.Calamity().VulnerableToSickness = true;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
@@ -66,122 +120,260 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(hitAmount);
|
||||
writer.Write(NPC.chaseable);
|
||||
writer.Write(hasBeenHit);
|
||||
writer.Write(statChange);
|
||||
writer.Write(NPC.localAI[0]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
hitAmount = reader.ReadInt32();
|
||||
NPC.chaseable = reader.ReadBoolean();
|
||||
hasBeenHit = reader.ReadBoolean();
|
||||
statChange = reader.ReadBoolean();
|
||||
NPC.localAI[0] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
NPC.TargetClosest();
|
||||
|
||||
if (Target.Calamity().ZoneClamDen)
|
||||
Personality = (int)PersonalityTypes.Den;
|
||||
else if (Target.Calamity().ZoneGleamingBurrows)
|
||||
Personality = (int)PersonalityTypes.Burrows;
|
||||
else
|
||||
Personality = (int)PersonalityTypes.Reefs;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
NPC.TargetClosest(true);
|
||||
NPC.TargetClosest(false);
|
||||
// Always be mad during Clamity
|
||||
if (Main.player[NPC.target].Calamity().clamity)
|
||||
{
|
||||
hitAmount = 3;
|
||||
hasBeenHit = true;
|
||||
Personality = (int)PersonalityTypes.Burrows;
|
||||
}
|
||||
if (NPC.justHit && hitAmount < 3)
|
||||
switch (CurrentPhase)
|
||||
{
|
||||
++hitAmount;
|
||||
hasBeenHit = true;
|
||||
}
|
||||
NPC.chaseable = hasBeenHit;
|
||||
if (hitAmount == 3)
|
||||
{
|
||||
if (!statChange)
|
||||
{
|
||||
NPC.defense = Main.hardMode ? 15 : 6;
|
||||
NPC.damage = NPC.defDamage;
|
||||
statChange = true;
|
||||
}
|
||||
if (NPC.ai[0] == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
case (int)PhaseType.Idle:
|
||||
{
|
||||
if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9)
|
||||
NPC.velocity.X *= 0.9f;
|
||||
switch (Personality)
|
||||
{
|
||||
NPC.ai[0] = 1f;
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
// Aggro immediately
|
||||
case (int)PersonalityTypes.Den:
|
||||
{
|
||||
ChangePhase((int)PhaseType.Attacking);
|
||||
}
|
||||
break;
|
||||
// Aggro if the player is near
|
||||
case (int)PersonalityTypes.Burrows:
|
||||
{
|
||||
if (Target.Distance(NPC.Center) < 600 && NPC.HasSight(Target.Center))
|
||||
{
|
||||
ChangePhase((int)PhaseType.Attacking);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Aggro if hurt
|
||||
default:
|
||||
{
|
||||
if (NPC.life < (NPC.lifeMax - 2))
|
||||
{
|
||||
ChangePhase((int)PhaseType.Attacking);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
// If it aggro'd, decrease kb resist and defense since it's no longer stuck in the ground
|
||||
if (CurrentPhase == (int)PhaseType.Attacking)
|
||||
{
|
||||
NPC.knockBackResist = 0.05f;
|
||||
NPC.defense = Main.hardMode ? 15 : 6;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (int)PhaseType.Attacking:
|
||||
{
|
||||
Timer++;
|
||||
// Squirt
|
||||
if (Timer > 0)
|
||||
{
|
||||
ChangePhase((int)PhaseType.Squirt);
|
||||
NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (int)PhaseType.Squirt:
|
||||
{
|
||||
// Slow down. Once the clam is rested, start incrementing Timer
|
||||
if (NPC.velocity.Y == 0)
|
||||
{
|
||||
NPC.velocity.X *= 0.8f;
|
||||
// Set ai[2] to 1
|
||||
NPC.ai[2] = 1;
|
||||
}
|
||||
|
||||
// Increment Timer is ai[2] is 1
|
||||
if (NPC.ai[2] == 1)
|
||||
{
|
||||
Timer++;
|
||||
}
|
||||
|
||||
// When to start opening
|
||||
float startOpen = 30;
|
||||
// When to end opening
|
||||
float endOpen = startOpen + 30;
|
||||
// When to start closing
|
||||
float startClose = endOpen + 20;
|
||||
// When to stop closing
|
||||
float endClose = startClose + 5;
|
||||
// When to go to the next attack
|
||||
float reset = endClose + 60;
|
||||
// Rotation at its peak
|
||||
float maxRotation = MathHelper.ToRadians(80);
|
||||
|
||||
// Direction the player is relative to the clam
|
||||
int playerPosition = NPC.DirectionTo(Target.Center).X.DirectionalSign();
|
||||
|
||||
// Shell animation
|
||||
if (Timer >= startOpen && Timer <= endOpen)
|
||||
{
|
||||
ShellRotation = (float)Utils.AngleLerp(0, maxRotation * -NPC.spriteDirection, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startOpen, endOpen, Timer, true), 0));
|
||||
}
|
||||
else if (Timer >= startClose && Timer <= endClose)
|
||||
{
|
||||
ShellRotation = (float)Utils.AngleLerp(maxRotation * -NPC.spriteDirection, 0, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startClose, endClose, Timer, true), 0));
|
||||
}
|
||||
|
||||
// Fire the projectile
|
||||
if (Timer == (endClose - 5))
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 velocity = NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * 5;
|
||||
|
||||
// If the player is on the other side of the clam, flip the jet so that it doesn't fire backwards
|
||||
if (playerPosition != NPC.direction)
|
||||
velocity.X *= -1;
|
||||
|
||||
int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType<MantisClawJet>(), NPC.damage, 1);
|
||||
Main.projectile[p].friendly = false;
|
||||
Main.projectile[p].hostile = true;
|
||||
Main.projectile[p].DamageType = DamageClass.Default;
|
||||
}
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
GenericBubbleParticle waterFlavored = new GenericBubbleParticle(NPC.Center, Main.rand.NextFloat(16, 22) * NPC.DirectionTo(Target.Center).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(-4, 4), 5);
|
||||
waterFlavored.AffectedByLight = true;
|
||||
GeneralParticleHandler.SpawnParticle(waterFlavored);
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), NPC.Center);
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), NPC.Center);
|
||||
}
|
||||
|
||||
// Go back to melee
|
||||
if (Timer >= reset)
|
||||
{
|
||||
ChangePhase((int)PhaseType.Attacking);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
NPC.spriteDirection = NPC.direction;
|
||||
/*if (!statChange)
|
||||
{
|
||||
NPC.defense = Main.hardMode ? 15 : 6;
|
||||
NPC.damage = NPC.defDamage;
|
||||
statChange = true;
|
||||
}
|
||||
if (NPC.ai[0] == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9)
|
||||
{
|
||||
NPC.ai[0] = 1f;
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (NPC.velocity.Y == 0f)
|
||||
{
|
||||
NPC.ai[2] += 1f;
|
||||
int decelerationTimer = 20;
|
||||
if (NPC.ai[1] == 0f)
|
||||
{
|
||||
decelerationTimer = 12;
|
||||
}
|
||||
if (NPC.ai[2] < (float)decelerationTimer)
|
||||
{
|
||||
NPC.velocity.X *= 0.9f;
|
||||
return;
|
||||
}
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.TargetClosest(true);
|
||||
if (NPC.direction == 0)
|
||||
{
|
||||
NPC.direction = -1;
|
||||
}
|
||||
NPC.spriteDirection = -NPC.direction;
|
||||
NPC.ai[1] += 1f;
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] >= 4f)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
if (NPC.ai[1] == 2f)
|
||||
{
|
||||
float multiplierX = (float)Main.rand.Next(3, 7);
|
||||
NPC.velocity.X = (float)NPC.direction * multiplierX;
|
||||
NPC.velocity.Y = -8f;
|
||||
NPC.ai[1] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float multiplierX = (float)Main.rand.Next(5, 9);
|
||||
NPC.velocity.X = (float)NPC.direction * multiplierX;
|
||||
NPC.velocity.Y = -4f;
|
||||
}
|
||||
}
|
||||
NPC.ai[0] = 1f;
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
else if (NPC.velocity.Y == 0f)
|
||||
{
|
||||
NPC.ai[2] += 1f;
|
||||
int decelerationTimer = 20;
|
||||
if (NPC.ai[1] == 0f)
|
||||
{
|
||||
if (NPC.direction == 1 && NPC.velocity.X < 1f)
|
||||
decelerationTimer = 12;
|
||||
}
|
||||
if (NPC.ai[2] < (float)decelerationTimer)
|
||||
{
|
||||
NPC.velocity.X *= 0.9f;
|
||||
return;
|
||||
}
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.TargetClosest(true);
|
||||
if (NPC.direction == 0)
|
||||
{
|
||||
NPC.direction = -1;
|
||||
}
|
||||
NPC.spriteDirection = -NPC.direction;
|
||||
NPC.ai[1] += 1f;
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] >= 4f)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
if (NPC.ai[1] == 2f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + 0.1f;
|
||||
return;
|
||||
float multiplierX = (float)Main.rand.Next(3, 7);
|
||||
NPC.velocity.X = (float)NPC.direction * multiplierX;
|
||||
NPC.velocity.Y = -8f;
|
||||
NPC.ai[1] = 0f;
|
||||
}
|
||||
if (NPC.direction == -1 && NPC.velocity.X > -1f)
|
||||
else
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - 0.1f;
|
||||
return;
|
||||
float multiplierX = (float)Main.rand.Next(5, 9);
|
||||
NPC.velocity.X = (float)NPC.direction * multiplierX;
|
||||
NPC.velocity.Y = -4f;
|
||||
}
|
||||
}
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
NPC.damage = 0;
|
||||
{
|
||||
if (NPC.direction == 1 && NPC.velocity.X < 1f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + 0.1f;
|
||||
return;
|
||||
}
|
||||
if (NPC.direction == -1 && NPC.velocity.X > -1f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - 0.1f;
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void ChangePhase(int phaseNum, bool resetai2 = true)
|
||||
{
|
||||
CurrentPhase = phaseNum;
|
||||
Timer = 0;
|
||||
if (resetai2)
|
||||
NPC.ai[2] = 0;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
return CurrentPhase > 0;
|
||||
}
|
||||
|
||||
public override bool? CanBeHitByProjectile(Projectile projectile)
|
||||
{
|
||||
if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention)
|
||||
{
|
||||
return hasBeenHit;
|
||||
return CurrentPhase > 0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -194,7 +386,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.frameCounter = 0.0;
|
||||
NPC.frame.Y = NPC.frame.Y + frameHeight;
|
||||
}
|
||||
if (hitAmount < 3)
|
||||
if (CurrentPhase == 0)
|
||||
{
|
||||
NPC.frame.Y = frameHeight * 4;
|
||||
}
|
||||
@@ -245,5 +437,23 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
npcLoot.Add(ItemID.PinkPearl, 40);
|
||||
npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType<MolluskHusk>(), 2);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
Texture2D tex = TextureAssets.Npc[NPC.type].Value;
|
||||
Vector2 drawOffset = Vector2.UnitY * 8;
|
||||
Vector2 topDrawOffset = drawOffset + new Vector2(NPC.spriteDirection * -22, -3);
|
||||
bool facingRight = NPC.spriteDirection == 1;
|
||||
if (facingRight)
|
||||
{
|
||||
topDrawOffset.X += 6;
|
||||
}
|
||||
Vector2 backOffset = topDrawOffset;
|
||||
if (ShellRotation == 0)
|
||||
spriteBatch.Draw(backTex.Value, NPC.Center - screenPos + backOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f);
|
||||
spriteBatch.Draw(tex, NPC.Center - screenPos + topDrawOffset, null, NPC.GetAlpha(drawColor), ShellRotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f);
|
||||
spriteBatch.Draw(bottomJawTex.Value, NPC.Center - screenPos + drawOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 319 B |
|
After Width: | Height: | Size: 358 B |
@@ -42,6 +42,9 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
SpawnModBiomes = new int[1] { ModContent.GetInstance<SunkenSeaBiome>().Type };
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
// Banner = NPC.type;
|
||||
//BannerItem = ModContent.ItemType<JellyghoulBanner>();
|
||||
SpawnModBiomes = new int[1] { ModContent.GetInstance<SunkenSeaBiome>().Type };
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
|
||||
@@ -80,6 +80,9 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
NPC.Calamity().VulnerableToWater = false;
|
||||
SpawnModBiomes = new int[1] { ModContent.GetInstance<SunkenSeaBiome>().Type };
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
|
||||
public ref float Timer => ref NPC.ai[1];
|
||||
|
||||
/// <summary>
|
||||
/// Handles the visual scale for the slug
|
||||
/// </summary>
|
||||
public Vector2 squish = new Vector2();
|
||||
public Player Target => Main.player[NPC.target];
|
||||
|
||||
@@ -64,6 +67,10 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.Calamity().VulnerableToCold = true;
|
||||
NPC.Calamity().VulnerableToWater = true;
|
||||
SpawnModBiomes = new int[1] { ModContent.GetInstance<SunkenSeaBiome>().Type };
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
@@ -98,31 +105,38 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
case (int)PhaseType.Idle:
|
||||
{
|
||||
// Flip direction and slow down if it's still moving from a previous cycle
|
||||
if (Timer == 0 && Main.rand.NextBool())
|
||||
{
|
||||
NPC.direction *= -1;
|
||||
NPC.velocity.X *= 0.9f;
|
||||
}
|
||||
// Move horizontally in short bursts
|
||||
else if (Timer >= Main.rand.Next(30, 90) && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0)
|
||||
{
|
||||
NPC.ai[2] = 1;
|
||||
NPC.velocity.X = Main.rand.NextFloat(2, 4) * Main.rand.NextBool().ToDirectionInt();
|
||||
}
|
||||
|
||||
// Increment the timer before the burst ends
|
||||
if (NPC.ai[2] == 1)
|
||||
{
|
||||
NPC.ai[3]++;
|
||||
}
|
||||
// Slowdown after a burst
|
||||
else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0)
|
||||
{
|
||||
NPC.velocity.X *= 0.9f;
|
||||
NPC.ai[3]++;
|
||||
}
|
||||
|
||||
// Handle movement states
|
||||
if (NPC.ai[3] > Main.rand.Next(20, 40))
|
||||
{
|
||||
// If the slug is moving, enter slowdown
|
||||
if (NPC.ai[2] == 1)
|
||||
NPC.ai[2] = 2;
|
||||
// If the slug is in slowdown, reset
|
||||
else if (NPC.ai[2] == 2)
|
||||
ChangePhase((int)PhaseType.Idle);
|
||||
NPC.ai[3] = 0;
|
||||
@@ -130,6 +144,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
|
||||
NPC.direction = NPC.velocity.X.DirectionalSign();
|
||||
|
||||
// Aggro
|
||||
if (Target.active && Target.Distance(NPC.Center) < 400 && NPC.HasSight(Target.Center))
|
||||
{
|
||||
ChangePhase((int)PhaseType.Rawr);
|
||||
@@ -141,6 +156,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
int roar = 40;
|
||||
int startAI = 70;
|
||||
NPC.velocity.X *= 0.9f;
|
||||
// Roar in place with a lil jump
|
||||
if (Timer == roar)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center);
|
||||
@@ -156,11 +172,13 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
break;
|
||||
case (int)PhaseType.Jumps:
|
||||
{
|
||||
// Do a few hops towards the player
|
||||
int maxJumps = 3;
|
||||
if (NPC.ai[2] >= maxJumps - 1 && NPC.velocity.Y == 0)
|
||||
{
|
||||
ChangePhase((int)PhaseType.Dash);
|
||||
}
|
||||
// Jump
|
||||
if (NPC.velocity.Y == 0)
|
||||
{
|
||||
NPC.velocity.Y = -5;
|
||||
@@ -172,20 +190,24 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
break;
|
||||
case (int)PhaseType.Dash:
|
||||
{
|
||||
// Squash and stretch to telegraph the dash
|
||||
int squash = 30;
|
||||
int stretch = 10;
|
||||
Vector2 squashAmt = new Vector2(0.6f, 1.5f);
|
||||
RawrAnimation(squash, stretch, squashAmt);
|
||||
// Slow down before dashing
|
||||
if (Timer < squash + 10)
|
||||
{
|
||||
NPC.velocity.X *= 0.95f;
|
||||
NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign();
|
||||
}
|
||||
// Dash
|
||||
else if (Timer == squash + 10)
|
||||
{
|
||||
NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 6;
|
||||
SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, NPC.Center);
|
||||
}
|
||||
// Leave behind some hot mist particles
|
||||
else
|
||||
{
|
||||
if (Timer % 2 == 0)
|
||||
@@ -209,15 +231,18 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
int squash = squashDuration;
|
||||
int stretch = squash + stretchDuration;
|
||||
// rawrxd
|
||||
if (Timer == squash)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center);
|
||||
}
|
||||
// Squash
|
||||
if (Timer < squash)
|
||||
{
|
||||
squish.X = MathHelper.Lerp(1, squashAmt.X, Utils.GetLerpValue(0, squash, Timer, true));
|
||||
squish.Y = MathHelper.Lerp(1, squashAmt.Y, Utils.GetLerpValue(0, squash, Timer, true));
|
||||
}
|
||||
// Stretch
|
||||
else if (Timer >= squash && Timer < stretch)
|
||||
{
|
||||
squish.X = MathHelper.Lerp(squashAmt.X, 1, Utils.GetLerpValue(squash, stretch, Timer, true));
|
||||
@@ -233,6 +258,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.ai[2] = 0;
|
||||
if (resetai3)
|
||||
NPC.ai[3] = 0;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
|
||||
@@ -74,6 +74,9 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
NPC.Calamity().VulnerableToWater = false;
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.value = 0;
|
||||
// Banner = NPC.type;
|
||||
// BannerItem = ModContent.ItemType<PolyperilBanner>();
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
|
||||
@@ -199,6 +199,10 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
NPC.Calamity().VulnerableToSickness = true;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
NPC.Calamity().VulnerableToWater = false;
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace CalamityMod.Systems.Collections
|
||||
{ SunkenSeaBiomeFlags.PolypForest, (spawnInfo => spawnInfo.Player.Calamity().ZonePolypForest, GetInstance<PolypForestBiome>().Type) },
|
||||
{ SunkenSeaBiomeFlags.GleamingBurrows, (spawnInfo => spawnInfo.Player.Calamity().ZoneGleamingBurrows, GetInstance<GleamingBurrowsBiome>().Type) },
|
||||
{ SunkenSeaBiomeFlags.BasaltGully, (spawnInfo => spawnInfo.Player.Calamity().ZoneBasaltGully, GetInstance<BasaltGullyBiome>().Type) },
|
||||
{ SunkenSeaBiomeFlags.ClamDen, (spawnInfo => spawnInfo.Player.Calamity().ZoneClamDen, GetInstance<ClamDenBiome>().Type) },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||