forked from github/server
undo curse_active change
curses should survive the death of a magician. good dreams needs a magician to decide allegiance.
This commit is contained in:
parent
13f9006148
commit
335740d12b
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
- Bugfix für Schild des Fisches (Solthar)
|
- Bugfix für Schild des Fisches (Solthar)
|
||||||
- Dämonen können magisch reanimiert werden.
|
- Dämonen können magisch reanimiert werden.
|
||||||
|
- "Schöne Träume" verliert seine Wirkung, wenn der Zauberer stirbt.
|
||||||
|
|
||||||
# 3.27
|
# 3.27
|
||||||
|
|
||||||
|
|
|
@ -649,10 +649,7 @@ bool curse_active(const curse * c)
|
||||||
return false;
|
return false;
|
||||||
if (c_flags(c) & CURSE_ISNEW)
|
if (c_flags(c) & CURSE_ISNEW)
|
||||||
return false;
|
return false;
|
||||||
if (c->vigour <= 0)
|
return c->vigour > 0;
|
||||||
return false;
|
|
||||||
|
|
||||||
return c->magician && c->magician->region && (c->magician->number > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_cursed_with(const attrib * ap, const curse * c)
|
bool is_cursed_with(const attrib * ap, const curse * c)
|
||||||
|
|
|
@ -210,17 +210,8 @@ static void test_curse_active(CuTest *tc) {
|
||||||
c->mask = CURSE_ISNEW;
|
c->mask = CURSE_ISNEW;
|
||||||
CuAssertTrue(tc, !curse_active(c));
|
CuAssertTrue(tc, !curse_active(c));
|
||||||
c->mask = 0;
|
c->mask = 0;
|
||||||
|
|
||||||
u->number = 0;
|
|
||||||
CuAssertTrue(tc, !curse_active(c));
|
|
||||||
u->number = 1;
|
|
||||||
|
|
||||||
c->magician = NULL;
|
c->magician = NULL;
|
||||||
CuAssertTrue(tc, !curse_active(c));
|
CuAssertTrue(tc, curse_active(c));
|
||||||
c->magician = u;
|
|
||||||
|
|
||||||
u->region = NULL;
|
|
||||||
CuAssertTrue(tc, !curse_active(c));
|
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ static int att_modification(const unit * u, skill_t sk)
|
||||||
attrib *a = a_find(u->region->attribs, &at_curse);
|
attrib *a = a_find(u->region->attribs, &at_curse);
|
||||||
while (a && a->type == &at_curse) {
|
while (a && a->type == &at_curse) {
|
||||||
curse *c = (curse *)a->data.v;
|
curse *c = (curse *)a->data.v;
|
||||||
if (c->type == &ct_gbdream && curse_active(c)) {
|
if (c->magician && c->magician->number > 0 && c->type == &ct_gbdream && curse_active(c)) {
|
||||||
int effect = curse_geteffect_int(c);
|
int effect = curse_geteffect_int(c);
|
||||||
bool allied = alliedunit(c->magician, u->faction, HELP_GUARD);
|
bool allied = alliedunit(c->magician, u->faction, HELP_GUARD);
|
||||||
if (allied) {
|
if (allied) {
|
||||||
|
|
|
@ -649,23 +649,34 @@ static void test_get_modifier(CuTest *tc) {
|
||||||
|
|
||||||
static void test_get_modifier_cursed(CuTest *tc) {
|
static void test_get_modifier_cursed(CuTest *tc) {
|
||||||
region *r;
|
region *r;
|
||||||
unit *u;
|
unit *u, *u2, *u3;
|
||||||
|
curse *c;
|
||||||
|
|
||||||
test_setup();
|
test_setup();
|
||||||
u = test_create_unit(test_create_faction(), r = test_create_plain(0, 0));
|
u = test_create_unit(test_create_faction(), r = test_create_plain(0, 0));
|
||||||
set_level(u, SK_TAXING, 1);
|
u2 = test_create_unit(u->faction, r); /* allied */
|
||||||
|
u3 = test_create_unit(test_create_faction(), r); /* not allied */
|
||||||
|
set_level(u2, SK_TAXING, 1);
|
||||||
|
set_level(u3, SK_TAXING, 1);
|
||||||
|
|
||||||
/* default: no effects: */
|
/* default: no effects: */
|
||||||
CuAssertIntEquals(tc, 0, get_modifier(u, SK_TAXING, 1, r, true));
|
CuAssertIntEquals(tc, 0, get_modifier(u2, SK_TAXING, 1, r, true));
|
||||||
|
CuAssertIntEquals(tc, 0, get_modifier(u3, SK_TAXING, 1, r, true));
|
||||||
|
|
||||||
/* cursed with good dreams */
|
/* cursed with good dreams */
|
||||||
create_curse(u, &r->attribs, &ct_gbdream, 1, 1, 1, 0);
|
c = create_curse(u, &r->attribs, &ct_gbdream, 1, 1, 1, 0);
|
||||||
CuAssertIntEquals(tc, 1, get_modifier(u, SK_TAXING, 1, r, true));
|
CuAssertIntEquals(tc, 1, get_modifier(u2, SK_TAXING, 1, r, true));
|
||||||
a_removeall(&r->attribs, NULL);
|
CuAssertIntEquals(tc, 0, get_modifier(u3, SK_TAXING, 1, r, true));
|
||||||
|
|
||||||
|
/* cursed with good dreams, but magician just died */
|
||||||
|
u->number = 0;
|
||||||
|
CuAssertIntEquals(tc, 0, get_modifier(u2, SK_TAXING, 1, r, true));
|
||||||
|
CuAssertIntEquals(tc, 0, get_modifier(u3, SK_TAXING, 1, r, true));
|
||||||
|
|
||||||
/* cursed with good dreams, but magician is dead */
|
/* cursed with good dreams, but magician is dead */
|
||||||
create_curse(NULL, &r->attribs, &ct_gbdream, 1, 1, 1, 0);
|
c->magician = NULL;
|
||||||
CuAssertIntEquals(tc, 0, get_modifier(u, SK_TAXING, 1, r, true));
|
CuAssertIntEquals(tc, 0, get_modifier(u2, SK_TAXING, 1, r, true));
|
||||||
|
CuAssertIntEquals(tc, 0, get_modifier(u3, SK_TAXING, 1, r, true));
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue