Ejemplo n.º 1
0
void mdeath::fungus(game *g, monster *z)
{
 monster spore(g->mtypes[mon_spore]);
 int sporex, sporey;
 g->sound(z->posx, z->posy, 10, "Pouf!");
 for (int i = -1; i <= 1; i++) {
  for (int j = -1; j <= 1; j++) {
   sporex = z->posx + i;
   sporey = z->posy + j;
   if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
    if (g->mon_at(sporex, sporey) >= 0) {	// Spores hit a monster
     if (g->u_see(sporex, sporey, j))
      g->add_msg("The %s is covered in tiny spores!",
                 g->z[g->mon_at(sporex, sporey)].name().c_str());
     if (!g->z[g->mon_at(sporex, sporey)].make_fungus(g))
      g->kill_mon(g->mon_at(sporex, sporey));
    } else if (g->u.posx == sporex && g->u.posy == sporey)
     g->u.infect(DI_SPORES, bp_mouth, 4, 30, g);
    else {
     spore.spawn(sporex, sporey);
     g->z.push_back(spore);
    }
   }
  }
 }
}
Ejemplo n.º 2
0
void mdeath::fungus(game *g, monster *z)
{
 monster spore(g->mtypes[mon_spore]);
 int sporex, sporey;
 //~ the sound of a fungus dying
 g->sound(z->posx(), z->posy(), 10, _("Pouf!"));
 for (int i = -1; i <= 1; i++) {
  for (int j = -1; j <= 1; j++) {
   sporex = z->posx() + i;
   sporey = z->posy() + j;
   if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
    if (g->mon_at(sporex, sporey) >= 0) { // Spores hit a monster
     if (g->u_see(sporex, sporey))
      g->add_msg(_("The %s is covered in tiny spores!"),
                 g->zombie(g->mon_at(sporex, sporey)).name().c_str());
     if (!g->zombie(g->mon_at(sporex, sporey)).make_fungus(g))
      g->kill_mon(g->mon_at(sporex, sporey), (z->friendly != 0));
    } else if (g->u.posx == sporex && g->u.posy == sporey)
     g->u.infect("spores", bp_mouth, 4, 30, g);
    else {
     spore.spawn(sporex, sporey);
     g->add_zombie(spore);
    }
   }
  }
 }
}
Ejemplo n.º 3
0
void mdeath::fungus(monster *z)
{
    monster spore(GetMType("mon_spore"));
    bool fungal = false;
    int mondex = -1;
    int sporex, sporey;
    //~ the sound of a fungus dying
    g->sound(z->posx(), z->posy(), 10, _("Pouf!"));
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            sporex = z->posx() + i;
            sporey = z->posy() + j;
            mondex = g->mon_at(sporex, sporey);
            if (g->m.move_cost(sporex, sporey) > 0) {
                if (mondex != -1) {
                    // Spores hit a monster
                    fungal = g->zombie(mondex).type->in_species("FUNGUS");
                    if (g->u_see(sporex, sporey) && !fungal) {
                        add_msg(_("The %s is covered in tiny spores!"),
                                g->zombie(mondex).name().c_str());
                    }
                    monster &critter = g->zombie( mondex );
                    if( !critter.make_fungus() ) {
                        critter.die( z ); // counts as kill by monster z
                    }
                } else if (g->u.posx == sporex && g->u.posy == sporey) {
                    // Spores hit the player
                    if (g->u.has_trait("TAIL_CATTLE") && one_in(20 - g->u.dex_cur - g->u.skillLevel("melee"))) {
                        add_msg(_("The spores land on you, but you quickly swat them off with your tail!"));
                        return;
                    }
                    bool hit = false;
                    if (one_in(4) && g->u.infect("spores", bp_head, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (one_in(2) && g->u.infect("spores", bp_torso, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (one_in(4) && g->u.infect("spores", bp_arm_l, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (one_in(4) && g->u.infect("spores", bp_arm_r, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (one_in(4) && g->u.infect("spores", bp_leg_l, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (one_in(4) && g->u.infect("spores", bp_leg_r, 3, 90, false, 1, 3, 120, 1, true)) {
                        hit = true;
                    }
                    if (hit && (g->u.has_trait("TAIL_CATTLE") &&
                                one_in(20 - g->u.dex_cur - g->u.skillLevel("melee")))) {
                        add_msg(_("The spores land on you, but you quickly swat them off with your tail!"));
                        hit = false;
                    }
                    if (hit) {
                        add_msg(m_warning, _("You're covered in tiny spores!"));
                    }
                } else if (one_in(2) && g->num_zombies() <= 1000) {
                    // Spawn a spore
                    spore.spawn(sporex, sporey);
                    g->add_zombie(spore);
                }
            }
        }
    }
}