benilla-re systems structs docs

CGUnit_C::CanAttack

function · objectlayer · primitive

Address
0x606980 · 543 bytes, up to 0x606b9e
Signature
bool __thiscall (CGUnit_C *this, CGUnit_C *other)
Meaning
Returns whether a unit may attack another: the ghost, flag and cross-flag refusals, then the reaction arms
Confidence
verified, proof one
Name from
the community database (idb)
Finding
objectlayer/reaction#attacking

Finding: Attacking in objectlayer: reaction

0x606980(this = A, B) decides whether A may attack B. Only a creature with type flag 0x2 may attack a ghost player, bit 4 of PLAYER_FLAGS. Bits 1, 7, 16, 20 and 25 of B's UNIT_FIELD_FLAGS each refuse. Bits 8 and 9 refuse across the controlled line both ways: B's 0x100 against a controlled A, B's 0x200 against any other, and A's against B alike. Two uncontrolled units may fight when either reaction is 1 or less; a mixed pair when A's is below 4. Two controlled units may not at 4 or more; else they may when a controlling player is missing, both are in one duel, B's player has the PvP flag, bit 12, or both are free-for-all.

The derivation is in the doc.

Callers 20

Callees 3

Calls and jumps by a bare address, from tables/calls.tsv.