Merge branch 'master' into br-visuals

This commit is contained in:
Dominic committed 2021-06-29 08:04:05 -05:00
commit c75d9f92ca
143 files changed
+4031 -101

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Cooldowns
{
public class Withered : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Withered");
Description.SetDefault("Holding withered weapons causes you to suffer but makes your weapons strong");
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
longerExpertDebuff = false;
canBeCleared = false;
}
public override void Update(Player player, ref int buffIndex) => player.Calamity().witheredDebuff = true;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

+1 -4
View File
@@ -16,10 +16,7 @@ namespace CalamityMod.Buffs.DamageOverTime
canBeCleared = false;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().vHex = true;
}
public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true;
public override void Update(NPC npc, ref int buffIndex)
{
@@ -0,0 +1,21 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.DamageOverTime
{
public class WeakBrimstoneFlames : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Weak Brimstone Flames");
Description.SetDefault("Health loss");
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = true;
longerExpertDebuff = false;
}
public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.Summon;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class SepulcherMinionBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Sepulcher");
Description.SetDefault("It is not benevolent");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
//Main.persistentBuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<SepulcherMinion>()] > 0)
modPlayer.sepulcher = true;
if (!modPlayer.sepulcher)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

+93 -4
View File
@@ -31,6 +31,7 @@ using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.GreatSandShark;
using CalamityMod.NPCs.Leviathan;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Other;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.Polterghast;
@@ -122,6 +123,7 @@ namespace CalamityMod.CalPlayer
public bool ableToDrawBlazingMouse = false;
public float blazingMouseAuraFade = 0f;
public float GeneralScreenShakePower = 0f;
public bool GivenBrimstoneLocus = false;
#endregion
#region Tile Entity Trackers
@@ -161,6 +163,7 @@ namespace CalamityMod.CalPlayer
public bool newCirrusInventory = false;
public bool newAmidiasInventory = false;
public bool newBanditInventory = false;
public bool newCalamitasInventory = false;
#endregion
#region Stat Meter
@@ -724,6 +727,7 @@ namespace CalamityMod.CalPlayer
public bool aCrunch = false;
public bool irradiated = false;
public bool bFlames = false;
public bool weakBrimstoneFlames = false;
public bool aFlames = false;
public bool gsInferno = false;
public bool astralInfection = false;
@@ -937,6 +941,7 @@ namespace CalamityMod.CalPlayer
public bool plaguebringerPatronSummon = false;
public bool howlTrio = false;
public bool mountedScanner = false;
public bool sepulcher = false;
public bool daedalusGolem = false;
public bool deathstareEyeball = false;
public bool witherBlossom = false;
@@ -1021,6 +1026,27 @@ namespace CalamityMod.CalPlayer
public bool omegaBlueTransformationPower;
#endregion
#region Calamitas Enchant Effects
public bool cursedSummonsEnchant = false;
public bool flamingItemEnchant = false;
public bool lifeManaEnchant = false;
public bool farProximityRewardEnchant = false;
public bool closeProximityRewardEnchant = false;
public bool dischargingItemEnchant = false;
public bool explosiveMinionsEnchant = false;
public bool bladeArmEnchant = false;
public bool manaMonsterEnchant = false;
public bool witheringWeaponEnchant = false;
public bool witheredDebuff = false;
public int witheredWeaponHoldTime = 0;
public bool persecutedEnchant = false;
public int persecutedEnchantSummonTimer = 0;
public bool lecherousOrbEnchant = false;
#endregion Calamitas Enchant Effects
#endregion
#region SavingAndLoading
@@ -1068,6 +1094,7 @@ namespace CalamityMod.CalPlayer
newCirrusInventory = false;
newAmidiasInventory = false;
newBanditInventory = false;
newCalamitasInventory = false;
}
public override TagCompound Save()
@@ -1116,6 +1143,8 @@ namespace CalamityMod.CalPlayer
boost.AddWithCondition("newCirrusInventory", newCirrusInventory);
boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory);
boost.AddWithCondition("newBanditInventory", newBanditInventory);
boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory);
boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus);
return new TagCompound
{
@@ -1191,6 +1220,8 @@ namespace CalamityMod.CalPlayer
newCirrusInventory = boost.Contains("newCirrusInventory");
newAmidiasInventory = boost.Contains("newAmidiasInventory");
newBanditInventory = boost.Contains("newBanditInventory");
newCalamitasInventory = boost.Contains("newCalamitasInventory");
GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus");
// Load rage from "stress" if this is an older save. Otherwise load it from "rage", its new name.
if (tag.ContainsKey("stress"))
@@ -1324,8 +1355,9 @@ namespace CalamityMod.CalPlayer
BitsByte flags6 = reader.ReadByte();
newBanditInventory = flags6[0];
finalTierAccessoryReforge = flags6[1];
}
finalTierAccessoryReforge = flags6[1];
newCalamitasInventory = flags6[2];
}
else
{
ModContent.GetInstance<CalamityMod>().Logger.Error("Unknown loadVersion: " + loadVersion);
@@ -1755,6 +1787,7 @@ namespace CalamityMod.CalPlayer
aCrunch = false;
irradiated = false;
bFlames = false;
weakBrimstoneFlames = false;
aFlames = false;
gsInferno = false;
astralInfection = false;
@@ -1973,6 +2006,7 @@ namespace CalamityMod.CalPlayer
plaguebringerPatronSummon = false;
howlTrio = false;
mountedScanner = false;
sepulcher = false;
daedalusGolem = false;
deathstareEyeball = false;
witherBlossom = false;
@@ -2007,9 +2041,23 @@ namespace CalamityMod.CalPlayer
RageDuration = DefaultRageDuration;
RageDamageBoost = DefaultRageDamageBoost;
cursedSummonsEnchant = false;
flamingItemEnchant = false;
lifeManaEnchant = false;
farProximityRewardEnchant = false;
closeProximityRewardEnchant = false;
dischargingItemEnchant = false;
explosiveMinionsEnchant = false;
bladeArmEnchant = false;
manaMonsterEnchant = false;
witheringWeaponEnchant = false;
persecutedEnchant = false;
lecherousOrbEnchant = false;
flatStealthLossReduction = 0;
lastProjectileHit = null;
CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem());
}
#endregion
@@ -2119,6 +2167,7 @@ namespace CalamityMod.CalPlayer
aCrunch = false;
irradiated = false;
bFlames = false;
weakBrimstoneFlames = false;
aFlames = false;
gsInferno = false;
astralInfection = false;
@@ -2413,6 +2462,7 @@ namespace CalamityMod.CalPlayer
animusBoost = 1f;
potionTimer = 0;
bloodflareCoreLostDefense = 0;
persecutedEnchantSummonTimer = 0;
if (BossRushEvent.BossRushActive)
{
@@ -4410,7 +4460,7 @@ namespace CalamityMod.CalPlayer
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed.");
}
if (bFlames || aFlames)
if (bFlames || aFlames || weakBrimstoneFlames)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames.");
}
@@ -4556,7 +4606,7 @@ namespace CalamityMod.CalPlayer
else
acidRoundMultiplier = 1D;
//Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me
// Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me
if (desertProwler && (item.ranged || item.type == ModContent.ItemType<PrismaticBreaker>()) && item.ammo == AmmoID.None)
flat += 1f;
}
@@ -6871,6 +6921,9 @@ namespace CalamityMod.CalPlayer
#region Shoot
public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (bladeArmEnchant)
return false;
if (rottenDogTooth && item.Calamity().rogue && item.type != ModContent.ItemType<SylvanSlasher>())
damage = (int)(damage * (1f + RottenDogtooth.StealthStrikeDamageMultiplier));
@@ -7305,6 +7358,15 @@ namespace CalamityMod.CalPlayer
if (player.whoAmI == Main.myPlayer)
{
// Summon a portal if needed.
if (player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
{
Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
int portal = NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, ModContent.NPCType<DemonPortal>());
if (Main.npc.IndexInRange(portal))
Main.npc[portal].target = player.whoAmI;
}
if (revivify)
{
int healAmt = (int)(damage / 15D);
@@ -10666,5 +10728,32 @@ namespace CalamityMod.CalPlayer
}
#endregion
#region Mana Consumption Effects
public override void OnConsumeMana(Item item, int manaConsumed)
{
CalamityPlayer modPlayer = player.Calamity();
if (Main.rand.NextBool(4) && modPlayer.lifeManaEnchant)
{
if (Main.myPlayer == player.whoAmI)
{
player.HealEffect(-5);
player.statLife -= 5;
if (player.statLife <= 0)
player.KillMe(PlayerDeathReason.ByCustomReason($"{player.name} converted all of their life to mana."), 1000, -1);
}
for (int i = 0; i < 8; i++)
{
Dust life = Dust.NewDustPerfect(player.Top + Main.rand.NextVector2Circular(player.width * 0.5f, 6f), 267);
life.color = Color.Red;
life.velocity = -Vector2.UnitY.RotatedByRandom(0.48f) * Main.rand.NextFloat(3f, 4.4f);
life.scale = Main.rand.NextFloat(1.5f, 1.72f);
life.fadeIn = 0.7f;
life.noGravity = true;
}
}
}
#endregion
}
}
+32 -2
View File
@@ -2,10 +2,10 @@ using CalamityMod.Buffs.Alcohol;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
@@ -95,6 +95,15 @@ namespace CalamityMod.CalPlayer
lifeRegenLost += 16;
}
if (modPlayer.weakBrimstoneFlames)
{
if (player.lifeRegen > 0)
player.lifeRegen = 0;
player.lifeRegenTime = 0;
lifeRegenLost += 5;
}
if (modPlayer.bFlames)
{
if (player.lifeRegen > 0)
@@ -400,7 +409,23 @@ namespace CalamityMod.CalPlayer
if (player.lifeRegen > 0)
player.lifeRegen = 0;
lifeRegenLost += 42; //the meaning of death
}
}
if (modPlayer.witheredDebuff)
{
modPlayer.witheredWeaponHoldTime += modPlayer.witheringWeaponEnchant.ToDirectionInt();
if (modPlayer.witheredWeaponHoldTime < 0)
{
modPlayer.witheredWeaponHoldTime = 0;
}
else
{
lifeRegenLost += (int)(4D * Math.Pow(1.5D, modPlayer.witheredWeaponHoldTime / 87D));
if (player.lifeRegen > 0)
player.lifeRegen = 0;
}
}
else
modPlayer.witheredWeaponHoldTime = 0;
player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult);
@@ -653,6 +678,11 @@ namespace CalamityMod.CalPlayer
player.lifeRegenTime += 1;
player.lifeRegen += 2;
}
else if (modPlayer.rOoze)
{
if (!Main.dayTime)
player.lifeRegen += 4;
}
if (modPlayer.ursaSergeant)
{
+62 -2
View File
@@ -7,6 +7,7 @@ using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.Summon;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor;
using CalamityMod.Items.Fishing.AstralCatches;
@@ -21,6 +22,7 @@ using CalamityMod.NPCs.AcidRain;
using CalamityMod.NPCs.Astral;
using CalamityMod.NPCs.Crags;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Other;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Projectiles.Boss;
@@ -116,6 +118,11 @@ namespace CalamityMod.CalPlayer
// Potions (Quick Buff && Potion Sickness)
HandlePotions(player, modPlayer);
// Update all particle sets for items.
// This must be done here instead of in the item logic because these sets are not properly instanced
// in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items.
CalamityGlobalItem.UpdateAllParticleSets();
// Regularly sync player stats during multiplayer
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
{
@@ -344,7 +351,7 @@ namespace CalamityMod.CalPlayer
for (int i = 0; i < Main.maxNPCs; ++i)
{
NPC npc = Main.npc[i];
if (npc is null || !npc.IsAnEnemy())
if (npc is null || !npc.IsAnEnemy() || npc.Calamity().DoesNotGenerateRage)
continue;
// Take the longer of the two directions for the NPC's hitbox to be generous.
@@ -1231,6 +1238,19 @@ namespace CalamityMod.CalPlayer
modPlayer.aBulwarkRareTimer--;
if (modPlayer.hellbornBoost > 0)
modPlayer.hellbornBoost--;
if (modPlayer.persecutedEnchantSummonTimer < 1800)
modPlayer.persecutedEnchantSummonTimer++;
else
{
modPlayer.persecutedEnchantSummonTimer = 0;
if (Main.myPlayer == player.whoAmI && player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
{
Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
int portal = NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, ModContent.NPCType<DemonPortal>());
if (Main.npc.IndexInRange(portal))
Main.npc[portal].target = player.whoAmI;
}
}
if (player.miscCounter % 20 == 0)
modPlayer.canFireAtaxiaRangedProjectile = true;
if (player.miscCounter % 100 == 0)
@@ -1454,11 +1474,14 @@ namespace CalamityMod.CalPlayer
// Ambrosial Ampoule bonus and other light-granting bonuses
float[] light = new float[3];
if (modPlayer.aAmpoule)
if ((modPlayer.rOoze && !Main.dayTime) || modPlayer.aAmpoule)
{
light[0] += 1f;
light[1] += 1f;
light[2] += 0.6f;
}
if (modPlayer.aAmpoule)
{
player.endurance += 0.05f;
player.pickSpeed -= 0.25f;
player.buffImmune[BuffID.Venom] = true;
@@ -2079,6 +2102,43 @@ namespace CalamityMod.CalPlayer
}
#endregion
#region Calamitas Enchantment Held Item Effects
public static void EnchantHeldItemEffects(Player player, CalamityPlayer modPlayer, Item heldItem)
{
if (heldItem.IsAir)
return;
// Exhaustion recharge effects.
foreach (Item item in player.inventory)
{
if (item.IsAir)
continue;
if (item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.ID == 600)
{
// Initialize the exhaustion if it is currently not defined.
if (item.Calamity().DischargeEnchantExhaustion <= 0f)
item.Calamity().DischargeEnchantExhaustion = CalamityGlobalItem.DischargeEnchantExhaustionCap;
// Slowly recharge the weapon over time. This is depleted when the item is actaully used.
else if (item.Calamity().DischargeEnchantExhaustion < CalamityGlobalItem.DischargeEnchantExhaustionCap)
item.Calamity().DischargeEnchantExhaustion++;
}
else
item.Calamity().DischargeEnchantExhaustion = 0f;
}
if (!heldItem.Calamity().AppliedEnchantment.HasValue || heldItem.Calamity().AppliedEnchantment.Value.HoldEffect is null)
return;
heldItem.Calamity().AppliedEnchantment.Value.HoldEffect(player);
// Weak brimstone flame hold curse effect.
if (modPlayer.flamingItemEnchant)
player.AddBuff(ModContent.BuffType<WeakBrimstoneFlames>(), 10);
}
#endregion
#region Max Life And Mana Effects
private static void MaxLifeAndManaEffects(Player player, CalamityPlayer modPlayer, Mod mod)
{
+3 -1
View File
@@ -355,7 +355,8 @@ namespace CalamityMod
ProjectileType<SausageMakerSpear>(),
ProjectileType<YateveoBloomSpear>(),
ProjectileType<HydraulicVoltCrasherProjectile>(),
ProjectileType<DragonRageStaff>()
ProjectileType<DragonRageStaff>(),
ProjectileType<TaintedBladeSlasher>()
};
rangedProjectileExceptionList = new List<int>()
@@ -427,6 +428,7 @@ namespace CalamityMod
ProjectileType<InfernadoFriendly>(),
ProjectileType<MurasamaSlash>(),
ProjectileType<PhaseslayerProjectile>(),
ProjectileType<TaintedBladeSlasher>(),
ProjectileType<PhotonRipperProjectile>(),
ProjectileType<SpineOfThanatosProjectile>(),
+11 -1
View File
@@ -42,6 +42,7 @@ using CalamityMod.Schematics;
using CalamityMod.Skies;
using CalamityMod.TileEntities;
using CalamityMod.UI;
using CalamityMod.UI.CalamitasEnchants;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -187,6 +188,7 @@ namespace CalamityMod
BossHealthBarManager.Load(this);
DraedonStructures.Load();
CalamityLists.LoadLists();
EnchantmentManager.LoadAllEnchantments();
SetupVanillaDR();
SetupBossKillTimes();
SetupBossVelocityScalingValues();
@@ -325,6 +327,7 @@ namespace CalamityMod
bossVelocityDamageScaleValues?.Clear();
bossVelocityDamageScaleValues = null;
EnchantmentManager.UnloadAllEnchantments();
CalamityLists.UnloadLists();
NPCStats.Unload();
@@ -552,7 +555,7 @@ namespace CalamityMod
{ ModContent.NPCType<AquaticScourgeTail>(), 7200 },
{ ModContent.NPCType<BrimstoneElemental>(), 10800 },
{ ModContent.NPCType<Calamitas>(), 1200 },
{ ModContent.NPCType<CalamitasRun3>(), 11400 },
{ ModContent.NPCType<CalamitasRun3>(), 13200 },
{ ModContent.NPCType<Leviathan>(), 10800 },
{ ModContent.NPCType<Siren>(), 10800 },
{ ModContent.NPCType<AstrumAureus>(), 10800 },
@@ -921,6 +924,13 @@ namespace CalamityMod
return true;
}, InterfaceScaleType.None));
// Calamitas Enchantment UI
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Calamitas Enchantment", () =>
{
CalamitasEnchantUI.Draw(Main.spriteBatch);
return true;
}, InterfaceScaleType.None));
// Popup GUIs.
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () =>
{
+3
View File
@@ -15,6 +15,7 @@ namespace CalamityMod.Effects
public static Effect LightDistortionShader;
public static Effect PhaseslayerRipShader;
public static Effect FadedUVMapStreakShader;
public static Effect FadingSolidTrailShader;
public static Effect ScarletDevilShader;
public static Effect BordernadoFireShader;
public static Effect PrismCrystalShader;
@@ -34,6 +35,7 @@ namespace CalamityMod.Effects
BordernadoFireShader = CalamityMod.Instance.GetEffect("Effects/BordernadoFire");
PrismCrystalShader = CalamityMod.Instance.GetEffect("Effects/PrismCrystalStreak");
FadedUVMapStreakShader = CalamityMod.Instance.GetEffect("Effects/FadedUVMapStreak");
FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail");
SCalShieldShader = CalamityMod.Instance.GetEffect("Effects/SupremeShieldShader");
Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref<Effect>(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh);
@@ -46,6 +48,7 @@ namespace CalamityMod.Effects
GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref<Effect>(LightDistortionShader), "DistortionPass");
GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"] = new MiscShaderData(new Ref<Effect>(PhaseslayerRipShader), "TrailPass");
GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref<Effect>(FadedUVMapStreakShader), "TrailPass");
GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref<Effect>(FadingSolidTrailShader), "TrailPass");
GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"] = new MiscShaderData(new Ref<Effect>(ScarletDevilShader), "TrailPass");
GameShaders.Misc["CalamityMod:Bordernado"] = new MiscShaderData(new Ref<Effect>(BordernadoFireShader), "TrailPass");
GameShaders.Misc["CalamityMod:PrismaticStreak"] = new MiscShaderData(new Ref<Effect>(PrismCrystalShader), "TrailPass");
Binary file not shown.
+66
View File
@@ -0,0 +1,66 @@
sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor;
float3 uSecondaryColor;
float uOpacity;
float uSaturation;
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
matrix uWorldViewProjection;
float shouldFlip;
struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
VertexShaderOutput VertexShaderFunction(in VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput)0;
float4 pos = mul(input.Position, uWorldViewProjection);
output.Position = pos;
output.Color = input.Color;
output.TextureCoordinates = input.TextureCoordinates;
return output;
}
// The X coordinate is the trail completion, the Y coordinate is the same as any other.
// This is simply how the primitive TextCoord is layed out in the C# code.
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
float4 color = input.Color;
float2 coords = input.TextureCoordinates;
if (shouldFlip == 1)
coords.y = 1 - coords.y;
// Read the fade map as a streak.
float4 fadeMapColor = tex2D(uImage1, coords);
float opacity = fadeMapColor.r;
return color * opacity;
}
technique Technique1
{
pass TrailPass
{
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

+24 -3
View File
@@ -1,6 +1,7 @@
using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.NPCs;
using CalamityMod.Projectiles;
using CalamityMod.Tiles.DraedonStructures;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -123,6 +124,7 @@ namespace CalamityMod.ILEditing
DisableDemonAltarGeneration();
DisableTeleportersDuringBossFights();
FixSplittingWormBannerDrops();
IncorporateMinionExplodingCountdown();
UseCoolFireCursorEffect();
MakeMouseHoverItemsSupportAnimations();
}
@@ -453,6 +455,25 @@ namespace CalamityMod.ILEditing
};
}
private static void IncorporateMinionExplodingCountdown()
{
On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float += (orig, x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1) =>
{
// This is unfortunately not something that can be done via SetDefaults since owner is set
// after that method is called. Doing it directly when the projectile is spawned appears to be the only reasonable way.
int proj = orig(x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1);
Projectile projectile = Main.projectile[proj];
if (projectile.minion)
{
Player player = Main.player[projectile.owner];
CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem());
if (player.Calamity().explosiveMinionsEnchant)
projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime;
}
return proj;
};
}
private static void MakeMouseHoverItemsSupportAnimations()
{
IL.Terraria.Main.DrawInterface_40_InteractItemIcon += (il) =>
@@ -482,8 +503,8 @@ namespace CalamityMod.ILEditing
#endregion
#region IL Editing Injected/Hooked Functions
private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig)
#region IL Editing Injected/Hooked Functions
private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig)
{
orig();
foreach (int npcType in NeedsFourLifeBytes)
@@ -591,7 +612,7 @@ namespace CalamityMod.ILEditing
Main.spriteBatch.Draw(Main.cursorTextures[cursorIndex], drawPosition, null, desaturatedCursorColor, 0f, Vector2.Zero, Main.cursorScale, SpriteEffects.None, 0f);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.UIScaleMatrix);
GameShaders.Misc["CalamityMod:FireMouse"].UseColor(Color.Red);
GameShaders.Misc["CalamityMod:FireMouse"].UseSecondaryColor(Color.Lerp(Color.Red, Color.Orange, 0.75f));
GameShaders.Misc["CalamityMod:FireMouse"].Apply();
+1
View File
@@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories
CalamityPlayer modPlayer = player.Calamity();
modPlayer.beeResist = true;
modPlayer.aAmpoule = true;
modPlayer.rOoze = true;
}
public override void AddRecipes()
-5
View File
@@ -25,11 +25,6 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().rOoze = true;
if (!Main.dayTime)
{
Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f);
player.lifeRegen += 4;
}
}
public override void AddRecipes()
-25
View File
@@ -238,30 +238,5 @@ namespace CalamityMod.Items.Accessories
level = reader.ReadInt32();
totalRageDamage = reader.ReadInt64();
}
public override void AddRecipes()
{
ModRecipe r = new ShatteredCommunityRecipe(mod);
r.SetResult(this);
r.AddIngredient(ModContent.ItemType<TheCommunity>());
r.AddIngredient(ModContent.ItemType<HeartofDarkness>());
r.AddIngredient(ModContent.ItemType<CalamitousEssence>(), 120);
r.AddRecipe();
}
// The Shattered Community can only be crafted with a full-power Community.
// That is, in a world where all relevant bosses have been defeated.
private class ShatteredCommunityRecipe : ModRecipe
{
public ShatteredCommunityRecipe(Mod mod) : base(mod) { }
public override bool RecipeAvailable()
{
bool vanillaBosses = NPC.downedSlimeKing && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedQueenBee && NPC.downedBoss3 && Main.hardMode;
vanillaBosses &= NPC.downedMechBossAny && NPC.downedPlantBoss && NPC.downedGolemBoss && NPC.downedFishron && NPC.downedAncientCultist && NPC.downedMoonlord;
bool calamityBosses = CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedYharon;
return vanillaBosses && calamityBosses;
}
}
}
}
+1
View File
@@ -78,6 +78,7 @@ namespace CalamityMod.Items.Accessories
modPlayer.seaShell = true;
modPlayer.absorber = true;
modPlayer.aAmpoule = true;
modPlayer.rOoze = true;
player.statManaMax2 += 20;
}
+35
View File
@@ -0,0 +1,35 @@
using CalamityMod.Items.Materials;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public class BrimstoneLocus : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brimstone Locus");
Tooltip.SetDefault("Not only can I enhance your equipment with potent magic, I can also draw out the true strength and ascend\n" +
"some of your weaponry to entirely new forms\n" +
"Such items are revealed while this item is in your inventory");
}
public override void SetDefaults()
{
item.width = 20;
item.height = 20;
item.rare = ItemRarityID.Purple;
item.Calamity().customRarity = CalamityRarity.Violet;
item.value = 0;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<CalamitousEssence>());
recipe.AddIngredient(ModContent.ItemType<BloodstoneCore>(), 3);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

