Merge electric debuffs with Laceration (from Buzzkill)

This commit is contained in:
Ozzatron committed 2024-06-03 21:14:03 -04:00
commit 5cf5b69e9d
165 files changed
+3741 -373

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.DamageOverTime
{
public class Laceration : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().laceration = true;
}
public override void Update(NPC npc, ref int buffIndex)
{
if (npc.Calamity().laceration < npc.buffTime[buffIndex])
npc.Calamity().laceration = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
internal static void DrawEffects(NPC npc, ref Color drawColor)
{
if (Main.rand.NextBool(3))
{
for (int b = 0; b < 2; b++)
{
Vector2 bloodVel = Main.rand.NextVector2CircularEdge(1f, 1f);
bloodVel.SafeNormalize(Vector2.Zero);
bloodVel *= Main.rand.NextFloat(4f, 7f);
Particle bloody = new BloodParticle(npc.Center, bloodVel, 40, 0.75f, new Color(192, 0, 0));
GeneralParticleHandler.SpawnParticle(bloody);
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

+9 -17
View File
@@ -31,6 +31,7 @@ using CalamityMod.Items.TreasureBags.MiscGrabBags;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.DraedonsArsenal;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs;
@@ -885,6 +886,7 @@ namespace CalamityMod.CalPlayer
public bool gState = false;
public bool bBlood = false;
public bool brainRot = false;
public bool laceration = false;
public bool elementalMix = false;
public bool icarusFolly = false;
public bool weakPetrification = false;
@@ -1958,6 +1960,7 @@ namespace CalamityMod.CalPlayer
gState = false;
bBlood = false;
brainRot = false;
laceration = false;
elementalMix = false;
icarusFolly = false;
vHex = false;
@@ -2384,6 +2387,7 @@ namespace CalamityMod.CalPlayer
gState = false;
bBlood = false;
brainRot = false;
laceration = false;
elementalMix = false;
icarusFolly = false;
vHex = false;
@@ -3108,16 +3112,16 @@ namespace CalamityMod.CalPlayer
//Right click dash on Speed Blaster
if (sBlasterDashActivated == true)
{
if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && Player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && Player.dashDelay == 0)
if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && (Player.HasCooldown(SpeedBlasterBoost.ID) || Player.HasCooldown(SuperradiantSawBoost.ID)) && Player.dashDelay == 0)
{
SpeedBlasterDashStarted = true;
}
sBlasterDashActivated = false;
}
if (Player.Calamity().SpeedBlasterDashStarted || (Player.dashDelay != 0 && Player.Calamity().LastUsedDashID == SpeedBlasterDash.ID))
if (Player.Calamity().SpeedBlasterDashStarted || (Player.dashDelay != 0 && (Player.Calamity().LastUsedDashID == SuperradiantSawDash.ID || Player.Calamity().LastUsedDashID == SpeedBlasterDash.ID)))
{
Player.Calamity().DeferredDashID = SpeedBlasterDash.ID;
Player.Calamity().DeferredDashID = Player.ActiveItem().type == ModContent.ItemType<SuperradiantSlaughterer>() ? SuperradiantSawDash.ID : SpeedBlasterDash.ID;
Player.dash = 0;
}
@@ -4313,20 +4317,8 @@ namespace CalamityMod.CalPlayer
if (weakPetrification)
WeakPetrification();
// Disable vanilla dashes during god slayer dash
if (godSlayerDashHotKeyPressed)
{
// Set the player to have no registered vanilla dashes.
Player.dashType = 0;
// Prevent the possibility of Shield of Cthulhu invulnerability exploits.
Player.eocHit = -1;
if (Player.eocDash != 0)
Player.eocDash = 0;
}
// Disable vanilla dashes during god slayer dash
if (SpeedBlasterDashStarted)
// Disable vanilla dashes during God Slayer or Speed Blaster dashes
if (godSlayerDashHotKeyPressed || SpeedBlasterDashStarted)
{
// Set the player to have no registered vanilla dashes.
Player.dashType = 0;
+5 -24
View File
@@ -13,8 +13,7 @@ namespace CalamityMod.CalPlayer
{
public partial class CalamityPlayer : ModPlayer
{
public int VerticalGodslayerDashTimer;
public int VerticalSpeedBlasterDashTimer;
public int VerticalOmnidashTimer;
private string dashID; //private backing variable
@@ -104,16 +103,9 @@ namespace CalamityMod.CalPlayer
}
}
if (Player.dashDelay > 0) //Speed Blaster
{
VerticalSpeedBlasterDashTimer = 0;
LastUsedDashID = string.Empty;
return;
}
if (Player.dashDelay > 0)
{
VerticalGodslayerDashTimer = 0;
VerticalOmnidashTimer = 0;
LastUsedDashID = string.Empty;
return;
}
@@ -137,21 +129,10 @@ namespace CalamityMod.CalPlayer
// Handle mid-dash effects.
UsedDash.MidDashEffects(Player, ref dashSpeed, ref dashSpeedDecelerationFactor, ref runSpeedDecelerationFactor);
if (UsedDash.IsOmnidirectional && VerticalGodslayerDashTimer < 25)
if (UsedDash.IsOmnidirectional && VerticalOmnidashTimer < 25)
{
VerticalGodslayerDashTimer++;
if (VerticalGodslayerDashTimer >= 25)
{
Player.dashDelay = dashDelayToApply;
// Stop the player from going flying
Player.velocity *= 0.2f;
}
}
if (UsedDash.IsOmnidirectional && VerticalSpeedBlasterDashTimer < 25)
{
VerticalSpeedBlasterDashTimer++;
if (VerticalSpeedBlasterDashTimer >= 25)
VerticalOmnidashTimer++;
if (VerticalOmnidashTimer >= 25)
{
Player.dashDelay = dashDelayToApply;
// Stop the player from going flying
+4
View File
@@ -450,6 +450,10 @@ namespace CalamityMod.CalPlayer
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).Format(Player.name));
}
if (laceration)
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).Format(Player.name));
}
if (elementalMix)
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).Format(Player.name));
+1
View File
@@ -99,6 +99,7 @@ namespace CalamityMod.CalPlayer
ApplyDoTDebuff(weakBrimstoneFlames, 7);
ApplyDoTDebuff(bBlood, 8, purity);
ApplyDoTDebuff(brainRot, 8, purity);
ApplyDoTDebuff(laceration, 12, purity);
ApplyDoTDebuff(vaporfied, 8, purity);
int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1);
ApplyDoTDebuff(staticDischarge, staticDoT, purity);
+13 -2
View File
@@ -1,7 +1,11 @@
using CalamityMod.Enums;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
namespace CalamityMod.CalPlayer.Dashes
{
@@ -12,8 +16,6 @@ namespace CalamityMod.CalPlayer.Dashes
public override bool IsOmnidirectional => true;
public bool dustOnce = true;
public override float CalculateDashSpeed(Player player) => 30f;
public override void OnDashEffects(Player player)
@@ -23,6 +25,15 @@ namespace CalamityMod.CalPlayer.Dashes
public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor)
{
Dust trail = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Unit() * 12f, DustID.RainbowTorch, -player.velocity * 0.2f, 150, Color.Aqua, 1.2f);
trail.noGravity = true;
Vector2 sparkVel = player.velocity.SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(-3f, -6f);
Color sparkColor = SpeedBlasterShot.GetColor(Main.rand.Next(5));
float scale = Main.rand.NextFloat(1f, 1.6f); // Bloom effect is double the spark's size
Particle spark = new CritSpark(player.Center + Main.rand.NextVector2Unit() * 12f, sparkVel, Color.White, sparkColor, scale, 15, 0.5f, scale * 2f);
GeneralParticleHandler.SpawnParticle(spark);
// Fall way, way, faster than usual.
player.maxFallSpeed = 50f;
+43
View File
@@ -0,0 +1,43 @@
using CalamityMod.Enums;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
namespace CalamityMod.CalPlayer.Dashes
{
public class SuperradiantSawDash : PlayerDashEffect
{
public static new string ID => "Superradiant Slaughterer";
public override DashCollisionType CollisionType => DashCollisionType.NoCollision;
public override bool IsOmnidirectional => true;
public override float CalculateDashSpeed(Player player) => 36f;
public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor)
{
Dust trail = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Unit() * 12f, DustID.RainbowTorch, -player.velocity * 0.2f, 150, Color.Lime, 1.2f);
trail.noGravity = true;
Vector2 sparkVel = player.velocity.SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(-3f, -6f);
Color sparkColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.25f);
float scale = Main.rand.NextFloat(1.2f, 2f); // Bloom effect is double the spark's size
Particle spark = new CritSpark(player.Center + Main.rand.NextVector2Unit() * 12f, sparkVel, Color.White, sparkColor, scale, 24, 0.5f, scale * 2f);
GeneralParticleHandler.SpawnParticle(spark);
// Fall way, way, faster than usual.
player.maxFallSpeed = 50f;
// Dash at a much, much faster speed than the default value.
dashSpeed = 24f;
runSpeedDecelerationFactor = 0.8f;
// Cooldown for dash.
player.Calamity().SpeedBlasterDashStarted = false;
player.Calamity().sBlasterDashActivated = false;
}
}
}
+2 -1
View File
@@ -842,8 +842,9 @@ namespace CalamityMod
ProjectileType<DaemonsFlameBow>(),
ProjectileType<DrataliornusBow>(),
ProjectileType<FlakKrakenHoldout>(),
ProjectileType<ButcherGun>(),
ProjectileType<BuzzkillHoldout>(),
ProjectileType<StarfleetMK2Gun>(),
ProjectileType<SuperradiantSlaughtererHoldout>(),
ProjectileType<NorfleetCannon>(),
ProjectileType<FlurrystormCannonShooting>(),
ProjectileType<ChickenCannonHeld>(),
+18
View File
@@ -0,0 +1,18 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class SuperradiantSawBoost : CooldownHandler
{
public static new string ID => "SuperradiantSawBoost";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/SuperradiantSawBoost";
public override Color OutlineColor => new Color(207, 207, 207);
public override Color CooldownStartColor => new Color(122, 240, 58);
public override Color CooldownEndColor => new Color(32, 186, 171);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

+54 -1
View File
@@ -27,6 +27,41 @@ namespace CalamityMod.Items
{
public partial class CalamityGlobalItem : GlobalItem
{
#region Backup Tooltip Insertion Positions
/// <summary>
/// This array contains (almost) every single vanilla tooltip in reverse order starting at "Tooltip0".<br />
/// Because "Tooltip0" is the first typical tooltip line, this is where Calamity tends to insert its tooltips.<br />
/// When this line is not present, Calamity needs to insert tooltips in an <i>equivalent</i> position.<br />
/// The best way to do this is to iterate backwards through all possible vanilla tooltip lines and pick the first one that is present.
/// </summary>
private static string[] BackupTooltipInsertionLineNames =
{
"Material",
"Consumable",
"Ammo",
"Placeable",
"UseMana",
"HealMana",
"HealLife",
"TileBoost",
"HammerPower",
"AxePower",
"PickPower",
"Defense",
"Vanity",
"Quest",
"WandConsumes",
"Equipable",
"BaitPower",
"NeedsBait",
"FishingPower",
"Knockback",
"NoTransfer",
"FavoriteDesc",
"ItemName"
};
#endregion
#region Main ModifyTooltips Function
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
{
@@ -49,6 +84,23 @@ namespace CalamityMod.Items
}
}
// If there are no standard vanilla tooltip lines (e.g. Flintlock Pistol, which has no tooltip)
// then a different position needs to be selected for typical insertion.
bool noStandardTooltips = false;
if (firstTooltipIndex == -1)
{
noStandardTooltips = true;
foreach (string lineName in BackupTooltipInsertionLineNames)
{
int idx = tooltips.FindIndex((line) => line.Name == lineName);
if (idx != -1)
{
firstTooltipIndex = lastTooltipIndex = idx;
break;
}
}
}
// Apply custom rarity coloration to the item's name if applicable.
TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria");
if (nameLine != null)
@@ -109,7 +161,8 @@ namespace CalamityMod.Items
if (holdingShift && firstTooltipIndex != -1)
{
// If asked to, remove all standard tooltip lines. This moves the last tooltip index.
if (holdShiftItem.HidesNormalTooltip)
// This only occurs if the standard tooltip lines are ACTUALLY standard tooltips. Otherwise, don't remove anything!
if (holdShiftItem.HidesNormalTooltip && !noStandardTooltips)
{
tooltips.RemoveRange(firstTooltipIndex, standardTooltipCount);
lastTooltipIndex -= standardTooltipCount;
@@ -20,9 +20,6 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureAbyss.AbyssTable>();
// This is Ozz's item of choice for placing hostile Lab Turrets for testing. It should not do this normally.
// item.createTile = ModContent.TileType<Tiles.DraedonStructures.DraedonLabTurret>();
}
public override void AddRecipes()
@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteBathtub : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 28;
Item.height = 20;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.value = 0;
Item.consumable = true;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteBathtub>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

@@ -0,0 +1,33 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteBed : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 28;
Item.height = 20;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteBed>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Silk, 5).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

@@ -0,0 +1,33 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteBookcase : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 28;
Item.height = 20;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteBookcase>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Book, 10).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteCandelabra : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteCandelabra>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Torch, 3).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteCandle : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteCandle>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Torch).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteChair : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 12;
Item.height = 30;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteChair>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteChandelier : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteChandelier>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Torch, 4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteChest : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 22;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteChest>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddRecipeGroup("IronBar", 2).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteClock : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 22;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteClock>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddRecipeGroup("IronBar", 3).
AddIngredient(ItemID.Glass, 6).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteDoor : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 14;
Item.height = 28;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<MarniteDoorClosed>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteDresser : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 22;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteDresser>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteLamp : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteLamp>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Torch).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteLantern : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteLantern>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Torch).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

