This commit is contained in:
mountaindrew10 committed 2022-02-09 05:07:57 -06:00
commit 0bd3d3646f
10 files changed
+211 -109

No files matched your search

+50 -5
View File
@@ -1,3 +1,6 @@
using CalamityMod.NPCs;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
@@ -5,10 +8,16 @@ namespace CalamityMod.Buffs.DamageOverTime
{
public class Shred : ModBuff
{
internal const int StackFalloffFrames = 320;
// 75 DPS (15x5) per stack may seem low, but it gets boosted by ranged stats and can supercrit.
internal static int BaseDamage = 15;
internal static int FramesPerDamageTick = 12;
public override void SetDefaults()
{
DisplayName.SetDefault("Shred");
Description.SetDefault("Blood");
Description.SetDefault("Someone built ten Tri-Tip Daggers...");
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
@@ -17,10 +26,46 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
if (npc.Calamity().pShred < npc.buffTime[buffIndex])
npc.Calamity().pShred = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
CalamityGlobalNPC cgn = npc.Calamity();
if (cgn.somaShredStacks <= 0)
{
cgn.somaShredStacks = 1;
cgn.somaShredFalloff = StackFalloffFrames;
}
else
{
++cgn.somaShredStacks;
}
// As soon as the debuff is applied to the NPC, subsume it into Calamity's tracking system
npc.DelBuff(buffIndex);
buffIndex--;
}
internal static void TickDebuff(NPC target, CalamityGlobalNPC cgn)
{
// Decrement the falloff counter every frame.
cgn.somaShredFalloff -= cgn.somaShredStacks;
if (cgn.somaShredFalloff <= 0)
{
cgn.somaShredFalloff += StackFalloffFrames;
--cgn.somaShredStacks;
}
// If a valid player applied this debuff, then let it deal damage.
if (cgn.somaShredApplicator >= 0 && cgn.somaShredApplicator < Main.maxPlayers && Main.myPlayer == cgn.somaShredApplicator)
{
Player applicator = Main.player[cgn.somaShredApplicator];
// Only deal damage once every several frames.
if (applicator.miscCounter % FramesPerDamageTick == 0)
{
int dmg = (int)(BaseDamage * cgn.somaShredStacks * applicator.rangedDamage);
Projectile tick = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), dmg, 0f, applicator.whoAmI, target.whoAmI);
tick.ranged = true; // Uncommon for DirectStrikes, but it needs to be able to crit.
tick.Calamity().canSupercrit = true;
}
}
}
}
}
+20 -10
View File
@@ -2,13 +2,16 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
@@ -19,12 +22,10 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.VanillaArmorChanges;
namespace CalamityMod.CalPlayer
{
public partial class CalamityPlayer : ModPlayer
public partial class CalamityPlayer : ModPlayer
{
#region On Hit Anything
public override void OnHitAnything(float x, float y, Entity victim)
@@ -175,6 +176,7 @@ namespace CalamityMod.CalPlayer
{
if (player.whoAmI != Main.myPlayer)
return;
CalamityGlobalNPC cgn = target.Calamity();
// Handle on-hit melee effects for the gem tech armor set.
if (proj.melee)
@@ -187,11 +189,9 @@ namespace CalamityMod.CalPlayer
if (witheringWeaponEnchant)
witheringDamageDone += (int)(damage * (crit ? 2D : 1D));
target.Calamity().IncreasedHeatEffects = fireball || cinnamonRoll;
target.Calamity().IncreasedColdEffects = eskimoSet;
target.Calamity().IncreasedSicknessAndWaterEffects = evergreenGin;
cgn.IncreasedHeatEffects = fireball || cinnamonRoll;
cgn.IncreasedColdEffects = eskimoSet;
cgn.IncreasedSicknessAndWaterEffects = evergreenGin;
switch (proj.type)
{
@@ -337,6 +337,7 @@ namespace CalamityMod.CalPlayer
break;
}
// TODO -- This should be removed, why is this here?
if (ProjectileID.Sets.StardustDragon[proj.type])
target.immune[proj.owner] = 10;
@@ -348,9 +349,18 @@ namespace CalamityMod.CalPlayer
if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ItemType<RaidersGlory>())
target.AddBuff(BuffID.Midas, 300, false);
// All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile
CalamityGlobalProjectile cgp = proj.Calamity();
if (cgp.appliesSomaShred)
{
target.AddBuff(BuffType<Shred>(), 320);
// This information cannot be transferred through the buff, but is necessary to calculate damage
cgn.somaShredApplicator = player.whoAmI;
}
ProjLifesteal(target, proj, damage, crit);
ProjOnHit(proj, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue);
NPCDebuffs(target, proj.melee, proj.ranged, proj.magic, proj.IsSummon(), proj.Calamity().rogue, true);
NPCDebuffs(target, proj.melee, proj.ranged, proj.magic, proj.IsSummon(), cgp.rogue, true);
// Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies).
if (target.type == NPCID.TargetDummy || target.type == NPCType<SuperDummyNPC>())
+2 -2
View File
@@ -116,10 +116,10 @@ namespace CalamityMod.Items
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f);
if (item.type == ModContent.ItemType<CrystylCrusher>())
nameLine.overrideColor = new Color(129, 29, 149);
if (item.type == ModContent.ItemType<SomaPrime>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 255, 255), new Color(0xD1, 0xCC, 0x6F), 4f);
if (item.type == ModContent.ItemType<Svantechnical>())
nameLine.overrideColor = new Color(220, 20, 60);
if (item.type == ModContent.ItemType<SomaPrime>())
nameLine.overrideColor = new Color(254, 253, 235);
if (item.type == ModContent.ItemType<Contagion>())
nameLine.overrideColor = new Color(207, 17, 117);
if (item.type == ModContent.ItemType<TriactisTruePaladinianMageHammerofMightMelee>())
+28 -25
View File
@@ -1,5 +1,5 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
@@ -10,37 +10,43 @@ namespace CalamityMod.Items.Weapons.Ranged
{
public class SomaPrime : ModItem
{
private static readonly float XYInaccuracy = 0.32f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Soma Prime");
Tooltip.SetDefault("Converts musket balls into extremely powerful high velocity rounds that inflict a powerful bleed debuff");
Tooltip.SetDefault(@"This weapon can supercrit if its crit chance is over 100%
All bullets fired inflict Shred, a stacking bleed debuff
Shred deals 75 DPS per stack and scales with your ranged stats
Damage ticks of Shred can also critically strike or supercrit
Replaces standard bullets with High Velocity Bullets
80% chance to not consume ammo");
}
public override void SetDefaults()
{
item.damage = 200;
item.damage = 130;
item.ranged = true;
item.width = 94;
item.height = 34;
item.useTime = 2;
item.useAnimation = 2;
item.useTime = item.useAnimation = 5;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 2f;
item.UseSound = SoundID.Item40;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<SlashRound>();
item.shootSpeed = 30f;
item.shoot = ProjectileID.BulletHighVelocity;
item.shootSpeed = 9f;
item.useAmmo = AmmoID.Bullet;
item.value = CalamityGlobalItem.Rarity16BuyPrice;
item.Calamity().customRarity = CalamityRarity.HotPink;
item.Calamity().devItem = true;
item.Calamity().canFirePointBlankShots = true;
}
item.Calamity().canFirePointBlankShots = true;
}
// Terraria seems to really dislike high crit values in SetDefaults
public override void GetWeaponCrit(Player player, ref int crit) => crit += 40;
public override void GetWeaponCrit(Player player, ref int crit) => crit += 30;
public override Vector2? HoldoutOffset() => new Vector2(-25, 0);
@@ -57,24 +63,21 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
for (int i = 0; i < 2; i++)
{
float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f;
float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f;
if (type == ProjectileID.Bullet) {
type = ProjectileID.BulletHighVelocity;
damage += 4; // in 1.4, HVBs deal 11 damage and Musket Balls deal 7
}
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<SlashRound>(), damage, knockBack, player.whoAmI);
else
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
}
speedX += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy);
speedY += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy);
Vector2 vel = new Vector2(speedX, speedY);
Projectile shot = Projectile.NewProjectileDirect(position, vel, type, damage, knockBack, player.whoAmI);
CalamityGlobalProjectile cgp = shot.Calamity();
cgp.canSupercrit = true;
cgp.appliesSomaShred = true;
return false;
}
public override bool ConsumeAmmo(Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
return true;
}
public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.8f;
}
}
+88 -24
View File
@@ -203,7 +203,14 @@ namespace CalamityMod.NPCs
public int hFlames = 0;
public int pFlames = 0;
public int aCrunch = 0;
public int pShred = 0;
// Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage
// It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently
public int somaShredStacks = 0;
public int somaShredApplicator = -1;
// Reduced by the number of active stacks every frame. If it hits zero, one stack disappears.
public int somaShredFalloff = Shred.StackFalloffFrames;
public int cDepth = 0;
public int gsInferno = 0;
public int astralInfection = 0;
@@ -816,8 +823,8 @@ namespace CalamityMod.NPCs
// Debuffs that aren't affected by weaknesses or resistances.
if (vaporfied > 0)
ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage);
if (pShred > 0)
ApplyDPSDebuff(1500, 300, ref npc.lifeRegen, ref damage);
if (somaShredStacks > 0)
Shred.TickDebuff(npc, this);
if (bBlood > 0)
ApplyDPSDebuff(50, 10, ref npc.lifeRegen, ref damage);
@@ -3690,8 +3697,7 @@ namespace CalamityMod.NPCs
pFlames--;
if (aFlames > 0)
aFlames--;
if (pShred > 0)
pShred--;
// Soma Prime's Shred stacks have a unique falloff mechanic in the debuff's own file.
if (aCrunch > 0)
aCrunch--;
if (cDepth > 0)
@@ -3911,6 +3917,36 @@ namespace CalamityMod.NPCs
MakeTownNPCsTakeMoreDamage(npc, projectile, mod, ref damage);
// Supercrits
var cgp = projectile.Calamity();
if (cgp.canSupercrit)
{
int critOver100 = 0;
if (projectile.melee)
critOver100 = player.meleeCrit - 100;
else if (projectile.ranged)
critOver100 = player.rangedCrit - 100;
else if (projectile.magic)
critOver100 = player.magicCrit - 100;
else if (projectile.thrown) // Also covers rogue
critOver100 = player.thrownCrit - 100;
// Supercrits can "supercrit" over and over for each extra 100% critical strike chance.
// For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead.
if (critOver100 > 0)
{
int supercritLayers = critOver100 / 100;
int lastLayerCritChance = critOver100 - supercritLayers;
// Roll for the remaining crit chance
if (Main.rand.Next(100) <= lastLayerCritChance)
++supercritLayers;
// Apply supercrit damage. This projectile is already guaranteed to be a crit, which will double its damage at the end.
// As such, only 50% damage is added per supercrit layer here.
damage = (int)(damage * (1f + 0.5f * supercritLayers));
}
}
int bullseyeType = ProjectileType<SpiritOriginBullseye>();
Projectile bullseye = null;
for (int i = 0; i < Main.maxProjectiles; i++)
@@ -4781,21 +4817,46 @@ namespace CalamityMod.NPCs
Lighting.AddLight(npc.position, 0.025f, 0f, 0f);
}
if (pShred > 0)
// Enemies suffering from Soma Prime's Shred spray blood like Violence
if (somaShredStacks > 0 && Main.netMode != NetmodeID.Server)
{
if (Main.rand.Next(5) < 4)
{
int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 5, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 1.1f;
Main.dust[dust].velocity.Y += 0.25f;
if (Main.rand.NextBool(2))
{
Main.dust[dust].noGravity = false;
Main.dust[dust].scale *= 0.5f;
}
}
}
// The amount of blood particles spawned by Soma Prime's Shred scales loosely with the number of stacks.
float roughBloodCount = (float)Math.Sqrt(0.8f * somaShredStacks);
int exactBloodCount = (int)roughBloodCount;
// Chance for the final blood particle
if (Main.rand.NextFloat() < roughBloodCount - exactBloodCount)
++exactBloodCount;
// Velocity of the spurting blood also slightly increases with stacks.
float velStackMult = 1f + (float)Math.Log(somaShredStacks);
// Code copied from Violence.
for (int i = 0; i < exactBloodCount; ++i)
{
int bloodLifetime = Main.rand.Next(22, 36);
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat());
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
if (Main.rand.NextBool(20))
bloodScale *= 2f;
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * velStackMult * randomSpeedMultiplier;
bloodVelocity.Y -= 5f;
BloodParticle blood = new BloodParticle(npc.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor);
GeneralParticleHandler.SpawnParticle(blood);
}
for (int i = 0; i < exactBloodCount / 3; ++i)
{
float bloodScale = Main.rand.NextFloat(0.2f, 0.33f);
Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.5f, 1f));
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * velStackMult * Main.rand.NextFloat(1f, 2f);
bloodVelocity.Y -= 2.3f;
BloodParticle2 blood = new BloodParticle2(npc.Center, bloodVelocity, 20, bloodScale, bloodColor);
GeneralParticleHandler.SpawnParticle(blood);
}
}
if (hFlames > 0 || banishingFire > 0)
{
@@ -5029,7 +5090,7 @@ namespace CalamityMod.NPCs
{
if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type)))
{
List<Texture2D> buffTextureList = new List<Texture2D>();
IList<Texture2D> buffTextureList = new List<Texture2D>();
// Damage over time debuffs
if (aFlames > 0)
@@ -5054,7 +5115,7 @@ namespace CalamityMod.NPCs
buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Plague"));
if (shellfishVore > 0)
buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/ShellfishEating"));
if (pShred > 0)
if (somaShredStacks > 0)
buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Shred"));
if (clamDebuff > 0)
buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff"));
@@ -5160,8 +5221,8 @@ namespace CalamityMod.NPCs
// Max amount of buffs per row
int buffDisplayRowLimit = 5;
/* The maximum length of a single row in the buff display
* Limited to 80 units, because every buff drawn here is half the size of a normal buff, 16 x 16, 16 * 5 = 80 units*/
// The maximum length of a single row in the buff display
// Limited to 80 units, because every buff drawn here is half the size of a normal buff, 16 x 16, 16 * 5 = 80 units
float drawPosX = totalLength >= 80f ? 40f : (float)(totalLength / 2);
// The height of a single frame of the npc
@@ -5189,7 +5250,10 @@ namespace CalamityMod.NPCs
float additionalYOffset = 14f * (float)Math.Floor(i * 0.2);
// Draw the display
spriteBatch.Draw(buffTextureList.ElementAt(i), drawPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f);
var tex = buffTextureList.ElementAt(i);
spriteBatch.Draw(tex, drawPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f);
// TODO -- Show number of Shred stacks (how?)
}
}
}
+1
View File
@@ -129,6 +129,7 @@ namespace CalamityMod.NPCs
{
"Amber", // <@!114677116473180169> (Mishiro Usui#1295)
"Faith", // <@!509050283871961123> (Toasty#1007)
"Xsiana", // <@!625780237489143839> (xiana.#0015)
};
private const int TavernkeepVanillaNames = 16;
private static readonly string[] TavernkeepNames =
@@ -2931,6 +2931,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas
if (!npc.dontTakeDamage && (willCharge || npc.ai[1] == 2f))
intensity = 1.1f;
// Dampen the opacity and intensity slightly, to allow SCal to be more easily visible inside of the forcefield.
intensity *= 0.75f;
opacity *= 0.75f;
Texture2D forcefieldTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamitasShield");
GameShaders.Misc["CalamityMod:SupremeShield"].UseImage("Images/Misc/Perlin");
+8 -3
View File
@@ -72,10 +72,15 @@ namespace CalamityMod.Particles
}
/// <summary>
/// Spawns the particle instance provided into the world. If the particle limit is reached but the particle is marked as important, it will try to replace a non important particle.
/// </summary>
public static void SpawnParticle(Particle particle)
/// Spawns the particle instance provided into the world. If the particle limit is reached but the particle is marked as important, it will try to replace a non important particle.
/// </summary>
public static void SpawnParticle(Particle particle)
{
// Don't queue particles if the game is paused.
// This precedent is established with how Dust instances are created.
if (Main.gamePaused)
return;
if (particles.Count >= CalamityConfig.Instance.ParticleLimit && !particle.Important)
return;
+10 -1
View File
@@ -4,7 +4,6 @@ using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Melee.Yoyos;
@@ -58,6 +57,16 @@ namespace CalamityMod.Projectiles
public int spawnedPlayerMinionProjectileDamageValue = 0;
public int defDamage = 0;
// Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit".
// For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage.
// They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits).
// For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead.
// These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit.
public bool canSupercrit = false;
// If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime.
public bool appliesSomaShred = false;
// Amount of extra updates that are set in SetDefaults.
public int defExtraUpdates = -1;
-39
View File
@@ -1,39 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SlashRound : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Round");
}
public override void SetDefaults()
{
projectile.width = 4;
projectile.height = 4;
projectile.light = 0.5f;
projectile.alpha = 255;
projectile.extraUpdates = 7;
projectile.scale = 1.18f;
projectile.friendly = true;
projectile.ranged = true;
projectile.ignoreWater = true;
projectile.aiStyle = 1;
aiType = ProjectileID.BulletHighVelocity;
projectile.penetrate = 1;
projectile.timeLeft = 600;
projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Shred>(), 180);
}
}
}