This commit is contained in:
Big E committed 2025-11-21 22:01:47 -05:00
commit fb139510a3
246 files changed
+2485 -3110

No files matched your search

-4
View File
@@ -204,10 +204,6 @@ namespace CalamityMod.Buffs
tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.ChaosState");
break;
case BuffID.IceBarrier:
tip = tip.Replace("25", "15");
break;
case BuffID.MagicPower:
tip = tip.Replace("20", "10");
break;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.DamageOverTime
public static DebuffData debuffData = new DebuffData()
{
EnemyLostRegen = 3996, //6x the tick size
SicknessDebuffScaling = 1,
HeatDebuffScaling = 1,
MinimumDamageTickSize = 666, //Vhex should always have ticks of 666
MultiplierDamageTickSize = 0
};
+8 -1
View File
@@ -1,4 +1,5 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -7,12 +8,18 @@ namespace CalamityMod.Buffs.StatDebuffs
{
public class WhisperingDeath : ModBuff
{
// Whispering Death does not deal DoT, but is classified as a sickness debuff.
public static DebuffData debuffData = new DebuffData()
{
SicknessDebuffScaling = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
BuffDatasets.DebuffDataset[Type] = debuffData;
}
public override void Update(Player player, ref int buffIndex)
+32 -27
View File
@@ -112,8 +112,6 @@ namespace CalamityMod.CalPlayer
public double projectileDamageReduction = 0D;
public int hellbornShots = 0;
public int garandShots = 0;
public int searedPanCounter = 0;
public int searedPanTimer = 0;
/// <summary> If set to true, prevents all player dashes. Used by Ball and Chain, and Stygian Shield. </summary>
public bool blockAllDashes = false;
/// <summary> Used by Flamsteed Ring to reset the player's hitbox size after dismounting. </summary>
@@ -368,12 +366,8 @@ namespace CalamityMod.CalPlayer
public int dragonRageHits = 0;
/// <summary> Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. </summary>
public int dragonRageCooldown = 0;
public const float AquaticBoostMax = 10000f;
/// <summary>
/// Counter variable which controls Aquatic Emblem's stat boosts while underwater.<br/>
/// This counter starts at <see cref="AquaticBoostMax"/>, and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0.
/// </summary>
public float aquaticBoost = 0f;
/// <summary> Counter variable which controls Aquatic Emblem's stat boosts while underwater. </summary>
public float aquaticBoost = 0;
public int galileoCooldown = 0;
/// <summary> Used to track Prideful Hunter's Planar Ripper's movement speed boost, along with its visual effects. </summary>
public int planarSpeedBoost = 0;
@@ -728,8 +722,6 @@ namespace CalamityMod.CalPlayer
public bool tCloudberry = false;
/// <summary> If true, the player has consumed Sacred Strawberry. </summary>
public bool sStrawberry = false;
/// <summary> If true, the player has consumed Nimble Bounder. </summary>
public bool nimbleBounderBoost = false;
public bool revJamDrop = false;
/// <summary> If true, the player has consumed Mushroom Plasma Root. </summary>
public bool rageBoostOne = false;
@@ -804,7 +796,6 @@ namespace CalamityMod.CalPlayer
public bool ascendantInsignia = false;
public int ascendantInsigniaBuffTime = 0;
public int ascendantInsigniaCooldown = 0;
public bool ascendantTrail = false;
/// <summary> Used to toggle dust spawned while swinging, through accessory visibility. </summary>
public bool magmaStoneVisuals = true;
public bool eGauntlet = false;
@@ -1751,7 +1742,6 @@ namespace CalamityMod.CalPlayer
sStrawberry = false;
pHeart = false;
cShard = false;
nimbleBounderBoost = false;
revJamDrop = false;
rageBoostOne = false;
rageBoostTwo = false;
@@ -1804,7 +1794,6 @@ namespace CalamityMod.CalPlayer
boost.AddWithCondition("dragonFruit", sStrawberry);
boost.AddWithCondition("phantomHeart", pHeart);
boost.AddWithCondition("cometShard", cShard);
boost.AddWithCondition("nimbleBounder", nimbleBounderBoost);
boost.AddWithCondition("revJam", revJamDrop);
boost.AddWithCondition("rageOne", rageBoostOne);
boost.AddWithCondition("rageTwo", rageBoostTwo);
@@ -1895,7 +1884,6 @@ namespace CalamityMod.CalPlayer
sStrawberry = boost.Contains("dragonFruit");
pHeart = boost.Contains("phantomHeart");
cShard = boost.Contains("cometShard");
nimbleBounderBoost = boost.Contains("nimbleBounder");
revJamDrop = boost.Contains("revJam");
rageBoostOne = boost.Contains("rageOne");
rageBoostTwo = boost.Contains("rageTwo");
@@ -2028,7 +2016,7 @@ namespace CalamityMod.CalPlayer
percentMaxLifeIncrease += 25;
if (affliction || afflicted)
percentMaxLifeIncrease += 10;
percentMaxLifeIncrease += Affliction.MaxLifeBoostPercent;
if (community)
percentMaxLifeIncrease += (int)(TheCommunity.CalculatePower() * TheCommunity.HealthMultiplier);
@@ -2244,7 +2232,6 @@ namespace CalamityMod.CalPlayer
teslaVisuals = true;
cryogenSoul = false;
ascendantInsignia = false;
ascendantTrail = false;
magmaStoneVisuals = true;
eGauntlet = false;
eGauntletVisuals = true;
@@ -3246,7 +3233,6 @@ namespace CalamityMod.CalPlayer
CurrentlyViewedHologramText = string.Empty;
#endregion
ascendantTrail = false;
evilSmasherBoost = 0;
burningSeaBurnOut = 0;
flareGunOverheat = 0;
@@ -3254,8 +3240,6 @@ namespace CalamityMod.CalPlayer
lucreciaEnergy = 0;
elementalMastery = 0;
garandShots = 0;
searedPanCounter = 0;
searedPanTimer = 0;
persecutedEnchantSummonTimer = 0;
momentumCapacitorTime = 0;
momentumCapacitorBoost = 0f;
@@ -3320,8 +3304,8 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_Accessory(FindAccessory(ItemType<AscendantInsignia>()));
Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType<AscendantAura>(), 0, 0f);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate"));
ascendantInsigniaCooldown = 2400;
ascendantInsigniaBuffTime = 240; //4 seconds
ascendantInsigniaCooldown = AscendantInsignia.AbilityCooldown;
ascendantInsigniaBuffTime = AscendantInsignia.AbilityDuration;
}
int numOfBlobs = Player.ownedProjectileCounts[ProjectileType<TransformerBlob>()];
@@ -3400,8 +3384,7 @@ namespace CalamityMod.CalPlayer
}
if (CalamityKeybinds.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID))
{
int seconds = CalamityUtils.SecondsToFrames(15f);
Player.AddBuff(BuffType<Buffs.StatBuffs.DivineBless>(), seconds, false);
Player.AddBuff(BuffType<Buffs.StatBuffs.DivineBless>(), AngelicAlliance.DivineBlessDuration, false);
SoundEngine.PlaySound(AngelicAlliance.ActivationSound, Player.Center);
// Spawn an archangel for every minion you have
@@ -3423,7 +3406,7 @@ namespace CalamityMod.CalPlayer
float start = 360f / angelAmt;
Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ProjectileType<AngelicAllianceArchangel>(), proj.damage / 10, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start);
Player.HealPlayer(2);
Player.HealPlayer(AngelicAlliance.HealPerAngelSpawned);
}
}
if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f &&
@@ -4463,6 +4446,30 @@ namespace CalamityMod.CalPlayer
Lighting.AddLight(Player.Center, Light * (0.55f + (oceanCrestTimer * 0.0035f)));
}
if (rampartOfDeities)
{
// Ice Barrier buff inherited from Frozen Turtle Shell
if (Player.statLife <= Player.statLifeMax2 * 0.5)
Player.AddBuff(BuffID.IceBarrier, 5);
// Paladin's Shield application
if (Player.statLife > Player.statLifeMax2 * 0.25f)
{
Player.hasPaladinShield = true;
if (Player.whoAmI != Main.myPlayer && Player.miscCounter % 10 == 0)
{
var localPlayer = Main.LocalPlayer;
if (localPlayer.team == Player.team && Player.team != 0)
{
float teamPlayerXDist = Player.position.X - localPlayer.position.X;
float teamPlayerYDist = Player.position.Y - localPlayer.position.Y;
if ((float)Math.Sqrt(teamPlayerXDist * teamPlayerXDist + teamPlayerYDist * teamPlayerYDist) < 800f)
localPlayer.AddBuff(BuffID.PaladinsShield, 20);
}
}
}
}
// True melee damage from various vanilla equipment placed here.
// Titan Glove and ALL upgrades.
@@ -4566,8 +4573,7 @@ namespace CalamityMod.CalPlayer
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? SilvaArmor.AccelerationBoost : 0f) +
(getSandCloakAccelBoost ? 0.75f : 0f) +
(nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) +
(ascendantInsignia ? 0.25f : 0f) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x
(ascendantInsignia ? (AscendantInsignia.AccelerationBoost - 0.25f) : 0f) + // Subtracted 0.25 provided by Soaring Insignia
(statisNinjaBelt ? 0.6f : 0f) +
(statisVoidSash ? 0.85f : 0f) +
(blueCandle ? WeightlessCandle.AccelerationBoost : 0f) +
@@ -4586,7 +4592,6 @@ namespace CalamityMod.CalPlayer
(dragonScales ? 0.1f : 0f) +
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? SilvaArmor.AccelerationBoost : 0f) +
(nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) +
(planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) +
//(exaltedKillMode ? 0.4f : devilsDevastationKillMode ? 0.7f : 0) +
(hasteLevel * 0.05f);
+2 -2
View File
@@ -1014,7 +1014,7 @@ namespace CalamityMod.CalPlayer
bool isReducedTrap = (proj.trap || proj.type == ProjectileID.RollingCactusSpike || proj.type == ProjectileID.Landmine) && !isIgnoredTrap;
if (Player.Calamity().trapProtection && isReducedTrap)
modifiers.SourceDamage *= 0.35f;
modifiers.SourceDamage *= (1f - ArchaicPowder.TrapDamageReduction);
// Reduce damage dealt by rainbow trails
if (proj.type == ProjectileID.HallowBossLastingRainbow)
@@ -2261,7 +2261,7 @@ namespace CalamityMod.CalPlayer
if (aquaticHeartIce)
{
SoundEngine.PlaySound(SoundID.NPCDeath7, Player.Center);
Player.AddCooldown(AquaticHeartIceShield.ID, CalamityUtils.SecondsToFrames(30));
Player.AddCooldown(AquaticHeartIceShield.ID, AquaticHeart.IceShieldCooldown);
for (int d = 0; d < 10; d++)
{
+9 -8
View File
@@ -6,6 +6,7 @@ using CalamityMod.Buffs.Placeables;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.CalPlayer.Dashes;
using CalamityMod.Cooldowns;
using CalamityMod.DataStructures;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Wings;
@@ -117,8 +118,8 @@ namespace CalamityMod.CalPlayer
ApplyDoTDebuff(crushDepth, 18, purity);
ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity);
ApplyDoTDebuff(shadowflame, 30, purity);
ApplyDoTDebuff(brimstoneFlames, abaddon ? 15 : 30, purity);
ApplyDoTDebuff(plague, alchFlask ? 15 : 30, purity);
ApplyDoTDebuff(brimstoneFlames, (int)MathF.Round(30 * (abaddon ? (1f - Abaddon.BrimstoneFlamesReduction) : 1f)), purity);
ApplyDoTDebuff(plague, (int)MathF.Round(30 * (abaddon ? (1f - AlchemicalFlask.PlagueReduction) : 1f)), purity);
ApplyDoTDebuff(vHex, 30); // Has other effects
ApplyDoTDebuff(searingLava, 30);
ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player
@@ -307,9 +308,9 @@ namespace CalamityMod.CalPlayer
int buffID = Player.buffType[l];
if (Player.buffTime[l] <= 2)
continue;
bool shouldHalveDuration = CalamityBuffSets.IsSicknessDebuff[buffID];
bool shouldHalveDuration = BuffDatasets.DebuffDataset[buffID].SicknessDebuffScaling > 0;
if (livingDewHalveDebuffs)
shouldHalveDuration |= CalamityBuffSets.IsFireDebuff[buffID];
shouldHalveDuration |= BuffDatasets.DebuffDataset[buffID].HeatDebuffScaling > 0;
if (purity)
shouldHalveDuration |= CalamityBuffSets.IsDebuff[buffID];
@@ -320,7 +321,7 @@ namespace CalamityMod.CalPlayer
if (divineBless)
{
if (Player.whoAmI == Main.myPlayer && Player.miscCounter % 15 == 0) // Flat 4 health per second
if (Player.whoAmI == Main.myPlayer && Player.miscCounter % AngelicAlliance.DivineBlessFramesPerHeal == 0) // Flat 4 health per second
{
if (!noLifeRegen)
Player.HealPlayer(1, HealTextType.None);
@@ -355,7 +356,7 @@ namespace CalamityMod.CalPlayer
}
// Permafrost's Concoction increases life regen while afflicted with a fire debuff
if (permafrostsConcoction && Player.buffType.Any(l => CalamityBuffSets.IsFireDebuff[l]))
if (permafrostsConcoction && Player.buffType.Any(l => BuffDatasets.DebuffDataset[l].HeatDebuffScaling > 0))
{
if (Player.lifeRegenTime < 900)
Player.lifeRegenTime = 900;
@@ -368,7 +369,7 @@ namespace CalamityMod.CalPlayer
{
float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2;
//Ambrosial Ampule and ooze give between 2 and 5 hp/s
int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(4f, 10f, missingLifeRatio));//Rounding is needed for it to ever actually give +5 hp/s, as the integer conversion would otherwise floor it.
int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(RadiantOoze.MinRegenBoost, RadiantOoze.MaxRegenBoost, missingLifeRatio));//Rounding is needed for it to ever actually give +5 hp/s, as the integer conversion would otherwise floor it.
Player.lifeRegen += lifeRegenToGive;
radiantOozeRegen += lifeRegenToGive / 2f;
purityRegen += lifeRegenToGive / 2f;
@@ -574,7 +575,7 @@ namespace CalamityMod.CalPlayer
Player.lifeRegen += HallowedRune.RegenBoost;
if (affliction || afflicted)
Player.lifeRegen += 1;
Player.lifeRegen += Affliction.RegenBoost;
if (trinketOfChi || chiRegen)
Player.lifeRegen += 2;
+21 -43
View File
@@ -2710,19 +2710,12 @@ namespace CalamityMod.CalPlayer
Player.jumpSpeedBoost += TheAbsorber.JumpSpeedBoost;
}
// Nimble Bounder bonus
if (nimbleBounderBoost)
{
Player.moveSpeed += NimbleBounder.MoveSpeedBoost;
Player.jumpSpeedBoost += NimbleBounder.JumpSpeedBoost;
}
// Affliction bonus
if (affliction || afflicted)
{
Player.endurance += 0.07f;
Player.statDefense += 9;
Player.GetDamage<GenericDamageClass>() += 0.1f;
Player.endurance += Affliction.DamageReductionBoost;
Player.statDefense += Affliction.DefenseBoost;
Player.GetDamage<GenericDamageClass>() += Affliction.DamageBoost;
}
float[] light = new float[3];
@@ -2945,8 +2938,8 @@ namespace CalamityMod.CalPlayer
if (!ascendantInsignia && ascendantInsigniaBuffTime > 0)
{
ascendantInsigniaBuffTime = 0;
ascendantInsigniaCooldown = 2400;
Player.AddCooldown(AscendEffect.ID, 2400);
ascendantInsigniaCooldown = AscendantInsignia.AbilityCooldown;
Player.AddCooldown(AscendEffect.ID, AscendantInsignia.AbilityCooldown);
}
if (!brimflameSet && brimflameFrenzy)
@@ -3002,7 +2995,7 @@ namespace CalamityMod.CalPlayer
{
divineBless = false;
Player.ClearBuff(ModContent.BuffType<Buffs.StatBuffs.DivineBless>());
Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60));
Player.AddCooldown(Cooldowns.DivineBless.ID, AngelicAlliance.DivineBlessCooldown);
}
// Armageddon's Dodge Disable feature puts Shadow Dodge/Holy Protection on permanent cooldown
@@ -3313,15 +3306,14 @@ namespace CalamityMod.CalPlayer
// Aquatic Emblem bonus
if (aquaticEmblem)
{
if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet &&
!Player.mount.Active)
if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet && !Player.mount.Active)
{
if (aquaticBoost > 0f)
if (aquaticBoost < AquaticEmblem.TimeToReachMaxBoost)
{
aquaticBoost -= 2f;
if (aquaticBoost <= 0f)
aquaticBoost++;
if (aquaticBoost > AquaticEmblem.TimeToReachMaxBoost)
{
aquaticBoost = 0f;
aquaticBoost = AquaticEmblem.TimeToReachMaxBoost;
if (Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
@@ -3329,18 +3321,18 @@ namespace CalamityMod.CalPlayer
}
else
{
aquaticBoost += 2f;
if (aquaticBoost > AquaticBoostMax)
aquaticBoost = AquaticBoostMax;
aquaticBoost--;
if (aquaticBoost <= 0f)
aquaticBoost = 0f;
if (Player.mount.Active)
aquaticBoost = AquaticBoostMax;
aquaticBoost = 0f;
}
Player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 20f);
Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f;
Player.statDefense += (int)Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxDefenseBoost);
Player.moveSpeed -= Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxMoveSpeedReduction);
}
else
aquaticBoost = AquaticBoostMax;
aquaticBoost = 0f;
if (Player.HeldItem.type == ModContent.ItemType<Auralis>() && Player.StandingStill(0.1f))
{
@@ -3709,18 +3701,6 @@ namespace CalamityMod.CalPlayer
if (Player.HeldItem.type != ModContent.ItemType<EvilSmasher>())
evilSmasherBoost = 0;
}
if (searedPanCounter > 0)
{
if (Player.HeldItem.type != ModContent.ItemType<SearedPan>())
{
searedPanCounter = 0;
searedPanTimer = 0;
}
else if (searedPanTimer < SearedPan.ConsecutiveHitOpening)
searedPanTimer++;
else
searedPanCounter = 0;
}
// Flight time boosts
double flightTimeMult = 1D +
@@ -3731,8 +3711,7 @@ namespace CalamityMod.CalPlayer
(soaring ? SoaringPotion.FlightBoost : 0D) +
(prismaticGreaves ? PrismaticGreaves.FlightTimeBoost : 0D) +
(plagueReaper ? PlagueReaperMask.SetBonusFlightTimeBoost : 0D) +
(ascendantInsignia ? 0.17 : 0D) + // Added to soaring insignia's flight to get 50%
(Player.empressBrooch ? 0.33 : 0D) +
(ascendantInsignia ? AscendantInsignia.FlightTimeBoost : Player.empressBrooch ? 0.33D : 0D) +
externalFlightTimeMultBoost;
if (community)
@@ -3976,10 +3955,9 @@ namespace CalamityMod.CalPlayer
if (ascendantInsignia && ascendantInsigniaBuffTime > 0)
{
ascendantTrail = true;
infiniteFlight = true;
if (ascendantInsigniaBuffTime == 1)
Player.AddCooldown(AscendEffect.ID, 2400);
Player.AddCooldown(AscendEffect.ID, AscendantInsignia.AbilityCooldown);
ascendantInsigniaBuffTime--;
}
@@ -4355,7 +4333,7 @@ namespace CalamityMod.CalPlayer
angelicActivate = -1;
if (angelicActivate == 1)
Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60));
Player.AddCooldown(Cooldowns.DivineBless.ID, AngelicAlliance.DivineBlessCooldown);
}
if (theBee && Player.statLife >= Player.statLifeMax2 && (!HasAnyEnergyShield || TotalEnergyShielding >= TotalMaxShieldDurability))
+7 -12
View File
@@ -202,11 +202,11 @@ namespace CalamityMod.CalPlayer
// Arc Flash Ring lightning strike (Remember to change the one for projectile hits if applicable when you change this one!)
// This one has a lot less limits than the projectile one, but that's because vanilla broadsword code is limiting (wow so surprising)
bool spawnChance = (Main.rand.Next(0, 100) < 6);
bool spawnChance = (Main.rand.Next(100) < ArcFlashRing.LightningSpawnPercent);
if (arcFlashRing && spawnChance)
{
var source = item.GetSource_FromThis();
int damage = (int)(((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline)
int damage = (int)(((hit.Damage * ArcFlashRing.LightningDamageMult) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline)
Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType<FlashBolt>(), damage, 0f, Player.whoAmI, target.whoAmI);
bolt.DamageType = hit.DamageType;
@@ -1216,18 +1216,15 @@ namespace CalamityMod.CalPlayer
target.AddBuff(BuffType<AstralInfectionDebuff>(), TitanHeartMask.OnHitDebuffDuration);
}
}
if (summon)
if (summon && !whip)
{
if (pSoulArtifact && !profanedCrystal)
if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
target.AddBuff(BuffType<HolyFlames>(), 600);
else if (pSoulArtifact)
target.AddBuff(BuffType<HolyFlames>(), 300);
if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
{
target.AddBuff(BuffType<HolyFlames>(), 600);
}
if (divineBless)
target.AddBuff(BuffType<BanishingFire>(), 60);
target.AddBuff(BuffType<BanishingFire>(), AngelicAlliance.BanishingFireDuration);
if (shadowMinions)
target.AddBuff(BuffID.ShadowFlame, 180);
@@ -1256,8 +1253,6 @@ namespace CalamityMod.CalPlayer
target.AddBuff(BuffType<VermillionFlux>(), 120);
target.AddBuff(BuffType<CrushDepth>(), 120);
}
if (voidOfExtinction)
CalamityUtils.Inflict246DebuffsNPC(target, BuffType<BrimstoneFlames>());
if (frostFlare)
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2);
if (omegaBlueChestplate)
+18
View File
@@ -0,0 +1,18 @@
using Microsoft.Xna.Framework;
using Terraria.Audio;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class PanaceaCooldown : CooldownHandler
{
public static new string ID => "Panacea";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/PanaceaCooldown";
public override Color OutlineColor => new Color(122, 198, 255);
public override Color CooldownStartColor => new Color(0, 128, 255);
public override Color CooldownEndColor => new Color(0, 255, 255);
public override SoundStyle? EndSound => new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver");
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

+6
View File
@@ -23,6 +23,7 @@ namespace CalamityMod.DataStructures
BuffID.CursedInferno, DebuffData.CursedInferno,
BuffID.ShadowFlame, DebuffData.Shadowflame,
BuffID.Daybreak, DebuffData.Daybroken,
BuffID.Burning, DebuffData.Burning,
BuffID.Frostburn, DebuffData.Frostburn,
BuffID.Frostburn2, DebuffData.Frostbite,
BuffID.Poisoned, DebuffData.Poisoned,
@@ -378,6 +379,11 @@ namespace CalamityMod.DataStructures
HeatDebuffScaling = 1,
NPCLifeRegenMethod = DaybrokenRegen
};
// Provided purely to classify it as a heat debuff
public static DebuffData Burning = new DebuffData()
{
HeatDebuffScaling = 1
};
public static DebuffData Frostburn = new DebuffData()
{
EnemyLostRegen = 16,
+44 -8
View File
@@ -1,5 +1,7 @@
using Microsoft.Xna.Framework;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -7,7 +9,16 @@ namespace CalamityMod.Dusts
{
public class DiamondDust : ModDust
{
public static Asset<Texture2D> GlowDiamond { get; private set; }
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void Load()
{
if (!Main.dedServ)
GlowDiamond = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -38,26 +49,51 @@ namespace CalamityMod.Dusts
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated").Value;
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
}
return false;
}
}
public class DiamondDustPixelated : DiamondDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
public static void DrawPixelated(Dust dust)
{
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
// Glow Orb
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
}
}
}
}
+41 -9
View File
@@ -1,6 +1,9 @@
using System;
using CalamityMod.Enums;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -8,6 +11,19 @@ namespace CalamityMod.Dusts
{
public class LightDust : ModDust
{
public static Asset<Texture2D> SolidCircle { get; private set; }
public static Asset<Texture2D> BloomCircle { get; private set; }
public override void Load()
{
if (Main.dedServ)
return;
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -28,21 +44,37 @@ namespace CalamityMod.Dusts
return true;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
}
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
return false;
}
}
public class LightDustPixelated : LightDust
{
public override string Texture => "CalamityMod/Dusts/LightDust";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
// Glow Orb
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
if (!dust.noLight)
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
+40 -7
View File
@@ -1,6 +1,8 @@
using System;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -8,7 +10,16 @@ namespace CalamityMod.Dusts
{
public class SquareDust : ModDust
{
public static Asset<Texture2D> GlowSquare { get; private set; }
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void Load()
{
if (!Main.dedServ)
GlowSquare = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleThick");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -42,22 +53,44 @@ namespace CalamityMod.Dusts
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleThick").Value;
Vector2 squash = Vector2.One;
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f);
}
return false;
}
}
public class SquareDustPixelated : SquareDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Vector2 squash = Vector2.One;
// Glow Orb
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f);
if (dust.alpha < 1)
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f);
}
}
}
}
+46 -9
View File
@@ -1,5 +1,7 @@
using Microsoft.Xna.Framework;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -7,7 +9,21 @@ namespace CalamityMod.Dusts
{
public class SquashDust : ModDust
{
public static Asset<Texture2D> SolidCircle { get; private set; }
public static Asset<Texture2D> BloomCircle { get; private set; }
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void Load()
{
if (Main.dedServ)
return;
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -37,24 +53,45 @@ namespace CalamityMod.Dusts
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
return false;
}
}
public class SquashDustPixelated : SquashDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
// Glow Orb
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
}
+43 -8
View File
@@ -1,5 +1,7 @@
using Microsoft.Xna.Framework;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -7,7 +9,16 @@ namespace CalamityMod.Dusts
{
public class SquashDustHollow : ModDust
{
public static Asset<Texture2D> BloomRing { get; private set; }
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void Load()
{
if (!Main.dedServ)
BloomRing = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -36,25 +47,49 @@ namespace CalamityMod.Dusts
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn);
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
return false;
}
}
public class SquashDustHollowPixelated : SquashDustHollow
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn);
// Glow Orb
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
}
+21 -11
View File
@@ -1,13 +1,15 @@
using Microsoft.Xna.Framework;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class SquashDustTileTouch : ModDust
public class SquashDustTileTouch : SquashDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -16,12 +18,14 @@ namespace CalamityMod.Dusts
public override bool Update(Dust dust)
{
bool touchedTiles = false;
int size = (int)(2);
int size = 2;
if (Collision.SolidCollision(dust.position, size, size))
{
touchedTiles = true;
dust.velocity = Vector2.Zero;
}
float fadeSpeed = (dust.fadeIn + 1); // For this dust, fadeIn is used to increase the power of gravity if it's active, otherwise it makes it's lifetime change
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
dust.velocity *= 0.96f;
@@ -45,24 +49,30 @@ namespace CalamityMod.Dusts
return false;
}
}
public class SquashDustTileTouchPixelated : SquashDustTileTouch
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
return false;
}
}
}
+40 -7
View File
@@ -1,6 +1,8 @@
using System;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -8,7 +10,16 @@ namespace CalamityMod.Dusts
{
public class UnstableDust : ModDust
{
public static Asset<Texture2D> GlowStar { get; private set; }
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void Load()
{
if (!Main.dedServ)
GlowStar = ModContent.Request<Texture2D>("CalamityMod/Particles/FullStar");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -41,23 +52,45 @@ namespace CalamityMod.Dusts
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/FullStar").Value;
Vector2 squash = new Vector2(0.4f, 1);
float texScaling = 6;
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
}
return false;
}
}
public class UnstableDustPixelated : UnstableDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Vector2 squash = new Vector2(0.4f, 1);
float texScaling = 6;
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
}
}
}
}
+43 -6
View File
@@ -1,6 +1,9 @@
using System;
using CalamityMod.Enums;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -8,6 +11,19 @@ namespace CalamityMod.Dusts
{
public class VoidDust : ModDust
{
public static Asset<Texture2D> SolidCircle { get; private set; }
public static Asset<Texture2D> BloomCircle { get; private set; }
public override void Load()
{
if (Main.dedServ)
return;
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -28,20 +44,41 @@ namespace CalamityMod.Dusts
return true;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
if (!dust.noLight)
{
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
return false;
}
}
public class VoidDustPixelated : VoidDust
{
public override string Texture => "CalamityMod/Dusts/VoidDust";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
if (!dust.noLight)
{
// Glow Orb
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
}
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
+46 -11
View File
@@ -1,6 +1,9 @@
using System;
using CalamityMod.Enums;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -8,6 +11,22 @@ namespace CalamityMod.Dusts
{
public class VoidDustInverted : ModDust
{
public static Asset<Texture2D> SolidCircle { get; private set; }
public static Asset<Texture2D> BloomCircle { get; private set; }
public static Asset<Texture2D> SmallBloomCircle { get; private set; }
public override void Load()
{
if (Main.dedServ)
return;
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
SmallBloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom");
}
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
@@ -28,23 +47,39 @@ namespace CalamityMod.Dusts
return true;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
Texture2D bloom2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom").Value;
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(bloom2, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom2.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
if (!dust.noLight)
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
return false;
}
}
public class VoidDustInvertedPixelated : VoidDustInverted
{
public override string Texture => "CalamityMod/Dusts/VoidDustInverted";
public override bool PreDraw(Dust dust)
{
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
if (!dust.noLight)
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
namespace CalamityMod.Enums
{
/// <summary>
/// A general collection of points in Terraria's overall draw order that graphical systems in the mod draw to.
/// </summary>
[Flags]
public enum GeneralDrawLayer
{
BeforeAllTiles = 0,
BeforeSolidTiles = 1,
BeforeNPCs = 2,
AfterNPCs = 4,
BeforeProjectiles = 8,
AfterProjectiles = 16,
AfterPlayers = 32,
AfterDusts = 64,
AfterEverything = 128,
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

+2 -1
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -77,7 +78,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/BigRipLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => new Color(239, 111, 85) * 0.5f;
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -48,7 +49,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override Color EdgeColor => Color.Red with { A = 0 };
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -48,7 +49,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override Color EdgeColor => Color.Red with { A = 0 };
+2 -1
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -79,7 +80,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/BloodLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => new Color(67, 17, 17);
+2 -2
View File
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
namespace CalamityMod.Graphics.Metaballs
{
@@ -71,7 +71,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/CalamitasLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => Color.Lerp(Color.Crimson, Color.Black, 0f);
+2 -2
View File
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
namespace CalamityMod.Graphics.Metaballs
{
@@ -71,7 +71,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/CataclysmLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => new Color(255,0,229);
+2 -2
View File
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
namespace CalamityMod.Graphics.Metaballs
{
@@ -73,7 +73,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/CatastropheLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => new Color(0,255,255);
+2 -1
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using CalamityMod.Effects;
using CalamityMod.Enums;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Systems.Graphic;
using Microsoft.Xna.Framework;
@@ -33,7 +34,7 @@ namespace CalamityMod.Graphics.Metaballs
public static List<DistortionParticle> Particles { get; private set; } = [];
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override bool AnythingToDraw => Particles.Count > 0 || CalamityUtils.AnyProjectiles(ModContent.ProjectileType<DoGRiftCrack>());
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -68,7 +69,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override void Update()
{
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -68,7 +69,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override void Update()
{
+2 -1
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -56,7 +57,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs;
public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f);
+2 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -56,7 +57,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override Color EdgeColor => new(61, 6, 2);
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -33,7 +34,7 @@ namespace CalamityMod.Graphics.Metaballs
/// <summary>
/// The draw layer in which metaballs should be drawn.
/// </summary>
public abstract MetaballDrawLayer DrawContext
public abstract GeneralDrawLayer DrawLayer
{
get;
}
-9
View File
@@ -1,9 +0,0 @@
namespace CalamityMod.Graphics.Metaballs
{
public enum MetaballDrawLayer
{
BeforeNPCs,
BeforeProjectiles,
AfterProjectiles,
}
}
+6 -38
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -15,8 +16,6 @@ namespace CalamityMod.Graphics.Metaballs
{
// Prepare event subscribers.
RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareMetaballTargets;
On_Main.DrawProjectiles += DrawMetaballsAfterProjectiles;
On_Main.DrawNPCs += DrawMetaballsBeforeNPCs;
}
public override void OnModUnload()
@@ -86,51 +85,20 @@ namespace CalamityMod.Graphics.Metaballs
Main.spriteBatch.End();
}
private void DrawMetaballsAfterProjectiles(On_Main.orig_DrawProjectiles orig, Main self)
{
if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeProjectiles))
{
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
DrawMetaballs(MetaballDrawLayer.BeforeProjectiles);
Main.spriteBatch.End();
}
orig(self);
if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.AfterProjectiles))
{
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
DrawMetaballs(MetaballDrawLayer.AfterProjectiles);
Main.spriteBatch.End();
}
}
private void DrawMetaballsBeforeNPCs(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles)
{
if (!behindTiles && AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeNPCs))
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
DrawMetaballs(MetaballDrawLayer.BeforeNPCs);
Main.spriteBatch.ExitShaderRegion();
}
orig(self, behindTiles);
}
/// <summary>
/// Checks if a metaball of a given layering type is currently in use. This is used to minimize needless <see cref="SpriteBatch"/> restarts when there is nothing to draw.
/// </summary>
/// <param name="layerType">The metaball layer type to check against.</param>
internal static bool AnyActiveMetaballsAtLayer(MetaballDrawLayer layerType) =>
metaballs.Any(m => m.AnythingToDraw && m.DrawContext == layerType);
internal static bool AnyActiveMetaballsAtLayer(GeneralDrawLayer layerType) =>
metaballs.Any(m => m.AnythingToDraw && m.DrawLayer == layerType);
/// <summary>
/// Draws all metaballs of a given <see cref="MetaballDrawLayer"/>. Used for layer ordering reasons.
/// Draws all metaballs of a given <see cref="GeneralDrawLayer"/>. Used for layer ordering reasons.
/// </summary>
/// <param name="layerType">The layer type to draw with.</param>
public static void DrawMetaballs(MetaballDrawLayer layerType)
internal static void DrawMetaballs(GeneralDrawLayer layerType)
{
foreach (Metaball metaball in metaballs.Where(m => m.DrawContext == layerType && m.AnythingToDraw))
foreach (Metaball metaball in metaballs.Where(m => m.DrawLayer == layerType && m.AnythingToDraw))
{
for (int i = 0; i < metaball.LayerTargets.Count; i++)
{
+2 -1
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -64,7 +65,7 @@ namespace CalamityMod.Graphics.Metaballs
public override bool AnythingToDraw => Particles.Any();
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override IEnumerable<Texture2D> Layers
{
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Rarities;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -54,7 +54,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public Color sparkColor;
public int Time = 0;
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Rarities;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -54,7 +54,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public Color sparkColor;
public int Time;
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Rarities;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -47,7 +47,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public Color sparkColor;
public int Time = 0;
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Rarities;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -47,7 +47,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public Color sparkColor;
public int Time;
+2 -1
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Effects;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -44,7 +45,7 @@ namespace CalamityMod.Graphics.Metaballs
public override bool AnythingToDraw => Particles.Any();
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override IEnumerable<Texture2D> Layers
{
+2 -7
View File
@@ -1,18 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using CalamityMod.NPCs;
using CalamityMod.Enums;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Systems.Mechanic;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
using static CalamityMod.Systems.LavaRenderingSystem;
namespace CalamityMod.Graphics.Metaballs
{
@@ -82,7 +77,7 @@ namespace CalamityMod.Graphics.Metaballs
WavyLineLayer = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/ScalArenaLayerWave", AssetRequestMode.ImmediateLoad).Value;
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs;
public override Color EdgeColor => SupremeCalamitas.CurrentColor;
+2 -2
View File
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
namespace CalamityMod.Graphics.Metaballs
{
@@ -73,7 +73,7 @@ namespace CalamityMod.Graphics.Metaballs
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/SeekersLayer", AssetRequestMode.ImmediateLoad);
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => new Color(255,106,0);
+2 -2
View File
@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Metaballs
@@ -77,7 +77,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs;
public override void Load()
{
if (Main.dedServ)
+2 -3
View File
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Particles;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Metaballs
@@ -80,7 +79,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs;
public override void Load()
{
if (Main.dedServ)
+2 -2
View File
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Metaballs
@@ -56,7 +56,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles;
public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f);
+2 -1
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -26,7 +27,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles;
public override Color EdgeColor => Color.Lerp(Color.Purple, Color.Black, 0.75f);
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.Enums;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Graphics.Primitives
{
@@ -10,11 +11,11 @@ namespace CalamityMod.Graphics.Primitives
/// <summary>
/// The layer to render the primitive(s) to.
/// </summary>
PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles;
GeneralDrawLayer LayerToRenderTo => GeneralDrawLayer.BeforeProjectiles;
/// <summary>
/// Render primitives that use pixelation here.
/// </summary>
void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer);
void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer);
}
}
@@ -1,17 +0,0 @@
using System;
namespace CalamityMod.Graphics.Primitives
{
/// <summary>
/// Controls what layer the <see cref="IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives"/> renders to.
/// </summary>
[Flags]
public enum PixelationPrimitiveLayer
{
BeforeNPCs = 1,
AfterNPCs = 2,
BeforeProjectiles = 4,
AfterProjectiles = 8,
AfterPlayers = 16
}
}
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -10,6 +11,10 @@ namespace CalamityMod.Graphics.Primitives
public class PrimitivePixelationSystem : ModSystem
{
#region Fields/Properties
private static ManagedRenderTarget PixelationTarget_BeforeAllTiles;
private static ManagedRenderTarget PixelationTarget_BeforeSolidTiles;
private static ManagedRenderTarget PixelationTarget_BeforeNPCs;
private static ManagedRenderTarget PixelationTarget_AfterNPCs;
@@ -20,6 +25,10 @@ namespace CalamityMod.Graphics.Primitives
private static ManagedRenderTarget PixelationTarget_AfterPlayers;
private static ManagedRenderTarget PixelationTarget_AfterDusts;
private static ManagedRenderTarget PixelationTarget_AfterEverything;
private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, width / 2, height / 2);
/// <summary>
@@ -35,22 +44,38 @@ namespace CalamityMod.Graphics.Primitives
#region Loading
public override void Load()
{
On_Main.CheckMonoliths += DrawToTargets;
On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs;
On_Main.DrawProjectiles += DrawTarget_Projectiles;
On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players;
if (Main.dedServ)
return;
PixelationTarget_BeforeNPCs = new(true, CreatePixelTarget);
PixelationTarget_AfterNPCs = new(true, CreatePixelTarget);
PixelationTarget_BeforeProjectiles = new(true, CreatePixelTarget);
PixelationTarget_AfterProjectiles = new(true, CreatePixelTarget);
PixelationTarget_AfterPlayers = new(true, CreatePixelTarget);
Main.QueueMainThreadAction(() =>
{
PixelationTarget_BeforeAllTiles = new(true, CreatePixelTarget);
PixelationTarget_BeforeSolidTiles = new(true, CreatePixelTarget);
PixelationTarget_BeforeNPCs = new(true, CreatePixelTarget);
PixelationTarget_AfterNPCs = new(true, CreatePixelTarget);
PixelationTarget_BeforeProjectiles = new(true, CreatePixelTarget);
PixelationTarget_AfterProjectiles = new(true, CreatePixelTarget);
PixelationTarget_AfterPlayers = new(true, CreatePixelTarget);
PixelationTarget_AfterDusts = new(true, CreatePixelTarget);
PixelationTarget_AfterEverything = new(true, CreatePixelTarget);
});
On_Main.CheckMonoliths += DrawToTargets;
//On_Main.DrawBackgroundBlackFill += DrawTarget_BeforeAllTiles;
//On_Main.DoDraw_Tiles_Solid += DrawTarget_BeforeSolidTiles;
//On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs;
//On_Main.DrawProjectiles += DrawTarget_Projectiles;
//On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players;
//On_Main.DrawDust += DrawTarget_AfterDusts;
//On_Main.DrawInfernoRings += DrawTarget_AfterEverything;
}
public override void Unload()
{
if (Main.dedServ)
return;
On_Main.CheckMonoliths -= DrawToTargets;
On_Main.DoDraw_DrawNPCsOverTiles -= DrawTarget_NPCs;
}
#endregion
@@ -63,11 +88,15 @@ namespace CalamityMod.Graphics.Primitives
return;
}
var beforeAllTiles = new List<IPixelatedPrimitiveRenderer>();
var beforeSolidTiles = new List<IPixelatedPrimitiveRenderer>();
var beforeNPCs = new List<IPixelatedPrimitiveRenderer>();
var afterNPCs = new List<IPixelatedPrimitiveRenderer>();
var beforeProjectiles = new List<IPixelatedPrimitiveRenderer>();
var afterProjectiles = new List<IPixelatedPrimitiveRenderer>();
var afterPlayers = new List<IPixelatedPrimitiveRenderer>();
var afterDusts = new List<IPixelatedPrimitiveRenderer>();
var afterEverything = new List<IPixelatedPrimitiveRenderer>();
// Check every active projectile.
foreach (Projectile projectile in Main.ActiveProjectiles)
@@ -75,14 +104,24 @@ namespace CalamityMod.Graphics.Primitives
// If the projectile is active, a mod projectile, and uses the interface, add it to the list of primitives to draw this frame.
if (projectile.ModProjectile != null && projectile.ModProjectile is IPixelatedPrimitiveRenderer pixelPrimitiveProjectile)
{
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs))
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeAllTiles))
beforeAllTiles.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeSolidTiles))
beforeSolidTiles.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeNPCs))
beforeNPCs.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs))
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterNPCs))
afterNPCs.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles))
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeProjectiles))
beforeProjectiles.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers))
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterProjectiles))
afterProjectiles.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterPlayers))
afterPlayers.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterDusts))
afterDusts.Add(pixelPrimitiveProjectile);
if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterEverything))
afterEverything.Add(pixelPrimitiveProjectile);
}
}
@@ -92,24 +131,38 @@ namespace CalamityMod.Graphics.Primitives
// If the NPC is active, a mod NPC, and uses the interface, add it to the list of primitives to draw this frame.
if (npc.ModNPC != null && npc.ModNPC is IPixelatedPrimitiveRenderer pixelPrimitiveNPC)
{
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs))
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeAllTiles))
beforeAllTiles.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeSolidTiles))
beforeSolidTiles.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeNPCs))
beforeNPCs.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs))
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterNPCs))
afterNPCs.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles))
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeProjectiles))
beforeProjectiles.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers))
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterProjectiles))
afterProjectiles.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterPlayers))
afterPlayers.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterDusts))
afterDusts.Add(pixelPrimitiveNPC);
if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterEverything))
afterEverything.Add(pixelPrimitiveNPC);
}
}
CurrentlyRendering = true;
DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, PixelationPrimitiveLayer.BeforeNPCs, beforeNPCs);
DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, PixelationPrimitiveLayer.AfterNPCs, afterNPCs);
DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, PixelationPrimitiveLayer.BeforeProjectiles, beforeProjectiles);
DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, PixelationPrimitiveLayer.AfterProjectiles, afterProjectiles);
DrawPrimsToRenderTarget(PixelationTarget_AfterPlayers, PixelationPrimitiveLayer.AfterPlayers, afterPlayers);
DrawPrimsToRenderTarget(PixelationTarget_BeforeAllTiles, GeneralDrawLayer.BeforeAllTiles, beforeAllTiles);
DrawPrimsToRenderTarget(PixelationTarget_BeforeSolidTiles, GeneralDrawLayer.BeforeSolidTiles, beforeSolidTiles);
DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, GeneralDrawLayer.BeforeNPCs, beforeNPCs);
DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, GeneralDrawLayer.AfterNPCs, afterNPCs);
DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, GeneralDrawLayer.BeforeProjectiles, beforeProjectiles);
DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, GeneralDrawLayer.AfterProjectiles, afterProjectiles);
DrawPrimsToRenderTarget(PixelationTarget_AfterPlayers, GeneralDrawLayer.AfterPlayers, afterPlayers);
DrawPrimsToRenderTarget(PixelationTarget_AfterDusts, GeneralDrawLayer.AfterDusts, afterDusts);
DrawPrimsToRenderTarget(PixelationTarget_AfterEverything, GeneralDrawLayer.AfterEverything, afterEverything);
Main.instance.GraphicsDevice.SetRenderTarget(null);
@@ -117,7 +170,7 @@ namespace CalamityMod.Graphics.Primitives
orig();
}
private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, PixelationPrimitiveLayer layer, List<IPixelatedPrimitiveRenderer> pixelPrimitives)
private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, GeneralDrawLayer layer, List<IPixelatedPrimitiveRenderer> pixelPrimitives)
{
// Swap to the target regardless, in order to clear any leftover content from last frame. Not doing this results in the final frame lingering once it stops rendering.
renderTarget.SwapTo();
@@ -135,31 +188,31 @@ namespace CalamityMod.Graphics.Primitives
#endregion
#region Target Drawing
private void DrawTarget_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self)
internal static void DrawTargetScaled(GeneralDrawLayer drawLayer, bool startSpritebatch = true)
{
DrawTargetScaled(PixelationTarget_BeforeNPCs);
orig(self);
DrawTargetScaled(PixelationTarget_AfterNPCs);
if (startSpritebatch)
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Draw(ReturnAssociatedRenderTarget(drawLayer), Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
if (startSpritebatch)
Main.spriteBatch.End();
}
private void DrawTarget_Projectiles(On_Main.orig_DrawProjectiles orig, Main self)
private static RenderTarget2D ReturnAssociatedRenderTarget(GeneralDrawLayer drawLayer)
{
DrawTargetScaled(PixelationTarget_BeforeProjectiles);
orig(self);
DrawTargetScaled(PixelationTarget_AfterProjectiles);
}
private void DrawTarget_Players(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self)
{
orig(self);
DrawTargetScaled(PixelationTarget_AfterPlayers);
}
private static void DrawTargetScaled(ManagedRenderTarget target)
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Draw(target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
Main.spriteBatch.End();
return drawLayer switch
{
GeneralDrawLayer.BeforeAllTiles => PixelationTarget_BeforeAllTiles,
GeneralDrawLayer.BeforeSolidTiles => PixelationTarget_BeforeSolidTiles,
GeneralDrawLayer.BeforeNPCs => PixelationTarget_BeforeNPCs,
GeneralDrawLayer.AfterNPCs => PixelationTarget_AfterNPCs,
GeneralDrawLayer.BeforeProjectiles => PixelationTarget_BeforeProjectiles,
GeneralDrawLayer.AfterProjectiles => PixelationTarget_AfterProjectiles,
GeneralDrawLayer.AfterPlayers => PixelationTarget_AfterPlayers,
GeneralDrawLayer.AfterDusts => PixelationTarget_AfterDusts,
_ => PixelationTarget_AfterEverything
};
}
#endregion
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Graphics.Primitives
/// <item>The third controls how many points are created for the trail, and the fourth determines whether the primitive is subsequently rendered.</item>
/// </list>
/// If you wish to use pixelation, you <b>MUST</b> make the NPC/Projectile inherit <see cref="IPixelatedPrimitiveRenderer"/> and use <see cref="IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives"/> instead of predraw..<br/>
/// You can also optionally specify a render layer with <see cref="IPixelatedPrimitiveRenderer.LayerToRenderTo"/>. It is <see cref="PixelationPrimitiveLayer.BeforeNPCs"/> by default.
/// You can also optionally specify a render layer with <see cref="IPixelatedPrimitiveRenderer.LayerToRenderTo"/>. It is <see cref="Enums.GeneralDrawLayer.BeforeNPCs"/> by default.
/// </summary>
[Autoload(Side = ModSide.Client)]
public sealed class PrimitiveRenderer : ModSystem
+2 -1
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
@@ -14,7 +15,7 @@ namespace CalamityMod.Graphics.Renderers
/// <summary>
/// The layer that the target should be drawn at.
/// </summary>
public abstract DrawLayer Layer { get; }
public abstract GeneralDrawLayer Layer { get; }
/// <summary>
/// Whether the target should draw and be drawn to this frame.
@@ -1,4 +1,5 @@
using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses;
using CalamityMod.Enums;
using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -11,7 +12,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
{
#region Fields/Properties
public override DrawLayer Layer => DrawLayer.AfterEverything;
public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterEverything;
public static NPC Deerclops => Main.npc[NPC.deerclopsBoss];
@@ -1,4 +1,5 @@
using CalamityMod.NPCs;
using CalamityMod.Enums;
using CalamityMod.NPCs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -18,7 +19,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
private set;
}
public override DrawLayer Layer => DrawLayer.NPC;
public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterNPCs;
public override bool ShouldDraw => !Main.gameMenu && CalamityDrawParameterNPC.DoGDeathAnimationTimer > 0;
@@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.DataStructures;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -28,7 +29,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
private static List<IDyeableShaderRenderer> RenderersToDrawThisFrame;
public override DrawLayer Layer => DrawLayer.Player;
public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterPlayers;
// This ignores MainTarget, and handles its own targets, so always call the draw methods.
public override bool ShouldDraw => true;
@@ -1,4 +1,5 @@
using CalamityMod.NPCs;
using CalamityMod.Enums;
using CalamityMod.NPCs;
using CalamityMod.NPCs.Providence;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -13,7 +14,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
{
#region Fields/Properties
public override DrawLayer Layer => DrawLayer.BeforeTiles;
public override GeneralDrawLayer Layer => GeneralDrawLayer.BeforeAllTiles;
public static Providence Provi
{
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using CalamityMod.Enums;
using CalamityMod.NPCs;
using CalamityMod.NPCs.ExoMechs.Ares;
using Microsoft.Xna.Framework;
@@ -42,7 +43,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
private set;
}
public override DrawLayer Layer => DrawLayer.NPC;
public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterNPCs;
// Unsure whether its more performant to always draw, or to check if any NPC actually has the debuff.
public override bool ShouldDraw => true;
+16 -99
View File
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -24,16 +25,8 @@ namespace CalamityMod.Graphics.Renderers
if (Main.dedServ)
return;
Main.QueueMainThreadAction(() =>
{
// This hooks here, because doing it any sooner causes the screen position to be a frame behind.
On_Main.CheckMonoliths += DrawToTargets;
On_Main.DrawNPCs += DrawNPCRenderers;
On_Main.DrawProjectiles += DrawProjectileRenderers;
On_Main.DrawPlayers_AfterProjectiles += DrawPlayerRenderers;
On_Main.DrawBackgroundBlackFill += DrawBeforeTileRenderers;
On_Main.DrawInfernoRings += DrawAfterEverythingRenderers;
});
// This hooks here, because doing it any sooner causes the screen position to be a frame behind.
Main.QueueMainThreadAction(() => On_Main.CheckMonoliths += DrawToTargets);
}
public override void Unload()
@@ -43,24 +36,13 @@ namespace CalamityMod.Graphics.Renderers
// Clear the cached renderers, so they can be readded on mod loading when initialized.
Renderers.Clear();
Main.QueueMainThreadAction(() =>
{
// Supposed to be auto-unloaded, but considering TMods poor track record with actually doing this, manually unload them.
On_Main.CheckMonoliths -= DrawToTargets;
On_Main.DrawNPCs -= DrawNPCRenderers;
On_Main.DrawProjectiles -= DrawProjectileRenderers;
On_Main.DrawPlayers_AfterProjectiles -= DrawPlayerRenderers;
On_Main.DrawBackgroundBlackFill -= DrawBeforeTileRenderers;
On_Main.DrawInfernoRings -= DrawAfterEverythingRenderers;
});
}
#endregion
#region Updating
public override void PreUpdateEntities()
{
if (Main.netMode is NetmodeID.Server)
if (Main.dedServ)
return;
foreach (var renderer in Renderers)
@@ -69,7 +51,7 @@ namespace CalamityMod.Graphics.Renderers
public override void PostUpdateEverything()
{
if (Main.netMode is NetmodeID.Server)
if (Main.dedServ)
return;
foreach (var renderer in Renderers)
@@ -78,6 +60,17 @@ namespace CalamityMod.Graphics.Renderers
#endregion
#region Drawing
internal static void DrawRendererAtLayer(GeneralDrawLayer drawLayer)
{
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer == drawLayer);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
private void DrawToTargets(On_Main.orig_CheckMonoliths orig)
{
orig();
@@ -106,82 +99,6 @@ namespace CalamityMod.Graphics.Renderers
Main.instance.GraphicsDevice.SetRenderTarget(null);
}
private void DrawNPCRenderers(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles)
{
orig(self, behindTiles);
if (behindTiles)
return;
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.NPC);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.ExitShaderRegion();
}
private void DrawProjectileRenderers(On_Main.orig_DrawProjectiles orig, Main self)
{
orig(self);
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Projectile);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
private void DrawPlayerRenderers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self)
{
orig(self);
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Player);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
private void DrawBeforeTileRenderers(On_Main.orig_DrawBackgroundBlackFill orig, Main self)
{
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.BeforeTiles);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform);
orig(self);
}
private void DrawAfterEverythingRenderers(On_Main.orig_DrawInfernoRings orig, Main self)
{
var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.AfterEverything);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
foreach (var renderer in renderers)
renderer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform);
orig(self);
}
#endregion
}
}
+9 -2
View File
@@ -43,7 +43,6 @@ namespace CalamityMod.ILEditing
IL_Main.DoDraw += CustomDoDrawChanges;
On_Main.DrawCursor += UseCoolFireCursorEffect;
On_Main.SortDrawCacheWorms += DrawFusableParticles;
On_Main.DrawInfernoRings += DrawForegroundParticles;
On_TileDrawing.Draw += ClearTilePings;
On_CommonCode.ModifyItemDropFromNPC += ColorBlightedGel;
On_MoonlordDeathDrama.RequestLight += DisableFlashesWithPhotosensitivityConfig;
@@ -59,6 +58,15 @@ namespace CalamityMod.ILEditing
IL_TileDrawing.DrawTrees += DrawTreeGlowMask;
On_TileDrawing.DrawBasicTile += DrawTreeTrunkAndCactusGlowMask;
// Graphics (GeneralDrawLayer detours)
On_Main.DrawBackgroundBlackFill += GeneralDrawLayer_DrawToLayer_BeforeAllTiles;
On_Main.DoDraw_Tiles_Solid += GeneralDrawLayer_DrawToLayer_BeforeSolidTiles;
On_Main.DoDraw_DrawNPCsOverTiles += GeneralDrawLayer_DrawToLayer_NPCs;
On_Main.DrawProjectiles += GeneralDrawLayer_DrawToLayer_Projectiles;
On_Main.DrawPlayers_AfterProjectiles += GeneralDrawLayer_DrawToLayer_AfterPlayers;
On_Main.DrawDust += GeneralDrawLayer_DrawToLayer_AfterDusts;
On_Main.DrawInfernoRings += GeneralDrawLayer_DrawToLayer_AfterEverything;
// NPC behavior
IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning;
On_Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate;
@@ -87,7 +95,6 @@ namespace CalamityMod.ILEditing
On_Item.GetShimmered += ShimmerEffectEdits;
On_Player.Teleport += TPOverride;
On_TileDrawing.DrawSingleTile += GlowMaskTileRender;
On_Main.DoUpdate_HandleChat += SpawnPunchCard;
On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse;
On_Player.ItemCheck_ReleaseCritter += ReleaseCritterVariant;
On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck;
+80 -41
View File
@@ -8,6 +8,9 @@ using CalamityMod.DataStructures;
using CalamityMod.Enums;
using CalamityMod.Events;
using CalamityMod.FluidSimulation;
using CalamityMod.Graphics.Metaballs;
using CalamityMod.Graphics.Primitives;
using CalamityMod.Graphics.Renderers;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
using CalamityMod.Items.Armor.Wulfrum;
@@ -26,6 +29,7 @@ using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Systems;
using CalamityMod.Systems.Graphic.PixelationSystem;
using CalamityMod.Systems.Mechanic;
using CalamityMod.Tiles;
using CalamityMod.Walls;
@@ -73,42 +77,6 @@ namespace CalamityMod.ILEditing
//private static readonly MethodInfo textureGetValueMethod = typeof(Asset<Texture2D>).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance);
#region Punch Card Spawning Command
private static void SpawnPunchCard(On_Main.orig_DoUpdate_HandleChat orig)
{
// Any of these conditions should result in normal behaviour
if (!Main.drawingPlayerChat || Main.CurrentInputTextTakerOverride != null || Main.editSign || PlayerInput.UsingGamepad)
{
orig();
return;
}
// Allow only one pick up of the card this way per player (also don't give it to dead people)
Player player = Main.LocalPlayer;
if (player.Calamity().spawnedPunchCard || player.dead || !player.active)
{
orig();
return;
}
// Find 2 specific sets of text from the live chat box (as the player is typing)
// Gives the item to you and abruptly shuts the chat box down if both parts are found
string text = Main.chatText.ToLower();
string prefix = "Items.Accessories.PunchCard.SpawnText";
if ((text.Contains(CalamityUtils.GetTextValue($"{prefix}1")) || text.Contains(CalamityUtils.GetTextValue($"{prefix}1Alt"))) && text.Contains(CalamityUtils.GetTextValue($"{prefix}2")))
{
player.QuickSpawnItem(Player.GetSource_None(), ModContent.ItemType<PunchCard>(), 1);
player.Calamity().spawnedPunchCard = true;
Main.chatText = "";
Main.ClosePlayerChat();
Main.chatRelease = false;
SoundEngine.PlaySound(SoundID.MenuClose);
return;
}
orig();
}
#endregion
#region Dash Fixes and Improvements
private static void MakeShieldSlamIFramesConsistent(ILContext il)
{
@@ -908,6 +876,82 @@ namespace CalamityMod.ILEditing
}
#endregion
#region GeneralDrawLayer Systems Drawing
private static void GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer drawLayer)
{
Main.spriteBatch.SafeAction(() =>
{
Main.spriteBatch.TryEnd();
GeneralParticleHandler.DrawParticleCollectionsAtSpecificLayer(drawLayer);
});
Main.spriteBatch.SafeAction(() =>
{
Main.spriteBatch.TryEnd();
Main.spriteBatch.TryBegin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
MetaballManager.DrawMetaballs(drawLayer);
});
Main.spriteBatch.SafeAction(() =>
{
Main.spriteBatch.TryEnd();
PrimitivePixelationSystem.DrawTargetScaled(drawLayer);
});
PixelationManager.DrawPixelatedTargets(drawLayer);
Main.spriteBatch.SafeAction(() =>
{
Main.spriteBatch.TryEnd();
RendererManager.DrawRendererAtLayer(drawLayer);
});
}
private static void GeneralDrawLayer_DrawToLayer_BeforeAllTiles(On_Main.orig_DrawBackgroundBlackFill orig, Main self)
{
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeAllTiles);
orig(self);
}
private static void GeneralDrawLayer_DrawToLayer_BeforeSolidTiles(On_Main.orig_DoDraw_Tiles_Solid orig, Main self)
{
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeSolidTiles);
orig(self);
}
private static void GeneralDrawLayer_DrawToLayer_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self)
{
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeNPCs);
orig(self);
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterNPCs);
}
private static void GeneralDrawLayer_DrawToLayer_Projectiles(On_Main.orig_DrawProjectiles orig, Main self)
{
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeProjectiles);
orig(self);
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterProjectiles);
}
private static void GeneralDrawLayer_DrawToLayer_AfterPlayers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self)
{
orig(self);
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterPlayers);
}
private static void GeneralDrawLayer_DrawToLayer_AfterDusts(On_Main.orig_DrawDust orig, Main self)
{
orig(self);
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterDusts);
}
private static void GeneralDrawLayer_DrawToLayer_AfterEverything(On_Main.orig_DrawInfernoRings orig, Main self)
{
orig(self);
GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterEverything);
}
#endregion
#region General Particle Rendering
private static void DrawFusableParticles(On_Main.orig_SortDrawCacheWorms orig, Main self)
{
@@ -919,11 +963,6 @@ namespace CalamityMod.ILEditing
orig(self);
}
private static void DrawForegroundParticles(On_Main.orig_DrawInfernoRings orig, Main self)
{
GeneralParticleHandler.DrawAllParticles(Main.spriteBatch);
orig(self);
}
#endregion
#region Disable Moon Lord Style Flashes With Photosensitivity Config
+6 -1
View File
@@ -1,5 +1,6 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -9,7 +10,11 @@ namespace CalamityMod.Items.Accessories
{
public new string LocalizationCategory => "Items.Accessories";
public static int CritBoost = 8;
public static float BrimstoneFlamesReduction = 0.5f;
public static int AbaddonExploDamage = 25;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, BrimstoneFlamesReduction.ToPercent());
public override void SetDefaults()
{
Item.width = 26;
@@ -22,7 +27,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().abaddon = true;
player.GetCritChance<GenericDamageClass>() += 8;
player.GetCritChance<GenericDamageClass>() += CritBoost;
}
}
}
+10 -3
View File
@@ -3,6 +3,7 @@ using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -11,6 +12,12 @@ namespace CalamityMod.Items.Accessories
{
public new string LocalizationCategory => "Items.Accessories";
public bool HasFlavorTooltip => true;
public static int AggroReduction = 450;
public static float StandingStealthRegenBoost = 0.25f;
public static float MovingStealthRegenBoost = 0.12f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandingStealthRegenBoost.ToPercent(), MovingStealthRegenBoost.ToPercent());
public override void SetDefaults()
{
Item.width = 30;
@@ -23,10 +30,10 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.stealthGenStandstill += 0.25f;
modPlayer.stealthGenMoving += 0.12f;
modPlayer.stealthGenStandstill += StandingStealthRegenBoost;
modPlayer.stealthGenMoving += MovingStealthRegenBoost;
modPlayer.abyssalMirror = true;
player.aggro -= 450;
player.aggro -= AggroReduction;
}
public override void AddRecipes()
+5 -1
View File
@@ -4,6 +4,7 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -12,6 +13,9 @@ namespace CalamityMod.Items.Accessories
{
public new string LocalizationCategory => "Items.Accessories";
public static int FlightTimeBoostFlat = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoostFlat.FramesToSeconds());
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 8));
@@ -30,7 +34,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().aeroStone = true;
player.wingTimeMax += 50;
player.wingTimeMax += FlightTimeBoostFlat;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
+10
View File
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -12,6 +13,14 @@ namespace CalamityMod.Items.Accessories
public class Affliction : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int RegenBoost = 1;
public static int MaxLifeBoostPercent = 10;
public static float DamageReductionBoost = 0.07f;
public static int DefenseBoost = 9;
public static float DamageBoost = 0.1f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), MaxLifeBoostPercent, DamageReductionBoost.ToPercent(), DefenseBoost, DamageBoost.ToPercent());
public override void SetDefaults()
{
Item.width = 38;
@@ -19,6 +28,7 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
Item.rare = ModContent.RarityType<PureGreen>();
Item.expert = true;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
+5
View File
@@ -3,6 +3,7 @@ using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -10,6 +11,10 @@ namespace CalamityMod.Items.Accessories
public class AlchemicalFlask : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static float PlagueReduction = 0.5f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PlagueReduction.ToPercent());
public override void SetDefaults()
{
Item.width = 26;
+6 -1
View File
@@ -1,5 +1,6 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -7,6 +8,10 @@ namespace CalamityMod.Items.Accessories
public class AlluringBait : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int FishingPowerBoost = 10;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBoost);
public override void SetDefaults()
{
Item.width = 26;
@@ -19,7 +24,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().alluringBait = true;
player.fishingSkill += 10;
player.fishingSkill += FishingPowerBoost;
}
}
}
+5 -1
View File
@@ -4,6 +4,7 @@ using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Projectiles.Magic;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -12,7 +13,9 @@ namespace CalamityMod.Items.Accessories
{
public new string LocalizationCategory => "Items.Accessories";
public static float DamageBoost = 0.05f;
public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(18);
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent());
public override void SetDefaults()
{
@@ -21,6 +24,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
@@ -29,7 +33,7 @@ namespace CalamityMod.Items.Accessories
modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit
modPlayer.aBrain = true;
player.brainOfConfusionItem = Item;
player.GetDamage<GenericDamageClass>() += 0.05f;
player.GetDamage<GenericDamageClass>() += DamageBoost;
}
public override void AddRecipes()
+6 -1
View File
@@ -4,6 +4,7 @@ using CalamityMod.Items.Materials;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -11,6 +12,10 @@ namespace CalamityMod.Items.Accessories
public class AmbrosialAmpoule : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int MaxLifeBoost = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, RadiantOoze.MinRegenBoost.ToRegenPerSecond(), RadiantOoze.MaxRegenBoost.ToRegenPerSecond());
public override void SetDefaults()
{
Item.width = 20;
@@ -23,7 +28,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
player.statLifeMax2 += 50;
player.statLifeMax2 += MaxLifeBoost;
if (!player.HasBuff(BuffID.Honey))
player.AddBuff(BuffID.Honey, 2);
+6 -1
View File
@@ -1,5 +1,6 @@
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -7,6 +8,10 @@ namespace CalamityMod.Items.Accessories
public class AncientFossil : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static float MiningSpeedBoost = 0.1f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MiningSpeedBoost.ToPercent());
public override void SetDefaults()
{
Item.width = 26;
@@ -18,7 +23,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.pickSpeed -= 0.1f;
player.pickSpeed -= MiningSpeedBoost;
player.Calamity().aFossil = true;
player.Calamity().fallingBlockProtection = true;
}
+17 -4
View File
@@ -6,6 +6,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -16,6 +17,18 @@ namespace CalamityMod.Items.Accessories
public new string LocalizationCategory => "Items.Accessories";
public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AngelicAllianceActivation");
// This accessory is insane. wtf. - Iris
public static int MinionSlotBoost = 2;
public static float TotalSummonDamageBoost = 0.15f; // this is partially all-class -- this number represents the whole thing
public static float DamageBoost = 0.08f;
public static int RegenBoostDuringFlight = 4;
public static int DivineBlessDuration = CalamityUtils.SecondsToFrames(15);
public static int DivineBlessCooldown = CalamityUtils.SecondsToFrames(60);
public static int HealPerAngelSpawned = 2;
public static int BanishingFireDuration = CalamityUtils.SecondsToFrames(1);
public static int DivineBlessFramesPerHeal = 15;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, TotalSummonDamageBoost.ToPercent(), DamageBoost.ToPercent(), RegenBoostDuringFlight.ToRegenPerSecond(), DivineBlessDuration.FramesToSeconds(), HealPerAngelSpawned, (60 / (float)DivineBlessFramesPerHeal).Round(), (DivineBlessCooldown / 3600f).Round());
public override void SetDefaults()
{
Item.width = 56;
@@ -32,11 +45,11 @@ namespace CalamityMod.Items.Accessories
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.angelicAlliance = true;
player.GetDamage<GenericDamageClass>() += 0.08f;
player.GetDamage<SummonDamageClass>() += 0.07f; //7% + 8% = 15%
player.maxMinions += 2;
player.GetDamage<GenericDamageClass>() += DamageBoost;
player.GetDamage<SummonDamageClass>() += TotalSummonDamageBoost - DamageBoost;
player.maxMinions += MinionSlotBoost;
if (player.wingTime < player.wingTimeMax)
player.lifeRegen += 4;
player.lifeRegen += RegenBoostDuringFlight;
}
public override void AddRecipes()
+8
View File
@@ -1,6 +1,7 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -8,6 +9,12 @@ namespace CalamityMod.Items.Accessories
public class AquaticEmblem : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int MaxDefenseBoost = 20;
public static float MaxMoveSpeedReduction = 0.1f;
public static int TimeToReachMaxBoost = CalamityUtils.SecondsToFrames(10);
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(TimeToReachMaxBoost.FramesToSeconds(), MaxDefenseBoost, MaxMoveSpeedReduction.ToPercent());
public override void SetDefaults()
{
Item.width = 18;
@@ -15,6 +22,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+4 -1
View File
@@ -3,6 +3,7 @@ using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -14,6 +15,8 @@ namespace CalamityMod.Items.Accessories
public static float WaterSpeedBoost = 0.15f;
public static float IceShieldDamageReductionBoost = 0.2f;
public static int IceShieldCooldown = CalamityUtils.SecondsToFrames(30);
public static LocalizedText FullTooltip => CalamityUtils.GetText("Items.Accessories.AquaticHeart.FullTooltip").WithFormatArgs(WaterSpeedBoost.ToPercent(), IceShieldDamageReductionBoost.ToPercent(), IceShieldCooldown.FramesToSeconds());
public override string AssetPath => "CalamityMod/Items/Accessories/";
public override (EquipType, string, string)[] EquipSlots =>
@@ -39,7 +42,7 @@ namespace CalamityMod.Items.Accessories
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
string statusTooltip = this.GetLocalizedValue(NPC.downedBoss3 ? "FullTooltip" : "LockedTooltip");
string statusTooltip = NPC.downedBoss3 ? FullTooltip.ToString() : this.GetLocalizedValue("LockedTooltip");
tooltips.FindAndReplace("[STATUS]", statusTooltip);
}
}
+7
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -11,6 +12,11 @@ namespace CalamityMod.Items.Accessories
public class ArcFlashRing : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static int LightningSpawnPercent = 6;
public static float LightningDamageMult = 4f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LightningSpawnPercent, LightningDamageMult);
public override void SetDefaults()
{
Item.width = 56;
@@ -18,6 +24,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+8 -2
View File
@@ -2,6 +2,7 @@
using CalamityMod.Items.Placeables.Crags;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -9,6 +10,11 @@ namespace CalamityMod.Items.Accessories
public class ArchaicPowder : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static float MiningSpeedBoost = 0.25f;
public static float TrapDamageReduction = 0.65f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MiningSpeedBoost.ToPercent(), TrapDamageReduction.ToPercent());
public override void SetDefaults()
{
Item.width = 56;
@@ -20,7 +26,7 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.pickSpeed -= 0.25f;
player.pickSpeed -= MiningSpeedBoost;
player.Calamity().aPowder = true;
player.Calamity().fallingBlockProtection = true;
player.Calamity().trapProtection = true;
@@ -29,7 +35,7 @@ namespace CalamityMod.Items.Accessories
if (player.chiselSpeed)
player.pickSpeed += 0.15f;
if (player.Calamity().aFossil)
player.pickSpeed += 0.1f;
player.pickSpeed += AncientFossil.MiningSpeedBoost;
}
public override void AddRecipes()
+14 -2
View File
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Ores;
using CalamityMod.Rarities;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
@@ -15,6 +16,16 @@ namespace CalamityMod.Items.Accessories
public class AscendantInsignia : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
// These values override Soaring Insignia's
public static double FlightTimeBoost = 0.5D;
public static float MoveSpeedBoost = 0.15f;
public static float JumpSpeedBoost = 0.75f; // NOTE: Tooltip shares this number with move speed % as they're equal
public static float AccelerationBoost = 0.5f;
public static int AbilityDuration = CalamityUtils.SecondsToFrames(4);
public static int AbilityCooldown = CalamityUtils.SecondsToFrames(40);
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoost.ToPercent(), MoveSpeedBoost.ToPercent(), (1f + AccelerationBoost).Round(), AbilityDuration.FramesToSeconds(), AbilityCooldown.FramesToSeconds());
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.AscendantInsigniaHotKey);
public override void SetDefaults()
{
@@ -23,6 +34,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
Item.accessory = true;
Item.rare = ModContent.RarityType<PureGreen>();
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
@@ -30,8 +42,8 @@ namespace CalamityMod.Items.Accessories
CalamityPlayer modPlayer = player.Calamity();
modPlayer.ascendantInsignia = true;
player.empressBrooch = true;
player.moveSpeed += 0.05f;
player.jumpSpeedBoost += 0.25f;
player.moveSpeed += MoveSpeedBoost;
player.jumpSpeedBoost += JumpSpeedBoost - 0.5f;
}
public override void AddRecipes()
+1
View File
@@ -35,6 +35,7 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories
Item.rare = ItemRarityID.Yellow;
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -17,6 +17,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -33,6 +33,7 @@ namespace CalamityMod.Items.Accessories
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateVanity(Player player)
@@ -43,6 +43,7 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
Item.rare = ModContent.RarityType<CosmicPurple>();
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -45,6 +45,7 @@ namespace CalamityMod.Items.Accessories
Item.defense = 20;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -28,6 +28,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -26,6 +26,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityCyanBuyPrice;
Item.rare = ItemRarityID.Cyan;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
@@ -21,6 +21,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
Item.accessory = true;
Item.rare = ItemRarityID.Lime;
Item.expert = true;
}
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.GravistarSabatonHotkey);
+1
View File
@@ -18,6 +18,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
Item.accessory = true;
Item.rare = ItemRarityID.Lime;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
+1
View File
@@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
Item.rare = ModContent.RarityType<CosmicPurple>();
Item.expert = true;
}
public override void Update(ref float gravity, ref float maxFallSpeed)
+1
View File
@@ -15,6 +15,7 @@ namespace CalamityMod.Items.Accessories
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
Item.accessory = true;
Item.expert = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
Loaded 100 of 246 files, more files were not shown because too many files have changed in this diff. Show more