forked from github/server
- bugifx in sp_undeadhero
- artrewards warning entfernt - artrewards in visual studio project eingebaut
This commit is contained in:
parent
f896b56031
commit
b7f25b807c
|
@ -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>
|
||||
|
@ -317,6 +317,82 @@ item_type it_instantartsculpture = {
|
|||
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
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
register_artrewards(void)
|
||||
|
@ -335,4 +411,3 @@ register_artrewards(void)
|
|||
it_register(&it_instantartsculpture);
|
||||
register_function((pf_generic)use_instantartsculpture, "instantartsculpture");
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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! */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue