Files
CalamityModPublic/Items/Weapons/Summon/PolypLauncher.cs
T
Altixal 11f4ab20a0 Sentry changes
- Atlas Munitions is now resummonable
- Calamity ground sentries now spawn at their resting spot
- The aforementioned ground sentries no longer try to "climb" platforms
2024-04-26 17:51:22 +07:00

46 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.mana = 10;
Item.useTime = Item.useAnimation = 35;
Item.useStyle = ItemUseStyleID.Swing;
Item.noMelee = true;
Item.knockBack = 0f;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
Item.UseSound = SoundID.Item44;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PolypLauncherSentry>();
Item.shootSpeed = 10f;
Item.DamageType = DamageClass.Summon;
Item.sentry = true;
}
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;
}
}
}