@@ -0,0 +1,63 @@
using CalamityMod.Items.Materials;
using CalamityMod.Tiles.FurnitureMarnite;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteLight : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
ItemID.Sets.Torches[Item.type] = true;
ItemID.Sets.SingleUseInGamepad[Type] = true;
ItemID.Sets.WaterTorches[Item.type] = true;
ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch;
}
public override void SetDefaults()
{
Item.width = 10;
Item.height = 12;
Item.maxStack = 9999;
Item.holdStyle = 1;
Item.noWet = false;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteLight>();
Item.flame = true;
Item.value = 500;
}
public override void HoldItem(Player player)
{
if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20))
{
Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.DungeonSpirit);
}
Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true);
Lighting.AddLight(position, (57f / 255f), (246f / 255f), (255f / 255f));
}
public override void PostUpdate()
{
Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), (57f / 255f), (246f / 255f), (255f / 255f));
}
public override void AddRecipes()
{
CreateRecipe(3).
AddIngredient(ItemID.Torch, 3).
AddIngredient<PolishedMarniteBlock>(1).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteOrgan : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteOrgan>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(1).
AddIngredient(ItemID.Bone, 4).
AddIngredient(ItemID.Book).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteSink : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteSink>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.WaterBucket).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteSofa : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteSofa>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddIngredient(ItemID.Silk, 2).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

@@ -0,0 +1,32 @@
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteTable : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 26;
Item.height = 26;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteTable>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.Tiles.FurnitureMarnite;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class MarniteWorkBench : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetDefaults()
{
Item.width = 28;
Item.height = 14;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.value = 0;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.MarniteWorkBench>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PolishedMarniteBlock>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

@@ -0,0 +1,46 @@
using CalamityMod.Items.Placeables.Walls;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class PolishedMarniteBlock : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
}
public override void SetDefaults()
{
Item.width = 12;
Item.height = 12;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.PolishedMarniteBlock>();
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.Marble, 2).
AddIngredient(ItemID.Granite, 2).
AddRecipeGroup(CalamityRecipes.AnyGoldOre, 1).
AddTile(TileID.WorkBenches).
Register();
CreateRecipe().
AddIngredient<PolishedMarniteWall>(4).
AddTile(TileID.WorkBenches).
Register();
CreateRecipe().
AddIngredient<PolishedMarnitePlatform>(2).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1,35 @@
using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureMarnite
{
public class PolishedMarnitePlatform : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 200;
}
public override void SetDefaults()
{
Item.width = 24;
Item.height = 14;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createTile = ModContent.TileType<Tiles.FurnitureMarnite.PolishedMarnitePlatform>();
}
public override void AddRecipes()
{
CreateRecipe(2).
AddIngredient<PolishedMarniteBlock>().
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

@@ -0,0 +1,38 @@
using CalamityMod.Items.Placeables.FurnitureMarnite;
using CalamityMod.Walls;
using Terraria.ID;
using Terraria.ModLoader;
using WallTiles = CalamityMod.Walls;
namespace CalamityMod.Items.Placeables.Walls
{
public class PolishedMarniteWall : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
}
public override void SetDefaults()
{
Item.width = 12;
Item.height = 12;
Item.maxStack = 9999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 7;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createWall = ModContent.WallType<WallTiles.PolishedMarniteWall>();
}
public override void AddRecipes()
{
CreateRecipe(4).
AddIngredient<PolishedMarniteBlock>().
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

@@ -1,5 +1,4 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
@@ -8,51 +7,56 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Butcher : ModItem, ILocalizedModType
[LegacyName("Butcher")]
public class Buzzkill : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 12;
Item.damage = 15;
Item.useTime = 40;
Item.useAnimation = 40;
Item.width = 76;
Item.height = 42;
Item.damage = 50;
Item.useTime = 30;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.knockBack = 1f;
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.UseSound = SoundID.Item38;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.DamageType = DamageClass.Ranged;
Item.channel = true;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ButcherGun>();
Item.shootSpeed = 12f;
Item.useAmmo = AmmoID.Bullet;
Item.shoot = ModContent.ProjectileType<BuzzkillHoldout>();
Item.shootSpeed = 20f;
Item.Calamity().canFirePointBlankShots = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
// Terraria seems to really dislike high crit values in SetDefaults
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21;
// Spawning the holdout cannot consume ammo
public override bool CanConsumeAmmo(Item ammo, Player player) => !Main.rand.NextBool(4) && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ButcherGun>(), damage, knockback, player.whoAmI, 0f, 0f);
// The holdout deals 1.5x base damage.
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<BuzzkillHoldout>(), (int)(damage * 1.5), knockback, player.whoAmI);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.Shotgun).
AddIngredient(ItemID.IllegalGunParts).
AddRecipeGroup("AnyCobaltBar", 5).
AddIngredient<EssenceofHavoc>(4).
AddTile(TileID.Anvils).
AddIngredient(ItemID.Cog, 15).
AddIngredient(ItemID.SoulofFright, 10).
AddTile(TileID.MythrilAnvil).
Register();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

-53
View File
@@ -1,53 +0,0 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ElementalBlaster : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 104;
Item.height = 42;
Item.damage = 67;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 2;
Item.useAnimation = 6;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 1.75f;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.UseSound = CommonCalamitySounds.PlasmaBoltSound;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<RainbowBlast>();
Item.shootSpeed = 18f;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-15, 0);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<SpeedBlaster>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

