From afbc4c816bc98bb4de7d9559b91e388d2f745ca1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 17 Apr 2015 16:31:52 +0200 Subject: [PATCH] refactoring ship speed, extract total skills of sailors into a function. --- res/core/de/strings.xml | 9 ++--- src/kernel/ship.c | 4 -- src/kernel/unit.c | 2 +- src/spells.c | 2 +- src/spy.c | 81 +++++++++++++++++++++-------------------- 5 files changed, 48 insertions(+), 50 deletions(-) diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index cd5dac609..d5b6dba34 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -5854,11 +5854,10 @@ das 50fache und auch im Kampf werden sich die erhöhte Kraft und die trollisch zähe Haut positiv auswirken. - This artifact gives the one wearing it + This artifact gives the wearer the strength of a cavetroll. He will be able to - carry fifty times as much as normal and also in - combat his enhanced strength and tough troll - skin will serve him well. + carry fifty times his normal load, as well as + gain strength and tough troll skin in combat. Der Schwarzmagier kann mit diesem @@ -5868,7 +5867,7 @@ Region werden einen Großteil ihrer Aura verlieren. With this dark ritual the - chaossorcerer causes a deep rift to appear in + chaos sorcerer causes a deep rift to appear in the astral balance that will tear all magical power from a region. All spellcasters in that region will lose most of their aura. diff --git a/src/kernel/ship.c b/src/kernel/ship.c index dfb840179..c95f85da5 100644 --- a/src/kernel/ship.c +++ b/src/kernel/ship.c @@ -348,10 +348,6 @@ int shipspeed(const ship * sh, const unit * u) c = c->nexthash; } -#ifdef SHIPSPEED - k *= SHIPSPEED; -#endif - if (sh->damage>0) { int size = sh->size * DAMAGE_SCALE; k *= (size - sh->damage); diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 310a407bd..b2601e75e 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1807,7 +1807,7 @@ void scale_number(unit * u, int n) const struct race *u_irace(const struct unit *u) { - if (u->irace && skill_enabled(SK_STEALTH)) { + if (u->irace) { return u->irace; } return u->_race; diff --git a/src/spells.c b/src/spells.c index e811967bd..8b504487a 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4582,7 +4582,7 @@ int sp_illusionary_shapeshift(castorder * co) irace = u_irace(u); if (irace == u_race(u)) { trigger *trestore = trigger_changerace(u, NULL, irace); - add_trigger(&u->attribs, "timer", trigger_timeout((int)power + 2, + add_trigger(&u->attribs, "timer", trigger_timeout((int)power + 3, trestore)); u->irace = rc; } diff --git a/src/spy.c b/src/spy.c index d993a9ab7..8264fcabf 100644 --- a/src/spy.c +++ b/src/spy.c @@ -214,7 +214,6 @@ int setstealth_cmd(unit * u, struct order *ord) char token[64]; const char *s; int level, rule; - const race *trace; init_order(ord); s = gettoken(token, sizeof(token)); @@ -237,47 +236,51 @@ int setstealth_cmd(unit * u, struct order *ord) return 0; } - trace = findrace(s, u->faction->locale); - if (trace) { - /* demons can cloak as other player-races */ - if (u_race(u) == get_race(RC_DAEMON)) { - race_t allowed[] = { RC_DWARF, RC_ELF, RC_ORC, RC_GOBLIN, RC_HUMAN, - RC_TROLL, RC_DAEMON, RC_INSECT, RC_HALFLING, RC_CAT, RC_AQUARIAN, - NORACE - }; - int i; - for (i = 0; allowed[i] != NORACE; ++i) - if (get_race(allowed[i]) == trace) - break; - if (get_race(allowed[i]) == trace) { - u->irace = trace; - if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs)) - set_racename(&u->attribs, NULL); + if (skill_enabled(SK_STEALTH)) { /* hack! E3 erlaubt keine Tarnung */ + const race *trace; + + trace = findrace(s, u->faction->locale); + if (trace) { + /* demons can cloak as other player-races */ + if (u_race(u) == get_race(RC_DAEMON)) { + race_t allowed[] = { RC_DWARF, RC_ELF, RC_ORC, RC_GOBLIN, RC_HUMAN, + RC_TROLL, RC_DAEMON, RC_INSECT, RC_HALFLING, RC_CAT, RC_AQUARIAN, + NORACE + }; + int i; + for (i = 0; allowed[i] != NORACE; ++i) + if (get_race(allowed[i]) == trace) + break; + if (get_race(allowed[i]) == trace) { + u->irace = trace; + if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs)) + set_racename(&u->attribs, NULL); + } + return 0; + } + + /* Singdrachen koennen sich nur als Drachen tarnen */ + if (u_race(u) == get_race(RC_SONGDRAGON) + || u_race(u) == get_race(RC_BIRTHDAYDRAGON)) { + if (trace == get_race(RC_SONGDRAGON) || trace == get_race(RC_FIREDRAGON) + || trace == get_race(RC_DRAGON) || trace == get_race(RC_WYRM)) { + u->irace = trace; + if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs)) + set_racename(&u->attribs, NULL); + } + return 0; + } + + /* Daemomen und Illusionsparteien koennen sich als andere race tarnen */ + if (u_race(u)->flags & RCF_SHAPESHIFT) { + if (playerrace(trace)) { + u->irace = trace; + if ((u_race(u)->flags & RCF_SHAPESHIFTANY) && get_racename(u->attribs)) + set_racename(&u->attribs, NULL); + } } return 0; } - - /* Singdrachen koennen sich nur als Drachen tarnen */ - if (u_race(u) == get_race(RC_SONGDRAGON) - || u_race(u) == get_race(RC_BIRTHDAYDRAGON)) { - if (trace == get_race(RC_SONGDRAGON) || trace == get_race(RC_FIREDRAGON) - || trace == get_race(RC_DRAGON) || trace == get_race(RC_WYRM)) { - u->irace = trace; - if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs)) - set_racename(&u->attribs, NULL); - } - return 0; - } - - /* Daemomen und Illusionsparteien koennen sich als andere race tarnen */ - if (u_race(u)->flags & RCF_SHAPESHIFT) { - if (playerrace(trace)) { - u->irace = trace; - if ((u_race(u)->flags & RCF_SHAPESHIFTANY) && get_racename(u->attribs)) - set_racename(&u->attribs, NULL); - } - } - return 0; } switch (findparam(s, u->faction->locale)) {