77 lines
3.0 KiB
C#
77 lines
3.0 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Ranged;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
[LegacyName("TerraFlameburster")]
|
|
public class WildfireBloom : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
|
|
public int FlareCounter = 0;
|
|
public int WildfireUseTime = 8;
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 114;
|
|
Item.height = 58;
|
|
Item.damage = 78;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.useTime = WildfireUseTime;
|
|
Item.useAnimation = WildfireUseTime;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noUseGraphic = true;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 3.25f;
|
|
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
|
|
Item.rare = ItemRarityID.Yellow;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ModContent.ProjectileType<WildfireBloomHoldout>();
|
|
Item.shootSpeed = 10f;
|
|
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, position, Vector2.Zero, ModContent.ProjectileType<WildfireBloomHoldout>(), 0, 0f, player.whoAmI);
|
|
|
|
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
|
|
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
|
{
|
|
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/WildfireBloomGlow").Value);
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.Flamethrower).
|
|
AddIngredient<Meowthrower>().
|
|
AddIngredient<LivingShard>(12).
|
|
AddIngredient<EssenceofSunlight>(5).
|
|
AddTile(TileID.MythrilAnvil).
|
|
Register();
|
|
}
|
|
}
|
|
}
|