This commit is contained in:
CongratsIsTrash committed 2023-10-19 17:54:11 -04:00
1 parent c166b401d2
commit 4ef641b500
11 files changed
+276 -297

No files matched your search

+6 -6
View File
@@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
+27 -29
View File
@@ -34,9 +34,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
@@ -233,18 +233,16 @@ namespace CalamityMod.Projectiles.Pets
}
else if (fly)
{
float num16 = 0.3f;
float flyingSpeed = 0.3f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 2000f)
{
@@ -254,7 +252,7 @@ namespace CalamityMod.Projectiles.Pets
}
if (playerDistance < 100f)
{
num16 = 0.1f;
flyingSpeed = 0.1f;
if (player.velocity.Y == 0f)
{
++playerStill;
@@ -275,53 +273,53 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.90f;
}
num16 = 0.01f;
flyingSpeed = 0.01f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.1f;
flyingSpeed = 0.1f;
}
if (playerDistance > 300f)
{
num16 = 1f;
flyingSpeed = 1f;
}
playerDistance = num21 / playerDistance;
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flyingSpeed;
if (flyingSpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flyingSpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flyingSpeed;
if (flyingSpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flyingSpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flyingSpeed;
if (flyingSpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flyingSpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flyingSpeed;
if (flyingSpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flyingSpeed * 2f;
}
}
+38 -41
View File
@@ -42,33 +42,30 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.timeLeft = 4;
}
float num16 = 0.5f;
float flySpeed = 0.5f;
Projectile.tileCollide = false;
int num17 = 100;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float num18 = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float num19 = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
num19 += (float)Main.rand.Next(-10, 21);
num18 += (float)Main.rand.Next(-10, 21);
num18 += (float)(60 * -(float)Main.player[Projectile.owner].direction);
num19 -= 60f;
float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19));
float num21 = 18f;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction);
vertPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertPos * vertPos));
//Limites de mouvement ici
float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19));
if (num27 > 1000f)
if (playerDistance > 1000f)
{
Projectile.position.X = Projectile.position.X + num18;
Projectile.position.Y = Projectile.position.Y + num19;
Projectile.position.X = Projectile.position.X + horiPos;
Projectile.position.Y = Projectile.position.Y + vertPos;
for (int k = 0; k < 10; k++)
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0, -1f, 0, default, 1f);
}
}
if (num20 < (float)num17 && Main.player[Projectile.owner].velocity.Y == 0f &&
if (playerDistance < 100f && Main.player[Projectile.owner].velocity.Y == 0f &&
Projectile.position.Y + (float)Projectile.height <= Main.player[Projectile.owner].position.Y + (float)Main.player[Projectile.owner].height &&
!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
{
@@ -78,60 +75,60 @@ namespace CalamityMod.Projectiles.Pets
Projectile.velocity.Y = -6f;
}
}
if (num20 < 50f)
if (playerDistance < 50f)
{
if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f)
{
Projectile.velocity *= 0.90f;
}
num16 = 0.01f;
flySpeed = 0.01f;
}
else
{
if (num20 < 100f)
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
}
if (num20 > 300f)
if (playerDistance > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
num20 = num21 / num20;
num18 *= num20;
num19 *= num20;
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertPos *= playerDistance;
}
//Les changements de velocité ici
if (Projectile.velocity.X < num18)
if (Projectile.velocity.X < horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > num18)
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y < num19)
if (Projectile.velocity.Y < vertPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > num19)
if (Projectile.velocity.Y > vertPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
if ((double)Projectile.velocity.X > 0.25)
+20 -22
View File
@@ -49,40 +49,38 @@ namespace CalamityMod.Projectiles.Pets
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16));
Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16));
Texture2D texture2D3 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/ChibiiDoggoMonochrome").Value;
int num156 = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y3 = num156 * Projectile.frame;
Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156);
Vector2 origin2 = rectangle.Size() / 2f;
int num157 = 8;
int num158 = 2;
int num159 = 1;
float num160 = 0f;
int textureArea = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y3 = textureArea * Projectile.frame;
Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea);
Vector2 halfRect = rectangle.Size() / 2f;
int eightCompare = 8;
int twoConst = 2;
int num161 = num159;
while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))
int counter = 1;
while ((twoConst > 0 && counter < eightCompare) || (twoConst < 0 && counter > eightCompare))
{
Color color26 = color25;
color26 = Projectile.GetAlpha(color26);
Color colorAlpha = colorArea;
colorAlpha = Projectile.GetAlpha(colorAlpha);
goto IL_6899;
IL_6881:
num161 += num158;
counter += twoConst;
continue;
IL_6899:
float num164 = (float)(num157 - num161);
if (num158 < 0)
float trailColorChange = (float)(eightCompare - counter);
if (twoConst < 0)
{
num164 = (float)(num159 - num161);
trailColorChange = (float)(1 - counter);
}
color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f);
Vector2 value4 = Projectile.oldPos[num161];
float num165 = Projectile.rotation;
colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f);
Vector2 oldDrawPos = Projectile.oldPos[counter];
float projRotate = Projectile.rotation;
SpriteEffects effects = spriteEffects;
Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f);
Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, halfRect, Projectile.scale, effects, 0f);
goto IL_6881;
}
Main.spriteBatch.Draw(ModContent.Request<Texture2D>(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0);
Main.spriteBatch.Draw(ModContent.Request<Texture2D>(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, halfRect, Projectile.scale, spriteEffects, 0);
return false;
}
+18 -20
View File
@@ -35,36 +35,34 @@ namespace CalamityMod.Projectiles.Pets
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16));
Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16));
Texture2D texture2D3 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/ChibiiDoggoFlyMonochrome").Value;
int num156 = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y3 = num156 * Projectile.frame;
Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156);
int textureArea = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y3 = textureArea * Projectile.frame;
Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea);
Vector2 origin2 = rectangle.Size() / 2f;
int num157 = 12;
int num158 = 2;
int num159 = 1;
float num160 = 0f;
int num161 = num159;
while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))
int twelveCompare = 12;
int twoConst = 2;
int counter = 1;
while ((twoConst > 0 && counter < twelveCompare) || (twoConst < 0 && counter > twelveCompare))
{
Color color26 = color25;
color26 = Projectile.GetAlpha(color26);
Color colorAlpha = colorArea;
colorAlpha = Projectile.GetAlpha(colorAlpha);
goto IL_6899;
IL_6881:
num161 += num158;
counter += twoConst;
continue;
IL_6899:
float num164 = (float)(num157 - num161);
if (num158 < 0)
float trailColorChange = (float)(twelveCompare - counter);
if (twoConst < 0)
{
num164 = (float)(num159 - num161);
trailColorChange = (float)(1 - counter);
}
color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f);
Vector2 value4 = Projectile.oldPos[num161];
float num165 = Projectile.rotation;
colorAlpha *= trailColorChange / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f);
Vector2 oldDrawPos = Projectile.oldPos[counter];
float projRotate = Projectile.rotation;
SpriteEffects effects = spriteEffects;
Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f);
Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f);
goto IL_6881;
}
Main.spriteBatch.Draw(ModContent.Request<Texture2D>(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0);
+34 -36
View File
@@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
@@ -144,18 +144,16 @@ namespace CalamityMod.Projectiles.Pets
}
else if (fly)
{
float num16 = 0.3f;
float flySpeed = 0.3f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 1200f)
{
Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2);
@@ -164,7 +162,7 @@ namespace CalamityMod.Projectiles.Pets
}
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
if (player.velocity.Y == 0f)
{
++playerStill;
@@ -185,52 +183,52 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.90f;
}
num16 = 0.01f;
flySpeed = 0.01f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
}
if (playerDistance > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
playerDistance = num21 / playerDistance;
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
Projectile.rotation = Projectile.velocity.X * 0.03f;
@@ -250,16 +248,16 @@ namespace CalamityMod.Projectiles.Pets
{
if (!Main.gamePaused || Main.gameMenu)
{
Vector2 vector69 = projectile.position - Main.screenPosition;
if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height)
Vector2 projDirect = projectile.position - Main.screenPosition;
if ((float)Main.mouseX > projDirect.X && (float)Main.mouseX < projDirect.X + (float)projectile.width && (float)Main.mouseY > projDirect.Y && (float)Main.mouseY < projDirect.Y + (float)projectile.height)
{
int num345 = (int)(Main.player[projectile.owner].Center.X / 16f);
int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f);
int num347 = (int)projectile.Center.X / 16;
int num348 = (int)projectile.Center.Y / 16;
int playerTileX = (int)(Main.player[projectile.owner].Center.X / 16f);
int playerTileY = (int)(Main.player[projectile.owner].Center.Y / 16f);
int projTileX = (int)projectile.Center.X / 16;
int projTileY = (int)projectile.Center.Y / 16;
int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX;
int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY;
if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1)
if (playerTileX >= projTileX - lastTileRangeX && playerTileX <= projTileX + lastTileRangeX + 1 && playerTileY >= projTileY - lastTileRangeY && playerTileY <= projTileY + lastTileRangeY + 1)
{
Main.player[projectile.owner].noThrow = 2;
Main.player[projectile.owner].cursorItemIconEnabled = true;
+28 -30
View File
@@ -62,9 +62,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -87,13 +87,13 @@ namespace CalamityMod.Projectiles.Pets
Projectile.timeLeft = 2;
}
Vector2 vector46 = Projectile.position;
Vector2 projPos = Projectile.position;
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -8f;
@@ -189,18 +189,16 @@ namespace CalamityMod.Projectiles.Pets
}
else if (fly)
{
float num16 = 0.5f;
float flySpeed = 0.5f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)player.direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 1200f)
{
Projectile.position.X = player.Center.X - (float)(Projectile.width / 2);
@@ -209,7 +207,7 @@ namespace CalamityMod.Projectiles.Pets
}
if (playerDistance < 100f)
{
num16 = 0.5f;
flySpeed = 0.5f;
if (player.velocity.Y == 0f)
{
++playerStill;
@@ -231,52 +229,52 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.90f;
}
num16 = 0.02f;
flySpeed = 0.02f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.35f;
flySpeed = 0.35f;
}
if (playerDistance > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
playerDistance = num21 / playerDistance;
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
+27 -29
View File
@@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
@@ -166,18 +166,16 @@ namespace CalamityMod.Projectiles.Pets
}
else if (fly)
{
float num16 = 0.3f;
float flySpeed = 0.3f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)player.direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 1200f)
{
Projectile.position.X = player.Center.X - (float)(Projectile.width / 2);
@@ -186,7 +184,7 @@ namespace CalamityMod.Projectiles.Pets
}
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
if (player.velocity.Y == 0f)
{
++playerStill;
@@ -207,52 +205,52 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.90f;
}
num16 = 0.01f;
flySpeed = 0.01f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
}
if (playerDistance > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
playerDistance = num21 / playerDistance;
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction;
+30 -32
View File
@@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
@@ -233,18 +233,16 @@ namespace CalamityMod.Projectiles.Pets
}
else if (fly)
{
float num16 = 0.3f;
float flySpeed = 0.3f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18.5f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 2000f)
{
Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2);
@@ -253,7 +251,7 @@ namespace CalamityMod.Projectiles.Pets
}
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
if (player.velocity.Y == 0f)
{
playerStill++;
@@ -274,52 +272,52 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.9f;
}
num16 = 0.01f;
flySpeed = 0.01f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
}
if (playerDistance > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
playerDistance = num21 / playerDistance;
playerDistance = 18.5f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
Projectile.rotation = Projectile.velocity.X * 0.015f;
@@ -352,9 +350,9 @@ namespace CalamityMod.Projectiles.Pets
{
SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D texture2D13 = ModContent.Request<Texture2D>(Texture).Value;
int num214 = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y6 = num214 * Projectile.frame;
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0);
int framing = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
int y6 = framing * Projectile.frame;
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0);
return false;
}
+6 -6
View File
@@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Pets
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
fallThrough = playerDistance > 200f;
return true;
}
@@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Pets
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -5f;
+42 -46
View File
@@ -42,8 +42,6 @@ namespace CalamityMod.Projectiles.Pets
Item item = Main.item[itemIndex];
if (item.active && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && ItemLoader.CanPickup(item, player))
{
int num = defaultItemGrabRange;//Player.defaultItemGrabRange;
if (new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height).Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height)))
{
if (Projectile.owner == Main.myPlayer && (player.ActiveItem().type != ItemID.None || player.itemAnimation <= 0))
@@ -63,16 +61,16 @@ namespace CalamityMod.Projectiles.Pets
{
continue;
//Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1);
//int num2 = item.buffType;
//int nebulaBuff = item.buffType;
//Main.item[itemIndex] = new Item();
//if (Main.netMode == 1)
//{
// NetMessage.SendData(102, -1, -1, "", projectile.owner, (float)num2, player.Center.X, player.Center.Y, 0, 0, 0);
// NetMessage.SendData(102, -1, -1, "", projectile.owner, (float)nebulaBuff, player.Center.X, player.Center.Y, 0, 0, 0);
// NetMessage.SendData(21, -1, -1, "", itemIndex, 0f, 0f, 0f, 0, 0, 0);
//}
//else
//{
// player.NebulaLevelup(num2);
// player.NebulaLevelup(nebulaBuff);
//}
}
if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane)
@@ -149,8 +147,8 @@ namespace CalamityMod.Projectiles.Pets
for (int index = 0; index < Main.projectile.Length; index++)
{
Projectile proj = Main.projectile[index];
bool flag23 = Main.projPet[proj.type];
if (index != Projectile.whoAmI && proj.active && proj.owner == Projectile.owner && flag23 && Math.Abs(Projectile.position.X - proj.position.X) + Math.Abs(Projectile.position.Y - proj.position.Y) < (float)Projectile.width)
bool isPet = Main.projPet[proj.type];
if (index != Projectile.whoAmI && proj.active && proj.owner == Projectile.owner && isPet && Math.Abs(Projectile.position.X - proj.position.X) + Math.Abs(Projectile.position.Y - proj.position.Y) < (float)Projectile.width)
{
if (Projectile.position.X < proj.position.X)
{
@@ -170,17 +168,16 @@ namespace CalamityMod.Projectiles.Pets
}
}
}
float num16 = 0.5f;
float flySpeed = 0.5f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float xDist = player.position.X + (float)(player.width / 2) - vector3.X;
float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float xDist = player.position.X + (float)(player.width / 2) - flyDirection.X;
float yDist = player.position.Y + (float)(player.height / 2) - flyDirection.Y;
yDist += (float)Main.rand.Next(-10, 21);
xDist += (float)Main.rand.Next(-10, 21);
xDist += (float)(60 * (float)player.direction);
yDist -= 60f;
float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist));
float num21 = 18f;
if (playerDist < 160f)
Projectile.ai[0] = 0f;
if (playerDist < 100f && player.velocity.Y == 0f &&
@@ -204,52 +201,52 @@ namespace CalamityMod.Projectiles.Pets
{
Projectile.velocity *= 0.99f;
}
num16 = 0.01f;
flySpeed = 0.01f;
}
else
{
if (playerDist < 100f)
{
num16 = 0.1f;
flySpeed = 0.1f;
}
if (playerDist > 300f)
{
num16 = 1f;
flySpeed = 1f;
}
playerDist = num21 / playerDist;
playerDist = 18f / playerDist;
xDist *= playerDist;
yDist *= playerDist;
}
if (Projectile.velocity.X < xDist)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > xDist)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y < yDist)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > yDist)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
}
@@ -334,7 +331,7 @@ namespace CalamityMod.Projectiles.Pets
Pickup(); //pickup items
bool flag24 = false;
bool decelerate = false;
if (Projectile.ai[0] == 2f)
{
Projectile.ai[1] += 1f;
@@ -347,10 +344,10 @@ namespace CalamityMod.Projectiles.Pets
}
else
{
flag24 = true;
decelerate = true;
}
}
if (flag24)
if (decelerate)
{
return;
}
@@ -406,32 +403,31 @@ namespace CalamityMod.Projectiles.Pets
}
}
float num647 = 100f;
float separationAnxietyDist = 100f;
if (foundFood)
{
num647 = 200f;
separationAnxietyDist = 200f;
}
if (Vector2.Distance(player.Center, Projectile.Center) > num647)
if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist)
{
Projectile.ai[0] = 1f;
Projectile.netUpdate = true;
}
if (foundFood && Projectile.ai[0] == 0f)
{
Vector2 vector47 = targetLocation - Projectile.Center;
float num648 = vector47.Length();
vector47.Normalize();
if (num648 > 200f)
Vector2 targetDirection = targetLocation - Projectile.Center;
float targetDist = targetDirection.Length();
targetDirection.Normalize();
if (targetDist > 200f)
{
float scaleFactor2 = 18f;
vector47 *= scaleFactor2;
Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f;
targetDirection *= scaleFactor2;
Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f;
}
else
{
float num649 = 9f;
vector47 *= -num649;
Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f;
targetDirection *= -9f;
Projectile.velocity = (Projectile.velocity * 40f + targetDirection) / 41f;
}
}
else
@@ -455,9 +451,9 @@ namespace CalamityMod.Projectiles.Pets
if (Main.myPlayer == Projectile.owner)
{
Projectile.ai[0] = 2f;
Vector2 value20 = targetLocation - Projectile.Center;
value20.Normalize();
Projectile.velocity = value20 * 12f;
Vector2 targetDest = targetLocation - Projectile.Center;
targetDest.Normalize();
Projectile.velocity = targetDest * 12f;
Projectile.netUpdate = true;
}
}