This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
68 lines
2.6 KiB
C#
68 lines
2.6 KiB
C#
using System;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Items.Weapons.Melee;
|
|
using CalamityMod.Projectiles.BaseProjectiles;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee.Shortswords
|
|
{
|
|
public class ElementalShivProj : BaseShortswordProjectile
|
|
{
|
|
public override LocalizedText DisplayName => CalamityUtils.GetItemName<ElementalShiv>();
|
|
public override string Texture => "CalamityMod/Items/Weapons/Melee/ElementalShiv";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.Size = new Vector2(22);
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.scale = 1f;
|
|
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
|
Projectile.ownerHitCheck = true;
|
|
Projectile.timeLeft = 360;
|
|
Projectile.extraUpdates = 1;
|
|
Projectile.hide = true;
|
|
Projectile.ownerHitCheck = true;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = -1;
|
|
}
|
|
|
|
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
|
{
|
|
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType<ElementBallShiv>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
};
|
|
|
|
public override void SetVisualOffsets()
|
|
{
|
|
const int HalfSpriteWidth = 44 / 2;
|
|
const int HalfSpriteHeight = 44 / 2;
|
|
|
|
int HalfProjWidth = Projectile.width / 2;
|
|
int HalfProjHeight = Projectile.height / 2;
|
|
|
|
DrawOriginOffsetX = 0;
|
|
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
|
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
|
}
|
|
|
|
public override void ExtraBehavior()
|
|
{
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
int rainbowDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
|
|
Main.dust[rainbowDust].velocity *= 0.2f;
|
|
Main.dust[rainbowDust].noGravity = true;
|
|
}
|
|
}
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<ElementalMix>(), 60);
|
|
}
|
|
}
|
|
}
|