+2 -1
View File
@@ -94,7 +94,8 @@ namespace CalamityMod.Items.Weapons.Ranged
Color ColorUsed = SpeedBlasterShot.GetColor(ColorValue);
for (int i = 0; i <= 8; i++)
{
CritSpark spark = new CritSpark(player.Center, player.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, ColorUsed, 2f, 45, 2f, 2.5f);
Vector2 sparkVel = player.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(45f)) * Main.rand.NextFloat(-28f, -36f);
CritSpark spark = new CritSpark(player.Center, sparkVel, Color.White, ColorUsed, 1.5f, 45, 0.5f, 2f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
@@ -0,0 +1,130 @@
using CalamityMod.Cooldowns;
using CalamityMod.Items.Materials;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
[LegacyName("ElementalBlaster")]
public class SuperradiantSlaughterer : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public const float ShootSpeed = 24f;
public const int DashCooldown = 360;
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
if (tooltips == null)
return;
Player player = Main.player[Main.myPlayer];
if (player is null)
return;
var mainTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[MAIN]") && x.Mod == "Terraria");
if (mainTooltip != null)
{
mainTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("MainInfo"));
mainTooltip.OverrideColor = Color.Chartreuse;
}
var altTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[ALT]") && x.Mod == "Terraria");
if (altTooltip != null)
{
altTooltip.Text = Lang.SupportGlyphs(this.GetLocalization("AltInfo").Format(DashCooldown / 60));
altTooltip.OverrideColor = Color.SpringGreen;
}
}
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 84;
Item.height = 46;
Item.damage = 76;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 30;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.channel = true;
Item.knockBack = 1.75f;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<SuperradiantSlaughtererHoldout>();
Item.shootSpeed = ShootSpeed;
Item.Calamity().canFirePointBlankShots = true;
}
// Terraria seems to really dislike high crit values in SetDefaults
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21;
public override bool AltFunctionUse(Player player) => true;
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2 && player.HasCooldown(SuperradiantSawBoost.ID))
return false;
else
return player.ownedProjectileCounts[Item.shoot] <= 0;
}
public override void HoldItem(Player player)
{
if (player.whoAmI != Main.myPlayer)
return;
player.Calamity().mouseWorldListener = true;
player.Calamity().rightClickListener = true;
// Right-click channeling
if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse && !player.HasCooldown(SuperradiantSawBoost.ID))
{
// Only one out at a time
if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI))
return;
int damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(Item.damage);
float kb = player.GetTotalKnockback<MeleeDamageClass>().ApplyTo(Item.knockBack);
Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, player.SafeDirectionTo(player.Calamity().mouseWorld), Item.shoot, damage * 2, kb, player.whoAmI, ai1: 2f);
}
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
// The holdout will initially double up when right clicking otherwise
if (player.altFunctionUse == 2)
return false;
// The holdout deals 2x base damage.
Projectile.NewProjectile(source, position, velocity, Item.shoot, damage * 2, knockback, player.whoAmI);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<Buzzkill>().
AddIngredient<SpeedBlaster>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -188,6 +188,11 @@ HolyInferno: {
Description: You've gone too far from the Profaned Goddess!
}
Laceration: {
DisplayName: Laceration
Description: You're a bloody mess
}
ManaBurn: {
DisplayName: Mana Burn
Description: The excess of mana sears your body and mind
@@ -3707,3 +3707,113 @@ ScintillatingBloom: {
DisplayName: Scintillating Bloom
Tooltip: ""
}
MarniteChest: {
DisplayName: Marnite Chest
Tooltip: ""
}
MarniteDresser: {
DisplayName: Marnite Dresser
Tooltip: ""
}
MarniteBathtub: {
DisplayName: Marnite Bathtub
Tooltip: ""
}
MarniteBed: {
DisplayName: Marnite Bed
Tooltip: ""
}
MarniteBookcase: {
DisplayName: Marnite Bookcase
Tooltip: ""
}
MarniteCandelabra: {
DisplayName: Marnite Candelabra
Tooltip: ""
}
MarniteCandle: {
DisplayName: Marnite Candle
Tooltip: ""
}
MarniteChair: {
DisplayName: Marnite Chair
Tooltip: ""
}
MarniteChandelier: {
DisplayName: Marnite Chandelier
Tooltip: ""
}
MarniteClock: {
DisplayName: Marnite Clock
Tooltip: ""
}
MarniteDoor: {
DisplayName: Marnite Door
Tooltip: ""
}
MarniteLamp: {
DisplayName: Marnite Lamp
Tooltip: ""
}
MarniteLantern: {
DisplayName: Marnite Lantern
Tooltip: ""
}
MarniteLight: {
DisplayName: Marnite Light
Tooltip: ""
}
MarniteOrgan: {
DisplayName: Marnite Organ
Tooltip: ""
}
MarniteSink: {
DisplayName: Marnite Sink
Tooltip: ""
}
MarniteSofa: {
DisplayName: Marnite Sofa
Tooltip: ""
}
MarniteTable: {
DisplayName: Marnite Table
Tooltip: ""
}
MarniteWorkBench: {
DisplayName: Marnite Work Bench
Tooltip: ""
}
PolishedMarniteBlock: {
DisplayName: Polished Marnite Block
Tooltip: ""
}
PolishedMarnitePlatform: {
DisplayName: Polished Marnite Platform
Tooltip: ""
}
PolishedMarniteWall: {
DisplayName: Polished Marnite Wall
Tooltip: ""
}
@@ -211,12 +211,14 @@ BulletFilledShotgun: {
'''
}
Butcher: {
DisplayName: Butcher
Buzzkill: {
DisplayName: Buzzkill
Tooltip:
'''
Fires bullets faster and more accurately the longer you hold the trigger
25% chance to save ammo
Hold <left> to rev up a buzzsaw that deals close-range damage
Release to fire the buzzsaw, which bounces off tiles and lacerates foes
Revving up the saws increases their damage and allows them to pierce more enemies
'Not to be confused with the Sawed-On Shotgun'
'''
}
@@ -433,15 +435,6 @@ Drataliornus: {
'''
}
ElementalBlaster: {
DisplayName: Elemental Blaster
Tooltip:
'''
Fires a storm of rainbow blasts
Does not consume ammo
'''
}
ElementalEruption: {
DisplayName: Elemental Eruption
Tooltip:
@@ -1162,9 +1155,10 @@ SpeedBlaster: {
Tooltip:
'''
Rapidly fires phosphorescent paintball shots
Press <right> to eject a powerful glob which propels you while moving
This ability has a cooldown of {0} seconds
While under cooldown, you fire more rapidly with greater accuracy
Press <right> to eject a powerful paint stream of a different color
Using this ability rapidly propels you in the direction you are moving
This ability has a {0} second cooldown
During this cooldown, you fire more rapidly with greater accuracy
'''
}
@@ -1231,6 +1225,31 @@ SulphuricAcidCannon: {
Tooltip: Fires an acidic shot that sticks to enemies and dissolves them
}
SuperradiantSlaughterer: {
DisplayName: Superradiant Slaughterer
Tooltip:
'''
[MAIN]
[ALT]
[c/ad1717:'No one knows how it turns blood into rainbows...']
'''
MainInfo:
'''
Hold <left> to rev up an elemental buzzsaw that deals close-range damage
Release <left> to fire the buzzsaw to pierce through and lacerate foes
Fired buzzsaws bounce off tiles and return to the player after winding down
When returning, the saws release extra homing bolts depending on the number of enemy and tile hits
Revving up the saws increases their damage and allows them to pierce more enemies
'''
AltInfo:
'''
Press <right> to eject a lingering buzzsaw towards the cursor that fires homing bolts
Using this ability rapidly propels you in the direction you are moving
This ability has a {0} second cooldown
During this cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning
'''
}
SurgeDriver: {
DisplayName: Surge Driver
Tooltip:
@@ -35,6 +35,7 @@ BouncingShotgunPellet.DisplayName: Shotgun Pellet
BrimstoneBolt.DisplayName: Brimstone Bolt
BrimstoneFireFriendly.DisplayName: Brimstone Fire
BubonicRoundProj.DisplayName: Bubonic Round
BuzzkillSaw.DisplayName: Buzzsaw
CardClub.DisplayName: Club
CardClubSplit.DisplayName: Club
CardDiamond.DisplayName: Diamond
@@ -169,7 +170,6 @@ PristineFire.DisplayName: Pristine Fire
PristineSecondary.DisplayName: Pristine Lingering Fire
PumplerGrenade.DisplayName: Squash Shell
P90Round.DisplayName: Armor-piercing Round
RainbowBlast.DisplayName: Blast
RainbowFront.DisplayName: Rainbow
RainbowTrail.DisplayName: Rainbow
RealmRavagerBullet.DisplayName: Explosive Bullet
@@ -220,6 +220,9 @@ StarmageddonStar2.DisplayName: Starmageddon Star
StormSurgeTornado.DisplayName: Surge
SulphuricBlast.DisplayName: Sulphuric Blast
SuperballBulletProj.DisplayName: Superball Bullet
SuperradiantBolt.DisplayName: Superradiant Bolt
SuperradiantSawLingering.DisplayName: Ultraradiant Saw
SuperradiantSaw.DisplayName: Superradiant Saw
TelluricGlareArrow.DisplayName: Radiant Arrow
TheMaelstromExplosion.DisplayName: Reaper Explosion
TheMaelstromShark.DisplayName: Reaper Shark
@@ -70,6 +70,9 @@ HolyFlames1: "{0} fell prey to their sins."
HolyFlames2: "{0} burst into sinless ash."
HolyFlames3: "{0} was purified by the profaned flame."
HolyInferno: "{0} was incinerated by the profaned backdraft."
Laceration1: "{0} expired from heavy internal bleeding."
Laceration2: "{0} was turned into a fine red mist."
Laceration3: "{0} forgot that blood is supposed to stay inside the body."
ManaBurn: "{0}'s life was completely converted into mana."
ManaConversionEnchant: "{0}'s life was fully tapped by dark magics."
MiracleBlight1: "{0} was blown away by miraculous technological advancements."
@@ -119,6 +119,7 @@ Cooldowns: {
SpeedBlasterBoost: Speed Blaster Boost
SpongeDurability: Sponge Barrier Durability
SpongeRecharge: Sponge Barrier Recharge
SuperradiantSawBoost: Superradiant Saw Boost
TarragonCloak: Tarragon Cloak Cooldown
TarragonImmunity: Tarragon Immunity Cooldown
UniverseSplitter: Universe Splitter Cooldown
-1
View File
@@ -235,7 +235,6 @@ namespace CalamityMod
ItemRedirect(ItemType<Elderberry>(), "Elderberry (calamity)");
ItemRedirect(ItemType<PineapplePet>(), "Pineapple (calamity)");
ItemRedirect(ItemType<TrashmanTrashcan>(), "Trash Can (pet)");
ItemRedirect(ItemType<Butcher>(), "Butcher (weapon)");
ItemRedirect(ItemType<SandstormGun>(), "Sandstorm (weapon)");
ItemRedirect(ItemType<Thunderstorm>(), "Thunderstorm (weapon)");
// Lore items
+10
View File
@@ -244,6 +244,7 @@ namespace CalamityMod.NPCs
public int pearlAura = 0;
public int bBlood = 0;
public int brainRot = 0;
public int laceration = 0;
public int elementalMix = 0;
public int marked = 0;
public int absorberAffliction = 0;
@@ -466,6 +467,7 @@ namespace CalamityMod.NPCs
myClone.pearlAura = pearlAura;
myClone.bBlood = bBlood;
myClone.brainRot = brainRot;
myClone.laceration = laceration;
myClone.elementalMix = elementalMix;
myClone.marked = marked;
myClone.absorberAffliction = absorberAffliction;
@@ -1141,6 +1143,8 @@ namespace CalamityMod.NPCs
ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage);
if (brainRot > 0)
ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage);
if (laceration > 0)
ApplyDPSDebuff(80, 10, ref npc.lifeRegen, ref damage);
if (elementalMix > 0)
ApplyDPSDebuff(400, 80, ref npc.lifeRegen, ref damage);
if (miracleBlight > 0)
@@ -5110,6 +5114,8 @@ namespace CalamityMod.NPCs
bBlood--;
if (brainRot > 0)
brainRot--;
if (laceration > 0)
laceration--;
if (elementalMix > 0)
elementalMix--;
if (vulnerabilityHex > 0)
@@ -6429,6 +6435,9 @@ namespace CalamityMod.NPCs
if (hFlames > 0 || banishingFire > 0)
HolyFlames.DrawEffects(npc, ref drawColor);
if (laceration > 0)
Laceration.DrawEffects(npc, ref drawColor);
// These draw effects do not include Miracle Blight's shader
if (miracleBlight > 0)
MiracleBlight.DrawEffects(npc, ref drawColor);
@@ -6638,6 +6647,7 @@ namespace CalamityMod.NPCs
("CalamityMod/Buffs/DamageOverTime/ElementalMix", NPC => NPC.Calamity().elementalMix > 0),
("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno", NPC => NPC.Calamity().gsInferno > 0),
("CalamityMod/Buffs/DamageOverTime/HolyFlames", NPC => NPC.Calamity().hFlames > 0),
("CalamityMod/Buffs/DamageOverTime/Laceration", NPC => NPC.Calamity().laceration > 0),
("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0),
("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0),
("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0),
-164
View File
@@ -1,164 +0,0 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ButcherGun : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Butcher>();
public override string Texture => "CalamityMod/Items/Weapons/Ranged/Butcher";
public override void SetDefaults()
{
Projectile.width = 66;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
Projectile.ai[0] += 1f;
int incrementAmt = 0;
float spreadMult = 0.15f;
if (Projectile.ai[0] >= 80f)
{
incrementAmt++;
spreadMult = 0.13f;
}
if (Projectile.ai[0] >= 160f)
{
incrementAmt++;
spreadMult = 0.11f;
}
if (Projectile.ai[0] >= 240f)
{
incrementAmt++;
spreadMult = 0.09f;
}
if (Projectile.ai[0] >= 320f)
{
incrementAmt++;
spreadMult = 0.07f;
}
if (Projectile.ai[0] >= 400f)
{
incrementAmt++;
spreadMult = 0.05f;
}
if (Projectile.ai[0] >= 480f)
{
incrementAmt++;
spreadMult = 0.04f;
}
if (Projectile.ai[0] >= 560f)
{
incrementAmt++;
spreadMult = 0.03f;
}
if (Projectile.ai[0] >= 640f) //8
{
incrementAmt++;
spreadMult = 0.02f;
}
int shootDelayBase = 40;
int incrementMult = 3;
Projectile.ai[1] -= 1f;
bool willShoot = false;
if (Projectile.ai[1] <= 0f)
{
Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt);
willShoot = true;
}
bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
}
if (Projectile.soundDelay <= 0 && canShoot)
{
Projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt;
if (Projectile.ai[0] != 1f)
{
SoundEngine.PlaySound(SoundID.Item38, Projectile.position);
}
Projectile.localAI[0] = 12f;
}
Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true);
if (willShoot && Main.myPlayer == Projectile.owner)
{
int projType = ProjectileID.Bullet;
float speedMult = 14f;
int damage = player.GetWeaponDamage(player.ActiveItem());
float kback = player.ActiveItem().knockBack;
if (canShoot)
{
player.PickAmmo(player.ActiveItem(), out projType, out speedMult, out damage, out kback, out _);
kback = player.GetWeaponKnockback(player.ActiveItem(), kback);
float speed = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source;
if (player.gravDir == -1f)
{
targetPos.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y;
}
Vector2 velMult = Vector2.Normalize(targetPos);
if (float.IsNaN(velMult.X) || float.IsNaN(velMult.Y))
{
velMult = -Vector2.UnitY;
}
velMult *= speed;
if (velMult.X != Projectile.velocity.X || velMult.Y != Projectile.velocity.Y)
{
Projectile.netUpdate = true;
}
Projectile.velocity = velMult * 0.55f;
int randomBulletCount = Main.rand.Next(3, 5); //3 to 4 bullets
for (int projIndex = 0; projIndex < randomBulletCount; projIndex++)
{
Vector2 bulletVel = Vector2.Normalize(Projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult);
if (float.IsNaN(bulletVel.X) || float.IsNaN(bulletVel.Y))
{
bulletVel = -Vector2.UnitY;
}
source += Utils.RandomVector2(Main.rand, -5f, 5f);
bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult;
bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult;
int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, bulletVel, projType, damage, kback, Projectile.owner, 0f, 0f);
Main.projectile[bullet].noDropItem = true;
Main.projectile[bullet].extraUpdates += incrementAmt / 2; //0 to 4
}
}
else
{
Projectile.Kill();
}
}
Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f;
float rotationAmt = 0f;
if (Projectile.spriteDirection == -1)
{
rotationAmt = MathHelper.Pi;
}
Projectile.rotation = Projectile.velocity.ToRotation() + rotationAmt;
Projectile.spriteDirection = Projectile.direction;
Projectile.timeLeft = 2;
player.ChangeDir(Projectile.direction);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction));
}
public override bool? CanDamage() => false;
}
}
+261
View File
@@ -0,0 +1,261 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class BuzzkillHoldout : BaseGunHoldoutProjectile
{
public override int AssociatedItemID => ModContent.ItemType<Buzzkill>();
public override float RecoilResolveSpeed => 0.05f;
public override float MaxOffsetLengthFromArm => 30f;
public override float OffsetXUpwards => -10f;
public override float OffsetXDownwards => 5f;
public override float BaseOffsetY => -10f;
public override float OffsetYDownwards => 10f;
public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.28f;
public ref float Time => ref Projectile.ai[0];
public const float ChargeupTime = 120f;
public SlotId ChargeIdle;
// Controls the saw visually disappearing from the holdout when it fires.
public bool NoSawOnHoldout = false;
public static Asset<Texture2D> Holdout;
public static Asset<Texture2D> SmallSlash;
public static Asset<Texture2D> LargeSlash;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 5;
}
public override void SetDefaults()
{
base.SetDefaults();
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void KillHoldoutLogic()
{
if (HeldItem.type != Owner.ActiveItem().type)
{
Projectile.Kill();
Projectile.netUpdate = true;
}
}
public override void HoldoutAI()
{
Time++;
float SawPower = MathHelper.Clamp(Time / ChargeupTime, 0f, 1f);
if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle) && Idle.IsPlaying)
Idle.Position = GunTipPosition;
if (Owner.CantUseHoldout())
{
if (Projectile.ai[1] < 1f)
{
KeepRefreshingLifetime = false;
Idle?.Stop();
Projectile.ai[1] = 1f;
Projectile.timeLeft = Owner.ActiveItem().useAnimation;
SoundStyle ShootSound = new("CalamityMod/Sounds/Item/SawShot", 2) { PitchVariance = 0.1f, Volume = 0.4f + SawPower * 0.5f };
SoundEngine.PlaySound(ShootSound, GunTipPosition);
float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage.
int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower);
int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt();
Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed, ModContent.ProjectileType<BuzzkillSaw>(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel);
buzzsaw.penetrate = sawPierce;
buzzsaw.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi);
NoSawOnHoldout = true;
OffsetLengthFromArm -= 4f + 12f * SawPower;
int sparkPairCount = 3 + 2 * sawLevel;
for (int s = 0; s < sparkPairCount; s++)
{
float velocityMult = Main.rand.NextFloat(5f, 8f) + Main.rand.NextFloat(4f, 7f) * sawLevel;
float scale = Main.rand.NextFloat(0.6f, 0.8f) + Main.rand.NextFloat(0.3f, 0.5f) * sawLevel;
Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * velocityMult;
Particle weaponShootSparks = new AltLineParticle(GunTipPosition, sparkVelocity, false, 40, scale, new Color(250, 250, 107));
GeneralParticleHandler.SpawnParticle(weaponShootSparks);
// re-randomize rotation for the alternate particle
sparkVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * velocityMult;
Particle weaponShootSparks2 = new AltSparkParticle(GunTipPosition, sparkVelocity, false, 40, scale, new Color(250, 250, 107));
GeneralParticleHandler.SpawnParticle(weaponShootSparks2);
}
}
}
if (NoSawOnHoldout)
{
Projectile.frame = 4;
return;
}
else
{
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 1;
}
}
if (Time > 30f)
{
if (Time % 3 == 0)
{
Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f);
sparkVel.SafeNormalize(Vector2.Zero);
sparkVel *= Main.rand.NextFloat(3f, 4.5f) + (SawPower * 4);
Particle buzzsawSparks = new AltLineParticle(GunTipPosition, sparkVel, false, 10, Utils.GetLerpValue(0.05f, 0.65f, SawPower, true), new Color(250, 250, 107));
GeneralParticleHandler.SpawnParticle(buzzsawSparks);
}
}
if (Time < ChargeupTime)
{
if (Time == 30f)
ChargeIdle = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BuzzsawCharge") { Volume = 0.3f }, GunTipPosition);
if (Time > 30f && Projectile.frame == 0)
Projectile.frame = 1;
}
else
{
if ((Time + 240) % 360 == 0)
ChargeIdle = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BuzzsawIdle"), GunTipPosition);
if (Time % 3 == 0)
{
Vector2 smokeVelocity = Vector2.UnitY * Main.rand.NextFloat(-7f, -12f);
smokeVelocity = smokeVelocity.RotatedByRandom(MathHelper.Pi / 8f);
Particle fullChargeSmoke = new HeavySmokeParticle(GunTipPosition + Main.rand.NextVector2CircularEdge(3f, 3f), smokeVelocity, Color.Gray, 30, 0.65f, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), true);
GeneralParticleHandler.SpawnParticle(fullChargeSmoke);
}
}
}
public override void OnSpawn(IEntitySource source)
{
base.OnSpawn(source);
ExtraBackArmRotation = MathHelper.ToRadians(15f);
}
// Failsafe because apparently the sound doesn't stop sometimes
public override void OnKill(int timeLeft)
{
if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle))
Idle?.Stop();
}
// The holdout can deal damage; you're literally spinning up a buzzsaw at the end, after all.
public override bool? CanDamage() => !NoSawOnHoldout;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 240);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition);
int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt();
int bloodCount = 4 + 3 * SawLevel;
for (int p = 0; p < bloodCount; p++)
{
float radius = Main.rand.NextFloat(6f, 10f) + Main.rand.NextFloat(4f, 10f) * SawLevel;
Vector2 velocity = Main.rand.NextVector2CircularEdge(radius, radius);
float scale = Main.rand.NextFloat(0.3f, 0.5f) + Main.rand.NextFloat(0.1f, 0.4f) * SawLevel;
Particle hitSparks = new AltLineParticle(target.Center, velocity, false, 20, scale, new Color(112, 16, 16));
GeneralParticleHandler.SpawnParticle(hitSparks);
}
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
hitbox = new Rectangle((int)GunTipPosition.X - 19, (int)GunTipPosition.Y - 20, 38, 40);
if (Time / ChargeupTime >= 1f)
hitbox.Inflate(65, 65);
else if (Time / ChargeupTime >= 0.25f)
hitbox.Inflate(28, 28);
}
public override bool PreDraw(ref Color lightColor)
{
Holdout ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillHoldout");
Texture2D holdoutTexture = Holdout.Value;
LargeSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillSawLargeSlash");
Texture2D largeSlashTexture = LargeSlash.Value;
SmallSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillSawSmallSlash");
Texture2D smallSlashTexture = SmallSlash.Value;
Color slashColor = new Color(200, 200, 200, 100);
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = holdoutTexture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = frame.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (!NoSawOnHoldout)
{
float shake = Utils.Remap(Time, 0f, ChargeupTime, 0f, 3f);
drawPosition += Main.rand.NextVector2Circular(shake, shake);
}
Main.EntitySpriteDraw(holdoutTexture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite);
if (Time > 30f && !NoSawOnHoldout)
{
if (Time / ChargeupTime >= 1f)
Main.EntitySpriteDraw(largeSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * -MathHelper.ToRadians(42f), largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time / ChargeupTime >= 0.25f)
Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (!CalamityConfig.Instance.Afterimages)
return false;
// Special afterimage drawing for the slashes only
for (int i = 1; i < 3; i++)
{
float intensity = MathHelper.Lerp(0.05f, 0.25f, 1f - i / 3f);
if (Time / ChargeupTime >= 1f)
Main.EntitySpriteDraw(largeSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor * intensity, (Time - i) * -MathHelper.ToRadians(42f), largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time / ChargeupTime >= 0.25f)
Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor * intensity, (Time - i) * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
}
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+214
View File
@@ -0,0 +1,214 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
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;
namespace CalamityMod.Projectiles.Ranged
{
public class BuzzkillSaw : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public static readonly SoundStyle TileCollideGFB = new("CalamityMod/Sounds/Custom/MetalPipeFalling");
public ref float SawLevel => ref Projectile.ai[0];
public ref float Time => ref Projectile.ai[1];
public static Asset<Texture2D> SmallSlash;
public static Asset<Texture2D> LargeSlash;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 40;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 480;
Projectile.penetrate = 1; // Saw pierce is set when the saw is spawned, due to it being dynamic based on charge.
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Time++;
Projectile.rotation += MathHelper.ToRadians(6f + 18f * SawLevel);
if (Projectile.frame < 1)
Projectile.frame = 1;
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 1;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
int sparkCount = 6 + 5 * (int)SawLevel;
for (int s = 0; s < sparkCount; s++)
{
Vector2 sparkVelocity = new Vector2();
if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X < 0)
sparkVelocity = Vector2.UnitX * 6.5f;
else if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X >= 0)
sparkVelocity = Vector2.UnitX * -6.5f;
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y < 0)
sparkVelocity = Vector2.UnitY * 6.5f;
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y >= 0)
sparkVelocity = Vector2.UnitY * -6.5f;
Vector2 sparkLocation = sparkVelocity.X > 0f ? Projectile.Left : (sparkVelocity.X < 0f ? Projectile.Right : (sparkVelocity.Y > 0f ? Projectile.Top : Projectile.Bottom));
sparkVelocity = sparkVelocity.RotatedByRandom(MathHelper.PiOver2) * (Main.rand.NextFloat(0.8f, 1.2f) + (Main.rand.NextFloat(0.2f, 0.6f) * SawLevel));
float scale = Main.rand.NextFloat(0.5f, 0.8f) + Main.rand.NextFloat(0.2f, 0.6f) * SawLevel;
Particle collisionSparks = new AltLineParticle(sparkLocation, sparkVelocity, false, 30, scale, new Color(250, 250, 107));
GeneralParticleHandler.SpawnParticle(collisionSparks);
}
Projectile.penetrate--;
Projectile.numHits++;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
else
{
SoundEngine.PlaySound(Main.zenithWorld ? TileCollideGFB : SoundID.Item178 with { Pitch = 0.15f * Projectile.numHits }, Projectile.Center); // Placeholder sound
if (Projectile.velocity.X != oldVelocity.X)
Projectile.velocity.X = -oldVelocity.X;
if (Projectile.velocity.Y != oldVelocity.Y)
Projectile.velocity.Y = -oldVelocity.Y;
}
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 150);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") with { Pitch = 0.15f * Projectile.numHits }, Projectile.Center);
int bloodCount = 6 + 10 * (int)SawLevel;
for (int p = 0; p < bloodCount; p++)
{
Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * (Main.rand.NextFloat(0.4f, 0.6f) + (Main.rand.NextFloat(0.2f, 0.6f) * SawLevel));
float scale = Main.rand.NextFloat(0.5f, 0.8f) + Main.rand.NextFloat(0.2f, 0.8f) * SawLevel;
Particle hitSparks = new AltLineParticle(target.Center, velocity, false, 30, scale, new Color(112, 16, 16));
GeneralParticleHandler.SpawnParticle(hitSparks);
}
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2), Projectile.Center);
// TODO - Change this dust
for (int d = 0; d < 8; d++)
{
Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f);
dustVel.SafeNormalize(Vector2.Zero);
dustVel *= Main.rand.NextFloat(5f, 9f);
Dust collisionDust = Dust.NewDustPerfect(Projectile.Center, 84, dustVel);
collisionDust.noGravity = true;
}
int goreToExclude = Main.rand.Next(3);
switch (goreToExclude)
{
case 0:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw2").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw3").Type, 0.8f);
break;
case 1:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw1").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw3").Type, 0.8f);
break;
case 2:
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw1").Type, 0.8f);
Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find<ModGore>("BuzzkillSaw2").Type, 0.8f);
break;
}
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
if (SawLevel >= 2f)
hitbox.Inflate(65, 65);
else if (SawLevel >= 1f)
hitbox.Inflate(28, 28);
}
public override bool PreDraw(ref Color lightColor)
{
LargeSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillSawLargeSlash");
Texture2D largeSlashTexture = LargeSlash.Value;
SmallSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/BuzzkillSawSmallSlash");
Texture2D smallSlashTexture = SmallSlash.Value;
Color slashColor = new Color(200, 200, 200, 100);
if (SawLevel >= 2f)
{
Main.EntitySpriteDraw(largeSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, -Projectile.rotation, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f), Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f));
float randomParticleScale = Main.rand.NextFloat(0.65f, 0.95f);
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : new Color(112, 16, 16), randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
if (SawLevel >= 1f)
{
Main.EntitySpriteDraw(smallSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, Projectile.rotation, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width, Projectile.width), Main.rand.NextFloat(-Projectile.width, Projectile.width));
float randomParticleScale = Main.rand.NextFloat(0.35f, 0.65f);
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : new Color(112, 16, 16), randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
if (!CalamityConfig.Instance.Afterimages)
return true;
// Special afterimage drawing to include the slashes
Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value;
Rectangle frame = buzzsawTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
for (int i = 1; i < Projectile.oldPos.Length; i++)
{
float afterimageRot = Projectile.oldRot[i];
Vector2 drawPos = Projectile.oldPos[i] + frame.Size() * 0.5f - Main.screenPosition;
float intensity = MathHelper.Lerp(0.1f, 0.6f, 1f - i / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(buzzsawTexture, drawPos, frame, lightColor * intensity, afterimageRot, frame.Size() * 0.5f, 1f, SpriteEffects.None);
if (SawLevel >= 2f)
Main.EntitySpriteDraw(largeSlashTexture, drawPos, null, slashColor * intensity, -afterimageRot, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (SawLevel >= 1f)
Main.EntitySpriteDraw(smallSlashTexture, drawPos, null, slashColor * intensity, afterimageRot, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

-64
View File
@@ -1,64 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class RainbowBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 1;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 300;
}
public override void AI()
{
//Rotation
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi);
Lighting.AddLight(Projectile.Center, new Vector3(Main.DiscoR, Main.DiscoG, Main.DiscoB) * (1.5f / 255));
Projectile.localAI[0]++;
if (Projectile.localAI[0] > 5f)
{
Vector2 dspeed = -Projectile.velocity * 0.5f;
int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f);
Main.dust[rainbowDust].noGravity = true;
Main.dust[rainbowDust].velocity = dspeed;
}
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f);
}
public override Color? GetAlpha(Color lightColor)
{
Color color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
return color;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<ElementalMix>(), 60);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

