Refactor Book of Unholy, add Singularity Sealing Unit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
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 TomeOfUnyielding : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 10000;
|
||||
Item.mana = 30;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user