improve some output, remove some error messages.

This commit is contained in:
Enno Rehling 2008-08-28 13:23:24 +00:00
parent 854135b934
commit 79d0f255e2
8 changed files with 84 additions and 103 deletions

View File

@ -40,12 +40,10 @@ attrib_type at_reduceproduction = {
attrib *
make_reduceproduction(int percent, int time)
{
attrib * a = a_new(&at_reduceproduction);
int reduce = 100 - (5 * time);
if (reduce < 10) reduce = 10;
a->data.sa[0] = (short)reduce;
a->data.sa[1] = (short)time;
return a;
attrib * a = a_new(&at_reduceproduction);
a->data.sa[0] = (short)percent;
a->data.sa[1] = (short)time;
return a;
}
void

View File

@ -40,8 +40,6 @@ extern "C" {
#define TRADE_FRACTION 100
extern struct attrib_type at_reduceproduction;
extern int income(const struct unit * u);
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */

View File

@ -171,7 +171,7 @@ give_men(int n, unit * u, unit * u2, struct order * ord)
/* werewolves can't be given to non-werewolves and vice-versa */
error = 312;
} else if (u2 && u2->number!=0 && u2->race != u->race) {
log_warning(("faction %s attempts to give %s to faction %s.\n",
log_warning(("faction %s attempts to give %s to %s.\n",
itoa36(u->faction->no), u->race->_name[0],
u2->race->_name[1]));
error = 139;

View File

@ -53,6 +53,7 @@
/* attributes includes */
#include <attributes/racename.h>
#include <attributes/reduceproduction.h>
/* util includes */
#include <util/attrib.h>
@ -668,47 +669,38 @@ rrandneighbour(region *r)
return rc;
}
void
volcano_outbreak(region *r)
static void
volcano_destruction(region * volcano, region * r, region * rn, const char * damage)
{
attrib *a;
region *rn;
unit *u, **up;
faction *f;
for (f=NULL,u=r->units; u; u=u->next) {
if (f!=u->faction) {
f = u->faction;
freset(f, FFL_SELECT);
}
}
rn = rrandneighbour(r);
/* Vulkan-Region verwüsten */
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 = a_add(&r->attribs, a_new(&at_reduceproduction));
/* Produktion vierteln ... */
a->data.sa[0] = 25;
/* Für 6-17 Runden */
a->data.sa[1] = (short)(a->data.sa[1] + 6 + rng_int()%12);
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, "4d10", true, false);
int dead = damage_unit(u, damage, true, false);
if (dead) {
ADDMSG(&u->faction->msgs, msg_message("volcano_dead",
"unit region dead", u, r, dead));
"unit region dead", u, volcano, dead));
}
if (!fval(u->faction, FFL_SELECT)) {
if (r==volcano && !fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (rn) {
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
@ -723,36 +715,28 @@ volcano_outbreak(region *r)
}
remove_empty_units_in_region(r);
}
void
volcano_outbreak(region *r)
{
region *rn;
unit *u;
faction *f;
for (f=NULL,u=r->units; u; u=u->next) {
if (f!=u->faction) {
f = u->faction;
freset(f, FFL_SELECT);
}
}
/* Zufällige Nachbarregion verwüsten */
rn = rrandneighbour(r);
volcano_destruction(r, r, rn, "4d10");
if (rn) {
rsettrees(r, 2, 0);
rsettrees(r, 1, 0);
rsettrees(r, 0, 0);
a = a_find(rn->attribs, &at_reduceproduction);
if (!a) a = a_add(&rn->attribs, a_new(&at_reduceproduction));
/* Produktion vierteln ... */
a->data.sa[0] = 25;
/* Für 6-17 Runden */
a->data.sa[1] = (short)(a->data.sa[1] + 6 + rng_int()%12);
/* Personen bekommen 3W10 Punkte Schaden. */
for (up=&rn->units; *up;) {
unit * u = *up;
if (u->number) {
int dead = damage_unit(u, "3d10", true, false);
if (dead) {
ADDMSG(&u->faction->msgs, msg_message("volcano_dead",
"unit region dead", u, r, dead));
}
}
if (u==*up) up=&u->next;
}
remove_empty_units_in_region(rn);
volcano_destruction(r, rn, NULL, "3d10");
}
}
@ -1216,24 +1200,23 @@ randomevents(void)
/* Vulkane qualmen, brechen aus ... */
for (r = regions; r; r = r->next) {
if (r->terrain == newterrain(T_VOLCANO_SMOKING) && a_find(r->attribs, &at_reduceproduction)) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else switch(rterrain(r)) {
case T_VOLCANO:
if (r->terrain == newterrain(T_VOLCANO_SMOKING)) {
if (a_find(r->attribs, &at_reduceproduction)) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else {
if (rng_int()%100 < 12) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else if (rng_int()%100 < 8) {
volcano_outbreak(r);
}
}
} else if (r->terrain == newterrain(T_VOLCANO)) {
if (rng_int()%100 < 4) {
ADDMSG(&r->msgs, msg_message("volcanostartsmoke", "region", r));
rsetterrain(r, T_VOLCANO_SMOKING);
}
break;
case T_VOLCANO_SMOKING:
if (rng_int()%100 < 12) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO);
} else if (rng_int()%100 < 8) {
volcano_outbreak(r);
}
break;
}
}

View File

@ -25,6 +25,7 @@
#include <attributes/viewrange.h>
#include <attributes/otherfaction.h>
#include <attributes/alliance.h>
#include <attributes/reduceproduction.h>
#ifdef AT_OPTION
# include <attributes/option.h>
#endif

View File

@ -1353,6 +1353,7 @@ readgame(const char * filename, int mode, int backup)
}
a_read(store, &global.attribs);
global.data_turn = turn = store->r_int(store);
log_info((1, " - reading turn %d\n", turn));
rng_init(turn);
++global.cookie;
store->r_int(store); /* max_unique_id = */

