Refactor Nyanageddons to be in Weapons/Ranged
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Items.Weapons.Ranged
|
||||
{
|
||||
public class Nyanageddon : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 250;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 40;
|
||||
Item.height = 40;
|
||||
Item.useTime = 8;
|
||||
Item.useAnimation = 8;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.knockBack = 6;
|
||||
Item.value = Item.buyPrice(gold: 20);
|
||||
Item.rare = ItemRarityID.Red;
|
||||
Item.UseSound = SoundID.Meowmere;
|
||||
Item.autoReuse = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shootSpeed = 20f;
|
||||
Item.useAmmo = AmmoID.None;
|
||||
}
|
||||
|
||||
// On shoot, fire Projectile ID 502 (the rainbow projectile) instead of the default ammo projectile
|
||||
public override bool Shoot(Player player, Terraria.DataStructures.EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack)
|
||||
{
|
||||
Terraria.Projectile.NewProjectile(source, position, velocity, 502, damage, knockBack, player.whoAmI);
|
||||
return false; // return false to prevent tModLoader from shooting the default projectile
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() {
|
||||
return new Vector2(2f, -2f);
|
||||
}
|
||||
|
||||
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) {
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 25f;
|
||||
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) {
|
||||
position += muzzleOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe recipe = CreateRecipe();
|
||||
recipe.AddIngredient(ItemID.RainbowGun, 1);
|
||||
recipe.AddIngredient(ItemID.LunarBar, 20);
|
||||
recipe.AddIngredient(ItemID.Meowmere, 1);
|
||||
recipe.AddTile(TileID.LunarCraftingStation);
|
||||
recipe.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 863 B |
@@ -0,0 +1,70 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using ForgottenWawiTech.Content.Items.Weapons.Ranged;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Items.Weapons.Ranged
|
||||
{
|
||||
public class TrueNyanageddon : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 3000;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 40;
|
||||
Item.height = 40;
|
||||
Item.useTime = 17;
|
||||
Item.useAnimation = 17;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.knockBack = 20;
|
||||
Item.value = Item.buyPrice(gold: 60);
|
||||
Item.rare = ItemRarityID.Expert;
|
||||
Item.UseSound = SoundID.Meowmere;
|
||||
Item.autoReuse = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shootSpeed = 30f;
|
||||
Item.useAmmo = AmmoID.None;
|
||||
Item.crit = 60;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, Terraria.DataStructures.EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack)
|
||||
{
|
||||
for (int i = 0; i <= 2; i++) // hey c# what the fuck. anyway, shoot 3 proj.
|
||||
{
|
||||
Vector2 newVelocity = velocity.RotatedBy(MathHelper.ToRadians(3 * i));
|
||||
Terraria.Projectile.NewProjectile(source, position, newVelocity, 502, damage, knockBack, player.whoAmI);
|
||||
}
|
||||
return false; // return false to prevent tModLoader from shooting the default projectile */
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() {
|
||||
return new Vector2(-5f, -2f);
|
||||
}
|
||||
|
||||
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) {
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 58f;
|
||||
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) {
|
||||
position += muzzleOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe recipe = CreateRecipe();
|
||||
if (ModLoader.TryGetMod("CalamityMod", out Mod calamityMod) && calamityMod.TryFind<ModItem>("AuricBar", out ModItem auricBar))
|
||||
{
|
||||
recipe.AddIngredient(auricBar.Type, 20);
|
||||
}
|
||||
recipe.AddIngredient<Nyanageddon>(1);
|
||||
recipe.AddIngredient(ItemID.LunarBar, 20);
|
||||
recipe.AddIngredient(ItemID.Meowmere, 3);
|
||||
recipe.AddTile(TileID.LunarCraftingStation);
|
||||
recipe.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 863 B |
Reference in New Issue
Block a user