+146 -18
View File
@@ -6,8 +6,10 @@ using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.Other;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
@@ -15,8 +17,10 @@ using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.UI;
using CalamityMod.UI.CalamitasEnchants;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
@@ -50,10 +54,26 @@ namespace CalamityMod.Items
return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f);
}
}
#endregion
#endregion
// Miscellaneous stuff
public CalamityRarity customRarity = CalamityRarity.NoEffect;
#region Enchantment Variables
public Enchantment? AppliedEnchantment = null;
public float DischargeEnchantExhaustion = 0;
public float DischargeExhaustionRatio
{
get
{
float ratio = DischargeEnchantExhaustion / DischargeEnchantExhaustionCap;
return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f);
}
}
public const float DischargeEnchantExhaustionCap = 1600f;
public const float DischargeEnchantMinDamageFactor = 0.77f;
public const float DischargeEnchantMaxDamageFactor = 1.26f;
#endregion
// Miscellaneous stuff
public CalamityRarity customRarity = CalamityRarity.NoEffect;
public int timesUsed = 0;
public int reforgeTier = 0;
public bool donorItem = false;
@@ -83,6 +103,7 @@ namespace CalamityMod.Items
{
CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone);
myClone.StealthGenBonus = StealthGenBonus;
myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion;
myClone.Charge = Charge;
return myClone;
}
@@ -109,7 +130,10 @@ namespace CalamityMod.Items
if (item.type == ItemID.PirateMap || item.type == ItemID.SnowGlobe)
item.maxStack = 20;
if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution)
if (item.type == ItemID.CelestialSigil)
item.maxStack = 1;
if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution)
item.value = Item.buyPrice(0, 0, 5, 0);
if (CalamityLists.useTurnList?.Contains(item.type) ?? false)
@@ -236,6 +260,7 @@ namespace CalamityMod.Items
public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
CalamityPlayer modPlayer = player.Calamity();
if (rogue)
{
speedX *= modPlayer.throwingVelocity;
@@ -476,10 +501,10 @@ namespace CalamityMod.Items
}
return true;
}
#endregion
#endregion
#region SavingAndLoading
public override bool NeedsSaving(Item item)
#region SavingAndLoading
public override bool NeedsSaving(Item item)
{
return true;
}
@@ -492,8 +517,10 @@ namespace CalamityMod.Items
["timesUsed"] = timesUsed,
["rarity"] = (int)customRarity,
["charge"] = Charge,
["reforgeTier"] = reforgeTier
};
["reforgeTier"] = reforgeTier,
["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0,
["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion
};
}
public override void Load(Item item, TagCompound tag)
@@ -508,8 +535,16 @@ namespace CalamityMod.Items
else
Charge = tag.GetFloat("charge");
DischargeEnchantExhaustion = tag.GetFloat("DischargeEnchantExhaustion");
reforgeTier = tag.GetInt("reforgeTimer");
}
Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID"));
if (savedEnchantment.HasValue)
{
AppliedEnchantment = savedEnchantment.Value;
bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null;
item.Calamity().AppliedEnchantment.Value.CreationEffect?.Invoke(item);
}
}
public override void LoadLegacy(Item item, BinaryReader reader)
{
@@ -540,7 +575,9 @@ namespace CalamityMod.Items
writer.Write(timesUsed);
writer.Write(Charge);
writer.Write(reforgeTier);
}
writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0);
writer.Write(DischargeEnchantExhaustion);
}
public override void NetReceive(Item item, BinaryReader reader)
{
@@ -551,7 +588,17 @@ namespace CalamityMod.Items
timesUsed = reader.ReadInt32();
Charge = reader.ReadSingle();
reforgeTier = reader.ReadInt32();
}
Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32());
if (savedEnchantment.HasValue)
{
AppliedEnchantment = savedEnchantment.Value;
bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null;
if (hasCreationEffect)
item.Calamity().AppliedEnchantment.Value.CreationEffect(item);
}
DischargeEnchantExhaustion = reader.ReadSingle();
}
#endregion
#region Pickup Item Changes
@@ -597,7 +644,7 @@ namespace CalamityMod.Items
NetMessage.SendData(MessageID.MoonlordCountdown, -1, -1, null, NPC.MoonLordCountdown);
}
return base.UseItem(item, player);
return base.UseItem(item, player);
}
public override bool AltFunctionUse(Item item, Player player)
@@ -706,7 +753,22 @@ namespace CalamityMod.Items
if (PopupGUIManager.AnyGUIsActive)
return false;
if (player.ownedProjectileCounts[ModContent.ProjectileType<RelicOfDeliveranceSpear>()] > 0 &&
if (player.Calamity().cursedSummonsEnchant && NPC.CountNPCS(ModContent.NPCType<CalamitasEnchantDemon>()) < 2)
{
Point spawnPosition = Main.MouseWorld.ToPoint();
NPC.NewNPC(spawnPosition.X, spawnPosition.Y, ModContent.NPCType<CalamitasEnchantDemon>(), Target: player.whoAmI);
Main.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld);
}
bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f;
if (player.Calamity().manaMonsterEnchant && Main.rand.NextBool(12) && player.ownedProjectileCounts[ModContent.ProjectileType<ManaMonster>()] <= 0 && belowHalfMana)
{
int damage = (int)(165000 * player.MagicDamage());
Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f);
Projectile.NewProjectile(player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType<ManaMonster>(), damage, 0f, player.whoAmI);
}
if (player.ownedProjectileCounts[ModContent.ProjectileType<RelicOfDeliveranceSpear>()] > 0 &&
(item.damage > 0 || item.ammo != AmmoID.None))
{
return false; // Don't use weapons if you're charging with a spear
@@ -728,6 +790,15 @@ namespace CalamityMod.Items
if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (modItem.rogue || item.magic || item.ranged || item.melee))
return player.altFunctionUse == 0 ? ProfanedSoulCrystal.TransformItemUsage(item, player) : AltFunctionUse(item, player);
// Exhaust the weapon if it has the necessary enchant.
if (!item.IsAir && modPlayer.dischargingItemEnchant)
{
float exhaustionCost = item.useTime * 2.25f;
if (exhaustionCost < 10f)
exhaustionCost = 10f;
DischargeEnchantExhaustion = MathHelper.Clamp(DischargeEnchantExhaustion - exhaustionCost, 0.001f, DischargeEnchantExhaustionCap);
}
// Check for sufficient charge if this item uses charge.
if (item.type >= ItemID.Count && modItem.UsesCharge)
{
@@ -837,7 +908,11 @@ namespace CalamityMod.Items
// Summon weapons specifically do not have their damage affected by charge. They still require charge to function however.
CalamityGlobalItem modItem = item.Calamity();
if (!item.summon && (modItem?.UsesCharge ?? false))
if (!item.summon && modItem.DischargeEnchantExhaustion > 0f)
mult *= DischargeEnchantmentDamageFormula();
if (!item.summon && (modItem?.UsesCharge ?? false))
{
// At exactly zero charge, do not perform any multiplication.
// This makes charge-using weapons show up at full damage when previewed in crafting, Recipe Browser, etc.
@@ -847,9 +922,20 @@ namespace CalamityMod.Items
}
}
// This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge.
// Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped.
internal float ChargeDamageFormula()
internal float DischargeEnchantmentDamageFormula()
{
// This exponential has the properties of beginning at 0 and ending at 1, yet also has their signature rising curve.
// It is therefore perfect for a potential interpolant.
float interpolant = (float)Math.Pow(2D, DischargeExhaustionRatio) - 1f;
// No further smoothening is required in the form of a Smoothstep remap.
// A linear interpolation works fine; the exponential already has the desired curve shape.
return MathHelper.Lerp(DischargeEnchantMinDamageFactor, DischargeEnchantMaxDamageFactor, interpolant);
}
// This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge.
// Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped.
internal float ChargeDamageFormula()
{
float x = MathHelper.Clamp(ChargeRatio, 0f, 1f);
float y = 1.087f - 0.08f / (x + 0.07f);
@@ -1633,6 +1719,48 @@ namespace CalamityMod.Items
}
#endregion
#region Inventory Drawing
internal static ChargingEnergyParticleSet EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f);
internal static void UpdateAllParticleSets()
{
EnchantmentEnergyParticles.Update();
}
public override bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
void drawItemManually(Color color, float generalScale)
{
Texture2D itemTexture = Main.itemTexture[item.type];
Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture);
Vector2 itemOrigin = itemFrame.Size() * 0.5f;
spriteBatch.Draw(itemTexture, position, itemFrame, color, 0f, itemOrigin, scale * generalScale, SpriteEffects.None, 0f);
}
if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ModContent.ItemType<BrimstoneLocus>()))
return true;
// Draw all particles.
float currentPower = 0f;
int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType<WITCH>());
if (calamitasNPCIndex != -1)
currentPower = Utils.InverseLerp(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true);
position += frame.Size() * 0.25f;
EnchantmentEnergyParticles.InterpolationSpeed = MathHelper.Lerp(0.035f, 0.1f, currentPower);
EnchantmentEnergyParticles.DrawSet(position + Main.screenPosition);
float pulse = Main.GlobalTime * 0.79f % 1f;
float pulseFade = Utils.InverseLerp(0.87f, 0.27f, pulse, true);
float pulseScale = scale * MathHelper.Lerp(1.6f, 1f, pulseFade) / scale;
Color pulseColor = Color.Lerp(drawColor, Color.BlueViolet, pulseFade) * pulseFade;
drawItemManually(pulseColor, pulseScale);
drawItemManually(drawColor, 1f);
return false;
}
#endregion
#region Reforging
private int NewPrefixType(Item item)
{
+52
View File
@@ -10,6 +10,7 @@ using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -17,6 +18,7 @@ using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI.Chat;
namespace CalamityMod.Items
{
@@ -41,6 +43,10 @@ namespace CalamityMod.Items
// This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items.
StealthGenAccessoryTooltip(item, tooltips);
// If an item has an enchantment, show its prefix in the first tooltip line and append its description to the
// tooltip list.
EnchantmentTooltips(item, tooltips);
// Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency.
if (item.type < ItemID.Count)
return;
@@ -227,6 +233,19 @@ namespace CalamityMod.Items
}
#endregion
#region Enchantment Tooltips
private void EnchantmentTooltips(Item item, IList<TooltipLine> tooltips)
{
if (!item.IsAir && AppliedEnchantment.HasValue)
{
tooltips[0].text = $"{AppliedEnchantment.Value.Name} {tooltips[0].text}";
TooltipLine descriptionLine = new TooltipLine(mod, "Enchantment", CalamityUtils.ColorMessage(AppliedEnchantment.Value.Description, Color.DarkRed));
tooltips.Add(descriptionLine);
}
}
#endregion
#region Vanilla Item Tooltip Modification
private void ModifyVanillaTooltips(Item item, IList<TooltipLine> tooltips)
{
@@ -964,6 +983,39 @@ namespace CalamityMod.Items
}
#endregion
#region Enchanted Rarity Text Drawing
public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset)
{
// Special enchantment line color.
if (line.Name == "ItemName" && line.mod == "Terraria" && item.IsEnchanted())
{
Color rarityColor = line.overrideColor ?? line.color;
Vector2 basePosition = new Vector2(line.X, line.Y);
float backInterpolant = (float)Math.Pow(Main.GlobalTime * 0.81f % 1f, 1.5f);
Vector2 backScale = line.baseScale * MathHelper.Lerp(1f, 1.2f, backInterpolant);
Color backColor = Color.Lerp(rarityColor, Color.DarkRed, backInterpolant) * (float)Math.Pow(1f - backInterpolant, 0.46f);
Vector2 backPosition = basePosition - new Vector2(1f, 0.1f) * backInterpolant * 10f;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
// Draw the back text as an ominous pulse.
for (int i = 0; i < 2; i++)
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, backPosition, backColor, line.rotation, line.origin, backScale, line.maxWidth, line.spread);
Main.spriteBatch.End();
Main.spriteBatch.Begin();
// Draw the front text as usual.
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, basePosition, rarityColor, line.rotation, line.origin, line.baseScale, line.maxWidth, line.spread);
return false;
}
return true;
}
#endregion
#region Fargo Biome Fountain Tooltip
private void FargoFountainTooltip(Item item, IList<TooltipLine> tooltips)
{
+3
View File
@@ -3,6 +3,7 @@ using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -16,6 +17,7 @@ namespace CalamityMod.Items.DifficultyItems
Tooltip.SetDefault("Enrages every boss and allows them to drop special items.\n" +
"Nurse no longer heals while a boss is alive.\n" +
"Effect can be toggled on and off.");
Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8));
}
public override void SetDefaults()
@@ -27,6 +29,7 @@ namespace CalamityMod.Items.DifficultyItems
item.useTime = 45;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item119;
item.noUseGraphic = true;
item.consumable = false;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 3.0 KiB

