public static void GladiatorSpearDrop(FargoSoulsPlayer modPlayer, Item item, Projectile projectile, NPC target, int damage) { Player player = modPlayer.Player; int spearDamage = projectile != null ? projectile.damage : item != null ? item.damage : damage; spearDamage /= 4; if (spearDamage > 0) { if (!modPlayer.TerrariaSoul) { spearDamage = Math.Min(spearDamage, FargoSoulsUtil.HighestDamageTypeScaling(player, 300)); } for (int i = 0; i < 4; i++) { Vector2 spawn = new Vector2(target.Center.X + Main.rand.NextFloat(-300, 300), target.Center.Y - Main.rand.Next(600, 801)); Vector2 speed = target.Center + target.velocity * i * 5 * Main.rand.NextFloat(0.5f, 1.5f) - spawn; speed.Normalize(); speed *= 15f * Main.rand.NextFloat(0.8f, 1.2f); Projectile.NewProjectile(player.GetSource_Misc(""), spawn, speed, ModContent.ProjectileType <GladiatorJavelin>(), spearDamage, 4f, Main.myPlayer); } modPlayer.GladiatorCD = modPlayer.WillForce ? 10 : 30; } }
public override void AI() { Projectile.damage = FargoSoulsUtil.HighestDamageTypeScaling(Main.player[Projectile.owner], 666); base.AI(); Main.player[Projectile.owner].itemTime = 0; Main.player[Projectile.owner].itemAnimation = 0; if (Main.player[Projectile.owner].reuseDelay < 17) { Main.player[Projectile.owner].reuseDelay = 17; } }
public static void BorealSnowballs(FargoSoulsPlayer modPlayer, int damage) { Player player = modPlayer.Player; Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f; int snowballDamage = damage / 2; if (!modPlayer.TerrariaSoul) { snowballDamage = Math.Min(snowballDamage, FargoSoulsUtil.HighestDamageTypeScaling(player, modPlayer.WoodForce ? 300 : 20)); } int p = Projectile.NewProjectile(player.GetSource_Misc(""), player.Center, vel, ProjectileID.SnowBallFriendly, snowballDamage, 1, Main.myPlayer); int numSnowballs = modPlayer.WoodForce ? 5 : 3; if (p != Main.maxProjectiles) { FargoSoulsGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1); } }
public static void CopperProc(FargoSoulsPlayer modPlayer, NPC target) { if (modPlayer.Player.GetToggleValue("Copper") && modPlayer.CopperProcCD == 0) { target.AddBuff(BuffID.Electrified, 180); int dmg = 20; int maxTargets = 1; int cdLength = 300; if (modPlayer.TerraForce) { dmg = 100; maxTargets = 10; cdLength = 200; } List <int> npcIndexes = new List <int>(); float closestDist = 500f; NPC closestNPC; for (int i = 0; i < maxTargets; i++) { closestNPC = null; //find closest npc to target that has not been chained to yet for (int j = 0; j < Main.maxNPCs; j++) { NPC npc = Main.npc[j]; if (npc.active && npc.whoAmI != target.whoAmI && npc.CanBeChasedBy() && npc.Distance(target.Center) < closestDist && !npcIndexes.Contains(npc.whoAmI) && Collision.CanHitLine(npc.Center, 0, 0, target.Center, 0, 0)) { closestNPC = npc; closestDist = npc.Distance(target.Center); //break; } } if (closestNPC != null) { npcIndexes.Add(closestNPC.whoAmI); Vector2 ai = closestNPC.Center - target.Center; float ai2 = Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai) * 20; Projectile p = FargoSoulsUtil.NewProjectileDirectSafe(modPlayer.Player.GetSource_ItemUse(modPlayer.Player.HeldItem), target.Center, velocity, ModContent.ProjectileType <CopperLightning>(), FargoSoulsUtil.HighestDamageTypeScaling(modPlayer.Player, dmg), 0f, modPlayer.Player.whoAmI, ai.ToRotation(), ai2); } else { break; } target = closestNPC; } modPlayer.CopperProcCD = cdLength; } }
public override void AI() { Player player = Main.player[Projectile.owner]; if (player.whoAmI == Main.myPlayer && (player.dead || !player.GetModPlayer <FargoSoulsPlayer>().DarkArtistEnchantActive || !player.GetToggleValue("DarkArt"))) { Projectile.Kill(); return; } Projectile.netUpdate = true; // Please sync ech //pulsation mumbo jumbo Projectile.position.X = (float)((int)Projectile.position.X); Projectile.position.Y = (float)((int)Projectile.position.Y); float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; Projectile.scale = num395 + 0.95f; //charging above the player if (Projectile.ai[0] == 0) { //float above player Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2) + player.gfxOffY - 50f; //rotate towards and face mouse const float rotationModifier = 0.08f; if (player.whoAmI == Main.myPlayer) { if (Main.MouseWorld.X > Projectile.Center.X) { Projectile.spriteDirection = 1; Projectile.rotation = Projectile.rotation.AngleLerp( (new Vector2(Main.MouseWorld.X, Main.MouseWorld.Y) - Projectile.Center).ToRotation(), rotationModifier); } else { Projectile.spriteDirection = -1; //absolute fuckery so it faces the right direction Vector2 target = new Vector2(Main.MouseWorld.X - (Main.MouseWorld.X - Projectile.Center.X) * 2, Main.MouseWorld.Y - (Main.MouseWorld.Y - Projectile.Center.Y) * 2) - Projectile.Center; Projectile.rotation = Projectile.rotation.AngleLerp(target.ToRotation(), rotationModifier); } } //2 seconds const float chargeTime = 120; if (player.controlUseItem) { //charge up while attacking Projectile.localAI[0]++; //charge level 1 if (Projectile.localAI[0] == chargeTime) { if (Projectile.owner == Main.myPlayer) { Projectile.netUpdate = true; } double spread = 2 * Math.PI / 36; for (int i = 0; i < 36; i++) { Vector2 velocity = new Vector2(2, 2).RotatedBy(spread * i); int index2 = Dust.NewDust(Projectile.Center, 0, 0, DustID.FlameBurst, velocity.X, velocity.Y, 100); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; } } //charging further if (Projectile.localAI[0] > chargeTime) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FlameBurst, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f); Main.dust[d].noGravity = true; } } else { //let go and fire if (Projectile.localAI[0] > chargeTime) { if (Projectile.owner == Main.myPlayer) { Projectile.netUpdate = true; } Vector2 mouse = Main.MouseWorld; destination = mouse; //switch to travel mode Projectile.ai[0] = 1; Projectile.localAI[0] = 0; player.GetModPlayer <FargoSoulsPlayer>().DarkArtistSpawn = true; //player.GetModPlayer<FargoSoulsPlayer>().DarkSpawnCD = 5; } } } else { //travelling to destination if (Vector2.Distance(Projectile.Center, destination) > 10 && Projectile.localAI[0] == 0) { Vector2 velocity = Vector2.Normalize(destination - Projectile.Center) * 10; Projectile.velocity = velocity; //dust int dustId = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 2f), Projectile.width, Projectile.height + 5, DustID.FlameBurst, 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, DustID.FlameBurst, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; } //attack as a sentry else { Projectile.localAI[0] = 1; Projectile.velocity = Vector2.Zero; int attackRate = 20; Projectile.ai[1] += 1f; if (Projectile.ai[1] >= attackRate) { float num = 2000f; int npcIndex = -1; for (int i = 0; i < 200; i++) { float dist = Vector2.Distance(Projectile.Center, Main.npc[i].Center); if (dist < num && dist < 600 && Main.npc[i].CanBeChasedBy(Projectile, false)) { npcIndex = i; num = dist; } } if (npcIndex != -1) { NPC target = Main.npc[npcIndex]; if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, target.position, target.width, target.height)) { Vector2 velocity = Vector2.Normalize(target.Center - Projectile.Center) * 10; int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType <MegaFlameburst>(), FargoSoulsUtil.HighestDamageTypeScaling(player, 85), 4, Projectile.owner, Projectile.whoAmI); SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot, Projectile.Center); const float rotationModifier = 0.08f; for (int i = 0; i < 20; i++) { if (target.Center.X > Projectile.Center.X) { Projectile.spriteDirection = 1; Projectile.rotation = Projectile.rotation.AngleLerp( (new Vector2(target.Center.X, target.Center.Y) - Projectile.Center).ToRotation(), rotationModifier); } else { Projectile.spriteDirection = -1; //absolute fuckery so it faces the right direction Vector2 rotation = new Vector2(target.Center.X - (target.Center.X - Projectile.Center.X) * 2, target.Center.Y - (target.Center.Y - Projectile.Center.Y) * 2) - Projectile.Center; Projectile.rotation = Projectile.rotation.AngleLerp(rotation.ToRotation(), rotationModifier); } } } } Projectile.ai[1] = 0f; //kill if too far away if (Vector2.Distance(Main.player[Projectile.owner].Center, Projectile.Center) > 2000) { Projectile.Kill(); } } } } }
public static void ShadewoodProc(FargoSoulsPlayer modPlayer, NPC target, Projectile projectile) { Player player = modPlayer.Player; bool trueMelee = (projectile == null || projectile.aiStyle == 19); if (target.HasBuff(ModContent.BuffType <SuperBleed>()) && (trueMelee || modPlayer.ShadewoodCD == 0) && (projectile == null || projectile.type != ModContent.ProjectileType <SuperBlood>()) && player.whoAmI == Main.myPlayer) { for (int i = 0; i < Main.rand.Next(3, 6); i++) { Projectile.NewProjectile(player.GetSource_Misc(""), target.Center.X, target.Center.Y - 20, 0f + Main.rand.NextFloat(-5, 5), Main.rand.NextFloat(-5, 5), ModContent.ProjectileType <SuperBlood>(), FargoSoulsUtil.HighestDamageTypeScaling(player, 20), 0f, Main.myPlayer); } if (modPlayer.WoodForce) { target.AddBuff(BuffID.Ichor, 30); } //true melee attack does not go on cooldown if (!trueMelee) { modPlayer.ShadewoodCD = 30; } } }
public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); Projectile.ai[0]++; Player player = Main.player[Projectile.owner]; FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); //falls to the ground if (!modPlayer.WizardEnchantActive && !modPlayer.LifeForce) { Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; } } //bonus damage if fully grown Projectile.damage = FargoSoulsUtil.HighestDamageTypeScaling(player, Projectile.frame == 4 ? 50 : 15); if (Projectile.frame != 4) { Projectile.frameCounter++; if (Projectile.frameCounter >= 60) { Projectile.frameCounter = 0; Projectile.frame = (Projectile.frame + 1) % 5; //dust if (Projectile.frame == 4) { const int max = 16; for (int i = 0; i < max; i++) { Vector2 vector6 = Vector2.UnitY * 5f; vector6 = vector6.RotatedBy((i - (max / 2 - 1)) * 6.28318548f / max) + Projectile.Center; Vector2 vector7 = vector6 - Projectile.Center; int d = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Grass, 0f, 0f, 0, default(Color), 1.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity = vector7; } } } } else { if (player.Hitbox.Intersects(Projectile.Hitbox)) { int heal = 25; if (modPlayer.LifeForce || modPlayer.WizardEnchantActive) { heal *= 2; } player.GetModPlayer <FargoSoulsPlayer>().HealPlayer(heal); SoundEngine.PlaySound(SoundID.Item2, player.Center); Projectile.Kill(); } } Projectile.width = (int)(32 * Projectile.scale); Projectile.height = (int)(32 * Projectile.scale); //make it not float when shrinking if (Projectile.ai[0] > 1800) //make Projectile shrink and disappear after 30 seconds instead of lasting forever { Projectile.scale -= 0.01f; } if (Projectile.scale <= 0) { Projectile.Kill(); } }
private void SpawnFire(FargoSoulsPlayer modPlayer) { int damage = 50; if (modPlayer.LifeForce || modPlayer.WizardEnchantActive) { damage *= 2; } //leave some fire behind Projectile[] fires = FargoSoulsUtil.XWay(5, Projectile.GetSource_FromThis(), Projectile.Center, ModContent.ProjectileType <PumpkinFlame>(), 3, FargoSoulsUtil.HighestDamageTypeScaling(modPlayer.Player, damage), 0); SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); }
public override void AI() { Player player = Main.player[Projectile.owner]; FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); Projectile.netUpdate = true; if (player.whoAmI == Main.myPlayer && (player.dead || !(modPlayer.ShadowEnchantActive || modPlayer.TerrariaSoul) || !player.GetToggleValue("Shadow"))) { modPlayer.ShadowEnchantActive = false; Projectile.Kill(); return; } // CD if (Projectile.ai[0] > 0) { Projectile.ai[0]--; //dusts indicate its back if (Projectile.ai[0] == 0) { const int num226 = 18; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX.RotatedBy(Projectile.rotation) * 6f; 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.Shadowflame, 0f, 0f, 0, default(Color), 2f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } } } float num395 = Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; Projectile.scale = num395 + 0.95f; if (Projectile.owner == Main.myPlayer) { //rotation mumbo jumbo float distanceFromPlayer = 250; Lighting.AddLight(Projectile.Center, 0.1f, 0.4f, 0.2f); Projectile.position = player.Center + new Vector2(distanceFromPlayer, 0f).RotatedBy(Projectile.ai[1]); Projectile.position.X -= Projectile.width / 2; Projectile.position.Y -= Projectile.height / 2; float rotation = (float)Math.PI / 120; Projectile.ai[1] -= rotation; if (Projectile.ai[1] > (float)Math.PI) { Projectile.ai[1] -= 2f * (float)Math.PI; Projectile.netUpdate = true; } Projectile.rotation = Projectile.ai[1] + (float)Math.PI / 2f; //wait for CD if (Projectile.ai[0] != 0f) { return; } //detect being hit foreach (Projectile proj in Main.projectile.Where(proj => proj.active && proj.friendly && !proj.hostile && proj.owner == Projectile.owner && proj.damage > 0 && !FargoSoulsUtil.IsSummonDamage(proj, false) && proj.type != ModContent.ProjectileType <ShadowBall>() && proj.Colliding(proj.Hitbox, Projectile.Hitbox))) { int numBalls = 5; int dmg = 25; if (modPlayer.AncientShadowEnchantActive) { numBalls = 10; dmg = 50; } int damage = FargoSoulsUtil.HighestDamageTypeScaling(player, dmg); Projectile[] balls = FargoSoulsUtil.XWay(numBalls, Projectile.GetSource_FromThis(), Projectile.Center, ModContent.ProjectileType <ShadowBall>(), 6, damage, 0); foreach (Projectile ball in balls) { ball.originalDamage = damage; } if (FargoSoulsUtil.CanDeleteProjectile(proj)) { proj.Kill(); } Projectile.ai[0] = 300; break; } } }
// public override bool ReforgePrice(Item item, ref int reforgePrice, ref bool canApplyDiscount) // { // if (Main.LocalPlayer.GetModPlayer<FargoSoulsPlayer>().SecurityWallet) // reforgePrice /= 2; // return true; // } // //summon variants // private static readonly int[] Summon = { ItemID.NimbusRod, ItemID.CrimsonRod, ItemID.BeeGun, ItemID.WaspGun, ItemID.PiranhaGun, ItemID.BatScepter }; // public override bool CanRightClick(Item item) // { // if (Array.IndexOf(Summon, item.type) > -1) // { // return true; // } // return base.CanRightClick(item); // } // public override void RightClick(Item item, Player player) // { // int newType = -1; // if (Array.IndexOf(Summon, item.type) > -1) // { // newType = mod.ItemType(ItemID.GetUniqueKey(item.type).Replace("Terraria ", string.Empty) + "Summon"); // } // if (newType != -1) // { // int num = Item.NewItem(player.getRect(), newType, prefixGiven: item.prefix); // if (Main.netMode == NetmodeID.MultiplayerClient) // { // NetMessage.SendData(MessageID.SyncItem, number: num, number2: 1f); // } // } // } public override bool WingUpdate(int wings, Player player, bool inUse) { FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); if (modPlayer.ChloroEnchantActive && player.GetToggleValue("Jungle") && inUse) { modPlayer.CanJungleJump = false; //spwn cloud if (modPlayer.JungleCD == 0) { int dmg = (modPlayer.NatureForce || modPlayer.WizardEnchantActive) ? 150 : 75; SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f }, player.Center); FargoSoulsUtil.XWay(10, player.GetSource_Accessory(modPlayer.ChloroEnchantItem), new Vector2(player.Center.X, player.Center.Y + (player.height / 2)), ProjectileID.SporeCloud, 3f, FargoSoulsUtil.HighestDamageTypeScaling(player, dmg), 0); modPlayer.JungleCD = 8; } } return(base.WingUpdate(wings, player, inUse)); }
public static void CactusSelfProc(FargoSoulsPlayer modPlayer) { if (modPlayer.CactusProcCD == 0) { Player player = modPlayer.Player; int dmg = 20; int numNeedles = 8; if (modPlayer.LifeForce || modPlayer.WizardEnchantActive) { dmg = 75; numNeedles = 16; } Projectile[] projs = FargoSoulsUtil.XWay(numNeedles, player.GetSource_ItemUse(player.HeldItem), player.Center, ModContent.ProjectileType <CactusNeedle>(), 4, FargoSoulsUtil.HighestDamageTypeScaling(player, dmg), 5f); double randomRotation = Main.rand.NextDouble() * MathHelper.Pi * 2; for (int i = 0; i < projs.Length; i++) { if (projs[i] == null) { continue; } Projectile p = projs[i]; p.GetGlobalProjectile <FargoSoulsGlobalProjectile>().CanSplit = false; p.ai[0] = 1; //these needles can inflict enemies with needled p.velocity = p.velocity.RotatedBy(randomRotation); } modPlayer.CactusProcCD = 15; } }