public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { if (FargoSoulsUtil.CanDeleteProjectile(projectile)) { projectile.penetrate = 0; projectile.timeLeft = 0; } }
public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { if (FargoSoulsUtil.CanDeleteProjectile(projectile)) { projectile.timeLeft = 0; projectile.GetGlobalProjectile <Projectiles.FargoGlobalProjectile>().canHurt = false; //so ml projs, etc. splash damage wont hrut } }
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (FargoSoulsUtil.CanDeleteProjectile(projectile)) { projectile.penetrate = 0; } damage = 0; NPC.life++; }
public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) { base.OnHitByProjectile(npc, projectile, damage, knockback, crit); if (projectile.maxPenetrate != 1 && FargoSoulsUtil.CanDeleteProjectile(projectile)) { projectile.timeLeft = 0; } }
public override void AI() { const int maxScale = 3; projectile.ai[0]++; //spawning in if (projectile.ai[0] <= 40) { projectile.scale = (projectile.ai[0]) / 40 * maxScale; projectile.alpha = 255 - (int)(255 * projectile.scale / maxScale); projectile.rotation = projectile.rotation - 0.1570796f; if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } int p = Player.FindClosest(projectile.Center, 0, 0); if (p != -1) { projectile.localAI[1] = projectile.Center == Main.player[p].Center ? 0 : projectile.DirectionTo(Main.player[p].Center).ToRotation(); projectile.localAI[1] += (float)Math.PI * 2 / 3 / 2; } } else //if (projectile.ai[0] <= 40 + time) { projectile.scale = maxScale; projectile.alpha = 0; projectile.rotation = projectile.rotation - (float)Math.PI / 60f; if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } else { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } //suck if (timer == 0) { int minDist = 500; Player player = Main.player[projectile.owner]; /*for (int i = 0; i < 200; i++) * { * float distance = projectile.Distance(Main.npc[i].Center); * NPC npc = Main.npc[i]; * * if (!npc.active || npc.townNPC || npc.type == NPCID.TargetDummy || npc.type == NPCID.DD2EterniaCrystal || npc.type == NPCID.DD2LanePortal || npc.boss || * (distance > minDist)) * { * continue; * } * * Vector2 dir = projectile.position - npc.Center; * npc.velocity = dir.SafeNormalize(Vector2.Zero) * 8; * * if (projectile.timeLeft <= 30 && distance < minDist / 4) * { * npc.active = false; * } * }*/ for (int i = 0; i < Main.maxProjectiles; i++) { float distance = projectile.Distance(Main.projectile[i].Center); Projectile proj = Main.projectile[i]; if (!FargoSoulsUtil.CanDeleteProjectile(proj) || (distance > minDist) || proj.type == projectile.type || (proj.owner == projectile.owner && player.GetModPlayer <FargoPlayer>().VortexStealth)) { continue; } Vector2 dir = projectile.position - proj.Center; proj.velocity = dir.SafeNormalize(Vector2.Zero) * 8; if (projectile.timeLeft <= 30 && distance < minDist / 4 && proj.minionSlots == 0) { proj.active = false; } } timer = 10; } timer--; } /*else * { * projectile.scale = (float)(1.0 - (projectile.ai[0] - time) / 60.0) * maxScale; * projectile.alpha = 255 - (int)(255 * projectile.scale / maxScale); * projectile.rotation = projectile.rotation - (float)Math.PI / 30f; * if (projectile.alpha >= 255) * projectile.Kill(); * for (int index = 0; index < 2; ++index) * { * switch (Main.rand.Next(3)) * { * case 0: * Vector2 spinningpoint1 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; * Dust dust1 = Main.dust[Dust.NewDust(projectile.Center - spinningpoint1 * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; * dust1.noGravity = true; * dust1.position = projectile.Center - spinningpoint1 * Main.rand.Next(10, 21); * dust1.velocity = spinningpoint1.RotatedBy(1.57079637050629, new Vector2()) * 6f; * dust1.scale = 0.5f + Main.rand.NextFloat(); * dust1.fadeIn = 0.5f; * dust1.customData = projectile.Center; * break; * case 1: * Vector2 spinningpoint2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; * Dust dust2 = Main.dust[Dust.NewDust(projectile.Center - spinningpoint2 * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; * dust2.noGravity = true; * dust2.position = projectile.Center - spinningpoint2 * 30f; * dust2.velocity = spinningpoint2.RotatedBy(-1.57079637050629, new Vector2()) * 3f; * dust2.scale = 0.5f + Main.rand.NextFloat(); * dust2.fadeIn = 0.5f; * dust2.customData = projectile.Center; * break; * } * } * }*/ Dust dust3 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 0, new Color(), 1f)]; dust3.velocity *= 5f; dust3.fadeIn = 1f; dust3.scale = 1f + Main.rand.NextFloat() + Main.rand.Next(4) * 0.3f; dust3.noGravity = true; }
public override void AI() { const int time = 1800; const int maxScale = 3; const float suckRange = 150; void Suck() { foreach (Projectile p in Main.projectile.Where(p => p.active && p.friendly && p.Distance(Projectile.Center) < suckRange && !FargoSoulsUtil.IsSummonDamage(p) && FargoSoulsUtil.CanDeleteProjectile(p) && p.type != ModContent.ProjectileType <Minions.LunarCultistLightningArc>())) { //suck in nearby friendly projs p.velocity = p.DirectionTo(Projectile.Center) * p.velocity.Length(); p.velocity *= 1.015f; //kill ones that actually fall in and retaliate if (Main.netMode != NetmodeID.MultiplayerClient && Projectile.Colliding(Projectile.Hitbox, p.Hitbox)) { Player player = Main.player[p.owner]; if (player.active && !player.dead && !player.ghost && suck <= 0) { suck = 6; Vector2 dir = Projectile.DirectionTo(player.Center).RotatedByRandom(MathHelper.ToRadians(10)); float ai1New = (Main.rand.NextBool()) ? 1 : -1; //randomize starting direction Vector2 vel = Vector2.Normalize(dir) * 6f; Projectile.NewProjectile(Terraria.Entity.InheritSource(Projectile), Projectile.Center, vel * 6, ModContent.ProjectileType <Champions.CosmosLightning>(), Projectile.damage, 0, Main.myPlayer, dir.ToRotation(), ai1New); } p.Kill(); } } }; if (suck > 0) { suck--; } NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[1], NPCID.MoonLordCore); if (npc != null) { Projectile.localAI[0]++; const int orbitTime = 180; Vector2 offset; offset.X = 300f * (float)Math.Sin(Math.PI * 2 / (orbitTime * 2) * Projectile.localAI[0]); offset.Y = 150f * (float)Math.Sin(Math.PI * 2 / orbitTime * Projectile.localAI[0]); Projectile.Center = npc.Center + offset; //if (Projectile.localAI[1] < 120) //{ // float num1 = 0.5f; // for (int i = 0; i < 5; ++i) // { // if (Main.rand.NextFloat() >= num1) // { // float f = Main.rand.NextFloat() * 6.283185f; // float num2 = Main.rand.NextFloat(); // Dust dust = Dust.NewDustPerfect(Projectile.Center + f.ToRotationVector2() * (110 + 600 * num2), 229, (f - 3.141593f).ToRotationVector2() * (14 + 8 * num2), 0, default, 1f); // dust.scale = 0.9f; // dust.fadeIn = 1.15f + num2 * 0.3f; // //dust.color = new Color(1f, 1f, 1f, num1) * (1f - num1); // dust.noGravity = true; // //dust.noLight = true; // } // } //} if (npc.GetEModeNPCMod <MoonLordCore>().VulnerabilityState != 1 && Projectile.timeLeft > 60) { Projectile.timeLeft = 60; } } else { Projectile.Kill(); return; } for (int i = 0; i < 10; i++) { Vector2 offset = new Vector2(); double angle = Main.rand.NextDouble() * 2d * Math.PI; offset.X += (float)(Math.Sin(angle) * suckRange); offset.Y += (float)(Math.Cos(angle) * suckRange); Dust dust = Main.dust[Dust.NewDust( Projectile.Center + offset - new Vector2(4, 4), 0, 0, 229, 0, 0, 100, Color.White, 1f )]; dust.velocity = npc.velocity / 3; if (Main.rand.NextBool(3)) { dust.velocity += Vector2.Normalize(offset); } dust.noGravity = true; } Projectile.localAI[1]++; if (Projectile.localAI[1] <= 50) { if (Main.rand.NextBool(4)) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 4f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } if (Main.rand.NextBool(4)) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 2f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } } else if (Projectile.localAI[1] <= 90) { Projectile.scale = (Projectile.localAI[1] - 50) / 40 * maxScale; Projectile.alpha = 255 - (int)(255 * Projectile.scale / maxScale); Projectile.rotation = Projectile.rotation - 0.1570796f; if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = Projectile.Center; } if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = Projectile.Center; } Suck(); } else if (Projectile.localAI[1] <= 90 + time) { Projectile.velocity *= 0.9f; Projectile.scale = maxScale; Projectile.alpha = 0; Projectile.rotation = Projectile.rotation - (float)Math.PI / 60f; if (Main.rand.NextBool()) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = Projectile.Center; } else { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = Projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = Projectile.Center; } Suck(); } else { Projectile.scale = (float)(1.0 - (Projectile.localAI[1] - time) / 60.0) * maxScale; Projectile.alpha = 255 - (int)(255 * Projectile.scale / maxScale); Projectile.rotation = Projectile.rotation - (float)Math.PI / 30f; if (Projectile.alpha >= 255) { Projectile.Kill(); } for (int index = 0; index < 2; ++index) { switch (Main.rand.Next(3)) { case 0: Vector2 spinningpoint1 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust1 = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint1 * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust1.noGravity = true; dust1.position = Projectile.Center - spinningpoint1 * Main.rand.Next(10, 21); dust1.velocity = spinningpoint1.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust1.scale = 0.5f + Main.rand.NextFloat(); dust1.fadeIn = 0.5f; dust1.customData = Projectile.Center; break; case 1: Vector2 spinningpoint2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale; Dust dust2 = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint2 * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust2.noGravity = true; dust2.position = Projectile.Center - spinningpoint2 * 30f; dust2.velocity = spinningpoint2.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust2.scale = 0.5f + Main.rand.NextFloat(); dust2.fadeIn = 0.5f; dust2.customData = Projectile.Center; break; } } } Dust dust3 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 0, new Color(), 1f)]; dust3.velocity *= 5f; dust3.fadeIn = 1f; dust3.scale = 1f + Main.rand.NextFloat() + Main.rand.Next(4) * 0.3f; dust3.noGravity = true; }
public override void Update(Player player, ref int buffIndex) { FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); player.noKnockback = true; player.endurance = .9f; player.thorns *= 10; modPlayer.ShellHide = true; float distance = 3f * 16; if (player.ownedProjectileCounts[ModContent.ProjectileType <TurtleShield>()] < 1) { Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType <TurtleShield>(), 0, 0, player.whoAmI); } if (modPlayer.TurtleCounter > 80) { Main.projectile.Where(x => x.active && x.hostile && x.damage > 0 && Vector2.Distance(x.Center, player.Center) <= distance && FargoSoulsUtil.CanDeleteProjectile(x)).ToList().ForEach(x => { int dustId = Dust.NewDust(new Vector2(x.position.X, x.position.Y + 2f), x.width, x.height + 5, DustID.GoldFlame, x.velocity.X * 0.2f, x.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(new Vector2(x.position.X, x.position.Y + 2f), x.width, x.height + 5, DustID.GoldFlame, x.velocity.X * 0.2f, x.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; // Turn around x.velocity *= -1f; // Flip sprite if (x.Center.X > player.Center.X) { x.direction = 1; x.spriteDirection = 1; } else { x.direction = -1; x.spriteDirection = -1; } x.hostile = false; x.friendly = true; modPlayer.TurtleShellHP--; }); } if (modPlayer.TurtleShellHP <= 0) { player.AddBuff(ModContent.BuffType <BrokenShell>(), 1800); modPlayer.TurtleShellHP = 24; //some funny dust const int max = 30; for (int i = 0; i < max; i++) { Vector2 vector6 = Vector2.UnitY * 5f; vector6 = vector6.RotatedBy((i - (max / 2 - 1)) * 6.28318548f / max) + Main.LocalPlayer.Center; Vector2 vector7 = vector6 - Main.LocalPlayer.Center; int d = Dust.NewDust(vector6 + vector7, 0, 0, DustID.GreenBlood, 0f, 0f, 0, default(Color), 2f); Main.dust[d].noGravity = true; Main.dust[d].velocity = vector7; } } }
public static void AncientHallowEffect(Player player, Item item) { FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); modPlayer.AncientHallowEnchantActive = true; modPlayer.SilverEnchantActive = true; modPlayer.AddMinion(item, player.GetToggleValue("Hallowed"), ModContent.ProjectileType <HallowSword>(), 50, 2); //reflect proj if (player.GetToggleValue("HallowS") && !modPlayer.noDodge && !player.HasBuff(ModContent.BuffType <HallowCooldown>())) { const int focusRadius = 50; float num14 = Main.GlobalTimeWrappedHourly % 3f / 3f; Color fairyQueenWeaponsColor = GetFairyQueenWeaponsColor(0f, 0f, num14); for (int i = 0; i < 20; i++) { Vector2 offset = new Vector2(); double angle = Main.rand.NextDouble() * 2d * Math.PI; offset.X += (float)(Math.Sin(angle) * focusRadius); offset.Y += (float)(Math.Cos(angle) * focusRadius); Dust dust = Main.dust[Dust.NewDust( player.Center + offset - new Vector2(4, 4), 0, 0, DustID.WhiteTorch, 0, 0, 100, fairyQueenWeaponsColor, 1f )]; dust.velocity = player.velocity; dust.noGravity = true; } Main.projectile.Where(x => x.active && x.hostile && x.damage > 0 && Vector2.Distance(x.Center, player.Center) <= focusRadius + Math.Min(x.width, x.height) / 2 && FargoSoulsUtil.CanDeleteProjectile(x)).ToList().ForEach(x => { for (int i = 0; i < 5; i++) { int dustId = Dust.NewDust(new Vector2(x.position.X, x.position.Y + 2f), x.width, x.height + 5, DustID.WhiteTorch, x.velocity.X * 0.2f, x.velocity.Y * 0.2f, 100, fairyQueenWeaponsColor, 3f); Main.dust[dustId].noGravity = true; } // Set ownership x.hostile = false; x.friendly = true; x.owner = player.whoAmI; // Turn around x.velocity *= -1f; // Flip sprite if (x.Center.X > player.Center.X) { x.direction = 1; x.spriteDirection = 1; } else { x.direction = -1; x.spriteDirection = -1; } // Don't know if this will help but here it is x.netUpdate = true; player.AddBuff(ModContent.BuffType <HallowCooldown>(), 600); }); } }
public override void AI() { //dust! int dustId = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; Player player = Main.player[Projectile.owner]; if (Projectile.owner == Main.myPlayer && (!player.controlUseItem || (player.controlUp && player.controlDown))) { Projectile.Kill(); return; } if (player.dead || !player.active) { Projectile.Kill(); return; } Vector2 ownerMountedCenter = player.RotatedRelativePoint(player.MountedCenter); Projectile.direction = player.direction; player.heldProj = Projectile.whoAmI; player.itemTime = 2; //15; player.itemAnimation = 2; //15; player.reuseDelay = 10; //player.itemAnimationMax = 15; Projectile.Center = ownerMountedCenter; Projectile.timeLeft = 2; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); Projectile.rotation += (float)Math.PI / 6.85f * player.direction; Projectile.ai[0] += MathHelper.Pi / 45; Projectile.velocity = Projectile.rotation.ToRotationVector2(); Projectile.position -= Projectile.velocity; player.itemRotation = Projectile.rotation; player.itemRotation = MathHelper.WrapAngle(player.itemRotation); if (++Projectile.localAI[0] > 10) //6 if set duration? { Projectile.localAI[0] = 0; SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); if (Projectile.owner == Main.myPlayer && !Main.LocalPlayer.controlUseTile) { Vector2 speed = -Vector2.UnitY.RotatedByRandom(Math.PI / 2) * Main.rand.NextFloat(9f, 12f); float ai1 = Main.rand.Next(30, 60); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position + Main.rand.NextVector2Square(0f, Projectile.width), speed, ModContent.ProjectileType <PhantasmalEyeHoming>(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, -1, ai1); } } for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].damage > 0 && Projectile.Colliding(Projectile.Hitbox, Main.projectile[i].Hitbox) && FargoSoulsUtil.CanDeleteProjectile(Main.projectile[i])) { if (Projectile.owner == Main.myPlayer) { //Vector2 offset = Main.projectile[i].Center - Main.player[Projectile.owner].Center; //Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType<Souls.IronParry>(), 0, 0f, Main.myPlayer, offset.X, offset.Y); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.projectile[i].Center, Vector2.Zero, ModContent.ProjectileType <Souls.IronParry>(), 0, 0f, Main.myPlayer); } Main.projectile[i].hostile = false; Main.projectile[i].friendly = true; Main.projectile[i].owner = player.whoAmI; // Turn away Main.projectile[i].velocity = Main.projectile[i].DirectionFrom(player.Center) * Main.projectile[i].velocity.Length(); // Don't know if this will help but here it is Main.projectile[i].netUpdate = true; } } }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); projectile.timeLeft++; if (player.dead || !player.active || !modPlayer.SnowEnchant) { projectile.Kill(); } if (player == Main.LocalPlayer) { projectile.Center = Main.MouseWorld; if (!player.GetToggleValue("Snow")) { projectile.Kill(); } } //dust int dist = 50; if (modPlayer.NatureForce) { dist = 100; } for (int i = 0; i < 15; i++) { Vector2 offset = new Vector2(); double angle = Main.rand.NextDouble() * 2d * Math.PI; offset.X += (float)(Math.Sin(angle) * Main.rand.Next(dist + 1)); offset.Y += (float)(Math.Cos(angle) * Main.rand.Next(dist + 1)); Dust dust = Main.dust[Dust.NewDust( projectile.Center + offset - new Vector2(4, 4), 0, 0, 76, 0, 0, 100, Color.White, .75f)]; dust.noGravity = true; } //for (int i = 0; i < 20; i++) //{ // Vector2 offset = new Vector2(); // double angle = Main.rand.NextDouble() * 2d * Math.PI; // offset.X += (float)(Math.Sin(angle) * dist); // offset.Y += (float)(Math.Cos(angle) * dist); // if (!Collision.SolidCollision(projectile.Center + offset - new Vector2(4, 4), 0, 0)) // { // Dust dust = Main.dust[Dust.NewDust( // projectile.Center + offset - new Vector2(4, 4), 0, 0, // 76, 0, 0, 100, Color.White, 1f // )]; // dust.velocity = projectile.velocity; // dust.noGravity = true; // } //} for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; if (proj.active && proj.hostile && proj.damage > 0 && projectile.Distance(FargoSoulsUtil.ClosestPointInHitbox(proj, projectile.Center)) < dist && FargoSoulsUtil.CanDeleteProjectile(proj)) { FargoGlobalProjectile globalProj = proj.GetGlobalProjectile <FargoGlobalProjectile>(); globalProj.ChilledProj = true; globalProj.ChilledTimer = 15; projectile.netUpdate = true; } } for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (npc.active && !npc.friendly && npc.damage > 0 && projectile.Distance(FargoSoulsUtil.ClosestPointInHitbox(npc, projectile.Center)) < dist && !npc.dontTakeDamage) { npc.GetGlobalNPC <FargoSoulsGlobalNPC>().SnowChilled = true; npc.GetGlobalNPC <FargoSoulsGlobalNPC>().SnowChilledTimer = 15; npc.netUpdate = true; } } }
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 void AI() { //dust! int dustId = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; Player player = Main.player[projectile.owner]; /*if (projectile.owner == Main.myPlayer && !player.controlUseItem) * { * projectile.Kill(); * return; * }*/ if (player.dead || !player.active) { projectile.Kill(); return; } //Vector2 ownerMountedCenter = player.RotatedRelativePoint(player.MountedCenter); //projectile.direction = player.direction; player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; if (++projectile.localAI[0] > 10) { projectile.localAI[0] = 0; Main.PlaySound(SoundID.Item1, projectile.Center); if (projectile.owner == Main.myPlayer) { Vector2 speed = Vector2.UnitX.RotatedByRandom(2 * Math.PI) * Main.rand.NextFloat(9f, 12f); float ai1 = Main.rand.Next(30, 60); int p = Projectile.NewProjectile(projectile.position + Main.rand.NextVector2Square(0f, projectile.width), speed, ModContent.ProjectileType <PhantasmalEyeHoming>(), projectile.damage, projectile.knockBack / 2, projectile.owner, -1, ai1); if (p != Main.maxProjectiles) { Main.projectile[p].melee = false; Main.projectile[p].ranged = true; } } } for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].damage > 0 && projectile.Colliding(projectile.Hitbox, Main.projectile[i].Hitbox) && FargoSoulsUtil.CanDeleteProjectile(Main.projectile[i])) { if (projectile.owner == Main.myPlayer) { //Vector2 offset = Main.projectile[i].Center - Main.player[projectile.owner].Center; //Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<Souls.IronParry>(), 0, 0f, Main.myPlayer, offset.X, offset.Y); Projectile.NewProjectile(Main.projectile[i].Center, Vector2.Zero, ModContent.ProjectileType <Souls.IronParry>(), 0, 0f, Main.myPlayer); } Main.projectile[i].hostile = false; Main.projectile[i].friendly = true; Main.projectile[i].owner = player.whoAmI; // Turn away Main.projectile[i].velocity = Main.projectile[i].DirectionFrom(projectile.Center) * Main.projectile[i].velocity.Length(); // Don't know if this will help but here it is Main.projectile[i].netUpdate = true; } } if (projectile.localAI[1] == 0) { projectile.localAI[0] = Main.rand.Next(10); projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); } projectile.localAI[1]++; float straightModifier = -0.5f * (float)Math.Cos(Math.PI * 2 / maxTime * projectile.localAI[1]); float sideModifier = 0.5f * (float)Math.Sin(Math.PI * 2 / maxTime * projectile.localAI[1]) * player.direction; Vector2 baseVel = new Vector2(projectile.ai[0], projectile.ai[1]); Vector2 straightVel = baseVel * straightModifier; Vector2 sideVel = baseVel.RotatedBy(Math.PI / 2) * sideModifier; projectile.Center = player.Center + baseVel / 2f; projectile.velocity = straightVel + sideVel; projectile.rotation += (float)Math.PI / 6.85f * -player.direction; }
public override void AI() { Player player = Main.player[Projectile.owner]; FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>(); //destroy duplicates if they somehow spawn if (player.ownedProjectileCounts[Projectile.type] > 1 || (Projectile.owner == Main.myPlayer && (!player.GetToggleValue("Rain") || !modPlayer.RainEnchantActive))) { Projectile.Kill(); } else { Projectile.timeLeft = 2; } //follow player float dist = Vector2.Distance(Projectile.Center, player.Center); if (dist > 200) { Vector2 velocity = Vector2.Normalize(player.Center - Projectile.Center) * player.velocity.Length(); Projectile.position += velocity; } else { Projectile.velocity.Y = 0; } //always max size if (modPlayer.NatureForce) { Projectile.scale = 3f; shrinkTimer = 1; } //absorb Projectiles if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; if (proj.active && proj.friendly && !proj.hostile && proj.owner == player.whoAmI && proj.damage > 0 && FargoSoulsUtil.CanDeleteProjectile(proj) && !FargoSoulsUtil.IsSummonDamage(proj, false) && proj.Hitbox.Intersects(Projectile.Hitbox) && proj.type != Projectile.type && proj.type != ProjectileID.RainFriendly && proj.type != ModContent.ProjectileType <LightningArc>() && proj.whoAmI != Main.player[proj.owner].heldProj && Array.IndexOf(FargoSoulsGlobalProjectile.noSplit, Projectile.type) <= -1 && proj.type != ModContent.ProjectileType <Chlorofuck>()) { if (Projectile.scale < 3f) { Projectile.scale *= 1.1f; } else { Vector2 rotationVector2 = (proj.Center + proj.velocity * 25) - Projectile.Center; rotationVector2.Normalize(); Vector2 vector2_3 = rotationVector2 * 10f; float ai_1 = Main.rand.Next(80); int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + Main.rand.NextFloat(Projectile.width), Projectile.position.Y + Main.rand.NextFloat(Projectile.height), vector2_3.X, vector2_3.Y, ModContent.ProjectileType <LightningArc>(), proj.maxPenetrate == 1 ? proj.damage * 2 : (int)(proj.damage * 1.2), Projectile.knockBack, Projectile.owner, rotationVector2.ToRotation(), ai_1); if (p != Main.maxProjectiles) { Main.projectile[p].DamageType = DamageClass.Magic; Main.projectile[p].usesIDStaticNPCImmunity = false; Main.projectile[p].idStaticNPCHitCooldown = 0; Main.projectile[p].GetGlobalProjectile <FargoSoulsGlobalProjectile>().noInteractionWithNPCImmunityFrames = false; if (proj.maxPenetrate == 1) { Main.projectile[p].penetrate = Main.projectile[p].maxPenetrate = 3; } } } proj.active = false; shrinkTimer = 120; break; } } } //shrink over time if no Projectiles absorbed if (shrinkTimer > 0 && Projectile.scale > 1f) { shrinkTimer--; if (shrinkTimer == 0) { Projectile.scale *= 0.9f; shrinkTimer = 10; } } //cancel normal rain Projectile.ai[0] = 0; Projectile.localAI[1]++; //bigger = more rain if (Projectile.scale > 3f) { Projectile.localAI[1] += 4; } else if (Projectile.scale > 2f) { Projectile.localAI[1] += 3; } else if (Projectile.scale > 1.5f) { Projectile.localAI[1] += 2; } else { Projectile.localAI[1]++; } //do the rain if (Projectile.localAI[1] >= 8) { Projectile.localAI[1] = 0; if (Projectile.owner == Main.myPlayer) { int num414 = (int)(Projectile.Center.X + (float)Main.rand.Next((int)(-20 * Projectile.scale), (int)(20 * Projectile.scale))); int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)num414, (float)num415, 0f, 5f, ProjectileID.RainFriendly, Projectile.damage / 4, 0f, Projectile.owner, 0f, 0); if (p != Main.maxProjectiles) { Main.projectile[p].penetrate = 1; Main.projectile[p].timeLeft = 45 * Main.projectile[p].MaxUpdates; } } } }