Merge branch '1.4.4' into HellkiteRework

This commit is contained in:
Xyk committed 2024-06-17 17:28:46 -07:00
commit b0f3a14900
116 files changed
+2797 -1516

No files matched your search

+9 -6
View File
@@ -78,16 +78,16 @@ namespace CalamityMod.Balancing
// Nerf Mushroom Spear projectiles by 50%.
Do(new ProjectileSpecificRequirementBalancingRule(0.5f, MushroomSpearFilter)),
// Nerf Spectre Mask set bonus projectiles by 30%.
Do(new ProjectileSpecificRequirementBalancingRule(0.7f, SpectreMaskSetBonusFilter)),
// Nerf Spectre Mask set bonus projectiles by 50%.
Do(new ProjectileSpecificRequirementBalancingRule(0.5f, SpectreMaskSetBonusFilter)),
};
NPCSpecificBalancingChanges = new List<NPCBalancingChange>();
#region Desert Scourge
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DesertScourgeIDs, Do(ResistTrueMelee(0.5f))));
// 25% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DesertScourgeIDs, Do(ResistTrueMelee(0.75f))));
#endregion
#region Crabulon
@@ -255,8 +255,8 @@ namespace CalamityMod.Balancing
// 70% resist to Stardust Dragon Staff.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4))));
// 60% resist to Aurora Blazer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType<AuroraFire>()))));
// 65% resist to Atlantis (Atlantis gaming!).
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<AtlantisSpear>()))));
// 55% resist to Flak Kraken.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType<FlakKrakenProjectile>()))));
@@ -264,6 +264,9 @@ namespace CalamityMod.Balancing
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f))));
// 50% resist to Aurora Blazer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<AuroraFire>()))));
// 35% resist to Ballistic Poison Bomb's clouds.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<BallisticPoisonCloud>()))));
+34 -9
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -29,20 +30,44 @@ namespace CalamityMod.Buffs.DamageOverTime
npc.DelBuff(buffIndex);
buffIndex--;
}
internal static void DrawEffects(PlayerDrawSet drawInfo)
{
Player player = drawInfo.drawPlayer;
var modPlayer = player.Calamity();
if (Main.rand.NextBool())
{
Vector2 randVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f);
Dust dust = Dust.NewDustPerfect(modPlayer.RandomDebuffVisualSpot, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.6f, 0.9f));
dust.noGravity = false;
Particle spark = new AltSparkParticle(modPlayer.RandomDebuffVisualSpot, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Main.rand.NextBool(8))
{
Particle spark = new GlowOrbParticle(modPlayer.RandomDebuffVisualSpot, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false);
GeneralParticleHandler.SpawnParticle(spark);
}
}
internal static void DrawEffects(NPC npc, ref Color drawColor)
{
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
Vector2 randVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f);
if (Main.rand.NextBool(3))
{
for (int b = 0; b < 2; b++)
{
Vector2 bloodVel = Main.rand.NextVector2CircularEdge(1f, 1f);
bloodVel.SafeNormalize(Vector2.Zero);
bloodVel *= Main.rand.NextFloat(4f, 7f);
Particle bloody = new BloodParticle(npc.Center, bloodVel, 40, 0.75f, new Color(192, 0, 0));
GeneralParticleHandler.SpawnParticle(bloody);
}
Particle spark = new AltSparkParticle(npcSize, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f);
GeneralParticleHandler.SpawnParticle(spark);
}
else
{
Dust dust = Dust.NewDustPerfect(npcSize, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.2f, 0.6f));
dust.noGravity = false;
}
if (Main.rand.NextBool(8))
{
Particle spark = new GlowOrbParticle(npcSize, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false);
GeneralParticleHandler.SpawnParticle(spark);
}
}
}
+20 -6
View File
@@ -32,8 +32,9 @@ namespace CalamityMod.Buffs.DamageOverTime
internal static void DrawEffects(PlayerDrawSet drawInfo)
{
Player Player = drawInfo.drawPlayer;
var modPlayer = Player.Calamity();
if (Main.rand.NextBool(7))
if (Main.rand.NextBool(14))
{
int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.FungiHit, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f);
Main.dust[dust].noGravity = false;
@@ -41,16 +42,29 @@ namespace CalamityMod.Buffs.DamageOverTime
Main.dust[dust].velocity.Y += 0.8f;
drawInfo.DustCache.Add(dust);
}
if (Main.rand.NextBool(9))
{
Gore bubble = Gore.NewGorePerfect(Player.GetSource_FromAI(), modPlayer.RandomDebuffVisualSpot, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), 411);
bubble.timeLeft = 4 + Main.rand.Next(7);
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
}
internal static void DrawEffects(NPC npc, ref Color drawColor)
{
if (Main.rand.Next(7) < 3)
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
if (Main.rand.NextBool(9))
{
int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustID.FungiHit, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1f);
Main.dust[dust].noGravity = false;
Main.dust[dust].velocity *= 1.2f;
Main.dust[dust].velocity.Y += 0.5f;
Dust dust = Dust.NewDustPerfect(npcSize, 76, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), 0, default, Main.rand.NextFloat(0.2f, 0.6f));
dust.color = (Main.rand.NextBool(3) ? Color.LightBlue : Color.LightSkyBlue);
}
if (Main.rand.NextBool(8))
{
Gore bubble = Gore.NewGorePerfect(npc.GetSource_FromAI(), npcSize, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), 411);
bubble.timeLeft = 4 + Main.rand.Next(7);
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
}
}
+7
View File
@@ -263,6 +263,7 @@ namespace CalamityMod.CalPlayer
public static readonly SoundStyle AdrenalineFilledSound = new("CalamityMod/Sounds/Custom/AbilitySounds/FullAdrenaline");
public static readonly SoundStyle AdrenalineActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AdrenalineActivate");
public static readonly SoundStyle AdrenalineHurtSound = new("CalamityMod/Sounds/Custom/AdrenalineMajorLoss");
public static readonly SoundStyle AdrenalineHurtGFB = new("CalamityMod/Sounds/Custom/AdrenalineMajorLossGFB");
public static readonly SoundStyle NanomachinesActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/NanomachinesActivate");
public static readonly SoundStyle RogueStealthSound = new("CalamityMod/Sounds/Custom/RogueStealth");
@@ -466,6 +467,7 @@ namespace CalamityMod.CalPlayer
public bool sTangerine = false;
public bool tCloudberry = false;
public bool sStrawberry = false;
public bool nimbleBounderBoost = false;
public bool revJamDrop = false;
public bool rageBoostOne = false;
public bool rageBoostTwo = false;
@@ -1273,6 +1275,7 @@ namespace CalamityMod.CalPlayer
sStrawberry = false;
pHeart = false;
cShard = false;
nimbleBounderBoost = false;
revJamDrop = false;
rageBoostOne = false;
rageBoostTwo = false;
@@ -1325,6 +1328,7 @@ namespace CalamityMod.CalPlayer
boost.AddWithCondition("dragonFruit", sStrawberry);
boost.AddWithCondition("phantomHeart", pHeart);
boost.AddWithCondition("cometShard", cShard);
boost.AddWithCondition("nimbleBounder", nimbleBounderBoost);
boost.AddWithCondition("revJam", revJamDrop);
boost.AddWithCondition("rageOne", rageBoostOne);
boost.AddWithCondition("rageTwo", rageBoostTwo);
@@ -1415,6 +1419,7 @@ namespace CalamityMod.CalPlayer
sStrawberry = boost.Contains("dragonFruit");
pHeart = boost.Contains("phantomHeart");
cShard = boost.Contains("cometShard");
nimbleBounderBoost = boost.Contains("nimbleBounder");
revJamDrop = boost.Contains("revJam");
rageBoostOne = boost.Contains("rageOne");
rageBoostTwo = boost.Contains("rageTwo");
@@ -3772,6 +3777,7 @@ namespace CalamityMod.CalPlayer
(kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) +
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? 0.05f : 0f) +
(nimbleBounderBoost ? 0.1f : 0f) +
(blueCandle ? CirrusBlueCandleBuff.AccelerationBoost : 0f) +
(planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) +
(hasteLevel * 0.05f);
@@ -3787,6 +3793,7 @@ namespace CalamityMod.CalPlayer
(kamiBoost ? KamiBuff.RunSpeedBoost : 0f) +
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? 0.05f : 0f) +
(nimbleBounderBoost ? 0.1f : 0f) +
(planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) +
(hasteLevel * 0.05f);
+1 -1
View File
@@ -3000,7 +3000,7 @@ namespace CalamityMod.CalPlayer
bool hitAtFullAdrenaline = adrenaline >= adrenalineMax;
if (hitAtFullAdrenaline)
{
SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center);
SoundEngine.PlaySound(Main.zenithWorld ? AdrenalineHurtGFB : AdrenalineHurtSound, Player.Center);
adrenaline = 0f;
return;
}
+2 -1
View File
@@ -118,7 +118,8 @@ namespace CalamityMod.CalPlayer
ApplyDoTDebuff(gsInferno, profanedCrystalBuffs ? 60 : 50);
int fluxDoT = ((Player.controlLeft || Player.controlRight) ? 60 : 15) / (eleResist ? 2 : 1);
ApplyDoTDebuff(vermillionFlux, fluxDoT);
ApplyDoTDebuff(dragonFire, dynamoStemCells ? 30 : 60);
int dragonfireDoT = ((Player.name == "JFL" || Player.name == "MrJFL") ? 240 : 60) / (dynamoStemCells ? 2 : 1);
ApplyDoTDebuff(dragonFire, dragonfireDoT);
int rebukeDoT = ((Player.controlLeft || Player.controlRight) ? 75 : 15) / (eleResist ? 2 : 1);
ApplyDoTDebuff(auricRebuke, rebukeDoT);
ApplyDoTDebuff(miracleBlight, 80);
+8 -1
View File
@@ -682,7 +682,7 @@ namespace CalamityMod.CalPlayer
Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").Format(Player.name)), auricRejectionDamage, 0);
Player.AddBuff(ModContent.BuffType<AuricRebuke>(), 120);
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"));
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center);
}
if (tile.TileType == auricLandMineID)
@@ -1866,6 +1866,13 @@ namespace CalamityMod.CalPlayer
Player.thorns += 3.5f;
}
// Nimble Bounder bonus
if (nimbleBounderBoost)
{
Player.moveSpeed += 0.05f;
Player.jumpSpeedBoost += 0.25f;
}
// Affliction bonus
if (affliction || afflicted)
{
@@ -64,12 +64,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value;
else if (itemType == ModContent.ItemType<FatesReveal>())
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value;
else if (itemType == ModContent.ItemType<GrandGuardian>())
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value;
else if (itemType == ModContent.ItemType<GreatswordofJudgement>())
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value;
else if (itemType == ModContent.ItemType<MajesticGuard>())
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value;
else if (itemType == ModContent.ItemType<NecroplasmicBeacon>())
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value;
else if (itemType == ModContent.ItemType<Orderbringer>())
@@ -174,11 +170,6 @@ namespace CalamityMod.CalPlayer.DrawLayers
break;*/
}
if (itemType == ModContent.ItemType<GrandGuardian>())
{
color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, heldItem.alpha);
}
Vector2 origin = new Vector2((float)itemDrawFrame.Width * 0.5f - (float)itemDrawFrame.Width * 0.5f * (float)drawPlayer.direction, itemDrawFrame.Height);
if (heldItem.useStyle == ItemUseStyleID.DrinkLiquid && drawPlayer.itemAnimation > 0)
{
+9 -2
View File
@@ -836,7 +836,11 @@ namespace CalamityMod
ProjectileType<ArkoftheElementsParryHoldout>(),
ProjectileType<ArkoftheCosmosSwungBlade>(),
ProjectileType<ArkoftheCosmosParryHoldout>(),
ProjectileType<HellkiteHoldout>(),
ProjectileType<GrandDadHoldout>(),
ProjectileType<GrandGuardianHoldout>(),
ProjectileType<EarthHoldout>(),
ProjectileType<MajesticGuardHoldout>(),
ProjectileType<PhangasmBow>(),
ProjectileType<ContagionBow>(),
ProjectileType<DaemonsFlameBow>(),
@@ -1921,6 +1925,7 @@ namespace CalamityMod
ProjectileType<DevilsSunriseCyclone>(),
ProjectileType<DevilsSunriseProj>(),
ProjectileType<DragonRageStaff>(),
ProjectileType<EarthHoldout>(),
ProjectileType<EclipsesStealth>(),
ProjectileType<EidolicWailSoundwave>(),
ProjectileType<EmesisGore>(),
@@ -1930,12 +1935,14 @@ namespace CalamityMod
ProjectileType<FantasyTalismanProj>(),
ProjectileType<FantasyTalismanStealth>(),
ProjectileType<GodsParanoiaProj>(),
ProjectileType<HellkiteHoldout>(),
ProjectileType<GrandDadHoldout>(),
ProjectileType<GrandGuardianHoldout>(),
ProjectileType<InsidiousHarpoon>(),
ProjectileType<JawsProjectile>(),
ProjectileType<LeviathanTooth>(),
ProjectileType<LiliesOfFinalityAoE>(),
ProjectileType<LionfishProj>(),
ProjectileType<MajesticGuardHoldout>(),
ProjectileType<MechanicalBarracuda>(),
ProjectileType<MetalShard>(),
ProjectileType<MurasamaSlash>(),
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

+1
View File
@@ -85,6 +85,7 @@ namespace CalamityMod.ILEditing
On_Player.UpdateItemDye += FindCalamityItemDyeShader;
On_AWorldListItem.GetDifficulty += GetDifficultyOverride;
On_Item.GetShimmered += ShimmerEffectEdits;
Terraria.On_Player.Teleport += TPOverride;
// Mana Burn (Chaos Stone) and Chalice of the Blood God
IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal;
+41
View File
@@ -22,6 +22,7 @@ using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Systems;
using CalamityMod.Tiles.Abyss;
using CalamityMod.Walls;
using CalamityMod.Waterfalls;
using CalamityMod.Waters;
using Microsoft.Xna.Framework;
@@ -1495,5 +1496,45 @@ namespace CalamityMod.ILEditing
}
}
#endregion
#region Block Abyss from Teleportation Potions
public static void TPOverride(Terraria.On_Player.orig_Teleport orig, Player self, Vector2 newPos, int Style = 0, int extraInfo = 0)
{
// Grab the tile from where the potion wants to teleport
Tile t = CalamityUtils.ParanoidTileRetrieval(newPos.ToTileCoordinates().X, newPos.ToTileCoordinates().Y);
// Check if it's a Teleportation Potion
if (Style == 2)
{
// Check if it's an Abyss wall
if (t.WallType == ModContent.WallType<SulphurousShaleWall>() || t.WallType == ModContent.WallType<AbyssGravelWall>() || t.WallType == ModContent.WallType<PyreMantleWall>() || t.WallType == ModContent.WallType<VoidstoneWallUnsafe>() || t.WallType == ModContent.WallType<HardenedSulphurousSandstoneWall>() || t.WallType == ModContent.WallType<SulphurousSandstoneWall>())
{
// If an Abyss wall is detected, try to find another teleportation location
bool canSpawn = false;
int teleportStartX = 100;
int teleportRangeX = Main.maxTilesX - 200;
int teleportStartY = 100;
int underworldLayer = Main.UnderworldLayer;
Vector2 newerPos = self.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, underworldLayer, new Player.RandomTeleportationAttemptSettings
{
avoidLava = true,
avoidHurtTiles = true,
maximumFallDistanceFromOrignalPoint = 100,
attemptsBeforeGivingUp = 1000
});
// Attempt teleporting again with the new location
orig(self, newerPos, Style, extraInfo);
}
else
{
orig(self, newPos, Style, extraInfo);
}
}
else
{
orig(self, newPos, Style, extraInfo);
}
}
#endregion
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Items.BaseItems
{
public abstract class CustomUseProjItem : ModItem
{
public override void SetDefaults()
{
}
public override bool CanShoot(Player player)
{
return player.ownedProjectileCounts[Item.shoot] < 1;
}
public override bool CanUseItem(Player player)
{
return base.CanUseItem(player);
}
}
}
+6 -3
View File
@@ -6,6 +6,7 @@ using CalamityMod.Balancing;
using CalamityMod.CustomRecipes;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.Demonshade;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Tools;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Magic;
@@ -296,6 +297,8 @@ namespace CalamityMod.Items
nameLine.OverrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f);
if (item.type == ModContent.ItemType<ShatteredCommunity>())
nameLine.OverrideColor = ShatteredCommunity.GetRarityColor();
if (item.type == ModContent.ItemType<NimbleBounder>())
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(132, 37, 147), new Color(0, 255, 0), 5f); //alternates purple and neon green
if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh)
if (item.type == ModContent.ItemType<TemporalUmbrella>())
@@ -374,9 +377,9 @@ namespace CalamityMod.Items
{
List<Color> earthColors = new List<Color>()
{
new Color(255, 99, 146),
new Color(255, 228, 94),
new Color(127, 200, 248)
Color.OrangeRed,
Color.MediumTurquoise,
Color.LimeGreen
};
if (nameLine != null)
{
+4
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using CalamityMod.Balancing;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Placeables.Ores;
using Microsoft.Xna.Framework;
using Terraria;
@@ -1411,6 +1412,9 @@ namespace CalamityMod.Items
shimmerTransmute[ModContent.ItemType<LifeJelly>()] = ModContent.ItemType<CleansingJelly>();
shimmerTransmute[ModContent.ItemType<CleansingJelly>()] = ModContent.ItemType<VitalJelly>();
shimmerTransmute[ModContent.ItemType<VitalJelly>()] = ModContent.ItemType<LifeJelly>();
//Calamity Permanent Upgrades
shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType<NimbleBounder>();
}
#endregion
}
+52
View File
@@ -0,0 +1,52 @@
using CalamityMod.CalPlayer;
using CalamityMod.Rarities;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.PermanentBoosters
{
public class NimbleBounder : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Misc";
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.useAnimation = 30;
Item.rare = ModContent.RarityType<HotPink>();
Item.useTime = 30;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.UseSound = SoundID.Zombie13; // frog sfx
Item.consumable = true;
Item.Calamity().devItem = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.nimbleBounderBoost)
{
return false;
}
return true;
}
public override bool? UseItem(Player player)
{
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
CalamityPlayer modPlayer = player.Calamity();
modPlayer.nimbleBounderBoost = true;
}
return true;
}
// Gives a purple light when dropped as an item
public override void PostUpdate()
{
Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.51f, 0.14f, 0.57f);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

