public override void AI() { if (++projectile.localAI[0] == 0) { for (int index1 = 0; index1 < 30; ++index1) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(), 2f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 5f; } } Lighting.AddLight(projectile.Center, 0.1f, 0.4f, 0.2f); projectile.scale = (Main.mouseTextColor / 200f - 0.35f) * 0.2f + 0.95f; projectile.scale *= 2.5f; int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantMark2>()); if (byUUID != -1) { Vector2 offset = new Vector2(100, 0).RotatedBy(projectile.ai[1]); projectile.Center = Main.projectile[byUUID].Center + offset; projectile.localAI[1] = Math.Max(0, 150 - Main.projectile[byUUID].ai[1]) / 150; //rampup projectile.ai[1] += 0.15f * projectile.localAI[1]; if (projectile.localAI[1] > 1f) //clamp it for use in draw { projectile.localAI[1] = 1f; } } projectile.rotation = projectile.ai[1] + (float)Math.PI / 2f; }
public override void Kill(int timeLeft) { Player player = Main.player[projectile.owner]; if (player.slotsMinions + projectile.minionSlots > player.maxMinions && projectile.owner == Main.myPlayer) { int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], projectile.type, ModContent.ProjectileType <EaterHead>()); if (byUUID != -1) { Projectile projectile1 = Main.projectile[byUUID]; if (projectile1.type != mod.ProjectileType("EaterHead")) { projectile1.localAI[1] = projectile.localAI[1]; } int byUUID2 = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.localAI[1], projectile.type, ModContent.ProjectileType <EaterHead>()); if (byUUID2 != -1) { projectile1 = Main.projectile[byUUID2]; projectile1.ai[0] = projectile.ai[0]; projectile1.ai[1] = 1f; projectile1.netUpdate = true; } } } }
public override void AI() { //dust! int dustId = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; Player projOwner = Main.player[projectile.owner]; Vector2 ownerMountedCenter = projOwner.RotatedRelativePoint(projOwner.MountedCenter); projectile.direction = projOwner.direction; projOwner.heldProj = projectile.whoAmI; projOwner.itemTime = projOwner.itemAnimation; projectile.Center = ownerMountedCenter; if (projOwner.itemAnimation == 0) { projectile.Kill(); } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { projectile.rotation -= MathHelper.ToRadians(90f); } scaletimer++; if (projectile.localAI[0] == 0) { projectile.localAI[0] = projectile.damage; } projectile.damage = (int)projectile.localAI[0]; int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <Dash>()); if (byUUID != -1) { if (Main.projectile[byUUID].localAI[0] != 0) //if dash has slowed down for some reason, do less damage { projectile.damage /= 2; projectile.localAI[1] = 1; } } }
public override void AI() { //the important part int ai1 = (int)projectile.ai[1]; int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, ai1, ModContent.ProjectileType <SparklingDevi>()); if (byUUID != -1) { Projectile devi = Main.projectile[byUUID]; if (projectile.timeLeft > 15) { Vector2 offset = new Vector2(0, -360).RotatedBy(Math.PI / 4 * devi.spriteDirection); projectile.Center = devi.Center + offset; projectile.rotation = (float)Math.PI / 4 * devi.spriteDirection - (float)Math.PI / 4; } else //swinging down { if (projectile.timeLeft == 15) //confirm facing the right direction with right offset { projectile.rotation = (float)Math.PI / 4 * devi.spriteDirection - (float)Math.PI / 4; } projectile.rotation -= (float)Math.PI / 15 * devi.spriteDirection * 0.75f; Vector2 offset = new Vector2(0, -360).RotatedBy(projectile.rotation + (float)Math.PI / 4); projectile.Center = devi.Center + offset; } projectile.spriteDirection = -devi.spriteDirection; projectile.localAI[1] = devi.velocity.ToRotation(); if (projectile.localAI[0] == 0) { projectile.localAI[0] = 1; if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <GlowRing>(), 0, 0f, Main.myPlayer, -1, -14); } Main.PlaySound(SoundID.Item92, projectile.Center); MakeDust(); } } else if (projectile.owner == Main.myPlayer && projectile.timeLeft < 60) { projectile.Kill(); return; } }
public override void AI() { int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.localAI[0], ModContent.ProjectileType <BlenderYoyoProj>()); if (byUUID == -1) { if (projectile.owner == Main.myPlayer && projectile.rotation > 0) { projectile.Kill(); return; } } else { Projectile proj = Main.projectile[byUUID]; //rotation mumbo jumbo float distanceFromPlayer = 150 + 150 * (1 - (float)Math.Cos(projectile.localAI[1])); // + projectile.ai[0] * 32; projectile.position = proj.Center + new Vector2(distanceFromPlayer, 0f).RotatedBy(projectile.ai[1]); projectile.position.X -= projectile.width / 2; projectile.position.Y -= projectile.height / 2; float rotation = MathHelper.Pi / 20 / projectile.MaxUpdates * 0.75f; projectile.ai[1] += rotation; if (projectile.ai[1] > MathHelper.Pi) { projectile.ai[1] -= MathHelper.TwoPi; projectile.netUpdate = true; } projectile.localAI[1] += MathHelper.TwoPi / 120 / projectile.MaxUpdates; // * (0.5f + 1.5f * projectile.ai[0] / 5); if (projectile.localAI[1] > MathHelper.Pi) { projectile.localAI[1] -= MathHelper.TwoPi; } projectile.damage = (int)(proj.damage * 0.5); projectile.knockBack = proj.knockBack; } projectile.timeLeft++; projectile.rotation += 0.25f / projectile.MaxUpdates; if (soundtimer > 0) { soundtimer--; } }
public override void AI() { int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantTrueEyeR>()); if (byUUID != -1) { if (projectile.timeLeft > 295) { if (Main.projectile[byUUID].ai[1] == 0f) //stop following true eye if true eye lost target & isn't preparing to charge { projectile.ai[0] = -1f; projectile.velocity = Vector2.Zero; projectile.netUpdate = true; } else { projectile.velocity = Main.projectile[byUUID].velocity; } } } if (projectile.alpha > 200) { projectile.alpha = 200; } projectile.alpha -= 5; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.scale = 1f - projectile.alpha / 255f; projectile.frameCounter++; if (projectile.frameCounter >= 6) { projectile.frameCounter = 0; projectile.frame++; if (projectile.frame > 1) { projectile.frame = 0; } } }
public override void AI() { if (++projectile.localAI[0] == 0) { for (int index1 = 0; index1 < 30; ++index1) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool() ? 107 : 157, 0f, 0f, 0, new Color(), 2f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 5f; } } Lighting.AddLight(projectile.Center, 0.1f, 0.4f, 0.2f); projectile.scale = (Main.mouseTextColor / 200f - 0.35f) * 0.2f + 0.95f; projectile.scale *= 1.5f; int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantBoss.MutantMark2>()); if (byUUID != -1) { Vector2 offset = new Vector2(100, 0).RotatedBy(projectile.ai[1]); projectile.Center = Main.projectile[byUUID].Center + offset; projectile.localAI[1] = Math.Max(0, 150 - Main.projectile[byUUID].ai[1]) / 150; //rampup if (projectile.localAI[1] > 1f) //clamp it for use in draw { projectile.localAI[1] = 1f; } projectile.ai[1] += 0.15f * projectile.localAI[1]; } projectile.rotation = projectile.ai[1] + (float)Math.PI / 2f; if (projectile.localAI[0] > 20) { projectile.localAI[0] = 1; NPC plantera = FargoSoulsUtil.NPCExists(NPC.plantBoss, NPCID.Plantera); if (plantera != null && projectile.Distance(plantera.Center) < 1600f && Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(projectile.Center, 4f * projectile.ai[1].ToRotationVector2(), ModContent.ProjectileType <CrystalLeafShot>(), projectile.damage, projectile.knockBack, projectile.owner); } } }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[1], ModContent.ProjectileType <Retiglaive>()); if (byUUID != -1) { projectile.Center = Main.projectile[byUUID].Center; } else { if (projectile.owner == Main.myPlayer && projectile.localAI[0] > 5) { projectile.Kill(); return; } } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.localAI[0] == 0f) { if (!Main.dedServ) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Zombie_104").WithVolume(0.3f), projectile.Center); } } float num801 = .3f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 3f * num801; if (projectile.scale > num801) { projectile.scale = num801; } float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2000f, array3); //for (int i = 0; i < array3.Length; i++) array3[i] = projectile.localAI[0] * projectile.ai[1]; float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[1], ModContent.ProjectileType <StyxGazer>(), ModContent.ProjectileType <StyxGazerArmor>()); if (byUUID != -1) { projectile.Center = Main.projectile[byUUID].Center; projectile.position += Main.projectile[byUUID].velocity * 75; projectile.velocity = Main.projectile[byUUID].velocity.RotatedBy(projectile.ai[0]); } else if (projectile.owner == Main.myPlayer && projectile.localAI[0] > 5) { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } //if (projectile.localAI[0] == 0f) //{ // Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 0.6f, 0f); //} float num801 = 1f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * num801 * 6f; if (projectile.scale > num801) { projectile.scale = num801; } float num804 = projectile.velocity.ToRotation(); /*if (Main.npc[ai1].velocity != Vector2.Zero) * num804 += projectile.ai[0];*/ projectile.rotation = num804 - 1.57079637f; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; //Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); for (int i = 0; i < array3.Length; i++) { array3[i] = 100f; } float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); if (Main.rand.NextBool()) { int d = Dust.NewDust(projectile.position + projectile.velocity * Main.rand.NextFloat(100), projectile.width, projectile.height, 87, 0f, 0f, 0, default(Color), 1.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 4f; } }
public override void AI() { Player player = Main.player[projectile.owner]; if (!Main.dedServ && Main.LocalPlayer.active) { Main.LocalPlayer.GetModPlayer <FargoPlayer>().Screenshake = 2; } Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[1], ModContent.ProjectileType <HentaiSpearWand>()); if (byUUID != -1) { projectile.timeLeft = 2; float itemrotate = player.direction < 0 ? MathHelper.Pi : 0; if (Math.Abs(player.itemRotation) > Math.PI / 2) { itemrotate = itemrotate == 0 ? MathHelper.Pi : 0; } projectile.velocity = (player.itemRotation + itemrotate).ToRotationVector2(); projectile.Center = player.Center + Main.rand.NextVector2Circular(5, 5); projectile.position += projectile.velocity * 164 * 1.3f / 4f; //offset by part of spear's length (wand) projectile.position += projectile.velocity * 164 * 1.3f * 0.75f; //part of penetrator's length (ray) projectile.damage = player.GetWeaponDamage(player.HeldItem); projectile.knockBack = player.GetWeaponKnockback(player.HeldItem, player.HeldItem.knockBack); /*projectile.Center = Main.projectile[player.heldProj].Center + Main.rand.NextVector2Circular(5, 5); * projectile.timeLeft = 2; * * projectile.velocity = Vector2.Normalize(Main.projectile[player.heldProj].velocity); * projectile.position += projectile.velocity * 164 * 1.3f * 0.75f; //part of penetrator's length * * projectile.damage = Main.projectile[player.heldProj].damage; * projectile.knockBack = Main.projectile[player.heldProj].knockBack;*/ } else if (projectile.localAI[0] > 5) //leeway for mp lag { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.localAI[0] == 0f) { if (!Main.dedServ) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Zombie_104"), projectile.Center); } } float num801 = 10f; if (projectile.localAI[0] == maxTime / 2) { if (projectile.owner == Main.myPlayer && !(player.controlUseTile && player.altFunctionUse == 2 && player.HeldItem.type == mod.ItemType("HentaiSpear"))) { projectile.localAI[0] += 1f; //if stop firing, proceed to die } else { projectile.localAI[0] -= 1f; //otherwise, stay (also for multiplayer!) } } else { projectile.localAI[0] += 1f; } if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } //projectile.scale = num801; projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 1.5f * num801; if (projectile.scale > num801) { projectile.scale = num801; } //float num804 = projectile.velocity.ToRotation(); //num804 += projectile.ai[0]; //projectile.rotation = num804 - 1.57079637f; //float num804 = Main.npc[(int)projectile.ai[1]].ai[3] - 1.57079637f; //if (projectile.ai[0] != 0f) num804 -= (float)Math.PI; //projectile.rotation = num804; //num804 += 1.57079637f; //projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; //Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); for (int i = 0; i < array3.Length; i++) { array3[i] = 3000f; } float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); /*Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); * for (int num809 = 0; num809 < 2; num809 = num3 + 1) * { * float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; * float num811 = (float)Main.rand.NextDouble() * 2f + 2f; * Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); * int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); * Main.dust[num812].noGravity = true; * Main.dust[num812].scale = 1.7f; * num3 = num809; * } * if (Main.rand.NextBool(5)) * { * Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; * int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); * Dust dust = Main.dust[num813]; * dust.velocity *= 0.5f; * Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); * }*/ //DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); //Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; if (++dustTimer > 30) { dustTimer = 0; const int max = 7; for (int i = 0; i < max; i++) { const int ring = 128; Vector2 offset = projectile.velocity * 3000 / max * (i - 0.5f);// (i + (float)dustTimer / 60); for (int index1 = 0; index1 < ring; ++index1) { Vector2 vector2 = (Vector2.UnitX * -projectile.width / 2f + -Vector2.UnitY.RotatedBy(index1 * 3.14159274101257 * 2 / ring) * new Vector2(8f, 16f)).RotatedBy(projectile.rotation - 1.57079637050629); int index2 = Dust.NewDust(projectile.Center, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[index2].scale = 3f; Main.dust[index2].noGravity = true; Main.dust[index2].position = projectile.Center + offset; //Main.dust[index2].velocity = Vector2.Zero; Main.dust[index2].velocity = 5f * Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[index2].position); Main.dust[index2].velocity += 5f * projectile.velocity; Main.dust[index2].velocity += vector2 * 1.5f; } } } if (++projectile.ai[0] > 60) { projectile.ai[0] = 0; Main.PlaySound(SoundID.Item84, player.Center); if (projectile.owner == Main.myPlayer) { const int ringMax = 10; const float speed = 12f; const float rotation = 0.5f; for (int i = 0; i < ringMax; i++) { Vector2 vel = speed * projectile.velocity.RotatedBy(2 * Math.PI / ringMax * i); Projectile.NewProjectile(player.Center, vel, ModContent.ProjectileType <HentaiSphereRing>(), projectile.damage, projectile.knockBack, projectile.owner, rotation, speed); Projectile.NewProjectile(player.Center, vel, ModContent.ProjectileType <HentaiSphereRing>(), projectile.damage, projectile.knockBack, projectile.owner, -rotation, speed); } } } if (++projectile.frameCounter > 3) { if (++projectile.frame > 15) { projectile.frame = 0; } switch (projectile.frame) { case 1: case 3: case 9: case 11: projectile.frameCounter = 2; break; default: projectile.frameCounter = 0; break; } } }
public override void AI() { int maxTime = 60; float alphaModifier = 3; switch ((int)projectile.ai[0]) { case 0: //abom flaming scythe telegraph, sticks to abom and follows his line of sight to player w/ offset { color = Color.Yellow; maxTime = 30; alphaModifier = 10; NPC abom = FargoSoulsUtil.NPCExists(projectile.localAI[1], ModContent.NPCType <NPCs.AbomBoss.AbomBoss>()); if (abom != null) { projectile.Center = abom.Center; projectile.rotation = abom.DirectionTo(Main.player[abom.target].Center).ToRotation() + projectile.ai[1]; } } break; case 1: //abom split sickle box telegraph, hides until after the sickles split { color = Color.Yellow; maxTime = 90 + 60; projectile.rotation = projectile.ai[1]; alphaModifier = 1; if (counter < 90) { alphaModifier = 0; } else { projectile.velocity = Vector2.Zero; } } break; case 2: //devi sparkling love, decelerates alongside energy hearts { color = Color.HotPink; maxTime = 90; projectile.rotation = projectile.ai[1]; alphaModifier = 1; if (projectile.velocity != Vector2.Zero) { if (counter == 0) { projectile.localAI[1] = -projectile.velocity.Length() / maxTime; } float speed = projectile.velocity.Length(); speed += projectile.localAI[1]; projectile.velocity = Vector2.Normalize(projectile.velocity) * speed; } } break; case 3: //abom laevateinn 1&2 telegraph, swing around to where actual sword will spawn { color = Color.Yellow; maxTime = 60; alphaModifier = 6f; NPC abom = FargoSoulsUtil.NPCExists(projectile.localAI[1], ModContent.NPCType <NPCs.AbomBoss.AbomBoss>()); if (abom != null) { projectile.Center = abom.Center; if (counter == 0) { projectile.rotation = abom.DirectionTo(Main.player[abom.target].Center).ToRotation(); } float targetRot = abom.DirectionTo(Main.player[abom.target].Center).ToRotation() + projectile.ai[1]; while (targetRot < -(float)Math.PI) { targetRot += 2f * (float)Math.PI; } while (targetRot > (float)Math.PI) { targetRot -= 2f * (float)Math.PI; } projectile.rotation = projectile.rotation.AngleLerp(targetRot, 0.05f); } } break; case 4: //abom laevateinn 3 telegraph, swing around to where actual sword will spawn but slower { color = Color.Yellow; maxTime = 150; alphaModifier = 7f; NPC abom = FargoSoulsUtil.NPCExists(projectile.localAI[1], ModContent.NPCType <NPCs.AbomBoss.AbomBoss>()); if (abom != null) { projectile.Center = abom.Center; float targetRot = projectile.ai[1]; while (targetRot < -(float)Math.PI) { targetRot += 2f * (float)Math.PI; } while (targetRot > (float)Math.PI) { targetRot -= 2f * (float)Math.PI; } projectile.velocity = projectile.velocity.ToRotation().AngleLerp(targetRot, 0.05f).ToRotationVector2(); } projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation(); } break; case 5: //abom cirno, slide in to a halt from outside { color = new Color(0, 1f, 1f); maxTime = 150; alphaModifier = 10f; NPC abom = FargoSoulsUtil.NPCExists(projectile.localAI[1], ModContent.NPCType <NPCs.AbomBoss.AbomBoss>()); if (abom != null) { Vector2 targetPos = abom.Center + Vector2.UnitX * projectile.ai[1]; projectile.Center = Vector2.Lerp(projectile.Center, targetPos, 0.025f); } projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation(); } break; case 6: //eridanus vortex lightning starting angles { projectile.GetGlobalProjectile <FargoGlobalProjectile>().TimeFreezeImmune = true; color = new Color(51, 255, 191); maxTime = 90; Player p = FargoSoulsUtil.PlayerExists(projectile.ai[1]); if (p != null) { projectile.rotation = projectile.DirectionTo(p.Center).ToRotation(); } else { projectile.ai[1] = Player.FindClosest(projectile.Center, 0, 0); } projectile.position -= projectile.velocity; projectile.rotation += projectile.velocity.ToRotation(); //yes, PLUS because rotation is set up there, velocity is the offset } break; case 7: //celestial pillar explode { projectile.GetGlobalProjectile <FargoGlobalProjectile>().TimeFreezeImmune = true; switch ((int)projectile.ai[1]) { case 0: color = Color.Magenta; break; //nebula case 1: color = Color.Orange; break; //solar case 2: color = new Color(51, 255, 191); break; //vortex default: color = Color.SkyBlue; break; //stardust } maxTime = 20; alphaModifier = 2; projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation(); if (counter == maxTime) { if (Main.netMode != NetmodeID.MultiplayerClient) { for (int j = 0; j < 4; j++) { Vector2 speed = (8f * (j + 1) + 4f) * projectile.velocity; Projectile.NewProjectile(projectile.Center, speed, mod.ProjectileType("CelestialFragment"), projectile.damage, 0f, Main.myPlayer, projectile.ai[1]); } } } } break; case 8: //prime limbs { color = Color.Yellow; maxTime = 60; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeSaw, NPCID.PrimeVice); if (npc != null) { projectile.Center = npc.Center; projectile.rotation = npc.rotation + MathHelper.PiOver2; } else { projectile.Kill(); return; } projectile.position -= projectile.velocity; projectile.rotation += projectile.velocity.ToRotation(); //yes, PLUS because rotation is set up there, velocity is the offset } break; case 9: //reti telegraph { color = Color.Red; maxTime = 120; alphaModifier = 2; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], NPCID.Retinazer); if (npc != null) { Vector2 offset = new Vector2(npc.width - 24, 0).RotatedBy(npc.rotation + 1.57079633); projectile.Center = npc.Center + offset; projectile.rotation = npc.rotation + MathHelper.PiOver2; } else { projectile.Kill(); return; } } break; case 10: //deviantt shadowbeam telegraph { color = Color.Purple; maxTime = 90; alphaModifier = 2; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], ModContent.NPCType <NPCs.DeviBoss.DeviBoss>()); if (npc != null) { projectile.Center = npc.Center; projectile.rotation = npc.localAI[0]; } else { projectile.Kill(); return; } } break; case 11: //destroyer telegraphs { maxTime = 90; alphaModifier = 2; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], NPCID.TheDestroyerBody, NPCID.TheDestroyerTail); if (npc == null) { projectile.Kill(); return; } NPC destroyer = FargoSoulsUtil.NPCExists(npc.realLife, NPCID.TheDestroyer); if (destroyer == null || destroyer.GetEModeNPCMod <Destroyer>().IsCoiling) { projectile.Kill(); return; } color = npc.ai[2] == 0 ? Color.Red : Color.Yellow; projectile.Center = npc.Center; projectile.rotation = projectile.localAI[1]; if (counter == 0) { projectile.localAI[0] = Main.rand.NextFloat(0.9f, 1.1f); } if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[2] == 0) { if (counter == maxTime) { Projectile.NewProjectile(projectile.Center, projectile.localAI[0] * projectile.rotation.ToRotationVector2(), ModContent.ProjectileType <DestroyerLaser>(), projectile.damage, projectile.knockBack, projectile.owner); } } else { if (counter > maxTime - 20 && counter % 10 == 0) { Projectile.NewProjectile(projectile.Center, projectile.localAI[0] * projectile.rotation.ToRotationVector2(), ModContent.ProjectileType <DarkStarHoming>(), projectile.damage, projectile.knockBack, projectile.owner, -1, 1f); } } } } break; case 12: //wof vanilla laser telegraph { color = Color.Purple; maxTime = 645; drawLayers = 4; alphaModifier = -1; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], NPCID.WallofFleshEye); if (npc != null && (npc.GetEModeNPCMod <WallofFleshEye>().HasTelegraphedNormalLasers || Main.netMode == NetmodeID.MultiplayerClient)) { projectile.rotation = npc.rotation + (npc.direction > 0 ? 0 : MathHelper.Pi); projectile.velocity = projectile.rotation.ToRotationVector2(); projectile.Center = npc.Center + (npc.width - 52) * Vector2.UnitX.RotatedBy(projectile.rotation); if (counter < npc.localAI[1]) { counter = (int)npc.localAI[1]; } projectile.alpha = (int)(255 * Math.Cos(Math.PI / 2 / maxTime * counter)); } else { projectile.Kill(); return; } } break; case 13: //mutant final spark tell { color = new Color(51, 255, 191); maxTime = 90; alphaModifier = counter > maxTime / 2 ? 6 : 3; projectile.scale = 4f; NPC mutant = FargoSoulsUtil.NPCExists(projectile.ai[1], ModContent.NPCType <NPCs.MutantBoss.MutantBoss>()); if (mutant != null) { float targetRot = MathHelper.WrapAngle(mutant.ai[3]); projectile.velocity = projectile.velocity.ToRotation().AngleLerp(targetRot, 0.12f * (float)Math.Pow((float)counter / maxTime, 3f)).ToRotationVector2(); } projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation(); } break; case 14: //moon lord vortex telegraph { color = new Color(51, 255, 191); maxTime = 180; alphaModifier = 5; Projectile vortex = FargoSoulsUtil.ProjectileExists(FargoSoulsUtil.GetByUUIDReal(projectile.owner, projectile.ai[1], ModContent.ProjectileType <MoonLordVortex>())); if (vortex != null) { projectile.Center = vortex.Center; projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation(); } else if (Main.netMode != NetmodeID.MultiplayerClient) { projectile.Kill(); return; } } break; default: break; } if (++counter > maxTime) { projectile.Kill(); return; } if (alphaModifier >= 0) { projectile.alpha = 255 - (int)(255 * Math.Sin(Math.PI / maxTime * counter) * alphaModifier); if (projectile.alpha < 0) { projectile.alpha = 0; } } color.A = 0; }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[1], ModContent.ProjectileType <RefractorBlaster2Held>()); if (byUUID != -1) { projectile.damage = Main.player[projectile.owner].GetWeaponDamage(Main.player[projectile.owner].HeldItem); projectile.knockBack = Main.player[projectile.owner].GetWeaponKnockback(Main.player[projectile.owner].HeldItem, Main.player[projectile.owner].HeldItem.knockBack); float rotation = Main.player[projectile.owner].itemRotation + (Main.player[projectile.owner].direction < 0 ? MathHelper.Pi : 0); projectile.velocity = rotation.ToRotationVector2(); projectile.Center = Main.player[projectile.owner].MountedCenter + 87f * projectile.velocity; projectile.timeLeft++; float rotdir = (projectile.ai[0] > 0) ? 1 : -1; Vector2 vel = projectile.velocity.RotatedBy(rotdir * MathHelper.Pi / 6); float windup = Math.Min(1f, Spinup); float rotspeed = windup * 1.5f * 6f; projectile.velocity = vel.RotatedBy(Math.Sin(projectile.localAI[0] * rotspeed + (Math.Abs(projectile.ai[0]) / 6 * MathHelper.TwoPi)) * rotdir * MathHelper.Pi / 14 * windup); } else if (projectile.localAI[0] > 0.05f) //leeway for mp lag { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } float num801 = .2f; projectile.localAI[0] += 0.01f; projectile.scale = Math.Min(projectile.localAI[0], num801); //float num804 = projectile.velocity.ToRotation(); //num804 += projectile.ai[0]; //projectile.rotation = num804 - 1.57079637f; //float num804 = Main.npc[(int)projectile.ai[1]].ai[3] - 1.57079637f; //if (projectile.ai[0] != 0f) num804 -= (float)Math.PI; //projectile.rotation = num804; //num804 += 1.57079637f; //projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2000f, array3); //for (int i = 0; i < array3.Length; i++) array3[i] = projectile.localAI[0] * projectile.ai[1]; float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); /*Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); * for (int num809 = 0; num809 < 2; num809 = num3 + 1) * { * float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; * float num811 = (float)Main.rand.NextDouble() * 2f + 2f; * Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); * int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); * Main.dust[num812].noGravity = true; * Main.dust[num812].scale = 1.7f; * num3 = num809; * } * if (Main.rand.NextBool(5)) * { * Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; * int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); * Dust dust = Main.dust[num813]; * dust.velocity *= 0.5f; * Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); * }*/ //DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); //Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; DelegateMethods.v3_1 = new Vector3(0.8f, 0f, 0f); Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (projectile.localAI[1]), 10, DelegateMethods.CastLight); }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } int num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], projectile.type, ModContent.ProjectileType <DestroyerHead>()); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("DestroyerHead")) { Main.projectile[byUUID].localAI[1] = projectile.identity; } } if (!flag67) { return; } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * 36; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; if (--attackTimer <= 0) { attackTimer = Main.rand.Next(150) + 150; } if (attackTimer == 1) { if (projectile.owner == Main.myPlayer) { int selectedTarget = -1; //pick target const float maxRange = 750f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile) && Collision.CanHit(projectile.Center, 0, 0, Main.npc[i].Center, 0, 0)) { if (projectile.Distance(Main.npc[i].Center) <= maxRange && Main.rand.NextBool()) //random because destroyer { selectedTarget = i; } } } if (selectedTarget != -1) //shoot { Projectile.NewProjectile(projectile.Center, 10f * projectile.DirectionTo(Main.npc[selectedTarget].Center), ProjectileID.MiniRetinaLaser, projectile.damage, projectile.knockBack, projectile.owner); Main.PlaySound(SoundID.Item12, projectile.Center); } } } }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } Projectile sphere = FargoSoulsUtil.ProjectileExists(FargoSoulsUtil.GetByUUIDReal(projectile.owner, projectile.ai[1], ProjectileID.PhantasmalSphere)); if (sphere != null) { projectile.Center = sphere.Center; sphere.ai[0] = -1; sphere.localAI[0] = 2; if (projectile.localAI[0] == 0f) { sphere.velocity = projectile.velocity; } } else { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } /*if (projectile.localAI[0] == 0f) * { * Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); * }*/ float num801 = 0.3f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 0.6f * num801; if (projectile.scale > num801) { projectile.scale = num801; } //float num804 = projectile.velocity.ToRotation(); //num804 += projectile.ai[0]; //projectile.rotation = num804 - 1.57079637f; //float num804 = Main.npc[(int)projectile.ai[1]].ai[3] - 1.57079637f; //if (projectile.ai[0] != 0f) num804 -= (float)Math.PI; //projectile.rotation = num804; //num804 += 1.57079637f; //projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; //Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); for (int i = 0; i < array3.Length; i++) { array3[i] = 3000f; } float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809 = num3 + 1) { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); Main.dust[num812].noGravity = true; Main.dust[num812].scale = 1.7f; num3 = num809; } if (Main.rand.NextBool(5)) { Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); } //DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); //Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); projectile.position -= projectile.velocity; projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } int num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <DestroyerBody>()); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; } if (!flag67) { return; } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * 45; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
public override void AI() { if (projectile.localAI[0] == 0) { Main.PlaySound(SoundID.Item92, projectile.Center); projectile.rotation = projectile.velocity.ToRotation(); Main.PlaySound(SoundID.Item89, projectile.position); if (!Main.dedServ && Main.LocalPlayer.active) { Main.LocalPlayer.GetModPlayer <FargoPlayer>().Screenshake = 30; } for (int num615 = 0; num615 < 20; num615++) { int num616 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num616].velocity *= 1.4f; } for (int num617 = 0; num617 < 40; num617++) { int num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num618].velocity *= 3f; } for (int num619 = 0; num619 < 2; num619++) { float scaleFactor9 = 0.4f; if (num619 == 1) { scaleFactor9 = 0.8f; } int num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore97 = Main.gore[num620]; gore97.velocity.X = gore97.velocity.X + 1f; Gore gore98 = Main.gore[num620]; gore98.velocity.Y = gore98.velocity.Y + 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore99 = Main.gore[num620]; gore99.velocity.X = gore99.velocity.X - 1f; Gore gore100 = Main.gore[num620]; gore100.velocity.Y = gore100.velocity.Y + 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore101 = Main.gore[num620]; gore101.velocity.X = gore101.velocity.X + 1f; Gore gore102 = Main.gore[num620]; gore102.velocity.Y = gore102.velocity.Y - 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore103 = Main.gore[num620]; gore103.velocity.X = gore103.velocity.X - 1f; Gore gore104 = Main.gore[num620]; gore104.velocity.Y = gore104.velocity.Y - 1f; } for (int k = 0; k < 20; k++) //make visual dust { Vector2 dustPos = projectile.position; dustPos.X += Main.rand.Next(projectile.width); dustPos.Y += Main.rand.Next(projectile.height); for (int i = 0; i < 15; i++) { int dust = Dust.NewDust(dustPos, 32, 32, 31, 0f, 0f, 100, default(Color), 3f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(dustPos, 32, 32, DustID.Fire, 0f, 0f, 100, default(Color), 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 7f; dust = Dust.NewDust(dustPos, 32, 32, DustID.Fire, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].velocity *= 3f; } float scaleFactor9 = 0.5f; for (int j = 0; j < 4; j++) { int gore = Gore.NewGore(dustPos, default(Vector2), Main.rand.Next(61, 64)); Main.gore[gore].velocity *= scaleFactor9; Main.gore[gore].velocity.X += 1f; Main.gore[gore].velocity.Y += 1f; } } const int num226 = 30; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 40f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Fire, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } } NPC moonLord = FargoSoulsUtil.NPCExists(NPCs.EModeGlobalNPC.moonBoss, NPCID.MoonLordCore); Projectile arena = FargoSoulsUtil.ProjectileExists(FargoSoulsUtil.GetByUUIDReal(projectile.owner, projectile.ai[0], ModContent.ProjectileType <LunarRitual>())); if (moonLord != null && arena != null && moonLord.ai[0] != 2f) { if (moonLord.GetEModeNPCMod <MoonLordCore>().VulnerabilityState == 4) { projectile.timeLeft = 60; } float orbitRange = Math.Abs(projectile.ai[1]) + 400f * moonLord.life / moonLord.lifeMax; if (++projectile.localAI[0] < 60) { Vector2 desiredPosition = arena.Center + projectile.velocity * orbitRange; projectile.Center = Vector2.Lerp(projectile.Center, desiredPosition, 0.05f); projectile.position += arena.velocity; projectile.position -= projectile.velocity; projectile.alpha -= 10; if (projectile.alpha < 0) { projectile.alpha = 0; } } else { projectile.alpha = 0; projectile.velocity = Vector2.Zero; projectile.rotation += MathHelper.ToRadians(3.5f) * Math.Min(1f, (projectile.localAI[0] - 60) / 180) * Math.Sign(projectile.ai[1]); projectile.Center = arena.Center + orbitRange * projectile.rotation.ToRotationVector2(); } } else if (Main.netMode != NetmodeID.MultiplayerClient) { projectile.Kill(); } }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int sword = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[1], ModContent.ProjectileType <AbomSword>()); if (sword != -1) { projectile.Center = Main.projectile[sword].Center + Main.projectile[sword].velocity * 75; projectile.velocity = Main.projectile[sword].velocity.RotatedBy(projectile.ai[0]); } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.localAI[0] == 0f) { //Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); } float num801 = 1f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * num801 * 6f; if (projectile.scale > num801) { projectile.scale = num801; } float num804 = projectile.velocity.ToRotation(); /*if (Main.npc[ai1].velocity != Vector2.Zero) * num804 += projectile.ai[0];*/ projectile.rotation = num804 - 1.57079637f; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; //Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); for (int i = 0; i < array3.Length; i++) { array3[i] = 100f; } float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); /*Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); * for (int num809 = 0; num809 < 2; num809 = num3 + 1) * { * float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; * float num811 = (float)Main.rand.NextDouble() * 2f + 2f; * Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); * int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); * Main.dust[num812].noGravity = true; * Main.dust[num812].scale = 1.7f; * num3 = num809; * } * if (Main.rand.NextBool(5)) * { * Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; * int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); * Dust dust = Main.dust[num813]; * dust.velocity *= 0.5f; * Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); * }*/ //DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); //Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); /*if (Main.npc[ai1].velocity != Vector2.Zero && --counter < 0) * { * counter = 5; * if (Main.netMode != NetmodeID.MultiplayerClient) //spawn bonus projs * { * Vector2 spawnPos = projectile.Center; * Vector2 vel = projectile.velocity.RotatedBy(Math.PI / 2 * Math.Sign(projectile.ai[0])); * const int max = 15; * for (int i = 1; i <= max; i++) * { * spawnPos += projectile.velocity * 3000f / max; * Projectile.NewProjectile(spawnPos, vel, mod.ProjectileType("AbomSickle2"), projectile.damage, 0f, projectile.owner); * } * } * }*/ /*int d = Dust.NewDust(projectile.position + projectile.velocity * Main.rand.NextFloat(100), projectile.width, projectile.height, 87, 0f, 0f, 0, default(Color), 1.5f); * Main.dust[d].noGravity = true; * Main.dust[d].velocity *= 4f;*/ }
public override void AI() { projectile.hide = false; Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <PungentEyeball>()); if (byUUID != -1) { projectile.Center = Main.projectile[byUUID].Center + Vector2.UnitX.RotatedBy(Main.projectile[byUUID].rotation) * 20f; } else if (projectile.owner == Main.myPlayer && projectile.localAI[0] > 5f) { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); } float num801 = (projectile.ai[1] == 0f) ? 0.4f : 1f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 10f * num801; if (projectile.scale > num801) { projectile.scale = num801; } projectile.rotation = Main.projectile[byUUID].rotation - 1.57079637f; projectile.velocity = Main.projectile[byUUID].rotation.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809 = num3 + 1) { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); Main.dust[num812].noGravity = true; Main.dust[num812].scale = 1.7f; num3 = num809; } if (Main.rand.NextBool(5)) { Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } int num1038 = 10; if (player.dead) { modPlayer.EaterMinion = false; } if (modPlayer.EaterMinion) { projectile.timeLeft = 2; } num1038 = 30; //D U S T /*if (Main.rand.NextBool(30)) * { * int num1039 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 0, default(Color), 2f); * Main.dust[num1039].noGravity = true; * Main.dust[num1039].fadeIn = 2f; * Point point4 = Main.dust[num1039].position.ToTileCoordinates(); * if (WorldGen.InWorld(point4.X, point4.Y, 5) && WorldGen.SolidTile(point4.X, point4.Y)) * { * Main.dust[num1039].noLight = true; * } * }*/ bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], projectile.type, ModContent.ProjectileType <EaterHead>()); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("EaterHead")) { Main.projectile[byUUID].localAI[1] = projectile.identity; } } if (!flag67) { return; } if (projectile.alpha > 0) { for (int num1054 = 0; num1054 < 2; num1054++) { int num1055 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 2f); Main.dust[num1055].noGravity = true; Main.dust[num1055].noLight = true; } } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; float dist = 26; if (Main.projectile[byUUID].type == mod.ProjectileType("EaterHead")) { dist = 32; } if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * dist; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //to fix tail disapearing meme float slotsUsed = 0; Main.projectile.Where(x => x.active && x.owner == player.whoAmI && x.minionSlots > 0).ToList().ForEach(x => { slotsUsed += x.minionSlots; }); if (player.maxMinions - slotsUsed < 1) { return(false); } int headCheck = -1; int tailCheck = -1; for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; if (proj.active && proj.owner == player.whoAmI) { if (headCheck == -1 && proj.type == mod.ProjectileType("EaterHead")) { headCheck = i; } if (tailCheck == -1 && proj.type == mod.ProjectileType("EaterTail")) { tailCheck = i; } if (headCheck != -1 && tailCheck != -1) { break; } } } //initial spawn if (headCheck == -1 && tailCheck == -1) { int current = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterHead"), damage, knockBack, player.whoAmI, 0f, 0f); int previous = 0; for (int i = 0; i < 4; i++) { current = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterBody"), damage, knockBack, player.whoAmI, Main.projectile[current].identity, 0f); previous = current; } current = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterTail"), damage, knockBack, player.whoAmI, Main.projectile[current].identity, 0f); Main.projectile[previous].localAI[1] = Main.projectile[current].identity; Main.projectile[previous].netUpdate = true; } //spawn more body segments else { int previous = (int)Main.projectile[tailCheck].ai[0]; int current = 0; for (int i = 0; i < 4; i++) { int prevUUID = FargoSoulsUtil.GetByUUIDReal(player.whoAmI, Main.projectile[previous].identity); current = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EaterBody"), damage, knockBack, player.whoAmI, prevUUID, 0f); previous = current; } Main.projectile[current].localAI[1] = Main.projectile[tailCheck].identity; Main.projectile[tailCheck].ai[0] = FargoSoulsUtil.GetByUUIDReal(player.whoAmI, Main.projectile[current].identity); Main.projectile[tailCheck].netUpdate = true; Main.projectile[tailCheck].ai[1] = 1f; } return(false); }
public override void AI() { if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } int num1038 = 30; //dust! int dustId = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height + 5, 62, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height + 5, 62, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantDestroyerBody>()); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; projectile.timeLeft = Main.projectile[byUUID].timeLeft; } if (!flag67) { return; } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * 36; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }