forked from github/server
Made sp_undeadheroes a bit simpler. Maybe bug will be easier to find that way
This commit is contained in:
parent
b93f1f5880
commit
2fed638074
|
@ -902,7 +902,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
cvector *fgs;
|
cvector *fgs;
|
||||||
void **fig;
|
void **fig;
|
||||||
int n, enemies, row;
|
int enemies;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int minrow = FIGHT_ROW;
|
int minrow = FIGHT_ROW;
|
||||||
int maxrow = NUMROWS;
|
int maxrow = NUMROWS;
|
||||||
|
@ -932,16 +932,15 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
for (fig = fgs->begin; fig != fgs->end; ++fig) {
|
for (fig = fgs->begin; fig != fgs->end; ++fig) {
|
||||||
fighter *df = *fig;
|
fighter *df = *fig;
|
||||||
|
int n = df->unit->number;
|
||||||
|
|
||||||
if (power<=0.0) break;
|
if (power<=0.0) break;
|
||||||
/* force sollte wegen des max(0,x) nicht unter 0 fallen können */
|
/* force sollte wegen des max(0,x) nicht unter 0 fallen können */
|
||||||
|
|
||||||
if (is_magic_resistant(mage, df->unit, 0)) continue;
|
if (is_magic_resistant(mage, df->unit, 0)) continue;
|
||||||
|
|
||||||
n = df->unit->number;
|
|
||||||
|
|
||||||
if (chance(power/n)) {
|
if (chance(power/n)) {
|
||||||
row = statusrow(df->status);
|
int row = statusrow(df->status);
|
||||||
df->side->size[row] -= df->alive;
|
df->side->size[row] -= df->alive;
|
||||||
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
||||||
df->side->nonblockers[row] -= df->alive;
|
df->side->nonblockers[row] -= df->alive;
|
||||||
|
@ -963,6 +962,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
default:
|
default:
|
||||||
assert(!"unknown combatrow");
|
assert(!"unknown combatrow");
|
||||||
}
|
}
|
||||||
|
assert(statusrow(df->status)==row);
|
||||||
df->side->size[row] += df->alive;
|
df->side->size[row] += df->alive;
|
||||||
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
||||||
df->side->nonblockers[row] += df->alive;
|
df->side->nonblockers[row] += df->alive;
|
||||||
|
@ -1718,6 +1718,13 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
||||||
int n, undead = 0;
|
int n, undead = 0;
|
||||||
int force = (int)get_force(power,0);
|
int force = (int)get_force(power,0);
|
||||||
double c = 0.50 + 0.02 * power;
|
double c = 0.50 + 0.02 * power;
|
||||||
|
side * s;
|
||||||
|
|
||||||
|
cv_foreach(s, b->sides) {
|
||||||
|
while (s->casualties) {
|
||||||
|
|
||||||
|
}
|
||||||
|
} cv_next(s);
|
||||||
|
|
||||||
/* Liste aus allen Kämpfern */
|
/* Liste aus allen Kämpfern */
|
||||||
fgs = fighters(b, fi, minrow, maxrow, FS_ENEMY | FS_HELP );
|
fgs = fighters(b, fi, minrow, maxrow, FS_ENEMY | FS_HELP );
|
||||||
|
@ -1744,51 +1751,34 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
int hp = unit_max_hp(du);
|
unit * u = createunit(r, mage->faction, 0, new_race[RC_UNDEAD]);
|
||||||
undead += j;
|
|
||||||
df->side->casualties -= j;
|
|
||||||
df->side->dead -= j;
|
|
||||||
if (j == du->number) {
|
|
||||||
/* Einheit war vollständig tot und konnte vollständig zu
|
|
||||||
* Untoten gemacht werden */
|
|
||||||
int nr;
|
|
||||||
|
|
||||||
df->side->alive += j;
|
/* new units gets some stats from old unit */
|
||||||
du->race = new_race[RC_UNDEAD];
|
set_string(&u->name, du->name);
|
||||||
setguard(du, GUARD_NONE);
|
set_string(&u->display, du->display);
|
||||||
u_setfaction(du,mage->faction);
|
|
||||||
if (fval(mage, UFL_PARTEITARNUNG))
|
|
||||||
fset(du, UFL_PARTEITARNUNG);
|
|
||||||
/* den Toten wieder volle Hitpoints geben */
|
|
||||||
for (nr = 0; nr != df->alive; ++nr) {
|
|
||||||
df->person[nr].hp = hp;
|
|
||||||
}
|
|
||||||
/* vereinfachtes loot */
|
|
||||||
change_money(mage, get_money(du));
|
|
||||||
set_money(du, 0);
|
|
||||||
} else {
|
|
||||||
unit *u;
|
|
||||||
u = createunit(r, mage->faction, 0, new_race[RC_UNDEAD]);
|
|
||||||
transfermen(du, u, j);
|
|
||||||
sprintf(buf, "%s", du->name);
|
|
||||||
set_string(&u->name, buf);
|
|
||||||
sprintf(buf, "%s", du->display);
|
|
||||||
set_string(&u->display, buf);
|
|
||||||
u->status = du->status;
|
u->status = du->status;
|
||||||
setguard(u, GUARD_NONE);
|
setguard(u, GUARD_NONE);
|
||||||
if (fval(mage, UFL_PARTEITARNUNG))
|
|
||||||
|
/* inherit stealth from magician */
|
||||||
|
if (fval(mage, UFL_PARTEITARNUNG)) {
|
||||||
fset(u, UFL_PARTEITARNUNG);
|
fset(u, UFL_PARTEITARNUNG);
|
||||||
set_string(&u->lastorder, du->lastorder);
|
|
||||||
/* den Toten volle Hitpoints geben */
|
|
||||||
u->hp = u->number * unit_max_hp(u);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* transfer dead people to new unit, set hitpoints to those of old unit */
|
||||||
|
transfermen(du, u, j);
|
||||||
|
u->hp = u->number * unit_max_hp(du);
|
||||||
|
df->side->casualties -= j;
|
||||||
|
df->side->dead -= j;
|
||||||
|
|
||||||
|
/* counting total number of undead */
|
||||||
|
undead += j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cv_kill(fgs);
|
cv_kill(fgs);
|
||||||
|
|
||||||
if (undead == 0) {
|
if (undead == 0) {
|
||||||
sprintf(buf, "%s kann keinen Untoten rufen.", unitname(mage));
|
sprintf(buf, "%s kann keine Untoten rufen.", unitname(mage));
|
||||||
level = 0;
|
level = 0;
|
||||||
} else if (undead == 1) {
|
} else if (undead == 1) {
|
||||||
sprintf(buf, "%s erweckt einen Untoten.", unitname(mage));
|
sprintf(buf, "%s erweckt einen Untoten.", unitname(mage));
|
||||||
|
|
Loading…
Reference in New Issue