Merge branch '1.4.4' into Handgun-Line-Reworks

This commit is contained in:
Xyk committed 2024-04-02 00:33:43 -07:00
commit 9ca1dfd3d9
118 files changed
+3016 -263

No files matched your search

+9
View File
@@ -295,6 +295,9 @@ namespace CalamityMod.Balancing
#region Ceaseless Void: Dark Energies
// 50% resist to true melee.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<DarkEnergy>(), ResistTrueMelee(0.5f)));
// 40% resist to Stellar Torus Staff.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<DarkEnergy>(), new ProjectileResistBalancingRule(0.6f, ProjectileType<StellarTorusBeam>())));
#endregion
#region Storm Weaver
@@ -390,6 +393,9 @@ namespace CalamityMod.Balancing
// 65% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(ResistTrueMelee(0.35f))));
// 65% resist to Stellar Torus Staff.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<StellarTorusBeam>()))));
// 65% resist to The Enforcer's projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<EssenceFlame2>()))));
@@ -453,6 +459,9 @@ namespace CalamityMod.Balancing
// 25% resist to Zenith.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal))));
// 20% resist to Ariane's aura (Lilies of Finality).
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<LiliesOfFinalityAoE>()))));
// 20% resist to Blood Boiler.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<BloodBoilerFire>()))));
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.BiomeManagers
if (Main.remixWorld)
return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords < abyssStartHeight;
return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords >= abyssStartHeight && playerYTileCoords <= Main.maxTilesY - 200;
return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords >= abyssStartHeight && playerYTileCoords <= Main.UnderworldLayer;
}
// Temporarily use sulphur for now
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.BiomeManagers
if (Main.remixWorld)
{
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer2Tiles >= 200 &&
playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.2f) && playerYTileCoords > SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.4f);
playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.2f) && playerYTileCoords > SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.4f);
}
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer2Tiles >= 200 &&
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.BiomeManagers
if (Main.remixWorld)
{
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer3Tiles >= 200 &&
playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.4f) && playerYTileCoords > SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.6f);
playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.4f) && playerYTileCoords > SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f);
}
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer3Tiles >= 200 &&
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.BiomeManagers
if (Main.remixWorld)
{
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer4Tiles >= 200 &&
playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.6f);
playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f);
}
return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer4Tiles >= 200 &&
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.BiomeManagers
}
if (Main.remixWorld)
return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y > SulphurousSea.YStart && point.Y < Main.maxTilesY - 200 && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss;
return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y > SulphurousSea.YStart && point.Y < Main.UnderworldLayer && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss;
return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y < (Main.rockLayer - Main.maxTilesY / 13) && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss;
}
+31
View File
@@ -0,0 +1,31 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.Summon;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class LiliesOfFinalityBuff : ModBuff
{
public override void SetStaticDefaults()
{
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<LiliesOfFinalityElster>()] > 0)
modPlayer.LiliesOfFinalityBool = true;
if (!modPlayer.LiliesOfFinalityBool)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
player.buffTime[buffIndex] = 18000;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

