- bugifx in sp_undeadhero

- artrewards warning entfernt
- artrewards in visual studio project eingebaut
This commit is contained in:
Enno Rehling 2004-05-20 07:34:02 +00:00
parent f896b56031
commit b7f25b807c
6 changed files with 197 additions and 113 deletions

View File

@ -1,38 +1,38 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <eressea.h>
#include "artrewards.h"
/* kernel includes */
#include <item.h>
#include <region.h>
#include <faction.h>
#include <unit.h>
#include <skill.h>
#include <curse.h>
#include <message.h>
#include <magic.h>
#include <ship.h>
#include <building.h>
#include <kernel/item.h>
#include <kernel/region.h>
#include <kernel/faction.h>
#include <kernel/unit.h>
#include <kernel/skill.h>
#include <kernel/curse.h>
#include <kernel/message.h>
#include <kernel/magic.h>
#include <kernel/ship.h>
#include <kernel/building.h>
/* gamecode includes */
#include <economy.h>
#include <gamecode/economy.h>
/* util includes */
#include <functions.h>
#include <rand.h>
#include <util/functions.h>
#include <util/rand.h>
/* libc includes */
#include <assert.h>
@ -46,20 +46,20 @@
static int
age_peaceimmune(attrib * a)
{
return --a->data.i;
return --a->data.i;
}
static attrib_type at_peaceimmune = {
"peaceimmune",
NULL, NULL,
age_peaceimmune,
a_writedefault,
a_readdefault
"peaceimmune",
NULL, NULL,
age_peaceimmune,
a_writedefault,
a_readdefault
};
static int
use_hornofdancing(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
int amount, const char *cm)
{
region *r;
int regionsPacified = 0;
@ -88,29 +88,29 @@ use_hornofdancing(struct unit * u, const struct item_type * itype,
if(regionsPacified > 0) {
ADDMSG(&u->faction->msgs, msg_message("hornofpeace_u_success",
"unit region command pacified", u, u->region, cm, regionsPacified));
"unit region command pacified", u, u->region, cm, regionsPacified));
} else {
ADDMSG(&u->faction->msgs, msg_message("hornofpeace_u_nosuccess",
"unit region command", u, u->region, cm));
"unit region command", u, u->region, cm));
}
return 0;
}
static resource_type rt_hornofdancing = {
{ "hornofdancing", "hornofdancing_p" },
{ "hornofdancing", "hornofdancing_p" },
RTF_ITEM,
&res_changeitem
{ "hornofdancing", "hornofdancing_p" },
{ "hornofdancing", "hornofdancing_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_hornofdancing = {
&rt_hornofdancing, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_hornofdancing,
NULL,
NULL
&rt_hornofdancing, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_hornofdancing,
NULL,
NULL
};
@ -118,7 +118,7 @@ item_type it_hornofdancing = {
static int
use_trappedairelemental(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
int amount, const char *cm)
{
curse *c;
int shipId;
@ -137,34 +137,34 @@ use_trappedairelemental(struct unit * u, const struct item_type * itype,
}
c = create_curse(u, &sh->attribs, ct_find("shipspeedup"),
20, 999999, SPEEDUP, 0);
20, 999999, SPEEDUP, 0);
curse_setflag(c, CURSE_NOAGE);
ADDMSG(&u->faction->msgs, msg_message("trappedairelemental_success",
"unit region command ship", u, u->region, cm, sh));
"unit region command ship", u, u->region, cm, sh));
return 1;
}
static resource_type rt_trappedairelemental = {
{ "trappedairelemental", "trappedairelemental_p" },
{ "trappedairelemental", "trappedairelemental_p" },
RTF_ITEM,
&res_changeitem
{ "trappedairelemental", "trappedairelemental_p" },
{ "trappedairelemental", "trappedairelemental_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_trappedairelemental = {
&rt_trappedairelemental, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_trappedairelemental,
NULL,
NULL
&rt_trappedairelemental, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_trappedairelemental,
NULL,
NULL
};
static int
use_aurapotion50(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
int amount, const char *cm)
{
if(!is_mage(u)) {
cmistake(u, cm, 214, MSG_MAGIC);
@ -174,25 +174,25 @@ use_aurapotion50(struct unit * u, const struct item_type * itype,
change_spellpoints(u, 50);
ADDMSG(&u->faction->msgs, msg_message("aurapotion50",
"unit region command", u, u->region, cm));
"unit region command", u, u->region, cm));
return 1;
}
static resource_type rt_aurapotion50 = {
{ "aurapotion50", "aurapotion50_p" },
{ "aurapotion50", "aurapotion50_p" },
RTF_ITEM,
&res_changeitem
{ "aurapotion50", "aurapotion50_p" },
{ "aurapotion50", "aurapotion50_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_aurapotion50 = {
&rt_aurapotion50, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_aurapotion50,
NULL,
NULL
&rt_aurapotion50, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_aurapotion50,
NULL,
NULL
};
#define BAGPIPEFRACTION dice_rand("2d4+2")
@ -200,7 +200,7 @@ item_type it_aurapotion50 = {
static int
use_bagpipeoffear(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
int amount, const char *cm)
{
int money;
@ -214,31 +214,107 @@ use_bagpipeoffear(struct unit * u, const struct item_type * itype,
rsetmoney(u->region, rmoney(u->region) - money);
create_curse(u, &u->region->attribs, ct_find("depression"),
20, BAGPIPEDURATION, 0, 0);
20, BAGPIPEDURATION, 0, 0);
ADDMSG(&u->faction->msgs, msg_message("bagpipeoffear_faction",
"unit region command money", u, u->region, cm, money));
"unit region command money", u, u->region, cm, money));
ADDMSG(&u->region->msgs, msg_message("bagpipeoffear_region",
"unit money", u, money));
"unit money", u, money));
return 0;
}
static resource_type rt_bagpipeoffear = {
{ "bagpipeoffear", "bagpipeoffear_p" },
{ "bagpipeoffear", "bagpipeoffear_p" },
RTF_ITEM,
&res_changeitem
{ "bagpipeoffear", "bagpipeoffear_p" },
{ "bagpipeoffear", "bagpipeoffear_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_bagpipeoffear = {
&rt_bagpipeoffear, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_bagpipeoffear,
NULL,
NULL
&rt_bagpipeoffear, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_bagpipeoffear,
NULL,
NULL
};
static int
use_instantartacademy(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
{
building *b;
if(u->region->land == NULL) {
cmistake(u, cm, 242, MSG_MAGIC);
return 0;
}
b = new_building(bt_find("artacademy"), u->region, u->faction->locale);
b->size = 100;
sprintf(buf, "%s", LOC(u->faction->locale, "artacademy"));
set_string(&b->name, buf);
ADDMSG(&u->region->msgs, msg_message(
"artacademy_create", "unit command", u, cm));
return 1;
}
static resource_type rt_instantartacademy = {
{ "instantartacademy", "instantartacademy_p" },
{ "instantartacademy", "instantartacademy_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_instantartacademy = {
&rt_instantartacademy, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_instantartacademy,
NULL,
NULL
};
static int
use_instantartsculpture(struct unit * u, const struct item_type * itype,
int amount, const char *cm)
{
building *b;
if(u->region->land == NULL) {
cmistake(u, cm, 242, MSG_MAGIC);
return 0;
}
b = new_building(bt_find("artsculpture"), u->region, u->faction->locale);
b->size = 100;
sprintf(buf, "%s", LOC(u->faction->locale, "artsculpture"));
set_string(&b->name, buf);
ADDMSG(&u->region->msgs, msg_message(
"artsculpture_create", "unit region command", u, cm));
return 1;
}
static resource_type rt_instantartsculpture = {
{ "instantartsculpture", "instantartsculpture_p" },
{ "instantartsculpture", "instantartsculpture_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_instantartsculpture = {
&rt_instantartsculpture, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_instantartsculpture,
NULL,
NULL
};
static int
@ -335,4 +411,3 @@ register_artrewards(void)
it_register(&it_instantartsculpture);
register_function((pf_generic)use_instantartsculpture, "instantartsculpture");
}

View File

@ -120,6 +120,9 @@
<Filter
Name="Header"
Filter="*.h">
<File
RelativePath=".\artrewards.h">
</File>
<File
RelativePath=".\birthday_firework.h">
</File>
@ -151,6 +154,9 @@
RelativePath=".\xerewards.h">
</File>
</Filter>
<File
RelativePath=".\artrewards.c">
</File>
<File
RelativePath=".\birthday_firework.c">
</File>

View File

@ -377,7 +377,9 @@ troop
select_corpse(battle * b, fighter * af)
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
* Toten auf allen Seiten (im Array). Wenn af == NULL, wird die
* Parteizugehörigkeit ignoriert, und irgendeine Leiche genommen. */
* Parteizugehörigkeit ignoriert, und irgendeine Leiche genommen.
*
* Untote werden nicht ausgewählt (casualties, not dead) */
{
troop dt =
{0, 0};
@ -2307,16 +2309,17 @@ aftermath(battle * b)
#ifdef TROLLSAVE
/* Trolle können regenerieren */
if (df->alive > 0 && dead && old_race(du->race) == RC_TROLL) {
if (df->alive > 0 && dead>0 && old_race(du->race) == RC_TROLL) {
for (i = 0; i != dead; ++i) {
if (chance(TROLL_REGENERATION)) {
++df->alive;
++df->side->alive;
++df->side->battle->alive;
++trollsave[df->side->index];
--dead;
/* do not change dead here, or loop will not terminate! recalculate later */
}
}
dead = du->number - df->alive - df->run.number;
}
#endif
/* Regeneration durch PR_MERCY */
@ -2326,19 +2329,23 @@ aftermath(battle * b)
++df->alive;
++df->side->alive;
++df->side->battle->alive;
--dead;
/* do not change dead here, or loop will not terminate! recalculate later */
}
}
dead = du->number - df->alive - df->run.number;
}
/* Tote, die wiederbelebt werde können */
/* tote insgesamt: */
df->side->dead += dead;
/* Tote, die wiederbelebt werde können: */
if (playerrace(df->unit->race)) {
df->side->casualties += dead;
}
#ifdef SHOW_KILLS
if (df->hits + df->kills) {
struct message * m = new_message(du->faction, "killsandhits%u:unit%i:hits%i:kills", du, df->hits, df->kills);
struct message * m = msg_message("killsandhits", "unit hits kills", du, df->hits, df->kills);
message_faction(b, du->faction, m);
msg_release(m);
}
#endif
}
@ -2372,7 +2379,6 @@ aftermath(battle * b)
relevant = true;
}
s->flee = 0;
s->dead = 0;
cv_foreach(df, s->fighters) {
unit *du = df->unit;
@ -2394,8 +2400,6 @@ aftermath(battle * b)
sum_hp += df->person[n].hp;
}
s->dead += dead;
if (df->alive == du->number) continue; /* nichts passiert */
/* die weggerannten werden später subtrahiert! */

