2 - (Example) Post DoG items are now 2 platinum instead of 1 platinum 40 gold. 3 - (Example) Dev items are now 2 platinum 80 gold instead of 2 platinum. 4 - Privated numeric rarity item values. 5 - All assigned item values use the rarity's names, e.g. RarityLightPurpleBuyPrice.
95 lines
3.2 KiB
C#
95 lines
3.2 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Magic;
|
|
using CalamityMod.Rarities;
|
|
using CalamityMod.Sounds;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Magic
|
|
{
|
|
public class PlasmaRifle : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Magic";
|
|
|
|
public static readonly SoundStyle HeavyShotSound = new("CalamityMod/Sounds/Item/PlasmaRifleMain");
|
|
public static readonly SoundStyle FastShotSound = new("CalamityMod/Sounds/Item/PlasmaRifleAlt");
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 72;
|
|
Item.height = 20;
|
|
Item.damage = 150;
|
|
Item.mana = 40;
|
|
Item.DamageType = DamageClass.Magic;
|
|
Item.useTime = Item.useAnimation = 8;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 4f;
|
|
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
|
Item.rare = ModContent.RarityType<Turquoise>();
|
|
Item.UseSound = CommonCalamitySounds.PlasmaBlastSound;
|
|
Item.autoReuse = true;
|
|
Item.shootSpeed = 12f;
|
|
Item.shoot = ModContent.ProjectileType<PlasmaShot>();
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
|
|
|
public override bool AltFunctionUse(Player player) => true;
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
if (player.altFunctionUse == 2)
|
|
{
|
|
Item.UseSound = FastShotSound;
|
|
}
|
|
else
|
|
{
|
|
Item.UseSound = HeavyShotSound;
|
|
}
|
|
return base.CanUseItem(player);
|
|
}
|
|
|
|
public override void ModifyManaCost(Player player, ref float reduce, ref float mult)
|
|
{
|
|
if (player.altFunctionUse == 2)
|
|
mult *= 0.25f;
|
|
}
|
|
|
|
public override float UseSpeedMultiplier(Player player)
|
|
{
|
|
if (player.altFunctionUse == 2)
|
|
return 1f;
|
|
return 0.2f;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
if (player.altFunctionUse == 2)
|
|
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<PlasmaBolt>(), damage * 2, knockback, player.whoAmI);
|
|
else
|
|
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.ToxicFlask).
|
|
AddIngredient(ItemID.LaserRifle).
|
|
AddIngredient<UelibloomBar>(7).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|