Ejemplo n.º 1
0
int infect_planet(int who, int star, int p)
{
    if(success(SPORE_SUCCESS_RATE)) {
        do_meta_infect(who, planets[star][p]);
        return 1;
    } else
        return 0;
}
Ejemplo n.º 2
0
int infect_planet(int type, int who, int star, int p)
{
#ifdef DEBUG
    char godbuf[200];
#endif

    int i;
    int x = int_rand(1, 100);
    planettype *pp;

    pp = planets[star][p];

    if (get_num_updates() < CombatUpdate) {
        /* If before combat, check to see if planet occupied. */
        for (i = 1; i <= Num_races; ++i) {
            if ((i != who)
                && pp->info[i - 1].popn
                && !isset(races[who - 1]->allied, i)
                && !isset(races[i - 1]->allied, who)) {
                sprintf(buf,
                        "Can only land on allies planets before Combat enabled.\nCombat enabled at update [%d]\n",
                        CombatUpdate);

                notify(who, 0, buf);

                return 0;
            }
        }
    }

    if (((x < SPORE_SUCCESS_RATE) && (type == STYPE_SUPERPOD))
        || ((x < NORMAL_SUCCESS_RATE) && (type == STYPE_POD))) {
#ifdef DEBUG
        if (type == STYPE_SUPERPOD) {
            sprintf(godbuf,
                    "SUPERPOD SUCCESS (%d%%) at /%s/%s by %s\n",
                    x,
                    Stars[star]->name,
                    Stars[star]->pnames[p],
                    races[who - 1]->name);
        } else {
            sprintf(godbuf,
                    "POD SUCCESS (%d%%) at /%s/%s by %s\n",
                    x,
                    Stars[star]->name,
                    Stars[star]->pnames[p],
                    races[who - 1]->name);
        }

        push_telegram(1, 0, godbuf);
#endif

        do_meta_infect(who, planets[star][p]);

        return 1;
    } else {
#ifdef DEBUG
        if (type == STYPE_SUPERPOD) {
            sprintf(godbuf,
                    "SUPERPOD FAILURE (%d%%) at /%s/%s by %s\n",
                    x,
                    Stars[star]->name,
                    Stars[star]->pnames[p],
                    races[who - 1]->name);
        } else {
            sprintf(godbuf,
                    "POD FAILURE (%d%%) at /%s/%s by %s\n",
                    x,
                    Stars[star]->name,
                    Stars[star]->pnames[p],
                    races[who - 1]->name);
        }

        push_telegram(1, 0, godbuf);
#endif

        return 0;
    }
}