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;
        }
    }
 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);
 }
 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);
     }
 }
    static void m3b(int s, int t, BS &b) {
        if (!b.attacking()) {
            return;
        }
        /* We never want to activate this berry if this is consumed by Bug Bite */
        if (b.gen() >= 4 && !turn(b,s).value("BugBiter").toBool()) {
            /* Normal moves */
            if (!b.hasSubstitute(s) && tmove(b,t).type == 0) {
                b.sendBerryMessage(4,s,0,t,b.poke(s).item(),move(b,t));
                b.eatBerry(s,false);

                turn(b,t)["Mod3Berry"] = -5;
            }
        }
    }
Exemple #5
0
    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);
    }
Exemple #6
0
    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 uodr(int s, int t, BS &b) {
        if (!b.attacking() || b.koed(s)) {
            return;
        }
        int arg = poke(b,s)["ItemArg"].toInt();
        int berry = b.poke(s).item();

        if (turn(b,t).value("BugBiter").toBool() || tmove(b,t).category == Move::Special) {
            b.eatBerry(s, s==t);

            if (b.isOut(s)) {
                if (b.hasWorkingAbility(s, Ability::Contrary)) {
                    b.sendBerryMessage(7,s,1,s, berry, arg);
                } else {
                    b.sendBerryMessage(7,s,0,s, berry, arg);
                }
                b.inflictStatMod(s,arg,1,s,false);
            }
        }
    }