caustic staff adjustments and mod support

This commit is contained in:
termigator1359 committed 2020-05-13 16:08:03 -04:00
1 parent 77e12a8f3b
commit 13042679f7
3 files changed
+20 -18

No files matched your search

+1
View File
@@ -830,6 +830,7 @@ namespace CalamityMod
sAssociation.Call("AddMinionInfo", ItemType<CorroslimeStaff>(), BuffType<Corroslime>(), ProjectileType<CorroslimeMinion>());
sAssociation.Call("AddMinionInfo", ItemType<CrimslimeStaff>(), BuffType<Crimslime>(), ProjectileType<CrimslimeMinion>());
sAssociation.Call("AddMinionInfo", ItemType<BlackHawkRemote>(), BuffType<BlackHawkBuff>(), ProjectileType<BlackHawkSummon>());
sAssociation.Call("AddMinionInfo", ItemType<CausticStaff>(), BuffType<CausticStaffBuff>(), ProjectileType<CausticStaffSummon>());
sAssociation.Call("AddMinionInfo", ItemType<AncientIceChunk>(), BuffType<IceClasper>(), ProjectileType<IceClasperMinion>());
sAssociation.Call("AddMinionInfo", ItemType<ShellfishStaff>(), BuffType<ShellfishBuff>(), ProjectileType<Shellfish>());
sAssociation.Call("AddMinionInfo", ItemType<HauntedScroll>(), BuffType<HauntedDishesBuff>(), ProjectileType<HauntedDishes>());
+2 -1
View File
@@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 360;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
projectile.extraUpdates = 1;
projectile.tileCollide = false;
}
public override void AI()
{
@@ -32,7 +34,6 @@ namespace CalamityMod.Projectiles.Summon
projectile.velocity.X *= 0.99f;
if (projectile.velocity.Y < 9f)
projectile.velocity.Y += 0.085f;
projectile.tileCollide = projectile.timeLeft <= 180;
}
public override void Kill(int timeLeft)
{
+17 -17
View File
@@ -108,16 +108,16 @@ namespace CalamityMod.Projectiles.Summon
bool foundEnemy = false;
int targetIndex = -1;
//If the player has targetted an enemy, choose that one
NPC npc = projectile.OwnerMinionAttackTargetNPC;
if (npc != null && npc.CanBeChasedBy(projectile, false))
NPC target = projectile.OwnerMinionAttackTargetNPC;
if (target != null && target.CanBeChasedBy(projectile, false))
{
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
float targetDist = Vector2.Distance(target.Center, projectile.Center);
if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height))
{
maxRange = targetDist;
targetPos = npc.Center;
targetPos = target.Center;
foundEnemy = true;
targetIndex = npc.whoAmI;
targetIndex = target.whoAmI;
}
}
//else, search through all available NPCs
@@ -125,14 +125,14 @@ namespace CalamityMod.Projectiles.Summon
{
for (int index = 0; index < Main.maxNPCs; ++index)
{
NPC npc2 = Main.npc[index];
if (npc2.CanBeChasedBy(projectile, false))
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy(projectile, false))
{
float targetDist = Vector2.Distance(npc2.Center, projectile.Center);
if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc2.position, npc2.width, npc2.height))
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
{
maxRange = targetDist;
targetPos = npc2.Center;
targetPos = npc.Center;
foundEnemy = true;
targetIndex = index;
}
@@ -179,9 +179,9 @@ namespace CalamityMod.Projectiles.Summon
projectile.ai[0] = 1f;
//Set speed to home in on the player. If returning to the player, go faster
float speed = 6f;
float speed = 9f;
if (projectile.ai[0] == 1f)
speed = 15f;
speed = 22f;
//Find the player and align accordingly. Get in a line if there's more than one.
Vector2 playerPos = player.Center - projectile.Center;
@@ -200,8 +200,8 @@ namespace CalamityMod.Projectiles.Summon
//Calculate player distance
float playerDist = playerPos.Length();
//If too far, increase speed
if (playerDist > 200f && speed < 9f)
speed = 9f;
if (playerDist > 200f && speed < 15f)
speed = 15f;
//If you were trying to chase the player but are close enough now, return to normal
if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
{
@@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Summon
//Increment firing cooldown
if (projectile.ai[1] > 0f)
{
++projectile.ai[1];
projectile.ai[1] += Main.rand.Next(1,4);
if (Main.rand.NextBool(3))
++projectile.ai[1];
}
@@ -293,7 +293,7 @@ namespace CalamityMod.Projectiles.Summon
return;
//Fire projectile
float speedMult = 11f;
float speedMult = 16f;
targetVec.Normalize();
targetVec *= speedMult;
int spike = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType<CausticStaffProjectile>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);