Files
CalamityModPublic/Items/Weapons/Melee/Avalanche.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

78 lines
3.4 KiB
C#

using System;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class Avalanche : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetDefaults()
{
Item.width = 64;
Item.height = 64;
Item.damage = 100;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 35;
Item.useTime = 35;
Item.useTurn = true;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 7.25f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
var source = player.GetSource_ItemUse(Item);
int totalProjectiles = 4;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<IceBombFriendly>();
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
float velocity = 4f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer);
}
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
var source = player.GetSource_ItemUse(Item);
int totalProjectiles = 4;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<IceBombFriendly>();
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
float velocity = 4f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, 0f, Main.myPlayer);
}
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.NextBool(3))
{
int iceDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, DustID.IceRod, (float)(player.direction * 2), 0f, 150, default, 1.5f);
Main.dust[iceDust].velocity *= 0.2f;
}
}
}
}