本文整理汇总了C++中BS::poke方法的典型用法代码示例。如果您正苦于以下问题:C++ BS::poke方法的具体用法?C++ BS::poke怎么用?C++ BS::poke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BS
的用法示例。
在下文中一共展示了BS::poke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例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: uodr
static void uodr(int s, int t, BS &b) {
if (b.koed(s))
return;
if (turn(b,t)["TypeMod"].toInt() <= 4)
return;
if (b.poke(s).isFull())
return;
b.eatBerry(s);
b.sendBerryMessage(6,s,0);
b.healLife(s, b.poke(s).totalLifePoints()/5);
}
示例5: ti
static void ti(int p, int s, BS &b) {
if (b.poke(s).isFull()) {
return;
}
b.sendBerryMessage(3,s,0);
int arg = poke(b,p).value("ItemArg").toInt();
if (arg == 0) {
arg = b.poke(s).totalLifePoints();
}
b.healLife(s, arg);
}
示例6: et
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);
}
}
示例7: 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);
}
}
示例8: ahpc
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);
}
}
示例9: et
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);
}
示例10: 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;
}
示例11: tp
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);
}
示例12: btd
static void btd(int s, int t, BS &b) {
if(b.poke(s).isFull()) {
if (b.gen() <= 4)
turn(b,s)["CannotBeKoedBy"] = t;
else
turn(b,s)["CannotBeKoedAt"] = b.attackCount();
}
}
示例13: 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;
}
}
示例14: ubh
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);
}
}
示例15: udi
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);
}
}