forked from github/server
Merge pull request #409 from ennorehling/develop
delete two old, unused features
This commit is contained in:
commit
190bdccc71
5 changed files with 18 additions and 48 deletions
30
src/battle.c
30
src/battle.c
|
@ -128,8 +128,8 @@ const troop no_troop = { 0, 0 };
|
||||||
#define DAMAGE_SKILL_BONUS (1<<4)
|
#define DAMAGE_SKILL_BONUS (1<<4)
|
||||||
|
|
||||||
static int max_turns;
|
static int max_turns;
|
||||||
static int damage_rules;
|
static int rule_damage;
|
||||||
static int loot_rules;
|
static int rule_loot;
|
||||||
static int skill_formula;
|
static int skill_formula;
|
||||||
static int rule_cavalry_skill;
|
static int rule_cavalry_skill;
|
||||||
static int rule_population_damage;
|
static int rule_population_damage;
|
||||||
|
@ -157,7 +157,7 @@ static void init_rules(void)
|
||||||
rule_anon_battle = config_get_int("rules.stealth.anon_battle", 1) != 0;
|
rule_anon_battle = config_get_int("rules.stealth.anon_battle", 1) != 0;
|
||||||
rule_cavalry_mode = config_get_int("rules.cavalry.mode", 1);
|
rule_cavalry_mode = config_get_int("rules.cavalry.mode", 1);
|
||||||
rule_cavalry_skill = config_get_int("rules.cavalry.skill", 2);
|
rule_cavalry_skill = config_get_int("rules.cavalry.skill", 2);
|
||||||
loot_rules = config_get_int("rules.combat.loot",
|
rule_loot = config_get_int("rules.combat.loot",
|
||||||
LOOT_MONSTERS | LOOT_OTHERS | LOOT_KEEPLOOT);
|
LOOT_MONSTERS | LOOT_OTHERS | LOOT_KEEPLOOT);
|
||||||
/* new formula to calculate to-hit-chance */
|
/* new formula to calculate to-hit-chance */
|
||||||
skill_formula = config_get_int("rules.combat.skill_formula",
|
skill_formula = config_get_int("rules.combat.skill_formula",
|
||||||
|
@ -166,16 +166,16 @@ static void init_rules(void)
|
||||||
max_turns = config_get_int("rules.combat.turns", COMBAT_TURNS);
|
max_turns = config_get_int("rules.combat.turns", COMBAT_TURNS);
|
||||||
/* damage calculation */
|
/* damage calculation */
|
||||||
if (config_get_int("rules.combat.critical", 1)) {
|
if (config_get_int("rules.combat.critical", 1)) {
|
||||||
damage_rules |= DAMAGE_CRITICAL;
|
rule_damage |= DAMAGE_CRITICAL;
|
||||||
}
|
}
|
||||||
if (config_get_int("rules.combat.melee_bonus", 1)) {
|
if (config_get_int("rules.combat.melee_bonus", 1)) {
|
||||||
damage_rules |= DAMAGE_MELEE_BONUS;
|
rule_damage |= DAMAGE_MELEE_BONUS;
|
||||||
}
|
}
|
||||||
if (config_get_int("rules.combat.missile_bonus", 1)) {
|
if (config_get_int("rules.combat.missile_bonus", 1)) {
|
||||||
damage_rules |= DAMAGE_MISSILE_BONUS;
|
rule_damage |= DAMAGE_MISSILE_BONUS;
|
||||||
}
|
}
|
||||||
if (config_get_int("rules.combat.skill_bonus", 1)) {
|
if (config_get_int("rules.combat.skill_bonus", 1)) {
|
||||||
damage_rules |= DAMAGE_SKILL_BONUS;
|
rule_damage |= DAMAGE_SKILL_BONUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != AT_COMBATSPELL && type != AT_SPELL) {
|
if (type != AT_COMBATSPELL && type != AT_SPELL) {
|
||||||
if (damage_rules & DAMAGE_CRITICAL) {
|
if (rule_damage & DAMAGE_CRITICAL) {
|
||||||
double kritchance = (sk * 3 - sd) / 200.0;
|
double kritchance = (sk * 3 - sd) / 200.0;
|
||||||
|
|
||||||
kritchance = _max(kritchance, 0.005);
|
kritchance = _max(kritchance, 0.005);
|
||||||
|
@ -1240,19 +1240,19 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
||||||
|
|
||||||
if (awtype != NULL && fval(awtype, WTF_MISSILE)) {
|
if (awtype != NULL && fval(awtype, WTF_MISSILE)) {
|
||||||
/* missile weapon bonus */
|
/* missile weapon bonus */
|
||||||
if (damage_rules & DAMAGE_MISSILE_BONUS) {
|
if (rule_damage & DAMAGE_MISSILE_BONUS) {
|
||||||
da += af->person[at.index].damage_rear;
|
da += af->person[at.index].damage_rear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* melee bonus */
|
/* melee bonus */
|
||||||
if (damage_rules & DAMAGE_MELEE_BONUS) {
|
if (rule_damage & DAMAGE_MELEE_BONUS) {
|
||||||
da += af->person[at.index].damage;
|
da += af->person[at.index].damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skilldifferenzbonus */
|
/* Skilldifferenzbonus */
|
||||||
if (damage_rules & DAMAGE_SKILL_BONUS) {
|
if (rule_damage & DAMAGE_SKILL_BONUS) {
|
||||||
da += _max(0, (sk - sd) / DAMAGE_QUOTIENT);
|
da += _max(0, (sk - sd) / DAMAGE_QUOTIENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2577,20 +2577,20 @@ static void loot_items(fighter * corpse)
|
||||||
itm->number -= loot;
|
itm->number -= loot;
|
||||||
maxloot -= loot;
|
maxloot -= loot;
|
||||||
|
|
||||||
if (is_monsters(u->faction) && (loot_rules & LOOT_MONSTERS)) {
|
if (is_monsters(u->faction) && (rule_loot & LOOT_MONSTERS)) {
|
||||||
looting = 1;
|
looting = 1;
|
||||||
}
|
}
|
||||||
else if (loot_rules & LOOT_OTHERS) {
|
else if (rule_loot & LOOT_OTHERS) {
|
||||||
looting = 1;
|
looting = 1;
|
||||||
}
|
}
|
||||||
else if (loot_rules & LOOT_SELF) {
|
else if (rule_loot & LOOT_SELF) {
|
||||||
looting = 2;
|
looting = 2;
|
||||||
}
|
}
|
||||||
if (looting) {
|
if (looting) {
|
||||||
if (mustloot) {
|
if (mustloot) {
|
||||||
maxrow = LAST_ROW;
|
maxrow = LAST_ROW;
|
||||||
}
|
}
|
||||||
else if (loot_rules & LOOT_KEEPLOOT) {
|
else if (rule_loot & LOOT_KEEPLOOT) {
|
||||||
int lootchance = 50 + b->keeploot;
|
int lootchance = 50 + b->keeploot;
|
||||||
if (rng_int() % 100 < lootchance) {
|
if (rng_int() % 100 < lootchance) {
|
||||||
maxrow = BEHIND_ROW;
|
maxrow = BEHIND_ROW;
|
||||||
|
|
|
@ -213,12 +213,6 @@ int LongHunger(const struct unit *u)
|
||||||
return config_get_int("hunger.long", 0);
|
return config_get_int("hunger.long", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkillCap(skill_t sk)
|
|
||||||
{
|
|
||||||
if (sk == SK_MAGIC) return 0; /* no caps on magic */
|
|
||||||
return config_get_int("skill.maxlevel", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int NMRTimeout(void)
|
int NMRTimeout(void)
|
||||||
{
|
{
|
||||||
return config_get_int("nmr.timeout", 0);
|
return config_get_int("nmr.timeout", 0);
|
||||||
|
|
|
@ -1323,7 +1323,6 @@ int get_modifier(const unit * u, skill_t sk, int level, const region * r, bool n
|
||||||
{
|
{
|
||||||
int bskill = level;
|
int bskill = level;
|
||||||
int skill = bskill;
|
int skill = bskill;
|
||||||
int hunger_red_skill = -1;
|
|
||||||
|
|
||||||
if (r && sk == SK_STEALTH) {
|
if (r && sk == SK_STEALTH) {
|
||||||
plane *pl = rplane(r);
|
plane *pl = rplane(r);
|
||||||
|
@ -1342,12 +1341,8 @@ int get_modifier(const unit * u, skill_t sk, int level, const region * r, bool n
|
||||||
#endif
|
#endif
|
||||||
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
||||||
|
|
||||||
if (hunger_red_skill == -1) {
|
if (fval(u, UFL_HUNGER)) {
|
||||||
hunger_red_skill = config_get_int("rules.hunger.reduces_skill", 2);
|
if (sk == SK_SAILING && skill > 2) {
|
||||||
}
|
|
||||||
|
|
||||||
if (fval(u, UFL_HUNGER) && hunger_red_skill) {
|
|
||||||
if (sk == SK_SAILING && skill > 2 && hunger_red_skill == 2) {
|
|
||||||
skill = skill - 1;
|
skill = skill - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1365,10 +1360,6 @@ int eff_skill(const unit * u, const skill *sv, const region *r)
|
||||||
int mlevel = sv->level + get_modifier(u, sv->id, sv->level, r, false);
|
int mlevel = sv->level + get_modifier(u, sv->id, sv->level, r, false);
|
||||||
|
|
||||||
if (mlevel > 0) {
|
if (mlevel > 0) {
|
||||||
int skillcap = SkillCap(sv->id);
|
|
||||||
if (skillcap>0 && mlevel > skillcap) {
|
|
||||||
return skillcap;
|
|
||||||
}
|
|
||||||
return mlevel;
|
return mlevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,16 +283,6 @@ static void test_skill_hunger(CuTest *tc) {
|
||||||
set_level(u, SK_ARMORER, 6);
|
set_level(u, SK_ARMORER, 6);
|
||||||
set_level(u, SK_SAILING, 6);
|
set_level(u, SK_SAILING, 6);
|
||||||
fset(u, UFL_HUNGER);
|
fset(u, UFL_HUNGER);
|
||||||
|
|
||||||
config_set("rules.hunger.reduces_skill", "0");
|
|
||||||
CuAssertIntEquals(tc, 6, effskill(u, SK_ARMORER, 0));
|
|
||||||
CuAssertIntEquals(tc, 6, effskill(u, SK_SAILING, 0));
|
|
||||||
|
|
||||||
config_set("rules.hunger.reduces_skill", "1");
|
|
||||||
CuAssertIntEquals(tc, 3, effskill(u, SK_ARMORER, 0));
|
|
||||||
CuAssertIntEquals(tc, 3, effskill(u, SK_SAILING, 0));
|
|
||||||
|
|
||||||
config_set("rules.hunger.reduces_skill", "2");
|
|
||||||
CuAssertIntEquals(tc, 3, effskill(u, SK_ARMORER, 0));
|
CuAssertIntEquals(tc, 3, effskill(u, SK_ARMORER, 0));
|
||||||
CuAssertIntEquals(tc, 5, effskill(u, SK_SAILING, 0));
|
CuAssertIntEquals(tc, 5, effskill(u, SK_SAILING, 0));
|
||||||
set_level(u, SK_SAILING, 2);
|
set_level(u, SK_SAILING, 2);
|
||||||
|
|
|
@ -535,7 +535,7 @@ static double study_speedup(unit * u, skill_t s, study_rule_t rule)
|
||||||
int study_cmd(unit * u, order * ord)
|
int study_cmd(unit * u, order * ord)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
int p, cap;
|
int p;
|
||||||
magic_t mtyp;
|
magic_t mtyp;
|
||||||
int l;
|
int l;
|
||||||
int studycost, days;
|
int studycost, days;
|
||||||
|
@ -563,11 +563,6 @@ int study_cmd(unit * u, order * ord)
|
||||||
cmistake(u, ord, 77, MSG_EVENT);
|
cmistake(u, ord, 77, MSG_EVENT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cap = SkillCap(sk);
|
|
||||||
if (cap > 0 && cap <= effskill(u, sk, 0)) {
|
|
||||||
cmistake(u, ord, 771, MSG_EVENT);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* Hack: Talente mit Malus -99 koennen nicht gelernt werden */
|
/* Hack: Talente mit Malus -99 koennen nicht gelernt werden */
|
||||||
if (u_race(u)->bonus[sk] == -99) {
|
if (u_race(u)->bonus[sk] == -99) {
|
||||||
cmistake(u, ord, 771, MSG_EVENT);
|
cmistake(u, ord, 771, MSG_EVENT);
|
||||||
|
|
Loading…
Reference in a new issue