Skytide Dragoon
I'll clean up the code tomorrow
No files matched your search
@@ -4,6 +4,7 @@ using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Pets;
|
||||
using CalamityMod.Items.Placeables.Furniture.DevPaintings;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs.StormWeaver;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -61,7 +62,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
// Weapons
|
||||
itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[]
|
||||
{
|
||||
ModContent.ItemType<StormDragoon>(),
|
||||
ModContent.ItemType<SkytideDragoon>(),
|
||||
ModContent.ItemType<TheStorm>(),
|
||||
ModContent.ItemType<Thunderbolt>()
|
||||
}));
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class SkytideDragoon : CustomUseProjItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 86;
|
||||
Item.height = 94;
|
||||
Item.damage = 315;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = 35;
|
||||
Item.useTime = 35;
|
||||
Item.useTurn = true;
|
||||
Item.knockBack = 12f;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
|
||||
Item.channel = true;
|
||||
Item.shoot = ModContent.ProjectileType<SkytideDragoonHoldout>();
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
}
|
||||
public override bool MeleePrefix() => true;
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
{
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/SkytideDragoonGlow").Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
@@ -1,56 +0,0 @@
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class StormDragoon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 74;
|
||||
Item.height = 34;
|
||||
Item.damage = 96;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 2;
|
||||
Item.useAnimation = 20;
|
||||
Item.reuseDelay = 10;
|
||||
Item.useLimitPerAnimation = 10;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 3.25f;
|
||||
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.UseSound = SoundID.Item31;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shootSpeed = 18f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
{
|
||||
return new Vector2(-25, 0);
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f;
|
||||
float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f;
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
if (Main.rand.Next(0, 100) < 90)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1517,3 +1517,8 @@ YinYo: {
|
||||
A very agile yoyo
|
||||
'''
|
||||
}
|
||||
|
||||
SkytideDragoon: {
|
||||
DisplayName: Skytide Dragoon
|
||||
Tooltip: ""
|
||||
}
|
||||
@@ -1235,15 +1235,6 @@ StellarCannon: {
|
||||
Tooltip: Launches an explosive astral crystal
|
||||
}
|
||||
|
||||
StormDragoon: {
|
||||
DisplayName: Storm Dragoon
|
||||
Tooltip:
|
||||
'''
|
||||
Fires a spray of bullets
|
||||
90% chance to save ammo
|
||||
'''
|
||||
}
|
||||
|
||||
StormSurge: {
|
||||
DisplayName: Storm Surge
|
||||
Tooltip:
|
||||
|
||||
@@ -304,3 +304,5 @@ WulfrumScrew.DisplayName: Wulfrum Screw
|
||||
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
|
||||
YinYoDark.DisplayName: Dark Shard
|
||||
YinYoLight.DisplayName: Light Shard
|
||||
DragoonBigBolt.DisplayName: Dragoon Big Bolt
|
||||
DragoonSmallBolt.DisplayName: Dragoon Small Bolt
|
||||
@@ -13,6 +13,7 @@ using CalamityMod.Items.Placeables.Furniture.Trophies;
|
||||
using CalamityMod.Items.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs.Perforator;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
@@ -986,7 +987,7 @@ namespace CalamityMod.NPCs.StormWeaver
|
||||
// Weapons
|
||||
int[] weapons = new int[]
|
||||
{
|
||||
ModContent.ItemType<StormDragoon>(),
|
||||
ModContent.ItemType<SkytideDragoon>(),
|
||||
ModContent.ItemType<TheStorm>(),
|
||||
ModContent.ItemType<Thunderbolt>(),
|
||||
};
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,133 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.GameContent.Animations.IL_Actions.Sprites;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class DragoonBigBolt : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int time = 0;
|
||||
public float colorValue = 0;
|
||||
public float sizeMult = 1;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 75;
|
||||
Projectile.timeLeft = 200;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
colorValue = MathHelper.Lerp(colorValue, 50, 0.025f);
|
||||
Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue));
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
colorValue += 30;
|
||||
sizeMult = Projectile.ai[1];
|
||||
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/ArcFlash");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Owner.Center);
|
||||
}
|
||||
|
||||
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (targetDist < 1400f && Projectile.timeLeft > 5)
|
||||
{
|
||||
Vector2 pos = Projectile.Center;
|
||||
if (Projectile.timeLeft % 4 == 0)
|
||||
{
|
||||
if (time < 120)
|
||||
{
|
||||
float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3);
|
||||
Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
sizeMult *= 0.98f;
|
||||
}
|
||||
Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (Main.rand.NextBool(35))
|
||||
{
|
||||
Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (time % 5 == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f));
|
||||
dust.noGravity = true;
|
||||
dust.color = usedColor;
|
||||
}
|
||||
}
|
||||
if (Projectile.ai[1] == 0.5f && Projectile.timeLeft == 1)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
}
|
||||
time++;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Electrified, 300);
|
||||
if (Projectile.ai[1] != 0.5f)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Projectile.timeLeft = 5;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
float fxScale = 3;
|
||||
Vector2 pos = target.Center;
|
||||
for (int i = 0; i < (int)(7 * fxScale); i++)
|
||||
{
|
||||
Particle spark2 = new BoltParticle(pos, (new Vector2(4, 4) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.1f, 0.15f) * fxScale, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.7f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType<LightDust>(), (new Vector2(5, 5) * fxScale).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.4f, 0.55f) * fxScale);
|
||||
dust.noGravity = !Main.rand.NextBool(3);
|
||||
dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid;
|
||||
}
|
||||
Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0815f * fxScale, 10);
|
||||
GeneralParticleHandler.SpawnParticle(pulse2);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.38f * fxScale, 0.5f * fxScale, 14);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.925f * fxScale, 0.2f * fxScale, 14);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1), targetHitbox);
|
||||
public override bool? CanCutTiles() => false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class DragoonSmallBolt : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int time = 0;
|
||||
public float colorValue = 0;
|
||||
public float sizeMult = 1;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 15;
|
||||
Projectile.height = 15;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 1; // Survives through its first hit by "cheating" and incrementing its own pierce counter
|
||||
Projectile.extraUpdates = 10;
|
||||
Projectile.timeLeft = 200;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
colorValue = MathHelper.Lerp(colorValue, 50, 0.025f);
|
||||
Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)) * 0.7f;
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
sizeMult = 1;
|
||||
}
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(Projectile.ai[1] * 0.022f);
|
||||
|
||||
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
Vector2 pos = Projectile.Center;
|
||||
if (Projectile.timeLeft % 3 == 0)
|
||||
{
|
||||
Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f * sizeMult, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (Main.rand.NextBool(35))
|
||||
{
|
||||
Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * sizeMult, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (time % 5 == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f));
|
||||
dust.noGravity = true;
|
||||
dust.color = usedColor;
|
||||
}
|
||||
}
|
||||
time++;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Electrified, 180);
|
||||
Projectile.timeLeft = 15;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 13, Main.rand.NextFloat(0.3f, 0.35f), Main.rand.NextBool() ? Color.Orchid : Color.Cyan, new Vector2(1.8f, 0.8f), true, true, false, 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.numHits > 0 ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox);
|
||||
public override bool? CanCutTiles() => false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,363 @@
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class SkytideDragoonHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
|
||||
{
|
||||
public override int AssignedItemID => ModContent.ItemType<SkytideDragoon>();
|
||||
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<SkytideDragoon>();
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon";
|
||||
public override float HitboxOutset => 185;
|
||||
|
||||
public override Vector2 HitboxSize => new Vector2(240, 40);
|
||||
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
|
||||
|
||||
public override Vector2 SpriteOrigin => new(0, 135);
|
||||
public Vector2 mousePos;
|
||||
public Vector2 aimVel;
|
||||
public bool doSwing = true;
|
||||
public bool postSwing = false;
|
||||
public float fadeIn = 0;
|
||||
public float colorFadeIn = 0;
|
||||
public int useAnim;
|
||||
public int swingCount = 0;
|
||||
public bool finalFlip = false;
|
||||
public float spearOutset = 0;
|
||||
public bool fireProj = true;
|
||||
public bool fancySwing => swingCount % 7 == 0;
|
||||
public bool redirected = false;
|
||||
public int attackPower = 0;
|
||||
public float attackMult = 0;
|
||||
public Vector2 tipOutset;
|
||||
|
||||
public Color color1 = Color.Orchid;
|
||||
public Color color2 = Color.Cyan;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
base.SetDefaults();
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
}
|
||||
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;
|
||||
Projectile.rotation = Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135);
|
||||
useAnim = fancySwing ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax;
|
||||
|
||||
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
||||
else Owner.direction = 1;
|
||||
|
||||
FlipAsSword = Owner.direction == -1 ? true : false;
|
||||
}
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
tipOutset = Vector2.One.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * spearOutset * 12;
|
||||
AbsolutePosition = Owner.MountedCenter + tipOutset;
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
mousePos = Owner.Center - aimVel;
|
||||
else
|
||||
{
|
||||
mousePos = Owner.Calamity().mouseWorld;
|
||||
}
|
||||
|
||||
if (CanHit)
|
||||
{
|
||||
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.15f);
|
||||
}
|
||||
else
|
||||
{
|
||||
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.12f);
|
||||
}
|
||||
colorFadeIn = MathHelper.Lerp(colorFadeIn, 0, 0.07f);
|
||||
|
||||
attackMult = MathHelper.Lerp(attackMult, attackPower, 0.15f);
|
||||
|
||||
|
||||
if (!doSwing)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
Projectile.localNPCImmunity[i] = 0;
|
||||
|
||||
Projectile.numHits = 0;
|
||||
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;
|
||||
fireProj = true;
|
||||
|
||||
doSwing = true;
|
||||
|
||||
swingCount++;
|
||||
|
||||
finalFlip = false;
|
||||
|
||||
if (swingCount == 1 && Owner.Calamity().mouseRight)
|
||||
redirected = true;
|
||||
else
|
||||
redirected = false;
|
||||
|
||||
useAnim = (fancySwing || redirected) ? (int)(Owner.itemAnimationMax * 2f) : Owner.itemAnimationMax;
|
||||
AnimationProgress = Animation % useAnim;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (fancySwing)
|
||||
{
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Vector2.UnitY.ToRotation() + MathHelper.ToRadians(-135), (redirected ? 0.1f : 0.22f));
|
||||
}
|
||||
else if (redirected)
|
||||
{
|
||||
float lerp = Utils.GetLerpValue(0, useAnim / 2f, AnimationProgress);
|
||||
CanHit = true;
|
||||
if (AnimationProgress < (useAnim / 2f))
|
||||
{
|
||||
Projectile.rotation += 0.81f * Owner.direction * (1 - lerp);
|
||||
Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f);
|
||||
Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f));
|
||||
Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f);
|
||||
Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType<LightDust>(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f));
|
||||
dust.noGravity = true;
|
||||
dust.color = color;
|
||||
|
||||
Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1));
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.15f);
|
||||
}
|
||||
}
|
||||
else
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.25f);
|
||||
|
||||
if (AnimationProgress < (useAnim / 2))
|
||||
{
|
||||
float time = (AnimationProgress) - (useAnim / 3);
|
||||
float timeMax = useAnim - (useAnim / 3);
|
||||
|
||||
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
||||
|
||||
if (redirected)
|
||||
CanHit = true;
|
||||
else
|
||||
CanHit = false;
|
||||
|
||||
postSwing = false;
|
||||
if (AnimationProgress == 0)
|
||||
{
|
||||
doSwing = false;
|
||||
}
|
||||
spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f);
|
||||
FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
float time = (AnimationProgress) - (useAnim / 3);
|
||||
float timeMax = useAnim - (useAnim / 3);
|
||||
|
||||
spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(120f), 0.2f);
|
||||
|
||||
if (time == (int)(timeMax * 0.4f))
|
||||
{
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/SkytideSwing");
|
||||
SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - (fancySwing ? 0.3f : 0) }, Projectile.Center);
|
||||
}
|
||||
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f))
|
||||
{
|
||||
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
||||
CanHit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fireProj && time >= (int)(timeMax * 0.7f))
|
||||
{
|
||||
if (fancySwing)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 3f;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/SkytiedBolt");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center);
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 5), Projectile.knockBack, Projectile.owner, 0, 0.5f);
|
||||
proj.timeLeft = 45;
|
||||
swingCount = 0;
|
||||
attackPower = 6;
|
||||
}
|
||||
else if (redirected)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 4.5f;
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/SkytiedBolt");
|
||||
SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center);
|
||||
SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit");
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center);
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType<DragoonBigBolt>(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f);
|
||||
swingCount = -1;
|
||||
attackPower = 0;
|
||||
}
|
||||
else // Five projectile scattershot
|
||||
{
|
||||
for (int i = -2; i < 3; i++)
|
||||
{
|
||||
float rot = (0.1f * attackPower * i / 6f);
|
||||
Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7;
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType<DragoonSmallBolt>(), (int)(Projectile.damage * 0.52), Projectile.knockBack, Projectile.owner, 0, rot);
|
||||
}
|
||||
attackPower--;
|
||||
}
|
||||
colorFadeIn = 1;
|
||||
fireProj = false;
|
||||
}
|
||||
}
|
||||
if (time >= (int)(timeMax * 0.85f))
|
||||
CanHit = false;
|
||||
|
||||
spearOutset = MathHelper.Lerp(spearOutset, MathHelper.ToRadians(MathHelper.Lerp(450f, 0f, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f);
|
||||
|
||||
if (time >= timeMax)
|
||||
doSwing = false;
|
||||
if (time < (int)(timeMax * 0.7f))
|
||||
postSwing = true;
|
||||
|
||||
if (CanHit)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f);
|
||||
float bonus = (1 - (7 / (attackPower + 1))) * 0.3f;
|
||||
Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f));
|
||||
Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f);
|
||||
Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType<LightDust>(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f));
|
||||
dust.noGravity = !(dust.type == 278);
|
||||
dust.color = color;
|
||||
dust.scale += bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArmRotationOffset = MathHelper.ToRadians(-140f);
|
||||
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0)
|
||||
Projectile.numHits -= 1;
|
||||
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.55f, Pitch = 0.8f }, Projectile.Center);
|
||||
SoundStyle fire2 = new("CalamityMod/Sounds/Custom/DefenseDamage");
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = 0.4f }, Projectile.Center);
|
||||
|
||||
if (target.CanBeMoved(true))
|
||||
{
|
||||
// Launch
|
||||
Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -23;
|
||||
target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f);
|
||||
}
|
||||
|
||||
target.AddBuff(BuffID.Electrified, 230);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
float minMult = 0.3f;
|
||||
int hitsToMinMult = 5;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= 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>("CalamityMod/Projectiles/Melee/SkytideDragoonHoldout");
|
||||
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/SkytideDragoonGlow");
|
||||
float fxRot = Projectile.rotation + MathHelper.ToRadians(45);
|
||||
float fxPosRot = Projectile.rotation - MathHelper.ToRadians(45);
|
||||
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
|
||||
Vector2 drawPos = (Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY)) + Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
|
||||
Color glowColor = Color.Lerp(color1, color2, colorFadeIn) with { A = 0 };
|
||||
Color auraColor = Color.Lerp(color2, color1, colorFadeIn) with { A = 0 } * 0.15f * fadeIn;
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/SkytideDragoonGhost").Value;
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 8 * fadeIn;
|
||||
Main.EntitySpriteDraw(centerTexture, drawPos + drawOffset, centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, drawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(glowTex.Value, drawPos, glowTex.Frame(1, FrameCount, 0, Frame), glowColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
||||
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/ArchSmear");
|
||||
Asset<Texture2D> orb = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 55.5f / MathHelper.Pi);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn;
|
||||
Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f);
|
||||
Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None);
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f;
|
||||
Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2;
|
||||
Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override void ResetStyle()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.9 KiB |