+2 -2
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 28;
Item.height = 30;
Item.damage = 86;
Item.damage = 88;
Item.DamageType = DamageClass.Magic;
Item.mana = 12;
Item.useTime = 25;
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.UseSound = SoundID.Item34;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<AtlantisSpear>();
Item.shootSpeed = 32f;
Item.shootSpeed = 40f;
}
public override void ModifyWeaponDamage(Player player, ref StatModifier damage)
+32 -125
View File
@@ -1,159 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class Earth : ModItem, ILocalizedModType
public class Earth : CustomUseProjItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetDefaults()
{
Item.width = 92;
Item.height = 104;
Item.damage = 210;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 16;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 16;
Item.damage = 1980;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useAnimation = 38;
Item.useTime = 38;
Item.useTurn = true;
Item.knockBack = 9.5f;
Item.UseSound = SoundID.Item1;
Item.knockBack = 15f;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice;
Item.rare = ModContent.RarityType<HotPink>();
Item.Calamity().devItem = true;
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
Item.channel = true;
Item.shoot = ModContent.ProjectileType<EarthHoldout>();
Item.noUseGraphic = true;
Item.noMelee = true;
Item.useStyle = ItemUseStyleID.Shoot;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
var source = player.GetSource_ItemUse(Item);
float projSpeed = 25f;
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X;
float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y;
if (player.gravDir == -1f)
{
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
{
mouseXDist = (float)player.direction;
mouseYDist = 0f;
mouseDistance = projSpeed;
}
else
{
mouseDistance = projSpeed / mouseDistance;
}
for (int i = 0; i < 3; i++)
{
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
realPlayerPos.Y -= (float)(100 * i);
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (mouseYDist < 0f)
{
mouseYDist *= -1f;
}
if (mouseYDist < 20f)
{
mouseYDist = 20f;
}
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
mouseDistance = projSpeed / mouseDistance;
mouseXDist *= mouseDistance;
mouseYDist *= mouseDistance;
float speedX4 = mouseXDist;
float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f;
int projDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType<EarthProj>(), projDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10));
}
if (target.Calamity().miscDefenseLoss < target.defense)
target.Calamity().miscDefenseLoss += 1;
if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5)
return;
int heal = Main.rand.Next(1, 70);
player.lifeSteal -= heal;
player.statLife += heal;
player.HealEffect(heal);
if (player.statLife > player.statLifeMax2)
player.statLife = player.statLifeMax2;
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/EarthGlow").Value);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
public override void ModifyTooltips(List<TooltipLine> list)
{
var source = player.GetSource_ItemUse(Item);
float projSpeed = 25f;
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X;
float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y;
if (player.gravDir == -1f)
List<Color> earthColors = new List<Color>()
{
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
{
mouseXDist = (float)player.direction;
mouseYDist = 0f;
mouseDistance = projSpeed;
}
else
{
mouseDistance = projSpeed / mouseDistance;
}
Color.OrangeRed,
Color.MediumTurquoise,
Color.LimeGreen
};
for (int i = 0; i < 3; i++)
{
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
realPlayerPos.Y -= (float)(100 * i);
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (mouseYDist < 0f)
{
mouseYDist *= -1f;
}
if (mouseYDist < 20f)
{
mouseYDist = 20f;
}
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
mouseDistance = projSpeed / mouseDistance;
mouseXDist *= mouseDistance;
mouseYDist *= mouseDistance;
float speedX4 = mouseXDist;
float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f;
int earthDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType<EarthProj>(), earthDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10));
}
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count);
Color currentColor = earthColors[colorIndex];
Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count];
Color earthTooltipColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f);
if (player.moonLeech || player.lifeSteal <= 0f)
return;
int heal = Main.rand.Next(1, 70);
player.lifeSteal -= heal;
player.statLife += heal;
player.HealEffect(heal);
if (player.statLife > player.statLifeMax2)
player.statLife = player.statLifeMax2;
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3");
if (line != null)
line.OverrideColor = Color.Lerp(earthTooltipColor, Color.White, 0.5f);
}
public override bool MeleePrefix() => true;
public override void AddRecipes()
{
CreateRecipe().
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

+67
View File
@@ -0,0 +1,67 @@
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class GrandDad : CustomUseProjItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static readonly SoundStyle GrandDadEasterEggSound = new("CalamityMod/Sounds/Custom/GFB/GrandDad");
public override void SetDefaults()
{
Item.width = 124;
Item.height = 124;
Item.damage = 2777;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useAnimation = 77;
Item.useTime = 77;
Item.useTurn = true;
Item.knockBack = 77f;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.channel = true;
Item.shoot = ModContent.ProjectileType<GrandDadHoldout>();
Item.noUseGraphic = true;
Item.noMelee = true;
Item.useStyle = ItemUseStyleID.Shoot;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandDadGlow").Value);
}
public override bool MeleePrefix() => true;
// Has a GFB tooltip stuffed to the brim with various references
public override void ModifyTooltips(List<TooltipLine> list)
{
list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")));
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MajesticGuard>().
AddIngredient<TwistingNether>(3).
AddTile(TileID.LunarCraftingStation).
Register();
}
public override void OnCreated(ItemCreationContext context)
{
if (Main.zenithWorld)
SoundEngine.PlaySound(GrandDadEasterEggSound, Main.LocalPlayer.MountedCenter);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

+15 -85
View File
@@ -1,4 +1,5 @@
using CalamityMod.Projectiles.Healing;
using CalamityMod.Items.BaseItems;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -8,109 +9,38 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class GrandGuardian : ModItem, ILocalizedModType
public class GrandGuardian : CustomUseProjItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
internal const int TotalHealOrbs = 3;
internal const int HealPerOrb = 3;
internal const int TotalHealed = TotalHealOrbs * HealPerOrb;
public override void SetDefaults()
{
Item.width = 130;
Item.height = 130;
Item.damage = 150;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 22;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 22;
Item.damage = 204;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useAnimation = 28;
Item.useTime = 28;
Item.useTurn = true;
Item.knockBack = 8.5f;
Item.UseSound = SoundID.Item1;
Item.knockBack = 9f;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityRedBuyPrice;
Item.rare = ItemRarityID.Red;
Item.shootSpeed = 12f;
}
Item.channel = true;
Item.shoot = ModContent.ProjectileType<GrandGuardianHoldout>();
Item.noUseGraphic = true;
Item.noMelee = true;
Item.useStyle = ItemUseStyleID.Shoot;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value);
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation);
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
if (target.Calamity().miscDefenseLoss < target.defense)
target.Calamity().miscDefenseLoss += 1;
OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage);
if (target.Calamity().miscDefenseLoss >= target.defense)
{
if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5)
return;
int heal = 6;
player.lifeSteal -= heal;
player.statLife += heal;
player.HealEffect(heal);
if (player.statLife > player.statLifeMax2)
player.statLife = player.statLifeMax2;
}
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage);
}
private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage)
{
var source = player.GetSource_ItemUse(Item);
// Grand Guardian is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee.
StatModifier playerMeleeDmg = player.GetTotalDamage<MeleeDamageClass>();
int rainbowBoomDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.5f);
int rainBoltDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.75f);
Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType<RainbowBoom>(), rainbowBoomDamage, 0f, player.whoAmI);
if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType<RainBolt>()] < 3)
{
float randomSpeedX = Main.rand.NextFloat(6f, 12f);
float randomSpeedY = Main.rand.NextFloat(6f, 12f);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType<RainBolt>(), rainBoltDamage, knockback, player.whoAmI);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType<RainBolt>(), rainBoltDamage, knockback, player.whoAmI);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType<RainBolt>(), rainBoltDamage, knockback, player.whoAmI);
}
if (player.moonLeech || player.lifeSteal <= 0f)
return;
if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType<RainHeal>()] < 3 && targetMaxLife > 5)
{
player.lifeSteal -= TotalHealed;
float randomSpeedX = Main.rand.NextFloat(3f, 4.5f);
float randomSpeedY = Main.rand.NextFloat(3f, 4.5f);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType<RainHeal>(), 0, 0f, player.whoAmI);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType<RainHeal>(), 0, 0f, player.whoAmI);
Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType<RainHeal>(), 0, 0f, player.whoAmI);
}
}
public override bool MeleePrefix() => true;
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MajesticGuard>().
AddIngredient<BurntSienna>().
AddIngredient(ItemID.FragmentNebula, 6).
AddTile(TileID.LunarCraftingStation).
Register();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 3.2 KiB

+27 -34
View File
@@ -1,4 +1,7 @@
using Microsoft.Xna.Framework;
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -6,7 +9,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class MajesticGuard : ModItem, ILocalizedModType
public class MajesticGuard : CustomUseProjItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
@@ -14,53 +17,43 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 100;
Item.height = 100;
Item.damage = 70;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 22;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 22;
Item.damage = 295;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useAnimation = 50;
Item.useTime = 50;
Item.useTurn = true;
Item.knockBack = 7.5f;
Item.UseSound = SoundID.Item1;
Item.knockBack = 12f;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
}
Item.channel = true;
Item.shoot = ModContent.ProjectileType<MajesticGuardHoldout>();
Item.noUseGraphic = true;
Item.noMelee = true;
Item.useStyle = ItemUseStyleID.Shoot;
}
public override bool MeleePrefix() => true;
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value);
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
if (target.Calamity().miscDefenseLoss < target.defense)
target.Calamity().miscDefenseLoss += 1;
if (target.Calamity().miscDefenseLoss >= target.defense)
{
if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5)
return;
int heal = 3;
player.lifeSteal -= heal;
player.statLife += heal;
player.HealEffect(heal);
if (player.statLife > player.statLifeMax2)
player.statLife = player.statLifeMax2;
}
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.AdamantiteSword).
AddIngredient(ItemID.SoulofMight, 15).
AddIngredient(ItemID.GoldBroadsword).
AddRecipeGroup("AnyMythrilBar", 15).
AddIngredient<EssenceofEleum>(3).
AddIngredient<EssenceofHavoc>(3).
AddIngredient<EssenceofSunlight>(3).
AddTile(TileID.MythrilAnvil).
Register();
CreateRecipe().
AddIngredient(ItemID.TitaniumSword).
AddIngredient(ItemID.SoulofMight, 15).
AddIngredient(ItemID.PlatinumBroadsword).
AddRecipeGroup("AnyMythrilBar", 15).
AddIngredient<EssenceofEleum>(3).
AddIngredient<EssenceofHavoc>(3).
AddIngredient<EssenceofSunlight>(3).
AddTile(TileID.MythrilAnvil).
Register();
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 3.1 KiB

