forked from github/server
fix https://bugs.eressea.de/view.php?id=2164 (ships get no damage when they drift).
simplify attack_chance configuration, set it only once. this way, I can more easily fudge it to 1.0 in the debugger.
This commit is contained in:
parent
d07f359acb
commit
c7ab0e8f59
|
@ -23,7 +23,6 @@
|
|||
"world.era": 2,
|
||||
"seed.population.min": 8,
|
||||
"seed.population.max": 8,
|
||||
"rules.ship.damage_drift": 0.00,
|
||||
"rules.reserve.twophase": true,
|
||||
"rules.give.max_men": -1,
|
||||
"rules.check_overload": false,
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
"rules.stealth.anon_battle": false,
|
||||
"rules.check_overload": false,
|
||||
"rules.combat.goblinbonus": 3,
|
||||
"rules.ship.damage_drift": 0.00,
|
||||
"rules.alliances": true,
|
||||
"rules.combat.herospeed": 3,
|
||||
"rules.combat.demon_vampire": 5,
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
"rules.stealth.anon_battle": false,
|
||||
"rules.check_overload": false,
|
||||
"rules.combat.goblinbonus": 3,
|
||||
"rules.ship.damage_drift": 0.00,
|
||||
"rules.alliances": true,
|
||||
"rules.combat.herospeed": 3,
|
||||
"rules.combat.demon_vampire": 5,
|
||||
|
|
|
@ -75,16 +75,14 @@
|
|||
#define DRAGON_RANGE 20 /* Max. Distanz zum nächsten Drachenziel */
|
||||
#define MAXILLUSION_TEXTS 3
|
||||
|
||||
static double attack_chance; /* rules.monsters.attack_chance, or default 0.4 */
|
||||
|
||||
static void give_peasants(unit *u, const item_type *itype, int reduce) {
|
||||
char buf[64];
|
||||
slprintf(buf, sizeof(buf), "%s 0 %d %s", LOC(u->faction->locale, keyword(K_GIVE)), reduce, LOC(u->faction->locale, itype->rtype->_name));
|
||||
unit_addorder(u, parse_order(buf, u->faction->locale));
|
||||
}
|
||||
|
||||
static double monster_attack_chance(void) {
|
||||
return get_param_flt(global.parameters, "rules.monsters.attack_chance", 0.4f);
|
||||
}
|
||||
|
||||
static void reduce_weight(unit * u)
|
||||
{
|
||||
int capacity, weight = 0;
|
||||
|
@ -160,7 +158,7 @@ static order *monster_attack(unit * u, const unit * target)
|
|||
static order *get_money_for_dragon(region * r, unit * u, int wanted)
|
||||
{
|
||||
int n;
|
||||
bool attacks = monster_attack_chance() > 0.0;
|
||||
bool attacks = attack_chance > 0.0;
|
||||
|
||||
/* falls genug geld in der region ist, treiben wir steuern ein. */
|
||||
if (rmoney(r) >= wanted) {
|
||||
|
@ -759,14 +757,13 @@ static order *plan_dragon(unit * u)
|
|||
void plan_monsters(faction * f)
|
||||
{
|
||||
region *r;
|
||||
double attack_chance = monster_attack_chance();
|
||||
|
||||
assert(f);
|
||||
attack_chance = get_param_flt(global.parameters, "rules.monsters.attack_chance", 0.4);
|
||||
f->lastorders = turn;
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
double rchance = attack_chance;
|
||||
bool attacking = false;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
|
@ -785,10 +782,8 @@ void plan_monsters(faction * f)
|
|||
produceexp(u, SK_PERCEPTION, u->number);
|
||||
}
|
||||
|
||||
if (rchance > 0.0) {
|
||||
if (chance(rchance))
|
||||
attacking = true;
|
||||
rchance = 0.0;
|
||||
if (!attacking) {
|
||||
if (chance(attack_chance)) attacking = true;
|
||||
}
|
||||
if (u->status > ST_BEHIND) {
|
||||
setstatus(u, ST_FIGHT);
|
||||
|
|
|
@ -260,7 +260,7 @@ int findtoken(const void * root, const char *key, variant * result)
|
|||
ref = ref->nexthash;
|
||||
str += len;
|
||||
if (!ref) {
|
||||
log_info("findtoken | token not found '%s'\n", key);
|
||||
log_debug("findtoken | token not found '%s'\n", key);
|
||||
return E_TOK_NOMATCH;
|
||||
}
|
||||
tk = ref->node;
|
||||
|
@ -269,6 +269,6 @@ int findtoken(const void * root, const char *key, variant * result)
|
|||
*result = tk->id;
|
||||
return E_TOK_SUCCESS;
|
||||
}
|
||||
log_info("findtoken | token not found '%s'\n", key);
|
||||
log_debug("findtoken | token not found '%s'\n", key);
|
||||
return E_TOK_NOMATCH;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue