Final merge of 1.4.4 into staging for 2.1 Brainstorm

This commit is contained in:
Ozzatron committed 2026-02-06 17:06:15 -05:00
commit 456057161d
128 files changed
+1137 -461

No files matched your search

+12 -9
View File
@@ -2206,15 +2206,18 @@ namespace CalamityMod.CalPlayer
Player.AddCooldown(Starburst.ID, MaxStratusStarburst);
}
}
// Shields. Has to intentionally be above resetting accessories and armor or the shields would clear instantly
if (!roverDrive)
RoverDriveShieldDurability = 0;
if (!lunicCorpsSet)
LunicCorpsShieldDurability = 0;
if (!sponge)
SpongeShieldDurability = 0;
if (!pSoulArtifact)
pSoulShieldDurability = 0;
if (Player.whoAmI == Main.myPlayer)
{
if (!roverDrive)
RoverDriveShieldDurability = 0;
if (!lunicCorpsSet)
LunicCorpsShieldDurability = 0;
if (!sponge)
SpongeShieldDurability = 0;
if (!pSoulArtifact)
pSoulShieldDurability = 0;
}
pSoulShieldVisible = false;
roverDrive = false;
roverDriveShieldVisible = false;
+32 -33
View File
@@ -4,19 +4,14 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer.DrawLayers;
using CalamityMod.DataStructures;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Systems.Collections;
using CalamityMod.Systems.Graphic.PixelationSystem;
using CalamityMod.Systems.Mechanic;
using CalamityMod.Utilities.Daybreak;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -106,7 +101,8 @@ namespace CalamityMod.CalPlayer
DevourerofGodsHead DoG = null;
foreach (var item in Main.ActiveNPCs)
{
if (item.type == ModContent.NPCType<DevourerofGodsHead>()) {
if (item.type == ModContent.NPCType<DevourerofGodsHead>())
{
DoG = item.ModNPC<DevourerofGodsHead>();
break;
}
@@ -155,37 +151,40 @@ namespace CalamityMod.CalPlayer
var dis = Player.Distance(virtualTargetPos);
if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying && !drawInfo.drawPlayer.isDisplayDollOrInanimate)
{
string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss";
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss";
var tex = ModContent.Request<Texture2D>((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value;
float baseRotation = DoG.NPC.rotation;
if (calamityPlayer.trippy)
int headIconIndex = -1;
DoG.BossHeadSlot(ref headIconIndex);
if (headIconIndex > -1)
{
Vector2 rotVec = baseRotation.ToRotationVector2();
switch (i)
var tex = TextureAssets.NpcHeadBoss[headIconIndex].Value;
float baseRotation = DoG.NPC.rotation;
if (calamityPlayer.trippy)
{
case 0:
rotVec.X *= -1;
rotVec.Y *= -1;
break;
case 1:
rotVec.Y *= -1;
break;
case 2:
break;
case 3:
rotVec.X *= -1;
break;
Vector2 rotVec = baseRotation.ToRotationVector2();
switch (i)
{
case 0:
rotVec.X *= -1;
rotVec.Y *= -1;
break;
case 1:
rotVec.Y *= -1;
break;
case 2:
break;
case 3:
rotVec.X *= -1;
break;
}
baseRotation = rotVec.ToRotation();
}
baseRotation = rotVec.ToRotation();
float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1);
Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f;
Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0);
}
float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1);
Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f;
Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0);
}
}
}
+6 -3
View File
@@ -3729,11 +3729,11 @@ namespace CalamityMod.CalPlayer
Player.velocity *= 0.98f;
if (molluskHelmet)
Player.velocity.X *= 0.995f;
Player.velocity.X *= 0.996f;
if (molluskChest)
Player.velocity.X *= 0.995f;
Player.velocity.X *= 0.996f;
if (molluskLegs)
Player.velocity.X *= 0.995f;
Player.velocity.X *= 0.996f;
if ((warped) && !Player.slowFall && !Player.mount.Active)
{
@@ -4505,6 +4505,9 @@ namespace CalamityMod.CalPlayer
#region Energy Shields
private void EnergyShields()
{
if (Player.whoAmI != Main.myPlayer)
return;
// Because later tier shields are brighter, shields are handled from highest tier to lowest tier here.
bool shieldAddedLight = false;
+10 -2
View File
@@ -92,11 +92,19 @@ namespace CalamityMod.Cooldowns
public override SoundStyle? EndSound => LunicCorpsHelmet.ActivationSound;
public override bool ShouldPlayEndSound => instance.player.Calamity().lunicCorpsSet;
public override void Tick() => instance.player.Calamity().playedLunicCorpsShieldSound = false;
// When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally.
public override void Tick()
{
if (instance.player.whoAmI == Main.myPlayer)
instance.player.Calamity().playedLunicCorpsShieldSound = false;
}
// When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally.
// The shield durability cooldown is added elsewhere, in Misc Effects.
public override void OnCompleted()
{
if (instance.player.whoAmI != Main.myPlayer)
return;
CalamityPlayer modPlayer = instance.player.Calamity();
if (modPlayer.LunicCorpsShieldDurability <= 0)
modPlayer.LunicCorpsShieldDurability = 1;
+9 -2
View File
@@ -109,16 +109,23 @@ namespace CalamityMod.Cooldowns
public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override void Tick() => instance.player.Calamity().playedProfanedSoulShieldSound = false;
public override void Tick()
{
if (instance.player.whoAmI == Main.myPlayer)
instance.player.Calamity().playedProfanedSoulShieldSound = false;
}
public override SoundStyle? EndSound => Providence.BurnStartSound;
public override bool ShouldPlayEndSound => instance.player.Calamity().pSoulArtifact;
// When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally.
// When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally.
// The shield durability cooldown is added elsewhere, in Misc Effects.
public override void OnCompleted()
{
if (instance.player.whoAmI != Main.myPlayer)
return;
CalamityPlayer modPlayer = instance.player.Calamity();
if (modPlayer.pSoulShieldDurability <= 0)
modPlayer.pSoulShieldDurability = 1;
+10 -2
View File
@@ -92,11 +92,19 @@ namespace CalamityMod.Cooldowns
public override SoundStyle? EndSound => TheSponge.ActivationSound;
public override bool ShouldPlayEndSound => instance.player.Calamity().sponge;
public override void Tick() => instance.player.Calamity().playedSpongeShieldSound = false;
// When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally.
public override void Tick()
{
if (instance.player.whoAmI == Main.myPlayer)
instance.player.Calamity().playedSpongeShieldSound = false;
}
// When the recharge period completes, grant 1 point of shielding immediately so the rest may refill normally.
// The shield durability cooldown is added elsewhere, in Misc Effects.
public override void OnCompleted()
{
if (instance.player.whoAmI != Main.myPlayer)
return;
CalamityPlayer modPlayer = instance.player.Calamity();
if (modPlayer.SpongeShieldDurability <= 0)
modPlayer.SpongeShieldDurability = 1;
+8 -1
View File
@@ -91,11 +91,18 @@ namespace CalamityMod.Cooldowns
public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override void Tick() => instance.player.Calamity().playedRoverDriveShieldSound = false;
public override void Tick()
{
if (instance.player.whoAmI == Main.myPlayer)
instance.player.Calamity().playedRoverDriveShieldSound = false;
}
// Rover Drive shields are recharged as a side effect of the cooldown completing client side
public override void OnCompleted()
{
if (instance.player.whoAmI != Main.myPlayer)
return;
CalamityPlayer modPlayer = instance.player.Calamity();
if (modPlayer.RoverDriveShieldDurability <= 0)
modPlayer.RoverDriveShieldDurability = 1;
+1 -1
View File
@@ -146,7 +146,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load render targets.
int layerCount = Layers.Count();
for (int i = 0; i < layerCount; i++)
LayerTargets.Add(ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice));
LayerTargets.Add(ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice, (width, height) => (width + 4, height + 4)));
});
}
+12 -1
View File
@@ -75,7 +75,12 @@ namespace CalamityMod.Graphics.Metaballs
{
using (target.Scope(clearColor: Color.Transparent))
{
// -2,-2 is to account for the border appplying at screen edge. We need this to draw off-screen.
// We directly adjust screen position so that drawing in the metaball functions works as expected
var offset = new Vector2(-2, -2);
Main.screenPosition += offset;
metaball.DrawInstances();
Main.screenPosition -= offset;
// Flush metaball contents to its render target and reset the sprite batch for the next iteration.
Main.spriteBatch.End();
@@ -106,11 +111,17 @@ namespace CalamityMod.Graphics.Metaballs
{
for (int i = 0; i < metaball.LayerTargets.Count; i++)
{
// -2,-2 is to account for the border appplying at screen edge. We need this to draw off-screen.
// We directly adjust screen position so that drawing in the metaball functions works as expected
var offset = new Vector2(-2, -2);
Main.screenPosition += offset;
// Prepare shaders for the given layer target.
metaball.PrepareShaderForTarget(i);
Main.screenPosition -= offset;
// Draw the metaball's raw contents with the shader.
Main.spriteBatch.Draw(metaball.LayerTargets[i].Target, Vector2.Zero, Color.White);
Main.spriteBatch.Draw(metaball.LayerTargets[i].Target, offset, Color.White);
}
}
@@ -62,6 +62,21 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
{
public override bool InstancePerEntity => false;
public override string IsArmorSet(Item head, Item body, Item legs)
{
if (head.ModItem is IDyeableShaderRenderer && head.ModItem.IsArmorSet(head, body, legs))
return "DyeableShaderSet";
if (body.ModItem is IDyeableShaderRenderer && body.ModItem.IsArmorSet(head, body, legs))
return "DyeableShaderSet";
if (legs.ModItem is IDyeableShaderRenderer && legs.ModItem.IsArmorSet(head, body, legs))
return "DyeableShaderSet";
return "";
}
public override void UpdateItemDye(Item item, Player player, int dye, bool hideVisual)
{
if (item.ModItem is not IDyeableShaderRenderer drawer)
-28
View File
@@ -1,28 +0,0 @@
using CalamityMod.Items.BaseItems;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class GoldenBomb : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Mihaii", null),
(EquipType.Body, "Mihaii", null),
(EquipType.Legs, "Mihaii", null),
];
public override void SetDefaults()
{
Item.width = 42;
Item.height = 38;
Item.accessory = true;
Item.rare = ItemRarityID.Blue;
Item.value = CalamityGlobalItem.RarityBlueBuyPrice;
Item.vanity = true;
Item.Calamity().devItem = true;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

+1 -1
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Astral
public static int MaxManaBoost = 80;
public static float AmmoReduction = 0.75f;
public static float DamageBoost = 0.07f;
public static float DamageBoost = 0.1f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent());
public override void SetDefaults()
+1 -1
View File
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Astral
public new string LocalizationCategory => "Items.Armor.Hardmode";
public static float DamageBoost = 0.05f;
public static int CritBoost = 10;
public static int CritBoost = 15;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost);
// Set Bonus
+1 -1
View File
@@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Astral
{
public new string LocalizationCategory => "Items.Armor.Hardmode";
public static float DamageBoost = 0.05f;
public static float DamageBoost = 0.1f;
public static float MoveSpeedBoost = 0.15f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent());
@@ -51,7 +51,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
{
"Altixal",
"apotofkoolaid",
"AquaSG",
"Atalya",
"Ben-TK",
"Big E",
@@ -65,7 +64,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Dia",
"Done",
"dozezoze",
"Eddie Spaghetti",
"ENNWAY",
"Flowaria",
"Fluffy",
@@ -73,24 +71,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"HaguriHat",
"jasper",
"LordMetarex",
"Mercutio 'Merkalto' Takle",
"Mishiro Usui",
"math2",
"Moonburn",
"Nycro",
"Ozzatron",
"Piky",
"PokerFace",
"Poroboros",
"Raesh",
"Sagittariod",
"Spider Prov",
"StipulateVenus",
"Sunny",
"_tofu",
"Tomat",
"Triangle",
"TYESKI (Universe)",
"Uncle Danny",
"Xyk",
"YuH",
// Former devs
@@ -101,6 +94,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Alphi",
"Altalyra",
"Amadis",
"AquaSG",
"AstroKnight",
"Blast",
"Blastitle",
@@ -120,6 +114,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"DylanDoe21",
"Earth",
"EchoDuck",
"Eddie Spaghetti",
"Ein",
"enamoured",
"Enreden",
@@ -150,14 +145,17 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Lompl Allimath",
"Lucille Karma",
"MarieArk",
"Mercutio 'Merkalto' Takle",
"Mihaii",
"Minecat",
"Mishiro Usui",
"Mrrp",
"Nao",
"Neverglide",
"Nincity",
"Niorin",
"Nitro",
"Nycro",
"NyctoDarkMatter",
"PaleoStar",
"Pbtopacio",
@@ -166,6 +164,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Pinkie Poss",
"Poly",
"Popo",
"Poroboros",
"President Waluigi",
"Puff",
"Purple Necromancer",
@@ -180,6 +179,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"SixteenInMono",
"Skeletony",
"Sok",
"Spider Prov",
"spooktacular",
"Spoopyro",
"Svante",
@@ -192,6 +192,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Trivaxy",
"Tobias",
"Uberransy",
"Uncle Danny",
"Vaikyia",
"Vladimier",
"Yatagarasu",
@@ -76,15 +76,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags
};
itemLoot.AddIf(getsLadPet, ModContent.ItemType<JoyfulHeart>());
// Mihaii dev item
// Name specific: "Mihaii"
static bool getsGoldenBomb(DropAttemptInfo info)
{
string playerName = info.player.name;
return playerName == "Mihaii";
};
itemLoot.AddIf(getsGoldenBomb, ModContent.ItemType<GoldenBomb>());
// HPU dev item
// Name specific: "Heart Plus Up"
static bool getsHapuFruit(DropAttemptInfo info)
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.height = 34;
Item.DamageType = DamageClass.Magic;
Item.mana = 9;
Item.damage = 40;
Item.damage = 31;
Item.knockBack = 11f;
Item.useAnimation = Item.useTime = 11;
Item.autoReuse = true;
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 38;
Item.height = 42;
Item.damage = 79;
Item.damage = 95;
Item.DamageType = DamageClass.Magic;
Item.mana = 13;
Item.useTime = 20;
+1 -1
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.width = 112;
Item.height = 112;
Item.DamageType = DamageClass.Magic;
Item.damage = 5000;
Item.damage = 5100;
Item.knockBack = 9.5f;
Item.mana = 80;
Item.useAnimation = Item.useTime = AftershotCooldownFrames;
+4 -4
View File
@@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Magic
{
public new string LocalizationCategory => "Items.Weapons.Magic";
public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot");
public static readonly SoundStyle VacuumStart = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumStart") with { Volume = 0.75f };
public static readonly SoundStyle VacuumLoop = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumLoop") with { Volume = 0.75f };
public static readonly SoundStyle VacuumEnd = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumEnd") with { Volume = 0.75f };
public static readonly SoundStyle VacuumStart = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumStart") with { Volume = 0.5f };
public static readonly SoundStyle VacuumLoop = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumLoop") with { Volume = 0.5f };
public static readonly SoundStyle VacuumEnd = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumEnd") with { Volume = 0.5f };
public const int ShotsPerSoul = 50;
public int storedSoulpower = 0;
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 124;
Item.height = 52;
Item.damage = 97;
Item.damage = 117;
Item.DamageType = DamageClass.Magic;
Item.mana = 15;
Item.useAnimation = Item.useTime = 60;
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 60;
Item.height = 62;
Item.damage = 2893;
Item.damage = 2626; //Some kind of... brainstorm
Item.DamageType = DamageClass.Magic;
Item.mana = 45;
Item.useAnimation = Item.useTime = 16;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 220;
Item.height = 60;
Item.damage = 840;
Item.damage = 890;
Item.DamageType = DamageClass.Magic;
Item.mana = 50;
Item.useAnimation = Item.useTime = 80; // 42 frames of firing animation
+2
View File
@@ -46,6 +46,8 @@ namespace CalamityMod.Items.Weapons.Melee
public override void HoldItem(Player player)
{
player.Calamity().mouseWorldListener = true;
if (player.whoAmI != Main.myPlayer)
return;
if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse)
{
SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode");
+4 -2
View File
@@ -1,8 +1,9 @@
using CalamityMod.Items.Materials;
using System;
using CalamityMod.Enums;
using CalamityMod.Items.Materials;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -90,6 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee
GeneralParticleHandler.SpawnParticle(spark3);
Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen);
GeneralParticleHandler.SpawnParticle(spark2);
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection);
+2
View File
@@ -44,6 +44,8 @@ namespace CalamityMod.Items.Weapons.Melee
public override void HoldItem(Player player)
{
player.Calamity().mouseWorldListener = true;
if (player.whoAmI != Main.myPlayer)
return;
if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse)
{
SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode");
@@ -43,6 +43,8 @@ namespace CalamityMod.Items.Weapons.Melee
public override void HoldItem(Player player)
{
player.Calamity().mouseWorldListener = true;
if (player.whoAmI != Main.myPlayer)
return;
if (player.Calamity().mouseRight && !player.mouseInterface && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse)
{
SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode");
+1 -1
View File
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 78;
Item.height = 78;
Item.damage = 240;
Item.damage = 310;
Item.DamageType = DamageClass.Melee;
Item.useStyle = ItemUseStyleID.Swing;
Item.useAnimation = Item.useTime = 20;
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 66;
Item.height = 70;
Item.damage = 300;
Item.damage = 250;
Item.DamageType = DamageClass.MeleeNoSpeed;
Item.noMelee = true;
Item.useTurn = true;
+1 -1
View File
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 90;
Item.height = 134;
Item.damage = 2001;
Item.damage = 2200;
Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
Item.noMelee = true;
Item.noUseGraphic = true;
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 86;
Item.height = 64;
Item.damage = 1100;
Item.damage = 1170;
Item.DamageType = DamageClass.MeleeNoSpeed;
Item.useAnimation = Item.useTime = 55;
Item.knockBack = 8.5f;
+2 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
+2 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
+1 -1
View File
@@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => flexMult = 1f;
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => flexMult = 1f;
public override float StealthDamageMultiplier => 0.4f;
public override float StealthDamageMultiplier => 0.9f;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
+9 -1
View File
@@ -6,6 +6,7 @@ using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -15,6 +16,9 @@ namespace CalamityMod.Items.Weapons.Summon
public class SarosPossession : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Summon";
public static SoundStyle FiringSound => new SoundStyle("CalamityMod/Sounds/Item/Summon/SarosFiring") with { MaxInstances = 1 ,Volume = 0.3f, pitchVariance = 0.05f, pitch = 0.5f };
public static SoundStyle SpawnSound => new SoundStyle("CalamityMod/Sounds/Item/Summon/SarosSpawn");
public static SoundStyle LoopSound => SoundID.DD2_BetsyFlameBreath with { Volume = 0.2f };
public override void SetDefaults()
{
Item.width = 44;
@@ -25,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.useStyle = ItemUseStyleID.Swing;
Item.noMelee = true;
Item.knockBack = 1.15f;
Item.UseSound = SoundID.Item44;
Item.UseSound = null;
Item.buffType = ModContent.BuffType<SarosPossessionBuff>();
Item.shoot = ModContent.ProjectileType<SarosAura>();
Item.DamageType = DamageClass.Summon;
@@ -47,12 +51,16 @@ namespace CalamityMod.Items.Weapons.Summon
var p = Main.projectile.First(x => x.active && x.type == type && x.owner == player.whoAmI);
p.ai[0]++;
p.netUpdate = true;
SoundEngine.PlaySound(SpawnSound with { MaxInstances = 10, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew, pitchVariance = 0.05f, }, player.Center);
return false;
} else
{
player.channel = false;
}
player.AddBuff(Item.buffType, 2);
SoundEngine.PlaySound(SpawnSound with { MaxInstances = 10, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew, pitchVariance = 0.05f, }, player.Center);
return true;
}
+1 -2
View File
@@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Typeless
public class StratusSphere : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Typeless";
public static readonly SoundStyle CastSound = new("CalamityMod/Sounds/Item/StratusSphereCast");
public static readonly SoundStyle LoopSound = new("CalamityMod/Sounds/Item/StratusSphereLoop");
public static readonly SoundStyle CastSound = new SoundStyle("CalamityMod/Sounds/Item/StratusSphereCast") with { Volume = 0.75f };
public override void SetDefaults()
{
@@ -2134,11 +2134,6 @@ GhostBracelet: {
Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity
}
GoldenBomb: {
DisplayName: Golden Bomb
Tooltip: "'I AM THE BOMB'"
}
HapuFruit: {
DisplayName: Ha-pu Fruit
Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'"
@@ -18,8 +18,8 @@ AqueousHunterDrone: {
<right> while holding any summon weapon to command the shrimp to launch a vertical missile barrage
Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground
Each shrimp uses 4 minion slots
[c/1FBFF:'When pursuing the adherents of gods, Yharim believed no stone should be left unturned.]
[c/1FBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.']
[c/1FFBFF:'When pursuing the adherents of gods, Yharim believed no stone should be left unturned.]
[c/1FFBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.']
'''
}
@@ -29,7 +29,7 @@ AethersWhisper: {
AlulaAustralis: {
DisplayName: Alula Australis
Tooltip: Fires a beautiful aurora trailed by a star shower
Tooltip: Fires a beautiful aurora that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] trailed by a star shower
}
AlphaDraconis: {
@@ -122,12 +122,12 @@ ArtAttack: {
AstralachneaStaff: {
DisplayName: Astralachnea Staff
Tooltip: Fires a spread of homing astral spider fangs
Tooltip: Fires a spread of homing astral spider fangs that inflict [cbuff:CalamityMod/AstralInfectionDebuff]
}
AstralStaff: {
DisplayName: Astral Staff
Tooltip: Summons a large crystal from the sky that has a large area of effect on impact
Tooltip: Summons a large crystal from the sky that has a large area of effect on impact and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
}
Atlantis: {
@@ -113,12 +113,12 @@ ArkoftheElements: {
AstralPike: {
DisplayName: Astral Pike
Tooltip: Summons astral star swarms on hit
Tooltip: Summons astral star swarms on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
}
AstralScythe: {
DisplayName: Astral Scythe
Tooltip: Shoots a scythe ring that accelerates over time
Tooltip: Shoots a scythe ring that accelerates over time and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
}
Ataraxia: {
@@ -903,7 +903,7 @@ Nadir: {
Nebulash: {
DisplayName: Nebulash
Tooltip: Fires a whip sword that emits particle explosions on hit
Tooltip: Fires a whip sword that emits particle explosions on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
}
NeptunesBounty: {
@@ -1352,7 +1352,7 @@ TheMicrowave: {
Tooltip:
'''
{$Common.YoyoStatsInfinite}
Fries nearby enemies with radiation
Fries nearby enemies with radiation and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
'Cooking, Astral Infection style'
'''
}
@@ -1393,7 +1393,7 @@ TitanArm: {
DisplayName: Titan Arm
Tooltip:
'''
Sends enemies straight to the stars at the speed of light
Sends enemies straight to the stars at the speed of light and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
Slap Hand but better
'''
}
@@ -120,7 +120,7 @@ ArterialAssault: {
AstralBlaster: {
DisplayName: Astral Blaster
Tooltip: Converts musket balls into homing astral rounds
Tooltip: Converts musket balls into homing astral rounds that inflict [cbuff:CalamityMod/AstralInfectionDebuff]
}
AstrealDefeat: {
@@ -145,7 +145,7 @@ AuroraBlazer: {
DisplayName: Aurora Blazer
Tooltip:
'''
Spews a nebula stream which forms a star shaped pattern
Spews a nebula stream which forms a star shaped pattern and inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
Uses gel for ammo
'''
}
@@ -1231,7 +1231,7 @@ StarSputter: {
DisplayName: Star Sputter
Tooltip:
'''
Fires a chain of comets
Fires a chain of comets that inflict [cbuff:CalamityMod/AstralInfectionDebuff]
Fires a bigger, more powerful comet every four rounds
'Look to the stars for a galaxy far, far away'
'''
@@ -1239,7 +1239,7 @@ StarSputter: {
StellarCannon: {
DisplayName: Stellar Cannon
Tooltip: Launches an explosive astral crystal
Tooltip: Launches an explosive astral crystal that inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
}
StormSurge: {
@@ -1311,6 +1311,7 @@ TauCannon: {
Charge level one fires a burst of bolts
Charge level two fires a beam of energy that quickly fizzles out
Charge level three fires a massive laser and creates astral portals around you
Inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
'This weapon is very ethically questionable'
'''
}
@@ -39,6 +39,7 @@ AuroradicalThrow: {
Launches a star that splits after a short period of time
Split stars home in on nearby enemies after a few seconds
Stealth strikes summon a meteor upon enemy impact
Inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
'''
}
@@ -557,6 +558,7 @@ HeavenfallenStardisk: {
Throws a stardisk upwards which then launches itself towards your mouse cursor
Explodes into a star of astral bolts on hit
Stealth strikes rain astral energy bolts from the sky
Inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
'''
}
@@ -668,6 +670,7 @@ LeonidProgenitor: {
Throws a bombshell that explodes, summoning a meteor to impact the site
Press <right> to throw a spread of gravity affected comets that explode, leaving behind a star
Stealth strikes lob a bombshell that additionally splits into comets on hit
Inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
'''
}
@@ -867,7 +870,7 @@ RadiantStar: {
DisplayName: Radiant Star
Tooltip:
'''
Throws daggers that explode and split after a while
Throws daggers that explode and split after a while and inflict [cbuff:CalamityMod/AstralInfectionDebuff]
Stealth strikes split more with a devastating explosion that sucks enemies in
'''
}
@@ -904,7 +907,7 @@ RegulusRiot: {
DisplayName: Regulus Riot
Tooltip:
'''
Fires a swift homing disk
Fires a swift homing disk that inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
Stealth strikes explode into energy stars
'''
}
@@ -1124,7 +1127,7 @@ StellarKnife: {
DisplayName: Stellar Knife
Tooltip:
'''
Throws knives that stop middair and then home into enemies
Throws knives that stop middair and then home into enemies, inflicting [cbuff:CalamityMod/AstralInfectionDebuff]
Stealth strikes throw a volley of 10 knives in a spread
'ZA WARUDO'
'''
@@ -2,6 +2,7 @@ AbandonedSlimeStaff: {
DisplayName: Abandoned Slime Staff
Tooltip:
'''
Summons an astral slime that inflicts [cbuff:CalamityMod/AstralInfectionDebuff]
Consumes all of the remaining minion slots on use
Must be used from the hotbar
Increased power and size based on the number of minion slots used
@@ -756,7 +757,7 @@ StaffOfNecrosteocytes: {
StarspawnHelixStaff: {
DisplayName: Starspawn Helix Staff
Tooltip: Summons astral probes to protect you
Tooltip: Summons astral probes that inflict [cbuff:CalamityMod/AstralInfectionDebuff]
}
StellarTorusStaff: {
@@ -255,7 +255,6 @@ SilvaCrystal.DisplayName: Silva Crystal
SilvaCrystalExplosion.DisplayName: Silva Explosion
SiriusBeam.DisplayName: Sirius Beam
SiriusQuasar.DisplayName: Sirius Quasar
SiriusExplosion.DisplayName: Sirius Explosion
SiriusMinion.DisplayName: Sirius
SkeletalDragonChild.DisplayName: Skeletal Child
SkeletalDragonMother.DisplayName: Skeletal Mother
@@ -616,7 +616,6 @@ Lecherous: {
Disenchant: Disenchant
// Worldgen Tasks
BetterUnderworld: Creating a smoother Underworld
BetterShimmer: Placing shimmer in a sane location
UnderworldStructures: Remnants of an Azafurian and Demonic war
UnderworldTreesAndGrass: Growing Underworld flora
UnderworldGeyserTraps: Adding an Underworld minefield
+2 -2
View File
@@ -443,12 +443,12 @@ namespace CalamityMod.NPCs
break;
// Chaos Elemental
// Rod of Discord @ 0.5% Normal, 0.625% Expert+ (2.5 times higher chance than vanilla)
// Rod of Discord @ 1% Normal, 2% Expert+
case NPCID.ChaosElemental:
// Remove the vanilla loot rule for Rod of Discord.
npcLoot.RemoveWhere((rule) => rule is CommonDrop conditionalRule && conditionalRule.itemId == ItemID.RodofDiscord);
// Define a replacement rule which has an increased chance.
npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 200, 160));
npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 100, 50));
break;
// Illuminant Bat
+1
View File
@@ -370,6 +370,7 @@ namespace CalamityMod.NPCs
"Kendra", // <@!237247188005158912> (lordmetarex)
"Libby", // <@!338315261352476682> (tyeski)
"Myles", // <@!658760860722004017> (apotofkoolaid)
"Luna", // <@!534132902095749120> (mizzultraviolet)
];
private static readonly string[] TownDogCorgiNames = null;
private static readonly string[] TownDogDalmatianNames = null;
@@ -54,7 +54,7 @@ public class BrainIllusion : ModNPC, ILocalizedModType
NPC.npcSlots = 0f;
NPC.netAlways = true;
Music = MusicID.Boss3;
SceneEffectPriority = SceneEffectPriority.BiomeLow;
SceneEffectPriority = (SceneEffectPriority)(-1);
}
public override void OnSpawn(IEntitySource source)
@@ -73,6 +73,15 @@ public class BrainIllusion : ModNPC, ILocalizedModType
return;
}
NPC brain = Main.npc[NPC.crimsonBoss];
if (brain.AIOverride<BrainOfCthulhuAI>().AIState == BrainOfCthulhuAI.BrainAIState.DeathAnimation)
{
NPC.damage = 0;
NPC.Opacity -= 0.1f;
if (NPC.Opacity <= 0)
NPC.active = false;
}
Player target = Main.player[NPC.target];
NPC.GivenName = brain.GivenOrTypeName + $": {brain.life}/{brain.lifeMax}";
@@ -40,6 +40,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride
public static SoundStyle Laugh = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Laugh") with { PauseBehavior = PauseBehavior.PauseWithGame };
private static SoundStyle Growl = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Growl", 2) with { PauseBehavior = PauseBehavior.PauseWithGame };
private static SoundStyle Death = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Death_Roar") with { PauseBehavior = PauseBehavior.PauseWithGame };
private static SoundStyle BloodShot = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_BloodShot");
private static SoundStyle BloodExplosion = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Explosion", 2);
internal static bool SummonedViaItem = false;
internal List<Particle> BoCAfterImages = [];
@@ -546,6 +549,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.oldVelocity = NPC.velocity;
Time++;
if(AIState != BrainAIState.DeathAnimation && NPC.lifeRegen < 0 && Math.Abs(NPC.lifeRegen) >= NPC.life)
TriggerDeathAnimation();
return false;
}
@@ -1889,8 +1895,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride
}
}
if (Main.netMode != NetmodeID.MultiplayerClient)
if (Time % BloodshotRate == 0)
if (Time % BloodshotRate == 0)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 dir = NPC.DirectionTo(Target.Center);
@@ -1908,7 +1915,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, initialDir * BloodshotVelocity / 2.1f, ProjectileID.BloodNautilusShot, BloodShotDamage, 0.5f, ai0: dir.ToRotation() + MathHelper.TwoPi, ai1: initialDir.ToRotation());
}
}
SoundEngine.PlaySound(BloodShot with { PitchVariance = 0.5f }, NPC.Center);
}
}
}
@@ -2065,11 +2073,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
if (AttackCounter <= SanguineTeleportCount)
{
SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion")
{
Volume = 0.5f
};
SoundEngine.PlaySound(explosion, NPC.Center);
SoundEngine.PlaySound(BloodExplosion, NPC.Center);
for (int i = 0; i < SanguineScytheCount; i++)
{
@@ -2250,10 +2254,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
if (Time == CrimsonEyeAttackIdleDuration)
{
SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion");
explosion.Volume = 0.5f;
SoundEngine.PlaySound(explosion, NPC.Center);
SoundEngine.PlaySound(BloodExplosion, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float projCount = 10;
@@ -2723,12 +2724,13 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.Opacity = BringOpacityTo(NPC.Opacity, 1, 0.1f);
(float angle, Vector2 offset, int time)[] bloodGushingData = [
(MathHelper.Pi / 6f, new(18, 12), 90),
(MathHelper.Pi / 6f, new(18, 12), 60),
(MathHelper.Pi, new(-30, -10), 150),
(-MathHelper.Pi / 4f, new(20, -40), 180),
(MathHelper.Pi + MathHelper.Pi / 4f, new(-20, -40), 200),
(MathHelper.Pi / 1.75f, new(-5, 22), 210)
(-MathHelper.Pi / 4f, new(20, -40), 210),
(MathHelper.Pi + MathHelper.Pi / 4f, new(-20, -40), 240),
(MathHelper.Pi / 1.75f, new(-5, 22), 260)
];
float EndTime = 270f;
for (int i = 0; i < bloodGushingData.Length; i++)
{
@@ -2736,7 +2738,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
if (Time == bloodGushingData[i].time)
{
if(i == 2)
if(i == 3)
SoundEngine.PlaySound(Death, NPC.Center);
Vector2 bloodDir = bloodGushingData[i].angle.ToRotationVector2();
@@ -2744,12 +2746,11 @@ public class BrainOfCthulhuAI : VanillaAIOverride
GeneralParticleHandler.SpawnParticle(p2);
NPC.velocity = bloodDir * -4f;
SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion")
SoundStyle bleed = BloodShot with
{
Volume = 0.5f,
Pitch = i / (float)(bloodGushingData.Length - 1)
};
SoundEngine.PlaySound(explosion, NPC.Center);
SoundEngine.PlaySound(bleed, NPC.Center);
Main.LocalPlayer.SetScreenshake(1f);
}
@@ -2763,10 +2764,10 @@ public class BrainOfCthulhuAI : VanillaAIOverride
}
if (Time >= 215)
if (Time >= EndTime)
{
SoundStyle explosion = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion");
SoundEngine.PlaySound(explosion, NPC.Center);
SoundEngine.PlaySound(BloodExplosion, NPC.Center);
SoundEngine.PlaySound(BloodShot, NPC.Center);
Main.LocalPlayer.SetScreenshake(2f);
@@ -2790,8 +2791,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.StrikeInstantKill();
}
float animationCompletion = Time / 215f;
float animationCompletion = Time / EndTime;
NPC.frameCounter += 2 * animationCompletion;
BoCDrawOffset = Main.rand.NextVector2Circular(4, 4) * animationCompletion;
if (Main.rand.NextFloat(0.5f, 1f) < animationCompletion)
{
@@ -2889,17 +2891,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
if (AIState != BrainAIState.DeathAnimation && (NPC.life + 1) <= hit.Damage)
{
NPC.life = 1;
NPC.BossBar = null;
NPC.dontTakeDamage = true;
if (AIState == BrainAIState.Stunned)
TeleportTime = 0;
AIState = BrainAIState.DeathAnimation;
ResetAttackValues();
Time = 0;
NPC.netUpdate = true;
TriggerDeathAnimation();
return;
}
@@ -2910,6 +2902,30 @@ public class BrainOfCthulhuAI : VanillaAIOverride
}
}
private void TriggerDeathAnimation()
{
NPC.life = 1;
NPC.lifeRegen = 0;
NPC.BossBar = null;
NPC.dontTakeDamage = true;
if (AIState == BrainAIState.Stunned || AIState == BrainAIState.IllusionTrick)
TeleportTime = 0;
foreach (NPC n in Main.ActiveNPCs)
{
if (n.type != ModContent.NPCType<FalseBrain>())
continue;
n.ModNPC<FalseBrain>().BeenHit = true;
}
AIState = BrainAIState.DeathAnimation;
ResetAttackValues();
Time = 0;
NPC.netUpdate = true;
}
public override bool PreKill(Mod mod) => AIState == BrainAIState.DeathAnimation && !NPC.dontTakeDamage;
public override void FindFrame(Mod mod, int frameHeight)
@@ -3036,6 +3052,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
if (n.ModNPC is FalseBrain falseBrain)
falseBrain.DrawSelf(spriteBatch, screenPos, Lighting.GetColor(n.Center.ToTileCoordinates()));
else if (AIState == BrainAIState.DeathAnimation)
drawBrain = true;
else
DrawBrainLikeFakes(spriteBatch, n);
}
@@ -65,6 +65,12 @@ public class BrainOfCthulhuSystem : ModSystem
if (Main.curMusic == MusicID.Boss3)
Main.curMusic = previousMusic;
}
if (Main.newMusic == MusicID.Boss1)
Main.newMusic = previousMusic;
if (Main.curMusic == MusicID.Boss1)
Main.curMusic = previousMusic;
}
private void StopOWBoss1FromStarting(On_Main.orig_UpdateAudio_DecideOnTOWMusic orig, Main self)
@@ -404,7 +410,11 @@ public class BrainOfCthulhuSystem : ModSystem
public override void PostUpdateEverything()
{
if (Main.curMusic != MusicID.Boss3 && Main.curMusic != MusicID.OtherworldlyBoss1)
bool allowBossMusic = false;
if (NPC.crimsonBoss != -1 && Main.npc[NPC.crimsonBoss].active && Main.npc[NPC.crimsonBoss].TryGetAIOverride<BrainOfCthulhuAI>(out var brainAI) && brainAI.AIState > BrainOfCthulhuAI.BrainAIState.SurfaceSpawnAnimation)
allowBossMusic = true;
if (((Main.curMusic != MusicID.Boss3 && Main.curMusic != MusicID.OtherworldlyBoss1) || allowBossMusic) && Main.curMusic != MusicID.Boss1)
previousMusic = Main.curMusic;
if (previousMusic == -1)
@@ -44,7 +44,7 @@ public class FalseBrain : ModNPC, ILocalizedModType
NPC.netAlways = true;
NPC.ShowNameOnHover = false;
Music = MusicID.Boss3;
SceneEffectPriority = SceneEffectPriority.BiomeLow;
SceneEffectPriority = (SceneEffectPriority)(-1);
NPC.localAI[0] = Main.rand.Next(6);
+35
View File
@@ -0,0 +1,35 @@
using System.IO;
using Terraria;
namespace CalamityMod.Packets.Entities
{
internal sealed class ManaBurnSyncPacket : CalamityPacket
{
public static ManaBurnSyncPacket Instance { get; private set; }
public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1)
{
if (npc is null)
return;
var packet = Instance.CreateBasePacket();
packet.WriteWhoAmI(npc);
packet.Write(npc.Calamity().manaBurn);
packet.Write(npc.Calamity().manaBurnPeak);
packet.Send(toClient, ignoreClient);
}
public override void HandlePacket(BinaryReader packet, int sender)
{
var npc = packet.ReadNPC();
var burn = packet.ReadSingle();
var burnPeak = packet.ReadSingle();
if (npc is null)
return;
npc.Calamity().manaBurn = burn;
npc.Calamity().manaBurnPeak = burnPeak;
}
}
}
@@ -21,6 +21,11 @@ namespace CalamityMod.Packets
packet.Write((Half)player.drawingParameters.ProfanedShieldCharge); // 2b
packet.WriteRGB(player.drawingParameters.ProfanedShieldColor); // 3b
packet.Write((Half)player.drawingParameters.SpongeShieldCharge); // 2b
packet.Write((short)player.RoverDriveShieldDurability);
packet.Write((short)player.LunicCorpsShieldDurability);
packet.Write((short)player.pSoulShieldDurability);
packet.Write((short)player.SpongeShieldDurability);
packet.Send(toClient, ignoreClient);
}
@@ -32,6 +37,10 @@ namespace CalamityMod.Packets
var profanedCharge = (float)packet.ReadHalf();
var profanedColor = packet.ReadRGB();
var spongeCharge = (float)packet.ReadHalf();
var roverDurability = packet.ReadInt16();
var lunicDurability = packet.ReadInt16();
var pSoulDurability = packet.ReadInt16();
var spongeDurability = packet.ReadInt16();
if (player is null)
return;
@@ -41,6 +50,10 @@ namespace CalamityMod.Packets
player.drawingParameters.ProfanedShieldCharge = profanedCharge;
player.drawingParameters.ProfanedShieldColor = profanedColor;
player.drawingParameters.SpongeShieldCharge = spongeCharge;
player.RoverDriveShieldDurability = roverDurability;
player.LunicCorpsShieldDurability = lunicDurability;
player.pSoulShieldDurability = pSoulDurability;
player.SpongeShieldDurability = spongeDurability;
if (Main.dedServ)
Send(player, ignoreClient: sender);
@@ -197,27 +197,46 @@ namespace CalamityMod.Projectiles.BaseProjectiles
// The center of the player, taking into account if they have a mount or not.
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
// The vector between the player and the mouse, used for pointing the holdout.
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition;
// The direction this holdout's pointing at.
float holdoutDirection = Projectile.velocity.ToRotation();
// A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively.
// Used for the offsets.
float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir);
// Only the owner should compute aiming from mouse position.
// Non-owner clients use the synced rotation/direction to avoid jitter.
if (Projectile.owner == Main.myPlayer)
{
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
// The vector between the player and the mouse, used for pointing the holdout.
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition;
int direction = MathF.Sign(ownerToMouse.X);
// A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively.
// Used for the offsets.
float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir);
Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm;
Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir);
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), WeaponTurnSpeed).ToRotationVector2();
Projectile.rotation = holdoutDirection;
int direction = MathF.Sign(ownerToMouse.X);
Projectile.spriteDirection = direction;
Owner.ChangeDir(direction);
Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm;
Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir);
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), WeaponTurnSpeed).ToRotationVector2();
Projectile.rotation = holdoutDirection;
Projectile.spriteDirection = direction;
Owner.ChangeDir(direction);
}
else
{
Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm;
float proximityLookingUpwards = Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir);
int direction = Projectile.spriteDirection;
Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir);
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = Projectile.rotation.ToRotationVector2();
Owner.ChangeDir(direction);
}
int currentDirection = Projectile.spriteDirection;
Owner.heldProj = Projectile.whoAmI;
if (SetUsage)
@@ -226,8 +245,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
// -Pi/2 because the arms rotation starts with arms pointing down.
float armRotation = (Projectile.rotation - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f);
Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * direction);
Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * direction);
Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * currentDirection);
Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * currentDirection);
if (KeepRefreshingLifetime)
Projectile.timeLeft = 2;
@@ -235,7 +254,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
if (OffsetLengthFromArm != MaxOffsetLengthFromArm)
OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed);
Projectile.ForceNetUpdate();
if (Projectile.owner == Main.myPlayer)
Projectile.ForceNetUpdate();
}
/// <summary>
@@ -251,12 +271,25 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
float drawRotation = Projectile.rotation;
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
SpriteEffects flipSprite = SpriteEffects.None;
if (Owner.gravDir == 1f)
{
if (Projectile.spriteDirection == -1)
flipSprite = SpriteEffects.FlipVertically;
}
else
{
rotationPoint.Y = texture.Height - rotationPoint.Y;
if (Projectile.spriteDirection == 1)
flipSprite = SpriteEffects.FlipVertically;
}
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite, 0);
return false;
}
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.BaseProjectiles
@@ -20,6 +21,31 @@ namespace CalamityMod.Projectiles.BaseProjectiles
// Also, be careful with the move and reelback speed. If they're bad values,
// the spear might end up detaching from or impaling the player.
private float GetSyncedItemAnimation(Player player)
{
float itemAnimation = player.itemAnimation;
if (Main.netMode != NetmodeID.SinglePlayer && Main.myPlayer == Projectile.owner)
{
if (Projectile.ai[1] != itemAnimation)
{
Projectile.ai[1] = itemAnimation;
Projectile.netUpdate = true;
}
}
if (Main.netMode == NetmodeID.SinglePlayer || Main.myPlayer == Projectile.owner)
return itemAnimation;
if (Projectile.ai[1] > 0f)
Projectile.localAI[1] = 1f;
if (Projectile.localAI[1] == 1f)
return Projectile.ai[1];
return Math.Max(1f, player.itemAnimationMax);
}
public virtual void Behavior()
{
if (SpearAiType == SpearType.TypicalSpear)
@@ -29,6 +55,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles
Player player = Main.player[Projectile.owner];
float itemAnimationMax = Math.Max(1f, player.itemAnimationMax);
float syncedItemAnimation = GetSyncedItemAnimation(player);
// Adjust owner stats based on this projectile
player.ChangeDir(Projectile.direction);
player.heldProj = Projectile.whoAmI;
@@ -47,7 +76,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
Projectile.netUpdate = true;
}
// Reel back
if (player.itemAnimation < player.itemAnimationMax / 3)
if (syncedItemAnimation < itemAnimationMax / 3f)
{
Projectile.ai[0] -= ReelbackSpeed;
@@ -67,7 +96,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
// If at the end of the animation, kill the projectile.
//Checking if == 0 is too late, lets the projectile linger into chained item uses.
if (player.itemAnimation <= 1)
if (syncedItemAnimation <= 1f)
Projectile.Kill();
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4;
@@ -78,6 +107,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
Player player = Main.player[Projectile.owner];
float itemAnimationMax = Math.Max(1f, player.itemAnimationMax);
float syncedItemAnimation = GetSyncedItemAnimation(player);
Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter, true);
Projectile.direction = player.direction;
@@ -92,7 +124,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
if (!player.frozen)
{
// Pretty much the same as regular spears.
if (Main.player[Projectile.owner].itemAnimation < Main.player[Projectile.owner].itemAnimationMax / 3)
if (syncedItemAnimation < itemAnimationMax / 3f)
{
if (Projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == Projectile.owner)
{
@@ -113,7 +145,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
Projectile.localAI[0] -= 1f;
}
float inverseAnimationCompletion = 1f - (player.itemAnimation / (float)player.itemAnimationMax);
float inverseAnimationCompletion = 1f - (syncedItemAnimation / itemAnimationMax);
float originalVelocityDirection = Projectile.velocity.ToRotation();
float originalVelocitySpeed = Projectile.velocity.Length();
+8 -1
View File
@@ -31,7 +31,14 @@ namespace CalamityMod.Projectiles.Boss
Projectile.timeLeft = 210;
}
public override void AI() => Projectile.Center = Main.npc[CalamityGlobalNPC.holyBoss].Center;
public override void AI()
{
int provIndex = CalamityGlobalNPC.holyBoss;
if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active)
return;
Projectile.Center = Main.npc[provIndex].Center;
}
public override bool PreDraw(ref Color lightColor)
{
+14 -10
View File
@@ -11,17 +11,18 @@ using CalamityMod.EntitySources;
using CalamityMod.Enums;
using CalamityMod.Events;
using CalamityMod.ExtraTextures;
using CalamityMod.Graphics;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Ammo;
using CalamityMod.Items.Fishing.FishingRods;
using CalamityMod.Items.Armor.Daedalus;
using CalamityMod.Items.Armor.Reaver;
using CalamityMod.Items.Fishing.FishingRods;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.NPCs;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Packets.Entities;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Healing;
@@ -54,7 +55,6 @@ using Terraria.Utilities;
using Terraria.WorldBuilding;
using static Terraria.ModLoader.ModContent;
using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech;
using CalamityMod.Graphics;
namespace CalamityMod.Projectiles
{
@@ -322,6 +322,7 @@ namespace CalamityMod.Projectiles
void ApplyGrapeBeer()
{
grapeBeer = true;
conditionalHomingRange = 600;
if (projectile.timeLeft > 300 * projectile.MaxUpdates)
projectile.timeLeft = 300 * projectile.MaxUpdates;
@@ -329,13 +330,13 @@ namespace CalamityMod.Projectiles
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = -1;
}
if (source is EntitySource_ItemUse_WithAmmo {Item: Item item})
if (source is EntitySource_ItemUse_WithAmmo { Item: Item item })
{
if (source is EntitySource_Parent { Entity: Player player })
{
if (player.Calamity().grapeBeer && (item.useAmmo == AmmoID.Bullet || item.useAmmo == AmmoID.Arrow || item.useAmmo == AmmoID.Dart || item.useAmmo == AmmoID.Rocket))
{
if (player.heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && player.Calamity().grapeBeerTimer < 5)
if (player.heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && player.Calamity().grapeBeerTimer < 5 && !CalamityProjectileSets.DoesNotGetHomingWithGrapeBeer[projectile.type])
ApplyGrapeBeer();
else
grapeBeer = true;
@@ -356,7 +357,7 @@ namespace CalamityMod.Projectiles
//Grape Beer homing
if (parent.Calamity().grapeBeer)
{
if (Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && Main.player[projectile.owner].Calamity().grapeBeerTimer < 5)
if (Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && projectile.damage > 0 && Main.player[projectile.owner].Calamity().grapeBeerTimer < 5 && !CalamityProjectileSets.DoesNotGetHomingWithGrapeBeer[projectile.type])
ApplyGrapeBeer();
else
grapeBeer = true;
@@ -4251,7 +4252,7 @@ namespace CalamityMod.Projectiles
arcFlashCooldown--;
if (arcFlashCooldown == 0)
showArcFlash = true;
if (conditionalHomingRange > 0f)
if (conditionalHomingRange > 0f && Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile)
{
CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 12f, 20f,true);
}
@@ -4690,9 +4691,12 @@ namespace CalamityMod.Projectiles
//Mana Burn
if (Main.player[projectile.owner].statMana < 0)
{
float burnRatio = (-Main.player[projectile.owner].statMana / 100) * ChaosStone.DamageMultPer100Mana;
target.Calamity().manaBurn += damageDone * burnRatio;
target.Calamity().playerManaBurnIntensity = -Main.player[projectile.owner].statMana / (float)Main.player[projectile.owner].statManaMax2;
var player = Main.player[projectile.owner];
float burnRatio = (-player.statMana / 100) * ChaosStone.DamageMultPer100Mana;
target.Calamity().manaBurn += damageDone * burnRatio * (player.Calamity().oldFashioned ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().ivDrip ? IVDripOnTheRocks.DamageBoostMultiplier : 1);
target.Calamity().playerManaBurnIntensity = -player.statMana / (float)player.statManaMax2;
if (Main.netMode != NetmodeID.SinglePlayer)
ManaBurnSyncPacket.Send(target);
}
// Hyperius Overflow
if (projectile.type != ProjectileType<HyperiusBulletProj>() && projectile.type != ProjectileType<HyperiusSplit>() && projectile.type != ProjectileType<HyperiusDamage>() && projectile.type != ProjectileType<HyperiusBleed>() && target.Calamity().hyperiusMarked)
+4
View File
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
@@ -58,6 +59,7 @@ namespace CalamityMod.Projectiles.Magic
GeneralParticleHandler.SpawnParticle(blastRing);
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true);
GeneralParticleHandler.SpawnParticle(blastRing2);
blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
Projectile.velocity *= 0.96f;
if (time == 3)
@@ -89,6 +91,7 @@ namespace CalamityMod.Projectiles.Magic
GeneralParticleHandler.SpawnParticle(spark);
Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.75f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2));
GeneralParticleHandler.SpawnParticle(spark2);
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
if (Main.rand.NextBool(6))
{
@@ -111,6 +114,7 @@ namespace CalamityMod.Projectiles.Magic
{
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true);
GeneralParticleHandler.SpawnParticle(blastRing2);
blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
Projectile.velocity = Vector2.Zero;
}
@@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Magic
target.AddBuff(BuffID.Frostburn2, 60);
float minMult = 0.2f;
int hitsToMinMult = 4;
int hitsToMinMult = 3;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
+1 -1
View File
@@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Magic
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
+1 -1
View File
@@ -287,7 +287,7 @@ namespace CalamityMod.Projectiles.Magic
Texture2D texGlow = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/IonBlasterGlow").Value;
Texture2D tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f);
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Vector2 shake = Main.rand.NextVector2Circular(2, 2) * manaPower;
+3
View File
@@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Magic
Projectile.scale = 1.85f;
Projectile.friendly = true;
Projectile.extraUpdates = 3;
Projectile.tileCollide = false;
Projectile.timeLeft = 600;
Projectile.penetrate = -1;
Projectile.DamageType = DamageClass.Magic;
@@ -51,6 +52,8 @@ namespace CalamityMod.Projectiles.Magic
// naturally dissipate entirely before despawning. Of course, it's also coded so that the laser stops dealing damage
// entirely once this is done to avoid hitting targets multiple times, so functionally the projectile remains the same
// and this change should have little to no effect on gameplay. If it does, ping me about it.
// 2FEB2026: sunny:
// Due to Calclone's new border, lasers no longer have tile collision, so this part of the code is now only used for hitting targets.
if (ShouldStopAndDie)
{
Projectile.velocity *= 0f;
+1 -1
View File
@@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic
SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, Owner.Center);
Vector2 laserPos = TipPosition + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-7f, 7f);
Vector2 laserVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 20f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType<SHPL>(), (int)(Projectile.damage * 1.35f), 3f, Projectile.owner, SoulColors[0]);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType<SHPL>(), (int)(Projectile.damage * 1.4f), 3f, Projectile.owner, SoulColors[0]);
if (ConsumeSoul)
{
+2 -2
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic
if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying)
ChargeSound.Position = Projectile.Center;
chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.3f : 1);
chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.4f : 1);
if (CurrentOverchargeFrames < FullyChargedFrames)
overchargePower = MathHelper.Clamp(Utils.GetLerpValue(FullyChargedFrames * 2, 0, CurrentOverchargeFrames, true), 0.5f, 1);
else
@@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Magic
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
@@ -6,6 +6,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.CalamityUtils;
@@ -48,6 +49,23 @@ namespace CalamityMod.Projectiles.Melee
public int bounces = 0;
public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime);
private Vector2 GetAimDirection()
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
float aimAngle = toMouse.ToRotation();
if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f)
{
Projectile.localAI[1] = aimAngle;
if (Projectile.timeLeft % 6 == 0)
Projectile.netUpdate = true;
}
return toMouse;
}
return Projectile.localAI[1].ToRotationVector2();
}
public override void SetDefaults()
{
Projectile.width = 12;
@@ -134,16 +152,19 @@ namespace CalamityMod.Projectiles.Melee
CurrentState &= ~State.HitTarget;
}
if ((CurrentState & State.Thrown) != 0 && (CurrentState & (State.StuckInGround | State.StuckInTarget)) == 0)
Projectile.extraUpdates = 1;
float playerDist = Vector2.Distance(Owner.Center, Projectile.Center);
Projectile.spriteDirection = Projectile.direction;
Vector3 Light = Color.Firebrick.ToVector3();
Lighting.AddLight(Projectile.Center, Light * 0.5f);
if (Projectile.timeLeft == Lifetime)
if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner)
{
// 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
Vector2 toMouse = GetAimDirection();
Projectile.velocity = toMouse * 14;
Projectile.Center = Owner.MountedCenter + toMouse * 12f;
Projectile.spriteDirection = Projectile.direction;
@@ -151,6 +172,7 @@ namespace CalamityMod.Projectiles.Melee
time = 0;
Projectile.extraUpdates = 1;
Projectile.tileCollide = true;
Projectile.netUpdate = true;
}
if (Projectile.velocity.X > 0)
@@ -287,7 +309,8 @@ namespace CalamityMod.Projectiles.Melee
public void throwAnimation()
{
Owner.ChangeDir(MathF.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X));
Vector2 aimDirection = GetAimDirection();
Owner.ChangeDir(MathF.Sign(aimDirection.X));
float armRotation = ArmAnticipationMovement() * Owner.direction;
@@ -358,6 +381,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2);
SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center);
Projectile.netUpdate = true;
}
public override bool? CanDamage()
@@ -407,11 +431,22 @@ namespace CalamityMod.Projectiles.Melee
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write((byte)CurrentState);
writer.Write(Projectile.rotation);
writer.Write(Projectile.localAI[1]);
writer.Write(impalePos.X);
writer.Write(impalePos.Y);
writer.Write(stuckTimer);
writer.Write((short)bounces);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
CurrentState = (State)reader.ReadByte();
Projectile.rotation = reader.ReadSingle();
Projectile.localAI[1] = reader.ReadSingle();
impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle());
stuckTimer = reader.ReadInt32();
bounces = reader.ReadInt16();
}
}
}
+105 -18
View File
@@ -1,4 +1,5 @@
using System;
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
using CalamityMod.Dusts;
@@ -51,8 +52,10 @@ namespace CalamityMod.Projectiles.Melee
public bool willDie = false;
public bool hasLaunchedBlades = false;
public bool swooshFade = false;
private int lastSwingId;
public NPC lastHitTarget = null;
private int lastHitTargetIndex = -1;
public int postSwingCooldownMax => (int)(useAnim * 0.65f);
public override void SetDefaults()
{
@@ -77,11 +80,26 @@ namespace CalamityMod.Projectiles.Melee
Projectile.knockBack = 0;
Projectile.scale = 1.15f;
Projectile.ai[1] = -1;
bool isOwner = Main.myPlayer == Projectile.owner;
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
{
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
Projectile.netUpdate = true;
}
else
{
Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer;
if (syncedDelta.LengthSquared() > 0.001f)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f;
else
aimVel = Vector2.UnitX * Owner.direction * 65f;
mousePos = Owner.Center - aimVel;
}
useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed<MeleeDamageClass>());
postSwingCooldown = postSwingCooldownMax / 2;
lastSwingId = (int)Projectile.ai[0];
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
@@ -117,32 +135,66 @@ namespace CalamityMod.Projectiles.Melee
}
public override void UseStyle()
{
bool isOwner = Main.myPlayer == Projectile.owner;
bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null)
Sound.Position = lastHitTarget.Center;
if (!isOwner)
{
Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer;
if (syncedDelta.LengthSquared() > 0.001f)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f;
}
if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0)
if (lastHitTargetIndex >= 0)
{
NPC syncedTarget = Main.npc[lastHitTargetIndex];
if (syncedTarget != null && syncedTarget.active && syncedTarget.life > 0)
lastHitTarget = syncedTarget;
}
if (isOwner)
{
bool shouldStartSwing = (Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0;
if (shouldStartSwing)
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
Projectile.ai[0] += 1f;
Projectile.netUpdate = true;
}
}
int swingId = (int)Projectile.ai[0];
if (swingId != lastSwingId && holding && postSwingCooldown == 0)
{
Animation = (int)(useAnim * 0.7f);
holding = false;
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
if (isOwner)
{
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
}
swingCount++;
lastSwingId = swingId;
}
if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null)
Sound.Position = lastHitTarget.Center;
if (postSwingCooldown > 0)
postSwingCooldown--;
else if (willDie)
{
if (hasKillMode)
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
if (isOwner)
{
if (hasKillMode)
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
Owner.Calamity().demonSwordKillMode = false;
}
DrawUnconditionally = false;
Projectile.Kill();
Owner.Calamity().demonSwordKillMode = false;
return;
}
if (killModeCD.timeLeft < KillMode.cooldownMax)
if (isOwner && killModeCD.timeLeft < KillMode.cooldownMax)
{
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
@@ -159,7 +211,7 @@ namespace CalamityMod.Projectiles.Melee
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
mousePos = isOwner ? Owner.Calamity().mouseWorld : (Owner.Center - aimVel);
}
if (CanHit && !swooshFade)
@@ -177,8 +229,15 @@ namespace CalamityMod.Projectiles.Melee
Projectile.numHits = 0;
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
{
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
}
else
{
mousePos = Owner.Center - aimVel;
}
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
@@ -187,8 +246,10 @@ namespace CalamityMod.Projectiles.Melee
finalFlip = false;
playSwingSound = true;
hasLaunchedBlades = false;
if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
if (isOwner && !Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
{
if (!willDie)
Projectile.netUpdate = true;
willDie = true;
if (lastHitTarget != null)
{
@@ -234,7 +295,8 @@ namespace CalamityMod.Projectiles.Melee
if (holding)
{
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f);
@@ -256,7 +318,8 @@ namespace CalamityMod.Projectiles.Melee
SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center);
playSwingSound = false;
Owner.Calamity().demonSwordKillMode = false;
if (isOwner)
Owner.Calamity().demonSwordKillMode = false;
}
if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f))
CanHit = true;
@@ -306,7 +369,12 @@ namespace CalamityMod.Projectiles.Melee
Projectile.numHits -= 1;
if (target != null && target.life > 0 && target.active)
{
lastHitTarget = target;
lastHitTargetIndex = target.whoAmI;
if (Main.myPlayer == Projectile.owner)
Projectile.netUpdate = true;
}
bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
@@ -438,5 +506,24 @@ namespace CalamityMod.Projectiles.Melee
public override void ResetStyle()
{
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(willDie);
writer.Write7BitEncodedInt(useAnim);
writer.Write7BitEncodedInt(lastHitTargetIndex);
writer.Write7BitEncodedInt(postSwingCooldown);
writer.WriteVector2(aimVel);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
willDie = reader.ReadBoolean();
useAnim = reader.Read7BitEncodedInt();
lastHitTargetIndex = reader.Read7BitEncodedInt();
postSwingCooldown = reader.Read7BitEncodedInt();
aimVel = reader.ReadVector2();
mousePos = Owner.Center - aimVel;
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Collections.Generic;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
@@ -44,6 +45,26 @@ namespace CalamityMod.Projectiles.Melee
public int bounces = 0;
public Vector2 tipPosition = Vector2.Zero;
public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime);
private bool visualChargeInitialized = false;
private int visualChargeTimer = 0;
private int visualChargeTime = 0;
private Vector2 GetAimDirection()
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
float aimAngle = toMouse.ToRotation();
if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f)
{
Projectile.localAI[1] = aimAngle;
if (Projectile.timeLeft % 6 == 0)
Projectile.netUpdate = true;
}
return toMouse;
}
return Projectile.localAI[1].ToRotationVector2();
}
public override void SetDefaults()
{
Projectile.width = 35;
@@ -58,6 +79,16 @@ namespace CalamityMod.Projectiles.Melee
Projectile.noEnchantmentVisuals = true;
}
public override void OnSpawn(Terraria.DataStructures.IEntitySource source)
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
Projectile.localAI[1] = toMouse.ToRotation();
Projectile.netUpdate = true;
}
}
public override bool ShouldUpdatePosition()
{
return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget);
@@ -66,10 +97,25 @@ namespace CalamityMod.Projectiles.Melee
//Swing animation keys
public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2);
public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3);
internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout });
internal float ArmAnticipationMovement(float progress) => PiecewiseAnimation(progress, new CurveSegment[] { pullback, throwout });
public override void AI()
{
bool isOwner = Main.myPlayer == Projectile.owner;
if (!visualChargeInitialized && !isOwner)
{
int fallbackCharge = (int)MathHelper.Clamp((Owner.HeldItem.useTime / 2.8f), 1, 100);
visualChargeTime = (int)(Projectile.localAI[2] > 0f ? Projectile.localAI[2] : fallbackCharge);
visualChargeTimer = visualChargeTime;
visualChargeInitialized = true;
}
if (!thrown && ChargeProgress >= 1f)
thrown = true;
if (thrown && !stuckInGround && !stuckInTarget && !exitedTarget)
Projectile.extraUpdates = 3;
float rate = (Main.GlobalTimeWrappedHourly + time * 3) * 2;
List<Color> eColors = new List<Color>()
{
@@ -87,10 +133,10 @@ namespace CalamityMod.Projectiles.Melee
Vector3 Light = Color.MediumOrchid.ToVector3();
Lighting.AddLight(Projectile.Center, Light * 0.85f);
if (Projectile.timeLeft == Lifetime)
if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner)
{
// 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
Vector2 toMouse = GetAimDirection();
Projectile.velocity = toMouse * 14;
Projectile.Center = Owner.MountedCenter + toMouse * 30f;
Projectile.spriteDirection = Projectile.direction;
@@ -129,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.velocity *= 0.01f;
stabbedTarget.Calamity().demonSwordImpales--;
stuckInTarget = false;
fadeOutEffect();
FadeOutEffect();
}
Projectile.Center = stabbedTarget.Center + impalePos;
@@ -155,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee
}
if (fadingOut)
fadeOutEffect();
FadeOutEffect();
}
if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1)
{
@@ -196,9 +242,16 @@ namespace CalamityMod.Projectiles.Melee
}
//Anticipation animation. Make the player look like they're holding the item
if (ChargeProgress < 1)
float chargeProgress = ChargeProgress;
bool canVisualCharge = !isOwner && Projectile.velocity.LengthSquared() < 0.01f && visualChargeTimer > 0;
if (canVisualCharge)
{
throwAnimation();
chargeProgress = 1f - (visualChargeTimer / (float)visualChargeTime);
visualChargeTimer--;
}
if (chargeProgress < 1f)
{
ThrowAnimation(chargeProgress);
if (ChargeProgress >= 0.6f && time == 0)
{
SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2);
@@ -210,7 +263,8 @@ namespace CalamityMod.Projectiles.Melee
else
time++;
}
public void fadeOutEffect()
public void FadeOutEffect()
{
Projectile.tileCollide = false;
if (Projectile.timeLeft > Lifetime - fadeOutTime)
@@ -229,11 +283,12 @@ namespace CalamityMod.Projectiles.Melee
dust.velocity += Projectile.velocity;
}
}
public void throwAnimation()
public void ThrowAnimation(float chargeProgress)
{
Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X));
Vector2 aimDirection = GetAimDirection();
Owner.ChangeDir(MathF.Sign(aimDirection.X));
float armRotation = ArmAnticipationMovement() * Owner.direction;
float armRotation = ArmAnticipationMovement(chargeProgress) * Owner.direction;
Owner.heldProj = Projectile.whoAmI;
Projectile.spriteDirection = Owner.direction;
@@ -362,25 +417,43 @@ namespace CalamityMod.Projectiles.Melee
return false;
}
/*
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(Projectile.timeLeft);
writer.Write(Projectile.rotation);
writer.Write(Projectile.localAI[2]);
writer.Write(Projectile.localAI[0]);
byte state = 0;
if (thrown)
state |= 1;
if (stuckInTarget)
state |= 2;
if (exitedTarget)
state |= 4;
if (stuckInGround)
state |= 8;
writer.WriteFlags(stuckInTarget, thrown);
writer.Write(state);
writer.Write(Projectile.rotation);
writer.Write(Projectile.localAI[0]);
writer.Write(Projectile.localAI[1]);
writer.Write(Projectile.localAI[2]);
writer.Write(impalePos.X);
writer.Write(impalePos.Y);
writer.Write(stuckTimer);
writer.Write((short)bounces);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
Projectile.timeLeft = reader.Read();
Projectile.rotation = reader.ReadSingle();
Projectile.localAI[2] = reader.ReadSingle();
Projectile.localAI[0] = reader.ReadSingle();
byte state = reader.ReadByte();
thrown = (state & 1) != 0;
stuckInTarget = (state & 2) != 0;
exitedTarget = (state & 4) != 0;
stuckInGround = (state & 8) != 0;
reader.ReadFlags(out stuckInTarget, out thrown);
Projectile.rotation = reader.ReadSingle();
Projectile.localAI[0] = reader.ReadSingle();
Projectile.localAI[1] = reader.ReadSingle();
Projectile.localAI[2] = reader.ReadSingle();
impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle());
stuckTimer = reader.ReadInt32();
bounces = reader.ReadInt16();
}
*/
}
}
+86 -16
View File
@@ -1,4 +1,5 @@
using System;
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
using CalamityMod.Dusts;
@@ -46,6 +47,7 @@ namespace CalamityMod.Projectiles.Melee
public bool willDie = false;
public bool hasLaunchedBlades = false;
public bool swooshFade = false;
private int lastSwingId;
public int postSwingCooldownMax => (int)(useAnim * 0.65f);
public override void SetDefaults()
{
@@ -62,11 +64,26 @@ namespace CalamityMod.Projectiles.Melee
Projectile.knockBack = 0;
Projectile.scale = 1.15f;
Projectile.ai[1] = -1;
bool isOwner = Main.myPlayer == Projectile.owner;
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
{
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
Projectile.netUpdate = true;
}
else
{
Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer;
if (syncedDelta.LengthSquared() > 0.001f)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f;
else
aimVel = Vector2.UnitX * Owner.direction * 65f;
mousePos = Owner.Center - aimVel;
}
useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed<MeleeDamageClass>());
postSwingCooldown = postSwingCooldownMax / 2;
lastSwingId = (int)Projectile.ai[0];
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
@@ -79,29 +96,56 @@ namespace CalamityMod.Projectiles.Melee
}
public override void UseStyle()
{
bool isOwner = Main.myPlayer == Projectile.owner;
bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0)
if (!isOwner)
{
Vector2 syncedDelta = Owner.Calamity().mouseWorldDeltaFromPlayer;
if (syncedDelta.LengthSquared() > 0.001f)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65f;
}
if (isOwner)
{
bool shouldStartSwing = (Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0;
if (shouldStartSwing)
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
Projectile.ai[0] += 1f;
Projectile.netUpdate = true;
}
}
int swingId = (int)Projectile.ai[0];
if (swingId != lastSwingId && holding && postSwingCooldown == 0)
{
Animation = (int)(useAnim * 0.7f);
holding = false;
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
if (isOwner)
{
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
}
swingCount++;
lastSwingId = swingId;
}
if (postSwingCooldown > 0)
postSwingCooldown--;
else if (willDie)
{
if (hasKillMode)
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
if (isOwner)
{
if (hasKillMode)
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
Owner.Calamity().demonSwordKillMode = false;
}
DrawUnconditionally = false;
Projectile.Kill();
Owner.Calamity().demonSwordKillMode = false;
return;
}
if (killModeCD.timeLeft < KillMode.cooldownMax)
if (isOwner && killModeCD.timeLeft < KillMode.cooldownMax)
{
killModeCD.timeLeft = KillMode.cooldownMax;
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
@@ -116,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
mousePos = isOwner ? Owner.Calamity().mouseWorld : (Owner.Center - aimVel);
}
if (CanHit && !swooshFade)
@@ -134,8 +178,15 @@ namespace CalamityMod.Projectiles.Melee
Projectile.numHits = 0;
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
{
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
}
else
{
mousePos = Owner.Center - aimVel;
}
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
@@ -144,8 +195,10 @@ namespace CalamityMod.Projectiles.Melee
finalFlip = false;
playSwingSound = true;
hasLaunchedBlades = false;
if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
if (isOwner && !Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
{
if (!willDie)
Projectile.netUpdate = true;
willDie = true;
}
@@ -169,7 +222,8 @@ namespace CalamityMod.Projectiles.Melee
if (holding)
{
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
if (isOwner)
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f);
@@ -191,7 +245,8 @@ namespace CalamityMod.Projectiles.Melee
SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center);
playSwingSound = false;
Owner.Calamity().demonSwordKillMode = false;
if (isOwner)
Owner.Calamity().demonSwordKillMode = false;
}
if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f))
CanHit = true;
@@ -335,5 +390,20 @@ namespace CalamityMod.Projectiles.Melee
public override void ResetStyle()
{
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(willDie);
writer.Write7BitEncodedInt(postSwingCooldown);
writer.WriteVector2(aimVel);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
willDie = reader.ReadBoolean();
postSwingCooldown = reader.Read7BitEncodedInt();
aimVel = reader.ReadVector2();
mousePos = Owner.Center - aimVel;
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Packets.Entities;
@@ -40,6 +41,26 @@ namespace CalamityMod.Projectiles.Melee
public int bounces = 0;
public Vector2 tipPosition = Vector2.Zero;
public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime);
private bool visualChargeInitialized = false;
private int visualChargeTimer = 0;
private int visualChargeTime = 0;
private Vector2 GetAimDirection()
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
float aimAngle = toMouse.ToRotation();
if (Math.Abs(MathHelper.WrapAngle(aimAngle - Projectile.localAI[1])) > 0.02f)
{
Projectile.localAI[1] = aimAngle;
if (Projectile.timeLeft % 6 == 0)
Projectile.netUpdate = true;
}
return toMouse;
}
return Projectile.localAI[1].ToRotationVector2();
}
public override void SetDefaults()
{
Projectile.width = 12;
@@ -54,6 +75,16 @@ namespace CalamityMod.Projectiles.Melee
Projectile.noEnchantmentVisuals = true;
}
public override void OnSpawn(Terraria.DataStructures.IEntitySource source)
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
Projectile.localAI[1] = toMouse.ToRotation();
Projectile.netUpdate = true;
}
}
public override bool ShouldUpdatePosition()
{
return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget);
@@ -62,20 +93,35 @@ namespace CalamityMod.Projectiles.Melee
//Swing animation keys
public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2);
public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3);
internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout });
internal float ArmAnticipationMovement(float progress) => PiecewiseAnimation(progress, new CurveSegment[] { pullback, throwout });
public override void AI()
{
bool isOwner = Main.myPlayer == Projectile.owner;
if (!visualChargeInitialized && !isOwner)
{
int fallbackCharge = (int)MathHelper.Clamp((Owner.HeldItem.useTime / 2.8f), 1, 100);
visualChargeTime = (int)(Projectile.localAI[2] > 0f ? Projectile.localAI[2] : fallbackCharge);
visualChargeTimer = visualChargeTime;
visualChargeInitialized = true;
}
if (!thrown && ChargeProgress >= 1f)
thrown = true;
if (thrown && !stuckInGround && !stuckInTarget)
Projectile.extraUpdates = 1;
float playerDist = Vector2.Distance(Owner.Center, Projectile.Center);
Projectile.spriteDirection = Projectile.direction;
Vector3 Light = Color.MediumOrchid.ToVector3();
Lighting.AddLight(Projectile.Center, Light * 0.5f);
if (Projectile.timeLeft == Lifetime)
if (Projectile.timeLeft == Lifetime && Main.myPlayer == Projectile.owner)
{
// 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction);
Vector2 toMouse = GetAimDirection();
Projectile.velocity = toMouse * 14;
Projectile.Center = Owner.MountedCenter + toMouse * 12f;
Projectile.spriteDirection = Projectile.direction;
@@ -115,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.velocity *= 0.01f;
stabbedTarget.Calamity().demonSwordImpales--;
stuckInTarget = false;
fadeOutEffect();
FadeOutEffect();
}
Projectile.Center = stabbedTarget.Center + impalePos;
@@ -141,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee
}
if (fadingOut)
fadeOutEffect();
FadeOutEffect();
}
if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1)
{
@@ -174,9 +220,16 @@ namespace CalamityMod.Projectiles.Melee
}
//Anticipation animation. Make the player look like they're holding the item
if (ChargeProgress < 1)
float chargeProgress = ChargeProgress;
bool canVisualCharge = !isOwner && Projectile.velocity.LengthSquared() < 0.01f && visualChargeTimer > 0;
if (canVisualCharge)
{
throwAnimation();
chargeProgress = 1f - (visualChargeTimer / (float)visualChargeTime);
visualChargeTimer--;
}
if (chargeProgress < 1f)
{
throwAnimation(chargeProgress);
if (ChargeProgress >= 0.6f && time == 0)
{
SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2);
@@ -188,7 +241,8 @@ namespace CalamityMod.Projectiles.Melee
else
time++;
}
public void fadeOutEffect()
public void FadeOutEffect()
{
Projectile.tileCollide = false;
if (Projectile.timeLeft > Lifetime - fadeOutTime)
@@ -207,11 +261,12 @@ namespace CalamityMod.Projectiles.Melee
dust.velocity += Projectile.velocity;
}
}
public void throwAnimation()
public void throwAnimation(float chargeProgress)
{
Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X));
Vector2 aimDirection = GetAimDirection();
Owner.ChangeDir(MathF.Sign(aimDirection.X));
float armRotation = ArmAnticipationMovement() * Owner.direction;
float armRotation = ArmAnticipationMovement(chargeProgress) * Owner.direction;
Owner.heldProj = Projectile.whoAmI;
Projectile.spriteDirection = Owner.direction;
@@ -296,7 +351,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (bounces >= 2)
{
impaleGround(oldVelocity);
ImpaleGround(oldVelocity);
}
else
{
@@ -318,12 +373,12 @@ namespace CalamityMod.Projectiles.Melee
}
else
{
impaleGround(oldVelocity);
ImpaleGround(oldVelocity);
}
Projectile.netUpdate = true;
return false;
}
public void impaleGround(Vector2 oldVelocity)
public void ImpaleGround(Vector2 oldVelocity)
{
Projectile.velocity = oldVelocity;
stuckInGround = true;
@@ -331,6 +386,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2);
SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center);
Projectile.netUpdate = true;
}
public override bool? CanDamage()
{
@@ -357,25 +413,43 @@ namespace CalamityMod.Projectiles.Melee
return false;
}
/*
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(Projectile.timeLeft);
writer.Write(Projectile.rotation);
writer.Write(Projectile.localAI[2]);
writer.Write(Projectile.localAI[0]);
byte state = 0;
if (thrown)
state |= 1;
if (stuckInTarget)
state |= 2;
if (exitedTarget)
state |= 4;
if (stuckInGround)
state |= 8;
writer.WriteFlags(stuckInTarget, thrown);
writer.Write(state);
writer.Write(Projectile.rotation);
writer.Write(Projectile.localAI[0]);
writer.Write(Projectile.localAI[1]);
writer.Write(Projectile.localAI[2]);
writer.Write(impalePos.X);
writer.Write(impalePos.Y);
writer.Write(stuckTimer);
writer.Write((short)bounces);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
Projectile.timeLeft = reader.Read();
Projectile.rotation = reader.ReadSingle();
Projectile.localAI[2] = reader.ReadSingle();
Projectile.localAI[0] = reader.ReadSingle();
byte state = reader.ReadByte();
thrown = (state & 1) != 0;
stuckInTarget = (state & 2) != 0;
exitedTarget = (state & 4) != 0;
stuckInGround = (state & 8) != 0;
reader.ReadFlags(out stuckInTarget, out thrown);
Projectile.rotation = reader.ReadSingle();
Projectile.localAI[0] = reader.ReadSingle();
Projectile.localAI[1] = reader.ReadSingle();
Projectile.localAI[2] = reader.ReadSingle();
impalePos = new Vector2(reader.ReadSingle(), reader.ReadSingle());
stuckTimer = reader.ReadInt32();
bounces = reader.ReadInt16();
}
*/
}
}
+2 -2
View File
@@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee
var player = Main.player[Projectile.owner];
var modPlayer = player.Calamity();
// Refund 20 energy if dash hits. Can get energy from multiple enemies.
modPlayer.elementalMastery += 20;
// Refund 30 energy if dash hits. Can get energy from multiple enemies.
modPlayer.elementalMastery += 30;
modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy);
// On-hit cut FX
+1 -1
View File
@@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee
{
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (MathHelper.PiOver4 * Projectile.spriteDirection) + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (MathHelper.PiOver4 * Projectile.spriteDirection) + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.PiOver2 * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
+1 -1
View File
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
// Setting the bolt's position on the player's back
Projectile.rotation = (21.8f - (Projectile.ai[1] * 0.1f)) * -Owner.direction;
Vector2 BoltPos = Owner.MountedCenter + new Vector2((10 + Projectile.ai[1] * 2.5f) * -Owner.direction, 3f - Projectile.ai[1]);
Vector2 BoltPos = Owner.MountedCenter + new Vector2((10 + Projectile.ai[1] * 2.5f) * -Owner.direction, 3f - Projectile.ai[1] + Owner.gfxOffY);
Projectile.Center = BoltPos;
}
@@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
{
for (var i = 0; i < 10; i++)
GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, (Projectile.rotation-MathHelper.PiOver4).ToRotationVector2().RotatedByRandom(0.4f) * -Main.rand.Next(10,20), false, 30, 2, new Color(69, 69, 200)));
Projectile.damage *= 20;
Projectile.damage = (int)(Projectile.damage*17.5f);
Projectile.Damage();
Owner.Calamity().StratusStarburst -= 10;
for (int i = 0; i < 3; i++)
@@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
Projectile.damage = Projectile.originalDamage;
if (Owner.Calamity().AvaliableStarburst >= 20)
{
Projectile.damage *= 30;
Projectile.damage *= 35;
Owner.SetImmuneTimeForAllTypes(Owner.longInvince ? 40 : 20);
Owner.Calamity().StratusStarburst -= 20;
SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Owner.Center);
+2 -2
View File
@@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee
Owner.SetScreenshake(3f);
SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt");
SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 0.5f);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 0.5f);
proj.timeLeft = 45;
swingCount = 0;
attackPower = 6;
@@ -233,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee
SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit");
SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 1f);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f);
swingCount = -1;
attackPower = 0;
}
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
@@ -155,7 +156,7 @@ namespace CalamityMod.Projectiles.Ranged
// Spawns the projectile.
if (Main.myPlayer == Projectile.owner)
{
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType<NukeOfBliss>(), damage, knockback, Projectile.owner, rocketType);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType<NukeOfBliss>(), damage, knockback, Projectile.owner, rocketType);
PostFireCooldown = Owner.itemAnimationMax;
Owner.SetScreenshake(5f);
}
@@ -217,7 +218,7 @@ namespace CalamityMod.Projectiles.Ranged
Texture2D texture2 = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/BlissfulBombardierGlow").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
+3 -3
View File
@@ -170,13 +170,13 @@ namespace CalamityMod.Projectiles.Ranged
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3);
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float randSize = Main.rand.NextFloat(0.9f, 1f);
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (homing)
{
+2
View File
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
@@ -60,6 +61,7 @@ namespace CalamityMod.Projectiles.Ranged
GeneralParticleHandler.SpawnParticle(spark);
Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false);
GeneralParticleHandler.SpawnParticle(spark2);
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
if (Time == 9f)
+4
View File
@@ -1,5 +1,7 @@
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Pets;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
@@ -32,6 +34,7 @@ namespace CalamityMod.Projectiles.Ranged
{
Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, color1, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0065f + 0.1f, Main.rand.Next(15, 22));
GeneralParticleHandler.SpawnParticle(explosion);
explosion.DrawLayer = GeneralDrawLayer.AfterEverything;
Particle explosion2 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0045f + 0.1f, Main.rand.Next(15, 22), false);
GeneralParticleHandler.SpawnParticle(explosion2);
Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false);
@@ -41,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged
{
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25);
GeneralParticleHandler.SpawnParticle(blastRing);
blastRing.DrawLayer = GeneralDrawLayer.AfterEverything;
}
float numberOfDusts = ExplosionRadius * 0.1f + 10;
+17 -3
View File
@@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged
public int maxFrames = 420;
public int initialFireTime = 45;
public float shineScale = 0;
private bool secondShot = true;
public override void KillHoldoutLogic()
{
@@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged
}
revSpeed = Utils.Remap(revFrames, 0, maxFrames - 120, 1, 20, true);
if (shootingTimer >= initialFireTime && revFrames < maxFrames)
if (shootingTimer >= initialFireTime && revFrames < maxFrames && secondShot && Owner.whoAmI == Main.myPlayer)
{
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
@@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
if (Main.myPlayer == Projectile.owner)
if (Owner.whoAmI == Main.myPlayer)
{
float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
@@ -69,14 +70,27 @@ namespace CalamityMod.Projectiles.Ranged
OffsetLengthFromArm -= 5f;
shineScale = 1;
secondShot = false;
}
if (shootingTimer >= 60 && revFrames < maxFrames)
{
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
if (Owner.whoAmI == Main.myPlayer)
{
float spread = 0.045f * Utils.GetLerpValue(0, maxFrames, revFrames, true);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity).RotatedByRandom(spread).RotatedByRandom(0.04f), bulletAMMO, Projectile.damage / 2, Projectile.knockBack, Projectile.owner);
Projectile.netUpdate = true;
}
shootingTimer = 0;
secondShot = true;
}
shootingTimer += revSpeed;
revFrames++;
shineScale *= 0.77f;
if (revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 ))
if ((revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) && Owner.whoAmI == Main.myPlayer)
{
Owner.SetScreenshake(6.5f);
OffsetLengthFromArm -= 35f;
+1 -1
View File
@@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Ranged
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/Hellborn").Value;
Texture2D spinTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/Hellborn").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
+2 -2
View File
@@ -319,7 +319,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 origin = pingTexture.Size() * 0.5f;
Vector2 pingDrawPosition;
Vector2 finalPosition = Owner.Center + new Vector2(40f * -Owner.direction, -40f);
Vector2 finalPosition = Owner.Center + new Vector2(40f * -Owner.direction, -40f * Owner.gravDir);
float progress = (float)pingAnimationTimer / PingAnimationDuration;
if (pingAnimationTimer < 15)
@@ -374,7 +374,7 @@ namespace CalamityMod.Projectiles.Ranged
// Calculate scale to display with all factors combined
Vector2 finalPingScale = new Vector2(basePingDrawScale * stretchScaleX, basePingDrawScale * stretchScaleY);
Main.EntitySpriteDraw(pingTexture, pingDrawPosition, null, drawColor, Owner.direction == 1 ? -0.25f : 0.25f, origin, finalPingScale, SpriteEffects.None, 0f);
Main.EntitySpriteDraw(pingTexture, pingDrawPosition, null, drawColor, (Owner.direction == 1 ? -0.25f : 0.25f) + (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f), origin, finalPingScale, (Owner.gravDir == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0f);
}
else
{
+5 -1
View File
@@ -1,10 +1,13 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Projectiles.Ranged.BlissfulBombardierHoldout;
@@ -133,6 +136,7 @@ namespace CalamityMod.Projectiles.Ranged
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
}
public override void OnKill(int timeLeft)
{
// Only do rocket effects for the owner client side
+17 -2
View File
@@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Ranged
for (int i = 0; i < 10; i++)
{
Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * (3f + sine * 0.3f);
Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, Color.OrangeRed with { A = 0 } * Math.Min(chargeScale, 1) * 0.4f, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0);
Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, Color.OrangeRed with { A = 0 } * Math.Min(chargeScale, 1) * 0.4f, drawRotation + (Owner.gravDir == -1 ? MathHelper.Pi : 0), rotationPoint, Projectile.scale, flipSprite, 0);
}
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
@@ -168,8 +168,23 @@ namespace CalamityMod.Projectiles.Ranged
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
// Handle glow copies
SpriteEffects flipSpriteGlow = SpriteEffects.None;
if (Owner.gravDir == -1f)
{
if (Projectile.spriteDirection == -1)
flipSpriteGlow = SpriteEffects.FlipVertically;
}
else
{
rotationPoint.Y = texture.Height - rotationPoint.Y;
if (Projectile.spriteDirection == 1)
flipSpriteGlow = SpriteEffects.FlipVertically;
}
for (int i = 0; i < 3; i++)
Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.OrangeRed : Color.Orange, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.3f * ((chargeScale >= 1 && CurrentChargingFrames <= OpalStriker.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), SpriteEffects.None, 0);
Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.OrangeRed : Color.Orange, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.3f * ((chargeScale >= 1 && CurrentChargingFrames <= OpalStriker.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), flipSpriteGlow, 0);
return false;
}
@@ -136,7 +136,6 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 pistilJiggleScale = new Vector2(1 - 0.25f * pistilPow, 1 + 0.5f * pistilPow);
drawPosition.X += 25 * Owner.direction;
drawPosition.Y += -5f;
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
@@ -183,21 +183,26 @@ namespace CalamityMod.Projectiles.Ranged
{
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f) - (Owner.gravDir == -1 ? MathHelper.Pi * Owner.direction : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Color tintColor = displayOverheat ? Color.Black :
BuiltHeat >= WarningTime ? Color.Lerp(Color.LightSalmon, Color.White, MathF.Abs(MathF.Sin(Owner.miscCounter * MathHelper.Pi / 30f))) : Color.LightSalmon;
float opacity = Utils.GetLerpValue(0, WarningTime, BuiltHeat, true);
Projectile.DrawBackglow(Color.HotPink * opacity, 4f, null, null, (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipVertically : SpriteEffects.None);
for (int i = 0; i < 16; i++)
{
Color auraColor = Color.HotPink * opacity * 0.6f;
Vector2 drawOffset = ((MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5);
Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
}
CalamityUtils.EnterShaderRegion(Main.spriteBatch);
GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity((displayOverheat ? 1f : opacity) * 0.45f);
GameShaders.Misc["CalamityMod:BasicTint"].UseColor(tintColor);
GameShaders.Misc["CalamityMod:BasicTint"].Apply();
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite);
CalamityUtils.ExitShaderRegion(Main.spriteBatch);
return false;
}
+24 -8
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
@@ -27,13 +28,14 @@ namespace CalamityMod.Projectiles.Ranged
public int time = 0;
public int lastUseTime = 0;
public int perfectLeniancy = 2;
public int goodLeniancy => perfectLeniancy + 6;
public static int perfectLeniancy = 2;
public static int goodLeniancy = perfectLeniancy + 6;
public static int starburstPerfectTime = 23;
public ref float shootingCooldown => ref Projectile.ai[0];
public ref float starburstTimer => ref Projectile.ai[1];
public int extendedCooldown => (int)(lastUseTime * 1.2f);
public int naildriverCooldown => (int)(lastUseTime * 1.5f);
public int starburstPerfectTime = 23;
public float recoilIntensity = 0;
public int recoilTimerMax = 62;
public Vector2 recoilDirection;
@@ -55,6 +57,17 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.DamageType = DamageClass.Ranged;
Projectile.tileCollide = false;
}
public override void SendExtraAIHoldout(BinaryWriter writer)
{
writer.Write(lastUseTime);
writer.Write(Projectile.spriteDirection);
}
public override void ReceiveExtraAIHoldout(BinaryReader reader)
{
lastUseTime = reader.ReadInt32();
Projectile.spriteDirection = reader.ReadInt32();
}
public override void HoldoutAI()
{
float rate = (time * 0.05f);
@@ -84,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged
return;
}
bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true);
bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo;
bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0;
bool leftShootChecks = Owner.whoAmI == Main.myPlayer && (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo;
bool rightShootChecks = Owner.whoAmI == Main.myPlayer && (Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0);
if (Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f)
if (Owner.whoAmI == Main.myPlayer && Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f)
{
OffsetLengthFromArm -= 8;
SoundStyle click = new("CalamityMod/Sounds/Item/DudFire");
@@ -97,6 +110,7 @@ namespace CalamityMod.Projectiles.Ranged
FireShotgun();
if (rightShootChecks)
{
Projectile.ForceNetUpdate();
SoundStyle test = new("CalamityMod/Sounds/Item/StarfleetStarburst");
SoundEngine.PlaySound(test with { Volume = 1f, Pitch = 0f }, Projectile.Center);
starburstTimer++;
@@ -149,6 +163,7 @@ namespace CalamityMod.Projectiles.Ranged
}
public void FireShotgun()
{
Projectile.ForceNetUpdate();
// 50% chance to not consume ammo
Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool());
@@ -171,8 +186,9 @@ namespace CalamityMod.Projectiles.Ranged
float randomVel = Main.rand.NextFloat(0.8f, 1f);
float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount;
float spread = (naildriver ? 0.06f : scattershot ? 0.9f : 0.25f);
Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType<StarfleetStar>(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1));
shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3;
int starExtraUpdates = naildriver ? 9 : scattershot ? 7 : 3;
Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType<StarfleetStar>(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, starExtraUpdates, Main.rand.Next(0, 300 + 1));
shotgun.extraUpdates = starExtraUpdates;
}
}
+3
View File
@@ -37,6 +37,9 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
if (time == 0 && Projectile.ai[1] > 0)
Projectile.extraUpdates = (int)Projectile.ai[1];
float rate = (Projectile.ai[2] * 0.05f);
List<Color> eColors = new List<Color>()
{
+25 -8
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
@@ -28,14 +29,14 @@ namespace CalamityMod.Projectiles.Ranged
public int time = 0;
public int lastUseTime = 0;
public int perfectLeniancy = 2;
public static int perfectLeniancy = 2;
public static int goodLeniancy = perfectLeniancy + 6;
public static int starburstPerfectTime = 23;
public float frontRecoil = 0;
public int goodLeniancy => perfectLeniancy + 6;
public ref float shootingCooldown => ref Projectile.ai[0];
public ref float starburstTimer => ref Projectile.ai[1];
public int extendedCooldown => (int)(lastUseTime * 1.2f);
public int perfectCooldown => (int)(lastUseTime * 1.5f);
public int starburstPerfectTime = 23;
public float recoilIntensity = 0;
public int recoilTimerMax = 62;
public Vector2 recoilDirection;
@@ -57,6 +58,19 @@ namespace CalamityMod.Projectiles.Ranged
public bool naildriver => ((starburstTimer <= starburstPerfectTime + perfectLeniancy) && (starburstTimer >= starburstPerfectTime - perfectLeniancy)); // if within perfect frame window
public bool scattershot => !naildriver && ((starburstTimer <= starburstPerfectTime + goodLeniancy) && (starburstTimer >= starburstPerfectTime - goodLeniancy)); // If within early or late frame window
public override void KillHoldoutLogic() { }
public override void SendExtraAIHoldout(BinaryWriter writer)
{
writer.Write(lastUseTime);
writer.Write(gunPower);
writer.Write(lastGunPower);
}
public override void ReceiveExtraAIHoldout(BinaryReader reader)
{
lastUseTime = reader.ReadInt32();
gunPower = reader.ReadInt32();
lastGunPower = reader.ReadInt32();
}
public override void SetDefaults()
{
base.SetDefaults();
@@ -97,10 +111,10 @@ namespace CalamityMod.Projectiles.Ranged
return;
}
bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true);
bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo;
bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0;
bool leftShootChecks = Owner.whoAmI == Main.myPlayer && (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo;
bool rightShootChecks = Owner.whoAmI == Main.myPlayer && Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0;
if (Main.mouseLeft && !hasAmmo && shake < 0.1f)
if (Owner.whoAmI == Main.myPlayer && Main.mouseLeft && !hasAmmo && shake < 0.1f)
{
shake = 0.8f;
SoundStyle click = new("CalamityMod/Sounds/Item/DudFire");
@@ -111,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged
FireShotgun();
if (rightShootChecks)
{
Projectile.ForceNetUpdate();
SoundStyle blast1 = new("CalamityMod/Sounds/Item/StarfleetStarburst");
AudSlot1 = SoundEngine.PlaySound(blast1 with { Volume = 0.7f + gunPower * 0.1f, Pitch = 0f, MaxInstances = 8 }, Projectile.Center);
SoundStyle blast2 = new("CalamityMod/Sounds/Item/StarfleetStarburst");
@@ -192,6 +207,7 @@ namespace CalamityMod.Projectiles.Ranged
}
public void FireShotgun()
{
Projectile.ForceNetUpdate();
// 50% chance to not consume ammo
Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool());
@@ -255,8 +271,9 @@ namespace CalamityMod.Projectiles.Ranged
float randomVel = Main.rand.NextFloat(0.8f, 1f);
float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount;
float spread = (i == 0 ? 0f : naildriver ? 0.06f : scattershot ? 0.9f : 0.25f) * MathHelper.Lerp(gunPower, 1, 0.75f);
Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ProjectileType<StarmadaStar>(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1));
shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3;
int starExtraUpdates = naildriver ? 9 : scattershot ? 7 : 3;
Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ProjectileType<StarmadaStar>(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, starExtraUpdates, Main.rand.Next(0, 300 + 1));
shotgun.extraUpdates = starExtraUpdates;
}
}
for (int i = 0; i < (int)(25 * gunPowerMult); i++)
+4
View File
@@ -37,6 +37,10 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
if (time == 0 && Projectile.ai[1] > 0)
Projectile.extraUpdates = (int)Projectile.ai[1];
float rate = (Projectile.ai[2] * 0.05f);
List<Color> eColors = new List<Color>()
{
+4
View File
@@ -344,6 +344,10 @@ namespace CalamityMod.Projectiles.Ranged
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (Owner.gravDir == -1f)
{
flipSprite |= SpriteEffects.FlipVertically;
}
if (Projectile.timeLeft > CoolingDownTime || KeepRefreshingLifetime == true)
{
+5 -1
View File
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -109,6 +110,7 @@ namespace CalamityMod.Projectiles.Rogue
GeneralParticleHandler.SpawnParticle(spark);
Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen);
GeneralParticleHandler.SpawnParticle(spark2);
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB);
@@ -126,10 +128,11 @@ namespace CalamityMod.Projectiles.Rogue
GeneralParticleHandler.SpawnParticle(spark);
Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen);
GeneralParticleHandler.SpawnParticle(spark2);
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile))
{
CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.95f, 16, 0.96f);
CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(2000), true, 0.95f, 16, 0.96f);
}
}
}
@@ -219,6 +222,7 @@ namespace CalamityMod.Projectiles.Rogue
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18);
GeneralParticleHandler.SpawnParticle(bolt2);
bolt2.DrawLayer = GeneralDrawLayer.AfterEverything;
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1));
}
+4 -1
View File
@@ -1,4 +1,6 @@
using CalamityMod.Particles;
using CalamityMod.Enums;
using CalamityMod.Graphics.Renderers;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -105,6 +107,7 @@ namespace CalamityMod.Projectiles.Rogue
{
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false);
GeneralParticleHandler.SpawnParticle(blastRing);
blastRing.DrawLayer = GeneralDrawLayer.AfterEverything;
}
}
else
+7 -2
View File
@@ -1,4 +1,6 @@
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Graphics.Renderers;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -151,15 +153,15 @@ namespace CalamityMod.Projectiles.Rogue
internal void Explode(bool big)
{
float sizeBonus = big ? Main.zenithWorld ? 6 : 2 : 1;
float bigExplosionDamage = 3f;
Player Owner = Main.player[Projectile.owner];
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11);
GeneralParticleHandler.SpawnParticle(orb);
orb.DrawLayer = GeneralDrawLayer.AfterEverything;
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11);
GeneralParticleHandler.SpawnParticle(orb2);
orb2.DrawLayer = GeneralDrawLayer.AfterEverything;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<DestructionExplosion>(), (int)(Projectile.damage * (big ? Main.zenithWorld ? bigExplosionDamage * 4f : bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner);
@@ -190,12 +192,15 @@ namespace CalamityMod.Projectiles.Rogue
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18);
GeneralParticleHandler.SpawnParticle(bolt2);
bolt2.DrawLayer = GeneralDrawLayer.AfterEverything;
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30);
GeneralParticleHandler.SpawnParticle(bolt3);
bolt3.DrawLayer = GeneralDrawLayer.AfterEverything;
Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30);
GeneralParticleHandler.SpawnParticle(bolt4);
bolt4.DrawLayer = GeneralDrawLayer.AfterEverything;
for (int i = 0; i < 2; i++)
{
+2 -1
View File
@@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Rogue
item.usesIDStaticNPCImmunity = false;
item.usesLocalNPCImmunity = true;
item.localNPCHitCooldown = 10;
item.netUpdate = true;
}
}
}
@@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue
{
int projID = ModContent.ProjectileType<LyraConstellation>();
Vector2 velocity = Vector2.Zero;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, projectileDamage, kb, Projectile.owner);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, (int)(projectileDamage * 0.8f), kb, Projectile.owner);
}
for (int i = 0; i < onHitCount; i++)
{
+3 -1
View File
@@ -1,11 +1,13 @@
using System.IO;
using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.Utilities.Daybreak;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -58,7 +60,6 @@ namespace CalamityMod.Projectiles.Summon
}
while (minionSlotsAvaliable >= 1 && MinionSlotsToAdd > 0)
{
Projectile.minionSlots++;
minionSlotsAvaliable--;
MinionSlotsToAdd--;
@@ -116,6 +117,7 @@ namespace CalamityMod.Projectiles.Summon
Vector2 source = Projectile.Center;
for (var i = 0; i < 3; i++)
{
SoundEngine.PlaySound(SarosPossession.FiringSound, Projectile.Center);
var velocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * shootSpeed;
Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType<SarosSunfire>(), damage, Projectile.knockBack, Projectile.owner, 120, ai1: (Projectile.minionSlots - 1) / 9f);
beam.DamageType = DamageClass.Summon;
+7 -5
View File
@@ -2,8 +2,10 @@
using System.Collections.Generic;
using CalamityMod.Enums;
using CalamityMod.Graphics.Primitives;
using CalamityMod.Items.Weapons.Summon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -41,19 +43,19 @@ namespace CalamityMod.Projectiles.Summon
Vector2 SarosPos => Owner.Center + Vector2.UnitY * (Owner.gfxOffY + Owner.gravDir * -24f);
public override void OnSpawn(IEntitySource source)
{
SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with { Volume = 0.5f, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }, Owner.Center);
SoundEngine.PlaySound(SarosPossession.SpawnSound with {pitch = -0.5f, MaxInstances = 5, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew}, Owner.Center);
Projectile.rotation = SarosPos.DirectionTo(Owner.Calamity().mouseWorld).ToRotation();
}
public override void AI()
{
if (Owner.miscCounter % 10 == 0)
SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with {Volume = 0.1f }, Owner.Center);
SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath with {Volume = 0.2f }, Owner.Center);
Projectile.rotation = Projectile.rotation.AngleLerp(SarosPos.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(), 0.1f);
Projectile.Center = SarosPos + Projectile.rotation.ToRotationVector2() * Utils.Remap(Projectile.timeLeft,5,10,1600,0);
if (Projectile.timeLeft == 5 && Owner.channel)
Projectile.timeLeft++;
Owner.Calamity().sarosEclipseBeamUsage += 2;
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
@@ -84,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon
public float FireWidthFunction(float completion, Vector2 vertexPos)
{
return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 96), Utils.Remap(completion, 0.9f, 1f, 96, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 -(Owner.Calamity().sarosEclipseBeamUsage / 300f), 3));
return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 96), Utils.Remap(completion, 0.9f, 1f, 96, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 -(Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)) * (Projectile.timeLeft > 5 ? 1 - (Projectile.timeLeft - 5) / 5f : 1);
}
public Color FireColorFunction(float completion, Vector2 vertexPos)
@@ -95,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon
public float FireCoreWidthFunction(float completion, Vector2 vertexPos)
{
return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 32), Utils.Remap(completion, 0.9f, 1f, 32, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 - (Owner.Calamity().sarosEclipseBeamUsage / 300f), 3));
return MathHelper.Min(Utils.Remap(completion, 0, 0.1f, 0, 32), Utils.Remap(completion, 0.9f, 1f, 32, 0)) * Utils.Remap(Projectile.timeLeft, 0, 5, 0, 1) * (0.75f+MathF.Pow(1 - (Owner.Calamity().sarosEclipseBeamUsage / 300f), 3)) * (Projectile.timeLeft > 5 ? 1-(Projectile.timeLeft-5)/5f : 1);
}
public Color FireCoreColorFunction(float completion, Vector2 vertexPos)
+7 -4
View File
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using CalamityMod.Graphics.Primitives;
using CalamityMod.Items.Weapons.Summon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -29,7 +31,6 @@ namespace CalamityMod.Projectiles.Summon
Projectile.width = 24;
Projectile.height = 24;
Projectile.friendly = true;
Projectile.timeLeft = 180;
Projectile.DamageType = DamageClass.Summon;
Projectile.MaxUpdates = 3;
Projectile.tileCollide = false;
@@ -37,11 +38,11 @@ namespace CalamityMod.Projectiles.Summon
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 24;
Projectile.stopsDealingDamageAfterPenetrateHits = true;
Projectile.timeLeft = 120 * Projectile.MaxUpdates;
}
public override void OnSpawn(IEntitySource source)
{
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
}
NPC target = null;
@@ -50,7 +51,9 @@ namespace CalamityMod.Projectiles.Summon
if (Projectile.ai[0] > 1)
{
Projectile.ai[0]--;
Projectile.timeLeft = 120;
Projectile.timeLeft = 120 * Projectile.MaxUpdates;
}
if (target != null && Projectile.localNPCImmunity[target.whoAmI] <= 0 && target.active && !target.dontTakeDamage)
@@ -69,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 4;
Projectile.timeLeft = (int)MathHelper.Min(8, Projectile.timeLeft);
}
}
}
NPC GetTargetInRange(float range)
{
var player = Main.player[Projectile.owner];
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff. Show more