Files
CalamityModPublic/Items/Weapons/Ranged/AMR.cs
T
2022-01-14 18:08:51 -05:00

68 lines
2.6 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class AMR : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Anti-materiel Rifle");
Tooltip.SetDefault("Converts musket balls into .50 caliber sniper rounds that rip apart enemy defense and DR\n" +
"If you crit the target a second swarm of bullets will fire");
}
public override void SetDefaults()
{
item.damage = 3240;
item.ranged = true;
item.width = 140;
item.height = 36;
item.useTime = 60;
item.useAnimation = 60;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 9.5f;
item.value = Item.buyPrice(1, 80, 0, 0);
item.rare = ItemRarityID.Red;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire");
item.autoReuse = true;
item.shoot = ProjectileID.Bullet;
item.shootSpeed = 12f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().customRarity = CalamityRarity.DarkBlue;
item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
// Terraria seems to really dislike high crit values in SetDefaults
public override void GetWeaponCrit(Player player, ref int crit) => crit += 20;
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<Shroomer>());
recipe.AddIngredient(ModContent.ItemType<CosmiliteBar>(), 10);
recipe.AddTile(ModContent.TileType<CosmicAnvil>());
recipe.SetResult(this);
recipe.AddRecipe();
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<AMRShot>(), damage, knockBack, player.whoAmI);
else
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI);
return false;
}
}
}