48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using CalamityMod.Projectiles.Summon;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Summon
|
|
{
|
|
public class PolypLauncher : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Summon";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 26;
|
|
Item.height = 56;
|
|
Item.damage = 12;
|
|
Item.DamageType = DamageClass.Summon;
|
|
Item.sentry = true;
|
|
Item.mana = 10;
|
|
Item.useAnimation = Item.useTime = 35;
|
|
Item.knockBack = 0.25f;
|
|
Item.shoot = ModContent.ProjectileType<PolypLauncherSentry>();
|
|
Item.shootSpeed = 10f;
|
|
|
|
Item.UseSound = SoundID.Item44;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.autoReuse = true;
|
|
Item.noMelee = true;
|
|
|
|
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
|
Item.rare = ItemRarityID.Green;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset);
|
|
YOffset -= 13;
|
|
position = new Vector2((float)XPosition, (float)(YPosition - YOffset));
|
|
int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f);
|
|
if (Main.projectile.IndexInRange(p))
|
|
Main.projectile[p].originalDamage = Item.damage;
|
|
player.UpdateMaxTurrets();
|
|
return false;
|
|
}
|
|
}
|
|
}
|