forked from github/server
BUG 1877: change non-spell familiars.
1. mages can have actions when familiars cast spells. 2. familiar spells do not increase magician's costs. 3. improve separation of caster and mage.
This commit is contained in:
parent
83b6db41fe
commit
b181618b53
7 changed files with 309 additions and 252 deletions
|
@ -10,6 +10,7 @@ function setup()
|
|||
eressea.settings.set("rules.food.flags", "4")
|
||||
eressea.settings.set("rules.peasants.growth.factor", "0")
|
||||
eressea.settings.set("magic.fumble.enable", "0")
|
||||
eressea.settings.set("magic.regeneration.enable", "0")
|
||||
end
|
||||
|
||||
function test_shapeshift()
|
||||
|
@ -104,6 +105,56 @@ function test_earn_silver()
|
|||
assert_equal(0, r:get_resource("money"))
|
||||
end
|
||||
|
||||
function test_familiar_cast()
|
||||
local r = region.create(0, 0, "plain")
|
||||
r:set_resource("money", 350)
|
||||
r:set_resource("peasant", 0)
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r)
|
||||
u.magic = "gwyrrd"
|
||||
u:set_skill("magic", 10)
|
||||
u.aura = 200
|
||||
u:add_spell("earn_silver#gwyrrd")
|
||||
u:add_order('ARBEITE')
|
||||
local uf = unit.create(f, r)
|
||||
uf.magic = "gwyrrd"
|
||||
uf.race = "lynx"
|
||||
uf:set_skill("magic", 5)
|
||||
uf:add_order('ZAUBER STUFE 1 Viehheilung')
|
||||
u.familiar = uf
|
||||
process_orders()
|
||||
assert_equal(198, u.aura) -- Fremdzauber, Kosten verdoppelt
|
||||
assert_equal(10, u:get_item('money')) -- von ARBEITE
|
||||
assert_equal(50, uf:get_item('money')) -- von Zauber
|
||||
assert_equal(300, uf.region:get_resource("money"))
|
||||
end
|
||||
|
||||
function test_familiar_mage_actions()
|
||||
local r = region.create(0, 0, "plain")
|
||||
r:set_resource("money", 350)
|
||||
r:set_resource("peasant", 0)
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r)
|
||||
u.magic = "gwyrrd"
|
||||
u:set_skill("magic", 10)
|
||||
u.aura = 200
|
||||
u:add_spell("earn_silver#gwyrrd")
|
||||
u:add_order('ZAUBER STUFE 1 Viehheilung')
|
||||
local uf = unit.create(f, r)
|
||||
uf.magic = "gwyrrd"
|
||||
uf.race = "lynx"
|
||||
uf:set_skill("magic", 5)
|
||||
uf:add_order('ZAUBER STUFE 1 Viehheilung')
|
||||
u.familiar = uf
|
||||
u.name = 'Xolgrim'
|
||||
uf.name = 'Zonk'
|
||||
process_orders()
|
||||
assert_equal(50, u:get_item('money'))
|
||||
assert_equal(50, uf:get_item('money'))
|
||||
assert_equal(250, uf.region:get_resource("money"))
|
||||
assert_equal(197, u.aura)
|
||||
end
|
||||
|
||||
function test_familiar()
|
||||
local r = region.create(0, 0, "mountain")
|
||||
local f = faction.create("human")
|
||||
|
|
43
src/battle.c
43
src/battle.c
|
@ -134,6 +134,7 @@ static int rule_cavalry_skill;
|
|||
static int rule_population_damage;
|
||||
static int rule_hero_speed;
|
||||
static bool rule_anon_battle;
|
||||
static bool rule_igjarjuk_curse;
|
||||
static int rule_goblin_bonus;
|
||||
static int rule_tactics_formula;
|
||||
static int rule_nat_armor;
|
||||
|
@ -156,6 +157,7 @@ static void init_rules(void)
|
|||
rule_hero_speed = config_get_int("rules.combat.herospeed", 10);
|
||||
rule_population_damage = config_get_int("rules.combat.populationdamage", 20);
|
||||
rule_anon_battle = config_get_int("rules.stealth.anon_battle", 1) != 0;
|
||||
rule_igjarjuk_curse = config_get_int("rules.combat.igjarjuk_curse", 0) != 0;
|
||||
rule_cavalry_mode = config_get_int("rules.cavalry.mode", 1);
|
||||
rule_cavalry_skill = config_get_int("rules.cavalry.skill", 2);
|
||||
rule_vampire = config_get_int("rules.combat.demon_vampire", 0);
|
||||
|
@ -1748,13 +1750,14 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
|
||||
memset(spellranks, 0, sizeof(spellranks));
|
||||
|
||||
if (was == DO_PRECOMBATSPELL) {
|
||||
if (rule_igjarjuk_curse && was == DO_PRECOMBATSPELL) {
|
||||
summon_igjarjuk(b, spellranks);
|
||||
}
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
fighter *fig;
|
||||
for (fig = s->fighters; fig; fig = fig->next) {
|
||||
unit *mage = fig->unit;
|
||||
unit *caster = mage;
|
||||
|
||||
if (fig->alive <= 0)
|
||||
continue; /* fighter kann im Kampf get<65>tet worden sein */
|
||||
|
@ -1788,7 +1791,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
continue;
|
||||
}
|
||||
|
||||
level = eff_spelllevel(mage, sp, level, 1);
|
||||
level = eff_spelllevel(mage, caster, sp, level, 1);
|
||||
if (sl > 0 && sl < level) {
|
||||
level = sl;
|
||||
}
|
||||
|
@ -1802,11 +1805,11 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
free_order(ord);
|
||||
if (power <= 0) { /* Effekt von Antimagie */
|
||||
report_failed_spell(b, mage, sp);
|
||||
pay_spell(mage, sp, level, 1);
|
||||
pay_spell(mage, NULL, sp, level, 1);
|
||||
}
|
||||
else if (fumble(r, mage, sp, level)) {
|
||||
report_failed_spell(b, mage, sp);
|
||||
pay_spell(mage, sp, level, 1);
|
||||
pay_spell(mage, NULL, sp, level, 1);
|
||||
}
|
||||
else {
|
||||
co = create_castorder_combat(0, fig, sp, level, power);
|
||||
|
@ -1822,7 +1825,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
|
||||
level = cast_spell(co);
|
||||
if (level > 0) {
|
||||
pay_spell(fig->unit, sp, level, 1);
|
||||
pay_spell(fig->unit, NULL, sp, level, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1839,7 +1842,7 @@ static int cast_combatspell(troop at, const spell * sp, int level, double force)
|
|||
level = cast_spell(&co);
|
||||
free_castorder(&co);
|
||||
if (level > 0) {
|
||||
pay_spell(at.fighter->unit, sp, level, 1);
|
||||
pay_spell(at.fighter->unit, NULL, sp, level, 1);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
@ -1848,7 +1851,7 @@ static void do_combatspell(troop at)
|
|||
{
|
||||
const spell *sp;
|
||||
fighter *fi = at.fighter;
|
||||
unit *caster = fi->unit;
|
||||
unit *mage = fi->unit;
|
||||
battle *b = fi->side->battle;
|
||||
region *r = b->region;
|
||||
selist *ql;
|
||||
|
@ -1857,28 +1860,28 @@ static void do_combatspell(troop at)
|
|||
int fumblechance = 0;
|
||||
order *ord;
|
||||
int sl;
|
||||
const struct locale *lang = caster->faction->locale;
|
||||
const struct locale *lang = mage->faction->locale;
|
||||
|
||||
sp = get_combatspell(caster, 1);
|
||||
sp = get_combatspell(mage, 1);
|
||||
if (sp == NULL) {
|
||||
fi->magic = 0; /* Hat keinen Kampfzauber, k<>mpft nichtmagisch weiter */
|
||||
return;
|
||||
}
|
||||
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
||||
if (!cancast(caster, sp, 1, 1, ord)) {
|
||||
if (!cancast(mage, sp, 1, 1, ord)) {
|
||||
fi->magic = 0; /* Kann nicht mehr Zaubern, k<>mpft nichtmagisch weiter */
|
||||
return;
|
||||
}
|
||||
|
||||
level = eff_spelllevel(caster, sp, fi->magic, 1);
|
||||
sl = get_combatspelllevel(caster, 1);
|
||||
level = eff_spelllevel(mage, mage, sp, fi->magic, 1);
|
||||
sl = get_combatspelllevel(mage, 1);
|
||||
if (sl > 0 && sl < level) {
|
||||
level = sl;
|
||||
}
|
||||
|
||||
if (fumble(r, caster, sp, level)) {
|
||||
report_failed_spell(b, caster, sp);
|
||||
pay_spell(caster, sp, level, 1);
|
||||
if (fumble(r, mage, sp, level)) {
|
||||
report_failed_spell(b, mage, sp);
|
||||
pay_spell(mage, NULL, sp, level, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1894,16 +1897,16 @@ static void do_combatspell(troop at)
|
|||
|
||||
/* Antimagie die Fehlschlag erh<72>ht */
|
||||
if (rng_int() % 100 < fumblechance) {
|
||||
report_failed_spell(b, caster, sp);
|
||||
pay_spell(caster, sp, level, 1);
|
||||
report_failed_spell(b, mage, sp);
|
||||
pay_spell(mage, NULL, sp, level, 1);
|
||||
free_order(ord);
|
||||
return;
|
||||
}
|
||||
power = spellpower(r, caster, sp, level, ord);
|
||||
power = spellpower(r, mage, sp, level, ord);
|
||||
free_order(ord);
|
||||
if (power <= 0) { /* Effekt von Antimagie */
|
||||
report_failed_spell(b, caster, sp);
|
||||
pay_spell(caster, sp, level, 1);
|
||||
report_failed_spell(b, mage, sp);
|
||||
pay_spell(mage, NULL, sp, level, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
254
src/magic.c
254
src/magic.c
|
@ -657,8 +657,6 @@ int change_maxspellpoints(unit * u, int csp)
|
|||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Counter für die bereits gezauberte Anzahl Sprüche pro Runde.
|
||||
* Um nur die Zahl der bereits gezauberten Sprüche zu ermitteln mit
|
||||
* step = 0 aufrufen.
|
||||
*/
|
||||
int countspells(unit * u, int step)
|
||||
{
|
||||
|
@ -666,36 +664,60 @@ int countspells(unit * u, int step)
|
|||
int count;
|
||||
|
||||
m = get_mage_depr(u);
|
||||
if (!m)
|
||||
if (!m) {
|
||||
return 0;
|
||||
|
||||
if (step == 0)
|
||||
}
|
||||
if (step == 0) {
|
||||
return m->spellcount;
|
||||
|
||||
}
|
||||
count = m->spellcount + step;
|
||||
|
||||
m->spellcount = (count > 0) ? count : 0;
|
||||
return m->spellcount;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Die für den Spruch benötigte Aura pro Stufe.
|
||||
* Die Grundkosten pro Stufe werden hier um 2^count erhöht. Der
|
||||
* Parameter count ist dabei die Anzahl der bereits gezauberten Sprüche
|
||||
int spellcount(const unit *u) {
|
||||
sc_mage *m = get_mage_depr(u);
|
||||
if (m) {
|
||||
return m->spellcount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Grundkosten pro Stufe werden um 2^count erhöht. countspells(u)
|
||||
* ist dabei die Anzahl der bereits gezauberten Sprüche
|
||||
*/
|
||||
int spellcost(unit * u, const spell * sp)
|
||||
int aura_multiplier(const unit * u) {
|
||||
int count = spellcount(u);
|
||||
return (1 << count);
|
||||
}
|
||||
|
||||
int spellcost(const unit * caster, const struct spell_component *spc)
|
||||
{
|
||||
int k, aura = 0;
|
||||
int count = countspells(u, 0);
|
||||
const resource_type *r_aura = get_resourcetype(R_AURA);
|
||||
|
||||
for (k = 0; sp->components && sp->components[k].type; k++) {
|
||||
if (sp->components[k].type == r_aura) {
|
||||
aura = sp->components[k].amount;
|
||||
if (spc->type == r_aura) {
|
||||
return spc->amount * aura_multiplier(caster);
|
||||
}
|
||||
return spc->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Die für den Spruch benötigte Aura pro Stufe.
|
||||
*/
|
||||
int auracost(const unit *caster, const spell *sp) {
|
||||
const resource_type *r_aura = get_resourcetype(R_AURA);
|
||||
if (sp->components) {
|
||||
int k;
|
||||
for (k = 0; sp->components[k].type; ++k) {
|
||||
const struct spell_component *spc = sp->components + k;
|
||||
if (r_aura == spc->type) {
|
||||
return spc->amount * aura_multiplier(caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
aura *= (1 << count);
|
||||
return aura;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -726,17 +748,17 @@ static int spl_costtyp(const spell * sp)
|
|||
return costtyp;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* durch Komponenten und cast_level begrenzter maximal möglicher
|
||||
* Level
|
||||
/**
|
||||
* Durch Komponenten und cast_level begrenzter maximal möglicherLevel.
|
||||
*
|
||||
* Da die Funktion nicht alle Komponenten durchprobiert sondern beim
|
||||
* ersten Fehler abbricht, muss die Fehlermeldung später mit cancast()
|
||||
* generiert werden.
|
||||
* */
|
||||
int eff_spelllevel(unit * u, const spell * sp, int cast_level, int range)
|
||||
*/
|
||||
int eff_spelllevel(unit * u, unit *caster, const spell * sp, int cast_level, int range)
|
||||
{
|
||||
const resource_type *r_aura = get_resourcetype(R_AURA);
|
||||
int k, maxlevel, needplevel;
|
||||
int k, maxlevel;
|
||||
int costtyp = SPC_FIX;
|
||||
|
||||
for (k = 0; sp->components && sp->components[k].type; k++) {
|
||||
|
@ -744,17 +766,15 @@ int eff_spelllevel(unit * u, const spell * sp, int cast_level, int range)
|
|||
return 0;
|
||||
|
||||
if (sp->components[k].amount > 0) {
|
||||
/* Die Kosten für Aura sind auch von der Zahl der bereits
|
||||
* gezauberten Sprüche abhängig */
|
||||
int level_cost = sp->components[k].amount * range;
|
||||
if (sp->components[k].type == r_aura) {
|
||||
needplevel = spellcost(u, sp) * range;
|
||||
}
|
||||
else {
|
||||
needplevel = sp->components[k].amount * range;
|
||||
/* Die Kosten fuer Aura sind auch von der Zahl der bereits
|
||||
* gezauberten Sprueche abhaengig */
|
||||
level_cost *= aura_multiplier(caster);
|
||||
}
|
||||
maxlevel =
|
||||
get_pooled(u, sp->components[k].type, GET_DEFAULT,
|
||||
needplevel * cast_level) / needplevel;
|
||||
level_cost * cast_level) / level_cost;
|
||||
|
||||
/* sind die Kosten fix, so muss die Komponente nur einmal vorhanden
|
||||
* sein und der cast_level ändert sich nicht */
|
||||
|
@ -803,27 +823,20 @@ int eff_spelllevel(unit * u, const spell * sp, int cast_level, int range)
|
|||
* Je nach Kostenart werden dann die Komponenten noch mit cast_level
|
||||
* multipliziert.
|
||||
*/
|
||||
void pay_spell(unit * u, const spell * sp, int cast_level, int range)
|
||||
void pay_spell(unit * mage, const unit *caster, const spell * sp, int cast_level, int range)
|
||||
{
|
||||
const resource_type *r_aura = get_resourcetype(R_AURA);
|
||||
int k;
|
||||
int resuse;
|
||||
|
||||
assert(cast_level > 0);
|
||||
for (k = 0; sp->components && sp->components[k].type; k++) {
|
||||
if (sp->components[k].type == r_aura) {
|
||||
resuse = spellcost(u, sp) * range;
|
||||
}
|
||||
else {
|
||||
resuse = sp->components[k].amount * range;
|
||||
}
|
||||
const struct spell_component *spc = sp->components + k;
|
||||
int resuse = spellcost(caster ? caster : mage, spc) * range;
|
||||
|
||||
if (sp->components[k].cost == SPC_LINEAR
|
||||
|| sp->components[k].cost == SPC_LEVEL) {
|
||||
if (spc->cost == SPC_LINEAR || spc->cost == SPC_LEVEL) {
|
||||
resuse *= cast_level;
|
||||
}
|
||||
|
||||
use_pooled(u, sp->components[k].type, GET_DEFAULT, resuse);
|
||||
use_pooled(mage, spc->type, GET_DEFAULT, resuse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -851,9 +864,7 @@ bool knowsspell(const region * r, const unit * u, const spell * sp)
|
|||
bool
|
||||
cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
||||
{
|
||||
const resource_type *r_aura = get_resourcetype(R_AURA);
|
||||
int k;
|
||||
int itemanz;
|
||||
resource *reslist = NULL;
|
||||
|
||||
if (!knowsspell(u->region, u, sp)) {
|
||||
|
@ -869,22 +880,18 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
|||
}
|
||||
|
||||
for (k = 0; sp->components && sp->components[k].type; ++k) {
|
||||
if (sp->components[k].amount > 0) {
|
||||
const resource_type *rtype = sp->components[k].type;
|
||||
int itemhave;
|
||||
const struct spell_component *spc = sp->components + k;
|
||||
if (spc->amount > 0) {
|
||||
const resource_type *rtype = spc->type;
|
||||
int itemhave, itemanz;
|
||||
|
||||
/* Die Kosten für Aura sind auch von der Zahl der bereits
|
||||
* gezauberten Sprüche abhängig */
|
||||
if (rtype == r_aura) {
|
||||
itemanz = spellcost(u, sp) * range;
|
||||
}
|
||||
else {
|
||||
itemanz = sp->components[k].amount * range;
|
||||
}
|
||||
itemanz = spellcost(u, spc) * range;
|
||||
|
||||
/* sind die Kosten stufenabhängig, so muss itemanz noch mit dem
|
||||
* level multipliziert werden */
|
||||
switch (sp->components[k].cost) {
|
||||
switch (spc->cost) {
|
||||
case SPC_LEVEL:
|
||||
case SPC_LINEAR:
|
||||
itemanz *= level;
|
||||
|
@ -1276,11 +1283,11 @@ bool fumble(region * r, unit * u, const spell * sp, int cast_grade)
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Dummy-Zauberpatzer, Platzhalter für speziel auf die Sprüche
|
||||
/* Dummy-Zauberpatzer, Platzhalter für speziell auf die Sprüche
|
||||
* zugeschnittene Patzer */
|
||||
static void fumble_default(castorder * co)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
|
||||
cmistake(mage, co->order, 180, MSG_MAGIC);
|
||||
|
||||
|
@ -1295,7 +1302,8 @@ static void do_fumble(castorder * co)
|
|||
{
|
||||
curse *c;
|
||||
region *r = co_get_region(co);
|
||||
unit *u = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
unit *caster = co_get_caster(co);
|
||||
const spell *sp = co->sp;
|
||||
int level = co->level;
|
||||
int duration;
|
||||
|
@ -1304,8 +1312,8 @@ static void do_fumble(castorder * co)
|
|||
static int rc_cache;
|
||||
fumble_f fun;
|
||||
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_message("patzer", "unit region spell", u, r, sp));
|
||||
ADDMSG(&mage->faction->msgs,
|
||||
msg_message("patzer", "unit region spell", mage, r, sp));
|
||||
switch (rng_int() % 10) {
|
||||
case 0:
|
||||
/* wenn vorhanden spezieller Patzer, ansonsten nix */
|
||||
|
@ -1325,22 +1333,22 @@ static void do_fumble(castorder * co)
|
|||
* The list of things to happen are attached to a timeout
|
||||
* trigger and that's added to the triggerlit of the mage gone toad.
|
||||
*/
|
||||
trigger *trestore = trigger_changerace(u, u_race(u), u->irace);
|
||||
trigger *trestore = trigger_changerace(mage, u_race(mage), mage->irace);
|
||||
if (chance(0.7)) {
|
||||
const resource_type *rtype = rt_find("toadslime");
|
||||
if (rtype) {
|
||||
t_add(&trestore, trigger_giveitem(u, rtype->itype, 1));
|
||||
t_add(&trestore, trigger_giveitem(mage, rtype->itype, 1));
|
||||
}
|
||||
}
|
||||
duration = rng_int() % level / 2;
|
||||
if (duration < 2) duration = 2;
|
||||
add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore));
|
||||
add_trigger(&mage->attribs, "timer", trigger_timeout(duration, trestore));
|
||||
if (rc_changed(&rc_cache)) {
|
||||
rc_toad = get_race(RC_TOAD);
|
||||
}
|
||||
u_setrace(u, rc_toad);
|
||||
u->irace = NULL;
|
||||
ADDMSG(&r->msgs, msg_message("patzer6", "unit region spell", u, r, sp));
|
||||
u_setrace(mage, rc_toad);
|
||||
mage->irace = NULL;
|
||||
ADDMSG(&r->msgs, msg_message("patzer6", "unit region spell", mage, r, sp));
|
||||
break;
|
||||
}
|
||||
/* fall-through is intentional! */
|
||||
|
@ -1350,26 +1358,26 @@ static void do_fumble(castorder * co)
|
|||
duration = rng_int() % level / 2;
|
||||
if (duration < 2) duration = 2;
|
||||
effect = level / -2.0;
|
||||
c = create_curse(u, &u->attribs, &ct_skillmod, level,
|
||||
c = create_curse(mage, &mage->attribs, &ct_skillmod, level,
|
||||
duration, effect, 1);
|
||||
c->data.i = SK_MAGIC;
|
||||
ADDMSG(&u->faction->msgs, msg_message("patzer2", "unit region", u, r));
|
||||
ADDMSG(&mage->faction->msgs, msg_message("patzer2", "unit region", mage, r));
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
/* Spruch schlägt fehl, alle Magiepunkte weg */
|
||||
set_spellpoints(u, 0);
|
||||
ADDMSG(&u->faction->msgs, msg_message("patzer3", "unit region spell",
|
||||
u, r, sp));
|
||||
set_spellpoints(mage, 0);
|
||||
ADDMSG(&mage->faction->msgs, msg_message("patzer3", "unit region spell",
|
||||
mage, r, sp));
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
/* Spruch gelingt, aber alle Magiepunkte weg */
|
||||
co->level = cast_spell(co);
|
||||
set_spellpoints(u, 0);
|
||||
ADDMSG(&u->faction->msgs, msg_message("patzer4", "unit region spell",
|
||||
u, r, sp));
|
||||
set_spellpoints(mage, 0);
|
||||
ADDMSG(&mage->faction->msgs, msg_message("patzer4", "unit region spell",
|
||||
mage, r, sp));
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
@ -1378,9 +1386,9 @@ static void do_fumble(castorder * co)
|
|||
default:
|
||||
/* Spruch gelingt, alle nachfolgenden Sprüche werden 2^4 so teuer */
|
||||
co->level = cast_spell(co);
|
||||
ADDMSG(&u->faction->msgs, msg_message("patzer5", "unit region spell",
|
||||
u, r, sp));
|
||||
countspells(u, 3);
|
||||
ADDMSG(&mage->faction->msgs, msg_message("patzer5", "unit region spell",
|
||||
mage, r, sp));
|
||||
countspells(caster, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1591,7 +1599,7 @@ verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj,
|
|||
static void
|
||||
verify_targets(castorder * co, int *invalid, int *resist, int *success)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
const spell *sp = co->sp;
|
||||
region *target_r = co_get_region(co);
|
||||
spellparameter *sa = co->par;
|
||||
|
@ -2038,6 +2046,10 @@ struct unit * co_get_caster(const struct castorder * co) {
|
|||
return co->_familiar ? co->_familiar : co->magician.u;
|
||||
}
|
||||
|
||||
struct unit * co_get_magician(const struct castorder * co) {
|
||||
return co->magician.u;
|
||||
}
|
||||
|
||||
struct region * co_get_region(const struct castorder * co) {
|
||||
return co->_rtarget;
|
||||
}
|
||||
|
@ -2432,7 +2444,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
spell *sp = 0;
|
||||
plane *pl;
|
||||
spellparameter *args = NULL;
|
||||
unit * caster = u;
|
||||
unit * mage = u;
|
||||
param_t param;
|
||||
|
||||
if (LongHunger(u)) {
|
||||
|
@ -2502,15 +2514,15 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
* können. unit_getspell findet aber nur jene Sprüche, die
|
||||
* die Einheit beherrscht. */
|
||||
if (!sp && is_familiar(u)) {
|
||||
caster = get_familiar_mage(u);
|
||||
if (caster) {
|
||||
mage = get_familiar_mage(u);
|
||||
if (mage) {
|
||||
familiar = u;
|
||||
sp = unit_getspell(caster, s, caster->faction->locale);
|
||||
sp = unit_getspell(mage, s, mage->faction->locale);
|
||||
}
|
||||
else {
|
||||
/* somehow, this familiar has no mage! */
|
||||
log_error("cast_cmd: familiar %s is without a mage?\n", unitname(u));
|
||||
caster = u;
|
||||
mage = u;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2597,24 +2609,22 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
cmistake(u, ord, 177, MSG_MAGIC);
|
||||
return 0;
|
||||
}
|
||||
if (caster != familiar) { /* Magier zaubert durch Vertrauten */
|
||||
if (mage != familiar) { /* Magier zaubert durch Vertrauten */
|
||||
int sk;
|
||||
if (range > 1) { /* Fehler! Versucht zu Farcasten */
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "familiar_farcast",
|
||||
"mage", caster));
|
||||
"mage", mage));
|
||||
return 0;
|
||||
}
|
||||
sk = effskill(caster, SK_MAGIC, 0);
|
||||
if (distance(caster->region, r) > sk) {
|
||||
sk = effskill(mage, SK_MAGIC, 0);
|
||||
if (distance(mage->region, r) > sk) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "familiar_toofar",
|
||||
"mage", caster));
|
||||
"mage", mage));
|
||||
return 0;
|
||||
}
|
||||
/* mage auf magier setzen, level anpassen, range für Erhöhung
|
||||
* der Spruchkosten nutzen, langen Befehl des Magiers
|
||||
* löschen, zaubern kann er noch */
|
||||
* der Spruchkosten nutzen */
|
||||
range *= 2;
|
||||
set_order(&caster->thisorder, NULL);
|
||||
sk /= 2;
|
||||
if (level > sk) level = sk;
|
||||
}
|
||||
|
@ -2635,7 +2645,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
unitname(u), MAX_PARAMETERS, sp->sname);
|
||||
}
|
||||
args =
|
||||
add_spellparameter(target_r, caster, sp->parameter,
|
||||
add_spellparameter(target_r, mage, sp->parameter,
|
||||
(const char *const *)params, p, ord);
|
||||
for (i = 0; i != p; ++i) {
|
||||
free(params[i]);
|
||||
|
@ -2645,7 +2655,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
return create_castorder(0, caster, familiar, sp, target_r, level, 0, range, ord,
|
||||
return create_castorder(0, mage, familiar, sp, target_r, level, 0, range, ord,
|
||||
args);
|
||||
}
|
||||
|
||||
|
@ -2718,16 +2728,17 @@ void magic(void)
|
|||
order *ord = co->order;
|
||||
int invalid, resist, success, cast_level = co->level;
|
||||
bool fumbled = false;
|
||||
unit *u = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
unit *caster = co_get_caster(co);
|
||||
const spell *sp = co->sp;
|
||||
region *target_r = co_get_region(co);
|
||||
|
||||
/* reichen die Komponenten nicht, wird der Level reduziert. */
|
||||
co->level = eff_spelllevel(u, sp, cast_level, co->distance);
|
||||
co->level = eff_spelllevel(mage, caster, sp, cast_level, co->distance);
|
||||
|
||||
if (co->level < 1) {
|
||||
/* Fehlermeldung mit Komponenten generieren */
|
||||
cancast(u, sp, cast_level, co->distance, ord);
|
||||
cancast(mage, sp, cast_level, co->distance, ord);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2735,24 +2746,24 @@ void magic(void)
|
|||
/* Sprüche mit Fixkosten werden immer auf Stufe des Spruchs
|
||||
* gezaubert, co->level ist aber defaultmäßig Stufe des Magiers */
|
||||
if (spl_costtyp(sp) != SPC_FIX) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("missing_components",
|
||||
"unit spell level", u, sp, cast_level));
|
||||
ADDMSG(&mage->faction->msgs, msg_message("missing_components",
|
||||
"unit spell level", mage, sp, cast_level));
|
||||
}
|
||||
}
|
||||
|
||||
/* Prüfen, ob die realen Kosten für die gewünschten Stufe bezahlt
|
||||
* werden können */
|
||||
if (!cancast(u, sp, co->level, co->distance, ord)) {
|
||||
if (!cancast(mage, sp, co->level, co->distance, ord)) {
|
||||
/* die Fehlermeldung wird in cancast generiert */
|
||||
continue;
|
||||
}
|
||||
|
||||
co->force = MagicPower(spellpower(target_r, u, sp, co->level, ord));
|
||||
co->force = MagicPower(spellpower(target_r, mage, sp, co->level, ord));
|
||||
/* die Stärke kann durch Antimagie auf 0 sinken */
|
||||
if (co->force <= 0) {
|
||||
co->force = 0;
|
||||
ADDMSG(&u->faction->msgs, msg_message("missing_force",
|
||||
"unit spell level", u, sp, co->level));
|
||||
ADDMSG(&mage->faction->msgs, msg_message("missing_force",
|
||||
"unit spell level", mage, sp, co->level));
|
||||
}
|
||||
|
||||
/* Ziele auf Existenz prüfen und Magieresistenz feststellen. Wurde
|
||||
|
@ -2772,15 +2783,15 @@ void magic(void)
|
|||
co->force = 0;
|
||||
/* zwar wurde mindestens ein Ziel gefunden, das widerstand
|
||||
* jedoch dem Zauber. Kosten abziehen und abbrechen. */
|
||||
ADDMSG(&u->faction->msgs, msg_message("spell_resist",
|
||||
"unit region spell", u, r, sp));
|
||||
ADDMSG(&mage->faction->msgs, msg_message("spell_resist",
|
||||
"unit region spell", mage, r, sp));
|
||||
}
|
||||
}
|
||||
|
||||
/* Auch für Patzer gibt es Erfahrung, müssen die Spruchkosten
|
||||
* bezahlt werden und die nachfolgenden Sprüche werden teurer */
|
||||
if (co->force > 0) {
|
||||
if (fumble(target_r, u, sp, co->level)) {
|
||||
if (fumble(target_r, mage, sp, co->level)) {
|
||||
/* zuerst bezahlen, dann evt in do_fumble alle Aura verlieren */
|
||||
fumbled = true;
|
||||
}
|
||||
|
@ -2794,12 +2805,12 @@ void magic(void)
|
|||
}
|
||||
/* erst bezahlen, dann Kostenzähler erhöhen */
|
||||
if (co->level > 0) {
|
||||
pay_spell(u, sp, co->level, co->distance);
|
||||
pay_spell(mage, caster, sp, co->level, co->distance);
|
||||
}
|
||||
if (fumbled) {
|
||||
do_fumble(co);
|
||||
}
|
||||
countspells(u, 1);
|
||||
countspells(caster, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2807,9 +2818,9 @@ void magic(void)
|
|||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (is_mage(u) && countspells(u, 0) > 0) {
|
||||
if (is_mage(u) && spellcount(u) > 0) {
|
||||
produceexp(u, SK_MAGIC, u->number);
|
||||
/* Spruchlistenaktualiesierung ist in Regeneration */
|
||||
/* Spruchlistenaktualisierung ist in Regeneration */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2859,32 +2870,21 @@ static void select_spellbook(void **tokens, spellbook *sb, const struct locale *
|
|||
|
||||
spell *unit_getspell(struct unit *u, const char *name, const struct locale * lang)
|
||||
{
|
||||
void * tokens = 0;
|
||||
spellbook *sb;
|
||||
|
||||
sb = unit_get_spellbook(u);
|
||||
if (sb) {
|
||||
void * tokens = 0;
|
||||
select_spellbook(&tokens, sb, lang);
|
||||
}
|
||||
#if 0 /* TODO: some familiars can cast spells from the mage's spellbook? */
|
||||
u = get_familiar_mage(u);
|
||||
if (u) {
|
||||
sb = unit_get_spellbook(u);
|
||||
if (sb) {
|
||||
select_spellbook(&tokens, sb, lang);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tokens) {
|
||||
variant token;
|
||||
if (findtoken(tokens, name, &token) != E_TOK_NOMATCH) {
|
||||
if (tokens) {
|
||||
variant token;
|
||||
if (findtoken(tokens, name, &token) != E_TOK_NOMATCH) {
|
||||
freetokens(tokens);
|
||||
return (spell *)token.v;
|
||||
}
|
||||
freetokens(tokens);
|
||||
return (spell *)token.v;
|
||||
}
|
||||
freetokens(tokens);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
11
src/magic.h
11
src/magic.h
|
@ -140,6 +140,7 @@ extern "C" {
|
|||
} castorder;
|
||||
|
||||
struct unit * co_get_caster(const struct castorder * co);
|
||||
struct unit * co_get_magician(const struct castorder * co);
|
||||
struct region * co_get_region(const struct castorder * co);
|
||||
|
||||
typedef struct spell_component {
|
||||
|
@ -288,9 +289,11 @@ extern "C" {
|
|||
|
||||
/* Prüfroutinen für Zaubern */
|
||||
int countspells(struct unit *u, int step);
|
||||
int spellcount(const struct unit *u);
|
||||
/* erhöht den Counter für Zaubersprüche um 'step' und gibt die neue
|
||||
* Anzahl der gezauberten Sprüche zurück. */
|
||||
int spellcost(struct unit *u, const struct spell * sp);
|
||||
int auracost(const struct unit *caster, const struct spell *sp);
|
||||
int spellcost(const struct unit *caster, const struct spell_component *spc);
|
||||
/* gibt die für diesen Spruch derzeit notwendigen Magiepunkte auf der
|
||||
* geringstmöglichen Stufe zurück, schon um den Faktor der bereits
|
||||
* zuvor gezauberten Sprüche erhöht */
|
||||
|
@ -298,12 +301,12 @@ extern "C" {
|
|||
int distance, struct order *ord);
|
||||
/* true, wenn Einheit alle Komponenten des Zaubers (incl. MP) für die
|
||||
* geringstmögliche Stufe hat und den Spruch beherrscht */
|
||||
void pay_spell(struct unit *u, const struct spell * sp, int eff_stufe, int distance);
|
||||
void pay_spell(struct unit *mage, const struct unit *caster, const struct spell * sp, int eff_stufe, int distance);
|
||||
/* zieht die Komponenten des Zaubers aus dem Inventory der Einheit
|
||||
* ab. Die effektive Stufe des gezauberten Spruchs ist wichtig für
|
||||
* die korrekte Bestimmung der Magiepunktkosten */
|
||||
int eff_spelllevel(struct unit *u, const struct spell * sp, int cast_level,
|
||||
int distance);
|
||||
int eff_spelllevel(struct unit *mage, struct unit *caster,
|
||||
const struct spell * sp, int cast_level, int distance);
|
||||
/* ermittelt die effektive Stufe des Zaubers. Dabei ist cast_level
|
||||
* die gewünschte maximale Stufe (im Normalfall Stufe des Magiers,
|
||||
* bei Farcasting Stufe*2^Entfernung) */
|
||||
|
|
|
@ -123,9 +123,9 @@ void test_pay_spell(CuTest * tc)
|
|||
change_resource(u, get_resourcetype(R_AURA), 3);
|
||||
change_resource(u, get_resourcetype(R_HORSE), 3);
|
||||
|
||||
level = eff_spelllevel(u, sp, 3, 1);
|
||||
level = eff_spelllevel(u, u, sp, 3, 1);
|
||||
CuAssertIntEquals(tc, 3, level);
|
||||
pay_spell(u, sp, level, 1);
|
||||
pay_spell(u, NULL, sp, level, 1);
|
||||
CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_SILVER)));
|
||||
CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_AURA)));
|
||||
CuAssertIntEquals(tc, 0, get_resource(u, get_resourcetype(R_HORSE)));
|
||||
|
@ -157,16 +157,16 @@ void test_pay_spell_failure(CuTest * tc)
|
|||
CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_AURA), 2));
|
||||
CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_HORSE), 3));
|
||||
|
||||
level = eff_spelllevel(u, sp, 3, 1);
|
||||
level = eff_spelllevel(u, u, sp, 3, 1);
|
||||
CuAssertIntEquals(tc, 2, level);
|
||||
pay_spell(u, sp, level, 1);
|
||||
pay_spell(u, NULL, sp, level, 1);
|
||||
CuAssertIntEquals(tc, 1, change_resource(u, get_resourcetype(R_SILVER), 1));
|
||||
CuAssertIntEquals(tc, 3, change_resource(u, get_resourcetype(R_AURA), 3));
|
||||
CuAssertIntEquals(tc, 2, change_resource(u, get_resourcetype(R_HORSE), 1));
|
||||
|
||||
CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 3, 1));
|
||||
CuAssertIntEquals(tc, 0, eff_spelllevel(u, u, sp, 3, 1));
|
||||
CuAssertIntEquals(tc, 0, change_resource(u, get_resourcetype(R_SILVER), -1));
|
||||
CuAssertIntEquals(tc, 0, eff_spelllevel(u, sp, 2, 1));
|
||||
CuAssertIntEquals(tc, 0, eff_spelllevel(u, u, sp, 2, 1));
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
|
|
188
src/spells.c
188
src/spells.c
|
@ -534,7 +534,7 @@ static unit * make_familiar(unit * mage, region *r, const race *rc, const char *
|
|||
static int sp_summon_familiar(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
const race *rc;
|
||||
message *msg;
|
||||
|
@ -600,7 +600,7 @@ static int sp_summon_familiar(castorder * co)
|
|||
* */
|
||||
static int sp_destroy_magic(castorder * co)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -692,7 +692,7 @@ static int sp_destroy_magic(castorder * co)
|
|||
static int sp_transferaura(castorder * co)
|
||||
{
|
||||
int aura, gain, multi = 2;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
unit *u;
|
||||
|
@ -768,7 +768,7 @@ static int sp_transferaura(castorder * co)
|
|||
static int sp_goodwinds(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
int duration = cast_level + 1;
|
||||
|
@ -824,7 +824,7 @@ static int sp_goodwinds(castorder * co)
|
|||
static int sp_magicstreet(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
|
||||
if (!fval(r->terrain, LAND_REGION)) {
|
||||
cmistake(mage, co->order, 186, MSG_MAGIC);
|
||||
|
@ -865,7 +865,7 @@ static int sp_magicstreet(castorder * co)
|
|||
static int sp_summonent(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
unit *u;
|
||||
|
@ -921,7 +921,7 @@ static int sp_blessstonecircle(castorder * co)
|
|||
{
|
||||
building *b;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *p = co->par;
|
||||
message *msg;
|
||||
|
@ -970,7 +970,7 @@ static int sp_blessstonecircle(castorder * co)
|
|||
static int sp_maelstrom(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
curse *c;
|
||||
int duration = (int)co->force + 1;
|
||||
|
@ -1013,7 +1013,7 @@ static int sp_mallorn(castorder * co)
|
|||
{
|
||||
region *r = co_get_region(co);
|
||||
int cast_level = co->level;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
|
||||
if (!fval(r->terrain, LAND_REGION)) {
|
||||
cmistake(mage, co->order, 186, MSG_MAGIC);
|
||||
|
@ -1057,7 +1057,7 @@ static int sp_mallorn(castorder * co)
|
|||
static int sp_blessedharvest(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
int duration = (int)co->force + 1;
|
||||
/* Attribut auf Region.
|
||||
|
@ -1094,7 +1094,7 @@ static int sp_hain(castorder * co)
|
|||
{
|
||||
int trees;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
|
||||
|
@ -1140,7 +1140,7 @@ static int sp_mallornhain(castorder * co)
|
|||
{
|
||||
int trees;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ static void fumble_ents(const castorder * co)
|
|||
int ents;
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
/* int cast_level = co->level; */
|
||||
double force = co->force;
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ static int sp_rosthauch(castorder * co)
|
|||
int n;
|
||||
int success = 0;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
int force = (int)co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -1338,7 +1338,7 @@ static int sp_kaelteschutz(castorder * co)
|
|||
int n, i = 0;
|
||||
int men;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
double effect;
|
||||
|
@ -1402,7 +1402,7 @@ static int sp_kaelteschutz(castorder * co)
|
|||
static int sp_sparkle(castorder * co)
|
||||
{
|
||||
unit *u;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
int duration = cast_level + 1;
|
||||
|
@ -1464,7 +1464,7 @@ static int sp_create_irongolem(castorder * co)
|
|||
unit *u2;
|
||||
attrib *a;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int number = lovar(force * 8 * RESOURCE_QUANTITY);
|
||||
|
@ -1534,7 +1534,7 @@ static int sp_create_stonegolem(castorder * co)
|
|||
unit *u2;
|
||||
attrib *a;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
int number = lovar(co->force * 5 * RESOURCE_QUANTITY);
|
||||
static int cache;
|
||||
|
@ -1602,7 +1602,7 @@ static int sp_great_drought(castorder * co)
|
|||
unit *u;
|
||||
bool terraform = false;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = 2;
|
||||
|
@ -1729,7 +1729,7 @@ static int sp_great_drought(castorder * co)
|
|||
static int sp_treewalkenter(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
spellparameter *pa = co->par;
|
||||
double power = co->force;
|
||||
int cast_level = co->level;
|
||||
|
@ -1855,7 +1855,7 @@ static int sp_treewalkexit(castorder * co)
|
|||
int n;
|
||||
int erfolg = 0;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
|
@ -1991,7 +1991,7 @@ static int sp_treewalkexit(castorder * co)
|
|||
static int sp_holyground(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
message *msg = msg_message("sp_holyground_effect", "mage region", mage, r);
|
||||
|
@ -2023,7 +2023,7 @@ static int sp_homestone(castorder * co)
|
|||
unit *u;
|
||||
curse *c;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
double effect;
|
||||
|
@ -2081,7 +2081,7 @@ static int sp_drought(castorder * co)
|
|||
{
|
||||
curse *c;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
int duration = (int)power + 1;
|
||||
|
@ -2144,7 +2144,7 @@ static int sp_ironkeeper(castorder * co)
|
|||
{
|
||||
unit *keeper;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
|
||||
|
@ -2203,7 +2203,7 @@ static int sp_stormwinds(castorder * co)
|
|||
unit *u;
|
||||
int erfolg = 0;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
int n, force = (int)power;
|
||||
|
@ -2290,7 +2290,7 @@ static int sp_stormwinds(castorder * co)
|
|||
static int sp_earthquake(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
building **blist = &r->buildings;
|
||||
|
@ -2330,7 +2330,7 @@ void patzer_peasantmob(const castorder * co)
|
|||
unit *u;
|
||||
attrib *a;
|
||||
region *r;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
|
||||
r = mage->region->land ? mage->region : co_get_region(co);
|
||||
|
||||
|
@ -2396,7 +2396,7 @@ static int sp_forest_fire(castorder * co)
|
|||
region *nr;
|
||||
direction_t i;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double probability;
|
||||
double percentage = (rng_int() % 8 + 1) * 0.1; /* 10 - 80% */
|
||||
|
@ -2480,7 +2480,7 @@ static int sp_fumblecurse(castorder * co)
|
|||
{
|
||||
unit *target;
|
||||
int duration;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
double effect;
|
||||
|
@ -2516,7 +2516,7 @@ static int sp_fumblecurse(castorder * co)
|
|||
|
||||
void patzer_fumblecurse(const castorder * co)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (cast_level / 2) + 1;
|
||||
|
@ -2554,7 +2554,7 @@ void patzer_fumblecurse(const castorder * co)
|
|||
static int sp_summondragon(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
unit *u;
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
|
@ -2627,7 +2627,7 @@ static int sp_firewall(castorder * co)
|
|||
connection *b;
|
||||
wall_data *fd;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -2718,7 +2718,7 @@ static const race *unholy_race(const race *rc) {
|
|||
static int sp_unholypower(castorder * co)
|
||||
{
|
||||
region * r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
int i;
|
||||
|
@ -2900,7 +2900,7 @@ static int dc_read_compat(variant *var, void *target, gamedata *data)
|
|||
static int sp_deathcloud(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
attrib *a = r->attribs;
|
||||
unit *u;
|
||||
|
||||
|
@ -2940,7 +2940,7 @@ static int sp_deathcloud(castorder * co)
|
|||
|
||||
static void patzer_deathcloud(const castorder * co)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int hp = (mage->hp - 2);
|
||||
|
||||
change_hitpoints(mage, -(rng_int() % hp));
|
||||
|
@ -2964,7 +2964,7 @@ static void patzer_deathcloud(const castorder * co)
|
|||
static int sp_plague(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
|
||||
plagues(r);
|
||||
|
@ -2993,7 +2993,7 @@ static int sp_plague(castorder * co)
|
|||
static int sp_summonshadow(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
unit *u;
|
||||
|
@ -3034,7 +3034,7 @@ static int sp_summonshadowlords(castorder * co)
|
|||
{
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int amount = (int)(force * force);
|
||||
|
@ -3067,7 +3067,7 @@ static int sp_chaossuction(castorder * co)
|
|||
{
|
||||
region *rt;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
|
||||
if (rplane(r)) {
|
||||
|
@ -3123,7 +3123,7 @@ static int sp_chaossuction(castorder * co)
|
|||
static int sp_magicboost(castorder * co)
|
||||
{
|
||||
curse *c;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
double effect;
|
||||
|
@ -3172,7 +3172,7 @@ static int sp_magicboost(castorder * co)
|
|||
*/
|
||||
static int sp_bloodsacrifice(castorder * co)
|
||||
{
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
int aura;
|
||||
int skill = effskill(mage, SK_MAGIC, 0);
|
||||
|
@ -3249,7 +3249,7 @@ static int sp_summonundead(castorder * co)
|
|||
int undead, dc;
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
int force = (int)(co->force * 10);
|
||||
const race *race = get_race(RC_SKELETON);
|
||||
|
@ -3306,7 +3306,7 @@ static int sp_auraleak(castorder * co)
|
|||
double lost;
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
|
||||
|
@ -3349,7 +3349,7 @@ static int sp_analysesong_obj(castorder * co)
|
|||
{
|
||||
int obj;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -3398,7 +3398,7 @@ static int sp_analysesong_obj(castorder * co)
|
|||
static int sp_analysesong_unit(castorder * co)
|
||||
{
|
||||
unit *u;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -3483,7 +3483,7 @@ static int sp_charmingsong(castorder * co)
|
|||
unit *target;
|
||||
int duration;
|
||||
skill_t i;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -3572,7 +3572,7 @@ static int sp_charmingsong(castorder * co)
|
|||
static int sp_song_resistmagic(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -3601,7 +3601,7 @@ static int sp_song_resistmagic(castorder * co)
|
|||
static int sp_song_susceptmagic(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -3630,7 +3630,7 @@ static int sp_rallypeasantmob(castorder * co)
|
|||
unit *u, *un;
|
||||
int erfolg = 0;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
curse *c;
|
||||
|
@ -3683,7 +3683,7 @@ static int sp_raisepeasantmob(castorder * co)
|
|||
int n;
|
||||
int anteil;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int rp, cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -3739,7 +3739,7 @@ static int sp_migranten(castorder * co)
|
|||
{
|
||||
unit *target;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
|
||||
|
@ -3807,7 +3807,7 @@ static int sp_song_of_peace(castorder * co)
|
|||
{
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = 2 + lovar(force / 2);
|
||||
|
@ -3856,7 +3856,7 @@ static int sp_generous(castorder * co)
|
|||
{
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -3914,7 +3914,7 @@ static int sp_recruit(castorder * co)
|
|||
region *r = co_get_region(co);
|
||||
int num, maxp = rpeasants(r);
|
||||
double n;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
faction *f = mage->faction;
|
||||
|
@ -3969,7 +3969,7 @@ static int sp_bigrecruit(castorder * co)
|
|||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
int n, maxp = rpeasants(r);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
faction *f = mage->faction;
|
||||
|
@ -4024,7 +4024,7 @@ static int sp_pump(castorder * co)
|
|||
unit *u, *target;
|
||||
region *rt;
|
||||
bool see = false;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
|
||||
|
@ -4085,7 +4085,7 @@ static int sp_seduce(castorder * co)
|
|||
const resource_type *rsilver = get_resourcetype(R_SILVER);
|
||||
unit *target;
|
||||
item **itmp, *items = NULL;
|
||||
unit *u, *mage = co->magician.u;
|
||||
unit *u, *mage = co_get_magician(co);
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
|
@ -4174,7 +4174,7 @@ static int sp_calm_monster(castorder * co)
|
|||
{
|
||||
curse *c;
|
||||
unit *target;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
|
@ -4226,13 +4226,13 @@ static int sp_headache(castorder * co)
|
|||
skill *smax = NULL;
|
||||
int i;
|
||||
unit *target;
|
||||
unit *mage = co->magician.u;
|
||||
unit *caster = co_get_caster(co);
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
|
||||
/* Macht alle nachfolgenden Zauber doppelt so teuer */
|
||||
countspells(mage, 1);
|
||||
countspells(caster, 1);
|
||||
|
||||
target = pa->param[0]->data.u; /* Zieleinheit */
|
||||
|
||||
|
@ -4256,8 +4256,8 @@ static int sp_headache(castorder * co)
|
|||
}
|
||||
set_order(&target->thisorder, NULL);
|
||||
|
||||
msg = msg_message("hangover_effect_0", "mage unit", mage, target);
|
||||
r_addmessage(mage->region, mage->faction, msg);
|
||||
msg = msg_message("hangover_effect_0", "mage unit", caster, target);
|
||||
r_addmessage(caster->region, caster->faction, msg);
|
||||
msg_release(msg);
|
||||
|
||||
msg = msg_message("hangover_effect_1", "unit", target);
|
||||
|
@ -4285,7 +4285,7 @@ static int sp_raisepeasants(castorder * co)
|
|||
unit *u2;
|
||||
attrib *a;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int rp = rpeasants(r), cast_level = co->level;
|
||||
double power = co->force;
|
||||
message *msg;
|
||||
|
@ -4339,7 +4339,7 @@ static int sp_raisepeasants(castorder * co)
|
|||
static int sp_depression(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -4373,7 +4373,7 @@ static int sp_depression(castorder * co)
|
|||
int sp_puttorest(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int dead = deathcount(r);
|
||||
int laid_to_rest = dice((int)(co->force * 2), 100);
|
||||
message *seen = msg_message("puttorest", "mage", mage);
|
||||
|
@ -4405,7 +4405,7 @@ int sp_icastle(castorder * co)
|
|||
building *b;
|
||||
const building_type *type;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -4473,7 +4473,7 @@ int sp_illusionary_shapeshift(castorder * co)
|
|||
{
|
||||
unit *u;
|
||||
const race *rc;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -4530,7 +4530,7 @@ int sp_illusionary_shapeshift(castorder * co)
|
|||
int sp_analysedream(castorder * co)
|
||||
{
|
||||
unit *u;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
|
||||
|
@ -4552,7 +4552,7 @@ int sp_analysedream(castorder * co)
|
|||
static int sp_gbdreams(castorder * co, int effect)
|
||||
{
|
||||
int duration;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
region *r = co_get_region(co);
|
||||
|
@ -4624,7 +4624,7 @@ int sp_clonecopy(castorder * co)
|
|||
unit *clone;
|
||||
region *r = co_get_region(co);
|
||||
region *target_region = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *msg;
|
||||
char name[NAMESIZE];
|
||||
|
@ -4656,7 +4656,7 @@ int sp_dreamreading(castorder * co)
|
|||
{
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
double power = co->force;
|
||||
|
@ -4703,7 +4703,7 @@ int sp_dreamreading(castorder * co)
|
|||
int sp_sweetdreams(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -4753,7 +4753,7 @@ int sp_sweetdreams(castorder * co)
|
|||
int sp_disturbingdreams(castorder * co)
|
||||
{
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
int duration = 1 + (int)(power / 6);
|
||||
|
@ -4841,7 +4841,7 @@ int sp_analysemagic(castorder * co)
|
|||
int sp_itemcloak(castorder * co)
|
||||
{
|
||||
unit *target;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
|
@ -4882,7 +4882,7 @@ int sp_resist_magic_bonus(castorder * co)
|
|||
unit *u;
|
||||
int n, m;
|
||||
int duration = 6;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -4939,7 +4939,7 @@ int sp_enterastral(castorder * co)
|
|||
int remaining_cap;
|
||||
int n, w;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -5054,7 +5054,7 @@ int sp_pullastral(castorder * co)
|
|||
int remaining_cap;
|
||||
int n, w;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -5196,7 +5196,7 @@ int sp_leaveastral(castorder * co)
|
|||
int remaining_cap;
|
||||
int n, w;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -5322,7 +5322,7 @@ int sp_leaveastral(castorder * co)
|
|||
int sp_fetchastral(castorder * co)
|
||||
{
|
||||
int n;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = 0;
|
||||
spellparameter *pa = co->par;
|
||||
double power = co->force;
|
||||
|
@ -5459,7 +5459,7 @@ int sp_showastral(castorder * co)
|
|||
int c = 0;
|
||||
region_list *rl, *rl2;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
|
||||
|
@ -5545,7 +5545,7 @@ int sp_viewreality(castorder * co)
|
|||
{
|
||||
region_list *rl, *rl2;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
message *m;
|
||||
|
||||
|
@ -5582,7 +5582,7 @@ int sp_disruptastral(castorder * co)
|
|||
region *rt;
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
int duration = (int)(power / 3) + 1;
|
||||
|
@ -5689,7 +5689,7 @@ static int sp_eternizewall(castorder * co)
|
|||
curse *c;
|
||||
building *b;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -5754,7 +5754,7 @@ int sp_permtransfer(castorder * co)
|
|||
{
|
||||
int aura, i;
|
||||
unit *tu;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
const spell *sp = co->sp;
|
||||
|
@ -5779,7 +5779,7 @@ int sp_permtransfer(castorder * co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
i = get_spellpoints(mage) - spellcost(mage, sp);
|
||||
i = get_spellpoints(mage) - auracost(mage, sp);
|
||||
if (aura > i) aura = i;
|
||||
|
||||
change_maxspellpoints(mage, -aura);
|
||||
|
@ -5813,7 +5813,7 @@ int sp_movecastle(castorder * co)
|
|||
region *target_region;
|
||||
unit *u, *unext;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
message *msg;
|
||||
|
@ -5896,7 +5896,7 @@ int sp_stealaura(castorder * co)
|
|||
{
|
||||
int taura;
|
||||
unit *u;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -5966,7 +5966,7 @@ int sp_antimagiczone(castorder * co)
|
|||
double power;
|
||||
double effect;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
@ -6023,7 +6023,7 @@ int sp_antimagiczone(castorder * co)
|
|||
static int sp_magicrunes(castorder * co)
|
||||
{
|
||||
int duration;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -6083,7 +6083,7 @@ int sp_speed2(castorder * co)
|
|||
{
|
||||
int n, maxmen, used = 0, dur, men;
|
||||
unit *u;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -6143,7 +6143,7 @@ int sp_break_curse(castorder * co)
|
|||
int obj;
|
||||
curse *c;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
double force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
|
@ -6300,7 +6300,7 @@ static int sp_babbler(castorder * co)
|
|||
{
|
||||
unit *target;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
message *msg;
|
||||
|
@ -6347,7 +6347,7 @@ static int sp_babbler(castorder * co)
|
|||
static int sp_readmind(castorder * co)
|
||||
{
|
||||
unit *target;
|
||||
unit *mage = co->magician.u;
|
||||
unit *mage = co_get_magician(co);
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ int sp_flying_ship(castorder * co)
|
|||
|
||||
assert(co);
|
||||
r = co_get_region(co);
|
||||
mage = co->magician.u;
|
||||
mage = co_get_magician(co);
|
||||
cast_level = co->level;
|
||||
power = co->force;
|
||||
pa = co->par;
|
||||
|
|
Loading…
Reference in a new issue