Add Avalian Trader Town NPC, add Infinite Mana accessory for testing, add two new magic weapons

This commit is contained in:
2025-11-09 23:53:14 +00:00
parent b2972be531
commit a73cf0965d
16 changed files with 919 additions and 2 deletions
@@ -0,0 +1,23 @@
using Terraria;
using Terraria.ModLoader;
using ForgottenWawiTech.Content.Rarities;
namespace ForgottenWawiTech.Content.Items.Accessories
{
public class DevInfiniteMana : ModItem
{
public override void SetDefaults()
{
Item.width = 28;
Item.height = 28;
Item.accessory = true;
Item.rare = ModContent.RarityType<FWTDeveloperItem>();
Item.value = Item.sellPrice(platinum: 999);
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.statMana = player.statManaMax2;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

+2 -2
View File
@@ -18,8 +18,8 @@ namespace ForgottenWawiTech.Content.Items.SummonItems
Item.width = 40;
Item.height = 40;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.useAnimation = 3;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = false;
Item.rare = ModContent.RarityType<FWTDeveloperItem>();
}
@@ -0,0 +1,80 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace ForgottenWawiTech.Content.Items.Weapons.Magic
{
public class BookOfUnholy: ModItem
{
public override void SetDefaults()
{
Item.damage = 10000;
Item.mana = 0; // Temp value for development
Item.crit = 100;
Item.DamageType = DamageClass.Magic;
Item.width = 40;
Item.height = 40;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useStyle = ItemUseStyleID.Shoot;
Item.knockBack = 6;
Item.value = Item.buyPrice(platinum: 20);
Item.rare = ItemRarityID.Red;
Item.autoReuse = true;
Item.noMelee = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 50f;
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)
{
// Shoot every projectile from vanilla Terraria magic weapons at once.
int[] projectiles = new int[] {
ProjectileID.WoodenArrowFriendly,
ProjectileID.EnchantedBoomerang,
ProjectileID.MagicMissile,
ProjectileID.Flamelash,
ProjectileID.DemonScythe,
ProjectileID.RainbowRodBullet,
ProjectileID.UnholyTridentFriendly,
ProjectileID.LightBeam,
ProjectileID.NightBeam,
ProjectileID.RainFriendly,
ProjectileID.IceSickle,
ProjectileID.LastPrismLaser,
ProjectileID.NebulaBlaze2
};
foreach (int projectileType in projectiles)
{
Terraria.Projectile.NewProjectile(source, position, velocity, projectileType, 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.BouncyBoulder, 100);
recipe.AddIngredient(ItemID.LunarBar, 20);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

@@ -0,0 +1,32 @@
using ForgottenWawiTech.Content.Projectiles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ForgottenWawiTech.Content.Items.Weapons.Magic
{
public class ShatteredPrism : ModItem
{
public override string Texture => "Terraria/Images/Item_" + ItemID.LastPrism; // TODO: Change
public static Color OverrideColor = new(80,0,80);
public override void SetDefaults() {
Item.CloneDefaults(ItemID.LastPrism);
Item.mana = 4;
Item.damage = 2000;
Item.shoot = ModContent.ProjectileType<ShatteredPrismHoldout>();
Item.shootSpeed = 30f;
// Change the item's draw color so that it is visually distinct from the vanilla Last Prism.
Item.color = OverrideColor;
}
// Because this weapon fires a holdout projectile, it needs to block usage if its projectile already exists.
public override bool CanUseItem(Player player) {
return player.ownedProjectileCounts[ModContent.ProjectileType<ShatteredPrismHoldout>()] <= 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B