本文整理汇总了C++中BS::hasWorkingAbility方法的典型用法代码示例。如果您正苦于以下问题:C++ BS::hasWorkingAbility方法的具体用法?C++ BS::hasWorkingAbility怎么用?C++ BS::hasWorkingAbility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BS
的用法示例。
在下文中一共展示了BS::hasWorkingAbility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: et
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);
}
示例4: ubh
static void ubh(int s, int t, BS &b) {
if (b.koed(s) || b.hasSubstitute(s) || b.hasWorkingAbility(s, Ability::Encourage))
return;
turn(b,s)["EscapeButtonActivated"] = true;
turn(b,s)["EscapeButtonCount"] = slot(b,s)["SwitchCount"];
addFunction(turn(b,t), "AfterAttackFinished", "EscapeButton", &aaf);
}
示例5: upa
static void upa(int s, int t, BS &b) {
if (b.koed(s) && !b.koed(t)) {
if (!b.hasWorkingAbility(t,Ability::Damp)){
b.sendAbMessage(2,0,s,t);
b.inflictPercentDamage(t,25,s,false);
}
else
b.sendAbMessage(2,1,s,t);
}
}
示例6: ubh
static void ubh(int s, int t, BS &b) {
//Red Card does not trigger if the Pokemon is phazed with Dragon Tail/Circle Throw
if (b.koed(s) || (b.hasWorkingAbility(t, Ability::SheerForce) && turn(b,t).contains("EncourageBug")) || tmove(b,t).attack == Move::DragonTail || tmove(b,t).attack == Move::CircleThrow || (b.hasSubstitute(s) && !b.canBypassSub(t)))
return;
addFunction(turn(b,t), "AfterAttackFinished", "RedCard", &aaf);
turn(b,t)["RedCardUser"] = s;
turn(b,t)["RedCardCount"] = slot(b,t)["SwitchCount"];
turn(b,t)["RedCardGiverCount"] = slot(b,s)["SwitchCount"];
return;
}
示例7: upa
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;
}
}
}
示例8: 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);
}
示例9: 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);
}
}
示例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: 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);
}
}
示例12: atl
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();
}
}
}
示例13: aaf
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");
}
示例14: atl
static void atl(int s, int, BS &b) {
if (turn(b,s).value("ActivateLifeOrb").toBool() && !b.hasWorkingAbility(s, Ability::MagicGuard)) {
//b.sendItemMessage(21,s);
b.inflictDamage(s,b.poke(s).totalLifePoints()/10,s);
}
}
示例15: 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);
}