forked from github/server
improve some output, remove some error messages.
This commit is contained in:
parent
854135b934
commit
79d0f255e2
8 changed files with 84 additions and 103 deletions
|
@ -41,9 +41,7 @@ attrib *
|
||||||
make_reduceproduction(int percent, int time)
|
make_reduceproduction(int percent, int time)
|
||||||
{
|
{
|
||||||
attrib * a = a_new(&at_reduceproduction);
|
attrib * a = a_new(&at_reduceproduction);
|
||||||
int reduce = 100 - (5 * time);
|
a->data.sa[0] = (short)percent;
|
||||||
if (reduce < 10) reduce = 10;
|
|
||||||
a->data.sa[0] = (short)reduce;
|
|
||||||
a->data.sa[1] = (short)time;
|
a->data.sa[1] = (short)time;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,6 @@ extern "C" {
|
||||||
|
|
||||||
#define TRADE_FRACTION 100
|
#define TRADE_FRACTION 100
|
||||||
|
|
||||||
extern struct attrib_type at_reduceproduction;
|
|
||||||
|
|
||||||
extern int income(const struct unit * u);
|
extern int income(const struct unit * u);
|
||||||
|
|
||||||
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
|
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
|
||||||
|
|
|
@ -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 */
|
/* werewolves can't be given to non-werewolves and vice-versa */
|
||||||
error = 312;
|
error = 312;
|
||||||
} else if (u2 && u2->number!=0 && u2->race != u->race) {
|
} 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],
|
itoa36(u->faction->no), u->race->_name[0],
|
||||||
u2->race->_name[1]));
|
u2->race->_name[1]));
|
||||||
error = 139;
|
error = 139;
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
/* attributes includes */
|
/* attributes includes */
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
|
#include <attributes/reduceproduction.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
|
@ -668,47 +669,38 @@ rrandneighbour(region *r)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
volcano_outbreak(region *r)
|
volcano_destruction(region * volcano, region * r, region * rn, const char * damage)
|
||||||
{
|
{
|
||||||
attrib * a;
|
attrib * a;
|
||||||
region *rn;
|
unit ** up;
|
||||||
unit *u, **up;
|
int percent = 25, time = 6 + rng_int()%12;
|
||||||
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 */
|
|
||||||
|
|
||||||
rsettrees(r, 2, 0);
|
rsettrees(r, 2, 0);
|
||||||
rsettrees(r, 1, 0);
|
rsettrees(r, 1, 0);
|
||||||
rsettrees(r, 0, 0);
|
rsettrees(r, 0, 0);
|
||||||
|
|
||||||
a = a_find(r->attribs, &at_reduceproduction);
|
a = a_find(r->attribs, &at_reduceproduction);
|
||||||
if (!a) a = a_add(&r->attribs, a_new(&at_reduceproduction));
|
if (!a) {
|
||||||
|
a = make_reduceproduction(percent, time);
|
||||||
|
} else {
|
||||||
/* Produktion vierteln ... */
|
/* Produktion vierteln ... */
|
||||||
a->data.sa[0] = 25;
|
a->data.sa[0] = (short)percent;
|
||||||
/* Für 6-17 Runden */
|
/* Für 6-17 Runden */
|
||||||
a->data.sa[1] = (short)(a->data.sa[1] + 6 + rng_int()%12);
|
a->data.sa[1] = (short)(a->data.sa[1] + time);
|
||||||
|
}
|
||||||
|
|
||||||
/* Personen bekommen 4W10 Punkte Schaden. */
|
/* Personen bekommen 4W10 Punkte Schaden. */
|
||||||
|
|
||||||
for (up=&r->units; *up;) {
|
for (up=&r->units; *up;) {
|
||||||
unit * u = *up;
|
unit * u = *up;
|
||||||
if (u->number) {
|
if (u->number) {
|
||||||
int dead = damage_unit(u, "4d10", true, false);
|
int dead = damage_unit(u, damage, true, false);
|
||||||
if (dead) {
|
if (dead) {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("volcano_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);
|
fset(u->faction, FFL_SELECT);
|
||||||
if (rn) {
|
if (rn) {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
|
ADDMSG(&u->faction->msgs, msg_message("volcanooutbreak",
|
||||||
|
@ -723,36 +715,28 @@ volcano_outbreak(region *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_empty_units_in_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 */
|
/* Zufällige Nachbarregion verwüsten */
|
||||||
|
rn = rrandneighbour(r);
|
||||||
|
|
||||||
|
volcano_destruction(r, r, rn, "4d10");
|
||||||
if (rn) {
|
if (rn) {
|
||||||
|
volcano_destruction(r, rn, NULL, "3d10");
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,24 +1200,23 @@ randomevents(void)
|
||||||
|
|
||||||
/* Vulkane qualmen, brechen aus ... */
|
/* Vulkane qualmen, brechen aus ... */
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
if (r->terrain == newterrain(T_VOLCANO_SMOKING) && a_find(r->attribs, &at_reduceproduction)) {
|
if (r->terrain == newterrain(T_VOLCANO_SMOKING)) {
|
||||||
|
if (a_find(r->attribs, &at_reduceproduction)) {
|
||||||
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
|
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
|
||||||
rsetterrain(r, T_VOLCANO);
|
rsetterrain(r, T_VOLCANO);
|
||||||
} else switch(rterrain(r)) {
|
} else {
|
||||||
case 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) {
|
if (rng_int()%100 < 12) {
|
||||||
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
|
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
|
||||||
rsetterrain(r, T_VOLCANO);
|
rsetterrain(r, T_VOLCANO);
|
||||||
} else if (rng_int()%100 < 8) {
|
} else if (rng_int()%100 < 8) {
|
||||||
volcano_outbreak(r);
|
volcano_outbreak(r);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <attributes/viewrange.h>
|
#include <attributes/viewrange.h>
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
#include <attributes/alliance.h>
|
#include <attributes/alliance.h>
|
||||||
|
#include <attributes/reduceproduction.h>
|
||||||
#ifdef AT_OPTION
|
#ifdef AT_OPTION
|
||||||
# include <attributes/option.h>
|
# include <attributes/option.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1353,6 +1353,7 @@ readgame(const char * filename, int mode, int backup)
|
||||||
}
|
}
|
||||||
a_read(store, &global.attribs);
|
a_read(store, &global.attribs);
|
||||||
global.data_turn = turn = store->r_int(store);
|
global.data_turn = turn = store->r_int(store);
|
||||||
|
log_info((1, " - reading turn %d\n", turn));
|
||||||
rng_init(turn);
|
rng_init(turn);
|
||||||
++global.cookie;
|
++global.cookie;
|
||||||
store->r_int(store); /* max_unique_id = */
|
store->r_int(store); /* max_unique_id = */
|
||||||
|
|
|
@ -117,7 +117,7 @@ oldterrain(const struct terrain_type * terrain)
|
||||||
for (t=0;t!=MAXTERRAINS;++t) {
|
for (t=0;t!=MAXTERRAINS;++t) {
|
||||||
if (newterrains[t]==terrain) return 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;
|
return NOTERRAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3096,34 +3096,6 @@ sp_unholypower(castorder *co)
|
||||||
return cast_level;
|
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
|
static int
|
||||||
dc_age(struct curse * c)
|
dc_age(struct curse * c)
|
||||||
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
|
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
|
||||||
|
@ -3215,6 +3187,34 @@ attrib_type at_deathcloud_compat = {
|
||||||
};
|
};
|
||||||
#endif
|
#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
|
static int
|
||||||
sp_deathcloud(castorder *co)
|
sp_deathcloud(castorder *co)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue