Flesh Totem Start

This commit is contained in:
mochi-angel committed 2025-04-26 15:26:20 -07:00
1 parent 50d7181d53
commit d07c7993fd
11 files changed
+202 -15

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Projectiles.Magic;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class FleshTotemBuff : BaseSummonBuff
{
protected override int MinionProjectileType => ModContent.ProjectileType<FleshTotemMinion>();
protected override ref bool MinionBool => ref BuffModdedOwner.fleshTotem;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

+14
View File
@@ -852,6 +852,7 @@ namespace CalamityMod.CalPlayer
public bool community = false;
public bool shatteredCommunity = false;
public bool fleshTotem = false;
public int fleshTotemManaStorage = 0;
public bool bloodPact = false;
public bool bloodPactBoost = false;
public bool bloodflareCore = false;
@@ -5599,6 +5600,19 @@ namespace CalamityMod.CalPlayer
life.noGravity = true;
}
}
if (modPlayer.fleshTotem)
{
if (Main.myPlayer == Player.whoAmI)
{
//Main.NewText(fleshTotemManaStorage);
fleshTotemManaStorage += manaConsumed;
if (fleshTotemManaStorage >= FleshTotem.manaStorageMax)
{
fleshTotemManaStorage = FleshTotem.manaStorageMax;
}
}
}
}
#endregion
}
+20 -7
View File
@@ -14,6 +14,7 @@ using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
using CalamityMod.Items.Armor.Aerospec;
using CalamityMod.Items.Armor.Bloodflare;
using CalamityMod.Items.Armor.Demonshade;
using CalamityMod.Items.Armor.LunicCorps;
using CalamityMod.Items.Armor.Silva;
@@ -32,6 +33,7 @@ using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Providence;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Typeless;
@@ -794,10 +796,6 @@ namespace CalamityMod.CalPlayer
// The amount of damage that will be dealt is yet to be determined.
//
// Can't have any cooldowns here because dodges grrrrr....
if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && TotalEnergyShielding <= 0)
contactDamageReduction += 0.5;
if (tarragonCloak && tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID))
contactDamageReduction += Buffs.StatBuffs.TarragonCloak.ContactDamageReduction;
@@ -1165,10 +1163,9 @@ namespace CalamityMod.CalPlayer
if (!hasIFrames && !Player.creativeGodMode)
nextHitDealsDefenseDamage |= npc.Calamity().canBreakPlayerDefense;
// ModifyHit (Flesh Totem effect happens here) -> Hurt (includes dodges) -> OnHit
// ModifyHit -> Hurt (includes dodges) -> OnHit
// As such, to avoid cooldowns proccing from dodge hits, do it here
if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && hurtInfo.Damage > 0)
Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20));
if (NPC.AnyNPCs(ModContent.NPCType<THELORDE>()))
Player.AddBuff(ModContent.BuffType<NOU>(), 15, true);
@@ -2482,6 +2479,22 @@ namespace CalamityMod.CalPlayer
}
}
if (fleshTotem && hurtInfo.Damage > 0)
{
if (fleshTotemManaStorage >= 25)
SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center);
int lostSoulAmount = fleshTotemManaStorage / 25;
if (Player.ownedProjectileCounts[ModContent.ProjectileType<FleshTotemMinion>()] != 0)
{
for (int k = 0; k < lostSoulAmount; k++)
{
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType<VoidVortexProj>(), FleshTotem.lostSoulDamage, 0f, Main.myPlayer, 0f, 0f, 3f);
}
}
fleshTotemManaStorage = 0;
}
// By setting brainOfConfusionItem, these accessories have this code already,
// but doing it again allows for increased duration + The Amalgam's other buffs,
// and also doesn't have random chance (why does Brain of Confusion not guarantee confusion on hit)
@@ -1,13 +1,16 @@
using Microsoft.Xna.Framework;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Accessories;
using Microsoft.Xna.Framework;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class FleshTotem : CooldownHandler
public class FleshTotemStorage : CooldownHandler
{
public static new string ID => "FleshTotem";
public static new string ID => "FleshTotemStorage";
public override bool ShouldDisplay => true;
private CalamityPlayer CalPlayer => instance.player.Calamity();
public override bool ShouldDisplay => CalPlayer.fleshTotem;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/FleshTotem";
public override Color OutlineColor => new Color(157, 248, 234);
+28 -1
View File
@@ -1,4 +1,9 @@
using CalamityMod.CalPlayer;
using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using CalamityMod.Cooldowns;
using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -8,6 +13,10 @@ namespace CalamityMod.Items.Accessories
public class FleshTotem : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int manaStorageMax = 600;
public const int lostSoulDamage = 200;
public override void SetDefaults()
{
Item.width = 26;
@@ -21,6 +30,24 @@ namespace CalamityMod.Items.Accessories
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.fleshTotem = true;
player.statManaMax2 += 30;
player.GetCritChance<MagicDamageClass>() += 5;
if (player.whoAmI == Main.myPlayer)
{
var source = player.GetSource_Accessory(Item);
if (player.FindBuffIndex(ModContent.BuffType<FleshTotemBuff>()) == -1)
{
player.AddBuff(ModContent.BuffType<FleshTotemBuff>(), 3600, true);
}
if (player.ownedProjectileCounts[ModContent.ProjectileType<FleshTotemMinion>()] < 1)
{
int damage = (int)player.GetTotalDamage<MagicDamageClass>().ApplyTo(lostSoulDamage);
int effigy = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType<FleshTotemMinion>(), damage, 2f, Main.myPlayer);
if (Main.projectile.IndexInRange(effigy))
Main.projectile[effigy].originalDamage = lostSoulDamage;
}
}
}
}
}
@@ -1603,3 +1603,8 @@ PopoNoselessBuff: {
DisplayName: Noseless Popo
Description: Your nose has been stolen!
}
FleshTotemBuff: {
DisplayName: Flesh Totem Buff
Description: Mods.CalamityMod.Buffs.FleshTotemBuff.Description
}
@@ -770,8 +770,12 @@ FleshTotem: {
DisplayName: Flesh Totem
Tooltip:
'''
Halves enemy contact damage
When you take contact damage this effect has a 20 second cooldown
5% increased magic critical strike chance
+30 max mana
Summons an effigy above your head that stores mana as you use it
The effigy occasionally pulses, restoring 30 mana
Pulses appear more frequently the more mana is stored
Upon being struck, the effigy unleashes all stored up mana as vengeful souls that chase your enemies
'''
}
@@ -262,3 +262,4 @@ WyvernFeatherPurple.DisplayName: Feather
WyvernProjectile.DisplayName: Wyvern
YharimsCrystalBeam.DisplayName: Yharim's Beam
YharimsCrystalPrism.DisplayName: Yermes Christal
FleshTotemMinion.DisplayName: Flesh Totem Minion
+104
View File
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.CalPlayer;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class FleshTotemMinion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Items/Accessories/FleshTotem";
public int pulseTimer = 0;
public override void SetDefaults()
{
Projectile.width = 30;
Projectile.height = 26;
Projectile.netImportant = true;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.timeLeft = 18000;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.timeLeft *= 5;
Projectile.DamageType = DamageClass.Magic;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (!modPlayer.fleshTotem)
{
Projectile.active = false;
return;
}
if (player.dead)
{
modPlayer.fleshTotem = false;
}
if (modPlayer.fleshTotem)
{
Projectile.timeLeft = 2;
}
Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f);
Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 85f);
if (player.gravDir == -1f)
{
Projectile.position.Y += 170f;
Projectile.rotation = MathHelper.Pi;
}
else
{
Projectile.rotation = 0f;
}
for (int i = 0; i < 2; i++)
{
int dustType = Main.rand.NextBool() ? 66 : 247;
float rotMulti = Main.rand.NextFloat(0.3f, 1f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY / 65f, dustType);
dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (modPlayer.fleshTotemManaStorage * 0.0009f) - rotMulti * 0.1f;
dust.noGravity = true;
dust.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (modPlayer.fleshTotemManaStorage * 0.0009f);
dust.alpha = 1;
dust.color = Color.Cyan;
}
int pulseMax = 360;
if (modPlayer.fleshTotemManaStorage == 0)
pulseMax = 360;
else
{
pulseMax = 360 - (modPlayer.fleshTotemManaStorage / 2);
if (pulseMax < 60)
{
pulseMax = 60;
}
}
if (pulseTimer >= pulseMax)
{
//Main.NewText(pulseMax);
SoundEngine.PlaySound(BrimstoneElemental.HellfireballSound, Projectile.Center);
int manaGained = 30;
player.statMana += manaGained;
if (Main.myPlayer == player.whoAmI)
player.ManaEffect(manaGained);
if (player.statMana > player.statManaMax2)
player.statMana = player.statManaMax2;
pulseTimer = 0;
}
pulseTimer++;
}
public override bool? CanDamage() => false;
}
}
-1
View File
@@ -172,7 +172,6 @@ namespace CalamityMod.Projectiles.Magic
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<AuricRebuke>(), 180);
if (hit.Damage > 1 && Projectile.ai[2] == 3)
Projectile.Kill();
}