+95
View File
@@ -0,0 +1,95 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Graphics.Primitives;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SuperradiantBolt : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public ref float Time => ref Projectile.ai[0];
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 22;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.timeLeft = 120;
Projectile.tileCollide = false;
Projectile.scale = 0.85f;
}
public override void AI()
{
Time++;
// Solid homing
NPC potentialTarget = Projectile.Center.ClosestNPCAt(480f);
if (potentialTarget != null && Time >= 15f)
{
Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 24f;
Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f;
Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f);
}
else if (Time >= 30f)
{
// Projectile decays a lot faster if there's no enemy in sight
Projectile.timeLeft -= 2;
}
Projectile.rotation = Projectile.velocity.ToRotation();
// Emit light
DelegateMethods.v3_1 = Color.Lerp(Color.Lime, Color.White, 0.55f).ToVector3() * 0.35f;
Utils.PlotTileLine(Projectile.Center - Projectile.velocity * 0.5f, Projectile.Center + Projectile.velocity * 0.5f, 16f, DelegateMethods.CastLightOpen);
}
public override bool? CanDamage() => Time >= 15f;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<ElementalMix>(), 45);
internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 20f;
internal Color ColorFunction(float completionRatio)
{
float hue = 0.4f + 0.2f * completionRatio * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f);
Color trailColor = Main.hslToRgb(hue, 1f, 0.8f);
return trailColor * Projectile.Opacity;
}
public override bool PreDraw(ref Color lightColor)
{
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 20);
Texture2D glow = TextureAssets.Projectile[Projectile.type].Value;
Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
return false;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i < 2; i++)
{
Vector2 sparkVel = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(24f)) * Main.rand.NextFloat(6f, 10f);
Color color = Main.hslToRgb(Main.rand.NextFloat(0.3f, 0.5f), 1f, 0.8f);
SparkParticle spark = new(Projectile.Center, sparkVel, false, 30, 1.3f, color);
GeneralParticleHandler.SpawnParticle(spark);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