View File

@ -92,7 +92,7 @@ extern "C" {
int removed; /* stoned */
int flee;
int dead;
int casualties;
int casualties; /* those dead that were real people, not undead! */
int healed;
boolean dh;
boolean stealth; /* Die Einheiten sind getarnt */

View File

@ -941,7 +941,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
n = df->unit->number;
if (chance(power/n)) {
row = statusrow(df->status);
row = statusrow(df->status)+FIRST_ROW;
df->side->size[row] -= df->alive;
if (df->unit->race->battle_flags & BF_NOBLOCK) {
df->side->nonblockers[row] -= df->alive;
@ -1569,6 +1569,9 @@ sp_reanimate(fighter * fi, int level, double power, spell * sp)
++t.fighter->side->size[t.fighter->unit->status + 1];
++t.fighter->side->healed;
--t.fighter->side->casualties;
assert(t.fighter->side->casualties>=0);
--t.fighter->side->dead;
assert(t.fighter->side->dead>=0);
++j;
}
}
@ -1712,8 +1715,8 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
int maxrow = AVOID_ROW;
cvector *fgs;
void **fig;
int n, j, undead = 0;
int k = (int)get_force(power,0);
int n, undead = 0;
int force = (int)get_force(power,0);
double c = 0.50 + 0.02 * power;
/* Liste aus allen Kämpfern */
@ -1724,42 +1727,38 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
fighter *df = *fig;
unit *du = df->unit;
if (!k)
break;
if (force<=0) break;
/* keine Monster */
if (!playerrace(du->race))
continue;
if (!playerrace(du->race)) continue;
if (df->alive + df->run.number < du->number) {
j = 0;
int j = 0;
/* Wieviele Untote können wir aus dieser Einheit wecken? */
for (n = df->alive + df->run.number; n <= du->number; n++) {
if (!k) break;
if (chance(c)) {
undead++;
j++;
--df->side->casualties;
++df->side->alive;
--k;
++j;
if (--force<=0) break;
}
}
if (j > 0) {
int hp = unit_max_hp(du);
undead += j;
df->side->casualties -= j;
if (j == du->number) {
/* Einheit war vollständig tot und konnte vollständig zu
* Untoten gemacht werden */
int nr;
df->side->dead -= j;
df->side->alive += j;
du->race = new_race[RC_UNDEAD];
setguard(du, GUARD_NONE);
u_setfaction(du,mage->faction);
if (fval(mage, UFL_PARTEITARNUNG))
fset(du, UFL_PARTEITARNUNG);
df->alive = du->number;
/* den Toten wieder volle Hitpoints geben */
for (nr = 0; nr != df->alive; ++nr) {
df->person[nr].hp = hp;

View File

@ -2694,7 +2694,7 @@ wage(const region *r, const unit *u, boolean img)
curse * c;
int wage;
attrib *a;
building_type *artsculpture_type = bt_find("artsculpture");
const building_type *artsculpture_type = bt_find("artsculpture");
static const curse_type * drought_ct, * blessedharvest_ct;
static boolean init;