Files
CalamityModPublic/Items/Weapons/DraedonsArsenal/MountedScanner.cs
T
doze-zoze 0b6565c24a balacing
- Medusa Head dmg buff
- Auger cooldown doubled
- Auger pull weakened
- Removed charge from all arsenal weapons. This includes the donor ones. I have notified the donors of this change and will return charge to their weapon if they desire.
2026-01-10 17:35:51 -06:00

95 lines
3.9 KiB
C#

using System;
using System.Collections.Generic;
using CalamityMod.CustomRecipes;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class MountedScanner : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
Item.width = 26;
Item.height = 26;
Item.DamageType = DamageClass.Summon;
Item.damage = 24;
Item.knockBack = 2f;
Item.mana = 10;
Item.useAnimation = Item.useTime = 36;
Item.autoReuse = true;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.UseSound = SoundID.Item15;
Item.noMelee = true;
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
Item.shoot = ModContent.ProjectileType<MountedScannerSummon>();
Item.shootSpeed = 1f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
var scanner = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI);
scanner.originalDamage = Item.damage;
int totalOwnedScanners = player.ownedProjectileCounts[type];
int currentScannerIndex = 0;
foreach (Projectile projectile in Main.projectile)
{
if (!projectile.active)
continue;
if (projectile.type != type)
continue;
if (projectile.owner != player.whoAmI)
continue;
float completionRatio = currentScannerIndex / (float)totalOwnedScanners;
// ai[0] is the angular offset relative to the projectile's owner.
// For the first 15 summons, wrap around the player angularly, but not at a perfect angle, a bit like the Dazzling Stabbers when idle.
// But once the total summon count is greater than 15, just create a perfect circle depending on the total amount of summons.
if (totalOwnedScanners <= 14)
{
projectile.ai[0] = Utils.AngleLerp(0f, MathHelper.Pi, currentScannerIndex / 15f);
if (currentScannerIndex % 2f == 1f)
projectile.ai[0] = -Utils.AngleLerp(0f, MathHelper.Pi, (currentScannerIndex + 1) / 15f);
}
else
{
projectile.ai[0] = MathHelper.TwoPi / totalOwnedScanners * currentScannerIndex;
}
// Add a specific offset so that the scanners spawn above the player at first and not to the side.
projectile.ai[0] -= MathHelper.PiOver2;
projectile.netUpdate = true;
currentScannerIndex++;
}
return false;
}
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2);
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MysteriousCircuitry>(15).
AddIngredient<DubiousPlating>(5).
AddRecipeGroup("AnyMythrilBar", 10).
AddIngredient(ItemID.SoulofFright, 20).
AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func<bool> condition), condition).
AddTile(TileID.MythrilAnvil).
Register();
}
}
}