+2 -1
View File
@@ -49,12 +49,13 @@ namespace CalamityMod.Items.Weapons.Magic
item.shoot = ModContent.ProjectileType<RainbowPartyCannonProjectile>();
item.channel = true;
item.shootSpeed = 20f;
item.Calamity().devItem = true;
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
tt2.overrideColor = new Color(MathHelper.Lerp(156f, 255f, Main.DiscoR / 256f), 108f, 251f);
tt2.overrideColor = new Color((int)MathHelper.Lerp(156f, 255f, Main.DiscoR / 256f), 108, 251);
}
public override void AddRecipes()
+1
View File
@@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee
Tooltip.SetDefault("There will be blood!\n" +
"ID and power-level locked\n" +
"Prove your strength or have the correct user ID to wield this sword");
Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 13));
}
public override void SetDefaults()
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
DisplayName.SetDefault("Bullet-Filled Shotgun");
Tooltip.SetDefault("Fires a massive spread of bouncing bullets\n" +
"Consumes five ammo per fire\n" +
"Consumes five bullets per-use\n" +
"Aim? What's that?");
}
public override void SetDefaults()
+50
View File
@@ -0,0 +1,50 @@
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Summon
{
public class ExhumedVigilance : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Exhumed Vigilance");
Tooltip.SetDefault("Summons either Cataclysm or Catastrophe at the mouse position\n" +
"They will look at you for a moment before charging at you\n" +
"They can do damage to both you and enemies");
}
public override void SetDefaults()
{
item.mana = 100;
item.damage = 1666;
item.useStyle = ItemUseStyleID.SwingThrow;
item.width = 58;
item.height = 64;
item.useTime = item.useAnimation = 30;
item.autoReuse = true;
item.noMelee = true;
item.knockBack = 0f;
item.value = CalamityGlobalItem.RarityVioletBuyPrice;
item.rare = ItemRarityID.Red;
item.Calamity().customRarity = CalamityRarity.Violet;
item.UseSound = SoundID.DD2_BetsySummon;
item.shoot = ModContent.ProjectileType<CataclysmSummon>();
item.shootSpeed = 10f;
item.summon = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (player.altFunctionUse != 2)
{
if (Main.rand.NextBool(2))
type = ModContent.ProjectileType<CatastropheSummon>();
Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

@@ -0,0 +1,51 @@
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Summon
{
public class StaffoftheMechworm2 : ModItem
{
// This is unfinished atm.
public override bool Autoload(ref string name) => false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Staff of the Mechworm (But Exhumed!)");
Tooltip.SetDefault("Summons a sepulcher to fight for you\n" +
"While the sepulcher is active brimstone hearts will begin to appear and orbit you\n" +
"The sepulcher will attempt to attack you more and more frequently depending on how many hearts are present\n" +
"The sepulcher takes up 4 minion slots");
}
public override void SetDefaults()
{
item.damage = 666;
item.mana = 15;
item.width = 58;
item.height = 58;
item.useTime = item.useAnimation = 12;
item.useStyle = ItemUseStyleID.SwingThrow;
item.noMelee = true;
item.knockBack = 2f;
item.value = CalamityGlobalItem.Rarity15BuyPrice;
item.rare = ItemRarityID.Purple;
item.Calamity().customRarity = CalamityRarity.Violet;
item.UseSound = SoundID.DD2_BetsySummon;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<SepulcherMinion>();
item.shootSpeed = 10f;
item.summon = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockBack, player.whoAmI);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+1
View File
@@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon
item.value = CalamityGlobalItem.RarityHotPinkBuyPrice;
item.Calamity().customRarity = CalamityRarity.HotPink;
item.Calamity().devItem = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
+6
View File
@@ -2,6 +2,7 @@ using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.Items;
using CalamityMod.Projectiles;
using CalamityMod.UI.CalamitasEnchants;
using CalamityMod.World;
using System;
using System.Collections.Generic;
@@ -1707,6 +1708,11 @@ namespace CalamityMod
CalamityLists.MinionsToNotResurrectList.AddRange(secondaryArguments.Select(argument => Convert.ToInt32(argument)));
return null;
case "CreateEnchantment":
case "RegisterEnchantment":
EnchantmentManager.ConstructFromModcall(args.Skip(1));
return null;
default:
return new ArgumentException("ERROR: Invalid method name.");
}
+34 -4
View File
@@ -29,6 +29,7 @@ using CalamityMod.NPCs.Leviathan;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.Polterghast;
using CalamityMod.NPCs.ProfanedGuardians;
@@ -40,6 +41,7 @@ using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Particles;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
@@ -60,7 +62,6 @@ using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using CalamityMod.NPCs.PlagueEnemies;
namespace CalamityMod.NPCs
{
@@ -113,6 +114,9 @@ namespace CalamityMod.NPCs
public int shopAlertAnimTimer = 0;
public int shopAlertAnimFrame = 0;
// Rage interactions
public bool DoesNotGenerateRage = false;
// NewAI
internal const int maxAIMod = 4;
public float[] newAI = new float[maxAIMod];
@@ -147,7 +151,7 @@ namespace CalamityMod.NPCs
public int wCleave = 0;
public int bBlood = 0;
public int dFlames = 0;
public int marked = 0;
public int marked = 0;
public int irradiated = 0;
public int bFlames = 0;
public int hFlames = 0;
@@ -216,6 +220,9 @@ namespace CalamityMod.NPCs
public static int draedonExoMechPrime = -1;
public static int adultEidolonWyrmHead = -1;
// Drawing variables.
public FireParticleSet VulnerabilityHexFireDrawer = null;
// Boss Enrage variable for use with the boss health UI.
// The logic behind this is as follows:
// 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player.
@@ -969,7 +976,8 @@ namespace CalamityMod.NPCs
ApplyDPSDebuff(pShred, 1500, 300, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(vulnerabilityHex, 44440, 4444, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(vulnerabilityHex, 44440, 4444, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage);
@@ -1993,7 +2001,9 @@ namespace CalamityMod.NPCs
#region Pre AI
public override bool PreAI(NPC npc)
{
CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod);
if (VulnerabilityHexFireDrawer != null)
VulnerabilityHexFireDrawer.Update();
CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod);
// Decrement each immune timer if it's greater than 0.
for (int i = 0; i < maxPlayerImmunities; i++)
@@ -3513,6 +3523,8 @@ namespace CalamityMod.NPCs
bBlood--;
if (dFlames > 0)
dFlames--;
if (vulnerabilityHex > 0)
vulnerabilityHex--;
if (marked > 0)
marked--;
if (irradiated > 0)
@@ -4939,6 +4951,24 @@ namespace CalamityMod.NPCs
Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + npc.width / 2 - Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + npc.height - Main.npcTexture[npc.type].Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
}
}
else
{
if (npc.Calamity().vulnerabilityHex > 0)
{
float compactness = npc.width * 0.6f;
if (compactness < 10f)
compactness = 10f;
float power = npc.height / 100f;
if (power > 2.75f)
power = 2.75f;
if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime)
VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power);
else
VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY));
}
else
VulnerabilityHexFireDrawer = null;
}
// Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event.
if (npc.type == NPCID.DD2EterniaCrystal)
+104
View File
@@ -0,0 +1,104 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Other
{
public class BrimstoneOrb : ModNPC
{
public ref float Time => ref npc.ai[0];
public Player Owner
{
get
{
if (npc.target >= 255 || npc.target < 0)
npc.TargetClosest();
return Main.player[npc.target];
}
}
public override void SetStaticDefaults() => DisplayName.SetDefault("Brimstone Orb");
public override void SetDefaults()
{
npc.width = npc.height = 28;
npc.damage = 0;
npc.defense = 0;
npc.lifeMax = 97444;
npc.noGravity = true;
npc.noTileCollide = true;
npc.value = 0f;
npc.HitSound = SoundID.NPCHit5;
npc.DeathSound = SoundID.NPCDeath7;
npc.knockBackResist = 0f;
npc.netAlways = true;
npc.aiStyle = -1;
npc.Calamity().DoesNotGenerateRage = true;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 97444;
public override void AI()
{
npc.Opacity = Utils.InverseLerp(0f, 15f, Time, true);
npc.velocity = Vector2.Zero;
if (Main.myPlayer == npc.target)
{
// Disappear if the player no longer has the enchanted weapon.
if (!Owner.Calamity().lecherousOrbEnchant)
{
npc.active = false;
npc.netUpdate = true;
}
Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.3f);
npc.Center = Vector2.Lerp(npc.Center, destination, 0.035f).MoveTowards(destination, 5f);
if (!npc.WithinRange(destination, 2000f))
npc.Center = Owner.Center;
if (npc.Center != destination)
{
npc.netSpam = 0;
npc.netUpdate = true;
}
}
Time++;
}
public override void HitEffect(int hitDirection, double damage)
{
for (int i = 0; i < 3; i++)
{
Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264);
magic.color = Color.Red;
magic.velocity = Main.rand.NextVector2Circular(3f, 3f);
magic.fadeIn = 0.9f;
magic.scale = 1.3f;
magic.noGravity = true;
}
if (npc.life <= 0)
{
for (int i = 0; i < 15; i++)
{
Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264);
magic.color = Color.Red;
magic.velocity = Main.rand.NextVector2Circular(6f, 6f);
magic.fadeIn = 1.25f;
magic.scale = Main.rand.NextFloat(1.2f, 1.56f);
magic.noGravity = true;
}
}
}
public override void NPCLoot()
{
for (int i = 0; i < 8; i++)
DropHelper.DropItem(npc, ItemID.Heart);
}
public override Color? GetAlpha(Color drawColor) => Color.White * npc.Opacity;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

