Okay this seems to be the Obedience Check for Pokémon Diamond, Pearl and Platinum. Even though it's for DPPl the Obedience Check should be similar for X and Y and recurring games, with perhaps slight changes.
In battles in which Exp. Points can be gained, if the Pokémon tries to attack, the Pokémon’s 32-bit ID number, OT (Original Trainer) name, or both are different from those of the player, and its level is greater than the player’s "badge level", then this process is followed to determine whether the attack can be used.
- The badge level is determined based on the number of Badges the player has:
- No badges: Badge level=10
- Two or more badges: Badge level=30
- Four or more badges: Badge level=50
- Six or more badges: Badge level=70
- Eight or more badges: No obedience check is done
A random integer from 0 through 255 is generated, and A is set to ((Level of Pokémon)+(Badge level))*(Random integer)/256.
If A is at least the badge level, the Pokémon is disobedient. Otherwise, this process stops and the attack is used as usual.
If the Pokémon chose Rage for use, the effect of Rage is cancelled.
If the attack is Snore or Sleep Talk while the Pokémon is asleep, display "X ignored orders while asleep!" and the attack is cancelled.
Another random integer from 0 through 255 is generated, and B is set to ((Level of Pokémon)+(Badge level))*(Random integer)/256.
If B is less than the badge level, display the message "X ignored orders!" and the Pokémon uses a different move that can be chosen for use if possible. [If a different move is used this way, PP is spent for that different move instead of the move ordered, and the ordered move is still the last move chosen for use, but the different move can be the last move used as usual.]
If B is at least the badge level, C is set to (Level of Pokémon)-(badge level), and R is set to a random integer from 0 through 255.
a. If R is less than C and the Pokémon doesn’t have Vital Spirit or Insomnia and Uproar is not in effect for a Pokémon in battle, display "X began to nap!" and the Pokémon falls asleep. (Not prevented by Safeguard, Substitute, Leaf Guard, or other effects that prevent the Pokémon from sleeping.)
b. Otherwise, if R minus C is less than C, display "X won’t obey!" and the Pokémon deals confusion damage to itself.
c. Otherwise, display one of the following messages: "X won’t obey!", "X turned away!", "X is loafing around!", "X pretended to not notice!".
No obedience check is done if the Pokémon is continuing to use Bide.
Source (Also on Bulbapedia's discussion page).
Okay after checking the Disobedience Quotes seen below:
You can see the only Obedience Quote in Diamond, Pearl and Platinum not in X and Y is "< Pokémon > ignored orders!". If the above is correct the formula for the Obedience Check in X and Y should be fairly similar based on that of Diamond, Pearl and Platinum, however with slight changes as that one quote isn't included and they need to match new game mechanics etc.