Warbanner of the Righteous

This commit is contained in:
Xyk committed 2024-11-03 12:32:43 -08:00
1 parent 5dd0fc1d3f
commit ef43927091
22 files changed
+418 -147

No files matched your search

+4 -2
View File
@@ -524,7 +524,8 @@ namespace CalamityMod.CalPlayer
public bool dodgeScarf = false;
public bool evasionScarf = false;
public bool badgeOfBravery = false;
public bool warbannerOfTheSun = false;
public bool WarbanneroftheRighteous = false;
public bool warbannerGlow = false;
public bool tesla = false;
public bool teslaVisuals = true;
public bool cryogenSoul = false;
@@ -1758,7 +1759,8 @@ namespace CalamityMod.CalPlayer
bloodyWormTooth = false;
vexation = false;
badgeOfBravery = false;
warbannerOfTheSun = false;
WarbanneroftheRighteous = false;
warbannerGlow = false;
aSpark = false;
transformer = false;
hideOfDeus = false;
File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

+5 -5
View File
@@ -14,19 +14,19 @@ using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Cooldowns
{
public class WarbanneroftheSunBuff : CooldownHandler
public class WarbanneroftheRighteousBuff : CooldownHandler
{
public float CompletionPercentage => Utils.GetLerpValue(40, 0, instance.timeLeft);
public float CompletionPercentage => Utils.GetLerpValue(80, 0, instance.timeLeft);
private bool IsEmpty => CompletionPercentage == 0;
private float TextXOffset => (instance.timeLeft < 20 ? -11 : -18f);
private float TextXOffset => (instance.timeLeft <= 20 ? -11 : -18f);
private Vector2 TextPosition => new(TextXOffset, 15);
private Color TextColor => Color.White;
private Color TextBorderColor => Color.Black;
public static new string ID => "WarbanneroftheSunBuff";
public static new string ID => "WarbanneroftheRighteousBuff";
public override bool CanTickDown => false;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override bool ShouldDisplay => instance.player.Calamity().warbannerOfTheSun;
public override bool ShouldDisplay => instance.player.Calamity().WarbanneroftheRighteous;
public override string Texture => "CalamityMod/Cooldowns/" + ID;
public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.SlateGray, Color.DarkGoldenrod, CompletionPercentage);
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.CalPlayer;
using CalamityMod.Cooldowns;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Mono.Cecil;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Items.Accessories
{
[AutoloadEquip(EquipType.Balloon)]
[LegacyName("SamuraiBadge")]
[LegacyName("WarbanneroftheSun")]
public class WarbanneroftheRighteous : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
internal const float MaxBonus = 0.8f;
internal const float MaxDistance = 350f;
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5));
ItemID.Sets.AnimatesAsSoul[Type] = true;
}
public override void SetDefaults()
{
Item.width = 32;
Item.height = 78;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.WarbanneroftheRighteous = true;
modPlayer.warbannerGlow = !hideVisual;
if (player.ownedProjectileCounts[ProjectileType<WarbannerLight>()] < 1 && !hideVisual && !player.dead)
{
Projectile light = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType<WarbannerLight>(), 0, 0f, player.whoAmI);
}
int maxValue = (int)(MaxBonus * 100);
float bonus = CalculateBonus(player) - 0.6f;
float displayBonus = (int)((bonus + 0.6f) * 100); // Should range from 0 to the maxValue
if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheRighteousBuff.ID, out var cooldown))
{
cooldown.timeLeft = maxValue - (int)displayBonus;
}
else
{
player.AddCooldown(WarbanneroftheRighteousBuff.ID, maxValue);
}
player.GetAttackSpeed<MeleeDamageClass>() += 0.15f;
// If damage is positive, boost melee damage, but negative damage is universal
if (bonus > 0)
player.GetDamage<MeleeDamageClass>() += bonus;
else
player.GetDamage<GenericDamageClass>() += bonus;
int targetCount = 0;
foreach (NPC npc in Main.ActiveNPCs) // More targets gradually reduces the burn damage for ALL targets
{
if (npc.Calamity().warbannerBurnMarked)
targetCount++;
}
for (int index = 0; index < Main.npc.Length; index++)
{
NPC nPC = Main.npc[index];
float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox
float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy
if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType<SuperDummyNPC>()) && nPC.CanBeChasedBy())
{
float minDamageMult = 0.35f;
int maxTargets = 25;
float damageMult = Utils.Remap(targetCount, maxTargets, 1, minDamageMult, 1);
// Handles giving the Warbanner Burn effect
CalamityGlobalNPC modNPC = nPC.Calamity();
if (!modNPC.warbannerBurnMarked)
{
modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center);
modNPC.warbannerBurnMarked = true;
modNPC.warbannerBurnTimer = 2;
}
if (modNPC.warbannerBurnMarked)
{
modNPC.warbannerBurnIntensity = intensity;
modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center);
int burnDamage = (int)player.GetBestClassDamage().ApplyTo(50 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy
modNPC.warbannerBurnDamage = burnDamage;
modNPC.warbannerBurnStacks++;
modNPC.warbannerBurnTimer++;
modNPC.warbannerBurnHideEffects = hideVisual;
}
}
}
}
private static float CalculateBonus(Player player)
{
float bonus = 0f;
NPC closestTarget = player.Center.ClosestNPCAt(MaxDistance * 7); // extra range is to account for bonus range from massive targets
if (closestTarget != null)
{
float generousHitboxWidth = Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox
bonus = Utils.Remap(Utils.Distance(player.Center, closestTarget.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 0, MaxBonus, true);
}
else
bonus = 0;
return bonus;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
position,
frame,
drawColor,
itemColor,
origin,
scale,
wantedScale: 0.6f,
drawOffset: new(0f, -2f)
);
return false;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

-126
View File
@@ -1,126 +0,0 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Cooldowns;
using CalamityMod.NPCs.NormalNPCs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
[AutoloadEquip(EquipType.Balloon)]
[LegacyName("SamuraiBadge")]
public class WarbanneroftheSun : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
internal const float MaxBonus = 0.4f;
internal const float MaxDistance = 500f;
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5));
ItemID.Sets.AnimatesAsSoul[Type] = true;
}
public override void SetDefaults()
{
Item.width = 32;
Item.height = 78;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.warbannerOfTheSun = true;
int maxValue = (int)(MaxBonus * 100);
float bonus = CalculateBonus(player) - 0.2f;
float displayBonus = (int)((bonus + 0.2f) * 100); // Should range from 0 to the maxValue
if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheSunBuff.ID, out var cooldown))
{
cooldown.timeLeft = maxValue - (int)displayBonus;
}
else
{
player.AddCooldown(WarbanneroftheSunBuff.ID, maxValue);
}
player.GetAttackSpeed<MeleeDamageClass>() += 0.15f;
player.GetDamage<MeleeDamageClass>() += bonus;
}
private static float CalculateBonus(Player player)
{
float bonus = 0f;
int closestNPC = -1;
foreach (NPC nPC in Main.ActiveNPCs)
{
if ((nPC.IsAnEnemy() || nPC.type == ModContent.NPCType<SuperDummyNPC>()) && !nPC.dontTakeDamage)
{
closestNPC = nPC.whoAmI;
break;
}
}
float distance = -1f;
foreach (NPC nPC in Main.ActiveNPCs)
{
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage)
{
float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2)));
if (distance == -1f || distance2 < distance)
{
distance = distance2;
closestNPC = nPC.whoAmI;
}
}
}
if (closestNPC != -1)
{
NPC actualClosestNPC = Main.npc[closestNPC];
float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f) + 80; // Adds some room so max bonus isnt when you're ON the hitbox
float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth;
if (hitboxEdgeDist < 0)
hitboxEdgeDist = 0;
if (hitboxEdgeDist < MaxDistance)
{
bonus = MathHelper.Lerp(0f, MaxBonus, 1f - (hitboxEdgeDist / MaxDistance));
if (bonus > MaxBonus)
bonus = MaxBonus;
}
}
return bonus;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
position,
frame,
drawColor,
itemColor,
origin,
scale,
wantedScale: 0.6f,
drawOffset: new(0f, -2f)
);
return false;
}
}
}
@@ -1966,12 +1966,14 @@ VoltaicJelly: {
'''
}
WarbanneroftheSun: {
DisplayName: Warbanner of the Sun
WarbanneroftheRighteous: {
DisplayName: Warbanner of the Righteous
Tooltip:
'''
Increases melee damage, true melee damage and melee speed the closer you are to enemies
These stat boosts max out at 20%
15% increased melee speed
Melee damage increased by 20% when close to enemies, but all damage is decreased by 60% when far away
Emit a blazing aura that burns and repels nearby enemies
Enemies take increased damage the closer they are to you and the longer they are in the aura
'''
}
@@ -128,6 +128,8 @@ TitanHeartBoom.DisplayName: Titan Heart Boom
UrsaSlash.DisplayName: Ursa Slash
VerstaltiteBobber.DisplayName: Verstaltite Bobber
VoidFieldGenerator.DisplayName: Void Field Generator
WarbannerDamage.DisplayName: The Unmatched Power of the Sun
WarbannerLight.DisplayName: Warbanner Light
WaterConvertor.DisplayName: Water Convertor
WhiteLabSeeker.DisplayName: Seeking Mechanism
WulfrumBobber.DisplayName: Wulfrum Bobber
+1 -1
View File
@@ -125,7 +125,7 @@ Cooldowns: {
TarragonCloak: Tarragon Cloak Cooldown
TarragonImmunity: Tarragon Immunity Cooldown
UniverseSplitter: Universe Splitter Cooldown
WarbanneroftheSunBuff: Warbanner Strength
WarbanneroftheRighteousBuff: Warbanner Strength
WulfrumBastionActive: Power Armor Durability
WulfrumBastionCooldown: Wulfrum Bastion Cooldown
WulfrumRoverDriveDurability: Protective Matrix Durability
+87 -1
View File
@@ -89,6 +89,7 @@ using CalamityMod.NPCs.SunkenSea;
using CalamityMod.Packets;
using CalamityMod.ExtraTextures;
using MonoMod.Utils;
using CalamityMod.Dusts;
namespace CalamityMod.NPCs
{
@@ -284,6 +285,14 @@ namespace CalamityMod.NPCs
public int aCrunch = 0;
public int crumble = 0;
public int warbannerBurnTime = 0; // Determines the rate that the enemy is damaged
public int warbannerBurnTimer = 0; // The duration of the debuff
public int warbannerBurnStacks = 0; // The stacks increase how fast the debuff hits
public int warbannerBurnDamage = 0; // Damage of the hits based on player's damage
public Vector2 warbannerBurnDirection;
public float warbannerBurnIntensity = 0;
public bool warbannerBurnMarked = false;
public bool warbannerBurnHideEffects = false;
public const int veriumDoomTime = 90;
public int veriumDoomTimer = 0;
public int veriumDoomStacks = 0;
@@ -519,6 +528,14 @@ namespace CalamityMod.NPCs
myClone.aCrunch = aCrunch;
myClone.crumble = crumble;
myClone.warbannerBurnTime = warbannerBurnTime;
myClone.warbannerBurnTimer = warbannerBurnTimer;
myClone.warbannerBurnStacks = warbannerBurnStacks;
myClone.warbannerBurnDamage = warbannerBurnDamage;
myClone.warbannerBurnDirection = warbannerBurnDirection;
myClone.warbannerBurnIntensity = warbannerBurnIntensity;
myClone.warbannerBurnMarked = warbannerBurnMarked;
myClone.warbannerBurnHideEffects = warbannerBurnHideEffects;
myClone.veriumDoomTimer = veriumDoomTimer;
myClone.veriumDoomStacks = veriumDoomStacks;
myClone.veriumDoomMarked = veriumDoomMarked;
@@ -5591,6 +5608,75 @@ namespace CalamityMod.NPCs
if (cursorFocus > 0 && cursorFocus < cursorFocusMax)
cursorFocus--;
if (warbannerBurnTimer > 0)
warbannerBurnTimer--;
if (warbannerBurnTimer == 0 && warbannerBurnMarked)
{
warbannerBurnTime = 0;
warbannerBurnDamage = 0;
warbannerBurnMarked = false;
warbannerBurnStacks = 0;
}
if (warbannerBurnMarked)
{
int maxStacks = 300; // Time in frames needed to reach max power
int fastestBurnRate = 2;
int slowestBurnRate = 20;
float burnPower = Utils.Remap(warbannerBurnStacks, 0, maxStacks, slowestBurnRate, fastestBurnRate, true);
float sizeBonus = (1 + Utils.GetLerpValue(0, 170, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f)));
if (!warbannerBurnHideEffects)
{
Lighting.AddLight(npc.Center, Color.Gold.ToVector3() * 0.3f * warbannerBurnIntensity);
}
if (warbannerBurnStacks == maxStacks && !warbannerBurnHideEffects)
{
// Sound and visual for hitting max stacks
for (int i = 0; i < 15; i++)
{
Particle spark = new SparkParticle(npc.Center, new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 45, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange);
GeneralParticleHandler.SpawnParticle(spark);
}
SoundStyle fullPower = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn");
SoundEngine.PlaySound(fullPower with { Volume = 0.7f, Pitch = 0.7f }, npc.Center);
warbannerBurnStacks++;
}
if (warbannerBurnIntensity > 2 && npc.CanBeMoved(true))
{
npc.velocity *= 0.99f - 0.25f * Utils.GetLerpValue(2, 3, warbannerBurnIntensity);
if (npc.velocity.Length() > 5) // Repel leaping enemies
npc.velocity = -npc.velocity * 0.7f;
}
if (warbannerBurnTime == 0)
{
if (!warbannerBurnHideEffects)
{
int particleLevel = (int)(MathHelper.Clamp((slowestBurnRate - burnPower) * 0.15f, 1, 2) * warbannerBurnIntensity);
for (int d = 0; d < particleLevel; d++)
{
Color color = Main.rand.NextBool() ? Color.Goldenrod : Color.Lerp(Color.OrangeRed, Color.Orange, Main.rand.NextFloat(0, 1)); ;
Vector2 sparkPos = npc.Center - warbannerBurnDirection * 220 * Utils.GetLerpValue(0, 200, Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f));
float velAdjust = Main.rand.NextFloat(2, 7) * warbannerBurnIntensity * sizeBonus;
Vector2 endVel = warbannerBurnDirection * velAdjust;
Vector2 startVel = (warbannerBurnDirection * velAdjust).RotatedByRandom(0.6f * warbannerBurnIntensity);
Particle sparks = new VelChangingSpark(sparkPos, startVel, endVel, "CalamityMod/Particles/SmallBloom", Main.rand.Next(18, 22 + 1), Main.rand.NextFloat(0.1f, 0.25f) * sizeBonus, color * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.1f);
GeneralParticleHandler.SpawnParticle(sparks);
Dust lust2 = Dust.NewDustPerfect(sparkPos, ModContent.DustType<LightDust>(), startVel, Scale: Main.rand.NextFloat(0.7f, 1.1f) * sizeBonus);
lust2.noGravity = true;
lust2.color = color;
lust2.noLightEmittence = true;
}
}
var player = Main.LocalPlayer;
Projectile burnHit = Projectile.NewProjectileDirect(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType<WarbannerDamage>(), (int)(warbannerBurnDamage * warbannerBurnIntensity), 0, Main.myPlayer, npc.whoAmI);
burnHit.ArmorPenetration = 50;
warbannerBurnTime = (int)(burnPower + (3 - warbannerBurnIntensity) * 4);
}
warbannerBurnTime--;
}
if (veriumDoomTimer > 0)
veriumDoomTimer--;
if (veriumDoomTimer == 0 && veriumDoomMarked)
@@ -6391,7 +6477,7 @@ namespace CalamityMod.NPCs
public override void HitEffect(NPC npc, NPC.HitInfo hit)
{
if (npc.life <= 0 && npc.Organic() && ashesOnDeath > 0)
DeathAshParticle.CreateAshesFromNPC(npc);
DeathAshParticle.CreateAshesFromNPC(npc, Vector2.Zero);
// Cultist shield flicker
if (npc.type == NPCID.CultistBoss)
@@ -1225,7 +1225,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
{
npcLoot.Add(ModContent.ItemType<RelicOfDeliverance>(), 4);
npcLoot.Add(ModContent.ItemType<ProfanedGuardianMask>(), 7);
npcLoot.Add(ModContent.ItemType<WarbanneroftheSun>(), 10);
npcLoot.Add(ModContent.ItemType<WarbanneroftheRighteous>(), 10);
npcLoot.Add(ModContent.ItemType<ProfanedGuardianTrophy>(), 10);
npcLoot.Add(ModContent.ItemType<ProfanedCore>());
npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType<UnholyEssence>(), 1, 10, 15, 15, 20));
+1 -1
View File
@@ -576,7 +576,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
}
}
DeathAshParticle.CreateAshesFromNPC(NPC);
DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero);
}
}
}
+1 -1
View File
@@ -612,7 +612,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
}
}
DeathAshParticle.CreateAshesFromNPC(NPC);
DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero);
}
}
}
+1 -1
View File
@@ -3266,7 +3266,7 @@ namespace CalamityMod.NPCs.Yharon
// Turn into dust on death.
if (NPC.life <= 0)
DeathAshParticle.CreateAshesFromNPC(NPC);
DeathAshParticle.CreateAshesFromNPC(NPC, Vector2.Zero);
}
}
#endregion
+11 -1
View File
@@ -23,6 +23,7 @@ namespace CalamityMod.Particles
public Color AshColor;
public Vector2 Center;
public Vector2 Velocity;
public static Vector2 VelOverride;
public Vector2 TopLeft => Center - Vector2.One * Scale * 3.5f;
public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 3.5f;
public Vector2 BottomRight => Center + Vector2.One * Scale * 3.5f;
@@ -84,12 +85,13 @@ namespace CalamityMod.Particles
Main.instance.GraphicsDevice.SetRenderTarget(null);
}
public static void CreateAshesFromNPC(NPC npc)
public static void CreateAshesFromNPC(NPC npc, Vector2 velocityOverride)
{
// Don't create ashes serverside.
if (Main.netMode == NetmodeID.Server)
return;
VelOverride = velocityOverride;
PendingNPCsToDraw[npc] = new(true, ManagedRenderTarget.CreateScreenSizedTarget);
}
@@ -228,11 +230,19 @@ namespace CalamityMod.Particles
float brightness = (AshColor.R + AshColor.G + AshColor.B) / 765f;
Time++;
Scale = MathHelper.Clamp(Scale - (brightness < 0.1f ? 0.08f : 0.008f), 0f, 1f);
float dissipationFactor = Utils.GetLerpValue(6f, 16f, Velocity.Length(), true);
float velocityInterpolant = Utils.GetLerpValue(25f - dissipationFactor * 10f, 80f - dissipationFactor * 45f, Time, true);
Vector2 idealVelocity = new Vector2(Main.windSpeedCurrent * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Center.Y / 50f + ID)) * 20f, (float)Math.Sin(Main.time / 20f + ID * 0.01f) * 3f - 1f);
if (VelOverride != Vector2.Zero)
{
Vector2 useVel = VelOverride.RotateRandom(0.01f * ID);
idealVelocity = new Vector2(useVel.X * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID)), useVel.Y * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Main.time / 20f + ID)));
}
Velocity = Vector2.Lerp(Velocity, idealVelocity, velocityInterpolant * 0.16f);
Center += Velocity;
}
+9 -2
View File
@@ -53,7 +53,10 @@ namespace CalamityMod.Particles
{
if (!FadeIn)
{
Scale *= 0.95f;
if ((float)Time / (float)Lifetime < 0.5f)
{
Scale *= 0.95f;
}
Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D));
}
else
@@ -67,7 +70,11 @@ namespace CalamityMod.Particles
Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f);
}
}
Velocity *= 0.95f;
if ((float)Time / (float)Lifetime < 0.8f)
{
Velocity *= 0.95f;
EndVelocity *= 0.95f;
}
Velocity = new Vector2(MathHelper.Lerp(Velocity.X, EndVelocity.X, LerpRate), MathHelper.Lerp(Velocity.Y, EndVelocity.Y, LerpRate));
+2 -1
View File
@@ -171,7 +171,8 @@ namespace CalamityMod.Projectiles.Melee
Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed);
GeneralParticleHandler.SpawnParticle(spark);
}
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BurningHolyBlast>(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 1.8f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BurningHolyBlast>(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f);
}
}
public override bool PreDraw(ref Color lightColor)
+39
View File
@@ -0,0 +1,39 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class WarbannerDamage : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 2;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 0;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.alpha = 255;
Projectile.timeLeft = 2;
}
// If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC.
public override bool? CanHitNPC(NPC target)
{
if (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f || Projectile.ai[0] == target.whoAmI)
return null;
return (bool?)false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 30);
}
}
}
+95
View File
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class WarbannerLight : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
public CalamityPlayer moddedOwner => Owner.Calamity();
public Color bColor = Color.White;
public int time = 0;
public float rotMult = 0.05f;
public int direction = 1;
public float rot2 = 0;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 1;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
Projectile.tileCollide = false;
Projectile.friendly = true;
Projectile.penetrate = -1;
}
public override void AI()
{
float rate = Main.GlobalTimeWrappedHourly * 5;
List<Color> eColors = new List<Color>()
{
Color.Goldenrod,
Color.Orange
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
Projectile.Center = Owner.MountedCenter;
if (moddedOwner.warbannerGlow && moddedOwner.WarbanneroftheRighteous)
Projectile.timeLeft++;
else
Projectile.Kill();
if (Owner.dead)
Projectile.Kill();
// Emit some light
Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f);
rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f;
if (time % 2 == 0)
{
Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100);
Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.1f, 0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 0.7f);
dust.color = bColor;
dust.noLightEmittence = true;
}
time++;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D rTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/ShatteredExplosion").Value;
Texture2D bTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Color drawColor = bColor;
for (int i = 0; i < 5; i++)
{
float bScale2 = 0.75f;
Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2, SpriteEffects.None, 0);
return false;
}
public override bool? CanDamage() => false;
}
}