Antimagie zeigt jetzt (hoffentlich) den korrekten Befehl an.
This commit is contained in:
Enno Rehling 2004-05-21 11:49:08 +00:00
parent 0f83d33024
commit bc1f94a826
3 changed files with 62 additions and 61 deletions

View File

@ -1504,7 +1504,7 @@ do_combatmagic(battle *b, combatmagic_t was)
}
power = spellpower(r, mage, sp, level);
power = spellpower(r, mage, sp, level, cmd);
if (power <= 0) { /* Effekt von Antimagie */
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
@ -1546,69 +1546,70 @@ do_combatmagic(battle *b, combatmagic_t was)
static void
do_combatspell(troop at, int row)
{
spell *sp;
fighter *fi = at.fighter;
unit *mage = fi->unit;
battle *b = fi->side->battle;
region *r = b->region;
int level;
spell *sp;
fighter *fi = at.fighter;
unit *mage = fi->unit;
battle *b = fi->side->battle;
region *r = b->region;
int level;
double power;
int fumblechance = 0;
void **mg;
int sl;
char cmd[128];
const struct locale * lang = mage->faction->locale;
int fumblechance = 0;
void **mg;
int sl;
char cmd[128];
const struct locale * lang = mage->faction->locale;
if (row>BEHIND_ROW) return;
if (row>BEHIND_ROW) return;
sp = get_combatspell(mage, 1);
if (sp == NULL) {
fi->magic = 0; /* Hat keinen Kampfzauber, kämpft nichtmagisch weiter */
return;
}
snprintf(cmd, 128, "ZAUBER %s", spell_name(sp, lang));
if (cancast(mage, sp, 1, 1, cmd) == false) {
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
return;
}
sp = get_combatspell(mage, 1);
if (sp == NULL) {
fi->magic = 0; /* Hat keinen Kampfzauber, kämpft nichtmagisch weiter */
return;
}
snprintf(cmd, 128, "%s \"%s\"",
LOC(lang, keywords[K_CAST]), spell_name(sp, lang));
if (cancast(mage, sp, 1, 1, cmd) == false) {
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
return;
}
level = eff_spelllevel(mage, sp, fi->magic, 1);
if ((sl = get_combatspelllevel(mage, 1)) > 0) level = min(level, sl);
level = eff_spelllevel(mage, sp, fi->magic, 1);
if ((sl = get_combatspelllevel(mage, 1)) > 0) level = min(level, sl);
if (fumble(r, mage, sp, sp->level) == true) {
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
if (fumble(r, mage, sp, sp->level) == true) {
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
for (mg = b->meffects.begin; mg != b->meffects.end; ++mg) {
meffect *mblock = *mg;
if (mblock->typ == SHIELD_BLOCK) {
if (meffect_blocked(b, mblock, fi->side) != 0) {
fumblechance += mblock->duration;
mblock->duration -= mblock->effect;
}
}
}
for (mg = b->meffects.begin; mg != b->meffects.end; ++mg) {
meffect *mblock = *mg;
if (mblock->typ == SHIELD_BLOCK) {
if (meffect_blocked(b, mblock, fi->side) != 0) {
fumblechance += mblock->duration;
mblock->duration -= mblock->effect;
}
}
}
/* Antimagie die Fehlschlag erhöht */
if (rand()%100 < fumblechance) {
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
power = spellpower(r, mage, sp, level);
if (power <= 0) { /* Effekt von Antimagie */
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
/* Antimagie die Fehlschlag erhöht */
if (rand()%100 < fumblechance) {
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
power = spellpower(r, mage, sp, level, cmd);
if (power <= 0) { /* Effekt von Antimagie */
report_failed_spell(b, mage, sp);
pay_spell(mage, sp, level, 1);
return;
}
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
if (level > 0) {
pay_spell(mage, sp, level, 1);
at.fighter->action_counter++;
}
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
if (level > 0) {
pay_spell(mage, sp, level, 1);
at.fighter->action_counter++;
}
}

View File

@ -985,7 +985,7 @@ cancast(unit * u, spell * sp, int level, int range, char * cmd)
*/
double
spellpower(region * r, unit * u, spell * sp, int cast_level)
spellpower(region * r, unit * u, spell * sp, int cast_level, const char * cmd)
{
curse * c;
double force = cast_level;
@ -1005,7 +1005,7 @@ spellpower(region * r, unit * u, spell * sp, int cast_level)
if (curse_active(c)) {
force -= curse_geteffect(c);
curse_changevigour(&r->attribs, c, -cast_level);
cmistake(u, findorder(u, u->thisorder), 185, MSG_MAGIC);
cmistake(u, findorder(u, cmd), 185, MSG_MAGIC);
}
/* Patzerfluch-Effekt: */
@ -1013,7 +1013,7 @@ spellpower(region * r, unit * u, spell * sp, int cast_level)
if (curse_active(c)) {
force -= curse_geteffect(c);
curse_changevigour(&u->attribs, c, -1);
cmistake(u, findorder(u, u->thisorder), 185, MSG_MAGIC);
cmistake(u, findorder(u, cmd), 185, MSG_MAGIC);
}
force = force * MagicPower();
@ -2925,7 +2925,7 @@ magic(void)
continue;
}
co->force = spellpower(target_r, u, sp, co->level);
co->force = spellpower(target_r, u, sp, co->level, cmd);
/* die Stärke kann durch Antimagie auf 0 sinken */
if (co->force <= 0) {
co->force = 0;

View File

@ -311,7 +311,7 @@ int change_maxspellpoints(struct unit * u, int csp);
/* verändert die maximalen Magiepunkte einer Einheit */
/* Zaubern */
double spellpower(struct region *r, struct unit *u, spell *spruch, int cast_level);
extern double spellpower(struct region *r, struct unit *u, spell *spruch, int cast_level, const char * cmd);
/* ermittelt die Stärke eines Spruchs */
boolean fumble (struct region *r, struct unit *u, spell *spruch, int cast_level);
/* true, wenn der Zauber misslingt, bei false gelingt der Zauber */