本文整理汇总了C++中BS类的典型用法代码示例。如果您正苦于以下问题:C++ BS类的具体用法?C++ BS怎么用?C++ BS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: et
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);
}
示例2: udi
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);
}
}
示例3: testpinch
static bool testpinch(int p, int s, BS &b, int ratio, bool activate) {
//HP Pinches activate, nothing else does if sending back
if (turn(b,s).value("SendingBack").toBool() && !activate) {
return false;
}
if (turn(b,p).value("BugBiter").toBool()) {
b.eatBerry(s);
return true;
}
//Gluttony
if (b.hasWorkingAbility(s, Ability::Gluttony))
ratio = 2;
if (!b.koed(s)) {
int lp = b.poke(s).lifePoints();
int tp = b.poke(s).totalLifePoints();
if (lp*ratio <= tp) {
//Reusing 'bool activate' in order to only affect HP berries
if (poke(b, s).value("HealBlockCount").toInt() > 0 && activate) {
b.sendMoveMessage(59,BS::HealByItem,s,Type::Psychic,s,b.poke(s).item());
return false;
}
b.eatBerry(s,s==p);
return true;
}
}
return false;
}
示例4: to
static void to (int p, int s, BS &b) {
if (!b.isOut(p)) {
return;
}
if (turn(b,p).value("BugBiter").toBool()) {
b.eatBerry(s);
return;
}
if (!testpinch(p, s, b, 4, false)) {
return;
}
b.sendBerryMessage(11,s,0);
turn(b,s)["TurnOrder"] = 3;
}
示例5: asc
static void asc(int s, int, BS &b) {
if (b.koed(s))
return;
int status = b.poke(s).status();
bool conf = b.isConfused(s);
int arg = poke(b,s)["ItemArg"].toInt();
/* Confusion berry */
if (arg == -1) {
if (conf) {
b.eatBerry(s);
b.healConfused(s);
b.sendBerryMessage(1, s, 0);
}
return;
}
/* Lum berry */
if (conf && arg == 0) {
b.healConfused(s);
goto end;
}
if (status == Pokemon::Fine) {
return;
}
/* LumBerry */
if (arg == 0) {
goto end;
} /* Poison Berry */
else if (arg == Pokemon::Poisoned) {
if (status == Pokemon::Poisoned || status == Pokemon::DeeplyPoisoned) {
goto end;
}
} else { /* Other Status Berry */
if (status == arg) {
goto end;
}
}
return;
end:
b.eatBerry(s);
b.healStatus(s, status);
b.sendBerryMessage(1, s, arg + 1);
}
示例6: ti
static void ti(int p, int s, BS &b) {
int pp = poke(b,p).value("ItemArg").toInt();
if (pp == 0) {
pp = 99;
}
b.sendBerryMessage(2,s,1);
for (int i = 0; i < 4; i++) {
if (b.move(s,i) != Move::NoMove) {
b.gainPP(s, i, pp);
}
}
}
示例7: tp
static void tp(int p, int s, BS &b) {
if (!b.isOut(s)) {
return;
}
if (!testpinch(p, s, b, 4, false)) {
return;
}
if (b.gen() <= 4) {
poke(b,s)["BerryLock"] = true;
} else {
poke(b,s)["Stat6BerryModifier"] = true;
}
b.sendBerryMessage(10,s,0);
}
示例8: to
static void to (int s, int, BS &b) {
if (!testpinch(s, s, b,4))
return;
b.sendBerryMessage(11,s,0);
turn(b,s)["TurnOrder"] = 3;
}
示例9: btl
static void btl(int s, int, BS &b) {
if (!testpinch(s, s, b,4))
return;
poke(b,s)["BerryLock"] = true;
b.sendBerryMessage(10,s,0);
}
示例10: bpm
static void bpm(int s, int, BS &b) {
if (tmove(b,s).type == poke(b,s)["ItemArg"]) {
if (b.gen() >= 4)
turn(b,s)["BasePowerItemModifier"] = 2;
else
turn(b,s)["BasePowerItemModifier"] = 1;
}
}
示例11: aaf
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);
}
}
示例12: uodr
static void uodr(int s, int, BS &b) {
if (!b.attacking()) {
return;
}
if (b.attacker() == s)
return;
if (fturn(b,b.attacker()).typeMod <= 0)
return;
if (b.canHeal(s,BS::HealByItem,b.poke(s).item())) {
b.eatBerry(s);
b.sendBerryMessage(6,s,0);
b.healLife(s, b.poke(s).totalLifePoints()/5);
}
}
示例13: udi
static void udi(int s, int t, BS &b) {
if (s == t)
return; /* life orb doesn't recoil with self damage */
if (b.koed(s))
return;
if (turn(b,t).contains("DamageTakenBy") && turn(b,t)["DamageTakenBy"].toInt() == s) {
turn(b,s)["ActivateLifeOrb"] = true;
}
}
示例14: bpm
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);
}
示例15: sm
static void sm(int s,int, BS &b) {
int num = b.pokenum(s).pokenum;
QStringList args = poke(b,s)["ItemArg"].toString().split('_');
if(!args[0].split('/').contains(QString::number(num))) {
return;
}
int boost = args[1].toInt();
for (int i = 2; i < args.size(); i++) {
turn(b,s)["Stat" + args[i] + "ItemModifier"] = boost;
}
}