133 lines
5.6 KiB
C#
133 lines
5.6 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Melee;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
public class ArkoftheElements : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Ark of the Elements");
|
|
Tooltip.SetDefault("A heavenly blade infused with the essence of Terraria");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 84;
|
|
item.damage = 126;
|
|
item.melee = true;
|
|
item.useAnimation = 20;
|
|
item.useTime = 20;
|
|
item.useTurn = true;
|
|
item.useStyle = 1;
|
|
item.crit += 10;
|
|
item.knockBack = 8.5f;
|
|
item.UseSound = SoundID.Item60;
|
|
item.autoReuse = true;
|
|
item.height = 84;
|
|
item.value = Item.buyPrice(1, 20, 0, 0);
|
|
item.rare = 10;
|
|
item.shoot = ModContent.ProjectileType<EonBeam>();
|
|
item.shootSpeed = 16f;
|
|
item.Calamity().postMoonLordRarity = 12;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
switch (Main.rand.Next(4))
|
|
{
|
|
case 0:
|
|
type = ModContent.ProjectileType<EonBeam>();
|
|
break;
|
|
case 1:
|
|
type = ModContent.ProjectileType<EonBeamV2>();
|
|
break;
|
|
case 2:
|
|
type = ModContent.ProjectileType<EonBeamV3>();
|
|
break;
|
|
case 3:
|
|
type = ModContent.ProjectileType<EonBeamV4>();
|
|
break;
|
|
}
|
|
int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer);
|
|
Main.projectile[projectile].timeLeft = 160;
|
|
Main.projectile[projectile].tileCollide = false;
|
|
float num72 = Main.rand.Next(22, 30);
|
|
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X;
|
|
float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y;
|
|
if (player.gravDir == -1f)
|
|
{
|
|
num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y;
|
|
}
|
|
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
|
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
|
{
|
|
num78 = (float)player.direction;
|
|
num79 = 0f;
|
|
num80 = num72;
|
|
}
|
|
else
|
|
{
|
|
num80 = num72 / num80;
|
|
}
|
|
|
|
int num107 = 4;
|
|
for (int num108 = 0; num108 < num107; num108++)
|
|
{
|
|
vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)-(float)player.direction + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y);
|
|
vector2.X = (vector2.X + player.Center.X) / 2f;
|
|
vector2.Y -= (float)(100 * num108);
|
|
num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
|
num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
|
num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
|
num80 = num72 / num80;
|
|
num78 *= num80;
|
|
num79 *= num80;
|
|
float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f;
|
|
float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f;
|
|
Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType<ElementBall>(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<TrueArkoftheAncients>());
|
|
recipe.AddIngredient(ModContent.ItemType<GalacticaSingularity>(), 5);
|
|
recipe.AddIngredient(ModContent.ItemType<CoreofCalamity>(), 5);
|
|
recipe.AddIngredient(ModContent.ItemType<BarofLife>(), 10);
|
|
recipe.AddIngredient(ItemID.LunarBar, 15);
|
|
recipe.AddTile(TileID.LunarCraftingStation);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
|
|
Main.dust[num250].velocity *= 0.2f;
|
|
Main.dust[num250].noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
|
target.AddBuff(ModContent.BuffType<Plague>(), 120);
|
|
}
|
|
}
|
|
}
|