This commit is contained in:
Enno Rehling 2014-07-26 22:52:31 +02:00
commit d994caf7a3
8 changed files with 100 additions and 79 deletions

View File

@ -8,7 +8,7 @@ memcheck = 0
locales = de,en
[config]
game = eressea
rules = eressea
source_dir = ..
maxnmrs = 10

View File

@ -8,7 +8,7 @@ memcheck = 0
locales = de,en
[config]
game = e3a
rules = e3a
source_dir = ..
maxnmrs = 20

View File

@ -18,5 +18,5 @@ fi
$ROOT/$BIN_DIR/eressea/test_eressea
cd $ROOT
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/runtests.lua
grep ERROR eressea.log
#grep ERROR eressea.log
cd $OLDWPD

View File

@ -137,9 +137,9 @@ function test_ship_capacity()
process_orders()
-- print(s.region, u.region, r2)
assert_equal(r2.id, u1.region.id, "boat with 5 humans did not move")
assert_not_equal(r2.id, u2.region.id, "boat with too many people has moved")
assert_not_equal(r2.id, u4.region.id, "boat with too much cargo has moved")
assert_equal(r2, u1.region, "boat with 5 humans did not move")
assert_not_equal(r2, u2.region, "boat with too many people has moved")
assert_not_equal(r2, u4.region, "boat with too much cargo has moved")
end
function test_levitate()

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_BUILD 680
#define VERSION_BUILD 681

View File

@ -1164,17 +1164,10 @@ void economics(region * r)
for (u = r->units; u; u = u->next) {
order *ord;
bool destroyed = false;
if (u->number > 0) {
for (ord = u->orders; ord; ord = ord->next) {
keyword_t kwd = getkeyword(ord);
if (kwd == K_DESTROY) {
if (!destroyed) {
if (destroy_cmd(u, ord) != 0)
ord = NULL;
destroyed = true;
}
} else if (kwd == K_GIVE) {
if (kwd == K_GIVE) {
give_cmd(u, ord);
} else if (kwd == K_FORGET) {
forget_cmd(u, ord);
@ -1207,6 +1200,27 @@ void economics(region * r)
if (recruitorders)
expandrecruit(r, recruitorders);
remove_empty_units_in_region(r);
for (u = r->units; u; u = u->next) {
order *ord;
bool destroyed = false;
if (u->number > 0) {
for (ord = u->orders; ord; ord = ord->next) {
keyword_t kwd = getkeyword(ord);
if (kwd == K_DESTROY) {
if (!destroyed) {
if (destroy_cmd(u, ord) != 0)
ord = NULL;
destroyed = true;
}
}
if (u->orders == NULL) {
break;
}
}
}
}
}
/* ------------------------------------------------------------- */

View File

@ -128,64 +128,68 @@ void equip_unit(struct unit *u, const struct equipment *eq)
void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
{
if (eq) {
if (mask & EQUIP_SKILLS) {
int sk;
for (sk = 0; sk != MAXSKILLS; ++sk) {
if (eq->skills[sk] != NULL) {
int i = dice_rand(eq->skills[sk]);
if (i > 0)
set_level(u, (skill_t)sk, i);
}
}
}
if (mask & EQUIP_SPELLS) {
if (eq->spellbook) {
quicklist * ql = eq->spellbook->spells;
int qi;
sc_mage * mage = get_mage(u);
for (qi = 0; ql; ql_advance(&ql, &qi, 1)) {
spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
unit_add_spell(u, mage, sbe->sp, sbe->level);
}
}
}
if (mask & EQUIP_ITEMS) {
itemdata *idata;
for (idata = eq->items; idata != NULL; idata = idata->next) {
int i = u->number * dice_rand(idata->value);
if (i > 0) {
i_add(&u->items, i_new(idata->itype, i));
}
}
}
if (eq->subsets) {
int i;
for (i = 0; eq->subsets[i].sets; ++i) {
if (chance(eq->subsets[i].chance)) {
float rnd = (1 + rng_int() % 1000) / 1000.0f;
int k;
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
if (rnd <= eq->subsets[i].sets[k].chance) {
equip_unit_mask(u, eq->subsets[i].sets[k].set, mask);
break;
if (eq) {
if (mask & EQUIP_SKILLS) {
int sk;
for (sk = 0; sk != MAXSKILLS; ++sk) {
if (eq->skills[sk] != NULL) {
int i = dice_rand(eq->skills[sk]);
if (i > 0) {
set_level(u, (skill_t)sk, i);
if (sk==SK_STAMINA) {
u->hp = unit_max_hp(u) * u->number;
}
}
}
}
rnd -= eq->subsets[i].sets[k].chance;
}
}
}
if (mask & EQUIP_SPELLS) {
if (eq->spellbook) {
quicklist * ql = eq->spellbook->spells;
int qi;
sc_mage * mage = get_mage(u);
for (qi = 0; ql; ql_advance(&ql, &qi, 1)) {
spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi);
unit_add_spell(u, mage, sbe->sp, sbe->level);
}
}
}
if (mask & EQUIP_ITEMS) {
itemdata *idata;
for (idata = eq->items; idata != NULL; idata = idata->next) {
int i = u->number * dice_rand(idata->value);
if (i > 0) {
i_add(&u->items, i_new(idata->itype, i));
}
}
}
if (eq->subsets) {
int i;
for (i = 0; eq->subsets[i].sets; ++i) {
if (chance(eq->subsets[i].chance)) {
float rnd = (1 + rng_int() % 1000) / 1000.0f;
int k;
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
if (rnd <= eq->subsets[i].sets[k].chance) {
equip_unit_mask(u, eq->subsets[i].sets[k].set, mask);
break;
}
rnd -= eq->subsets[i].sets[k].chance;
}
}
}
}
if (mask & EQUIP_SPECIAL) {
if (eq->callback)
eq->callback(eq, u);
}
}
if (mask & EQUIP_SPECIAL) {
if (eq->callback)
eq->callback(eq, u);
}
}
}
void equip_items(struct item **items, const struct equipment *eq)

View File

@ -3226,15 +3226,18 @@ static int sp_bloodsacrifice(castorder * co)
*/
static void skill_summoned(unit * u, int level)
{
if (level > 0) {
const race *rc = u_race(u);
skill_t sk;
for (sk = 0; sk != MAXSKILLS; ++sk) {
if (rc->bonus[sk] > 0) {
set_level(u, sk, level);
}
if (level > 0) {
const race *rc = u_race(u);
skill_t sk;
for (sk = 0; sk != MAXSKILLS; ++sk) {
if (rc->bonus[sk] > 0) {
set_level(u, sk, level);
}
}
if (rc->bonus[SK_STAMINA]) {
u->hp = unit_max_hp(u) * u->number;
}
}
}
}
/* ------------------------------------------------------------- */
@ -4928,7 +4931,7 @@ int sp_resist_magic_bonus(castorder * co)
float power = co->force;
spellparameter *pa = co->par;
/* Pro Stufe koennen bis zu 5 Personen verzaubert werden */
double maxvictims = 5;
double maxvictims = 5 * power;
int victims = (int)maxvictims;
/* Schleife ueber alle angegebenen Einheiten */