You can use this check to see if a Pokemon in the party has Ghost-type (I haven't tested this, but took it from something similar). You'll need to replace "user" in the first line with whoever the battler is that has the ability. This will exclude fainted Pokemon and the active Pokemon, but it's an easy fix if you want it to include them:
Code:
[email protected](user.index)
partyGhost=false
for i in 0...party.length
next if attacker.pokemonIndex==i
if party[i] && !party[i].egg? && party[i].hp>0 && party[i].hasType?(:GHOST)
partyGhost=true
break
end
end
You can use the variable partyGhost for seeing if there's a ghost Pokemon in the party (true if there is, false otherwise). I'm not sure what you mean by "with the ability's holder", but you could add that check in "if party
&& !party.egg? && party.hp>0 && party.hasType?(:GHOST)"