Files
CalamityModPublic/Items/Weapons/Rogue/ShatteredSun.cs
T
ben-tk feb3baa47b Added new fields to the RogueWeapon abstract class to make modifying stealth strikes simpler
Also doubled the Celestus stealth strike damage modifier but made it only shoot one projectile
2022-10-03 11:32:21 -04:00

69 lines
2.5 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Rogue
{
public class ShatteredSun : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shattered Sun");
Tooltip.SetDefault("Throws daggers that split into scorching homing daggers\n" +
"Stealth strikes fire volleys of homing daggers from the player on dagger hits that suck enemies in");
SacrificeTotal = 1;
}
public override void SetDefaults()
{
Item.width = 56;
Item.height = 56;
Item.damage = 80;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.useAnimation = 12;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 12;
Item.knockBack = 6f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.shoot = ModContent.ProjectileType<ShatteredSunKnife>();
Item.shootSpeed = 25f;
Item.DamageType = RogueDamageClass.Instance;
}
// Terraria seems to really dislike high crit values in SetDefaults
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10;
public override float StealthDamageMultiplier => 1.2f;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.Calamity().StealthStrikeAvailable())
{
int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
if (stealth.WithinBounds(Main.maxProjectiles))
Main.projectile[stealth].Calamity().stealthStrike = true;
return false;
}
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<RadiantStar>().
AddIngredient<DivineGeode>(6).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}