public override bool PreKill(int timeLeft) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); Projectile.NewProjectile(s, Projectile.Center, Vector2.Zero, ModContent.ProjectileType <Escuregot_explosion>(), 0, 0); return(base.PreKill(timeLeft)); }
public override void AI() { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); if (Projectile.ai[0] == 0) { SpawnProjectile(ModContent.ProjectileType <Persona_ground>(), offsetY: 5); Projectile.Center -= new Vector2(0, Projectile.height / 3); Projectile.ai[0] = 1; } if (Projectile.timeLeft > 20) { if (Projectile.timeLeft % 45 == 0) { SpawnProjectile(ModContent.ProjectileType <persona_explosion>(), offsetY: -25 + Projectile.height / 3); } if (Projectile.timeLeft % 15 == 0) { SpawnProjectile(ModContent.ProjectileType <PersonaSlice>(), offsetX: Main.rand.NextFloat(-5, 5), offsetY: 20 + Main.rand.NextFloat(0, 5)); } } Projectile.alpha = (Projectile.timeLeft > 80) ? (int)(((Projectile.timeLeft - 80f) / 20f) * 250) : (int)(250f * (1f - Projectile.timeLeft / 100f)); Projectile.velocity = Vector2.Zero; }
public override void Kill(int timeLeft) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, Projectile.Center, Vector2.Zero, ModContent.ProjectileType <Wunderwaffe_explosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner); SoundEngine.PlaySound(SoundID.Item12, Projectile.Center); }
public override void Kill(int timeLeft) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, Projectile.Center, Vector2.Zero, ModContent.ProjectileType <persona_fire>(), Projectile.damage * 4, Projectile.knockBack + 1, Projectile.owner); SoundEngine.PlaySound(SoundID.Item7.SoundId, x: (int)Projectile.Center.X, y: (int)Projectile.Center.Y, volumeScale: 3); }
public override void AI() { TargetEnemie(); Projectile.ai[0]++; Projectile.frame = (int)(Projectile.ai[0] / 50f) % 2; if (target != -1 && Vector2.Distance(Main.npc[target].Center, Projectile.Center) < 750) { if (Vector2.Distance(Main.npc[target].Center, Projectile.Center) > 400) { Projectile.velocity = MathHelp.Normalize(Main.npc[target].Center - Projectile.Center); Projectile.spriteDirection = (Projectile.velocity.X == 0) ? Projectile.spriteDirection : ((Projectile.velocity.X > 0) ? 1 : -1); Projectile.rotation = (Projectile.spriteDirection > 0) ? (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) : (float)(Math.PI + Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X)); } else { Projectile.spriteDirection = (Main.npc[target].Center - Projectile.Center).X > 0 ? 1 : -1; if (Projectile.ai[0] % 2 == 0) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, Projectile.Center, MathHelp.Normalize(Main.npc[target].Center + new Vector2(0, 25) - Projectile.Center) * 5, ProjectileID.WaterStream, Projectile.damage / 4, 3, Projectile.owner); Main.projectile[proj].timeLeft = 50; if (Projectile.ai[0] % 120 == 0) { int itm = Item.NewItem(Projectile.getRect(), ItemID.Star); Main.item[itm].velocity = new Vector2(Main.rand.Next(-3, 3), Main.rand.Next(-3, 3)); } } Projectile.velocity = Vector2.Zero; Projectile.rotation = 0; } } else { if (Vector2.Distance(Main.player[Projectile.owner].Center, Projectile.Center) > 200) { Projectile.velocity = MathHelp.Normalize(Main.player[Projectile.owner].Center - Projectile.Center); if (Vector2.Distance(Main.player[Projectile.owner].Center, Projectile.Center) > 700) { Projectile.timeLeft = 2; } Projectile.spriteDirection = (Projectile.velocity.X == 0) ? Projectile.spriteDirection : ((Projectile.velocity.X > 0) ? 1 : -1); Projectile.rotation = (Projectile.spriteDirection > 0) ? (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) : (float)(Math.PI + Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X)); } else { Projectile.velocity = Vector2.Zero; Projectile.rotation = 0; } } }
public int SpawnProjectile(int type, float offsetX = 0, float offsetY = 0) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); Vector2 offset = new Vector2(offsetX, offsetY); int proj = Projectile.NewProjectile(s, Projectile.Center + offset, Vector2.Zero, type, 0, Projectile.knockBack, Projectile.owner); return(proj); }
public override void Kill(int timeLeft) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); float rot = Main.rand.NextFloat((float)(-Math.PI * 2f), (float)(Math.PI * 2f)); int proj = Projectile.NewProjectile(s, Projectile.Center, Vector2.Zero, ModContent.ProjectileType <VergilSlice>(), Projectile.damage, 1); Main.projectile[proj].owner = Projectile.owner; Main.projectile[proj].rotation = rot; SoundEngine.PlaySound(SoundID.Item7.SoundId, x: (int)Main.projectile[proj].Center.X, y: (int)Main.projectile[proj].Center.Y, volumeScale: 3); }
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, target.Center, Vector2.Zero, ModContent.ProjectileType <Wunderwaffe_explosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (!isBoss(target)) { target.life = 0; target.checkDead(); } }
public override void SetDefaults() { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); Projectile.netImportant = true; Projectile.width = 42; Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 3; Projectile.tileCollide = true; Projectile.timeLeft = 1700; Projectile.light = 1; Player p = Main.player[Projectile.owner]; Projectile.NewProjectile(s, p.Center, p.velocity, ModContent.ProjectileType <Escuregot_explosion>(), 0, 0); Projectile.damage = (int)(Projectile.damage * 0.25f); }
public override bool OnTileCollide(Vector2 oldVelocity) { Projectile.timeLeft = 40; if (Projectile.ai[0] > 50 && Main.player[Projectile.owner].statMana > 20) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int projAmmount = Main.rand.Next(2, 5); for (int i = 0; i < projAmmount; i++) { int proj = Projectile.NewProjectile(s, Projectile.Center, new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(2, 5)), ProjectileID.BallofFire, Projectile.damage / 2, 1, Projectile.owner); } Main.player[Projectile.owner].statMana -= 20; } return(false); }
public override void AI() { Projectile.Center = Main.player[Projectile.owner].Center + new Vector2(0, -30); TargetEnemie(); Projectile.spriteDirection = Main.player[Projectile.owner].direction; if (target != -1) { Projectile.ai[0]++; if (Projectile.ai[0] % 20 == 0) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); Projectile.direction = (Main.npc[target].Center.X > Projectile.Center.X) ? 1 : -1; dir = MathHelp.Normalize(Main.npc[target].Center - Projectile.Center) * 15; int proj = Projectile.NewProjectile(s, Projectile.Center, dir, ProjectileID.BallofFire, (int)Projectile.ai[1] + 1, Projectile.knockBack, Projectile.owner); } } }
public override void AI() { int vergilProjCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].type == Type) { vergilProjCount++; } } if (vergilProjCount > 7) { Projectile.timeLeft = 0; return; } Projectile.friendly = true; Projectile.frame = (int)((1f - (Projectile.timeLeft / 28f)) * 28f); for (int i = 0; i < Main.maxNPCs; i++) { if (!Main.npc[i].friendly && !Main.npc[i].townNPC && Vector2.Distance(Main.npc[i].Center, Projectile.Center) < 500) { Main.npc[i].life -= Projectile.damage; Main.npc[i].checkDead(); } } Projectile.ai[0]++; if (Projectile.ai[0] % 10 == 0) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, Projectile.Center, Vector2.Zero, ModContent.ProjectileType <Vergil_Bubble>(), 0, 0, Projectile.owner); Main.projectile[proj].ai[0] = 50; } }
public override void AI() { Projectile.frame = 0; if (Projectile.damage > 0) { Projectile.ai[1] = Projectile.damage; Projectile.damage = 0; } if (Projectile.timeLeft >= 2999) { owner = Main.player[Projectile.owner]; } TargetEnemie(); if (owner != null) { Projectile.velocity.Y = (owner.Center.Y < Projectile.Center.Y - 25) ? -5 : Projectile.velocity.Y + 0.25f; Projectile.velocity.X = (Math.Abs(owner.Center.X - Projectile.Center.X) < 200) ? 0 : MathHelp.Sign(owner.Center.X - Projectile.Center.X) * 5; Projectile.frameCounter += (int)Projectile.velocity.X; Projectile.frame = (((Projectile.frameCounter / 25) % 2) == 0) ? 0 : 3; if (owner.statLife < owner.statLifeMax * 0.4f) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); owner.statLife += (int)(owner.statLifeMax * 0.4f); Projectile.timeLeft -= 500; Projectile.frame = 1; int proj = Projectile.NewProjectile(s, Projectile.Center, new Vector2(0, -2), ProjectileID.HallowStar, 0, 0, Projectile.owner); Main.projectile[proj].timeLeft = 50; } else { if (target != -1 && Main.npc[target].active) { Projectile.ai[0]++; if (Projectile.ai[0] > attackTimers[curAttack]) { curAttack = (curAttack == 0) ? Main.rand.Next(1, 4) : 0; Projectile.ai[0] = 0; if (curAttack == 1 || curAttack == 2) { Projectile.velocity.Y = -5; } if (curAttack == 1) { Projectile.timeLeft -= 150; } } switch (curAttack) { case 0: break; case 1: Whisle(); NoFall(); Projectile.frame = 2; break; case 2: Projectile.frame = 3; if (Projectile.ai[0] % 10 == 0) { ThrowBall(new Vector2(Main.rand.Next(-7, 7), 0), 7); } NoFall(); break; case 3: Projectile.frame = 2; if (Projectile.ai[0] % 15 == 0) { ThrowBall(Main.npc[target].Center - Projectile.Center, 7, 2.5f); } NoFall(); break; } } } Projectile.tileCollide = (Vector2.Distance(Projectile.Center, owner.Center) < 700); if (Math.Abs(Projectile.velocity.X) > 1) { Projectile.spriteDirection = (int)MathHelp.Sign(Projectile.velocity.X); } } Projectile.hide = Projectile.velocity.Y > 0; }
void ThrowBall(Vector2 velocity, float speed, float damageMult = 1) { ProjectileSource_ProjectileParent s = new ProjectileSource_ProjectileParent(Projectile); int proj = Projectile.NewProjectile(s, Projectile.Center, MathHelp.Normalize(velocity) * speed, ModContent.ProjectileType <baseball>(), (int)((Projectile.ai[1] + 1) * damageMult), Projectile.knockBack, Projectile.owner); }