forked from github/server
change effskill signature to take a region, change eff_skill to work on a skill * to avoid multiple lookups.
This commit is contained in:
parent
6889cb0c80
commit
de808bf146
|
@ -52,7 +52,7 @@ void herbsearch(unit * u, int max)
|
|||
region * r = u->region;
|
||||
int herbsfound;
|
||||
const item_type *whichherb;
|
||||
int effsk = effskill(u, SK_HERBALISM);
|
||||
int effsk = effskill(u, SK_HERBALISM, 0);
|
||||
|
||||
if (effsk == 0) {
|
||||
cmistake(u, u->thisorder, 59, MSG_PRODUCE);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <util/attrib.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
attrib_type at_stealth = {
|
||||
|
@ -49,9 +50,10 @@ int eff_stealth(const unit * u, const region * r)
|
|||
{
|
||||
int e = 0;
|
||||
|
||||
assert(u->region == r); // TODO: param r is useless
|
||||
/* Auf Schiffen keine Tarnung! */
|
||||
if (!u->ship && skill_enabled(SK_STEALTH)) {
|
||||
e = eff_skill(u, SK_STEALTH, r);
|
||||
e = effskill(u, SK_STEALTH, r);
|
||||
|
||||
if (u->flags & UFL_STEALTH) {
|
||||
int es = u_geteffstealth(u);
|
||||
|
|
31
src/battle.c
31
src/battle.c
|
@ -504,7 +504,7 @@ const armor_type * sh)
|
|||
if (tohit < 0.5)
|
||||
tohit = 0.5;
|
||||
if (chance(tohit)) {
|
||||
int defense = effskill(dt.fighter->unit, SK_STAMINA);
|
||||
int defense = effskill(dt.fighter->unit, SK_STAMINA, dt.fighter->unit->region);
|
||||
double tosave = defense * 0.05;
|
||||
return !chance(tosave);
|
||||
}
|
||||
|
@ -586,12 +586,12 @@ weapon_skill(const weapon_type * wtype, const unit * u, bool attacking)
|
|||
int skill;
|
||||
|
||||
if (wtype == NULL) {
|
||||
skill = effskill(u, SK_WEAPONLESS);
|
||||
skill = effskill(u, SK_WEAPONLESS, 0);
|
||||
if (skill <= 0) {
|
||||
/* wenn kein waffenloser kampf, dann den rassen-defaultwert */
|
||||
if (u_race(u) == get_race(RC_ORC)) {
|
||||
int sword = effskill(u, SK_MELEE);
|
||||
int spear = effskill(u, SK_SPEAR);
|
||||
int sword = effskill(u, SK_MELEE, 0);
|
||||
int spear = effskill(u, SK_SPEAR, 0);
|
||||
skill = _max(sword, spear) - 3;
|
||||
if (attacking) {
|
||||
skill = _max(skill, u_race(u)->at_default);
|
||||
|
@ -636,7 +636,7 @@ weapon_skill(const weapon_type * wtype, const unit * u, bool attacking)
|
|||
/* changed: if we own a weapon, we have at least a skill of 0 */
|
||||
if (!i_canuse(u, wtype->itype))
|
||||
return -1;
|
||||
skill = effskill(u, wtype->skill);
|
||||
skill = effskill(u, wtype->skill, 0);
|
||||
if (skill < wtype->minskill)
|
||||
skill = 0;
|
||||
if (skill > 0) {
|
||||
|
@ -683,7 +683,7 @@ static int CavalryBonus(const unit * u, troop enemy, int type)
|
|||
}
|
||||
else {
|
||||
/* new rule, chargers in Eressea 1.1 */
|
||||
int skl = effskill(u, SK_RIDING);
|
||||
int skl = effskill(u, SK_RIDING, 0);
|
||||
/* only half against trolls */
|
||||
if (skl > 0) {
|
||||
if (type == BONUS_DAMAGE) {
|
||||
|
@ -1031,7 +1031,7 @@ static int natural_armor(unit * du)
|
|||
bonus[u_race(du)->index] = -1;
|
||||
}
|
||||
if (bonus[u_race(du)->index] > 0) {
|
||||
int sk = effskill(du, SK_STAMINA);
|
||||
int sk = effskill(du, SK_STAMINA, 0);
|
||||
sk /= bonus[u_race(du)->index];
|
||||
an += sk;
|
||||
}
|
||||
|
@ -1686,7 +1686,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
if (fig->alive <= 0)
|
||||
continue; /* fighter kann im Kampf getötet worden sein */
|
||||
|
||||
level = eff_skill(mage, SK_MAGIC, r);
|
||||
level = effskill(mage, SK_MAGIC, r);
|
||||
if (level > 0) {
|
||||
double power;
|
||||
const spell *sp;
|
||||
|
@ -2330,7 +2330,7 @@ void do_regenerate(fighter * af)
|
|||
|
||||
while (ta.index--) {
|
||||
struct person *p = af->person + ta.index;
|
||||
p->hp += effskill(au, SK_STAMINA);
|
||||
p->hp += effskill(au, SK_STAMINA, 0);
|
||||
p->hp = _min(unit_max_hp(au), p->hp);
|
||||
}
|
||||
}
|
||||
|
@ -2353,7 +2353,7 @@ static double horsebonus(const unit * u)
|
|||
const item_type *it_horse, *it_elvenhorse, *it_charger;
|
||||
int n1 = 0, n2 = 0, n3 = 0;
|
||||
item *itm;
|
||||
int skl = eff_skill(u, SK_RIDING, u->region);
|
||||
int skl = effskill(u, SK_RIDING, 0);
|
||||
const resource_type *rtype;
|
||||
|
||||
if (skl < 1) return 0.0;
|
||||
|
@ -2384,11 +2384,10 @@ static double horsebonus(const unit * u)
|
|||
double fleechance(unit * u)
|
||||
{
|
||||
double c = 0.20; /* Fluchtwahrscheinlichkeit in % */
|
||||
region *r = u->region;
|
||||
attrib *a = a_find(u->attribs, &at_fleechance);
|
||||
/* Einheit u versucht, dem Getümmel zu entkommen */
|
||||
|
||||
c += (eff_skill(u, SK_STEALTH, r) * 0.05);
|
||||
c += (effskill(u, SK_STEALTH, 0) * 0.05);
|
||||
c += horsebonus(u);
|
||||
|
||||
if (u_race(u) == get_race(RC_HALFLING)) {
|
||||
|
@ -3188,7 +3187,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
|
|||
region *r = b->region;
|
||||
item *itm;
|
||||
fighter *fig = NULL;
|
||||
int h, i, tactics = eff_skill(u, SK_TACTICS, r);
|
||||
int h, i, tactics = effskill(u, SK_TACTICS, 0);
|
||||
int berserk;
|
||||
int strongmen;
|
||||
int speeded = 0, speed = 1;
|
||||
|
@ -3432,17 +3431,17 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
|
|||
* keine addierten boni. */
|
||||
|
||||
/* Zuerst mal die Spezialbehandlung gewisser Sonderfälle. */
|
||||
fig->magic = eff_skill(u, SK_MAGIC, r);
|
||||
fig->magic = effskill(u, SK_MAGIC, 0);
|
||||
|
||||
if (fig->horses) {
|
||||
if (!fval(r->terrain, CAVALRY_REGION) || r_isforest(r)
|
||||
|| eff_skill(u, SK_RIDING, r) < CavalrySkill()
|
||||
|| effskill(u, SK_RIDING, 0) < CavalrySkill()
|
||||
|| u_race(u) == get_race(RC_TROLL) || fval(u, UFL_WERE))
|
||||
fig->horses = 0;
|
||||
}
|
||||
|
||||
if (fig->elvenhorses) {
|
||||
if (eff_skill(u, SK_RIDING, r) < 5 || u_race(u) == get_race(RC_TROLL)
|
||||
if (effskill(u, SK_RIDING, 0) < 5 || u_race(u) == get_race(RC_TROLL)
|
||||
|| fval(u, UFL_WERE))
|
||||
fig->elvenhorses = 0;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ static int tolua_unit_effskill(lua_State * L)
|
|||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *skname = tolua_tostring(L, 2, 0);
|
||||
skill_t sk = findskill(skname);
|
||||
int value = (sk == NOSKILL) ? -1 : eff_skill(self, sk, self->region);
|
||||
int value = (sk == NOSKILL) ? -1 : effskill(self, sk, 0);
|
||||
lua_pushinteger(L, value);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
|||
prefix)));
|
||||
}
|
||||
if (u->faction != f && a_fshidden
|
||||
&& a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH) >= 6) {
|
||||
&& a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH, 0) >= 6) {
|
||||
stream_printf(out, "-1;Anzahl\n");
|
||||
}
|
||||
else {
|
||||
|
@ -942,14 +942,13 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
|||
pr = 0;
|
||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||
if (sv->level > 0) {
|
||||
skill_t sk = sv->id;
|
||||
int esk = eff_skill(u, sk, r);
|
||||
int esk = eff_skill(u, sv, r);
|
||||
if (!pr) {
|
||||
pr = 1;
|
||||
stream_printf(out, "TALENTE\n");
|
||||
}
|
||||
stream_printf(out, "%d %d;%s\n", u->number * level_days(sv->level), esk,
|
||||
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
||||
translate(mkname("skill", skillnames[sv->id]), skillname(sv->id,
|
||||
f->locale)));
|
||||
}
|
||||
}
|
||||
|
@ -957,7 +956,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
|||
/* spells that this unit can cast */
|
||||
mage = get_mage(u);
|
||||
if (mage) {
|
||||
int i, maxlevel = effskill(u, SK_MAGIC);
|
||||
int i, maxlevel = effskill(u, SK_MAGIC, 0);
|
||||
cr_output_spells(out, u, maxlevel);
|
||||
|
||||
for (i = 0; i != MAXCOMBATSPELLS; ++i) {
|
||||
|
@ -979,7 +978,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
|||
show = u->items;
|
||||
}
|
||||
else if (!itemcloak && mode >= see_unit && !(a_fshidden
|
||||
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
|
||||
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH, 0) >= 3)) {
|
||||
int n = report_items(u->items, result, MAX_INVENTORY, u, f);
|
||||
assert(n >= 0);
|
||||
if (n > 0)
|
||||
|
|
|
@ -999,7 +999,7 @@ static void manufacture(unit * u, const item_type * itype, int want)
|
|||
int minskill = itype->construction->minskill;
|
||||
skill_t sk = itype->construction->skill;
|
||||
|
||||
skill = effskill(u, sk);
|
||||
skill = effskill(u, sk, 0);
|
||||
skill =
|
||||
skillmod(itype->rtype->attribs, u, u->region, sk, skill, SMF_PRODUCTION);
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
|
|||
|
||||
assert(itype->construction->skill != 0
|
||||
|| "limited resource needs a required skill for making it");
|
||||
skill = eff_skill(u, itype->construction->skill, u->region);
|
||||
skill = effskill(u, itype->construction->skill, 0);
|
||||
if (skill == 0) {
|
||||
skill_t sk = itype->construction->skill;
|
||||
add_message(&u->faction->msgs,
|
||||
|
@ -1282,7 +1282,7 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist)
|
|||
if (!fval(al, AFL_DONE)) {
|
||||
int req = required(al->want - al->get, al->save);
|
||||
assert(al->get <= al->want && al->get >= 0);
|
||||
if (eff_skill(al->unit, itype->construction->skill, r)
|
||||
if (effskill(al->unit, itype->construction->skill, 0)
|
||||
>= rm->level + itype->construction->minskill - 1) {
|
||||
if (req) {
|
||||
norders += req;
|
||||
|
@ -1817,7 +1817,7 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
|
|||
}
|
||||
|
||||
/* Ein Händler kann nur 10 Güter pro Talentpunkt handeln. */
|
||||
k = u->number * 10 * eff_skill(u, SK_TRADE, r);
|
||||
k = u->number * 10 * effskill(u, SK_TRADE, 0);
|
||||
|
||||
/* hat der Händler bereits gehandelt, muss die Menge der bereits
|
||||
* verkauften/gekauften Güter abgezogen werden */
|
||||
|
@ -2134,7 +2134,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
|
|||
|
||||
/* Ein Händler kann nur 10 Güter pro Talentpunkt verkaufen. */
|
||||
|
||||
n = _min(n, u->number * 10 * eff_skill(u, SK_TRADE, r));
|
||||
n = _min(n, u->number * 10 * effskill(u, SK_TRADE, 0));
|
||||
|
||||
if (!n) {
|
||||
cmistake(u, ord, 54, MSG_COMMERCE);
|
||||
|
@ -2181,7 +2181,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
|
|||
* existiert, so dass man arrays von orders machen kann. */
|
||||
|
||||
/* Ein Händler kann nur 10 Güter pro Talentpunkt handeln. */
|
||||
k = u->number * 10 * eff_skill(u, SK_TRADE, r);
|
||||
k = u->number * 10 * effskill(u, SK_TRADE, 0);
|
||||
|
||||
/* hat der Händler bereits gehandelt, muss die Menge der bereits
|
||||
* verkauften/gekauften Güter abgezogen werden */
|
||||
|
@ -2280,7 +2280,7 @@ static void plant(region * r, unit * u, int raw)
|
|||
}
|
||||
|
||||
/* Skill prüfen */
|
||||
skill = eff_skill(u, SK_HERBALISM, r);
|
||||
skill = effskill(u, SK_HERBALISM, 0);
|
||||
itype = rherbtype(r);
|
||||
if (skill < 6) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
|
@ -2325,6 +2325,7 @@ static void planttrees(region * r, unit * u, int raw)
|
|||
int n, i, skill, planted = 0;
|
||||
const resource_type *rtype;
|
||||
|
||||
assert(r == u->region); // TODO: param r is unnecessary
|
||||
if (!fval(r->terrain, LAND_REGION)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2333,7 +2334,7 @@ static void planttrees(region * r, unit * u, int raw)
|
|||
rtype = get_resourcetype(fval(r, RF_MALLORN) ? R_MALLORNSEED : R_SEED);
|
||||
|
||||
/* Skill prüfen */
|
||||
skill = eff_skill(u, SK_HERBALISM, r);
|
||||
skill = effskill(u, SK_HERBALISM, 0);
|
||||
if (skill < 6) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "plant_skills",
|
||||
|
@ -2380,6 +2381,7 @@ static void breedtrees(region * r, unit * u, int raw)
|
|||
static int gamecookie = -1;
|
||||
static int current_season;
|
||||
|
||||
assert(r == u->region); // TODO: param r is unnecessary
|
||||
if (gamecookie != global.cookie) {
|
||||
gamedate date;
|
||||
get_gamedate(turn, &date);
|
||||
|
@ -2401,7 +2403,7 @@ static void breedtrees(region * r, unit * u, int raw)
|
|||
rtype = get_resourcetype(fval(r, RF_MALLORN) ? R_MALLORNSEED : R_SEED);
|
||||
|
||||
/* Skill prüfen */
|
||||
skill = eff_skill(u, SK_HERBALISM, r);
|
||||
skill = effskill(u, SK_HERBALISM, 0);
|
||||
if (skill < 12) {
|
||||
planttrees(r, u, raw);
|
||||
return;
|
||||
|
@ -2440,8 +2442,9 @@ static void breedhorses(region * r, unit * u)
|
|||
struct building *b = inside_building(u);
|
||||
const struct building_type *btype = b ? b->type : NULL;
|
||||
const struct resource_type *rhorse = get_resourcetype(R_HORSE);
|
||||
int horses;
|
||||
int horses, effsk;
|
||||
assert(rhorse && rhorse->itype);
|
||||
assert(r == u->region); // TODO: param r is unnecessary
|
||||
if (btype != bt_find("stables")) {
|
||||
cmistake(u, u->thisorder, 122, MSG_PRODUCE);
|
||||
return;
|
||||
|
@ -2451,11 +2454,12 @@ static void breedhorses(region * r, unit * u)
|
|||
cmistake(u, u->thisorder, 107, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
n = u->number * eff_skill(u, SK_HORSE_TRAINING, r);
|
||||
effsk = effskill(u, SK_HORSE_TRAINING, 0);
|
||||
n = u->number * effsk;
|
||||
n = _min(n, horses);
|
||||
|
||||
for (c = 0; c < n; c++) {
|
||||
if (rng_int() % 100 < eff_skill(u, SK_HORSE_TRAINING, r)) {
|
||||
if (rng_int() % 100 < effsk) {
|
||||
i_change(&u->items, rhorse->itype, 1);
|
||||
++breed;
|
||||
}
|
||||
|
@ -2551,7 +2555,7 @@ static void research_cmd(unit * u, struct order *ord)
|
|||
kwd = init_order(ord);
|
||||
assert(kwd == K_RESEARCH);
|
||||
|
||||
if (eff_skill(u, SK_HERBALISM, r) < 7) {
|
||||
if (effskill(u, SK_HERBALISM, 0) < 7) {
|
||||
cmistake(u, ord, 227, MSG_EVENT);
|
||||
return;
|
||||
}
|
||||
|
@ -2584,8 +2588,9 @@ static int max_skill(region * r, faction * f, skill_t sk)
|
|||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->faction == f) {
|
||||
if (eff_skill(u, sk, r) > w) {
|
||||
w = eff_skill(u, sk, r);
|
||||
int effsk = effskill(u, sk, 0);
|
||||
if (effsk > w) {
|
||||
w = effsk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2614,7 +2619,7 @@ message * check_steal(const unit * u, struct order *ord) {
|
|||
static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
||||
{
|
||||
const resource_type *rring = get_resourcetype(R_RING_OF_NIMBLEFINGER);
|
||||
int n, i, id;
|
||||
int n, i, id, effsk;
|
||||
bool goblin = false;
|
||||
request *o;
|
||||
unit *u2 = NULL;
|
||||
|
@ -2671,11 +2676,12 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
|||
return;
|
||||
}
|
||||
|
||||
n = eff_skill(u, SK_STEALTH, r) - max_skill(r, f, SK_PERCEPTION);
|
||||
effsk = effskill(u, SK_STEALTH, 0);
|
||||
n = effsk - max_skill(r, f, SK_PERCEPTION);
|
||||
|
||||
if (n <= 0) {
|
||||
/* Wahrnehmung == Tarnung */
|
||||
if (u_race(u) != get_race(RC_GOBLIN) || eff_skill(u, SK_STEALTH, r) <= 3) {
|
||||
if (u_race(u) != get_race(RC_GOBLIN) || effsk <= 3) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("stealfail", "unit target", u, u2));
|
||||
if (n == 0) {
|
||||
ADDMSG(&u2->faction->msgs, msg_message("stealdetect", "unit", u2));
|
||||
|
@ -2771,7 +2777,7 @@ void entertain_cmd(unit * u, struct order *ord)
|
|||
cmistake(u, ord, 58, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
if (!effskill(u, SK_ENTERTAINMENT)) {
|
||||
if (!effskill(u, SK_ENTERTAINMENT, 0)) {
|
||||
cmistake(u, ord, 58, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
|
@ -2788,7 +2794,7 @@ void entertain_cmd(unit * u, struct order *ord)
|
|||
return;
|
||||
}
|
||||
|
||||
u->wants = u->number * (entertainbase + effskill(u, SK_ENTERTAINMENT)
|
||||
u->wants = u->number * (entertainbase + effskill(u, SK_ENTERTAINMENT, 0)
|
||||
* entertainperlevel);
|
||||
|
||||
max_e = getuint();
|
||||
|
@ -3002,7 +3008,7 @@ void tax_cmd(unit * u, struct order *ord, request ** taxorders)
|
|||
u->wants = _min(income(u), max);
|
||||
}
|
||||
else {
|
||||
u->wants = _min(n * eff_skill(u, SK_TAXING, r) * 20, max);
|
||||
u->wants = _min(n * effskill(u, SK_TAXING, 0) * 20, max);
|
||||
}
|
||||
|
||||
u2 = is_guarded(r, u, GUARD_TAX);
|
||||
|
@ -3077,7 +3083,7 @@ void loot_cmd(unit * u, struct order *ord, request ** lootorders)
|
|||
}
|
||||
else {
|
||||
/* For player start with 20 Silver +10 every 5 level of close combat skill*/
|
||||
int skbonus = (_max(eff_skill(u, SK_MELEE, r), eff_skill(u, SK_SPEAR, r)) * 2 / 10) + 2;
|
||||
int skbonus = (_max(effskill(u, SK_MELEE, 0), effskill(u, SK_SPEAR, 0)) * 2 / 10) + 2;
|
||||
u->wants = _min(n * skbonus * 10, max);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ static void destroy_road(unit * u, int nmax, struct order *ord)
|
|||
n = _min(n, road);
|
||||
if (n != 0) {
|
||||
region *r2 = rconnect(r, d);
|
||||
int willdo = eff_skill(u, SK_ROAD_BUILDING, r) * u->number;
|
||||
int willdo = effskill(u, SK_ROAD_BUILDING, 0) * u->number;
|
||||
willdo = _min(willdo, n);
|
||||
if (willdo == 0) {
|
||||
/* TODO: error message */
|
||||
|
@ -263,11 +263,13 @@ int destroy_cmd(unit * u, struct order *ord)
|
|||
|
||||
void build_road(region * r, unit * u, int size, direction_t d)
|
||||
{
|
||||
int n, left;
|
||||
int n, left, effsk;
|
||||
region *rn = rconnect(r, d);
|
||||
|
||||
assert(u->number);
|
||||
if (!eff_skill(u, SK_ROAD_BUILDING, r)) {
|
||||
assert(r == u->region); // TODO: param r is unnecessary
|
||||
effsk = effskill(u, SK_ROAD_BUILDING, 0);
|
||||
if (!effsk) {
|
||||
cmistake(u, u->thisorder, 103, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +339,7 @@ void build_road(region * r, unit * u, int size, direction_t d)
|
|||
left = _min(n, left);
|
||||
|
||||
/* n = maximum by skill. try to maximize it */
|
||||
n = u->number * eff_skill(u, SK_ROAD_BUILDING, r);
|
||||
n = u->number * effsk;
|
||||
if (n < left) {
|
||||
const resource_type *ring = get_resourcetype(R_RING_OF_NIMBLEFINGER);
|
||||
item *itm = ring ? *i_find(&u->items, ring->itype) : 0;
|
||||
|
@ -349,12 +351,11 @@ void build_road(region * r, unit * u, int size, direction_t d)
|
|||
if (n < left) {
|
||||
int dm = get_effect(u, oldpotiontype[P_DOMORE]);
|
||||
if (dm != 0) {
|
||||
int sk = eff_skill(u, SK_ROAD_BUILDING, r);
|
||||
int todo = (left - n + sk - 1) / sk;
|
||||
int todo = (left - n + effsk - 1) / effsk;
|
||||
todo = _min(todo, u->number);
|
||||
dm = _min(dm, todo);
|
||||
change_effect(u, oldpotiontype[P_DOMORE], -dm);
|
||||
n += dm * sk;
|
||||
n += dm * effsk;
|
||||
} /* Auswirkung Schaffenstrunk */
|
||||
}
|
||||
|
||||
|
@ -456,7 +457,7 @@ int build(unit * u, const construction * ctype, int completed, int want)
|
|||
int dm = get_effect(u, oldpotiontype[P_DOMORE]);
|
||||
|
||||
assert(u->number);
|
||||
basesk = effskill(u, type->skill);
|
||||
basesk = effskill(u, type->skill, 0);
|
||||
if (basesk == 0)
|
||||
return ENEEDSKILL;
|
||||
|
||||
|
@ -676,7 +677,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
|
||||
assert(u->number);
|
||||
assert(btype->construction);
|
||||
if (eff_skill(u, SK_BUILDING, r) == 0) {
|
||||
if (effskill(u, SK_BUILDING, 0) == 0) {
|
||||
cmistake(u, ord, 101, MSG_PRODUCE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -887,7 +888,8 @@ order * ord)
|
|||
const construction *cons = newtype->construction;
|
||||
order *new_order;
|
||||
|
||||
if (!eff_skill(u, SK_SHIPBUILDING, r)) {
|
||||
assert(u->region == r); // TODO: param r is unnecessary
|
||||
if (!effskill(u, SK_SHIPBUILDING, 0)) {
|
||||
cmistake(u, ord, 100, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
@ -897,7 +899,7 @@ order * ord)
|
|||
}
|
||||
|
||||
/* check if skill and material for 1 size is available */
|
||||
if (eff_skill(u, cons->skill, r) < cons->minskill) {
|
||||
if (effskill(u, cons->skill, 0) < cons->minskill) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
|
||||
"error_build_skill_low", "value", cons->minskill));
|
||||
return;
|
||||
|
@ -935,7 +937,8 @@ void continue_ship(region * r, unit * u, int want)
|
|||
ship *sh;
|
||||
int msize;
|
||||
|
||||
if (!eff_skill(u, SK_SHIPBUILDING, r)) {
|
||||
assert(u->region == r); // TODO: param r is unnecessary
|
||||
if (!effskill(u, SK_SHIPBUILDING, 0)) {
|
||||
cmistake(u, u->thisorder, 100, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
@ -956,7 +959,7 @@ void continue_ship(region * r, unit * u, int want)
|
|||
cmistake(u, u->thisorder, 16, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
if (eff_skill(u, cons->skill, r) < cons->minskill) {
|
||||
if (effskill(u, cons->skill, 0) < cons->minskill) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
|
||||
"error_build_skill_low", "value", cons->minskill));
|
||||
return;
|
||||
|
|
|
@ -434,10 +434,9 @@ static bool
|
|||
b_blockfogwall(const connection * b, const unit * u, const region * r)
|
||||
{
|
||||
unused_arg(b);
|
||||
unused_arg(r);
|
||||
if (!u)
|
||||
return true;
|
||||
return (bool)(effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */
|
||||
return (bool)(effskill(u, SK_PERCEPTION, r) > 4); /* Das ist die alte Nebelwand */
|
||||
}
|
||||
|
||||
/** Legacy type used in old Eressea games, no longer in use. */
|
||||
|
|
|
@ -825,7 +825,7 @@ int amount, struct order *ord)
|
|||
""));
|
||||
return ECUSTOM;
|
||||
}
|
||||
if (effskill(u, SK_STEALTH) <= effskill(target, SK_PERCEPTION)) {
|
||||
if (effskill(u, SK_STEALTH, 0) <= effskill(target, SK_PERCEPTION, 0)) {
|
||||
cmistake(u, ord, 64, MSG_EVENT);
|
||||
return ECUSTOM;
|
||||
}
|
||||
|
|
|
@ -1671,7 +1671,7 @@ int readgame(const char *filename, bool backup)
|
|||
sc_mage *mage = get_mage(u);
|
||||
if (mage) {
|
||||
faction *f = u->faction;
|
||||
int skl = effskill(u, SK_MAGIC);
|
||||
int skl = effskill(u, SK_MAGIC, 0);
|
||||
if (f->magiegebiet == M_GRAY) {
|
||||
log_error("faction %s had magic=gray, fixing (%s)\n", factionname(f), magic_school[mage->magietyp]);
|
||||
f->magiegebiet = mage->magietyp;
|
||||
|
|
|
@ -273,7 +273,7 @@ static int ShipSpeedBonus(const unit * u)
|
|||
int level = get_param_int(global.parameters, "movement.shipspeed.skillbonus", 0);
|
||||
if (level > 0) {
|
||||
ship *sh = u->ship;
|
||||
int skl = effskill(u, SK_SAILING);
|
||||
int skl = effskill(u, SK_SAILING, 0);
|
||||
int minsk = (sh->type->cptskill + 1) / 2;
|
||||
return (skl - minsk) / level;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ int crew_skill(const ship *sh) {
|
|||
|
||||
for (u = sh->region->units; u; u = u->next) {
|
||||
if (u->ship == sh) {
|
||||
n += eff_skill(u, SK_SAILING, sh->region) * u->number;
|
||||
n += effskill(u, SK_SAILING, 0) * u->number;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
|
|
|
@ -1365,31 +1365,31 @@ int get_modifier(const unit * u, skill_t sk, int level, const region * r, bool n
|
|||
return skill - bskill;
|
||||
}
|
||||
|
||||
int eff_skill(const unit * u, skill_t sk, const region * r)
|
||||
int eff_skill(const unit * u, const skill *sv, const region *r)
|
||||
{
|
||||
if (skill_enabled(sk)) {
|
||||
int level = get_level(u, sk);
|
||||
if (level > 0) {
|
||||
int mlevel = level + get_modifier(u, sk, level, r, false);
|
||||
assert(u);
|
||||
if (!r) r = u->region;
|
||||
if (sv && sv->level>0) {
|
||||
int mlevel = sv->level + get_modifier(u, sv->id, sv->level, r, false);
|
||||
|
||||
if (mlevel > 0) {
|
||||
int skillcap = SkillCap(sk);
|
||||
int skillcap = SkillCap(sv->id);
|
||||
if (skillcap && mlevel > skillcap) {
|
||||
return skillcap;
|
||||
}
|
||||
return mlevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eff_skill_study(const unit * u, skill_t sk, const region * r)
|
||||
int effskill_study(const unit * u, skill_t sk, const region * r)
|
||||
{
|
||||
int level = get_level(u, sk);
|
||||
if (level > 0) {
|
||||
int mlevel = level + get_modifier(u, sk, level, r, true);
|
||||
|
||||
skill *sv = unit_skill(u, sk);
|
||||
if (sv && sv->level > 0) {
|
||||
int mlevel = sv->level;
|
||||
if (!r) r = u->region;
|
||||
mlevel += get_modifier(u, sv->id, sv->level, r, true);
|
||||
if (mlevel > 0)
|
||||
return mlevel;
|
||||
}
|
||||
|
@ -1741,7 +1741,7 @@ int unit_max_hp(const unit * u)
|
|||
h = u_race(u)->hitpoints;
|
||||
|
||||
if (rules_stamina & 1) {
|
||||
p = pow(effskill(u, SK_STAMINA) / 2.0, 1.5) * 0.2;
|
||||
p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2;
|
||||
h += (int)(h * p + 0.5);
|
||||
}
|
||||
|
||||
|
@ -1852,9 +1852,20 @@ struct spellbook * unit_get_spellbook(const struct unit * u)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int effskill(const unit * u, skill_t sk)
|
||||
int effskill(const unit * u, skill_t sk, const region *r)
|
||||
{
|
||||
return eff_skill(u, sk, u->region);
|
||||
assert(u);
|
||||
|
||||
if (skill_enabled(sk)) {
|
||||
skill *sv = u->skills;
|
||||
while (sv != u->skills + u->skill_size) {
|
||||
if (sv->id == sk) {
|
||||
return eff_skill(u, sv, r);
|
||||
}
|
||||
++sv;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remove_empty_units_in_region(region * r)
|
||||
|
|
|
@ -160,7 +160,7 @@ extern "C" {
|
|||
void remove_skill(struct unit *u, skill_t sk);
|
||||
struct skill *unit_skill(const struct unit *u, skill_t id);
|
||||
bool has_skill(const unit * u, skill_t sk);
|
||||
int effskill(const struct unit *u, skill_t sk);
|
||||
int effskill(const struct unit *u, skill_t sk, const struct region *r);
|
||||
int produceexp(struct unit *u, skill_t sk, int n);
|
||||
int SkillCap(skill_t sk);
|
||||
|
||||
|
@ -168,14 +168,12 @@ extern "C" {
|
|||
int get_level(const struct unit *u, skill_t id);
|
||||
extern void transfermen(struct unit *u, struct unit *u2, int n);
|
||||
|
||||
extern int eff_skill(const struct unit *u, skill_t sk,
|
||||
const struct region *r);
|
||||
extern int eff_skill_study(const struct unit *u, skill_t sk,
|
||||
const struct region *r);
|
||||
int eff_skill(const struct unit *u, const struct skill *sv, const struct region *r);
|
||||
int effskill_study(const struct unit *u, skill_t sk, const struct region *r);
|
||||
|
||||
extern int get_modifier(const struct unit *u, skill_t sk, int lvl,
|
||||
int get_modifier(const struct unit *u, skill_t sk, int level,
|
||||
const struct region *r, bool noitem);
|
||||
extern int remove_unit(struct unit **ulist, struct unit *u);
|
||||
int remove_unit(struct unit **ulist, struct unit *u);
|
||||
|
||||
#define GIFT_SELF 1<<0
|
||||
#define GIFT_FRIENDS 1<<1
|
||||
|
|
31
src/laws.c
31
src/laws.c
|
@ -894,7 +894,7 @@ static int slipthru(const region * r, const unit * u, const building * b)
|
|||
|
||||
/* u wird am hinein- oder herausschluepfen gehindert, wenn STEALTH <=
|
||||
* OBSERVATION +2 der belagerer u2 ist */
|
||||
n = eff_skill(u, SK_STEALTH, r);
|
||||
n = effskill(u, SK_STEALTH, r);
|
||||
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (usiege(u2) == b) {
|
||||
|
@ -902,7 +902,7 @@ static int slipthru(const region * r, const unit * u, const building * b)
|
|||
if (invisible(u, u2) >= u->number)
|
||||
continue;
|
||||
|
||||
o = eff_skill(u2, SK_PERCEPTION, r);
|
||||
o = effskill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (o + 2 >= n) {
|
||||
return 0; /* entdeckt! */
|
||||
|
@ -2290,7 +2290,7 @@ static bool display_potion(faction * f, unit * u, const potion_type * ptype)
|
|||
return false;
|
||||
else {
|
||||
int i = i_get(u->items, ptype->itype);
|
||||
if (i == 0 && 2 * ptype->level > effskill(u, SK_ALCHEMY)) {
|
||||
if (i == 0 && 2 * ptype->level > effskill(u, SK_ALCHEMY, 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2465,7 +2465,7 @@ static void reshow(unit * u, struct order *ord, const char *s, param_t p)
|
|||
a_removeall(&u->faction->attribs, &at_seenspell);
|
||||
break;
|
||||
case P_POTIONS:
|
||||
skill = effskill(u, SK_ALCHEMY);
|
||||
skill = effskill(u, SK_ALCHEMY, 0);
|
||||
c = 0;
|
||||
for (ptype = potiontypes; ptype != NULL; ptype = ptype->next) {
|
||||
if (ptype->level * 2 <= skill) {
|
||||
|
@ -3138,7 +3138,7 @@ static building *age_building(building * b)
|
|||
curse *c = get_curse(rt->attribs, ct_astralblock);
|
||||
if (c == NULL) {
|
||||
if (mage != NULL) {
|
||||
int sk = effskill(mage, SK_MAGIC);
|
||||
int sk = effskill(mage, SK_MAGIC, 0);
|
||||
float effect = 100;
|
||||
/* the mage reactivates the circle */
|
||||
c = create_curse(mage, &rt->attribs, ct_astralblock,
|
||||
|
@ -3148,7 +3148,7 @@ static building *age_building(building * b)
|
|||
}
|
||||
}
|
||||
else if (mage != NULL) {
|
||||
int sk = effskill(mage, SK_MAGIC);
|
||||
int sk = effskill(mage, SK_MAGIC, 0);
|
||||
c->duration = _max(c->duration, sk / 2);
|
||||
c->vigour = _max(c->vigour, (float)sk);
|
||||
}
|
||||
|
@ -3693,7 +3693,7 @@ static int faction_getmages(faction * f, unit ** results, int numresults)
|
|||
if (u->number > 0) {
|
||||
sc_mage *mage = get_mage(u);
|
||||
if (mage) {
|
||||
int level = eff_skill(u, SK_MAGIC, u->region);
|
||||
int level = effskill(u, SK_MAGIC, 0);
|
||||
if (level > maxlevel) {
|
||||
maxlevel = level;
|
||||
}
|
||||
|
@ -3752,7 +3752,7 @@ static void update_spells(void)
|
|||
unit * u = mages[i];
|
||||
sc_mage *mage = get_mage(u);
|
||||
if (mage && mage->spellbook) {
|
||||
int level = effskill(u, SK_MAGIC);
|
||||
int level = effskill(u, SK_MAGIC, 0);
|
||||
show_new_spells(f, level, mage->spellbook);
|
||||
}
|
||||
}
|
||||
|
@ -4182,7 +4182,7 @@ int armedmen(const unit * u, bool siege_weapons)
|
|||
item *itm;
|
||||
int n = 0;
|
||||
if (!(urace(u)->flags & RCF_NOWEAPONS)) {
|
||||
if (effskill(u, SK_WEAPONLESS) >= 1) {
|
||||
if (effskill(u, SK_WEAPONLESS, 0) >= 1) {
|
||||
/* kann ohne waffen bewachen: fuer drachen */
|
||||
n = u->number;
|
||||
}
|
||||
|
@ -4193,7 +4193,7 @@ int armedmen(const unit * u, bool siege_weapons)
|
|||
const weapon_type *wtype = resource2weapon(itm->type->rtype);
|
||||
if (wtype == NULL || (!siege_weapons && (wtype->flags & WTF_SIEGE)))
|
||||
continue;
|
||||
if (effskill(u, wtype->skill) >= wtype->minskill)
|
||||
if (effskill(u, wtype->skill, 0) >= wtype->minskill)
|
||||
n += itm->number;
|
||||
/* if (effskill(u, wtype->skill) >= wtype->minskill) n += itm->number; */
|
||||
if (n > u->number)
|
||||
|
@ -4238,9 +4238,9 @@ int siege_cmd(unit * u, order * ord)
|
|||
d = _min(u->number, d);
|
||||
pooled = get_pooled(u, rt_catapultammo, GET_DEFAULT, d);
|
||||
d = _min(pooled, d);
|
||||
if (eff_skill(u, SK_CATAPULT, r) >= 1) {
|
||||
if (effskill(u, SK_CATAPULT, 0) >= 1) {
|
||||
katapultiere = d;
|
||||
d *= eff_skill(u, SK_CATAPULT, r);
|
||||
d *= effskill(u, SK_CATAPULT, 0);
|
||||
}
|
||||
else {
|
||||
d = 0;
|
||||
|
@ -4604,6 +4604,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
|||
int stealth, rings;
|
||||
unit *u2 = r->units;
|
||||
|
||||
assert(u->region == r); // TODO: param r is unnecessary
|
||||
if (u->faction == f || omniscient(f)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -4640,7 +4641,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
|||
while (u2) {
|
||||
if (rings < u->number || invisible(u, u2) < u->number) {
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
int observation = eff_skill(u2, SK_PERCEPTION, r);
|
||||
int observation = effskill(u2, SK_PERCEPTION, 0);
|
||||
|
||||
if (observation >= stealth) {
|
||||
return true;
|
||||
|
@ -4684,7 +4685,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
|
|||
return false;
|
||||
}
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
o = eff_skill(u, SK_PERCEPTION, target->region);
|
||||
o = effskill(u, SK_PERCEPTION, target->region);
|
||||
if (o >= n) {
|
||||
return true;
|
||||
}
|
||||
|
@ -4730,7 +4731,7 @@ int modifier)
|
|||
if (rings && invisible(u, u2) >= u->number)
|
||||
continue;
|
||||
|
||||
o = eff_skill(u2, SK_PERCEPTION, r);
|
||||
o = effskill(u2, SK_PERCEPTION, 0);
|
||||
|
||||
if (o >= n) {
|
||||
return true;
|
||||
|
|
|
@ -81,7 +81,7 @@ int lighthouse_range(const building * b, const faction * f)
|
|||
if (c > buildingcapacity(b))
|
||||
break;
|
||||
if (f == NULL || u->faction == f) {
|
||||
int sk = eff_skill(u, SK_PERCEPTION, r) / 3;
|
||||
int sk = effskill(u, SK_PERCEPTION, 0) / 3;
|
||||
d = _max(d, sk);
|
||||
d = _min(maxd, d);
|
||||
if (d == maxd)
|
||||
|
@ -131,7 +131,7 @@ bool check_leuchtturm(region * r, faction * f)
|
|||
d = distance(r, r2);
|
||||
if (maxd < d)
|
||||
break;
|
||||
if (eff_skill(u, SK_PERCEPTION, r) >= d * 3)
|
||||
if (effskill(u, SK_PERCEPTION, 0) >= d * 3)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
30
src/magic.c
30
src/magic.c
|
@ -517,7 +517,7 @@ int u_hasspell(const unit *u, const struct spell *sp)
|
|||
spellbook * book = unit_get_spellbook(u);
|
||||
spellbook_entry * sbe = book ? spellbook_get(book, sp) : 0;
|
||||
if (sbe) {
|
||||
return sbe->level <= effskill(u, SK_MAGIC);
|
||||
return sbe->level <= effskill(u, SK_MAGIC, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ int get_combatspelllevel(const unit * u, int nr)
|
|||
|
||||
assert(nr < MAXCOMBATSPELLS);
|
||||
if (m) {
|
||||
int level = eff_skill(u, SK_MAGIC, u->region);
|
||||
int level = effskill(u, SK_MAGIC, 0);
|
||||
return _min(m->combatspells[nr].level, level);
|
||||
}
|
||||
return -1;
|
||||
|
@ -703,7 +703,7 @@ static int use_item_aura(const region * r, const unit * u)
|
|||
{
|
||||
int sk, n;
|
||||
|
||||
sk = eff_skill(u, SK_MAGIC, r);
|
||||
sk = effskill(u, SK_MAGIC, r);
|
||||
n = (int)(sk * sk * u_race(u)->maxaura / 4);
|
||||
|
||||
return n;
|
||||
|
@ -717,7 +717,7 @@ int max_spellpoints(const region * r, const unit * u)
|
|||
double divisor = 1.2;
|
||||
const struct resource_type *rtype;
|
||||
|
||||
sk = eff_skill(u, SK_MAGIC, r);
|
||||
sk = effskill(u, SK_MAGIC, r);
|
||||
msp = u_race(u)->maxaura * (pow(sk, potenz) / divisor + 1) + get_spchange(u);
|
||||
|
||||
rtype = rt_find("aurafocus");
|
||||
|
@ -950,7 +950,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
|||
return false;
|
||||
}
|
||||
/* reicht die Stufe aus? */
|
||||
if (eff_skill(u, SK_MAGIC, u->region) < level) {
|
||||
if (effskill(u, SK_MAGIC, 0) < level) {
|
||||
/* die Einheit ist nicht erfahren genug für diesen Zauber */
|
||||
cmistake(u, ord, 169, MSG_MAGIC);
|
||||
return false;
|
||||
|
@ -1123,7 +1123,7 @@ double magic_resistance(unit * target)
|
|||
|
||||
assert(target->number > 0);
|
||||
/* Magier haben einen Resistenzbonus vom Magietalent * 5% */
|
||||
probability += effskill(target, SK_MAGIC) * 0.05;
|
||||
probability += effskill(target, SK_MAGIC, 0) * 0.05;
|
||||
|
||||
/* Auswirkungen von Zaubern auf der Einheit */
|
||||
c = get_curse(target->attribs, ct_find("magicresistance"));
|
||||
|
@ -1207,10 +1207,10 @@ target_resists_magic(unit * magician, void *obj, int objtyp, int t_bonus)
|
|||
skill *sv;
|
||||
unit *u = (unit *)obj;
|
||||
|
||||
at = effskill(magician, SK_MAGIC);
|
||||
at = effskill(magician, SK_MAGIC, 0);
|
||||
|
||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||
int sk = effskill(u, sv->id);
|
||||
int sk = eff_skill(u, sv, 0);
|
||||
if (pa < sk)
|
||||
pa = sk;
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ bool fumble(region * r, unit * u, const spell * sp, int cast_grade)
|
|||
* */
|
||||
|
||||
int rnd = 0;
|
||||
double x = (double)cast_grade / (double)eff_skill(u, SK_MAGIC, r);
|
||||
double x = (double)cast_grade / (double)effskill(u, SK_MAGIC, r);
|
||||
int fumble_chance = (int)(((double)x * 40.0) - 20.0);
|
||||
struct building *b = inside_building(u);
|
||||
const struct building_type *btype = b ? b->type : NULL;
|
||||
|
@ -1432,7 +1432,7 @@ static double regeneration(unit * u)
|
|||
double potenz = 1.5;
|
||||
double divisor = 2.0;
|
||||
|
||||
sk = effskill(u, SK_MAGIC);
|
||||
sk = effskill(u, SK_MAGIC, 0);
|
||||
/* Rassenbonus/-malus */
|
||||
d = pow(sk, potenz) * u_race(u)->regaura / divisor;
|
||||
d++;
|
||||
|
@ -2149,7 +2149,7 @@ static int sm_familiar(const unit * u, const region * r, skill_t sk, int value)
|
|||
/* the familiar is dead */
|
||||
return value;
|
||||
}
|
||||
mod = eff_skill(familiar, sk, r) / 2;
|
||||
mod = effskill(familiar, sk, r) / 2;
|
||||
if (r != familiar->region) {
|
||||
mod /= distance(r, familiar->region);
|
||||
}
|
||||
|
@ -2515,7 +2515,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
cmistake(u, ord, 269, MSG_MAGIC);
|
||||
return 0;
|
||||
}
|
||||
level = eff_skill(u, SK_MAGIC, r);
|
||||
level = effskill(u, SK_MAGIC, 0);
|
||||
|
||||
init_order(ord);
|
||||
s = gettoken(token, sizeof(token));
|
||||
|
@ -2648,7 +2648,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
}
|
||||
/* Stufenangabe bei nicht Stufenvariierbaren Sprüchen abfangen */
|
||||
if (!(sp->sptyp & SPELLLEVEL)) {
|
||||
int ilevel = eff_skill(u, SK_MAGIC, u->region);
|
||||
int ilevel = effskill(u, SK_MAGIC, 0);
|
||||
if (ilevel != level) {
|
||||
level = ilevel;
|
||||
ADDMSG(&u->faction->msgs, msg_message("spellfail::nolevel",
|
||||
|
@ -2674,7 +2674,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
"mage", caster));
|
||||
return 0;
|
||||
}
|
||||
if (distance(caster->region, r) > eff_skill(caster, SK_MAGIC, caster->region)) {
|
||||
if (distance(caster->region, r) > effskill(caster, SK_MAGIC, 0)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "familiar_toofar",
|
||||
"mage", caster));
|
||||
return 0;
|
||||
|
@ -2684,7 +2684,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
* löschen, zaubern kann er noch */
|
||||
range *= 2;
|
||||
set_order(&caster->thisorder, NULL);
|
||||
level = _min(level, eff_skill(caster, SK_MAGIC, caster->region) / 2);
|
||||
level = _min(level, effskill(caster, SK_MAGIC, 0) / 2);
|
||||
}
|
||||
}
|
||||
/* Weitere Argumente zusammenbasteln */
|
||||
|
|
|
@ -853,7 +853,7 @@ void plan_monsters(faction * f)
|
|||
/* Einheiten, die Waffenlosen Kampf lernen könnten, lernen es um
|
||||
* zu bewachen: */
|
||||
if (u_race(u)->bonus[SK_WEAPONLESS] != -99) {
|
||||
if (eff_skill(u, SK_WEAPONLESS, u->region) < 1) {
|
||||
if (effskill(u, SK_WEAPONLESS, 0) < 1) {
|
||||
long_order =
|
||||
create_order(K_STUDY, f->locale, "'%s'",
|
||||
skillname(SK_WEAPONLESS, f->locale));
|
||||
|
|
31
src/move.c
31
src/move.c
|
@ -251,7 +251,7 @@ static int ridingcapacity(unit * u)
|
|||
** tragen nichts (siehe walkingcapacity). Ein Wagen zählt nur, wenn er
|
||||
** von zwei Pferden gezogen wird */
|
||||
|
||||
animals = _min(animals, effskill(u, SK_RIDING) * u->number * 2);
|
||||
animals = _min(animals, effskill(u, SK_RIDING, 0) * u->number * 2);
|
||||
if (fval(u_race(u), RCF_HORSE))
|
||||
animals += u->number;
|
||||
|
||||
|
@ -275,7 +275,7 @@ int walkingcapacity(const struct unit *u)
|
|||
/* Das Gewicht, welches die Pferde tragen, plus das Gewicht, welches
|
||||
* die Leute tragen */
|
||||
|
||||
pferde_fuer_wagen = _min(animals, effskill(u, SK_RIDING) * u->number * 4);
|
||||
pferde_fuer_wagen = _min(animals, effskill(u, SK_RIDING, 0) * u->number * 4);
|
||||
if (fval(u_race(u), RCF_HORSE)) {
|
||||
animals += u->number;
|
||||
people = 0;
|
||||
|
@ -338,7 +338,7 @@ static int canwalk(unit * u)
|
|||
int maxwagen, maxpferde;
|
||||
int vehicles = 0, vcap = 0;
|
||||
int animals = 0, acap = 0;
|
||||
|
||||
int effsk;
|
||||
/* workaround: monsters are too stupid to drop items, therefore they have
|
||||
* infinite carrying capacity */
|
||||
|
||||
|
@ -347,11 +347,12 @@ static int canwalk(unit * u)
|
|||
|
||||
get_transporters(u->items, &animals, &acap, &vehicles, &vcap);
|
||||
|
||||
maxwagen = effskill(u, SK_RIDING) * u->number * 2;
|
||||
effsk = effskill(u, SK_RIDING, 0);
|
||||
maxwagen = effsk * u->number * 2;
|
||||
if (u_race(u) == get_race(RC_TROLL)) {
|
||||
maxwagen = _max(maxwagen, u->number / 4);
|
||||
}
|
||||
maxpferde = effskill(u, SK_RIDING) * u->number * 4 + u->number;
|
||||
maxpferde = effsk * u->number * 4 + u->number;
|
||||
|
||||
if (animals > maxpferde)
|
||||
return E_CANWALK_TOOMANYHORSES;
|
||||
|
@ -375,7 +376,7 @@ static int canwalk(unit * u)
|
|||
|
||||
bool canfly(unit * u)
|
||||
{
|
||||
if (i_get(u->items, it_find("pegasus")) >= u->number && effskill(u, SK_RIDING) >= 4)
|
||||
if (i_get(u->items, it_find("pegasus")) >= u->number && effskill(u, SK_RIDING, 0) >= 4)
|
||||
return true;
|
||||
|
||||
if (fval(u_race(u), RCF_FLY))
|
||||
|
@ -389,7 +390,7 @@ bool canfly(unit * u)
|
|||
|
||||
bool canswim(unit * u)
|
||||
{
|
||||
if (i_get(u->items, it_find("dolphin")) >= u->number && effskill(u, SK_RIDING) >= 4)
|
||||
if (i_get(u->items, it_find("dolphin")) >= u->number && effskill(u, SK_RIDING, 0) >= 4)
|
||||
return true;
|
||||
|
||||
if (u_race(u)->flags & RCF_FLY)
|
||||
|
@ -410,7 +411,7 @@ bool canswim(unit * u)
|
|||
static int canride(unit * u)
|
||||
{
|
||||
int horses = 0, maxhorses, unicorns = 0, maxunicorns;
|
||||
int skill = effskill(u, SK_RIDING);
|
||||
int skill = effskill(u, SK_RIDING, 0);
|
||||
item *itm;
|
||||
const item_type *it_horse, *it_elvenhorse, *it_charger;
|
||||
const resource_type *rtype;
|
||||
|
@ -483,7 +484,7 @@ static ship *do_maelstrom(region * r, unit * u)
|
|||
int damage;
|
||||
ship *sh = u->ship;
|
||||
|
||||
damage = rng_int() % 75 + rng_int() % 75 - eff_skill(u, SK_SAILING, r) * 4;
|
||||
damage = rng_int() % 75 + rng_int() % 75 - effskill(u, SK_SAILING, r) * 4;
|
||||
|
||||
if (damage <= 0) {
|
||||
return sh;
|
||||
|
@ -606,7 +607,7 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route)
|
|||
ulist = &u->next;
|
||||
u->ship = sh; /* undo the trick -- do not use u_set_ship here */
|
||||
}
|
||||
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
|
||||
if (route && effskill(u, SK_SAILING, from) >= 1) {
|
||||
produceexp(u, SK_SAILING, u->number);
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +740,7 @@ static void drifting_ships(region * r)
|
|||
continue;
|
||||
if (firstu == NULL)
|
||||
firstu = captain;
|
||||
if (eff_skill(captain, SK_SAILING, r) >= sh->type->cptskill) {
|
||||
if (effskill(captain, SK_SAILING, r) >= sh->type->cptskill) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -869,7 +870,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
|
|||
return NULL;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (is_guard(u, GUARD_TRAVELTHRU)) {
|
||||
int sk = eff_skill(u, SK_PERCEPTION, r);
|
||||
int sk = effskill(u, SK_PERCEPTION, r);
|
||||
if (invisible(reisender, u) >= reisender->number)
|
||||
continue;
|
||||
if (!(u_race(u)->flags & RCF_FLY) && u_race(reisender)->flags & RCF_FLY)
|
||||
|
@ -1717,7 +1718,7 @@ static bool ship_ready(const region * r, unit * u)
|
|||
cmistake(u, u->thisorder, 146, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
if (eff_skill(u, SK_SAILING, r) < u->ship->type->cptskill) {
|
||||
if (effskill(u, SK_SAILING, r) < u->ship->type->cptskill) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
|
||||
"error_captain_skill_low", "value ship", u->ship->type->cptskill,
|
||||
u->ship));
|
||||
|
@ -2060,11 +2061,11 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
|
|||
for (u2 = current_point->units; u2; u2 = u2->next) {
|
||||
if (u2->ship == sh && !alliedunit(harbourmaster, u->faction, HELP_GUARD)) {
|
||||
|
||||
if (effskill(harbourmaster, SK_PERCEPTION) > effskill(u2, SK_STEALTH)) {
|
||||
if (effskill(harbourmaster, SK_PERCEPTION, 0) > effskill(u2, SK_STEALTH, 0)) {
|
||||
for (itm = u2->items; itm; itm = itm->next) {
|
||||
const luxury_type *ltype = resource2luxury(itm->type->rtype);
|
||||
if (ltype != NULL && itm->number > 0) {
|
||||
int st = itm->number * effskill(harbourmaster, SK_TRADE) / 50;
|
||||
int st = itm->number * effskill(harbourmaster, SK_TRADE, 0) / 50;
|
||||
st = _min(itm->number, st);
|
||||
|
||||
if (st > 0) {
|
||||
|
|
|
@ -291,9 +291,9 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
}
|
||||
else {
|
||||
if (eff_skill(u, SK_LONGBOW, r) < 3
|
||||
&& eff_skill(u, SK_HERBALISM, r) < 2
|
||||
&& eff_skill(u, SK_MAGIC, r) < 2) {
|
||||
if (effskill(u, SK_LONGBOW, r) < 3
|
||||
&& effskill(u, SK_HERBALISM, r) < 2
|
||||
&& effskill(u, SK_MAGIC, r) < 2) {
|
||||
return;
|
||||
}
|
||||
name = "random_forest_men";
|
||||
|
@ -303,7 +303,7 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
|
||||
case T_SWAMP:
|
||||
if (eff_skill(u, SK_MELEE, r) <= 1) {
|
||||
if (effskill(u, SK_MELEE, r) <= 1) {
|
||||
return;
|
||||
}
|
||||
name = "random_swamp_men";
|
||||
|
@ -312,7 +312,7 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
|
||||
case T_DESERT:
|
||||
if (eff_skill(u, SK_RIDING, r) <= 2) {
|
||||
if (effskill(u, SK_RIDING, r) <= 2) {
|
||||
return;
|
||||
}
|
||||
name = "random_desert_men";
|
||||
|
@ -321,7 +321,7 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
|
||||
case T_HIGHLAND:
|
||||
if (eff_skill(u, SK_MELEE, r) <= 1) {
|
||||
if (effskill(u, SK_MELEE, r) <= 1) {
|
||||
return;
|
||||
}
|
||||
name = "random_highland_men";
|
||||
|
@ -330,7 +330,7 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
|
||||
case T_MOUNTAIN:
|
||||
if (eff_skill(u, SK_MELEE, r) <= 1 || eff_skill(u, SK_TRADE, r) <= 2) {
|
||||
if (effskill(u, SK_MELEE, r) <= 1 || effskill(u, SK_TRADE, r) <= 2) {
|
||||
return;
|
||||
}
|
||||
name = "random_mountain_men";
|
||||
|
@ -339,7 +339,7 @@ static void get_allies(region * r, unit * u)
|
|||
break;
|
||||
|
||||
case T_GLACIER:
|
||||
if (eff_skill(u, SK_MELEE, r) <= 1 || eff_skill(u, SK_TRADE, r) <= 1) {
|
||||
if (effskill(u, SK_MELEE, r) <= 1 || effskill(u, SK_TRADE, r) <= 1) {
|
||||
return;
|
||||
}
|
||||
name = "random_glacier_men";
|
||||
|
|
|
@ -420,7 +420,7 @@ const faction * viewer)
|
|||
const unit *u;
|
||||
for (u = r->units; visible != res->amount && u != NULL; u = u->next) {
|
||||
if (u->faction == viewer) {
|
||||
int s = eff_skill(u, itype->construction->skill, r);
|
||||
int s = effskill(u, itype->construction->skill, 0);
|
||||
if (s > maxskill) {
|
||||
maxskill = s;
|
||||
visible = res->type->visible(res, maxskill);
|
||||
|
@ -515,7 +515,7 @@ size_t size)
|
|||
bufp = STRLCPY(bufp, ", ", size);
|
||||
|
||||
if (u->faction != f && a_fshidden && a_fshidden->data.ca[0] == 1
|
||||
&& effskill(u, SK_STEALTH) >= 6) {
|
||||
&& effskill(u, SK_STEALTH, 0) >= 6) {
|
||||
bufp = STRLCPY(bufp, "? ", size);
|
||||
}
|
||||
else {
|
||||
|
@ -602,7 +602,7 @@ size_t size)
|
|||
show = u->items;
|
||||
}
|
||||
else if (!itemcloak && mode >= see_unit && !(a_fshidden
|
||||
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
|
||||
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH, 0) >= 3)) {
|
||||
int n = report_items(u->items, results, MAX_INVENTORY, u, f);
|
||||
assert(n >= 0);
|
||||
if (n > 0)
|
||||
|
@ -641,7 +641,7 @@ size_t size)
|
|||
|
||||
if (book) {
|
||||
quicklist *ql = book->spells;
|
||||
int qi, header, maxlevel = effskill(u, SK_MAGIC);
|
||||
int qi, header, maxlevel = effskill(u, SK_MAGIC, 0);
|
||||
int result = _snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u));
|
||||
if (wrptr(&bufp, &size, result) != 0) {
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -810,7 +810,7 @@ const struct unit * u, struct skill * sv, int *dh, int days)
|
|||
}
|
||||
}
|
||||
|
||||
effsk = effskill(u, sv->id);
|
||||
effsk = eff_skill(u, sv, 0);
|
||||
if (wrptr(&bufp, &size, _snprintf(bufp, size, "%d", effsk)) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ static void view_regatta(struct seen_region **seen, region * r, faction * f)
|
|||
int skill = 0;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->faction == f) {
|
||||
int es = effskill(u, SK_PERCEPTION);
|
||||
int es = effskill(u, SK_PERCEPTION, 0);
|
||||
if (es > skill)
|
||||
skill = es;
|
||||
}
|
||||
|
|
12
src/spells.c
12
src/spells.c
|
@ -2516,7 +2516,7 @@ static int sp_fumblecurse(castorder * co)
|
|||
target = pa->param[0]->data.u;
|
||||
|
||||
rx = rng_int() % 3;
|
||||
sx = cast_level - effskill(target, SK_MAGIC);
|
||||
sx = cast_level - effskill(target, SK_MAGIC, 0);
|
||||
duration = _max(sx, rx) + 1;
|
||||
|
||||
effect = force / 2;
|
||||
|
@ -3254,7 +3254,7 @@ static int sp_bloodsacrifice(castorder * co)
|
|||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
int aura;
|
||||
int skill = eff_skill(mage, SK_MAGIC, mage->region);
|
||||
int skill = effskill(mage, SK_MAGIC, 0);
|
||||
int hp = (int)(co->force * 8);
|
||||
|
||||
if (hp <= 0) {
|
||||
|
@ -3591,11 +3591,11 @@ static int sp_charmingsong(castorder * co)
|
|||
}
|
||||
/* Magieresistensbonus fuer hoehere Talentwerte */
|
||||
for (i = 0; i < MAXSKILLS; i++) {
|
||||
int sk = effskill(target, i);
|
||||
int sk = effskill(target, i, 0);
|
||||
if (tb < sk)
|
||||
tb = sk;
|
||||
}
|
||||
tb -= effskill(mage, SK_MAGIC);
|
||||
tb -= effskill(mage, SK_MAGIC, 0);
|
||||
if (tb > 0) {
|
||||
resist_bonus += tb * 15;
|
||||
}
|
||||
|
@ -4143,7 +4143,7 @@ static int sp_pump(castorder * co)
|
|||
create_unit(rt, mage->faction, RS_FARVISION, get_race(RC_SPELL), 0,
|
||||
"spell/pump", NULL);
|
||||
u->age = 2;
|
||||
set_level(u, SK_PERCEPTION, eff_skill(target, SK_PERCEPTION, u->region));
|
||||
set_level(u, SK_PERCEPTION, effskill(target, SK_PERCEPTION, 0));
|
||||
|
||||
return cast_level;
|
||||
}
|
||||
|
@ -4795,7 +4795,7 @@ int sp_dreamreading(castorder * co)
|
|||
"spell/dreamreading", NULL);
|
||||
set_number(u2, 1);
|
||||
u2->age = 2; /* Nur fuer diese Runde. */
|
||||
set_level(u2, SK_PERCEPTION, eff_skill(u, SK_PERCEPTION, u2->region));
|
||||
set_level(u2, SK_PERCEPTION, effskill(u, SK_PERCEPTION, u2->region));
|
||||
|
||||
msg =
|
||||
msg_message("sp_dreamreading_effect", "mage unit region", mage, u,
|
||||
|
|
24
src/spy.c
24
src/spy.c
|
@ -99,7 +99,7 @@ void spy_message(int spy, const unit * u, const unit * target)
|
|||
strncat(buf, (const char *)skillname((skill_t)sv->id, u->faction->locale),
|
||||
sizeof(buf) - 1);
|
||||
strncat(buf, " ", sizeof(buf) - 1);
|
||||
strncat(buf, itoa10(eff_skill(target, (skill_t)sv->id, target->region)),
|
||||
strncat(buf, itoa10(eff_skill(target, sv, target->region)),
|
||||
sizeof(buf) - 1);
|
||||
}
|
||||
}
|
||||
|
@ -134,14 +134,14 @@ int spy_cmd(unit * u, struct order *ord)
|
|||
cmistake(u, u->thisorder, 24, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
if (eff_skill(u, SK_SPY, r) < 1) {
|
||||
if (effskill(u, SK_SPY, 0) < 1) {
|
||||
cmistake(u, u->thisorder, 39, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
/* Die Grundchance fuer einen erfolgreichen Spionage-Versuch ist 10%.
|
||||
* Fuer jeden Talentpunkt, den das Spionagetalent das Tarnungstalent
|
||||
* des Opfers uebersteigt, erhoeht sich dieses um 5%*/
|
||||
spy = eff_skill(u, SK_SPY, r) - eff_skill(target, SK_STEALTH, r);
|
||||
spy = effskill(u, SK_SPY, 0) - effskill(target, SK_STEALTH, r);
|
||||
spychance = 0.1 + _max(spy * 0.05, 0.0);
|
||||
|
||||
if (chance(spychance)) {
|
||||
|
@ -154,8 +154,8 @@ int spy_cmd(unit * u, struct order *ord)
|
|||
|
||||
/* der Spion kann identifiziert werden, wenn das Opfer bessere
|
||||
* Wahrnehmung als das Ziel Tarnung + Spionage/2 hat */
|
||||
observe = eff_skill(target, SK_PERCEPTION, r)
|
||||
- (effskill(u, SK_STEALTH) + eff_skill(u, SK_SPY, r) / 2);
|
||||
observe = effskill(target, SK_PERCEPTION, r)
|
||||
- (effskill(u, SK_STEALTH, 0) + effskill(u, SK_SPY, 0) / 2);
|
||||
|
||||
if (invisible(u, target) >= u->number) {
|
||||
observe = _min(observe, 0);
|
||||
|
@ -164,8 +164,8 @@ int spy_cmd(unit * u, struct order *ord)
|
|||
/* Anschliessend wird - unabhaengig vom Erfolg - gewuerfelt, ob der
|
||||
* Spionageversuch bemerkt wurde. Die Wahrscheinlich dafuer ist (100 -
|
||||
* SpionageSpion*5 + WahrnehmungOpfer*2)%. */
|
||||
observechance = 1.0 - (eff_skill(u, SK_SPY, r) * 0.05)
|
||||
+ (eff_skill(target, SK_PERCEPTION, r) * 0.02);
|
||||
observechance = 1.0 - (effskill(u, SK_SPY, 0) * 0.05)
|
||||
+ (effskill(target, SK_PERCEPTION, 0) * 0.02);
|
||||
|
||||
if (chance(observechance)) {
|
||||
ADDMSG(&target->faction->msgs, msg_message("spydetect",
|
||||
|
@ -228,7 +228,7 @@ int setstealth_cmd(unit * u, struct order *ord)
|
|||
if (isdigit(s[0])) {
|
||||
/* Tarnungslevel setzen */
|
||||
level = atoi((const char *)s);
|
||||
if (level > effskill(u, SK_STEALTH)) {
|
||||
if (level > effskill(u, SK_STEALTH, 0)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_lowstealth", ""));
|
||||
return 0;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ static int top_skill(region * r, faction * f, ship * sh, skill_t sk)
|
|||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->ship == sh && u->faction == f) {
|
||||
int s = eff_skill(u, sk, r);
|
||||
int s = effskill(u, sk, 0);
|
||||
value = _max(s, value);
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,6 @@ int sabotage_cmd(unit * u, struct order *ord)
|
|||
param_t p;
|
||||
ship *sh;
|
||||
unit *u2;
|
||||
region *r;
|
||||
int skdiff = INT_MAX;
|
||||
|
||||
assert(u);
|
||||
|
@ -517,13 +516,12 @@ int sabotage_cmd(unit * u, struct order *ord)
|
|||
return 0;
|
||||
}
|
||||
u2 = ship_owner(sh);
|
||||
r = u->region;
|
||||
if (u2->faction != u->faction) {
|
||||
skdiff =
|
||||
eff_skill(u, SK_SPY, r) - top_skill(r, u2->faction, sh, SK_PERCEPTION);
|
||||
effskill(u, SK_SPY, 0) - top_skill(u->region, u2->faction, sh, SK_PERCEPTION);
|
||||
}
|
||||
if (try_destruction(u, u2, sh, skdiff)) {
|
||||
sink_ship(r, sh, u);
|
||||
sink_ship(u->region, sh, u);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
18
src/study.c
18
src/study.c
|
@ -347,8 +347,7 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
sk = teachskill[i];
|
||||
}
|
||||
if (sk != NOSKILL
|
||||
&& eff_skill_study(u, sk,
|
||||
r) - TEACHDIFFERENCE > eff_skill_study(student, sk, r)) {
|
||||
&& effskill_study(u, sk, 0) - TEACHDIFFERENCE > effskill_study(student, sk, 0)) {
|
||||
teaching -= teach_unit(u, student, teaching, sk, true, &academy);
|
||||
}
|
||||
}
|
||||
|
@ -366,8 +365,7 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
init_order(student->thisorder);
|
||||
sk = getskill(student->faction->locale);
|
||||
if (sk != NOSKILL
|
||||
&& eff_skill_study(u, sk, r) - TEACHDIFFERENCE >= eff_skill(student,
|
||||
sk, r)) {
|
||||
&& effskill_study(u, sk, 0) - TEACHDIFFERENCE >= effskill(student, sk, 0)) {
|
||||
teaching -= teach_unit(u, student, teaching, sk, true, &academy);
|
||||
}
|
||||
}
|
||||
|
@ -454,8 +452,8 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
/* u is teacher, u2 is student */
|
||||
if (eff_skill_study(u2, sk, r) > eff_skill_study(u, sk,
|
||||
r) - TEACHDIFFERENCE) {
|
||||
if (effskill_study(u2, sk, 0) > effskill_study(u, sk, 0)
|
||||
- TEACHDIFFERENCE) {
|
||||
if (feedback) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "teach_asgood",
|
||||
"student", u2));
|
||||
|
@ -565,7 +563,7 @@ int study_cmd(unit * u, order * ord)
|
|||
cmistake(u, ord, 77, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) {
|
||||
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk, 0)) {
|
||||
cmistake(u, ord, 771, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
|
@ -684,7 +682,7 @@ int study_cmd(unit * u, order * ord)
|
|||
}
|
||||
}
|
||||
if (sk == SK_ALCHEMY) {
|
||||
maxalchemy = eff_skill(u, SK_ALCHEMY, r);
|
||||
maxalchemy = effskill(u, SK_ALCHEMY, 0);
|
||||
if (!has_skill(u, SK_ALCHEMY)) {
|
||||
int amax = skill_limit(u->faction, SK_ALCHEMY);
|
||||
if (count_skill(u->faction, SK_ALCHEMY) + u->number > amax) {
|
||||
|
@ -779,7 +777,7 @@ int study_cmd(unit * u, order * ord)
|
|||
if (feedback) {
|
||||
ADDMSG(&teacher->faction->msgs, msg_message("teach_teacher",
|
||||
"teacher student skill level", teacher, u, sk,
|
||||
effskill(u, sk)));
|
||||
effskill(u, sk, 0)));
|
||||
}
|
||||
ADDMSG(&u->faction->msgs, msg_message("teach_student",
|
||||
"teacher student skill", teacher, u, sk));
|
||||
|
@ -796,7 +794,7 @@ int study_cmd(unit * u, order * ord)
|
|||
if (sk == SK_ALCHEMY) {
|
||||
const potion_type *ptype;
|
||||
faction *f = u->faction;
|
||||
int skill = eff_skill(u, SK_ALCHEMY, r);
|
||||
int skill = effskill(u, SK_ALCHEMY, 0);
|
||||
if (skill > maxalchemy) {
|
||||
for (ptype = potiontypes; ptype; ptype = ptype->next) {
|
||||
if (skill == ptype->level * 2) {
|
||||
|
|
|
@ -440,7 +440,7 @@ summary *make_summary(void)
|
|||
|
||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||
skill_t sk = sv->id;
|
||||
int aktskill = eff_skill(u, sk, r);
|
||||
int aktskill = effskill(u, sk, r);
|
||||
if (aktskill > s->maxskill)
|
||||
s->maxskill = aktskill;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue