public void DrawSword(bool gloop = false) { GetRotation(out float realRot, out SpriteEffects effect); if (gloop) { Main.spriteBatch.Draw(SwordExtra, (npc.Center - Main.screenPosition) / 2f, npc.frame, Color.White, realRot, npc.frame.Size() / 2f, 1 / 2f, effect, 0f); } else { Color col = Lighting.GetColor((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f)); Main.spriteBatch.Draw(SwordExtra, npc.Center - Main.screenPosition, npc.frame, StarjinxGlobalNPC.GetColorBrightness(col), realRot, npc.frame.Size() / 2f, 1f, effect, 0f); } }
public override Color?GetAlpha(Color drawColor) => StarjinxGlobalNPC.GetColorBrightness(drawColor);
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { if (!inFG) //if not in foreground stop drawing { return(false); } GetRotation(out float realRot, out SpriteEffects effect); Color col = Lighting.GetColor((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f)); spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition, npc.frame, StarjinxGlobalNPC.GetColorBrightness(col), realRot, npc.frame.Size() / 2f, 1f, effect, 0f); if (enchantment != Enchantment.Void) { DrawSword(); } return(false); }
public override void AI() { Player player = Main.player[npc.target]; //npc.TargetClosest(true); StarjinxGlobalNPC.TargetClosestSjinx(npc, true); npc.spriteDirection = npc.direction; bool empowered = npc.GetGlobalNPC <PathfinderGNPC>().Buffed; if (++AiTimer < IDLETIME) { _attackGlowStrength = MathHelper.Lerp(_attackGlowStrength, 0f, 0.1f); _attackGlowColor = Color.Lerp(_attackGlowColor, Color.Transparent, 0.1f); Vector2 homeCenter = player.Center; //Dont go to players outside of the sjinx range if (player.DistanceSQ(player.GetModPlayer <StarjinxPlayer>().StarjinxPosition) > StarjinxMeteorite.EVENT_RADIUS * StarjinxMeteorite.EVENT_RADIUS) { npc.velocity *= 0.98f; StarjinxGlobalNPC.TargetClosestSjinx(npc, false); } else { float extraSpeed = empowered ? 1.2f : 1f; npc.rotation = npc.velocity.X * .035f; switch (Pattern[(int)AttackType]) { case (int)Attacks.MortarComets: homeCenter.Y -= 300; npc.AccelFlyingMovement(homeCenter, new Vector2(0.2f, 0.15f), new Vector2(0.07f, 0.1f), new Vector2(5, 3)); break; default: homeCenter.Y -= 50; npc.AccelFlyingMovement(homeCenter, new Vector2(0.15f, 0.1f), new Vector2(0.07f, 0.1f), new Vector2(2, 1)); break; } } } if (AiTimer == IDLETIME && Main.netMode != NetmodeID.Server) { Main.PlaySound(new LegacySoundStyle(SoundID.Item, 123).WithPitchVariance(0.2f).WithVolume(1.3f), npc.Center); } if (AiTimer > IDLETIME) { AttackDict[Pattern[(int)AttackType]].Invoke(Main.player[npc.target], npc); npc.rotation = 0f; } else { UpdateYFrame(10, 0, 4); frame.X = 0; } npc.localAI[0] = Math.Max(npc.localAI[0] - 0.05f, 0); }