Esempio n. 1
0
void drown(region * r)
{
  if (fval(r->terrain, SEA_REGION)) {
    unit **up = up = &r->units;
    while (*up) {
      unit *u = *up;
      int amphibian_level = 0;
      if (u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0) {
        up = &u->next;
        continue;
      }

      if (amphibian_level) {
        int dead = damage_unit(u, "5d1", false, false);
        if (dead) {
          ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_dead",
              "amount unit region", dead, u, r));
        } else {
          ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_nodead",
              "unit region", u, r));
        }
      } else if (!(canswim(u) || canfly(u))) {
        scale_number(u, 0);
        ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r));
      }
      if (*up == u)
        up = &u->next;
    }
    remove_empty_units_in_region(r);
  }
}
Esempio n. 2
0
static void
volcano_destruction(region * volcano, region * r, region * rn,
  const char *damage)
{
  attrib *a;
  unit **up;
  int percent = 25, time = 6 + rng_int() % 12;

  rsettrees(r, 2, 0);
  rsettrees(r, 1, 0);
  rsettrees(r, 0, 0);

  a = a_find(r->attribs, &at_reduceproduction);
  if (!a) {
    a = make_reduceproduction(percent, time);
  } else {
    /* Produktion vierteln ... */
    a->data.sa[0] = (short)percent;
    /* Für 6-17 Runden */
    a->data.sa[1] = (short)(a->data.sa[1] + time);
  }

  /* Personen bekommen 4W10 Punkte Schaden. */

  for (up = &r->units; *up;) {
    unit *u = *up;
    if (u->number) {
      int dead = damage_unit(u, damage, true, false);
      if (dead) {
        ADDMSG(&u->faction->msgs, msg_message("volcano_dead",
            "unit region dead", u, volcano, dead));
      }
      if (r == volcano && !fval(u->faction, FFL_SELECT)) {
        fset(u->faction, FFL_SELECT);
        if (rn) {
          ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
              "regionv regionn", r, rn));
        } else {
          ADDMSG(&u->faction->msgs, msg_message("volcanooutbreaknn",
              "region", r));
        }
      }
    }
    if (u == *up)
      up = &u->next;
  }

  remove_empty_units_in_region(r);
}
Esempio n. 3
0
void drown(region * r)
{
    if (fval(r->terrain, SEA_REGION)) {
        unit **up = &r->units;
        while (*up) {
            unit *u = *up;

            if (!(u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0 || canswim(u) || canfly(u))) {
                scale_number(u, 0);
                ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r));
            }

            up = &u->next;
        }
        remove_empty_units_in_region(r);
    }
}