Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into 1.4.4
This commit is contained in:
commit
5572ed6383
12 files changed
+258
-188
No files matched your search
@@ -26,7 +26,6 @@ using CalamityMod.Items.Dyes;
|
||||
using CalamityMod.Items.Mounts;
|
||||
using CalamityMod.Items.Mounts.Minecarts;
|
||||
using CalamityMod.Items.PermanentBoosters;
|
||||
using CalamityMod.Items.Potions.Alcohol;
|
||||
using CalamityMod.Items.TreasureBags.MiscGrabBags;
|
||||
using CalamityMod.Items.VanillaArmorChanges;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
|
||||
@@ -18,7 +18,6 @@ using CalamityMod.Items.Armor.LunicCorps;
|
||||
using CalamityMod.Items.Armor.Silva;
|
||||
using CalamityMod.Items.Armor.Wulfrum;
|
||||
using CalamityMod.Items.Mounts;
|
||||
using CalamityMod.Items.Potions.Alcohol;
|
||||
using CalamityMod.Items.VanillaArmorChanges;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.NPCs;
|
||||
@@ -863,15 +862,16 @@ namespace CalamityMod.CalPlayer
|
||||
contactDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer;
|
||||
|
||||
// Contact damage reduction is reduced by DR Damage, which itself is proportional to defense damage
|
||||
// In GFB, as defense damage is uncapped, DR damage is also uncapped.
|
||||
int currentDefense = Player.GetCurrentDefense(false);
|
||||
if (totalDefenseDamage > 0 && currentDefense > 0)
|
||||
{
|
||||
double drDamageRatio = CurrentDefenseDamage / (double)currentDefense;
|
||||
if (drDamageRatio > 1D)
|
||||
if (!Main.getGoodWorld && drDamageRatio > 1D)
|
||||
drDamageRatio = 1D;
|
||||
|
||||
contactDamageReduction *= 1D - drDamageRatio;
|
||||
if (contactDamageReduction < 0D)
|
||||
if (!Main.getGoodWorld && contactDamageReduction < 0D)
|
||||
contactDamageReduction = 0D;
|
||||
}
|
||||
|
||||
@@ -1939,10 +1939,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
#region Actually Dealing Defense Damage
|
||||
// Check if the player has iframes for the sake of avoiding defense damage.
|
||||
bool hasIFrames = false;
|
||||
for (int i = 0; i < Player.hurtCooldowns.Length; i++)
|
||||
if (Player.hurtCooldowns[i] > 0)
|
||||
hasIFrames = true;
|
||||
bool hasIFrames = Player.HasIFrames();
|
||||
|
||||
// If the player was just hit by something capable of dealing defense damage, then apply defense damage.
|
||||
// Bloodflare Core makes every hit deal defense damage (to enable its function).
|
||||
@@ -1955,11 +1952,11 @@ namespace CalamityMod.CalPlayer
|
||||
int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage;
|
||||
double standardDefenseDamage = netMitigation * defenseDamageRatio;
|
||||
|
||||
// If Bloodflare Core is equipped and standard defense damage would be less than half the player's total defense,
|
||||
// then instead forcibly deal half of the player's total defense as defense damage.
|
||||
// Bloodflare Core overrides standard defense damage if it would be less than half of the player's total defense.
|
||||
if (bloodflareCore && standardDefenseDamage < halfDefense)
|
||||
{
|
||||
DealDefenseDamage(hurtInfo, (int)halfDefense, true);
|
||||
// In this case, forcibly deal half of the player's total defense as defense damage. This ignores ratios.
|
||||
DealDefenseDamage((int)halfDefense, true);
|
||||
|
||||
// Set up Bloodflare Core's heal over time. Any in-progress heals are overwritten if they would have a shorter duration.
|
||||
if (bloodflareCoreRemainingHealOverTime < halfDefense)
|
||||
@@ -2747,46 +2744,42 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Defense Damage Function
|
||||
#region Defense Damage Functions
|
||||
/// <summary>
|
||||
/// Deals Calamity defense damage to a player.
|
||||
/// Deals Calamity defense damage to a player the "normal way", using an incoming hit.<br />
|
||||
/// This is the convenience function which follows all standard Calamity balancing rules for taking a regular hit.
|
||||
/// </summary>
|
||||
/// <param name="hurtInfo">HurtInfo of the incoming strike to the player.</param>
|
||||
/// <param name="customIncomingDamage">If set to zero or a positive number, ignores the HurtInfo and uses this value as the incoming damage.</param>
|
||||
/// <param name="absolute">If true, deals exactly the custom amount defense damage, ignoring the standard ratios and Draedon's Heart.<br />
|
||||
/// This also bypasses the
|
||||
/// This does nothing unless customIncomingDefenseDamage is specified.</param>
|
||||
public void DealDefenseDamage(Player.HurtInfo hurtInfo, int customIncomingDamage = -1, bool absolute = false)
|
||||
public void DealDefenseDamage(Player.HurtInfo hurtInfo)
|
||||
{
|
||||
// Legacy safeguard: Skip defense damage if the player is somehow "hit for zero" (this should never happen).
|
||||
if (hurtInfo.Damage <= 0 || hurtInfo.SourceDamage <= 0)
|
||||
return;
|
||||
|
||||
double ratioToUse = defenseDamageRatio;
|
||||
|
||||
// Calculate the defense damage taken from this hit.
|
||||
// If custom incoming defense damage is specified, then ignore the incoming hurt info and use the custom value.
|
||||
int incomingDamageToUse;
|
||||
if (customIncomingDamage >= 0)
|
||||
{
|
||||
incomingDamageToUse = customIncomingDamage;
|
||||
// If absolute is specified, then ignore the ratio and always inflict EXACTLY THAT MUCH defense damage. This means it bypasses Draedon's Heart!
|
||||
if (absolute)
|
||||
ratioToUse = 1D;
|
||||
}
|
||||
|
||||
// Standard hits. Defense damage scales with "net mitigation", aka how much damage the player DIDN'T take.
|
||||
// Under typical circumstances, defense damage scales with "net mitigation", aka how much damage the player DIDN'T take.
|
||||
// Thematically, this means it scales with how much damage the player's defense took instead of them.
|
||||
else
|
||||
{
|
||||
int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage;
|
||||
int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage;
|
||||
int incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation;
|
||||
|
||||
// If the player somehow took amplified damage (their mitigation was negative) then they take no base defense damage.
|
||||
// The defense damage floor will still apply to them.
|
||||
incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation;
|
||||
}
|
||||
// Leave it to the direct function to determine how much defense damage is taken. Use standard ratios.
|
||||
DealDefenseDamage(incomingDamageToUse, false);
|
||||
}
|
||||
|
||||
int defenseDamageTaken = (int)Math.Round(incomingDamageToUse * ratioToUse);
|
||||
/// <summary>
|
||||
/// Deals Calamity defense damage to a player. This is the direct function, for unusual sources of defense damage.
|
||||
/// </summary>
|
||||
/// <param name="incomingDamage">The amount of defense damage to deal.</param>
|
||||
/// <param name="absolute">If true, deals exactly the specified defense damage, ignoring the standard ratios and Draedon's Heart.<br />
|
||||
/// Setting this to false is equivalent to considering the first parameter as standard incoming damage to the player.<br />
|
||||
/// Setting this to true bypasses the defense damage floor, and can thus inflict less defense damage than is typically allowed.</param>
|
||||
public void DealDefenseDamage(int incomingDamage, bool absolute = false)
|
||||
{
|
||||
// If absolute is specified, then ignore the ratio and always inflict EXACTLY THAT MUCH defense damage.
|
||||
// This means it bypasses Draedon's Heart!
|
||||
double ratioToUse = absolute ? 1D : defenseDamageRatio;
|
||||
|
||||
// Intended amount of defense damage to take. Can round up, but can also be overwritten by the floor.
|
||||
int defenseDamageTaken = (int)Math.Round(incomingDamage * ratioToUse);
|
||||
|
||||
// There is a floor on defense damage based on difficulty; i.e. there is a minimum amount of defense damage from any hit that can deal defense damage.
|
||||
// This floor is only applied if bosses are alive, but is bypassed by the absolute flag.
|
||||
@@ -2801,10 +2794,16 @@ namespace CalamityMod.CalPlayer
|
||||
defenseDamageTaken = defenseDamageFloor;
|
||||
}
|
||||
|
||||
//
|
||||
// The amount of defense damage taken is now final.
|
||||
//
|
||||
|
||||
// The amount of defense damage taken is now final. Apply it.
|
||||
ApplyDefenseDamageInternal(defenseDamageTaken);
|
||||
}
|
||||
|
||||
// Actually applies defense damage. Cannot be called externally.
|
||||
private void ApplyDefenseDamageInternal(int defenseDamage, bool showVisuals = true)
|
||||
{
|
||||
// Can be dynamically reduced by Adamantite set bonus and maybe other future effects.
|
||||
int defenseDamageTaken = defenseDamage;
|
||||
|
||||
// Apply incoming defense damage to the Adamantite armor set bonus.
|
||||
if (AdamantiteSetDefenseBoost > 0)
|
||||
{
|
||||
@@ -2843,11 +2842,12 @@ namespace CalamityMod.CalPlayer
|
||||
// Reset the delay between iframes ending and defense damage recovery starting.
|
||||
defenseDamageDelayFrames = DefenseDamageRecoveryDelay;
|
||||
|
||||
// Audiovisual effects
|
||||
ShowDefenseDamageEffects(defenseDamageTaken);
|
||||
if (showVisuals)
|
||||
ShowDefenseDamageEffects(defenseDamage);
|
||||
}
|
||||
|
||||
private void ShowDefenseDamageEffects(int defDamage)
|
||||
// Displays visuals for taking defense damage.
|
||||
private void ShowDefenseDamageEffects(int defenseDamage)
|
||||
{
|
||||
// Play a sound from taking defense damage.
|
||||
if (hurtSoundTimer == 0 && Main.myPlayer == Player.whoAmI)
|
||||
@@ -2857,7 +2857,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
|
||||
// Display text indicating that defense damage was taken.
|
||||
string text = (-defDamage).ToString();
|
||||
string text = (-defenseDamage).ToString();
|
||||
Color messageColor = Color.LightGray;
|
||||
Rectangle location = new Rectangle((int)Player.position.X, (int)Player.position.Y - 16, Player.width, Player.height);
|
||||
CombatText.NewText(location, messageColor, Language.GetTextValue(text));
|
||||
|
||||
@@ -3923,19 +3923,16 @@ namespace CalamityMod.CalPlayer
|
||||
//
|
||||
// Current defense damage can be calculated at any time using the accessor property CurrentDefenseDamage.
|
||||
// However, it CANNOT be written to. You can only set the total defense damage.
|
||||
// CalamityPlayer has a function called DealDefenseDamage to handle everything for you, when dealing defense damage.
|
||||
// CalamityPlayer has a function called DealDefenseDamage to handle everything for you when dealing defense damage.
|
||||
//
|
||||
// The player's current recovery through defense damage is tracked through two frame counts:
|
||||
// defenseDamageRecoveryFrames = How many more frames the player will still be recovering from defense damage
|
||||
// totalDefenseDamageRecoveryFrames = The total timer for defense damage recovery that the player is undergoing
|
||||
//
|
||||
// Defense damage heals over a fixed time (CalamityPlayer.DefenseDamageRecoveryTime).
|
||||
// This is independent of how much defense the player started with, or how much they lost.
|
||||
// If hit again while recovering from defense damage, that fixed time is ADDED to the current recovery timer
|
||||
// (in addition to the player taking more defense damage, of course).
|
||||
// Defense damage does not heal during iframes, and has a delay after they end before it starts recovering.
|
||||
if (totalDefenseDamage > 0)
|
||||
{
|
||||
// Used to cleanse all defense damage by accessories
|
||||
// If a Full Cleanse is in effect, then cleanse all defense damage and don't do anything else.
|
||||
if (CleansingEffect == 1)
|
||||
{
|
||||
totalDefenseDamage = 0;
|
||||
@@ -3944,53 +3941,53 @@ namespace CalamityMod.CalPlayer
|
||||
defenseDamageDelayFrames = 0;
|
||||
CleansingEffect = 0;
|
||||
}
|
||||
|
||||
// Defense damage is capped at your maximum defense, no matter what.
|
||||
if (totalDefenseDamage > Player.statDefense)
|
||||
totalDefenseDamage = Player.statDefense;
|
||||
|
||||
// You cannot begin recovering from defense damage until your iframes wear off.
|
||||
bool hasIFrames = false;
|
||||
for (int i = 0; i < Player.hurtCooldowns.Length; i++)
|
||||
if (Player.hurtCooldowns[i] > 0)
|
||||
hasIFrames = true;
|
||||
|
||||
// Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all.
|
||||
if (!hasIFrames && defenseDamageDelayFrames > 0)
|
||||
--defenseDamageDelayFrames;
|
||||
|
||||
// Once the delay is up, defense damage recovery occurs.
|
||||
else if (defenseDamageDelayFrames <= 0)
|
||||
else
|
||||
{
|
||||
// Make one frame's worth of progress towards recovery.
|
||||
--defenseDamageRecoveryFrames;
|
||||
// Defense damage is capped at your maximum defense, except in GFB.
|
||||
if (!Main.getGoodWorld && totalDefenseDamage > Player.statDefense)
|
||||
totalDefenseDamage = Player.statDefense;
|
||||
|
||||
// If completely recovered, reset defense damage to nothing.
|
||||
if (defenseDamageRecoveryFrames <= 0)
|
||||
// You cannot begin recovering from defense damage until your iframes wear off.
|
||||
if (!Player.HasIFrames())
|
||||
{
|
||||
totalDefenseDamage = 0;
|
||||
defenseDamageRecoveryFrames = 0;
|
||||
totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime;
|
||||
defenseDamageDelayFrames = 0;
|
||||
// Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all.
|
||||
if (defenseDamageDelayFrames > 0)
|
||||
--defenseDamageDelayFrames;
|
||||
|
||||
// Once the delay is up, defense damage recovery actually occurs.
|
||||
else if (defenseDamageDelayFrames <= 0)
|
||||
{
|
||||
// Make one frame's worth of progress towards recovery.
|
||||
--defenseDamageRecoveryFrames;
|
||||
|
||||
// If completely recovered, reset defense damage to nothing.
|
||||
if (defenseDamageRecoveryFrames <= 0)
|
||||
{
|
||||
totalDefenseDamage = 0;
|
||||
defenseDamageRecoveryFrames = 0;
|
||||
totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime;
|
||||
defenseDamageDelayFrames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get current amount of defense damage to apply this frame.
|
||||
int currentDefenseDamage = CurrentDefenseDamage;
|
||||
|
||||
// Apply DR Damage.
|
||||
//
|
||||
// DR Damage is applied at exactly the same ratio as defense damage;
|
||||
// if you lose half your defense to defense damage, you also lose half your DR.
|
||||
// This is applied first because the math would be wrong if the player's defense was already reduced by defense damage.
|
||||
if (Player.statDefense > 0 && Player.endurance > 0f)
|
||||
{
|
||||
float drDamageRatio = currentDefenseDamage / (float)Player.statDefense;
|
||||
Player.endurance *= 1f - drDamageRatio;
|
||||
}
|
||||
|
||||
// Apply defense damage
|
||||
Player.statDefense -= currentDefenseDamage;
|
||||
}
|
||||
|
||||
// Get current amount of defense damage to apply this frame.
|
||||
int currentDefenseDamage = CurrentDefenseDamage;
|
||||
|
||||
// Apply DR Damage.
|
||||
//
|
||||
// DR Damage is applied at exactly the same ratio as defense damage;
|
||||
// if you lose half your defense to defense damage, you also lose half your DR.
|
||||
// This is applied first because the math would be wrong if the player's defense was already reduced by defense damage.
|
||||
if (Player.statDefense > 0 && Player.endurance > 0f)
|
||||
{
|
||||
float drDamageRatio = currentDefenseDamage / (float)Player.statDefense;
|
||||
Player.endurance *= 1f - drDamageRatio;
|
||||
}
|
||||
|
||||
// Apply defense damage
|
||||
Player.statDefense -= currentDefenseDamage;
|
||||
}
|
||||
|
||||
// Defense can never be reduced below zero, no matter what
|
||||
|
||||
@@ -67,12 +67,12 @@ namespace CalamityMod.CalPlayer.Dashes
|
||||
hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage;
|
||||
hitContext.BaseKnockback = AsgardianAegis.ShieldSlamKnockback;
|
||||
|
||||
// TODO -- Asgardian Aegis should probably spawn some god slayer themed explosion instead of a holy attack
|
||||
int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage);
|
||||
// Spawn explosion
|
||||
int explosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage);
|
||||
if (player.Calamity().oldFashioned)
|
||||
supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage);
|
||||
explosionDamage = CalamityUtils.CalcOldFashionedDamage(explosionDamage);
|
||||
|
||||
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<HolyExplosionSupreme>(), supremeExplosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f);
|
||||
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<CosmicDashExplosion>(), explosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f);
|
||||
npc.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer.Dashes
|
||||
@@ -23,17 +25,7 @@ namespace CalamityMod.CalPlayer.Dashes
|
||||
|
||||
public override void OnDashEffects(Player player)
|
||||
{
|
||||
// Spawn fire dust around the player's body.
|
||||
for (int d = 0; d < 20; d++)
|
||||
{
|
||||
Dust holyFireDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f);
|
||||
holyFireDashDust.position += Main.rand.NextVector2Square(-5f, 5f);
|
||||
holyFireDashDust.velocity *= 0.2f;
|
||||
holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f);
|
||||
holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
holyFireDashDust.noGravity = true;
|
||||
holyFireDashDust.fadeIn = 0.5f;
|
||||
}
|
||||
// Nothing
|
||||
}
|
||||
|
||||
public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor)
|
||||
@@ -41,13 +33,20 @@ namespace CalamityMod.CalPlayer.Dashes
|
||||
// Spawn fire dust around the player's body.
|
||||
for (int d = 0; d < 4; d++)
|
||||
{
|
||||
Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f);
|
||||
holyFireDashDust.velocity *= 0.1f;
|
||||
Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f);
|
||||
holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f);
|
||||
holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f);
|
||||
holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
holyFireDashDust.noGravity = true;
|
||||
if (Main.rand.NextBool())
|
||||
holyFireDashDust.fadeIn = 0.5f;
|
||||
holyFireDashDust.fadeIn = 0.1f;
|
||||
}
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Vector2 dustPosition = player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f);
|
||||
Dust dust = Dust.NewDustPerfect(dustPosition, 222, -player.velocity * Main.rand.NextFloat(0.15f, 0.4f), 0, default, 0.5f);
|
||||
dust.noGravity = false;
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +65,34 @@ namespace CalamityMod.CalPlayer.Dashes
|
||||
hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage;
|
||||
hitContext.BaseKnockback = AsgardsValor.ShieldSlamKnockback;
|
||||
|
||||
// TODO -- With the removal of its holy explosion, Asgard's Valor needs better visuals
|
||||
int Dusts = 12;
|
||||
float radians = MathHelper.TwoPi / Dusts;
|
||||
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f));
|
||||
for (int k = 0; k < Dusts; k++)
|
||||
{
|
||||
Vector2 velocity = spinningPoint.RotatedBy(radians * k);
|
||||
Dust dust = Dust.NewDustPerfect(npc.Center, 296, velocity * 3f, 0, default, 2.5f);
|
||||
dust.noGravity = true;
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
|
||||
Dust dust2 = Dust.NewDustPerfect(npc.Center, 158, velocity * 5f, 0, default, 2.2f);
|
||||
dust2.noGravity = true;
|
||||
dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
dust2.color = Color.Salmon;
|
||||
|
||||
Dust dust3 = Dust.NewDustPerfect(npc.Center, 169, velocity * 7f, 0, default, 1.9f);
|
||||
dust3.noGravity = true;
|
||||
dust3.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
dust3.color = Color.SandyBrown;
|
||||
|
||||
}
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(npc.Center, 222, new Vector2(0, -3.5f).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.8f, 1.4f), 0, default, 1.2f);
|
||||
dust.noGravity = false;
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class Photoviscerator : ModItem, ILocalizedModType
|
||||
{
|
||||
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhotoUseSound") { Volume = 0.55f };
|
||||
public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PhotoHitSound") { Volume = 0.45f };
|
||||
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhotoUseSound") { Volume = 0.35f };
|
||||
public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PhotoHitSound") { Volume = 0.4f };
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
// Left-click stats
|
||||
|
||||
@@ -236,9 +236,10 @@ AsgardianAegis: {
|
||||
DisplayName: Asgardian Aegis
|
||||
Tooltip:
|
||||
'''
|
||||
Grants immunity to knockback
|
||||
Immune to most debuffs
|
||||
Grants a cosmic inferno dash which can slam through enemies without taking damage
|
||||
Allows the ability to ram dash, empowered by the cosmic inferno
|
||||
This dash can slam through enemies without taking damage
|
||||
Grants immunity to knockback and fire blocks
|
||||
Grants immunity to the vast majority of debuffs, including God Slayer Inferno
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -246,9 +247,10 @@ AsgardsValor: {
|
||||
DisplayName: Asgard's Valor
|
||||
Tooltip:
|
||||
'''
|
||||
Grants immunity to knockback
|
||||
Immune to several debuffs
|
||||
Grants a holy dash which can slam through enemies without taking damage
|
||||
Allows the ability to ram dash
|
||||
This dash can slam through enemies without taking damage
|
||||
Grants immunity to knockback and fire blocks
|
||||
Grants immunity to most debuffs, including most forms of frost and flame
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -657,8 +659,10 @@ ElysianAegis: {
|
||||
DisplayName: Elysian Aegis
|
||||
Tooltip:
|
||||
'''
|
||||
Grants immunity to knockback and several flame debuffs
|
||||
Grants an enhanced holy flame dash which can slam through enemies without taking damage
|
||||
Allows the ability to ram dash, empowered by holy fire
|
||||
This dash can slam through enemies without taking damage
|
||||
Grants immunity to knockback and fire blocks
|
||||
Grants immunity to most fire debuffs, including Daybreak and Holy Flames
|
||||
Blessed by the Profaned Flame
|
||||
'''
|
||||
}
|
||||
@@ -1203,8 +1207,9 @@ OrnateShield: {
|
||||
DisplayName: Ornate Shield
|
||||
Tooltip:
|
||||
'''
|
||||
Allows the ability to ram dash
|
||||
This dash can slam through enemies without taking damage
|
||||
Grants immunity to Chilled, Frostburn, Frostbite, and Frozen
|
||||
Grants a frost dash which can slam through enemies without taking damage
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -132,3 +132,4 @@ WulfrumLureSignal.DisplayName: Signal
|
||||
YanmeisKnifeSlash.DisplayName: Yanmei's Knife
|
||||
YellowLabSeeker.DisplayName: Seeking Mechanism
|
||||
AscendantAura.DisplayName: Ascendant Aura
|
||||
CosmicDashExplosion.DisplayName: Cosmic Dash Explosion
|
||||
@@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
Projectile.NewProjectile(source, bombPos, bombVel, ProjectileType<ExoLight>(), damage, knockback, Projectile.owner, yDirection);
|
||||
}
|
||||
SoundEngine.PlaySound(HalleysInferno.Hit, Owner.MountedCenter);
|
||||
SoundEngine.PlaySound(HalleysInferno.Hit with { Volume = 0.5f }, Owner.MountedCenter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
dust.scale = Main.rand.NextFloat(1.3f, 1.8f);
|
||||
dust.color = sparkColor;
|
||||
}
|
||||
SoundEngine.PlaySound(HalleysInferno.Shoot, Owner.MountedCenter);
|
||||
SoundEngine.PlaySound(HalleysInferno.Shoot with { Volume = 0.4f } , Owner.MountedCenter);
|
||||
|
||||
int rightClickDamage = (int)(0.5f * damage);
|
||||
Projectile.NewProjectile(source, position, velocity, ProjectileType<ExoFlareCluster>(), rightClickDamage, knockback, Projectile.owner);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class CosmicDashExplosion : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak1") { Volume = 0.3f };
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 4;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(Impact with { PitchVariance = 0.3f }, Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.position);
|
||||
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, 181, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f));
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
for (int j = 0; j < 13; j++)
|
||||
{
|
||||
Vector2 dustVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 272, dustVel, 0, default, 1f);
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 226, dustVel, 0, default, 1f);
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak1") { Volume = 0.3f };
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 60;
|
||||
@@ -30,71 +28,36 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.ai[0] < 2)
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
||||
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
||||
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
for (int i = 0; i < 5; i++)
|
||||
int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust].velocity *= 3f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust].velocity *= 3f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[holyDust].scale = 0.5f;
|
||||
Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[holyDust2].noGravity = true;
|
||||
Main.dust[holyDust2].velocity *= 5f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust2].velocity *= 2f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
Main.dust[holyDust].scale = 0.5f;
|
||||
Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
SoundEngine.PlaySound(Impact with { PitchVariance = 0.3f }, Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.position);
|
||||
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, Main.rand.NextFloat(1.2f, 1.8f));
|
||||
Main.dust[holyDust].velocity *= 3f;
|
||||
Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[holyDust].scale = 0.5f;
|
||||
Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 12; j++)
|
||||
{
|
||||
int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 272, 0f, 0f, 100, default, 0.8f);
|
||||
Main.dust[holyDust2].noGravity = true;
|
||||
Main.dust[holyDust2].velocity *= 5f;
|
||||
int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[holyDust2].noGravity = true;
|
||||
Main.dust[holyDust2].velocity *= 5f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 0.6f);
|
||||
Main.dust[holyDust2].velocity *= 2f;
|
||||
holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holyDust2].velocity *= 2f;
|
||||
if (Projectile.ai[0] == 1)
|
||||
Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,6 +401,25 @@ namespace CalamityMod
|
||||
#endregion
|
||||
|
||||
#region Immunity Frames
|
||||
/// <summary>
|
||||
/// Checks whether the player has any kind of immunity frames (or "iframes" for short) available.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose immunity frames should be checked.</param>
|
||||
/// <returns>Whether or not they are currently in any immunity frames.</returns>
|
||||
public static bool HasIFrames(this Player player)
|
||||
{
|
||||
// Check old school iframes first (aka "cooldown timer -1". Regular hits, falling damage, etc.)
|
||||
if (player.immune || player.immuneTime > 0)
|
||||
return true;
|
||||
|
||||
// Check more particular iframes. This primarily comes from traps, lava, and bosses.
|
||||
for (int i = 0; i < player.hurtCooldowns.Length; i++)
|
||||
if (player.hurtCooldowns[i] > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives the player the specified number of immunity frames (or "iframes" for short).<br />If the player already has more iframes than you want to give them, this function does nothing.
|
||||
/// </summary>
|
||||
@@ -421,6 +440,7 @@ namespace CalamityMod
|
||||
return false;
|
||||
|
||||
// Apply iframes thoroughly.
|
||||
// Player.AddImmuneTime does exist, but is equivalent to the below code.
|
||||
player.immune = true;
|
||||
player.immuneNoBlink = !blink;
|
||||
player.immuneTime = frames;
|
||||
|
||||
Reference in new issue
Block a user