public override void AI() { Player player = Main.player[projectile.owner]; if (player.whoAmI == Main.myPlayer) { mousePos = Main.MouseWorld; } PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { patronPlayer.PrimeMinion = false; } if (patronPlayer.PrimeMinion) { projectile.timeLeft = 2; } // projectile.alpha = 0; projectile.frameCounter++; if (projectile.frameCounter >= 7) { projectile.frameCounter = 0; projectile.frame = (projectile.frame + 1) % 7; Main.NewText(projectile.DirectionTo(mousePos).ToString()); } if (projectile.Distance(mousePos) > 50) { //projectile.velocity = projectile.DirectionTo(Main.MouseWorld) * 8; projectile.velocity = Vector2.Lerp(projectile.velocity, (projectile.DirectionTo(mousePos) * 10), 0.05f); } else if (projectile.Distance(mousePos) > 10) { projectile.velocity = Vector2.Zero; } // //projectile.velocity = Vector2.Lerp(projectile.velocity, (projectile.DirectionTo(mousePos) * 20), 0.05f); //projectile.alpha = (int)(Math.Cos(projectile.ai[0] * MathHelper.TwoPi / 180) * 122.5 + 122.5); // Main.NewText(projectile.DirectionTo(Main.MouseWorld).ToString()); /*projectile.ai[0]++; * if (projectile.ai[0] == 180) * { * * projectile.Center = Main.MouseWorld; * //projectile.velocity = projectile.DirectionTo(Main.MouseWorld) * 8; * projectile.netUpdate = true; * projectile.ai[0] = 0; * }*/ }
public override void CheckActive() { Player player = Main.player[projectile.owner]; PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { modPlayer.FishMinion = false; } if (modPlayer.FishMinion) { projectile.timeLeft = 2; } }
public override bool?UseItem(Player player) { PatreonPlayer patreonPlayer = player.GetModPlayer <PatreonPlayer>(); patreonPlayer.PiranhaPlantMode = !patreonPlayer.PiranhaPlantMode; FargoSoulsUtil.PrintLocalization(patreonPlayer.PiranhaPlantMode ? $"Mods.{Mod.Name}.Message.{Name}On" : $"Mods.{Mod.Name}.Message.{Name}Off", 175, 75, 255); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); //sync world } SoundEngine.PlaySound(SoundID.Roar, player.Center); return(true); }
public override void Update(Player player, ref int buffIndex) { PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.ownedProjectileCounts[ModContent.ProjectileType <PrimeMinionProj>()] > 0) { patronPlayer.PrimeMinion = true; } if (!patronPlayer.PrimeMinion) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override void Update(Player player, ref int buffIndex) { PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.ownedProjectileCounts[mod.ProjectileType("FishMinion")] > 0) { modPlayer.FishMinion = true; } if (!modPlayer.FishMinion) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override void AI() { Player player = Main.player[projectile.owner]; PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { modPlayer.DovePet = false; } if (modPlayer.DovePet) { projectile.timeLeft = 2; } /*int num113 = Dust.NewDust(new Vector2(projectile.Center.X - projectile.direction * (projectile.width / 2), projectile.Center.Y + projectile.height / 2), projectile.width, 6, 76, 0f, 0f, 0, default(Color), 1f); * Main.dust[num113].noGravity = true; * Main.dust[num113].velocity *= 0.3f; * Main.dust[num113].noLight = true;*/ }
public override bool UseItem(Player player) { PatreonPlayer patreonPlayer = player.GetModPlayer <PatreonPlayer>(); patreonPlayer.PiranhaPlantMode = !patreonPlayer.PiranhaPlantMode; string text = patreonPlayer.PiranhaPlantMode ? "The suffering continues." : "The suffering wanes."; if (Main.netMode == NetmodeID.SinglePlayer) { Main.NewText(text, 175, 75, 255); } else if (Main.netMode == NetmodeID.Server) { NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(text), new Color(175, 75, 255)); NetMessage.SendData(MessageID.WorldData); //sync world } Main.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 0); return(true); }
public override void AI() { Player player = Main.player[projectile.owner]; PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { patronPlayer.PrimeMinion = false; } if (patronPlayer.PrimeMinion) { projectile.timeLeft = 2; } // projectile.alpha = 0; projectile.frameCounter++; if (projectile.frameCounter >= 6) { projectile.frameCounter = 0; projectile.frame = (projectile.frame + 1) % 6; } Vector2 targetPos; bool spin = false; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1]); if (npc == null) { targetPos = player.Top - 32 * Vector2.UnitY; projectile.direction = projectile.spriteDirection = player.direction; if (projectile.Distance(targetPos) > 1200) { projectile.Center = player.Center; } if (++projectile.localAI[0] > 10) { projectile.localAI[0] = 0; projectile.ai[1] = FargoSoulsUtil.FindClosestHostileNPCPrioritizingMinionFocus(projectile, 800f, true, player.Center); projectile.netUpdate = true; } } else { if (++projectile.ai[0] > 360) { spin = true; } if (projectile.ai[0] > 540) { projectile.ai[0] = 0; projectile.netUpdate = true; } targetPos = spin ? npc.Center : npc.Top - 32 * Vector2.UnitY; if (!spin) { projectile.direction = projectile.spriteDirection = Math.Sign(npc.Center.X - projectile.Center.X); } NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; if (minionAttackTargetNpc != null && projectile.ai[1] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(projectile)) { projectile.ai[1] = minionAttackTargetNpc.whoAmI; projectile.netUpdate = true; } if (!npc.CanBeChasedBy() || player.Distance(npc.Center) > 1200) { projectile.ai[1] = -1; projectile.netUpdate = true; } } if (projectile.Distance(targetPos) > 16 || spin) { float speed = npc == null ? 12f : 16f; float lerp = 0.03f; lerp += 0.03f * Math.Min(1f, projectile.localAI[1] / 300f); //gradually gets better tracking until it gets in range if (spin) { speed *= 1.5f; lerp *= 2f; } projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(targetPos) * speed, lerp); } else { projectile.velocity *= 0.99f; projectile.localAI[1] = 0; } if (spin) { projectile.rotation += MathHelper.TwoPi / 20f; projectile.direction = projectile.spriteDirection = 1; } else { projectile.rotation = 0; } // //projectile.velocity = Vector2.Lerp(projectile.velocity, (projectile.DirectionTo(mousePos) * 20), 0.05f); //projectile.alpha = (int)(Math.Cos(projectile.ai[0] * MathHelper.TwoPi / 180) * 122.5 + 122.5); // Main.NewText(projectile.DirectionTo(Main.MouseWorld).ToString()); /*projectile.ai[0]++; * if (projectile.ai[0] == 180) * { * * projectile.Center = Main.MouseWorld; * //projectile.velocity = projectile.DirectionTo(Main.MouseWorld) * 8; * projectile.netUpdate = true; * projectile.ai[0] = 0; * }*/ }
public override void AI() { Player player = Main.player[projectile.owner]; PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { patronPlayer.PrimeMinion = false; } if (patronPlayer.PrimeMinion) { projectile.timeLeft = 2; } int head = -1; for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].type == ModContent.ProjectileType <PrimeMinionProj>() && Main.projectile[i].active && Main.projectile[i].owner == projectile.owner) { head = i; } } if (head == -1) { if (projectile.owner == Main.myPlayer) { projectile.Kill(); } } else { for (int index = 0; index < 1000; ++index) { if (index != projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == projectile.owner && Main.projectile[index].type == projectile.type) && (double)Math.Abs((float)(projectile.position.X - Main.projectile[index].position.X)) + (double)Math.Abs((float)(projectile.position.Y - Main.projectile[index].position.Y)) < (double)projectile.width) { if (projectile.position.X < Main.projectile[index].position.X) { projectile.velocity.X -= 0.2f; } else { projectile.velocity.X += 0.2f; } if (projectile.position.Y < Main.projectile[index].position.Y) { projectile.velocity.Y -= 0.2f; } else { projectile.velocity.Y += 0.2f; } } } bool targetting = false; NPC targetnpc = null; NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false)) { Vector2 distancetotarget = minionAttackTargetNpc.Center - projectile.Center; Vector2 headtoTarget = minionAttackTargetNpc.Center - Main.projectile[head].Center; if (distancetotarget.Length() < 1000 && headtoTarget.Length() < 300) { targetnpc = minionAttackTargetNpc; targetting = true; } } else if (!targetting) { float distancemax = 1000; for (int index = 0; index < 200; ++index) { if (Main.npc[index].CanBeChasedBy((object)this, false)) { Vector2 distancetotarget = Main.npc[index].Center - projectile.Center; Vector2 headtotarget = Main.npc[index].Center - Main.projectile[head].Center; if (distancetotarget.Length() < distancemax && headtotarget.Length() < 300) { distancemax = distancetotarget.Length(); targetnpc = Main.npc[index]; targetting = true; } } } } if (targetting) { projectile.direction = projectile.spriteDirection = Math.Sign(targetnpc.Center.X - projectile.Center.X); float movespeed = Math.Max(projectile.Distance(targetnpc.Center) / 40f, 18f); if (projectile.Distance(targetnpc.Center) > 32) { projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(targetnpc.Center) * movespeed, 0.05f); } } else { projectile.direction = projectile.spriteDirection = Main.projectile[head].spriteDirection; float movespeed = Math.Max(projectile.Distance(Main.projectile[head].Center) / 40f, 14f); if (projectile.Distance(Main.projectile[head].Center) > 32) { projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(Main.projectile[head].Center) * movespeed, 0.04f); } } projectile.position += Main.projectile[head].velocity * 0.8f; } }
public override void UpdateAccessory(Player player, bool hideVisual) { PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); modPlayer.CompOrb = true; }
public override void AI() { Player player = Main.player[projectile.owner]; PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); if (!player.active || player.dead || player.ghost) { modPlayer.Crimetroid = false; } if (modPlayer.Crimetroid) { projectile.timeLeft = 2; } if (++projectile.frameCounter > 6) { projectile.frameCounter = 0; if (++projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } } float dist = projectile.Distance(player.Top); if (dist > 400) { projectile.tileCollide = false; } if (dist > 2000) { projectile.Center = player.Center; } Vector2 focus = player.Top; if (dist < 60) { projectile.localAI[0] = 0; focus = projectile.Center + projectile.velocity; if (focus == projectile.Center) { focus.Y -= 1; } if (!projectile.tileCollide) { projectile.tileCollide = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, player.position, player.width, player.height); } } else if (projectile.localAI[0] == 0) { projectile.localAI[0] = MathHelper.ToRadians(Main.rand.NextFloat(45)); if (Main.rand.NextBool()) { projectile.localAI[0] *= -1; } } projectile.localAI[0] *= 0.99f; float maxSpeed = 8f; if (projectile.localAI[1] > 0) { projectile.localAI[1]--; maxSpeed *= 0.5f; } if (!player.velocity.HasNaNs() && player.velocity != Vector2.Zero) { maxSpeed += player.velocity.Length() / 2; } Vector2 change = projectile.DirectionTo(focus) * maxSpeed; if (projectile.localAI[0] != 0) { change = change.RotatedBy(projectile.localAI[0]); } const float increment = 22; projectile.velocity = (projectile.velocity * (increment - 1) + change) / increment; projectile.rotation = projectile.velocity.X * .05f; if (Math.Abs(projectile.rotation) > MathHelper.ToRadians(75)) { projectile.rotation = MathHelper.ToRadians(75) * Math.Sign(projectile.rotation); } }
public override void AI() { Player player = Main.player[Projectile.owner]; PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { patronPlayer.PrimeMinion = false; } if (patronPlayer.PrimeMinion) { Projectile.timeLeft = 2; } int head = -1; for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].type == ModContent.ProjectileType <PrimeMinionProj>() && Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner) { head = i; } } if (head == -1) { if (Projectile.owner == Main.myPlayer) { Projectile.Kill(); } } else { for (int index = 0; index < 1000; ++index) { if (index != Projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == Projectile.owner && Main.projectile[index].type == Projectile.type) && (double)Math.Abs((float)(Projectile.position.X - Main.projectile[index].position.X)) + (double)Math.Abs((float)(Projectile.position.Y - Main.projectile[index].position.Y)) < (double)Projectile.width) { if (Projectile.position.X < Main.projectile[index].position.X) { Projectile.velocity.X -= 0.2f; } else { Projectile.velocity.X += 0.2f; } if (Projectile.position.Y < Main.projectile[index].position.Y) { Projectile.velocity.Y -= 0.2f; } else { Projectile.velocity.Y += 0.2f; } } } bool targetting = false; NPC targetnpc = null; NPC minionAttackTargetNpc = Projectile.OwnerMinionAttackTargetNPC; if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false)) { Vector2 distancetotarget = minionAttackTargetNpc.Center - Projectile.Center; Vector2 headtoTarget = minionAttackTargetNpc.Center - Main.projectile[head].Center; if (distancetotarget.Length() < 1000 && headtoTarget.Length() < 400) { targetnpc = minionAttackTargetNpc; targetting = true; } } else if (!targetting) { float distancemax = 1000; for (int index = 0; index < 200; ++index) { if (Main.npc[index].CanBeChasedBy((object)this, false)) { Vector2 distancetotarget = Main.npc[index].Center - Projectile.Center; Vector2 headtotarget = Main.npc[index].Center - Main.projectile[head].Center; if (distancetotarget.Length() < distancemax && headtotarget.Length() < 400) { distancemax = distancetotarget.Length(); targetnpc = Main.npc[index]; targetting = true; } } } } float movespeed = Math.Max(Projectile.Distance(Main.projectile[head].Center) / 40f, 14f); if (Projectile.Distance(Main.projectile[head].Center) > 64) { Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(Main.projectile[head].Center) * movespeed, 0.04f); } Projectile.rotation = 0; Projectile.direction = Projectile.spriteDirection = Main.projectile[head].spriteDirection; if (targetting) { Projectile.rotation = Projectile.DirectionTo(targetnpc.Center).ToRotation(); Projectile.direction = Projectile.spriteDirection = 1; if (++Projectile.localAI[0] > 22) { Projectile.localAI[0] = -Main.rand.Next(20); if (Projectile.owner == Main.myPlayer) { int p = FargoSoulsUtil.NewSummonProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 10f * Projectile.DirectionTo(targetnpc.Center), ProjectileID.MiniRetinaLaser, Projectile.originalDamage, Projectile.knockBack, Projectile.owner); if (p != Main.maxProjectiles) { Main.projectile[p].usesIDStaticNPCImmunity = false; Main.projectile[p].usesLocalNPCImmunity = false; } } } } Projectile.position += Main.projectile[head].velocity * 0.8f; } }
public override void AI() { Player player = Main.player[Projectile.owner]; PatreonPlayer modPlayer = player.GetModPlayer <PatreonPlayer>(); if (!player.active || player.dead || player.ghost) { modPlayer.ChibiiRemii = false; } if (modPlayer.ChibiiRemii) { Projectile.timeLeft = 2; } const int sitTime = 600; const int sitFrame = 6; const int firstFlyFrame = 7; if (Projectile.tileCollide) //walking { //wavedash away if too close but not if sitting if (player.velocity.X == 0 && System.Math.Abs(player.Bottom.Y - Projectile.Bottom.Y) < 16 * 2 && System.Math.Abs(player.Center.X - Projectile.Center.X) < 16 * (Projectile.velocity.X == 0 ? 1 : 3) && sitTimer < sitTime) { Projectile.velocity.X += 0.1f * System.Math.Sign(Projectile.Center.X - player.Center.X); } //faster if (!Collision.SolidCollision(Projectile.position + Projectile.velocity.X * Vector2.UnitX, Projectile.width, Projectile.height)) { Projectile.position.X += Projectile.velocity.X; } //high jump //if (Projectile.velocity.Y < 0) Projectile.position.Y += Projectile.velocity.Y; //animation bool relativelyStillVertically = Projectile.velocity.Y >= 0 && Projectile.velocity.Y <= 0.8f; if (relativelyStillVertically) { if (System.Math.Abs(Projectile.velocity.X) < 1f) { realFrameCounter = 0; realFrame = 1; } else { realFrameCounter += System.Math.Abs(Projectile.velocity.X); if (++realFrameCounter > 8) { realFrameCounter = 0; realFrame += 1; } } if (realFrame >= sitFrame) { realFrame = 0; } } else { realFrame = 1; } if (Projectile.velocity.X == 0) { realFrame = relativelyStillVertically ? 0 : 1; realFrameCounter = 0; if (!relativelyStillVertically) { sitTimer = 0; } if (sitTimer >= 600) { realFrame = sitFrame; if (sitTimer == 600 && squeak) { squeak = false; if (!Main.dedServ) { SoundEngine.PlaySound(new SoundStyle($"FargowiltasSouls/Sounds/SqueakyToy/squeak{Main.rand.Next(1, 7)}"), Projectile.Center); } } } else { sitTimer += 1; //face player when standing idle Projectile.direction = Math.Sign(player.Center.X - Projectile.Center.X); //dont squeak if player moves at all if (player.velocity.X != 0 || Math.Abs(player.velocity.Y) > 0.5f) { squeak = false; } } } else { sitTimer = 0; squeak = true; } if (realFrame > sitFrame) { realFrame = 0; } } else //flying { Projectile.Center += Projectile.velocity; if (++realFrameCounter > 3) { realFrameCounter = 0; realFrame++; } if (realFrame < firstFlyFrame || realFrame >= Main.projFrames[Projectile.type]) { realFrame = firstFlyFrame; } } //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X == 0 ? player.Center.X - Projectile.Center.X : Projectile.velocity.X); }
public override void AI() { Player player = Main.player[Projectile.owner]; PatreonPlayer patronPlayer = player.GetModPlayer <PatreonPlayer>(); if (player.dead) { patronPlayer.PrimeMinion = false; } if (patronPlayer.PrimeMinion) { Projectile.timeLeft = 2; } // Projectile.alpha = 0; bool foundLimbs = false; int[] limbs = new int[] { ModContent.ProjectileType <PrimeMinionCannon>(), ModContent.ProjectileType <PrimeMinionLaserGun>(), ModContent.ProjectileType <PrimeMinionSaw>(), ModContent.ProjectileType <PrimeMinionVice>() }; for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && limbs.Contains(Main.projectile[i].type)) { foundLimbs = true; break; } } if (!foundLimbs && Projectile.owner == Main.myPlayer) { Projectile.Kill(); } Projectile.frameCounter++; if (Projectile.frameCounter >= 6) { Projectile.frameCounter = 0; Projectile.frame = (Projectile.frame + 1) % 6; } Vector2 targetPos; bool spin = false; NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[1]); if (npc == null) { targetPos = player.Top - 32 * Vector2.UnitY; Projectile.direction = Projectile.spriteDirection = player.direction; if (Projectile.Distance(targetPos) > 1200) { Projectile.Center = player.Center; } if (++Projectile.localAI[0] > 10) { Projectile.localAI[0] = 0; Projectile.ai[1] = FargoSoulsUtil.FindClosestHostileNPCPrioritizingMinionFocus(Projectile, 800f, true, player.Center); Projectile.netUpdate = true; } } else { if (++Projectile.ai[0] > 360) { spin = true; } if (Projectile.ai[0] > 540) { Projectile.ai[0] = 0; Projectile.netUpdate = true; } targetPos = spin ? npc.Center : npc.Top - 32 * Vector2.UnitY; if (!spin) { Projectile.direction = Projectile.spriteDirection = Math.Sign(npc.Center.X - Projectile.Center.X); } NPC minionAttackTargetNpc = Projectile.OwnerMinionAttackTargetNPC; if (minionAttackTargetNpc != null && Projectile.ai[1] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy()) { Projectile.ai[1] = minionAttackTargetNpc.whoAmI; Projectile.netUpdate = true; } if (!npc.CanBeChasedBy() || player.Distance(npc.Center) > 1200) { Projectile.ai[1] = -1; Projectile.netUpdate = true; } } if (Projectile.Distance(targetPos) > 16 || spin) { float speed = npc == null ? 12f : 16f; float lerp = 0.03f; lerp += 0.03f * Math.Min(1f, Projectile.localAI[1] / 300f); //gradually gets better tracking until it gets in range if (spin) { speed *= 1.5f; lerp *= 2f; } Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(targetPos) * speed, lerp); } else { Projectile.velocity *= 0.99f; Projectile.localAI[1] = 0; } if (spin) { Projectile.rotation += MathHelper.TwoPi / 20f; Projectile.direction = Projectile.spriteDirection = 1; } else { Projectile.rotation = 0; } // //Projectile.velocity = Vector2.Lerp(Projectile.velocity, (Projectile.DirectionTo(mousePos) * 20), 0.05f); //Projectile.alpha = (int)(Math.Cos(Projectile.ai[0] * MathHelper.TwoPi / 180) * 122.5 + 122.5); // Main.NewText(Projectile.DirectionTo(Main.MouseWorld).ToString()); /*Projectile.ai[0]++; * if (Projectile.ai[0] == 180) * { * * Projectile.Center = Main.MouseWorld; * //Projectile.velocity = Projectile.DirectionTo(Main.MouseWorld) * 8; * Projectile.netUpdate = true; * Projectile.ai[0] = 0; * }*/ }