View File

@ -117,7 +117,7 @@ oldterrain(const struct terrain_type * terrain)
for (t=0;t!=MAXTERRAINS;++t) {
if (newterrains[t]==terrain) return t;
}
log_warning(("%s is not a classic terrain", terrain->_name));
log_warning(("%s is not a classic terrain.\n", terrain->_name));
return NOTERRAIN;
}

View File

@ -3096,34 +3096,6 @@ sp_unholypower(castorder *co)
return cast_level;
}
/* ------------------------------------------------------------- */
/* Name: Todeswolke
* Stufe: 11
* Gebiet: Draig
* Kategorie: Region, negativ
*
* Wirkung:
* Personen in der Region verlieren stufe/2 Trefferpunkte pro Runde.
* Dauer force/2
* Wirkt gegen MR
* Rüstung wirkt nicht
* Patzer:
* Magier gerät in den Staub und verliert zufällige Zahl von HP bis
* auf MAX(hp,2)
* Besonderheiten:
* Nicht als curse implementiert, was schlecht ist - man kann dadurch
* kein dispell machen. Wegen fix unter Zeitdruck erstmal nicht zu
* ändern...
* Missbrauchsmöglichkeit:
* Hat der Magier mehr HP als Rasse des Feindes (extrem: Dämon/Goblin)
* so kann er per Farcasting durch mehrmaliges Zaubern eine
* Nachbarregion auslöschen. Darum sollte dieser Spruch nur einmal auf
* eine Region gelegt werden können.
*
* Flag:
* (FARCASTING | REGIONSPELL | TESTRESISTANCE)
*/
static int
dc_age(struct curse * c)
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
@ -3215,6 +3187,34 @@ attrib_type at_deathcloud_compat = {
};
#endif
/* ------------------------------------------------------------- */
/* Name: Todeswolke
* Stufe: 11
* Gebiet: Draig
* Kategorie: Region, negativ
*
* Wirkung:
* Personen in der Region verlieren stufe/2 Trefferpunkte pro Runde.
* Dauer force/2
* Wirkt gegen MR
* Rüstung wirkt nicht
* Patzer:
* Magier gerät in den Staub und verliert zufällige Zahl von HP bis
* auf MAX(hp,2)
* Besonderheiten:
* Nicht als curse implementiert, was schlecht ist - man kann dadurch
* kein dispell machen. Wegen fix unter Zeitdruck erstmal nicht zu
* ändern...
* Missbrauchsmöglichkeit:
* Hat der Magier mehr HP als Rasse des Feindes (extrem: Dämon/Goblin)
* so kann er per Farcasting durch mehrmaliges Zaubern eine
* Nachbarregion auslöschen. Darum sollte dieser Spruch nur einmal auf
* eine Region gelegt werden können.
*
* Flag:
* (FARCASTING | REGIONSPELL | TESTRESISTANCE)
*/
static int
sp_deathcloud(castorder *co)
{