2 - (Example) Post DoG items are now 2 platinum instead of 1 platinum 40 gold. 3 - (Example) Dev items are now 2 platinum 80 gold instead of 2 platinum. 4 - Privated numeric rarity item values. 5 - All assigned item values use the rarity's names, e.g. RarityLightPurpleBuyPrice.
119 lines
4.9 KiB
C#
119 lines
4.9 KiB
C#
using System;
|
|
using CalamityMod.Projectiles.Magic;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Magic
|
|
{
|
|
public class WyvernsCall : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Magic";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Item.staff[Item.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 52;
|
|
Item.height = 74;
|
|
Item.damage = 65;
|
|
Item.DamageType = DamageClass.Magic;
|
|
Item.mana = 10;
|
|
Item.useTime = 23;
|
|
Item.useAnimation = 23;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 4.75f;
|
|
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
|
|
Item.rare = ItemRarityID.Pink;
|
|
Item.UseSound = SoundID.Item102;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ModContent.ProjectileType<WyvernFeatherPurple>();
|
|
Item.shootSpeed = 35f;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
float projSpeed = Item.shootSpeed;
|
|
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
|
|
float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
|
|
if (player.gravDir == -1f)
|
|
{
|
|
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
|
|
}
|
|
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
|
|
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
|
|
{
|
|
mouseXDist = (float)player.direction;
|
|
mouseYDist = 0f;
|
|
mouseDistance = projSpeed;
|
|
}
|
|
else
|
|
{
|
|
mouseDistance = projSpeed / mouseDistance;
|
|
}
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
float damageMult = 1f;
|
|
float kbMult = 1f;
|
|
if (Main.rand.NextBool(10))
|
|
{
|
|
type = ModContent.ProjectileType<WyvernProjectile>();
|
|
}
|
|
else if (Main.rand.NextBool(3))
|
|
{
|
|
type = ModContent.ProjectileType<WyvernFeatherGreen>();
|
|
}
|
|
else if (Main.rand.NextBool())
|
|
{
|
|
type = ModContent.ProjectileType<WyvernFeatherPink>();
|
|
}
|
|
if (type == ModContent.ProjectileType<WyvernProjectile>())
|
|
{
|
|
damageMult = 15f;
|
|
kbMult = 1.5f;
|
|
}
|
|
if (type == ModContent.ProjectileType<WyvernFeatherPink>())
|
|
{
|
|
kbMult = 2f;
|
|
}
|
|
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
|
|
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
|
|
realPlayerPos.Y -= (float)(100 * i);
|
|
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
|
|
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
|
|
if (mouseYDist < 0f)
|
|
{
|
|
mouseYDist *= -1f;
|
|
}
|
|
if (mouseYDist < 20f)
|
|
{
|
|
mouseYDist = 20f;
|
|
}
|
|
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
|
|
mouseDistance = projSpeed / mouseDistance;
|
|
mouseXDist *= mouseDistance;
|
|
mouseYDist *= mouseDistance;
|
|
int feather = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, mouseXDist, mouseYDist, type, (int)(damage * damageMult), (int)(knockback * kbMult), player.whoAmI, 0f, (float)Main.rand.Next(15));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<SkyGlaze>().
|
|
AddRecipeGroup("AnyMythrilBar", 5).
|
|
AddIngredient(ItemID.SoulofFlight, 15).
|
|
AddTile(TileID.MythrilAnvil).
|
|
Register();
|
|
}
|
|
}
|
|
}
|