added bouncy spiky balls (unobtainable)
This commit is contained in:
1 parent
be4032cf4d
commit
85aaa08721
5 files changed
+179
No files matched your search
@@ -1959,6 +1959,7 @@ namespace CalamityMod
|
||||
|
||||
spikyBallList = new List<int>()
|
||||
{
|
||||
ModContent.ItemType<BouncySpikyBall>(),
|
||||
ModContent.ItemType<GodsParanoia>(),
|
||||
ModContent.ItemType<NastyCholla>(),
|
||||
ModContent.ItemType<HellsSun>(),
|
||||
@@ -1969,6 +1970,7 @@ namespace CalamityMod
|
||||
|
||||
spikyBallProjList = new List<int>()
|
||||
{
|
||||
ModContent.ProjectileType<BouncyBol>(),
|
||||
ModContent.ProjectileType<GodsParanoiaProj>(),
|
||||
ModContent.ProjectileType<HellsSunProj>(),
|
||||
ModContent.ProjectileType<NastyChollaBol>(),
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class BouncySpikyBall : RogueWeapon
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bouncy Spiky Ball");
|
||||
Tooltip.SetDefault(@"Throws a very bouncy ball that richochets off walls and enemies
|
||||
Receives a small boost in damage and velocity after bouncing off an enemy
|
||||
Stealth strikes provide a bigger boost after richocheting");
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
{
|
||||
item.width = 14;
|
||||
item.damage = 10;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.useAnimation = 18;
|
||||
item.useStyle = 1;
|
||||
item.useTime = 18;
|
||||
item.knockBack = 1f;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.autoReuse = true;
|
||||
item.consumable = true;
|
||||
item.maxStack = 999;
|
||||
item.height = 14;
|
||||
item.value = Item.buyPrice(0, 0, 1, 0);
|
||||
item.rare = 1;
|
||||
item.shoot = ModContent.ProjectileType<BouncyBol>();
|
||||
item.shootSpeed = 8f;
|
||||
item.Calamity().rogue = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
|
||||
{
|
||||
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f);
|
||||
Main.projectile[stealth].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.SpikyBall, 3);
|
||||
recipe.AddIngredient(ItemID.PinkGel);
|
||||
recipe.AddTile(TileID.WorkBenches);
|
||||
recipe.SetResult(this, 3);
|
||||
recipe.AddRecipe();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 301 B |
@@ -0,0 +1,115 @@
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class BouncyBol : ModProjectile
|
||||
{
|
||||
private bool hasHitEnemy = false;
|
||||
private int targetNPC = -1;
|
||||
private List<int> previousNPCs = new List<int>() { -1 };
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bouncy Ball");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 14;
|
||||
projectile.height = 14;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = 8;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.Calamity().rogue = true;
|
||||
projectile.aiStyle = 14;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (hasHitEnemy == true && projectile.timeLeft < 575)
|
||||
{
|
||||
projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out
|
||||
projectile.velocity.Y *= 1.005f;
|
||||
if (projectile.velocity.X > 16f)
|
||||
{
|
||||
projectile.velocity.X = 16f;
|
||||
}
|
||||
if (projectile.velocity.Y > 16f)
|
||||
{
|
||||
projectile.velocity.Y = 16f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
float minDist = 999f;
|
||||
int index = 0;
|
||||
for (int i = 0; i < Main.npc.Length; i++)
|
||||
{
|
||||
bool hasHitNPC = false;
|
||||
for (int j = 0; j < previousNPCs.Count; j++)
|
||||
{
|
||||
if (previousNPCs[j] == i)
|
||||
{
|
||||
hasHitNPC = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc == target)
|
||||
{
|
||||
previousNPCs.Add(i);
|
||||
}
|
||||
if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC)
|
||||
{
|
||||
float dist = (projectile.Center - npc.Center).Length();
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 velocityNew;
|
||||
if (minDist < 999f)
|
||||
{
|
||||
if (projectile.Calamity().stealthStrike && hasHitEnemy == false)
|
||||
{
|
||||
projectile.damage = (int)(projectile.damage * 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.damage = (int)(projectile.damage * 1.1f);
|
||||
}
|
||||
hasHitEnemy = true;
|
||||
targetNPC = index;
|
||||
velocityNew = Main.npc[index].Center - projectile.Center;
|
||||
velocityNew.Normalize();
|
||||
velocityNew *= 15f;
|
||||
projectile.velocity = velocityNew;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
if (projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
projectile.velocity.X = -oldVelocity.X * 1.001f;
|
||||
}
|
||||
if (projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
projectile.velocity.Y = -oldVelocity.Y * 1.001f;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 301 B |
Reference in new issue
Block a user