public override void AI() { projectile.frame = (projectile.frame == 4 ? 0 : ++projectile.frame); if (projectile.timeLeft <= 60) { projectile.alpha += 255 / 60; } AmmoboxHelpfulMethods.createDustCircle(projectile.Center, 199, 128, true, true, 64, new Color(255, 255, 255), velocity: new Vector2(0f, 0f)); AmmoboxHelpfulMethods.createDustCircle(projectile.Center, 211, noGravity: true, radius: 16, newDustPerfect: true, Count: 16, velocity: new Vector2(0, 0), color: new Color(255, 0, 251)); // Do black holey stuff projectile.velocity = Vector2.Zero; double maxRange = 128; foreach (NPC npc in Main.npc) { double x = projectile.Center.X - npc.Center.X; double y = projectile.Center.Y - npc.Center.Y; double distance = Vector2.Distance(projectile.Center, npc.Center); if (distance < maxRange && npc.active && !npc.boss) { Vector2 vel = new Vector2((float)x, (float)y) * 0.04f; npc.velocity = vel; if (Main.netMode == 1) { var packet = mod.GetPacket(); packet.Write((byte)AmmoboxMsgType.AmmoboxUpdateVelocity); packet.Write(npc.whoAmI); packet.WriteVector2(vel); packet.Send(); } } } }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; AmmoboxHelpfulMethods.createBurst(ProjectileID.CursedFlameFriendly, projectile.position, projectile.owner, 5, Count: 2, oneInX: 1); AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; AmmoboxHelpfulMethods.createBurst(ProjectileID.FallingStar, projectile.position, projectile.owner, 40); AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; AmmoboxHelpfulMethods.blastArea(projectile.position, maxRange: 7, extraDrops: true); AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type, largeBlast: true); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; AmmoboxHelpfulMethods.createBurst(ProjectileID.HarpyFeather, projectile.position, projectile.owner, 20, oneInX: 1, makeFriendly: true); AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type); }
public override void AI() { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; // Rocket launcher if (shotFrom == ItemID.RocketLauncher) { projectile.velocity = projectile.oldVelocity; if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) { projectile.velocity *= 1.1f; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } // Grenade launcher if (shotFrom == ItemID.GrenadeLauncher) { //projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; // If going to explode if (projectile.ai[1] == 200) { projectile.Kill(); } else { projectile.ai[1] += 1; } } // Proximity mine if (shotFrom == ItemID.ProximityMineLauncher) { if (projectile.ai[1] < 3) { projectile.velocity *= 0.98f; } if (projectile.ai[1] >= 3 && projectile.alpha < 150) { projectile.alpha += 1; } } // Snowman if (shotFrom == ItemID.SnowmanCannon) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Common for all launchers for (int i = 0; i < 2; i++) { Dust dust = Dust.NewDustPerfect(projectile.Center, 31); Main.dust[dust.dustIndex].velocity *= 0.05f; } }
public override void AI() { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; // Rocket launcher if (shotFrom == ItemID.RocketLauncher) { projectile.velocity = projectile.oldVelocity; if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) { projectile.velocity *= 1.1f; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } // Grenade launcher if (shotFrom == ItemID.GrenadeLauncher) { //projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; // If going to explode if (projectile.ai[1] == 200) { projectile.Kill(); } else { projectile.ai[1] += 1; } } // Proximity mine if (shotFrom == ItemID.ProximityMineLauncher) { if (projectile.ai[1] < 3) { projectile.velocity *= 0.98f; } if (projectile.ai[1] >= 3 && projectile.alpha < 150) { projectile.alpha += 1; } } // Snowman if (shotFrom == ItemID.SnowmanCannon) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Common for all launchers for (int i = 0; i < 1; i++) { Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Ice, newColor: Color.WhiteSmoke); } Lighting.AddLight(projectile.Center, Color.SkyBlue.ToVector3()); }
public override void AI() { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; // Rocket launcher if (shotFrom == ItemID.RocketLauncher) { projectile.velocity = projectile.oldVelocity; if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) { projectile.velocity *= 1.1f; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } // Grenade launcher if (shotFrom == ItemID.GrenadeLauncher) { //projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; // If going to explode if (projectile.ai[1] == 200) { projectile.Kill(); } else { projectile.ai[1] += 1; } } // Proximity mine if (shotFrom == ItemID.ProximityMineLauncher) { if (projectile.ai[1] < 3) { projectile.velocity *= 0.98f; } if (projectile.ai[1] >= 3 && projectile.alpha < 150) { projectile.alpha += 1; } } // Snowman if (shotFrom == ItemID.SnowmanCannon) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Common for all launchers if (!(shotFrom == ItemID.ProximityMineLauncher && projectile.ai[1] >= 3)) { Dust.NewDustPerfect(projectile.Center - new Vector2(0, projectile.height / 2), DustID.GoldCoin); } Lighting.AddLight(projectile.Center + new Vector2(0, projectile.height / 2), Color.Yellow.ToVector3()); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; /* * Custom effects here */ AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type, largeBlast: true); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; for (int i = 0; i < 20; i++) { Dust.NewDust(projectile.position, projectile.width, projectile.height, 12); } AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type, skipDamage: true); }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; for (int i = 0; i < 30; i++) { Dust.NewDust(projectile.position, 8, 8, DustID.Smoke, newColor: Color.LightYellow, Scale: 2f); } AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type); }
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (target.GetGlobalNPC <AmmoboxGlobalNPC>().apAlreadyDroppedOre) { return; } if (AmmoboxHelpfulMethods.processMinerOreDrop(target, oneInX: 20)) { target.GetGlobalNPC <AmmoboxGlobalNPC>().apAlreadyDroppedOre = true; } }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; int id = Projectile.NewProjectile(projectile.position, projectile.velocity, mod.ProjectileType("BlackHole"), 0, 0, projectile.owner); if (Main.netMode != NetmodeID.Server) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/blackHole").WithVolume(0.8f), projectile.position); } AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.owner); }
public override void AI() { // Adapted from vanilla // Variable names might not be true to their function for (int index1 = 0; index1 < 10; ++index1) { float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * (double)index1); float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * (double)index1); int index2 = Dust.NewDust(new Vector2(num1, num2), 1, 1, 75, 0.0f, 0.0f, 0, Color.Lime, 1f); Main.dust[index2].alpha = projectile.alpha; Main.dust[index2].position.X = (float)num1; Main.dust[index2].position.Y = (float)num2; Main.dust[index2].velocity = new Vector2(0, 0); Main.dust[index2].noGravity = true; } AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); CalculatedStyle innerDim = base.Parent.GetInnerDimensions(); if (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemID != -1) { float baseX = innerDim.X; float baseY = innerDim.Y; float textureWidth = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemID].Width; float textureHeight = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemID].Height; float centerX = baseX + ((innerDim.Width - textureWidth) / 2f); float centerY = baseY + ((innerDim.Height - textureHeight) / 2f); spriteBatch.Draw(Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemID], new Vector2(centerX, centerY), Color.White); } Vector2 fontSize = Main.fontMouseText.MeasureString("Ammo: "); Vector2 textPos = new Vector2(innerDim.X - 14f, innerDim.Y - (fontSize.Y + 5f)); float alphaOrSomething = Main.mouseTextColor / 255f; Color baseColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, "Ammo: ", textPos, baseColor, 0, Vector2.Zero, Vector2.One); Color fontColor = AmmoboxHelpfulMethods.getRarityColor(Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemRarity); Vector2 mousePos = new Vector2(Main.mouseX, Main.mouseY); if (base.Parent.ContainsPoint(mousePos) && Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemName != "") { ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoDisplayItemName, mousePos + new Vector2(15, 15), fontColor, 0, Vector2.Zero, Vector2.One); } }
public override void AI() { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; if (drawAura) { if (rotation >= 2) { rotation = 0; } else { rotation += (1 / 256d); } // (0, 142, 255) // 0, 0x11, 255 AmmoboxHelpfulMethods.createDustCircle(projectile.Center, 178, 256, true, true, 32, color: new Color(0, 142, 255), angleOffset: rotation, shader: 39); AmmoboxHelpfulMethods.createDustCircle(projectile.Center, 178, 256, true, true, 32, color: new Color(255, 0, 0), angleOffset: (1 / 32d), shader: 39); foreach (NPC n in Main.npc) { float a = Math.Abs(projectile.Center.X - n.Center.X); float b = Math.Abs(projectile.Center.Y - n.Center.Y); double dist = Math.Sqrt(a * a + b * b); if (dist < 192f && n.active && !n.friendly) { if (Main.player[projectile.owner].statLife < Main.player[projectile.owner].statLifeMax) { n.GetGlobalNPC <AmmoboxGlobalNPC>().apExtraHeartTick = 120; } if (Main.player[projectile.owner].statMana < Main.player[projectile.owner].statManaMax) { n.GetGlobalNPC <AmmoboxGlobalNPC>().apExtraManaTick = 120; } Main.npc[n.whoAmI].netUpdate = true; } } return; } // Rocket launcher if (shotFrom == ItemID.RocketLauncher) { projectile.velocity = projectile.oldVelocity; if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) { projectile.velocity *= 1.1f; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } // Grenade launcher if (shotFrom == ItemID.GrenadeLauncher) { //projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; // If going to explode if (projectile.ai[1] == 200) { projectile.Kill(); } else { projectile.ai[1] += 1; } } // Proximity mine if (shotFrom == ItemID.ProximityMineLauncher) { if (projectile.ai[1] < 3) { projectile.velocity *= 0.98f; } if (projectile.ai[1] >= 3 && projectile.alpha < 150) { projectile.alpha += 1; } } // Snowman if (shotFrom == ItemID.SnowmanCannon) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Common for all launchers /* * Do stuff here */ }
public override void Kill(int timeLeft) { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; AmmoboxHelpfulMethods.explodeRocket(shotFrom, projectile.identity, projectile.type); }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); if (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().doNotDraw) { return; } //Main.LocalPlayer.mouseInterface = true; Texture2D bgTexture = Main.wireUITexture[0]; // Draw weapon circle Rectangle outputRect = new Rectangle((int)leftCorner.X, (int)leftCorner.Y, mainDiameter, mainDiameter); spriteBatch.Draw(Main.wireUITexture[CheckMouseWithinCircle(Main.MouseScreen, mainRadius, spawnPosition) ? 1 : 0], outputRect, Color.White); // Draw weapon inside circle if (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().heldItemType != -1) { int finalWidth = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().heldItemType].Width / 2, finalHeight = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().heldItemType].Height / 2; Rectangle outputWeaponRect = new Rectangle((int)spawnPosition.X - (finalWidth / 2), (int)spawnPosition.Y - (finalHeight / 2), finalWidth, finalHeight); spriteBatch.Draw(Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().heldItemType], outputWeaponRect, Color.White); } // Check how many ammo types are available // TODO: Add the one slot thing int outerRadius = 48; double offset = 0; // Apply offset depending on the amount of circles to be drawn offset = (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount == 3) ? 0.5 : (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount == 4) ? 0.25 : (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount == 5) ? (1d / 9d) : 0; // Angle between each circle // (*Math.PI is @ Line 186) double angleSteps = 2.0d / Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount; // TODO: Fix weird position of lower circle on circleAmount == 3 int done = 0; // Starting angle double i = offset; // done --> ID of currently drawn circle for (done = 0; done < Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount; ++done) { double x = outerRadius * Math.Cos(i * Math.PI), y = outerRadius * Math.Sin(i * Math.PI); Rectangle ammoBgRect = new Rectangle((int)(leftCorner.X + x), (int)(leftCorner.Y + y), mainDiameter, mainDiameter); // Check if mouse is within the circle checked //bool isMouseWithin = CheckMouseWithinCircle(Main.MouseScreen, mainRadius + 8, new Vector2((int)(spawnPosition.X + x), (int)(spawnPosition.Y + y))); bool isMouseWithin = CheckMouseWithinWheel(Main.MouseScreen, spawnPosition, 96, mainRadius, offset * Math.PI, Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().circleAmount, done); // Actually draw the bg circle spriteBatch.Draw(Main.wireUITexture[isMouseWithin ? 1 : 0], ammoBgRect, (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done] == Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().currentFirstAmmoType) ? Color.Gray : Color.White); // Draw ammo sprites over the icons int ammoWidth = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]].Width, ammoHeight = Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]].Height; Rectangle ammoRect = new Rectangle((int)(spawnPosition.X + x) - (ammoWidth / 2), (int)(spawnPosition.Y + y) - (ammoHeight / 2), ammoWidth, ammoHeight); spriteBatch.Draw(Main.itemTexture[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]], ammoRect, (Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done] == Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().currentFirstAmmoType) ? Color.Gray : Color.White); if (isMouseWithin) { Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().selectedAmmoType = Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]; // For some reason CloneDefaults doesn't actually clone the type // Set the type for proper cloning Item onetwo = new Item(); onetwo.SetDefaults(Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]); // Draw the tooltip Color fontColor = AmmoboxHelpfulMethods.getRarityColor(onetwo.rare); Vector2 mousePos = new Vector2(Main.mouseX, Main.mouseY); ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, onetwo.Name + " (" + Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoCount[Main.LocalPlayer.GetModPlayer <AmmoboxPlayer>().ammoTypes[done]] + ")", mousePos + new Vector2(15, 15), fontColor, 0, Vector2.Zero, Vector2.One); } i += angleSteps; } }
public override void AI() { int shotFrom = projectile.GetGlobalProjectile <AmmoboxGlobalProjectile>().apShotFromLauncherID; // Rocket launcher if (shotFrom == ItemID.RocketLauncher) { projectile.velocity = projectile.oldVelocity; if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) { projectile.velocity *= 1.1f; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Grenade launcher if (shotFrom == ItemID.GrenadeLauncher) { //projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; // If going to explode if (tickAliveCount == 200) { projectile.Kill(); } else { ++tickAliveCount; } AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Proximity mine if (shotFrom == ItemID.ProximityMineLauncher) { if (projectile.ai[1] < 3) { projectile.velocity *= 0.98f; } if (projectile.ai[1] >= 3 && projectile.alpha < 150) { projectile.alpha += 1; } } // Snowman if (shotFrom == ItemID.SnowmanCannon) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; AmmoboxHelpfulMethods.chaseEnemy(projectile.identity, projectile.type); } // Common for all launchers for (int index1 = 0; index1 < 10; ++index1) { float num1 = (float)(projectile.Center.X - projectile.velocity.X / 10.0 * (double)index1); float num2 = (float)(projectile.Center.Y - projectile.velocity.Y / 10.0 * (double)index1); int index2 = Dust.NewDust(new Vector2(num1, num2), 1, 1, 75, 0.0f, 0.0f, 0, Color.Lime, 1f); Main.dust[index2].alpha = projectile.alpha; Main.dust[index2].position.X = (float)num1; Main.dust[index2].position.Y = (float)num2; Main.dust[index2].velocity = new Vector2(0, 0); Main.dust[index2].noGravity = true; } }