Merge: Frozen Cube + Elumphant
No files matched your search
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.DamageOverTime
|
||||
{
|
||||
public class WindChilled : ModBuff
|
||||
{
|
||||
public static DebuffData debuffData = new DebuffData()
|
||||
{
|
||||
EnemyLostRegen = 12,
|
||||
NPCLifeRegenMethod = WindChilledNPCLifeRegen,
|
||||
ColdDebuffScaling = 1
|
||||
};
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.debuff[Type] = true;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
BuffID.Sets.LongerExpertDebuff[Type] = true;
|
||||
BuffDatasets.DebuffDataset[Type] = debuffData;
|
||||
}
|
||||
public static void WindChilledNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage)
|
||||
{
|
||||
var cnpc = npc.Calamity();
|
||||
|
||||
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)
|
||||
{
|
||||
player.Calamity().windChilled = true;
|
||||
}
|
||||
|
||||
public override void Update(NPC npc, ref int buffIndex)
|
||||
{
|
||||
npc.Calamity().windChilled = true;
|
||||
}
|
||||
|
||||
internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false)
|
||||
{
|
||||
Player player = drawInfo.drawPlayer;
|
||||
|
||||
float widthMult = 1;
|
||||
float hightMult = 1;
|
||||
Color color = Elumphant.color1;
|
||||
Color color2 = Elumphant.color2;
|
||||
float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi);
|
||||
if (Main.rand.NextBool(16))
|
||||
{
|
||||
bool start = !Main.rand.NextBool(4);
|
||||
Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + player.velocity * 0.85f;
|
||||
Vector2 particlePos = player.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult);
|
||||
Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult)));
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Enums.GeneralDrawLayer.AfterPlayers);
|
||||
}
|
||||
if (Main.rand.NextBool(11))
|
||||
{
|
||||
Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1);
|
||||
Dust dust2 = Dust.NewDustPerfect(player.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType<SquashDustPixelated>(),
|
||||
Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult));
|
||||
dust2.noGravity = false;
|
||||
dust2.color = Main.rand.NextBool() ? color : color2;
|
||||
dust2.customData = new Vector2(0.7f, 1.4f);
|
||||
dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void DrawEffects(NPC npc, ref Color drawColor)
|
||||
{
|
||||
float maxSizeMult = 10f;
|
||||
float widthMult = MathF.Pow(Utils.Remap(npc.width, 10, 500, 1f, maxSizeMult, false), 0.8f);
|
||||
float hightMult = MathF.Pow(Utils.Remap(npc.height, 10, 500, 1f, maxSizeMult, false), 0.8f);
|
||||
Color color = Elumphant.color1;
|
||||
Color color2 = Elumphant.color2;
|
||||
float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi);
|
||||
if (Main.rand.NextBool(16))
|
||||
{
|
||||
bool start = !Main.rand.NextBool(4);
|
||||
Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + npc.velocity * 0.85f;
|
||||
Vector2 particlePos = npc.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult);
|
||||
Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult)));
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
if (Main.rand.NextBool(11))
|
||||
{
|
||||
Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1);
|
||||
Dust dust2 = Dust.NewDustPerfect(npc.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType<SquashDustPixelated>(),
|
||||
Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult));
|
||||
dust2.noGravity = false;
|
||||
dust2.color = Main.rand.NextBool() ? color : color2;
|
||||
dust2.customData = new Vector2(0.7f, 1.4f);
|
||||
dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -1140,6 +1140,11 @@ namespace CalamityMod.CalPlayer
|
||||
public bool scionsCurioGotHit = false;
|
||||
public bool scionsCurioVisuals = false;
|
||||
public float scionsCurioDebuffDamage = 0;
|
||||
public bool frozenCube = false;
|
||||
public bool frozenCubeVisuals = false;
|
||||
public float frozenCubeDebuffBoost = 0;
|
||||
public float frozenCubeElumphantBoost = 0;
|
||||
public int frozenCubeUsedDefense = 0;
|
||||
public bool miniOldDuke = false;
|
||||
public bool miniOldDukeVanity = false;
|
||||
public bool starbusterCore = false;
|
||||
@@ -1419,6 +1424,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool vaporfied = false;
|
||||
public bool banishingFire = false;
|
||||
public bool wither = false;
|
||||
public bool windChilled = false;
|
||||
public bool ManaBurn = false;
|
||||
|
||||
/// <summary> Counter variable used to prevent the player from being inflicted with another immobilizing debuff for a short time after being inflicted with one. </summary>
|
||||
@@ -2526,6 +2532,7 @@ namespace CalamityMod.CalPlayer
|
||||
camper = false;
|
||||
corrosiveSpine = false;
|
||||
scionsCurio = false;
|
||||
frozenCube = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0;
|
||||
rottenDogTooth = false;
|
||||
angelicAlliance = false;
|
||||
ChaosStone = false;
|
||||
@@ -2725,6 +2732,7 @@ namespace CalamityMod.CalPlayer
|
||||
vaporfied = false;
|
||||
banishingFire = false;
|
||||
wither = false;
|
||||
windChilled = false;
|
||||
ManaBurn = false;
|
||||
|
||||
TypelessDebuffMultiplier = new();
|
||||
@@ -3211,6 +3219,7 @@ namespace CalamityMod.CalPlayer
|
||||
vaporfied = false;
|
||||
banishingFire = false;
|
||||
wither = false;
|
||||
windChilled = false;
|
||||
ImmobilityDebuffImmunityTimer = 0;
|
||||
TypelessDebuffMultiplier = new();
|
||||
HeatDebuffMultiplier = new();
|
||||
@@ -5396,6 +5405,14 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
// Frozen Cube defense cut
|
||||
if (Player.Calamity().frozenCube)
|
||||
{
|
||||
int usedDefense = (Player.statDefense / FrozenCube.usedDefenseDivide);
|
||||
Player.Calamity().frozenCubeUsedDefense = usedDefense;
|
||||
Player.statDefense -= usedDefense;
|
||||
}
|
||||
|
||||
if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now
|
||||
Player.GetDamage<GenericDamageClass>() += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel;
|
||||
|
||||
|
||||
@@ -584,6 +584,9 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
if (calamityPlayer.vHex && drawInfo.shadow == 0f)
|
||||
VulnerabilityHex.DrawEffects(drawInfo);
|
||||
|
||||
if (calamityPlayer.windChilled && drawInfo.shadow == 0f)
|
||||
WindChilled.DrawEffects(drawInfo);
|
||||
#endregion
|
||||
|
||||
if (calamityPlayer.fortunesFavor && drawInfo.shadow == 0f)
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace CalamityMod.CalPlayer
|
||||
ApplyDoTDebuff(whisperingDeath, 0, laudanum);
|
||||
|
||||
ApplyDoTDebuff(irradiated, 4);
|
||||
ApplyDoTDebuff(windChilled, 4);
|
||||
int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0);
|
||||
ApplyDoTDebuff(sulphurPoison, sulphurDoT);
|
||||
ApplyDoTDebuff(riptide, 6);
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet;
|
||||
target.Calamity().IncreasedColdEffects_CryoStone = CryoStone;
|
||||
target.Calamity().IncreasedColdEffects_FrozenCube = frozenCube;
|
||||
|
||||
target.Calamity().IncreasedElectricityEffects_Unused = false;
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public class FrozenCube : ModItem, ILocalizedModType
|
||||
{
|
||||
public static int mistBaseDamage = 1;
|
||||
public static int slamBaseDamage = 20;
|
||||
public static int baseAttackSpeed = 90;
|
||||
public static int baseAttackCooldown = 180;
|
||||
|
||||
public static int usedDefenseDivide = 3;
|
||||
public static int debuff = ModContent.BuffType<WindChilled>();
|
||||
|
||||
public static readonly SoundStyle noise = new("CalamityMod/Sounds/Item/ElumphantSound") { Volume = 0.6f };
|
||||
public static readonly SoundStyle cry = new("CalamityMod/Sounds/Item/ElumphantCry") { Volume = 0.6f };
|
||||
public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/ElumphantBop") { Volume = 0.6f };
|
||||
public static readonly SoundStyle jokeBonk = new("CalamityMod/Sounds/Item/Bonk") { Volume = 0.6f };
|
||||
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 34;
|
||||
Item.height = 34;
|
||||
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.accessory = true;
|
||||
}
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.frozenCube = true;
|
||||
modPlayer.frozenCubeVisuals = !hideVisual;
|
||||
|
||||
int projectile = ProjectileType<Elumphant>();
|
||||
if (player.ownedProjectileCounts[projectile] < 1 && !player.dead)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (Main.LocalPlayer != null)
|
||||
list.FindAndReplace("[DAMAGELINE]", Main.LocalPlayer.Calamity().frozenCube ?
|
||||
this.GetLocalization("EquippedDebuff").Format((Main.LocalPlayer.Calamity().frozenCubeDebuffBoost.ToPercent("N0")).ToString()) + "\n" +
|
||||
this.GetLocalization("EquippedElumphant").Format((Main.LocalPlayer.Calamity().frozenCubeElumphantBoost.ToPercent("N1")).ToString())
|
||||
: this.GetLocalizedValue("Unequipped"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 794 B |
@@ -74,6 +74,7 @@ namespace CalamityMod.Items.Armor.Fearmonger
|
||||
ModContent.BuffType<GodSlayerInferno>(),
|
||||
BuffID.Chilled,
|
||||
BuffID.Frozen,
|
||||
ModContent.BuffType<WindChilled>(),
|
||||
};
|
||||
for (var i = 0; i < immuneDebuffs.Length; ++i)
|
||||
player.buffImmune[immuneDebuffs[i]] = true;
|
||||
|
||||
@@ -403,6 +403,22 @@ WeakBrimstoneFlames: {
|
||||
Description: Using the Supreme Witch's power causes you to suffer, but makes your weapons strong
|
||||
}
|
||||
|
||||
WindChilled: {
|
||||
DisplayName: Wind Chilled
|
||||
Description: Should have worn a coat
|
||||
ItemTooltipPlayer:
|
||||
'''
|
||||
Cold - 2 DPS
|
||||
Reduced movement speed
|
||||
'''
|
||||
ItemTooltipEnemy:
|
||||
'''
|
||||
Cold - 6 DPS
|
||||
1.5x damage if the enemy is inflicted with a Water debuff
|
||||
Enhances Water debuff damage
|
||||
'''
|
||||
}
|
||||
|
||||
// Mounts
|
||||
|
||||
AndromedaBuff: {
|
||||
|
||||
@@ -2250,3 +2250,20 @@ XyksBlessingOrange: {
|
||||
[c/E1B65F:Prove that it was never a waste.']
|
||||
'''
|
||||
}
|
||||
|
||||
FrozenCube: {
|
||||
DisplayName: Frozen Cube
|
||||
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
|
||||
[DAMAGELINE]
|
||||
[c/7497ED:'What I wanna know is, where's the mammoth?']
|
||||
'''
|
||||
EquippedDebuff: Current Cold Debuff boost: +{0}%
|
||||
EquippedElumphant: Current Elumphant Power: +{0}%
|
||||
Unequipped: Equip this accessory to view its statistics
|
||||
}
|
||||
@@ -49,6 +49,8 @@ DragonDust.DisplayName: Dust
|
||||
DunesandBallFalling.DisplayName: Dunesand Ball
|
||||
DuneSandBallGun.DisplayName: Dunesand Ball
|
||||
EarlyBloomBobber.DisplayName: Early Bloom Bobber
|
||||
Elumphant.DisplayName: Elumphant
|
||||
ElumphantMist.DisplayName: Elumphant Mist
|
||||
EmpyreanBlast.DisplayName: Empyrean Blast
|
||||
EmpyreanEmber.DisplayName: Empyrean Ember
|
||||
EmpyreanMarble.DisplayName: Empyrean Marble
|
||||
|
||||
@@ -156,6 +156,7 @@ namespace CalamityMod.NPCs
|
||||
// Cold debuff effects
|
||||
public bool IncreasedColdEffects_EskimoSet = false;
|
||||
public bool IncreasedColdEffects_CryoStone = false;
|
||||
public bool IncreasedColdEffects_FrozenCube = false;
|
||||
|
||||
// Electric effects
|
||||
public bool IncreasedElectricityEffects_Unused = false;
|
||||
@@ -389,6 +390,8 @@ namespace CalamityMod.NPCs
|
||||
public bool trueVulnerabilityHex = false;
|
||||
public bool banishingFire = false;
|
||||
public bool wither = false;
|
||||
public bool windChilled = false;
|
||||
public float windChilledMult = 1;
|
||||
/// <summary>
|
||||
/// If greater than 0, this enemy will appear to disintegrate into ash when killed.<br/>
|
||||
/// Used by Rancor's laser beam.
|
||||
@@ -515,6 +518,7 @@ namespace CalamityMod.NPCs
|
||||
|
||||
myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet;
|
||||
myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone;
|
||||
myClone.IncreasedColdEffects_FrozenCube = IncreasedColdEffects_FrozenCube;
|
||||
myClone.IncreasedElectricityEffects_Unused = IncreasedElectricityEffects_Unused;
|
||||
myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball;
|
||||
myClone.IncreasedHeatEffects_FireBoots = IncreasedHeatEffects_FireBoots;
|
||||
@@ -636,6 +640,7 @@ namespace CalamityMod.NPCs
|
||||
myClone.trueVulnerabilityHex = trueVulnerabilityHex;
|
||||
myClone.banishingFire = banishingFire;
|
||||
myClone.wither = wither;
|
||||
myClone.windChilled = windChilled;
|
||||
myClone.ashesOnDeath = ashesOnDeath;
|
||||
|
||||
myClone.fortunesFavor = fortunesFavor;
|
||||
@@ -802,6 +807,7 @@ namespace CalamityMod.NPCs
|
||||
ladHearts--;
|
||||
banishingFire = false;
|
||||
wither = false;
|
||||
windChilled = false;
|
||||
if (ashesOnDeath > 0)
|
||||
ashesOnDeath--;
|
||||
|
||||
@@ -888,9 +894,13 @@ namespace CalamityMod.NPCs
|
||||
ActiveColdDebuffMultiplier += 1;
|
||||
ActiveHeatDebuffMultiplier -= 0.5f;
|
||||
}
|
||||
if (npc.HasBuff(BuffID.Chilled)) //Nothing inflicts this at the moment. Put here so we can start using it.
|
||||
if (npc.HasBuff(ModContent.BuffType<WindChilled>()))
|
||||
{
|
||||
ActiveWaterDebuffMultiplier += 1;
|
||||
ActiveWaterDebuffMultiplier += 0.5f;
|
||||
}
|
||||
if (npc.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].WaterDebuffScaling > 0) || npc.wet || npc.honeyWet || npc.dripping)
|
||||
{
|
||||
windChilledMult = 1.5f;
|
||||
}
|
||||
if (VulnerableToHeat.HasValue)
|
||||
{
|
||||
@@ -4836,6 +4846,9 @@ namespace CalamityMod.NPCs
|
||||
if (voidfrost)
|
||||
Voidfrost.DrawEffects(npc, ref drawColor);
|
||||
|
||||
if (windChilled)
|
||||
WindChilled.DrawEffects(npc, ref drawColor);
|
||||
|
||||
// TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs
|
||||
if (electrified)
|
||||
{
|
||||
@@ -4974,6 +4987,7 @@ namespace CalamityMod.NPCs
|
||||
("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux),
|
||||
("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost),
|
||||
("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex),
|
||||
("CalamityMod/Buffs/DamageOverTime/WindChilled", NPC => NPC.Calamity().windChilled),
|
||||
|
||||
// All other important Calamity debuffs, in alphabetical order
|
||||
("CalamityMod/Buffs/StatDebuffs/AbsorberAffliction", NPC => NPC.Calamity().absorberAffliction),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Mounts;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
@@ -179,6 +180,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
||||
{
|
||||
npcLoot.Add(ItemID.Leather, 1, 1, 2); // 100% chance of 1-2 leather
|
||||
npcLoot.Add(ModContent.ItemType<TundraLeash>(), 12); // 8% chance to drop Tundra Leash
|
||||
LeadingConditionRule postCryo = npcLoot.DefineConditionalDropSet(DropHelper.PostCryo());
|
||||
postCryo.Add(ModContent.ItemType<EssenceofEleum>());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomPulsingSpark : Particle
|
||||
{
|
||||
public Color InitialColor;
|
||||
public Color BackColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool FadeIn = false;
|
||||
public float FadeInScale = 0f;
|
||||
public bool GlowCenter = false;
|
||||
public float GlowCenterScale = 1;
|
||||
public float GlowOpacity = 1;
|
||||
public Texture2D NewTexture;
|
||||
public Texture2D NewTextureBack;
|
||||
public float ExtraRotation;
|
||||
public Vector2 Stretch = new Vector2(0.5f, 1.6f);
|
||||
public float ShrinkSpeed = 0;
|
||||
public bool FlipHorizontal = false;
|
||||
public bool NoShrink = false;
|
||||
public float Spin = 0;
|
||||
public float ColorFadeSpeed = 0;
|
||||
public int PulseRate;
|
||||
public int randTimeAdd = 0;
|
||||
|
||||
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 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;
|
||||
NewTexture ??= ModContent.Request<Texture2D>(frontTexture).Value;
|
||||
NewTextureBack ??= ModContent.Request<Texture2D>(backTexture).Value;
|
||||
ExtraRotation = extraRotation;
|
||||
AffectedByGravity = affectedByGravity;
|
||||
AffectedByLight = affectedByLight;
|
||||
Scale = scale;
|
||||
Stretch = stretch;
|
||||
FadeInScale = scale;
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = color;
|
||||
BackColor = backColor;
|
||||
ShrinkSpeed = shrinkSpeed;
|
||||
PulseRate = pulseRate;
|
||||
|
||||
AltVisual = useAddativeBlend;
|
||||
GlowCenter = glowCenter;
|
||||
GlowCenterScale = glowCenterScale;
|
||||
GlowOpacity = glowOpacity;
|
||||
FlipHorizontal = flipHorizontal;
|
||||
NoShrink = noShrink;
|
||||
|
||||
FadeIn = fadeIn;
|
||||
randTimeAdd = Main.rand.Next(0, 200 + 1);
|
||||
SineRate = sineRate;
|
||||
SineIntensity = sineIntensity;
|
||||
SineRotation = sineRotation;
|
||||
TurnRate = turnRate;
|
||||
|
||||
if (FadeIn)
|
||||
Scale = 0f;
|
||||
Spin = spin;
|
||||
ColorFadeSpeed = colorFadeSpeed;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (!FadeIn)
|
||||
{
|
||||
if (!NoShrink)
|
||||
Scale *= 0.95f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((float)Time / (float)Lifetime < 0.5f)
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f);
|
||||
}
|
||||
}
|
||||
Velocity *= 0.95f;
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
ExtraRotation += Spin;
|
||||
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);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
float pulseScale = 1 + Utils.Remap(Time % PulseRate, 0, PulseRate, 0, 0.85f);
|
||||
Vector2 adjustedSquash = new Vector2(Math.Max(Stretch.X - 0.4f, 0.1f), Math.Max(Stretch.Y + 0.4f, 0.1f));
|
||||
Vector2 scale = adjustedSquash * Scale * pulseScale;
|
||||
|
||||
float scaleMult = 1;
|
||||
Color col = Color;
|
||||
Color backCol = BackColor;
|
||||
|
||||
Vector2 drawPos = Position + Vector2.UnitX.RotatedBy(SineRotation) * Sine;
|
||||
if (AffectedByLight)
|
||||
{
|
||||
col = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(Color);
|
||||
backCol = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(BackColor);
|
||||
}
|
||||
|
||||
if (Pixelate)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f));
|
||||
spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f));
|
||||
spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,759 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class Elumphant : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public static Color color1 = new Color(60, 103, 207);
|
||||
public static Color color2 = new Color(103, 188, 214);
|
||||
public Color usedColor = Color.White;
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public float squashTimerX = 0; public float squashTimerY = 0; // Adjusts the X and Y centric squash effects
|
||||
public float fallTimer = 0; // How long the Elumphant has been falling
|
||||
public int maxFallTimer = 120;
|
||||
public int lastHighestFallTimer = 0;
|
||||
public ref float attackTimer => ref Projectile.ai[1]; // Timer for cycling between attack and cooldown phases
|
||||
public ref float mistShootTimer => ref Projectile.ai[2]; // Timer for the frames that it fires mist
|
||||
|
||||
public float fxFade = 0; // The glow visuals multiplier
|
||||
|
||||
public float verticalSquash = 0; public float horizontalSquash = 0; // The Elumphant's current X and Y squash
|
||||
|
||||
public float trunkRotation = 0; // Rotation for the trunk, and also the direction that it's mist will be fired in
|
||||
public bool dashing = false; // If the Elumphant is performing its jumping bonk attack
|
||||
public NPC targeted; // The currently targeted NPC for either of it's attacks
|
||||
public bool hitHead = true; // If the Elumphant has landed on its back when falling back to the player's head
|
||||
public int blinkTime = 1; public int cryTime = 1; // Timers for doing its idle animations
|
||||
public bool mammothFlip = false; // If the Elumphant is spinning as it falls back to the player
|
||||
public bool mammothOops = false; // If the Elumphant is doing its mistake animation after bonking the player's head
|
||||
public int hopTimer = 0; // Timer for the little hop after bonking its head
|
||||
public bool attackedThisFrame = false;
|
||||
public int attackDirection = 1;
|
||||
public int attacksDone = 0;
|
||||
public bool recoiling = false; // If the Elumphant has finished bonking enemies and is returning to the player
|
||||
public float maxTargetingDistance = 0;
|
||||
public float maxTrunkRot => -MathHelper.PiOver2 * 1.1f;
|
||||
public int attackTime => (int)(FrozenCube.baseAttackSpeed);
|
||||
public int attackTimeAdjusted = 0; // Attack speed adjusted for the slam attack
|
||||
public float damageScaling = 0; // The damage scaling on the mist and slam attacks
|
||||
public int cooldownTime = 0; // The cooldown between attacks
|
||||
public List<NPC> hitNPCs = new List<NPC>();
|
||||
public Vector2 lastHitNPCPos;
|
||||
public Vector2 lastProjPos;
|
||||
public bool spawnJumpDusts = true;
|
||||
public float frozenCubePower = 0; // The base power boost gained from defense before scaling adjustments
|
||||
public bool vis => Owner.Calamity().frozenCubeVisuals;
|
||||
|
||||
Vector2 goalPosition;
|
||||
public SlotId soundSlot;
|
||||
public static Asset<Texture2D> TrunkTexture { get; private set; }
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
TrunkTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/ElumphantTrunk");
|
||||
}
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 25;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
Main.projFrames[Type] = 3;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 46;
|
||||
Projectile.height = 34;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = DamageClass.Generic;
|
||||
}
|
||||
public float WidthFunction(float completion, Vector2 _)
|
||||
{
|
||||
float width;
|
||||
float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6);
|
||||
float newSine = 0.7f - sine * 0.1f;
|
||||
float cutPoint = 0.1f;
|
||||
float baseFade = (MathF.Pow((1 - completion), 2));
|
||||
float compFade = completion > cutPoint ? baseFade : baseFade * (1 - MathF.Pow((Utils.GetLerpValue(cutPoint, 0, completion)), 3));
|
||||
width = (completion == 0 ? 0 : 45 * newSine * compFade);
|
||||
|
||||
return width;
|
||||
}
|
||||
public Color ColorFunction(float completion, Vector2 _)
|
||||
{
|
||||
float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6);
|
||||
Color clr = Color.Lerp(usedColor, Color.DodgerBlue, 0.6f + 0.2f * sine);
|
||||
Color tipColor = Color.Lerp(clr, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(clr, tipColor, completion) * fxFade;
|
||||
}
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
if (vis)
|
||||
{
|
||||
// Render the main trail
|
||||
string shader = "CalamityMod:TrailStreak";
|
||||
Vector2[] length = Projectile.oldPos.Take((int)(Math.Max(10 - Projectile.numHits, 5))).ToArray();
|
||||
GameShaders.Misc[shader].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/DoubleTrail"));
|
||||
PrimitiveRenderer.RenderTrail(length, new(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, true, true, GameShaders.Misc[shader]), length.Length * 6);
|
||||
}
|
||||
}
|
||||
public void SetStats()
|
||||
{
|
||||
maxTargetingDistance = (float)(500 * GetPower(0.25f));
|
||||
attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f)));
|
||||
damageScaling = (float)GetPower(0.015f, 22 * (1 + frozenCubePower));
|
||||
cooldownTime = (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f));
|
||||
}
|
||||
public void SetElumphantPower()
|
||||
{
|
||||
int usedDefense = Owner.Calamity().frozenCubeUsedDefense;
|
||||
if (time == 0) // Show the player how much defense is being used
|
||||
CombatText.NewText(Projectile.Hitbox, color2, -usedDefense,false, true);
|
||||
|
||||
frozenCubePower = usedDefense * 0.05f; // 1 point of defense = 5% effectiveness
|
||||
|
||||
float power = (float)(GetPower(0.0185f, 13f * (1 + frozenCubePower)) - 1);
|
||||
Owner.Calamity().frozenCubeDebuffBoost = power;
|
||||
Owner.Calamity().frozenCubeElumphantBoost = damageScaling - 1;
|
||||
Owner.Calamity().ColdDebuffMultiplier += power; // Boost cold debuff damage
|
||||
}
|
||||
public double GetPower(float efficiency, float intenseScaling = 1)
|
||||
{
|
||||
double defensePower = frozenCubePower;
|
||||
return Math.Pow(1 + defensePower * efficiency, intenseScaling);
|
||||
}
|
||||
|
||||
public void GetColor()
|
||||
{
|
||||
float rate = Main.GlobalTimeWrappedHourly * 5;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
color1,
|
||||
color2
|
||||
};
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
usedColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f);
|
||||
}
|
||||
public void ManageSquash()
|
||||
{
|
||||
float resolutionSpeed = 0.02f / Projectile.MaxUpdates;
|
||||
verticalSquash = MathHelper.Lerp(verticalSquash, 0, resolutionSpeed);
|
||||
horizontalSquash = MathHelper.Lerp(horizontalSquash, 0, resolutionSpeed);
|
||||
}
|
||||
public void SetDirection(int newDirection)
|
||||
{
|
||||
if (newDirection == 0)
|
||||
{
|
||||
Projectile.spriteDirection = Owner.direction;
|
||||
return;
|
||||
}
|
||||
if (Projectile.spriteDirection != newDirection)
|
||||
{
|
||||
trunkRotation *= -1;
|
||||
Projectile.rotation *= -1;
|
||||
}
|
||||
Projectile.spriteDirection = newDirection;
|
||||
}
|
||||
public void GetTarget(bool excludeHitNPCs, float distanceMult = 1, bool leaveBossesLast = false) // Target closest NPC to mouse, unless they're too far, then do closest to Elumphant
|
||||
{
|
||||
if (excludeHitNPCs)
|
||||
{
|
||||
NPC chosenTarget = null;
|
||||
float distance = 0;
|
||||
if (leaveBossesLast && targeted != null)
|
||||
targeted = null;
|
||||
|
||||
for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++)
|
||||
{
|
||||
bool ignoreBosses = (u == 0) && leaveBossesLast;
|
||||
|
||||
for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit
|
||||
{
|
||||
NPC searchedTarget = Main.npc[index];
|
||||
bool bossCheck = !(searchedTarget.boss && ignoreBosses);
|
||||
if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.HasBuff(FrozenCube.debuff) && !hitNPCs.Contains(searchedTarget) && searchedTarget.active && searchedTarget.life > 0 && bossCheck)
|
||||
{
|
||||
float targetDistance = Projectile.Center.Distance(new Vector2(searchedTarget.Center.X, Projectile.Center.Y));
|
||||
if (targetDistance > distance)
|
||||
{
|
||||
distance = targetDistance;
|
||||
chosenTarget = searchedTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
targeted = chosenTarget;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool targetFar = (distanceMult != -1);
|
||||
|
||||
NPC chosenTarget = null;
|
||||
if (leaveBossesLast && targeted != null)
|
||||
targeted = null;
|
||||
float distance = (targetFar ? 0 : maxTargetingDistance);
|
||||
|
||||
for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++)
|
||||
{
|
||||
bool ignoreBosses = (u == 0) && leaveBossesLast;
|
||||
for (int index = 0; index < Main.npc.Length; index++)
|
||||
{
|
||||
NPC searchedTarget = Main.npc[index];
|
||||
if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.active && searchedTarget.life > 0)
|
||||
{
|
||||
bool canHit = Collision.CanHit(Owner.Center, 1, 1, searchedTarget.Center, 1, 1);
|
||||
|
||||
float targetDistance = Owner.Center.Distance(new Vector2(searchedTarget.Center.X, Owner.Center.Y));
|
||||
// Checks most distant target first, then closest if that fails
|
||||
bool inRange = (targetFar ? (targetDistance > distance) : (targetDistance < distance));
|
||||
bool bossCheck = !(searchedTarget.boss && ignoreBosses);
|
||||
if (inRange && canHit && targetDistance < maxTargetingDistance && bossCheck)
|
||||
{
|
||||
distance = targetDistance;
|
||||
chosenTarget = searchedTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chosenTarget != null)
|
||||
targeted = chosenTarget;
|
||||
}
|
||||
|
||||
if (!ValidDistance())
|
||||
targeted = null;
|
||||
}
|
||||
}
|
||||
public void ScaleOpacity(float endAt)
|
||||
{
|
||||
Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, endAt, 0.12f);
|
||||
}
|
||||
public bool ValidDistance(float distanceCheckMult = 1) => (targeted != null && targeted.Distance(Owner.Center) < (maxTargetingDistance * distanceCheckMult));
|
||||
public void HopAttack(Vector2 originalPosition)
|
||||
{
|
||||
if (!vis)
|
||||
ScaleOpacity(0.4f);
|
||||
|
||||
float attackLerp = Utils.GetLerpValue((int)(Math.Max(attackTimeAdjusted, 2) / 2), Math.Max(attackTimeAdjusted, 2), attackTimer, true);
|
||||
|
||||
if (attackTimer == 0 && Projectile.numHits == 0)
|
||||
{
|
||||
GetTarget(true, 10, true);
|
||||
}
|
||||
|
||||
if (targeted == null || (targeted != null && (targeted.life <= 0 || !targeted.active)))
|
||||
{
|
||||
if (attackLerp > 0 && !recoiling)
|
||||
{
|
||||
lastHitNPCPos = Projectile.Center;
|
||||
attackTimer = attackTimeAdjusted;
|
||||
}
|
||||
recoiling = true;
|
||||
targeted = null;
|
||||
}
|
||||
|
||||
if (attacksDone != 0)
|
||||
Projectile.frame = 2;
|
||||
if (recoiling)
|
||||
{
|
||||
attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / GetPower(0.5f));
|
||||
if (Projectile.numHits > 1)
|
||||
attackTimer = attackTimeAdjusted;
|
||||
Projectile.numHits = 1;
|
||||
}
|
||||
|
||||
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction);
|
||||
if (!recoiling)
|
||||
fxFade = (attackLerp <= 0.2f ? 0 : Math.Max(attackLerp, MathHelper.Lerp(fxFade, 1, 0.15f)));
|
||||
else
|
||||
fxFade = MathHelper.Lerp(0f, 1, MathF.Pow(attackLerp, 4));
|
||||
|
||||
Vector2 basePosition = recoiling ? originalPosition : Projectile.numHits == 0 ? originalPosition : (lastHitNPCPos);
|
||||
Vector2 targetPos = recoiling ? lastHitNPCPos : targeted.Center - (Vector2.UnitY * targeted.height / 2);
|
||||
|
||||
float jumpHeight = 250;// Math.Max(250 - Projectile.numHits * 10, 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 * jumpLerp;
|
||||
float jumpOffsetX = MathHelper.Lerp(basePosition.X, targetPos.X, attackLerp);
|
||||
goalPosition = new Vector2(jumpOffsetX, jumpOffsetY);
|
||||
|
||||
Projectile.Center = goalPosition;
|
||||
|
||||
if (attackLerp > 0f && spawnJumpDusts && vis)
|
||||
{
|
||||
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.Center + 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;
|
||||
}
|
||||
|
||||
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 = Utils.AngleLerp(trunkRotation, 0, 0.11f);
|
||||
|
||||
int attemptDir = Math.Sign((recoiling ? basePosition.X : targetPos.X) - Projectile.Center.X);
|
||||
SetDirection(attemptDir);
|
||||
|
||||
if (attackTimer <= (int)(Math.Max(attackTimeAdjusted, 2) / 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);
|
||||
}
|
||||
}
|
||||
public void MistAttack(float fallLerp)
|
||||
{
|
||||
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
|
||||
{
|
||||
if (vis)
|
||||
SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center);
|
||||
|
||||
Projectile.soundDelay = 0;
|
||||
Projectile.frameCounter = 1;
|
||||
}
|
||||
SetDirection(Math.Sign(Projectile.Center.DirectionTo(targeted.Center).X));
|
||||
horizontalSquash = 0.5f;
|
||||
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 (attackTimer > (cooldownTime * 1.1f))
|
||||
{
|
||||
if (!vis)
|
||||
ScaleOpacity(0.4f);
|
||||
if (mistShootTimer == 0 && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2();
|
||||
int damage = (int)Owner.GetTotalDamage<GenericDamageClass>().ApplyTo((float)(FrozenCube.mistBaseDamage * damageScaling));
|
||||
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, (float)GetPower(1));
|
||||
}
|
||||
mistShootTimer += (float)(0.35f * GetPower(0.25f));
|
||||
if (mistShootTimer >= 2f)
|
||||
mistShootTimer = 0;
|
||||
}
|
||||
mammothFlip = false;
|
||||
|
||||
attackedThisFrame = true;
|
||||
if (!ValidDistance())
|
||||
{
|
||||
GetTarget(false, -1);
|
||||
if (!ValidDistance())
|
||||
{
|
||||
attackTimer = cooldownTime + attackTime;
|
||||
targeted = null;
|
||||
}
|
||||
}
|
||||
if (attackTimer == cooldownTime + attackTime)
|
||||
{
|
||||
attackDirection *= -1;
|
||||
Projectile.frame = 0;
|
||||
attacksDone++;
|
||||
if (attacksDone >= 2) // Every 2 attacks, do a dash slam
|
||||
{
|
||||
dashing = true;
|
||||
attackTimer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Idle()
|
||||
{
|
||||
if (!vis)
|
||||
ScaleOpacity(0);
|
||||
targeted = null;
|
||||
if (Owner.StandingStill()) // If standing still, let the player mess with the mammoth squash for fun
|
||||
{
|
||||
if (Owner.controlDown)
|
||||
horizontalSquash = 0.5f;
|
||||
if (Owner.controlUp)
|
||||
verticalSquash = 0.5f;
|
||||
}
|
||||
if (Math.Abs(Owner.velocity.X) > 4 && fallTimer == 0)
|
||||
verticalSquash = 0.25f * Utils.GetLerpValue(4, 10, Math.Abs(Owner.velocity.X));
|
||||
if (targeted == null && attackTimer > cooldownTime) // If can attack but there is no target, wait to decrease the timer until a target is found
|
||||
attackTimer--;
|
||||
int cryStart = (int)(cryTime - 65);
|
||||
if (Projectile.soundDelay >= cryStart)
|
||||
{
|
||||
if (Projectile.soundDelay == cryStart) // Sound
|
||||
{
|
||||
verticalSquash = 0.3f;
|
||||
if (vis)
|
||||
soundSlot = SoundEngine.PlaySound(FrozenCube.cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center);
|
||||
}
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, maxTrunkRot * Projectile.spriteDirection, 0.025f);
|
||||
}
|
||||
else if (hopTimer <= 0)
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f);
|
||||
if (Projectile.soundDelay >= cryTime)
|
||||
{
|
||||
SetRandCry();
|
||||
}
|
||||
|
||||
if (Projectile.frameCounter >= blinkTime)
|
||||
{
|
||||
Projectile.frame = 1;
|
||||
Projectile.frameCounter = -6;
|
||||
}
|
||||
if (Projectile.frameCounter == 0)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
SetRandBlink();
|
||||
}
|
||||
if (vis)
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
Projectile.soundDelay += 2; // Naturally decreases by 1, so to make it count up, increases it by 2
|
||||
}
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
lastHitNPCPos = lastProjPos = Owner.Center;
|
||||
Projectile.Opacity = 0;
|
||||
}
|
||||
if (vis && Projectile.Opacity < 1)
|
||||
ScaleOpacity(1);
|
||||
Projectile.timeLeft++;
|
||||
SetStats();
|
||||
GetColor();
|
||||
SetElumphantPower();
|
||||
ManageSquash();
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying)
|
||||
sound.Position = Projectile.Center;
|
||||
|
||||
if (targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile)))
|
||||
GetTarget(false);
|
||||
|
||||
float sine = MathF.Sin(time * 0.04f);
|
||||
float sine2 = MathF.Sin(time * 0.08f);
|
||||
float sine3 = MathF.Sin(time * 0.1f);
|
||||
float fallLerp = Utils.GetLerpValue(0, maxFallTimer, fallTimer, true);
|
||||
|
||||
int hopTimerMax = 16;
|
||||
float hop = 1 + (mammothOops ? 1 - MathF.Pow(Utils.GetLerpValue(hopTimerMax, 0, hopTimer, true), 2.5f) : MathF.Pow(Utils.GetLerpValue(0, hopTimerMax, hopTimer, true), 1.0f)) * 1.55f;
|
||||
if (hopTimer >= hopTimerMax)
|
||||
mammothOops = false;
|
||||
else if (mammothOops)
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(0, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true));
|
||||
else if (hopTimer > 0)
|
||||
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 * 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.Center + offsetX + offsetY;
|
||||
|
||||
if (dashing) // Hop Attack
|
||||
{
|
||||
HopAttack(goalPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Center = goalPosition;
|
||||
if (targeted == null)
|
||||
GetTarget(false);
|
||||
|
||||
if (attackTimer > cooldownTime && targeted != null) // Mist Attack
|
||||
{
|
||||
MistAttack(fallLerp);
|
||||
}
|
||||
else // Idle
|
||||
{
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : Owner.direction;
|
||||
if (fallTimer == 0)
|
||||
SetDirection(direction);
|
||||
Idle();
|
||||
}
|
||||
|
||||
if (hopTimer <= 0 && !attackedThisFrame)
|
||||
{
|
||||
if (mammothFlip)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (Owner.velocity.Y > 8 && !dashing && vis) // If the player is falling at close to max normal downward velocity
|
||||
{
|
||||
if (fallTimer == 0)
|
||||
mammothFlip = Main.rand.NextBool(3);
|
||||
hitHead = false;
|
||||
SetRandCry();
|
||||
SetRandBlink();
|
||||
if (fallTimer < maxFallTimer)
|
||||
fallTimer++;
|
||||
}
|
||||
else if (fallTimer > 0)
|
||||
fallTimer -= 7 - Math.Min(Owner.velocity.Y, 0); if (fallTimer < 0) fallTimer = 0;
|
||||
if (fallTimer <= 0 && !hitHead)
|
||||
{
|
||||
float landPower = (Utils.GetLerpValue(0, maxFallTimer, lastHighestFallTimer, true));
|
||||
verticalSquash = 1f * landPower;
|
||||
lastHighestFallTimer = 0;
|
||||
hitHead = true;
|
||||
float rotation = MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi);
|
||||
if (mammothFlip && rotation < MathHelper.PiOver2 && rotation > -MathHelper.PiOver2 && landPower > 0.2f)
|
||||
{
|
||||
int halfDusts = 7;
|
||||
Projectile.frame = 1;
|
||||
SetRandBlink();
|
||||
if (vis)
|
||||
{
|
||||
Owner.SetScreenshake(2);
|
||||
SoundEngine.PlaySound(FrozenCube.jokeBonk with { Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center);
|
||||
for (int i = -halfDusts; i <= halfDusts; i++)
|
||||
{
|
||||
Vector2 dustVel = Vector2.UnitX.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.6f, 1.8f);
|
||||
Vector2 dustPos = Owner.Center - (Vector2.UnitY * Owner.height / 2) + dustVel * 1.5f;
|
||||
Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType<SquashDustPixelated>(),
|
||||
dustVel * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 3);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool() ? color1 : color2;
|
||||
dust2.customData = new Vector2(0.6f, 1.5f);
|
||||
dust2.fadeIn = -0.4f;
|
||||
if (i == -1)
|
||||
i = 1;
|
||||
}
|
||||
SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(0.4f, 0.6f), volume = 0.6f }, Projectile.Center);
|
||||
CombatText.NewText(Projectile.Hitbox, usedColor, "!");
|
||||
}
|
||||
|
||||
trunkRotation = maxTrunkRot * Projectile.spriteDirection;
|
||||
verticalSquash = 1.5f * landPower;
|
||||
mammothOops = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.rotation = 0;
|
||||
}
|
||||
mammothFlip = false;
|
||||
}
|
||||
|
||||
if (fxFade > 0 && vis)
|
||||
Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.6f * fxFade);
|
||||
|
||||
if (fallTimer > lastHighestFallTimer)
|
||||
lastHighestFallTimer = (int)fallTimer;
|
||||
|
||||
if (attackTimer >= attackTime + cooldownTime)
|
||||
attackTimer = 0;
|
||||
|
||||
attackTimer += recoiling ? -0.75f : 1 + 0.4f * Projectile.numHits;
|
||||
time++;
|
||||
if (mammothOops)
|
||||
hopTimer++;
|
||||
else if (hopTimer > 0)
|
||||
hopTimer--;
|
||||
|
||||
squashTimerX += 0.1f + horizontalSquash;
|
||||
squashTimerY += 0.1f + verticalSquash;
|
||||
|
||||
attackedThisFrame = false;
|
||||
|
||||
lastProjPos = Projectile.Center;
|
||||
|
||||
if (!Owner.Calamity().frozenCube)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var sound2) && sound2.IsPlaying)
|
||||
sound2?.Stop();
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void SetRandBlink()
|
||||
{
|
||||
Projectile.frameCounter = Projectile.frameCounter > 0 ? 1 : 0;
|
||||
blinkTime = Main.rand.Next(55, 90 + 1);
|
||||
}
|
||||
public void SetRandCry()
|
||||
{
|
||||
Projectile.soundDelay = 0;
|
||||
cryTime = Main.rand.Next(800, 1200 + 1);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time == 0)
|
||||
return false;
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Texture2D trunk = TrunkTexture.Value;
|
||||
|
||||
Color bodyColor = lightColor * Projectile.Opacity;
|
||||
Rectangle frame = tex.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
|
||||
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);
|
||||
|
||||
float trunkDistX = 10;
|
||||
float trunkPosX = (trunkDistX - trunkDistX * (1 - squashX)) * Projectile.spriteDirection;
|
||||
Vector2 trunkPos = new Vector2(trunkPosX * Projectile.scale, 0);
|
||||
|
||||
if (vis)
|
||||
{
|
||||
for (int i = 0; i < 18; i++) // Backglow
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 4 * 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.Opacity, 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 = (float)(0.7f * GetPower(0.5f));
|
||||
target.MoveNPC(Vector2.UnitY, 8, false, Owner);
|
||||
|
||||
hitNPCs.Add(target);
|
||||
GetTarget(true, 1, true);
|
||||
lastHitNPCPos = target.Center - Vector2.UnitY * (target.height / 2);
|
||||
|
||||
bool lastHit = false;
|
||||
if (targeted == null)
|
||||
{
|
||||
attackMult *= 1.25f;
|
||||
if (vis)
|
||||
Owner.SetScreenshake(3 * attackMult);
|
||||
lastHit = true;
|
||||
recoiling = true;
|
||||
modifiers.SourceDamage *= (float)(1.5f * damageScaling);
|
||||
}
|
||||
else
|
||||
{
|
||||
attackTimer = (int)(attackTimeAdjusted / 2);
|
||||
float minMult = 0.25f;
|
||||
int hitsToMinMult = 4;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= (float)(damageMult * damageScaling);
|
||||
}
|
||||
|
||||
if (lastHit && vis)
|
||||
{
|
||||
SoundEngine.PlaySound(FrozenCube.noise with { Pitch = -0.5f, volume = 0.8f }, Projectile.Center);
|
||||
}
|
||||
verticalSquash = lastHit ? 0.85f : 0.5f;
|
||||
|
||||
if (vis)
|
||||
{
|
||||
SoundEngine.PlaySound(FrozenCube.hit with { Pitch = -0.2f + 0.05f * Projectile.numHits, volume = 1f, MaxInstances = -1 }, Projectile.Center);
|
||||
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 CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox);
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (targeted == null)
|
||||
return false;
|
||||
// These extra frames before the hit allow for a bit of "hitstop" on the jump attack
|
||||
return (dashing && attackTimer >= attackTimeAdjusted + 3 && target == targeted) ? null : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,119 @@
|
||||
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;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class ElumphantMist : ModProjectile, ILocalizedModType
|
||||
{
|
||||
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 bool vis => Owner.Calamity().frozenCubeVisuals;
|
||||
public static Asset<Texture2D> SmokeTexture1 { get; private set; }
|
||||
public static Asset<Texture2D> SmokeTexture2 { get; private set; }
|
||||
public static Asset<Texture2D> SmokeTexture3 { get; private set; }
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SmokeTexture1 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/SmokePuff1");
|
||||
SmokeTexture2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/SmokePuff2");
|
||||
SmokeTexture3 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/SmokePuff3");
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 38;
|
||||
Projectile.ignoreWater = true;
|
||||
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) && vis) // 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) && vis)
|
||||
{
|
||||
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(FrozenCube.debuff, (int)(300 * Projectile.ai[2]));
|
||||
float minMult = 0.25f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
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;
|
||||
Texture2D bTexture = (textureChoice == 0 ? SmokeTexture1.Value : textureChoice == 1 ? SmokeTexture2.Value : SmokeTexture3.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 * (vis ? 1 : 0.5f), 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;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -67,7 +67,7 @@ namespace CalamityMod.Systems.Collections
|
||||
BuffType<Dragonfire>(), BuffType<VermillionFlux>(), BuffType<AuricRebuke>(), BuffType<StaticDischarge>(), BuffType<Nightwither>(), BuffType<Voidfrost>(),
|
||||
BuffType<VulnerabilityHex>(), BuffType<MiracleBlight>(), BuffType<WhisperingDeath>(), BuffType<FrozenLungs>(), BuffType<FishAlert>(), BuffType<HolyInferno>(),
|
||||
BuffType<IcarusFolly>(), BuffType<DoGExtremeGravity>(), BuffType<PopoNoselessBuff>(), BuffType<SagePoison>(), BuffType<SearingLava>(), BuffType<WeakBrimstoneFlames>(), BuffType<Withered>(), BuffType<ManaBurn>(),
|
||||
BuffType<DemonicFlames>(), BuffType<Bane>(), BuffType<Shred>());
|
||||
BuffType<DemonicFlames>(), BuffType<Bane>(), BuffType<Shred>(), BuffType<WindChilled>());
|
||||
|
||||
/// <summary>
|
||||
/// If <see langword="true"/> for a buff type, then that buff is a whip tag buff on the player.<br/>
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace CalamityMod.World
|
||||
int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie);
|
||||
List<ChestItem> contents = new List<ChestItem>()
|
||||
{
|
||||
new ChestItem(ItemType<TundraLeash>(), 1),
|
||||
new ChestItem(ItemType<FrozenCube>(), 1),
|
||||
new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)),
|
||||
new ChestItem(ItemID.FrozenKey, 1),
|
||||
new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)),
|
||||
@@ -446,7 +446,7 @@ namespace CalamityMod.World
|
||||
{
|
||||
contents = new List<ChestItem>()
|
||||
{
|
||||
new ChestItem(ItemType<TundraLeash>(), 1),
|
||||
new ChestItem(ItemType<FrozenCube>(), 1),
|
||||
new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)),
|
||||
new ChestItem(ItemID.FrozenKey, 1),
|
||||
new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)),
|
||||
|
||||