[ACE] Quickly conditioning if a certain number of opponents match a certain criteria?

I'm asking because I'm using a custom enemy AI script.

Let's say I wanted to find find out how many members in the game party have DEF above a certain amount, to judge whether the enemy will use Armor Curse or not.

Kind of like $game_party.movable_members.size >= 2 but I guess in the form of criteria,

like $game_party.alive_members.inject {|mem| mem.def >= 50}.size. That way I wouldn't have to go

if member 0 is not nil then if alive and active then if def is greater than 50 then amount += 1 end end end...

and soforth.

How could I achieve this?
$game_party.alive_members.select {|m| m.def >= 50}.size
Ooh, and it even works for multiple conditions (m.def >= 50 && !m.state?(2)).

Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/ace-quickly-conditioning-if-a-certain-number-of-opponents-match-a-certain-criteria.34901/