Initial
No files matched your search
@@ -297,6 +297,8 @@ namespace CalamityMod.CalPlayer
|
||||
public bool lucreciaEnergyPaused = false;
|
||||
public bool lucreciaEnergyMaxSFXPlayed = false;
|
||||
private int lucreciaParticleTimer = 0;
|
||||
public float unstableCastersGauntletVis = 0;
|
||||
public int unstableCastersGauntletVisTimer = 0;
|
||||
public int PhotoAudioCooldown = 0;
|
||||
public int PhotoTimer = 90;
|
||||
/// <summary> Cooldown variable used to add a delay between Anahita's Arpeggio uses. </summary>
|
||||
|
||||
@@ -419,6 +419,22 @@ namespace CalamityMod.CalPlayer
|
||||
lucreciaEnergyPaused = false;
|
||||
}
|
||||
|
||||
|
||||
if (Player.HeldItem.type == ModContent.ItemType<UnstableCastersGauntlet>() && unstableCastersGauntletVis < 100)
|
||||
{
|
||||
|
||||
unstableCastersGauntletVisTimer++;
|
||||
// Gain 0.1% charge once every 8 ticks
|
||||
if (unstableCastersGauntletVisTimer >= 8)
|
||||
{
|
||||
unstableCastersGauntletVis += 0.1f;
|
||||
unstableCastersGauntletVisTimer = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if (unstableCastersGauntletVis >= 100)
|
||||
unstableCastersGauntletVis = 100;
|
||||
|
||||
if (lAmbergris)
|
||||
{
|
||||
if (dashStart)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class UnstableCastersGauntletLayer : PlayerDrawLayer
|
||||
{
|
||||
public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.HandOnAcc);
|
||||
|
||||
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.drawPlayer.HeldItem.ModItem is UnstableCastersGauntlet;
|
||||
|
||||
protected override void Draw(ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
// Thanks YuH.
|
||||
|
||||
Vector2 bodyPos = new Vector2((int)(drawInfo.Position.X - Main.screenPosition.X - drawInfo.drawPlayer.bodyFrame.Width / 2 + drawInfo.drawPlayer.width / 2), (int)(drawInfo.Position.Y - Main.screenPosition.Y + drawInfo.drawPlayer.height - drawInfo.drawPlayer.bodyFrame.Height + 4f)) + drawInfo.drawPlayer.bodyPosition + new Vector2(drawInfo.drawPlayer.bodyFrame.Width / 2, drawInfo.drawPlayer.bodyFrame.Height / 2);
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/UnstableCastersGauntlet_HandsOn").Value;
|
||||
Vector2 position = bodyPos + drawInfo.frontShoulderOffset + (new Vector2(-5 * (!drawInfo.playerEffect.HasFlag(SpriteEffects.FlipHorizontally) ? 1 : -1), 0f));
|
||||
|
||||
// Apply offset
|
||||
Vector2 value = Main.OffsetsPlayerHeadgear[drawInfo.drawPlayer.bodyFrame.Y / drawInfo.drawPlayer.bodyFrame.Height];
|
||||
value.Y -= 2f;
|
||||
position += value * -drawInfo.playerEffect.HasFlag(SpriteEffects.FlipVertically).ToDirectionInt();
|
||||
|
||||
Vector2 origin = drawInfo.bodyVect + drawInfo.frontShoulderOffset + (new Vector2(-5 * (!drawInfo.playerEffect.HasFlag(SpriteEffects.FlipHorizontally) ? 1 : -1), 0f));
|
||||
if (drawInfo.compFrontArmFrame.X / drawInfo.compFrontArmFrame.Width >= 7)
|
||||
{
|
||||
position += new Vector2((!drawInfo.playerEffect.HasFlag(SpriteEffects.FlipHorizontally)) ? 1 : (-1), (!drawInfo.playerEffect.HasFlag(SpriteEffects.FlipVertically)) ? 1 : (-1));
|
||||
}
|
||||
|
||||
DrawData drawData = new DrawData(texture, position, drawInfo.compFrontArmFrame, Color.White * (1f - drawInfo.shadow), drawInfo.compositeFrontArmRotation, origin, 1f, drawInfo.playerEffect, 0);
|
||||
drawInfo.DrawDataCache.Add(drawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Dusts
|
||||
{
|
||||
public class TerraSigilDust : ModDust
|
||||
{
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.noLight = true;
|
||||
dust.rotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
dust.fadeIn = 1f;
|
||||
// Randomly select one of the three variants
|
||||
dust.frame = new Rectangle(0, Main.rand.Next(3) * 12, 10, 12);
|
||||
}
|
||||
|
||||
public override bool Update(Dust dust)
|
||||
{
|
||||
dust.velocity.Y += 0.2f;
|
||||
dust.velocity *= 0.983f;
|
||||
dust.position += dust.velocity;
|
||||
|
||||
dust.alpha += 1;
|
||||
if (dust.alpha > 255)
|
||||
{
|
||||
dust.active = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 389 B |
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,71 @@
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Items.Materials;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class UnstableCastersGauntlet : ModItem, ILocalizedModType
|
||||
{
|
||||
public static int UseTime = 20;
|
||||
public new string LocalizationCategory => "Items.Weapons.Magic";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 62;
|
||||
Item.height = 60;
|
||||
Item.damage = 100;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.mana = 0;
|
||||
Item.useAnimation = Item.useTime = UseTime;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
Item.knockBack = 3f;
|
||||
Item.value = CalamityGlobalItem.RarityRedBuyPrice;
|
||||
Item.rare = ItemRarityID.Red;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<UnstableCastersGauntletHoldout>();
|
||||
Item.shootSpeed = 15f;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
public override bool CanRightClick() => true;
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseRotationListener = true;
|
||||
}
|
||||
|
||||
public override void EquipFrameEffects(Player player, EquipType type)
|
||||
{
|
||||
player.handon = -1;
|
||||
player.handoff = -1;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Projectile will point toward your cursor.
|
||||
Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
|
||||
Projectile.NewProjectile(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType<UnstableCastersGauntletHoldout>(), damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.LunarBar, 5).
|
||||
AddIngredient<LifeAlloy>(5).
|
||||
AddIngredient(ItemID.FragmentNebula, 5).
|
||||
AddTile(TileID.MythrilAnvil).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
@@ -948,6 +948,24 @@ UndinesRetribution: {
|
||||
Tooltip: Casts a swarm of homing spears
|
||||
}
|
||||
|
||||
UnstableCastersGauntlet: {
|
||||
DisplayName: Unstable Caster's Gauntlet
|
||||
Tooltip:
|
||||
'''
|
||||
<left> to fire piercing needles
|
||||
<right> to summon 6 sigils, each representing a primordial element
|
||||
Hold <left> with sigils available to consume random sigils, each unleashing an attack
|
||||
Ordo sigils always land critical strikes and pierce infinitely
|
||||
Perditio sigils pierce and ignore 25 points of enemy defense
|
||||
Ignis sigils inflict Daybroken
|
||||
Aqua sigils inflict Crush Depth
|
||||
Aer sigils boast impeccable knockback
|
||||
Terra sigils split into sharp rocks
|
||||
All actions require sufficient Vis to use
|
||||
Vis is restored over time
|
||||
'''
|
||||
}
|
||||
|
||||
ValkyrieRay: {
|
||||
DisplayName: Valkyrie Ray
|
||||
Tooltip: Casts a devastating ray of holy power
|
||||
|
||||
@@ -262,3 +262,18 @@ WyvernFeatherPurple.DisplayName: Feather
|
||||
WyvernProjectile.DisplayName: Wyvern
|
||||
YharimsCrystalBeam.DisplayName: Yharim's Beam
|
||||
YharimsCrystalPrism.DisplayName: Yermes Christal
|
||||
SigilSet.DisplayName: Elemental Conjuring Ring
|
||||
AquaSigilWaterball.DisplayName: Aqua Waterball
|
||||
AquaSigilWaterballExplosion.DisplayName: Aqua Waterball Explosion
|
||||
AquaSigilWaterdroplet.DisplayName: Aqua Waterdroplet
|
||||
TerraSigilLargeRock.DisplayName: Terra Large Rock
|
||||
TerraSigilMediumRock.DisplayName: Terra Medium Rock
|
||||
TerraSigilSmallRock.DisplayName: Terra Small Rock
|
||||
AerSigilMissile.DisplayName: Aer Missile
|
||||
AerSigilBlast.DisplayName: Aer Blast
|
||||
OrdoSigilBeam.DisplayName: Ordo Beam
|
||||
PerditoShot.DisplayName: Perdito Beam Shot
|
||||
PerditoSigilShot.DisplayName: Perdito Shot
|
||||
IgnisSigilFireballExplosion.DisplayName: Ignis Fireball Explosion
|
||||
IgnisSigilFireball.DisplayName: Ignis Fireball
|
||||
IgnisSigilEmbers.DisplayName: Ignis Ember
|
||||
@@ -9,6 +9,7 @@ Nanomachines: Nanomachines
|
||||
Rage: Rage
|
||||
Flight: "{0} Flight Remaining"
|
||||
Charge: Current Charge
|
||||
Vis: Current Vis
|
||||
DefenseDamage: Defense Damage
|
||||
SulphurousWater: Sulphuric Poisoning
|
||||
Stealth: Stealth
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AerSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] == 35 && !spawnedProjectile)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/VividClarityBeamAppear") { Volume = 0.5f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX);
|
||||
|
||||
spawnedProjectile = true;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 48f, ModContent.ProjectileType<AerSigilMissile>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if fading
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 791 B |
@@ -0,0 +1,34 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class AerSigilBlast : BaseMassiveExplosionProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override int Lifetime => 28;
|
||||
public override bool UsesScreenshake => true;
|
||||
public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 5.5f;
|
||||
public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.LightGoldenrodYellow, Color.Yellow, MathHelper.Clamp(pulseCompletionRatio * 2f, 0f, 1f));
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.8f / 255f, Projectile.Opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
// This projectile is intended to be a simple VFX projectile.
|
||||
public class AerSigilFeather : ModProjectile
|
||||
{
|
||||
private float extraRotation = 0;
|
||||
private float intervalModifier = 1f;
|
||||
private bool randomized = false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 151;
|
||||
Projectile.height = 205;
|
||||
Projectile.scale = 0.15f;
|
||||
|
||||
Projectile.friendly = false;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 170;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
// Fade out
|
||||
if (Projectile.timeLeft < 50)
|
||||
{
|
||||
Projectile.alpha = (int)(255 - (255f / 50f) * Projectile.timeLeft);
|
||||
}
|
||||
|
||||
|
||||
// Attempts to replicate the motion of a feather swaying in wind
|
||||
float blendProgress = (170f - Projectile.timeLeft) / (170f - 100f);
|
||||
blendProgress = Math.Min(blendProgress, 1f);
|
||||
|
||||
if (!randomized)
|
||||
{
|
||||
extraRotation = Main.rand.NextFloat(0, MathHelper.TwoPi);
|
||||
intervalModifier = Main.rand.NextFloat(0.815f, 1.225f);
|
||||
randomized = true;
|
||||
}
|
||||
|
||||
Vector2 newFeatherVelocity = Vector2.Zero;
|
||||
newFeatherVelocity.Y = Projectile.velocity.Y * 0.96f + 0.04f;
|
||||
newFeatherVelocity.X = 1.4f * (float)Math.Cos(Projectile.timeLeft * 0.035f * intervalModifier); // The first float is effectively magnitude
|
||||
|
||||
|
||||
float newFeatherRotation = extraRotation + (float)Math.Sin(Projectile.timeLeft * 0.035f);
|
||||
|
||||
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, newFeatherVelocity, blendProgress);
|
||||
Projectile.rotation = MathHelper.Lerp(Projectile.rotation, newFeatherRotation, blendProgress);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
return false;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
lightColor = Color.LightGoldenrodYellow * 0.5f;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AerSigilMissile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static float MaxWidth = 32;
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
private int wingAnimationTimer = 0;
|
||||
private const int wingAnimationDuration = 80;
|
||||
|
||||
public static Asset<Texture2D> BloomTex;
|
||||
public static Asset<Texture2D> SlashTex;
|
||||
public static Asset<Texture2D> TrailTex;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 12;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 420;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
|
||||
// Makes trail draw right away
|
||||
for (int i = 0; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
Projectile.oldPos[i] = Projectile.position;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Little bit of ambient lighting as it travels
|
||||
Lighting.AddLight(Projectile.Center, Color.LightGoldenrodYellow.ToVector3() * 0.4f);
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
|
||||
if (Projectile.FinalExtraUpdate())
|
||||
Time++;
|
||||
|
||||
// Required in addition to the SetDefaults loop because otherwise the funny drawing from (0,0) error happens
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
for (int i = 0; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
Projectile.oldPos[i] = Projectile.position;
|
||||
}
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
float variance = Main.rand.NextFloat(-0.6f, 0.6f);
|
||||
int dustStyle = ModContent.DustType<SquashDust>();
|
||||
Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle);
|
||||
dust2.scale = Main.rand.NextFloat(1.2f, 1.9f) - Math.Abs(variance);
|
||||
dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1f, 1.6f) * (1 - Math.Abs(variance));
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, Main.rand.NextFloat(0f, 1f));
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/AerSigilGust") { Volume = 0.6f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
Vector2 adjustedCenter = Projectile.Center - Main.screenPosition + new Vector2(0, -16).RotatedBy(Projectile.rotation - MathHelper.PiOver2);
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
float randomAngle = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
float randomSpeed = Main.rand.NextFloat(6, 10);
|
||||
Vector2 vel = new Vector2((float)Math.Cos(randomAngle) * randomSpeed, (float)Math.Sin(randomAngle) * randomSpeed);
|
||||
vel.X *= 3f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType<AerSigilFeather>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<AerSigilBlast>(), (int)(Projectile.damage * 4.25f), Projectile.knockBack * 6, Projectile.owner);
|
||||
explosion.ai[1] = 600f;
|
||||
explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate
|
||||
explosion.netUpdate = true;
|
||||
}
|
||||
|
||||
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod * 0.75f, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.6f * 2.5f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.75f, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.5f * 2.5f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, 0.5f) with { A = 0 } * Projectile.Opacity;
|
||||
|
||||
public float TrailWidth(float completionRatio)
|
||||
{
|
||||
float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true)));
|
||||
width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true);
|
||||
return width * (MaxWidth * .265f);
|
||||
}
|
||||
public Color TrailColor(float completionRatio)
|
||||
{
|
||||
Color baseColor = Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, completionRatio);
|
||||
return baseColor * 0.2f;
|
||||
}
|
||||
|
||||
public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 5.5f;
|
||||
public Color MiniTrailColor(float completionRatio) => Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, completionRatio);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Color mainColor = Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f) % 1);
|
||||
Color secondaryColor = Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1);
|
||||
|
||||
Vector2 adjustedCenter = Projectile.Center - Main.screenPosition + new Vector2(0, -16).RotatedBy(Projectile.rotation - MathHelper.PiOver2);
|
||||
|
||||
wingAnimationTimer++;
|
||||
Texture2D wingTexture = Request<Texture2D>("CalamityMod/ExtraTextures/SimpleWings").Value;
|
||||
Vector2 origin = wingTexture.Size() * 0.5f;
|
||||
|
||||
float stretchFactorY = 0f;
|
||||
|
||||
// Only run the animation logic if the timer is within the duration
|
||||
if (wingAnimationTimer <= wingAnimationDuration)
|
||||
{
|
||||
float progress = (float)wingAnimationTimer / wingAnimationDuration;
|
||||
|
||||
if (progress < 0.25f) // Stretch Up
|
||||
{
|
||||
float stretchProgress = progress / 0.25f;
|
||||
stretchFactorY = MathHelper.Lerp(-1.4f, 0.5f, (float)Math.Sin(stretchProgress * MathHelper.PiOver2));
|
||||
}
|
||||
else if (progress < 0.5f) // Squash Down and overadjust
|
||||
{
|
||||
float squashProgress = (progress - 0.25f) / 0.3f;
|
||||
stretchFactorY = MathHelper.Lerp(0.5f, -0.25f, squashProgress * squashProgress);
|
||||
}
|
||||
else if (progress < 0.8f) // Stretch up again at a slower pace to a bit above the normal scale
|
||||
{
|
||||
float stretchProgress = (progress - 0.6f) / 0.2f;
|
||||
stretchFactorY = MathHelper.Lerp(-0.25f, 0f, stretchProgress * stretchProgress);
|
||||
}
|
||||
else // Return to normal
|
||||
{
|
||||
stretchFactorY = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate scale to display with all factors combined
|
||||
float baseScale = 1f;
|
||||
float stretchScaleY = 1f + stretchFactorY;
|
||||
float stretchScaleX = 1f - (stretchFactorY * 0.5f);
|
||||
Vector2 finalScale = new Vector2(baseScale * stretchScaleX, baseScale * stretchScaleY) * 0.6f;
|
||||
|
||||
// Draw backglow of wings
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
|
||||
Color glowColor = Color.LightGoldenrodYellow with { A = 0 } * 0.8f;
|
||||
Main.EntitySpriteDraw(wingTexture, adjustedCenter, null, glowColor, (Projectile.rotation + MathHelper.PiOver2), origin, finalScale * 1.5f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
|
||||
|
||||
|
||||
// Render the trail
|
||||
Main.spriteBatch.EnterShaderRegion();
|
||||
|
||||
if (TrailTex == null)
|
||||
TrailTex = Request<Texture2D>("CalamityMod/ExtraTextures/Trails/BasicTrail");
|
||||
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189");
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].Apply();
|
||||
|
||||
Vector2 offset = Projectile.Size * 0.5f;
|
||||
Vector2[] oldPosWithOffset = Projectile.oldPos.Select(p => p - offset).ToArray();
|
||||
|
||||
PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(TrailWidth, TrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30);
|
||||
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor);
|
||||
|
||||
PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30);
|
||||
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
|
||||
|
||||
// Draw the main texture
|
||||
Color drawColor = Color.LightGoldenrodYellow * 0.5f;
|
||||
Main.EntitySpriteDraw(wingTexture, adjustedCenter, null, drawColor, (Projectile.rotation + MathHelper.PiOver2), origin, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
|
||||
// Draw bloom circle at the tip
|
||||
if (BloomTex == null)
|
||||
BloomTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
Texture2D bloomTex = BloomTex.Value;
|
||||
Main.EntitySpriteDraw(bloomTex, adjustedCenter, null, (Color.White * 4f) with { A = 0 }, 0, bloomTex.Size() / 2f, 0.45f * Projectile.scale, 0, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AquaSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] == 35 && !spawnedProjectile)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/AquaSigilShot") { Volume = 1.5f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX);
|
||||
|
||||
spawnedProjectile = true;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 29f, ModContent.ProjectileType<AquaSigilWaterball>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if fading
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 773 B |
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Sounds;
|
||||
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.Magic
|
||||
{
|
||||
public class AquaSigilWaterball : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 108;
|
||||
Projectile.height = 94;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1; // Explodes on a delay after hitting
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Time++;
|
||||
Projectile.Opacity = Utils.GetLerpValue(0f, 10f, Time, true);
|
||||
|
||||
// Hasnt hit anything
|
||||
if (Projectile.ai[1] == 0)
|
||||
{
|
||||
// Set rotation to face forward
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter % 4 == 3)
|
||||
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
|
||||
}
|
||||
else // After hit
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
|
||||
// Scale up and die
|
||||
Projectile.scale += 0.05f;
|
||||
if (Projectile.scale >= 1.25f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
// Failsafe
|
||||
if (Projectile.timeLeft > 5)
|
||||
{
|
||||
Projectile.timeLeft = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// Normal sprite
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
|
||||
// All-white variant
|
||||
Asset<Texture2D> ghostTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/AquaSigilWaterballGhost");
|
||||
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
|
||||
// NORMAL draw logic
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), drawColor, Projectile.rotation, new Vector2(49, 160), Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
// After hitting a target, draw the white variant
|
||||
if (Projectile.ai[1] > 0)
|
||||
{
|
||||
// Fade from normal to fully white
|
||||
float fadeFactor = Utils.GetLerpValue(5f, 0f, Projectile.timeLeft, true);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
|
||||
|
||||
Main.EntitySpriteDraw(ghostTexture.Value, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), Color.White * fadeFactor, Projectile.rotation, new Vector2(49, 160), Projectile.scale * (1f + fadeFactor * 0.2f), SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
|
||||
Projectile.ai[1] = 1; // Has hit an enemy
|
||||
Projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/AquaSigilExplosion") { Volume = 1f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
Vector2 vel = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1.2f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + (new Vector2(Main.rand.NextFloat(-22, -30), Main.rand.NextFloat(-4, 4)).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Main.rand.NextBool(5) ? 187 : 180, vel * Main.rand.NextFloat(0.1f, 0.9f) + new Vector2(0, -2));
|
||||
dust.noGravity = false;
|
||||
dust.scale = Main.rand.NextFloat(1.1f, 1.7f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 vel = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1.2f);
|
||||
Projectile droplets = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(Main.rand.NextFloat(-22, -30), Main.rand.NextFloat(-4, 4)).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), vel * 0.8f, ModContent.ProjectileType<AquaSigilWaterdroplet>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType<AquaSigilWaterballExplosion>(), (int)(Projectile.damage * 3.85f), Projectile.knockBack, Projectile.owner);
|
||||
explosion.ai[1] = 260f;
|
||||
explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate
|
||||
explosion.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,34 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class AquaSigilWaterballExplosion : BaseMassiveExplosionProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override int Lifetime => 26;
|
||||
public override bool UsesScreenshake => true;
|
||||
public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 3f;
|
||||
public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.DarkTurquoise, Color.MediumTurquoise, MathHelper.Clamp(pulseCompletionRatio * 2f, 0f, 1f));
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.3f / 255f, Projectile.Opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,82 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AquaSigilWaterdroplet : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 9;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = false; // This is VFX
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 10;
|
||||
Projectile.damage = 0; // This is VFX
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f);
|
||||
Projectile.scale -= 0.01f;
|
||||
|
||||
if (Projectile.scale <= 0f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] <= 3f)
|
||||
{
|
||||
Projectile.ai[0] += 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.525f, Color.LightSkyBlue));
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.35f;
|
||||
}
|
||||
|
||||
private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity;
|
||||
Color endColor = Color.LightSkyBlue;
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1,115 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class IgnisSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] == 35 && !spawnedProjectile)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.Center);
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX);
|
||||
|
||||
spawnedProjectile = true;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 34f, ModContent.ProjectileType<IgnisSigilFireball>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// Get textures
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if fading
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 789 B |
@@ -0,0 +1,81 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class IgnisSigilEmbers : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 9;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = false; // This is VFX
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 10;
|
||||
Projectile.damage = 0; // This is VFX
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.22f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f);
|
||||
Projectile.scale -= 0.01f;
|
||||
|
||||
if (Projectile.scale <= 0f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] <= 3f)
|
||||
{
|
||||
Projectile.ai[0] += 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.45f, Color.Salmon));
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.35f;
|
||||
}
|
||||
|
||||
private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity;
|
||||
Color endColor = Color.DarkOrange;
|
||||
return Color.Lerp(endColor, Color.DarkSalmon, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class IgnisSigilFireball : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 9;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 92;
|
||||
Projectile.height = 92;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1; // Explodes on a delay after hitting
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Time++;
|
||||
|
||||
Projectile.Opacity = Utils.GetLerpValue(0f, 10f, Time, true);
|
||||
|
||||
// Hasnt hit anything
|
||||
if (Projectile.ai[1] == 0)
|
||||
{
|
||||
// Set rotation to face forward
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter % 4 == 3)
|
||||
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
|
||||
}
|
||||
else // After hit
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
|
||||
// Scale up and die
|
||||
Projectile.scale += 0.2f;
|
||||
if (Projectile.scale >= 1.75f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
// Failsafe
|
||||
if (Projectile.timeLeft > 5)
|
||||
{
|
||||
Projectile.timeLeft = 5;
|
||||
}
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.22f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f);
|
||||
Projectile.scale -= 0.01f;
|
||||
|
||||
if (Projectile.scale <= 0f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] <= 3f)
|
||||
{
|
||||
Projectile.ai[0] += 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new SquishyLightParticle(Projectile.Center, Projectile.velocity, Projectile.scale * 1.5f, Color.OrangeRed, 3, 1f, 0f, 1f));
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.125f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Daybreak, 180);
|
||||
Projectile.ai[1] = 1; // Has hit an enemy
|
||||
Projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 132f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity;
|
||||
Color endColor = Color.IndianRed;
|
||||
return Color.Lerp(endColor, Color.Orange, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 340);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/IgnisSigilHit") { Volume = 0.7f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
Vector2 vel = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1.2f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + (new Vector2(Main.rand.NextFloat(-22, -30), Main.rand.NextFloat(-4, 4)).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Main.rand.NextBool(5) ? 174 : 35, vel * Main.rand.NextFloat(0.1f, 0.9f) + new Vector2(0, -2));
|
||||
dust.noGravity = false;
|
||||
dust.scale = Main.rand.NextFloat(1.1f, 1.7f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 vel = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1.2f);
|
||||
Projectile embers = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(Main.rand.NextFloat(-22, -30), Main.rand.NextFloat(-4, 4)).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), vel * 0.8f, ModContent.ProjectileType<IgnisSigilEmbers>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.265f, 21, true, 1f));
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType<IgnisSigilFireballExplosion>(), (int) (Projectile.damage * 3.35f), Projectile.knockBack, Projectile.owner);
|
||||
explosion.ai[1] = 145f;
|
||||
explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate
|
||||
explosion.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.LightGoldenrodYellow, Color.Orange, 0.5f) with { A = 0 } * Projectile.Opacity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class IgnisSigilFireballExplosion : BaseMassiveExplosionProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override int Lifetime => 16;
|
||||
public override bool UsesScreenshake => true;
|
||||
public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 3f;
|
||||
public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Firebrick, Color.LightSalmon, MathHelper.Clamp(pulseCompletionRatio * 2f, 3f, 6f));
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.5f / 255f, Projectile.Opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class OrdoSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] == 35 && !spawnedProjectile)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/OntologicalDespoilerLargeShot") { Volume = 0.5f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX);
|
||||
|
||||
spawnedProjectile = true;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 18f, ModContent.ProjectileType<OrdoSigilBeam>(), (int) (Projectile.damage * 4.5f), Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if fading
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 767 B |
@@ -0,0 +1,64 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class OrdoSigilBeam : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 32;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = 5;
|
||||
Projectile.MaxUpdates = 15;
|
||||
Projectile.timeLeft = 20 * Projectile.MaxUpdates;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Time++;
|
||||
|
||||
// Render the needle beam as a pair of severely stretched spark particles.
|
||||
// This has to be done only on specific extra updates or it'll instantly overload the particle limit.
|
||||
bool isDrawingUpdate = Projectile.numUpdates % 3 == 0;
|
||||
if (Time > 6f && isDrawingUpdate)
|
||||
{
|
||||
Color outerSparkColor = new Color(255, 255, 255);
|
||||
float scaleBoost = MathHelper.Clamp(Time * 0.03f, 0f, 2f);
|
||||
float outerSparkScale = 3.2f + scaleBoost;
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center, Projectile.velocity, false, 7, outerSparkScale, outerSparkColor);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
Color innerSparkColor = new Color(181, 181, 181);
|
||||
float innerSparkScale = 1.6f + scaleBoost;
|
||||
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity, false, 7, innerSparkScale, innerSparkColor);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
if (Projectile.FinalExtraUpdate())
|
||||
Lighting.AddLight(Projectile.Center, Color.MediumBlue.ToVector3() * 0.4f);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
modifiers.SetCrit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class PerditoSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] == 35 && !spawnedProjectile)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType<PerditoSigilShotCreator>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
spawnedProjectile = true;
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if fading
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 815 B |
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
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.Magic
|
||||
{
|
||||
public class PerditoSigilShot : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public Color baseColor = Color.White;
|
||||
public int sineDir = 1;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 20;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 28;
|
||||
Projectile.height = 28;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 22;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ArmorPenetration = 25;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
float lifeProgress = 1f - (Projectile.timeLeft / 22f);
|
||||
|
||||
float fadeIn = Utils.GetLerpValue(0f, 0.25f, lifeProgress, true);
|
||||
float fadeOut = Utils.GetLerpValue(1f, 0.66f, lifeProgress, true);
|
||||
float fadeMult = fadeIn * fadeOut;
|
||||
|
||||
// Store fade multiplier in ai[3]
|
||||
Projectile.localAI[0] = fadeMult;
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
sineDir = Main.rand.NextBool() ? 1 : -1;
|
||||
Projectile.ai[1] = Main.rand.NextFloat(-0.06f, 0.06f); // curvature
|
||||
}
|
||||
|
||||
float curvature = Projectile.ai[1];
|
||||
if (curvature != 0f)
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(curvature);
|
||||
|
||||
Projectile.scale = MathHelper.Lerp(0.4f, 2.4f, fadeMult);
|
||||
baseColor = Color.LightGray * fadeMult;
|
||||
|
||||
if (time > 13)
|
||||
{
|
||||
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
|
||||
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f;
|
||||
float scale = Main.rand.NextFloat(0.8f, 1.1f);
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset * sineDir, ModContent.DustType<VoidDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
|
||||
dust2.noGravity = true;
|
||||
dust2.scale = scale;
|
||||
dust2.color = baseColor;
|
||||
}
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset * sineDir, ModContent.DustType<VoidDustInverted>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
|
||||
dust3.noGravity = true;
|
||||
dust3.scale = scale;
|
||||
dust3.color = baseColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (time > 13 && time < 34 && Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.Center += Projectile.velocity.RotatedBy((Projectile.ai[2] == 1 ? MathHelper.PiOver2 : -MathHelper.PiOver2)) * 0.2f;
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
float fadeMult = Projectile.localAI[0];
|
||||
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLineBloom");
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLine");
|
||||
|
||||
// Colors dynamically fade out
|
||||
Color trailColor1 = (baseColor with { A = 0 }) * (0.35f * fadeMult);
|
||||
Color trailColor2 = Color.Black * fadeMult;
|
||||
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], trailColor1, 1, tex.Value);
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], trailColor2, 1, tex2.Value, true, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, (Main.rand.NextBool() ? ModContent.DustType<VoidDustInverted>() : ModContent.DustType<VoidDust>()), (Projectile.velocity * 3).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.2f, 1f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.15f, 1.45f);
|
||||
dust.color = baseColor;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.97f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class PerditoSigilShotCreator : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public ref float FiringTimer => ref Projectile.ai[0];
|
||||
public ref float ShotsFiredCount => ref Projectile.ai[1];
|
||||
|
||||
private const int TotalShots = 13;
|
||||
private const int DelayBetweenShots = 4;
|
||||
private const float ShotSpeed = 17f;
|
||||
private const float SpawnRadius = 150f; // Radius around the cursor where shots spawn
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 1;
|
||||
Projectile.height = 1;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = DelayBetweenShots * TotalShots + 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.Center = Main.MouseWorld;
|
||||
Vector2 targetCenter = Projectile.Center;
|
||||
|
||||
FiringTimer++;
|
||||
|
||||
if (FiringTimer % DelayBetweenShots == 0 && ShotsFiredCount < TotalShots)
|
||||
{
|
||||
ShotsFiredCount++;
|
||||
if (ShotsFiredCount == TotalShots)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/PerditoSigilHit2") { Volume = 0.9f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
}
|
||||
else
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/PerditoSigilHit1") { Volume = 0.8f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
float startAngle = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
Vector2 spawnOffset = startAngle.ToRotationVector2() * SpawnRadius;
|
||||
Vector2 spawnPosition = targetCenter + spawnOffset;
|
||||
|
||||
Vector2 velocity = (targetCenter - spawnPosition).SafeNormalize(Vector2.UnitX) * ShotSpeed;
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, velocity, ModContent.ProjectileType<PerditoSigilShot>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (ShotsFiredCount >= TotalShots)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class SigilSet : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float FadeoutFlag => ref Projectile.ai[2];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 550;
|
||||
Projectile.height = 550;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Culling Logic
|
||||
Player p = Main.player[Projectile.owner];
|
||||
if (p == null || !p.active || p.dead || p.HeldItem.type != ModContent.ItemType<UnstableCastersGauntlet>())
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// Visuals
|
||||
Projectile.Center = p.MountedCenter + Vector2.UnitY * p.gfxOffY;
|
||||
Projectile.rotation += 0.01f;
|
||||
Lighting.AddLight(Projectile.Center, 1f, 1f, 1f);
|
||||
|
||||
if (Projectile.frameCounter++ > 3)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
if (Projectile.frame++ > 2)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Fading logic
|
||||
if (FadeoutFlag == 1f)
|
||||
{
|
||||
Projectile.alpha += 13;
|
||||
if (Projectile.alpha >= 255)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.alpha = Utils.Clamp(Projectile.alpha - 25, 0, 255);
|
||||
}
|
||||
|
||||
|
||||
if (Projectile.ai[1] == 0) // spawn flag
|
||||
{
|
||||
int[] sigilTypes = new int[]
|
||||
{
|
||||
ModContent.ProjectileType<IgnisSigil>(),
|
||||
ModContent.ProjectileType<AquaSigil>(),
|
||||
ModContent.ProjectileType<TerraSigil>(),
|
||||
ModContent.ProjectileType<AerSigil>(),
|
||||
ModContent.ProjectileType<OrdoSigil>(),
|
||||
ModContent.ProjectileType<PerditoSigil>()
|
||||
};
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, sigilTypes[i], Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity, i);
|
||||
}
|
||||
|
||||
// Make it not happen again
|
||||
Projectile.ai[1] = 1;
|
||||
}
|
||||
else // Sigils exist
|
||||
{
|
||||
int activeSigilCount = 0;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
Projectile proj = Main.projectile[i];
|
||||
if (proj.active && proj.ai[0] == Projectile.identity)
|
||||
{
|
||||
// Check if the sigil is not currently fading out
|
||||
if (proj.type == ModContent.ProjectileType<IgnisSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<AquaSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<TerraSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<AerSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<OrdoSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<PerditoSigil>())
|
||||
{
|
||||
if (proj.ai[2] <= 0)
|
||||
{
|
||||
activeSigilCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If no non-fading sigils remain, start timer
|
||||
if (activeSigilCount == 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
FadeoutFlag = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.localAI[0] = 0;
|
||||
}
|
||||
}
|
||||
Projectile.timeLeft = 4;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D main = TextureAssets.Projectile[Type].Value;
|
||||
Texture2D smol = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/ThaumRingSmall").Value;
|
||||
Texture2D rune = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/ThaumRune").Value;
|
||||
|
||||
// Modify opacity again so it doesn't override changes to alpha in AI
|
||||
float drawOpacity = 1f - Projectile.alpha / 255f;
|
||||
|
||||
// Ring components
|
||||
Main.EntitySpriteDraw(smol, Projectile.Center - Main.screenPosition, null, Color.White * 0.5f * drawOpacity, Projectile.rotation, smol.Size() / 2, Projectile.scale + MathF.Cos(2 * Main.GlobalTimeWrappedHourly + 5) * 0.0027f, 0);
|
||||
Main.EntitySpriteDraw(main, Projectile.Center - Main.screenPosition, main.Frame(1, 4, 0, Projectile.frame), Color.White * 0.5f * drawOpacity, Projectile.rotation, new Vector2(main.Width / 2, main.Height / 8), Projectile.scale, 0);
|
||||
for (int i = 0; i < 14; i++)
|
||||
{
|
||||
float dist = 150f + MathF.Sin(Main.GlobalTimeWrappedHourly * 2) * 10;
|
||||
Vector2 runePos = Projectile.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 14f)) * dist).RotatedBy(-Projectile.rotation * 0.6f);
|
||||
Main.EntitySpriteDraw(rune, runePos - Main.screenPosition, rune.Frame(1, 7, 0, i % 6), Color.White * 0.5f * drawOpacity, runePos.DirectionTo(Projectile.Center).ToRotation() + MathHelper.PiOver2, new Vector2(rune.Width / 2, rune.Height / 14), Projectile.scale, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 105 KiB |
@@ -0,0 +1,115 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class TerraSigil : ModProjectile
|
||||
{
|
||||
private bool spawnedProjectile = false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 74;
|
||||
Projectile.friendly = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
bool parentActive = parent != null && parent.active && parent.type == ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
if (!parentActive && Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
int i = (int)Projectile.ai[1];
|
||||
float dist = i % 3 == 0 ? 270f : 280f;
|
||||
float extraRot = i % 3 == 0 ? 0 : i % 3 == 1 ? MathHelper.ToRadians(-3.33f) : MathHelper.ToRadians(3.33f);
|
||||
|
||||
Vector2 sigilPos = parent.Center + (Vector2.UnitX.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi, i / 6f)) * dist).RotatedBy(parent.rotation + extraRot);
|
||||
Projectile.Center = sigilPos;
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Projectile.localAI[0]++;
|
||||
|
||||
if (Projectile.localAI[0] >= 35 && !spawnedProjectile)
|
||||
{
|
||||
spawnedProjectile = true;
|
||||
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
|
||||
Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX);
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 32f, ModContent.ProjectileType<TerraSigilLargeRock>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] >= 50)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Projectile.scale = parent.scale;
|
||||
Projectile.rotation = 0;
|
||||
Projectile.alpha = parent.alpha;
|
||||
}
|
||||
|
||||
if (parentActive)
|
||||
{
|
||||
Projectile.timeLeft = parent.timeLeft;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D mainTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D blankTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BlankSigil").Value;
|
||||
|
||||
float finalScale = Projectile.scale;
|
||||
float alphaOpacity = 1f - (Projectile.alpha / 255f);
|
||||
float maskOpacity = 0f;
|
||||
|
||||
// Apply animation effects if the fade-out is active
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
float animationTime = Projectile.localAI[0];
|
||||
|
||||
if (animationTime <= 24)
|
||||
{
|
||||
maskOpacity = Utils.GetLerpValue(0f, 24f, animationTime, clamped: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskOpacity = 1f;
|
||||
}
|
||||
|
||||
if (animationTime >= 35)
|
||||
{
|
||||
float scaleFactor = Utils.GetLerpValue(35f, 50f, animationTime, clamped: true);
|
||||
finalScale = MathHelper.Lerp(Projectile.scale, 0f, scaleFactor);
|
||||
alphaOpacity = MathHelper.Lerp(alphaOpacity, 0f, scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(mainTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * alphaOpacity, Projectile.rotation, mainTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
Main.EntitySpriteDraw(blankTexture, Projectile.Center - Main.screenPosition, null, Color.White * maskOpacity, Projectile.rotation, blankTexture.Size() / 2, finalScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 976 B |
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Sounds;
|
||||
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.Magic
|
||||
{
|
||||
public class TerraSigilLargeRock : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 66;
|
||||
Projectile.height = 64;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.timeLeft = 255;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Time++;
|
||||
Projectile.rotation += 0.05f;
|
||||
|
||||
if (Projectile.timeLeft > 247)
|
||||
Projectile.scale *= 1.05f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// Normal sprite
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
|
||||
// All-white variant
|
||||
Asset<Texture2D> ghostTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/TerraSigilLargeRockGhost");
|
||||
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
|
||||
// NORMAL draw logic
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), drawColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
// Only apply the glow effect during the first 8 frames
|
||||
if (Time < 8)
|
||||
{
|
||||
// Fade from fully white to fully transparent
|
||||
float fadeFactor = Utils.GetLerpValue(0, 8, Time, true);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
|
||||
|
||||
Main.EntitySpriteDraw(ghostTexture.Value, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), Color.White * (1 - fadeFactor), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.8f, Pitch = -0.4f + i * 0.25f, MaxInstances = 2 }, Projectile.Center);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer && Projectile.numHits > 0)
|
||||
{
|
||||
// Spawns 5 medium rock projectiles outward and evenly spaced
|
||||
int numRocks = 5;
|
||||
float spreadAngle = MathHelper.TwoPi / numRocks;
|
||||
|
||||
for (int i = 0; i < numRocks; i++)
|
||||
{
|
||||
// Calc angle for each rock
|
||||
float rotation = spreadAngle * i;
|
||||
Vector2 launchVelocity = new Vector2(1f, 0f).RotatedBy(rotation) * 20f;
|
||||
|
||||
// Spawn them.
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, launchVelocity, ModContent.ProjectileType<TerraSigilMediumRock>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Dust and smoke particles
|
||||
for (int i = 0; i < 28; i++)
|
||||
{
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? ModContent.DustType<TerraSigilDust>() : 262, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f)); // Reduced velocity
|
||||
dust.noGravity = false;
|
||||
dust.scale = Main.rand.NextFloat(0.85f, 1.25f);
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 0.3f;
|
||||
dust.velocity *= 2.2f;
|
||||
dust.alpha = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f));
|
||||
Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(3, 8)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(15, 30 + 1), Projectile.scale * Main.rand.NextFloat(0.05f, 0.1f) * 4, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 1f)), false, extraRotation: Main.rand.NextFloat(-2, 2), spin: Main.rand.NextFloat(-0.5f, 0.5f), affectedByLight: true);
|
||||
GeneralParticleHandler.SpawnParticle(sand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 704 B |
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Dusts;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class TerraSigilMediumRock : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
public bool goToCursor = false;
|
||||
public Vector2 mousePos;
|
||||
public float CenterX;
|
||||
public float CenterY;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 75;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Time < 69)
|
||||
Projectile.friendly = false;
|
||||
else
|
||||
Projectile.friendly = true;
|
||||
|
||||
if (Time == 0)
|
||||
{
|
||||
Projectile.scale = 0.5f;
|
||||
}
|
||||
|
||||
// If not moving to cursor, slow down
|
||||
if (!goToCursor)
|
||||
{
|
||||
Projectile.velocity *= 0.96f;
|
||||
}
|
||||
|
||||
if (Time < 11)
|
||||
Projectile.scale *= 1.08f;
|
||||
|
||||
// After 1 second, rapidly move to cursor
|
||||
if (Time == 60)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
mousePos = Main.player[Projectile.owner].ClampedMouseWorld();
|
||||
goToCursor = true;
|
||||
}
|
||||
|
||||
if (goToCursor)
|
||||
{
|
||||
if (Time == 60)
|
||||
{
|
||||
CenterX = Projectile.Center.X;
|
||||
CenterY = Projectile.Center.Y;
|
||||
}
|
||||
if (Time > 60)
|
||||
Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, mousePos.X, Utils.GetLerpValue(60, 73, Time, true)), MathHelper.Lerp(CenterY, mousePos.Y, Utils.GetLerpValue(60, 73, Time, true)));
|
||||
}
|
||||
|
||||
Projectile.rotation += 0.05f;
|
||||
Time++;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerJump2") { Volume = 0.7f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
|
||||
int rockCount = Main.rand.Next(1, 3);
|
||||
for (int i = 0; i < rockCount; i++)
|
||||
{
|
||||
Vector2 randomVelocity = new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-3f, -10f));
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randomVelocity, ModContent.ProjectileType<TerraSigilSmallRock>(), 0, 0, Projectile.owner);
|
||||
}
|
||||
|
||||
// Dust and smoke particles
|
||||
for (int i = 0; i < 14; i++)
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? ModContent.DustType<TerraSigilDust>() : 262, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f)); // Reduced velocity
|
||||
dust.noGravity = false;
|
||||
dust.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
if (dust.type == 262)
|
||||
{
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 0.3f;
|
||||
dust.velocity *= 1.5f;
|
||||
}
|
||||
dust.alpha = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f));
|
||||
Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(3, 8)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(15, 30 + 1), Projectile.scale * Main.rand.NextFloat(0.05f, 0.1f) * 4, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 1f)), false, extraRotation: Main.rand.NextFloat(-2, 2), spin: Main.rand.NextFloat(-0.5f, 0.5f), affectedByLight: true);
|
||||
GeneralParticleHandler.SpawnParticle(sand);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 randVel = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f); // Reduced velocity
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Peru, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.6f, 1.5f), 0.3f); // Reduced duration and scale
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, randVel * 0.5f, Color.SandyBrown, Color.Beige, Main.rand.NextFloat(0.2f, 0.8f), 80f, Main.rand.NextFloat(0.02f, -0.02f)); // Reduced duration and scale
|
||||
GeneralParticleHandler.SpawnParticle(SandCloud);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 632 B |
@@ -0,0 +1,45 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class TerraSigilSmallRock : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 26;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = false; // VFX
|
||||
Projectile.damage = 0; // This is VFX
|
||||
Projectile.hostile = false;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.timeLeft = 100;
|
||||
Projectile.scale *= 0.6f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Set the frame to be randomly chosen on spawn
|
||||
if (Projectile.ai[0] == 0)
|
||||
{
|
||||
Projectile.frame = Main.rand.Next(Main.projFrames[Type]);
|
||||
Projectile.ai[0] = 1;
|
||||
}
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.45f;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 730 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,187 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class UnstableCastersGauntletHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<UnstableCastersGauntlet>();
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public ref float shootingTimer => ref Projectile.ai[0];
|
||||
|
||||
private float currentRecoilRotation;
|
||||
private float RecoilRotationAmount = 0.22f;
|
||||
private float RotationResolveSpeed = 0.22f;
|
||||
|
||||
// Normal weapon usetime is 20. This is used throughout the AI to make the holdout's components scale with attack speed.
|
||||
public float speedModifier => HeldItem.useTime / 20f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 1;
|
||||
Projectile.height = 1;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
CalamityPlayer calPlayer = Owner.Calamity();
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.None, 0f);
|
||||
|
||||
// -- SIGIL M1 ATTACKS --
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<SigilSet>()] == 1 && Owner.altFunctionUse == 0)
|
||||
{
|
||||
float sigilFireRate = HeldItem.useTime * 4f;
|
||||
|
||||
if (shootingTimer >= sigilFireRate)
|
||||
{
|
||||
// Find all active sigils
|
||||
var activeSigils = new List<Projectile>();
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
Projectile proj = Main.projectile[i];
|
||||
if (proj.active && proj.owner == Projectile.owner)
|
||||
{
|
||||
if (proj.type == ModContent.ProjectileType<IgnisSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<AquaSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<TerraSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<AerSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<OrdoSigil>() ||
|
||||
proj.type == ModContent.ProjectileType<PerditoSigil>())
|
||||
{
|
||||
// Make sure sigil isn't already consumed
|
||||
if (proj.ai[2] <= 0)
|
||||
{
|
||||
activeSigils.Add(proj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there are active sigils, select a random one and start the consuming anim
|
||||
if (activeSigils.Count > 0)
|
||||
{
|
||||
int randomIndex = Main.rand.Next(activeSigils.Count);
|
||||
Projectile chosenSigil = activeSigils[randomIndex];
|
||||
|
||||
// Start fadeout
|
||||
chosenSigil.ai[2] = 1.0f;
|
||||
shootingTimer = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Particle/dust channeling VFX
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<SigilSet>()] > 0)
|
||||
{
|
||||
Projectile sigilParent = null;
|
||||
int sigilType = ModContent.ProjectileType<SigilSet>();
|
||||
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
if (p.type == sigilType && p.owner == Projectile.owner)
|
||||
{
|
||||
sigilParent = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sigilParent != null)
|
||||
{
|
||||
Vector2 randomSpawnOffset = Main.rand.NextVector2Circular(90f, 90f);
|
||||
Vector2 dustSpawnPosition = GunTipPosition + randomSpawnOffset;
|
||||
|
||||
Vector2 inwardVelocity = (GunTipPosition - dustSpawnPosition).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(7f, 10f);
|
||||
Dust dust = Dust.NewDustPerfect(dustSpawnPosition, ModContent.DustType<LightDust>(), inwardVelocity, 0, Color.DarkMagenta, 1.2f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity *= 0.5f;
|
||||
dust.fadeIn = 0.5f;
|
||||
dust.scale *= 0.4f;
|
||||
|
||||
Lighting.AddLight(GunTipPosition, 0.4f * Color.DarkMagenta.ToVector3());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -- NEEDLES --
|
||||
else
|
||||
{
|
||||
int needleFireRate = (int)(12 * speedModifier);
|
||||
if (shootingTimer >= needleFireRate)
|
||||
{
|
||||
if (calPlayer.unstableCastersGauntletVis >= 0.3f)
|
||||
{
|
||||
// Consume vis
|
||||
calPlayer.unstableCastersGauntletVis -= 0.3f;
|
||||
|
||||
Projectile.velocity *= Main.rand.NextFloat(0.97f, 1.04f);
|
||||
|
||||
currentRecoilRotation -= RecoilRotationAmount;
|
||||
|
||||
// SFX
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/UnstableCastersGauntlet/VisNeedleFire") { Volume = 0.4f, PitchVariance = 0.15f }, Projectile.Center);
|
||||
|
||||
// Pulse VFX
|
||||
Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5f, Color.DarkMagenta * 4f, new Vector2(0.4f, 0.8f), Projectile.velocity.ToRotation(), 0.07f, 0.3f, 16);
|
||||
GeneralParticleHandler.SpawnParticle(shootPulse);
|
||||
|
||||
// Spawn needle
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * 35f).RotatedBy(Main.rand.NextFloat(-0.07f, 0.07f)), ModContent.ProjectileType<VisNeedle>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
shootingTimer = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cull if there isnt enough vis
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -- SIGIL SPAWNING --
|
||||
if (Owner.altFunctionUse == 2 && calPlayer.unstableCastersGauntletVis >= 6f)
|
||||
{
|
||||
float sigilFireRate = HeldItem.useTime * 4f;
|
||||
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<SigilSet>()] <= 0 || shootingTimer >= sigilFireRate)
|
||||
{
|
||||
calPlayer.unstableCastersGauntletVis -= 6f;
|
||||
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MagicRockSound") { Volume = 0.4f, PitchVariance = 0.05f }, Projectile.Center);
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ModContent.ProjectileType<SigilSet>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
shootingTimer = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -- RECOIL --
|
||||
ExtraFrontArmRotation = currentRecoilRotation;
|
||||
|
||||
// Resolve
|
||||
if (currentRecoilRotation != 0f)
|
||||
currentRecoilRotation = MathHelper.Lerp(currentRecoilRotation, 0f, RotationResolveSpeed);
|
||||
|
||||
|
||||
shootingTimer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class VisNeedle : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 6;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.penetrate = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Face the right direction
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
// Leak a particle
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 velocity = Vector2.Normalize(Projectile.velocity).RotatedBy(Main.rand.NextFloat(-0.07f, 0.07f)) * 0.8f;
|
||||
float scale = Projectile.scale * 0.33f;
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, velocity, false, 20, scale, Color.Magenta));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle the projectile's trail from here
|
||||
private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, MathHelper.Lerp(10f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * (Projectile.Opacity * 0.75f);
|
||||
Color endColor = Color.Lerp(Color.Magenta, Color.Violet, (float)Math.Sin(completionRatio * MathHelper.Pi * 2f - offsetTime * 4f) * 0.5f + 0.5f);
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 209 B |
|
After Width: | Height: | Size: 850 B |
@@ -104,6 +104,13 @@ namespace CalamityMod.Systems
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
|
||||
// Unstable Caster's Gauntlet vis meter
|
||||
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Vis UI", () =>
|
||||
{
|
||||
VisUI.Draw(Main.spriteBatch, Main.LocalPlayer);
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
|
||||
// Enchantment meters
|
||||
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Enchantment Meters", () =>
|
||||
{
|
||||
|
||||
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using CalamityMod.Items;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.CalPlayer;
|
||||
|
||||
namespace CalamityMod.UI.DraedonsArsenal
|
||||
{
|
||||
[Autoload(Side = ModSide.Client)]
|
||||
public sealed class VisUI : ModSystem
|
||||
{
|
||||
// Base pulled from Arsenal charge UI
|
||||
// Defaults to same pos as arsenal charge meter since there isn't a state where both would coexist
|
||||
internal const float DefaultChargePosX = 50.104603f;
|
||||
internal const float DefaultChargePosY = 58.05169f;
|
||||
private const float MouseDragEpsilon = 0.05f; // 0.05%
|
||||
|
||||
private static Vector2? dragOffset = null;
|
||||
private static Texture2D edgeTexture, barTexture;
|
||||
|
||||
public override void OnModLoad()
|
||||
{
|
||||
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/UI/UnstableCastersGauntlet/VisMeterBorder", AssetRequestMode.ImmediateLoad).Value;
|
||||
barTexture = ModContent.Request<Texture2D>("CalamityMod/UI/UnstableCastersGauntlet/VisMeter", AssetRequestMode.ImmediateLoad).Value;
|
||||
Reset();
|
||||
}
|
||||
|
||||
public override void Unload()
|
||||
{
|
||||
Reset();
|
||||
edgeTexture = barTexture = null;
|
||||
}
|
||||
|
||||
private static void Reset() => dragOffset = null;
|
||||
|
||||
public static void Draw(SpriteBatch spriteBatch, Player player)
|
||||
{
|
||||
// Sanity check the planned position before drawing
|
||||
Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.ChargeMeterPosX, CalamityClientConfig.Instance.ChargeMeterPosY);
|
||||
if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f)
|
||||
screenRatioPosition.X = DefaultChargePosX;
|
||||
if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f)
|
||||
screenRatioPosition.Y = DefaultChargePosY;
|
||||
|
||||
// Convert the screen ratio position to an absolute position in pixels
|
||||
// Cast to integer to prevent blurriness which results from decimal pixel positions
|
||||
float uiScale = Main.UIScale;
|
||||
Vector2 screenPos = screenRatioPosition;
|
||||
screenPos.X = (int)(screenPos.X * 0.01f * Main.screenWidth);
|
||||
screenPos.Y = (int)(screenPos.Y * 0.01f * Main.screenHeight);
|
||||
|
||||
void SavePosition()
|
||||
{
|
||||
bool changed = false;
|
||||
if (CalamityClientConfig.Instance.ChargeMeterPosX != screenRatioPosition.X)
|
||||
{
|
||||
CalamityClientConfig.Instance.ChargeMeterPosX = screenRatioPosition.X;
|
||||
changed = true;
|
||||
}
|
||||
if (CalamityClientConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y)
|
||||
{
|
||||
CalamityClientConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y;
|
||||
changed = true;
|
||||
}
|
||||
if (changed)
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
}
|
||||
|
||||
// If the Charge Meter is turned off or the player is not holding an item, stop.
|
||||
Item heldItem = player.HeldItem;
|
||||
if (!CalamityClientConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir)
|
||||
{
|
||||
Reset();
|
||||
SavePosition();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the player is not holding the correct item, stop.
|
||||
if (heldItem.type != ModContent.ItemType<UnstableCastersGauntlet>())
|
||||
{
|
||||
Reset();
|
||||
SavePosition();
|
||||
return;
|
||||
}
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
DrawChargeBar(spriteBatch, modPlayer.unstableCastersGauntletVis / 100f, screenPos);
|
||||
|
||||
|
||||
Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
|
||||
Rectangle chargeBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale * 0.8f);
|
||||
MouseState ms = Mouse.GetState();
|
||||
Vector2 mousePos = Main.MouseScreen;
|
||||
|
||||
if (chargeBar.Intersects(mouseHitbox))
|
||||
{
|
||||
if (!CalamityClientConfig.Instance.MeterPosLock)
|
||||
Main.LocalPlayer.mouseInterface = true;
|
||||
|
||||
// If the mouse is on top of the meter, show the exact numeric charge.
|
||||
string percentString = (player.Calamity().unstableCastersGauntletVis).ToString("n2");
|
||||
Main.instance.MouseText($"{CalamityUtils.GetTextValue("UI.Vis")}: {percentString}%", 0, 0, -1, -1, -1, -1);
|
||||
|
||||
Vector2 newScreenRatioPosition = screenRatioPosition;
|
||||
// Handle mouse dragging
|
||||
if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed)
|
||||
{
|
||||
// If the drag offset doesn't exist yet, create it.
|
||||
if (!dragOffset.HasValue)
|
||||
dragOffset = mousePos - screenPos;
|
||||
|
||||
// Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset.
|
||||
Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero);
|
||||
|
||||
// Convert the new corner position into a screen ratio position.
|
||||
newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth;
|
||||
newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight;
|
||||
}
|
||||
|
||||
// Compute the change in position. If it is large enough, actually move the meter
|
||||
Vector2 delta = newScreenRatioPosition - screenRatioPosition;
|
||||
if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon)
|
||||
{
|
||||
CalamityClientConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X;
|
||||
CalamityClientConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y;
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawChargeBar(SpriteBatch spriteBatch, float chargeRatio, Vector2 screenPos)
|
||||
{
|
||||
float uiScale = Main.UIScale;
|
||||
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
|
||||
spriteBatch.Draw(edgeTexture, screenPos, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale * 0.8f, SpriteEffects.None, 0);
|
||||
|
||||
Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * chargeRatio), barTexture.Width);
|
||||
spriteBatch.Draw(barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale * 0.85f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||