Files
CalamityModPublic/Items/Weapons/Magic/SHPC.cs
T
Ozzatron 22afdd3933 1 - Calamity sell prices increase much more sharply with rarity.
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.
2024-04-17 21:20:17 -04:00

132 lines
4.9 KiB
C#

using System.Collections.Generic;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Magic
{
public class SHPC : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Magic";
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 124;
Item.height = 52;
Item.damage = 16;
Item.DamageType = DamageClass.Magic;
Item.mana = 20;
Item.useTime = Item.useAnimation = 7;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 3.25f;
Item.UseSound = SoundID.Item92;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<SHPB>();
Item.shootSpeed = 20f;
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
}
public override Vector2? HoldoutOffset() => new Vector2(-35, -10);
public override bool AltFunctionUse(Player player) => true;
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
Item.UseSound = CommonCalamitySounds.LaserCannonSound;
}
else
{
Item.UseSound = SoundID.Item92;
}
return base.CanUseItem(player);
}
public override void ModifyManaCost(Player player, ref float reduce, ref float mult)
{
if (player.altFunctionUse == 2)
mult *= 0.3f;
}
public override float UseSpeedMultiplier(Player player)
{
if (player.altFunctionUse == 2)
return 1f;
return 1 / 7.14f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.altFunctionUse == 2)
{
for (int shootAmt = 0; shootAmt < 3; shootAmt++)
{
float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f;
float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<SHPL>(), damage, knockback * 0.5f, player.whoAmI, 0f, 0f);
}
return false;
}
else
{
for (int shootAmt = 0; shootAmt < 3; shootAmt++)
{
float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f;
float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<SHPB>(), (int)(damage * 1.1), knockback, player.whoAmI, 0f, 0f);
}
return false;
}
}
public override void ModifyWeaponDamage(Player player, ref StatModifier damage)
{
// scaling legendary!!!!
if (Main.zenithWorld)
{
bool plantera = NPC.downedPlantBoss;
bool golem = NPC.downedGolemBoss;
bool cultist = NPC.downedAncientCultist;
bool moonLord = NPC.downedMoonlord;
bool providence = DownedBossSystem.downedProvidence;
bool devourerOfGods = DownedBossSystem.downedDoG;
bool yharon = DownedBossSystem.downedYharon;
float damageMult = 1f +
(plantera ? 0.1f : 0f) + //1.1
(golem ? 0.15f : 0f) + //1.25
(cultist ? 3.5f : 0f) + //4.75
(moonLord ? 4.5f : 0f) + //9.25
(providence ? 7.5f : 0f) + //16.75
(devourerOfGods ? 2.5f : 0f) + //19.25
(yharon ? 30f : 0f); //49.25
damage *= damageMult;
}
}
public override void ModifyTooltips(List<TooltipLine> list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"));
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PlasmaDriveCore>().
AddIngredient<SuspiciousScrap>(4).
AddRecipeGroup("AnyMythrilBar", 10).
AddTile(TileID.MythrilAnvil).
Register();
}
}
}