Hop and Debuff
This commit is contained in:
1 parent
707bdeb930
commit
ec411597a6
7 files changed
+374
-68
No files matched your search
@@ -21,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
{
|
||||
public static DebuffData debuffData = new DebuffData()
|
||||
{
|
||||
EnemyLostRegen = 20,
|
||||
EnemyLostRegen = 12,
|
||||
NPCLifeRegenMethod = WindChilledNPCLifeRegen,
|
||||
ColdDebuffScaling = 1
|
||||
};
|
||||
@@ -37,8 +37,8 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
{
|
||||
var cnpc = npc.Calamity();
|
||||
|
||||
int baseDoTValue = (int)(cnpc.windChilledMult * debuffData.EnemyLostRegen);
|
||||
cnpc.ApplyDPSDebuff(baseDoTValue, Math.Max((int)(baseDoTValue * debuffData.MultiplierDamageTickSize), debuffData.MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
|
||||
int baseDoTValue = (int)(cnpc.windChilledMult * npc.Calamity().ActiveColdDebuffMultiplier.ApplyTo(debuffData.EnemyLostRegen));
|
||||
cnpc.ApplyDPSDebuff(baseDoTValue, Math.Max((int)(baseDoTValue * debuffData.MultiplierDamageTickSize), debuffData.MinimumDamageTickSize) / 2, ref npc.lifeRegen, ref damage);
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.frozenCube = true;
|
||||
modPlayer.ColdDebuffMultiplier += modPlayer.frozenCubePower;
|
||||
|
||||
int projectile = ProjectileType<Elumphant>();
|
||||
if (player.ownedProjectileCounts[projectile] < 1 && !player.dead)
|
||||
{
|
||||
Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, 0, 0f, player.whoAmI);
|
||||
int damage = (int)player.GetTotalDamage<GenericDamageClass>().ApplyTo(slamBaseDamage);
|
||||
Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI);
|
||||
}
|
||||
}
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
|
||||
@@ -407,9 +407,9 @@ WindChilled: {
|
||||
'''
|
||||
ItemTooltipEnemy:
|
||||
'''
|
||||
Cold - 10 DPS
|
||||
Cold - 6 DPS
|
||||
1.5x damage if the enemy is inflicted with a Water debuff
|
||||
Enhances Water debuff damage
|
||||
Enhances Water debuff damage
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -2245,5 +2245,13 @@ XyksBlessingOrange: {
|
||||
|
||||
FrozenCube: {
|
||||
DisplayName: Frozen Cube
|
||||
Tooltip: ""
|
||||
Tooltip:
|
||||
'''
|
||||
A frozen block of ice with something inside
|
||||
Summons an Elumphant to sit atop your head and protect you
|
||||
The Elumphant will cycle between shooting cold air that inflicts [cbuff:CalamityMod/WindChilled], and headbutting enemies
|
||||
Elumphant's headbutts only target enemies inflicted with [cbuff:CalamityMod/WindChilled]
|
||||
Reduces your defense by 33%, but uses that defense to boost the Elumphant's power and your cold debuff damage
|
||||
[c/7497ED:What I wanna know is, where's the mammoth?']
|
||||
'''
|
||||
}
|
||||
@@ -32,13 +32,15 @@ namespace CalamityMod.Particles
|
||||
public float SineRate = 0;
|
||||
public float SineIntensity = 0;
|
||||
public float Sine = 0;
|
||||
public float SineRotation = 0;
|
||||
public float TurnRate = 0;
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public bool AltVisual = true;
|
||||
public override bool UseAdditiveBlend => AltVisual;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public CustomPulsingSpark(Vector2 relativePosition, Vector2 velocity, string frontTexture, string backTexture, bool affectedByGravity, int lifetime, float scale, Color color, Color backColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, int pulseRate = 10, float sineRate = 1, float sineIntensity = 0, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
|
||||
public CustomPulsingSpark(Vector2 relativePosition, Vector2 velocity, string frontTexture, string backTexture, bool affectedByGravity, int lifetime, float scale, Color color, Color backColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, int pulseRate = 10, float turnRate = 0, float sineRate = 1, float sineIntensity = 0, float sineRotation = 0, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
@@ -67,6 +69,8 @@ namespace CalamityMod.Particles
|
||||
randTimeAdd = Main.rand.Next(0, 200 + 1);
|
||||
SineRate = sineRate;
|
||||
SineIntensity = sineIntensity;
|
||||
SineRotation = sineRotation;
|
||||
TurnRate = turnRate;
|
||||
|
||||
if (FadeIn)
|
||||
Scale = 0f;
|
||||
@@ -102,6 +106,8 @@ namespace CalamityMod.Particles
|
||||
Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation;
|
||||
|
||||
Sine = (float)Math.Sin(((Time + randTimeAdd) * SineRate) / MathHelper.Pi) * SineIntensity;
|
||||
if (TurnRate != 0)
|
||||
Velocity = Velocity.RotatedBy(TurnRate);
|
||||
|
||||
Stretch.X *= (1 - 0.2f * ShrinkSpeed);
|
||||
Stretch.Y *= (1 + 0.2f * ShrinkSpeed);
|
||||
@@ -117,7 +123,7 @@ namespace CalamityMod.Particles
|
||||
Color col = Color;
|
||||
Color backCol = BackColor;
|
||||
|
||||
Vector2 drawPos = Position + Vector2.UnitX * Sine;
|
||||
Vector2 drawPos = Position + Vector2.UnitX.RotatedBy(SineRotation) * Sine;
|
||||
if (AffectedByLight)
|
||||
{
|
||||
col = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(Color);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -33,7 +35,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public ref float attackTimer => ref Projectile.ai[1];
|
||||
|
||||
public float fxFade = 0; // The glow visuals multiplier
|
||||
public float followSpeed = 12; // The speed it follows you, lower is faster
|
||||
public float followSpeed = 7; // The speed it follows you, lower is faster
|
||||
public float lerpDir = 0;
|
||||
public float actionSpeed = 1;
|
||||
|
||||
@@ -53,9 +55,17 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public bool attackedThisFrame = false;
|
||||
public int attackDirection = 1;
|
||||
public float mistShootTimer = 0;
|
||||
public int attacksDone = 0;
|
||||
public bool recoiling = false;
|
||||
public float maxTargetingDistance => 500 * GetPower(0.25f);
|
||||
public float maxTrunkRot => -MathHelper.PiOver2 * 1.1f;
|
||||
public int attackTime => (int)(FrozenCube.baseAttackSpeed);
|
||||
public int attackTimeAdjusted => (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f) + 0.23f * Projectile.numHits));
|
||||
public int cooldownTime => (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f));
|
||||
public List<NPC> hitNPCs = new List<NPC>();
|
||||
public Vector2 lastHitNPCPos;
|
||||
public Vector2 lastProjPos;
|
||||
public bool spawnJumpDusts = true;
|
||||
|
||||
Vector2 goalPosition;
|
||||
public override void SetStaticDefaults()
|
||||
@@ -71,12 +81,18 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
}
|
||||
public void SetElumphantPower()
|
||||
{
|
||||
int usedDefense = (Owner.statDefense / 3);
|
||||
if (time == 0)
|
||||
CombatText.NewText(Projectile.Hitbox, color2, -usedDefense,false, true);
|
||||
Owner.statDefense -= usedDefense;
|
||||
Owner.Calamity().frozenCubePower = usedDefense * 0.05f;
|
||||
Owner.Calamity().ColdDebuffMultiplier += Owner.Calamity().frozenCubePower;
|
||||
}
|
||||
public float GetPower(float efficiency) => 1 + Owner.Calamity().frozenCubePower * efficiency;
|
||||
public void GetColor()
|
||||
@@ -100,6 +116,11 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
}
|
||||
public void SetDirection(int newDirection)
|
||||
{
|
||||
if (newDirection == 0)
|
||||
{
|
||||
Projectile.spriteDirection = Owner.direction;
|
||||
return;
|
||||
}
|
||||
if (Projectile.spriteDirection != newDirection)
|
||||
{
|
||||
trunkRotation *= -1;
|
||||
@@ -107,18 +128,55 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
}
|
||||
Projectile.spriteDirection = newDirection;
|
||||
}
|
||||
public void GetTarget() => targeted = Projectile.Center.ClosestNPCAt(500, false);
|
||||
public void GetTarget(bool excludeHitNPCs) // Target closest NPC to mouse, unless they're too far, then do closest to Elumphant
|
||||
{
|
||||
if (excludeHitNPCs)
|
||||
{
|
||||
float distance = maxTargetingDistance * 5;
|
||||
NPC chosenTarget = null;
|
||||
for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits.
|
||||
{
|
||||
NPC searchedTarget = Main.npc[index];
|
||||
if (searchedTarget.CanBeChasedBy(null, false))
|
||||
{
|
||||
float extraDistance = (searchedTarget.width / 2) + (searchedTarget.height / 2);
|
||||
|
||||
bool canHit = true;
|
||||
if (extraDistance < distance)
|
||||
canHit = Collision.CanHit(Projectile.Center, 1, 1, Main.npc[index].Center, 1, 1); // blocked by walls
|
||||
|
||||
if (searchedTarget.HasBuff(ModContent.BuffType<WindChilled>()) && Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && !hitNPCs.Contains(searchedTarget) && searchedTarget.active && searchedTarget.life > 0 && canHit)
|
||||
{
|
||||
distance = Vector2.Distance(Projectile.Center, searchedTarget.Center);
|
||||
chosenTarget = searchedTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
targeted = chosenTarget;
|
||||
}
|
||||
else
|
||||
{
|
||||
targeted = (Owner.ClampedMouseWorld()).ClosestNPCAt(maxTargetingDistance, true);
|
||||
if (!ValidDistance())
|
||||
targeted = (Projectile.Center).ClosestNPCAt(maxTargetingDistance, true);
|
||||
if (!ValidDistance())
|
||||
targeted = null;
|
||||
}
|
||||
}
|
||||
public bool ValidDistance() => (targeted != null && targeted.Distance(Projectile.Center) < maxTargetingDistance);
|
||||
public override void AI()
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
lastHitNPCPos = lastProjPos = Owner.MountedCenter;
|
||||
}
|
||||
Projectile.timeLeft++;
|
||||
SetElumphantPower();
|
||||
GetColor();
|
||||
SetElumphantPower();
|
||||
ManageSquash();
|
||||
|
||||
Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.3f);
|
||||
|
||||
if (Owner.controlUseItem)
|
||||
Main.NewText(GetPower(1));
|
||||
if (targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile)))
|
||||
targeted = null;
|
||||
|
||||
float sine = MathF.Sin(time * 0.04f);
|
||||
float sine2 = MathF.Sin(time * 0.08f);
|
||||
@@ -132,31 +190,117 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
else if (mammothOops)
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(0, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true));
|
||||
else if (hopTimer > 0)
|
||||
trunkRotation = trunkRotation.AngleLerp(maxTrunkRot * Projectile.spriteDirection, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true));
|
||||
trunkRotation = MathHelper.WrapAngle(MathHelper.Lerp(0, maxTrunkRot * Projectile.spriteDirection - Projectile.rotation, MathF.Pow(Utils.GetLerpValue(0, hopTimerMax / 2, hopTimer, true), mammothOops ? 1f : 1f)));
|
||||
|
||||
Vector2 offsetY = -Vector2.UnitY * (Owner.height / 2 + Projectile.height / 2.5f) * (1 + 0.4f * sine2 * fallLerp + 5 * CalamityUtils.EaseInOutExp(fallLerp, 2f, 2f)) * hop;
|
||||
Vector2 offsetX = Vector2.UnitX * ((3 * Projectile.spriteDirection) + 17 * sine3 * fallLerp);
|
||||
Vector2 offsetY = -Vector2.UnitY * (Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) * (1 + 0.4f * sine2 * fallLerp + 5 * CalamityUtils.EaseInOutExp(fallLerp, 2f, 2f)) * hop;
|
||||
Vector2 offsetX = Vector2.UnitX * ((3 * Projectile.spriteDirection) + 17 * sine3 * fallLerp) * Projectile.scale;
|
||||
goalPosition = Owner.MountedCenter + offsetX + offsetY;
|
||||
|
||||
if (dashing)
|
||||
{
|
||||
Projectile.frame = 2;
|
||||
SetDirection(Math.Sign(Projectile.velocity.X));
|
||||
if (attackTimer == 0)
|
||||
{
|
||||
GetTarget(true);
|
||||
}
|
||||
if (attacksDone != 0)
|
||||
Projectile.frame = 2;
|
||||
|
||||
Projectile.velocity = (goalPosition - Projectile.Center) / (followSpeed);
|
||||
float attackLerp = Utils.GetLerpValue((int)(attackTimeAdjusted / 2), attackTimeAdjusted, attackTimer, true);
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction);
|
||||
fxFade = attackLerp;
|
||||
if (targeted == null || (targeted != null && (targeted.life <= 0 || !targeted.active)))
|
||||
{
|
||||
if (attackLerp > 0 && !recoiling)
|
||||
{
|
||||
lastHitNPCPos = Projectile.Center;
|
||||
attackTimer = attackTimeAdjusted;
|
||||
}
|
||||
recoiling = true;
|
||||
targeted = null;
|
||||
}
|
||||
|
||||
Vector2 ownerPos = (Owner.MountedCenter + new Vector2((3 * Projectile.spriteDirection), -(Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale)));
|
||||
Vector2 basePosition = recoiling ? ownerPos : Projectile.numHits == 0 ? ownerPos : (lastHitNPCPos);
|
||||
Vector2 targetPos = recoiling ? lastHitNPCPos : targeted.Center - (Vector2.UnitY * targeted.height / 2);
|
||||
|
||||
float jumpHeight = Math.Max(250 - Projectile.numHits * 40, recoiling ? 250 : 60);
|
||||
float jumpLerp = attackLerp > 0.5f ? 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 1f, attackLerp), 4)) : 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 0f, attackLerp), 2));
|
||||
float jumpOffsetY = MathHelper.Lerp(basePosition.Y, targetPos.Y, attackLerp) - (jumpHeight + Math.Max(targeted != null ? (Owner.Center.Y - targeted.Center.Y) : 0, 0)) * jumpLerp;
|
||||
float jumpOffsetX = MathHelper.Lerp(basePosition.X, targetPos.X, attackLerp);
|
||||
goalPosition = new Vector2(jumpOffsetX, jumpOffsetY);
|
||||
|
||||
Projectile.Center = goalPosition;
|
||||
|
||||
if (attackLerp > 0f && spawnJumpDusts)
|
||||
{
|
||||
bool clrChoose = Main.rand.NextBool();
|
||||
int halfDusts = 14;
|
||||
for (int i = -halfDusts; i <= halfDusts; i++)
|
||||
{
|
||||
Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 1.8f);
|
||||
Vector2 dustPos = Owner.MountedCenter + Vector2.UnitY * -(Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) + dustVel * 1.5f;
|
||||
Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType<SquashDustPixelated>(),
|
||||
dustVel.RotatedByRandom(0.55f) * (Math.Abs(i) * 0.2f) * (Main.rand.NextBool(5) ? 3 : 1), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 2.5f);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool() ? color1 : color2;
|
||||
dust2.customData = new Vector2(0.6f, 1.5f);
|
||||
dust2.fadeIn = -0.7f;
|
||||
|
||||
if (i == -1)
|
||||
i = 1;
|
||||
}
|
||||
spawnJumpDusts = false;
|
||||
}
|
||||
|
||||
if (attackLerp > 0.6f && !recoiling)
|
||||
{
|
||||
Vector2 vel = lastProjPos.DirectionTo(Projectile.Center);
|
||||
bool clrChoose = Main.rand.NextBool();
|
||||
float opacity = 0.3f * attackLerp;
|
||||
Particle smoke = new CustomColorChangeSpark(Projectile.Center - vel * 18, vel * Main.rand.NextFloat(0.3f, 0.45f), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(12, 17), (Main.rand.NextFloat(0.35f, 0.45f) + 0.35f * attackLerp) * Projectile.scale, (clrChoose ? color1 : color2) with { A = 0 } * opacity, (clrChoose ? color2 : color1) with { A = 0 } * opacity, new Vector2(0.65f, 1f), false, shrinkSpeed: 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke, true, Enums.GeneralDrawLayer.BeforeProjectiles);
|
||||
}
|
||||
|
||||
float goalAngle = (attackLerp > 0.5f ? basePosition.DirectionTo(Projectile.Center) : Projectile.Center.DirectionTo(targetPos)).ToRotation() + (attackLerp > 0.5f ? MathHelper.PiOver2 : -MathHelper.PiOver2);
|
||||
if (!recoiling)
|
||||
Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, -MathHelper.PiOver2 * Projectile.spriteDirection, MathHelper.PiOver2 * Projectile.spriteDirection)) * (1 - MathF.Pow(1 - attackLerp, 3));
|
||||
else
|
||||
Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, MathHelper.TwoPi * 2 * Projectile.spriteDirection, 0));
|
||||
trunkRotation = trunkRotation.AngleLerp(Projectile.rotation, recoiling ? 1 : 0.15f);
|
||||
|
||||
int attemptDir = Math.Sign((recoiling ? basePosition.X : targetPos.X) - Projectile.Center.X);
|
||||
SetDirection(attemptDir);
|
||||
|
||||
if (attackTimer <= (int)(attackTimeAdjusted / 2) && recoiling)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
hitNPCs.Clear();
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
recoiling = false;
|
||||
dashing = false;
|
||||
Projectile.numHits = 0;
|
||||
attackTimer = (int)(cooldownTime / 2);
|
||||
attacksDone = 0;
|
||||
spawnJumpDusts = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
Projectile.localNPCImmunity[i] = 0;
|
||||
GetTarget(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction);
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : Math.Sign(Owner.velocity.X);
|
||||
if (fallTimer == 0)
|
||||
SetDirection(direction);
|
||||
Projectile.Center = goalPosition;
|
||||
|
||||
if (targeted == null)
|
||||
GetTarget();
|
||||
if (attackTimer > cooldownTime && targeted != null) // Attack!!!
|
||||
GetTarget(false);
|
||||
if (attackTimer == cooldownTime && !ValidDistance())
|
||||
attackTimer--;
|
||||
if (attackTimer > cooldownTime && ValidDistance()) // Attack!!!
|
||||
{
|
||||
Projectile.frame = 1;
|
||||
float angleSweep = MathF.Sin(attackTimer * 0.085f) * attackDirection;
|
||||
float goalAngle = Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2;
|
||||
if (attackTimer == cooldownTime + 1) // Make start attack sound
|
||||
{
|
||||
SoundStyle attack = new("CalamityMod/Sounds/Item/ElumphantSound");
|
||||
@@ -167,27 +311,38 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
}
|
||||
SetDirection(Math.Sign(Projectile.Center.DirectionTo(targeted.Center).X));
|
||||
horizontalSquash = 0.5f;
|
||||
float angleSweep = MathF.Sin(attackTimer * 0.085f) * attackDirection;
|
||||
float goalAngle = Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2;
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp((goalAngle + MathHelper.PiOver2 * Projectile.spriteDirection) * fallLerp, 0.07f);
|
||||
trunkRotation = trunkRotation.AngleLerp(goalAngle - Projectile.rotation - MathHelper.PiOver4 * angleSweep, 0.12f);
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp((goalAngle + MathHelper.PiOver2 * Projectile.spriteDirection), 0.07f) * MathF.Pow(fallLerp, 0.2f);
|
||||
float angleMax = MathHelper.PiOver4 * 0.75f * Utils.GetLerpValue(maxTargetingDistance, 30, Projectile.Center.Distance(targeted.Center), true);
|
||||
if (hopTimer == 0)
|
||||
trunkRotation = trunkRotation.AngleLerp(goalAngle - Projectile.rotation - angleMax * angleSweep, 0.23f);
|
||||
|
||||
if (mistShootTimer == 0)
|
||||
if (attackTimer > (cooldownTime * 1.1f))
|
||||
{
|
||||
Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2();
|
||||
int damage = (int)Owner.GetTotalDamage<GenericDamageClass>().ApplyTo(FrozenCube.mistBaseDamage);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVel * 5, shootVel * 10, ModContent.ProjectileType<PristineSecondary>(), damage, 0, Owner.whoAmI);
|
||||
if (mistShootTimer == 0 && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2();
|
||||
int damage = (int)Owner.GetTotalDamage<GenericDamageClass>().ApplyTo(FrozenCube.mistBaseDamage * GetPower(4));
|
||||
int projectile = ModContent.ProjectileType<ElumphantMist>();
|
||||
Vector2 shootPosition = Projectile.Center + shootVel * 5 * Projectile.scale;
|
||||
Projectile mist = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), shootPosition, (shootVel * shootPosition.Distance(targeted.Center) / 25) * Main.rand.NextFloat(0.9f, 1.1f), projectile, damage, 0, Owner.whoAmI, 0, Owner.ownedProjectileCounts[projectile] % 3, GetPower(1));
|
||||
}
|
||||
mistShootTimer += 0.35f * GetPower(0.25f);
|
||||
if (mistShootTimer >= 2f)
|
||||
mistShootTimer = 0;
|
||||
}
|
||||
mistShootTimer += 0.5f * GetPower(0.5f);
|
||||
if (mistShootTimer >= 5)
|
||||
mistShootTimer = 0;
|
||||
|
||||
mammothFlip = false;
|
||||
|
||||
attackedThisFrame = true;
|
||||
if (attackTimer == cooldownTime + attackTime)
|
||||
{
|
||||
attackDirection *= -1;
|
||||
Projectile.frame = 0;
|
||||
attacksDone++;
|
||||
if (attacksDone >= 2) // Every 2 attacks, do a dash slam
|
||||
{
|
||||
dashing = true;
|
||||
attackTimer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Idle
|
||||
@@ -211,7 +366,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
verticalSquash = 0.3f;
|
||||
SoundStyle cry = new("CalamityMod/Sounds/Item/ElumphantCry");
|
||||
SoundEngine.PlaySound(cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame());
|
||||
SoundEngine.PlaySound(cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center);
|
||||
}
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, maxTrunkRot * Projectile.spriteDirection, 0.025f);
|
||||
}
|
||||
@@ -241,7 +396,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
if (mammothFlip)
|
||||
{
|
||||
Projectile.rotation -= 0.11f * Projectile.spriteDirection * fallLerp;
|
||||
Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation - 0.11f * Projectile.spriteDirection * fallLerp);
|
||||
}
|
||||
else
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2 * 0.7f * sine * fallLerp, 0.015f);
|
||||
@@ -252,7 +407,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (Owner.velocity.Y > 8)
|
||||
{
|
||||
if (fallTimer == 0)
|
||||
mammothFlip = Main.rand.NextBool(3);
|
||||
mammothFlip = true;//Main.rand.NextBool(3);
|
||||
hitHead = false;
|
||||
SetRandCry();
|
||||
SetRandBlink();
|
||||
@@ -274,7 +429,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
SoundEngine.PlaySound(bonk with { Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center);
|
||||
|
||||
int halfDusts = 7;
|
||||
Owner.SetScreenshake(2);
|
||||
Owner.SetScreenshake(3);
|
||||
Projectile.frame = 1;
|
||||
SetRandBlink();
|
||||
for (int i = -halfDusts; i <= halfDusts; i++)
|
||||
@@ -300,15 +455,22 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
mammothOops = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.rotation = 0;
|
||||
}
|
||||
mammothFlip = false;
|
||||
}
|
||||
|
||||
if (fxFade > 0)
|
||||
Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.6f * fxFade);
|
||||
|
||||
if (fallTimer > lastHighestFallTimer)
|
||||
lastHighestFallTimer = (int)fallTimer;
|
||||
|
||||
if (attackTimer == attackTime + cooldownTime)
|
||||
if (attackTimer >= attackTime + cooldownTime)
|
||||
attackTimer = 0;
|
||||
if (!dashing) attackTimer++;
|
||||
|
||||
attackTimer += recoiling ? -0.75f : 1;
|
||||
time++;
|
||||
if (mammothOops)
|
||||
hopTimer++;
|
||||
@@ -320,6 +482,8 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
attackedThisFrame = false;
|
||||
|
||||
lastProjPos = Projectile.Center;
|
||||
|
||||
if (!Owner.Calamity().frozenCube)
|
||||
Projectile.Kill();
|
||||
}
|
||||
@@ -338,42 +502,121 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Texture2D trunk = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/ElumphantTrunk").Value;
|
||||
Texture2D bTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Color drawColor = usedColor;
|
||||
|
||||
Color bodyColor = lightColor;
|
||||
Rectangle frame = tex.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
|
||||
|
||||
for (int i = 0; i < 18; i++) // Backglow
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 2 * fxFade;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, frame, drawColor with { A = 0 } * 0.2f * fxFade, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
}
|
||||
|
||||
float squashSineV = MathF.Sin(squashTimerY * 0.55f) * verticalSquash;
|
||||
float squashSineH = -MathF.Sin(squashTimerX * 0.55f) * horizontalSquash;
|
||||
float power = 0.35f;
|
||||
float squashX = 1 - power * squashSineV + power * 1.25f * squashSineH;
|
||||
float squashY = 1 + power * 1.25f * squashSineV - power * squashSineH;
|
||||
Vector2 elumphantSquash = new Vector2(squashX, squashY);
|
||||
Vector2 elumphantLocation = new Vector2(Projectile.Center.X, Projectile.Center.Y + ((tex.Height() / 5) * (1 - squashY))) + new Vector2(0f, Owner.gfxOffY);
|
||||
|
||||
// Main body
|
||||
Vector2 elumphantLocation = new Vector2(Projectile.Center.X, Projectile.Center.Y + ((tex.Height() / 5) * (1 - squashY)));
|
||||
Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition, frame, Color.Lerp(bodyColor, drawColor with { A = 0 }, fxFade), Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
float trunkDistX = 10;
|
||||
float trunkPosX = (trunkDistX - trunkDistX * (1 - squashX)) * Projectile.spriteDirection;
|
||||
Vector2 trunkPos = new Vector2(trunkPosX, 0);
|
||||
Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, Color.Lerp(bodyColor, drawColor with { A = 0 }, fxFade), Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
Vector2 trunkPos = new Vector2(trunkPosX * Projectile.scale, 0);
|
||||
|
||||
for (int i = 0; i < 18; i++) // Backglow
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 6 * fxFade;
|
||||
Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition + drawOffset, frame, usedColor with { A = 0 } * 0.2f * fxFade, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, usedColor with { A = 0 } * 0.2f * fxFade, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
}
|
||||
|
||||
// Main body
|
||||
Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition, frame, bodyColor, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
|
||||
Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, bodyColor, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
|
||||
return false;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (dashing)
|
||||
{
|
||||
float attackMult = 0.7f * GetPower(0.5f);
|
||||
SoundStyle attack = new("CalamityMod/Sounds/Item/Bonk");
|
||||
SoundEngine.PlaySound(attack with { Pitch = -0.2f + 0.05f * Projectile.numHits, volume = 0.75f, MaxInstances = -1 }, Projectile.Center);
|
||||
|
||||
target.MoveNPC(Projectile.Center.DirectionTo(target.Center), 8, false, Owner);
|
||||
|
||||
hitNPCs.Add(target);
|
||||
GetTarget(true);
|
||||
lastHitNPCPos = target.Center - Vector2.UnitY * (target.height / 2);
|
||||
|
||||
bool lastHit = false;
|
||||
if (targeted == null)
|
||||
{
|
||||
Projectile.extraUpdates = 0;
|
||||
attackMult *= 1.25f;
|
||||
Owner.SetScreenshake(3 * attackMult);
|
||||
lastHit = true;
|
||||
recoiling = true;
|
||||
modifiers.SourceDamage *= 2f * GetPower(5);
|
||||
}
|
||||
else
|
||||
{
|
||||
attackTimer = (int)(attackTimeAdjusted / 2) - 4;
|
||||
float minMult = 0.1f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult * GetPower(4);
|
||||
}
|
||||
|
||||
if (lastHit)
|
||||
{
|
||||
SoundStyle finalHit = new("CalamityMod/Sounds/Item/ElumphantSound");
|
||||
SoundEngine.PlaySound(finalHit with { Pitch = -0.5f, volume = 0.8f }, Projectile.Center);
|
||||
}
|
||||
verticalSquash = lastHit ? 0.85f : 0.5f;
|
||||
|
||||
int halfDusts = (int)((lastHit ? 12 : 8) * attackMult);
|
||||
for (int i = -halfDusts; i <= halfDusts; i++)
|
||||
{
|
||||
Vector2 dustVel = Vector2.UnitX * Main.rand.NextFloat(0.6f, 1.8f) * attackMult;
|
||||
Vector2 dustPos = Projectile.Center + dustVel * 1.5f;
|
||||
Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType<SquashDustPixelated>(),
|
||||
dustVel.RotatedByRandom(0.35f) * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * (lastHit ? 5 : 3.5f) * attackMult);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool() ? color1 : color2;
|
||||
dust2.customData = new Vector2(0.6f, 1.5f);
|
||||
dust2.fadeIn = -0.4f / attackMult;
|
||||
|
||||
float opacity = 0.7f;
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
bool clrChoose = Main.rand.NextBool();
|
||||
Particle smoke = new CustomColorChangeSpark(dustPos, dustVel.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 0.45f) * i * (lastHit ? 2 : 1), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(22, 27), Main.rand.NextFloat(0.45f, 0.65f) * Projectile.scale * (lastHit ? 2 : 1) * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity, new Vector2(0.25f, 1.2f));
|
||||
GeneralParticleHandler.SpawnParticle(smoke, true);
|
||||
}
|
||||
|
||||
if (lastHit)
|
||||
{
|
||||
bool clrChoose = Main.rand.NextBool();
|
||||
float velMult = Main.rand.NextFloat(1.2f, 1.35f) * i;
|
||||
Vector2 velocity = dustVel.RotatedByRandom(0.3f) * velMult;
|
||||
Particle mist = new CustomPulsingSpark(dustPos, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 55, Main.rand.NextFloat(1.05f, 1.45f) * Projectile.scale * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: 0, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.0028f, 0.0035f) * velMult,
|
||||
sineRate: Main.rand.NextFloat(0.09f, 0.12f), sineIntensity: (int)(4 + Main.rand.Next(15, 20 + 1)) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation());
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
|
||||
if (i == -1)
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
return false;
|
||||
return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox);
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (targeted == null)
|
||||
return false;
|
||||
return (dashing && attackTimer >= attackTimeAdjusted + 3 && target == targeted) ? null : false;
|
||||
}
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Renderers;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -19,34 +22,80 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public int textureChoice = 0;
|
||||
public float fade = 1;
|
||||
public int lifetime = 90;
|
||||
public float originalScale = 0;
|
||||
public Color mistColor = Color.White;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 38;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.timeLeft = lifetime;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
textureChoice = (int)Projectile.ai[1];
|
||||
originalScale = Main.rand.NextFloat(0.7f, 1.1f);
|
||||
mistColor = Main.rand.NextBool() ? Elumphant.color1 : Elumphant.color2;
|
||||
}
|
||||
Projectile.velocity *= 0.96f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
fade = 1 - MathF.Pow(Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true), 3 / Projectile.ai[2]);
|
||||
Projectile.scale = (1 + (1 - fade) * Projectile.ai[2]) * originalScale;
|
||||
|
||||
float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true);
|
||||
float opacity = 0.4f * fade * (1.2f - inverseFade);
|
||||
if (Main.rand.NextBool(3)) // Effects
|
||||
{
|
||||
Particle trail = new CustomColorChangeSpark(Projectile.Center + Main.rand.NextVector2Circular(40, 40) * Projectile.scale * (1 - fade) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * (-35 + 65 * inverseFade) * Projectile.scale, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(3, 4), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.75f, 1f) * Projectile.scale, (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity, new Vector2(0.15f + 0.85f * inverseFade, 1.4f - 0.4f * inverseFade));
|
||||
GeneralParticleHandler.SpawnParticle(trail, true);
|
||||
}
|
||||
if (Main.rand.NextBool(12))
|
||||
{
|
||||
float rotation = 0;
|
||||
Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(7f, 14f);
|
||||
Particle mist = new CustomPulsingSpark(Projectile.Center, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 35, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(Projectile.scale, 0.3f), (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: rotation, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.06f, 0.085f),
|
||||
sineRate: Main.rand.NextFloat(0.15f, 0.35f), sineIntensity: (int)(8 + Main.rand.Next(35, 55 + 1) * inverseFade) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation());
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, mistColor.ToVector3() * 0.3f * Projectile.scale);
|
||||
|
||||
time++;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
|
||||
target.AddBuff(ModContent.BuffType<WindChilled>(), (int)(300 * Projectile.ai[2]));
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
return false;
|
||||
return CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15 * Projectile.scale, 50 * Projectile.scale, targetHitbox);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time == 0)
|
||||
return false;
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Texture2D bTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.Cyan, Projectile.rotation, tex.Size() * 0.5f, new Vector2(1f, 1f) * Projectile.scale, SpriteEffects.None);
|
||||
Texture2D bTexture = (textureChoice == 0 ? ModContent.Request<Texture2D>("CalamityMod/Particles/SmokePuff1").Value : textureChoice == 1 ? ModContent.Request<Texture2D>("CalamityMod/Particles/SmokePuff2").Value : ModContent.Request<Texture2D>("CalamityMod/Particles/SmokePuff3").Value);
|
||||
float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true);
|
||||
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, mistColor with { A = 0 } * fade, Projectile.rotation, new Vector2(bTexture.Width / 2, bTexture.Height * (MathHelper.Lerp(0.7f, 0.4f, inverseFade))), new Vector2(0.3f + 0.7f * inverseFade, 1.4f - 0.4f * inverseFade) * Projectile.scale, SpriteEffects.None);
|
||||
}, Enums.GeneralDrawLayer.AfterProjectiles, default);
|
||||
return false;
|
||||
}
|
||||
public override bool? CanDamage() => null;
|
||||
|
||||
Reference in new issue
Block a user