Files
CalamityModPublic/Items/Weapons/Ranged/ChromaticEruption.cs
T
CongratsIsTrash 982f71a1ef Elemental weapon renames, EXCEPT Lance and Disk
Also made Legion of Celestia (Elemental Axe) minions destroy trees in GFB
2024-07-02 23:23:50 -04:00

69 lines
2.7 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
[LegacyName("ElementalEruption")]
public class ChromaticEruption : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public int FlareCounter = 0;
public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
public override void SetDefaults()
{
Item.width = 64;
Item.height = 34;
Item.damage = 94;
Item.DamageType = DamageClass.Ranged;
Item.useAnimation = Item.useTime = 6;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noUseGraphic = true;
Item.noMelee = true;
Item.knockBack = 3.5f;
Item.UseSound = SoundID.Item34;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ChromaticEruptionHoldout>();
Item.shootSpeed = 9f;
Item.useAmmo = AmmoID.Gel;
Item.channel = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true;
// Spawning the holdout cannot consume ammo
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<ChromaticEruptionHoldout>(), damage, knockback, player.whoAmI, 0, 1);
holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WildfireBloom>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}