Exemple #1
0
    static void ti(int p, int s, BS &b) {
        QString sarg = poke(b,p).value("ItemArg").toString();
        int arg = sarg.section("_", 0, 0).toInt();
        bool permanent = sarg.section("_", 1) == "1";

        if (permanent) {
            turn(b,p)["PermanentItem"] = true;
        }

        if (b.koed(s))
            return;

        int status = b.poke(s).status();
        bool conf = b.isConfused(s);

        /* Confusion berry */
        if (arg == -1) {
            if (conf) {
                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) {
            if (status == Pokemon::Fine)
                return;
            goto end;
        } else { /* Other Status Berry */
            if (status == arg) {
                goto end;
            }
        }

        return;

end:
        b.healStatus(s, status);
        b.sendBerryMessage(1, s, arg + 1);
    }
Exemple #2
0
    static void os(int s, int, BS &b) {
        b.sendItemMessage(40, s, 0);
        b.sendItemMessage(40, s, 1);
        b.inflictStatMod(s, Attack, 2, s, false);
        b.inflictConfused(s,s);
        b.disposeItem(s);

        /* in GSC cart mechanics, infinite confusion */
        if (b.isConfused(s)) {
            if (b.gen() == Gen::GoldSilver || b.gen() == Gen::Crystal) {
                poke(b,s)["ConfusedCount"] = 255;
            }
        }
    }
Exemple #3
0
    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);
    }