Note: This branch is non functional until grand dad branch is merged
This commit is contained in:
Xyk committed 2024-06-13 19:06:59 -07:00
1 parent d8836204ce
commit 3f81d67a9a
20 files changed
+489 -102

No files matched your search

+2 -1
View File
@@ -836,7 +836,7 @@ namespace CalamityMod
ProjectileType<ArkoftheElementsParryHoldout>(),
ProjectileType<ArkoftheCosmosSwungBlade>(),
ProjectileType<ArkoftheCosmosParryHoldout>(),
ProjectileType<HellkiteHoldout>(),
ProjectileType<PhangasmBow>(),
ProjectileType<ContagionBow>(),
ProjectileType<DaemonsFlameBow>(),
@@ -1930,6 +1930,7 @@ namespace CalamityMod
ProjectileType<FantasyTalismanProj>(),
ProjectileType<FantasyTalismanStealth>(),
ProjectileType<GodsParanoiaProj>(),
ProjectileType<HellkiteHoldout>(),
ProjectileType<InsidiousHarpoon>(),
ProjectileType<JawsProjectile>(),
ProjectileType<LeviathanTooth>(),
+28 -97
View File
@@ -1,7 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -9,115 +13,42 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class Hellkite : ModItem, ILocalizedModType
public class Hellkite : CustomUseProjItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewHit") { Volume = 0.6f };
public static float PitchSound = 1;
public static readonly SoundStyle SwingSound = new("CalamityMod/Sounds/Item/HellkiteSwing", 2);
public static readonly SoundStyle SwingSoundBig = new("CalamityMod/Sounds/Item/HellkiteHeavySwing");
public static readonly SoundStyle HitSoundSmall = new("CalamityMod/Sounds/Item/HellkiteSmallHit", 3);
public static readonly SoundStyle HitSoundBig = new("CalamityMod/Sounds/Item/HellkiteBigHit", 2);
public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Item/HellkiteCharge");
public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/HellkiteFullCharge");
public override void SetDefaults()
{
Item.width = 84;
Item.height = 84;
Item.damage = 180;
Item.DamageType = DamageClass.Melee;
Item.useTime = Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Swing;
Item.width = 124;
Item.height = 124;
Item.damage = 740;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useTime = Item.useAnimation = 71;
Item.useTurn = true;
Item.knockBack = 8f;
Item.UseSound = SoundID.Item1;
Item.knockBack = 13f;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
Item.rare = ItemRarityID.Lime;
Item.channel = true;
Item.shoot = ModContent.ProjectileType<HellkiteHoldout>();
Item.noUseGraphic = true;
Item.noMelee = true;
Item.useStyle = ItemUseStyleID.Shoot;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
public override bool MeleePrefix() => true;
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
if (!Main.zenithWorld)
if (Main.rand.NextBool(4))
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.InfernoFork);
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/HellkiteGlow").Value);
}
// NOTE: Modded item variants don't seem to be supported as of now, so this is probably temporary (also there is no way around modifiers screwing rarity/value in some way)
public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage += (Main.zenithWorld ? (1669f / 180f - 1f) : 0f);
public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback += (Main.zenithWorld ? 1.5f : 0f);
public override float UseSpeedMultiplier(Player player) => Main.zenithWorld ? 2.5f : 1f;
public override void ModifyItemScale(Player player, ref float scale) => scale *= (Main.zenithWorld ? 2.5f : 1f);
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
public override void ModifyTooltips(List<TooltipLine> list)
{
if (Main.zenithWorld)
{
SoundEngine.PlaySound(UseSound with { Pitch = PitchSound * Main.rand.NextFloat(0.01f, 0.03f) });
}
else
{
target.AddBuff(BuffID.OnFire3, 300);
int onHitDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false);
float firstDustScale = 1.7f;
float secondDustScale = 0.8f;
float thirdDustScale = 2f;
Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2();
Vector2 dustVelocity = dustRotation * target.velocity.Length();
SoundEngine.PlaySound(SoundID.Item14, target.Center);
int increment;
for (int i = 0; i < 40; i = increment + 1)
{
int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale);
Dust dust = Main.dust[swingDust];
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
dust.noGravity = true;
dust.velocity.Y -= 6f;
dust.velocity *= 3f;
dust.velocity += dustVelocity * Main.rand.NextFloat();
swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale);
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
dust.velocity.Y -= 6f;
dust.velocity *= 2f;
dust.noGravity = true;
dust.fadeIn = 1f;
dust.color = Color.Crimson * 0.5f;
dust.velocity += dustVelocity * Main.rand.NextFloat();
increment = i;
}
for (int j = 0; j < 20; j = increment + 1)
{
int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale);
Dust dust = Main.dust[swingDust2];
dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f;
dust.noGravity = true;
dust.velocity.Y -= 6f;
dust.velocity *= 0.5f;
dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat());
increment = j;
}
}
}
public override void ModifyTooltips(List<TooltipLine> list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"));
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
target.AddBuff(BuffID.OnFire3, 300);
SoundEngine.PlaySound(SoundID.Item14, target.Center);
}
public override void AddRecipes()
{
CreateRecipe().
AddCondition(Condition.ZenithWorld).
AddIngredient(ItemID.TitaniumSword).
AddIngredient<NightmareFuel>(12).
AddTile<CosmicAnvil>().
AddDecraftCondition(Condition.ZenithWorld).
Register();
CreateRecipe().
AddCondition(Condition.NotZenithWorld).
AddIngredient(ItemID.FieryGreatsword).
AddIngredient<PerennialBar>(8).
AddTile(TileID.MythrilAnvil).
Register();
list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")));
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

-1
View File
@@ -60,7 +60,6 @@ namespace CalamityMod.Items.Weapons.Melee
{
CreateRecipe().
AddIngredient<Floodtide>().
AddIngredient<Hellkite>().
AddIngredient(ItemID.TerraBlade).
AddIngredient<UelibloomBar>(7).
AddTile(TileID.LunarCraftingStation).
@@ -682,10 +682,13 @@ Hellkite: {
Tooltip: "[GFB]"
TooltipNormal:
'''
Summons flame geyser explosions on enemy hits
Contains the power of an ancient drake
An ancient blade created during the Draconic Era by Azafure's finest forgemaster
Swings a slow and heavy blade with powerful knockback
Holding <right> while swinging will begin charging a strengthened swing
Releasing <right> while fully charged will unleash a devastating slash
[c/E1B65F:'Feel the strength of a blade forged through passion']
'''
TooltipGFB: "'My Beloved <3'"
TooltipGFB: "'My beloved <3' -Xyk"
}
HolyCollider: {
+4
View File
@@ -2,6 +2,7 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.World;
using Terraria;
using Terraria.GameContent.Bestiary;
@@ -99,6 +100,9 @@ namespace CalamityMod.NPCs.Crags
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType<Hellkite>(), 6);
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

+449
View File
@@ -0,0 +1,449 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Ranged;
using Humanizer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.Graphics.Renderers;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class HellkiteHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<Hellkite>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Hellkite>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/Hellkite";
public override float HitboxOutset => 100;
public override Vector2 HitboxSize => new Vector2(185, 185) * Projectile.scale;
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(0, 125);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = false;
public bool postSwing = false;
public float fadeIn = 0; // Used to make particle effects and outer glow on the sword fade in and out
public int useAnim; // Used as your use time stat since checking the held item use time gets jank if your attack speed changes mid swing
public int storedUseAnim; // Used to check your use time when you began using the item and to reset use time when needed
public int swingCount = -1; // Runs counting code first, so it has to be one below
public float GFBMulti = 1; // GFB infinite charge particle and damage multiplier
public int GFBCharge = 0; // GFB charge counter
public bool GFBFlashWarning = false;
public int pierceReduction = 0; // Used to reduce damage when striking many enemies with a single swing
public bool chargedSwing = false; // True if you have a charged swing fully charged
public int chargeTimer = 0; // Timer for charging the blade with right click
public int chargeTimerMax = 240;
public SlotId AudSlot;
public override void SetDefaults()
{
base.SetDefaults();
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
}
public override void OnSpawn(IEntitySource source)
{
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = -1;
base.OnSpawn(source);
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
storedUseAnim = useAnim;
chargeTimerMax = useAnim * 5;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
}
public override void UseStyle()
{
AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 0.7f) : storedUseAnim);
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
{
mousePos = Owner.Calamity().mouseWorld;
}
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
if (chargeTimer > 0)
fadeIn = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0, 1f);
// If you are no longer holding the charge, then stop charge counter so you can swing
if (!Owner.Calamity().mouseRight)
chargeTimer = 0;
if (!doSwing)
{
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1 ? true : false;
Vector2 bladePos = new Vector2(60, 0);
Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
if (Owner.Calamity().mouseRight)
{
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.05f);
float rotationValue = 65f + (25 * Utils.GetLerpValue(0, chargeTimerMax, chargeTimer, true)) * (FlipAsSword ? 1 : -1) * -Projectile.ai[1];
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(rotationValue), 0.3f);
Animation = 0;
if (chargeTimer < chargeTimerMax && !chargedSwing)
chargeTimer++;
if (Main.zenithWorld)
{
GFBCharge++;
}
Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -15;
particlePos += Main.rand.NextVector2Circular(20, 20);
Dust dust2 = Dust.NewDustPerfect(particlePos, 267, particleVel * Main.rand.NextFloat(0.2f, 1));
dust2.scale = Main.rand.NextFloat(0.65f, 1.15f) * fadeIn * GFBMulti;
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
Particle spark3 = new GlowOrbParticle(particlePos, particleVel * Main.rand.NextFloat(0.2f, 1.5f), false, 22, Main.rand.NextFloat(0.2f, 0.4f) * fadeIn * GFBMulti, Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed);
GeneralParticleHandler.SpawnParticle(spark3);
if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying)
{
ChargeSound.Position = Projectile.Center;
ChargeSound.Pitch = Utils.Remap(chargeTimer, 0, chargeTimerMax, -0.4f, 0f);
ChargeSound.Volume = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0f, 0.5f) * 100;
}
else if (!chargedSwing)
{
AudSlot = SoundEngine.PlaySound(Hellkite.ChargeSound with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center);
}
}
if (chargeTimer == chargeTimerMax || GFBCharge >= (MathHelper.Clamp(chargeTimerMax - (GFBMulti * GFBMulti * 2), 12, 80)) && GFBCharge > 0)
{
particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
SoundEngine.PlaySound(Hellkite.FullChargeSound with { Volume = 0.9f, PitchVariance = 0.2f }, Projectile.Center);
chargedSwing = true;
useAnim = storedUseAnim / 3;
chargeTimer++;
if (Main.zenithWorld)
{
if (chargeTimerMax - (GFBMulti * GFBMulti * 2) <= 12 && !GFBFlashWarning)
{
SoundStyle w = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning");
SoundEngine.PlaySound(w with { Volume = 0.5f, Pitch = 1f }, Projectile.Center);
Main.NewText("I've gotta give you a flashing lights warning on this one", Color.Orange);
GFBFlashWarning = true;
}
GFBMulti += 0.5f;
Projectile.scale += 0.03f;
GFBCharge = 0;
}
for (int i = 0; i < 20; i++)
{
Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed);
GeneralParticleHandler.SpawnParticle(spark2);
Dust dust2 = Dust.NewDustPerfect(particlePos, 267, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f));
dust2.scale = Main.rand.NextFloat(0.65f, 1.15f) * fadeIn;
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
}
}
if (chargeTimer == 0)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
Projectile.numHits = 0;
pierceReduction = 0;
doSwing = true;
}
}
else if (chargeTimer == 0)
{
if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound))
ChargeSound?.Stop();
if (!CanHit && !postSwing)
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f);
if (AnimationProgress < (useAnim / 3))
{
if (Owner.Calamity().mouseRight && !chargedSwing)
doSwing = false;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
{
GFBMulti = 1;
GFBCharge = 0;
Projectile.scale = 1;
Animation = 0;
doSwing = false;
chargeTimer = 0;
chargedSwing = false;
swingCount++;
useAnim = storedUseAnim;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
}
else
{
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time == (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)))
{
if (!chargedSwing)
{
SoundEngine.PlaySound(Hellkite.SwingSound with { Volume = 0.8f, PitchVariance = 0.25f }, Projectile.Center);
}
else
{
SoundEngine.PlaySound(Hellkite.SwingSound with { Volume = 0.9f, Pitch = 0.2f }, Projectile.Center);
SoundEngine.PlaySound(Hellkite.SwingSoundBig with { Volume = 1f, Pitch = 0f }, Projectile.Center);
}
}
if ( time > (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && time < (int)(timeMax * (chargedSwing ? 0.9f : 0.7f)))
{
CanHit = true;
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
if (chargedSwing)
{
for (int i = 0; i < 3; i++)
{
particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new AltSparkParticle(particlePos, -particleVel.RotatedByRandom(0.4f), false, 24, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.OrangeRed : Color.DarkRed));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f), Main.rand.NextBool(4) ? Color.Red : Color.DarkRed, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f) * 2, Main.rand.NextBool(4) ? Color.Crimson : Color.Red, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true));
}
}
else
{
GeneralParticleHandler.SpawnParticle(new AltSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 24, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.OrangeRed : Color.DarkRed));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.Red : Color.DarkRed, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f));
}
}
else
{
CanHit = false;
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
//if (time >= timeMax)
//doSwing = false;
if (time < (int)(timeMax * 0.9f))
postSwing = true;
if (CanHit)
{
if (chargedSwing)
{
for (int i = 0; i < 6; i++)
{
float randRot = Main.rand.NextFloat(-10, -45);
Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
GeneralParticleHandler.SpawnParticle(new PointParticle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), false, Main.rand.Next(15, 18 + 1), Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed) * 0.8f));
}
for (int i = 0; i < 4; i++)
{
float randRot = Main.rand.NextFloat(-30, -60);
Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel * Main.rand.NextFloat(0.3f, 0.9f));
dust2.scale = Main.rand.NextFloat(0.65f, 0.95f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
}
}
else
{
for (int i = 0; i < 3; i++)
{
float randRot = Main.rand.NextFloat(-30, -60);
Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel * Main.rand.NextFloat(0.1f, 0.5f));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
}
}
}
}
}
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
}
public override void OnKill(int timeLeft)
{
if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound))
ChargeSound?.Stop();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
// If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits)
if ((damageDone <= 2 || target.life <= 0) && pierceReduction > 0)
{
pierceReduction -= 1;
}
if (!chargedSwing)
{
if (Projectile.numHits == 0)
{
SoundEngine.PlaySound(Hellkite.HitSoundSmall with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center);
Owner.Calamity().GeneralScreenShakePower = 4.5f;
}
for (int i = 0; i < MathHelper.Clamp(8 - Projectile.numHits * 2, 2, 8); i++)
{
Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
GeneralParticleHandler.SpawnParticle(spark2);
if (Main.rand.NextBool())
{
Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.DarkRed);
GeneralParticleHandler.SpawnParticle(spark3);
}
}
}
else
{
if (Projectile.numHits == 0)
{
SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center);
Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti;
for (int i = 0; i < 3; i++)
{
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, GFBFlashWarning ? (int)(18 * GFBMulti) : 18, true);
GeneralParticleHandler.SpawnParticle(blastRing);
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, GFBFlashWarning ? (int)(18 * GFBMulti) : 18, true);
GeneralParticleHandler.SpawnParticle(blastRing2);
}
for (int i = 0; i < 2; i++)
{
Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * GFBMulti, Color.OrangeRed, new Vector2(3, 0.8f), true);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int i = 0; i < 15; i++)
{
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed);
GeneralParticleHandler.SpawnParticle(spark2);
if (Main.rand.NextBool())
{
Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Color.DarkRed);
GeneralParticleHandler.SpawnParticle(spark3);
}
Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1));
dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * GFBMulti;
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed;
}
}
}
bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust;
if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false))
{
// Custom knockback
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (chargedSwing ? -24 : -19);
target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f);
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float minMult = 0.25f;
int hitsToMinMult = 4;
float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= (chargedSwing ? 4f * (GFBMulti) : 1) * damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/HellkiteGlow");
Asset<Texture2D> shineTex = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle");
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY);
SpriteEffects sEffects = spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
for (int i = 0; i < 5; i++)
{
Color auraColor = Color.Lerp(Color.OrangeRed, Color.Orange, Utils.GetLerpValue(0, 5, i)) * 0.2f * fadeIn;
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/HellkiteGhost").Value;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f - 0.5f);
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects);
}
Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects);
if (chargeTimer > 0)
{
for (int i = 0; i < 5; i++)
{
Color auraColor = Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i)) * 0.4f * fadeIn;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 13f) * 0.5f);
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), glowTex.Value.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects);
}
}
Main.EntitySpriteDraw(glowTex.Value, generalDrawPos, glowTex.Frame(1, FrameCount, 0, Frame), chargeTimer > 0 ? Color.Lerp(Color.White, Color.Gold, fadeIn) : Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects);
}
return false;
}
public override void ResetStyle()
{
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.