Esempio n. 1
0
def find_best_tid():
    global print

    print('TID  Cycle PID      Nature  HP  AT  DE  SA  SD  SP')
    old_print, print = print, lambda *args: None
    best = None
    for initial in tried_tids:
        for off in range(-1, 1 + 1):
            tid = initial + off
            if tid in tried_tids:
                continue
            seed = next(seeds(tid, 590))
            otId = ((seed >> 16) << 16) | tid
            new_best = glitch_mudkip(seed, otId, 0)
            i, pid, ivs = new_best
            ivs = ', '.join(f'{iv:2d}' for iv in ivs)
            old_print(
                f'{tid:04X} {i:5d} {pid:08x} {r_nature[pid % 25]:7} {ivs}')
            if best is None:
                best = new_best
                continue
            l = [best, new_best]
            l.sort(key=mudkip_key)
            new_best = l[0]
            if best != new_best:
                old_print('^')
            best = new_best
    print = old_print
Esempio n. 2
0
def explore_ids(seed, tid, cycle, limit=70):
    mudkips = list(method1_mons(seed, MUDKIP, 1000))
    mudkips.sort(key=method1_key)
    print('Mudkip')
    for i, pid, ivs in mudkips[:5]:
        print(f'{i+cycle:>5} {r_nature[pid % 25]} {pid:08x} {ivs}')
    print('Mudkip glitch')
    glitch_kips = filter(lambda t: corruptible(t[1], tid), mudkips)
    for j, pid, ivs in list(glitch_kips)[:5]:
        print(f'{j+cycle:>5} {r_nature[pid % 25]} {pid:08x} {ivs}')
    for i, base in enumerate(seeds(seed, limit=limit), 0):
        otId = ((base >> 16) << 16) | tid
        if otId & 0xff000000 == 0x04000000:
            continue
        print(f'{i+cycle:04d} ID: {otId:08x}')
        # print('Bootstrap (Wild-nodiff)')
        # triples = wild_mons(base, MUDKIP+15000, 60*60*60)
        # pairs = ((t[0], t[2]) for t in triples)
        # for total, i, pid, evs, address, pos in bootstrap_names(otId, pairs):
        #     if total < 50:
        #         box, index = divmod(pos, 30)
        #         print(f'{i+cycle:>6} {pid:08x} {total} {evs} {address:08x} Box {box+1} {index+1}')
        print('Bootstrap (Wild-pure)')
        triples = wild_mons(base, MUDKIP + 15000, 60 * 60 * 60, diff=True)
        pairs = ((t[0], t[-1]) for t in triples)
        for total, i, pid, evs, address, pos in bootstrap_names(otId, pairs):
            if total < 50:
                box, index = divmod(pos, 30)
                print(
                    f'{i+cycle:>6} {pid:08x} {total} {evs} {address:08x} Box {box+1} {index+1}'
                )
Esempio n. 3
0
def avoid(seed,
          limit=10,
          diff=False,
          bike=False,
          rate=20):  # Avoid wild encounters
    l = []
    offset = 2
    rate *= 16
    rate = (80 * rate // 100) if bike else rate
    rate = min(rate, 2880)
    for rng in seeds(seed, offset, limit):
        src = (r >> 16 for r in seeds(rng, limit=2))
        if diff and not next(src) % 100 < 60:
            is_enc = False
        elif not next(src) % 2880 < rate:
            is_enc = False
        else:
            is_enc = True
        calls = 2 - len(list(src))
        l.append(f'{rng:08x}:{str(is_enc)[0]}:{calls}')
    print(' '.join(l))
Esempio n. 4
0
def male_mons(seed, frame=0, limit=1000, threshold=127):  # Yield Wally's Ralts
    for i, base in enumerate(seeds(seed, frame, limit), frame):
        rng = rand(base)
        gender = 1
        while gender != 0:  # MON_MALE
            otId = next(rng) | (next(rng) << 16)
            pid = next(rng) | (next(rng) << 16)
            gender = 1 if threshold > (pid & 0xff) else 0
        value = next(rng)
        hp, at, de = value & 0x1f, (value & 0x3e0) >> 5, (value & 0x7c00) >> 10
        value = next(rng)
        sp, sa, sd = value & 0x1f, (value & 0x3e0) >> 5, (value & 0x7c00) >> 10
        yield i, pid, otId, (hp, at, de, sa, sd, sp)
Esempio n. 5
0
 def cycle_changed(self, value):
     if self.old_cycle is None:
         self.old_cycle = value
         return
     seed = int(self.rng.text(), 16) if self.rng.text() else 0
     if value > self.old_cycle:  # Advance RNG
         seed = next(seeds(seed, value-self.old_cycle, 1))
         self.rng.setText(f'{seed:08X}')
     elif value < self.old_cycle:  # Reverse RNG
         for _ in range(self.old_cycle-value):
             seed = 0xffffffff & (seed - 0x6073) * 0xeeb9eb65
         self.rng.setText(f'{seed:08X}')
     self.old_cycle = value
Esempio n. 6
0
def seek(seed,
         offset=0,
         limit=10,
         chance=0,
         acc_stage=6,
         evade=6,
         move_acc=95):
    chances = (16, 8, 4, 3, 2)
    dividends = (33, 36, 43, 50, 60, 75, 1, 133, 166, 2, 233, 133, 3)
    divisors = (100, 100, 100, 100, 100, 100, 1, 100, 100, 1, 100, 50, 1)
    assert len(divisors) == len(dividends) == 13
    buff = acc_stage + 6 - evade
    calc = dividends[buff] * move_acc
    calc //= divisors[buff]
    for base in seeds(seed, offset, limit=limit):
        value = base >> 16
        acc = (value % 100) + 1
        crit = (value % chances[chance]) == 0
        dmg = 100 - (value % 16)
        print(
            f'{base:08x}:{acc:03d}/{calc:03d}{str(acc <= calc)[0]}:{dmg:03d}{"!" if crit else ""}',
            end=' ')
    print()
Esempio n. 7
0
def rng_ids(seed: int,
            tid: int,
            limit=70):  # Yields full trainer ids from a seed and TID
    # TODO: Add in offset
    for i, s in enumerate(seeds(seed, limit=70)):
        yield i, ((s >> 16) << 16) | tid