68 lines
2.5 KiB
C#
68 lines
2.5 KiB
C#
using CalamityMod.Projectiles.Magic;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Items.Weapons.Magic
|
|
{
|
|
public class WrathoftheAncients : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Wrath of the Ancients");
|
|
Tooltip.SetDefault("Casts a granite energy pulse");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 47;
|
|
item.magic = true;
|
|
item.mana = 20;
|
|
item.width = 28;
|
|
item.height = 30;
|
|
item.useTime = 38;
|
|
item.useAnimation = 38;
|
|
item.useStyle = 5;
|
|
item.noMelee = true;
|
|
item.knockBack = 6f;
|
|
item.value = Item.buyPrice(0, 80, 0, 0);
|
|
item.rare = 8;
|
|
item.autoReuse = true;
|
|
item.shoot = ModContent.ProjectileType<GranitePulse>();
|
|
item.shootSpeed = 9f;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
int i = Main.myPlayer;
|
|
float num72 = item.shootSpeed;
|
|
int num73 = damage;
|
|
float num74 = knockBack;
|
|
num74 = player.GetWeaponKnockback(item, num74);
|
|
player.itemTime = item.useTime;
|
|
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;
|
|
}
|
|
else
|
|
{
|
|
num80 = num72 / num80;
|
|
}
|
|
num78 = 0f;
|
|
num79 = 0f;
|
|
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
|
|
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
|
|
Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType<GranitePulse>(), num73, num74, i, 0f, 0f);
|
|
return false;
|
|
}
|
|
}
|
|
}
|