forked from github/server
In der Regel sollte create_unit() benutzt werden, um Einheiten zu erzeugen, weil dann Parteitarnung, Rasse, etc. von der erzeugenden Einheit übernommen werden.
This commit is contained in:
parent
c91d69e379
commit
fc7e4493f1
|
@ -248,7 +248,7 @@ expandrecruit(region * r, request * recruitorders)
|
|||
u->hp = u->n * unit_max_hp(u);
|
||||
unew = u;
|
||||
} else {
|
||||
unew = createunit(r, u->faction, u->n, u->race);
|
||||
unew = create_unit(r, u->faction, u->n, u->race, 0, NULL, u);
|
||||
}
|
||||
|
||||
if (unew->race == new_race[RC_URUK]) {
|
||||
|
|
|
@ -3817,7 +3817,6 @@ do_battle(void)
|
|||
*/
|
||||
switch (u->status) {
|
||||
case ST_FLEE:
|
||||
run = true;
|
||||
break;
|
||||
default:
|
||||
if ((fig->person[dt.index].flags & FL_HIT) == 0) continue;
|
||||
|
|
|
@ -762,7 +762,7 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp)
|
|||
break;
|
||||
}
|
||||
|
||||
u = createunit(r, mage->faction, force, rc);
|
||||
u = create_unit(r, mage->faction, force, rc, 0, NULL, mage);
|
||||
u->status = ST_FIGHT;
|
||||
|
||||
set_string(&u->name, racename(mage->faction->locale, u, u->race));
|
||||
|
@ -770,9 +770,6 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp)
|
|||
set_level(u, SK_AUSDAUER, (int)(power/2));
|
||||
u->hp = u->number * unit_max_hp(u);
|
||||
|
||||
if (fval(mage, UFL_PARTEITARNUNG))
|
||||
fset(u, UFL_PARTEITARNUNG);
|
||||
|
||||
a = a_new(&at_unitdissolve);
|
||||
a->data.ca[0] = 0;
|
||||
a->data.ca[1] = 100;
|
||||
|
@ -793,7 +790,7 @@ sp_wolfhowl(fighter * fi, int level, double power, spell * sp)
|
|||
unit *mage = fi->unit;
|
||||
attrib *a;
|
||||
int force = (int)(get_force(power, 3)/2);
|
||||
unit *u = createunit(r, mage->faction, force, new_race[RC_WOLF]);
|
||||
unit *u = create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage);
|
||||
unused(sp);
|
||||
|
||||
u->status = ST_FIGHT;
|
||||
|
@ -830,7 +827,7 @@ sp_shadowknights(fighter * fi, int level, double power, spell * sp)
|
|||
|
||||
unused(sp);
|
||||
|
||||
u = createunit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT]);
|
||||
u = create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL, mage);
|
||||
u->status = ST_FIGHT;
|
||||
|
||||
set_string(&u->name, "Schattenritter");
|
||||
|
@ -1730,7 +1727,7 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
|||
}
|
||||
|
||||
if (j > 0) {
|
||||
unit * u = createunit(r, mage->faction, 0, new_race[RC_UNDEAD]);
|
||||
unit * u = create_unit(r, mage->faction, 0, new_race[RC_UNDEAD], 0, NULL, mage);
|
||||
|
||||
/* new units gets some stats from old unit */
|
||||
set_string(&u->name, du->name);
|
||||
|
|
|
@ -2543,16 +2543,12 @@ init_used_faction_ids(void)
|
|||
}
|
||||
|
||||
|
||||
unit *
|
||||
make_undead_unit(region * r, faction * f, int n, const struct race * rc)
|
||||
void
|
||||
make_undead_unit(unit * u)
|
||||
{
|
||||
unit *u;
|
||||
|
||||
u = createunit(r, f, n, rc);
|
||||
set_order(&u->lastorder, NULL);
|
||||
name_unit(u);
|
||||
fset(u, UFL_ISNEW);
|
||||
return u;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -920,7 +920,7 @@ extern int findoption(const char *s, const struct locale * lang);
|
|||
extern char buf[BUFSIZE + 1];
|
||||
|
||||
/* special units */
|
||||
struct unit *make_undead_unit(struct region * r, struct faction * f, int n, const struct race * rc);
|
||||
void make_undead_unit(struct unit *);
|
||||
|
||||
extern struct region *regions;
|
||||
extern struct faction *factions;
|
||||
|
|
|
@ -614,7 +614,7 @@ sp_summon_familiar(castorder *co)
|
|||
target_region = rconnect(r,d);
|
||||
}
|
||||
|
||||
familiar = createunit(target_region, mage->faction, 1, rc);
|
||||
familiar = create_unit(target_region, mage->faction, 1, rc, 0, NULL, mage);
|
||||
if (target_region==mage->region) {
|
||||
familiar->building = mage->building;
|
||||
familiar->ship = mage->ship;
|
||||
|
@ -3225,11 +3225,7 @@ sp_unholypower(castorder *co)
|
|||
/* Verletzungsanteil der transferierten Personen berechnen */
|
||||
wounds = wounds*n/u->number;
|
||||
|
||||
un = createunit(co->rt, u->faction, 0, target_race);
|
||||
if (co->rt==u->region) {
|
||||
un->building = u->building;
|
||||
un->ship = u->ship;
|
||||
}
|
||||
un = create_unit(co->rt, u->faction, 0, target_race, 0, NULL, u);
|
||||
transfermen(u, un, n);
|
||||
un->hp = unit_max_hp(un)*n - wounds;
|
||||
ADDMSG(&co->rt->msgs, msg_message("unholypower_limitedeffect",
|
||||
|
@ -3502,13 +3498,7 @@ sp_summonshadow(castorder *co)
|
|||
unit *u;
|
||||
int val;
|
||||
|
||||
u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOW]);
|
||||
if (r==mage->region) {
|
||||
u->building = mage->building;
|
||||
u->ship = mage->ship;
|
||||
}
|
||||
if (fval(mage, UFL_PARTEITARNUNG))
|
||||
fset(u, UFL_PARTEITARNUNG);
|
||||
u = create_unit(r, mage->faction, (int)(force*force), new_race[RC_SHADOW], 0, NULL, mage);
|
||||
|
||||
/* Bekommen Tarnung = (Magie+Tarnung)/2 und Wahrnehmung 1. */
|
||||
val = get_level(mage, SK_MAGIC) + get_level(mage, SK_STEALTH);
|
||||
|
@ -3549,13 +3539,7 @@ sp_summonshadowlords(castorder *co)
|
|||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
|
||||
u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOWLORD]);
|
||||
if (r==mage->region) {
|
||||
u->building = mage->building;
|
||||
u->ship = mage->ship;
|
||||
}
|
||||
if (fval(mage, UFL_PARTEITARNUNG))
|
||||
fset(u, UFL_PARTEITARNUNG);
|
||||
u = create_unit(r, mage->faction, (int)(force*force), new_race[RC_SHADOWLORD], 0, NULL, mage);
|
||||
|
||||
/* Bekommen Tarnung = Magie und Wahrnehmung 5. */
|
||||
set_level(u, SK_STEALTH, get_level(mage, SK_MAGIC));
|
||||
|
@ -3786,13 +3770,8 @@ sp_summonundead(castorder *co)
|
|||
race = new_race[RC_GHOUL];
|
||||
}
|
||||
|
||||
u = make_undead_unit(r, mage->faction, undead, race);
|
||||
if (r==mage->region) {
|
||||
u->building = mage->building;
|
||||
u->ship = mage->ship;
|
||||
}
|
||||
if (fval(mage, UFL_PARTEITARNUNG))
|
||||
fset(u, UFL_PARTEITARNUNG);
|
||||
u = create_unit(r, mage->faction, undead, race, 0, NULL, mage);
|
||||
make_undead_unit(u);
|
||||
|
||||
sprintf(buf, "%s erweckt %d Untote aus ihren Gräbern.",
|
||||
unitname(mage), undead);
|
||||
|
@ -5432,14 +5411,9 @@ sp_clonecopy(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
clone = createunit(target_region, mage->faction, 1, new_race[RC_CLONE]);
|
||||
if (target_region==mage->region) {
|
||||
clone->building = mage->building;
|
||||
clone->ship = mage->ship;
|
||||
}
|
||||
sprintf(buf, "Klon von %s", unitname(mage));
|
||||
clone = create_unit(target_region, mage->faction, 1, new_race[RC_CLONE], 0, buf, mage);
|
||||
clone->status = ST_FLEE;
|
||||
sprintf(buf, "Klon von %s", unitname(mage));
|
||||
set_string(&clone->name, buf);
|
||||
fset(clone, UFL_LOCKED);
|
||||
|
||||
create_newclone(mage, clone);
|
||||
|
@ -5485,7 +5459,7 @@ sp_dreamreading(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
u2=createunit(u->region,mage->faction, RS_FARVISION, new_race[RC_SPELL]);
|
||||
u2 = createunit(u->region,mage->faction, RS_FARVISION, new_race[RC_SPELL]);
|
||||
set_number(u2, 1);
|
||||
set_string(&u2->name, "sp_dreamreading");
|
||||
u2->age = 2; /* Nur für diese Runde. */
|
||||
|
|
|
@ -73,10 +73,9 @@ age_undead(unit *u)
|
|||
for (m = u->number; m; m--)
|
||||
if (rand() % 100 < UNDEAD_BREAKUP_FRACTION)
|
||||
n++;
|
||||
u2 = make_undead_unit(r, findfaction(MONSTER_FACTION), 0, new_race[RC_UNDEAD]);
|
||||
u2 = create_unit(r, findfaction(MONSTER_FACTION), 0, new_race[RC_UNDEAD], 0, NULL, u);
|
||||
make_undead_unit(u2);
|
||||
transfermen(u, u2, u->number - n);
|
||||
u2->building = u->building;
|
||||
u2->ship = u->ship;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue