added sulphurous grabber

slime staff can now use any wood
fixed calamari ink ignoring minion targetting
This commit is contained in:
termigator1359 committed 2020-03-26 16:14:48 -04:00
1 parent 5f310d3ccc
commit 3b9e609d8f
13 files changed
+302 -28

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
using CalamityMod.Projectiles.Melee.Yoyos;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class SulphurousGrabber : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sulphurous Grabber");
Tooltip.SetDefault("Occasionally releases a ring of colored bubbles\n" +
"The yoyo receives powers up after touching a green bubble");
ItemID.Sets.Yoyo[item.type] = true;
ItemID.Sets.GamepadExtraRange[item.type] = 15;
ItemID.Sets.GamepadSmartQuickReach[item.type] = true;
}
public override void SetDefaults()
{
item.width = 50;
item.height = 36;
item.melee = true;
item.damage = 36;
item.knockBack = 3.5f;
item.useTime = 25;
item.useAnimation = 25;
item.useStyle = 5;
item.UseSound = SoundID.Item1;
item.channel = true;
item.noUseGraphic = true;
item.noMelee = true;
item.shoot = ModContent.ProjectileType<SulphurousGrabberYoyo>();
item.shootSpeed = 12f;
item.rare = 5;
item.value = Item.buyPrice(gold: 36);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

+8 -1
View File
@@ -1,5 +1,7 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -7,7 +9,6 @@ using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Buffs.StatDebuffs;
namespace CalamityMod.NPCs.AcidRain
{
@@ -192,6 +193,12 @@ namespace CalamityMod.NPCs.AcidRain
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore3"), npc.scale);
}
}
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ModContent.ItemType<SulphurousGrabber>(), 20);
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
@@ -0,0 +1,47 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SulphurousGrabberBubble : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bubble");
}
public override void SetDefaults()
{
projectile.width = 18;
projectile.height = 18;
projectile.friendly = true;
projectile.alpha = 60;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.timeLeft = 120;
projectile.melee = true;
}
public override void AI()
{
projectile.velocity.X *= 0.9f;
projectile.velocity.Y *= 0.9f;
if (Main.rand.NextBool(5))
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54);
int num190 = Main.rand.Next(5, 9);
for (int num191 = 0; num191 < num190; num191++)
{
int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f);
Main.dust[num192].velocity *= 0.8f;
Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f);
Main.dust[num192].noGravity = true;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

@@ -0,0 +1,48 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SulphurousGrabberBubble2 : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bubble");
}
public override void SetDefaults()
{
projectile.width = 18;
projectile.height = 18;
projectile.friendly = true;
projectile.alpha = 60;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.timeLeft = 120;
projectile.melee = true;
}
public override void AI()
{
projectile.ai[0]++;
projectile.velocity.X *= 0.9f;
projectile.velocity.Y *= 0.9f;
if (Main.rand.NextBool(5))
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54);
int num190 = Main.rand.Next(5, 9);
for (int num191 = 0; num191 < num190; num191++)
{
int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f);
Main.dust[num192].velocity *= 0.8f;
Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f);
Main.dust[num192].noGravity = true;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

@@ -0,0 +1,113 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee.Yoyos
{
public class SulphurousGrabberYoyo : ModProjectile
{
private int bubbleCounter = 0;
private bool bubbleStronk = false;
private int bubbleStronkCounter = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sulphurous Grabber Yoyo");
ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f;
ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f;
ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.aiStyle = 99;
projectile.width = 18;
projectile.height = 18;
projectile.scale = 1f;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = -1;
projectile.localNPCHitCooldown = 10 * projectile.extraUpdates;
}
public override void AI()
{
if (projectile.owner == Main.myPlayer)
{
if (bubbleStronk)
{
ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f;
projectile.extraUpdates = 1;
projectile.usesLocalNPCImmunity = true;
bubbleStronkCounter++;
}
else
{
ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f;
projectile.extraUpdates = 0;
projectile.usesLocalNPCImmunity = false;
bubbleStronkCounter = 0;
}
if (bubbleStronkCounter >= 240)
bubbleStronk = false;
Rectangle rectangle = new Rectangle((int)((double)projectile.position.X + (double)projectile.velocity.X * 0.5 - 4.0), (int)((double)projectile.position.Y + (double)projectile.velocity.Y * 0.5 - 4.0), projectile.width + 8, projectile.height + 8);
for (int i = 0; i < Main.maxProjectiles; i++)
{
Projectile proj = Main.projectile[i];
if (proj.active && proj.type == ModContent.ProjectileType<SulphurousGrabberBubble2>() && proj.ai[0] >= 40f && proj.owner == projectile.owner)
{
Rectangle rect = proj.getRect();
if (rectangle.Intersects(rect))
{
proj.Kill();
bubbleStronk = true;
bubbleStronkCounter = 0;
break;
}
}
}
bubbleCounter++;
if (bubbleCounter >= 60)
{
for (float i = 0; i < 9; i++)
{
int projType = ModContent.ProjectileType<SulphurousGrabberBubble>();
if (Main.rand.NextBool(10))
projType = ModContent.ProjectileType<SulphurousGrabberBubble2>();
float angle = MathHelper.TwoPi / 9 * i;
Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 8f, projType, projectile.damage / 10, projectile.knockBack / 10, projectile.owner, 0f, 0f);
}
bubbleCounter = 0;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D tex = Main.projectileTexture[projectile.type];
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
if (bubbleStronk)
{
tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble");
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex);
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

+40 -25
View File
@@ -41,38 +41,53 @@ namespace CalamityMod.Projectiles.Summon
projectile.frame = 0;
}
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float num474 = 400f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
Player player = Main.player[projectile.owner];
int targetIdx = -1;
float maxHomingRange = 400f;
bool hasHomingTarget = false;
if (player.HasMinionAttackTargetNPC)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
NPC npc = Main.npc[player.MinionAttackTargetNPC];
if (npc.CanBeChasedBy(projectile, false))
{
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
if (num478 < num474)
float dist = (projectile.Center - npc.Center).Length();
if (dist < maxHomingRange)
{
num474 = num478;
num472 = num476;
num473 = num477;
flag17 = true;
targetIdx = player.MinionAttackTargetNPC;
maxHomingRange = dist;
hasHomingTarget = true;
}
}
}
if (flag17)
else
{
float num483 = 10f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
for (int i = 0; i < Main.npc.Length; ++i)
{
NPC npc = Main.npc[i];
if (npc == null || !npc.active)
continue;
if (npc.CanBeChasedBy(projectile, false))
{
float dist = (projectile.Center - npc.Center).Length();
if (dist < maxHomingRange)
{
targetIdx = i;
maxHomingRange = dist;
hasHomingTarget = true;
}
}
}
}
// Home in on said closest NPC.
if (hasHomingTarget)
{
NPC target = Main.npc[targetIdx];
Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 10f;
float homingRatio = 20f;
projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f);
}
}
+2 -2
View File
@@ -293,8 +293,8 @@ namespace CalamityMod.Projectiles.Summon
}
if (num23 > 3000f)
{
projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2);
projectile.position.X = player.Center.X - (float)(projectile.width / 2);
projectile.position.Y = player.Center.Y - (float)(projectile.width / 2);
}
if (num23 > 70f)
{
+1
View File
@@ -469,6 +469,7 @@ namespace CalamityMod
//Slime Staff
r = GetNewRecipe();
r.AddIngredient(ItemID.Wood, 6);
r.anyWood = true;
r.AddIngredient(ItemID.Gel, 40);
r.AddIngredient(ItemID.PinkGel, 10);
r.AddTile(TileID.Anvils);