Files
CalamityModPublic/Items/Weapons/DraedonsArsenal/PulseDragon.cs
T

72 lines
3.0 KiB
C#

using CalamityMod.CustomRecipes;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class PulseDragon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
Item.damage = 300;
Item.DamageType = DamageClass.MeleeNoSpeed;
Item.width = 30;
Item.height = 10;
Item.useTime = 20;
Item.useAnimation = 20;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.knockBack = 8f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.channel = true;
Item.shoot = ModContent.ProjectileType<PulseDragonProjectile>();
Item.shootSpeed = 20f;
modItem.UsesCharge = true;
modItem.MaxCharge = 190f;
modItem.ChargePerUse = 0.32f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack)
{
float offsetAngle = Main.rand.NextFloat(0.2f, 0.4f);
velocity += player.velocity;
float velocityAngle = velocity.ToRotation();
Projectile projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockBack, player.whoAmI, velocityAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness));
projectile.localAI[0] = 1f;
projectile = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(offsetAngle), type, damage, knockBack, player.whoAmI, velocityAngle + offsetAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness));
projectile.localAI[0] = -1f;
return false;
}
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4);
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MysteriousCircuitry>(12).
AddIngredient<DubiousPlating>(18).
AddIngredient<UelibloomBar>(8).
AddIngredient(ItemID.LunarBar, 4).
AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func<bool> condition), condition).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}