+3 -1
View File
@@ -65,7 +65,9 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
player.velocity += -velocity * 0.3f;
Vector2 recoilVelocity = velocity;
recoilVelocity.Normalize();
player.velocity += -recoilVelocity * 7f;
if (type == ProjectileID.Bullet)
type = ModContent.ProjectileType<NitroShot>();
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f);
+24 -2
View File
@@ -1,5 +1,4 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
using Terraria;
@@ -11,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue
{
public class CrushsawCrasher : RogueWeapon
{
bool HasHoveredOverNameInGFB = false;
public override void SetDefaults()
{
Item.width = 38;
@@ -51,6 +52,27 @@ namespace CalamityMod.Items.Weapons.Rogue
return true;
}
public override void UpdateInventory(Player player)
{
if (Main.zenithWorld)
{
if (Main.HoverItem.type == Item.type)
{
if (!HasHoveredOverNameInGFB)
{
HasHoveredOverNameInGFB = true;
string firstWord = this.GetLocalizedValue("GFBFirstWord" + Main.rand.Next(1, 12 + 1).ToString());
string lastWord = this.GetLocalizedValue("GFBLastWord" + Main.rand.Next(1, 10 + 1).ToString());
Item.SetNameOverride(firstWord + " " + lastWord);
}
}
else
HasHoveredOverNameInGFB = false;
}
else
Item.ClearNameOverride();
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 300);
@@ -30,7 +30,7 @@ ElysianWings: {
Acceleration multiplier: 2.7
Great vertical speed
Flight time: 240
Temporary immunity to lava and 10% increased movement speed
Immunity to lava and 10% increased movement speed
Blessed by the Profaned Flame
'''
}
@@ -323,3 +323,13 @@ SuperDummy: {
Right click to kill all super dummies
'''
}
NimbleBounder: {
DisplayName: Nimble Bounder
Tooltip:
'''
Permanently increases movement and jump speed by 5%
Permanently increases acceleration by 10%
[c/842593:'Might be useful for speedrunning']
'''
}
@@ -409,12 +409,10 @@ Earth: {
DisplayName: Earth
Tooltip:
'''
Lowers enemy defense by 1 with every strike
Your attacks will heal you a lot
Rains RGB meteors that explode into more meteors after a short time on enemy hits
Ice meteors freeze enemies
Flame meteors explode
Green meteors spawn healing orbs
A beautiful prismatic blade with unrivaled close combat proficiency
Heals you greatly on hit
Every other swing will summon three Gaia meteors to fall upon nearby enemies
'All its spawn shall know the beauty and wrath of their creator'
'''
}
@@ -634,15 +632,34 @@ GoldplumeSpear: {
Tooltip: Shoots falling feathers
}
GrandDad: {
DisplayName: Grand Dad
Tooltip: "[GFB]"
TooltipNormal:
'''
An unfathomably heavy blade that rips through enemies using its sheer mass
Heals you on hit
Striking weaker enemies will launch them with incredible force
Launched enemies take immense damage when colliding with walls and floors
Holding <right> while swinging will heavily reduce the damage of the blade and increase its launch damage and velocity
[c/00B8DF:'How are you swinging something that has half the mass of a star?']
'''
TooltipGFB:
'''
A high quality blade that rips through enemies
Striking weaker enemies will yeet them with incredible force, often leaving them Stuck Inside tiles
Yeeted enemies will turn to JAM when SLAMMED into walls and floors
Holding <right> while swinging will heavily reduce the damage of the blade and increase its yeet damage and velocity, nice >:]
[c/00B8DF:'Please read the weapon description.']
'''
}
GrandGuardian: {
DisplayName: Grand Guardian
Tooltip:
'''
Lowers enemy defense by 1 with every strike
If enemy defense is 0 or below your attacks will heal you
Striking enemies causes a large explosion
Striking enemies that are under half life will cause them to release rainbow bolts
Enemies spawn healing orbs on death
An ornate winged blade that easily cuts through enemies
Creates cosmic explosions and heals you slightly on hit
'''
}
@@ -756,8 +773,8 @@ MajesticGuard: {
DisplayName: Majestic Guard
Tooltip:
'''
Lowers enemy defense by 1 with every strike
If enemy defense is 0 or below your attacks will heal you
An intricate blade, heavy enough to crush anything it wouldn't cut
Strongly knocks back enemies and heals you slightly on hit
'''
}
@@ -224,6 +224,28 @@ CrushsawCrasher: {
Throws bouncing axes
Stealth strikes throw five at once
'''
GFBFirstWord1: Crushsaw
GFBFirstWord2: Crashsaw
GFBFirstWord3: Crushclaw
GFBFirstWord4: Crashclaw
GFBFirstWord5: Crushcaw
GFBFirstWord6: Crushaw
GFBFirstWord7: Crushmaw
GFBFirstWord8: Crashmaw
GFBFirstWord9: Crawshaw
GFBFirstWord10: Coleslaw
GFBFirstWord11: Cashew
GFBFirstWord12: Cawcaw
GFBLastWord1: Crasher
GFBLastWord2: Crusher
GFBLastWord3: Clasher
GFBLastWord4: Casher
GFBLastWord5: Clacker
GFBLastWord6: Catcher
GFBLastWord7: Trasher
GFBLastWord8: Rasher
GFBLastWord9: Cracker
GFBLastWord10: Cackler
}
Crystalline: {
@@ -1315,7 +1337,7 @@ Turbulance: {
Tooltip:
'''
Fires a cloudy javelin that bursts into wind slashes on hit
Wind slashes home if the javelin crits
Wind slashes occasionally home, and always home if the javelin crits
Stealth strikes are trailed by homing wind slashes
'''
}
@@ -169,9 +169,9 @@ Frogfish.DisplayName: Frogfish
Horse.DisplayName: Earth Elemental
IceClasper.DisplayName: Ice Clasper
ImpiousImmolator.DisplayName: Impious Immolator
KingSlimeJewel.DisplayName: Ruby Jewel
KingSlimeJewel2.DisplayName: Sapphire Jewel
KingSlimeJewel3.DisplayName: Emerald Jewel
KingSlimeJewelEmerald.DisplayName: Emerald Jewel
KingSlimeJewelRuby.DisplayName: Ruby Jewel
KingSlimeJewelSapphire.DisplayName: Sapphire Jewel
LavaSlimeNoLavaDrop.DisplayName: Lava Slime
MantisShrimp.DisplayName: Mantis Shrimp
OverloadedSoldier.DisplayName: Overloaded Soldier
@@ -623,7 +623,3 @@ WITCH: {
Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!"
}
}
KingSlimeJewelEmerald.DisplayName: King Slime Jewel Emerald
KingSlimeJewelRuby.DisplayName: King Slime Jewel Ruby
KingSlimeJewelSapphire.DisplayName: King Slime Jewel Sapphire
@@ -12,7 +12,6 @@ HydrothermicHealOrb.DisplayName: Hydrothermic Rejuvenation
IridescentExcaliburHeal.DisplayName: Iridescent Excalibur Heal
ManaPolarizerHealOrb.DisplayName: Mana Polarizer Heal Orb
PhantomicHeart.DisplayName: Phantomic Heart
RainHeal.DisplayName: Heal
ReaverHealOrb.DisplayName: Reaver Heal Orb
RoyalHeal.DisplayName: Heal
ShinobiHealOrb.DisplayName: Blue Healing Orb
@@ -99,10 +99,8 @@ DracoBeam2.DisplayName: Draconic Beam
DraconicSpark.DisplayName: Draconic Spark
DragonPowFlail.DisplayName: Dragon Pow
DragonRageFireball.DisplayName: Dragon Rage Fireball
Earth2.DisplayName: Earth
Earth3.DisplayName: Earth
Earth4.DisplayName: Earth
EarthProj.DisplayName: Earth
EarthBoom.DisplayName: Earth's Judgement
EarthMeteor.DisplayName: Gaia Meteor
ElementalGlassStar.DisplayName: Glass Star
ElementBall.DisplayName: Elemental Ball
ElementBallShiv.DisplayName: Shiv
@@ -158,6 +156,7 @@ GhastlyChain.DisplayName: Ghastly Chain
GhastlySoulLarge.DisplayName: Ghastly Soul
GhastlySoulMedium.DisplayName: Ghastly Soul
GhastlySoulSmall.DisplayName: Ghastly Soul
GrandGuardianBoom.DisplayName: Cosmic Burst
GreenWater.DisplayName: Greentide Tooth
GrovetendersEntanglingVines.DisplayName: Entangling Growth
GrovetendersTouch.DisplayName: Grovetender's Touch
@@ -216,12 +215,13 @@ PwnagehammerExplosionSmall.DisplayName: Pwnage Blast
PwnagehammerExplosionBig.DisplayName: Pwnage Blast
PwnagehammerProj.DisplayName: Pwnagehammer
PwnagehammerSmallExplosion.DisplayName: Pwnage Blast
RainBolt.DisplayName: Bolt
RainbowBoom.DisplayName: Boom
Razorwind.DisplayName: Razorwind
RedtideWhirlpool.DisplayName: Whirlpool
RemsRevengeProj.DisplayName: Rem's Revenge
RendingNeedle.DisplayName: Rending Needle
RespiteblockHoldout.DisplayName: Respiteblock
RespiteblockBlood.DisplayName: Respiteblock Blood
Rox1.DisplayName: Rock
RoxcaliburProj.DisplayName: Roxcalibur
RSSolarFlare.DisplayName: Flare
@@ -315,5 +315,3 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
YateveoBloomProj.DisplayName: Yateveo Bloom
YinYoDark.DisplayName: Dark Shard
YinYoLight.DisplayName: Light Shard
RespiteblockHoldout.DisplayName: Respiteblock
RespiteblockBlood.DisplayName: Respiteblock Blood
+4
View File
@@ -1003,6 +1003,8 @@ namespace CalamityMod
"TaintedCloudberry" => player.Calamity().tCloudberry,
"SacredStrawberry" => player.Calamity().sStrawberry,
"NimbleBounder" => player.Calamity().nimbleBounderBoost,
"CometShard" => player.Calamity().cShard,
"EtherealCore" => player.Calamity().eCore,
"PhantomHeart" => player.Calamity().pHeart,
@@ -1036,6 +1038,8 @@ namespace CalamityMod
case "EtherealCore": player.Calamity().eCore = value; break;
case "PhantomHeart": player.Calamity().pHeart = value; break;
case "NimbleBounder": player.Calamity().nimbleBounderBoost = value; break;
case "MushroomPlasmaRoot": player.Calamity().rageBoostOne = value; break;
case "InfernalBlood": player.Calamity().rageBoostTwo = value; break;
case "RedLightningContainer": player.Calamity().rageBoostThree = value; break;
+17 -2
View File
@@ -469,7 +469,7 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.height = (int)(100 * NPC.scale);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int r = 0; r < 50; r++)
for (int r = 0; r < 30; r++)
{
int aureusDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[aureusDust].velocity *= 3f;
@@ -479,7 +479,7 @@ namespace CalamityMod.NPCs.AstrumAureus
Main.dust[aureusDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int s = 0; s < 100; s++)
for (int s = 0; s < 60; s++)
{
int aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[aureusDust2].noGravity = true;
@@ -487,6 +487,21 @@ namespace CalamityMod.NPCs.AstrumAureus
aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[aureusDust2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
float randomSpread = Main.rand.Next(-200, 201) / 100f;
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus1").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus2").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus3").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus4").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus5").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus6").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus7").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus8").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus9").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus10").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("Aureus11").Type, 1f);
}
}
}
+14
View File
@@ -194,6 +194,20 @@ namespace CalamityMod.NPCs.AstrumDeus
astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
float randomSpread = Main.rand.Next(-200, 201) / 100f;
if (NPC.localAI[3] == 1f)
{
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusAltBody1").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusAltBody2").Type, 1f);
}
else
{
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusBody1").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusBody2").Type, 1f);
}
}
}
}
+7
View File
@@ -228,6 +228,13 @@ namespace CalamityMod.NPCs.AstrumDeus
astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
float randomSpread = Main.rand.Next(-200, 201) / 100f;
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusHead1").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusHead2").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusHead3").Type, 1f);
}
}
}
}
+6
View File
@@ -165,6 +165,12 @@ namespace CalamityMod.NPCs.AstrumDeus
astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
float randomSpread = Main.rand.Next(-200, 201) / 100f;
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusTail1").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find<ModGore>("AstrumDeusTail2").Type, 1f);
}
}
}
@@ -774,98 +774,102 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400;
float timer = npc.ai[0] + 15f;
float divisor = timer + shootProjectile;
bool canFireProjectiles = npc.Opacity >= 1f;
bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail;
if (!flyAtTarget || deathModeEnragePhase_BodyAndTail)
if (canFireProjectiles)
{
float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f;
if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f)
if (!flyAtTarget || deathModeEnragePhase_BodyAndTail)
{
npc.TargetClosest();
if (Main.netMode != NetmodeID.MultiplayerClient)
float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f;
if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f)
{
if (deathModeEnragePhase_BodyAndTail)
{
Vector2 velocity = Vector2.Zero;
if (movingMines)
{
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
randomMineMovement.Normalize();
randomMineMovement *= Main.rand.Next(90, 121) * 0.01f;
velocity = randomMineMovement;
}
npc.TargetClosest();
int type = ModContent.ProjectileType<DeusMine>();
int damage = npc.GetProjectileDamage(type);
float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
}
}
if (Vector2.Distance(player.Center, npc.Center) > 80f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f;
Vector2 deusLaserCenter = npc.Center;
float deusLaserTargetX = player.Center.X - deusLaserCenter.X;
float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y;
float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY);
deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist;
deusLaserTargetX *= deusLaserTargetDist;
deusLaserTargetY *= deusLaserTargetDist;
deusLaserCenter.X += deusLaserTargetX * 5f;
deusLaserCenter.Y += deusLaserTargetY * 5f;
Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY);
Vector2 laserVelocity = shootDirection * deusLaserSpeed;
int type = shootGodRays ? ModContent.ProjectileType<AstralGodRay>() : ModContent.ProjectileType<AstralShot2>();
int damage = npc.GetProjectileDamage(type);
if (shootGodRays)
if (deathModeEnragePhase_BodyAndTail)
{
SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, npc.Center);
// Waving beams need to start offset so they cross each other neatly.
float waveSideOffset = Main.rand.NextFloat(9f, 14f);
Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset;
for (int i = -1; i <= 1; i += 2)
Vector2 velocity = Vector2.Zero;
if (movingMines)
{
Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f);
Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
// Tell this Phased God Ray exactly which way it should be waving.
godRay.localAI[1] = i * 0.5f;
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
randomMineMovement.Normalize();
randomMineMovement *= Main.rand.Next(90, 121) * 0.01f;
velocity = randomMineMovement;
}
int type = ModContent.ProjectileType<DeusMine>();
int damage = npc.GetProjectileDamage(type);
float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
}
else
}
if (Vector2.Distance(player.Center, npc.Center) > 80f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center);
Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f;
Vector2 deusLaserCenter = npc.Center;
float deusLaserTargetX = player.Center.X - deusLaserCenter.X;
float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y;
float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY);
deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist;
deusLaserTargetX *= deusLaserTargetDist;
deusLaserTargetY *= deusLaserTargetDist;
deusLaserCenter.X += deusLaserTargetX * 5f;
deusLaserCenter.Y += deusLaserTargetY * 5f;
Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY);
Vector2 laserVelocity = shootDirection * deusLaserSpeed;
int type = shootGodRays ? ModContent.ProjectileType<AstralGodRay>() : ModContent.ProjectileType<AstralShot2>();
int damage = npc.GetProjectileDamage(type);
if (shootGodRays)
{
SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, npc.Center);
// Waving beams need to start offset so they cross each other neatly.
float waveSideOffset = Main.rand.NextFloat(9f, 14f);
Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset;
for (int i = -1; i <= 1; i += 2)
{
Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f);
Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
// Tell this Phased God Ray exactly which way it should be waving.
godRay.localAI[1] = i * 0.5f;
}
}
else
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center);
Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
}
}
}
}
}
}
else
{
if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f)
else
{
Vector2 velocity = Vector2.Zero;
if (movingMines)
if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f)
{
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
randomMineMovement.Normalize();
randomMineMovement *= Main.rand.Next(30, 121) * 0.01f;
velocity = randomMineMovement;
}
Vector2 velocity = Vector2.Zero;
if (movingMines)
{
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
randomMineMovement.Normalize();
randomMineMovement *= Main.rand.Next(30, 121) * 0.01f;
velocity = randomMineMovement;
}
int type = ModContent.ProjectileType<DeusMine>();
int damage = npc.GetProjectileDamage(type);
float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
int type = ModContent.ProjectileType<DeusMine>();
int damage = npc.GetProjectileDamage(type);
float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
}
}
}
}
-109
View File
@@ -1,109 +0,0 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.NPCs
{
public class CalamityFallDamageNPC : GlobalNPC
{
/// <summary>
/// How much "gravity damage" is this npc slated to recieve once it hits the ground.
/// </summary>
private int potentialEnergyDamage = 0;
/// <summary>
/// This keeps track of the last recorded velocity, so that we can dispel the potential fall damage if the enemy slows their fall down by any means
/// </summary>
private Vector2 OldVelocity = Vector2.Zero;
/// <summary>
/// This keeps track of the last recorded velocity, because terraria is dumb and we need two of them
/// </summary>
private Vector2 OlderVelocity = Vector2.Zero;
private float terminalVelocityForFullFallDamage = 0;
public int PotentialEnergyDamage
{
get
{
return potentialEnergyDamage;
}
private set
{
//You can't stack gravity damage. Higher "gravity" simply replaces the gravity damage.
potentialEnergyDamage = value == 0 ? 0 : Math.Max(potentialEnergyDamage, value);
}
}
public bool FallDamageSusceptible => PotentialEnergyDamage > 0;
public override bool InstancePerEntity => true;
public override GlobalNPC Clone(NPC npc, NPC npcClone)
{
CalamityFallDamageNPC myClone = (CalamityFallDamageNPC)base.Clone(npc, npcClone);
myClone.potentialEnergyDamage = potentialEnergyDamage;
myClone.OldVelocity = OldVelocity;
myClone.OlderVelocity = OlderVelocity;
myClone.terminalVelocityForFullFallDamage = terminalVelocityForFullFallDamage;
return myClone;
}
public override void SetDefaults(NPC npc)
{
PotentialEnergyDamage = 0;
OldVelocity = Vector2.Zero;
OlderVelocity = Vector2.Zero;
}
/// <summary>
/// Sets up a NPC to recieve fall damage when they hit the ground.
/// </summary>
/// <param name="npc">The npc to apply fall damage to</param>
/// <param name="potentialDamage">The maximum fall damage taken by the npc once they hit the ground</param>
/// <param name="terminalVelocityForFullDamage">The downwards velocity necessary to recieve the full fall damage. By default 10, the npc max fall speed</param>
public void ApplyFallDamage(NPC npc, int potentialDamage, float terminalVelocityForFullDamage = 10f)
{
//NPCs that don't collide with tiles simply don't get fall damage, lol.
if (npc.noTileCollide)
return;
PotentialEnergyDamage = potentialDamage;
OldVelocity = npc.velocity;
OlderVelocity = npc.velocity;
terminalVelocityForFullFallDamage = terminalVelocityForFullDamage;
}
public override void PostAI(NPC npc)
{
if (FallDamageSusceptible)
{
float newVerticalVelocity = npc.velocity.Y;
float oldVerticalVelocity = OldVelocity.Y;
float olderVerticalVelocity = OlderVelocity.Y;
//If the thing flies back up, cancel the fall dmg
if (newVerticalVelocity < 0 && oldVerticalVelocity >= 0)
PotentialEnergyDamage = 0;
//Same goes for if it slows its fall.
//We use 3 variables cuz there is a frame inbetween the fall and the landing where the velocity is still set to something.
if (newVerticalVelocity > 0 && olderVerticalVelocity > 0 && oldVerticalVelocity < olderVerticalVelocity)
PotentialEnergyDamage = 0;
//If the npc hit a tile/Came to a stop after falling
if (newVerticalVelocity == 0 && oldVerticalVelocity > 0)
{
//I don't think a tile check below the npc is necessary but if we find weird edge cases ill add it
npc.StrikeNPC(npc.CalculateHitInfo((int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 1), true);
PotentialEnergyDamage = 0;
}
OlderVelocity = OldVelocity;
OldVelocity = npc.velocity;
}
}
}
}
+31 -15
View File
@@ -3512,10 +3512,17 @@ namespace CalamityMod.NPCs
if (npc.type == NPCID.BloodNautilus)
return DreadnautilusAI.BuffedDreadnautilusAI(npc, Mod);
// More telegraphs
if (npc.type == NPCID.SpikedIceSlime || npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.SlimeSpiked)
return SlimeAI.BuffedSlimeAI(npc, Mod);
// Decrease the projectile velocities of several fighter enemies and make them better to fight in general
// Also limit the amount of times Vortex Larvae and Hornets can evolve
if (npc.type == NPCID.IceGolem || npc.type == NPCID.Eyezor || npc.type == NPCID.VortexRifleman ||
npc.type == NPCID.TacticalSkeleton || npc.type == NPCID.Nailhead || npc.type == NPCID.WallCreeper ||
npc.type == NPCID.BloodCrawler || npc.type == NPCID.BlackRecluse || npc.type == NPCID.JungleCreeper)
npc.type == NPCID.BloodCrawler || npc.type == NPCID.BlackRecluse || npc.type == NPCID.JungleCreeper ||
npc.type == NPCID.BoneLee || npc.type == NPCID.VortexLarva || npc.type == NPCID.VortexHornet ||
npc.type == NPCID.VortexHornetQueen)
{
return RevengeanceAndDeathAI.BuffedFighterAI(npc, Mod);
}
@@ -3539,10 +3546,18 @@ namespace CalamityMod.NPCs
if (npc.type == NPCID.Antlion)
return RevengeanceAndDeathAI.BuffedAntlionAI(npc, Mod);
// Ichor Sticker telegraph
if (npc.type == NPCID.IchorSticker)
// Corruptor and Blood Squid telegraphs
if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid)
return RevengeanceAndDeathAI.BuffedFlyingAI(npc, Mod);
// Ichor Sticker and Ice Elemental telegraphs
if (npc.type == NPCID.IchorSticker || npc.type == NPCID.IceElemental)
return RevengeanceAndDeathAI.BuffedHoveringAI(npc, Mod);
// Fungi Bulb telegraphs
if (npc.type == NPCID.FungiBulb || npc.type == NPCID.GiantFungiBulb)
return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod);
// Spider web spit telegraph
if (npc.type == NPCID.WallCreeperWall || npc.type == NPCID.BloodCrawlerWall || npc.type == NPCID.BlackRecluseWall ||
npc.type == NPCID.JungleCreeperWall)
@@ -3923,8 +3938,6 @@ namespace CalamityMod.NPCs
case NPCID.ToxicSludge:
case NPCID.IceSlime:
case NPCID.Crimslime:
case NPCID.SpikedIceSlime:
case NPCID.SpikedJungleSlime:
case NPCID.UmbrellaSlime:
case NPCID.RainbowSlime:
case NPCID.SlimeMasked:
@@ -3933,7 +3946,6 @@ namespace CalamityMod.NPCs
case NPCID.SlimeRibbonYellow:
case NPCID.SlimeRibbonGreen:
case NPCID.SlimeRibbonRed:
case NPCID.SlimeSpiked:
case NPCID.SandSlime:
case NPCID.GoldenSlime:
case NPCID.ShimmerSlime:
@@ -4050,7 +4062,6 @@ namespace CalamityMod.NPCs
case NPCID.HellArmoredBonesSpikeShield:
case NPCID.HellArmoredBonesMace:
case NPCID.HellArmoredBonesSword:
case NPCID.BoneLee:
case NPCID.Paladin:
case NPCID.SkeletonSniper:
case NPCID.SkeletonCommando:
@@ -4130,9 +4141,6 @@ namespace CalamityMod.NPCs
case NPCID.StardustSpiderBig:
case NPCID.NebulaSoldier:
case NPCID.VortexSoldier:
case NPCID.VortexLarva:
case NPCID.VortexHornet:
case NPCID.VortexHornetQueen:
case NPCID.SolarDrakomire:
case NPCID.SolarSpearman:
case NPCID.SolarSolenian:
@@ -4164,13 +4172,11 @@ namespace CalamityMod.NPCs
case NPCID.ServantofCthulhu:
case NPCID.EaterofSouls:
case NPCID.MeteorHead:
case NPCID.Corruptor:
case NPCID.Crimera:
case NPCID.Moth:
case NPCID.Parrot:
case NPCID.Bee:
case NPCID.BeeSmall:
case NPCID.BloodSquid:
case NPCID.Hornet:
case NPCID.HornetFatty:
case NPCID.HornetHoney:
@@ -4239,8 +4245,6 @@ namespace CalamityMod.NPCs
case NPCID.Snatcher:
case NPCID.Clinger:
case NPCID.AngryTrapper:
case NPCID.FungiBulb:
case NPCID.GiantFungiBulb:
return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod);
}
break;
@@ -4320,7 +4324,6 @@ namespace CalamityMod.NPCs
case NPCID.Pixie:
case NPCID.Wraith:
case NPCID.Gastropod:
case NPCID.IceElemental:
case NPCID.FloatyGross:
case NPCID.Ghost:
case NPCID.Poltergeist:
@@ -6890,6 +6893,19 @@ namespace CalamityMod.NPCs
return false;
}
if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid)
{
Texture2D texture = TextureAssets.Npc[npc.type].Value;
SpriteEffects spriteEffects = SpriteEffects.None;
if (npc.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.spriteBatch.Draw(texture, npc.Center - screenPos + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f);
return false;
}
if (npc.type == NPCID.GolemHeadFree)
{
// Draw the head as usual.
+141
View File
@@ -0,0 +1,141 @@
using System;
using CalamityMod.Projectiles.Healing;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.NPCs
{
public class CalamityTileCollisionHarmNPC : GlobalNPC
{
/// <summary>
/// How much "gravity damage" is this npc slated to recieve once it hits the ground.
/// </summary>
private int potentialEnergyDamage = 0;
/// <summary>
/// This keeps track of the last recorded velocity, so that we can dispel the potential fall damage if the enemy slows their fall down by any means
/// </summary>
private Vector2 OldVelocity = Vector2.Zero;
/// <summary>
/// This keeps track of the last recorded velocity, because terraria is dumb and we need two of them
/// </summary>
private Vector2 OlderVelocity = Vector2.Zero;
private float terminalVelocityForFullFallDamage = 0;
private bool CheckTiles = false;
private Vector2 ForcedVel = Vector2.Zero;
private bool hitVoid = false;
public int PotentialEnergyDamage
{
get
{
return potentialEnergyDamage;
}
private set
{
//You can't stack gravity damage. Higher "gravity" simply replaces the gravity damage.
potentialEnergyDamage = value == 0 ? 0 : Math.Max(potentialEnergyDamage, value);
}
}
public bool FallDamageSusceptible => PotentialEnergyDamage > 0;
public override bool InstancePerEntity => true;
public override GlobalNPC Clone(NPC npc, NPC npcClone)
{
CalamityTileCollisionHarmNPC myClone = (CalamityTileCollisionHarmNPC)base.Clone(npc, npcClone);
myClone.potentialEnergyDamage = potentialEnergyDamage;
myClone.OldVelocity = OldVelocity;
myClone.OlderVelocity = OlderVelocity;
myClone.terminalVelocityForFullFallDamage = terminalVelocityForFullFallDamage;
return myClone;
}
public override void SetDefaults(NPC npc)
{
PotentialEnergyDamage = 0;
OldVelocity = Vector2.Zero;
OlderVelocity = Vector2.Zero;
}
/// <summary>
/// Sets up a NPC to recieve fall damage when they hit the ground.
/// </summary>
/// <param name="npc">The npc to apply fall damage to</param>
/// <param name="potentialDamage">The maximum fall damage taken by the npc once they hit the ground</param>
/// <param name="terminalVelocityForFullDamage">The downwards velocity necessary to recieve the full fall damage. By default 10, the npc max fall speed</param>
/// <param name="checkTiles">Will check for tiles in the collision instead of velocity</param>
public void ApplyCollisionDamage(NPC npc, int potentialDamage, Vector2 forcedVel, float terminalVelocityForFullDamage = 10f, bool checkTiles = false)
{
//NPCs that don't collide with tiles simply don't get fall damage, lol.
if (npc.noTileCollide)
return;
PotentialEnergyDamage = potentialDamage;
OldVelocity = npc.velocity;
OlderVelocity = npc.velocity;
terminalVelocityForFullFallDamage = terminalVelocityForFullDamage;
CheckTiles = checkTiles;
ForcedVel = forcedVel;
}
public override void PostAI(NPC npc)
{
if (FallDamageSusceptible)
{
if (CheckTiles)
{
float oldVelocity = OldVelocity.Length();
if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40))
{
npc.StrikeNPC(npc.CalculateHitInfo((int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 1), true);
PotentialEnergyDamage = 0;
hitVoid = false;
}
oldVelocity = npc.velocity.Length();
npc.Center += ForcedVel;
ForcedVel *= 0.995f;
if (!WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40) && !hitVoid)
{
npc.velocity = -npc.velocity * 0.5f;
ForcedVel = -ForcedVel * 0.5f;
hitVoid = true;
}
}
else
{
float newVerticalVelocity = npc.velocity.Y;
float oldVerticalVelocity = OldVelocity.Y;
float olderVerticalVelocity = OlderVelocity.Y;
//If the thing flies back up, cancel the fall dmg
if (newVerticalVelocity < 0 && oldVerticalVelocity >= 0)
PotentialEnergyDamage = 0;
//Same goes for if it slows its fall.
//We use 3 variables cuz there is a frame inbetween the fall and the landing where the velocity is still set to something.
if (newVerticalVelocity > 0 && olderVerticalVelocity > 0 && oldVerticalVelocity < olderVerticalVelocity)
PotentialEnergyDamage = 0;
//If the npc hit a tile/Came to a stop after falling
if (newVerticalVelocity == 0 && oldVerticalVelocity > 0) //Collision.SolidCollision(npc.Center, npc.width, npc.height))
{
//I don't think a tile check below the npc is necessary but if we find weird edge cases ill add it
npc.StrikeNPC(npc.CalculateHitInfo((int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 1), true);
PotentialEnergyDamage = 0;
}
OlderVelocity = OldVelocity;
OldVelocity = npc.velocity;
}
}
}
}
}
@@ -54,6 +54,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
public const float RedDevilTridentGateValue = 375f;
public const float RedDevilTridentTelegraphTime = 30f;
public const float IceElementalFrostBlastGateValue = 180f;
public const float IceElementalFrostBlastGateValue_Death = 120f;
public const float IceElementalFrostBlastTelegraphTime = 30f;
public const float FungiBulbSporeShootGateValue = 240f;
public const float GiantFungiBulbSporeShootGateValue = 150f;
public const float GiantFungiBulbSporeShootGateValue_Rev = 120f;
public const float FungiBulbSporeTelegraphTime = 30f;
public const float CorruptorVileSpitGateValue = 180f;
public const float CorruptorVileSpitTelegraphTime = 30f;
public const float BloodSquidBloodShotGateValue = 120f;
public const float BloodSquidBloodShotTelegraphTime = 30f;
#endregion
#region Revengeance and Death Mode non-boss NPC AIs
@@ -946,104 +961,110 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
if (npcType == NPCID.VortexLarva)
{
npc.localAI[0] += 1f;
if (npc.localAI[0] >= (CalamityWorld.death ? 90f : 150f))
if (NPC.CountNPCS(NPCID.VortexHornet) < 6)
{
int centerTileX = (int)npc.Center.X / 16 - 1;
int centerTileY = (int)npc.Center.Y / 16 - 1;
if (!Collision.SolidTiles(centerTileX, centerTileX + 2, centerTileY, centerTileY + 1) && Main.netMode != NetmodeID.MultiplayerClient)
npc.localAI[0] += 1f;
if (npc.localAI[0] >= (CalamityWorld.death ? 90f : CalamityWorld.revenge ? 150f : 300f))
{
npc.Transform(NPCID.VortexHornet);
npc.life = npc.lifeMax;
npc.localAI[0] = 0f;
return false;
int centerTileX = (int)npc.Center.X / 16 - 1;
int centerTileY = (int)npc.Center.Y / 16 - 1;
if (!Collision.SolidTiles(centerTileX, centerTileX + 2, centerTileY, centerTileY + 1) && Main.netMode != NetmodeID.MultiplayerClient)
{
npc.Transform(NPCID.VortexHornet);
npc.life = npc.lifeMax;
npc.localAI[0] = 0f;
return false;
}
}
int maxValue;
if (npc.localAI[0] < (CalamityWorld.revenge ? 30f : 60f))
{
maxValue = 16;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 45f : CalamityWorld.revenge ? 60f : 120f))
{
maxValue = 8;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 90f : 180f))
{
maxValue = 4;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 75f : CalamityWorld.revenge ? 120f : 240f))
{
maxValue = 2;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 90f : CalamityWorld.revenge ? 150f : 300f))
{
maxValue = 1;
}
else
{
maxValue = 1;
}
if (Main.rand.NextBool(maxValue))
{
Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
dust.velocity = npc.DirectionFrom(dust.position) * dust.velocity.Length();
dust.position -= dust.velocity * 5f;
dust.position.X += (float)(npc.direction * 6);
dust.position.Y += 4f;
}
}
int maxValue;
if (npc.localAI[0] < 30f)
{
maxValue = 16;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 45f : 60f))
{
maxValue = 8;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 60f : 90f))
{
maxValue = 4;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 75f : 120f))
{
maxValue = 2;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 90f : 150f))
{
maxValue = 1;
}
else
{
maxValue = 1;
}
if (Main.rand.NextBool(maxValue))
{
Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
dust.velocity = npc.DirectionFrom(dust.position) * dust.velocity.Length();
dust.position -= dust.velocity * 5f;
dust.position.X += (float)(npc.direction * 6);
dust.position.Y += 4f;
}
}
if (npcType == NPCID.VortexHornet)
{
npc.localAI[0] += 1f;
npc.localAI[0] += Math.Abs(npc.velocity.X) / 2f;
if (npc.localAI[0] >= (CalamityWorld.death ? 300f : 600f) && Main.netMode != NetmodeID.MultiplayerClient)
if (NPC.CountNPCS(NPCID.VortexHornetQueen) < 3)
{
int centerTileX = (int)npc.Center.X / 16 - 2;
int centerTileY = (int)npc.Center.Y / 16 - 3;
if (!Collision.SolidTiles(centerTileX, centerTileX + 4, centerTileY, centerTileY + 4))
npc.localAI[0] += 1f;
npc.localAI[0] += Math.Abs(npc.velocity.X) / 2f;
if (npc.localAI[0] >= (CalamityWorld.death ? 300f : CalamityWorld.revenge ? 600f : 1200f) && Main.netMode != NetmodeID.MultiplayerClient)
{
npc.Transform(NPCID.VortexHornetQueen);
npc.life = npc.lifeMax;
npc.localAI[0] = 0f;
return false;
int centerTileX = (int)npc.Center.X / 16 - 2;
int centerTileY = (int)npc.Center.Y / 16 - 3;
if (!Collision.SolidTiles(centerTileX, centerTileX + 4, centerTileY, centerTileY + 4))
{
npc.Transform(NPCID.VortexHornetQueen);
npc.life = npc.lifeMax;
npc.localAI[0] = 0f;
return false;
}
}
int maxValue2;
if (npc.localAI[0] < (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 120f : 240f))
{
maxValue2 = 32;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 120f : CalamityWorld.revenge ? 240f : 480f))
{
maxValue2 = 16;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 180f : CalamityWorld.revenge ? 360f : 720f))
{
maxValue2 = 6;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 240f : CalamityWorld.revenge ? 480f : 960f))
{
maxValue2 = 2;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 300f : CalamityWorld.revenge ? 600f : 1200f))
{
maxValue2 = 1;
}
else
{
maxValue2 = 1;
}
if (Main.rand.NextBool(maxValue2))
{
Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
}
}
int maxValue2;
if (npc.localAI[0] < (CalamityWorld.death ? 60f : 120f))
{
maxValue2 = 32;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 120f : 240f))
{
maxValue2 = 16;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 180f : 360f))
{
maxValue2 = 6;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 240f : 480f))
{
maxValue2 = 2;
}
else if (npc.localAI[0] < (CalamityWorld.death ? 300f : 600f))
{
maxValue2 = 1;
}
else
{
maxValue2 = 1;
}
if (Main.rand.NextBool(maxValue2))
{
Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)];
dust.noGravity = true;
dust.scale = 1f;
dust.noLight = true;
}
}
@@ -1653,7 +1674,7 @@ PrepareToShoot:
}
else if (npcType == NPCID.Crab || npcType == NPCID.SeaSnail || npcType == NPCID.VortexLarva)
{
FighterRunningAI(npc, CalamityWorld.death ? 4f : 1f, 0.06f, 0.7f);
FighterRunningAI(npc, CalamityWorld.death ? 4f : CalamityWorld.revenge ? 1f : 0.5f, CalamityWorld.revenge ? 0.06f : 0.05f, 0.7f);
}
else if (npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy)
{
@@ -1671,7 +1692,7 @@ PrepareToShoot:
}
else if (npcType == NPCID.BoneLee)
{
FighterRunningAI(npc, CalamityWorld.death ? 10f : 7f, 0.3f, 0.7f);
FighterRunningAI(npc, CalamityWorld.death ? 7f : CalamityWorld.revenge ? 6f : 5f, CalamityWorld.revenge ? 0.3f : 0.2f, 0.7f);
}
else if (npcType == NPCID.IceGolem)
{
@@ -1686,14 +1707,10 @@ PrepareToShoot:
if (npc.ai[2] > 0f)
{
if (npc.velocity.Y == 0f)
{
npc.velocity.X *= 0.8f;
}
}
else
{
FighterRunningAI(npc, CalamityWorld.death ? 5f : 3.5f, 0.2f, 0.8f);
}
}
else if (npcType == NPCID.Butcher)
{
@@ -1811,8 +1828,11 @@ PrepareToShoot:
acceleration = 0.15f;
turnMultiplier = 0.98f;
}
maxVelocity *= 1.25f;
acceleration *= 1.25f;
if (CalamityWorld.revenge)
{
maxVelocity *= 1.25f;
acceleration *= 1.25f;
}
if (CalamityWorld.death)
{
maxVelocity *= 1.25f;
@@ -1939,7 +1959,8 @@ PrepareToShoot:
{
velocityMax *= 1f + (1f - npc.scale);
}
velocityMax *= 1.25f;
if (CalamityWorld.revenge)
velocityMax *= 1.25f;
if (CalamityWorld.death)
velocityMax *= 1.25f;
FighterRunningAI(npc, velocityMax, 0.09f, 0.8f, true, 0.8f);
@@ -2151,21 +2172,21 @@ PrepareToShoot:
{
npc.velocity.X *= 0.98f;
}
if (playerDistX < -20f && npc.velocity.X > -8f)
if (playerDistX < -20f && npc.velocity.X > -(CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X -= 0.025f;
npc.velocity.X -= CalamityWorld.revenge ? 0.025f : 0.015f;
}
else if (playerDistX > 20f && npc.velocity.X < 8f)
else if (playerDistX > 20f && npc.velocity.X < (CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X += 0.025f;
npc.velocity.X += CalamityWorld.revenge ? 0.025f : 0.015f;
}
if (npc.velocity.X > 8f)
if (npc.velocity.X > (CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X = 8f;
npc.velocity.X = CalamityWorld.revenge ? 8f : 6f;
}
if (npc.velocity.X < -8f)
if (npc.velocity.X < -(CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X = -8f;
npc.velocity.X = -(CalamityWorld.revenge ? 8f : 6f);
}
if (playerDistY < -20f && npc.velocity.Y > 0f)
{
@@ -2175,13 +2196,13 @@ PrepareToShoot:
{
npc.velocity.Y *= 0.98f;
}
if (playerDistY < -20f && npc.velocity.Y > -8f)
if (playerDistY < -20f && npc.velocity.Y > -(CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.Y -= 0.25f;
npc.velocity.Y -= CalamityWorld.revenge ? 0.25f : 0.15f;
}
else if (playerDistY > 20f && npc.velocity.Y < 8f)
else if (playerDistY > 20f && npc.velocity.Y < (CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.Y += 0.25f;
npc.velocity.Y += CalamityWorld.revenge ? 0.25f : 0.15f;
}
}
foreach (NPC n in Main.ActiveNPCs)
@@ -2209,7 +2230,7 @@ PrepareToShoot:
}
else if (Main.player[npc.target].Center.Y + 100f < npc.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
npc.velocity.Y = -7f;
npc.velocity.Y = -(CalamityWorld.revenge ? 7f : 5f);
npc.ai[2] = 1f;
}
}
@@ -2229,7 +2250,7 @@ PrepareToShoot:
npc.spriteDirection = npc.direction;
if (Collision.CanHit(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
{
float distanceToLocationX = Main.player[npc.target].Center.X - (float)(npc.direction * 450) - npc.Center.X;
float distanceToLocationX = Main.player[npc.target].Center.X - (float)(npc.direction * (CalamityWorld.revenge ? 450 : 300)) - npc.Center.X;
if (distanceToLocationX < 40f && npc.velocity.X > 0f)
{
npc.velocity.X *= 0.98f;
@@ -2238,27 +2259,27 @@ PrepareToShoot:
{
npc.velocity.X *= 0.98f;
}
if (distanceToLocationX < 40f && npc.velocity.X > -7f)
if (distanceToLocationX < 40f && npc.velocity.X > -(CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X -= 0.25f;
npc.velocity.X -= CalamityWorld.revenge ? 0.25f : 0.2f;
}
else if (distanceToLocationX > 40f && npc.velocity.X < 7f)
else if (distanceToLocationX > 40f && npc.velocity.X < (CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X += 0.25f;
npc.velocity.X += CalamityWorld.revenge ? 0.25f : 0.2f;
}
if (npc.velocity.X > 8f)
if (npc.velocity.X > (CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X = 8f;
npc.velocity.X = CalamityWorld.revenge ? 8f : 6f;
}
if (npc.velocity.X < -8f)
if (npc.velocity.X < -(CalamityWorld.revenge ? 8f : 6f))
{
npc.velocity.X = -8f;
npc.velocity.X = -(CalamityWorld.revenge ? 8f : 6f);
}
}
}
else if (Main.player[npc.target].Center.Y + 100f < npc.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
npc.velocity.Y = -8f;
npc.velocity.Y = -(CalamityWorld.revenge ? 8f : 6f);
}
foreach (NPC n in Main.ActiveNPCs)
{
@@ -2642,7 +2663,10 @@ PrepareToShoot:
attackTimeMax = 8;
}
}
attackTimeMax = (int)(attackTimeMax * 0.75);
if (CalamityWorld.revenge)
attackTimeMax = (int)(attackTimeMax * 0.75);
int modifiedAttackTime = attackTimeMax / 2;
if (npcType == NPCID.NebulaSoldier)
{
@@ -2721,7 +2745,10 @@ PrepareToShoot:
{
projSpeed = CalamityWorld.death ? 4f : 7f;
}
projSpeed *= 1.25f;
if (CalamityWorld.revenge)
projSpeed *= 1.25f;
Vector2 spawnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
if (npcType == NPCID.GreekSkeleton)
{
@@ -2750,6 +2777,7 @@ PrepareToShoot:
if (npcType == NPCID.VortexHornetQueen)
{
spawnPosition += new Vector2((float)(npc.spriteDirection * 2), -12f);
projSpeed = CalamityWorld.death ? 6f : CalamityWorld.revenge ? 9f : 7f;
}
float distX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - spawnPosition.X;
float projOffset = Math.Abs(distX) * 0.1f;
@@ -3130,8 +3158,17 @@ PrepareToShoot:
maxVelocity = 2f;
acceleration = 0.5f;
}
maxVelocity *= 1.5f;
acceleration *= 1.5f;
else if (npc.type == NPCID.VortexHornetQueen)
{
maxVelocity = 4f;
acceleration = 0.6f;
decelerationFactor = 0.95f;
}
if (CalamityWorld.revenge)
{
maxVelocity *= 1.5f;
acceleration *= 1.5f;
}
bool forceDeceleration = false;
if ((npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner) && Vector2.Distance(npc.Center, Main.player[npc.target].Center) < 300f && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
{
@@ -3458,16 +3495,16 @@ PrepareToShoot:
{
npc.velocity.Y *= 1.1f;
}
if (npcType == NPCID.BoneLee && npc.velocity.Y == 0f && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 150f && Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 50f && ((npc.direction > 0 && npc.velocity.X >= 1f) || (npc.direction < 0 && npc.velocity.X <= -1f)))
if (npcType == NPCID.BoneLee && npc.velocity.Y == 0f && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 150f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 50f && ((npc.direction > 0 && npc.velocity.X >= 1f) || (npc.direction < 0 && npc.velocity.X <= -1f)))
{
npc.velocity.X = (float)(9 * npc.direction);
npc.velocity.Y = -5f;
npc.velocity.X = (float)((CalamityWorld.death ? 9 : CalamityWorld.revenge ? 8 : 7) * npc.direction);
npc.velocity.Y = -(CalamityWorld.death ? 4f : CalamityWorld.revenge ? 3.5f : 3f);
npc.netUpdate = true;
}
if (npcType == NPCID.BoneLee && npc.velocity.Y < 0f)
{
npc.velocity.X *= 1.25f;
npc.velocity.Y *= 1.15f;
npc.velocity.X *= CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1.15f : 1.1f;
npc.velocity.Y *= CalamityWorld.death ? 1.1f : CalamityWorld.revenge ? 1.075f : 1.05f;
}
if (npcType == NPCID.Butcher && npc.velocity.Y < 0f)
{
@@ -3712,8 +3749,12 @@ PrepareToShoot:
}
}
maxVelocity *= 1.25f;
acceleration *= 1.25f;
if (CalamityWorld.revenge)
{
maxVelocity *= 1.25f;
acceleration *= 1.25f;
}
if (CalamityWorld.death && deathModeVelocityBuff)
{
maxVelocity *= 1.25f;
@@ -3754,14 +3795,14 @@ PrepareToShoot:
{
npc.ai[0] += 1f;
if (npc.ai[0] > 0f)
npc.velocity.Y += 0.03f;
npc.velocity.Y += CalamityWorld.revenge ? 0.03f : 0.023f;
else
npc.velocity.Y -= 0.03f;
npc.velocity.Y -= CalamityWorld.revenge ? 0.03f : 0.023f;
if (npc.ai[0] < -100f || npc.ai[0] > 100f)
npc.velocity.X += 0.03f;
npc.velocity.X += CalamityWorld.revenge ? 0.03f : 0.023f;
else
npc.velocity.X -= 0.03f;
npc.velocity.X -= CalamityWorld.revenge ? 0.03f : 0.023f;
if (npc.ai[0] > 200f)
npc.ai[0] = -200f;
@@ -3769,8 +3810,8 @@ PrepareToShoot:
if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid))
{
npc.velocity.X += targetXDist * 0.009f;
npc.velocity.Y += targetYDist * 0.009f;
npc.velocity.X += targetXDist * (CalamityWorld.revenge ? 0.009f : 0.007f);
npc.velocity.Y += targetYDist * (CalamityWorld.revenge ? 0.009f : 0.007f);
}
// Master Mode Queen Bee Bees
@@ -3955,9 +3996,9 @@ PrepareToShoot:
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.95f;
npc.velocity.Y -= 0.4f;
if (npc.velocity.Y < -3f)
npc.velocity.Y = -3f;
npc.velocity.Y -= CalamityWorld.revenge ? 0.4f : 0.3f;
if (npc.velocity.Y < -(CalamityWorld.revenge ? 3f : 2f))
npc.velocity.Y = -(CalamityWorld.revenge ? 3f : 2f);
}
if (npc.type == NPCID.Moth && npc.wet)
@@ -4071,26 +4112,34 @@ PrepareToShoot:
if (npc.type == NPCID.Corruptor)
{
if (npc.justHit)
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
npc.localAI[0] = 0f;
npc.localAI[0] += 1f;
if (npc.localAI[0] == 180f)
if (npc.localAI[0] == CorruptorVileSpitGateValue)
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255);
NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), NPCID.VileSpit);
npc.localAI[0] = 0f;
}
if (npc.localAI[0] > CorruptorVileSpitGateValue - CorruptorVileSpitTelegraphTime)
{
Vector2 dustCenter = npc.Center + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 25f + Main.rand.NextVector2CircularEdge(3f, 3f);
Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f);
dust.noGravity = true;
dust.velocity *= 0.3f;
}
}
if (npc.type == NPCID.BloodSquid)
{
if (npc.justHit)
if (npc.justHit || targetData.Type == 0 || !Collision.CanHit(npc, targetData))
npc.localAI[0] = 0f;
npc.localAI[0] += 1f;
if (npc.localAI[0] >= 120f)
if (npc.localAI[0] >= BloodSquidBloodShotGateValue)
{
if (targetData.Type != 0 && Collision.CanHit(npc, targetData))
{
@@ -4109,10 +4158,19 @@ PrepareToShoot:
}
}
else
npc.localAI[0] = 50f;
npc.localAI[0] = 0f;
}
else
npc.localAI[0] = 50f;
npc.localAI[0] = 0f;
}
if (npc.localAI[0] > BloodSquidBloodShotGateValue - BloodSquidBloodShotTelegraphTime)
{
Vector2 dustCenter = npc.Center + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 25f + Main.rand.NextVector2CircularEdge(5f, 5f);
Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, DustID.Blood, 0f, 0f, 100, default, 3f);
dust.fadeIn = 1.7f;
dust.noGravity = true;
dust.velocity *= 0f;
}
}
}
@@ -5576,9 +5634,7 @@ PrepareToShoot:
public static bool BuffedPlantAI(NPC npc, Mod mod)
{
if (npc.ai[0] < 0f || npc.ai[0] >= (float)Main.maxTilesX || npc.ai[1] < 0f || npc.ai[1] >= (float)Main.maxTilesX)
{
return false;
}
if (!Main.tile[(int)npc.ai[0], (int)npc.ai[1]].HasTile)
{
@@ -5590,7 +5646,7 @@ PrepareToShoot:
FixExploitManEaters.ProtectSpot((int)npc.ai[0], (int)npc.ai[1]);
npc.TargetClosest(true);
npc.TargetClosest();
float acceleration = 0.035f;
float minDistance = 250f;
@@ -5611,7 +5667,7 @@ PrepareToShoot:
break;
case NPCID.GiantFungiBulb:
acceleration = 0.15f;
minDistance = 450f;
minDistance = CalamityWorld.revenge ? 450f : 350f;
break;
}
@@ -5629,11 +5685,12 @@ PrepareToShoot:
if (npc.ai[2] > 300f)
{
minDistance *= 1.3f;
maxVelocity += 2f;
if (CalamityWorld.revenge)
maxVelocity += 2f;
if (npc.ai[2] > 450f)
{
npc.ai[2] = 0f;
}
}
Vector2 anchorPosition = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f);
@@ -5644,37 +5701,30 @@ PrepareToShoot:
float normalizedMagnitude = minDistance / distanceMagnitude;
distanceVector *= normalizedMagnitude;
}
if (npc.position.X < npc.ai[0] * 16f + 8f + distanceVector.X)
{
npc.velocity.X += acceleration;
if (npc.velocity.X < 0f && distanceVector.X > 0f)
{
npc.velocity.X += acceleration * 1.5f;
}
}
else if (npc.position.X > npc.ai[0] * 16f + 8f + distanceVector.X)
{
npc.velocity.X -= acceleration;
if (npc.velocity.X > 0f && distanceVector.X < 0f)
{
npc.velocity.X -= acceleration * 1.5f;
}
}
if (npc.position.Y < npc.ai[1] * 16f + 8f + distanceVector.Y)
{
npc.velocity.Y += acceleration;
if (npc.velocity.Y < 0f && distanceVector.Y > 0f)
{
npc.velocity.Y += acceleration * 1.5f;
}
}
else if (npc.position.Y > npc.ai[1] * 16f + 8f + distanceVector.Y)
{
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > 0f && distanceVector.Y < 0f)
{
npc.velocity.Y -= acceleration * 1.5f;
}
}
npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-maxVelocity), new Vector2(maxVelocity));
@@ -5694,26 +5744,32 @@ PrepareToShoot:
npc.netUpdate = true;
npc.velocity.X = npc.oldVelocity.X * -0.7f;
if (npc.velocity.X > 0f && npc.velocity.X < 2f)
{
npc.velocity.X = 2f;
}
if (npc.velocity.X < 0f && npc.velocity.X > -2f)
{
npc.velocity.X = -2f;
}
}
if (npc.collideY)
{
npc.netUpdate = true;
npc.velocity.Y = npc.oldVelocity.Y * -0.7f;
if (npc.velocity.Y > 0f && npc.velocity.Y < 2f)
{
npc.velocity.Y = 2f;
}
if (npc.velocity.Y < 0f && npc.velocity.Y > -2f)
{
npc.velocity.Y = -2f;
}
if ((npc.type == NPCID.GiantFungiBulb || npc.type == NPCID.FungiBulb) && !Main.player[npc.target].DeadOrGhost)
{
if (npc.localAI[0] > ((npc.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? GiantFungiBulbSporeShootGateValue_Rev : GiantFungiBulbSporeShootGateValue) : FungiBulbSporeShootGateValue) - FungiBulbSporeTelegraphTime))
{
Vector2 dustCenter = npc.Center + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * (npc.type == NPCID.GiantFungiBulb ? 20f : 12f) + Main.rand.NextVector2CircularEdge(5f, 5f);
Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, DustID.BlueTorch, 0f, 0f, 100, default, 3f);
dust.noGravity = true;
dust.velocity *= 0f;
}
if (npc.localAI[0] == (npc.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? GiantFungiBulbSporeShootGateValue_Rev : GiantFungiBulbSporeShootGateValue) : FungiBulbSporeShootGateValue) - 1)
SoundEngine.PlaySound(SoundID.Item17, npc.Center);
}
if (Main.netMode != NetmodeID.MultiplayerClient)
@@ -5732,45 +5788,40 @@ PrepareToShoot:
int type = ProjectileID.CursedFlameHostile;
Vector2 flameVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 12f;
int flame = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, flameVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
int flame = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, flameVelocity, type, damage, 0f, Main.myPlayer);
Main.projectile[flame].timeLeft = 180;
npc.localAI[0] = 0f;
}
else
{
npc.localAI[0] = ClingerShootGateValue_Rev - 15f;
}
}
}
if ((npc.type == NPCID.GiantFungiBulb || npc.type == NPCID.FungiBulb) && !Main.player[npc.target].DeadOrGhost)
{
if (npc.justHit)
if (npc.justHit || Collision.SolidCollision(npc.position, npc.width, npc.height) || !Collision.CanHit(npc, Main.player[npc.target]))
npc.localAI[0] = 0f;
npc.localAI[0] += 1f;
float sporeSpawnGateValue = npc.type == NPCID.GiantFungiBulb ? 120f : 240f;
float sporeSpawnGateValue = npc.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? GiantFungiBulbSporeShootGateValue_Rev : GiantFungiBulbSporeShootGateValue) : FungiBulbSporeShootGateValue;
if (npc.localAI[0] >= sporeSpawnGateValue)
{
if (!Collision.SolidCollision(npc.position, npc.width, npc.height))
if (!Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc, Main.player[npc.target]))
{
float speed = npc.type == NPCID.GiantFungiBulb ? 16f : 8f;
float speed = npc.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? 16f : 14f) : 8f;
distanceVector.X = Main.player[npc.target].Center.X - npc.Center.X;
float absoluteYDistance = Math.Abs(distanceVector.X * 0.1f);
if (Main.player[npc.target].Center.Y - npc.Center.Y > 0f)
{
absoluteYDistance = 0f;
}
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed;
int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore);
Main.npc[idx].velocity = velocity;
Main.npc[idx].netUpdate = true;
npc.localAI[0] = 0f;
return false;
}
npc.localAI[0] = 120f;
npc.localAI[0] = 0f;
}
}
}
@@ -6005,7 +6056,7 @@ PrepareToShoot:
// Emit feather dust from center when about to shoot
if (npc.ai[0] > HarpyFeatherGateValue - HarpyFeatherTelegraphTime)
{
Dust dust = Dust.NewDustDirect(npc.Center + Main.rand.NextVector2CircularEdge(5f, 5f), 1, 1, 42, 0f, 0f, 0, default, 1.5f);
Dust dust = Dust.NewDustDirect(npc.Center + Main.rand.NextVector2CircularEdge(5f, 5f), 1, 1, 172, 0f, 0f, 0, default, 1.5f);
dust.noGravity = true;
dust.velocity *= 0f;
}
@@ -7048,7 +7099,7 @@ PrepareToShoot:
if (Main.rand.NextBool(3))
{
int iceEleDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Frost, 0f, 0f, 200, default(Color), 1f);
int iceEleDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Frost, 0f, 0f, 200, default, 1f);
Dust dust = Main.dust[iceEleDust];
dust.velocity *= 0.3f;
Main.dust[iceEleDust].noGravity = true;
@@ -7065,56 +7116,41 @@ PrepareToShoot:
iceElementalTargetY *= iceElementalTargetDist;
if (iceElementalTargetX > 0f)
{
npc.direction = 1;
}
else
{
npc.direction = -1;
}
npc.spriteDirection = npc.direction;
if (npc.direction < 0)
{
npc.rotation = (float)Math.Atan2((double)(-(double)iceElementalTargetY), (double)(-(double)iceElementalTargetX));
}
else
{
npc.rotation = (float)Math.Atan2((double)iceElementalTargetY, (double)iceElementalTargetX);
}
if (npc.justHit)
{
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
npc.localAI[1] = 0f;
npc.ai[3] = 0f;
}
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 16f)
{
int dmg = 45;
int projType = ProjectileID.FrostBlastHostile;
Projectile.NewProjectile(npc.GetSource_FromAI(), iceElementalPosition.X, iceElementalPosition.Y, iceElementalTargetX, iceElementalTargetY, projType, dmg, 0f, Main.myPlayer, 0f, 0f);
}
tileCheckLoopAmt = 15;
if (npc.ai[3] > 0f)
// Emit frost dust when about to fire
if (npc.localAI[1] > (CalamityWorld.death ? IceElementalFrostBlastGateValue_Death : IceElementalFrostBlastGateValue) - IceElementalFrostBlastTelegraphTime)
{
npc.ai[3] += 1f;
if (npc.ai[3] >= 64f)
{
npc.ai[3] = 0f;
}
Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Frost, 0f, 0f, 200, default, 2f);
dust.noGravity = true;
dust.velocity *= 0f;
}
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 0f)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[1] += 1f;
if (npc.localAI[1] > (CalamityWorld.death ? 60f : 120f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
if (npc.localAI[1] > (CalamityWorld.death ? IceElementalFrostBlastGateValue_Death : IceElementalFrostBlastGateValue) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
npc.localAI[1] = 0f;
npc.ai[3] = 1f;
int dmg = 45;
int projType = ProjectileID.FrostBlastHostile;
Projectile.NewProjectile(npc.GetSource_FromAI(), iceElementalPosition.X, iceElementalPosition.Y, iceElementalTargetX, iceElementalTargetY, projType, dmg, 0f, Main.myPlayer);
npc.netUpdate = true;
}
}
@@ -7216,34 +7252,28 @@ PrepareToShoot:
{
hoverDownwards = true;
if (npc.type == NPCID.IchorSticker)
npc.velocity.Y += 3f;
npc.velocity.Y += (CalamityWorld.revenge ? 3f : 2f);
}
if (hoverDownwards)
{
if (npc.type == NPCID.Pixie || npc.type == NPCID.IceElemental)
{
npc.velocity.Y = npc.velocity.Y + 0.3f;
if (npc.velocity.Y > 3f)
{
npc.velocity.Y = 3f;
}
npc.velocity.Y += CalamityWorld.revenge ? 0.3f : 0.2f;
if (npc.velocity.Y > (CalamityWorld.revenge ? 3f : 2f))
npc.velocity.Y = CalamityWorld.revenge ? 3f : 2f;
}
else if (npc.type == NPCID.Drippler)
{
npc.velocity.Y = npc.velocity.Y + 0.05f;
npc.velocity.Y += 0.05f;
if (npc.velocity.Y > 1f)
{
npc.velocity.Y = 1f;
}
}
else
{
npc.velocity.Y = npc.velocity.Y + 0.15f;
npc.velocity.Y += 0.15f;
if (npc.velocity.Y > 4f)
{
npc.velocity.Y = 4f;
}
}
}
else
@@ -7251,30 +7281,20 @@ PrepareToShoot:
if (npc.type == NPCID.Pixie || npc.type == NPCID.IceElemental)
{
if ((npc.directionY < 0 && npc.velocity.Y > 0f) | canOpenDoor)
{
npc.velocity.Y = npc.velocity.Y - 0.3f;
}
npc.velocity.Y -= CalamityWorld.revenge ? 0.3f : 0.2f;
}
else if (npc.type == NPCID.Drippler)
{
if ((npc.directionY < 0 && npc.velocity.Y > 0f) | canOpenDoor)
{
npc.velocity.Y = npc.velocity.Y - 0.1f;
}
npc.velocity.Y -= 0.1f;
if (npc.velocity.Y < -1f)
{
npc.velocity.Y = -1f;
}
}
else if (npc.directionY < 0 && npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y - 0.15f;
}
npc.velocity.Y -= 0.15f;
if (npc.velocity.Y < -5.5f)
{
npc.velocity.Y = -5.5f;
}
if (npc.velocity.Y < -(CalamityWorld.revenge ? 5.5f : 4f))
npc.velocity.Y = -(CalamityWorld.revenge ? 5.5f : 4f);
}
if (npc.type == NPCID.Pixie && npc.wet)
@@ -7353,87 +7373,60 @@ PrepareToShoot:
if (npc.direction == -1 && npc.velocity.X > -maxHoverVel)
{
npc.velocity.X = npc.velocity.X - 0.15f;
npc.velocity.X -= CalamityWorld.revenge ? 0.15f : 0.1f;
if (npc.velocity.X > maxHoverVel)
{
npc.velocity.X = npc.velocity.X - 0.15f;
}
npc.velocity.X -= CalamityWorld.revenge ? 0.15f : 0.1f;
else if (npc.velocity.X > 0f)
{
npc.velocity.X = npc.velocity.X + 0.1f;
}
npc.velocity.X += CalamityWorld.revenge ? 0.1f : 0.05f;
if (npc.velocity.X < -maxHoverVel)
{
npc.velocity.X = -maxHoverVel;
}
}
else if (npc.direction == 1 && npc.velocity.X < maxHoverVel)
{
npc.velocity.X = npc.velocity.X + 0.15f;
npc.velocity.X += CalamityWorld.revenge ? 0.15f : 0.1f;
if (npc.velocity.X < -maxHoverVel)
{
npc.velocity.X = npc.velocity.X + 0.15f;
}
npc.velocity.X += CalamityWorld.revenge ? 0.15f : 0.1f;
else if (npc.velocity.X < 0f)
{
npc.velocity.X = npc.velocity.X - 0.1f;
}
npc.velocity.X -= CalamityWorld.revenge ? 0.1f : 0.05f;
if (npc.velocity.X > maxHoverVel)
{
npc.velocity.X = maxHoverVel;
}
}
if (npc.type == NPCID.Drippler)
{
maxHoverVel = 1.5f;
}
else
{
maxHoverVel = 2.5f;
}
maxHoverVel = CalamityWorld.revenge ? 2.5f : 1.5f;
if (CalamityWorld.death)
{
maxHoverVel *= 1.25f;
}
if (npc.directionY == -1 && npc.velocity.Y > -maxHoverVel)
{
npc.velocity.Y = npc.velocity.Y - 0.06f;
npc.velocity.Y -= CalamityWorld.revenge ? 0.06f : 0.04f;
if (npc.velocity.Y > maxHoverVel)
{
npc.velocity.Y = npc.velocity.Y - 0.1f;
}
npc.velocity.Y -= CalamityWorld.revenge ? 0.1f : 0.05f;
else if (npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y + 0.05f;
}
npc.velocity.Y += CalamityWorld.revenge ? 0.05f : 0.03f;
if (npc.velocity.Y < -maxHoverVel)
{
npc.velocity.Y = -maxHoverVel;
}
}
else if (npc.directionY == 1 && npc.velocity.Y < maxHoverVel)
{
npc.velocity.Y = npc.velocity.Y + 0.06f;
npc.velocity.Y += CalamityWorld.revenge ? 0.06f : 0.04f;
if (npc.velocity.Y < -maxHoverVel)
{
npc.velocity.Y = npc.velocity.Y + 0.1f;
}
npc.velocity.Y += CalamityWorld.revenge ? 0.1f : 0.05f;
else if (npc.velocity.Y < 0f)
{
npc.velocity.Y = npc.velocity.Y - 0.05f;
}
npc.velocity.Y -= CalamityWorld.revenge ? 0.05f : 0.03f;
if (npc.velocity.Y > maxHoverVel)
{
npc.velocity.Y = maxHoverVel;
}
}
if (npc.type == NPCID.Gastropod)
{
Lighting.AddLight((int)npc.position.X / 16, (int)npc.position.Y / 16, 0.4f, 0f, 0.25f);
}
return false;
}
@@ -12,6 +12,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
{
public static class SlimeAI
{
public const float SpikedSlimeSpikeBarrageGateValue = 30f;
public const float SpikedSlimeSpikeGateValue = 50f;
public const float SpikedSlimeSpikeTelegraphTime = 30f;
public static void ChooseRandomItem(out int dropItem)
{
// Use a fallback of -1.
@@ -101,7 +105,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
if (npc.type == NPCID.SpikedJungleSlime)
{
projectileShootType = ProjectileID.JungleSpike;
projectileShootSpeedFactor *= 0.6f;
projectileShootSpeedFactor *= 1.5f;
}
ref float jumpDelay = ref npc.ai[0];
@@ -180,7 +184,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
if (Main.netMode != NetmodeID.MultiplayerClient && projectileShootCountdown <= 0f)
{
var source = npc.GetSource_FromAI();
if (distanceFromTarget < 120f)
if (Main.expertMode && distanceFromTarget < 120f)
{
for (int i = 0; i < 5; i++)
{
@@ -188,25 +192,60 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
spikeShootVelocity *= Main.rand.NextVector2Square(0.75f, 1.25f);
spikeShootVelocity.Normalize();
spikeShootVelocity *= Main.rand.NextFloat(3.5f, 4.5f) * projectileShootSpeedFactor;
int proj = Projectile.NewProjectile(source, npc.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f);
int proj = Projectile.NewProjectile(source, npc.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer);
if (CalamityWorld.death)
Main.projectile[proj].extraUpdates += 1;
projectileShootCountdown = 30f;
projectileShootCountdown = SpikedSlimeSpikeBarrageGateValue;
}
}
else
{
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * Main.rand.NextFloat(200f)) * projectileShootSpeedFactor * (CalamityWorld.death ? 4f : 6f);
int proj = Projectile.NewProjectile(source, npc.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f);
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * (npc.type == NPCID.SpikedJungleSlime ? 10f : 100f)) * projectileShootSpeedFactor * (CalamityWorld.death ? 3.25f : CalamityWorld.revenge ? 5.5f : 4.5f);
int proj = Projectile.NewProjectile(source, npc.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer);
if (CalamityWorld.death)
{
Main.projectile[proj].extraUpdates += 1;
Main.projectile[proj].timeLeft = 1200;
}
projectileShootCountdown = 50f;
projectileShootCountdown = SpikedSlimeSpikeGateValue;
}
}
}
else
projectileShootCountdown = SpikedSlimeSpikeGateValue;
if (npc.type == NPCID.SpikedIceSlime)
{
// Emit dust from center when about to shoot
if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime)
{
Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 135, 0f, 0f, 100, default, 3f);
dust.noGravity = true;
dust.velocity *= 0f;
}
}
else if (npc.type == NPCID.SpikedJungleSlime)
{
// Emit dust from center when about to shoot
if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime)
{
Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 61, 0f, 0f, 0, default, 3f);
dust.noGravity = true;
dust.velocity *= 0f;
}
}
else if (npc.type == NPCID.SlimeSpiked)
{
// Emit dust from center when about to shoot
if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime)
{
Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 4, 0f, 0f, 0, new Color(78, 136, 255, 150), 1.5f);
dust.noGravity = true;
dust.velocity *= 0f;
}
}
}
// Decrement the target reset counter.
@@ -360,6 +399,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
npc.velocity.X *= 1.2f;
npc.velocity.Y *= 1.3f;
}
npc.netUpdate = true;
}
@@ -367,7 +407,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
{
// Move up if tiles are hit on the Y axis.
if (npc.collideY)
npc.velocity.Y = -4f;
npc.velocity.Y = -(CalamityWorld.death ? 4f : CalamityWorld.revenge ? 3f : 2f);
if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X)
{
@@ -378,8 +418,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
if (npc.velocity.Y > 0f)
npc.ai[3] = npc.position.X;
float riseSpeed = 0.6f;
float maxRiseSpeed = 6f;
float riseSpeed = CalamityWorld.death ? 0.6f : CalamityWorld.revenge ? 0.55f : 0.5f;
float maxRiseSpeed = CalamityWorld.death ? 6f : CalamityWorld.revenge ? 5f : 4f;
if (isLavaSlime)
{
riseSpeed += 0.2f;
@@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using ReLogic.Content;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.BaseProjectiles
{
public abstract class BaseCustomUseStyleProjectile : ModProjectile
{
public override void SetDefaults()
{
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.timeLeft = Owner.HeldItem.useAnimation + 1;
}
#region Fields
/// <summary>
/// REQUIRED. The item ID that this projectile is linked to.
/// </summary>
public virtual int AssignedItemID => ItemID.None;
/// <summary>
/// The offset in pixels of the weapon from the projectile owner's center. This works even while using AbsolutePosition.
/// </summary>
public Vector2 Offset = Vector2.Zero;
/// <summary>
/// The Player that is using the projectile.
/// </summary>
public virtual Player Owner => Main.player[Projectile.owner];
/// <summary>
/// The amount of pixels out the center of the projectile's hitbox is.
/// </summary>
public virtual float HitboxOutset => 30;
/// <summary>
/// The projectile's hitbox size in pixels.
/// </summary>
public virtual Vector2 HitboxSize => new Vector2(30, 30);
/// <summary>
/// The number of animations that this projectile has gone through. Useful for things like swing combos.
/// </summary>
public int NumberOfAnimations = 0;
public float Animation = 0;
/// <summary>
/// If true, flips the sprite with a 45-degree sword tilt in mind.
/// </summary>
public bool FlipAsSword = false;
/// <summary>
/// The offset in radians of the weapon's rotation from its current rotation.
/// </summary>
public float RotationOffset = 0f;
/// <summary>
/// The offset in radians of the rotation of the player's front arm.
/// </summary>
public float ArmRotationOffset = 0f;
/// <summary>
/// The offset in radians of the rotation of the player's back arm.
/// </summary>
public float ArmRotationOffsetBack = 0f;
/// <summary>
/// The amount of animation frames the projectile has in a vertical sheet.
/// </summary>
public virtual int FrameCount => 1;
/// <summary>
/// The individual frame currently being drawn in a vertical sheet.
/// </summary>
public int Frame = 0;
/// <summary>
/// The origin of the sprite when drawn on your character.
/// </summary>
/// <returns></returns>
public virtual Vector2 SpriteOrigin => Projectile.Size / 2;
/// <summary>
/// Helper method for getting the rotation of the sprite plus RotationOffset, without having to make your own local variable every time.
/// </summary>
/// <returns></returns>
public float FinalRotation => Projectile.rotation + RotationOffset;
/// <summary>
/// Useful for flipping the sprite horizontally or vertically in case of holdouts needing to be flipped based on player direction.
/// </summary>
public SpriteEffects spriteEffects = SpriteEffects.None;
/// <summary>
/// Rotation offset for the hitbox that doesn't affect the sprite.
/// Useful for if you have, for instance, a sword sprite at a 45 degree angle, and need that to reflect on the hitbox.
/// </summary>
/// <returns></returns>
public virtual float HitboxRotationOffset => 0f;
/// <summary>
/// Whether or not the projectile can hit enemies at the current frame.
/// Useful for wind-up animations where you don't want the projectile to deal damage.
/// </summary>
public bool CanHit = true;
/// <summary>
/// Overrides the projectile owner's center as the projectile's location, so long as it isn't Vector2.Zero.
/// If not equal to Vector2.Zero, this value will be affected by the projectile's velocity just like its normal position.
/// </summary>
public Vector2 AbsolutePosition = Vector2.Zero;
/// <summary>
/// If this field is true, the projectile will draw at all times. Otherwise, it will only draw when its associated item is in use.
/// </summary>
public bool DrawUnconditionally = false;
/// <summary>
/// The number of frames that the current use animation has progressed through.
/// </summary>
public float AnimationProgress = 0;
#endregion
#region Use Style
/// <summary>
/// Determines the behavior to reset to when the item is not in use.
/// </summary>
public virtual void ResetStyle() { }
/// <summary>
/// Determines the behavior of the projectile when the item is in use.
/// </summary>
public virtual void UseStyle() { }
/// <summary>
/// Determines the behavior of the projectile when the item use animation begins for the first time in a row.
/// </summary>
public virtual void OnBeginUse() { }
/// <summary>
/// Determines the behavior of the projectile when the item use animation ends.
/// </summary>
public virtual void OnEndUse() { }
#endregion
public override void AI()
{
if (Owner.HeldItem.type != AssignedItemID)
{
Projectile.Kill();
}
Owner.Calamity().mouseWorldListener = true;
Owner.Calamity().rightClickListener = true;
if (Owner.ItemAnimationActive)
{
Animation++;
UseStyle();
Owner.heldProj = Projectile.whoAmI;
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + RotationOffset + ArmRotationOffset);
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + RotationOffset + ArmRotationOffsetBack);
}
else
{
Animation = 0;
if (DrawUnconditionally)
{
Owner.heldProj = Projectile.whoAmI;
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + RotationOffset + ArmRotationOffset);
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + RotationOffset + ArmRotationOffsetBack);
}
NumberOfAnimations = 0;
ResetStyle();
}
AnimationProgress = Animation % Owner.itemAnimationMax;
if (AbsolutePosition == Vector2.Zero)
{
Projectile.position = Owner.position + (Owner.Size / 2) - (Projectile.Size / 2) + Offset;
}
else
{
AbsolutePosition += Projectile.velocity;
Projectile.position = AbsolutePosition - (Projectile.Size / 2) + Offset;
}
if (Owner.itemAnimation == 1)
{
OnEndUse();
NumberOfAnimations++;
}
if (Owner.ItemAnimationJustStarted)
{
Projectile.timeLeft = Owner.HeldItem.useAnimation + 1;
if (DrawUnconditionally) Projectile.timeLeft = 100;
OnBeginUse();
}
}
public override bool? CanHitNPC(NPC target)
{
bool bb = (target.immune[0] <= 0) && !target.friendly && !target.dontTakeDamage;
return bb;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.HitDirectionOverride = Owner.direction;
base.ModifyHitNPC(target, ref modifiers);
}
public override bool? CanDamage()
{
return CanHit ? base.CanDamage() : false;
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset);
hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y);
base.ModifyDamageHitbox(ref hitbox);
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if (Owner.itemAnimation > 0 || DrawUnconditionally)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
return false;
}
}
}
+1 -1
View File
@@ -161,6 +161,6 @@ namespace CalamityMod.Projectiles.Boss
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18 * Projectile.scale, targetHitbox);
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10 * Projectile.scale, targetHitbox);
}
}
+5 -1
View File
@@ -10,6 +10,7 @@ using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.NPCs;
using CalamityMod.NPCs.Cryogen;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.Particles;
@@ -4370,7 +4371,10 @@ namespace CalamityMod.Projectiles
if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255)
{
if (projectile.ModProjectile is null || (projectile.ModProjectile != null && projectile.ModProjectile.CanHitPlayer(Main.LocalPlayer) && (projectile.ModProjectile.CanDamage() ?? true)))
return Color.Coral;
{
Color mainColor = Color.Lerp(Color.Crimson with { A = 0 }, Color.OrangeRed with { A = 0 }, ((Main.GlobalTimeWrappedHourly * 2) % 1f));
return mainColor;
}
}
if (projectile.type == ProjectileID.BloodNautilusShot)
@@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles
{ ProjectileID.MythrilDrill, standardDrillTweaks },
{ ProjectileID.NanoBullet, standardBulletTweaks },
{ ProjectileID.NebulaDrill, standardDrillTweaks },
{ ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(+1)) },
{ ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(-1)) },
{ ProjectileID.OrichalcumChainsaw, standardChainsawTweaks },
{ ProjectileID.OrichalcumDrill, standardDrillTweaks },
{ ProjectileID.PalladiumChainsaw, standardChainsawTweaks },
-50
View File
@@ -1,50 +0,0 @@
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Healing
{
public class RainHeal : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Healing";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private const int TimeLeft = 300;
private const int HomingTime = TimeLeft - 120;
private const int SlowDownTime = TimeLeft - 150;
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.timeLeft = TimeLeft;
Projectile.tileCollide = false;
Projectile.extraUpdates = 3;
}
public override void AI()
{
if (Projectile.timeLeft < HomingTime)
{
if (Projectile.timeLeft > SlowDownTime)
Projectile.velocity *= 0.9f;
else
Projectile.HealingProjectile(GrandGuardian.HealPerOrb, Projectile.owner, 12f, 15f);
}
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0f;
Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f;
Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f;
}
}
}
+10 -2
View File
@@ -9,7 +9,8 @@ namespace CalamityMod.Projectiles.Magic
{
public new string LocalizationCategory => "Projectiles.Magic";
public bool devourer = DownedBossSystem.downedDoG;
public static int TotalSegments = 20;
public static int TotalSegments = 16;
public float damageMultiplier = 1f;
public override void SetDefaults()
{
@@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = -1;
Projectile.penetrate = 4;
Projectile.extraUpdates = (Main.zenithWorld && devourer) ? 1 : 0;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = (Main.zenithWorld && devourer) ? 2 : 8;
@@ -78,6 +79,13 @@ namespace CalamityMod.Projectiles.Magic
public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha);
// Damage falloff is handled in ModifyHitNPC instead of OnHitNPC so that the split spears don't inherit the lower damage
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.SourceDamage *= damageMultiplier;
damageMultiplier *= 0.8f;
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 3; k++)
-99
View File
@@ -1,99 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class Earth2 : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private int noTileHitCounter = 120;
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 34;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
Projectile.coldDamage = true;
}
public override void AI()
{
int randomToSubtract = Main.rand.Next(1, 4);
noTileHitCounter -= randomToSubtract;
if (noTileHitCounter == 0)
{
Projectile.tileCollide = true;
}
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 20 + Main.rand.Next(40);
if (Main.rand.NextBool(5))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
Projectile.alpha -= 15;
int alphaControl = 150;
if (Projectile.Center.Y >= Projectile.ai[1])
{
alphaControl = 0;
}
if (Projectile.alpha < alphaControl)
{
Projectile.alpha = alphaControl;
}
Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
if (Main.rand.NextBool(16))
{
Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default);
int greenishDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
Main.dust[greenishDust].velocity = dustDirection * 0.66f;
Main.dust[greenishDust].position = Projectile.Center + dustDirection * 12f;
}
if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server)
{
int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
Main.gore[gored].velocity *= 0.66f;
Main.gore[gored].velocity += Projectile.velocity * 0.3f;
}
if (Projectile.ai[1] == 1f)
{
Projectile.light = 0.9f;
if (Main.rand.NextBool(10))
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
}
if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server)
{
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
}
}
Lighting.AddLight(Projectile.Center, 0f, 0f, 1.5f);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int k = 0; k < 15; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 120);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

-162
View File
@@ -1,162 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class Earth3 : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private int noTileHitCounter = 120;
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 34;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
}
public override void AI()
{
int randomToSubtract = Main.rand.Next(1, 4);
noTileHitCounter -= randomToSubtract;
if (noTileHitCounter == 0)
{
Projectile.tileCollide = true;
}
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 20 + Main.rand.Next(40);
if (Main.rand.NextBool(5))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
Projectile.alpha -= 15;
int alphaControl = 150;
if (Projectile.Center.Y >= Projectile.ai[1])
{
alphaControl = 0;
}
if (Projectile.alpha < alphaControl)
{
Projectile.alpha = alphaControl;
}
Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
if (Main.rand.NextBool(16))
{
Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default);
int brownDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
Main.dust[brownDust].velocity = dustDirection * 0.66f;
Main.dust[brownDust].position = Projectile.Center + dustDirection * 12f;
}
if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server)
{
int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
Main.gore[gored].velocity *= 0.66f;
Main.gore[gored].velocity += Projectile.velocity * 0.3f;
}
if (Projectile.ai[1] == 1f)
{
Projectile.light = 0.9f;
if (Main.rand.NextBool(10))
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
}
if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server)
{
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
}
}
Lighting.AddLight(Projectile.Center, 1.5f, 0f, 0f);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 30;
Projectile.height = 30;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
for (int i = 0; i < 20; i++)
{
int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
Main.dust[dusty].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[dusty].scale = 0.5f;
Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 35; num623++)
{
int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f);
Main.dust[dusty2].noGravity = true;
Main.dust[dusty2].velocity *= 5f;
dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f);
Main.dust[dusty2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
Vector2 goreSource = Projectile.Center;
int goreAmt = 3;
Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f);
for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++)
{
float velocityMult = 0.33f;
if (goreIndex < (goreAmt / 3))
{
velocityMult = 0.66f;
}
if (goreIndex >= (2 * goreAmt / 3))
{
velocityMult = 1f;
}
Mod mod = ModContent.GetInstance<CalamityMod>();
int type = Main.rand.Next(61, 64);
int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
Gore gore = Main.gore[smoke];
gore.velocity *= velocityMult;
gore.velocity.X += 1f;
gore.velocity.Y += 1f;
type = Main.rand.Next(61, 64);
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
gore = Main.gore[smoke];
gore.velocity *= velocityMult;
gore.velocity.X -= 1f;
gore.velocity.Y += 1f;
type = Main.rand.Next(61, 64);
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
gore = Main.gore[smoke];
gore.velocity *= velocityMult;
gore.velocity.X += 1f;
gore.velocity.Y -= 1f;
type = Main.rand.Next(61, 64);
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
gore = Main.gore[smoke];
gore.velocity *= velocityMult;
gore.velocity.X -= 1f;
gore.velocity.Y -= 1f;
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 120);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

-108
View File
@@ -1,108 +0,0 @@
using System;
using CalamityMod.Balancing;
using CalamityMod.Projectiles.Healing;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class Earth4 : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private int noTileHitCounter = 120;
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 34;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
}
public override void AI()
{
int randomToSubtract = Main.rand.Next(1, 4);
noTileHitCounter -= randomToSubtract;
if (noTileHitCounter == 0)
{
Projectile.tileCollide = true;
}
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 20 + Main.rand.Next(40);
if (Main.rand.NextBool(5))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
Projectile.alpha -= 15;
int alphaControl = 150;
if (Projectile.Center.Y >= Projectile.ai[1])
{
alphaControl = 0;
}
if (Projectile.alpha < alphaControl)
{
Projectile.alpha = alphaControl;
}
Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
if (Main.rand.NextBool(16))
{
Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default);
int brightGreenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
Main.dust[brightGreenDust].velocity = dustDirection * 0.66f;
Main.dust[brightGreenDust].position = Projectile.Center + dustDirection * 12f;
}
if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server)
{
int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
Main.gore[gored].velocity *= 0.66f;
Main.gore[gored].velocity += Projectile.velocity * 0.3f;
}
if (Projectile.ai[1] == 1f)
{
Projectile.light = 0.9f;
if (Main.rand.NextBool(10))
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
}
if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server)
{
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
}
}
Lighting.AddLight(Projectile.Center, 0f, 1.5f, 0f);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int k = 0; k < 15; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(SoundID.Item4, Projectile.position);
int heal = (int)Math.Round(hit.Damage * 0.075);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType<EarthHealOrb>(), BalancingConstants.LifeStealRange);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

+35
View File
@@ -0,0 +1,35 @@
using System;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class EarthBoom : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = Projectile.height = 500;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 15;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+313
View File
@@ -0,0 +1,313 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class EarthHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<Earth>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Earth>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth";
public override float HitboxOutset => 105;
public override Vector2 HitboxSize => new Vector2(145, 145);
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(0, 104);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = true;
public bool postSwing = false;
public float fadeIn = 0;
public int useAnim;
public int swingCount;
public bool spawnBoom = true;
public Color mainColor = Color.OrangeRed;
public override void SetDefaults()
{
base.SetDefaults();
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = -1;
base.OnSpawn(source);
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
}
public override void UseStyle()
{
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
}
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
if (!doSwing)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
spawnBoom = true;
Projectile.numHits = 0;
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
doSwing = true;
swingCount++;
}
else
{
if (!CanHit && !postSwing)
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f);
if (AnimationProgress < (useAnim / 3))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
{
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
}
else
{
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time == (int)(timeMax * 0.4f))
{
SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.6f : 0.9f) }, Projectile.Center);
}
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f))
{
CanHit = true;
for (int i = 0; i < 2; i++)
{
mainColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 12, Main.rand.NextFloat(0.03f, 0.01f), mainColor, new Vector2 (0.3f, 1f)));
}
for (int i = 0; i < 6; i++)
{
mainColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true));
}
}
else
CanHit = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
if (time >= timeMax)
doSwing = false;
if (time < (int)(timeMax * 0.7f))
postSwing = true;
if (CanHit)
{
for (int i = 0; i < 3; i++)
{
mainColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
bool color = Main.rand.NextBool();
GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f);
GeneralParticleHandler.SpawnParticle(sparker);
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Color.Lerp(Color.White, mainColor, 0.5f);
}
}
}
}
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
mainColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0)
Projectile.numHits -= 1;
if (target.CanBeMoved(true))
{
// Launch
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -17;
target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f);
}
if (Projectile.ai[1] == -1 && spawnBoom)
{
Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650));
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType<EarthMeteor>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0, 0, 2);
spawnBoom = false;
}
SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1");
SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = 0.2f }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash");
SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center);
int heal = (int)(MathHelper.Clamp(30 - Projectile.numHits * 25, 1, 30));
if (Projectile.numHits < 30)
{
Owner.statLife += heal;
Owner.HealEffect(heal);
if (Owner.statLife > Owner.statLifeMax2)
Owner.statLife = Owner.statLifeMax2;
}
int points = 6;
float radians = MathHelper.TwoPi / points;
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100);
for (int k = 0; k < points; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
if (k % 2 == 0)
velocity *= 5;
Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.08f, mainColor, new Vector2(1f, 0.4f), true);
GeneralParticleHandler.SpawnParticle(spark);
Particle spark2 = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 35, 0.06f, mainColor, new Vector2(0.4f, 1.1f), false, false);
GeneralParticleHandler.SpawnParticle(spark2);
}
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 15, true);
GeneralParticleHandler.SpawnParticle(blastRing);
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.5f, 15, true);
GeneralParticleHandler.SpawnParticle(blastRing2);
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
{
mainColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
Particle mini = new CustomPulse(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 1f), mainColor, "CalamityMod/Particles/HealingPlus", Vector2.One, Main.rand.NextFloat(-10, 10), Main.rand.NextFloat(0.8f, 1.4f), 0.2f, 35, true);
GeneralParticleHandler.SpawnParticle(mini);
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Color.Lerp(Color.White, mainColor, 0.5f);
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float minMult = 1f;
int hitsToMinMult = 1;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/EarthGlow");
float r = (FlipAsSword ? MathHelper.ToRadians(90) : 0f);
for (int i = 0; i < 5; i++)
{
Color auraColor = mainColor * 0.5f * fadeIn;
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/EarthGhost").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
return false;
}
public override void ResetStyle()
{
}
}
}
+189
View File
@@ -0,0 +1,189 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using ReLogic.Utilities;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.Particles;
namespace CalamityMod.Projectiles.Melee
{
public class EarthMeteor : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public ref float time => ref Projectile.ai[0];
public SlotId AudSlot;
public Color mainColor = Color.White;
public Color randomColor = Color.White;
public Color variedColor = Color.White;
public int colorTimer = 0;
public int fallTime = 180;
public override void SetDefaults()
{
Projectile.width = 36;
Projectile.height = 84;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 600;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
Projectile.scale = 1.2f;
randomColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
if (time == 0)
{
mainColor = randomColor;
}
if (time % 20 == 0)
{
variedColor = colorTimer switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
colorTimer++;
if (colorTimer >= 3)
colorTimer = 0;
}
mainColor = Color.Lerp(mainColor, variedColor, 0.07f);
if (time == 0 && Projectile.ai[2] == 2)
{
SoundStyle fire2 = new("CalamityMod/Sounds/Item/WeldingShoot");
AudSlot = SoundEngine.PlaySound(fire2 with { Volume = 0.01f, Pitch = 0.01f, IsLooped = true }, Projectile.Center);
}
if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying && Projectile.ai[2] == 2)
{
ChargeSound.Position = Projectile.Center;
ChargeSound.Pitch = Utils.Remap(time, 0, fallTime, 0.4f, -0.8f) * 100;
ChargeSound.Volume = Utils.Remap(time, fallTime * 0.2f, fallTime, 0f, 0.9f) * 100;
}
if (time == (int)(fallTime * 0.2f) && Projectile.ai[2] > 0)
{
Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650));
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType<EarthMeteor>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1);
}
if (time == fallTime)
{
Projectile.extraUpdates = 15;
NPC target = Projectile.Center.ClosestNPCAt(2000);
if (target != null)
Projectile.velocity = (target.Center - Projectile.Center + target.velocity * 8).SafeNormalize(Vector2.UnitX) * 8;
else
Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8;
}
if (time >= fallTime)
{
// Spawn in a helix-style pattern
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f;
if (targetDist < 1400f && time % 2 == 0)
{
GlowSparkParticle orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, false, 10, 0.03f, mainColor, new Vector2(0.5f, 1f), false, false);
GeneralParticleHandler.SpawnParticle(orb);
GlowSparkParticle orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, false, 10, 0.03f, mainColor, new Vector2(0.5f, 1f), false, false);
GeneralParticleHandler.SpawnParticle(orb2);
}
}
else
{
float randSize = Main.rand.NextFloat(0.8f, 1.2f);
for (int i = 0; i < 2; i++)
{
Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * Utils.Remap(time, 0, fallTime, 0, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.8f * randSize, 0f, 3);
GeneralParticleHandler.SpawnParticle(bloom);
}
Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * Utils.Remap(time, 0, fallTime, 0f, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.65f * randSize, 0f, 3);
GeneralParticleHandler.SpawnParticle(bloom3);
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
time++;
}
public override bool PreDraw(ref Color lightColor)
{
if (time <= fallTime)
return false;
Color auraColor = mainColor;
for (int i = 0; i < 7; i++)
{
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/EarthMeteor").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 20f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale * 1.1f, SpriteEffects.None, 0f);
}
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1);
return false;
}
public override void OnKill(int timeLeft)
{
if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && Projectile.ai[2] == 2)
ChargeSound?.Stop();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.numHits <= 0)
{
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType<EarthBoom>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner);
for (int i = 0; i < 20; i++)
{
randomColor = Main.rand.Next(3) switch
{
0 => Color.OrangeRed,
1 => Color.MediumTurquoise,
_ => Color.LawnGreen,
};
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20));
dust2.scale = Main.rand.NextFloat(0.85f, 1.15f);
dust2.noGravity = false;
dust2.color = Color.Lerp(Color.White, randomColor, 0.5f);
}
Particle bolt2 = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.5f, 19);
GeneralParticleHandler.SpawnParticle(bolt2);
Particle bolt3 = new CustomPulse(target.Center, Vector2.Zero, Color.MediumTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.35f, 17);
GeneralParticleHandler.SpawnParticle(bolt3);
Particle bolt4 = new CustomPulse(target.Center, Vector2.Zero, Color.LawnGreen, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.2f, 15);
GeneralParticleHandler.SpawnParticle(bolt4);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor");
SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center);
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true);
GeneralParticleHandler.SpawnParticle(blastRing);
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true);
GeneralParticleHandler.SpawnParticle(blastRing2);
}
}
public override bool? CanDamage() => time < fallTime ? false : null;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80, targetHitbox);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

-149
View File
@@ -1,149 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class EarthProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private int noTileHitCounter = 120;
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 34;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.ignoreWater = true;
}
public override void AI()
{
int randomToSubtract = Main.rand.Next(1, 4);
noTileHitCounter -= randomToSubtract;
if (noTileHitCounter == 0)
{
Projectile.tileCollide = true;
}
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 20 + Main.rand.Next(40);
if (Main.rand.NextBool(5))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
Projectile.alpha -= 15;
int alphaControl = 150;
if (Projectile.Center.Y >= Projectile.ai[1])
{
alphaControl = 0;
}
if (Projectile.alpha < alphaControl)
{
Projectile.alpha = alphaControl;
}
Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
int dustChoice = Main.rand.Next(3);
if (dustChoice == 0)
{
dustChoice = 74;
}
else if (dustChoice == 1)
{
dustChoice = 229;
}
else
{
dustChoice = 244;
}
if (Main.rand.NextBool(16))
{
Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default);
int dustOnHit = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
Main.dust[dustOnHit].velocity = dustDirection * 0.66f;
Main.dust[dustOnHit].position = Projectile.Center + dustDirection * 12f;
}
if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server)
{
int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
Main.gore[gored].velocity *= 0.66f;
Main.gore[gored].velocity += Projectile.velocity * 0.3f;
}
if (Projectile.ai[1] == 1f)
{
Projectile.light = 0.9f;
if (Main.rand.NextBool(10))
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
}
if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server)
{
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
}
}
Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f);
}
public override void OnKill(int timeLeft)
{
float spread = 45f * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 4; i++)
{
int projChoice = Main.rand.Next(3);
if (projChoice == 0)
{
projChoice = ModContent.ProjectileType<Earth2>();
}
else if (projChoice == 1)
{
projChoice = ModContent.ProjectileType<Earth3>();
}
else
{
projChoice = ModContent.ProjectileType<Earth4>();
}
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int k = 0; k < 15; k++)
{
int dustChoice = Main.rand.Next(3);
if (dustChoice == 0)
{
dustChoice = 74;
}
else if (dustChoice == 1)
{
dustChoice = 229;
}
else
{
dustChoice = 244;
}
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 600);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

+274
View File
@@ -0,0 +1,274 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class GrandDadHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<GrandDad>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<GrandDad>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandDad";
public override float HitboxOutset => 125;
public override Vector2 HitboxSize => new Vector2(170, 170);
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(0, 124);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = true;
public bool postSwing = false;
public float fadeIn = 0;
public int useAnim;
public int swingCount;
public override void SetDefaults()
{
base.SetDefaults();
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = 1;
base.OnSpawn(source);
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
}
public override void UseStyle()
{
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
}
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
if (!doSwing)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
Projectile.numHits = 0;
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
doSwing = true;
swingCount++;
}
else
{
if (!CanHit && !postSwing)
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f);
if (AnimationProgress < (useAnim / 3))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
{
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
}
else
{
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time == (int)(timeMax * 0.4f))
{
SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.3f }, Projectile.Center);
}
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f))
{
CanHit = true;
for (int i = 0; i < 3; i++)
{
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new LineParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.Black : Color.DarkBlue, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f));
}
}
else
CanHit = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
if (time >= timeMax)
doSwing = false;
if (time < (int)(timeMax * 0.7f))
postSwing = true;
if (CanHit)
{
for (int i = 0; i < 5; i++)
{
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.Gold : Color.Goldenrod));
}
}
}
}
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0)
Projectile.numHits -= 1;
SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1");
SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash");
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center);
if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType<PrimordialWyrmHead>() && Main.rand.NextBool(5))
{
SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8);
SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center);
}
if (Projectile.numHits == 0)
{
Owner.Calamity().GeneralScreenShakePower = 6.5f;
}
int heal = (int)(MathHelper.Clamp(12 - Projectile.numHits * 5, 1, 12));
if (Projectile.numHits < 12)
{
Owner.statLife += heal;
Owner.HealEffect(heal);
if (Owner.statLife > Owner.statLifeMax2)
Owner.statLife = Owner.statLifeMax2;
}
if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType<PrimordialWyrmHead>() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
{
if (target.type == ModContent.NPCType<PrimordialWyrmHead>())
{
CombatText.NewText(target.Hitbox, Color.Aqua, "boop!");
SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped");
SoundEngine.PlaySound(boop with {Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center);
}
bool rightClicked = Owner.Calamity().mouseRight;
// Make all hit enemies able to hit tiles, so you can dunk them
target.noTileCollide = false;
// Launch the suckers
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (Main.zenithWorld ? -50 : -30) * (rightClicked ? 2 : 1);
target.velocity = launchVel * 0.5f;
// Remove knockback resist, just like it used to
target.knockBackResist = 1;
// Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone)
target.FlungNPC().ApplyCollisionDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel, 5f, true);
}
Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35, false, 13, 0.5f, Color.DodgerBlue);
GeneralParticleHandler.SpawnParticle(spark);
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
{
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), true, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue);
GeneralParticleHandler.SpawnParticle(spark2);
if (Main.rand.NextBool(3))
{
Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), true, 55, Main.rand.NextFloat(0.4f, 1.5f), Color.Black);
GeneralParticleHandler.SpawnParticle(spark3);
}
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Owner.Calamity().mouseRight)
modifiers.SourceDamage *= 0.0025f;
else
{
float minMult = 0.5f;
int hitsToMinMult = 7;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandDadGlow");
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
for (int i = 0; i < 5; i++)
{
Color auraColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn;
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/GrandDadGhost").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
return false;
}
public override void ResetStyle()
{
}
}
}
+62
View File
@@ -0,0 +1,62 @@
using System;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class GrandGuardianBoom : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Color mainColor = Color.White;
public int time = 0;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 400;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 35;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (mainColor == Color.White)
{
mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid;
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 35);
GeneralParticleHandler.SpawnParticle(bolt2);
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f, 15);
GeneralParticleHandler.SpawnParticle(bolt3);
for (int i = 0; i < 25; i++)
{
Vector2 dustVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * 1;
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor;
bool color = Main.rand.NextBool();
GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f);
GeneralParticleHandler.SpawnParticle(sparker);
}
}
if (time == 6)
{
//Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 2.56f, 3.26f, 24);
//GeneralParticleHandler.SpawnParticle(bolt2);
}
time++;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+272
View File
@@ -0,0 +1,272 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class GrandGuardianHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<GrandGuardian>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<GrandGuardian>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian";
public override float HitboxOutset => 105;
public override Vector2 HitboxSize => new Vector2(150, 150);
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(0, 124);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = true;
public bool postSwing = false;
public float fadeIn = 0;
public int useAnim;
public int swingCount;
public bool spawnBoom = true;
public override void SetDefaults()
{
base.SetDefaults();
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = 1;
base.OnSpawn(source);
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
}
public override void UseStyle()
{
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
}
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
if (!doSwing)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
spawnBoom = true;
Projectile.numHits = 0;
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
doSwing = true;
swingCount++;
}
else
{
if (!CanHit && !postSwing)
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f);
if (AnimationProgress < (useAnim / 3))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
{
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
}
else
{
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time == (int)(timeMax * 0.3f))
{
SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 1f, Pitch = -0.2f }, Projectile.Center);
SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce with { Volume = 1f, Pitch = -0.5f }, Projectile.Center);
}
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f))
{
CanHit = true;
for (int i = 0; i < 4; i++)
{
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue));
}
}
else
CanHit = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
if (time >= timeMax)
doSwing = false;
if (time < (int)(timeMax * 0.7f))
postSwing = true;
if (CanHit)
{
for (int i = 0; i < 3; i++)
{
bool color = Main.rand.NextBool();
GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f);
GeneralParticleHandler.SpawnParticle(sparker);
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid;
}
}
}
}
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0)
Projectile.numHits -= 1;
if (target.CanBeMoved(false))
{
// Launch
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -8;
target.velocity = launchVel;
}
if (spawnBoom)
{
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType<GrandGuardianBoom>(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner);
spawnBoom = false;
}
SoundStyle fire = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2");
SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = -0.6f }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash");
SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center);
int heal = (int)(MathHelper.Clamp(3 - Projectile.numHits, 1, 3));
if (Projectile.numHits < 3)
{
Owner.statLife += heal;
Owner.HealEffect(heal);
if (Owner.statLife > Owner.statLifeMax2)
Owner.statLife = Owner.statLifeMax2;
}
int points = 4;
float radians = MathHelper.TwoPi / points;
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100);
Color useColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid;
for (int k = 0; k < points; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.07f, useColor, new Vector2(1f, 0.4f), true, false);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
{
//Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue);
//GeneralParticleHandler.SpawnParticle(spark2);
if (Main.rand.NextBool(3))
{
//Particle spark3 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 45, Main.rand.NextFloat(0.3f, 1f), Color.Lavender);
//GeneralParticleHandler.SpawnParticle(spark3);
}
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float minMult = 0.3f;
int hitsToMinMult = 5;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow");
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
for (int i = 0; i < 5; i++)
{
Color auraColor = Color.Lerp(Color.DodgerBlue, Color.Cyan, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn;
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/GrandGuardianGhost").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
return false;
}
public override void ResetStyle()
{
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+241
View File
@@ -0,0 +1,241 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class MajesticGuardHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<MajesticGuard>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<MajesticGuard>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/MajesticGuard";
public override float HitboxOutset => 105;
public override Vector2 HitboxSize => new Vector2(140, 140);
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(-5, 100);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = true;
public bool postSwing = false;
public float fadeIn = 0;
public int useAnim;
public int swingCount;
public override void SetDefaults()
{
base.SetDefaults();
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = 1;
base.OnSpawn(source);
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
}
public override void UseStyle()
{
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
}
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
if (!doSwing)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
Projectile.numHits = 0;
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
doSwing = true;
swingCount++;
}
else
{
if (!CanHit && !postSwing)
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f);
if (AnimationProgress < (useAnim / 3))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
{
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
}
else
{
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time == (int)(timeMax * 0.4f))
{
SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.55f }, Projectile.Center);
}
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f))
{
CanHit = true;
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod));
}
else
CanHit = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
if (time >= timeMax)
doSwing = false;
if (time < (int)(timeMax * 0.7f))
postSwing = true;
if (CanHit)
{
for (int i = 0; i < 2; i++)
{
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold;
}
}
}
}
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0)
Projectile.numHits -= 1;
SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow");
SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage");
SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.4f }, Projectile.Center);
int heal = (int)(MathHelper.Clamp(5 - Projectile.numHits * 3, 1, 5));
if (Projectile.numHits < 5)
{
Owner.statLife += heal;
Owner.HealEffect(heal);
if (Owner.statLife > Owner.statLifeMax2)
Owner.statLife = Owner.statLifeMax2;
}
if (target.CanBeMoved(true))
{
// Launch
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -15;
target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f);
}
for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++)
{
Particle spark2 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Gold : Color.DarkGoldenrod);
GeneralParticleHandler.SpawnParticle(spark2);
if (Main.rand.NextBool(3))
{
Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.Silver);
GeneralParticleHandler.SpawnParticle(spark3);
}
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float minMult = 0.3f;
int hitsToMinMult = 5;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow");
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
for (int i = 0; i < 5; i++)
{
Color auraColor = Color.Lerp(Color.Silver, Color.White, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn;
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/MajesticGuardGhost").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
return false;
}
public override void ResetStyle()
{
}
}
}
-59
View File
@@ -1,59 +0,0 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class RainBolt : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private const int TimeLeft = 180;
private const int HomingTime = TimeLeft - 30;
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
Projectile.timeLeft = TimeLeft;
}
public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < HomingTime && target.CanBeChasedBy(Projectile);
public override void AI()
{
if (Projectile.localAI[0] == 0f)
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.Center);
Projectile.localAI[0] += 1f;
}
int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].velocity *= 0f;
if (Projectile.timeLeft < HomingTime)
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f);
else
Projectile.velocity *= 0.95f;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item60, Projectile.Center);
for (int k = 0; k < 5; k++)
{
int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
Main.dust[rain].noGravity = true;
}
}
}
}
-65
View File
@@ -1,65 +0,0 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class RainbowBoom : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 100;
Projectile.height = 100;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 20;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 5;
}
public override void AI()
{
float projTimer = 25f;
if (Projectile.ai[0] > 180f)
projTimer -= (Projectile.ai[0] - 180f) / 2f;
if (projTimer <= 0f)
{
projTimer = 0f;
Projectile.Kill();
}
projTimer *= 0.7f;
Projectile.ai[0] += 4f;
int timerCounter = 0;
while ((float)timerCounter < projTimer)
{
float rando1 = (float)Main.rand.Next(-30, 31);
float rando2 = (float)Main.rand.Next(-30, 31);
float rando3 = (float)Main.rand.Next(9, 27);
float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2));
randoAdjuster = rando3 / randoAdjuster;
rando1 *= randoAdjuster;
rando2 *= randoAdjuster;
int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].position.X = Projectile.Center.X;
Main.dust[rainbow].position.Y = Projectile.Center.Y;
Main.dust[rainbow].position.X += (float)Main.rand.Next(-10, 11);
Main.dust[rainbow].position.Y += (float)Main.rand.Next(-10, 11);
Main.dust[rainbow].velocity.X = rando1;
Main.dust[rainbow].velocity.Y = rando2;
timerCounter++;
}
}
}
}
@@ -302,7 +302,7 @@ namespace CalamityMod.Projectiles.Melee.Spears
if (CurrentAttackState == AttackState.UpwardsThrust)
{
target.velocity.Y -= 12 * (float)Math.Sqrt(target.knockBackResist);
target.FallingNPC().ApplyFallDamage(target, 50, 5f);
target.FlungNPC().ApplyCollisionDamage(target, 50, Vector2.Zero, 5f);
}
target.AddBuff(BuffID.Poisoned, 180);
+9 -1
View File
@@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Ranged
public Color BlueFogColor = new Color(150, 120, 255);
public float BlueFogRot = 0f;
public float BlueFogScale = 1f;
public float damageMult = 1;
public override void SetDefaults()
{
@@ -58,7 +59,10 @@ namespace CalamityMod.Projectiles.Ranged
// Turns around every once in a while
int TurnRate = Lifetime / 5;
if (Time % TurnRate == TurnRate - 1)
{
Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(-216f));
damageMult = 1;
}
Projectile.rotation = Projectile.velocity.ToRotation();
// Determines particle size as well as hitbox
@@ -104,7 +108,11 @@ namespace CalamityMod.Projectiles.Ranged
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 240);
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.SourceDamage *= damageMult;
damageMult *= 0.8f;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 240);
// Circular hitbox adjusted for the size of the smoke particles (rough estimate minimally accounting for fog)
+1 -2
View File
@@ -180,8 +180,7 @@ namespace CalamityMod.Projectiles.Rogue
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC target = Main.npc[i];
bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust;
if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false))
if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false))
{
if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600)
target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22;
+1 -2
View File
@@ -305,8 +305,7 @@ namespace CalamityMod.Projectiles.Rogue
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC target = Main.npc[i];
bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust;
if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && target.CanBeChasedBy(Projectile, false))
if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false))
{
if (target != null && !CalamityPlayer.areThereAnyDamnBosses)
{
+6 -1
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Summon.HarvestStaff;
@@ -16,7 +17,11 @@ namespace CalamityMod.Projectiles.Summon
public static float Gravity = 0.8f;
public static float MaxGravity = 20f;
public override void SetStaticDefaults() => Main.projFrames[Type] = 4;
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 4;
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
}
public override void SetDefaults()
{
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff. Show more