DSO rework.
This commit is contained in:
1 parent
f289c249e8
commit
e71d36a7b6
6 files changed
+98
-52
No files matched your search
@@ -245,7 +245,6 @@ namespace CalamityMod.CalPlayer
|
||||
public int giantShellPostHit = 0;
|
||||
public int tortShellPostHit = 0;
|
||||
public int spiritOriginBullseyeShootCountdown = 0;
|
||||
public int spiritOriginConvertedCrit = 0;
|
||||
public int RustyMedallionCooldown = 0;
|
||||
public int MiniSwamerCooldown = 0;
|
||||
public float SulphWaterPoisoningLevel;
|
||||
@@ -255,6 +254,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool ragePulse = false;
|
||||
public int ragePulseVisualTimer = 0;
|
||||
public int ragePulseTimer = 0;
|
||||
public int SpiritOrginCritChanceIncrease = 0;
|
||||
|
||||
private const int DashDisableCooldown = 12;
|
||||
|
||||
@@ -1904,9 +1904,11 @@ namespace CalamityMod.CalPlayer
|
||||
lumenousAmulet = false;
|
||||
oceanCrest = false;
|
||||
aquaticEmblem = false;
|
||||
if (!spiritOrigin)
|
||||
SpiritOrginCritChanceIncrease = 0;
|
||||
spiritOrigin = false;
|
||||
spiritOriginVanity = false;
|
||||
spiritOriginConvertedCrit = 0;
|
||||
|
||||
|
||||
astralStarRain = false;
|
||||
|
||||
@@ -2396,7 +2398,7 @@ namespace CalamityMod.CalPlayer
|
||||
RustyMedallionCooldown = 0;
|
||||
SulphWaterPoisoningLevel = 0f;
|
||||
holyInfernoFadeIntensity = 0f;
|
||||
spiritOriginConvertedCrit = 0;
|
||||
SpiritOrginCritChanceIncrease = 0;
|
||||
rage = 0f;
|
||||
adrenaline = 0f;
|
||||
raiderCritLifespan = 0f;
|
||||
|
||||
@@ -74,6 +74,7 @@ using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence;
|
||||
using static CalamityMod.Items.Accessories.DaawnlightSpiritOrigin;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
@@ -187,14 +188,14 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
// After everything else, if Daawnlight Spirit Origin is equipped, set ranged crit to the base 4%.
|
||||
// Store all the crit so it can be used in damage calculations.
|
||||
if (spiritOrigin)
|
||||
|
||||
int critChanceDecreaseRate = (int)Utils.Remap(SpiritOrginCritChanceIncrease, 0, ExtraCritHardCap, MinimumLossRate, MaximumLossRate);
|
||||
int perFrameCritChanceDecrease = SpiritOrginCritChanceIncrease <= ExtraCritHardCap ? MinCritLossPerFrame :
|
||||
(int)Utils.Remap(SpiritOrginCritChanceIncrease, ExtraCritHardCap, ExtraCritHardCap + CritHardCapScalingInterval, MinCritLossPerFrame, CritLossPerFrameIncreasePerInterval, clamped: false);
|
||||
if (SpiritOrginCritChanceIncrease > 0 && Player.miscCounter % critChanceDecreaseRate == 0)
|
||||
{
|
||||
// player.rangedCrit already contains the crit stat of the held item, no need to grab it separately.
|
||||
// Don't store the base 4% because you're not removing it.
|
||||
spiritOriginConvertedCrit = (int)(Player.GetTotalCritChance<RangedDamageClass>() - 4);
|
||||
Player.GetCritChance<RangedDamageClass>() = -spiritOriginConvertedCrit;
|
||||
SpiritOrginCritChanceIncrease -= perFrameCritChanceDecrease;
|
||||
Main.NewText(SpiritOrginCritChanceIncrease, Color.Lerp(Color.Green, Color.Red, Utils.GetLerpValue(0, ExtraCritHardCap, SpiritOrginCritChanceIncrease, true)) * 5f);
|
||||
}
|
||||
|
||||
if (Player.ActiveItem().type != ModContent.ItemType<SaharaSlicers>())
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CalamityMod.Buffs.Pets;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Materials;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -18,16 +17,58 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
// "Despite the seemingly insane numbers here, I think this item might actually be underpowered"
|
||||
// hindsight: the item was not underpowered. Ozzatron 05NOV2021
|
||||
//
|
||||
// Regular crits are intentionally weak, especially because they rarely happen (your crit chance gets murdered).
|
||||
// Bullseyes should be doing all the work.
|
||||
private const float OriginBullseyeCritRatio = 3.5f; // Bullseye crits deal x3.5 damage instead of x2.
|
||||
private const float ForcedCritBullseyeCritRatio = 2.4f; // If your projectile is forced to crit, you get less of a reward.
|
||||
// Memes 03SEP2024: Old comments kept for record.
|
||||
|
||||
private const float StoredCritConversionRatio = 0.01f; // Add +1% more damage to crits for every 1% critical chance the player would have had.
|
||||
private const float MinUseTimeForSlowBonus = 11f;
|
||||
private const float MaxSlowBonusUseTime = 72f;
|
||||
private const float MaxSlowWeaponBonus = 0.33f; // Up to +33% more damage to crits for slower weapons.
|
||||
#region Balancing Variables
|
||||
|
||||
/// <summary>
|
||||
/// The bullseye's total lifespan while it is not hit.
|
||||
/// </summary>
|
||||
public const int BullseyeIdleLifetime = 600;
|
||||
|
||||
/// <summary>
|
||||
/// The bullseye's lifespan when hit.
|
||||
/// </summary>
|
||||
public const int BullseyeHitLifetime = 90;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum amount of critcal strike chance lost per decrease.
|
||||
/// </summary>
|
||||
public const int MinCritLossPerFrame = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum rate at which the extra critcal strike chance decreases.<br/>
|
||||
/// This means that it'll decrease every X frames.<br/>
|
||||
/// <br/>
|
||||
/// When there's no critical strike chance, this will be the loss rate,<br/>
|
||||
/// and it'll linearly scale to <see cref="MaximumLossRate"/>.
|
||||
/// </summary>
|
||||
public const int MinimumLossRate = 4;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum rate at which the extra critcal strike chance decreases.<br/>
|
||||
/// This means that it'll decrease every X frames.<br/>
|
||||
/// <br/>
|
||||
/// When the extra critical strike chance reaches <see cref="ExtraCritHardCap"/>,<br/>
|
||||
/// this value will be the loss rate.
|
||||
/// </summary>
|
||||
public const int MaximumLossRate = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of extra critcal strike chance at which the hard scaling starts applying.
|
||||
/// </summary>
|
||||
public const int ExtraCritHardCap = 75;
|
||||
|
||||
/// <summary>
|
||||
/// When the extra critical strike chance is past <see cref="ExtraCritHardCap"/>,<br/>
|
||||
/// every <see cref="CritHardCapScalingInterval"/> more, it'll start decreasing by <see cref="CritLossPerFrameIncreasePerInterval"/> more.
|
||||
/// </summary>
|
||||
public const int CritHardCapScalingInterval = 25;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of extra critical strike chance lost every <see cref="CritLossPerFrameIncreasePerInterval"/> past <see cref="ExtraCritHardCap"/>.
|
||||
/// </summary>
|
||||
public const int CritLossPerFrameIncreasePerInterval = 4;
|
||||
|
||||
// These were very carefully calculated, please don't change them.
|
||||
internal const float RegularEnemyBullseyeRadius = 8f;
|
||||
@@ -36,25 +77,7 @@ namespace CalamityMod.Items.Accessories
|
||||
// Special search radius for coin ricoshots that only applies to DSO targets.
|
||||
public static readonly float RicoshotSearchDistance = 2800f;
|
||||
|
||||
internal static float GetDamageMultiplier(Player p, CalamityPlayer mp, bool hitBullseye, bool wasForcedCrit)
|
||||
{
|
||||
float baseCritMult = 2f; // In vanilla Terraria, crits do +100% damage.
|
||||
|
||||
// If a bullseye was struck, replace a "regular crit" with a "bullseye crit".
|
||||
if (hitBullseye)
|
||||
{
|
||||
// Bullseye crits are weaker if the projectile was already a forced crit.
|
||||
// This is currently implemented for ULTRAKILL-style ricoshots and for Heavenly Gale's lightning.
|
||||
baseCritMult = wasForcedCrit ? ForcedCritBullseyeCritRatio : OriginBullseyeCritRatio;
|
||||
}
|
||||
|
||||
// Factor in the critical strike chance the player isn't getting to use.
|
||||
float convertedCritBonus = StoredCritConversionRatio * mp.spiritOriginConvertedCrit;
|
||||
|
||||
float useTimeInterpolant = Utils.GetLerpValue(MinUseTimeForSlowBonus, MaxSlowBonusUseTime, p.ActiveItem().useTime, true);
|
||||
float slowWeaponBonus = MathHelper.Lerp(0f, MaxSlowWeaponBonus, useTimeInterpolant);
|
||||
return baseCritMult * (1f + convertedCritBonus + slowWeaponBonus);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
|
||||
@@ -6118,7 +6118,6 @@ namespace CalamityMod.NPCs
|
||||
|
||||
// Don't allow large hitbox projectiles or explosions to "snipe" enemies.
|
||||
// Hitbox criteria were changed to allow long one dimensional projectiles so that Condemnation would work.
|
||||
bool hitBullseye = false;
|
||||
bool acceptableVelocity = projectile.velocity != Vector2.Zero;
|
||||
bool acceptableHitbox = (projectile.width <= 36) || (projectile.height <= 36);
|
||||
if (bullseye != null && acceptableVelocity && acceptableHitbox)
|
||||
@@ -6149,19 +6148,19 @@ namespace CalamityMod.NPCs
|
||||
bool willStrikeBullseye = dotCenter > dotOne && dotCenter > dotTwo;
|
||||
|
||||
// If a bullseye is triggered, set it as hit.
|
||||
if (willStrikeBullseye && bullseye.ai[1] == 0f)
|
||||
if (willStrikeBullseye)
|
||||
{
|
||||
modifiers.SetCrit();
|
||||
hitBullseye = true;
|
||||
bullseye.ai[1] = 1f; // Make the bullseye disappear immediately.
|
||||
Main.player[projectile.owner].Calamity().SpiritOrginCritChanceIncrease += Main.player[projectile.owner].ActiveItem().useTime;
|
||||
|
||||
if (bullseye.ai[2] == 0f)
|
||||
{
|
||||
bullseye.timeLeft = DaawnlightSpiritOrigin.BullseyeHitLifetime;
|
||||
bullseye.ai[2] = 1f;
|
||||
}
|
||||
|
||||
bullseye.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// The bonus provided by Daawnlight Spirit Origin can be computed as a complete replacement to regular crits.
|
||||
// As such, it is subtracted by the base critical strike damage boost of 200%
|
||||
float bonus = DaawnlightSpiritOrigin.GetDamageMultiplier(player, modPlayer, hitBullseye, cgp.forcedCrit) - 2f;
|
||||
modifiers.CritDamage += bonus;
|
||||
}
|
||||
|
||||
if (!projectile.npcProj && !projectile.trap)
|
||||
|
||||
@@ -16,6 +16,7 @@ using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.PlagueEnemies;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
@@ -187,15 +188,23 @@ namespace CalamityMod.Projectiles
|
||||
|
||||
public override void OnSpawn(Projectile projectile, IEntitySource source)
|
||||
{
|
||||
// TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile
|
||||
// which is way too early, the projectile's own initialization isn't even done yet
|
||||
|
||||
CreatedByPlayerDash = source is ProjectileSource_PlayerDashHit;
|
||||
|
||||
IEntitySource sourceItem = source as EntitySource_ItemUse_WithAmmo;
|
||||
if (sourceItem != null)
|
||||
extorterBoost = true;
|
||||
|
||||
// TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile
|
||||
// which is way too early, the projectile's own initialization isn't even done yet
|
||||
// Whenever the player has Daawnlight Spirit Origin, any ranged projectile will have the capacity to infintely supercrit.
|
||||
if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass<RangedDamageClass>())
|
||||
{
|
||||
projectile.CritChance += Main.player[projectile.owner].Calamity().SpiritOrginCritChanceIncrease;
|
||||
projectile.Calamity().supercritHits = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion On Spawn
|
||||
|
||||
#region Set Defaults
|
||||
|
||||
@@ -10,15 +10,27 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public class SpiritOriginBullseye : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public NPC Target => Main.npc[(int)Projectile.ai[0]];
|
||||
|
||||
public bool FadingOut
|
||||
{
|
||||
get => Projectile.ai[1] == 1f;
|
||||
set => Projectile.ai[1] = value.ToInt();
|
||||
}
|
||||
|
||||
public bool HasBeenHit
|
||||
{
|
||||
get => Projectile.ai[2] == 1f;
|
||||
set => Projectile.ai[2] = value.ToInt();
|
||||
}
|
||||
|
||||
public Vector2 BullseyeOffsetFromCenter;
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = (int)(2 * DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius);
|
||||
@@ -27,7 +39,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Projectile.hostile = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.timeLeft = DaawnlightSpiritOrigin.BullseyeIdleLifetime;
|
||||
Projectile.Opacity = 0f;
|
||||
Projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user