Files
CalamityModPublic/Projectiles/Rogue/FeatherKnifeProjectile.cs
T
Ozzatron 31f396d29b 1 - Replaced AverageDamage with "best class damage"
2 - Shield slams scale with melee instead of anything
3 - A few things scale with summon instead of anything, like Demonshade Red Devil
4 - Hide of Astrum Deus scales with melee instead of anything
5 - Other minor pedantic scaling changes
6 - Hundreds of compile errors
2022-05-22 19:13:21 -04:00

64 lines
2.7 KiB
C#

using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FeatherKnifeProjectile : ModProjectile
{
public override string Texture => "CalamityMod/Items/Weapons/Rogue/FeatherKnife";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Knife");
}
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.friendly = true;
Projectile.aiStyle = 2;
Projectile.timeLeft = 600;
AIType = ProjectileID.ThrowingKnife;
Projectile.DamageType = RogueDamageClass.Instance;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
public override void AI()
{
if (Projectile.timeLeft % 35 == 0)
{
if (Projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Projectile.velocity.X / 20, 2), ModContent.ProjectileType<StickyFeatherAero>(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceRogue = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Projectile.velocity.X / 20, 2), ModContent.ProjectileType<StickyFeatherAero>(), (int)(Projectile.damage * 0.69), Projectile.knockBack, Projectile.owner);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceRogue = true;
}
public override void Kill(int timeLeft)
{
if (Main.rand.NextBool(2) && !Projectile.noDropItem)
Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType<FeatherKnife>());
}
}
}