Luxor's Gift Rework
No files matched your search
@@ -709,6 +709,7 @@ namespace CalamityMod.CalPlayer
|
||||
#region Accessory
|
||||
public bool shieldOfTheHighRulerDashVelocityBoosted = false;
|
||||
public bool luxorsGift = false;
|
||||
public bool luxorHit = false;
|
||||
public bool fungalSymbiote = false;
|
||||
public bool trinketOfChi = false;
|
||||
public bool gladiatorSword = false;
|
||||
@@ -2770,6 +2771,7 @@ namespace CalamityMod.CalPlayer
|
||||
#region Buffs, Debuffs, Counters, and Nonsense
|
||||
heldGaelsLastFrame = false;
|
||||
gaelSwipes = 0;
|
||||
luxorHit = false;
|
||||
arsenalCooldown = 0;
|
||||
andromedaState = AndromedaPlayerState.Inactive;
|
||||
planarSpeedBoost = 0;
|
||||
|
||||
@@ -146,6 +146,9 @@ namespace CalamityMod.CalPlayer
|
||||
// Ursa Sergeant slash cooldown is reset on kill
|
||||
if (ursaSergeant && target.life <= 0 && target.realLife == -1)
|
||||
ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300);
|
||||
|
||||
if (luxorsGift)
|
||||
luxorHit = true;
|
||||
|
||||
// Transformer gives +2 blobs on kill, which are stored then given to you one by one (so it can't spawn more than one on a single frame)
|
||||
if (transformer && Player.Calamity().transformerCooldown == 0 && target.life <= 0 && target.realLife == -1)
|
||||
@@ -307,6 +310,9 @@ namespace CalamityMod.CalPlayer
|
||||
if (ursaSergeant && target.life <= 0 && target.realLife == -1)
|
||||
ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown);
|
||||
|
||||
if (luxorsGift && proj.type != ModContent.ProjectileType<LuxorsGiftMelee>() && proj.type != ModContent.ProjectileType<LuxorsGiftRanged>() && proj.type != ModContent.ProjectileType<LuxorsGiftMagic>() && proj.type != ModContent.ProjectileType<LuxorsGiftSummon>() && proj.type != ModContent.ProjectileType<LuxorsGiftRogue>() && proj.type != ModContent.ProjectileType<LuxorsGiftClassless>())
|
||||
luxorHit = true;
|
||||
|
||||
// Transformer gives +2 blobs on kill, which are stored then given to you one by one (so it can't spawn more than one on a single frame)
|
||||
if (transformer && Player.Calamity().transformerCooldown == 0 && target.life <= 0 && target.realLife == -1)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,43 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public class LuxorsGift : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
|
||||
public const int meleeAttackSpeed = 100;
|
||||
public const int rangedAttackSpeed = 25;
|
||||
public const int magicAttackSpeed = 75;
|
||||
public const int summonerAttackSpeed = 140;
|
||||
public const int rogueAttackSpeed = 36; // Rogue has a 12 frame delay between it's two shots, so it's actaully a bit slower than you'd think
|
||||
public const int classlessAttackSpeed = 50;
|
||||
|
||||
public const int meleeDamage = 16;
|
||||
public const int rangedDamage = 5;
|
||||
public const int magicDamage = 13;
|
||||
public const int summonerDamage = 22;
|
||||
public const int rogueDamage = 8;
|
||||
public const int classlessDamage = 9;
|
||||
|
||||
public const int luxArmorPen = 35; // Remember kids, If a Shark Tooth Necklace approaches you, run away and contact your nearest trusted adult
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 58;
|
||||
Item.height = 48;
|
||||
Item.width = 66;
|
||||
Item.height = 46;
|
||||
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.accessory = true;
|
||||
@@ -21,6 +47,11 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.luxorsGift = true;
|
||||
|
||||
if (player.ownedProjectileCounts[ProjectileType<Luxor>()] < 1 && !player.dead)
|
||||
{
|
||||
Projectile lux = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType<Luxor>(), 0, 0f, player.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 1.3 KiB |
@@ -343,84 +343,6 @@ namespace CalamityMod.Items
|
||||
player.statMana = 0;
|
||||
}
|
||||
|
||||
if (modPlayer.luxorsGift && !item.channel)
|
||||
{
|
||||
// useTime 9 = 0.9 useTime 2 = 0.2
|
||||
float damageMult = 1f;
|
||||
if (item.useTime < 10)
|
||||
damageMult -= (10 - item.useTime) / 10f;
|
||||
|
||||
float newDamage = damage * damageMult;
|
||||
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (item.CountsAsClass<MeleeDamageClass>())
|
||||
{
|
||||
int meleeDamage = (int)(newDamage * 0.25f);
|
||||
|
||||
if (meleeDamage >= 1)
|
||||
{
|
||||
int projectile = Projectile.NewProjectile(playerSource, position, velocity * 0.5f, ModContent.ProjectileType<LuxorsGiftMelee>(), (int)meleeDamage, 0f, player.whoAmI);
|
||||
if (projectile.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile].DamageType = DamageClass.Generic;
|
||||
}
|
||||
}
|
||||
else if (item.CountsAsClass<ThrowingDamageClass>())
|
||||
{
|
||||
int throwingDamage = (int)(newDamage * 0.2f);
|
||||
|
||||
if (throwingDamage >= 1)
|
||||
{
|
||||
int projectile = Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType<LuxorsGiftRogue>(), (int)throwingDamage, 0f, player.whoAmI);
|
||||
if (projectile.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile].DamageType = DamageClass.Generic;
|
||||
}
|
||||
}
|
||||
else if (item.CountsAsClass<RangedDamageClass>())
|
||||
{
|
||||
// This projectile is channeled and has no cooldown unless the gun fires
|
||||
// The damage of the projectile is also always the max damage of the weapon, and the shot damage is calculated based off of that
|
||||
// You can see how this may cause issues
|
||||
// The projectile is fired inside of the scope's code instead
|
||||
if (type != ModContent.ProjectileType<TitaniumRailgunScope>())
|
||||
{
|
||||
int rangedDamage = (int)(newDamage * 0.15f);
|
||||
|
||||
if (rangedDamage >= 1)
|
||||
{
|
||||
int projectile = Projectile.NewProjectile(playerSource, position, velocity * 1.5f, ModContent.ProjectileType<LuxorsGiftRanged>(), (int)rangedDamage, 0f, player.whoAmI);
|
||||
if (projectile.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile].DamageType = DamageClass.Generic;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.CountsAsClass<MagicDamageClass>())
|
||||
{
|
||||
int magicDamage = (int)(newDamage * 0.3f);
|
||||
|
||||
if (magicDamage >= 1)
|
||||
{
|
||||
int projectile = Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType<LuxorsGiftMagic>(), (int)magicDamage, 0f, player.whoAmI);
|
||||
if (projectile.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile].DamageType = DamageClass.Generic;
|
||||
}
|
||||
}
|
||||
else if (item.CountsAsClass<SummonDamageClass>() && player.ownedProjectileCounts[ModContent.ProjectileType<LuxorsGiftSummon>()] < 1)
|
||||
{
|
||||
if (damage >= 1)
|
||||
{
|
||||
int summonDamage = item.damage;
|
||||
|
||||
int projectile = Projectile.NewProjectile(playerSource, position, Vector2.Zero, ModContent.ProjectileType<LuxorsGiftSummon>(), summonDamage, 0f, player.whoAmI);
|
||||
if (projectile.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[projectile].DamageType = DamageClass.Generic;
|
||||
Main.projectile[projectile].originalDamage = item.damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modPlayer.bloodflareMage && modPlayer.canFireBloodflareMageProjectile)
|
||||
{
|
||||
if (item.CountsAsClass<MagicDamageClass>() && !item.channel)
|
||||
|
||||
@@ -1055,8 +1055,9 @@ LuxorsGift: {
|
||||
DisplayName: Luxor's Gift
|
||||
Tooltip:
|
||||
'''
|
||||
Weapons fire unique projectiles based on their damage type
|
||||
Some weapons are unable to receive this bonus
|
||||
Summons a scarab launcher that follows you closely
|
||||
The scarab fires different projectiles at enemies depending on what class the held weapon belongs to
|
||||
When not in use, the scarab will condense itself into a small orb of light
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ JewelSpike.DisplayName: Spike
|
||||
KelvinCatalystStar.DisplayName: Kelvin Catalyst Star
|
||||
LeviAmberDash.DisplayName: Riptide Slam
|
||||
LunicBeam.DisplayName: Lunic Seeker
|
||||
Luxor.DisplayName: Luxor
|
||||
LuxorsGiftClassless.DisplayName: Luxor's Classless
|
||||
MagnusBeam.DisplayName: Magnus Seeker
|
||||
MagnusBoom.DisplayName: Nebula Blast
|
||||
MythrilFlare.DisplayName: Mythril Flare
|
||||
@@ -98,6 +100,7 @@ PlaguePulse.DisplayName: Plague Pulse
|
||||
PoisonousSeawater.DisplayName: Seawater
|
||||
PscTransformAnimation.DisplayName: Psc Transform Animation
|
||||
PscTransformRocks.DisplayName: Psc Transform Rocks
|
||||
PuddleSplash.DisplayName: Puddle Splash
|
||||
ReaverOrb.DisplayName: Reaver Orb
|
||||
ReaverThornBase.DisplayName: Thorn
|
||||
RedLabSeeker.DisplayName: Seeking Mechanism
|
||||
@@ -145,4 +148,3 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife
|
||||
YellowLabSeeker.DisplayName: Seeking Mechanism
|
||||
VoidofExtinctionCrit.DisplayName: Void of Extinction Crit
|
||||
XykDeathAnim.DisplayName: Xyk Death Animation
|
||||
PuddleSplash.DisplayName: Puddle Splash
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -14,69 +17,87 @@ namespace CalamityMod.Projectiles.Magic
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 1;
|
||||
}
|
||||
|
||||
public float velLerp => Utils.GetLerpValue(1, 8, Projectile.velocity.Length(), true);
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.height = 36;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 240;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.35f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
if (Projectile.timeLeft == 360)
|
||||
Projectile.velocity *= 0.1f;
|
||||
if (Projectile.velocity.Length() < 8)
|
||||
Projectile.velocity *= 1.01f;
|
||||
/*
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = !Main.rand.NextBool(3);
|
||||
dust.scale = Main.rand.NextFloat(0.45f, 0.6f);
|
||||
dust.color = Color.Gold;
|
||||
dust.noLightEmittence = true;
|
||||
*/
|
||||
if (Projectile.timeLeft > 30)
|
||||
{
|
||||
Projectile.scale -= 0.01f;
|
||||
Projectile.alpha += 15;
|
||||
if (Projectile.alpha >= 250)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
else if (Projectile.localAI[0] == 1f)
|
||||
{
|
||||
Projectile.scale += 0.01f;
|
||||
Projectile.alpha -= 15;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.localAI[0] = 0f;
|
||||
}
|
||||
}
|
||||
Projectile.localAI[1] += 1f;
|
||||
if (Projectile.localAI[1] == 3f)
|
||||
{
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
|
||||
dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default);
|
||||
int dusty = Dust.NewDust(Projectile.Center, 0, 0, DustID.CopperCoin, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[dusty].scale = 1.1f;
|
||||
Main.dust[dusty].noGravity = true;
|
||||
Main.dust[dusty].position = Projectile.Center + dustRotate;
|
||||
Main.dust[dusty].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[dusty].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dusty].position) * 1.25f;
|
||||
Vector2 offset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 35 * velLerp;
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.1f) * Main.rand.NextFloat(5.5f, 6.5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, dustVel);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.5f);
|
||||
dust.color = Color.Gold;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Projectile.velocity *= 0.25f;
|
||||
float minMult = 0.5f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
for (int g = 0; g < 4; g++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 offset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 35 * velLerp;
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2();
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType<LightDust>(), dustVel.RotatedByRandom(0.3f) * Main.rand.NextFloat(5.5f, 9.5f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.2f, 1.5f);
|
||||
dust.color = Color.Gold;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10 + 65 * velLerp, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Gold;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 2f).ToRotationVector2().RotatedBy(Projectile.timeLeft * 0.1f) * 45 * velLerp;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.6f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, new Vector2(1 - 0.3f * velLerp, 1 + 0.8f * velLerp) * Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 550 B |
@@ -1,5 +1,9 @@
|
||||
using CalamityMod.Dusts;
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -15,100 +19,82 @@ namespace CalamityMod.Projectiles.Melee
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 3;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.penetrate = -1; // Works like 2
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.extraUpdates = 2;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.35f);
|
||||
Projectile.scale = (Projectile.ai[0] == 5 ? 0.5f : 0.75f);
|
||||
Projectile.velocity *= 0.973f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.ai[0] == 5)
|
||||
{
|
||||
Projectile.scale -= 0.01f;
|
||||
Projectile.alpha += 15;
|
||||
if (Projectile.alpha >= 250)
|
||||
if (Projectile.timeLeft % 9 == 0 && Projectile.timeLeft > 30)
|
||||
{
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localAI[0] = 1f;
|
||||
Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.45f, 0.6f);
|
||||
dust.color = Color.Red;
|
||||
dust.alpha = 120;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
else if (Projectile.localAI[0] == 1f)
|
||||
else if (Projectile.timeLeft % 4 == 0 && Projectile.timeLeft > 30)
|
||||
{
|
||||
Projectile.scale += 0.01f;
|
||||
Projectile.alpha -= 15;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.localAI[0] = 0f;
|
||||
}
|
||||
Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = !Main.rand.NextBool(3);
|
||||
dust.scale = Main.rand.NextFloat(0.45f, 0.6f);
|
||||
dust.color = Color.Red;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
Projectile.localAI[1] += 1f;
|
||||
if (Projectile.localAI[1] == 3f)
|
||||
if (Projectile.timeLeft > 90 && Projectile.timeLeft < 177 && Projectile.timeLeft % 2 == 0 && Projectile.ai[0] == 0)
|
||||
{
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
|
||||
dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default);
|
||||
int spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[spawnDust].scale = 1.1f;
|
||||
Main.dust[spawnDust].noGravity = true;
|
||||
Main.dust[spawnDust].position = Projectile.Center + dustRotate;
|
||||
Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f;
|
||||
}
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, false, 14, 0.02f, Color.Red * 0.45f, new Vector2(1.4f, 1f), true, false, 0.6f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.timeLeft < 85)
|
||||
{
|
||||
byte b2 = (byte)(Projectile.timeLeft * 3);
|
||||
byte a2 = (byte)(100f * ((float)b2 / 255f));
|
||||
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
|
||||
}
|
||||
return new Color(255, 255, 255, 100);
|
||||
float minMult = 0.5f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
if (Projectile.numHits >= 1 && Projectile.timeLeft > 70)
|
||||
Projectile.timeLeft = 70;
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
|
||||
dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default);
|
||||
int spawnDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[spawnDust].scale = 1.1f;
|
||||
Main.dust[spawnDust].noGravity = true;
|
||||
Main.dust[spawnDust].position = Projectile.Center + dustRotate;
|
||||
Main.dust[spawnDust].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[spawnDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[spawnDust].position) * 1.25f;
|
||||
}
|
||||
if (Projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (Projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
Projectile.velocity = oldVelocity * 0.85f;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.ai[0] == 5 || Projectile.numHits >= 2) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Red;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
//CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 668 B |
@@ -1,4 +1,8 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -17,87 +21,79 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.width = 38;
|
||||
Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.extraUpdates = 5;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft < 85)
|
||||
{
|
||||
byte b2 = (byte)(Projectile.timeLeft * 3);
|
||||
byte a2 = (byte)(100f * ((float)b2 / 255f));
|
||||
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
|
||||
}
|
||||
return new Color(255, 255, 255, 100);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.scale -= 0.01f;
|
||||
Projectile.alpha += 15;
|
||||
if (Projectile.alpha >= 250)
|
||||
{
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
else if (Projectile.localAI[0] == 1f)
|
||||
{
|
||||
Projectile.scale += 0.01f;
|
||||
Projectile.alpha -= 15;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.localAI[0] = 0f;
|
||||
}
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.35f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
Projectile.localAI[1] += 1f;
|
||||
if (Projectile.localAI[1] == 3f)
|
||||
if (Projectile.timeLeft == 300)
|
||||
Projectile.velocity *= 0.5f;
|
||||
if (Projectile.timeLeft > 30)
|
||||
{
|
||||
for (int l = 0; l < 12; l++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 offset = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
offset += -Vector2.UnitY.RotatedBy((double)(l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f);
|
||||
offset = offset.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default);
|
||||
int electric = Dust.NewDust(Projectile.Center, 0, 0, DustID.IceTorch, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[electric].scale = 1.1f;
|
||||
Main.dust[electric].noGravity = true;
|
||||
Main.dust[electric].position = Projectile.Center + offset;
|
||||
Main.dust[electric].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[electric].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[electric].position) * 1.25f;
|
||||
Vector2 dustPos = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * (i == 0 ? -3 : 3);
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f);
|
||||
Dust dust = Dust.NewDustPerfect(dustPos + Main.rand.NextVector2Circular(2, 2), Main.rand.NextBool() ? 278 : ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.3f, 0.4f);
|
||||
dust.color = Color.Cyan;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Projectile.ExpandHitboxBy(16);
|
||||
Projectile.maxPenetrate = Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.Damage();
|
||||
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
|
||||
int dustAmt = Main.rand.Next(10, 20);
|
||||
for (int d = 0; d < dustAmt; d++)
|
||||
float minMult = 0.5f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
int electric = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[electric].velocity *= 2f;
|
||||
Main.dust[electric].noGravity = true;
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(11, 11), Main.rand.NextBool() ? 278 : ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.3f, 1.7f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.1f);
|
||||
dust.color = Color.Cyan;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(11, 11), Main.rand.NextBool() ? 278 : ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.3f, 1.7f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.1f);
|
||||
dust.color = Color.Cyan;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Cyan;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 584 B |
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -17,95 +20,92 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 48;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 4;
|
||||
Projectile.aiStyle = ProjAIStyleID.ThrownProjectile;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 300;
|
||||
AIType = ProjectileID.ThrowingKnife;
|
||||
Projectile.penetrate = 3;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.extraUpdates = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.Magenta.ToVector3() * 0.35f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Projectile.scale -= 0.01f;
|
||||
Projectile.alpha += 15;
|
||||
if (Projectile.alpha >= 250)
|
||||
{
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
else if (Projectile.localAI[0] == 1f)
|
||||
{
|
||||
Projectile.scale += 0.01f;
|
||||
Projectile.alpha -= 15;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.localAI[0] = 0f;
|
||||
}
|
||||
}
|
||||
Projectile.localAI[1] += 1f;
|
||||
if (Projectile.localAI[1] == 3f)
|
||||
{
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
Vector2 rotation = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
rotation += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
|
||||
rotation = rotation.RotatedBy((double)(Projectile.rotation - 1.57079637f), default);
|
||||
int dusty = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[dusty].scale = 1.1f;
|
||||
Main.dust[dusty].noGravity = true;
|
||||
Main.dust[dusty].position = Projectile.Center + rotation;
|
||||
Main.dust[dusty].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[dusty].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dusty].position) * 1.25f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft < 85)
|
||||
{
|
||||
byte b2 = (byte)(Projectile.timeLeft * 3);
|
||||
byte a2 = (byte)(100f * ((float)b2 / 255f));
|
||||
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
|
||||
}
|
||||
return new Color(255, 255, 255, 100);
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Projectile.penetrate--;
|
||||
if (Projectile.penetrate <= 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
Projectile.velocity.Y += 0.04f;
|
||||
if (Projectile.velocity.Y > 0)
|
||||
Projectile.velocity.X *= 0.99f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (Projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
Projectile.velocity.Y += 0.06f;
|
||||
if (Projectile.velocity.Y > 0)
|
||||
Projectile.velocity.X *= 0.985f;
|
||||
}
|
||||
if (Projectile.timeLeft > 60)
|
||||
{
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.3f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, dustVel);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.5f);
|
||||
dust.color = Color.Magenta;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
float minMult = 0.4f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
Projectile.velocity = Utils.DirectionTo(target.Center, Projectile.Center).RotatedByRandom(0.2f) * 7;
|
||||
Projectile.velocity.X *= 0.2f;
|
||||
Projectile.velocity.Y *= 1.2f;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>());
|
||||
c.velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2().RotatedBy(MathHelper.PiOver4) * 4.5f * (i % 2 == 0 ? 0.78f : 1f);
|
||||
c.scale = Main.rand.NextFloat(0.6f, 0.7f) * (i % 2 == 0 ? 2.2f : 1.8f);
|
||||
c.noGravity = true;
|
||||
c.color = Color.Magenta;
|
||||
c.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
if (Projectile.numHits == 0)
|
||||
Projectile.numHits = 1;
|
||||
if (Projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (Projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
Projectile.velocity *= 0.92f;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
Projectile.localNPCImmunity[i] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 30, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Magenta;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 663 B |
@@ -1,5 +1,10 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,10 +15,10 @@ namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Summon";
|
||||
private int dust = 3;
|
||||
|
||||
public NPC targeted;
|
||||
public int attackTime = 0;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 1;
|
||||
}
|
||||
@@ -21,96 +26,85 @@ namespace CalamityMod.Projectiles.Summon
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.height = 46;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.timeLeft = 180000;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft *= 5;
|
||||
Projectile.minion = true;
|
||||
Projectile.penetrate = -1; // 3
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (dust > 0)
|
||||
{
|
||||
int dustAmt = 36;
|
||||
for (int i = 0; i < dustAmt; i++)
|
||||
{
|
||||
Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f;
|
||||
rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center;
|
||||
Vector2 faceDirection = rotate - Projectile.Center;
|
||||
int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.TerraBlade, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity = faceDirection;
|
||||
}
|
||||
dust--;
|
||||
}
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.scale -= 0.01f;
|
||||
Projectile.alpha += 15;
|
||||
if (Projectile.alpha >= 250)
|
||||
{
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
else if (Projectile.localAI[0] == 1f)
|
||||
{
|
||||
Projectile.scale += 0.01f;
|
||||
Projectile.alpha -= 15;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.localAI[0] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool isMinion = Projectile.type == ModContent.ProjectileType<LuxorsGiftSummon>();
|
||||
if (isMinion)
|
||||
{
|
||||
if (!modPlayer.luxorsGift || player.dead)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.ChargingMinionAI(700f, 1000f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Color.Lime.ToVector3() * 0.35f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
if (targeted == null || !targeted.active || targeted.life <= 0)
|
||||
targeted = Projectile.Center.ClosestNPCAt(500);
|
||||
if (targeted != null && attackTime == 0)
|
||||
{
|
||||
CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.8f, 12, 0.93f, 0.99f);
|
||||
}
|
||||
if (attackTime > 0)
|
||||
{
|
||||
attackTime--;
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(0.09f * (Projectile.numHits % 2 == 0 ? -1 : 1));
|
||||
if (Projectile.velocity.Length() < 12)
|
||||
Projectile.velocity *= 1.025f;
|
||||
}
|
||||
|
||||
if (Projectile.timeLeft % 2 == 0)
|
||||
{
|
||||
bool sparkly = Main.rand.NextBool(3);
|
||||
Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), sparkly ? 278 : ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = !sparkly;
|
||||
dust.scale = Main.rand.NextFloat(0.45f, 0.6f) * (sparkly ? 1.6f : 1);
|
||||
dust.color = Color.Lime;
|
||||
dust.noLightEmittence = true;
|
||||
dust.velocity *= (sparkly ? 1 : 8);
|
||||
}
|
||||
|
||||
Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 0.5f, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 9, 0.18f, Color.Lime * 0.7f, new Vector2(0.9f, 1.2f), true, false, 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
modifiers.DisableCrit();
|
||||
if (!Collision.CanHit(Projectile, Main.player[Projectile.owner]))
|
||||
modifiers.SourceDamage *= 0.75f; // Minion deals 75% damage if it doesn't have line of sight with its owner
|
||||
}
|
||||
float minMult = 0.5f;
|
||||
int hitsToMinMult = 3;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft < 85)
|
||||
attackTime = 45;
|
||||
|
||||
if (Projectile.numHits >= 2)
|
||||
{
|
||||
byte b2 = (byte)(Projectile.timeLeft * 3);
|
||||
byte a2 = (byte)(100f * ((float)b2 / 255f));
|
||||
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.8f) * Main.rand.NextFloat(6f, 14f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), ModContent.DustType<LightDust>(), dustVel);
|
||||
dust.noGravity = Main.rand.NextBool();
|
||||
dust.scale = Main.rand.NextFloat(0.65f, 1.2f);
|
||||
dust.color = Color.Lime;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
return new Color(255, 255, 255, 100);
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target) => (targeted != null && target == targeted && attackTime == 0) ? null : false;
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 8, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
var dye = Main.player[Projectile.owner]?.cMinion ?? 0;
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2, armorShaderToUse: dye);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Lime;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 513 B |
@@ -0,0 +1,251 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class Luxor : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public CalamityPlayer moddedOwner => Owner.Calamity();
|
||||
public Color usedColor = Color.White;
|
||||
public DamageClass lastDamageClass = null;
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public ref float attackTimer => ref Projectile.ai[1];
|
||||
public ref float idleTimer => ref Projectile.localAI[0];
|
||||
public int classType = 0; // 0 = Classless, 1 = Melee, 2 = Ranged, 3 = Mage, 4 = Summoner, 5 = Rogue
|
||||
public Vector2 tipPosition => Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 15;
|
||||
|
||||
public float fxFade = 0; // The glow visuals multiplier
|
||||
public float postFireBoost = 0; // The glow increases right when you fire, then quickly fades
|
||||
public float followSpeed = 6; // The speed Luxor follows you, lower is faster
|
||||
public bool rogueChain = true; // Used for rogue's double projectile shot
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 114;
|
||||
Projectile.height = 38;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Color classColor = Color.White;
|
||||
DamageClass itemClass = Owner.HeldItem.DamageType;
|
||||
if (itemClass == null)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
else if (itemClass.CountsAsClass<MeleeDamageClass>())
|
||||
{ classColor = Color.Red; classType = 1; }
|
||||
else if (itemClass.CountsAsClass<RangedDamageClass>())
|
||||
{ classColor = Color.Cyan; classType = 2; }
|
||||
else if (itemClass.CountsAsClass<MagicDamageClass>())
|
||||
{ classColor = Color.Gold; classType = 3; }
|
||||
else if (itemClass.CountsAsClass<SummonDamageClass>())
|
||||
{ classColor = Color.Lime; classType = 4; }
|
||||
else if (itemClass.CountsAsClass<RogueDamageClass>())
|
||||
{ classColor = Color.Magenta; classType = 5; }
|
||||
else
|
||||
{ classColor = Color.Gray; classType = 0; };
|
||||
|
||||
if (time == 0 || itemClass != lastDamageClass)
|
||||
{
|
||||
Projectile.netUpdate = true;
|
||||
attackTimer = 60; // 60 frame attack delay on spawn or swapping class weapons
|
||||
}
|
||||
lastDamageClass = itemClass;
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 7;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.Lerp(classColor, Color.White, 0.15f),
|
||||
Color.Lerp(classColor, Color.Black, 0.15f)
|
||||
};
|
||||
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld);
|
||||
|
||||
Vector2 destination = Vector2.Lerp(Owner.Center - Projectile.velocity * (70 + 100 * Utils.GetLerpValue(0, 110, attackTimer, true)), Owner.Center + Vector2.UnitY * -40, Utils.GetLerpValue(280, 300, idleTimer, true));
|
||||
Projectile.velocity = (destination - Projectile.Center) / followSpeed;
|
||||
|
||||
Projectile.rotation = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
fxFade = (float)Math.Pow(Utils.GetLerpValue(30, 0, attackTimer, true), 3) + postFireBoost;
|
||||
|
||||
if (idleTimer >= 280)
|
||||
{
|
||||
if (moddedOwner.luxorHit)
|
||||
{
|
||||
if (idleTimer > 320)
|
||||
idleTimer = 320;
|
||||
idleTimer -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fxFade = 1;
|
||||
attackTimer = 40;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (attackTimer == 0 && moddedOwner.luxorHit)
|
||||
{
|
||||
int attackSpeed = 0;
|
||||
int attackDamage = 0;
|
||||
int projType = 0;
|
||||
switch (classType)
|
||||
{
|
||||
case 0: attackSpeed = LuxorsGift.classlessAttackSpeed; attackDamage = LuxorsGift.classlessDamage; projType = ModContent.ProjectileType<LuxorsGiftClassless>(); break;
|
||||
case 1: attackSpeed = LuxorsGift.meleeAttackSpeed; attackDamage = LuxorsGift.meleeDamage; projType = ModContent.ProjectileType<LuxorsGiftMelee>(); break;
|
||||
case 2: attackSpeed = LuxorsGift.rangedAttackSpeed; attackDamage = LuxorsGift.rangedDamage; projType = ModContent.ProjectileType<LuxorsGiftRanged>(); break;
|
||||
case 3: attackSpeed = LuxorsGift.magicAttackSpeed; attackDamage = LuxorsGift.magicDamage; projType = ModContent.ProjectileType<LuxorsGiftMagic>(); break;
|
||||
case 4: attackSpeed = LuxorsGift.summonerAttackSpeed; attackDamage = LuxorsGift.summonerDamage; projType = ModContent.ProjectileType<LuxorsGiftSummon>(); break;
|
||||
case 5: attackSpeed = LuxorsGift.rogueAttackSpeed; attackDamage = LuxorsGift.rogueDamage; projType = ModContent.ProjectileType<LuxorsGiftRogue>(); break;
|
||||
}
|
||||
float powerMult = Utils.GetLerpValue(-120, 140, attackSpeed, true); // An intensity multiplier based on the fire rate of the mode
|
||||
if (Main.zenithWorld) // Just like old times
|
||||
{
|
||||
attackSpeed = 0;
|
||||
attackDamage = Math.Max(1, (int)(Owner.HeldItem.damage * Utils.Remap(Owner.HeldItem.useAnimation, 3, 120, 0.025f, 1f, false)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)(20 * powerMult); i++) // Firing dust
|
||||
{
|
||||
Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 12 * powerMult;
|
||||
Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.5f, 1.2f));
|
||||
dust.noGravity = !Main.rand.NextBool(3);
|
||||
dust.scale = Main.rand.NextFloat(0.75f, 1.4f) * powerMult;
|
||||
dust.color = usedColor;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
if (classType == 1) // Melee shotgun
|
||||
{
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedBy(-0.12f * i * Main.rand.NextFloat(0.7f, 1f)) * (12 - Main.rand.NextFloat(0f, 0.6f) - Math.Abs(i)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI);
|
||||
proj.ArmorPenetration = LuxorsGift.luxArmorPen;
|
||||
}
|
||||
for (int i = 0; i < 5; i++) // These are visual
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedByRandom(0.4f) * (12 - Main.rand.NextFloat(2f, 5f)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI, 5);
|
||||
proj.timeLeft = 95;
|
||||
}
|
||||
}
|
||||
else // Everything else
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld) * 12, projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI);
|
||||
proj.ArmorPenetration = LuxorsGift.luxArmorPen;
|
||||
if (classType == 5) // Rogue has gravity so velocity is adjusted a bit
|
||||
proj.velocity.Y -= 1.5f;
|
||||
}
|
||||
|
||||
SoundStyle blam = new("CalamityMod/Sounds/Item/GunShotSmall");
|
||||
SoundEngine.PlaySound(blam with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, tipPosition);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = 0.2f }, tipPosition);
|
||||
|
||||
if (classType == 5 && rogueChain)
|
||||
{
|
||||
rogueChain = false;
|
||||
attackTimer = attackSpeed / 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
attackTimer = attackSpeed;
|
||||
moddedOwner.luxorHit = false;
|
||||
if (!CalamityClientConfig.Instance.Photosensitivity)
|
||||
postFireBoost = 1.7f;
|
||||
idleTimer = 0;
|
||||
rogueChain = true;
|
||||
}
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
if (attackTimer > 0)
|
||||
attackTimer--;
|
||||
if (postFireBoost > 0) // Quickly fade out the increased poost fire visuals
|
||||
postFireBoost -= 0.2f;
|
||||
|
||||
if (time % 2 == 0 && false)
|
||||
{
|
||||
Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(100);
|
||||
Dust dust = Dust.NewDustPerfect(Owner.Center + dustVel, ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.1f, 0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 0.7f);
|
||||
dust.color = usedColor;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
|
||||
float idleFade = Utils.GetLerpValue(280, 300, idleTimer, true);
|
||||
Lighting.AddLight(tipPosition, Color.Lerp(usedColor, Color.Lerp(usedColor, Color.White, 0.5f), idleFade).ToVector3() * (0.5f * MathHelper.Lerp(fxFade, 1, 0.55f) + 0.35f * idleFade));
|
||||
|
||||
if (moddedOwner.luxorsGift)
|
||||
Projectile.timeLeft++;
|
||||
else
|
||||
Projectile.Kill();
|
||||
if (Owner.dead)
|
||||
Projectile.Kill();
|
||||
|
||||
time++;
|
||||
if (!moddedOwner.luxorHit)
|
||||
idleTimer++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Texture2D bTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Texture2D cTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Light").Value;
|
||||
float idleFade = (float)Math.Pow(Utils.GetLerpValue(280, 300, idleTimer, true), 5);
|
||||
Color drawColor = usedColor;
|
||||
Color bodyColor = Color.Lerp(lightColor, Color.Gold with { A = 0 }, idleFade);
|
||||
float drawMult = Math.Max(idleFade, fxFade);
|
||||
|
||||
if (idleFade == 0)
|
||||
{
|
||||
for (int i = 0; i < 18; i++) // Backglow
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 6 * drawMult;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.2f * drawMult, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
// Main body
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, bodyColor * (1 - idleFade), Projectile.rotation, tex.Size() * 0.5f, new Vector2(1 - 0.85f * idleFade, 1f) * Projectile.scale, SpriteEffects.None);
|
||||
for (int i = 0; i < 4; i++) // Glow orb
|
||||
{
|
||||
Main.EntitySpriteDraw(bTexture, Vector2.Lerp(tipPosition, Projectile.Center, idleFade) - Main.screenPosition, null, drawColor with { A = 0 } * 0.35f * drawMult, time * 0.13f * (i + 1), bTexture.Size() * 0.5f, new Vector2(1 + i * 0.15f, i - 0.3f * i) * Projectile.scale * MathHelper.Lerp(0.33f, 0.22f, idleFade) * drawMult, SpriteEffects.None);
|
||||
}
|
||||
// Glow orb center
|
||||
Main.EntitySpriteDraw(cTexture, Vector2.Lerp(tipPosition, Projectile.Center, idleFade) - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f * drawMult, Projectile.rotation, cTexture.Size() * 0.5f, Projectile.scale * MathHelper.Lerp(0.4f, 0.3f, idleFade) * drawMult, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class LuxorsGiftClassless : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 1;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.extraUpdates = 6;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.35f);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.timeLeft < 294)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.3f, false, 18, 0.03f * (1 + Utils.GetLerpValue(270, 300, Projectile.timeLeft, true)), Color.Gray * 0.45f, new Vector2(1.1f * (1 + Utils.GetLerpValue(270, 300, Projectile.timeLeft, true)), 1.3f), true, false, 0.3f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
float minMult = 0.1f;
|
||||
int hitsToMinMult = 7;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
for (int i = 0; i < Math.Max(6 - Projectile.numHits, 1); i++)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f), false, 8, 0.02f, Color.White * 0.75f, new Vector2(0.8f, 1.3f), true, false, 1f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f), false, 35, 0.5f, Color.White);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
if (Projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (Projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Color drawColor = Color.Gray;
|
||||
float fade = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f;
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
//CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.3 KiB |