+163
View File
@@ -0,0 +1,163 @@
using CalamityMod.Projectiles.Healing;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Other
{
public class CalamitasEnchantDemon : ModNPC
{
public Player Target => Main.player[npc.target];
public ref float AttackTimer => ref npc.ai[0];
public ref float FadeAwayTimer => ref npc.ai[1];
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Demon");
Main.npcFrameCount[npc.type] = 5;
}
public override void SetDefaults()
{
npc.width = 68;
npc.height = 68;
npc.damage = 0;
npc.defense = 0;
// This is meant to be created after SCal is defeated and should be at least a little challenging.
npc.lifeMax = 101010;
npc.HitSound = SoundID.NPCHit47;
npc.DeathSound = SoundID.NPCDeath18;
npc.noGravity = true;
npc.noTileCollide = true;
npc.value = 0f;
npc.knockBackResist = 0f;
npc.netAlways = true;
npc.aiStyle = 0;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010;
public override void AI()
{
FadeAwayTimer++;
// This npc should not attempt to locate other targets. The only one it will accept is the
// player who summoned it in the first place.
if (!Main.projectile.IndexInRange(npc.target) || Target.dead || !Target.active)
{
FadeAway();
return;
}
if (FadeAwayTimer < 15f)
{
DoInitializationAI();
return;
}
AttackTarget();
}
public void FadeAway()
{
npc.dontTakeDamage = true;
npc.Opacity = Utils.InverseLerp(50f, 0f, FadeAwayTimer, true);
// Become inactive after fading away completely.
if (npc.Opacity <= 0f)
{
npc.active = false;
npc.netUpdate = true;
}
// Slow down and fade away.
npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * npc.Opacity * -2f, 0.125f);
FadeAwayTimer++;
if (Main.dedServ)
return;
// Create some fade dust.
for (int i = 0; i < 3; i++)
{
Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223);
magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f);
magic.scale = Main.rand.NextFloat(1f, 1.125f);
magic.fadeIn = 0.4f;
magic.noGravity = true;
magic.noLight = true;
}
}
public void DoInitializationAI()
{
// Create a burst of magic on the first frame.
if (!Main.dedServ && FadeAwayTimer == 1f)
{
for (int i = 0; i < 50; i++)
{
Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223);
magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f);
magic.scale = Main.rand.NextFloat(1f, 1.125f);
magic.fadeIn = 0.7f;
magic.noGravity = true;
magic.noLight = true;
}
}
// Rise upward.
npc.velocity = Vector2.UnitX * MathHelper.Lerp(-0.1f, -3.5f, FadeAwayTimer / 15f);
}
public void AttackTarget()
{
// Slow down prior to a charge.
if (AttackTimer % 120f > 90f)
npc.velocity *= 0.94f;
// Otherwise attempt to move towards the player.
else if (!npc.WithinRange(Target.Center, 150f))
{
Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center) * 16f;
npc.velocity = (npc.velocity * 29f + idealVelocity) / 30f;
npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.025f);
}
// Charge.
if (AttackTimer % 120f == 119f)
npc.velocity = npc.SafeDirectionTo(Target.Center) * 23.5f;
npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt();
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter++;
if (npc.frameCounter % 5f == 4f)
npc.frame.Y += frameHeight;
if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type])
npc.frame.Y = 0;
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
{
Utils.PoofOfSmoke(npc.Center);
// Release 4 healing projectiles towards the target.
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < 4; i++)
{
Vector2 shootVelocity = npc.SafeDirectionTo(Target.Center).RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 14f);
Projectile.NewProjectile(npc.Center, shootVelocity, ModContent.ProjectileType<DemonHeal>(), 0, 0f, npc.target);
}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

