Skip to content

Commit

Permalink
update bestiary icon, fix regression in dungeon soul NPC animation, r…
Browse files Browse the repository at this point in the history
…emove images from csproj
  • Loading branch information
direwolf420 committed May 30, 2021
1 parent 7a3d8c7 commit 194367e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
3 changes: 3 additions & 0 deletions AssortedCrazyThings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="**\*.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.*" />
</ItemGroup>
Expand Down
29 changes: 14 additions & 15 deletions NPCs/DungeonBird/DungeonSoulBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override void SetDefaults()
//adjust stats here to match harvester hitbox 1:1, then do findframes in postdraw
NPC.width = wid; //42 //16
NPC.height = hei; //52 //24
NPC.npcSlots = 0f; //takes 1/10 npc slots out of 200 when alive
NPC.npcSlots = 0f;
NPC.chaseable = false;
NPC.dontCountMe = true;
NPC.dontTakeDamageFromHostiles = true;
Expand Down Expand Up @@ -140,7 +140,7 @@ public override void FindFrame(int frameHeight)
{
NPC.frame.Y += frameHeight;
NPC.frameCounter = 0;
if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight)
if (NPC.frame.Y >= 3 * frameHeight)
{
NPC.frame.Y = 0;
}
Expand Down Expand Up @@ -247,15 +247,20 @@ public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)

public override void AI()
{
NPC.scale = 1f;
Entity tar = GetTarget();
NPC tarnpc = new NPC();
if (tar is NPC)
--NPC.timeLeft;
if (NPC.timeLeft < 0)
{
tarnpc = (NPC)tar;
KillInstantly(NPC);
}

NPC.noTileCollide = false;
NPC.scale = 1f;

Entity tar = GetTarget();
if (!(tar is NPC tarnpc))
{
return;
}

if (AI_State == 0)
{
Expand Down Expand Up @@ -306,11 +311,11 @@ public override void AI()
if (AI_State == 1 && NPC.velocity.Y != 0)
{
float betweenX = tarnpc.Center.X - NPC.Center.X;
if (betweenX > 2f || betweenX < -2f)
if ((betweenX > 2f || betweenX < -2f) && betweenX != 0f)
{
float factor = 4f; //2f
int acc = 4; //4
betweenX = betweenX / Math.Abs(betweenX);
betweenX /= Math.Abs(betweenX);
betweenX *= factor;
NPC.velocity.X = (NPC.velocity.X * (acc - 1) + betweenX) / acc;
NPC.noTileCollide = false;
Expand All @@ -325,12 +330,6 @@ public override void AI()
{
NPC.velocity.X = 0;
}

--NPC.timeLeft;
if (NPC.timeLeft < 0)
{
KillInstantly(NPC);
}
}
}

Expand Down
Binary file modified icon_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 194367e

Please sign in to comment.