This commit is contained in:
mountaindrew10 committed 2025-05-03 21:54:56 -05:00
commit 8bc9a3bd00
33 files changed
+1201 -329

No files matched your search

+3 -6
View File
@@ -21,12 +21,13 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 56;
Item.height = 60;
Item.damage = 143;
Item.damage = 1000;
Item.DamageType = DamageClass.Magic;
Item.mana = 22;
Item.useTime = 25;
Item.useAnimation = 25;
Item.useStyle = ItemUseStyleID.Shoot;
Item.channel = true;
Item.noMelee = true;
Item.knockBack = 8f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
@@ -39,11 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
for (int i = 0; i < 7; i++)
{
Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f);
Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer);
}
velocity *= 0;
return true; // Fires one directly with no randomness, totaling 8 projectiles
}
+47 -39
View File
@@ -1,8 +1,11 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -10,68 +13,73 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class TheMutilator : ModItem, ILocalizedModType
public class TheMutilator : BaseSwordHoldoutItem, ILocalizedModType
{
public static int MaximumCharge = 10;
public int Charge = 0;
public int DecayTimer = 0;
public new string LocalizationCategory => "Items.Weapons.Melee";
public override int ProjectileType => ModContent.ProjectileType<MutilatorSwordProj>();
public override void SetDefaults()
{
Item.width = 90;
Item.height = 90;
Item.damage = 483;
Item.damage = 1111;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 18;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 18;
Item.useTurn = true;
Item.useTime = 30;
Item.knockBack = 8f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.shootSpeed = 10f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
base.SetDefaults();
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 240);
if (target.life <= (target.lifeMax * 0.2f))
public override void ModifyWeaponDamage(Player player, ref StatModifier damage)
{
damage *= 1 + Charge / 7f;
}
public override void UpdateInventory(Player player)
{
if (DecayTimer > 0) DecayTimer--;
else
{
if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool())
if (Charge > 0)
{
int heartDrop = CalamityPlayer.areThereAnyDamnBosses ? 1 : Main.rand.Next(1, 3);
for (int i = 0; i < heartDrop; i++)
{
Item.NewItem(player.GetSource_OnHit(target), (int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false);
}
}
SoundEngine.PlaySound(SoundID.Item14, target.Center);
target.position.X += target.width / 2;
target.position.Y += target.height / 2;
target.position.X -= target.width / 2;
target.position.Y -= target.height / 2;
for (int i = 0; i < 30; i++)
{
int bloodDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloodDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[bloodDust].scale = 0.5f;
Main.dust[bloodDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 50; j++)
{
int bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[bloodDust2].noGravity = true;
Main.dust[bloodDust2].velocity *= 5f;
bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloodDust2].velocity *= 2f;
Charge--;
DecayTimer = 60;
}
}
}
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
float fill = Charge / (float)MaximumCharge;
if (fill <= 0)
return;
float barScale = 3f;
var barBG = ModContent.Request<Texture2D>("CalamityMod/UI/MiscTextures/GenericBarBack").Value;
var barFG = ModContent.Request<Texture2D>("CalamityMod/UI/MiscTextures/GenericBarFront").Value;
Vector2 barOrigin = barBG.Size() * 0.5f;
float yOffset = 44f;
Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset);
Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height);
Color colorBG = Color.Crimson;
Color colorFG = Color.Lerp(Color.OrangeRed, Color.DarkOrange, fill);
spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f);
spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f);
}
public override void AddRecipes()
{
CreateRecipe().
+1
View File
@@ -1,5 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Typeless;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
+17 -45
View File
@@ -1,6 +1,8 @@
using System;
using CalamityMod.Items.Ammo;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
@@ -13,14 +15,16 @@ namespace CalamityMod.Items.Weapons.Ranged
public class ArterialAssault : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
int shotNum = 0;
public override void SetDefaults()
{
Item.width = 44;
Item.height = 100;
Item.damage = 110;
Item.damage = 500;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 3;
Item.useAnimation = 15;
Item.useTime = 6;
Item.useAnimation = 40;
Item.reuseDelay = 10;
Item.useLimitPerAnimation = 5;
Item.useStyle = ItemUseStyleID.Shoot;
@@ -34,52 +38,20 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.shootSpeed = 30f;
Item.useAmmo = AmmoID.Arrow;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float arrowSpeed = Item.shootSpeed;
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (player.gravDir == -1f)
{
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
{
mouseXDist = (float)player.direction;
mouseYDist = 0f;
mouseDistance = arrowSpeed;
}
else
{
mouseDistance = arrowSpeed / mouseDistance;
}
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f;
realPlayerPos.Y -= 100f;
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (mouseYDist < 0f)
{
mouseYDist *= -1f;
}
if (mouseYDist < 20f)
{
mouseYDist = 20f;
}
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
mouseDistance = arrowSpeed / mouseDistance;
mouseXDist *= mouseDistance;
mouseYDist *= mouseDistance;
Vector2 arrowVel = new Vector2(mouseXDist, mouseYDist);
Projectile shotArrow = Projectile.NewProjectileDirect(source, realPlayerPos, arrowVel, type, damage, knockback, player.whoAmI);
float rotateBy = 0.75f * ((shotNum*3) % 5 - 2);
position += velocity.SafeNormalize(Vector2.Zero).RotatedBy(rotateBy) * 64;
velocity = position.DirectionTo(Main.MouseWorld) * velocity.Length()*2;
type = ModContent.ProjectileType<BloodfireArrowProj>();
Projectile shotArrow = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI);
shotArrow.noDropItem = true;
shotArrow.tileCollide = false;
shotArrow.Calamity().conditionalHomingRange = 300f;
(shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true;
shotArrow.Calamity().conditionalHomingRange = 175f;
shotArrow.Calamity().BloodstoneOrbValue = 20;
shotNum++;
if (shotNum > 4) shotNum = 0;
return false;
}
+2 -2
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Item.width = 60;
Item.height = 30;
Item.damage = 115;
Item.damage = 135;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 5;
Item.useAnimation = 25;
@@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
shotReturn = !shotReturn;
if (Main.rand.NextFloat() > 0.60f)
if (Main.rand.NextFloat() > 0.20f)
player.statLife -= 1;
if (player.statLife <= 0)
{
-58
View File
@@ -1,58 +0,0 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ClaretCannon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.width = 48;
Item.height = 30;
Item.damage = 148;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 3;
Item.useAnimation = 9;
Item.reuseDelay = 10;
Item.useLimitPerAnimation = 3;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 5.5f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.UseSound = SoundID.Item40;
Item.autoReuse = true;
Item.shootSpeed = 24f;
Item.shoot = ModContent.ProjectileType<ClaretCannonProj>();
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<BloodstoneCore>(4).
AddTile(TileID.LunarCraftingStation).
Register();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ClaretCannonProj>(), damage, knockback, player.whoAmI);
else
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
return false;
}
}
}
+109
View File
@@ -0,0 +1,109 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
using System;
namespace CalamityMod.Items.Weapons.Typeless
{
public class ClaretCannon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Typeless";
public int ClaretCooldown = 0;
public static int ClaretCooldownMax = 300;
public float baseUseDir = 0;
public override void SetDefaults()
{
Item.width = 48;
Item.height = 30;
Item.damage = 500;
Item.DamageType = AverageDamageClass.Instance;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useLimitPerAnimation = 1;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 5.5f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.UseSound = SoundID.Item40;
Item.autoReuse = true;
Item.shootSpeed = 12f;
Item.shoot = ModContent.ProjectileType<ClaretCannonProj>();
}
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
public override void UpdateInventory(Player player)
{
ClaretCooldown--;
if (ClaretCooldown < 0)
ClaretCooldown = 0;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<BloodstoneCore>(4).
AddTile(TileID.LunarCraftingStation).
Register();
}
public override bool CanUseItem(Player player)
{
if (ClaretCooldown > 0)
return false;
return true;
}
public override void UseAnimation(Player player)
{
}
public override void UseItemFrame(Player player)
{
float comp = 1 - player.itemTime / (float)player.itemTimeMax;
float lerpValue1 = MathHelper.Lerp(0, 90, MathF.Pow(comp, 0.3f));
float lerpValue2 = MathHelper.Lerp(90, 0, MathF.Pow(comp, 2));
player.itemRotation = baseUseDir - MathHelper.ToRadians(Math.Min(lerpValue1, lerpValue2)) * player.direction;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
baseUseDir = player.itemRotation;
ClaretCooldown = ClaretCooldownMax;
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
return false;
}
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
float fill = ClaretCooldown / (float)ClaretCooldownMax;
if (fill <= 0)
return;
float barScale = 1.5f;
var barBG = ModContent.Request<Texture2D>("CalamityMod/UI/MiscTextures/GenericBarBack").Value;
var barFG = ModContent.Request<Texture2D>("CalamityMod/UI/MiscTextures/GenericBarFront").Value;
Vector2 barOrigin = barBG.Size() * 0.5f;
float yOffset = 5f;
Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset);
Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height);
Color colorBG = Color.Crimson;
Color colorFG = Color.Lerp(Color.OrangeRed, Color.DarkOrange, fill);
spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f);
spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f);
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 694 B

