Files
CalamityModPublic/Items/Weapons/Magic/Photosynthesis.cs
T
2024-05-03 12:54:21 -07:00

65 lines
2.3 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Magic
{
[LegacyName("TerraRay")]
public class Photosynthesis : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Magic";
public override void SetStaticDefaults()
{
Item.staff[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 78;
Item.height = 78;
Item.damage = 60;
Item.DamageType = DamageClass.Magic;
Item.mana = 10;
Item.useTime = 24;
Item.useAnimation = 24;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 4f;
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
Item.rare = ItemRarityID.Yellow;
Item.UseSound = SoundID.Item60;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PhotosyntheticSolarBeam>();
Item.shootSpeed = 6f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Vector2 shootVelocity = velocity;
Vector2 shootPosition = position + shootVelocity * 12f;
Projectile.NewProjectile(source, shootPosition, shootVelocity, type, damage, knockback, player.whoAmI);
return false;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/PhotosynthesisGlow").Value);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<NightsRay>().
AddIngredient<ValkyrieRay>().
AddIngredient<LivingShard>(12).
AddTile(TileID.MythrilAnvil).
Register();
}
}
}