def ROR12(x): if not ROR12_start.IsSet(): ROR12_init() if IsEUDVariable(x): x = x.getValueAddr() nptr = Forward() RawTrigger( nextptr=ROR12_start, actions=[ SetMemory3(0x6509B0, SetTo, EPD(x)), # SetNextPtr(ROR12_end, nptr), SetMemory3(ROR12_end + 4, SetTo, nptr), ]) nptr << NextTrigger()
def ROL8_init(): PushTriggerScope() ROL8_start << NextTrigger() for i in range(31, -1, -1): RawTrigger( conditions=DeathsX(CurrentPlayer, AtLeast, 1, 0, 2**i), actions=[ # ret.AddNumber(2**((i + 8) % 32)), SetMemory3(ret.getValueAddr(), Add, 2**((i + 8) % 32)), ], ) VProc(ret, SetMemory3(ret._varact + 16, SetTo, EPD(ROL8_end) + 87)) ROL8_end << RawTrigger( nextptr=random.getrandbits(32), actions=[ SetDeaths(CurrentPlayer, SetTo, 0, 0), # ret.SetNumber(0), SetMemory3(ret.getValueAddr(), SetTo, 0), ]) PopTriggerScope()