Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into 1.4.4
This commit is contained in:
commit
d5978a8b19
20 files changed
+232
-174
No files matched your search
@@ -2647,7 +2647,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<RottenBrain>()));
|
||||
int effectStrength = amalgam ? 3 : aBrain ? 2 : 1;
|
||||
int effectDamage = amalgam ? 400 : aBrain ? 50 : 15;
|
||||
int effectDamage = amalgam ? 400 : aBrain ? 35 : 15;
|
||||
effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage);
|
||||
|
||||
Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f;
|
||||
|
||||
@@ -1609,7 +1609,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
float insanityValue = ((p.ai[1] % 10) + 1);
|
||||
if (p.ai[0] == layer)
|
||||
p.ai[2] = insanityValue / CalamityUtils.CountProjectiles(ModContent.ProjectileType<TransformerBlob>()) * (angleMax) - (angleMax) / 2f;
|
||||
p.ai[2] = insanityValue / CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType<TransformerBlob>(), Player.whoAmI) * (angleMax) - (angleMax) / 2f;
|
||||
|
||||
p.netUpdate = true;
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
float insanityValue = ((p.ai[1] % 10) + 1);
|
||||
if (p.ai[0] == layer)
|
||||
p.ai[2] = insanityValue / CalamityUtils.CountProjectiles(ModContent.ProjectileType<TransformerBlob>()) * (angleMax) - (angleMax) / 2f;
|
||||
p.ai[2] = insanityValue / CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType<TransformerBlob>(), Player.whoAmI) * (angleMax) - (angleMax) / 2f;
|
||||
|
||||
p.netUpdate = true;
|
||||
index++;
|
||||
@@ -3395,7 +3395,10 @@ namespace CalamityMod.CalPlayer
|
||||
continue;
|
||||
float distance = (npc.Center - Player.Center).Length();
|
||||
if (distance < GiantPearl.AuraRadius)
|
||||
{
|
||||
npc.AddBuff(ModContent.BuffType<PearlAura>(), 20, false);
|
||||
npc.Calamity().pearlAuraOwner = Player.whoAmI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public const float RaiderBonus = 10f;
|
||||
public const int RaiderCooldown = 5;
|
||||
public const int RaiderCooldown = 10;
|
||||
public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit");
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -34,8 +34,7 @@ namespace CalamityMod.Items.Armor.TitanHeart
|
||||
public override void UpdateEquip(Player player)
|
||||
{
|
||||
player.Calamity().titanHeartMantle = true;
|
||||
// 15% attack speed penalty
|
||||
player.GetAttackSpeed<ThrowingDamageClass>() -= 0.15f;
|
||||
player.GetDamage<ThrowingDamageClass>() += 0.05f;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.TitanHeart
|
||||
player.setBonus = this.GetLocalizedValue("SetBonus");
|
||||
var modPlayer = player.Calamity();
|
||||
modPlayer.titanHeartSet = true;
|
||||
player.GetDamage<ThrowingDamageClass>() += 0.15f;
|
||||
player.GetDamage<ThrowingDamageClass>() += 0.10f;
|
||||
modPlayer.rogueStealthMax += 1f;
|
||||
modPlayer.wearingRogueArmor = true;
|
||||
player.noKnockback = true;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
int type = ModContent.ProjectileType<IceBombFriendly>();
|
||||
if (CalamityUtils.CountProjectiles(type) < 16)
|
||||
if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) < 16)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (CalamityUtils.CountProjectiles(ModContent.ProjectileType<LightningThing>()) < 3 &&
|
||||
if (CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType<LightningThing>(), player.whoAmI) < 3 &&
|
||||
player.statLife <= player.statLifeMax2 * 0.5f &&
|
||||
Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -45,13 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
}
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
public override bool MeleePrefix() => true;
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
if (player.Calamity().mouseRight)
|
||||
{
|
||||
Projectile.NewProjectile(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5);
|
||||
}
|
||||
|
||||
@@ -48,19 +48,19 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
}
|
||||
}
|
||||
float angleMax = MathHelper.ToRadians(360f);
|
||||
if (CalamityUtils.CountProjectiles(type) == 1)
|
||||
if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) == 1)
|
||||
angleMax = 0f;
|
||||
float index = 1f;
|
||||
if (player.ownedProjectileCounts[Item.shoot] > 30)
|
||||
{
|
||||
angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f);
|
||||
}
|
||||
angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function
|
||||
angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuitive than using a min function
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
if (p.type == type && p.owner == player.whoAmI)
|
||||
{
|
||||
p.ai[1] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f;
|
||||
p.ai[1] = (index / CalamityUtils.CountOwnedProjectiles(type, player.whoAmI)) * angleMax - angleMax / 2f;
|
||||
p.netUpdate = true;
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ TitanHeartBoots: {
|
||||
|
||||
TitanHeartMantle: {
|
||||
DisplayName: Titan Heart Mantle
|
||||
Tooltip: 5% boosted rogue knockback but 15% lowered rogue attack speed
|
||||
Tooltip: 5% boosted rogue damage and knockback
|
||||
}
|
||||
|
||||
TitanHeartMask: {
|
||||
@@ -534,7 +534,7 @@ TitanHeartMask: {
|
||||
'''
|
||||
SetBonus:
|
||||
'''
|
||||
15% increased rogue damage and knockback
|
||||
10% increased rogue damage and 20% increased rogue knockback
|
||||
+100 maximum stealth
|
||||
Stealth strikes deal double knockback and cause an astral explosion
|
||||
Grants immunity to knockback
|
||||
|
||||
@@ -115,7 +115,9 @@ namespace CalamityMod.NPCs.Abyss
|
||||
NPC.soundDelay = 360;
|
||||
if (hasBeenHit)
|
||||
{
|
||||
SoundEngine.PlaySound(EnragedRoarSound, NPC.Center);
|
||||
// Roar becomes lower pitch when crippled
|
||||
float pitch = phase3 ? -0.4f : 0;
|
||||
SoundEngine.PlaySound(EnragedRoarSound with { Pitch = pitch }, NPC.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -302,6 +302,11 @@ namespace CalamityMod.NPCs
|
||||
/// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC.
|
||||
/// </summary>
|
||||
public int pearlAuraCounter = 0;
|
||||
/// <summary>
|
||||
/// When an NPC is inflicted with Pearl Aura, this variable is set to index of the player who inflicted it.<br/>
|
||||
/// Used for properly counting pearl shard amount and for giving pearl shards an owner.
|
||||
/// </summary>
|
||||
public int pearlAuraOwner = -1;
|
||||
public int bBlood = 0;
|
||||
public int brainRot = 0;
|
||||
public int heavybleeding = 0;
|
||||
@@ -5815,20 +5820,24 @@ namespace CalamityMod.NPCs
|
||||
SoundEngine.PlaySound(SoundID.Item49, npc.Center);
|
||||
|
||||
// Prevent things from getting too crazy
|
||||
if (CalamityUtils.CountProjectiles(ProjectileType<PearlAuraShard>()) <= 3)
|
||||
// CIT 8MAR2025: It is assumed that pearlAuraOwner is always set to something other than -1 when this code is run.
|
||||
if (CalamityUtils.CountOwnedProjectiles(ProjectileType<PearlAuraShard>(), pearlAuraOwner) <= 3)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 shardPos = npc.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-500f, -650f));
|
||||
Vector2 shardVel = Vector2.Normalize(npc.Center - shardPos).RotatedByRandom(MathHelper.Pi / 55f) * 20f;
|
||||
int damage = 20;
|
||||
Projectile.NewProjectile(npc.GetSource_FromThis(), shardPos, shardVel, ProjectileType<PearlAuraShard>(), damage, 5f, Main.myPlayer);
|
||||
Projectile.NewProjectile(npc.GetSource_FromThis(), shardPos, shardVel, ProjectileType<PearlAuraShard>(), damage, 5f, pearlAuraOwner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pearlAuraCounter = 0;
|
||||
pearlAuraOwner = -1;
|
||||
}
|
||||
|
||||
if (demonSwordImpales > 0 && npc.CanBeMoved(true))
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
// Release bursts of homing dark magic bolts periodically. The amount of bolts that can be summoned has a hard limit.
|
||||
// This is where most of the damage comes from. Be careful when messing with this.
|
||||
if ((int)Time % 30 == 0 && CalamityUtils.CountProjectiles(ModContent.ProjectileType<EternityHoming>()) < Eternity.MaxHomers)
|
||||
if ((int)Time % 30 == 0 && CalamityUtils.CountOwnedProjectiles(ModContent.ProjectileType<EternityHoming>(), Projectile.owner) < Eternity.MaxHomers)
|
||||
{
|
||||
int homerCount = 6;
|
||||
int damage = (int)player.GetTotalDamage<MagicDamageClass>().ApplyTo(0.8f * Eternity.BaseDamage);
|
||||
|
||||
@@ -88,68 +88,79 @@ namespace CalamityMod.Projectiles.Melee
|
||||
*/
|
||||
if (hasHit)
|
||||
{
|
||||
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0)
|
||||
Projectile.numHits -= 1;
|
||||
int numHits = 0;
|
||||
foreach (var target in Main.ActiveNPCs)
|
||||
{
|
||||
Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset);
|
||||
Rectangle hitbox = new((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y);
|
||||
if (!hitbox.Intersects(target.getRect()))
|
||||
continue;
|
||||
|
||||
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && numHits > 0)
|
||||
numHits -= 1;
|
||||
|
||||
SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center);
|
||||
SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash");
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center);
|
||||
if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType<PrimordialWyrmHead>() && Main.rand.NextBool(5))
|
||||
{
|
||||
SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8);
|
||||
SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center);
|
||||
}
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 6.5f;
|
||||
}
|
||||
|
||||
int heal = (int)MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20);
|
||||
if (Projectile.numHits < 10)
|
||||
{
|
||||
Owner.HealPlayer(heal);
|
||||
}
|
||||
|
||||
if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType<PrimordialWyrmHead>() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
|
||||
{
|
||||
if (target.type == ModContent.NPCType<PrimordialWyrmHead>())
|
||||
SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center);
|
||||
SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash");
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center);
|
||||
if (Main.zenithWorld && numHits == 0 && target.type != ModContent.NPCType<PrimordialWyrmHead>() && Main.rand.NextBool(5))
|
||||
{
|
||||
CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop"));
|
||||
SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped");
|
||||
SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center);
|
||||
SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8);
|
||||
SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center);
|
||||
}
|
||||
if (numHits == 0)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 6.5f;
|
||||
}
|
||||
|
||||
bool rightClicked = Owner.Calamity().mouseRight;
|
||||
int heal = (int)MathHelper.Clamp(20 - numHits * 12, 1, 20);
|
||||
if (numHits < 10)
|
||||
{
|
||||
Owner.HealPlayer(heal);
|
||||
}
|
||||
|
||||
// Make all hit enemies able to hit tiles, so you can dunk them
|
||||
target.noTileCollide = false;
|
||||
if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType<PrimordialWyrmHead>() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
|
||||
{
|
||||
if (target.type == ModContent.NPCType<PrimordialWyrmHead>())
|
||||
{
|
||||
CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop"));
|
||||
SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped");
|
||||
SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center);
|
||||
}
|
||||
|
||||
// Launch the suckers
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1);
|
||||
target.MoveNPC(launchVel, launchPower * 0.5f, true);
|
||||
bool rightClicked = Owner.Calamity().mouseRight;
|
||||
|
||||
// Remove knockback resist, just like it used to
|
||||
target.knockBackResist = 1;
|
||||
// Make all hit enemies able to hit tiles, so you can dunk them
|
||||
target.noTileCollide = false;
|
||||
|
||||
// Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone)
|
||||
target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true);
|
||||
}
|
||||
// Launch the suckers
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1);
|
||||
target.MoveNPC(launchVel, launchPower * 0.5f, true);
|
||||
|
||||
if (Projectile.numHits < 3)
|
||||
{
|
||||
Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
// Remove knockback resist, just like it used to
|
||||
target.knockBackResist = 1;
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
|
||||
{
|
||||
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType<VoidDust>(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f));
|
||||
dust.noGravity = true;
|
||||
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
|
||||
// Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone)
|
||||
target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true);
|
||||
}
|
||||
|
||||
if (numHits < 3)
|
||||
{
|
||||
Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + numHits * 5), false, (int)(16 - numHits * 3), 0.6f - numHits * 0.15f, Color.DodgerBlue, 0.45f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(10 - numHits * 2, 2, 10); i++)
|
||||
{
|
||||
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType<VoidDust>(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f));
|
||||
dust.noGravity = true;
|
||||
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
|
||||
}
|
||||
|
||||
numHits++;
|
||||
}
|
||||
|
||||
hasHit = false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
@@ -8,7 +9,6 @@ using ReLogic.Content;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -45,6 +45,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public bool playSwingSound = true;
|
||||
|
||||
public SlotId AudSlot;
|
||||
|
||||
private bool hasSpawned;
|
||||
private bool hasHit;
|
||||
private int damageDone;
|
||||
private int targetId;
|
||||
private NPC target => Main.npc[targetId];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
base.SetDefaults();
|
||||
@@ -52,29 +59,115 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
CanHit = false;
|
||||
Projectile.knockBack = 0;
|
||||
Projectile.scale = 1;
|
||||
Projectile.ai[1] = -1;
|
||||
base.OnSpawn(source);
|
||||
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles
|
||||
mousePos = Owner.Calamity().mouseWorld;
|
||||
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
||||
useAnim = Owner.itemAnimationMax;
|
||||
storedUseAnim = useAnim;
|
||||
|
||||
chargeTimerMax = useAnim * 5; // Max charge time is set here
|
||||
|
||||
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
||||
else Owner.direction = 1;
|
||||
|
||||
FlipAsSword = Owner.direction == -1 ? true : false;
|
||||
}
|
||||
public override void UseStyle()
|
||||
{
|
||||
if (!hasSpawned)
|
||||
{
|
||||
CanHit = false;
|
||||
Projectile.knockBack = 0;
|
||||
Projectile.scale = 1;
|
||||
Projectile.ai[1] = -1;
|
||||
Projectile.timeLeft = Owner.HeldItem.useAnimation + 1;
|
||||
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles
|
||||
mousePos = Owner.Calamity().mouseWorld;
|
||||
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
||||
useAnim = Owner.itemAnimationMax;
|
||||
storedUseAnim = useAnim;
|
||||
|
||||
chargeTimerMax = useAnim * 5; // Max charge time is set here
|
||||
|
||||
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
||||
else Owner.direction = 1;
|
||||
|
||||
FlipAsSword = Owner.direction == -1 ? true : false;
|
||||
hasSpawned = true;
|
||||
}
|
||||
|
||||
if (hasHit)
|
||||
{
|
||||
int numHits = 0;
|
||||
foreach (var target in Main.ActiveNPCs)
|
||||
{
|
||||
Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset);
|
||||
Rectangle hitbox = new((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y);
|
||||
if (!hitbox.Intersects(target.getRect()))
|
||||
continue;
|
||||
|
||||
// If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits)
|
||||
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0)
|
||||
{
|
||||
pierceReduction -= 1;
|
||||
}
|
||||
|
||||
if (!chargedSwing)
|
||||
{
|
||||
if (numHits == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(Hellkite.HitSoundSmall with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center);
|
||||
Owner.Calamity().GeneralScreenShakePower = 4.5f;
|
||||
}
|
||||
for (int i = 0; i < MathHelper.Clamp(8 - numHits * 2, 2, 8); i++)
|
||||
{
|
||||
Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numHits == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center);
|
||||
Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti;
|
||||
bool photos = CalamityClientConfig.Instance.Photosensitivity;
|
||||
|
||||
if (!photos)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * (photos ? 1f : GFBMulti), Color.OrangeRed, new Vector2(3, 0.8f), true);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1));
|
||||
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * GFBMulti;
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true);
|
||||
numHits++;
|
||||
}
|
||||
|
||||
hasHit = false;
|
||||
}
|
||||
|
||||
AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 0.7f) : storedUseAnim);
|
||||
|
||||
if (Owner.Calamity().mouseRight)
|
||||
@@ -218,7 +311,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
|
||||
else Owner.direction = 1;
|
||||
}
|
||||
|
||||
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f);
|
||||
|
||||
if (AnimationProgress < (useAnim / 1.5f))
|
||||
@@ -332,7 +425,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,73 +439,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
// If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits)
|
||||
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0)
|
||||
{
|
||||
pierceReduction -= 1;
|
||||
}
|
||||
|
||||
if (!chargedSwing)
|
||||
{
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(Hellkite.HitSoundSmall with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center);
|
||||
Owner.Calamity().GeneralScreenShakePower = 4.5f;
|
||||
}
|
||||
for (int i = 0; i < MathHelper.Clamp(8 - Projectile.numHits * 2, 2, 8); i++)
|
||||
{
|
||||
Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center);
|
||||
Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti;
|
||||
bool photos = CalamityClientConfig.Instance.Photosensitivity;
|
||||
|
||||
if (!photos)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * (photos ? 1f : GFBMulti), Color.OrangeRed, new Vector2(3, 0.8f), true);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1));
|
||||
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * GFBMulti;
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true);
|
||||
targetId = target.whoAmI;
|
||||
this.damageDone = damageDone;
|
||||
Projectile.ForceNetUpdate();
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
@@ -462,8 +491,19 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override void ResetStyle()
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write7BitEncodedInt(targetId);
|
||||
writer.Write(damageDone);
|
||||
writer.Write(hasHit);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
targetId = reader.Read7BitEncodedInt();
|
||||
damageDone = reader.ReadInt32();
|
||||
hasHit = reader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
if (CalamityUtils.CountProjectiles(shootType) > 24)
|
||||
if (CalamityUtils.CountOwnedProjectiles(shootType, Projectile.owner) > 24)
|
||||
return;
|
||||
|
||||
int energyDamage = (int)(Projectile.damage * 0.5f);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Player player = Main.player[Projectile.owner];
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
if (CalamityUtils.CountProjectiles(Projectile.type) > 1)
|
||||
if (CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner) > 1)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
return;
|
||||
}
|
||||
|
||||
int totalHeads = CalamityUtils.CountProjectiles(Projectile.type);
|
||||
int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner);
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
DeltaPosition = DeltaPositionMoving = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads));
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public void PerformInitializationEffects()
|
||||
{
|
||||
int totalHeads = CalamityUtils.CountProjectiles(Projectile.type);
|
||||
int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner);
|
||||
CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads));
|
||||
Projectile.netUpdate = true;
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f;
|
||||
}
|
||||
|
||||
int totalHeads = CalamityUtils.CountProjectiles(Projectile.type);
|
||||
int totalHeads = CalamityUtils.CountOwnedProjectiles(Projectile.type, Projectile.owner);
|
||||
int moveRate = 40 + totalHeads * 4;
|
||||
|
||||
// Reset the ideal offset from time to time.
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CalamityMod
|
||||
}
|
||||
|
||||
public static int CountProjectiles(int projectileID) => Main.projectile.Count(proj => proj.type == projectileID && proj.active);
|
||||
public static int CountOwnedProjectiles(int projectileID, int ownerID) => Main.projectile.Count(proj => proj.active && proj.type == projectileID && proj.owner == ownerID);
|
||||
|
||||
public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer);
|
||||
|
||||
|
||||
Reference in new issue
Block a user