prismatic breaker file (not done yet)

This commit is contained in:
termigator1359 committed 2020-05-13 18:15:26 -04:00
1 parent 7dcf68f44d
commit e26b1fa6a0
1 file changed
+162
+162
View File
@@ -0,0 +1,162 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class PrismaticBreaker : ModItem
{
private int alpha = 50;
private int swing = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Elemental Excalibur");
Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" +
"Fires rainbow beams that change their behavior based on their color\n" +
"Right click for true melee");
}
public override void SetDefaults()
{
item.damage = 500;
item.crit += 8;
item.useAnimation = 15;
item.useStyle = 1;
item.useTime = 3;
item.useTurn = true;
item.melee = true;
item.knockBack = 8f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.width = 92;
item.height = 92;
item.value = CalamityGlobalItem.Rarity14BuyPrice;
item.rare = 10;
item.shoot = ModContent.ProjectileType<PrismaticWave>();
item.shootSpeed = 12f;
item.Calamity().customRarity = CalamityRarity.Dedicated;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Vector2 origin = new Vector2(46f, 44f);
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f);
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (player.altFunctionUse == 2)
{
Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType<PrismaticBeam>(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f);
}
else
{
swing++;
if (swing > 5)
swing = 0;
if (swing == 5)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
}
return false;
}
public override bool AltFunctionUse(Player player) => true;
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.NextBool(4))
{
Color color = new Color(255, 0, 0, alpha);
switch (Main.rand.Next(12))
{
case 0: // Red
break;
case 1: // Orange
color = new Color(255, 128, 0, alpha);
break;
case 2: // Yellow
color = new Color(255, 255, 0, alpha);
break;
case 3: // Lime
color = new Color(128, 255, 0, alpha);
break;
case 4: // Green
color = new Color(0, 255, 0, alpha);
break;
case 5: // Turquoise
color = new Color(0, 255, 128, alpha);
break;
case 6: // Cyan
color = new Color(0, 255, 255, alpha);
break;
case 7: // Light Blue
color = new Color(0, 128, 255, alpha);
break;
case 8: // Blue
color = new Color(0, 0, 255, alpha);
break;
case 9: // Purple
color = new Color(128, 0, 255, alpha);
break;
case 10: // Fuschia
color = new Color(255, 0, 255, alpha);
break;
case 11: // Hot Pink
color = new Color(255, 0, 128, alpha);
break;
default:
break;
}
Dust dust24 = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 0.8f)];
dust24.noGravity = true;
}
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
target.AddBuff(BuffID.CursedInferno, 120);
target.AddBuff(BuffID.Frostburn, 120);
target.AddBuff(BuffID.OnFire, 120);
target.AddBuff(BuffID.Ichor, 120);
}
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
target.AddBuff(BuffID.CursedInferno, 120);
target.AddBuff(BuffID.Frostburn, 120);
target.AddBuff(BuffID.OnFire, 120);
target.AddBuff(BuffID.Ichor, 120);
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<CosmicRainbow>());
recipe.AddIngredient(ModContent.ItemType<SolsticeClaymore>());
recipe.AddIngredient(ModContent.ItemType<BarofLife>(), 3);
recipe.AddIngredient(ModContent.ItemType<CosmiliteBar>(), 10);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}