+387
View File
@@ -0,0 +1,387 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SuperradiantSaw : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public static readonly SoundStyle TileCollideGFB = new("CalamityMod/Sounds/Custom/MetalPipeFalling");
public ref float SawLevel => ref Projectile.ai[0];
public ref float Time => ref Projectile.ai[1];
public ref float PierceBeforeReturn => ref Projectile.ai[2];
// Hitstop timer.
public int HitstopTimer = 0;
// Controls if the saw is returning to the player.
public bool Returning = false;
public int ReturnTimer = 0;
public const int ReturnDelay = 90;
public const int MaxBoltPairs = 7; // No more than 7 pairs per saw
// Whether the saw is empowered by right click.
public bool Empowered = false;
public Particle SmallSlashSmear;
public Particle LargeSlashSmear;
public static Asset<Texture2D> SawOutline;
public static Asset<Texture2D> SmallSlash;
public static Asset<Texture2D> LargeSlash;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 46;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 600;
Projectile.penetrate = -1; // Saws only pierce a certain number of times before returning, and don't deal direct damage while returning
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
// Deadshot Brooch makes me die inside
if (Projectile.MaxUpdates > 1)
Projectile.MaxUpdates = 1;
// Timer and rotation
Time++;
Projectile.rotation += MathHelper.ToRadians(6f + 18f * SawLevel);
// Hitstop timer
if (HitstopTimer > 0)
{
HitstopTimer--;
if (HitstopTimer == 0)
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * SuperradiantSlaughterer.ShootSpeed;
}
// Control the saw being empowered or not
Player Owner = Main.player[Projectile.owner];
Empowered = Owner.HasCooldown(SuperradiantSawBoost.ID);
// While empowered, the saws will slightly home in on the cursor
if (Empowered && !Returning && Time > 30)
{
float homingTurnSpeed = 0.2f;
Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.MouseWorld).ToRotation(), homingTurnSpeed).ToRotationVector2() * SuperradiantSlaughterer.ShootSpeed;
}
// Saws automatically return 2 seconds after hitting an enemy
if (ReturnTimer > 0 && ReturnTimer < ReturnDelay)
{
ReturnTimer++;
if (ReturnTimer == ReturnDelay)
Returning = true;
}
if (Returning)
{
Projectile.tileCollide = false;
if (ReturnTimer < ReturnDelay)
ReturnTimer = ReturnDelay;
ReturnTimer++;
if (ReturnTimer < ReturnDelay + 30)
Projectile.velocity *= 0.95f;
else
{
// Spawns a burst of homing bolts when it starts returning, based on how many tiles and enemies it hit
if (ReturnTimer == ReturnDelay + 30)
{
int boltCount = Math.Min(Projectile.numHits, MaxBoltPairs) * 2;
for (int b = 0; b < boltCount; b++)
{
Vector2 randBoltVelocity = Main.rand.NextVector2Unit() * 9f;
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randBoltVelocity, ModContent.ProjectileType<SuperradiantBolt>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
// Extra burst of sparks for cool points
float sparkCount = 6f + 5f * SawLevel;
for (float i = 0f; i < sparkCount; i++)
{
Vector2 velocity = Main.rand.NextVector2Unit() * (12f + 10f * SawLevel);
float sparkScale = 1f + 0.25f * SawLevel; // Bloom effect is double the spark's size
Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, Color.Lime, sparkScale, 30, 0.1f, sparkScale, Main.rand.NextFloat(0f, 0.01f));
GeneralParticleHandler.SpawnParticle(sparkle);
}
}
// Continuously spawn homing bolts as it returns while empowered
if (ReturnTimer % 9 == 0 && Empowered)
{
Vector2 randVelocity = -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 3f) * 0.5f;
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randVelocity, ModContent.ProjectileType<SuperradiantBolt>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
float returnSpeed = (SuperradiantSlaughterer.ShootSpeed * 0.6f) + (0.05f * (ReturnTimer - 120));
Vector2 ownerDist = Owner.Center - Projectile.Center;
if (ownerDist.Length() > 3000f)
Projectile.Kill();
ownerDist.Normalize();
ownerDist *= returnSpeed;
// Home back in on the player; accelerates over time
if (Projectile.velocity.X < ownerDist.X)
Projectile.velocity.X = ownerDist.X;
else if (Projectile.velocity.X > ownerDist.X)
Projectile.velocity.X = ownerDist.X;
if (Projectile.velocity.Y < ownerDist.Y)
Projectile.velocity.Y = ownerDist.Y;
else if (Projectile.velocity.Y > ownerDist.Y)
Projectile.velocity.Y = ownerDist.Y;
// Delete the saw if it touches its owner
if (Main.myPlayer == Projectile.owner)
{
if (Projectile.Hitbox.Intersects(Owner.Hitbox))
Projectile.Kill();
}
}
}
else
{
// A bit of dust while travelling
if (Main.rand.NextBool())
{
Color dustColor = Empowered ? Main.DiscoColor : new Color(Main.DiscoR, 255, 60);
Dust trail = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, dustColor, 1.2f);
trail.noGravity = true;
}
}
// Rainbow smear particles which follow the path of the slashes
if (Empowered)
{
if (SawLevel >= 2f)
{
if (LargeSlashSmear == null)
{
LargeSlashSmear = new CircularSmearVFX(Projectile.Center, Color.Black, Time * -Projectile.rotation, 1.35f);
GeneralParticleHandler.SpawnParticle(LargeSlashSmear);
}
else
{
LargeSlashSmear.Rotation = -Projectile.rotation;
LargeSlashSmear.Time = 0;
LargeSlashSmear.Position = Projectile.Center;
LargeSlashSmear.Scale = 1.35f;
LargeSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.8f;
}
}
if (SawLevel >= 1f)
{
if (SmallSlashSmear == null)
{
SmallSlashSmear = new CircularSmearVFX(Projectile.Center, Color.Black, Projectile.rotation, 0.8f);
GeneralParticleHandler.SpawnParticle(SmallSlashSmear);
}
else
{
SmallSlashSmear.Rotation = Projectile.rotation;
SmallSlashSmear.Time = 0;
SmallSlashSmear.Position = Projectile.Center;
SmallSlashSmear.Scale = 0.8f;
SmallSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Cos(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.6f;
}
}
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
int sparkCount = 6 + 5 * (int)SawLevel;
for (int s = 0; s < sparkCount; s++)
{
Vector2 sparkVelocity = new Vector2();
if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X < 0)
sparkVelocity = Vector2.UnitX * 6.5f;
else if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X >= 0)
sparkVelocity = Vector2.UnitX * -6.5f;
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y < 0)
sparkVelocity = Vector2.UnitY * 6.5f;
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y >= 0)
sparkVelocity = Vector2.UnitY * -6.5f;
Vector2 sparkLocation = sparkVelocity.X > 0f ? Projectile.Left : (sparkVelocity.X < 0f ? Projectile.Right : (sparkVelocity.Y > 0f ? Projectile.Top : Projectile.Bottom));
sparkVelocity = sparkVelocity.RotatedByRandom(MathHelper.PiOver2) * (Main.rand.NextFloat(0.8f, 1.2f) + (Main.rand.NextFloat(0.2f, 0.6f) * SawLevel));
float scale = Main.rand.NextFloat(0.5f, 0.8f) + Main.rand.NextFloat(0.2f, 0.6f) * SawLevel;
Particle collisionSparks = new AltLineParticle(sparkLocation, sparkVelocity, false, 30, scale, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
GeneralParticleHandler.SpawnParticle(collisionSparks);
}
SoundEngine.PlaySound(Main.zenithWorld ? TileCollideGFB : SoundID.Item178 with { Pitch = 0.1f * Projectile.numHits }, Projectile.Center); // Placeholder sound
if (Projectile.velocity.X != oldVelocity.X)
Projectile.velocity.X = -oldVelocity.X;
if (Projectile.velocity.Y != oldVelocity.Y)
Projectile.velocity.Y = -oldVelocity.Y;
if (PierceBeforeReturn > 0)
{
PierceBeforeReturn--;
Projectile.numHits++;
if (PierceBeforeReturn <= 0)
Returning = true;
}
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 180);
target.AddBuff(ModContent.BuffType<ElementalMix>(), 90);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") with { Pitch = 0.1f * Projectile.numHits }, Projectile.Center);
// SUPER COLORFUL PARTICLE EFFECTS YEAH
int onHitSparkAmount = 7 + 10 * (int)SawLevel;
for (int s = 0; s < onHitSparkAmount; s++)
{
Vector2 sparkVel = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * (Main.rand.NextFloat(0.4f, 0.8f) + (Main.rand.NextFloat(0.4f, 0.6f) * SawLevel));
float sparkSize = 0.4f + Main.rand.NextFloat(0.3f, 0.6f) * SawLevel;
Color sparkColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f);
Particle sparked = new AltLineParticle(target.Center, sparkVel, false, 30, sparkSize, sparkColor);
GeneralParticleHandler.SpawnParticle(sparked);
}
for (int sq = 0; sq < 7; sq++)
{
Vector2 squareVel = Main.rand.NextVector2CircularEdge(1f, 1f)* (Main.rand.NextFloat(10f, 16f) + 5f * SawLevel);
float squareSize = 1.6f + Main.rand.NextFloat(1f, 1.6f) * SawLevel;
Color squareColor = Main.hslToRgb(Main.rand.NextFloat(), 0.6f, 0.8f);
Particle squared = new SquareParticle(target.Center, squareVel, true, 30, squareSize, squareColor);
GeneralParticleHandler.SpawnParticle(squared);
}
// Hitstop effect if the saw is not returning
if (!Returning && HitstopTimer == 0)
{
HitstopTimer = 5;
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) / SuperradiantSlaughterer.ShootSpeed;
}
if (Projectile.numHits < 1)
ReturnTimer = 1;
if (PierceBeforeReturn > 0)
{
PierceBeforeReturn--;
if (PierceBeforeReturn <= 0)
Returning = true;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// The saw deals less damage while returning, to prevent its damage being too crazy
if (PierceBeforeReturn <= 0)
modifiers.SourceDamage *= 0.33f;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2), Projectile.Center);
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
if (SawLevel >= 2f)
hitbox.Inflate(72, 72);
else if (SawLevel >= 1f)
hitbox.Inflate(32, 32);
}
public override bool PreDraw(ref Color lightColor)
{
LargeSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawLargeSlash");
Texture2D largeSlashTexture = LargeSlash.Value;
SmallSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawSmallSlash");
Texture2D smallSlashTexture = SmallSlash.Value;
Color slashColor = new Color(200, 200, 200, 100);
if (SawLevel >= 2f)
{
Main.EntitySpriteDraw(largeSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, -Projectile.rotation, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f), Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f));
float randomParticleScale = Main.rand.NextFloat(0.65f, 0.95f);
Color bloomColor = Color.Lerp(new Color(29, 120, 30), new Color(56, 255, 59), MathF.Abs(MathF.Sin(Time)));
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : bloomColor, randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
if (SawLevel >= 1f)
{
Main.EntitySpriteDraw(smallSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, Projectile.rotation, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width, Projectile.width), Main.rand.NextFloat(-Projectile.width, Projectile.width));
float randomParticleScale = Main.rand.NextFloat(0.35f, 0.65f);
Color bloomColor = Color.Lerp(new Color(29, 120, 30), new Color(56, 255, 59), MathF.Abs(MathF.Cos(Time)));
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : bloomColor, randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
// Draw the saw itself at full brightness
Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value;
Main.EntitySpriteDraw(buzzsawTexture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Empowered) // Rainbow outline while empowered
{
SawOutline ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawOutline");
Texture2D outline = SawOutline.Value;
Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None);
}
if (!CalamityConfig.Instance.Afterimages)
return false;
// Special afterimage drawing to include the slashes
for (int i = 1; i < Projectile.oldPos.Length; i++)
{
float afterimageRot = Projectile.oldRot[i];
Vector2 drawPos = Projectile.oldPos[i] + buzzsawTexture.Size() * 0.5f - Main.screenPosition;
float intensity = MathHelper.Lerp(0.1f, 0.6f, 1f - i / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(buzzsawTexture, drawPos, null, lightColor * intensity, afterimageRot, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (SawLevel >= 2f)
Main.EntitySpriteDraw(largeSlashTexture, drawPos, null, slashColor * intensity, -afterimageRot, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (SawLevel >= 1f)
Main.EntitySpriteDraw(smallSlashTexture, drawPos, null, slashColor * intensity, afterimageRot, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,201 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SuperradiantSawLingering : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/Ranged/SuperradiantSaw";
public ref float Time => ref Projectile.ai[1];
public Particle SmallSlashSmear;
public Particle LargeSlashSmear;
public static Asset<Texture2D> SawOutline;
public static Asset<Texture2D> SmallSlash;
public static Asset<Texture2D> LargeSlash;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 46;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 270;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
// dies from cringe (Deadshot Brooch moment)
if (Projectile.MaxUpdates > 1)
Projectile.MaxUpdates = 1;
// Timer and rotation
Time++;
Projectile.rotation += MathHelper.ToRadians(42f);
// Make it lose velocity as it travels
Projectile.velocity *= 0.955f;
// Continously spawn homing bolts and small saws
if (Time % 12 == 0 && Time > 30)
{
Vector2 randVelocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(7.5f, 9f);
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randVelocity, ModContent.ProjectileType<SuperradiantBolt>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
// Fade out at the end of its lifetime
if (Projectile.timeLeft <= 30)
{
Projectile.alpha += 8;
if (Projectile.alpha > 255)
Projectile.Kill();
}
// Rainbow smear particles which follow the path of the slashes
if (LargeSlashSmear == null)
{
LargeSlashSmear = new CircularSmearVFX(Projectile.Center, Color.Black, Time * -Projectile.rotation, 1.35f);
GeneralParticleHandler.SpawnParticle(LargeSlashSmear);
}
else
{
LargeSlashSmear.Rotation = -Projectile.rotation;
LargeSlashSmear.Time = 0;
LargeSlashSmear.Position = Projectile.Center;
LargeSlashSmear.Scale = 1.35f;
LargeSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.8f * Projectile.Opacity;
}
if (SmallSlashSmear == null)
{
SmallSlashSmear = new CircularSmearVFX(Projectile.Center, Color.Black, Projectile.rotation, 0.8f);
GeneralParticleHandler.SpawnParticle(SmallSlashSmear);
}
else
{
SmallSlashSmear.Rotation = Projectile.rotation;
SmallSlashSmear.Time = 0;
SmallSlashSmear.Position = Projectile.Center;
SmallSlashSmear.Scale = 0.8f;
SmallSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Cos(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.6f * Projectile.Opacity;
}
}
public override bool? CanDamage() => Projectile.timeLeft > 30;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 180);
target.AddBuff(ModContent.BuffType<ElementalMix>(), 90);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice"), Projectile.Center);
// SUPER EPIC AND AWESOME PARTICLES
for (int s = 0; s < 12; s++)
{
Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f)* Main.rand.NextFloat(14f, 18f);
float sparkSize = Main.rand.NextFloat(1f, 1.4f);
Color sparkColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f);
Particle sparked = new AltLineParticle(target.Center, sparkVel, false, 30, sparkSize, sparkColor);
GeneralParticleHandler.SpawnParticle(sparked);
}
for (int sq = 0; sq < 5; sq++)
{
Vector2 squareVel = Main.rand.NextVector2CircularEdge(1f, 1f)* Main.rand.NextFloat(10f, 16f);
float squareSize = Main.rand.NextFloat(3.2f, 4f);
Color squareColor = Main.hslToRgb(Main.rand.NextFloat(), 0.6f, 0.8f);
Particle squared = new SquareParticle(target.Center, squareVel, true, 30, squareSize, squareColor);
GeneralParticleHandler.SpawnParticle(squared);
}
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2), Projectile.Center);
for (int i = 0; i < 32; i++)
{
Vector2 velocity = ((MathHelper.TwoPi * i / 32f) - (MathHelper.Pi / 32f)).ToRotationVector2() * 32f;
Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, Color.Lime, 1.5f, 30, 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f));
GeneralParticleHandler.SpawnParticle(sparkle);
}
}
public override void ModifyDamageHitbox(ref Rectangle hitbox) => hitbox.Inflate(70, 70);
public override bool PreDraw(ref Color lightColor)
{
LargeSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawLargeSlash");
Texture2D largeSlashTexture = LargeSlash.Value;
SmallSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawSmallSlash");
Texture2D smallSlashTexture = SmallSlash.Value;
Color slashColor = new Color(200, 200, 200, 100) * Projectile.Opacity;
Main.EntitySpriteDraw(largeSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, -Projectile.rotation, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f), Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f));
float randomParticleScale = Main.rand.NextFloat(0.65f, 0.95f);
Color bloomColor = Color.Lerp(new Color(29, 120, 30), new Color(56, 255, 59), MathF.Abs(MathF.Sin(Time)));
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : bloomColor, randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
Main.EntitySpriteDraw(smallSlashTexture, Projectile.Center - Main.screenPosition, null, slashColor, Projectile.rotation, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width, Projectile.width), Main.rand.NextFloat(-Projectile.width, Projectile.width));
float randomParticleScale = Main.rand.NextFloat(0.35f, 0.65f);
Color bloomColor = Color.Lerp(new Color(29, 120, 30), new Color(56, 255, 59), MathF.Abs(MathF.Sin(Time)));
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : bloomColor, randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
// Draw the saw itself at full brightness, glow and outline in rainbow
Texture2D buzzsawTexture = TextureAssets.Projectile[Projectile.type].Value;
Main.EntitySpriteDraw(buzzsawTexture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None);
SawOutline ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawOutline");
Texture2D outline = SawOutline.Value;
Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None);
if (!CalamityConfig.Instance.Afterimages)
return false;
// Special afterimage drawing to include the slashes
for (int i = 1; i < Projectile.oldPos.Length; i++)
{
float afterimageRot = Projectile.oldRot[i];
Vector2 drawPos = Projectile.oldPos[i] + buzzsawTexture.Size() * 0.5f - Main.screenPosition;
float intensity = MathHelper.Lerp(0.1f, 0.6f, 1f - i / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(buzzsawTexture, drawPos, null, Color.White * intensity, afterimageRot, buzzsawTexture.Size() * 0.5f, 1f, SpriteEffects.None);
Main.EntitySpriteDraw(largeSlashTexture, drawPos, null, slashColor * intensity, -afterimageRot, largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
Main.EntitySpriteDraw(smallSlashTexture, drawPos, null, slashColor * intensity, afterimageRot, smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,350 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SuperradiantSlaughtererHoldout : BaseGunHoldoutProjectile
{
public override int AssociatedItemID => ModContent.ItemType<SuperradiantSlaughterer>();
public override float RecoilResolveSpeed => 0.05f;
public override float MaxOffsetLengthFromArm => 36f;
public override float BaseOffsetY => -5f;
public override float OffsetYUpwards => -5f;
public override float OffsetYDownwards => 5f;
public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.25f;
public ref float Time => ref Projectile.ai[0];
public const float ChargeupTime = 120f;
public SlotId ChargeIdle;
// Controls the saw visually disappearing from the holdout when it fires.
public bool NoSawOnHoldout = false;
public Particle SmallSlashSmear;
public Particle LargeSlashSmear;
public static Asset<Texture2D> Holdout;
public static Asset<Texture2D> HoldoutGlow;
public static Asset<Texture2D> MiniSaw;
public static Asset<Texture2D> SmallSlash;
public static Asset<Texture2D> LargeSlash;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 5;
}
public override void SetDefaults()
{
base.SetDefaults();
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void KillHoldoutLogic()
{
if (HeldItem.type != Owner.ActiveItem().type)
{
Projectile.Kill();
Projectile.netUpdate = true;
}
}
public override void HoldoutAI()
{
Time++;
float SawPower = MathHelper.Clamp(Time / ChargeupTime, 0f, 1f);
if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle) && Idle.IsPlaying)
Idle.Position = GunTipPosition;
// Handle the right-click dash (holds priority over left-click)
if (Owner.Calamity().mouseRight && !Owner.HasCooldown(SuperradiantSawBoost.ID))
{
Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown);
Owner.Calamity().sBlasterDashActivated = true;
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition);
// Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x)
float mouseDist = Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld) / 21f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * mouseDist, ModContent.ProjectileType<SuperradiantSawLingering>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
// Special case: right-clicking while not holding left-click
// This is to keep it friendly to use both fires at the same time, but end the animation early if not
if (Projectile.ai[1] >= 2f)
{
NoSawOnHoldout = true;
OffsetLengthFromArm -= 16f;
Projectile.timeLeft = Owner.ActiveItem().useAnimation;
KeepRefreshingLifetime = false;
Idle?.Stop();
}
// If moving, make particle effects when the dash activates
if (Owner.velocity != Vector2.Zero)
{
int particleAmt = 7;
for (int c = 0; c < particleAmt; c++)
{
Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1));
Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int e = 0; e < particleAmt * 2; e++)
{
Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1));
Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3));
GeneralParticleHandler.SpawnParticle(spark2);
}
}
}
else if (Owner.CantUseHoldout() && Projectile.ai[1] < 1f)
{
KeepRefreshingLifetime = false;
Idle?.Stop();
Projectile.ai[1] = 1f;
Projectile.timeLeft = Owner.ActiveItem().useAnimation;
SoundStyle ShootSound = new("CalamityMod/Sounds/Item/SawShot", 2) { PitchVariance = 0.1f, Volume = 0.4f + SawPower * 0.5f };
SoundEngine.PlaySound(ShootSound, GunTipPosition);
float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 2f; // The damage must be divided by 2 to offset the holdout having 2x base damage.
int sawPierce = (int)MathHelper.Lerp(2f, 7f, SawPower);
int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt();
// ai[0] determines which slashes are drawn. ai[1] is the saw's timer variable. ai[2] stores the saw's pierce.
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * SuperradiantSlaughterer.ShootSpeed, ModContent.ProjectileType<SuperradiantSaw>(), (int)(Projectile.damage * sawDamageMult), Projectile.knockBack, Projectile.owner, sawLevel, 0f, sawPierce);
NoSawOnHoldout = true;
OffsetLengthFromArm -= 4f + 12f * SawPower;
int sparkPairCount = 3 + 2 * sawLevel;
for (int s = 0; s < sparkPairCount; s++)
{
float velocityMult = Main.rand.NextFloat(5f, 8f) + Main.rand.NextFloat(4f, 7f) * sawLevel;
float scale = Main.rand.NextFloat(0.6f, 0.8f) + Main.rand.NextFloat(0.3f, 0.5f) * sawLevel;
Color color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f);
Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * velocityMult;
Particle weaponShootSparks = new AltLineParticle(GunTipPosition, sparkVelocity, false, 40, scale, color);
GeneralParticleHandler.SpawnParticle(weaponShootSparks);
// re-randomize rotation for the alternate particle
sparkVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * velocityMult;
Particle weaponShootSparks2 = new AltSparkParticle(GunTipPosition, sparkVelocity, false, 40, scale, color);
GeneralParticleHandler.SpawnParticle(weaponShootSparks2);
}
}
if (NoSawOnHoldout)
{
Projectile.frame = 4;
return;
}
else
{
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 0;
}
}
// Smear particles which follow the path of the slashes
if (SawPower >= 1f)
{
if (LargeSlashSmear == null)
{
LargeSlashSmear = new CircularSmearVFX(GunTipPosition, Color.Black, Time * -MathHelper.ToRadians(42f), 1.35f);
GeneralParticleHandler.SpawnParticle(LargeSlashSmear);
}
else
{
LargeSlashSmear.Rotation = Time * -MathHelper.ToRadians(42f);
LargeSlashSmear.Time = 0;
LargeSlashSmear.Position = GunTipPosition;
LargeSlashSmear.Scale = 1.35f;
LargeSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.8f;
}
}
if (SawPower >= 0.25f)
{
if (SmallSlashSmear == null)
{
SmallSlashSmear = new CircularSmearVFX(GunTipPosition, Color.Black, Time * MathHelper.ToRadians(42f), 0.8f);
GeneralParticleHandler.SpawnParticle(SmallSlashSmear);
}
else
{
SmallSlashSmear.Rotation = Time * MathHelper.ToRadians(42f);
SmallSlashSmear.Time = 0;
SmallSlashSmear.Position = GunTipPosition;
SmallSlashSmear.Scale = 0.8f;
SmallSlashSmear.Color = Main.hslToRgb(0.5f + 0.5f * MathF.Cos(Main.GlobalTimeWrappedHourly * 5f), 1f, 0.6f) * 0.6f;
}
}
if (Time < ChargeupTime)
{
if (Time == 30f && !NoSawOnHoldout)
ChargeIdle = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BuzzsawCharge") { Volume = 0.3f }, GunTipPosition);
}
else
{
if ((Time + 240) % 360 == 0)
ChargeIdle = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BuzzsawIdle"), GunTipPosition);
if (Time % 3 == 0)
{
Vector2 smokeVelocity = Vector2.UnitY * Main.rand.NextFloat(-7f, -12f);
smokeVelocity = smokeVelocity.RotatedByRandom(MathHelper.Pi / 8f);
Color smokeColor = Main.rand.NextBool() ? Main.DiscoColor : Color.Gray;
Particle fullChargeSmoke = new HeavySmokeParticle(GunTipPosition + Main.rand.NextVector2CircularEdge(3f, 3f), smokeVelocity, smokeColor, 30, 0.65f, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), true);
GeneralParticleHandler.SpawnParticle(fullChargeSmoke);
}
}
}
public override void OnSpawn(IEntitySource source)
{
base.OnSpawn(source);
ExtraBackArmRotation = MathHelper.ToRadians(15f);
}
// Failsafe because apparently the sound doesn't stop sometimes
public override void OnKill(int timeLeft)
{
if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle))
Idle?.Stop();
}
// The holdout can deal damage; you're literally spinning up a buzzsaw at the end, after all.
public override bool? CanDamage() => !NoSawOnHoldout;
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
hitbox = new Rectangle((int)GunTipPosition.X - 23, (int)GunTipPosition.Y - 23, 46, 46);
if (Time / ChargeupTime >= 1f)
hitbox.Inflate(72, 72);
else if (Time / ChargeupTime >= 0.25f)
hitbox.Inflate(32, 32);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 300);
target.AddBuff(ModContent.BuffType<ElementalMix>(), 150);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition);
// EPIC AND COOL RAINBOW PARTICLES WOOOO
int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt();
int onHitSparkAmount = 4 + 4 * SawLevel;
for (int s = 0; s < onHitSparkAmount; s++)
{
Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f) * (Main.rand.NextFloat(6f, 10f) + 5f * SawLevel);
float sparkSize = 0.4f + Main.rand.NextFloat(0.3f, 0.6f) * SawLevel;
Color sparkColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f);
Particle sparked = new AltLineParticle(target.Center, sparkVel, false, 20, sparkSize, sparkColor);
GeneralParticleHandler.SpawnParticle(sparked);
}
for (int sq = 0; sq < 5; sq++)
{
Vector2 squareVel = Main.rand.NextVector2CircularEdge(1f, 1f)* (Main.rand.NextFloat(6f, 10f) + 5f * SawLevel);
float squareSize = 1.6f + Main.rand.NextFloat(1f, 1.6f) * SawLevel;
Color squareColor = Main.hslToRgb(Main.rand.NextFloat(), 0.6f, 0.8f);
Particle squared = new SquareParticle(target.Center, squareVel, true, 20, squareSize, squareColor);
GeneralParticleHandler.SpawnParticle(squared);
}
}
public override bool PreDraw(ref Color lightColor)
{
Holdout ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSlaughtererHoldout");
Texture2D holdoutTexture = Holdout.Value;
LargeSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawLargeSlash");
Texture2D largeSlashTexture = LargeSlash.Value;
SmallSlash ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSawSmallSlash");
Texture2D smallSlashTexture = SmallSlash.Value;
Color slashColor = new Color(200, 200, 200, 100);
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = holdoutTexture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = frame.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (!NoSawOnHoldout)
{
float shake = Utils.Remap(Time, 0f, ChargeupTime, 0f, 3f);
drawPosition += Main.rand.NextVector2Circular(shake, shake);
}
// Mini saw drawn under the gun
MiniSaw ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSlaughtererHoldoutMiniSaw");
Texture2D mini = MiniSaw.Value;
Vector2 verticalOffset = Vector2.UnitY.RotatedBy(Projectile.rotation);
if (Math.Cos(Projectile.rotation) < 0f)
verticalOffset *= -1f;
Vector2 miniSawPosition = drawPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.125f + verticalOffset * 6f;
Main.EntitySpriteDraw(mini, miniSawPosition, null, Color.White, Time * MathHelper.ToRadians(24f), mini.Size() * 0.5f, Projectile.scale, flipSprite);
Main.EntitySpriteDraw(holdoutTexture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite);
// Glowmask
HoldoutGlow ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SuperradiantSlaughtererHoldoutGlow");
Texture2D glow = HoldoutGlow.Value;
Main.EntitySpriteDraw(glow, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite);
if (NoSawOnHoldout)
return false;
if (Time > 30f)
{
if (Time / ChargeupTime >= 1f)
Main.EntitySpriteDraw(largeSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * -MathHelper.ToRadians(42f), largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time / ChargeupTime >= 0.25f)
Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (!CalamityConfig.Instance.Afterimages)
return false;
// Special afterimage drawing for the slashes only
for (int i = 1; i < 3; i++)
{
float intensity = MathHelper.Lerp(0.05f, 0.25f, 1f - i / 3f);
if (Time / ChargeupTime >= 1f)
Main.EntitySpriteDraw(largeSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor * intensity, (Time - i) * -MathHelper.ToRadians(42f), largeSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
if (Time / ChargeupTime >= 0.25f)
Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor * intensity, (Time - i) * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None);
}
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

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