From bc1f94a8264389071c262f5bc4edcc82992819ed Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 21 May 2004 11:49:08 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000087 Antimagie zeigt jetzt (hoffentlich) den korrekten Befehl an. --- src/common/kernel/battle.c | 113 +++++++++++++++++++------------------ src/common/kernel/magic.c | 8 +-- src/common/kernel/magic.h | 2 +- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index f91242ab0..a12254256 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -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++; + } } diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c index 558ade48c..8debb01ed 100644 --- a/src/common/kernel/magic.c +++ b/src/common/kernel/magic.c @@ -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; diff --git a/src/common/kernel/magic.h b/src/common/kernel/magic.h index 861f7217e..3070a01de 100644 --- a/src/common/kernel/magic.h +++ b/src/common/kernel/magic.h @@ -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 */