From 2a569635dfe640e8f7981d2bd48723be72a94264 Mon Sep 17 00:00:00 2001 From: Steffen Mecke Date: Tue, 17 Nov 2015 12:06:12 +0100 Subject: [PATCH] seaserpent test --- src/monsters.test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/monsters.test.c b/src/monsters.test.c index d19633277..39a04959e 100644 --- a/src/monsters.test.c +++ b/src/monsters.test.c @@ -145,6 +145,31 @@ static void test_monsters_waiting(CuTest * tc) test_cleanup(); } +static void test_seaserpent_attack(CuTest * tc) +{ + faction *f, *f2; + region *r; + unit *u, *m; + race *rc; + + create_monsters(&f, &f2, &r, &u, &m); + r = findregion(-1, 0); + u = test_create_unit(u->faction, r); + unit_setid(u, 2); + m = test_create_unit(m->faction, r); + u_setrace(m, rc = test_create_race("seaserpent")); + assert(!m->region->land); + fset(m, UFL_MOVED); + fset(rc, RCF_ATTACK_MOVED); + + set_param(&global.parameters, "rules.monsters.attack_chance", "1"); + + plan_monsters(f2); + + CuAssertPtrNotNull(tc, find_order("ATTACKIERE 2", m)); + test_cleanup(); +} + static void test_monsters_attack_not(CuTest * tc) { faction *f, *f2; @@ -238,6 +263,7 @@ CuSuite *get_monsters_suite(void) CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_monsters_attack); SUITE_ADD_TEST(suite, test_monsters_attack_ocean); + SUITE_ADD_TEST(suite, test_seaserpent_attack); SUITE_ADD_TEST(suite, test_monsters_waiting); SUITE_ADD_TEST(suite, test_monsters_attack_not); SUITE_ADD_TEST(suite, test_dragon_attacks_the_rich);