+123
View File
@@ -0,0 +1,123 @@
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Other
{
public class DemonPortal : ModNPC
{
public ref float Time => ref npc.ai[0];
public override void SetStaticDefaults() => DisplayName.SetDefault("Mysterious Portal");
public override void SetDefaults()
{
npc.width = npc.height = 60;
npc.damage = 0;
npc.defense = 0;
npc.lifeMax = 24660;
npc.noGravity = true;
npc.noTileCollide = true;
npc.value = 0f;
npc.knockBackResist = 0f;
npc.netAlways = true;
npc.aiStyle = -1;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 24660;
public override void AI()
{
npc.rotation += 0.18f;
npc.Opacity = Utils.InverseLerp(0f, 30f, Time, true) * Utils.InverseLerp(420f, 390f, Time, true);
npc.velocity = Vector2.Zero;
npc.scale = npc.Opacity;
if (Time == 300f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
ReleaseThings();
Main.PlaySound(SoundID.DD2_EtherianPortalOpen, npc.Center);
}
if (Main.netMode != NetmodeID.MultiplayerClient && Time >= 420f)
{
npc.active = false;
npc.netUpdate = true;
}
Time++;
}
public void ReleaseThings()
{
bool friendly = npc.life == 1;
for (int i = 0; i < 6; i++)
{
int demon = Projectile.NewProjectile(npc.Center, Main.rand.NextVector2CircularEdge(4f, 4f), ModContent.ProjectileType<SuicideBomberDemon>(), 17000, 0f, npc.target);
if (Main.projectile.IndexInRange(demon))
{
Main.projectile[demon].friendly = friendly;
Main.projectile[demon].hostile = !friendly;
}
}
}
public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
{
bool wouldDie = npc.life - (damage * (crit ? 2D : 1D)) <= 0;
if (wouldDie)
{
npc.immortal = true;
// Enrage demons if hit when already at 1 health.
if (npc.life == 1)
{
int demonType = ModContent.ProjectileType<SuicideBomberDemon>();
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].type != demonType || !Main.projectile[i].active || Main.projectile[i].hostile)
continue;
Main.projectile[i].hostile = true;
Main.projectile[i].friendly = false;
Main.projectile[i].netUpdate = true;
}
}
npc.life = 1;
damage = 0D;
return false;
}
return true;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
spriteBatch.SetBlendState(BlendState.AlphaBlend);
Texture2D portalTexture = Main.npcTexture[npc.type];
Vector2 drawPosition = npc.Center - Main.screenPosition;
Vector2 origin = portalTexture.Size() * 0.5f;
Color baseColor = Color.White;
// Purple-black portal.
Color color = Color.Lerp(baseColor, Color.Black, 0.55f) * npc.Opacity * 1.8f;
spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f);
spriteBatch.Draw(portalTexture, drawPosition, null, color, -npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f);
// Purple portal.
color = Color.Lerp(Color.Lerp(baseColor, Color.Purple, 0.55f), Color.Black, 0.66f) * npc.Opacity * 1.6f;
spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * 0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f);
// Red portal.
color = Color.Lerp(baseColor, Color.Red, 0.55f) * npc.Opacity * 1.6f;
spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * -0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f);
spriteBatch.SetBlendState(BlendState.AlphaBlend);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

