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); }
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); }