forked from github/server
replace ct_find calls with constants.
reorder a lot of includes.
This commit is contained in:
parent
c99e92db20
commit
7985ebe511
|
@ -27,6 +27,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "move.h"
|
||||
#include "skill.h"
|
||||
|
||||
#include <spells/buildingcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/build.h>
|
||||
|
@ -54,9 +58,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <attributes/racename.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/moved.h>
|
||||
#include <spells/buildingcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/assert.h>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "spells/shipcurse.h"
|
||||
#include "monsters.h"
|
||||
|
||||
#include <spells/flyingship.h>
|
||||
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/race.h>
|
||||
|
@ -9,8 +11,6 @@
|
|||
#include <kernel/spellbook.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <spells/flyingship.h>
|
||||
|
||||
#include <tolua.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "reports.h"
|
||||
#include "calendar.h"
|
||||
|
||||
#include <attributes/reduceproduction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <spells/buildingcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/building.h>
|
||||
|
@ -67,10 +72,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/parser.h>
|
||||
#include <util/rng.h>
|
||||
|
||||
#include <attributes/reduceproduction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
/* libs includes */
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
@ -2655,12 +2656,9 @@ expandwork(region * r, request * work_begin, request * work_end, int maxwork)
|
|||
earnings = jobs * p_wage;
|
||||
if (r->attribs && rule_blessed_harvest() == HARVEST_TAXES) {
|
||||
/* E3 rules */
|
||||
const curse_type *blessedharvest_ct = ct_find("blessedharvest");
|
||||
if (blessedharvest_ct) {
|
||||
int happy =
|
||||
(int)(jobs * curse_geteffect(get_curse(r->attribs, blessedharvest_ct)));
|
||||
earnings += happy;
|
||||
}
|
||||
int happy =
|
||||
(int)(jobs * curse_geteffect(get_curse(r->attribs, &ct_blessedharvest)));
|
||||
earnings += happy;
|
||||
}
|
||||
rsetmoney(r, money + earnings);
|
||||
}
|
||||
|
|
17
src/items.c
17
src/items.c
|
@ -7,6 +7,12 @@
|
|||
#include "move.h"
|
||||
#include "magic.h"
|
||||
|
||||
#include <attributes/fleechance.h>
|
||||
|
||||
#include <spells/shipcurse.h>
|
||||
#include <spells/unitcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -21,9 +27,6 @@
|
|||
#include <kernel/spell.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <attributes/fleechance.h>
|
||||
#include <spells/shipcurse.h>
|
||||
|
||||
/* triggers includes */
|
||||
#include <triggers/changerace.h>
|
||||
#include <triggers/timeout.h>
|
||||
|
@ -167,7 +170,7 @@ struct order *ord)
|
|||
}
|
||||
|
||||
if (force > 0) {
|
||||
create_curse(u, &r->attribs, ct_find("antimagiczone"), force, duration,
|
||||
create_curse(u, &r->attribs, &ct_antimagiczone, force, duration,
|
||||
effect, 0);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +188,7 @@ int amount, struct order *ord)
|
|||
{
|
||||
int money;
|
||||
|
||||
if (get_curse(u->region->attribs, ct_find("depression"))) {
|
||||
if (get_curse(u->region->attribs, &ct_depression)) {
|
||||
cmistake(u, ord, 58, MSG_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
@ -194,7 +197,7 @@ int amount, struct order *ord)
|
|||
change_money(u, money);
|
||||
rsetmoney(u->region, rmoney(u->region) - money);
|
||||
|
||||
create_curse(u, &u->region->attribs, ct_find("depression"),
|
||||
create_curse(u, &u->region->attribs, &ct_depression,
|
||||
20, BAGPIPEDURATION, 0.0, 0);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("bagpipeoffear_faction",
|
||||
|
@ -354,7 +357,7 @@ use_tacticcrystal(unit * u, const struct item_type *itype, int amount,
|
|||
der vor den Antimagiezaubern passiert */
|
||||
|
||||
effect = (float)(rng_int() % 6 - 1);
|
||||
c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
|
||||
c = create_curse(u, &u->attribs, &ct_skillmod, power,
|
||||
duration, effect, u->number);
|
||||
c->data.i = SK_TACTICS;
|
||||
UNUSED_ARG(ord);
|
||||
|
|
|
@ -21,6 +21,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "building.h"
|
||||
|
||||
#include <attributes/reduceproduction.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include "curse.h"
|
||||
#include "item.h"
|
||||
|
@ -54,10 +57,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/reduceproduction.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
typedef struct building_typelist {
|
||||
struct building_typelist *next;
|
||||
building_type *type;
|
||||
|
|
|
@ -159,7 +159,7 @@ void deathcounts(region * r, int fallen)
|
|||
if (fallen == 0)
|
||||
return;
|
||||
if (r->attribs) {
|
||||
const curse_type *ctype = ct_find("holyground");
|
||||
const curse_type *ctype = &ct_holyground;
|
||||
if (ctype && curse_active(get_curse(r->attribs, ctype)))
|
||||
return;
|
||||
a = a_find(r->attribs, &at_deathcount);
|
||||
|
|
|
@ -20,6 +20,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "ship.h"
|
||||
|
||||
#include <attributes/movement.h>
|
||||
#include <spells/shipcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include "build.h"
|
||||
#include "curse.h"
|
||||
|
@ -41,9 +44,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/umlaut.h>
|
||||
#include <util/xml.h>
|
||||
|
||||
#include <attributes/movement.h>
|
||||
#include <spells/shipcurse.h>
|
||||
|
||||
#include <storage.h>
|
||||
#include <selist.h>
|
||||
#include <critbit.h>
|
||||
|
@ -335,7 +335,7 @@ int shipspeed(const ship * sh, const unit * u)
|
|||
if (curse_active(get_curse(sh->attribs, &ct_stormwind))) {
|
||||
k *= 2;
|
||||
}
|
||||
if (curse_active(get_curse(sh->attribs, ct_find("nodrift")))) {
|
||||
if (curse_active(get_curse(sh->attribs, &ct_nodrift))) {
|
||||
k += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ static void test_shipspeed_nodrift(CuTest *tc) {
|
|||
register_shipcurse();
|
||||
assert(sh && cap && crew);
|
||||
|
||||
create_curse(0, &sh->attribs, ct_find("nodrift"), 1, 1, 1, 0);
|
||||
create_curse(0, &sh->attribs, &ct_nodrift, 1, 1, 1, 0);
|
||||
CuAssertIntEquals_Msg(tc, "nodrift adds +1 to range", sh->type->range + 1, shipspeed(sh, cap));
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
|
@ -18,14 +18,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <attributes/racename.h>
|
||||
#include "terrain.h"
|
||||
#include "terrainid.h"
|
||||
|
||||
#include <attributes/racename.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include "curse.h"
|
||||
#include "region.h"
|
||||
#include "resources.h"
|
||||
#include "terrainid.h"
|
||||
|
||||
#include <util/log.h>
|
||||
#include <util/attrib.h>
|
||||
|
@ -160,7 +162,7 @@ const char *terrain_name(const struct region *r)
|
|||
return r->terrain->name(r);
|
||||
}
|
||||
else if (fval(r->terrain, SEA_REGION)) {
|
||||
if (curse_active(get_curse(r->attribs, ct_find("maelstrom")))) {
|
||||
if (curse_active(get_curse(r->attribs, &ct_maelstrom))) {
|
||||
return "maelstrom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -941,8 +941,7 @@ bool can_survive(const unit * u, const region * r)
|
|||
return false;
|
||||
|
||||
if (r->attribs) {
|
||||
const curse_type *ctype = ct_find("holyground");
|
||||
if (fval(u_race(u), RCF_UNDEAD) && curse_active(get_curse(r->attribs, ctype)))
|
||||
if (fval(u_race(u), RCF_UNDEAD) && curse_active(get_curse(r->attribs, &ct_holyground)))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
27
src/laws.c
27
src/laws.c
|
@ -42,6 +42,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "calendar.h"
|
||||
#include "guard.h"
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/raceprefix.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include <spells/buildingcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/ally.h>
|
||||
|
@ -66,12 +75,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/terrainid.h> /* for volcanoes in emigration (needs a flag) */
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/raceprefix.h>
|
||||
#include <attributes/stealth.h>
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
|
@ -2859,13 +2862,12 @@ static void age_stonecircle(building *b) {
|
|||
if (get_astralplane()) {
|
||||
region *rt = r_standard_to_astral(r);
|
||||
if (mage && rt && !fval(rt->terrain, FORBIDDEN_REGION)) {
|
||||
const struct curse_type *ct_astralblock = ct_find("astralblock");
|
||||
curse *c = get_curse(rt->attribs, ct_astralblock);
|
||||
curse *c = get_curse(rt->attribs, &ct_astralblock);
|
||||
if (!c) {
|
||||
int sk = effskill(mage, SK_MAGIC, 0);
|
||||
float effect = 100;
|
||||
/* the mage reactivates the circle */
|
||||
c = create_curse(mage, &rt->attribs, ct_astralblock,
|
||||
c = create_curse(mage, &rt->attribs, &ct_astralblock,
|
||||
(float)MAX(1, sk), MAX(1, sk / 2), effect, 0);
|
||||
ADDMSG(&r->msgs,
|
||||
msg_message("astralshield_activate", "region unit", r, mage));
|
||||
|
@ -2923,7 +2925,7 @@ static void ageing(void)
|
|||
}
|
||||
|
||||
if (is_cursed(u->attribs, C_OLDRACE, 0)) {
|
||||
curse *c = get_curse(u->attribs, ct_find("oldrace"));
|
||||
curse *c = get_curse(u->attribs, &ct_oldrace);
|
||||
if (c->duration == 1 && !(c_flags(c) & CURSE_NOAGE)) {
|
||||
u_setrace(u, get_race(curse_geteffect_int(c)));
|
||||
u->irace = NULL;
|
||||
|
@ -3234,15 +3236,14 @@ static int use_item(unit * u, const item_type * itype, int amount, struct order
|
|||
void monthly_healing(void)
|
||||
{
|
||||
region *r;
|
||||
const curse_type *heal_ct = ct_find("healingzone");
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
double healingcurse = 0;
|
||||
|
||||
if (r->attribs && heal_ct) {
|
||||
if (r->attribs) {
|
||||
/* bonus zurücksetzen */
|
||||
curse *c = get_curse(r->attribs, heal_ct);
|
||||
curse *c = get_curse(r->attribs, &ct_healing);
|
||||
if (c != NULL) {
|
||||
healingcurse = curse_geteffect(c);
|
||||
}
|
||||
|
|
43
src/magic.c
43
src/magic.c
|
@ -25,6 +25,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "study.h"
|
||||
#include "helpers.h"
|
||||
#include "laws.h"
|
||||
#include "spells.h"
|
||||
|
||||
#include <triggers/timeout.h>
|
||||
#include <triggers/shock.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/giveitem.h>
|
||||
#include <triggers/changerace.h>
|
||||
#include <triggers/clonedied.h>
|
||||
|
||||
#include <spells/regioncurse.h>
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/building.h>
|
||||
|
@ -46,13 +57,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <triggers/timeout.h>
|
||||
#include <triggers/shock.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/giveitem.h>
|
||||
#include <triggers/changerace.h>
|
||||
#include <triggers/clonedied.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/gamedata.h>
|
||||
|
@ -1024,7 +1028,7 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order
|
|||
curse *c;
|
||||
|
||||
/* Antimagie in der Zielregion */
|
||||
c = get_curse(r->attribs, ct_find("antimagiczone"));
|
||||
c = get_curse(r->attribs, &ct_antimagiczone);
|
||||
if (curse_active(c)) {
|
||||
unit *mage = c->magician;
|
||||
force -= curse_geteffect(c);
|
||||
|
@ -1043,7 +1047,7 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order
|
|||
}
|
||||
|
||||
/* Patzerfluch-Effekt: */
|
||||
c = get_curse(r->attribs, ct_find("fumble"));
|
||||
c = get_curse(r->attribs, &ct_fumble);
|
||||
if (curse_active(c)) {
|
||||
unit *mage = c->magician;
|
||||
force -= curse_geteffect(c);
|
||||
|
@ -1100,21 +1104,22 @@ variant magic_resistance(unit * target)
|
|||
{
|
||||
attrib *a;
|
||||
curse *c;
|
||||
const curse_type * ct_goodresist = 0, *ct_badresist = 0;
|
||||
const resource_type *rtype;
|
||||
const race *rc = u_race(target);
|
||||
variant v, prob = rc_magres(rc);
|
||||
const plane *pl = rplane(target->region);
|
||||
bool good_resist = true;
|
||||
bool bad_resist = true;
|
||||
|
||||
if (rc == get_race(RC_HIRNTOETER) && !pl) {
|
||||
prob = frac_mul(prob, frac_make(1, 2));
|
||||
prob = frac_mul(prob, frac_make(1, 2));
|
||||
}
|
||||
assert(target->number > 0);
|
||||
/* Magier haben einen Resistenzbonus vom Magietalent * 5% */
|
||||
prob = frac_add(prob, frac_make(effskill(target, SK_MAGIC, 0), 20));
|
||||
|
||||
/* Auswirkungen von Zaubern auf der Einheit */
|
||||
c = get_curse(target->attribs, ct_find("magicresistance"));
|
||||
c = get_curse(target->attribs, &ct_magicresistance);
|
||||
if (c) {
|
||||
/* TODO: legacy. magicresistance-effect is an integer-percentage stored in a double */
|
||||
int effect = curse_geteffect_int(c) * get_cursedmen(target, c);
|
||||
|
@ -1132,27 +1137,23 @@ variant magic_resistance(unit * target)
|
|||
|
||||
/* Auswirkungen von Zaubern auf der Region */
|
||||
a = a_find(target->region->attribs, &at_curse);
|
||||
if (a) {
|
||||
ct_badresist = ct_find("badmagicresistancezone");
|
||||
ct_goodresist = ct_find("goodmagicresistancezone");
|
||||
}
|
||||
while (a && a->type == &at_curse) {
|
||||
curse *c = (curse *)a->data.v;
|
||||
unit *mage = c->magician;
|
||||
|
||||
if (mage != NULL) {
|
||||
if (ct_goodresist && c->type == ct_goodresist) {
|
||||
if (good_resist && c->type == &ct_goodmagicresistancezone) {
|
||||
if (alliedunit(mage, target->faction, HELP_GUARD)) {
|
||||
/* TODO: legacy. magicresistance-effect is an integer-percentage stored in a double */
|
||||
prob = frac_add(prob, frac_make(curse_geteffect_int(c), 100));
|
||||
ct_goodresist = 0; /* only one effect per region */
|
||||
good_resist = false; /* only one effect per region */
|
||||
}
|
||||
}
|
||||
else if (ct_badresist && c->type == ct_badresist) {
|
||||
else if (bad_resist && c->type == &ct_badmagicresistancezone) {
|
||||
if (!alliedunit(mage, target->faction, HELP_GUARD)) {
|
||||
/* TODO: legacy. magicresistance-effect is an integer-percentage stored in a double */
|
||||
prob = frac_sub(prob, frac_make(curse_geteffect_int(c), 100));
|
||||
ct_badresist = 0; /* only one effect per region */
|
||||
bad_resist = false; /* only one effect per region */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1410,7 +1411,7 @@ static void do_fumble(castorder * co)
|
|||
/* temporary skill loss */
|
||||
duration = MAX(rng_int() % level / 2, 2);
|
||||
effect = level / -2.0;
|
||||
c = create_curse(u, &u->attribs, ct_find("skillmod"), level,
|
||||
c = create_curse(u, &u->attribs, &ct_skillmod, level,
|
||||
duration, effect, 1);
|
||||
c->data.i = SK_MAGIC;
|
||||
ADDMSG(&u->faction->msgs, msg_message("patzer2", "unit region", u, r));
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <attributes/targetregion.h>
|
||||
#include <attributes/hate.h>
|
||||
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/building.h>
|
||||
|
@ -904,13 +906,12 @@ void spawn_undead(void)
|
|||
{
|
||||
region *r;
|
||||
faction *monsters = get_monsters();
|
||||
const curse_type *ctype = ct_find("holyground");
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
int unburied = deathcount(r);
|
||||
|
||||
if (r->attribs && ctype) {
|
||||
if (curse_active(get_curse(r->attribs, ctype))) {
|
||||
if (r->attribs) {
|
||||
if (curse_active(get_curse(r->attribs, &ct_holyground))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
28
src/move.c
28
src/move.c
|
@ -31,6 +31,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "lighthouse.h"
|
||||
#include "piracy.h"
|
||||
|
||||
#include <spells/flyingship.h>
|
||||
#include <spells/unitcurse.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/movement.h>
|
||||
#include <attributes/stealth.h>
|
||||
#include <attributes/targetregion.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/building.h>
|
||||
|
@ -49,9 +60,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/terrainid.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <spells/flyingship.h>
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
#include "teleport.h"
|
||||
#include "direction.h"
|
||||
#include "calendar.h"
|
||||
|
@ -72,12 +80,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <storage.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/movement.h>
|
||||
#include <attributes/stealth.h>
|
||||
#include <attributes/targetregion.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
@ -1002,7 +1004,7 @@ bool move_blocked(const unit * u, const region * r, const region * r2)
|
|||
}
|
||||
|
||||
if (r->attribs) {
|
||||
const curse_type *fogtrap_ct = ct_find("fogtrap");
|
||||
const curse_type *fogtrap_ct = &ct_fogtrap;
|
||||
curse *c = get_curse(r->attribs, fogtrap_ct);
|
||||
return curse_active(c);
|
||||
}
|
||||
|
@ -1254,7 +1256,7 @@ static bool roadto(const region * r, direction_t dir)
|
|||
return false;
|
||||
}
|
||||
if (r->attribs || r2->attribs) {
|
||||
const curse_type *roads_ct = ct_find("magicstreet");
|
||||
const curse_type *roads_ct = &ct_magicstreet;
|
||||
if (roads_ct != NULL) {
|
||||
if (get_curse(r->attribs, roads_ct) != NULL)
|
||||
return true;
|
||||
|
@ -1578,7 +1580,7 @@ static const region_list *travel_route(unit * u,
|
|||
|
||||
/* illusionary units disappear in antimagic zones */
|
||||
if (fval(u_race(u), RCF_ILLUSIONARY)) {
|
||||
curse *c = get_curse(next->attribs, ct_find("antimagiczone"));
|
||||
curse *c = get_curse(next->attribs, &ct_antimagiczone);
|
||||
if (curse_active(c)) {
|
||||
curse_changevigour(&next->attribs, c, (float)-u->number);
|
||||
ADDMSG(&u->faction->msgs, msg_message("illusionantimagic", "unit", u));
|
||||
|
@ -1892,7 +1894,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
break;
|
||||
}
|
||||
|
||||
if (curse_active(get_curse(next_point->attribs, ct_find("maelstrom")))) {
|
||||
if (curse_active(get_curse(next_point->attribs, &ct_maelstrom))) {
|
||||
if (do_maelstrom(next_point, u) == NULL)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "chaos.h"
|
||||
#include "study.h"
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/reduceproduction.h>
|
||||
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
|
@ -44,10 +50,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/terrainid.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/reduceproduction.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/bsdstring.h>
|
||||
|
@ -692,32 +694,28 @@ static void orc_growth(void)
|
|||
for (u = r->units; u; u = u->next) {
|
||||
if (u->attribs && !has_skill(u, SK_MAGIC) && !has_skill(u, SK_ALCHEMY)
|
||||
&& !fval(u, UFL_HERO)) {
|
||||
const curse_type *ct_orcish = ct_find("orcish");
|
||||
curse *c = get_curse(u->attribs, &ct_orcish);
|
||||
if (c) {
|
||||
int n;
|
||||
int increase = 0;
|
||||
int num = get_cursedmen(u, c);
|
||||
double prob = curse_geteffect(c);
|
||||
const item_type * it_chastity = it_find("ao_chastity");
|
||||
|
||||
if (ct_orcish) {
|
||||
curse *c = get_curse(u->attribs, ct_orcish);
|
||||
if (c) {
|
||||
int n;
|
||||
int increase = 0;
|
||||
int num = get_cursedmen(u, c);
|
||||
double prob = curse_geteffect(c);
|
||||
const item_type * it_chastity = it_find("ao_chastity");
|
||||
if (it_chastity) {
|
||||
num -= i_get(u->items, it_chastity);
|
||||
}
|
||||
for (n = num; n > 0; n--) {
|
||||
if (chance(prob)) {
|
||||
++increase;
|
||||
}
|
||||
}
|
||||
if (increase) {
|
||||
unit *u2 = create_unit(r, u->faction, increase, u_race(u), 0, NULL, u);
|
||||
transfermen(u2, u, u2->number);
|
||||
|
||||
if (it_chastity) {
|
||||
num -= i_get(u->items, it_chastity);
|
||||
}
|
||||
for (n = num; n > 0; n--) {
|
||||
if (chance(prob)) {
|
||||
++increase;
|
||||
}
|
||||
}
|
||||
if (increase) {
|
||||
unit *u2 = create_unit(r, u->faction, increase, u_race(u), 0, NULL, u);
|
||||
transfermen(u2, u, u2->number);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("orcgrowth",
|
||||
"unit amount race", u, increase, u_race(u)));
|
||||
}
|
||||
ADDMSG(&u->faction->msgs, msg_message("orcgrowth",
|
||||
"unit amount race", u, increase, u_race(u)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "calendar.h"
|
||||
#include "teleport.h"
|
||||
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/connection.h>
|
||||
|
@ -72,8 +74,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/unit.h>
|
||||
#include <kernel/alliance.h>
|
||||
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
|
|
|
@ -25,6 +25,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "lighthouse.h"
|
||||
#include "donations.h"
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include <spells/unitcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/alliance.h>
|
||||
|
@ -68,11 +76,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include "move.h"
|
||||
|
||||
|
@ -303,12 +306,9 @@ report_items(const unit *u, item * result, int size, const unit * owner,
|
|||
assert(size);
|
||||
|
||||
if (u->attribs) {
|
||||
const curse_type *itemcloak_ct = ct_find("itemcloak");
|
||||
if (itemcloak_ct) {
|
||||
curse * cu = get_curse(u->attribs, itemcloak_ct);
|
||||
if (cu && curse_active(cu)) {
|
||||
return 0;
|
||||
}
|
||||
curse * cu = get_curse(u->attribs, &ct_itemcloak);
|
||||
if (cu && curse_active(cu)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (itm = items; itm; itm = itm->next) {
|
||||
|
|
55
src/spells.c
55
src/spells.c
|
@ -825,7 +825,7 @@ static int sp_goodwinds(castorder * co)
|
|||
|
||||
/* keine Probleme mit C_SHIP_SPEEDUP und C_SHIP_FLYING */
|
||||
/* NODRIFT bewirkt auch +1 Geschwindigkeit */
|
||||
create_curse(mage, &sh->attribs, ct_find("nodrift"), power, duration,
|
||||
create_curse(mage, &sh->attribs, &ct_nodrift, power, duration,
|
||||
zero_effect, 0);
|
||||
|
||||
/* melden, 1x pro Partei */
|
||||
|
@ -872,7 +872,7 @@ static int sp_magicstreet(castorder * co)
|
|||
}
|
||||
|
||||
/* wirkt schon in der Zauberrunde! */
|
||||
create_curse(mage, &r->attribs, ct_find("magicstreet"), co->force,
|
||||
create_curse(mage, &r->attribs, &ct_magicstreet, co->force,
|
||||
co->level + 1, zero_effect, 0);
|
||||
|
||||
/* melden, 1x pro Partei */
|
||||
|
@ -1022,7 +1022,7 @@ static int sp_maelstrom(castorder * co)
|
|||
/* Attribut auf Region.
|
||||
* Existiert schon ein curse, so wird dieser verstaerkt
|
||||
* (Max(Dauer), Max(Staerke))*/
|
||||
c = create_curse(mage, &r->attribs, ct_find("maelstrom"), co->force, duration, co->force, 0);
|
||||
c = create_curse(mage, &r->attribs, &ct_maelstrom, co->force, duration, co->force, 0);
|
||||
|
||||
/* melden, 1x pro Partei */
|
||||
if (c) {
|
||||
|
@ -1102,7 +1102,7 @@ static int sp_blessedharvest(castorder * co)
|
|||
* Existiert schon ein curse, so wird dieser verstaerkt
|
||||
* (Max(Dauer), Max(Staerke))*/
|
||||
|
||||
if (create_curse(mage, &r->attribs, ct_find("blessedharvest"), co->force,
|
||||
if (create_curse(mage, &r->attribs, &ct_blessedharvest, co->force,
|
||||
duration, 1.0, 0)) {
|
||||
const char * effect = co->sp->sname[0]=='b' ? "harvest_effect" : "raindance_effect";
|
||||
message *seen = msg_message(effect, "mage", mage);
|
||||
|
@ -1405,7 +1405,7 @@ static int sp_kaelteschutz(castorder * co)
|
|||
}
|
||||
|
||||
effect = 1;
|
||||
create_curse(mage, &u->attribs, ct_find("insectfur"), (float)cast_level,
|
||||
create_curse(mage, &u->attribs, &ct_insectfur, (float)cast_level,
|
||||
duration, effect, men);
|
||||
|
||||
force -= u->number;
|
||||
|
@ -1455,7 +1455,7 @@ static int sp_sparkle(castorder * co)
|
|||
|
||||
u = pa->param[0]->data.u;
|
||||
effect = (float)(rng_int() % 0xffffff);
|
||||
create_curse(mage, &u->attribs, ct_find("sparkle"), (float)cast_level,
|
||||
create_curse(mage, &u->attribs, &ct_sparkle, (float)cast_level,
|
||||
duration, effect, u->number);
|
||||
|
||||
ADDMSG(&mage->faction->msgs, msg_message("sparkle_effect", "mage target",
|
||||
|
@ -2036,7 +2036,7 @@ static int sp_holyground(castorder * co)
|
|||
report_spell(mage, r, msg);
|
||||
msg_release(msg);
|
||||
|
||||
ctype = ct_find("holyground");
|
||||
ctype = &ct_holyground;
|
||||
create_curse(mage, &r->attribs, ctype, power * power, 1, zero_effect, 0);
|
||||
|
||||
a_removeall(&r->attribs, &at_deathcount);
|
||||
|
@ -2083,7 +2083,7 @@ static int sp_homestone(castorder * co)
|
|||
/* Magieresistenz der Burg erhoeht sich um 50% */
|
||||
effect = 50.0F;
|
||||
c = create_curse(mage, &mage->building->attribs,
|
||||
ct_find("magicresistance"), force * force, 1, effect, 0);
|
||||
&ct_magicresistance, force * force, 1, effect, 0);
|
||||
c_setflag(c, CURSE_NOAGE);
|
||||
|
||||
/* melden, 1x pro Partei in der Burg */
|
||||
|
@ -2538,7 +2538,7 @@ static int sp_fumblecurse(castorder * co)
|
|||
duration = MAX(sx, rx) + 1;
|
||||
|
||||
effect = force / 2;
|
||||
c = create_curse(mage, &target->attribs, ct_find("fumble"),
|
||||
c = create_curse(mage, &target->attribs, &ct_fumble,
|
||||
force, duration, effect, 0);
|
||||
if (c == NULL) {
|
||||
report_failure(mage, co->order);
|
||||
|
@ -2561,7 +2561,7 @@ void patzer_fumblecurse(const castorder * co)
|
|||
curse *c;
|
||||
|
||||
effect = force / 2;
|
||||
c = create_curse(mage, &mage->attribs, ct_find("fumble"), force,
|
||||
c = create_curse(mage, &mage->attribs, &ct_fumble, force,
|
||||
duration, effect, 0);
|
||||
if (c != NULL) {
|
||||
ADDMSG(&mage->faction->msgs, msg_message("magic_fumble",
|
||||
|
@ -3231,13 +3231,6 @@ static int sp_magicboost(castorder * co)
|
|||
double power = co->force;
|
||||
double effect;
|
||||
trigger *tsummon;
|
||||
const curse_type *ct_auraboost;
|
||||
const curse_type *ct_magicboost;
|
||||
|
||||
ct_auraboost = ct_find("auraboost");
|
||||
ct_magicboost = ct_find("magicboost");
|
||||
assert(ct_auraboost != NULL);
|
||||
assert(ct_magicboost != NULL);
|
||||
|
||||
/* fehler, wenn schon ein boost */
|
||||
if (is_cursed(mage->attribs, C_MBOOST, 0)) {
|
||||
|
@ -3246,13 +3239,13 @@ static int sp_magicboost(castorder * co)
|
|||
}
|
||||
|
||||
effect = 6;
|
||||
create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1);
|
||||
create_curse(mage, &mage->attribs, &ct_magicboost, power, 10, effect, 1);
|
||||
/* one aura boost with 200% aura now: */
|
||||
effect = 200;
|
||||
c = create_curse(mage, &mage->attribs, ct_auraboost, power, 4, effect, 1);
|
||||
c = create_curse(mage, &mage->attribs, &ct_auraboost, power, 4, effect, 1);
|
||||
|
||||
/* and one aura boost with 50% aura in 5 weeks: */
|
||||
tsummon = trigger_createcurse(mage, mage, ct_auraboost, power, 6, 50, 1);
|
||||
tsummon = trigger_createcurse(mage, mage, &ct_auraboost, power, 6, 50, 1);
|
||||
add_trigger(&mage->attribs, "timer", trigger_timeout(5, tsummon));
|
||||
|
||||
ADDMSG(&mage->faction->msgs, msg_message("magicboost_effect",
|
||||
|
@ -3685,7 +3678,7 @@ static int sp_song_resistmagic(castorder * co)
|
|||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
||||
create_curse(mage, &r->attribs, ct_find("goodmagicresistancezone"),
|
||||
create_curse(mage, &r->attribs, &ct_goodmagicresistancezone,
|
||||
force, duration, 15, 0);
|
||||
|
||||
/* Erfolg melden */
|
||||
|
@ -3714,7 +3707,7 @@ static int sp_song_susceptmagic(castorder * co)
|
|||
double force = co->force;
|
||||
int duration = (int)force + 1;
|
||||
|
||||
create_curse(mage, &r->attribs, ct_find("badmagicresistancezone"),
|
||||
create_curse(mage, &r->attribs, &ct_badmagicresistancezone,
|
||||
force, duration, 15, 0);
|
||||
|
||||
ADDMSG(&mage->faction->msgs, msg_message("regionmagic_effect",
|
||||
|
@ -3822,7 +3815,7 @@ static int sp_raisepeasantmob(castorder * co)
|
|||
a->data.ca[1] = 15; /* 15% */
|
||||
a_add(&u->attribs, a);
|
||||
|
||||
create_curse(mage, &r->attribs, ct_find("riotzone"), (float)cast_level, duration,
|
||||
create_curse(mage, &r->attribs, &ct_riotzone, (float)cast_level, duration,
|
||||
(float)anteil, 0);
|
||||
|
||||
msg = msg_message("sp_raisepeasantmob_effect", "mage region", mage, r);
|
||||
|
@ -3978,7 +3971,7 @@ static int sp_generous(castorder * co)
|
|||
}
|
||||
|
||||
effect = 2;
|
||||
create_curse(mage, &r->attribs, ct_find("generous"), force, duration, effect,
|
||||
create_curse(mage, &r->attribs, &ct_generous, force, duration, effect,
|
||||
0);
|
||||
|
||||
for (u = r->units; u; u = u->next)
|
||||
|
@ -4443,7 +4436,7 @@ static int sp_depression(castorder * co)
|
|||
int duration = (int)force + 1;
|
||||
message *msg;
|
||||
|
||||
create_curse(mage, &r->attribs, ct_find("depression"), force, duration,
|
||||
create_curse(mage, &r->attribs, &ct_depression, force, duration,
|
||||
zero_effect, 0);
|
||||
|
||||
msg = msg_message("sp_depression_effect", "mage region", mage, r);
|
||||
|
@ -4862,7 +4855,7 @@ int sp_sweetdreams(castorder * co)
|
|||
|
||||
/* Nichts machen als ein entsprechendes Attribut an die Einheit legen. */
|
||||
effect = 0.05f;
|
||||
create_curse(mage, &u->attribs, ct_find("orcish"), power, duration, effect, men);
|
||||
create_curse(mage, &u->attribs, &ct_orcish, power, duration, effect, men);
|
||||
|
||||
msg = msg_message("sp_sweetdreams_effect", "mage unit region", mage, u, r);
|
||||
r_addmessage(r, mage->faction, msg);
|
||||
|
@ -4885,7 +4878,7 @@ int sp_disturbingdreams(castorder * co)
|
|||
double effect;
|
||||
|
||||
effect = 10;
|
||||
create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, effect, 0);
|
||||
create_curse(mage, &r->attribs, &ct_badlearn, power, duration, effect, 0);
|
||||
|
||||
ADDMSG(&mage->faction->msgs, msg_message("sp_disturbingdreams_effect",
|
||||
"mage region", mage, r));
|
||||
|
@ -4979,7 +4972,7 @@ int sp_itemcloak(castorder * co)
|
|||
/* Zieleinheit */
|
||||
target = pa->param[0]->data.u;
|
||||
|
||||
create_curse(mage, &target->attribs, ct_find("itemcloak"), power, duration,
|
||||
create_curse(mage, &target->attribs, &ct_itemcloak, power, duration,
|
||||
zero_effect, 0);
|
||||
ADDMSG(&mage->faction->msgs, msg_message("itemcloak", "mage target", mage,
|
||||
target));
|
||||
|
@ -5031,7 +5024,7 @@ int sp_resist_magic_bonus(castorder * co)
|
|||
m = MIN(u->number, victims);
|
||||
victims -= m;
|
||||
|
||||
create_curse(mage, &u->attribs, ct_find("magicresistance"),
|
||||
create_curse(mage, &u->attribs, &ct_magicresistance,
|
||||
power, duration, 20, m);
|
||||
|
||||
msg = msg_message("magicresistance_effect", "unit", u);
|
||||
|
@ -5793,7 +5786,7 @@ int sp_disruptastral(castorder * co)
|
|||
|
||||
/* Kontakt unterbinden */
|
||||
effect = 100;
|
||||
create_curse(mage, &rl2->data->attribs, ct_find("astralblock"),
|
||||
create_curse(mage, &rl2->data->attribs, &ct_astralblock,
|
||||
power, duration, effect, 0);
|
||||
}
|
||||
|
||||
|
@ -6107,7 +6100,7 @@ int sp_antimagiczone(castorder * co)
|
|||
/* Reduziert die Staerke jedes Spruchs um effect */
|
||||
effect = cast_level;
|
||||
|
||||
create_curse(mage, &r->attribs, ct_find("antimagiczone"), power, duration,
|
||||
create_curse(mage, &r->attribs, &ct_antimagiczone, power, duration,
|
||||
effect, 0);
|
||||
|
||||
/* Erfolg melden */
|
||||
|
|
|
@ -22,14 +22,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ship;
|
||||
struct curse;
|
||||
struct curse_type;
|
||||
struct region;
|
||||
struct unit;
|
||||
struct message;
|
||||
|
||||
extern const struct curse_type ct_magicresistance;
|
||||
|
||||
void register_magicresistance(void);
|
||||
void register_spells(void);
|
||||
void set_spelldata(struct spell *sp);
|
||||
|
||||
int sp_baddreams(castorder * co);
|
||||
int sp_gooddreams(castorder * co);
|
||||
|
|
|
@ -39,7 +39,7 @@ static void test_good_dreams(CuTest *tc) {
|
|||
|
||||
level = sp_gooddreams(&co);
|
||||
CuAssertIntEquals(tc, 10, level);
|
||||
curse = get_curse(r->attribs, ct_find("gbdream"));
|
||||
curse = get_curse(r->attribs, &ct_gbdream);
|
||||
CuAssertTrue(tc, curse && curse->duration > 1);
|
||||
CuAssertTrue(tc, curse->effect == 1);
|
||||
|
||||
|
@ -96,7 +96,7 @@ static void test_bad_dreams(CuTest *tc) {
|
|||
|
||||
level = sp_baddreams(&co);
|
||||
CuAssertIntEquals(tc, 10, level);
|
||||
curse = get_curse(r->attribs, ct_find("gbdream"));
|
||||
curse = get_curse(r->attribs, &ct_gbdream);
|
||||
CuAssertTrue(tc, curse && curse->duration > 1);
|
||||
CuAssertTrue(tc, curse->effect == -1);
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <platform.h>
|
||||
#include "combatspells.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
|
@ -27,8 +29,6 @@
|
|||
#include <kernel/race.h>
|
||||
#include <kernel/terrain.h>
|
||||
|
||||
#include <spells/buildingcurse.h>
|
||||
|
||||
#include <guard.h>
|
||||
#include <battle.h>
|
||||
#include <move.h>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <platform.h>
|
||||
#include "flyingship.h"
|
||||
|
||||
#include <spells/shipcurse.h>
|
||||
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -13,8 +15,6 @@
|
|||
|
||||
#include <magic.h>
|
||||
|
||||
#include <spells/shipcurse.h>
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
/* libc includes */
|
||||
|
|
|
@ -22,7 +22,7 @@ static struct message *cinfo_magicresistance(const void *obj, objtype_t typ, con
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct curse_type ct_magicresistance = {
|
||||
const struct curse_type ct_magicresistance = {
|
||||
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_magicresistance
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ static void test_magicresistance_unit(CuTest *tc) {
|
|||
f2 = test_create_faction(NULL);
|
||||
u2 = test_create_unit(f2, r);
|
||||
|
||||
c = create_curse(u1, &u2->attribs, ct_find("magicresistance"), 10, 20, 30, u2->number);
|
||||
c = create_curse(u1, &u2->attribs, &ct_magicresistance, 10, 20, 30, u2->number);
|
||||
CuAssertPtrNotNull(tc, u2->attribs);
|
||||
CuAssertPtrEquals(tc, (void *)&at_curse, (void *)u2->attribs->type);
|
||||
msg = c->type->curseinfo(u2, TYP_UNIT, c, 1);
|
||||
|
@ -62,7 +62,7 @@ static void test_magicresistance_building(CuTest *tc) {
|
|||
|
||||
b1 = test_create_building(r, NULL);
|
||||
|
||||
c = create_curse(u1, &b1->attribs, ct_find("magicresistance"), 10, 20, 30, 0);
|
||||
c = create_curse(u1, &b1->attribs, &ct_magicresistance, 10, 20, 30, 0);
|
||||
CuAssertPtrNotNull(tc, b1->attribs);
|
||||
CuAssertPtrEquals(tc, (void *)&at_curse, (void *)b1->attribs->type);
|
||||
msg = c->type->curseinfo(b1, TYP_BUILDING, c, 1);
|
||||
|
|
|
@ -106,7 +106,7 @@ static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse *
|
|||
return msg_message("curseinfo::magicstreetwarn", "id", c->no);
|
||||
}
|
||||
|
||||
static struct curse_type ct_magicstreet = {
|
||||
const struct curse_type ct_magicstreet = {
|
||||
"magicstreet",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_magicstreet
|
||||
|
@ -157,7 +157,7 @@ const curse * c, int self)
|
|||
return self;
|
||||
}
|
||||
|
||||
static struct curse_type ct_antimagiczone = {
|
||||
const struct curse_type ct_antimagiczone = {
|
||||
"antimagiczone",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_antimagiczone, NULL, NULL, NULL, cansee_antimagiczone
|
||||
|
@ -188,13 +188,13 @@ static struct curse_type ct_farvision = {
|
|||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
static struct curse_type ct_fogtrap = {
|
||||
const struct curse_type ct_fogtrap = {
|
||||
"fogtrap",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_maelstrom = {
|
||||
const struct curse_type ct_maelstrom = {
|
||||
"maelstrom",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
|
@ -212,28 +212,28 @@ const struct curse_type ct_drought = {
|
|||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_badlearn = {
|
||||
const struct curse_type ct_badlearn = {
|
||||
"badlearn",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
/* Trübsal-Zauber */
|
||||
static struct curse_type ct_depression = {
|
||||
const struct curse_type ct_depression = {
|
||||
"depression",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
/* Astralblock, auf Astralregion */
|
||||
static struct curse_type ct_astralblock = {
|
||||
const struct curse_type ct_astralblock = {
|
||||
"astralblock",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
/* Unterhaltungsanteil vermehren */
|
||||
static struct curse_type ct_generous = {
|
||||
const struct curse_type ct_generous = {
|
||||
"generous",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | M_MAXEFFECT),
|
||||
cinfo_simple
|
||||
|
@ -248,7 +248,7 @@ const struct curse_type ct_peacezone = {
|
|||
|
||||
/* erniedigt Magieresistenz von nicht-aliierten Einheiten, wirkt nur 1x
|
||||
* pro Einheit */
|
||||
static struct curse_type ct_badmagicresistancezone = {
|
||||
const struct curse_type ct_badmagicresistancezone = {
|
||||
"badmagicresistancezone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
|
@ -256,19 +256,19 @@ static struct curse_type ct_badmagicresistancezone = {
|
|||
|
||||
/* erhöht Magieresistenz von aliierten Einheiten, wirkt nur 1x pro
|
||||
* Einheit */
|
||||
static struct curse_type ct_goodmagicresistancezone = {
|
||||
const struct curse_type ct_goodmagicresistancezone = {
|
||||
"goodmagicresistancezone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_riotzone = {
|
||||
const struct curse_type ct_riotzone = {
|
||||
"riotzone",
|
||||
CURSETYP_NORM, 0, (M_DURATION),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_holyground = {
|
||||
const struct curse_type ct_holyground = {
|
||||
"holyground",
|
||||
CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD),
|
||||
cinfo_simple
|
||||
|
|
|
@ -25,6 +25,18 @@ extern "C" {
|
|||
extern const struct curse_type ct_godcursezone;
|
||||
extern const struct curse_type ct_gbdream;
|
||||
extern const struct curse_type ct_healing;
|
||||
extern const struct curse_type ct_antimagiczone;
|
||||
extern const struct curse_type ct_depression;
|
||||
extern const struct curse_type ct_astralblock;
|
||||
extern const struct curse_type ct_badmagicresistancezone;
|
||||
extern const struct curse_type ct_goodmagicresistancezone;
|
||||
extern const struct curse_type ct_holyground;
|
||||
extern const struct curse_type ct_fogtrap;
|
||||
extern const struct curse_type ct_magicstreet;
|
||||
extern const struct curse_type ct_maelstrom;
|
||||
extern const struct curse_type ct_riotzone;
|
||||
extern const struct curse_type ct_generous;
|
||||
extern const struct curse_type ct_badlearn;
|
||||
|
||||
void register_regioncurse(void);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ const struct curse_type ct_stormwind = { "stormwind",
|
|||
CURSETYP_NORM, 0, NO_MERGE, cinfo_ship
|
||||
};
|
||||
|
||||
static struct curse_type ct_nodrift = { "nodrift",
|
||||
const struct curse_type ct_nodrift = { "nodrift",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR), cinfo_shipnodrift
|
||||
};
|
||||
|
||||
|
|
|
@ -21,9 +21,11 @@ extern "C" {
|
|||
|
||||
struct message;
|
||||
struct curse;
|
||||
struct curse_type;
|
||||
|
||||
extern const struct curse_type ct_shipspeedup;
|
||||
extern const struct curse_type ct_stormwind;
|
||||
extern const struct curse_type ct_nodrift;
|
||||
|
||||
struct message *cinfo_ship(const void *obj, objtype_t typ,
|
||||
const struct curse *c, int self);
|
||||
|
|
|
@ -60,14 +60,14 @@ static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_auraboost = {
|
||||
const struct curse_type ct_auraboost = {
|
||||
"auraboost",
|
||||
CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE),
|
||||
cinfo_auraboost
|
||||
};
|
||||
|
||||
/* Magic Boost - Gabe des Chaos */
|
||||
static struct curse_type ct_magicboost = {
|
||||
const struct curse_type ct_magicboost = {
|
||||
"magicboost",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_IMMUNE, M_MEN, cinfo_simple
|
||||
};
|
||||
|
@ -168,7 +168,7 @@ message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_orcish = {
|
||||
const struct curse_type ct_orcish = {
|
||||
"orcish",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN,
|
||||
cinfo_unit
|
||||
|
@ -192,7 +192,7 @@ static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_insectfur = {
|
||||
const struct curse_type ct_insectfur = {
|
||||
"insectfur",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION),
|
||||
cinfo_kaelteschutz
|
||||
|
@ -259,7 +259,7 @@ static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c,
|
|||
}
|
||||
}
|
||||
|
||||
static struct curse_type ct_sparkle = { "sparkle",
|
||||
const struct curse_type ct_sparkle = { "sparkle",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), cinfo_sparkle
|
||||
};
|
||||
|
||||
|
@ -284,20 +284,20 @@ const struct curse_type ct_worse = {
|
|||
/*
|
||||
* C_ITEMCLOAK
|
||||
*/
|
||||
static struct curse_type ct_itemcloak = {
|
||||
const struct curse_type ct_itemcloak = {
|
||||
"itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
static struct curse_type ct_fumble = {
|
||||
const struct curse_type ct_fumble = {
|
||||
"fumble", CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE,
|
||||
cinfo_unit
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
static struct curse_type ct_oldrace = {
|
||||
const struct curse_type ct_oldrace = {
|
||||
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,14 @@ extern "C" {
|
|||
extern const struct curse_type ct_speed;
|
||||
extern const struct curse_type ct_worse;
|
||||
extern const struct curse_type ct_skillmod;
|
||||
extern const struct curse_type ct_oldrace;
|
||||
extern const struct curse_type ct_fumble;
|
||||
extern const struct curse_type ct_orcish;
|
||||
extern const struct curse_type ct_itemcloak;
|
||||
extern const struct curse_type ct_insectfur;
|
||||
extern const struct curse_type ct_sparkle;
|
||||
extern const struct curse_type ct_magicboost;
|
||||
extern const struct curse_type ct_auraboost;
|
||||
|
||||
struct message *cinfo_unit(const void *obj, objtype_t typ,
|
||||
const struct curse *c, int self);
|
||||
|
|
12
src/study.c
12
src/study.c
|
@ -28,6 +28,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "alchemy.h"
|
||||
#include "academy.h"
|
||||
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
|
@ -52,6 +54,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/rand.h>
|
||||
#include <util/rng.h>
|
||||
#include <util/umlaut.h>
|
||||
|
||||
#include <selist.h>
|
||||
|
||||
/* libc includes */
|
||||
|
@ -282,12 +285,9 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
int teaching, i, j, count, academy = 0;
|
||||
|
||||
if (u->region->attribs) {
|
||||
const curse_type *gbdream_ct = ct_find("gbdream");
|
||||
if (gbdream_ct) {
|
||||
if (get_curse(u->region->attribs, gbdream_ct)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "gbdream_noteach", ""));
|
||||
return 0;
|
||||
}
|
||||
if (get_curse(u->region->attribs, &ct_gbdream)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "gbdream_noteach", ""));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if ((u_race(u)->flags & RCF_NOTEACH) || fval(u, UFL_WERE)) {
|
||||
|
|
Loading…
Reference in New Issue