forked from github/server
Merge pull request #461 from ennorehling/feature/bug-2173-easy-braineaters
easy braineaters
This commit is contained in:
commit
fda20b2fb4
14 changed files with 53 additions and 33 deletions
|
@ -88,6 +88,7 @@ set (ERESSEA_SRC
|
||||||
names.c
|
names.c
|
||||||
lighthouse.c
|
lighthouse.c
|
||||||
reports.c
|
reports.c
|
||||||
|
teleport.c
|
||||||
guard.c
|
guard.c
|
||||||
prefix.c
|
prefix.c
|
||||||
donations.c
|
donations.c
|
||||||
|
|
|
@ -45,7 +45,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
|
@ -54,6 +53,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include "creport.h"
|
#include "creport.h"
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "summary.h"
|
#include "summary.h"
|
||||||
|
#include "teleport.h"
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
#include "market.h"
|
#include "market.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
#include "reports.h"
|
#include "reports.h"
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
|
#include "teleport.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
|
@ -55,7 +56,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "listbox.h"
|
#include "listbox.h"
|
||||||
#include "wormhole.h"
|
#include "wormhole.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
#include "teleport.h"
|
||||||
|
|
||||||
#include <modules/xmas.h>
|
#include <modules/xmas.h>
|
||||||
#include <modules/gmcmd.h>
|
#include <modules/gmcmd.h>
|
||||||
|
@ -36,7 +37,6 @@
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
|
|
|
@ -50,7 +50,6 @@ ship.c
|
||||||
skills.c
|
skills.c
|
||||||
spellbook.c
|
spellbook.c
|
||||||
spell.c
|
spell.c
|
||||||
teleport.c
|
|
||||||
terrain.c
|
terrain.c
|
||||||
unit.c
|
unit.c
|
||||||
xmlreader.c
|
xmlreader.c
|
||||||
|
|
|
@ -36,6 +36,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
#include "wormhole.h"
|
#include "wormhole.h"
|
||||||
#include "prefix.h"
|
#include "prefix.h"
|
||||||
|
#include "teleport.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
#include "guard.h"
|
#include "guard.h"
|
||||||
|
|
||||||
|
@ -59,7 +60,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h> /* for volcanoes in emigration (needs a flag) */
|
#include <kernel/terrainid.h> /* for volcanoes in emigration (needs a flag) */
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
10
src/magic.c
10
src/magic.c
|
@ -41,7 +41,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/version.h>
|
#include <kernel/version.h>
|
||||||
|
@ -1127,8 +1126,13 @@ double magic_resistance(unit * target)
|
||||||
curse *c;
|
curse *c;
|
||||||
const curse_type * ct_goodresist = 0, *ct_badresist = 0;
|
const curse_type * ct_goodresist = 0, *ct_badresist = 0;
|
||||||
const resource_type *rtype;
|
const resource_type *rtype;
|
||||||
double probability = u_race(target)->magres;
|
const race *rc = u_race(target);
|
||||||
|
double probability = rc->magres;
|
||||||
|
const plane *pl = rplane(target->region);
|
||||||
|
|
||||||
|
if (rc == get_race(RC_HIRNTOETER) && !pl) {
|
||||||
|
probability /= 2;
|
||||||
|
}
|
||||||
assert(target->number > 0);
|
assert(target->number > 0);
|
||||||
/* Magier haben einen Resistenzbonus vom Magietalent * 5% */
|
/* Magier haben einen Resistenzbonus vom Magietalent * 5% */
|
||||||
probability += effskill(target, SK_MAGIC, 0) * 0.05;
|
probability += effskill(target, SK_MAGIC, 0) * 0.05;
|
||||||
|
@ -1989,7 +1993,7 @@ static spellparameter *add_spellparameter(region * target_r, unit * u,
|
||||||
case 'r':
|
case 'r':
|
||||||
/* Parameter sind zwei Regionskoordinaten */
|
/* Parameter sind zwei Regionskoordinaten */
|
||||||
/* this silly thing only works in the normal plane! */
|
/* this silly thing only works in the normal plane! */
|
||||||
j = addparam_region(param + i, &spobj, u, ord, get_normalplane());
|
j = addparam_region(param + i, &spobj, u, ord, NULL);
|
||||||
++c;
|
++c;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
|
#include "teleport.h"
|
||||||
|
|
||||||
|
#include <kernel/race.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
|
@ -402,6 +404,25 @@ void test_multi_cast(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_magic_resistance(CuTest *tc) {
|
||||||
|
unit *u;
|
||||||
|
race *rc;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
rc = test_create_race("human");
|
||||||
|
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
|
||||||
|
CuAssertDblEquals(tc, rc->magres, magic_resistance(u), 0.01);
|
||||||
|
rc->magres = 1.0;
|
||||||
|
CuAssertDblEquals_Msg(tc, "magic resistance is capped at 0.9", 0.9, magic_resistance(u), 0.01);
|
||||||
|
rc = test_create_race("braineater");
|
||||||
|
rc->magres = 1.0;
|
||||||
|
u_setrace(u, rc);
|
||||||
|
CuAssertDblEquals_Msg(tc, "brain eaters outside astral space have 50% magres", 0.5, magic_resistance(u), 0.01);
|
||||||
|
u->region->_plane = get_astralplane();
|
||||||
|
CuAssertDblEquals_Msg(tc, "brain eaters in astral space have full magres", 0.9, magic_resistance(u), 0.01);
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
CuSuite *get_magic_suite(void)
|
CuSuite *get_magic_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
@ -417,5 +438,6 @@ CuSuite *get_magic_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_set_main_combatspell);
|
SUITE_ADD_TEST(suite, test_set_main_combatspell);
|
||||||
SUITE_ADD_TEST(suite, test_set_post_combatspell);
|
SUITE_ADD_TEST(suite, test_set_post_combatspell);
|
||||||
SUITE_ADD_TEST(suite, test_hasspell);
|
SUITE_ADD_TEST(suite, test_hasspell);
|
||||||
|
SUITE_ADD_TEST(suite, test_magic_resistance);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,13 +44,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/render.h>
|
#include <kernel/render.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
#include <spells/flyingship.h>
|
#include <spells/flyingship.h>
|
||||||
|
|
||||||
|
#include "teleport.h"
|
||||||
#include "direction.h"
|
#include "direction.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
|
|
|
@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "upkeep.h"
|
#include "upkeep.h"
|
||||||
#include "vortex.h"
|
#include "vortex.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
#include "teleport.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/ally.h>
|
#include <kernel/ally.h>
|
||||||
|
@ -65,7 +66,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
struct seen_region *next;
|
struct seen_region *next;
|
||||||
struct region *r;
|
struct region *r;
|
||||||
seen_t mode;
|
seen_t mode;
|
||||||
bool disbelieves;
|
bool disbelieves; /* potion of truth */
|
||||||
} seen_region;
|
} seen_region;
|
||||||
|
|
||||||
struct seen_region **seen_init(void);
|
struct seen_region **seen_init(void);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "direction.h"
|
#include "direction.h"
|
||||||
#include "randenc.h"
|
#include "randenc.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
#include "teleport.h"
|
||||||
|
|
||||||
#include <spells/borders.h>
|
#include <spells/borders.h>
|
||||||
#include <spells/buildingcurse.h>
|
#include <spells/buildingcurse.h>
|
||||||
|
@ -49,7 +50,6 @@
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/teleport.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
@ -3146,7 +3146,7 @@ static int sp_chaossuction(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
|
|
||||||
if (getplane(r) != get_normalplane()) {
|
if (rplane(r)) {
|
||||||
/* Der Zauber funktioniert nur in der materiellen Welt. */
|
/* Der Zauber funktioniert nur in der materiellen Welt. */
|
||||||
cmistake(mage, co->order, 190, MSG_MAGIC);
|
cmistake(mage, co->order, 190, MSG_MAGIC);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5436,8 +5436,9 @@ int sp_fetchastral(castorder * co)
|
||||||
region *rt = co_get_region(co); /* region to which we are fetching */
|
region *rt = co_get_region(co); /* region to which we are fetching */
|
||||||
region *ro = NULL; /* region in which the target is */
|
region *ro = NULL; /* region in which the target is */
|
||||||
|
|
||||||
if (rplane(rt) != get_normalplane()) {
|
if (rplane(rt)) {
|
||||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "error190", ""));
|
/* Der Zauber funktioniert nur in der materiellen Welt. */
|
||||||
|
cmistake(mage, co->order, 190, MSG_MAGIC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,19 +21,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "teleport.h"
|
#include "teleport.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include "equipment.h"
|
#include <kernel/equipment.h>
|
||||||
#include "unit.h"
|
#include <kernel/unit.h>
|
||||||
#include "region.h"
|
#include <kernel/region.h>
|
||||||
#include "race.h"
|
#include <kernel/race.h>
|
||||||
#include "skill.h"
|
#include <kernel/terrain.h>
|
||||||
#include "terrain.h"
|
#include <kernel/faction.h>
|
||||||
#include "faction.h"
|
#include <kernel/plane.h>
|
||||||
#include "plane.h"
|
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
|
|
||||||
|
#include "skill.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
|
@ -96,8 +96,7 @@ region_list *astralregions(const region * r, bool(*valid) (const region *))
|
||||||
|
|
||||||
region *r_standard_to_astral(const region * r)
|
region *r_standard_to_astral(const region * r)
|
||||||
{
|
{
|
||||||
if (rplane(r) != get_normalplane())
|
assert(!rplane(r));
|
||||||
return NULL;
|
|
||||||
return tpregion(r);
|
return tpregion(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +108,9 @@ region *r_astral_to_standard(const region * r)
|
||||||
assert(is_astral(r));
|
assert(is_astral(r));
|
||||||
x = (r->x - TE_CENTER_X) * TP_DISTANCE;
|
x = (r->x - TE_CENTER_X) * TP_DISTANCE;
|
||||||
y = (r->y - TE_CENTER_Y) * TP_DISTANCE;
|
y = (r->y - TE_CENTER_Y) * TP_DISTANCE;
|
||||||
pnormalize(&x, &y, get_normalplane());
|
pnormalize(&x, &y, NULL);
|
||||||
r2 = findregion(x, y);
|
r2 = findregion(x, y);
|
||||||
if (r2 == NULL || rplane(r2) != get_normalplane())
|
if (r2 == NULL || rplane(r2))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return r2;
|
return r2;
|
||||||
|
@ -168,11 +167,6 @@ void spawn_braineaters(float chance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plane *get_normalplane(void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_astral(const region * r)
|
bool is_astral(const region * r)
|
||||||
{
|
{
|
||||||
plane *pl = get_astralplane();
|
plane *pl = get_astralplane();
|
|
@ -31,7 +31,6 @@ extern "C" {
|
||||||
extern bool inhabitable(const struct region *r);
|
extern bool inhabitable(const struct region *r);
|
||||||
extern bool is_astral(const struct region *r);
|
extern bool is_astral(const struct region *r);
|
||||||
extern struct plane *get_astralplane(void);
|
extern struct plane *get_astralplane(void);
|
||||||
extern struct plane *get_normalplane(void);
|
|
||||||
|
|
||||||
void create_teleport_plane(void);
|
void create_teleport_plane(void);
|
||||||
void set_teleport_plane_regiontypes(void);
|
void set_teleport_plane_regiontypes(void);
|
Loading…
Reference in a new issue