DSO visuals & cooldown.
This commit is contained in:
1 parent
e71d36a7b6
commit
673bbad28a
8 files changed
+131
-3
No files matched your search
@@ -188,15 +188,19 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (spiritOrigin)
|
||||
{
|
||||
if (Player.Calamity().cooldowns.TryGetValue(DaawnlightSpiritOriginExtraCrit.ID, out var cooldown))
|
||||
cooldown.timeLeft = Math.Max(0, ExtraCritHardCap - SpiritOrginCritChanceIncrease);
|
||||
else
|
||||
Player.AddCooldown(DaawnlightSpiritOriginExtraCrit.ID, ExtraCritHardCap);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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>())
|
||||
saharaSlicersBolts = 0;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 710 B |
Binary file not shown.
|
After Width: | Height: | Size: 618 B |
Binary file not shown.
|
After Width: | Height: | Size: 591 B |
@@ -0,0 +1,48 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Localization;
|
||||
using static CalamityMod.Items.Accessories.DaawnlightSpiritOrigin;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
public class DaawnlightSpiritOriginExtraCrit : CooldownHandler
|
||||
{
|
||||
public static new string ID => "DSOCritCooldown";
|
||||
|
||||
// If the player doesn't have DSO, this cooldown should not appear.
|
||||
public override bool ShouldDisplay => instance.player.GetModPlayer<CalamityPlayer>().spiritOrigin;
|
||||
|
||||
private float ExtraCritChance => instance.player.GetModPlayer<CalamityPlayer>().SpiritOrginCritChanceIncrease;
|
||||
|
||||
private float TextXOffset => (ExtraCritChance > 99 ? -24 : ExtraCritChance > 9 ? -20 : -16) * TextScale;
|
||||
private Vector2 TextPosition => new(TextXOffset , 25);
|
||||
private Color TextColor => Color.Lerp(Color.White , Color.Tomato , Utils.GetLerpValue(ExtraCritHardCap - 10 , ExtraCritHardCap , instance.player.GetModPlayer<CalamityPlayer>().SpiritOrginCritChanceIncrease , false));
|
||||
private Color TextBorderColor = Color.Black;
|
||||
private float TextScale => Utils.Remap(ExtraCritChance, 0, ExtraCritHardCap, 1f, 1.5f);
|
||||
|
||||
public override bool CanTickDown => false;
|
||||
|
||||
public override Color CooldownStartColor => new(Main.DiscoR, Main.DiscoG, Main.DiscoB);
|
||||
|
||||
public override Color CooldownEndColor => new(Main.DiscoB, Main.DiscoR, Main.DiscoG);
|
||||
|
||||
public override string Texture => "CalamityMod/Cooldowns/" + ID;
|
||||
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
|
||||
public override void DrawExpanded(SpriteBatch spriteBatch , Vector2 position , float opacity , float scale)
|
||||
{
|
||||
base.DrawExpanded(spriteBatch , position , opacity , scale);
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch , FontAssets.MouseText.Value , $"+{ExtraCritChance}%" , position + TextPosition , TextColor , TextBorderColor , TextScale);
|
||||
}
|
||||
|
||||
public override void DrawCompact(SpriteBatch spriteBatch , Vector2 position , float opacity , float scale)
|
||||
{
|
||||
base.DrawCompact(spriteBatch , position , opacity , scale);
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch , FontAssets.MouseText.Value , $"+{ExtraCritChance}%" , position + TextPosition , TextColor , TextBorderColor , TextScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6158,6 +6158,24 @@ namespace CalamityMod.NPCs
|
||||
bullseye.ai[2] = 1f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int randomStarAmount = Main.rand.Next(3, 6);
|
||||
float randomCircleRotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
for (int i = 0 ; i < randomStarAmount ; i++)
|
||||
{
|
||||
Particle fancyStars = new FancyStars(
|
||||
bullseye.Center,
|
||||
Main.rand.NextFloat(MathHelper.TwoPi) * Main.rand.NextBool().ToDirectionInt(),
|
||||
Main.rand.NextFloat(0.42f, 0.63f),
|
||||
(MathHelper.TwoPi / randomStarAmount * i).ToRotationVector2().RotatedBy(randomCircleRotation).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(7f, 12f),
|
||||
Main.rand.NextFloat(0.1f, 0.5f),
|
||||
55,
|
||||
new Color(Main.rand.Next(256), Main.rand.Next(256), Main.rand.Next(256)) * 1.2f);
|
||||
GeneralParticleHandler.SpawnParticle(fancyStars);
|
||||
}
|
||||
}
|
||||
|
||||
bullseye.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class FancyStars : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/FancyStars";
|
||||
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public override bool SetLifetime => true;
|
||||
|
||||
public override bool UseAdditiveBlend => true;
|
||||
|
||||
private readonly float _rotationSpeed;
|
||||
private readonly int _variant;
|
||||
|
||||
public FancyStars(
|
||||
Vector2 position ,
|
||||
float rotation ,
|
||||
float scale ,
|
||||
Vector2 velocity ,
|
||||
float rotationSpeed ,
|
||||
int lifeTime ,
|
||||
Color color)
|
||||
{
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
Scale = Math.Max(0f , scale);
|
||||
Velocity = velocity;
|
||||
_rotationSpeed = rotationSpeed;
|
||||
Lifetime = lifeTime;
|
||||
Color = color;
|
||||
_variant = Main.rand.Next(5);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
float interpolator = MathF.Pow(Utils.GetLerpValue(0f, 60f, Lifetime), 0.56f);
|
||||
Velocity *= interpolator;
|
||||
Rotation += _rotationSpeed * interpolator;
|
||||
Scale -= 0.01f * interpolator;
|
||||
Scale = Math.Max(0f , Scale);
|
||||
Color *= interpolator;
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle starVariant = texture.Frame(horizontalFrames: 5, verticalFrames: 1, frameX: _variant);
|
||||
spriteBatch.Draw(texture , Position - Main.screenPosition , starVariant , Color , Rotation , starVariant.Size() * 0.5f , Scale , SpriteEffects.None , layerDepth: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Reference in new issue
Block a user