117 lines
5.1 KiB
C#
117 lines
5.1 KiB
C#
using CalamityMod.Projectiles.Melee;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
public class ForbiddenOathblade : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Forbidden Oathblade");
|
|
Tooltip.SetDefault("Fires a demonic scythe and critical hits cause shadowflame explosions");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 74;
|
|
item.height = 74;
|
|
item.scale = 1.5f;
|
|
item.damage = 110;
|
|
item.melee = true;
|
|
item.useAnimation = 25;
|
|
item.useTime = 25;
|
|
item.useTurn = true;
|
|
item.useStyle = ItemUseStyleID.SwingThrow;
|
|
item.knockBack = 6.5f;
|
|
item.UseSound = SoundID.Item1;
|
|
item.autoReuse = true;
|
|
item.value = Item.buyPrice(0, 36, 0, 0);
|
|
item.rare = ItemRarityID.Pink;
|
|
item.shoot = ModContent.ProjectileType<ForbiddenOathbladeProjectile>();
|
|
item.shootSpeed = 10f;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<BladecrestOathsword>());
|
|
recipe.AddIngredient(ModContent.ItemType<OldLordOathsword>());
|
|
recipe.AddIngredient(ItemID.SoulofFright, 5);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
if (Main.rand.NextBool(3))
|
|
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173);
|
|
}
|
|
|
|
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(BuffID.ShadowFlame, 120);
|
|
target.AddBuff(BuffID.OnFire, 240);
|
|
if (crit)
|
|
{
|
|
target.AddBuff(BuffID.ShadowFlame, 360);
|
|
target.AddBuff(BuffID.OnFire, 720);
|
|
player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) * 2, 0f, 0, false);
|
|
float num50 = 1.7f;
|
|
float num51 = 0.8f;
|
|
float num52 = 2f;
|
|
Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2();
|
|
Vector2 value4 = value3 * target.velocity.Length();
|
|
Main.PlaySound(SoundID.Item14, target.position);
|
|
int num3;
|
|
for (int num53 = 0; num53 < 40; num53 = num3 + 1)
|
|
{
|
|
int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50);
|
|
Dust dust = Main.dust[num54];
|
|
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
|
|
dust.noGravity = true;
|
|
dust.velocity.Y -= 4.5f;
|
|
dust.velocity *= 3f;
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51);
|
|
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
|
|
dust.velocity.Y -= 3f;
|
|
dust.velocity *= 2f;
|
|
dust.noGravity = true;
|
|
dust.fadeIn = 1f;
|
|
dust.color = Color.Crimson * 0.5f;
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num3 = num53;
|
|
}
|
|
for (int num55 = 0; num55 < 20; num55 = num3 + 1)
|
|
{
|
|
int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52);
|
|
Dust dust = Main.dust[num56];
|
|
dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f;
|
|
dust.noGravity = true;
|
|
dust.velocity.Y -= 1.5f;
|
|
dust.velocity *= 0.5f;
|
|
dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat());
|
|
num3 = num55;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<Shadowflame>(), 120);
|
|
target.AddBuff(BuffID.OnFire, 240);
|
|
if (crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<Shadowflame>(), 360);
|
|
target.AddBuff(BuffID.OnFire, 720);
|
|
Main.PlaySound(SoundID.Item14, target.position);
|
|
}
|
|
}
|
|
}
|
|
}
|