//public override Vector2? HoldoutOffset() => new Vector2(10, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { const float shootArc = Tools.FullCircle / 10f; const int fireAmount = 9; for (int i = 0; i < fireAmount; i++) { // Creates the arc by going back and forth - this way it will not look lopsided in low graphics settings var velocity = new Vector2(speedX, speedY).RotatedBy(shootArc / 2f * i / fireAmount * (i % 2 == 0 ? 1 : -1)); Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); } int gelAmount = Main.rand.Next(1, 4); var gelPosition = position + new Vector2(speedX, speedY).OfLength(Item.width); // Tip of the nozzle if (!Collision.CanHit(player.Center, 0, 0, gelPosition, 0, 0)) { gelPosition = position; // So that it doesn't go through walls } for (int i = 0; i < gelAmount; i++) { var gelVelocity = new Vector2(speedX, speedY) .RotatedBy(shootArc * Main.rand.NextFloat(-1, +1)) // Random inside the fire arc * Main.rand.NextFloat(0, 2); // Random power Projectile.NewProjectile(gelPosition, gelVelocity, Mod.Find <ModProjectile>(nameof(ProjGelFire)).Type, damage, 0, player.whoAmI); } if (Main.rand.NextBool(1000)) { Main.NewText("Burn, baby! Burn!", Color.Orange); } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int amount = Main.rand.Next(1, 4); for (int i = 0; i <= 2; i++) { if (Main.rand.NextBool(6)) { amount++; } } if (player.strongBees && Main.rand.NextBool(3)) { amount++; } for (int i = 0; i < amount; i++) { speedX += Main.rand.Next(-35, 36) * 0.02f; speedY += Main.rand.Next(-35, 36) * 0.02f; int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, player.beeType(), player.beeDamage(damage), player.beeKB(knockBack), player.whoAmI); Main.projectile[proj].minion = true; Main.projectile[proj].magic = false; } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 center = player.MountedCenter; Vector2 velocity = new Vector2(player.direction, 0); //Fist movement direction int nextFist = -1; for (int i = 0; i < 20; i++) // Makes x attempts at creating a projectile that the player can reach { do { nextFist = Main.rand.Next(FistPositions.Length); }while (nextFist == PreviousFist); // Can't match the position of the previous one var offset = FistPositions[nextFist]; offset.X *= player.direction; position = center + offset; if (Collision.CanHit(center, 0, 0, position, 0, 0)) { break; } } PreviousFist = nextFist; Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float cursorAngle = (Main.MouseWorld - player.Center).ToRotation().ToDegrees(); if (cursorAngle >= -135 && cursorAngle <= -45) { position = -Vector2.UnitY; // Up } else if (cursorAngle >= -45 && cursorAngle <= +45) { position = Vector2.UnitX; // Right } else if (cursorAngle >= +45 && cursorAngle <= +135) { position = Vector2.UnitY; // Down } else { position = -Vector2.UnitX; // Left } var proj = Projectile.NewProjectileDirect(Vector2.Zero, Vector2.Zero, type, damage, knockBack, player.whoAmI); var mane = proj.ModProjectile as ProjLionsMane; mane.RelativePosition = position.OfLength(5); mane.Direction = player.altFunctionUse == 2 ? -1 : +1; proj.netUpdate = true; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = Mod.Find <ModProjectile>(nameof(RainbowArrow)).Type; RainbowArrow.ArrowMode mode; if (ShootingWhiteArrow(player)) { mode = RainbowArrow.ArrowMode.White; } else { mode = RainbowArrow.ArrowMode.Normal; if (NextColor < 11) { NextColor++; } else { NextColor = 0; } } var proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); var arrow = proj.ModProjectile as RainbowArrow; arrow.Mode = mode; arrow.ColorId = NextColor; proj.netUpdate = true; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { player.AddBuff(Item.buffType, 2); Vector2 spawnPos = Main.MouseWorld; velocity = velocity.RotatedBy(Math.PI / 2); player.SpawnMinionOnCursor(source, player.whoAmI, ModContent.ProjectileType <OpticRetinazer>(), Item.damage, knockback, default, velocity);
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { var proj = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); var laser = proj.ModProjectile as ProjLaserPointer; laser.LaserColor = LaserColor; return(false); }
public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (AccessoryProperties.YoyoDupe && YoyoProjectiles.YoyoProjectilesList.Contains(type)) { SpawnProjectiles.CreateDuplicate(type, position, velocity.X, velocity.Y, damage, knockback, 2, player.GetSource_ItemUse(item)); } return(base.Shoot(item, player, source, position, velocity, type, damage, knockback)); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) { damage = (int)(damage * 0.75); } Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { var proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); proj.GetGlobalProjectile <VirtuousProjectile>().spotter = true; // Projectile can spawn a Crosshair proj.netUpdate = true; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[proj].minion = true; Main.projectile[proj].melee = false; Main.projectile[proj].ranged = false; Main.projectile[proj].magic = false; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = -1; i <= 1; i++) { Projectile.NewProjectile(source, position, velocity.RotatedBy(MathHelper.ToRadians(30) * i), type, damage, knockback, player.whoAmI, lastThrown); } lastThrown = type; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) { FargoSoulsUtil.NewSummonProjectile(source, position, velocity, type, Item.damage, knockback, player.whoAmI); return(false); } return(base.Shoot(player, source, position, velocity, type, damage, knockback)); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int numberProjectiles = 9; for (int i = 0; i < numberProjectiles; i++) { velocity = velocity.RotatedBy(MathHelper.ToRadians(45) * (Main.rand.NextDouble() - 0.5)); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = ModContent.ProjectileType <PrimeLaser>(); int p = Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, type, damage, knockback, player.whoAmI); if (p < 1000) { SplitProj(Main.projectile[p], 21); } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //initial spawn if (player.ownedProjectileCounts[ModContent.ProjectileType <VortexRitualProj>()] <= 0) { Vector2 mouse = Main.MouseWorld; Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType <VortexRitualProj>(), damage, knockback, player.whoAmI, 0, 300); //some funny dust } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int amount = Main.rand.Next(1, 4); for (int i = 0; i < amount; i++) { speedX += Main.rand.Next(-35, 36) * 0.05f; speedY += Main.rand.Next(-35, 36) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[proj].minion = true; Main.projectile[proj].magic = false; } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { player.AddBuff(ModContent.BuffType <Buffs.Minions.BrainMinion>(), 2); Vector2 spawnPos = Main.MouseWorld; float usedminionslots = 0; var minions = Main.projectile.Where(x => x.minionSlots > 0 && x.owner == player.whoAmI && x.active); foreach (Projectile minion in minions) { usedminionslots += minion.minionSlots; } if (player.ownedProjectileCounts[type] == 0 && usedminionslots != player.maxMinions) //only spawn brain minion itself when the player doesnt have any, and if minion slots aren't maxxed out { player.SpawnMinionOnCursor(source, player.whoAmI, type, Item.damage, knockback); } player.SpawnMinionOnCursor(source, player.whoAmI, ModContent.ProjectileType <CreeperMinion>(), Item.damage, knockback, default, Main.rand.NextVector2Circular(10, 10));
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { damage = (int)(damage / 4.0 * 1.3); float minionSlotsUsed = 0; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && !Main.projectile[i].hostile && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].minionSlots > 0) { minionSlotsUsed += Main.projectile[i].minionSlots; } } float modifier = player.maxMinions - minionSlotsUsed; if (modifier < 1) { modifier = 1; } if (modifier > 7) { modifier = 7; } float spread = MathHelper.ToRadians(60f / 3.5f); if (modifier % 2 == 0) { Vector2 baseSpeed = velocity.RotatedBy(spread * (-modifier / 2 + 0.5f)); //half offset for v spread for (int i = 0; i < modifier; i++) { FargoSoulsUtil.NewSummonProjectile(source, position, baseSpeed.RotatedBy(spread * (i + Main.rand.NextFloat(-0.5f, 0.5f))), type, Item.damage, knockback, player.whoAmI); } } else { Vector2 baseSpeed = velocity; int max = (int)modifier / 2; for (int i = -max; i <= max; i++) { FargoSoulsUtil.NewSummonProjectile(source, position, baseSpeed.RotatedBy(spread * (i + Main.rand.NextFloat(-0.5f, 0.5f))), type, Item.damage, knockback, player.whoAmI); } } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float x; float y = player.Center.Y - Main.rand.NextFloat(600, 700); const int timeLeft = 45 * 2; for (int i = 0; i < 5; i++) { x = player.Center.X + 2f * Main.rand.NextFloat(-400, 400); float ai1 = Main.rand.Next(timeLeft); int p = Projectile.NewProjectile(source, x, y, Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(15f, 20f), type, damage, knockback, player.whoAmI, 0f, ai1); if (p != Main.maxProjectiles) { Main.projectile[p].timeLeft = timeLeft; } } return(false); }
public sealed override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { var orbitalPlayer = player.GetModPlayer <OrbitalPlayer>(); if (orbitalPlayer.active[this.OrbitalType]) // The orbital is already active { if (Special != SpecialType.None) // Alternate use mechanics { if (Special == SpecialType.RightClick) { // Left-click resets duration, right-click activates special if (player.altFunctionUse != 2) { orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this); } else { orbitalPlayer.SpecialFunctionActive = true; } } else if (Special == SpecialType.Reuse) { // Activates special and resets duration orbitalPlayer.SpecialFunctionActive = true; orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this); } } } else // The orbital is not active { orbitalPlayer.ResetOrbitals(); orbitalPlayer.active[this.OrbitalType] = true; orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this); for (int i = 0; i < this.Amount; i++) { // The desired rotation will be passed as velocity Vector2 rotation = Vector2.UnitX.RotatedBy(Tools.FullCircle * i / this.Amount); Projectile.NewProjectile(source, position, rotation, type, damage, knockBack, player.whoAmI); } } return(false); // Doesn't shoot normally }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { flip = !flip; if (player.altFunctionUse == 2) //right click { velocity = velocity.RotatedBy(Math.PI / 2 * (flip ? 1 : -1)); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, (float)Math.PI / 120 * (flip ? -1 : 1)); } else { const int max = 5; for (int i = 0; i < max; i++) { Projectile.NewProjectile(source, position, velocity.RotatedBy(2 * Math.PI / max * i), type, damage, knockback, player.whoAmI, 0, (Main.MouseWorld - position).Length() * (flip ? 1 : -1)); } } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int shoot; if (counter > 2) { shoot = ProjectileID.ClothiersCurse; counter = 0; } else { shoot = ModContent.ProjectileType <Bonez>(); } Main.projectile[Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, shoot, damage, knockback, player.whoAmI)].DamageType = DamageClass.Ranged; counter++; return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 muzzleOffset = Vector2.Normalize(velocity) * 46f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; } { //Item.damage = 80; int numberProjectiles = 2 + Main.rand.Next(2); for (int i = 0; i < numberProjectiles; i++) { Vector2 perturbedSpeed = velocity.RotatedByRandom(MathHelper.ToRadians(30)); Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <MahogunyLeafProjectile>(), (int)(damage * 0.6), knockback, player.whoAmI); } } return(true); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 20; i++) // Makes 20 attempts at finding a projectile position that the player can reach { position = player.MountedCenter + Main.rand.NextVector2(20, 60); if (Collision.CanHit(player.MountedCenter, 0, 0, position, 0, 0)) { break; } } // Right click: Horizontal, in the direction the player is facing // Left click: Middlepoint between straight from the player to the cursor and straight from the sword to the cursor velocity = player.altFunctionUse == 2 ? new Vector2(player.direction * Item.shootSpeed, 0) : Vector2.Lerp(Main.MouseWorld - player.Center, Main.MouseWorld - position, 0.5f).OfLength(Item.shootSpeed); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile.NewProjectile(source, position + Vector2.Normalize(velocity) * 60f, velocity, type, damage, knockback, player.whoAmI); if (--skullTimer < 0) { skullTimer = 5; SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot); //float ai = Main.rand.NextFloat((float)Math.PI * 2); /*for (int i = 0; i <= 4; i++) * { * int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY).RotatedByRandom(MathHelper.Pi / 18), * ModContent.ProjectileType<DragonFireball>(), damage * 3, knockBack, player.whoAmI); * Main.projectile[p].netUpdate = true; * }*/ Projectile.NewProjectile(source, position, 2f * velocity,//.RotatedByRandom(MathHelper.Pi / 18), ModContent.ProjectileType <DragonFireball>(), damage, knockback * 6f, player.whoAmI); } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { // Position is off the corner of the screen and velocity points toward the mouse Vector2 basePosition = player.Center + new Vector2(-player.direction * (Main.screenWidth / 2), -(Main.screenHeight / 2 + 100)); Vector2 baseVelocity = (Main.MouseWorld - basePosition).OfLength(Item.shootSpeed); int projAmount = Main.rand.Next(2, 6); for (int i = 0; i < projAmount; i++) { int newType = Main.rand.NextBool(2) ? type : Mod.Find <ModProjectile>(nameof(WarArrow)).Type; // Arrows can be replaced by the special type var velocityRotation = newType switch { ProjectileID.JestersArrow => 0, ProjectileID.HolyArrow => 7.ToRadians(), _ => 10.ToRadians(), }; Vector2 newVelocity = baseVelocity.RotatedBy(velocityRotation * -player.direction); Vector2 newPosition = basePosition + baseVelocity.Perpendicular(Main.rand.Next(150), Main.rand.NextBool(2)); // Random offset in either direction var proj = Projectile.NewProjectileDirect(null, newPosition, newVelocity, newType, damage, knockBack, player.whoAmI); proj.tileCollide = false; proj.noDropItem = true; proj.netUpdate = true; var modProj = proj.GetGlobalProjectile <VirtuousProjectile>(); modProj.artOfWar = true; modProj.collidePositionY = player.position.Y; } SoundEngine.PlaySound(SoundID.Item5, basePosition); //if (player.itemAnimation >= item.useAnimation - item.useTime) // If I wanted to make it shoot arrows normally as well //{ // Main.PlaySound(SoundID.Item5, position); // return true; //} return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int p = Projectile.NewProjectile(player.GetSource_ItemUse(source.Item), player.Center, velocity, type, damage, knockback, player.whoAmI); float spread = MathHelper.Pi / 8; if (numSpikes == 5) { spread = MathHelper.Pi / 5; } FargoSoulsGlobalProjectile.SplitProj(Main.projectile[p], numSpikes, spread, 1); numSpikes += 2; if (numSpikes > 5) { numSpikes = 3; } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { player.AddBuff(ModContent.BuffType <PrimeMinionBuff>(), 2); Vector2 spawnPos = Main.MouseWorld; float usedminionslots = 0; var minions = Main.projectile.Where(x => x.minionSlots > 0 && x.owner == player.whoAmI && x.active); foreach (Projectile minion in minions) { usedminionslots += minion.minionSlots; } if (usedminionslots < player.maxMinions) { if (player.ownedProjectileCounts[type] == 0) //only spawn brain minion itself when the player doesnt have any, and if minion slots aren't maxxed out { FargoSoulsUtil.NewSummonProjectile(source, spawnPos, Vector2.Zero, type, Item.damage, knockback, player.whoAmI); } if (++counter >= 4) { counter = 0; } int limbType; switch (counter) { case 0: limbType = ModContent.ProjectileType <PrimeMinionVice>(); break; case 1: limbType = ModContent.ProjectileType <PrimeMinionSaw>(); break; case 2: limbType = ModContent.ProjectileType <PrimeMinionLaserGun>(); break; default: limbType = ModContent.ProjectileType <PrimeMinionCannon>(); break; } FargoSoulsUtil.NewSummonProjectile(source, spawnPos, Main.rand.NextVector2Circular(10, 10), limbType, Item.damage, knockback, player.whoAmI); } return(false); }
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { /*Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); * if (--skullTimer < 0) * { * skullTimer = 10; * //float ai = Main.rand.NextFloat((float)Math.PI * 2); * Projectile.NewProjectile(position, 1.5f * new Vector2(speedX, speedY), ModContent.ProjectileType<HellSkull>(), damage / 2, knockBack, player.whoAmI, -1); * }*/ position += Vector2.Normalize(velocity) * 40f; int max = Main.rand.Next(1, 4); float rotation = MathHelper.Pi / 4f / max * Main.rand.NextFloat(0.25f, 0.75f) * 0.75f; counter++; for (int i = -max; i <= max; i++) { int newType; switch (Main.rand.Next(3)) { case 0: newType = ModContent.ProjectileType <HellBone>(); break; case 1: newType = ModContent.ProjectileType <HellBonez>(); break; default: newType = ModContent.ProjectileType <HellSkeletron>(); break; } Projectile.NewProjectile(source, position, Main.rand.NextFloat(0.8f, 1.2f) * velocity.RotatedBy(rotation * i + Main.rand.NextFloat(-rotation, rotation)), newType, damage, knockback, player.whoAmI); } if (counter > 4) { for (int j = -1; j <= 1; j += 2) { Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType <HellSkull2>(), damage, knockback, player.whoAmI, 0, j); } counter = 0; } return(false); }