Files
CalamityModPublic/Items/Weapons/Melee/DraedonsExoblade.cs
T
Ozzatron cdb8a5489e 1 - Renamed Exocrystals to Exo Prisms
2 - Added Miracle Matter
3 - Changed all Exo Weapon recipes to require 1 Miracle Matter
4 - Improved the tooltips of most late game crafting materials
5 - Changed some late game crafting recipes around
2021-09-12 20:07:49 -04:00

136 lines
5.7 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class DraedonsExoblade : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Exoblade");
Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" +
"Fires an exo beam that homes in on the player and explodes\n" +
"Striking an enemy with the blade causes several comets to fire\n" +
"All attacks briefly freeze enemies hit\n" +
"Enemies hit at very low HP explode into frost energy and freeze nearby enemies");
}
public override void SetDefaults()
{
item.width = 80;
item.damage = 900;
item.useAnimation = 14;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 14;
item.useTurn = true;
item.melee = true;
item.knockBack = 9f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.height = 114;
item.value = CalamityGlobalItem.Rarity15BuyPrice;
item.rare = ItemRarityID.Red;
item.shoot = ModContent.ProjectileType<Exobeam>();
item.shootSpeed = 19f;
item.Calamity().customRarity = CalamityRarity.Violet;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.NextBool(4))
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255));
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
if (crit)
damage /= 2;
if (target.life <= (target.lifeMax * 0.05f))
Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType<Exoboom>(), damage, knockback, Main.myPlayer);
target.ExoDebuffs();
Main.PlaySound(SoundID.Item88, player.Center);
float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = player.position.Y + Main.rand.Next(-800, 801);
Vector2 startPos = new Vector2(xPos, yPos);
Vector2 velocity = target.position - startPos;
float dir = 10 / startPos.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (player.ownedProjectileCounts[ModContent.ProjectileType<Exocomet>()] < 8)
{
for (int comet = 0; comet < 2; comet++)
{
float ai1 = Main.rand.NextFloat() + 0.5f;
Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType<Exocomet>(), damage, knockback, player.whoAmI, 0f, ai1);
}
}
if (!target.canGhostHeal || player.moonLeech)
return;
int healAmount = Main.rand.Next(3) + 5;
player.statLife += healAmount;
player.HealEffect(healAmount);
}
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
{
if (crit)
damage /= 2;
if (target.statLife <= (target.statLifeMax2 * 0.05f))
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<Exoboom>(), damage, item.knockBack, Main.myPlayer);
target.ExoDebuffs();
Main.PlaySound(SoundID.Item88, player.Center);
float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = player.position.Y + Main.rand.Next(-800, 801);
Vector2 startPos = new Vector2(xPos, yPos);
Vector2 velocity = target.position - startPos;
float dir = 10 / startPos.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (player.ownedProjectileCounts[ModContent.ProjectileType<Exocomet>()] < 8)
{
for (int comet = 0; comet < 2; comet++)
{
float ai1 = Main.rand.NextFloat() + 0.5f;
Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType<Exocomet>(), damage, item.knockBack, player.whoAmI, 0f, ai1);
}
}
if (player.moonLeech)
return;
int healAmount = Main.rand.Next(3) + 5;
player.statLife += healAmount;
player.HealEffect(healAmount);
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<Terratomere>());
recipe.AddIngredient(ModContent.ItemType<AnarchyBlade>());
recipe.AddIngredient(ModContent.ItemType<FlarefrostBlade>());
recipe.AddIngredient(ModContent.ItemType<PhoenixBlade>());
recipe.AddIngredient(ModContent.ItemType<StellarStriker>());
recipe.AddIngredient(ModContent.ItemType<MiracleMatter>());
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}