forked from github/server
Antimagie zeigt jetzt (hoffentlich) den korrekten Befehl an.
This commit is contained in:
parent
0f83d33024
commit
bc1f94a826
|
@ -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 */
|
if (power <= 0) { /* Effekt von Antimagie */
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
|
@ -1546,69 +1546,70 @@ do_combatmagic(battle *b, combatmagic_t was)
|
||||||
static void
|
static void
|
||||||
do_combatspell(troop at, int row)
|
do_combatspell(troop at, int row)
|
||||||
{
|
{
|
||||||
spell *sp;
|
spell *sp;
|
||||||
fighter *fi = at.fighter;
|
fighter *fi = at.fighter;
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
int level;
|
int level;
|
||||||
double power;
|
double power;
|
||||||
int fumblechance = 0;
|
int fumblechance = 0;
|
||||||
void **mg;
|
void **mg;
|
||||||
int sl;
|
int sl;
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
const struct locale * lang = mage->faction->locale;
|
const struct locale * lang = mage->faction->locale;
|
||||||
|
|
||||||
if (row>BEHIND_ROW) return;
|
if (row>BEHIND_ROW) return;
|
||||||
|
|
||||||
sp = get_combatspell(mage, 1);
|
sp = get_combatspell(mage, 1);
|
||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
fi->magic = 0; /* Hat keinen Kampfzauber, kämpft nichtmagisch weiter */
|
fi->magic = 0; /* Hat keinen Kampfzauber, kämpft nichtmagisch weiter */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
snprintf(cmd, 128, "ZAUBER %s", spell_name(sp, lang));
|
snprintf(cmd, 128, "%s \"%s\"",
|
||||||
if (cancast(mage, sp, 1, 1, cmd) == false) {
|
LOC(lang, keywords[K_CAST]), spell_name(sp, lang));
|
||||||
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
|
if (cancast(mage, sp, 1, 1, cmd) == false) {
|
||||||
return;
|
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
level = eff_spelllevel(mage, sp, fi->magic, 1);
|
level = eff_spelllevel(mage, sp, fi->magic, 1);
|
||||||
if ((sl = get_combatspelllevel(mage, 1)) > 0) level = min(level, sl);
|
if ((sl = get_combatspelllevel(mage, 1)) > 0) level = min(level, sl);
|
||||||
|
|
||||||
if (fumble(r, mage, sp, sp->level) == true) {
|
if (fumble(r, mage, sp, sp->level) == true) {
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mg = b->meffects.begin; mg != b->meffects.end; ++mg) {
|
for (mg = b->meffects.begin; mg != b->meffects.end; ++mg) {
|
||||||
meffect *mblock = *mg;
|
meffect *mblock = *mg;
|
||||||
if (mblock->typ == SHIELD_BLOCK) {
|
if (mblock->typ == SHIELD_BLOCK) {
|
||||||
if (meffect_blocked(b, mblock, fi->side) != 0) {
|
if (meffect_blocked(b, mblock, fi->side) != 0) {
|
||||||
fumblechance += mblock->duration;
|
fumblechance += mblock->duration;
|
||||||
mblock->duration -= mblock->effect;
|
mblock->duration -= mblock->effect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Antimagie die Fehlschlag erhöht */
|
/* Antimagie die Fehlschlag erhöht */
|
||||||
if (rand()%100 < fumblechance) {
|
if (rand()%100 < fumblechance) {
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
power = spellpower(r, mage, sp, level);
|
power = spellpower(r, mage, sp, level, cmd);
|
||||||
if (power <= 0) { /* Effekt von Antimagie */
|
if (power <= 0) { /* Effekt von Antimagie */
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
|
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
at.fighter->action_counter++;
|
at.fighter->action_counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -985,7 +985,7 @@ cancast(unit * u, spell * sp, int level, int range, char * cmd)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double
|
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;
|
curse * c;
|
||||||
double force = cast_level;
|
double force = cast_level;
|
||||||
|
@ -1005,7 +1005,7 @@ spellpower(region * r, unit * u, spell * sp, int cast_level)
|
||||||
if (curse_active(c)) {
|
if (curse_active(c)) {
|
||||||
force -= curse_geteffect(c);
|
force -= curse_geteffect(c);
|
||||||
curse_changevigour(&r->attribs, c, -cast_level);
|
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: */
|
/* Patzerfluch-Effekt: */
|
||||||
|
@ -1013,7 +1013,7 @@ spellpower(region * r, unit * u, spell * sp, int cast_level)
|
||||||
if (curse_active(c)) {
|
if (curse_active(c)) {
|
||||||
force -= curse_geteffect(c);
|
force -= curse_geteffect(c);
|
||||||
curse_changevigour(&u->attribs, c, -1);
|
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();
|
force = force * MagicPower();
|
||||||
|
@ -2925,7 +2925,7 @@ magic(void)
|
||||||
continue;
|
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 */
|
/* die Stärke kann durch Antimagie auf 0 sinken */
|
||||||
if (co->force <= 0) {
|
if (co->force <= 0) {
|
||||||
co->force = 0;
|
co->force = 0;
|
||||||
|
|
|
@ -311,7 +311,7 @@ int change_maxspellpoints(struct unit * u, int csp);
|
||||||
/* verändert die maximalen Magiepunkte einer Einheit */
|
/* verändert die maximalen Magiepunkte einer Einheit */
|
||||||
|
|
||||||
/* Zaubern */
|
/* 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 */
|
/* ermittelt die Stärke eines Spruchs */
|
||||||
boolean fumble (struct region *r, struct unit *u, spell *spruch, int cast_level);
|
boolean fumble (struct region *r, struct unit *u, spell *spruch, int cast_level);
|
||||||
/* true, wenn der Zauber misslingt, bei false gelingt der Zauber */
|
/* true, wenn der Zauber misslingt, bei false gelingt der Zauber */
|
||||||
|
|
Loading…
Reference in New Issue