static void uodr(int s, int t, BS &b) { if (fturn(b,t).typeMod > 0 && !b.koed(s)) { b.sendItemMessage(43, s); b.disposeItem(s); b.inflictStatMod(s, Attack, 2, s); b.inflictStatMod(s, SpAttack, 2, s); } }
static void uodr(int s, int t, BS &b) { if (forbidden_moves.contains(move(b,t))) return; if (fturn(b,t).typeMod > 0 && !b.koed(s)) { b.sendItemMessage(43, s); b.disposeItem(s); b.inflictStatMod(s, Attack, 2, s); b.inflictStatMod(s, SpAttack, 2, s); } }
static void os(int s, int, BS &b) { b.sendItemMessage(40, s, 0); b.sendItemMessage(40, s, 1); b.inflictStatMod(s, Attack, 2, s, false); b.inflictConfused(s,s); b.disposeItem(s); }
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 ubh(int s, int t, BS &b) { int tp = poke(b,s)["ItemArg"].toString().section('_', 0, 0).toInt(); if (!b.koed(s) && type(b,t) == tp) { int stat = poke(b,s)["ItemArg"].toString().section('_', 1).toInt(); if (b.hasMaximalStatMod(s, stat)) return; b.sendItemMessage(36, s, 0, t, b.poke(s).item(), stat); b.disposeItem(s); b.inflictStatMod(s, stat, 1, s, false); } }
static void os(int s, int, BS &b) { b.sendItemMessage(40, s, 0); b.sendItemMessage(40, s, 1); b.inflictStatMod(s, Attack, 2, s, false); b.inflictConfused(s,s); b.disposeItem(s); /* in GSC cart mechanics, infinite confusion */ if (b.isConfused(s)) { if (b.gen() == Gen::GoldSilver || b.gen() == Gen::Crystal) { poke(b,s)["ConfusedCount"] = 255; } } }
static void ubh(int s, int t, BS &b) { if (!b.koed(s) && type(b,t) == poke(b,s)["ItemArg"].toInt()) { int stat; if (b.poke(s).item() == Item::RechargeableBattery) { if (b.hasMaximalStatMod(s, Attack)) return; stat = Attack; } else { if (b.hasMaximalStatMod(s, SpAttack)) return; stat = SpAttack; } b.sendItemMessage(36, s, 0, t, b.poke(s).item(), stat); b.disposeItem(s); b.inflictStatMod(s, stat, 1, s, false); } }
static void tp(int p, int s, BS &b) { /* The berry may change after the call to test pinch (eaten), so saved before. */ int berry = b.poke(s).item(); if (!testpinch(p, s, b, 4, false)) return; int arg = poke(b,p)["ItemArg"].toInt(); if (b.isOut(s)) { if (b.hasWorkingAbility(s, Ability::Contrary)) { b.sendBerryMessage(7,s,1,s, berry, arg); } else { b.sendBerryMessage(7,s,0,s, berry, arg); } b.inflictStatMod(s, arg, 1, s, false); } }
static void uodr(int s, int t, BS &b) { if (!b.attacking() || b.koed(s)) { return; } int arg = poke(b,s)["ItemArg"].toInt(); int berry = b.poke(s).item(); if (turn(b,t).value("BugBiter").toBool() || tmove(b,t).category == Move::Special) { b.eatBerry(s, s==t); if (b.isOut(s)) { if (b.hasWorkingAbility(s, Ability::Contrary)) { b.sendBerryMessage(7,s,1,s, berry, arg); } else { b.sendBerryMessage(7,s,0,s, berry, arg); } b.inflictStatMod(s,arg,1,s,false); } } }