public override Action <ProceduralSpell, Player, Vector2> GetUseAbility() { return(delegate(ProceduralSpell spell, Player player, Vector2 target) { Main.PlaySound(Terraria.ID.SoundID.Item6, player.position); spell.remaining = spell.cooldown; PlayerCharacter character = player.GetModPlayer <PlayerCharacter>(); if (character.minions.Exists(minion => minion is WingedEyeball)) { foreach (ProceduralMinion eyeball in character.minions.Where(minion => minion.projectile.type == mod.ProjectileType <WingedEyeball>())) { foreach (ProceduralSpellProj psp in eyeball.circlingProtection) { psp.projectile.Kill(); } eyeball.circlingProtection.Clear(); if (eyeball.smallProt != null) { eyeball.smallProt.projectile.Kill(); } eyeball.projectile.Kill(); } } Projectile eye = Main.projectile[Projectile.NewProjectile(player.Center, Vector2.Zero, mod.ProjectileType <WingedEyeball>(), 0, 0f, player.whoAmI)]; eye.Center = target; WingedEyeball we = (WingedEyeball)eye.modProjectile; we.source = spell; foreach (GlyphModifier modifier in spell.modifiers) { if (modifier.minionAI != null) { we.glyphModifiers.Add(modifier.minionAI); } } character.minions.Add((WingedEyeball)eye.modProjectile); }); }
public override Action <ProceduralSpell, Player, Vector2> GetUseAbility() { return(delegate(ProceduralSpell spell, Player player, Vector2 target) { //Main.PlaySound(SoundID.Item6, player.position); SoundManager.PlaySound(Sounds.LegacySoundStyle_Item6, player.position); SoundManager.PlaySound(Sounds.MenuClose); spell.Remaining = spell.Cooldown; PlayerCharacter character = player.GetModPlayer <PlayerCharacter>(); if (character.Minions.Exists(minion => minion is WingedEyeball)) { foreach (ProceduralMinion eyeball in character.Minions.Where(minion => minion.projectile.type == ModContent.ProjectileType <WingedEyeball>()) ) { foreach (ProceduralSpellProj psp in eyeball.CirclingProtection) { psp.projectile.Kill(); } eyeball.CirclingProtection.Clear(); eyeball.SmallProt?.projectile.Kill(); eyeball.projectile.Kill(); } } Projectile eye = Main.projectile[ Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <WingedEyeball>(), 0, 0f, player.whoAmI)]; eye.Center = target; WingedEyeball we = (WingedEyeball)eye.modProjectile; we.Source = spell; foreach (GlyphModifier modifier in spell.Modifiers.Where(modifier => modifier.MinionAi != null)) { we.GlyphModifiers.Add(modifier.MinionAi); } character.Minions.Add((WingedEyeball)eye.modProjectile); }); }