% is the modulus operator, it gives the remainer of the euclidean division. You nailed it right (all your assumptions about Tantarian's AI are correct).

& and >> are bitwise operators, in the sense that they have a meaning on the bits rather than numbers.

https://en.wikipedia.org/wiki/Bitwise_operations_in_CWhat you need to remember most of the time, it's that "GetRandom % 2" and "GetRandom & 2" are indeed equivalent, but it's not the case anymore with larger numbers.

"(GetRandom % N)==0" is a 1/N chance to occur.

"GetRandom % N" is a (N-1)/N chance to occur.

"GetRandom & 1", "GetRandom & 2", "GetRandom & 4" are all 1/2 chances to occur.

"GetRandom & 3" is a 3/4 chance to occur (it's the independant probability of having either "GetRandom & 1" or "GetRandom & 2").

For >>, you can see it as divisions.

"A >> 1" is the same as A/2,

"A >> 2" is the same as A/4,

"A >> 3" is the same as A/8,

etc...

The result is always truncated (5 >> 1 = 5/2 = 2 for instance). There exists only integral numbers in FF9.

For Kuja's AI, it indeed connects the counter-attack only if Kuja's HP are below half of his Max HP without counting the extra 10 000 HP (so it's half of his in-game visible Max HP, not the number that appears in the datas).