forked from github/server
cursed factions get to fight a wolfhowl if they attack (WIP)
This commit is contained in:
parent
89bc83c4ab
commit
dd667aa752
35
src/battle.c
35
src/battle.c
|
@ -194,6 +194,7 @@ static void message_faction(battle * b, faction * f, struct message *m)
|
|||
{
|
||||
region *r = b->region;
|
||||
|
||||
assert(f);
|
||||
if (f->battles == NULL || f->battles->r != r) {
|
||||
struct bmsg *bm = (struct bmsg *)calloc(1, sizeof(struct bmsg));
|
||||
bm->next = f->battles;
|
||||
|
@ -210,6 +211,7 @@ void message_all(battle * b, message * m)
|
|||
watcher *w;
|
||||
|
||||
for (bf = b->factions; bf; bf = bf->next) {
|
||||
assert(bf->faction);
|
||||
message_faction(b, bf->faction, m);
|
||||
}
|
||||
if (p)
|
||||
|
@ -1687,6 +1689,39 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
|
||||
memset(spellranks, 0, sizeof(spellranks));
|
||||
|
||||
#ifdef FFL_CURSED
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
fighter *fig = 0;
|
||||
if (s->bf->attacker) {
|
||||
spell *sp = find_spell("wolfhowl");
|
||||
if (sp && fval(s->faction, FFL_CURSED)) {
|
||||
int si;
|
||||
for (si = 0; s->enemies[si]; ++si) {
|
||||
side *se = s->enemies[si];
|
||||
if (se && !fval(se->faction, FFL_NPC)) {
|
||||
fighter *fi;
|
||||
for (fi = se->fighters; fi; fi = fi->next) {
|
||||
if (fi && (!fig || fig->unit->number > fi->unit->number)) {
|
||||
fig = fi;
|
||||
if (fig->unit->number == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fig && fig->unit->number == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fig) {
|
||||
co = create_castorder(0, fig->unit, 0, sp, r, 10, 10, 0, 0, 0);
|
||||
add_castorder(&spellranks[sp->rank], co);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
fighter *fig;
|
||||
for (fig = s->fighters; fig; fig = fig->next) {
|
||||
|
|
|
@ -39,6 +39,7 @@ extern "C" {
|
|||
#define FFL_ISNEW (1<<1)
|
||||
#define FFL_RESTART (1<<2)
|
||||
#define FFL_QUIT (1<<3)
|
||||
#define FFL_CURSED (1<<4) /* you're going to have a bad time */
|
||||
#define FFL_DEFENDER (1<<10)
|
||||
#define FFL_SELECT (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
|
||||
#define FFL_NOAID (1<<21) /* Hilfsflag Kampf */
|
||||
|
@ -49,8 +50,7 @@ extern "C" {
|
|||
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
||||
#define FFL_NPC (1<<25) /* eine Partei mit Monstern */
|
||||
#define FFL_DBENTRY (1<<28) /* Partei ist in Datenbank eingetragen */
|
||||
|
||||
#define FFL_SAVEMASK (FFL_DEFENDER|FFL_NEWID|FFL_NPC|FFL_DBENTRY|FFL_NOIDLEOUT)
|
||||
#define FFL_SAVEMASK (FFL_DEFENDER|FFL_NEWID|FFL_NPC|FFL_DBENTRY|FFL_NOIDLEOUT|FFL_CURSED)
|
||||
|
||||
typedef struct faction {
|
||||
struct faction *next;
|
||||
|
|
Loading…
Reference in New Issue