static void as(int s, int, BS &b) { bool act = false; for (int i = 1; i <= 7; i++) { if (fpoke(b,s).boosts[i] < 0) { act = true; fpoke(b,s).boosts[i] = 0; } } if (act) { b.sendItemMessage(3,s); b.disposeItem(s); } }
static void appl(int p, int s, BS &b) { if (b.koed(s)) return; int minmove = 0; int minPP = 100; bool init = false; bool zeroPP = false; for (int i = 0; i < 4; i++) { if (b.move(s, i) == 0) { continue; } if (b.PP(s, i) == 0) { zeroPP = true; init = true; minmove = i; minPP = 0; break; } if (b.PP(s, i) < minPP && (fpoke(b, s).moves[i] == b.poke(s).move(i).num() ? b.PP(s, i) < b.poke(s).move(i).totalPP() : b.PP(s, i) < 5)) { minmove = i; init = true; minPP = b.PP(s, i); } } if (init && (zeroPP || turn(b,p).value("BugBiter").toBool())) { b.eatBerry(s, s==p); b.sendBerryMessage(2,s,0,0,0,b.move(s,minmove)); b.gainPP(s,minmove,b.gen() <= 2 ? 5 : 10); } }
static void tp(int p, int s, BS &b) { if (!b.isOut(s)) { return; } int berry = b.poke(s).item(); QVector<int> stats; for (int i = Attack; i <= Evasion; i++) { if (fpoke(b,s).boosts[i] < 6) { stats.push_back(i); } } if (stats.empty()) return; if (!testpinch(p, s, b, 4, false)) return; int stat = stats[b.randint(stats.size())]; if (b.hasWorkingAbility(s, Ability::Contrary)) { b.sendBerryMessage(9,s,1,s, berry, stat); } else { b.sendBerryMessage(9,s,0,s, berry, stat); } b.inflictStatMod(s, stat, 2, s, false); }
static void btl(int s, int, BS &b) { if (fturn(b,s).contains(TM::NoChoice)) { /* multiple turn move */ return; } int count = poke(b,s)["IMMetroCount"].toInt(); int lslot = poke(b,s)["IMLastMoveSlot"].toInt(); int slot = fpoke(b,s).lastMoveSlot; bool act = poke(b,s)["IMMetroActivating"].toBool(); poke(b,s)["IMLastMoveSlot"] = slot; poke(b,s)["IMMetroActivating"] = true; if (slot != lslot) { poke(b,s)["IMMetroCount"] = 0; return; } if (tmove(b,s).power == 0) { return; } if (act) { poke(b,s)["IMMetroCount"] = std::min(10, count+1); } }