本文整理汇总了C++中BS::eatBerry方法的典型用法代码示例。如果您正苦于以下问题:C++ BS::eatBerry方法的具体用法?C++ BS::eatBerry怎么用?C++ BS::eatBerry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BS
的用法示例。
在下文中一共展示了BS::eatBerry方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: appl
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);
}
}
示例4: appl
static void appl(int s, int, BS &b) {
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.poke(s).move(i).PP() == 0) {
zeroPP = true;
init = true;
minmove = i;
minPP = 0;
break;
}
if (b.poke(s).move(i).PP() < minPP && b.poke(s).move(i).PP() < b.poke(s).move(i).totalPP()) {
minmove = i;
init = true;
minPP = b.poke(s).move(i).PP();
}
}
if (init && (zeroPP || turn(b,s).value("BugBiter").toBool())) {
b.eatBerry(s);
b.sendBerryMessage(2,s,0,0,0,b.move(s,minmove));
b.gainPP(s,minmove,10);
}
}
示例5: testpinch
static bool testpinch(int s, int , BS &b, int ratio) {
if (turn(b,s).value("BugBiter").toBool()) {
b.eatBerry(s);
return true;
}
//Gluttony
if (b.hasWorkingAbility(s, 30))
ratio = 2;
bool ret = b.poke(s).lifePoints()*ratio <= b.poke(s).totalLifePoints() && !b.koed(s);
if (ret)
b.eatBerry(s);
return ret;
}
示例6: turn
static void m3b(int s, int t, BS &b) {
if (!b.hasSubstitute(s) && turn(b,t)["TypeMod"].toInt() > 4 && turn(b,t)["Type"].toInt() == poke(b,s)["ItemArg"].toInt()) {
b.sendBerryMessage(4,s,0,t,b.poke(s).item(),move(b,t));
b.eatBerry(s,false);
turn(b,t)["Mod3Berry"] = -5;
}
}
示例7: uodr
static void uodr(int s, int t, BS &b) {
//Magic Guard
if (turn(b,t)["Category"].toInt() != poke(b,s)["ItemArg"].toInt() || b.koed(t) || b.hasWorkingAbility(t, Ability::MagicGuard)) {
return;
}
b.eatBerry(s);
b.sendBerryMessage(12,s,0,t);
b.inflictDamage(t, b.poke(t).lifePoints()/8,s,false);
}
示例8: turn
static void m3b(int s, int t, BS &b) {
if (!b.attacking()) {
return;
}
if (!b.hasSubstitute(s) && fturn(b,t).typeMod > 0 && tmove(b,t).type == poke(b,s)["ItemArg"].toInt()) {
b.sendBerryMessage(4,s,0,t,b.poke(s).item(),move(b,t));
b.eatBerry(s,false);
turn(b,t)["Mod3Berry"] = -5;
}
}
示例9: uodr
static void uodr(int s, int t, BS &b) {
if (!b.attacking()) {
return;
}
//Magic Guard
if (tmove(b,t).category != poke(b,s)["ItemArg"].toInt() || b.koed(t) || b.hasWorkingAbility(t, Ability::MagicGuard)) {
return;
}
b.eatBerry(s);
b.sendBerryMessage(12,s,0,t);
b.inflictDamage(t, b.poke(t).totalLife()/8,s,false);
}
示例10: 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;
}