+2
View File
@@ -1079,6 +1079,7 @@ namespace CalamityMod.CalPlayer
public bool celestialDragons = false;
public bool KalandraMirror = false;
public bool StellarTorus = false;
public bool LiliesOfFinalityBool = false;
#endregion
#region Biome
@@ -2121,6 +2122,7 @@ namespace CalamityMod.CalPlayer
celestialDragons = false;
KalandraMirror = false;
StellarTorus = false;
LiliesOfFinalityBool = false;
disableVoodooSpawns = false;
disablePerfCystSpawns = false;
+2 -2
View File
@@ -551,7 +551,7 @@ namespace CalamityMod.CalPlayer
#region Adrenaline
// This is how much Adrenaline will be changed by this frame.
float adrenalineDiff = 0;
bool wofAndNotHell = Main.wofNPCIndex >= 0 && Player.position.Y < (float)((Main.maxTilesY - 200) * 16);
bool wofAndNotHell = Main.wofNPCIndex >= 0 && Player.position.Y < (float)(Main.UnderworldLayer * 16);
// If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration.
if (adrenalineModeActive)
@@ -3119,7 +3119,7 @@ namespace CalamityMod.CalPlayer
for (int i = 0; i < Main.maxNPCs; ++i)
{
NPC npc = Main.npc[i];
if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
if (!npc.active || npc.friendly || npc.dontTakeDamage)
continue;
if (Vector2.Distance(Player.Center, npc.Center) <= range)
+2
View File
@@ -2065,6 +2065,7 @@ namespace CalamityMod
ProjectileType<InsidiousHarpoon>(),
ProjectileType<JawsProjectile>(),
ProjectileType<LeviathanTooth>(),
ProjectileType<LiliesOfFinalityAoE>(),
ProjectileType<LionfishProj>(),
ProjectileType<MechanicalBarracuda>(),
ProjectileType<MetalShard>(),
@@ -2566,6 +2567,7 @@ namespace CalamityMod
{ NPCID.EyeofCthulhu, 450000 }, // 30 seconds
{ NPCID.ServantofCthulhu, 6000 },
{ NPCType<BloodlettingServant>(), 12000 },
{ NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start
{ NPCID.EaterofWorldsBody, 10000 },
+3
View File
@@ -295,6 +295,7 @@ namespace CalamityMod
EnemyStats.ContactDamageValues = new SortedDictionary<int, int[]>
{
{ NPCID.KingSlime, new int[] { 40, 64, 80, 96, 120 } },
{ ModContent.NPCType<KingSlimeJewel3>(), new int[] { 30, 44, 60, 76, 90 } },
{ ModContent.NPCType<DesertScourgeHead>(), new int[] { 45, 66, 88, 110, 132 } },
{ ModContent.NPCType<DesertScourgeBody>(), new int[] { 24, 32, 40, 48, 72 } },
@@ -310,6 +311,7 @@ namespace CalamityMod
50, // 60 in phase 2, 70 in phase 3
72 } }, // Vanilla: 108 in phase 2; Rev+: 86 in phase 2, 101 in phase 3
{ NPCID.ServantofCthulhu, new int[] { 18, 24, 30, 36, 54 } },
{ ModContent.NPCType<BloodlettingServant>(), new int[] { 20, 26, 34, 42, 60 } }, // In phase 2: 26, 34, 44, 55, 78
{ ModContent.NPCType<Crabulon>(), new int[] { 40, 64, 80, 96, 120 } },
{ ModContent.NPCType<CrabShroom>(), new int[] { 25, 50, 62, 74, 75 } },
@@ -562,6 +564,7 @@ namespace CalamityMod
{ new Tuple<int, int>(ModContent.NPCType<DesertScourgeHead>(), ModContent.ProjectileType<GreatSandBlast>()), new int[] { 26, 44, 60, 76, 108 } },
{ new Tuple<int, int>(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 26, 44, 60, 76, 108 } },
{ new Tuple<int, int>(ModContent.NPCType<BloodlettingServant>(), ProjectileID.BloodShot), new int[] { 26, 36, 44, 52, 84 } },
{ new Tuple<int, int>(ModContent.NPCType<Crabulon>(), ModContent.ProjectileType<MushBomb>()), new int[] { 32, 48, 60, 72, 96 } },
{ new Tuple<int, int>(ModContent.NPCType<Crabulon>(), ModContent.ProjectileType<MushBombFall>()), new int[] { 32, 48, 60, 72, 96 } },
+3 -2
View File
@@ -150,7 +150,8 @@ namespace CalamityMod.Events
DownedBossSystem.startedBossRushAtLeastOnce = true;
},
permittedNPCs: new int[] { NPCID.BlueSlime, NPCID.YellowSlime, NPCID.PurpleSlime, NPCID.RedSlime, NPCID.GreenSlime, NPCID.RedSlime,
NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType<KingSlimeJewel>() }),
NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType<KingSlimeJewel>(),
ModContent.NPCType<KingSlimeJewel2>(), ModContent.NPCType<KingSlimeJewel3>() }),
new Boss(ModContent.NPCType<DesertScourgeHead>(), spawnContext: type =>
{
@@ -160,7 +161,7 @@ namespace CalamityMod.Events
}, permittedNPCs: new int[] { ModContent.NPCType<DesertScourgeBody>(), ModContent.NPCType<DesertScourgeTail>(), ModContent.NPCType<DesertNuisanceHead>(),
ModContent.NPCType<DesertNuisanceBody>(), ModContent.NPCType<DesertNuisanceTail>() }),
new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: NPCID.ServantofCthulhu),
new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.ServantofCthulhu, ModContent.NPCType<BloodlettingServant>() }),
new Boss(ModContent.NPCType<Crabulon>(), TimeChangeContext.Day, type =>
{
+2 -2
View File
@@ -62,10 +62,10 @@ namespace CalamityMod.Items.Armor.Auric
}
if (player.ownedProjectileCounts[ModContent.ProjectileType<SilvaCrystal>()] < 1)
{
var damage = (int)player.GetTotalDamage<SummonDamageClass>().ApplyTo(800);
var damage = (int)player.GetTotalDamage<SummonDamageClass>().ApplyTo(750);
var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType<SilvaCrystal>(), damage, 0f, Main.myPlayer, -20f, 0f);
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = 800;
Main.projectile[p].originalDamage = 750;
}
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor.Silva
var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType<SilvaCrystal>(), damage, 0f, Main.myPlayer, -20f, 0f);
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = baseDamage;
Main.projectile[p].originalDamage = 600;
}
}
player.GetDamage<SummonDamageClass>() += 0.65f;
+6
View File
@@ -93,6 +93,8 @@ namespace CalamityMod.Items
private void ApplyRarityColor(Item item, TooltipLine nameLine)
{
#region Uniquely Colored Developer Items
if (item.type == ModContent.ItemType<LiliesOfFinality>())
nameLine.OverrideColor = Color.Lerp(Color.Red, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f);
if (item.type == ModContent.ItemType<Fabstaff>())
nameLine.OverrideColor = new Color(Main.DiscoR, 100, 255);
if (item.type == ModContent.ItemType<StaffofBlushie>())
@@ -259,6 +261,10 @@ namespace CalamityMod.Items
// Numerous random tooltip edits which don't fit into another category
#region Various Tooltip Edits
// Lilies of Finality 512 edit
if (item.type == ModContent.ItemType<LiliesOfFinality>())
EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + " summon damage");
// Master Mode items also drop in Revengeance
// Only affects vanilla and Calamity items
if (item.master && (item.type < ItemID.Count || item.ModItem?.Mod is CalamityMod))
+1 -1
View File
@@ -162,6 +162,7 @@ namespace CalamityMod.Items
{ ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod
{ ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive
{ ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury
{ ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, //Lunar Portal Staff
{ ItemID.Muramasa, Do(CritDelta(+20)) },
{ ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) },
{ ItemID.Musket, Do(PointBlank, DamageExact(22)) },
@@ -487,7 +488,6 @@ namespace CalamityMod.Items
{ ItemID.FireWhip, autoReuse }, // Firecracker
{ ItemID.FlinxStaff, Do(AutoReuse, UseExact(35)) },
{ ItemID.MaceWhip, autoReuse }, // Morning Star
{ ItemID.MoonlordTurretStaff, Do(UseExact(15)) }, // Lunar Portal Staff
{ ItemID.OpticStaff, Do(AutoReuse, UseExact(25)) },
{ ItemID.PirateStaff, Do(AutoReuse, UseExact(25)) },
{ ItemID.QueenSpiderStaff, Do(UseExact(25)) },
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.DraedonMisc
Item.autoReuse = true;
Item.consumable = true;
Item.maxStack = 9999;
Item.rare = ItemRarityID.Orange;
Item.rare = ItemRarityID.Green;
Item.createTile = ModContent.TileType<CodebreakerTile>();
}
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.autoReuse = true;
Item.noMelee = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<IonBlast>();
Item.shootSpeed = 8f;
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.shootSpeed = 20f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.noMelee = true;
Item.knockBack = 3.75f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item95;
Item.autoReuse = true;
Item.shootSpeed = 13f;
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.noMelee = true;
Item.knockBack = 1.5f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item33;
Item.autoReuse = true;
Item.shootSpeed = 6f;
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.noMelee = true;
Item.knockBack = 5f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item84;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<NuclearFuryProjectile>();
+3 -3
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 74;
Item.height = 86;
Item.damage = 135;
Item.damage = 105;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 22;
Item.useStyle = ItemUseStyleID.Swing;
@@ -30,14 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<BalefulHarvesterProjectile>() : ProjectileID.FlamingJack;
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 0.8f), Item.knockBack * 0.5f, 0, type);
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 1.5f), Item.knockBack * 0.5f, 0, type);
target.AddBuff(BuffID.OnFire3, 300);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<BalefulHarvesterProjectile>() : ProjectileID.FlamingJack;
CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 0.8f), Item.knockBack * 0.5f, 0, type);
CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 1.5f), Item.knockBack * 0.5f, 0, type);
target.AddBuff(BuffID.OnFire3, 300);
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 56;
Item.height = 56;
Item.damage = 15;
Item.damage = 17;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 21;
Item.useTime = 21;
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<GalaxyBlast>();
Item.shootSpeed = 16f;
}
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<JudgementProj>();
Item.shootSpeed = 10f;
}
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<VirulentBeeWave>();
Item.shootSpeed = 9f;
}
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.noUseGraphic = true;
Item.knockBack = 10f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.channel = true;
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<SolsticeBeam>();
Item.shootSpeed = 16f;
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<StellarContemptHammer>();
Item.shootSpeed = Speed;
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shootSpeed = 12f;
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.channel = true;
Item.knockBack = 4.25f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.noUseGraphic = true;
Item.UseSound = SoundID.Item20;
Item.autoReuse = true;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.knockBack = 4.5f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item38;
Item.autoReuse = true;
Item.shootSpeed = 13f;
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.knockBack = 4.5f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item36;
Item.autoReuse = true;
Item.shoot = ProjectileID.BlackBolt;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.knockBack = 15f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item92;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PlasmaBlast>();
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.noUseGraphic = true;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 6f;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item71;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
+3 -2
View File
@@ -33,14 +33,15 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.DamageType = RogueDamageClass.Instance;
}
public override float StealthDamageMultiplier => 2f;
public override float StealthDamageMultiplier => 1.5f;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
if (player.Calamity().StealthStrikeAvailable() && stealth.WithinBounds(Main.maxProjectiles))
if (player.Calamity().StealthStrikeAvailable())
{
Main.projectile[stealth].Calamity().stealthStrike = true;
Main.projectile[stealth].penetrate = 3;
SoundEngine.PlaySound(SoundID.Item73, player.Center);
for (float i = 0; i < 5; i++)
{
+1 -1
View File
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.UseSound = SoundID.Item39;
Item.autoReuse = true;
Item.value = Item.sellPrice(copper: 24);
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<LunarKunaiProj>();
Item.shootSpeed = 22f;
Item.DamageType = RogueDamageClass.Instance;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.UseSound = SoundID.Item60;
Item.DamageType = DamageClass.Summon;
Item.mana = 10;
Item.damage = 230;
Item.damage = 232;
Item.knockBack = 3f;
Item.autoReuse = true;
Item.useTime = Item.useAnimation = 10;
+85
View File
@@ -0,0 +1,85 @@
using CalamityMod.Projectiles.Summon;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Items.Weapons.Summon
{
public class LiliesOfFinality : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Summon";
#region Other Stats
public static float MaxEnemyDistanceDetection = 2000f;
public static int CommonDustID = 114;
public static float Elster_DistanceFromTarget = 280f;
public static float Elster_TargettingFlySpeed = 35f;
public static float Elster_BulletProjectileSpeed = 20f;
public static int Elster_BulletMaxUpdates = 2;
public static float Ariane_BoltFireRate = 60f;
public static float Ariane_TargettingFlySpeed = 20f;
public static float Ariane_BoltProjectileSpeed = 25f;
public static int Ariane_BoltTimeHoming = 600;
public static float Ariane_MinTurnRate = 0.05f;
public static float Ariane_MaxTurnRate = 0.2f;
public static int Ariane_AoESize = 1050;
public static float Ariane_AoEDMGMultiplier = 0.4f;
// Do not change this number, ever. - Fabsol
public const int TheNumber = 512;
#endregion
public override void SetDefaults()
{
Item.damage = TheNumber;
Item.DamageType = DamageClass.Summon;
Item.shoot = ProjectileType<LiliesOfFinalityElster>();
Item.knockBack = 5f;
Item.mana = 10;
Item.useTime = Item.useAnimation = 15;
Item.width = 36;
Item.height = 50;
Item.noMelee = true;
Item.value = CalamityGlobalItem.Rarity15BuyPrice;
Item.rare = RarityType<Violet>();
Item.useStyle = ItemUseStyleID.HoldUp;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.maxMinions - player.slotsMinions >= 2)
{
Projectile.NewProjectileDirect(source, Main.MouseWorld, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI);
Projectile.NewProjectileDirect(source, Main.MouseWorld, new Vector2(1f, -1f) * 3f, ProjectileType<LiliesOfFinalityAriane>(), damage, knockback, player.whoAmI);
if (Main.dedServ)
return false;
int dustAmount = Main.rand.Next(30, 40 + 1);
for (int i = 0; i < dustAmount; i++)
{
float angle = MathHelper.TwoPi / dustAmount * i;
Vector2 dustVelocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 6f);
Dust spawnDust = Dust.NewDustPerfect(
Main.MouseWorld,
CommonDustID,
dustVelocity,
Scale: Main.rand.NextFloat(1.2f, 1.5f));
spawnDust.noGravity = true;
}
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+2 -2
View File
@@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Summon
{
Item.width = 42;
Item.height = 42;
Item.damage = 185;
Item.useTime = Item.useAnimation = 30;
Item.damage = 142;
Item.useTime = Item.useAnimation = 20;
Item.knockBack = 4f;
Item.mana = 10;
Item.shoot = ModContent.ProjectileType<StellarTorusSummon>();
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.noMelee = true;
Item.knockBack = 0.5f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
Item.rare = ItemRarityID.Purple;
Item.UseSound = SoundID.Item14;
Item.autoReuse = true;
Item.DamageType = DamageClass.Summon;
@@ -1520,3 +1520,8 @@ YoungDukeBuff: {
DisplayName: Young Duke Buff
Description: Mods.CalamityMod.Buffs.YoungDukeBuff.Description
}
LiliesOfFinalityBuff: {
DisplayName: Finality
Description: Remember our promise
}
@@ -204,7 +204,7 @@ CosmicKunai: {
Tooltip:
'''
Fires a rapid stream of short-range kunai
Stealth strikes make kunai travel farther and spawn 5 homing Cosmic Scythes
Stealth strikes make kunai pierce foes, travel farther, and spawn 5 homing scythes
'''
}
@@ -830,3 +830,13 @@ HarvestStaff: {
'No thoughts behind those eyes'
'''
}
LiliesOfFinality: {
DisplayName: Lilies of Finality
Tooltip:
'''
Requires 2 minion slots to use
Can only be summoned once
'Wake up'
'''
}
@@ -146,6 +146,7 @@ AeroSlime.DisplayName: Aero Slime
ArmoredDiggerHead.DisplayName: Armored Digger
MechanizedSerpent: Mechanized Serpent
AuroraSpirit.DisplayName: Aurora Spirit
BloodlettingServant.DisplayName: Bloodletting Servant
BloomSlime.DisplayName: Bloom Slime
Bohldohr.DisplayName: Bohldohr
Cnidrion.DisplayName: Cnidrion
@@ -167,7 +168,9 @@ Frogfish.DisplayName: Frogfish
Horse.DisplayName: Earth Elemental
IceClasper.DisplayName: Ice Clasper
ImpiousImmolator.DisplayName: Impious Immolator
KingSlimeJewel.DisplayName: Crown Jewel
KingSlimeJewel.DisplayName: Ruby Jewel
KingSlimeJewel2.DisplayName: Sapphire Jewel
KingSlimeJewel3.DisplayName: Emerald Jewel
MantisShrimp.DisplayName: Mantis Shrimp
OverloadedSoldier.DisplayName: Overloaded Soldier
PerennialSlime.DisplayName: Perennial Slime
@@ -325,3 +325,9 @@ HopeShredderArrow.DisplayName: Hope Shredder Arrow
HopeShredderArrowSplit.DisplayName: Hope Shredder Split Arrow
HarvestStaffMinion.DisplayName: Harvest Staff Minion
HarvestStaffSentry.DisplayName: Harvest Staff Sentry
LiliesOfFinalityAoE.DisplayName: Bioresonance Aura
LiliesOfFinalityAriane.DisplayName: Ariane
LiliesOfFinalityBullet.DisplayName: Einhorn Bullet
LiliesOfFinalityBolt.DisplayName: Bioresonance Bolt
LiliesOfFinalityElster.DisplayName: Elster
LiliesOfEternityBullet.DisplayName: Lilies Of Eternity Bullet
+3 -1
View File
@@ -293,7 +293,9 @@ namespace CalamityMod
// Enemies
EnemyRedirect(NPCType<HiveEnemy>(), "Hive (enemy)");
EnemyRedirect(NPCType<KingSlimeJewel>(), "Crown Jewel (enemy)");
EnemyRedirect(NPCType<KingSlimeJewel>(), "Ruby Jewel (enemy)");
EnemyRedirect(NPCType<KingSlimeJewel2>(), "Sapphire Jewel (enemy)");
EnemyRedirect(NPCType<KingSlimeJewel3>(), "Emerald Jewel (enemy)");
EnemyRedirect(NPCType<OldDukeToothBall>(), "Tooth Ball (Old Duke)");
EnemyRedirect(NPCType<CalamitasEnchantDemon>(), "Enchantment");
EnemyRedirect(NPCType<LeviathanStart>(), "%3F%3F%3F");
+1 -1
View File
@@ -199,7 +199,7 @@ namespace CalamityMod.NPCs.Abyss
if (NPC.position.Y > Main.worldSurface * 16.0)
NPC.velocity.Y += 3f;
if (NPC.position.Y > (Main.maxTilesY - 200) * 16.0)
if (NPC.position.Y > Main.UnderworldLayer * 16.0)
{
for (int a = 0; a < Main.maxNPCs; a++)
{
@@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
// Check for the flipped Abyss
if (Main.remixWorld)
{
notOcean = player.position.Y < (Main.maxTilesY - 200) * 0.8f || player.position.Y > Main.maxTilesY - 200 ||
notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
}
@@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
if (Main.remixWorld)
{
enrage = !bossRush &&
(player.position.Y < (Main.maxTilesY - 200) * 0.8f || player.position.Y > Main.maxTilesY - 200 ||
(player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
(player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000)));
}
+3
View File
@@ -6392,6 +6392,9 @@ namespace CalamityMod.NPCs
if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge))
return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR);
if (npc.type == NPCID.KingSlime && Main.masterMode && CalamityWorld.revenge)
return NPC.AnyNPCs(ModContent.NPCType<KingSlimeJewel2>()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null;
if (npc.type == NPCID.QueenBee && Main.zenithWorld)
{
if (npc.life / (float)npc.lifeMax < 0.5f)
+1
View File
@@ -15,6 +15,7 @@ namespace CalamityMod.NPCs.HiveMind
public class HiveBlob2 : ModNPC
{
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.HiveBlob.DisplayName");
public override string Texture => "CalamityMod/NPCs/HiveMind/HiveBlob";
public override void SetStaticDefaults()
{
Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

+1 -1
View File
@@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.NormalNPCs
NPC.velocity.Y = NPC.velocity.Y + 1f;
maxChaseSpeed *= 2f;
}
if ((double)NPC.position.Y > (double)((Main.maxTilesY - 200) * 16))
if ((double)NPC.position.Y > (double)(Main.UnderworldLayer * 16))
{
for (int a = 0; a < Main.maxNPCs; a++)
{
+1 -1
View File
@@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void AI()
{
Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.02f, 0.7f, 0.7f);
Lighting.AddLight(NPC.Center, 0.02f, 0.7f, 0.7f);
}
public override void HitEffect(NPC.HitInfo hit)
+203
View File
@@ -0,0 +1,203 @@
using System;
using CalamityMod.Events;
using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class BloodlettingServant : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[NPC.type] = 4;
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
}
public override void SetDefaults()
{
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.width = 30;
NPC.height = 32;
if (Main.tenthAnniversaryWorld)
NPC.scale *= 0.5f;
if (Main.getGoodWorld)
NPC.scale *= 1.1f;
NPC.defense = 5;
NPC.lifeMax = 96;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
NPC.knockBackResist = 0f;
NPC.noGravity = true;
NPC.noTileCollide = true;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = true;
}
public override void AI()
{
NPC.TargetClosest();
Player target = Main.player[NPC.target];
Vector2 lookAt = target.Center - NPC.Center;
if (lookAt.X > 0f)
{
NPC.spriteDirection = 1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X);
}
if (lookAt.X < 0f)
{
NPC.spriteDirection = -1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi;
}
Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f);
bool phase2 = NPC.life < NPC.lifeMax * 0.5;
float enrageScale = 1f + NPC.ai[2];
float enrageScaleMaxSpeedBonus = 2f * enrageScale;
float maxSpeedX = (phase2 ? (CalamityWorld.death ? 10f : 8f) : (CalamityWorld.death ? 8f : 6f)) + enrageScaleMaxSpeedBonus;
float maxSpeedY = (phase2 ? (CalamityWorld.death ? 8f : 6f) : (CalamityWorld.death ? 4f : 3f)) + enrageScaleMaxSpeedBonus;
float xAccel = maxSpeedX * 0.01f;
float xAccelBoost1 = maxSpeedX * 0.01f;
float xAccelBoost2 = maxSpeedX * 0.0075f;
float yAccel = maxSpeedY * 0.01f;
float yAccelBoost1 = maxSpeedY * 0.01f;
float yAccelBoost2 = maxSpeedY * 0.0075f;
if (target.dead)
{
NPC.velocity.Y -= 0.04f;
if (NPC.timeLeft > 10)
NPC.timeLeft = 10;
}
else
DemonEyeAI.DemonEyeBatMovement(NPC, maxSpeedX, maxSpeedY, xAccel, xAccelBoost1, xAccelBoost2, yAccel, yAccelBoost1, yAccelBoost2);
if (phase2)
NPC.damage = (int)Math.Round(NPC.defDamage * 1.3);
else
NPC.damage = NPC.defDamage;
if (!target.dead)
NPC.ai[3] += enrageScale;
float projectileShootGateValue = CalamityWorld.death ? 180f : 270f;
if (Main.getGoodWorld)
projectileShootGateValue *= 0.5f;
bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f;
if (NPC.ai[3] >= projectileShootGateValue && shootProjectile)
{
NPC.ai[3] = 0f;
float projectileSpeed = CalamityWorld.death ? 16f : 12f;
Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int projType = ProjectileID.BloodShot;
int projDamage = NPC.GetProjectileDamage(projType);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer);
Main.projectile[proj].timeLeft = 600;
}
NPC.netUpdate = true;
}
if (Main.rand.NextBool(20))
{
Vector2 dustSpawnTopLeft = new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f);
Dust blood = Dust.NewDustDirect(dustSpawnTopLeft, NPC.width, NPC.height / 2, DustID.Blood, NPC.velocity.X, 2f, 0, new Color(128, 0, 0, 255 - NPC.alpha), 1f);
blood.velocity.X *= 0.5f;
blood.velocity.Y *= 0.1f;
}
float pushVelocity = 0.2f * enrageScale;
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].active)
{
if (i != NPC.whoAmI && Main.npc[i].type == NPC.type)
{
if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale)
{
if (NPC.position.X < Main.npc[i].position.X)
NPC.velocity.X -= pushVelocity;
else
NPC.velocity.X += pushVelocity;
if (NPC.position.Y < Main.npc[i].position.Y)
NPC.velocity.Y -= pushVelocity;
else
NPC.velocity.Y += pushVelocity;
}
}
}
}
}
public override void FindFrame(int frameHeight)
{
NPC.frameCounter += 1D;
if (NPC.frameCounter >= 8D)
NPC.frame.Y = frameHeight;
else
NPC.frame.Y = 0;
if (NPC.frameCounter >= 16D)
{
NPC.frame.Y = 0;
NPC.frameCounter = 0D;
}
if (NPC.life < NPC.lifeMax * 0.5)
NPC.frame.Y += frameHeight * 2;
}
public override Color? GetAlpha(Color drawColor) => new Color(128, 0, 0, 255 - NPC.alpha);
public override void HitEffect(NPC.HitInfo hit)
{
if (NPC.life > 0)
{
for (int i = 0; i < hit.Damage / (double)NPC.lifeMax * 100; i++)
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f);
if (NPC.life < NPC.lifeMax * 0.5f && NPC.localAI[0] == 0f)
{
NPC.localAI[0] = 1f;
for (int i = 0; i < 50; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f);
Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f);
Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f);
Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha);
}
}
}
else
{
for (int i = 0; i < 100; i++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f);
Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f);
Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f);
Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha);
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+21 -15
View File
@@ -60,15 +60,17 @@ namespace CalamityMod.NPCs.NormalNPCs
return;
}
Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f);
// Float around the player
NPC.rotation = NPC.velocity.X / 15f;
NPC.TargetClosest(true);
NPC.TargetClosest();
float velocity = 5f;
float acceleration = 0.1f;
if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f)
if (NPC.position.Y > Main.player[NPC.target].position.Y - 400f)
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y *= 0.98f;
@@ -116,7 +118,7 @@ namespace CalamityMod.NPCs.NormalNPCs
{
NPC.ai[0] = 0f;
Vector2 npcPos = new Vector2(NPC.Center.X, NPC.Center.Y);
Vector2 npcPos = NPC.Center;
float xDist = Main.player[NPC.target].Center.X - npcPos.X;
float yDist = Main.player[NPC.target].Center.Y - npcPos.Y;
Vector2 projVector = new Vector2(xDist, yDist);
@@ -128,8 +130,6 @@ namespace CalamityMod.NPCs.NormalNPCs
projLength = speed / projLength;
projVector.X *= projLength;
projVector.Y *= projLength;
npcPos.X += projVector.X * 2f;
npcPos.Y += projVector.Y * 2f;
for (int dusty = 0; dusty < 10; dusty++)
{
@@ -163,14 +163,16 @@ namespace CalamityMod.NPCs.NormalNPCs
else
Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, damage, 0f, Main.myPlayer);
}
NPC.netUpdate = true;
}
}
public override Color? GetAlpha(Color drawColor)
{
Color initialColor = Color.DarkRed;
Color initialColor = new Color(150, 0, 0);
Color newColor = initialColor;
Color finalColor = Color.White;
Color finalColor = new Color(255, 125, 125);
float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration;
if (NPC.ai[0] > colorTelegraphGateValue)
newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration);
@@ -183,31 +185,35 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void HitEffect(NPC.HitInfo hit)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, hit.HitDirection, -1f, 0, default, 1f);
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, hit.HitDirection, -1f, 0, default, 1f);
Main.dust[dust].noGravity = true;
if (NPC.life <= 0)
{
NPC.position.X = NPC.position.X + (NPC.width / 2);
NPC.position.Y = NPC.position.Y + (NPC.height / 2);
NPC.width = 45;
NPC.height = 45;
NPC.position = NPC.Center;
NPC.width = NPC.height = 45;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int i = 0; i < 2; i++)
{
int rubyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
Main.dust[rubyDust].velocity *= 3f;
Main.dust[rubyDust].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[rubyDust].scale = 0.5f;
Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 10; j++)
{
int rubyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 3f);
int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 3f);
Main.dust[rubyDust2].noGravity = true;
Main.dust[rubyDust2].velocity *= 5f;
rubyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
Main.dust[rubyDust2].noGravity = true;
Main.dust[rubyDust2].velocity *= 2f;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 4.2 KiB

+191
View File
@@ -0,0 +1,191 @@
using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class KingSlimeJewel2 : ModNPC
{
public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel";
private const int BuffDustGateValue = 60;
private const float LightTelegraphDuration = 45f;
public override void SetStaticDefaults()
{
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
}
public override void SetDefaults()
{
NPC.aiStyle = -1;
AIType = -1;
NPC.damage = 10;
NPC.width = 22;
NPC.height = 22;
NPC.defense = 5;
NPC.DR_NERD(0.05f);
NPC.lifeMax = 105;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
NPC.knockBackResist = 0.9f;
NPC.noGravity = true;
NPC.noTileCollide = true;
NPC.HitSound = SoundID.NPCHit5;
NPC.DeathSound = SoundID.NPCDeath15;
NPC.Calamity().VulnerableToSickness = false;
}
public override void AI()
{
// Setting this in SetDefaults will disable expert mode scaling, so put it here instead
NPC.damage = 0;
// Despawn
if (!CalamityPlayer.areThereAnyDamnBosses)
{
NPC.life = 0;
NPC.HitEffect();
NPC.active = false;
NPC.netUpdate = true;
return;
}
Lighting.AddLight(NPC.Center, 0f, 0f, 0.8f);
// Float around the player
NPC.rotation = NPC.velocity.X / 15f;
NPC.TargetClosest();
float velocity = 5f;
float acceleration = 0.1f;
if (NPC.position.Y > Main.player[NPC.target].position.Y - 300f)
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y *= 0.98f;
NPC.velocity.Y -= acceleration;
if (NPC.velocity.Y > velocity)
NPC.velocity.Y = velocity;
}
else if (NPC.position.Y < Main.player[NPC.target].position.Y - 400f)
{
if (NPC.velocity.Y < 0f)
NPC.velocity.Y *= 0.98f;
NPC.velocity.Y += acceleration;
if (NPC.velocity.Y < -velocity)
NPC.velocity.Y = -velocity;
}
if (NPC.Center.X > Main.player[NPC.target].Center.X + 300f)
{
if (NPC.velocity.X > 0f)
NPC.velocity.X *= 0.98f;
NPC.velocity.X -= acceleration;
if (NPC.velocity.X > 8f)
NPC.velocity.X = 8f;
}
if (NPC.Center.X < Main.player[NPC.target].Center.X - 300f)
{
if (NPC.velocity.X < 0f)
NPC.velocity.X *= 0.98f;
NPC.velocity.X += acceleration;
if (NPC.velocity.X < -8f)
NPC.velocity.X = -8f;
}
// Emit buff dust
NPC.ai[0] += 1f;
if (NPC.ai[0] >= BuffDustGateValue)
{
NPC.ai[0] = 0f;
for (int dusty = 0; dusty < 10; dusty++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f);
int sapphire = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f);
Main.dust[sapphire].velocity = dustVel * Main.rand.NextFloat(1f, 2f);
Main.dust[sapphire].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[sapphire].scale = 0.5f;
Main.dust[sapphire].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
SoundEngine.PlaySound(SoundID.Item8, NPC.Center);
NPC.netUpdate = true;
}
}
public override Color? GetAlpha(Color drawColor)
{
Color initialColor = new Color(0, 0, 150);
Color newColor = initialColor;
Color finalColor = new Color(125, 125, 255);
float colorTelegraphGateValue = BuffDustGateValue - LightTelegraphDuration;
if (NPC.ai[0] > colorTelegraphGateValue)
newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration);
newColor.A = (byte)(255 * NPC.Opacity);
return newColor;
}
public override bool CheckActive() => false;
public override void HitEffect(NPC.HitInfo hit)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, hit.HitDirection, -1f, 0, default, 1f);
Main.dust[dust].noGravity = true;
if (NPC.life <= 0)
{
NPC.position = NPC.Center;
NPC.width = NPC.height = 45;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int i = 0; i < 2; i++)
{
int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f);
Main.dust[rubyDust].noGravity = true;
Main.dust[rubyDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[rubyDust].scale = 0.5f;
Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 10; j++)
{
int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 3f);
Main.dust[rubyDust2].noGravity = true;
Main.dust[rubyDust2].velocity *= 5f;
rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f);
Main.dust[rubyDust2].noGravity = true;
Main.dust[rubyDust2].velocity *= 2f;
}
}
}
}
}
+271
View File
@@ -0,0 +1,271 @@
using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class KingSlimeJewel3 : ModNPC
{
public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel";
private const int ChargePhaseGateValue = 90;
private const int ChargeGateValue = 60;
private const int ChargeGateValue_Death = 40;
private const float LightTelegraphDuration = 30f;
public override void SetStaticDefaults()
{
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
}
public override void SetDefaults()
{
NPC.aiStyle = -1;
AIType = -1;
NPC.GetNPCDamage();
NPC.width = 22;
NPC.height = 22;
NPC.defense = 15;
NPC.DR_NERD(0.15f);
NPC.lifeMax = 175;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
NPC.knockBackResist = 0.7f;
NPC.noGravity = true;
NPC.noTileCollide = true;
NPC.HitSound = SoundID.NPCHit5;
NPC.DeathSound = SoundID.NPCDeath15;
NPC.Calamity().VulnerableToSickness = false;
}
public override void AI()
{
// Despawn
if (!CalamityPlayer.areThereAnyDamnBosses)
{
NPC.life = 0;
NPC.HitEffect();
NPC.active = false;
NPC.netUpdate = true;
return;
}
Lighting.AddLight(NPC.Center, 0f, 0.8f, 0f);
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead)
NPC.TargetClosest();
if (NPC.ai[3] == 1f)
{
NPC.knockBackResist = 0f;
if (NPC.ai[0] == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.velocity *= CalamityWorld.death ? 0.94f : 0.96f;
NPC.ai[1] += 1f;
float anglularSpeed = NPC.ai[1] / (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue);
anglularSpeed = 0.1f + anglularSpeed * 0.4f;
NPC.rotation += anglularSpeed * NPC.direction;
if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue))
{
for (int dusty = 0; dusty < 10; dusty++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f);
int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f);
Main.dust[emerald].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[emerald].scale = 0.5f;
Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
SoundEngine.PlaySound(SoundID.Item38, NPC.Center);
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.netUpdate = true;
}
}
else if (NPC.ai[0] == 1f)
{
// Set damage
NPC.damage = NPC.defDamage;
float chargeSpeed = CalamityWorld.death ? 24f : 16f;
NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * chargeSpeed;
NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2;
NPC.ai[0] = 2f;
NPC.ai[1] = 0f;
NPC.netSpam = 0;
NPC.netUpdate = true;
}
else if (NPC.ai[0] == 2f)
{
// Set damage
NPC.damage = NPC.defDamage;
NPC.ai[1] += 1f;
if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue))
{
// Avoid cheap bullshit
NPC.damage = 0;
for (int dusty = 0; dusty < 10; dusty++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f);
int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f);
Main.dust[emerald].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[emerald].scale = 0.5f;
Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
SoundEngine.PlaySound(SoundID.Item8, NPC.Center);
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
NPC.velocity = Vector2.Zero;
}
}
}
else
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.knockBackResist = 0.7f;
NPC.rotation = NPC.velocity.X / 15f;
float velocity = 5f;
float acceleration = 0.2f;
if (NPC.position.Y > Main.player[NPC.target].position.Y - 200f)
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y *= 0.98f;
NPC.velocity.Y -= acceleration;
if (NPC.velocity.Y > velocity)
NPC.velocity.Y = velocity;
}
else if (NPC.position.Y < Main.player[NPC.target].position.Y - 300f)
{
if (NPC.velocity.Y < 0f)
NPC.velocity.Y *= 0.98f;
NPC.velocity.Y += acceleration;
if (NPC.velocity.Y < -velocity)
NPC.velocity.Y = -velocity;
}
if (NPC.Center.X > Main.player[NPC.target].Center.X + 200f)
{
if (NPC.velocity.X > 0f)
NPC.velocity.X *= 0.98f;
NPC.velocity.X -= acceleration;
if (NPC.velocity.X > 8f)
NPC.velocity.X = 8f;
}
if (NPC.Center.X < Main.player[NPC.target].Center.X - 200f)
{
if (NPC.velocity.X < 0f)
NPC.velocity.X *= 0.98f;
NPC.velocity.X += acceleration;
if (NPC.velocity.X < -8f)
NPC.velocity.X = -8f;
}
NPC.ai[2] += 1f;
if (NPC.ai[2] >= ChargePhaseGateValue)
{
NPC.ai[2] = 0f;
NPC.ai[3] = 1f;
NPC.netUpdate = true;
}
}
}
public override Color? GetAlpha(Color drawColor)
{
Color initialColor = new Color(0, 150, 0);
Color newColor = initialColor;
Color finalColor = new Color(125, 255, 125);
float colorTelegraphGateValue = (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue) - LightTelegraphDuration;
if (NPC.ai[1] > colorTelegraphGateValue)
newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[1] - colorTelegraphGateValue) / LightTelegraphDuration);
newColor.A = (byte)(255 * NPC.Opacity);
return newColor;
}
public override bool CheckActive() => false;
public override void HitEffect(NPC.HitInfo hit)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f);
Main.dust[dust].noGravity = true;
if (NPC.life <= 0)
{
NPC.position = NPC.Center;
NPC.width = NPC.height = 45;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int i = 0; i < 2; i++)
{
int emeraldDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
Main.dust[emeraldDust].noGravity = true;
Main.dust[emeraldDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[emeraldDust].scale = 0.5f;
Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 10; j++)
{
int emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f);
Main.dust[emeraldDust2].noGravity = true;
Main.dust[emeraldDust2].velocity *= 5f;
emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
Main.dust[emeraldDust2].noGravity = true;
Main.dust[emeraldDust2].velocity *= 2f;
}
}
}
}
}
+1 -2
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.StormWeaver
global.unbreakableDR = true;
NPC.chaseable = false;
NPC.HitSound = SoundID.NPCHit4;
NPC.DeathSound = SoundID.NPCDeath14;
NPC.DeathSound = StormWeaverHead.DeathSound;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
@@ -136,7 +136,6 @@ namespace CalamityMod.NPCs.StormWeaver
global.unbreakableDR = false;
NPC.chaseable = true;
NPC.HitSound = SoundID.NPCHit13;
NPC.DeathSound = SoundID.NPCDeath13;
NPC.frame = new Rectangle(0, 0, 54, 52);
}
}
+5 -3
View File
@@ -51,6 +51,9 @@ namespace CalamityMod.NPCs.StormWeaver
private const float BoltAngleSpread = 280;
private bool tail = false;
public static readonly SoundStyle ArmorShedSound = new("CalamityMod/Sounds/Custom/WeaverArmorShed");
public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/WeaverDeath");
// Lightning flash variables
public float lightning = 0f;
private float lightningDecay = 1f;
@@ -98,7 +101,7 @@ namespace CalamityMod.NPCs.StormWeaver
global.unbreakableDR = true;
NPC.chaseable = false;
NPC.HitSound = SoundID.NPCHit4;
NPC.DeathSound = SoundID.NPCDeath14;
NPC.DeathSound = DeathSound;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
@@ -202,7 +205,7 @@ namespace CalamityMod.NPCs.StormWeaver
if (Main.netMode != NetmodeID.Server)
Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find<ModGore>("SWArmorHead1").Type, NPC.scale);
SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.Center);
SoundEngine.PlaySound(ArmorShedSound, NPC.Center);
CalamityGlobalNPC global = NPC.Calamity();
NPC.defense = 20;
@@ -210,7 +213,6 @@ namespace CalamityMod.NPCs.StormWeaver
global.unbreakableDR = false;
NPC.chaseable = true;
NPC.HitSound = SoundID.NPCHit13;
NPC.DeathSound = SoundID.NPCDeath13;
NPC.frame = new Rectangle(0, 0, 62, 86);
}
}
+1 -2
View File
@@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.StormWeaver
// Phase one settings
NPC.takenDamageMultiplier = 2f;
NPC.HitSound = SoundID.NPCHit53;
NPC.DeathSound = SoundID.NPCDeath14;
NPC.DeathSound = StormWeaverHead.DeathSound;
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
@@ -140,7 +140,6 @@ namespace CalamityMod.NPCs.StormWeaver
global.DR = 0.4f;
NPC.takenDamageMultiplier = 1f;
NPC.HitSound = SoundID.NPCHit13;
NPC.DeathSound = SoundID.NPCDeath13;
NPC.frame = new Rectangle(0, 0, 42, 68);
}
}
@@ -198,12 +198,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (!despawn)
{
Vector2 brainCenter = npc.Center;
float targetXDist = Main.player[npc.target].Center.X - brainCenter.X;
float targetYDist = Main.player[npc.target].Center.Y - brainCenter.Y;
Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero);
float targetXDist = destination.X - brainCenter.X;
float targetYDist = destination.Y - brainCenter.Y;
float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist);
float velocityScale = death ? 6f : 4.5f;
float velocityBoost = velocityScale * (1f - lifeRatio);
float nonChargeSpeed = 18f + velocityBoost + 3f * enrageScale;
float nonChargeSpeed = (masterMode ? 24f : 18f) + velocityBoost + 3f * enrageScale;
if (Main.getGoodWorld)
nonChargeSpeed *= 1.15f;
@@ -213,6 +214,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float minInertia = death ? 60f : 75f;
float maxInertia = death ? 80f : 100f;
if (masterMode)
{
minInertia -= 10f;
maxInertia -= 10f;
}
float inertia = MathHelper.Lerp(minInertia, maxInertia, lifeRatio);
npc.velocity.X = (npc.velocity.X * inertia + targetXDist) / (inertia + 1f);
npc.velocity.Y = (npc.velocity.Y * inertia + targetYDist) / (inertia + 1f);
@@ -259,7 +266,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center);
// Velocity
npc.velocity = (Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity;
npc.velocity = (Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity;
if (Main.getGoodWorld)
npc.velocity *= 1.15f;
}
@@ -406,6 +413,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
spread = death ? 30 : 20;
}
if (masterMode)
{
numProj += 3;
spread += 10;
}
float rotation = MathHelper.ToRadians(spread);
for (int j = 0; j < numProj; j++)
{
@@ -444,6 +457,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
spread = death ? 15 : 10;
}
if (masterMode)
{
numProj += 4;
spread += 15;
}
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < numProj; i++)
{
@@ -673,7 +692,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X;
float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y;
float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1);
float maxMoveVelocity = (death ? 2f : 1.5f) + velocityScale;
float maxMoveVelocity = (death ? (masterMode ? 4f : 2f) : (masterMode ? 3f : 1.5f)) + velocityScale;
if (Main.getGoodWorld)
maxMoveVelocity *= 2f;
@@ -698,7 +717,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (!despawn)
npc.localAI[1] += (death ? 2f : 1f) + velocityScale;
if (npc.localAI[1] >= 360f)
if (npc.localAI[1] >= (masterMode ? 540f : 360f))
{
// Teleport location
npc.localAI[1] = 0f;
@@ -855,7 +874,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X;
float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y;
float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist);
float velocity = (death ? 12f : 8f) + chargeAggressionScale;
float velocity = (death ? (masterMode ? 16f : 12f) : (masterMode ? 12f : 8f)) + chargeAggressionScale;
velocity += 2f * enrageScale;
// Max distance from Brain
@@ -905,9 +924,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Set damage
npc.damage = npc.defDamage;
float chargeVelocity = (death ? 9f : 6f) + chargeAggressionScale;
float chargeVelocity = (death ? (masterMode ? 12f : 9f) : (masterMode ? 9f : 6f)) + chargeAggressionScale;
chargeVelocity += 2f * enrageScale;
Vector2 targetDirection = Main.player[npc.target].Center - npc.Center;
Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero);
Vector2 targetDirection = destination - npc.Center;
targetDirection = targetDirection.SafeNormalize(Vector2.UnitY);
if (Main.getGoodWorld)
{
@@ -922,7 +942,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
// Return to Brain after a set time
float chargeDistance = masterMode ? 700f : 600f;
float chargeDistance = masterMode ? 900f : 600f;
float returnToBrainGateValue = chargeDistance / chargeVelocity;
npc.ai[1] += 1f;
@@ -12,6 +12,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
public static class EaterOfWorldsAI
{
private const int TotalMasterModeWorms = 4;
public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod)
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
@@ -38,9 +40,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles && npc.type == NPCID.EaterofWorldsHead)
npc.TargetClosest();
// Fade in.
npc.Opacity = MathHelper.Clamp(npc.Opacity + 0.08f, 0f, 1f);
bool enrage = true;
int targetTileX = (int)Main.player[npc.target].Center.X / 16;
int targetTileY = (int)Main.player[npc.target].Center.Y / 16;
@@ -68,7 +67,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsBody);
// Percent body segments remaining
float lifeRatio = segmentCount / totalSegments;
float lifeRatio = MathHelper.Clamp(segmentCount / totalSegments, 0f, 1f);
// 10 seconds of resistance to prevent spawn killing
if (calamityGlobalNPC.newAI[1] < 600f && bossRush)
@@ -85,6 +84,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Boost velocity by 50% phase
bool phase4 = lifeRatio < (masterMode ? 0.5f : 0.2f);
// Go fucking crazy in Master Mode
bool phase5 = lifeRatio < 0.15f && masterMode;
bool phase6 = lifeRatio < 0.05f && masterMode;
// Fire projectiles
if (Main.netMode != NetmodeID.MultiplayerClient)
{
@@ -163,8 +166,29 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// A head sets the length variable (npc.ai[2]) and then sets its next segment to a freshly spawned body.
if (npc.type == NPCID.EaterofWorldsHead)
{
// Amount of segments to spawn.
int segmentSpawnAmount = (int)(masterMode ? (totalSegments / TotalMasterModeWorms) : totalSegments);
// Spawn additional worms of reduced length in Master Mode.
if (masterMode)
{
Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY);
int randomXLimit = 80;
int randomYLimit = 80;
for (int i = 1; i < TotalMasterModeWorms; i++)
{
additionalWormSpawnLocation += new Vector2((Main.rand.Next(randomXLimit + 1) + randomXLimit) * (Main.rand.NextBool() ? -1f : 1f), Main.rand.Next(randomYLimit + 1) + randomYLimit);
int wormHead = NPC.NewNPC(npc.GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsHead, npc.whoAmI + segmentSpawnAmount * i + 1);
Main.npc[wormHead].ai[2] = segmentSpawnAmount;
Main.npc[wormHead].ai[0] = NPC.NewNPC(Main.npc[wormHead].GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsBody, Main.npc[wormHead].whoAmI);
Main.npc[(int)Main.npc[wormHead].ai[0]].ai[1] = Main.npc[wormHead].whoAmI;
Main.npc[(int)Main.npc[wormHead].ai[0]].ai[2] = Main.npc[wormHead].ai[2] - 1f;
Main.npc[wormHead].netUpdate = true;
}
}
// Set head's "length beyond this point" to be the total length of the worm.
npc.ai[2] = totalSegments;
npc.ai[2] = segmentSpawnAmount;
// Body spawn
npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI);
@@ -300,7 +324,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
noFlyZone -= (int)(enrageScale * 200f);
if (masterMode)
noFlyZone -= 200;
noFlyZone -= phase5 ? 400 : 200;
if (noFlyZone < 100)
noFlyZone = 100;
@@ -331,7 +355,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float segmentVelocity = 12f + velocityBoost;
float segmentAcceleration = 0.15f + accelerationBoost;
if (phase4)
if (phase6)
{
segmentVelocity += 6f * (enrageScale + 1f);
segmentAcceleration += 0.3f * (enrageScale + 1f);
}
else if (phase5)
{
segmentVelocity += 4f * (enrageScale + 1f);
segmentAcceleration += 0.2f * (enrageScale + 1f);
}
else if (phase4)
{
segmentVelocity += 2f * (enrageScale + 1f);
segmentAcceleration += 0.1f * (enrageScale + 1f);
@@ -355,8 +389,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
Vector2 segmentDirection = npc.Center;
float targetPosX = Main.player[npc.target].Center.X;
float targetPosY = Main.player[npc.target].Center.Y;
Vector2 destination = Main.player[npc.target].Center + (phase6 ? Main.player[npc.target].velocity * 20f : Vector2.Zero);
float targetPosX = destination.X;
float targetPosY = destination.Y;
targetPosX = (int)(targetPosX / 16f) * 16;
targetPosY = (int)(targetPosY / 16f) * 16;
@@ -497,14 +532,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
while (segmentAmt > 0 && segmentAmt < Main.maxNPCs && Main.npc[segmentAmt].active && Main.npc[segmentAmt].aiStyle == npc.aiStyle)
{
int arg_2853_0 = (int)Main.npc[segmentAmt].ai[0];
int attachedSegments = (int)Main.npc[segmentAmt].ai[0];
Main.npc[segmentAmt].active = false;
npc.life = 0;
if (Main.netMode == NetmodeID.Server)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0);
segmentAmt = arg_2853_0;
segmentAmt = attachedSegments;
}
if (Main.netMode == NetmodeID.Server)
@@ -1208,8 +1243,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
public static int GetEaterOfWorldsSegmentsCountRevDeath()
{
return CalamityWorld.LegendaryMode ? 100 :
(CalamityWorld.death || BossRushEvent.BossRushActive) ? ((Main.masterMode || BossRushEvent.BossRushActive) ? 62 : 57) :
((Main.masterMode || BossRushEvent.BossRushActive) ? 67 : 62);
(CalamityWorld.death || BossRushEvent.BossRushActive) ? ((Main.masterMode || BossRushEvent.BossRushActive) ? 60 : 57) :
((Main.masterMode || BossRushEvent.BossRushActive) ? 68 : 62);
}
public static int GetEaterOfWorldsSegmentsCountVanilla()
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Events;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
@@ -152,7 +153,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
hoverAcceleration += 0.08f;
}
float attackSwitchTimer = 180f - (death ? 180f * (1f - lifeRatio) : 0f);
float attackSwitchTimer = (masterMode ? 120f : 180f) - (death ? 180f * (1f - lifeRatio) : 0f);
bool timeToCharge = npc.ai[2] >= attackSwitchTimer;
Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f;
Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.01f) : 0f));
@@ -172,7 +173,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (!Main.player[npc.target].dead)
npc.ai[3] += 1f;
float servantSpawnGateValue = death ? 20f : 40f;
float servantSpawnGateValue = death ? (masterMode ? 10f : 20f) : (masterMode ? 25f : 40f);
if (Main.getGoodWorld)
servantSpawnGateValue *= 0.8f;
@@ -242,13 +243,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Set damage
npc.damage = npc.defDamage;
int chargeDelay = 90;
int chargeDelay = masterMode ? 70 : 90;
if (death)
chargeDelay -= (int)Math.Round(40f * (1f - lifeRatio));
if (Main.getGoodWorld)
chargeDelay -= 30;
float slowDownGateValue = chargeDelay * (death ? 0.75f : 0.65f);
float slowDownGateValue = chargeDelay * (death ? (masterMode ? 0.9f : 0.75f) : (masterMode ? 0.8f : 0.65f));
npc.ai[2] += 1f;
if (npc.ai[2] >= slowDownGateValue)
@@ -260,7 +261,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (decelerationScalar < 0f)
decelerationScalar = 0f;
npc.velocity *= (MathHelper.Lerp(0.92f, 0.96f, decelerationScalar));
npc.velocity *= (MathHelper.Lerp(masterMode ? 0.76f : 0.92f, masterMode ? 0.88f : 0.96f, decelerationScalar));
if (Main.getGoodWorld)
npc.velocity *= 0.99f;
@@ -338,14 +339,24 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[1] += phaseChangeRate;
if (npc.ai[1] % servantSpawnGateValue == 0f)
{
Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(5.65f, 5.65f);
float servantVelocity = masterMode ? 11.3f : 5.65f;
Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity);
if (Main.getGoodWorld)
servantSpawnVelocity *= 3f;
Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, enrageScale);
int spawnType = NPCID.ServantofCthulhu;
if (masterMode)
{
int maxBloodServants = 2;
bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType<BloodlettingServant>()) < maxBloodServants;
if (spawnBloodServant)
spawnType = ModContent.NPCType<BloodlettingServant>();
}
int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScale);
Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X;
Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y;
@@ -461,13 +472,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
hoverAcceleration += 0.1f;
}
float phaseLimit = 200f - (death ? 150f * (phase2LifeRatio - lifeRatio) : 0f);
float phaseLimit = (masterMode ? 160f : 200f) - (death ? 150f * (phase2LifeRatio - lifeRatio) : 0f);
bool timeToCharge = npc.ai[2] >= phaseLimit;
Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.01f) : 0f));
npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.001f) : 0f));
npc.ai[2] += 1f;
float projectileGateValue = (lifeRatio < 0.5f && death) ? 50f : 80f;
float projectileGateValue = (lifeRatio < 0.5f && death) ? (masterMode ? 40f : 50f) : (masterMode ? 60f : 80f);
if (npc.ai[2] % projectileGateValue == 0f && shootProjectile)
{
Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity * 2f;
@@ -475,8 +486,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ProjectileID.BloodNautilusShot;
int numProj = 3;
int spread = 10;
int numProj = masterMode ? Main.rand.Next(4, 6) : 3;
int spread = masterMode ? numProj * 3 : 10;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < numProj; i++)
{
@@ -530,11 +541,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Set damage
npc.damage = setDamage;
int phase2ChargeDelay = 80;
int phase2ChargeDelay = masterMode ? 60 : 80;
if (death)
phase2ChargeDelay -= (int)Math.Round(35f * (phase2LifeRatio - lifeRatio));
float slowDownGateValue = phase2ChargeDelay * (death ? 0.85f : 0.75f);
float slowDownGateValue = phase2ChargeDelay * (death ? (masterMode ? 0.95f : 0.85f) : (masterMode ? 0.9f : 0.75f));
npc.ai[2] += 1f;
if (npc.ai[2] >= slowDownGateValue)
@@ -546,7 +557,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (decelerationScalar < 0f)
decelerationScalar = 0f;
npc.velocity *= (MathHelper.Lerp(0.9f, 0.95f, decelerationScalar));
npc.velocity *= (MathHelper.Lerp(masterMode ? 0.6f : 0.9f, masterMode ? 0.7f : 0.95f, decelerationScalar));
if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1)
npc.velocity.X = 0f;
if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1)
@@ -611,10 +622,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float targetVelocity = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f;
targetVelocity += 10f - targetVelocity;
if (targetVelocity < 5f)
targetVelocity = 5f;
if (targetVelocity > 15f)
targetVelocity = 15f;
if (targetVelocity < (masterMode ? 2f : 5f))
targetVelocity = (masterMode ? 2f : 5f);
if (targetVelocity > (masterMode ? 6f : 15f))
targetVelocity = (masterMode ? 6f : 15f);
if (npc.ai[2] == -1f)
{
@@ -733,6 +744,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float accelerationBoost = death ? 0.425f * (phase3LifeRatio - lifeRatio) : 0.125f * (phase3LifeRatio - lifeRatio);
float hoverSpeed = 8f + speedBoost;
float hoverAcceleration = 0.25f + accelerationBoost;
hoverSpeed += enrageScale * 4f;
hoverAcceleration += enrageScale * 0.125f;
Vector2 eyeLineUpChargeDirection = npc.Center;
float lineUpChargeTargetX = Main.player[npc.target].Center.X - eyeLineUpChargeDirection.X;
@@ -762,8 +775,31 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
Vector2 servantSpawnVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity;
Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset;
int maxServants = death ? (finalPhaseDeath ? 1 : penultimatePhaseDeath ? 2 : 3) : (finalPhaseRev ? 2 : 4);
bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants;
int spawnType = NPCID.ServantofCthulhu;
bool spawnServant = false;
float enrageScaleToPass = enrageScale;
if (masterMode)
{
int maxBloodServants = 2;
bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType<BloodlettingServant>()) < maxBloodServants;
if (spawnBloodServant)
{
spawnType = ModContent.NPCType<BloodlettingServant>();
spawnServant = true;
enrageScaleToPass += 0.5f;
}
else
{
int maxServants = death ? 1 : 2;
spawnServant = (penultimatePhaseDeath || finalPhaseRev) ? false : NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants;
}
}
else
{
int maxServants = death ? (finalPhaseDeath ? 1 : penultimatePhaseDeath ? 2 : 3) : (finalPhaseRev ? 2 : 4);
spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants;
}
if (spawnServant)
SoundEngine.PlaySound(SoundID.NPCDeath13, servantSpawnCenter);
@@ -771,7 +807,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
if (spawnServant)
{
int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, enrageScale);
int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScaleToPass);
Main.npc[eye].velocity.X = servantSpawnVelocity.X;
Main.npc[eye].velocity.Y = servantSpawnVelocity.Y;
@@ -839,9 +875,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
npc.TargetClosest();
calamityGlobalNPC.newAI[0] += 1f;
calamityGlobalNPC.newAI[0] += ((masterMode && calamityGlobalNPC.newAI[0] % 2f != 0f) ? Main.rand.Next(2) + 1f : 1f);
if (calamityGlobalNPC.newAI[0] > 3f)
calamityGlobalNPC.newAI[0] = 0f;
calamityGlobalNPC.newAI[0] = masterMode ? Main.rand.Next(2) : 0f;
npc.SyncExtraAI();
}
@@ -50,18 +50,40 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Spawn Crystal phase
bool phase3 = lifeRatio < 0.5f;
// Check if the crystal is alive
// Check if the crystals are alive
bool crystalAlive = true;
bool blueCrystalAlive = false;
bool greenCrystalAlive = true;
if (phase3)
{
crystalAlive = NPC.AnyNPCs(ModContent.NPCType<KingSlimeJewel>());
if (masterMode)
{
blueCrystalAlive = NPC.AnyNPCs(ModContent.NPCType<KingSlimeJewel2>());
greenCrystalAlive = NPC.AnyNPCs(ModContent.NPCType<KingSlimeJewel3>());
}
}
// Sapphire Crystal buffs
int setDamage = npc.defDamage;
npc.defense = npc.defDefense;
if (blueCrystalAlive)
{
setDamage = (int)Math.Round(setDamage * 1.5);
npc.defense *= 2;
}
// Dust color when the blue crystal is alive
Color dustColor = Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f);
// Spawn crystal in phase 2
if (phase3 && npc.Calamity().newAI[0] == 0f)
{
npc.Calamity().newAI[0] = 1f;
npc.SyncExtraAI();
Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2);
for (int i = 0; i < 20; i++)
Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale;
int totalDustPerCrystalSpawn = 20;
for (int i = 0; i < totalDustPerCrystalSpawn; i++)
{
int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemRuby, 0f, 0f, 100, default, 2f);
Main.dust[rubyDust].velocity *= 2f;
@@ -73,10 +95,44 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
}
SoundEngine.PlaySound(SoundID.Item38, npc.Center);
if (masterMode)
{
for (int i = 0; i < totalDustPerCrystalSpawn; i++)
{
int sapphireDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemSapphire, 0f, 0f, 100, default, 2f);
Main.dust[sapphireDust].velocity *= 2f;
Main.dust[sapphireDust].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[sapphireDust].scale = 0.5f;
Main.dust[sapphireDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < totalDustPerCrystalSpawn; i++)
{
int emeraldDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
Main.dust[emeraldDust].velocity *= 2f;
Main.dust[emeraldDust].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[emeraldDust].scale = 0.5f;
Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
}
SoundEngine.PlaySound(SoundID.Item38, vector);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType<KingSlimeJewel>());
if (masterMode)
{
NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType<KingSlimeJewel2>());
NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType<KingSlimeJewel3>());
}
}
}
// Set up health value for spawning slimes
@@ -154,7 +210,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Get closer to activating teleport
if (npc.ai[2] < teleportGateValue)
{
if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f)
if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > (masterMode ? 160f : 320f))
npc.ai[2] += death ? 3f : 2f;
else
npc.ai[2] += 1f;
@@ -168,7 +224,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
teleporting = true;
npc.aiAction = 1;
float teleportRate = crystalAlive ? 1f : 2f;
if (masterMode)
teleportRate *= 2f;
npc.ai[0] += teleportRate;
teleportScale = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f);
teleportScale = 0.5f + teleportScale * 0.5f;
@@ -199,9 +259,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
for (int i = 0; i < 10; i++)
{
int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f);
int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f);
Main.dust[slimeDust].noGravity = true;
Main.dust[slimeDust].velocity *= 0.5f;
Main.dust[slimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f;
}
}
}
@@ -214,7 +274,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
teleporting = true;
npc.aiAction = 0;
float teleportRate = crystalAlive ? 1f : 2f;
if (masterMode)
teleportRate *= 2f;
npc.ai[0] += teleportRate;
teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f);
teleportScale = 0.5f + teleportScale * 0.5f;
@@ -238,9 +302,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
for (int j = 0; j < 10; j++)
{
int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f);
int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f);
Main.dust[slimyDust].noGravity = true;
Main.dust[slimyDust].velocity *= 2f;
Main.dust[slimyDust].velocity *= blueCrystalAlive ? 0f : 2f;
}
}
@@ -262,7 +326,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (npc.ai[0] >= 0f)
{
// Set damage
npc.damage = npc.defDamage;
npc.damage = setDamage;
npc.netUpdate = true;
npc.TargetClosest();
@@ -280,12 +344,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[1] = 2f;
float bossRushJumpSpeedMult = 1.5f;
float yVelocityMult = 1.2f;
// Jump type
if (npc.ai[1] == 3f)
{
npc.velocity.Y = -13f * speedMult;
npc.velocity.Y = -10f * speedMult;
npc.velocity.X += (phase2 ? (death ? 5.5f : 4.5f) : 3.5f) * npc.direction;
npc.ai[0] = -100f;
npc.ai[1] = 0f;
@@ -308,14 +371,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[1] += 1f;
}
if (masterMode)
if (!greenCrystalAlive)
{
npc.velocity.X *= 1.4f;
npc.velocity.Y *= 1.2f;
npc.velocity.X *= 1.2f;
npc.velocity.Y *= 0.6f;
}
if (!crystalAlive)
npc.velocity.Y *= yVelocityMult;
if (masterMode)
npc.velocity.X *= 1.4f;
if (bossRush)
npc.velocity.X *= bossRushJumpSpeedMult;
@@ -332,9 +395,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
float jumpVelocityLimit = crystalAlive ? 3f : 4.5f;
if (masterMode)
jumpVelocityLimit += 1f;
jumpVelocityLimit += 3f;
if (Main.getGoodWorld)
jumpVelocityLimit = 6f;
jumpVelocityLimit = 8f;
if ((npc.direction == 1 && npc.velocity.X < jumpVelocityLimit) || (npc.direction == -1 && npc.velocity.X > -jumpVelocityLimit))
{
@@ -342,13 +405,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction;
if (masterMode)
npc.velocity.X += 0.2f * npc.direction;
npc.velocity.X += 0.3f * npc.direction;
}
else
{
npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f;
if (masterMode)
npc.velocity.X *= 0.95f;
npc.velocity.X *= 0.9f;
}
}
@@ -363,10 +426,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
}
// Spawn dust
int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f);
int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 255, blueCrystalAlive ? dustColor : new Color(0, 80, 255, 80), npc.scale * 1.2f);
Main.dust[idleSlimeDust].noGravity = true;
Main.dust[idleSlimeDust].velocity *= 0.5f;
Main.dust[idleSlimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f;
if (npc.life <= 0)
return false;
@@ -843,7 +905,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
public static void GetPlaceToTeleportTo(NPC npc)
{
npc.TargetClosest(false);
Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f;
float distanceAhead = 640f;
Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX;
Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead;
Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates();
int randomPredictiveTeleportOffset = 5;
int teleportTries = 0;
@@ -858,7 +922,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
bool canTeleportToTile = true;
if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava)
canTeleportToTile = false;
if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0))
if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0))
canTeleportToTile = false;
if (canTeleportToTile)
@@ -867,7 +931,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.localAI[2] = teleportTileY * 16 + 16;
break;
}
else
predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1;
}
else
predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1;
}
// Default teleport if the above conditions aren't met in 100 iterations
@@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float chargeDeceleration = bossRush ? 0.85f : phase4 ? 0.92f : phase3 ? 0.95f : 0.96f;
// Enrage if target is on the surface
if (!bossRush && (surface || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16)))
if (!bossRush && (surface || Main.player[npc.target].position.Y > Main.UnderworldLayer * 16))
{
enrage = true;
velocity += 8f;
@@ -792,7 +792,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (masterMode && Main.netMode != NetmodeID.MultiplayerClient)
{
float sporeSpeed = Main.masterMode ? 12f : 10f;
float sporeSpeed = 12f;
Vector2 sporeVelocity = projectileVelocity * sporeSpeed;
int spore = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore);
Main.npc[spore].velocity.X = sporeVelocity.X;
@@ -897,7 +897,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
despawn = true;
// Enrage if Plantera's target is on the surface
if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn))
if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > Main.UnderworldLayer * 16) | despawn))
{
npc.localAI[0] -= 4f;
enrage = true;
+109 -13
View File
@@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float lifeRatio = npc.life / (float)npc.lifeMax;
// Bee spawn limit
int beeLimit = 15;
int beeLimit = masterMode ? 9 : 15;
// Queen Bee Bee count
int totalBees = 0;
@@ -85,6 +85,34 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
}
// Hornet spawn limit
int hornetLimit = 3;
bool hornetLimitReached = false;
// Only run this when necessary
if (masterMode)
{
// Queen Bee Hornet count
int totalHornets = 0;
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hornet = Main.npc[i];
bool isQueenBeeHornet = hornet.ai[3] == 1f;
if (hornet.active && (hornet.type == NPCID.LittleHornetHoney || hornet.type == NPCID.HornetHoney || hornet.type == NPCID.BigHornetHoney) && isQueenBeeHornet)
{
int hornetCountIncrement = hornet.type == NPCID.BigHornetHoney ? 3 : hornet.type == NPCID.HornetHoney ? 2 : 1;
totalHornets += hornetCountIncrement;
if (totalHornets >= hornetLimit)
{
hornetLimitReached = true;
break;
}
}
}
}
else
hornetLimitReached = true;
// Phases
// Become more aggressive and start firing double stingers (triple in death mode) phase
@@ -181,7 +209,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
int phase;
int maxRandom = phase4 ? 5 : 4;
do phase = Main.rand.Next(maxRandom);
while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4));
while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (masterMode && phase6 && phase == 3));
bool charging = phase == 0;
@@ -252,7 +280,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (death)
chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio);
if (masterMode)
chargeDistanceY *= 1.5f;
chargeDistanceY *= 2f;
float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X);
float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y);
@@ -292,6 +320,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float chargeAccelerationX = (phase4 ? 0.9f : phase2 ? 0.7f : 0.5f) + 0.5f * enrageScale;
float chargeAccelerationY = (phase4 ? 0.45f : phase2 ? 0.35f : 0.25f) + 0.25f * enrageScale;
if (masterMode)
{
chargeVelocityX += 2f;
chargeVelocityY += 4f;
chargeAccelerationX += 0.15f;
chargeAccelerationY += 0.3f;
}
// Velocity calculations
if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY)
npc.velocity.Y += chargeAccelerationY;
@@ -361,7 +397,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
shouldCharge = true;
}
if (enrageScale > 0f && shouldCharge)
npc.velocity *= MathHelper.Lerp(0.3f, 1f, 1f - enrageScale / maxEnrageScale);
npc.velocity *= MathHelper.Lerp(0.3f, masterMode ? 0.8f : 1f, 1f - enrageScale / maxEnrageScale);
// Keep moving
if (npc.ai[2] != 1f)
@@ -402,8 +438,38 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
else
spawnType = NPCID.Hellbat;
}
else if (masterMode)
{
int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12);
switch (random)
{
default:
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
break;
if (!beeLimitReached)
case 6:
case 7:
case 8:
spawnType = NPCID.LittleHornetHoney;
break;
case 9:
case 10:
spawnType = NPCID.HornetHoney;
break;
case 11:
spawnType = NPCID.BigHornetHoney;
break;
}
}
if (!beeLimitReached || !hornetLimitReached)
{
int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType);
Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY);
@@ -480,8 +546,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (masterMode)
{
beeAttackAccel *= 1.4f;
beeAttackSpeed *= 1.2f;
beeAttackAccel *= 2f;
beeAttackSpeed *= 1.5f;
}
bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height);
@@ -491,7 +557,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Go to bee spawn phase
calamityGlobalNPC.newAI[0] += 1f;
if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= 180f)
if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (masterMode ? 90f : 180f))
{
npc.ai[0] = 1f;
npc.ai[1] = 0f;
@@ -518,8 +584,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (masterMode)
{
beeAttackHoverAccel *= 1.4f;
beeAttackHoverSpeed *= 1.2f;
beeAttackHoverAccel *= 2f;
beeAttackHoverSpeed *= 1.5f;
}
Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f);
@@ -550,7 +616,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
// Spawn bees
if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee && !beeLimitReached)
if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee && (!beeLimitReached || !hornetLimitReached))
{
if (!phase3 || Main.zenithWorld)
SoundEngine.PlaySound(SoundID.NPCHit1, beeSpawnLocation);
@@ -559,7 +625,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (phase3 && !Main.zenithWorld)
if (phase3)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), beeSpawnLocation, (Main.player[npc.target].Center - beeSpawnLocation).SafeNormalize(Vector2.UnitY), ProjectileID.BeeHive, 0, 0f, Main.myPlayer, 0f, 0f, 1f);
}
@@ -573,6 +639,36 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
else
spawnType = NPCID.Hellbat;
}
else if (masterMode)
{
int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12);
switch (random)
{
default:
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
break;
case 6:
case 7:
case 8:
spawnType = NPCID.LittleHornetHoney;
break;
case 9:
case 10:
spawnType = NPCID.HornetHoney;
break;
case 11:
spawnType = NPCID.BigHornetHoney;
break;
}
}
int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType);
Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY);
@@ -601,7 +697,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Go to a random phase
float numSpawns = phase3 ? (masterMode ? 1f : 2f) : (masterMode ? 3f : 5f);
if (npc.ai[2] > numSpawns || beeLimitReached)
if (npc.ai[2] > numSpawns || (beeLimitReached && hornetLimitReached))
{
npc.ai[0] = -1f;
npc.ai[1] = 2f;
@@ -29,11 +29,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float lifeRatio = npc.life / (float)npc.lifeMax;
// Phases
float phase2LifeRatio = 0.85f;
float phase3LifeRatio = 0.7f;
float phase2LifeRatio = masterMode ? 1f : 0.85f;
float phase3LifeRatio = masterMode ? 0.9f : 0.7f;
float respawnHandsLifeRatio = 0.5f;
float phase4LifeRatio = 0.3f;
float phase5LifeRatio = 0.1f;
float phase4LifeRatio = masterMode ? 0.4f : 0.3f;
float phase5LifeRatio = masterMode ? 0.2f : 0.1f;
// Begin firing spreads of skulls phase
bool phase2 = lifeRatio < phase2LifeRatio;
@@ -450,7 +450,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float headYTopSpeed = headYAcceleration * 100f;
float headXAcceleration = (Main.getGoodWorld ? 0.21f : masterMode ? 0.16f : 0.08f) + (death ? 0.08f * (1f - lifeRatio) : 0f);
float headXTopSpeed = headXAcceleration * 100f;
float deceleration = Main.getGoodWorld ? 0.83f : Main.masterMode ? 0.86f : Main.expertMode ? 0.89f : 0.92f;
float deceleration = Main.getGoodWorld ? 0.83f : masterMode ? 0.86f : 0.89f;
if (bossRush)
{
@@ -904,7 +904,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float velocityMultiplier = MathHelper.Lerp(death ? 0.6f : 0.7f, 1f, skeletronLifeRatio);
float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.4f : 0.3f, 1f - skeletronLifeRatio);
float handSwipeVelocity = MathHelper.Lerp(16f, death ? 24f : 20f, 1f - skeletronLifeRatio);
float deceleration = Main.getGoodWorld ? 0.78f : Main.masterMode ? 0.82f : Main.expertMode ? 0.86f : 0.9f;
float deceleration = Main.getGoodWorld ? 0.78f : masterMode ? 0.82f : 0.86f;
float handSwipeDuration = HandSwipeDistance / handSwipeVelocity;
float slapGateValue = HandSlapGateValue;
+1 -1
View File
@@ -1523,7 +1523,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
// Boost speed if too far from target
if (spazmatismFlamethrowerTargetDist > flamethrowerDistance)
spazmatismFlamethrowerMaxSpeed += MathHelper.Lerp(0f, Main.masterMode ? 10f : 6.6f, MathHelper.Clamp((spazmatismFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f));
spazmatismFlamethrowerMaxSpeed += MathHelper.Lerp(0f, masterMode ? 10f : 6.6f, MathHelper.Clamp((spazmatismFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f));
if (Main.getGoodWorld)
{
@@ -3570,6 +3570,12 @@ PrepareToShoot:
if (Main.player[npc.target].position.Y - npc.position.Y < 80f && npc.velocity.Y > 0f)
npc.velocity.Y *= 0.97f;
}
if (npc.ai[3] == 1f)
{
maxVelocity += npc.ai[2] * 1.5f;
acceleration += npc.ai[2] * 0.01f;
}
}
else if (npc.type == NPCID.MossHornet)
{
@@ -3963,7 +3969,7 @@ PrepareToShoot:
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.ai[1] += (npc.type == NPCID.MossHornet ? 2f : 1f);
npc.ai[1] += (npc.type == NPCID.MossHornet ? 2f : 1f) + npc.ai[2];
if (npc.justHit)
npc.ai[1] = 0f;
@@ -3972,6 +3978,7 @@ PrepareToShoot:
if (targetData.Type != 0 && Collision.CanHit(npc, targetData))
{
float projSpeed = (CalamityWorld.death || Main.hardMode) ? 5f : 8f;
projSpeed += npc.ai[2] * ((CalamityWorld.death || Main.hardMode) ? 2f : 4f);
Vector2 projSpawnPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2);
float projTargetXDist = targetData.Center.X - projSpawnPosition.X;
float projTargetYDist = targetData.Center.Y - projSpawnPosition.Y;
@@ -3981,7 +3988,7 @@ PrepareToShoot:
projTargetDistance = projSpeed / projTargetDistance;
projTargetXDist *= projTargetDistance;
projTargetYDist *= projTargetDistance;
int projDamage = (int)(10f * npc.scale);
int projDamage = (int)((npc.ai[3] == 1f ? 15f : 10f) * npc.scale);
if (npc.type == NPCID.MossHornet)
projDamage = (int)(30f * npc.scale);
@@ -7427,7 +7434,7 @@ PrepareToShoot:
if (npc.ai[3] == 0f)
{
npc.position.X += 8f;
if (npc.position.Y / 16f > Main.maxTilesY - 200f)
if (npc.position.Y / 16f > Main.UnderworldLayer)
{
npc.ai[3] = 3f;
}
+55
View File
@@ -0,0 +1,55 @@
using System;
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class ArianeFakeDust : Particle
{
public override string Texture => "CalamityMod/Particles/FakeDust";
public override bool UseAdditiveBlend => true;
public override bool UseCustomDraw => true;
public override bool SetLifetime => true;
private Projectile Projectile;
private Vector2 RelativePosition;
private float Spin;
private float Opacity;
private bool Big;
public ArianeFakeDust(Projectile proj, Vector2 relativePosition, Vector2 velocity, Color color, float scale, int lifeTime, float rotationSpeed = 1f, bool bigSize = false)
{
Projectile = proj;
RelativePosition = relativePosition;
Velocity = velocity;
Color = color;
Scale = scale;
Lifetime = lifeTime;
Rotation = Main.rand.NextFloat(MathHelper.TwoPi);
Spin = rotationSpeed;
Big = bigSize;
Variant = Main.rand.Next(3);
}
public override void Update()
{
if (Projectile != null && Projectile.active && Projectile.type == ModContent.ProjectileType<LiliesOfFinalityAoE>())
Position = Projectile.Center + RelativePosition;
Velocity *= 0.95f;
Scale *= 0.98f;
Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f);
Opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi);
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D dustTexture = Big ? ModContent.Request<Texture2D>("CalamityMod/Particles/FakeDustBig").Value : ModContent.Request<Texture2D>(Texture).Value;
Rectangle frame = new Rectangle(0, (Big ? 8 : 6) * Variant, (Big ? 8 : 6), (Big ? 8 : 6));
spriteBatch.Draw(dustTexture, Position - Main.screenPosition, frame, Color * Opacity, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0);
}
}
}
@@ -0,0 +1,39 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class LiliesOfFinalityHeartParticle : Particle
{
public override string Texture => "CalamityMod/Particles/LiliesOfFinalityHeartParticle";
public override bool UseCustomDraw => true;
public override bool SetLifetime => true;
public LiliesOfFinalityHeartParticle(Vector2 position, Vector2 velocity, int lifeTime, float scale = 1f)
{
Position = position;
Velocity = velocity;
Lifetime = lifeTime;
Scale = scale;
Rotation = velocity.ToRotation() + MathHelper.PiOver2;
Color = Color.White;
}
public override void Update()
{
Velocity *= 0.96f;
Scale *= 0.97f;
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D emoteTexture = ModContent.Request<Texture2D>(Texture).Value;
Vector2 origin = emoteTexture.Size() * 0.5f;
float opacity = 1f - MathF.Pow(LifetimeCompletion, 4f);
spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, null, Color * opacity * 0.7f, Rotation, origin, Scale, SpriteEffects.None, 0);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

@@ -0,0 +1,250 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.Localization;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.BaseProjectiles
{
/// <summary>
/// An abstract class dedicated to ease the making of gun-like holdouts, regarding of the weapon class.<br/>
/// All the AI code goes to <see cref="HoldoutAI"/>.<br/>
/// Sets the texture, localization and SetDefaults automatically.<br/>
/// You also have convenient properties for offsets, arm visuals and the tip of the gun.<br/>
/// <b>You must name your holdout's class the name of the item's class plus "Holdout" at the end</b>, you'll get errors otherwise.
/// </summary>
public abstract class BaseGunHoldoutProjectile : ModProjectile, ILocalizedModType
{
#region Overridable Properties
/// <summary>
/// The ID of the item that this holdout belongs to.
/// </summary>
public abstract int AssociatedItemID { get; }
/// <summary>
/// The position of the gun tip, used for spawning the holdout's shots.<br/>
/// Override if it isn't aligned properly. For example: when the tip is a bit upwards.
/// </summary>
public virtual Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.5f;
/// <summary>
/// How fast <see cref="OffsetLengthFromArm"/> returns back to <see cref="MaxOffsetLengthFromArm"/>.<br/>
/// In consequence, this is how fast the holdout goes back to its position.<br/>
/// Defaults to 0.3f.
/// </summary>
public virtual float RecoilResolveSpeed => 0.3f;
/// <summary>
/// The distance of the holdout to the arm.<br/>
/// Used to properly position the weapon to be held on the player's arms.
/// </summary>
public virtual float MaxOffsetLengthFromArm { get; }
/// <summary>
/// The offset in the X-axis of the holdout when the player's pointing upwards.
/// </summary>
public virtual float OffsetXUpwards { get; }
/// <summary>
/// The offset in the X-axis of the holdout when the player's pointing downwards.
/// </summary>
public virtual float OffsetXDownwards { get; }
/// <summary>
/// The base offset on the Y-axis of the holdout.<br/>
/// Used to align the holdout when pointing horizontally.
/// </summary>
public virtual float BaseOffsetY { get; }
/// <summary>
/// The offset in the Y-axis of the holdout when the player's pointing upwards.
/// </summary>
public virtual float OffsetYUpwards { get; }
/// <summary>
/// The offset in the Y-axis of the holdout when the player's pointing downwards.
/// </summary>
public virtual float OffsetYDownwards { get; }
#endregion
#region Properties
/// <summary>
/// The owner of this holdout.<br/>
/// It's set on <see cref="OnSpawn(IEntitySource)"/>.
/// </summary>
public Player Owner { get; private set; }
/// <summary>
/// The item that the player's holding, correspondent to <see cref="AssociatedItemID"/>.<br/>
/// It's set on <see cref="OnSpawn(IEntitySource)"/>.
/// </summary>
public Item HeldItem { get; private set; }
/// <summary>
/// Whether the holdout will have its <see cref="Projectile.timeLeft"/> set 2 constantly.<br/>
/// Used when you want to keep it alive for a bit longer after it should despawn.<br/>
/// Defaults to <see langword="true"/>.
/// </summary>
public bool KeepRefreshingLifetime { get; set; } = true;
/// <summary>
/// The current offset length from the arm of the holdout.<br/>
/// Used to make recoil effects by setting this to a lower value than <see cref="MaxOffsetLengthFromArm"/>.
/// </summary>
public float OffsetLengthFromArm { get; set; }
/// <summary>
/// Extra rotation added to the front arm if you want to make it be held cooler or more naturally.<br/>
/// Direction is already taken care of, so you don't need to multiply anything.
/// </summary>
public float ExtraFrontArmRotation { get; set; }
/// <summary>
/// Extra rotation added to the back arm if you want to make it be held cooler or more naturally.<br/>
/// Direction is already taken care of, so you don't need to multiply anything.
/// </summary>
public float ExtraBackArmRotation { get; set; }
/// <summary>
/// The visual stretch of the owner's front arm.<br/>
/// Defaults to <see cref="Player.CompositeArmStretchAmount.Full"/>.
/// </summary>
public Player.CompositeArmStretchAmount FrontArmStretch { get; set; } = Player.CompositeArmStretchAmount.Full;
/// <summary>
/// The visual stretch of the owner's back arm.<br/>
/// Defaults to <see cref="Player.CompositeArmStretchAmount.Full"/>.
/// </summary>
public Player.CompositeArmStretchAmount BackArmStretch { get; set; } = Player.CompositeArmStretchAmount.Full;
private Type AssociatedItemType => ItemLoader.GetItem(AssociatedItemID).GetType();
#endregion
#region Overridden Members
// Gets the display name of the associated item.
public override LocalizedText DisplayName => CalamityUtils.GetItemName(AssociatedItemID);
// Gets the texture of the associated item.
public override string Texture => (AssociatedItemType.Namespace + "." + AssociatedItemType.Name).Replace('.', '/');
public override void SetDefaults()
{
Projectile.width = Projectile.height = Request<Texture2D>(Texture).Width();
Projectile.tileCollide = false;
Projectile.netImportant = true;
}
public override void OnSpawn(IEntitySource source)
{
Owner = Main.player[Projectile.owner];
OffsetLengthFromArm = MaxOffsetLengthFromArm;
HeldItem = Owner.ActiveItem();
Projectile.velocity = Owner.Calamity().mouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter);
}
public override bool ShouldUpdatePosition() => false;
public override bool? CanDamage() => false;
#endregion
#region AI
public override void AI()
{
KillHoldoutLogic();
ManageHoldout();
HoldoutAI();
}
/// <summary>
/// Here goes the code for when the holdout needs to despawn.<br/>
/// Defaults to despawning when the owner isn't holding or isn't using the correspondent weapon.
/// </summary>
public virtual void KillHoldoutLogic()
{
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
{
Projectile.netUpdate = true;
Projectile.Kill();
}
}
/// <summary>
/// Does all the needed code for a holdout to work.
/// </summary>
public virtual void ManageHoldout()
{
// The center of the player, taking into account if they have a mount or not.
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
// The vector between the player and the mouse, used for pointing the holdout.
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition;
// The direction this holdout's pointing at.
float holdoutDirection = Projectile.velocity.ToRotation();
// A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively.
// Used for the offsets.
float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY);
int direction = MathF.Sign(ownerToMouse.X);
Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm;
Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards));
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2();
Projectile.rotation = holdoutDirection;
Projectile.spriteDirection = direction;
Owner.ChangeDir(direction);
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = Owner.itemAnimation = 2;
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
// -Pi/2 because the arms rotation starts with arms pointing down.
float armRotation = Projectile.rotation - MathHelper.PiOver2;
Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * direction);
Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * direction);
if (KeepRefreshingLifetime)
Projectile.timeLeft = 2;
if (OffsetLengthFromArm != MaxOffsetLengthFromArm)
OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed);
}
/// <summary>
/// Where all the actual AI goes to.
/// </summary>
public abstract void HoldoutAI();
#endregion
#region Drawing
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite);
return false;
}
#endregion
}
}
@@ -224,14 +224,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
Owner = Main.player[Projectile.owner];
ModdedOwner = Owner.Calamity();
Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses);
Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || (CalamityPlayer.areThereAnyDamnBosses && !Grounded));
// When minions are grounded, they are affected by tiles, meaning they have a much limited movement.
// Pre-Hardmode minions are affected the most since they can't see through walls.
// In consequence, some targets that may seem valid, aren't detected due to this.
// If the minion hasn't detected any targets with the center being the player, we give them a second chance with the center being the minion itself.
// If there are bosses on the world, we don't do this check because if there wasn't any targets with tile X-Ray, this won't do anything.
if (Grounded && Target is null && PreHardmodeMinionTileVision && !CalamityPlayer.areThereAnyDamnBosses)
if (Grounded && Target is null && PreHardmodeMinionTileVision)
Target = Projectile.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, false);
}
@@ -300,74 +300,13 @@ namespace CalamityMod.Projectiles.BaseProjectiles
public bool IsTileBetweenTargetAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, Projectile.Center, platformCheckDownwards);
/// <summary>
/// Checks if the minion has a tile in front of him, at their left or right.
/// </summary>
/// <param name="leftFluff">The extra distance it'll check at the left, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0.</param>
/// <param name="rightFluff">The extra distance it'll check at the right, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0.</param>
/// <returns><see langword="true"/> if there's a tile at the left or right, otherwise <see langword="false"/></returns>
public bool IsMinionFacingTile(int leftFluff = 0, int rightFluff = 0)
public bool IsMinionFacingTile()
{
Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft);
Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
for (int coordY = topLeft.Y; coordY < bottomLeft.Y; coordY++)
{
if (Main.tile[topLeft.X - leftFluff, coordY].IsTileSolid())
return true;
}
Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight);
Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordY = topRight.Y; coordY <= bottomRight.Y; coordY++)
{
if (Main.tile[topRight.X + rightFluff, coordY].IsTileSolid())
return true;
}
return false;
}
/// <summary>
/// Checks whether the minion is standing on a tile or not.
/// </summary>
/// <returns><see langword="true"/> if the minion's standing on a tile, otherwise <see langword="false"/></returns>
public bool IsMinionStandingOnTile()
{
Point minionPointLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
Point minionPointRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordX = minionPointLeft.X; coordX <= minionPointRight.X; coordX++)
{
if (Main.tile[coordX, minionPointLeft.Y].IsTileSolidGround())
return true;
}
return false;
}
/// <summary>
/// Checks whether the minion is inside a tile or not.<br/>
/// It checks if there's tiles in the diagonals of the minion's hitbox.
/// </summary>
/// <returns><see langword="true"/> if there's a tile inside the minion, otherwise <see langword="false"/></returns>
public bool IsMinionInsideTile()
{
Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft);
Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordX = topLeft.X; coordX <= bottomRight.X; coordX++)
{
if (Main.tile[coordX, (int)Utils.Remap(coordX, topLeft.X, bottomRight.X, topLeft.Y, bottomRight.Y)].IsTileSolid())
return true;
}
Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight);
Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
for (int coordX = bottomLeft.X; coordX >= topRight.X; coordX--)
{
if (Main.tile[coordX, (int)Utils.Remap(coordX, bottomLeft.X, topRight.X, bottomLeft.Y, bottomRight.Y)].IsTileSolid())
return true;
}
return false;
Rectangle inflatedMinionHitbox = Projectile.getRect();
inflatedMinionHitbox.Inflate(1, 0);
bool stuckOnLeftTile = Main.tile[new Vector2(inflatedMinionHitbox.X, inflatedMinionHitbox.Y + inflatedMinionHitbox.Height - 17).ToSafeTileCoordinates()].IsTileSolid();
bool stuckOnRightTile = Main.tile[new Vector2(inflatedMinionHitbox.X + inflatedMinionHitbox.Width, inflatedMinionHitbox.Y + inflatedMinionHitbox.Height - 17).ToSafeTileCoordinates()].IsTileSolid();
return stuckOnLeftTile || stuckOnRightTile;
}
#endregion
+35
View File
@@ -10,6 +10,7 @@ using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.NPCs;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Melee;
@@ -4507,6 +4508,40 @@ namespace CalamityMod.Projectiles
for (int i = 0; i < availableAmountOfNPCsToSpawnUpToSlot; i++)
{
int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1);
if (Main.zenithWorld)
{
beeType = Main.rand.NextBool(3) ? ModContent.NPCType<PlagueChargerLarge>() : ModContent.NPCType<PlagueCharger>();
}
else if (Main.masterMode || BossRushEvent.BossRushActive)
{
switch (Main.rand.Next(12))
{
default:
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
break;
case 6:
case 7:
case 8:
beeType = NPCID.LittleHornetHoney;
break;
case 9:
case 10:
beeType = NPCID.HornetHoney;
break;
case 11:
beeType = NPCID.BigHornetHoney;
break;
}
}
int beeSpawn = NPC.NewNPC(projectile.GetSource_FromThis(), (int)projectile.Center.X, (int)projectile.Center.Y, beeType, 1);
Main.npc[beeSpawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f;
Main.npc[beeSpawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f;
@@ -16,6 +16,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
private SlotId gatlingLaserLoopID;
private bool fireLasers = false;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 24;
@@ -29,6 +34,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter >= 13)
{
Projectile.frameCounter = 10;
Projectile.frame++;
if (Projectile.frame >= Main.projFrames[Projectile.type])
Projectile.frame = 0;
}
if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out var ShootingSound) && ShootingSound.IsPlaying)
ShootingSound.Position = Projectile.Center;
Player player = Main.player[Projectile.owner];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
Time++;
Lighting.AddLight(Projectile.Center, 0.2f, 0f, 0f);
if (Projectile.timeLeft % 11 == 0 && Time > 12 && Time < 460)
if (Projectile.timeLeft % 11 == 0 && Time > 15 && Time < 460)
{
SparkParticle spark = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 1.7f, Color.Red);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.timeLeft % 4 == 0 && Time > 12 && Time < 460)
if (Projectile.timeLeft % 4 == 0 && Time > 15 && Time < 460)
{
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 0.4f, Color.White);
GeneralParticleHandler.SpawnParticle(spark2);
+2
View File
@@ -17,6 +17,8 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
+2
View File
@@ -32,6 +32,8 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.penetrate = 5;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.extraUpdates = 1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
@@ -0,0 +1,69 @@
using CalamityMod.Graphics.Primitives;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfEternityBullet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
{
public new string LocalizationCategory => "Projectiles.Summon";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
ProjectileID.Sets.MinionShot[Type] = true;
ProjectileID.Sets.TrailingMode[Type] = 2;
ProjectileID.Sets.TrailCacheLength[Type] = 8;
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Summon;
Projectile.width = Projectile.height = 16;
Projectile.timeLeft = 300;
Projectile.penetrate = -1;
Projectile.localNPCHitCooldown = -1;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
}
public override void AI()
{
if (Main.dedServ)
return;
Dust trailDust = Dust.NewDustPerfect(
Projectile.Center + Main.rand.NextVector2Circular(8f, 8f),
64,
Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f),
Scale: Main.rand.NextFloat(1f, 1.2f));
trailDust.noGravity = true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.velocity = Vector2.Zero;
Projectile.timeLeft = 10;
}
private float PrimitiveWidthFunction(float completionRatio)
{
float trailPoint = 0.1f;
return completionRatio > trailPoint ? Utils.Remap(completionRatio, trailPoint, 1f, 12f, 0f) : Utils.Remap(completionRatio, trailPoint, 0f, 12f, 0f);
}
private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio);
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch)
{
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]));
}
}
}
+107
View File
@@ -0,0 +1,107 @@
using System;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfFinalityAoE : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private ref float ArianeID => ref Projectile.ai[0];
private ref float Timer => ref Projectile.ai[1];
private Projectile Ariane;
private const int TimeToFullScale = 120;
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Summon;
Projectile.width = Projectile.height = Ariane_AoESize;
Projectile.localNPCHitCooldown = 30;
Projectile.penetrate = -1;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
Projectile.netImportant = true;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / 2f, targetHitbox);
public override void AI()
{
if (Ariane != null && Ariane.active && Ariane.owner == Projectile.owner && Ariane.type == ModContent.ProjectileType<LiliesOfFinalityAriane>() && Ariane.ModProjectile<LiliesOfFinalityAriane>().State == LiliesOfFinalityAriane.AIState.Attack)
Projectile.timeLeft = 2;
Projectile.Center = Ariane.Center;
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (!Main.dedServ)
{
float currentScale = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, Projectile.width / 2f);
int circleDustAmount = (int)Utils.Remap(Timer, 0f, TimeToFullScale, 5f, 40f) + Main.rand.Next(20);
for (int i = 0; i < circleDustAmount; i++)
{
if (Main.rand.NextBool(20))
{
float angle = MathHelper.TwoPi / circleDustAmount * i;
Vector2 position = angle.ToRotationVector2() * (currentScale + Main.rand.NextFloat(10f));
Particle fakeDust = new ArianeFakeDust(
Projectile,
position + Main.rand.NextVector2Circular(15f, 15f),
Vector2.Zero,
Color.Red,
Main.rand.NextFloat(1.5f, 2.5f),
120);
GeneralParticleHandler.SpawnParticle(fakeDust);
}
}
int eyeDustAmount = (int)Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 20f);
for (int i = 0; i < eyeDustAmount; i++)
{
if (Main.rand.NextBool(15))
{
float interpolator = Main.rand.NextFloat();
float maxOffsetX = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 450f);
float maxOffsetY = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 200f);
Vector2 xPosition = Vector2.UnitX * MathHelper.Lerp(-maxOffsetX, maxOffsetX, interpolator);
Vector2 yPosition = Vector2.UnitY * MathHelper.Lerp(0f, maxOffsetY, MathF.Pow(CalamityUtils.Convert01To010(interpolator), 0.7f)) * Main.rand.NextBool().ToDirectionInt();
Particle fakeDust = new ArianeFakeDust(
Projectile,
xPosition + yPosition + Main.rand.NextVector2Circular(15f, 15f),
Vector2.Zero,
Color.Crimson * 0.8f,
Main.rand.NextFloat(2f, 2.5f),
120);
GeneralParticleHandler.SpawnParticle(fakeDust);
}
}
Dust insideDust = Dust.NewDustPerfect(
Projectile.Center + Main.rand.NextVector2Circular(currentScale, currentScale),
CommonDustID,
Main.rand.NextVector2Circular(3f, 3f),
Scale: Main.rand.NextFloat(0.8f, 1.2f));
insideDust.noGravity = true;
}
Timer++;
}
public override void OnSpawn(IEntitySource source) => Ariane = Main.projectile[(int)ArianeID];
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= Ariane_AoEDMGMultiplier;
}
}
@@ -0,0 +1,381 @@
using System.IO;
using CalamityMod.Buffs.Summon;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using static System.MathF;
using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfFinalityAriane : BaseMinionProjectile
{
#region Members
public enum AIState { Idle, ReturnToOwner, Attack }
public AIState State
{
get => (AIState)Projectile.ai[0];
set
{
Projectile.ai[0] = (float)value;
// The minion'll be able to walk on tiles when they're not in a flying state.
Projectile.tileCollide = value == AIState.Idle;
// Because some states mess with the rotation, we reset it so it doesn't cause visual issues on the states that don't deal with rotation.
Projectile.rotation = 0f;
// When the minion goes into its attack state, it spawns a lingering AoE.
if (value == AIState.Attack && Main.myPlayer == Projectile.owner)
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileType<LiliesOfFinalityAoE>(), Projectile.damage, 0f, Projectile.owner, Projectile.whoAmI);
Timer = 0f;
NetUpdate();
}
}
public enum AnimationState { Still, Walk, Fly }
public AnimationState Animation
{
get => (AnimationState)Projectile.ai[1];
set
{
Projectile.ai[1] = (float)value;
switch (value)
{
case AnimationState.Still:
Projectile.width = 32;
FrameAmount = 1;
break;
case AnimationState.Walk:
Projectile.width = 32;
FrameAmount = 9;
break;
case AnimationState.Fly:
Projectile.width = 56;
FrameAmount = 8;
break;
}
// If the animation state is being set to the same thing every frame, don't reset the animation.
// Or if the current frame of animation is outside the amount of frames that the next animation will have, reset it.
if (Animation != value || Projectile.frame + 1 > FrameAmount)
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
}
}
}
private ref float Timer => ref Projectile.ai[2];
/// <summary>
/// The amount of animation frames there is in the current animation.
/// </summary>
private int FrameAmount = 1;
private Projectile Elster;
#endregion
#region Overridden Members
public override int AssociatedProjectileTypeID => ProjectileType<LiliesOfFinalityAriane>();
public override int AssociatedBuffTypeID => BuffType<LiliesOfFinalityBuff>();
public override ref bool AssociatedMinionBool => ref ModdedOwner.LiliesOfFinalityBool;
public override float EnemyDistanceDetection => MaxEnemyDistanceDetection;
public override int AnimationFrames => 18;
public override bool Grounded => true;
public override void SetDefaults()
{
Projectile.width = 32;
Projectile.height = 66;
base.SetDefaults();
}
public override void CheckMinionExistence()
{
Projectile.timeLeft = 2;
if (Elster is null || !Elster.active || Elster.owner != Projectile.owner || Elster.type != ProjectileType<LiliesOfFinalityElster>())
Projectile.Kill();
}
public override void OnSpawn(IEntitySource source)
{
for (int i = 0; i < Main.maxProjectiles; i++)
{
Projectile p = Main.projectile[i];
if (p == null || !p.active || p.owner != Projectile.owner || p.type != ProjectileType<LiliesOfFinalityElster>())
continue;
Elster = p;
break;
}
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
// If the projectile's above the player, it can fall through platforms to reach the player.
if (State == AIState.Idle)
fallThrough = Projectile.Bottom.Y < Owner.Top.Y;
return true;
}
public override bool? CanDamage() => false;
#endregion
#region AI
public override void MinionAI()
{
switch (State)
{
case AIState.Idle:
IdleState();
break;
case AIState.ReturnToOwner:
ReturnToOwnerState();
break;
case AIState.Attack:
AttackState();
break;
}
Timer++;
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
if (Elster.ModProjectile<LiliesOfFinalityElster>().State == LiliesOfFinalityElster.AIState.ReturnToOwner || Elster.ModProjectile<LiliesOfFinalityElster>().State == LiliesOfFinalityElster.AIState.AttackFlying)
{
Dust connectionArianeElster = Dust.NewDustPerfect(
Vector2.Lerp(Projectile.Center, Elster.Center, Main.rand.NextFloat()) + Main.rand.NextVector2Circular(5f, 5f),
CommonDustID,
Vector2.Zero,
Scale: Main.rand.NextFloat(0.8f, 1f));
connectionArianeElster.noGravity = true;
}
}
private void IdleState()
{
if (Timer > 15f)
{
if (Target is not null)
{
State = AIState.Attack;
return;
}
if (IsTileBetweenOwnerAndMinionVertically() || !Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) || !Projectile.WithinRange(Owner.Center, 960f))
{
State = AIState.ReturnToOwner;
return;
}
if (!Projectile.getRect().Intersects(Elster.getRect()))
{
int walkDirection = Sign(Elster.Center.X - Projectile.Center.X);
float maxSpeed = Utils.Remap(Abs(Elster.Center.X - Projectile.Center.X), 160f, 0f, 6f, 0f);
Projectile.velocity.X += 0.08f * walkDirection;
if (Abs(Projectile.velocity.X) > maxSpeed)
Projectile.velocity.X = maxSpeed * walkDirection;
}
else
{
Projectile.velocity.X *= 0.8f;
Projectile.spriteDirection = Sign(Elster.Center.X - Projectile.Center.X);
Elster.spriteDirection = Sign(Projectile.Center.X - Elster.Center.X);
if (!Main.dedServ && Main.rand.NextBool(100))
{
Vector2 emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 0.7f);
Particle heart = new LiliesOfFinalityHeartParticle((Main.rand.NextBool() ? Projectile.Center : Elster.Center) + emoteDirection * 15f, emoteDirection * Main.rand.NextFloat(1f, 2f), Main.rand.Next(30, 45), Main.rand.NextFloat(0.6f, 1f));
GeneralParticleHandler.SpawnParticle(heart);
}
}
}
DoGravity();
Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY);
Projectile.spriteDirection = Sign(Projectile.velocity.X);
Animation = Abs(Projectile.velocity.X) < 0.04f || IsMinionFacingTile() ? AnimationState.Still : AnimationState.Walk;
}
private void ReturnToOwnerState()
{
if (Target is not null)
{
State = AIState.Attack;
return;
}
if (!IsTileBetweenOwnerAndMinionVertically() && Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) && Projectile.WithinRange(Owner.Center, 960f))
{
State = AIState.Idle;
Projectile.velocity.Y = 5f * Sign(Projectile.velocity.Y);
return;
}
FlyTowardsPlace(Owner.velocity.Length() + 6f, Owner.Center, Sign(Projectile.velocity.X));
Animation = AnimationState.Fly;
}
private void AttackState()
{
if (Target is not null)
{
Vector2 targetSpot = Elster.Center + new Vector2(-100f * Projectile.spriteDirection, -60f);
if (!Projectile.WithinRange(targetSpot, 8f))
FlyTowardsPlace(Ariane_TargettingFlySpeed, targetSpot, Sign(Target.Center.X - Projectile.Center.X));
else
Projectile.velocity *= 0.8f;
if (Timer >= Ariane_BoltFireRate)
ShootBolt();
Animation = AnimationState.Fly;
}
else
State = AIState.Idle;
}
private void ShootBolt()
{
if (Main.myPlayer != Projectile.owner)
return;
Vector2 shootDirection = Projectile.SafeDirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver4);
Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
Projectile.Center,
shootDirection * Ariane_BoltProjectileSpeed,
ProjectileType<LiliesOfFinalityBolt>(),
Projectile.damage,
Projectile.knockBack,
Projectile.owner);
Timer = 0f;
NetUpdate();
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
Vector2 visualBoltSpawn = Projectile.Center + shootDirection * Projectile.Size.Length() / 2f;
for (int i = 0; i < 10; i++)
{
Dust shootDust = Dust.NewDustPerfect(
visualBoltSpawn + (Vector2.UnitY * MathHelper.Lerp(-8f, 8f, Main.rand.NextFloat())).RotatedBy(visualBoltSpawn.ToRotation()),
CommonDustID,
shootDirection * Main.rand.NextFloat(3f, 6f),
Scale: Main.rand.NextFloat(0.6f, 0.8f));
shootDust.noGravity = true;
}
Particle outerRing = new DirectionalPulseRing(
visualBoltSpawn,
Vector2.Zero,
Color.Red,
new Vector2(0.4f, 1f),
shootDirection.ToRotation(),
0.05f,
0.3f,
20);
Particle innerRing = new DirectionalPulseRing(
visualBoltSpawn,
Vector2.Zero,
Color.Fuchsia,
new Vector2(0.5f, 1f),
shootDirection.ToRotation(),
0.05f,
0.15f,
20);
GeneralParticleHandler.SpawnParticle(outerRing);
GeneralParticleHandler.SpawnParticle(innerRing);
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound") { Pitch = 0.4f }, Projectile.Center);
}
private void FlyTowardsPlace(float speed, Vector2 place, int spriteDirection)
{
Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(place) * speed) / 21f;
Projectile.spriteDirection = spriteDirection;
}
private void NetUpdate()
{
Projectile.netUpdate = true;
if (Projectile.netSpam >= 10)
Projectile.netSpam = 9;
}
#endregion
#region Syncing
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(FrameAmount);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
FrameAmount = reader.ReadInt32();
}
#endregion
#region Drawing & Animation
public override void DoAnimation()
{
if (Animation == AnimationState.Still)
return;
FramesUntilNextAnimationFrame = Animation == AnimationState.Walk ? (int)Utils.Remap(Abs(Projectile.velocity.X), 0f, 6f, 8f, 4f) : 5;
Projectile.frameCounter++;
if (Projectile.frameCounter >= FramesUntilNextAnimationFrame)
{
Projectile.frameCounter = 0;
Projectile.frame = (Projectile.frame + 1) % FrameAmount;
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Texture2D glowTexture = Request<Texture2D>(GlowTexture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = texture.Frame(3, 9, (int)Animation, Projectile.frame);
Vector2 origin = frame.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, flipSprite);
Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, flipSprite);
return false;
}
#endregion
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

+134
View File
@@ -0,0 +1,134 @@
using System;
using CalamityMod.Graphics.Primitives;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfFinalityBolt : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private ref float RandomColorOffset => ref Projectile.localAI[0];
private const int TimeBeforeHoming = 10;
private const int TimeDying = 15;
private SlotId LoopingSound;
public override void SetStaticDefaults()
{
ProjectileID.Sets.MinionShot[Type] = true;
ProjectileID.Sets.TrailingMode[Type] = 2;
ProjectileID.Sets.TrailCacheLength[Type] = 6;
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Summon;
Projectile.width = Projectile.height = 16;
Projectile.timeLeft = TimeBeforeHoming + Ariane_BoltTimeHoming + TimeDying;
Projectile.localNPCHitCooldown = -1;
Projectile.penetrate = -1;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
}
public override void AI()
{
NPC target = Projectile.Center.MinionHoming(MaxEnemyDistanceDetection, Main.player[Projectile.owner]);
if (target is not null && Projectile.timeLeft > TimeDying && Projectile.timeLeft < Ariane_BoltTimeHoming)
{
float turnRate = Utils.Remap(Projectile.timeLeft, Ariane_BoltTimeHoming, TimeDying, Ariane_MinTurnRate, Ariane_MaxTurnRate);
Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(target.Center).ToRotation(), turnRate).ToRotationVector2() * Ariane_BoltProjectileSpeed;
}
// When the projectile's abut to die, it'll stop in place and spawn some dust to cover the shader suddenly cutting off.
if (Projectile.timeLeft < TimeDying - 1)
{
Projectile.velocity = Vector2.Zero;
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (!Main.dedServ)
{
for (int i = 0; i < 2; i++)
{
Dust fadingDust = Dust.NewDustDirect(
Projectile.position,
Projectile.width,
Projectile.height,
CommonDustID,
Scale: Main.rand.NextFloat(0.8f, 1.2f));
fadingDust.noGravity = true;
}
}
}
Projectile.rotation = Projectile.velocity.ToRotation();
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
if (Main.rand.NextBool())
{
Dust trailDust = Dust.NewDustPerfect(
Projectile.Center + Main.rand.NextVector2Circular(10f, 10f),
CommonDustID,
Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f),
Scale: Main.rand.NextFloat(0.4f, 0.6f));
trailDust.noGravity = true;
}
if (SoundEngine.TryGetActiveSound(LoopingSound, out var sound) && sound.IsPlaying)
sound.Position = Projectile.Center;
}
public override void OnSpawn(IEntitySource source)
{
// Since we don't want all the projectiles on screen to cycle through the same colors at the same time, we set an initial offset to the color.
RandomColorOffset = Main.rand.NextFloat(100f);
LoopingSound = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ArianeShot") with { Volume = 0.2f }, Projectile.Center);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
// Since we don't want the trail to instantly disappear on hit, we'll make reduce its time alive to near death.
Projectile.timeLeft = TimeDying;
SoundEngine.PlaySound(SoundID.Item70 with { Volume = 0.5f, Pitch = 0.4f }, Projectile.Center);
if (SoundEngine.TryGetActiveSound(LoopingSound, out var sound))
sound.Stop();
}
private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, 32f, MathF.Pow(completionRatio, 1f / 2.5f));
private Color ColorFunction(float completionRatio)
{
float offsetTime = Main.GlobalTimeWrappedHourly + RandomColorOffset;
float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-offsetTime * 3f) * 0.5f + 0.5f);
float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity;
Color endColor = Color.Lerp(Color.Fuchsia, Color.Red, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f);
return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity;
}
public override bool PreDraw(ref Color lightColor)
{
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
return false;
}
}
}
@@ -0,0 +1,73 @@
using CalamityMod.Graphics.Primitives;
using CalamityMod.Items.Weapons.Summon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfFinalityBullet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
{
public new string LocalizationCategory => "Projectiles.Summon";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
ProjectileID.Sets.MinionShot[Type] = true;
ProjectileID.Sets.TrailingMode[Type] = 2;
ProjectileID.Sets.TrailCacheLength[Type] = 8;
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Summon;
Projectile.width = Projectile.height = 16;
Projectile.timeLeft = 300;
Projectile.localNPCHitCooldown = -1;
Projectile.penetrate = -1;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.MaxUpdates = LiliesOfFinality.Elster_BulletMaxUpdates;
Projectile.usesLocalNPCImmunity = true;
}
public override void AI()
{
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
Dust trailDust = Dust.NewDustPerfect(
Projectile.Center + Main.rand.NextVector2Circular(8f, 8f),
64,
Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f),
Scale: Main.rand.NextFloat(1f, 1.2f));
trailDust.noGravity = true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
// Since we don't want the trail to instantly disappear on hit, we'll make it stop and reduce its time alive to near death.
Projectile.velocity = Vector2.Zero;
Projectile.timeLeft = 10;
}
private float PrimitiveWidthFunction(float completionRatio)
{
float trailPoint = 0.1f;
return completionRatio > trailPoint ? Utils.Remap(completionRatio, trailPoint, 1f, 16f, 0f) : Utils.Remap(completionRatio, trailPoint, 0f, 16f, 0f);
}
private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio);
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch)
{
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]));
}
}
}
@@ -0,0 +1,400 @@
using System.IO;
using CalamityMod.Buffs.Summon;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using static System.MathF;
using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Summon
{
public class LiliesOfFinalityElster : BaseMinionProjectile
{
#region Members
public enum AIState { Idle, ReturnToOwner, AttackOnGround, AttackFlying }
public AIState State
{
get => (AIState)Projectile.ai[0];
set
{
Projectile.ai[0] = (float)value;
// Just in case it doesn't reset properly.
HasShotOnce = false;
// The minion'll be able to walk on tiles when they're not in a flying state.
Projectile.tileCollide = value == AIState.Idle || value == AIState.AttackOnGround;
// Because some states mess with the rotation, we reset it so it doesn't cause visual issues on the states that don't deal with rotation.
Projectile.rotation = 0f;
NetUpdate();
}
}
public enum AnimationState { Still, Walk, Fly, Shoot, FlyShoot }
public AnimationState Animation
{
get => (AnimationState)Projectile.ai[1];
set
{
Projectile.ai[1] = (float)value;
switch (value)
{
case AnimationState.Still:
Projectile.width = 32;
Projectile.frame = 0;
FrameAmount = 1;
break;
case AnimationState.Walk:
Projectile.width = 32;
FrameAmount = 9;
break;
case AnimationState.Fly:
Projectile.width = 36;
FrameAmount = 4;
break;
case AnimationState.Shoot:
case AnimationState.FlyShoot:
Projectile.width = 56;
FrameAmount = 7;
break;
}
// If the animation state is being set to the same thing every frame, don't reset the animation.
// Or if the current frame of animation is outside the amount of frames that the next animation will have, reset it.
if (Animation != value || Projectile.frame + 1 > FrameAmount)
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
}
}
}
private ref float Timer => ref Projectile.ai[2];
/// <summary>
/// Because the fire rate is animation frame dependent, it can stay on the same animation for multiple ticks.<br/>
/// We use this bool to only fire once in that span of time.
/// </summary>
private bool HasShotOnce;
/// <summary>
/// The amount of animation frames there is in the current animation.
/// </summary>
private int FrameAmount = 1;
#endregion
#region Overridden Members
public override int AssociatedProjectileTypeID => ProjectileType<LiliesOfFinalityElster>();
public override int AssociatedBuffTypeID => BuffType<LiliesOfFinalityBuff>();
public override ref bool AssociatedMinionBool => ref ModdedOwner.LiliesOfFinalityBool;
public override float EnemyDistanceDetection => MaxEnemyDistanceDetection;
public override int AnimationFrames => 28;
public override bool Grounded => true;
public override void SetDefaults()
{
Projectile.width = 32;
Projectile.height = 56;
base.SetDefaults();
}
public override void CheckMinionExistence()
{
base.CheckMinionExistence();
if (Timer > 10f && Main.player[Projectile.owner].ownedProjectileCounts[ProjectileType<LiliesOfFinalityAriane>()] == 0)
Projectile.Kill();
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
// If the projectile's above the player, it can fall through platforms to reach the player.
if (State == AIState.Idle)
fallThrough = Projectile.Bottom.Y < Owner.Top.Y;
return true;
}
public override bool? CanDamage() => false;
#endregion
#region AI
public override void MinionAI()
{
switch (State)
{
case AIState.Idle:
IdleState();
break;
case AIState.ReturnToOwner:
ReturnToOwnerState();
break;
case AIState.AttackOnGround:
AttackOnGroundState();
break;
case AIState.AttackFlying:
AttackFlyingState();
break;
}
Timer++;
}
private void IdleState()
{
if (Timer > 15f)
{
if (Target is not null)
{
State = AIState.AttackOnGround;
return;
}
if (IsTileBetweenOwnerAndMinionVertically() || !Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) || !Projectile.WithinRange(Owner.Center, 960f))
{
State = AIState.ReturnToOwner;
return;
}
Vector2 idlePosition = Owner.Center - Vector2.UnitX * 60f * Owner.direction;
if (!Projectile.WithinRange(idlePosition, 8f))
{
int walkDirection = Sign(idlePosition.X - Projectile.Center.X);
float maxSpeed = Utils.Remap(Abs(idlePosition.X - Projectile.Center.X), 160f, 0f, 6f, 0f);
Projectile.velocity.X += 0.08f * walkDirection;
if (Abs(Projectile.velocity.X) > maxSpeed)
Projectile.velocity.X = maxSpeed * walkDirection;
}
else
Projectile.velocity.X = 0f;
}
DoGravity();
Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY);
Projectile.spriteDirection = Sign(Projectile.velocity.X);
Animation = Abs(Projectile.velocity.X) < 0.04f || IsMinionFacingTile() ? AnimationState.Still : AnimationState.Walk;
}
private void ReturnToOwnerState()
{
if (Target is not null)
{
State = AIState.AttackOnGround;
return;
}
if (!IsTileBetweenOwnerAndMinionVertically() && Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) && Projectile.WithinRange(Owner.Center, 960f))
{
State = AIState.Idle;
// Does a little hop to confirm the minion reaches the desired height.
Projectile.velocity.Y = 5f * Sign(Projectile.velocity.Y);
return;
}
FlyTowardsPlace(Owner.velocity.Length() + 6f, Owner.Center, Sign(Projectile.velocity.X), AnimationState.Fly);
Projectile.rotation = MathHelper.ToRadians(Projectile.velocity.Length()) * Sign(Projectile.velocity.X);
ElevationDust(false);
}
private void AttackOnGroundState()
{
if (Target is not null)
{
if (Projectile.Center.Y > Target.Bottom.Y || Projectile.Center.Y < Target.Top.Y)
{
State = AIState.AttackFlying;
return;
}
// If the frame of the animation is the shooting one (and hasn't shot once yet): shoot.
if (Projectile.frame == 2 && !HasShotOnce)
ShootBullet();
// Reset the bool for the next shot.
if (Projectile.frame != 2 && HasShotOnce)
HasShotOnce = false;
DoGravity();
Projectile.velocity.X = 0f;
Projectile.spriteDirection = Sign(Target.Center.X - Projectile.Center.X);
Animation = AnimationState.Shoot;
}
else
State = AIState.Idle;
}
private void AttackFlyingState()
{
if (Target is not null)
{
Vector2 targetSpot = Target.Center - Vector2.UnitX * (Elster_DistanceFromTarget + Target.width / 2f) * Sign(Target.Center.X - Projectile.Center.X);
if (!Projectile.WithinRange(targetSpot, 5f))
FlyTowardsPlace(Elster_TargettingFlySpeed, targetSpot, Sign(Target.Center.X - Projectile.Center.X), AnimationState.FlyShoot);
else
Projectile.velocity *= 0.8f;
// If the frame of the animation is the shooting one (and hasn't shot once yet): shoot.
if (Projectile.frame == 2 && !HasShotOnce)
ShootBullet();
// Reset the bool for the next shot.
if (Projectile.frame != 2 && HasShotOnce)
HasShotOnce = false;
ElevationDust(true);
}
else
State = AIState.Idle;
}
private void FlyTowardsPlace(float speed, Vector2 place, int spriteDirection, AnimationState spriteAnimation)
{
Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(place) * speed) / 21f;
Projectile.spriteDirection = spriteDirection;
Animation = spriteAnimation;
}
private void ShootBullet()
{
if (Main.myPlayer != Projectile.owner)
return;
Vector2 bulletSpawnPosition = Projectile.Center - Vector2.UnitX * 15f * Projectile.spriteDirection;
Vector2 bulletVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(bulletSpawnPosition, Target, Elster_BulletProjectileSpeed, Elster_BulletMaxUpdates);
Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
bulletSpawnPosition,
//Vector2.UnitX * Elster_BulletProjectileSpeed * Projectile.spriteDirection,
bulletVelocity,
ProjectileType<LiliesOfFinalityBullet>(),
(int)(Projectile.damage * 1.2f),
Projectile.knockBack,
Projectile.owner);
HasShotOnce = true;
NetUpdate();
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
Particle shootRing = new DirectionalPulseRing(
Projectile.Center + Vector2.UnitX * Projectile.width / 2f * Projectile.spriteDirection,
Vector2.Zero,
Color.Goldenrod,
new Vector2(0.5f, 1f),
0f,
0.05f,
0.25f,
7);
GeneralParticleHandler.SpawnParticle(shootRing);
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/ElsterShot", 4) { Volume = 0.3f }, Projectile.Center);
}
private void ElevationDust(bool shootingState)
{
// If on a dedicated server, don't bother running the visuals and sounds to save resources.
if (Main.dedServ)
return;
Vector2 leftLeg = shootingState ? Projectile.BottomLeft + Vector2.UnitX * (Projectile.spriteDirection == -1 ? 28f : 10f) : Projectile.BottomLeft;
Vector2 rightLeg = shootingState ? Projectile.BottomRight - Vector2.UnitX * (Projectile.spriteDirection == -1 ? 10f : 28f) : Projectile.BottomRight;
if (Main.rand.NextBool())
{
float interpolant = Main.rand.NextFloat();
Dust elevationDust = Dust.NewDustPerfect(
Vector2.Lerp(leftLeg, rightLeg, interpolant),
CommonDustID,
Vector2.UnitY.RotatedByRandom(MathHelper.Lerp(-MathHelper.ToRadians(15f), MathHelper.ToRadians(15f), interpolant) * Main.rand.NextFloat(8f, 12f)),
Scale: Main.rand.NextFloat(1f, 1.2f));
elevationDust.noGravity = true;
}
if (Main.rand.NextBool(4))
{
float interpolant = Main.rand.NextFloat();
Dust elevationDust = Dust.NewDustPerfect(
Vector2.Lerp(leftLeg, rightLeg, interpolant),
CommonDustID,
-Vector2.UnitY * Main.rand.NextFloat(3f, 6f),
Scale: Main.rand.NextFloat(1f, 1.2f));
elevationDust.noGravity = true;
}
}
private void NetUpdate()
{
Projectile.netUpdate = true;
if (Projectile.netSpam >= 10)
Projectile.netSpam = 9;
}
#endregion
#region Syncing
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(HasShotOnce);
writer.Write(FrameAmount);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
HasShotOnce = reader.ReadBoolean();
FrameAmount = reader.ReadInt32();
}
#endregion
#region Drawing & Animation
public override void DoAnimation()
{
if (Animation == AnimationState.Still)
return;
FramesUntilNextAnimationFrame = Animation == AnimationState.Walk ? (int)Utils.Remap(Abs(Projectile.velocity.X), 0f, 6f, 8f, 4f) : 5;
Projectile.frameCounter++;
if (Projectile.frameCounter >= FramesUntilNextAnimationFrame)
{
Projectile.frameCounter = 0;
Projectile.frame = (Projectile.frame + 1) % FrameAmount;
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = texture.Frame(5, 9, (int)Animation, Projectile.frame);
Vector2 origin = frame.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, flipSprite);
return false;
}
#endregion
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff. Show more