public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockback) { int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI); FargoGlobalProjectile.SplitProj(Main.projectile[p], Main.rand.Next(3, 6), MathHelper.Pi / 5, 1); return(false); }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockback) { damage = (int)(damage / 4.0 * 1.1); 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].minion) { minionSlotsUsed += Main.projectile[i].minionSlots; } } float modifier = player.maxMinions - minionSlotsUsed + 1; if (modifier < 1) { modifier = 1; } if (modifier > 7) { modifier = 7; } if (modifier % 2 == 0) { float spread = MathHelper.ToRadians(80 / 3.5f); Vector2 baseSpeed = new Vector2(speedX, speedY).RotatedBy(spread * (-modifier / 2 + 0.5f)); //half offset for v spread for (int i = 0; i < modifier; i++) { Projectile.NewProjectile(player.Center, baseSpeed.RotatedBy(spread * i), type, damage, knockback, player.whoAmI); } } else { int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI); if (p != Main.maxProjectiles) { float spread = MathHelper.ToRadians(80f / 7 * modifier * 2); FargoGlobalProjectile.SplitProj(Main.projectile[p], (int)modifier, spread, 1); } } return(false); }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockback) { int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI); float spread = MathHelper.Pi / 8; if (numSpikes == 5) { spread = MathHelper.Pi / 5; } FargoGlobalProjectile.SplitProj(Main.projectile[p], numSpikes, spread, 1); numSpikes += 2; if (numSpikes > 5) { numSpikes = 3; } return(false); }
public override bool CanUseItem(Item item, Player player) { FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if (modPlayer.IronGuard) { //Main.NewText($"iron {modPlayer.ironShieldCD}, {modPlayer.ironShieldTimer}"); modPlayer.IronGuard = false; modPlayer.wasHoldingShield = false; player.shield_parry_cooldown = 0; //prevent that annoying tick sound //check is necessary so if player does a real parry then switches to right click weapon, using it won't reset cooldowns if (modPlayer.ironShieldCD == 40 && modPlayer.ironShieldTimer == 20) { modPlayer.ironShieldCD = 0; modPlayer.ironShieldTimer = 0; } } //dont use hotkeys in stasis if (player.HasBuff(ModContent.BuffType <GoldenStasis>())) { if (item.type == ItemID.RodofDiscord) { player.ClearBuff(ModContent.BuffType <Buffs.Souls.GoldenStasis>()); } else { return(false); } } if (FargoSoulsWorld.MasochistMode) { if (item.type == ItemID.RodofDiscord && (modPlayer.LihzahrdCurse || (Framing.GetTileSafely(Main.MouseWorld).wall == WallID.LihzahrdBrickUnsafe && !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()]))) { return(false); } if (modPlayer.LihzahrdCurse && (item.type == ItemID.WireKite || item.type == ItemID.WireCutter)) { return(false); } } if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow) { int damage = (int)(item.mana / (1f - player.endurance) + player.statDefense); player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), damage, 0); player.immune = false; player.immuneTime = 0; } if (modPlayer.BuilderMode && (item.createTile != -1 || item.createWall != -1) && item.type != ItemID.PlatinumCoin && item.type != ItemID.GoldCoin) { item.useTime = 1; item.useAnimation = 1; } if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0 && //non weapons and weapons with no ammo begone item.damage > 0 && player.HasAmmo(item, true) && !(item.mana > 0 && player.statMana < item.mana) && item.type != ItemID.ExplosiveBunny && item.type != ItemID.Cannonball && item.useTime > 0 && item.createTile == -1 && item.createWall == -1 && item.ammo == AmmoID.None && item.hammer == 0 && item.pick == 0 && item.axe == 0) { modPlayer.AdditionalAttacksTimer = 60; Vector2 position = player.Center; Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position); if (modPlayer.BorealEnchant && player.GetToggleValue("Boreal") && player.whoAmI == Main.myPlayer) { Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f; int p = Projectile.NewProjectile(player.Center, vel, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer); int numSnowballs = 3; if (modPlayer.WoodForce || modPlayer.WizardEnchant) { numSnowballs = 5; } if (p != 1000) { FargoGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1); } } if (modPlayer.CelestialRune && player.GetToggleValue("MasoCelest")) { if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //fireball { Main.PlaySound(SoundID.Item34, position); for (int i = 0; i < 3; i++) { Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f), ModContent.ProjectileType <CelestialRuneFireball>(), (int)(50f * player.meleeDamage), 9f, player.whoAmI); } } if (item.ranged) //lightning { float ai1 = Main.rand.Next(100); Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f; Projectile.NewProjectile(position, vel, ModContent.ProjectileType <CelestialRuneLightningArc>(), (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1); } if (item.magic) //ice mist { Projectile.NewProjectile(position, velocity * 4.25f, ModContent.ProjectileType <CelestialRuneIceMist>(), (int)(50f * player.magicDamage), 4f, player.whoAmI); } if (item.thrown) //ancient vision { Projectile.NewProjectile(position, velocity * 16f, ModContent.ProjectileType <CelestialRuneAncientVision>(), (int)(50f * player.magicDamage), 0, player.whoAmI); } } if (modPlayer.PumpkingsCape && player.GetToggleValue("MasoPump")) { if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //flaming jack { float distance = 2000f; int target = -1; for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].CanBeChasedBy()) { float newDist = Main.npc[i].Distance(player.Center); if (newDist < distance) { distance = newDist; target = i; } } } if (target != -1) { Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f); } } if (item.ranged) //jack o lantern { Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI); } if (item.magic) //bat scepter { for (int i = 0; i < 3; i++) { Vector2 newVel = velocity * 10f; newVel.X += Main.rand.Next(-35, 36) * 0.02f; newVel.Y += Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI); } } } } //critter attack timer if (modPlayer.WoodEnchant && player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed && item.makeNPC > 0) { if (modPlayer.CritterAttackTimer == 0) { Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center); float damageMultiplier = player.minionDamage; int type = -1; int damage = 0; int attackCooldown = 0; switch (item.type) { //case ItemID.Bunny: // type = ProjectileID.ExplosiveBunny; // damage = 10; // attackCooldown = 10; // break; case ItemID.Bird: type = ModContent.ProjectileType <BirdProj>(); damage = 15; attackCooldown = 15; break; case ItemID.BlueJay: type = ModContent.ProjectileType <BlueJayProj>(); damage = 10; attackCooldown = 10; break; case ItemID.Cardinal: type = ModContent.ProjectileType <CardinalProj>(); damage = 20; attackCooldown = 20; break; } if (type != -1) { Projectile.NewProjectile(player.Center, vel * 2f, type, damage, 2, player.whoAmI); modPlayer.CritterAttackTimer = attackCooldown; } } return(false); } if (item.type == ItemID.RodofDiscord) { if (FargoSoulsWorld.MasochistMode && EModeGlobalNPC.AnyBossAlive()) { player.AddBuff(ModContent.BuffType <Buffs.Masomode.ChaosLife>(), 30); modPlayer.MaxLifeReduction += 100; /*player.statLife -= player.statLifeMax2 / 5; * PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); * if (Main.rand.Next(2) == 0) * damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); * if (player.statLife <= 0 && !player.chaosState) //since chaos state will check and kill anyway, avoid doublekill * player.KillMe(damageSource, 1, 0); * player.lifeRegenCount = 0; * player.lifeRegenTime = 0;*/ } } return(true); }
public override bool CanUseItem(Item item, Player player) { FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); //dont use hotkeys in stasis if (player.HasBuff(ModContent.BuffType <GoldenStasis>())) { if (item.type == ItemID.RodofDiscord) { player.ClearBuff(ModContent.BuffType <Buffs.Souls.GoldenStasis>()); } else { return(false); } } if (FargoSoulsWorld.MasochistMode) { if (item.type == ItemID.RodofDiscord && (modPlayer.LihzahrdCurse || (Framing.GetTileSafely(Main.MouseWorld).wall == WallID.LihzahrdBrickUnsafe && !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()]))) { return(false); } if (modPlayer.LihzahrdCurse && (item.type == ItemID.WireKite || item.type == ItemID.WireCutter)) { return(false); } } if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow) { int damage = (int)(item.mana / (1f - player.endurance) + player.statDefense); player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), damage, 0); player.immune = false; player.immuneTime = 0; } if (modPlayer.BuilderMode && (item.createTile != -1 || item.createWall != -1) && item.type != ItemID.PlatinumCoin && item.type != ItemID.GoldCoin) { item.useTime = 1; item.useAnimation = 1; } //non weapons and weapons with no ammo begone if (item.damage <= 0 || !player.HasAmmo(item, true) || (item.mana > 0 && player.statMana < item.mana)) { return(true); } if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0) { modPlayer.AdditionalAttacksTimer = 60; Vector2 position = player.Center; Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position); if (modPlayer.BorealEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.BorealSnowballs)) { Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f; int p = Projectile.NewProjectile(player.Center, vel, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer); int numSnowballs = 3; if (modPlayer.WoodForce || modPlayer.WizardEnchant) { numSnowballs = 5; } if (p != 1000) { FargoGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1); } } if (modPlayer.CelestialRune && SoulConfig.Instance.GetValue(SoulConfig.Instance.CelestialRune)) { if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //fireball { Main.PlaySound(SoundID.Item34, position); for (int i = 0; i < 3; i++) { Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f), ModContent.ProjectileType <CelestialRuneFireball>(), (int)(50f * player.meleeDamage), 9f, player.whoAmI); } } if (item.ranged) //lightning { float ai1 = Main.rand.Next(100); Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f; Projectile.NewProjectile(position, vel, ModContent.ProjectileType <CelestialRuneLightningArc>(), (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1); } if (item.magic) //ice mist { Projectile.NewProjectile(position, velocity * 4.25f, ModContent.ProjectileType <CelestialRuneIceMist>(), (int)(50f * player.magicDamage), 4f, player.whoAmI); } if (item.thrown) //ancient vision { Projectile.NewProjectile(position, velocity * 16f, ModContent.ProjectileType <CelestialRuneAncientVision>(), (int)(50f * player.magicDamage), 0, player.whoAmI); } } if (modPlayer.PumpkingsCape && SoulConfig.Instance.GetValue(SoulConfig.Instance.PumpkingCape)) { if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //flaming jack { float distance = 2000f; int target = -1; for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].CanBeChasedBy()) { float newDist = Main.npc[i].Distance(player.Center); if (newDist < distance) { distance = newDist; target = i; } } } if (target != -1) { Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f); } } if (item.ranged) //jack o lantern { Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI); } if (item.magic) //bat scepter { for (int i = 0; i < 3; i++) { Vector2 newVel = velocity * 10f; newVel.X += Main.rand.Next(-35, 36) * 0.02f; newVel.Y += Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI); } } } } return(true); }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //right click if (player.altFunctionUse == 2) { mode++; if (mode > 5) { mode = 1; } SetUpItem(); return(false); } switch (mode) { //melee case 1: Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("PufferRang"), damage, knockBack, player.whoAmI); break; //range case 2: int num129 = Main.rand.Next(4, 6); for (int num130 = 0; num130 < num129; num130++) { float num131 = (float)Main.mouseX + Main.screenPosition.X - position.X; float num132 = (float)Main.mouseY + Main.screenPosition.Y - position.Y; num131 += (float)Main.rand.Next(-40, 41) * 0.4f; num132 += (float)Main.rand.Next(-40, 41) * 0.4f; Projectile.NewProjectile(position, new Vector2(num131, num132), type, damage, knockBack, player.whoAmI); } break; //magic case 3: int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot = mod.ProjectileType("Bubble"), damage, knockBack, player.whoAmI); FargoGlobalProjectile.SplitProj(Main.projectile[p], 5); break; //summon case 4: Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("FishMinion"), damage, knockBack, player.whoAmI); break; //throwing default: for (int i = 0; i < 10; i++) { Projectile.NewProjectile(position, new Vector2(speedX + Main.rand.Next(-2, 2), speedY + Main.rand.Next(-2, 2)), mod.ProjectileType("SpikyLure"), damage, knockBack, player.whoAmI); } break; } return(false); }
public override bool CanUseItem(Item item, Player player) { FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if (item.type == ItemID.PumpkinPie && player.statLife != player.statLifeMax2 && player.HasBuff(BuffID.PotionSickness)) { return(false); } if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow) { player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), item.mana + item.damage, 0); player.immune = false; player.immuneTime = 0; } //non weapons and weapons with no ammo begone if (item.damage <= 0 || !player.HasAmmo(item, true) || (item.mana > 0 && player.statMana < item.mana)) { return(true); } if (modPlayer.BorealEnchant && ++modPlayer.BorealCount >= 4) { modPlayer.BorealCount = 0; if (Soulcheck.GetValue("Boreal Snowball Support")) { Vector2 velocity = Vector2.Normalize(Main.MouseWorld - player.Center) * (item.shootSpeed > 0 ? item.shootSpeed : 10) * .75f; int p = Projectile.NewProjectile(player.Center, velocity, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer); if (p != 1000 && (player.ZoneSnow || modPlayer.WoodForce)) { FargoGlobalProjectile.SplitProj(Main.projectile[p], 5); } } } if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0) { modPlayer.AdditionalAttacksTimer = 60; Vector2 position = player.Center; Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position); if (modPlayer.CelestialRune && Soulcheck.GetValue("Celestial Rune Support")) { if (item.melee) //fireball { Main.PlaySound(SoundID.Item34, position); for (int i = 0; i < 3; i++) { Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f), mod.ProjectileType("CelestialRuneFireball"), (int)(50f * player.meleeDamage), 9f, player.whoAmI); } } if (item.ranged) //lightning { float ai1 = Main.rand.Next(100); Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f; Projectile.NewProjectile(position, vel, mod.ProjectileType("CelestialRuneLightningArc"), (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1); } if (item.magic) //ice mist { Projectile.NewProjectile(position, velocity * 4.25f, mod.ProjectileType("CelestialRuneIceMist"), (int)(50f * player.magicDamage), 4f, player.whoAmI); } if (item.thrown) //ancient vision { Projectile.NewProjectile(position, velocity * 16f, mod.ProjectileType("CelestialRuneAncientVision"), (int)(50f * player.thrownDamage), 0, player.whoAmI); } } if (modPlayer.PumpkingsCape && Soulcheck.GetValue("Pumpking's Cape Support")) { if (item.melee) //flaming jack { float distance = 2000f; int target = -1; for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].CanBeChasedBy()) { float newDist = Main.npc[i].Distance(player.Center); if (newDist < distance) { distance = newDist; target = i; } } } if (target != -1) { Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f); } } if (item.ranged) //jack o lantern { Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI); } if (item.magic) //bat scepter { for (int i = 0; i < 3; i++) { Vector2 newVel = velocity * 10f; newVel.X += Main.rand.Next(-35, 36) * 0.02f; newVel.Y += Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI); } } } } if (Fargowiltas.Instance.ThoriumLoaded) { ThoriumCanUse(player, item); } return(true); }