$gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id).length
- $gameParty.battleMembers() is the function call to get the battle members
- $gameParty.battleMembers()[member_index] specifies a battle member, member_index must be a number (begins at 0 for first member)
- $gameParty.battleMembers()[member_index]._states gives the states for that member in ID form
- $gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id) filters the states and returns an array that meets the required ID. req_state_id must be a number
- $gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id).length gives the number of states in the array
I recommend you learn array filter going forward before continuing.