Bug 2612 Zauberreparatur.

This commit is contained in:
Enno Rehling 2019-09-29 17:56:56 +02:00
parent a6ea80f5f8
commit 17fbd0d67d
3 changed files with 30 additions and 18 deletions

View File

@ -234,8 +234,6 @@ function test_familiar_school()
local u = unit.create(f, r)
u.magic = "draig"
u:set_skill("magic", 10)
u.aura = 200
u:add_spell("fireball")
local uf = unit.create(f, r)
uf.race = "lynx"
u.familiar = uf
@ -247,3 +245,18 @@ function test_familiar_school()
assert_equal(0, uf.aura)
assert_nil(uf.magic)
end
function test_astral_disruption()
local r = region.create(0, 0, "plain")
local r2 = r:get_astral('fog')
local f = faction.create("human")
local u = unit.create(f, r)
local uh = unit.create(get_monsters(), r2, 1, "braineater")
u.magic = "draig"
u:set_skill("magic", 100) -- level 100 should beat magic resistance
u.aura = 200
u:add_spell("astral_disruption")
u:add_order('ZAUBERE STUFE 1 "Stoere Astrale Integritaet"')
process_orders()
assert_equal(r, uh.region)
end

View File

@ -587,10 +587,10 @@ static int tolua_region_getastral(lua_State * L)
if (!rt) {
const char *tname = tolua_tostring(L, 2, NULL);
const terrain_type *terrain = get_terrain(tname ? tname : "fog");
plane *pl = get_astralplane();
rt = new_region(real2tp(r->x), real2tp(r->y), pl, 0);
if (tname) {
const terrain_type *terrain = get_terrain(tname);
if (terrain) {
terraform_region(rt, terrain);
}
}

View File

@ -5554,7 +5554,14 @@ int sp_viewreality(castorder * co)
return cast_level;
}
/* ------------------------------------------------------------- */
/**
* Zauber: Störe astrale Integrität
*
* Dieser Zauber bewirkt eine schwere Störung des Astralraums. Innerhalb eines
* astralen Radius von Stufe/5 Regionen werden alle Astralwesen, die dem Zauber
* nicht wiederstehen können, aus der astralen Ebene geschleudert. Der astrale
* Kontakt mit allen betroffenen Regionen ist für Stufe/3 Wochen gestört.
*/
int sp_disruptastral(castorder * co)
{
region_list *rl, *rl2;
@ -5584,20 +5591,20 @@ int sp_disruptastral(castorder * co)
return 0;
}
rl = list_all_in_range(rt, (short)(power / 5));
rl = list_all_in_range(rt, (int)(power / 5));
for (rl2 = rl; rl2 != NULL; rl2 = rl2->next) {
attrib *a;
double effect;
region *r2 = rl2->data;
int inhab_regions = 0;
region_list *trl = NULL;
region *rtargets[MAX_SCHEMES];
if (is_cursed(r2->attribs, &ct_astralblock))
continue;
if (r2->units != NULL) {
inhab_regions = get_astralregions(r, inhabitable, NULL);
inhab_regions = get_astralregions(r2, inhabitable, rtargets);
}
/* Nicht-Permanente Tore zerstoeren */
@ -5613,17 +5620,10 @@ int sp_disruptastral(castorder * co)
/* Einheiten auswerfen */
if (trl != NULL) {
if (inhab_regions) {
for (u = r2->units; u; u = u->next) {
region_list *trl2 = trl;
region *tr;
int c = rng_int() % inhab_regions;
/* Zufaellige Zielregion suchen */
while (c-- != 0) {
trl2 = trl2->next;
}
tr = trl2->data;
region *tr = rtargets[c];
if (!is_magic_resistant(mage, u, 0) && can_survive(u, tr)) {
message *msg = msg_message("disrupt_astral", "unit region", u, tr);
@ -5634,7 +5634,6 @@ int sp_disruptastral(castorder * co)
move_unit(u, tr, NULL);
}
}
free_regionlist(trl);
}
/* Kontakt unterbinden */