int sp_frighten(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; int at_malus = 0; int df_malus = 0; int force = 0; int enemies = 0; int targets = 0; message *m; at_malus = level - 4; if (at_malus < 1) at_malus = 1; df_malus = 2; force = (int)get_force(power, 2); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); if (!enemies) { m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force && enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); fighter *df = dt.fighter; --enemies; if (!df) break; assert(!helping(fi->side, df->side)); if (df->person[dt.index].flags & FL_COURAGE) { df->person[dt.index].flags &= ~(FL_COURAGE); } if (!is_magic_resistant(mage, df->unit, 0)) { df->person[dt.index].attack -= at_malus; df->person[dt.index].defense -= df_malus; targets++; } --force; } m = msg_message("cast_frighten_effect", "mage spell amount", fi->unit, sp, targets); message_all(b, m); msg_release(m); return level; }
/* Feuersturm: Betrifft sehr viele Gegner (in der Regel alle), * macht nur vergleichsweise geringen Schaden */ int sp_immolation(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; troop at; int force, qi, killed = 0; const char *damage; quicklist *fgs, *ql; message *m; /* 2d4 HP */ damage = spell_damage(5); /* Betrifft alle Gegner */ force = 99999; if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) { message *m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } at.fighter = fi; at.index = 0; fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY); for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) { fighter *df = (fighter *)ql_get(ql, qi); int n = df->alive - df->removed; troop dt; dt.fighter = df; while (n != 0) { dt.index = --n; killed += terminate(dt, at, AT_COMBATSPELL, damage, false); if (--force == 0) break; } if (force == 0) break; } ql_free(fgs); m = msg_message("battle::combatspell", "mage spell killed", fi->unit, sp, killed); message_all(b, m); msg_release(m); return level; }
/* Panik (Praekampfzauber) */ int flee_spell(struct castorder * co, int strength) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; selist *fgs, *ql; int n, qi, panik = 0; message *msg; double power = co->force; int force; force = (int)get_force(power, strength); if (force<=0 || !count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) { msg = msg_message("sp_flee_effect_0", "mage spell", mage, sp); message_all(b, msg); msg_release(msg); return 0; } fgs = select_fighters(b, fi->side, FS_ENEMY, select_afraid, NULL); scramble_fighters(fgs); for (qi = 0, ql = fgs; force > 0 && ql; selist_advance(&ql, &qi, 1)) { fighter *df = (fighter *)selist_get(ql, qi); for (n = 0; force > 0 && n != df->alive; ++n) { if (df->person[n].flags & FL_PANICED) { /* bei SPL_SONG_OF_FEAR moeglich */ df->person[n].attack -= 1; --force; ++panik; } else if (!(df->person[n].flags & FL_COURAGE) || !(u_race(df->unit)->flags & RCF_UNDEAD)) { if (!is_magic_resistant(mage, df->unit, 0)) { df->person[n].flags |= FL_PANICED; ++panik; } --force; } } } selist_free(fgs); msg = msg_message("sp_flee_effect_1", "mage spell amount", mage, sp, panik); message_all(b, msg); msg_release(msg); return level; }
/* Benommenheit: eine Runde kein Angriff */ int sp_stun(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; message *m; /* Aus beiden Reihen nehmen */ int force = 0, enemies; int stunned; if (power <= 0) return 0; switch (sp->id) { case SPL_SHOCKWAVE: force = lovar(get_force(power, 1)); break; default: assert(0); } enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { message *m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } stunned = 0; while (force && stunned < enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); fighter *df = dt.fighter; unit *du = df->unit; --force; if (!is_magic_resistant(mage, du, 0)) { df->person[dt.index].flags |= FL_STUNNED; ++stunned; } } m = msg_message("cast_stun_effect", "mage spell amount", fi->unit, sp, stunned); message_all(b, m); msg_release(m); return level; }
int sp_windshield(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; int force, at_malus; int enemies; message *m; switch (sp->id) { case SPL_WINDSHIELD: force = (int)get_force(power, 4); at_malus = level / 4; break; default: force = (int)power; at_malus = 2; } enemies = count_enemies(b, fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force && enemies) { troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE); fighter *df = dt.fighter; --enemies; if (!df) break; assert(!helping(fi->side, df->side)); if (df->person[dt.index].missile) { /* this suxx... affects your melee weapon as well. */ df->person[dt.index].attack -= at_malus; --force; } } m = msg_message("cast_storm_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return level; }
int sp_dragonodem(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; troop dt; troop at; int force, enemies; const char *damage; /* 11-26 HP */ damage = spell_damage(4); /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */ force = lovar(get_force(power, 6)); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); if (!enemies) { struct message *m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } else { struct message *m; int killed = 0; at.fighter = fi; at.index = 0; while (force && killed < enemies) { dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); assert(dt.fighter); --force; killed += terminate(dt, at, AT_COMBATSPELL, damage, false); } m = msg_message("cast_combatspell", "mage spell dead", fi->unit, sp, killed); message_all(b, m); msg_release(m); } return level; }
int sp_fumbleshield(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; int effect; int duration; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); /* der erste Zauber schl�gt mit 100% fehl */ switch (sp->id) { case SPL_DRAIG_FUMBLESHIELD: case SPL_GWYRRD_FUMBLESHIELD: case SPL_CERDDOR_FUMBLESHIELD: case SPL_TYBIED_FUMBLESHIELD: duration = 100; effect = _max(1, 25 - level); break; default: duration = 100; effect = 10; } do_meffect(fi, SHIELD_BLOCK, effect, duration); return level; }
int sp_reduceshield(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; int effect; int duration; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); /* jeder Schaden wird um effect% reduziert bis der Schild duration * Trefferpunkte aufgefangen hat */ switch (sp->id) { case SPL_REDUCESHIELD: effect = 50; duration = (int)(50 * power * power); break; default: effect = level * 3; duration = (int)get_force(power, 5); } do_meffect(fi, SHIELD_REDUCE, effect, duration); return level; }
int sp_armorshield(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; int effect; int duration; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); /* gibt R�stung +effect f�r duration Treffer */ switch (sp->id) { case SPL_ARMORSHIELD: effect = level / 3; duration = (int)(20 * power * power); break; default: effect = level / 4; duration = (int)(power * power); } do_meffect(fi, SHIELD_ARMOR, effect, duration); return level; }
int sp_strong_wall(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; float power = co->force; battle *b = fi->side->battle; unit *mage = fi->unit; building *burg; float effect; static bool init = false; message *msg; static const curse_type *strongwall_ct; if (!init) { init = true; strongwall_ct = ct_find("strongwall"); } if (!mage->building) { return 0; } burg = mage->building; effect = power / 4; create_curse(mage, &burg->attribs, strongwall_ct, power, 1, effect, 0); msg = msg_message("sp_strongwalls_effect", "mage building", mage, mage->building); message_all(b, msg); msg_release(msg); return level; }
int sp_shadowcall(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; battle *b = fi->side->battle; region *r = b->region; unit *mage = fi->unit; attrib *a; int force = (int)(get_force(power, 3) / 2); unit *u; const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" }; const race *rc = rc_find(races[rng_int() % 3]); message *msg; u = create_unit(r, mage->faction, force, rc, 0, NULL, mage); setstatus(u, ST_FIGHT); set_level(u, SK_WEAPONLESS, (int)(power / 2)); set_level(u, SK_STAMINA, (int)(power / 2)); u->hp = u->number * unit_max_hp(u); a = a_new(&at_unitdissolve); a->data.ca[0] = 0; a->data.ca[1] = 100; a_add(&u->attribs, a); make_fighter(b, u, fi->side, is_attacker(fi)); msg = msg_message("sp_shadowcall_effect", "mage amount race", mage, u->number, u_race(u)); message_all(b, msg); msg_release(msg); return level; }
/* Magier weicht dem Kampf aus. Wenn er sich bewegen kann, zieht er in * eine Nachbarregion, wobei ein NACH berücksichtigt wird. Ansonsten * bleibt er stehen und nimmt nicht weiter am Kampf teil. */ int sp_denyattack(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; region *r = b->region; message *m; /* Fliehende Einheiten verlassen auf jeden Fall Gebäude und Schiffe. */ if (!fval(r->terrain, SEA_REGION)) { leave(mage, false); } /* und bewachen nicht */ setguard(mage, GUARD_NONE); /* irgendwie den langen befehl sperren */ /* fset(fi, FIG_ATTACKED); */ /* wir tun so, als wäre die Person geflohen */ fset(fi, FIG_NOLOOT); fi->run.hp = mage->hp; fi->run.number = mage->number; /* fighter leeren */ rmfighter(fi, mage->number); m = msg_message("cast_escape_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return level; }
/* Magier weicht dem Kampf aus. Wenn er sich bewegen kann, zieht er in * eine Nachbarregion, wobei ein NACH beruecksichtigt wird. Ansonsten * bleibt er stehen und nimmt nicht weiter am Kampf teil. */ int sp_appeasement(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; region *r = b->region; message *m; /* Fliehende Einheiten verlassen auf jeden Fall Gebaeude und Schiffe. */ if (!(r->terrain->flags & SEA_REGION)) { leave(mage, false); } /* und bewachen nicht */ setguard(mage, false); unit_setstatus(mage, ST_FLEE); /* wir tun so, als waere die Person geflohen */ fi->flags |= FIG_NOLOOT; fi->run.hp = mage->hp; fi->run.number = mage->number; /* fighter leeren */ rmfighter(fi, mage->number); m = msg_message("cast_escape_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return level; }
static fighter *summon_allies(const fighter *fi, const race *rc, int number) { attrib *a; unit *mage = fi->unit; side *si = fi->side; battle *b = si->battle; region *r = b->region; message *msg; unit *u = create_unit(r, mage->faction, number, rc, 0, NULL, mage); leave(u, true); unit_setstatus(u, ST_FIGHT); u->hp = u->number * unit_max_hp(u); if (mage->flags & UFL_ANON_FACTION) { u->flags |= UFL_ANON_FACTION; } a = a_new(&at_unitdissolve); a->data.ca[0] = 0; a->data.ca[1] = 100; a_add(&u->attribs, a); msg = msg_message("sp_wolfhowl_effect", "mage amount race", mage, u->number, rc); message_all(b, msg); msg_release(msg); return make_fighter(b, u, si, is_attacker(fi)); }
int sp_strong_wall(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; battle *b = fi->side->battle; unit *mage = fi->unit; building *burg; double effect; message *msg; if (!mage->building) { return 0; } burg = mage->building; effect = power / 4; create_curse(mage, &burg->attribs, &ct_strongwall, power, 1, effect, 0); msg = msg_message("sp_strongwalls_effect", "mage building", mage, mage->building); message_all(b, msg); msg_release(msg); return level; }
/* wiederbeleben */ int sp_reanimate(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; battle *b = fi->side->battle; unit *mage = fi->unit; int healable, j = 0; double c = 0.50 + 0.02 * power; double k = EFFECT_HEALING_SPELL * power; bool use_item = has_ao_healing(mage); message *msg; if (use_item) { k *= 2; c += 0.10; } healable = count_healable(b, fi); healable = (int)_min(k, healable); while (healable--) { fighter *tf = select_corpse(b, fi); if (tf != NULL && tf->side->casualties > 0 && u_race(tf->unit) != get_race(RC_DAEMON) && (chance(c))) { assert(tf->alive < tf->unit->number); /* t.fighter->person[].hp beginnt mit t.index = 0 zu z�hlen, * t.fighter->alive ist jedoch die Anzahl lebender in der Einheit, * also sind die hp von t.fighter->alive * t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote * oder weggelaufene ist t.fighter->hitpoints[tf->alive] */ tf->person[tf->alive].hp = 2; ++tf->alive; ++tf->side->size[SUM_ROW]; ++tf->side->size[tf->unit->status + 1]; ++tf->side->healed; --tf->side->casualties; assert(tf->side->casualties >= 0); --tf->side->dead; assert(tf->side->dead >= 0); ++j; } } if (j <= 0) { level = j; } if (use_item) { msg = msg_message("reanimate_effect_1", "mage amount item", mage, j, get_resourcetype(R_AMULET_OF_HEALING)); } else { msg = msg_message("reanimate_effect_0", "mage amount", mage, j); } message_all(b, msg); msg_release(msg); return level; }
int sp_drainodem(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; troop dt; troop at; int force, enemies; int drained = 0; int killed = 0; const char *damage; message *m; /* 11-26 HP */ damage = spell_damage(4); /* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */ force = lovar(get_force(power, 6)); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); if (!enemies) { m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } at.fighter = fi; at.index = 0; while (force && drained < enemies) { dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); assert(dt.fighter); if (hits(at, dt, NULL)) { drain_exp(dt.fighter->unit, 90); ++drained; killed += terminate(dt, at, AT_COMBATSPELL, damage, false); } --force; } m = msg_message("cast_drainlife_effect", "mage spell amount", fi->unit, sp, drained); message_all(b, m); msg_release(m); return level; }
int sp_berserk(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; int at_bonus = 0; int df_malus = 0; int force = 0; int allies = 0; int targets = 0; message *m; switch (sp->id) { case SPL_BERSERK: case SPL_BLOODTHIRST: at_bonus = _max(1, level / 3); df_malus = 2; force = (int)get_force(power, 2); break; default: at_bonus = 1; df_malus = 0; force = (int)power; } allies = count_allies(fi->side, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE, ALLY_ANY); /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten best�nde * die Gefahr eine Endlosschleife*/ allies *= 2; while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY); fighter *df = dt.fighter; --allies; if (df) { if (!(df->person[dt.index].flags & FL_COURAGE)) { df->person[dt.index].attack += at_bonus; df->person[dt.index].defence -= df_malus; df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE; targets++; --force; } } } m = msg_message("cast_berserk_effect", "mage spell amount", fi->unit, sp, targets); message_all(b, m); msg_release(m); return level; }
int sp_tiredsoldiers(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; int n = 0; int force = (int)(power * power * 4); message *m; if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE | SELECT_FIND)) { message *m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force) { troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); fighter *df = t.fighter; if (!df) break; assert(!helping(fi->side, df->side)); if (!(df->person[t.index].flags & FL_TIRED)) { if (!is_magic_resistant(mage, df->unit, 0)) { df->person[t.index].flags = df->person[t.index].flags | FL_TIRED; df->person[t.index].defence -= 2; ++n; } } --force; } m = msg_message("cast_tired_effect", "mage spell amount", fi->unit, sp, n); message_all(b, m); msg_release(m); return level; }
/* Versteinern */ int sp_petrify(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; /* Wirkt auf erste und zweite Reihe */ int force, enemies; int stoned = 0; message *m; force = lovar(get_force(power, 0)); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { message *m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force && stoned < enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); unit *du = dt.fighter->unit; if (!is_magic_resistant(mage, du, 0)) { /* person ans ende hinter die lebenden schieben */ remove_troop(dt); ++stoned; } --force; } m = msg_message("cast_petrify_effect", "mage spell amount", fi->unit, sp, stoned); message_all(b, m); msg_release(m); return level; }
int sp_sleep(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; unit *mage = fi->unit; unit *du; troop dt; int force, enemies; int k = 0; message *m; /* Immer aus der ersten Reihe nehmen */ force = lovar(co->force * 25); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force && enemies) { dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); assert(dt.fighter); du = dt.fighter->unit; if (!is_magic_resistant(mage, du, 0)) { dt.fighter->person[dt.index].flags |= FL_SLEEPING; ++k; --enemies; } --force; } m = msg_message("cast_sleep_effect", "mage spell amount", fi->unit, sp, k); message_all(b, m); msg_release(m); return level; }
/* Generischer Kampfzauber */ int damage_spell(struct castorder * co, int dmg, int strength) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; double power = co->force; battle *b = fi->side->battle; troop at, dt; message *m; /* Immer aus der ersten Reihe nehmen */ int enemies, killed = 0; int force = lovar(get_force(power, strength)); const char *damage = spell_damage(dmg); at.fighter = fi; at.index = 0; enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); if (enemies == 0) { m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return 0; } while (force > 0 && killed < enemies) { dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); assert(dt.fighter); --force; killed += terminate(dt, at, AT_COMBATSPELL, damage, false); } m = msg_message("cast_combatspell", "mage spell dead", fi->unit, sp, killed); message_all(b, m); msg_release(m); return level; }
int sp_reeling_arrows(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; battle *b = fi->side->battle; message *m; b->reelarrow = true; m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); return level; }
int sp_keeploot(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); b->keeploot = (int)fmax(25, b->keeploot + 5 * power); return level; }
int sp_healing(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; battle *b = fi->side->battle; unit *mage = fi->unit; int j = 0; int healhp = (int)power * 200; selist *fgs; message *msg; bool use_item = has_ao_healing(mage); /* bis zu 11 Personen pro Stufe (einen HP muessen sie ja noch * haben, sonst waeren sie tot) koennen geheilt werden */ if (use_item) { healhp *= 2; } /* gehe alle denen wir helfen der reihe nach durch, heile verwundete, * bis zu verteilende HP aufgebraucht sind */ fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_HELP); scramble_fighters(fgs); j += heal_fighters(fgs, &healhp, false); j += heal_fighters(fgs, &healhp, true); selist_free(fgs); if (j <= 0) { level = j; } if (use_item) { msg = msg_message("healing_effect_1", "mage amount item", mage, j, get_resourcetype(R_AMULET_OF_HEALING)); } else { msg = msg_message("healing_effect_0", "mage amount", mage, j); } message_all(b, msg); msg_release(msg); return level; }
/* Heldenmut */ int sp_hero(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; int df_bonus = 0; int force = 0; int allies; int targets = 0; message *m; df_bonus = (int)(power / 5); force = lovar(get_force(power, 4)); if (force < 1) force = 1; allies = count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY); /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten bestuende * die Gefahr eine Endlosschleife*/ allies *= 2; while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY); fighter *df = dt.fighter; --allies; if (df) { if (!(df->person[dt.index].flags & FL_COURAGE)) { df->person[dt.index].defense += df_bonus; df->person[dt.index].flags = df->person[dt.index].flags | FL_COURAGE; targets++; --force; } } } m = msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets); message_all(b, m); msg_release(m); return level; }
int sp_fumbleshield(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; const spell * sp = co->sp; int effect; int duration; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); /* der erste Zauber schlaegt mit 100% fehl */ duration = 100; effect = 25 - level; if (effect < 1) effect = 1; do_meffect(fi, SHIELD_BLOCK, effect, duration); return level; }
int armor_spell(struct castorder * co, int per_level, int time_multi) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; const spell * sp = co->sp; int effect; int duration; battle *b = fi->side->battle; message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); /* gibt Ruestung +effect fuer duration Treffer */ effect = level / per_level; duration = (int)(time_multi * power * power); do_meffect(fi, SHIELD_ARMOR, effect, duration); return level; }
int sp_wolfhowl(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; double power = co->force; battle *b = fi->side->battle; region *r = b->region; unit *mage = fi->unit; attrib *a; message *msg; int force = (int)(get_force(power, 3) / 2); const race * rc = new_race[RC_WOLF]; if (force>0) { unit *u = create_unit(r, mage->faction, force, rc, 0, NULL, mage); leave(u, true); setstatus(u, ST_FIGHT); set_level(u, SK_WEAPONLESS, (int)(power / 3)); set_level(u, SK_STAMINA, (int)(power / 3)); u->hp = u->number * unit_max_hp(u); if (fval(mage, UFL_ANON_FACTION)) { fset(u, UFL_ANON_FACTION); } a = a_new(&at_unitdissolve); a->data.ca[0] = 0; a->data.ca[1] = 100; a_add(&u->attribs, a); make_fighter(b, u, fi->side, is_attacker(fi)); } msg = msg_message("sp_wolfhowl_effect", "mage amount race", mage, force, rc); message_all(b, msg); msg_release(msg); return level; }
int sp_speed(struct castorder * co) { fighter * fi = co->magician.fig; double power = co->force; const spell * sp = co->sp; battle *b = fi->side->battle; int force; int allies; int targets = 0; message *m; force = lovar(power * power * 5); allies = count_allies(fi->side, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE, ALLY_ANY); /* maximal 2*allies Versuche ein Opfer zu finden, ansonsten bestuende * die Gefahr eine Endlosschleife*/ allies *= 2; while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY); fighter *df = dt.fighter; --allies; if (df) { if (df->person[dt.index].speed == 1) { df->person[dt.index].speed++; targets++; --force; } } } m = msg_message("cast_speed_effect", "mage spell amount", fi->unit, sp, targets); message_all(b, m); msg_release(m); return 1; }