Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Terraria;
- using Terraria.ID;
- using Terraria.ModLoader;
- using System;
- using System.Collections.Generic;
- namespace GuidosMod.items.weapons
- {
- public class TrueNightSky : ModItem
- {
- public override void SetStaticDefaults()
- {
- DisplayName.SetDefault("True Night Sky");
- Tooltip.SetDefault("A blade forged from the essence of 2000 dark souls.");
- }
- public override void SetDefaults()
- {
- item.damage = 119;
- item.melee = true;
- item.width = 50;
- item.height = 76;
- item.useTime = 12;
- item.useAnimation = 12;
- item.useStyle = 1;
- item.knockBack = 5;
- item.value = 10000;
- item.rare = 11;
- item.UseSound = SoundID.Item88;
- item.shootSpeed = 35f;
- item.autoReuse = true;
- item.useTurn = true;
- }
- public override void AddRecipes()
- {
- ModRecipe recipe = new ModRecipe(mod);
- recipe.AddIngredient(null, "TheNightSky", 1);
- recipe.AddIngredient(ItemID.SoulofNight, 2000);
- recipe.AddTile(TileID.DemonAltar);
- recipe.SetResult(this);
- recipe.AddRecipe();
- }
- public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
- {
- player.AddBuff(BuffID.Wrath, 600);
- target.AddBuff(39, 420);
- }
- public override void MeleeEffects(Player player, Rectangle hitbox)
- {
- Vector2 dustPosition;
- Vector2 dustVelocity = CalculateDustVelocityNormal(player, -1.57f); //send dust flying backwards of blade vlocity
- for (int i = 0; i < 10; i++)
- {
- float dist = Main.rand.NextFloat();
- dustPosition = CalculateDustPosition(player, item, 4, dist, 4f);
- int d = Terraria.Dust.NewDust(dustPosition, 0, 0,
- 27, player.velocity.X, player.velocity.Y, 0, 0, 1.3f - 0.8f * dist);
- Main.dust[d].velocity += dustVelocity * 5 * dist;
- }
- }
- private static Vector2 CalculateDustPosition(Player player, Item item, int handleLength, float distNormal, float scaleDisplace)
- {
- handleLength += 16;
- int length = (int)(item.width * 1.414f * item.scale) - handleLength;
- float cosRot = (float)Math.Cos(player.itemRotation - 0.78f * player.direction * player.gravDir);
- float sinRot = (float)Math.Sin(player.itemRotation - 0.78f * player.direction * player.gravDir);
- if (length < 1) length = 1;
- return new Vector2(
- (float)(player.itemLocation.X + (handleLength + length * distNormal) * cosRot * player.direction) - scaleDisplace,
- (float)(player.itemLocation.Y + (handleLength + length * distNormal) * sinRot * player.direction) - scaleDisplace);
- }
- private static Vector2 CalculateDustVelocityNormal(Player player, float angleOffset)
- {
- float cosRot = (float)Math.Cos(player.itemRotation - (0.78f - angleOffset) * player.direction * player.gravDir);
- float sinRot = (float)Math.Sin(player.itemRotation - (0.78f - angleOffset) * player.direction * player.gravDir);
- return new Vector2(
- (float)(cosRot * player.direction),
- (float)(sinRot * player.direction));
- }
- public override void HoldItem(Player player)
- {
- player.armorPenetration += 20;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement