public virtual void OrderOfTheCrates(Player P) { if (firstTimeSetup) { for (int layer = 0; layer < phase; layer++) { Cratesperlayer[layer] = 4 + (layer * 4); List <CratrosityInstancedCrate> cratesInThisLayer = new List <CratrosityInstancedCrate>(); for (int i = 0; i < Cratesperlayer[layer]; i = i + 1) { int crateType = ItemID.WoodenCrate; if (layer == 3) { crateType = ItemID.IronCrate; if (npc.ai[3] > 300000 && i % 2 == 0) { crateType = ModContent.ItemType <HavocGear.Items.DankCrate>(); } else if (npc.ai[3] > 100000 && i % 2 == 0) { crateType = ItemID.HallowedFishingCrate; } else { if (npc.ai[3] < -100000 && i % 2 == 0) { crateType = EvilCrateType; } } } if (layer == 2) { crateType = (i % 2 == 0) ? ItemID.JungleFishingCrate : ItemID.DungeonFishingCrate; } if (layer == 1) { crateType = (i % 2 == 0) ? ItemID.HallowedFishingCrate : (EvilCrateType); } if (layer == 0) { crateType = ItemID.FloatingIslandFishingCrate; } cratesInThisLayer.Add(new CratrosityInstancedCrate(this, crateType, 8, layer)); } cratesPerRing.Add(cratesInThisLayer); } firstTimeSetup = false; } nonaispin = nonaispin + 1f; compressvar += (compressvargoal - compressvar) / 20; float themaxdist = 99999f; for (int layer = 0; layer < phase; layer++) { for (int index = 0; index < cratesPerRing[layer].Count; index++) { CratrosityInstancedCrate crate = cratesPerRing[layer][index]; if (!crate.Update()) { continue; } crate.crateAngle = (layer % 2 == 0 ? 1 : -1) * ((nonaispin * 0.01f) * (1f + layer / 3f)) + MathHelper.TwoPi * ((index / (float)cratesPerRing[layer].Count)); crate.crateDist = compressvar * 20f + ((float)layer * 20f) * compressvar; //Cratesangle[a, i] = (a % 2 == 0 ? 1 : -1) * ((nonaispin * 0.01f) * (1f + a / 3f)) + 2.0 * Math.PI * ((i / (double)Cratesperlayer[a])); //Cratesdist[a, i] = compressvar * 20f + ((float)a * 20f) * compressvar; float theexpand = 0f; if (themode > 0) { theexpand = (((index / 1f) * (layer + 1f))) * (themode / 30f); } crate.crateVector += ((crate.crateDist * (new Vector2((float)Math.Cos(crate.crateAngle), (float)Math.Sin(crate.crateAngle))) + npc.Center) - crate.crateVector) / (theexpand + (Math.Max((((compressvar) - 1) * (2 + (layer * 1))), 1))); //if (index) //crate.crateVector += Main.rand.NextVector2Circular(32, 32); float sinner = npc.ai[0] + ((float)(index * 5) + (layer * 14)); float sinner2 = (float)(10f + (Math.Sin(sinner / 30f) * 7f)); if (compressvar > 1.01) { int[] projtype = { ModContent.ProjectileType <GlowingPlatinumCoin>(), ModContent.ProjectileType <GlowingPlatinumCoin>(), ModContent.ProjectileType <GlowingPlatinumCoin>(), ModContent.ProjectileType <GlowingGoldCoin>(), ModContent.ProjectileType <GlowingSilverCoin>(), ModContent.ProjectileType <GlowingCopperCoin>() }; int[] projdamage = { 60, 50, 40, 30, 20, 10 }; float[] projspeed = { 1f, 1f, 1f, 9f, 8f, 7f }; if (layer == phase - 1) { if (sinner2 < 4 && (npc.ai[0] + (index * 4)) % 30 == 0) { List <Projectile> itz = Idglib.Shattershots(crate.crateVector, P.position, new Vector2(P.width, P.height), projtype[layer + 1], (int)((double)npc.damage * ((double)projdamage[layer + 1] / (double)defaultdamage)), projspeed[layer + 1], 0, 1, true, 0, false, 110); if (projtype[layer + 1] == ModContent.ProjectileType <GlowingPlatinumCoin>()) { itz[0].aiStyle = 18; IdgProjectile.AddOnHitBuff(itz[0].whoAmI, BuffID.ShadowFlame, 60 * 10); } } } crate.crateVector += ((P.Center - crate.crateVector) / (sinner2)) * ((Math.Max(compressvar - 1, 0) * 1)); } float dist = (P.Center - crate.crateVector).Length(); if (dist < themaxdist) { themaxdist = dist; theclostestcrate = crate.crateVector; } } } }
public override void OrderOfTheCrates(Player P) { if (pmlphase == 2 && pmlphasetimer > -30000) { int timer = 3000000 - pmlphasetimer; Vector2 playerdiff = P.MountedCenter - npc.Center; nonaispin = nonaispin + 0.6f; for (int layer = 0; layer < phase; layer++) { for (int index = 0; index < cratesPerRing[layer].Count; index++) { CratrosityInstancedCrate crate = cratesPerRing[layer][index]; Vector2 anglediff = P.MountedCenter - crate.crateVector; //Cratesangle[a, i] = (a % 2 == 0 ? 1 : -1) * ((nonaispin * 0.01f) * (1f + a / 3f)) + 2.0 * Math.PI * ((i / (double)Cratesperlayer[a])); //Cratesdist[a, i] = compressvar * 20f + ((float)a * 20f) * compressvar; int adder = (((layer * cratesPerRing[layer].Count) + index) * 10); float crateangle2 = anglediff.ToRotation(); if ((timer + adder) % 600 >= 300 && timer >= 600) { if ((timer + adder) % 600 == 300) { crate.crateAngle = crateangle2; SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_DarkMageAttack, npc.Center); if (sound != null) { sound.Pitch = -0.25f; } for (float f = 0; f < MathHelper.TwoPi; f += MathHelper.TwoPi / 12f) { Vector2 offset = f.ToRotationVector2(); int dust = Dust.NewDust(crate.crateVector + (offset * 32f), 0, 0, DustID.GoldFlame); Main.dust[dust].scale = 1.5f; Main.dust[dust].noGravity = true; Main.dust[dust].velocity = f.ToRotationVector2() * 4f; } } if ((timer + adder) % 600 > 330) { int counterdist = ((timer + adder) % 600) - 330; float cratevelocitybutcastedasfloat = crate.crateAngle; Vector2 disttoplayer = P.MountedCenter - crate.crateVector; Vector2 velo = cratevelocitybutcastedasfloat.ToRotationVector2(); if (disttoplayer.LengthSquared() > 200 * 200) { crate.crateAngle = (cratevelocitybutcastedasfloat.AngleLerp(disttoplayer.ToRotation(), 0.010f)); } crate.crateVector += velo * MathHelper.Clamp(counterdist / 120f, 0f, 1f) * 60f; for (float f = 0; f < MathHelper.TwoPi; f += MathHelper.TwoPi / 2f) { int dust = Dust.NewDust(crate.crateVector - new Vector2(16, 16), 32, 32, DustID.GoldFlame); Main.dust[dust].scale = 1f; Main.dust[dust].noGravity = true; Main.dust[dust].velocity = (velo + Main.rand.NextVector2Circular(4f, 4f)) * 1f; } Point point = crate.crateVector.ToPoint(); Rectangle rect = new Rectangle(point.X - 16, point.Y - 16, 32, 32); foreach (Player player in Main.player.Where(testby => testby.active && !testby.dead && testby.Hitbox.Intersects(rect))) { if (player != null) { player.Hurt(PlayerDeathReason.ByCustomReason(player.name + "Got smashed"), npc.damage * 2, npc.direction); } } } } else { //Cratesangle[a, i] = (float)(Cratesangle[a, i]) float dist = ((index * layer) + index) * 32f; Vector2 goHere = (npc.Center + (Vector2.UnitX).RotatedBy(anglediff.ToRotation()) * dist); float crateangle = crate.crateAngle; if ((timer + adder) > 150) { crate.crateAngle = (crateangle.AngleLerp((goHere - crate.crateVector).ToRotation(), 0.025f)); } crate.crateVector += crateangle.ToRotationVector2() * (1f + Math.Min((goHere - crate.crateVector).Length() * 0.01f, 40f)); } //Vector2 it = new Vector2(P.Center.X - crate.crateVector.X, P.Center.Y - crate.crateVector.Y); //it.Normalize(); } } } else { base.OrderOfTheCrates(P); } }