@@ -749,7 +749,12 @@ SandstreamScepter: {
SanguineFlare: {
DisplayName: Sanguine Flare
Tooltip: Fires a blast of sanguine flares that drain enemy life
Tooltip:
'''
Charges up a sanguine flare that gains power over time
When striking an enemy, this flare causes a bloodsplosion and splits into blood orbs
Picking up these blood orbs reduces the duration of [Potion Sickness]
'''
}
SeethingDischarge: {
@@ -994,7 +999,9 @@ Viscera: {
DisplayName: Viscera
Tooltip:
'''
Fires a rapid barrage of piercing blood beams that heal you on enemy hit
Fires a rapid barrage of piercing blood beams
The first enemy struck by each beam will burst into blood orbs
Picking up these blood orbs reduces the duration of [Potion Sickness]
Each successive beam in the barrage deals more damage
The last beam of the barrage instead explodes upon hitting an enemy
'''
@@ -1359,8 +1359,9 @@ TheMutilator: {
DisplayName: The Mutilator
Tooltip:
'''
Striking an enemy below 20% life will trigger a bloodsplosion
Bloodsplosions cause hearts to drop that can be picked up to heal you
Striking enemies empowers The Mutilator, increasing its damage
At full charge, striking enemies causes a blood orb explosion
Picking up these blood orbs reduces the duration of [Potion Sickness]
'''
}
@@ -113,8 +113,9 @@ ArterialAssault: {
DisplayName: Arterial Assault
Tooltip:
'''
Fires a chain of 5 arrows from the sky
All arrows will rapidly home in on nearby enemies
Fires a group of 5 homing blood arrows
These blood arrows burst into blood orbs upon striking an enemy
Picking up these blood orbs reduces the duration of [Potion Sickness]
'''
}
@@ -201,9 +202,10 @@ BloodBoiler: {
DisplayName: Blood Boiler
Tooltip:
'''
Fires twin streams of life stealing bloodfire that returns to you
Fires twin streams of bloodfire that returns to you
Retuning bloodfire reduces [Potion Sickness] if it struck an enemy
Uses your health as ammo
40% chance to save health
20% chance to save health
'''
}
@@ -271,15 +273,6 @@ ClamorRifle: {
Tooltip: Converts musket balls into homing energy bolts
}
ClaretCannon: {
DisplayName: Claret Cannon
Tooltip:
'''
Fires strings of 3 bullets
Converts musket balls into bloody tears that drain enemy health
'''
}
CleansingBlaze: {
DisplayName: Cleansing Blaze
Tooltip:
@@ -85,8 +85,9 @@ BloodsoakedCrasher: {
'''
Throws a bloody axe that is affected by gravity and can bounce twice
The axe speeds up over time, but will slow down upon hitting an enemy
Heals on enemy hits
Stealth strikes spawn homing blood on enemy hits
Spews blood orbs upon enemy hits
Picking up these blood orbs reduces the duration of [Potion Sickness]
Stealth strikes spawn homing blood bolts on hit
'''
}
@@ -292,7 +292,8 @@ DragonbloodDisgorger: {
Tooltip:
'''
Summons a skeletal dragon and her two children
Baby spits passively heal the player
Baby spits burst into blood orbs upon hitting an enemy
Picking up these blood orbs reduces the duration of [Potion Sickness]
Requires 6 minion slots to be summoned
There can only be one family at a time
'''
@@ -7,6 +7,19 @@ Aestheticus: {
'''
}
ClaretCannon: {
DisplayName: Claret Cannon
Tooltip:
'''
Fires a hypercondensed claret round
The round explodes upon striking an enemy and releases blood orbs
The explosion shreds enemies, inflicting [Laceration] and dramatically reducing their defense
Picking up the blood orbs will reduce [Potion Sickness] when possible
If you do not have [Potion Sickness], your natural regeneration will be enhanced
Can only fire once every 5 seconds
'''
}
EyeofMagnus: {
DisplayName: Eye of Magnus
Tooltip:
@@ -19,3 +19,4 @@ RoyalHeal.DisplayName: Heal
ShinobiHealOrb.DisplayName: Blue Healing Orb
SilvaOrb.DisplayName: Silva Orb
TransfusionTrail.DisplayName: Heal
BloodstoneHealOrb.DisplayName: Bloodstone Heal Orb
@@ -306,3 +306,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
YinYoDark.DisplayName: Dark Shard
YinYoLight.DisplayName: Light Shard
MutilatorSwordProj.DisplayName: The Mutilator
@@ -46,7 +46,6 @@ ChromaticFlare.DisplayName: Chromatic Flare
CinderArrowProj.DisplayName: Cinder Arrow
ClamorRifleProj.DisplayName: Clamor Bolt
ClamorRifleProjSplit.DisplayName: Clamor Bolt
ClaretCannonProj.DisplayName: Claret Cannon
CondemnationArrow.DisplayName: Condemning Arrow
CondemnationArrowHoming.DisplayName: Condemning Echo
ContagionArrow.DisplayName: Contagion Arrow
@@ -32,6 +32,7 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation
ChaoticGeyser.DisplayName: Chaotic Geyser
ChlorophyteLifePulse.DisplayName: Life Pulse
ChronoClock.DisplayName: Chrono Clock
ClaretCannonProj.DisplayName: Claret Round
CoralBubble.DisplayName: Bubble
CoralBubbleSmall.DisplayName: Bubble
CosmicDashExplosion.DisplayName: Cosmic Dash Explosion
+4 -1
View File
@@ -33,6 +33,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/ExoMechs/THanosLaser");
public static readonly SoundStyle GFBeam = new("CalamityMod/Sounds/Custom/ExoMechs/THanosGFBeam");
public static readonly SoundStyle ThanatosHitSoundOpen = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen", 2) { Volume = 0.5f };
public static readonly SoundStyle ThanatosHitSoundClosed = new("CalamityMod/Sounds/NPCHit/ThanatosHitClosed", 3) { Volume = 0.4f };
@@ -903,7 +906,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
{
//Commented out in case we decide its better for it to simply play from anywhere in range
//if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance)
LaserSoundSlot = SoundEngine.PlaySound(LaserSound, NPC.Center);
LaserSoundSlot = SoundEngine.PlaySound((Main.zenithWorld ? GFBeam : LaserSound), NPC.Center);
// Create a bunch of lightning bolts in the sky
ExoMechsSky.CreateLightningBolt(12);
@@ -0,0 +1,497 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs;
using CalamityMod.Systems.Collections;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent.Prefixes;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.BaseProjectiles
{
public class BaseSwordHoldoutPlayer : ModPlayer
{
/// <summary>
/// Used to detect what swing a weapon is doing.
/// </summary>
public int swingNum = 0;
}
/// <summary>
/// Manages all the required settings for custom sword holdouts done using BaseSwordHoldoutProjectile
/// </summary>
public abstract class BaseSwordHoldoutItem : ModItem
{
public virtual int ProjectileType { get; set; }
public virtual bool SizeModifiers { get; set; } = true;
public virtual bool RClickAutoswing { get; set; } = false;
public override void SetStaticDefaults()
{
if (RClickAutoswing) ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
}
public override bool MeleePrefix()
{
return SizeModifiers;
}
public override void SetDefaults()
{
Item.noMelee = true;
Item.noUseGraphic = true;
Item.shoot = ProjectileType;
Item.autoReuse = true;
Item.useTurn = false;
Item.useStyle = ItemUseStyleID.Shoot;
if (SizeModifiers) PrefixLegacy.ItemSets.SwordsHammersAxesPicks[Item.type] = true;
}
public override bool CanUseItem(Player player)
{
if (player.itemTime > 0)
{
return false;
}
for (int i = 0; i < 1000; i++)
{
var proj = Main.projectile[i];
if (proj.type == ProjectileType && proj.owner == player.whoAmI && proj.active)
{
return false;
}
}
return base.CanUseItem(player);
}
}
[PierceResistException]
//Doze 24apr2025 - Not a child of BaseCustomUseStyleProjectile because this doesn't use any of it's functionality. Comes from my melee rework mod.
public abstract class BaseSwordHoldoutProjectile : ModProjectile
{
#region Overrideable Fields
/// <summary>
/// The width, in degrees, of the sword swing.
/// Defaults to 180
/// </summary>
public virtual int swingWidth { get; set; } = 180;
/// <summary>
/// How many frames the sword swing should take.
/// Defaults to 20
/// </summary>
public virtual int swingTime { get; set; } = 20;
/// <summary>
/// If the swing should alternate directions each use.
/// Defaults to true
/// </summary>
public virtual bool AlternateSwings { get; set; } = true;
/// <summary>
/// How far the held sword should be offset from the player
/// Defaults to 0
/// </summary>
public virtual int OffsetDistance { get; set; } = 0;
/// <summary>
/// What item this projectile uses as a base.
/// </summary>
public virtual Item BaseItem { get; set; }
/// <summary>
/// Whether or not this projectile uses a base item at all.
/// Defaults to true.
/// </summary>
public virtual bool UsesBaseItem { get; set; } = true;
/// <summary>
/// Length of after-image trail left by the projectile.
/// Defaults to 0
/// </summary>
public virtual int AfterImageLength { get; set; } = 0;
/// <summary>
/// Whether or not this should get melee speed bonuses
/// Defaults to TRUE
/// </summary>
public virtual bool useMeleeSpeed { get; set; } = true;
/// <summary>
/// Whether or not this should get melee size bonuses (Titan Glove)
/// Defaults to TRUE
/// </summary>
public virtual bool useMeleeSize { get; set; } = true;
/// <summary>
/// Array of three colors used for the built-in trail drawing code.
/// Defaults to White, Black, Green.
/// </summary>
public virtual Color[] trailColors { get; set; } = [Color.White, Color.Black, Color.Green];
/// <summary>
/// Whether or not to draw a trail when swung.
/// </summary>
public virtual bool drawSwordTrail { get; set; } = false;
/// <summary>
/// How far the trail should be offset from the center of the projectile. Use to draw trail at sword tip
/// Defaults to 25
/// </summary>
public virtual float trailOffset { get; set; } = 25;
/// <summary>
/// Length of the trail in frames
/// Defaults to 25
/// </summary>
public virtual int trailLength { get; set; } = 25;
/// <summary>
/// How long before the weapon should begin it's actual swing once used
/// </summary>
public virtual int StartupTime { get; set; } = 0;
/// <summary>
/// How long the weapon should "cool down" after swinging before ending the item use
/// </summary>
public virtual int CooldownTime { get; set; } = 0;
/// <summary>
/// Speed at which the projectile should rotate to match the mouse angle during StartupTime.
/// Set to 0 to disable.
/// Defaults to 0.5f
/// </summary>
public virtual float RotateInStartup { get; set; } = 0.5f;
#endregion
#region Fields
/// <summary>
/// Angle of the swing. By default, gets set to mouse angle. Can be set in Spawn(IEntitySource) for fixed angles.
/// </summary>
public Vector2 angle { get; set; } = Vector2.Zero;
/// <summary>
/// Internal timer for the projectile's entire lifespan
/// </summary>
public int timer { get; set; } = 0;
/// <summary>
/// Internal timer for the projectile's swing animation
/// </summary>
internal int swingTimer = 0;
public static Asset<Texture2D> TrailTexture;
public float baseScale;
/// <summary>
/// Old weapon scales used to track for trail drawing
/// </summary>
public List<float> oldScale = new List<float>();
List<float> oldProjectileRot = new List<float> { };
List<Vector2> oldProjectilePos = new List<Vector2> { };
internal int ExistsTime = 20;
public bool inStartup => timer < StartupTime;
public bool inCooldown => timer > CooldownStartFrame;
public bool inSwing => !(inStartup || inCooldown);
public int CooldownStartFrame => swingTime + StartupTime;
public int CooldownTimer => timer - CooldownStartFrame;
public float StartupCompletion => timer / (float)StartupTime;
public float SwingCompletion => swingTimer / (float)swingTime;
public float CooldownCompletion => CooldownTimer / (float)CooldownTime;
#endregion
#region Overridable Methods
/// <summary>
/// Happens after movement but before timer increases. Use as to not cancel the default AI behavior.
/// </summary>
public virtual void AdditionalAI() { }
/// <summary>
/// happens after OnSpawn. Use as not to cancel the default OnSpawn behavior.
/// </summary>
/// <param name="source"></param>
public virtual void Spawn(IEntitySource source) { }
/// <summary>
/// happens after SetDefaults. Use as not to cancel default SetDefaults behavior.
/// </summary>
public virtual void Defaults() { }
/// <summary>
/// Returns the swing offset from the center angle in radians. Automatically will be inverted if AlternateSwings is enabled.
/// </summary>
/// <returns></returns>
public virtual float SwingFunction()
{
return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 2, swingWidth / 2, swingTimer / (float)swingTime));
}
/// <summary>
/// The function for the width of the trail
/// </summary>
/// <param name="completion"></param>
/// <returns></returns>
public virtual float trailWidth(float completion)
{
return MathHelper.Lerp(30, 0, completion);
}
/// <summary>
/// The function for the color of the trail
/// </summary>
/// <param name="completion"></param>
/// <returns></returns>
public virtual Color trailColor(float completion)
{
return Color.Black;
}
#endregion
#region Overrides
public override void SetStaticDefaults()
{
ProjectileDestroyExceptionsList.List.Add(Projectile.type);
}
/// <summary>
/// DO NOT OVERRIDE IN MOST SITUATIONS
/// use Defaults() instead.
/// That will set defaults after everything is set in the base projectile.
/// </summary>
public override void SetDefaults()
{
Projectile.timeLeft = swingTime * 2;
if (UsesBaseItem)
{
Projectile.width = BaseItem.width;
Projectile.height = BaseItem.height;
}
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.extraUpdates = 0;
Projectile.aiStyle = -2;
Projectile.DamageType = ModLoader.GetMod("CalamityMod").Find<DamageClass>("TrueMeleeDamageClass");
Projectile.tileCollide = false;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100;
Defaults();
}
/// <summary>
/// DO NOT OVERRIDE IN MOST SITUATIONS
/// use Spawn(IEntitySource) instead
/// That will run spawn code in the proper timing.
/// </summary>
public override void OnSpawn(IEntitySource source)
{
var player = Main.player[Projectile.owner];
angle = (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One);
Projectile.velocity = Vector2.Zero;
if (angle.X < 0)
{
player.direction = 1;
Projectile.spriteDirection = 1 * (int)player.gravDir;
}
else
{
player.direction = -1;
Projectile.spriteDirection = -1 * (int)player.gravDir;
}
swingTime = Main.player[Projectile.owner].HeldItem.useTime;
Spawn(source);
if (useMeleeSpeed)
{
var speed = Main.player[Projectile.owner].GetAttackSpeed<MeleeDamageClass>();
if (speed > 3f)
speed = 3f;
if (speed != 0f)
speed = 1f / speed;
swingTime = (int)(swingTime * speed);
if (swingTime < 1)
{
swingTime = 1;
}
StartupTime = (int)(StartupTime * speed);
CooldownTime = (int)(CooldownTime * speed);
}
if (useMeleeSize)
{
if (player.meleeScaleGlove) Projectile.scale *= 1.1f;
Projectile.scale *= player.HeldItem.scale;
}
baseScale = Projectile.scale;
ExistsTime = swingTime + StartupTime + CooldownTime;
Projectile.timeLeft = ExistsTime * 2;
}
/// <summary>
/// DO NOT OVERRIDE IN MOST SITUATIONS
/// use AdditionalAI() instead
/// That will run AI code at the right time.
/// </summary>
public override void AI()
{
var player = Main.player[Projectile.owner];
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
float adust = MathHelper.ToRadians(45 + 180);
if (timer < StartupTime || timer > StartupTime + swingTime)
{
angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInStartup);
if (angle.X < 0)
{
player.direction = 1;
Projectile.spriteDirection = 1 * (int)player.gravDir;
}
else
{
player.direction = -1;
Projectile.spriteDirection = -1 * (int)player.gravDir;
}
}
if (Projectile.spriteDirection == -1)
{
adust = MathHelper.ToRadians(-45);
}
var armCenter = player.Center - new Vector2(5 * player.direction, 2);
if (AfterImageLength > 0)
{
oldProjectileRot.Add(Projectile.rotation);
oldProjectilePos.Add(Projectile.Center);
if (oldProjectileRot.Count > AfterImageLength)
{
oldProjectileRot.RemoveAt(0);
oldProjectilePos.RemoveAt(0);
}
}
var angle2 = (AlternateSwings && (modplayer.swingNum % 2 == 1 ? false : true) ? SwingFunction() : -SwingFunction());
Projectile.Center = armCenter - (angle * OffsetDistance * (1 + (Projectile.scale - 1) * 0.75f)).RotatedBy(Projectile.spriteDirection * angle2);
Projectile.rotation = angle.RotatedBy(Projectile.spriteDirection * angle2).ToRotation() + adust;
AdditionalAI();
player.itemTime = ExistsTime + 1 - timer;
if (timer > ExistsTime)
{
Projectile.Kill();
player.itemTime = 0;
}
timer++;
if (timer >= StartupTime && timer < StartupTime + swingTime)
{
swingTimer++;
}
var armDir = armCenter - Projectile.Center;
armDir.Y *= player.gravDir;
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armDir.ToRotation() + MathHelper.ToRadians(90));
oldScale.Insert(0, Projectile.scale);
}
public override bool PreDraw(ref Color lightColor)
{
var player = Main.player[Projectile.owner];
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
if (AfterImageLength > 0)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
for (int i = 0; i < oldProjectileRot.Count; i++)
{
var col = Projectile.Opacity * (i / (float)AfterImageLength) * 0.1f;
if (Projectile.spriteDirection == 1)
{
Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.None, 0);
}
else
{
Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.FlipHorizontally, 0);
}
}
}
if (drawSwordTrail && timer >= StartupTime && timer <= StartupTime + swingTime)
{
Main.spriteBatch.EnterShaderRegion();
if (TrailTexture == null)
{
TrailTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes", (AssetRequestMode)2);
}
Vector2 trailOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() + Projectile.Size * 0.5f;
GameShaders.Misc["CalamityMod:ExobladeSlash"].SetShaderTexture(TrailTexture);
GameShaders.Misc["CalamityMod:ExobladeSlash"].UseColor(trailColors[0]);
GameShaders.Misc["CalamityMod:ExobladeSlash"].UseSecondaryColor(trailColors[1]);
GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["fireColor"].SetValue(trailColors[2].ToVector3());
GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue((AlternateSwings && modplayer.swingNum % 2 == 1) ^ Projectile.spriteDirection == -1 ? false : true);
GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply();
var positionsToUse = Projectile.oldPos.Take((int)MathHelper.Min(trailLength,swingTimer)).ToArray();
for (var i = 0; i < positionsToUse.Length; i++)
{
if (i >= timer) break;
positionsToUse[i] += (Projectile.oldRot[i] - MathHelper.PiOver4 * (Projectile.spriteDirection == -1 ? 3 : 1)).ToRotationVector2() * this.trailOffset * oldScale[i];
}
PrimitiveRenderer.RenderTrail(positionsToUse, new(trailWidth, trailColor, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 25);
Main.spriteBatch.ExitShaderRegion();
Main.player[Projectile.owner].heldProj = Projectile.whoAmI;
}
Main.player[Projectile.owner].heldProj = Projectile.whoAmI;
return true;
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
var center = hitbox.Center.ToVector2();
hitbox.Height = (int)(Projectile.height * Projectile.scale);
hitbox.Width = (int)(Projectile.width * Projectile.scale);
hitbox.Location = (center - new Vector2(hitbox.Width / 2, hitbox.Height / 2)).ToPoint();
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.HitDirectionOverride = ((Main.player[Projectile.owner].DirectionTo(target.Center)).X >= 0 ? 1 : -1);
}
public override bool? CanDamage()
{
return inSwing;
}
#endregion
#region Helper Methods
/// <summary>
/// Spawns projectiles from the sword swing, automatically spacing them out on the if an amount is set.
/// </summary>
/// <param name="type"></param>
/// <param name="velocity">Velocity of the projectile. Automatically converted into a Vector2 in the direction of swing.</param>
/// <param name="damagemod">The modifier from the source projectile's damage for this projectile</param>
/// <param name="amount">The amount of projectiles for the sword to shoot. If set, it will space out those projectiles evenly. If unset, will force a shot.</param>
/// <param name="negate"></param>
/// <returns></returns>
public void shootCheck(int type = 0, float velocity = 1, float damagemod = 1, int amount = 0, int negate = 0, int ai0 = 0)
{
if (negate == 0)
{
negate = Projectile.spriteDirection;
}
if (amount == 0)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0);
return;
}
amount += 1;
if (timer % (swingTime / amount) == 0 && timer > 0 && timer < swingTime - swingTime / amount / 2)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0);
}
}
#endregion
}
}
+7
View File
@@ -19,6 +19,7 @@ using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
@@ -282,6 +283,8 @@ namespace CalamityMod.Projectiles
/// </summary>
public float UpdatePriority = 0f;
public int BloodstoneOrbValue = 0;
#region On Spawn
public override void OnSpawn(Projectile projectile, IEntitySource source)
@@ -4222,6 +4225,10 @@ namespace CalamityMod.Projectiles
#region On Hit NPC
public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone)
{
if (BloodstoneOrbValue > 0)
{
Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType<BloodstoneHealOrb>(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI);
}
// Hyperius Overflow
if (projectile.type != ProjectileType<HyperiusBulletProj>() && projectile.type != ProjectileType<HyperiusSplit>() && projectile.type != ProjectileType<HyperiusDamage>() && projectile.type != ProjectileType<HyperiusBleed>() && target.Calamity().hyperiusMarked)
{
+131
View File
@@ -0,0 +1,131 @@
using System;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Healing
{
public class BloodstoneHealOrb : ModProjectile, ILocalizedModType //Modified copy from SanguineHealOrb
{
public new string LocalizationCategory => "Projectiles.Healing";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public int target = -1;
public ref int heal => ref Projectile.damage;
public int spawnCooldown = 60; //how many frames must pass before it can be picked up
public override void SetDefaults()
{
Projectile.width = 8;
Projectile.height = 8;
Projectile.ignoreWater = true;
Projectile.alpha = 255;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 60 * 5 * Projectile.MaxUpdates;
spawnCooldown *= Projectile.MaxUpdates;
}
public override void AI()
{
float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi);
if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death
{
particleSize *= Projectile.timeLeft / 60f;
}
particleSize *= 8f;
Particle beam3 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f);
GeneralParticleHandler.SpawnParticle(beam3);
if (false && Main.rand.NextBool(8))
{
Particle beam4 = new CustomSpark(Projectile.Center + Projectile.Size / 2f, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f);
GeneralParticleHandler.SpawnParticle(beam4);
}
Projectile.scale = MathHelper.Lerp(1, 1, 0.65f);
float maxDistance = 200f;
if (spawnCooldown > 0)
{
PassiveBehavior();
spawnCooldown--;
return;
}
if (target < 0)
{
PassiveBehavior();
if (Projectile.FinalExtraUpdate()) for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
{
Player player = Main.player[playerIndex];
if (player.lifeMagnet)
maxDistance *= 1.5f; //Heartreach gives 50% more range
float targetDist = Vector2.Distance(player.Center, Projectile.Center);
if (targetDist < maxDistance)
{
maxDistance = targetDist;
target = playerIndex;
}
}
}
else HealHome();
}
public void PassiveBehavior()
{
Projectile.velocity *= 0.99f;
}
public void HealHome()
{
Player player = Main.player[target];
Vector2 playerVector = player.Center - Projectile.Center;
float playerDist = playerVector.Length();
if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y)
{
Heal(player, heal);
Projectile.Kill();
}
Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 5)) / 6f; //Move towards player. Range is determined in the AI();
}
public static void Heal(Player player, int PotionTime)
{
var cplayer = player.Calamity();
if (player.potionDelay > 0)
{
player.potionDelay -= PotionTime;
if (player.potionDelay < 0)
player.potionDelay = 0;
if (player.HasBuff(BuffID.PotionSickness))
{
for (var i = 0; i < player.buffType.Length; i++)
{
if (player.buffType[i] == BuffID.PotionSickness)
{
player.buffTime[i] = player.potionDelay;
}
}
}
}
else
{
player.lifeRegenTime += 3*PotionTime; //if Potion Sickness is full, each orb speeds up natural regen
}
Particle ring = new CustomPulse(player.Center, Vector2.Zero, new Color(255, 32, 32)*0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, 0, 0.01f, 0.05f, 20);
GeneralParticleHandler.SpawnParticle(ring);
}
public override bool PreDraw(ref Color lightColor)
{
return false;
}
}
}
+105 -37
View File
@@ -2,7 +2,11 @@
using CalamityMod.Balancing;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Healing;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -13,10 +17,8 @@ namespace CalamityMod.Projectiles.Magic
public class SanguineFlareProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
private int x;
private double speed = 10;
private float startSpeedY = 0f;
public bool beingChanneled = true;
public float dmgMult = 1;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 4;
@@ -25,48 +27,74 @@ namespace CalamityMod.Projectiles.Magic
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.width = 30;
Projectile.height = 30;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.DamageType = DamageClass.Magic;
Projectile.extraUpdates = 19;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 1f, 0f, 0f);
if (Projectile.localAI[0] == 0f)
var player = Main.player[Projectile.owner];
if (beingChanneled && player.channel)
{
Projectile.velocity.X = Projectile.velocity.X + (Main.player[Projectile.owner].velocity.X * 0.5f);
startSpeedY = Projectile.velocity.Y + (Main.player[Projectile.owner].velocity.Y * 0.5f);
Projectile.velocity.Y = startSpeedY;
}
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] >= 180f)
Projectile.velocity = Vector2.Zero;
Projectile.timeLeft = 300 * Projectile.MaxUpdates;
if (Projectile.FinalExtraUpdate())
{
player.itemTime = 15;
player.SetItemAnimation(15);
var dir = player.Center.DirectionTo(player.ClampedMouseWorld()) * 64;
player.direction = dir.X >= 0 ? 1 : -1;
Projectile.direction = player.direction;
player.itemRotation = (dir * player.direction).ToRotation();
Projectile.Center = player.Center + player.Center.DirectionTo(player.ClampedMouseWorld()) * 64;
dmgMult *= 1.009f;
if (dmgMult >= 5f)
{
dmgMult = 5f;
player.channel = false;
}
}
} else
{
x++;
speed += 0.1;
Projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4));
}
Projectile.rotation += Projectile.velocity.Y * 0.02f;
Projectile.alpha -= 5;
if (Projectile.alpha < 30)
{
Projectile.alpha = 30;
if (beingChanneled)
{
Projectile.damage = (int)(Projectile.damage * dmgMult);
Projectile.velocity = player.MountedCenter.DirectionTo(player.ClampedMouseWorld())*4;
Projectile.extraUpdates = 19;
beingChanneled = false;
}
float particleSize = (dmgMult * 5 + 5)/2f;
Particle beam3 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.1f, "CalamityMod/Particles/PearlParticleGlow", false, 10, 0.05f * particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f);
GeneralParticleHandler.SpawnParticle(beam3);
if (Main.rand.NextBool(8))
{
Particle beam4 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/WaterFoam", false, 5, 0.01f * particleSize, Color.Red, new Vector2(1f, 1), true, false, Main.rand.NextFloat(-10, 10), false, false, 0f);
GeneralParticleHandler.SpawnParticle(beam4);
}
}
}
public override Color? GetAlpha(Color lightColor)
public override bool? CanDamage()
{
return new Color(200, 60, 60, Projectile.alpha);
return !beingChanneled;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
SoundStyle hitSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath");
SoundEngine.PlaySound(hitSound with { Volume = 0.5f }, Projectile.Center);
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 10;
@@ -95,23 +123,63 @@ namespace CalamityMod.Projectiles.Magic
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 60);
int heal = (int)Math.Round(hit.Damage * 0.025);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5)
target.AddBuff(ModContent.BuffType<Laceration>(), 360);
if (beingChanneled || Projectile.penetrate == -1)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange);
var player = Main.player[Projectile.owner];
float orbCount = MathHelper.Lerp(0, 20, (dmgMult-1) / 4f);
for (var i = 0; i < orbCount; i++)
{
Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType<BloodstoneHealOrb>(), 20, 0f, player.whoAmI);
}
if (dmgMult > 1)
{
Projectile.position = Projectile.Center;
Projectile.Size *= dmgMult * 1.5f;
Projectile.Center = Projectile.position;
Projectile.penetrate = -1;
Projectile.extraUpdates = 0;
Projectile.timeLeft = 2;
Projectile.velocity *= 0;
Projectile.damage /= 2;
Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed*0.75f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*dmgMult/5f, 0.87f * dmgMult / 5f, (int)(40 * 0.38f), false);
GeneralParticleHandler.SpawnParticle(bloodsplosion);
Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32)*0.5f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * dmgMult / 5f, 0.155f * dmgMult / 5f, 40);
GeneralParticleHandler.SpawnParticle(bloodsplosion2);
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<Laceration>(), 60);
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
if (beingChanneled)
{
Texture2D lightTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
for (int i = 0; i < 1; i++)
{
//Photoviscerator drawcode, edited slightly
Color color = Color.DarkRed * (dmgMult/5f);
color.A = 0;
Vector2 drawPosition = Projectile.oldPos[i]+Projectile.Size /2f + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right.
Color outerColor = color;
Color innerColor = color * 0.5f;
float intensity = 0.9f + 0.15f * (float)Math.Cos(dmgMult * MathHelper.TwoPi);
intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length);
if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death
{
intensity *= Projectile.timeLeft / 60f;
}
// Become smaller the futher along the old positions we are.
Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity;
Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f;
outerColor *= intensity;
innerColor *= intensity;
Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 1.25f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 1.25f, SpriteEffects.None, 0);
}
}
return false;
}
}
+7 -8
View File
@@ -10,6 +10,7 @@ using Terraria.Audio;
using CalamityMod.Balancing;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Healing;
namespace CalamityMod.Projectiles.Magic
{
@@ -93,15 +94,13 @@ namespace CalamityMod.Projectiles.Magic
dust.noGravity = true;
}
}
if (Projectile.ai[2] < 1){
for (int i = 0; i < 2; i++) {
Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.5f) * Main.rand.NextFloat(3, 5), ModContent.ProjectileType<BloodstoneHealOrb>(), 5, 0f, Projectile.owner);
}
Projectile.ai[2]++;
}
int heal = (int)Math.Round(hit.Damage * 0.05);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange);
}
public override void AI()
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Healing;
using Terraria.Audio;
using Terraria.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Particles;
namespace CalamityMod.Projectiles.Melee
{
public class MutilatorSwordProj : BaseSwordHoldoutProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override int swingWidth => 180;
public override string Texture => ModContent.GetModItem(BaseItem.type).Texture;
public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType<TheMutilator>()).Item;
public override int AfterImageLength => 5;
public override int OffsetDistance => 60;
public override bool drawSwordTrail => true;
public override Color[] trailColors => [Color.Red, Color.DarkRed, Color.Gold];
public override float trailOffset => 20;
public override float trailWidth(float completion)
{
return base.trailWidth(completion);
}
public override int trailLength => 5;
public override int StartupTime { get; set; }
public override int CooldownTime { get; set; }
public bool hasGivenBlood = false;
public override void Spawn(IEntitySource source)
{
var player = Main.player[Projectile.owner];
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
StartupTime = 15;
CooldownTime = 5;
swingTime -= StartupTime + CooldownTime;
modplayer.swingNum = 0;
}
public override void AdditionalAI()
{
if (inStartup)
{
Projectile.scale = baseScale * MathHelper.Lerp(0.5f, 1, 1 - MathF.Pow(1 - StartupCompletion, 2f));
} else if (inCooldown)
{
Projectile.scale = baseScale * MathHelper.Lerp(1,0.5f,MathF.Pow(CooldownCompletion,2));
} else
Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, SwingCompletion), MathHelper.SmoothStep(2, 1, SwingCompletion));
}
public override float SwingFunction()
{
if (inStartup)
return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * 0.5f, -swingWidth * 0.75f, 1-MathF.Pow(1-StartupCompletion,2f)));
if (inCooldown)
return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.25f, swingWidth * 0.33f, CooldownCompletion));
return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth *0.75f, swingWidth *0.25f, SwingCompletion));
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 60);
var player = Main.player[Projectile.owner];
var item = player.HeldItem;
if (item.type != ModContent.ItemType<TheMutilator>())
{
Projectile.Kill();
return;
}
var modItem = item.ModItem as TheMutilator;
if (!hasGivenBlood)
{
modItem.Charge++;
hasGivenBlood = true;
if (modItem.Charge > TheMutilator.MaximumCharge)
{
modItem.Charge = 0;
int orbAmount = 30;
if (orbAmount > 0)
{
float spreadAmount = MathHelper.ToRadians(360);
for (var i = 0; i < orbAmount; i++)
{
Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType<BloodstoneHealOrb>(), 22, 0f, player.whoAmI);
}
Particle bloodsplosion2 = new CustomPulse(target.Center, Vector2.Zero, new Color(255, 32, 32) * 0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, 40);
GeneralParticleHandler.SpawnParticle(bloodsplosion2);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, player.Center);
}
}
modItem.DecayTimer = 180;
}
}
}
}
+3 -12
View File
@@ -7,6 +7,7 @@ using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Projectiles.Healing;
namespace CalamityMod.Projectiles.Ranged
{
@@ -195,19 +196,9 @@ namespace CalamityMod.Projectiles.Ranged
{
if (Projectile.Hitbox.Intersects(player.Hitbox))
{
if (!Main.player[Projectile.owner].moonLeech)
if (improvedHeal)
{
int bonusHeal = Main.rand.NextBool(3) ? 5 : 3;
int heal = improvedHeal ? bonusHeal : 2;
if (Main.LocalPlayer.lifeSteal <= 0f)
{
Projectile.Kill();
return;
}
Main.LocalPlayer.lifeSteal -= heal;
player.HealPlayer(heal);
BloodstoneHealOrb.Heal(player, 8);
}
Projectile.Kill();
+19 -6
View File
@@ -18,6 +18,9 @@ namespace CalamityMod.Projectiles.Ranged
{
public new string LocalizationCategory => "Projectiles.Ranged";
//Used by Arterial Assault
public bool DisableEffects = false;
public override string Texture => "CalamityMod/Items/Ammo/BloodfireArrow";
public override void SetStaticDefaults()
@@ -47,14 +50,22 @@ namespace CalamityMod.Projectiles.Ranged
if (Projectile.localAI[0] == 0)
{
Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost
player.statLife -= 1;
if (player.statLife <= 0)
if (DisableEffects)
{
PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name));
player.KillMe(pdr, 1000.0, 0, false);
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9;
} else
{
Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost
player.statLife -= 1;
if (player.statLife <= 0)
{
PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name));
player.KillMe(pdr, 1000.0, 0, false);
}
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9;
}
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9;
}
Player Owner = Main.player[Projectile.owner];
@@ -101,6 +112,8 @@ namespace CalamityMod.Projectiles.Ranged
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (DisableEffects)
return;
Player player = Main.player[Projectile.owner];
player.lifeRegenTime += 2;
-77
View File
@@ -1,77 +0,0 @@
using CalamityMod.Balancing;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ClaretCannonProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 10;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.alpha = 255;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.DamageType = DamageClass.Ranged;
Projectile.extraUpdates = 1;
Projectile.aiStyle = ProjAIStyleID.Arrow;
AIType = ProjectileID.Bullet;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
return true;
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 2; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 120);
int heal = (int)Math.Round(hit.Damage * 0.02);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
return false;
}
}
}
+14 -8
View File
@@ -6,6 +6,10 @@ using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Healing;
using System.Reflection.Metadata;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Rogue
{
public class BloodsoakedCrashax : ModProjectile, ILocalizedModType
@@ -109,7 +113,7 @@ namespace CalamityMod.Projectiles.Rogue
int projID = ModContent.ProjectileType<Blood>();
int bloodDamage = Projectile.damage;
float bloodKB = 1f;
int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f);
int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi)*4f, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f);
if (stealth.WithinBounds(Main.maxProjectiles))
{
Main.projectile[stealth].DamageType = RogueDamageClass.Instance;
@@ -117,14 +121,16 @@ namespace CalamityMod.Projectiles.Rogue
}
}
int heal = (int)Math.Round(damage * 0.01);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
float orbAmount = Projectile.Calamity().stealthStrike ? 3 : Projectile.penetrate % 2;
if (orbAmount > 0)
{
float spreadAmount = MathHelper.ToRadians(360);
for (var i = 0; i < orbAmount; i++)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType<BloodstoneHealOrb>(), 20, 0f, Projectile.owner);
if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange);
}
}
}
public override bool PreDraw(ref Color lightColor) //afterimages
+1 -9
View File
@@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 6;
Projectile.DamageType = DamageClass.Summon;
Projectile.Calamity().BloodstoneOrbValue = 20; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal.
}
public override void AI()
@@ -49,15 +50,6 @@ namespace CalamityMod.Projectiles.Summon
blood.velocity = Main.rand.NextVector2Circular(1f, 2f);
blood.noGravity = true;
}
int heal = (int)Math.Round(hit.Damage * 0.01);
if (heal > BalancingConstants.LifeStealCap)
heal = BalancingConstants.LifeStealCap;
if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5)
return;
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange);
}
}
}
+81
View File
@@ -0,0 +1,81 @@
using CalamityMod.Balancing;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Weapons.Typeless;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Particles;
namespace CalamityMod.Projectiles.Typeless
{
public class ClaretCannonProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.alpha = 0;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.DamageType = AverageDamageClass.Instance;
Projectile.extraUpdates = 1;
Projectile.aiStyle = 0;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
return true;
}
public override void OnKill(int timeLeft)
{
if (Projectile.penetrate != -1)
return;
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/PerfLargeDeath") { Volume = 0.5f }, Projectile.Center);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit") { Volume = 0.5f }, Projectile.Center);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), ClaretCannon.ClaretCooldownMax);
target.AddBuff(BuffID.BetsysCurse, ClaretCannon.ClaretCooldownMax*2);
if (Projectile.penetrate == -1)
return;
var player = Main.player[Projectile.owner];
float orbCount = 20;
for (var i = 0; i < orbCount; i++)
{
Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(1) * Main.rand.NextFloat(2.75f, 5.25f), ModContent.ProjectileType<BloodstoneHealOrb>(), 20, 0f, player.whoAmI);
}
Projectile.position = Projectile.Center;
Projectile.Size = new Vector2(352);
Projectile.Center = Projectile.position;
Projectile.penetrate = -1;
Projectile.extraUpdates = 0;
Projectile.timeLeft = 2;
Projectile.velocity *= 0;
Projectile.damage /= 2;
float particleScale = 8f;
Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f*particleScale/5f, 0.87f * particleScale / 5f, (int)(40 * 0.38f), false);
GeneralParticleHandler.SpawnParticle(bloodsplosion);
Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f * particleScale / 5f, 0.155f * particleScale / 5f, 40);
GeneralParticleHandler.SpawnParticle(bloodsplosion2);
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.