Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Terraria;
- using Terraria.ID;
- using Terraria.ModLoader;
- namespace BadMod.Items
- {
- public class PotionOStorm : ModItem
- {
- public override void SetStaticDefaults()
- {
- DisplayName.SetDefault("Potion O' Rain"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
- Tooltip.SetDefault("Oh god nos");
- }
- public override void SetDefaults()
- {
- item.melee = false;
- item.width = 12;
- item.height = 12;
- item.useTime = 25;
- item.useAnimation = 20;
- item.useStyle = 2;
- item.value = 150;
- item.rare = 1;
- item.UseSound = SoundID.Item1;
- item.autoReuse = false;
- item.consumable = true;
- item.shoot = 680;
- item.shootSpeed = 20f;
- //The useStyle of the item.
- //Use useStyle 1 for normal swinging or for throwing
- //use useStyle 2 for an item that drinks such as a potion,
- //use useStyle 3 to make the sword act like a shortsword
- //use useStyle 4 for use like a life crystal,
- //and use useStyle 5 for staffs or guns
- }
- public override void AddRecipes()
- {
- ModRecipe recipe = new ModRecipe(mod);
- recipe.AddIngredient(ItemID.DirtBlock, 5);
- recipe.AddTile(TileID.WorkBenches);
- recipe.SetResult(this);
- recipe.AddRecipe();
- }
- // Star Wrath/Starfury style weapon. Spawn projectiles from sky that aim towards mouse.
- // See Source code for Star Wrath projectile to see how it passes through tiles.
- // The following changes to SetDefaults
- public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
- {
- Vector2 target = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
- float ceilingLimit = target.Y;
- if (ceilingLimit > player.Center.Y - 200f)
- {
- ceilingLimit = player.Center.Y - 200f;
- }
- for (int i = 0; i < 15; i++)
- {
- position = player.Center + new Vector2((-(float)Main.rand.Next(0, 401) * player.direction), -600f);
- position.Y -= (100 * i);
- Vector2 heading = target - position;
- if (heading.Y < 0f)
- {
- heading.Y *= -1f;
- }
- if (heading.Y < 20f)
- {
- heading.Y = 20f;
- }
- heading.Normalize();
- heading *= new Vector2(speedX, speedY).Length();
- speedX = heading.X;
- speedY = heading.Y + Main.rand.Next(-40, 41) * 0.02f;
- Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage * 2, knockBack, player.whoAmI, 0f, ceilingLimit);
- }
- return false;
- }
- public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
- {
- Player p = Main.player[projectile.owner];
- int healingAmount = damage / 18; //decrease the value 30 to increase heal, increase value to decrease. Or you can just replace damage/x with a set value to heal, instead of making it based on damage.
- p.statLife += healingAmount;
- p.HealEffect(healingAmount, true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment