static void et(int s, int, BS &b) { if(b.koed(s) || b.hasWorkingAbility(s, Ability::MagicGuard)) { return; } if(b.hasType(s, Pokemon::Poison)) { if (!b.poke(s).isFull()) { b.sendItemMessage(16,s,0); b.healLife(s, b.poke(s).totalLifePoints()/16); } } else if (!b.hasType(s, Pokemon::Steel)) { b.sendItemMessage(16,s,1); b.inflictDamage(s, b.poke(s).totalLifePoints()/8,s); } }
static void et(int s, int, BS &b) { if (b.poke(s).status() != Pokemon::Fine) { return; } int status = poke(b,s)["ItemArg"].toInt(); if (!b.canGetStatus(s, status)) return; if (status == Pokemon::Burnt) { b.sendItemMessage(19,s,0); } else { b.sendItemMessage(19,s,1); } b.inflictStatus(s, status, s, status == Pokemon::Poisoned ? 15: 0, status == Pokemon::Poisoned ? 15: 0); }
static void uodr(int s, int, BS &b) { if (b.koed(s)) return; b.sendItemMessage(4, s); turn(b,s)["SurviveReason"] = true; }
static void et(int s, int, BS &b) { if (b.hasWorkingAbility(s, Ability::MagicGuard)) return; b.sendItemMessage(29,s,0); b.inflictDamage(s, b.poke(s).totalLifePoints()/8,s); }
static void et(int s, int, BS &b) { if (!b.canHeal(s)) return; b.sendItemMessage(12,s); b.healLife(s, b.poke(s).totalLifePoints()/16); }
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 ahpc(int s, int, BS &b) { if (!b.koed(s) && b.poke(s).lifePercent() <= 50) { b.disposeItem(s); b.sendItemMessage(18,s,0); b.healLife(s, 20); } }
static void uodr(int s, int t, BS &b) { if (b.koed(s)) return; if (turn(b,s).contains("CannotBeKoedBy") && turn(b,s)["CannotBeKoedBy"].toInt() == t && b.poke(s).lifePoints() == 1) { b.sendItemMessage(4, s); } }
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 uss(int s, int, BS &b) { if (b.koed(s)) return; b.sendItemMessage(5, s); b.disposeItem(s); turn(b,s)["SurviveReason"] = true; }
static void udi(int s, int t, BS &b) { if (s==t) return; if (b.koed(s)) return; b.sendItemMessage(24, s); b.healLife(s, turn(b,s)["DamageInflicted"].toInt()/8); }
static void ahpc(int s, int, BS &b) { if (!b.canHeal(s)) return; if (b.poke(s).lifePercent() <= 50) { b.disposeItem(s); b.sendItemMessage(18,s,0); b.healLife(s, 20); } }
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 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 as(int s, int, BS &b) { if (poke(b,s).contains("AttractedTo")) { int seducer = poke(b,s)["AttractedTo"].toInt(); if (poke(b,seducer).contains("Attracted") && poke(b,seducer)["Attracted"].toInt() == s) { b.sendItemMessage(7,s); removeFunction(poke(b,s), "DetermineAttackPossible", "Attract"); poke(b,s).remove("AttractedTo"); b.disposeItem(s); } } }
static void upa( int s, int t, BS &b) { if (!b.koed(t) && !b.hasWorkingAbility(t, Ability::MagicGuard)) { b.sendItemMessage(34,s,0,t); b.inflictDamage(t,b.poke(t).totalLifePoints()/6,s,false); /* In VGC 2011, the one with the rugged helmet wins */ if (b.koed(t)) { b.selfKoer() = t; } } }
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 as(int s, int, BS &b) { bool act = false; for (int i = 1; i <= 7; i++) { if (poke(b,s)["Boost" + QString::number(i)].toInt() < 0) { act = true; poke(b,s)["Boost"+ QString::number(i)] = 0; } } if (act) { b.sendItemMessage(3,s); b.disposeItem(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); /* 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 udi(int s, int t, BS &b) { if (s==t) return; if (!b.canHeal(s) || turn(b,s).value("EncourageBug").toBool()) return; int damage = turn(b,s)["DamageInflicted"].toInt(); if (damage > 0) { b.sendItemMessage(24, s); b.healLife(s, damage/8); } }
static void ti(int p, int s, BS &b) { if (!b.koed(s)) { return; } int percent = poke(b,p).value("ItemArg").toInt(); if (percent == 0) { percent = 100; } b.changeHp(s, b.poke(s).totalLifePoints()*percent/100); b.changeStatus(b.player(s), b.slotNum(s), Pokemon::Fine); b.sendItemMessage(1007, s); }
static void ti(int, int p, BS &b) { for (int i = 0; i < 6; i++) { int s = b.slot(p, i); b.changeHp(s, b.poke(s).totalLifePoints()); if (b.koed(s)) { b.sendItemMessage(1999, s); } b.changeStatus(p, i, Pokemon::Fine); for (int j = 0; j < 4; j++) { if (b.move(s, j) != Move::NoMove) { b.gainPP(s, j, 99); } } } }
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 aaf(int, int, BS &b) { std::vector<int> speeds = b.sortedBySpeed(); for (unsigned i = 0; i < speeds.size(); i++) { int p = speeds[i]; if (!b.hasWorkingItem(p, Item::EscapeButton)) continue; if (!turn(b,p).contains("EscapeButtonActivated")) continue; if (turn(b,p)["EscapeButtonCount"] != slot(b,p)["SwitchCount"]) continue; b.sendItemMessage(39, p, 0); b.disposeItem(p); b.requestSwitch(p); } }
static void udi(int s, int t, BS &b) { if (s==t) return; if (b.koed(s) || b.hasWorkingAbility(s, Ability::Encourage)) return; if (b.poke(s).lifePoints() == b.poke(s).totalLifePoints()) { // Don't heal if at full health already return; } int damage = turn(b,s)["DamageInflicted"].toInt(); if (damage > 0) { b.sendItemMessage(24, s); b.healLife(s, damage/8); } }
static void atl(int s, int, BS &b) { if (turn(b,s).value("ActivateLifeOrb").toBool() && !turn(b,s).value("NoLifeOrbActivation").toBool() && !turn(b,s).value("EncourageBug").toBool() && !b.hasWorkingAbility(s, Ability::MagicGuard)) { if (b.gen() >= 5) b.sendItemMessage(21,s); b.inflictDamage(s,b.poke(s).totalLifePoints()/10,s); turn(b,s)["NoLifeOrbActivation"] = true; /* Self KO Clause */ if (b.koed(s)) { /* In VGC 2011 (gen 5), the user of the Life Orb wins instead of losing with the Self KO Clause */ if (b.gen() <= 4) b.selfKoer() = s; else b.selfKoer() = turn(b,s).value("LOTarget").toInt(); } } }
static void bpm(int s, int t, BS &b) { if (s == t) return; /* Doom Desire & Future sight don't have their gem attacking right away, only when it hits, and then b.attacking() is false */ if (tmove(b,s).attack == Move::FutureSight || tmove(b,s).attack == Move::DoomDesire) { if (b.attacking()) return; } if (tmove(b,s).power <= 1) { return; } if (tmove(b,s).type != poke(b,s)["ItemArg"].toInt() || tmove(b,s).attack == Move::FirePledge || tmove(b,s).attack == Move::GrassPledge || tmove(b,s).attack == Move::WaterPledge ) return; b.sendItemMessage(37, s, 0, 0, b.poke(s).item(), move(b,s)); turn(b,s)["GemActivated"] = true; b.disposeItem(s); }
static void bpm(int s, int t, BS &b) { if (s == t) return; /* Doom Desire & Future sight don't have their jewel attacking right away, only when it hits, and then b.attacking() is false */ if (tmove(b,s).attack == Move::FutureSight || tmove(b,s).attack == Move::DoomDesire) { if (b.attacking()) return; } if (tmove(b,s).power <= 1) { return; } if (tmove(b,s).type != poke(b,s)["ItemArg"].toInt()) return; b.sendItemMessage(37, s, 0, 0, b.poke(s).item(), move(b,s)); turn(b,s)["BasePowerItemModifier"] = 5; b.disposeItem(s); }
static void aaf(int t, int, BS &b) { if (turn(b,t)["RedCardCount"] != slot(b,t)["SwitchCount"]) return; int s = turn(b,t)["RedCardUser"].toInt(); if (b.koed(s) || b.koed(t) || turn(b,t)["RedCardGiverCount"] != slot(b,s)["SwitchCount"]) return; if (!b.hasWorkingItem(s, Item::RedCard)) return; int target = b.player(t); if (b.countBackUp(target) == 0) { return; } b.sendItemMessage(38, s, 0, t); b.disposeItem(s); /* ingrain & suction cups */ if (poke(b,t).value("Rooted").toBool()) { b.sendMoveMessage(107, 1, s, Pokemon::Grass,t); return; } else if (b.hasWorkingAbility(t,Ability::SuctionCups)) { b.sendMoveMessage(107, 0, s, 0,t); return; } QList<int> switches; for (int i = 0; i < 6; i++) { if (!b.isOut(target, i) && !b.poke(target,i).ko()) { switches.push_back(i); } } b.sendBack(t, true); b.sendPoke(t, switches[b.randint(switches.size())], true); b.sendMoveMessage(107,2,s,0,t); b.callEntryEffects(t); turn(b,t).remove("RedCardUser"); }
static void as(int s, int, BS &b) { bool used = false; if (poke(b,s).contains("AttractedTo")) { int seducer = poke(b,s)["AttractedTo"].toInt(); if (poke(b,seducer).contains("Attracted") && poke(b,seducer)["Attracted"].toInt() == s) { removeFunction(poke(b,s), "DetermineAttackPossible", "Attract"); poke(b,s).remove("AttractedTo"); used = true; } } if (b.gen() >= 5) { if (poke(b,s).contains("Tormented")) { removeFunction(poke(b,s), "MovesPossible", "Torment"); poke(b,s).remove("Tormented"); used = true; } if (b.counters(s).hasCounter(BC::Taunt)) { removeFunction(poke(b,s), "MovesPossible", "Taunt"); removeFunction(poke(b,s), "MovePossible", "Taunt"); b.removeEndTurnEffect(BS::PokeEffect, s, "Taunt"); used = true; } if (b.counters(s).hasCounter(BC::Encore)) { removeFunction(poke(b,s), "MovesPossible", "Encore"); b.removeEndTurnEffect(BS::PokeEffect, s, "Encore"); used = true; } if (b.counters(s).hasCounter(BC::Disable)) { removeFunction(poke(b,s), "MovesPossible", "Disable"); removeFunction(poke(b,s), "MovePossible", "Disable"); b.removeEndTurnEffect(BS::PokeEffect, s, "Disable"); used = true; } b.counters(s).clear(); } if (used) { b.sendItemMessage(7,s); b.disposeItem(s); } }