+67
View File
@@ -0,0 +1,67 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Other
{
public class ExhumedHeart : ModNPC
{
public ref float Time => ref npc.ai[0];
public Player Owner
{
get
{
if (npc.target >= 255 || npc.target < 0)
npc.TargetClosest();
return Main.player[npc.target];
}
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Exhumed Brimstone Heart");
Main.npcFrameCount[npc.type] = 6;
}
public override void SetDefaults()
{
npc.width = npc.height = 38;
npc.damage = 0;
npc.defense = 0;
npc.lifeMax = 51740;
npc.noGravity = true;
npc.noTileCollide = true;
npc.value = 0f;
npc.HitSound = SoundID.NPCHit13;
npc.DeathSound = SoundID.NPCDeath1;
npc.knockBackResist = 0f;
npc.netAlways = true;
npc.aiStyle = -1;
npc.Calamity().DoesNotGenerateRage = true;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740;
public override void AI()
{
npc.Opacity = Utils.InverseLerp(0f, 25f, Time, true);
npc.Center = Owner.Center + (MathHelper.TwoPi * Time / 540f).ToRotationVector2() * 350f;
npc.velocity = Vector2.Zero;
Time++;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter++;
npc.frame.Y = (int)(npc.frameCounter / 5) % Main.npcFrameCount[npc.type] * frameHeight;
}
public override Color? GetAlpha(Color drawColor)
{
Color color = Color.Purple * npc.Opacity;
color.A = 127;
return color;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+15 -2
View File
@@ -13,6 +13,7 @@ using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -568,7 +569,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas
forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, npc.Opacity, true);
if (npc.alpha >= 230)
{
// TODO: Spawn the town NPC variant of SCal here when it's on the public branch.
if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive)
{
// Create a teleport line effect
Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red);
npc.Center = initialRitualPosition;
// Make the town NPC spawn.
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType<WITCH>());
}
npc.active = false;
npc.netUpdate = true;
}
@@ -995,7 +1006,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas
if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive)
{
// TODO: Spawn the town NPC variant of SCal again here.
if (giveUpCounter == 720)
{
for (int i = 0; i < 24; i++)
@@ -2723,6 +2733,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas
Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red);
npc.Center = initialRitualPosition;
// Make the town NPC spawn.
NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType<WITCH>());
// Increase the player's SCal kill count
if (Main.player[npc.target].Calamity().sCalKillCount < 5)
Main.player[npc.target].Calamity().sCalKillCount++;
+157
View File
@@ -0,0 +1,157 @@
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items;
using CalamityMod.Projectiles.Magic;
using CalamityMod.UI.CalamitasEnchants;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas;
namespace CalamityMod.NPCs.TownNPCs
{
[AutoloadHead]
public class WITCH : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brimstone Witch");
Main.npcFrameCount[npc.type] = 27;
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
NPCID.Sets.AttackFrameCount[npc.type] = 4;
NPCID.Sets.DangerDetectRange[npc.type] = 700;
NPCID.Sets.AttackType[npc.type] = 1;
NPCID.Sets.AttackTime[npc.type] = 30;
NPCID.Sets.AttackAverageChance[npc.type] = 5;
}
public override void SetDefaults()
{
npc.townNPC = true;
npc.friendly = true;
npc.lavaImmune = true;
npc.width = 18;
npc.height = 40;
npc.aiStyle = 7;
npc.damage = 10;
// You should not be able to kill SCal under any typical circumstances.
npc.Calamity().DR = 0.999999f;
npc.Calamity().unbreakableDR = true;
npc.lifeMax = 1000000;
npc.defense = 120;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath6;
npc.knockBackResist = 0.8f;
animationType = NPCID.Wizard;
}
public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal;
public override string TownNPCName() => "Calamitas";
public override string GetChat() => "Mrrp is cringe.";
public override void SetChatButtons(ref string button, ref string button2) => button = "Enchant";
public override void OnChatButtonClicked(bool firstButton, ref bool shop)
{
if (firstButton)
{
Main.playerInventory = true;
Main.LocalPlayer.Calamity().newCalamitasInventory = false;
CalamitasEnchantUI.NPCIndex = npc.whoAmI;
CalamitasEnchantUI.CurrentlyViewing = true;
if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus)
{
DropHelper.DropItem(npc, ItemType<BrimstoneLocus>());
Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true;
}
shop = false;
}
}
// Make this Town NPC teleport to the Queen statue when triggered.
public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue;
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 50;
knockback = 10f;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
{
cooldown = 10;
randExtraCooldown = 50;
}
public override bool PreAI()
{
// Disappear if the SCal boss is active. She's supposed to be the boss.
// However, this doesn't happen in Boss Rush; the SCal there is a silent puppet created by Xeroc, not SCal herself.
if (NPC.AnyNPCs(NPCType<SCalBoss>()) && !BossRushEvent.BossRushActive)
{
npc.active = false;
npc.netUpdate = true;
return false;
}
return true;
}
//public override void TownNPCAttackMagic(ref float auraLightMultiplier)
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = ProjectileType<SeethingDischargeBrimstoneHellblast>();
attackDelay = 1;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
{
multiplier = 2f;
}
// Explode into red dust on death.
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
{
npc.position = npc.Center;
npc.width = npc.height = 50;
npc.position.X -= npc.width / 2;
npc.position.Y -= npc.height / 2;
for (int i = 0; i < 5; i++)
{
int brimstone = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimstone].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[brimstone].scale = 0.5f;
Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < 10; i++)
{
int fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[fire].noGravity = true;
Main.dust[fire].velocity *= 5f;
fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[fire].velocity *= 2f;
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

+45
View File
@@ -0,0 +1,45 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class ChargingEnergyParticleSet : BaseParticleSet
{
public float InterpolationSpeed;
public float EdgeOffset;
public Color EdgeColor;
public Color CenterColor;
public override int ParticleLifetime => 50;
public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Light");
public ChargingEnergyParticleSet(int setLifetime, int particleSpawnRate, Color edgeColor, Color centerColor, float interpolationSpeed, float edgeOffset) :
base(setLifetime, particleSpawnRate)
{
EdgeColor = edgeColor;
CenterColor = centerColor;
InterpolationSpeed = interpolationSpeed;
EdgeOffset = edgeOffset;
}
public override void UpdateBehavior(Particle particle)
{
float distanceToCenter = particle.RelativeOffset.Length();
particle.Scale = MathHelper.SmoothStep(0.05f, 0.125f, Utils.InverseLerp(EdgeOffset, 6f, distanceToCenter, true));
particle.Scale *= Utils.InverseLerp(ParticleLifetime, ParticleLifetime - 10f, particle.Time, true);
if (distanceToCenter > 4.5f)
particle.RelativeOffset = Vector2.Lerp(particle.RelativeOffset, Vector2.Zero, InterpolationSpeed);
}
public override Color DetermineParticleColor(float lifetimeCompletion)
{
Color particleColor = Color.Lerp(EdgeColor, CenterColor, Utils.InverseLerp(0f, 0.67f, lifetimeCompletion, true));
particleColor.A = 50;
return particleColor;
}
public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2CircularEdge(1f, 1f) * EdgeOffset, 0.1f);
}
}
+44
View File
@@ -0,0 +1,44 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class FireParticleSet : BaseParticleSet
{
public float SpawnAreaCompactness;
public float RelativePower;
public Color BrightColor;
public Color DarkColor;
public override int ParticleLifetime => 50;
public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Fire");
public FireParticleSet(int setLifetime, int particleSpawnRate, Color brightColor, Color darkColor, float spawnAreaCompactness, float relativePower) :
base(setLifetime, particleSpawnRate)
{
BrightColor = brightColor;
DarkColor = darkColor;
SpawnAreaCompactness = spawnAreaCompactness;
RelativePower = relativePower;
}
public override void UpdateBehavior(Particle particle)
{
particle.Scale += RelativePower * 0.01f;
particle.RelativeOffset.Y -= RelativePower * 3f;
}
public override Color DetermineParticleColor(float lifetimeCompletion)
{
Color particleColor = Color.Lerp(BrightColor, DarkColor, lifetimeCompletion);
particleColor = Color.Lerp(particleColor, Color.SaddleBrown, Utils.InverseLerp(0.95f, 0.7f, lifetimeCompletion, true));
particleColor = Color.Lerp(particleColor, Color.White, Utils.InverseLerp(0.1f, 0.25f, lifetimeCompletion, true) * Utils.InverseLerp(0.4f, 0.25f, lifetimeCompletion, true) * 0.7f);
particleColor *= Utils.InverseLerp(0f, 0.15f, lifetimeCompletion, true) * Utils.InverseLerp(1f, 0.8f, lifetimeCompletion, true) * 0.6f;
particleColor.A = 50;
return particleColor;
}
public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2Circular(1f, 1f) * SpawnAreaCompactness, 0.06f);
}
}
+66 -2
View File
@@ -1,3 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Events;
@@ -8,6 +9,7 @@ using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Melee.Yoyos;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -112,8 +114,12 @@ namespace CalamityMod.Projectiles
public const float MaliceModeProjectileVelocityMultiplier = 1.25f;
public const float BossRushProjectileVelocityMultiplier = 1.35f;
#region SetDefaults
public override void SetDefaults(Projectile projectile)
// Enchantment variables.
public int ExplosiveEnchantCountdown = 0;
public const int ExplosiveEnchantTime = 2400;
#region SetDefaults
public override void SetDefaults(Projectile projectile)
{
if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type))
trueMelee = true;
@@ -249,6 +255,47 @@ namespace CalamityMod.Projectiles
#region PreAI
public override bool PreAI(Projectile projectile)
{
if (projectile.minion && ExplosiveEnchantCountdown > 0)
{
ExplosiveEnchantCountdown--;
if (defDamage == 0)
defDamage = projectile.damage;
projectile.damage = (int)(defDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime));
// Make fizzle sounds and fire dust to indicate the impending explosion.
if (ExplosiveEnchantCountdown <= 300)
{
if (Main.rand.NextBool(24))
Main.PlaySound(SoundID.DD2_BetsyFireballShot, projectile.Center);
Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height) * 0.42f, 267);
fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.45f, 1f));
fire.scale = Main.rand.NextFloat(1.4f, 1.65f);
fire.fadeIn = 0.5f;
fire.noGravity = true;
}
if (ExplosiveEnchantCountdown % 40 == 39 && Main.rand.NextBool(12))
{
int damage = (int)(Main.player[projectile.owner].MinionDamage() * 2000);
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType<SummonBrimstoneExplosionSmall>(), damage, 0f, projectile.owner);
}
if (ExplosiveEnchantCountdown <= 0)
{
Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center);
if (Main.myPlayer == projectile.owner)
{
if (projectile.minionSlots > 0f)
{
int damage = (int)(Main.player[projectile.owner].MinionDamage() * 6000);
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType<SummonBrimstoneExplosion>(), damage, 0f, projectile.owner);
}
projectile.Kill();
}
}
}
if (RequiresManualResurrection)
{
// Reactivate the projectile the instant it's created. This is dirty as fuck, but
@@ -2055,6 +2102,23 @@ namespace CalamityMod.Projectiles
organicEnemyHitEffect?.Invoke(target);
}
}
if (modPlayer.flamingItemEnchant && !projectile.minion)
target.AddBuff(BuffType<VulnerabilityHex>(), 420);
if (modPlayer.farProximityRewardEnchant)
{
float proximityDamageInterpolant = Utils.InverseLerp(250f, 2400f, target.Distance(player.Center), true);
float proximityDamageFactor = MathHelper.SmoothStep(0.7f, 1.45f, proximityDamageInterpolant);
damage = (int)Math.Ceiling(damage * proximityDamageFactor);
}
if (modPlayer.closeProximityRewardEnchant)
{
float proximityDamageInterpolant = Utils.InverseLerp(400f, 175f, target.Distance(player.Center), true);
float proximityDamageFactor = MathHelper.SmoothStep(0.75f, 1.75f, proximityDamageInterpolant);
damage = (int)Math.Ceiling(damage * proximityDamageFactor);
}
if (!projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits)
crit = true;
@@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
// This both checks if the player has sufficient mana and consumes it if they do.
// If this is false, the Gatling Laser stops functioning.
bool hasMana = player.CheckMana(gatling.mana, true, false);
bool hasMana = player.CheckMana(gatling, -1, true, false);
// Checks if the Gatling Laser has sufficient charge to fire. If this is false, it stops functioning.
CalamityGlobalItem modItem = gatling.Calamity();
Loaded 100 of 143 files, more files were not shown because too many files have changed in this diff. Show more