Instead of skimming through, I read it a little more carefully... You really should state that your tests are related to the damage, that's changed based on who's in the match with you. It's not so clear simply from looking at the coding if you're not familiar with the terminology.
On a side note, the coding does exactly what it's written to do.
I mean, it checks whether or not you're facing C-Ridley and sets the damage, then checks for ZSS, then checks for falco, then everyone else. In that case, as longs as Ridley is there, it doesn't matter who else is in the match, the damage is already set.
It will never work differently than that as it is. In order for the damage to be dealt differently for each character individually, it would have to check, AS YOU ATTACK, whose hurtbox is being attacked, and calculate/deal the damage on the fly. I don't know if that is possible. But that really is only an issue if you're looking for damage or battle effects that are specific to a certain momentaneous interaction. After all, you could be hitting one character in a moment and another character later on.
In the case of presence-specific events, this works just fine. It's however just too simple a code for the case of momentaneous interaction.