From bdbffba68ec76d498915e27da75cd24f5711b949 Mon Sep 17 00:00:00 2001 From: CTD Date: Thu, 14 Aug 2014 02:06:24 +0200 Subject: [PATCH 1/3] Fixing Merge conflict --- src/laws.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/laws.c b/src/laws.c index dcee77f0a..400a5ff5d 100755 --- a/src/laws.c +++ b/src/laws.c @@ -4626,12 +4626,12 @@ void init_processor(void) } p += 10; /* can't allow reserve before siege (weapons) */ - if (get_param_int(global.parameters, "rules.reserve.twophase", 0)) { - add_proc_order(p, K_RESERVE, &reserve_self, 0, "Selbst_Reservieren"); - p += 10; - } - add_proc_region(p, &enter_1, "Betreten (3. Versuch)"); /* to claim a castle after a victory and to be able to DESTROY it in the same turn */ - add_proc_order(p, K_RESERVE, &reserve_cmd, 0, "Reservieren"); + add_proc_region(p, &enter_1, "Betreten (3. Versuch)"); /* to claim a castle after a victory and to be able to DESTROY it in the same turn */ + if (get_param_int(global.parameters, "rules.reserve.twophase", 0)) { + add_proc_order(p, K_RESERVE, &reserve_self, 0, "RESERVE (self)"); + p += 10; + } + add_proc_order(p, K_RESERVE, &reserve_cmd, 0, "RESERVE (all)"); add_proc_order(p, K_CLAIM, &claim_cmd, 0, NULL); add_proc_unit(p, &follow_unit, "Folge auf Einheiten setzen"); From 7dd86959a922bd3b3cc8ddbd9a28cd09a4775199 Mon Sep 17 00:00:00 2001 From: CTD Date: Thu, 14 Aug 2014 12:37:59 +0200 Subject: [PATCH 2/3] Bewegung durch Region blockieren MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Etwas größerer Umbau. Befreundete Wachen erlauben nicht mehr automatisch die Durchreise. Es werden sowohl die Befreundeten als auch die Feindlichen Bewacher in der Region gezählt, und die Differenz mit rules.guard.guard_number_stop_prob multipliziert. Bei 700 Feindlichen und keinen freundlichen Wachen ist die Chance dann 100%. Bei 100 Feindlichen und 400 freundlichen ist sie 0. Zusätzlich gibt rules.guard.castle_stop_prob 10% pro Burgenlevel für den Burgenbesitzer. rules.guard.region_type_stop_prob gibt 10% für Regionen mit weniger Begehbaren Pfaden (Berge und Vulkane) und das doppelte für sehr schwer passierbare Regionen (Sümpfe und Gletscher). Für Spiele mit Wahrnehmung (E2) sollten die Werte für: rules.guard.skill_stop_prob rules.guard.castle_stop_prob rules.guard.region_type_stop_prob auf 5% Angepasst werden. --- src/kernel/move.c | 52 +++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/kernel/move.c b/src/kernel/move.c index bbf2051f2..9912ad4a6 100644 --- a/src/kernel/move.c +++ b/src/kernel/move.c @@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "ship.h" #include "skill.h" #include "terrain.h" +#include "terrainid.h" #include "teleport.h" #include "unit.h" @@ -839,48 +840,48 @@ static void caught_target(region * r, unit * u) } } -/* TODO: Unsichtbarkeit bedenken ! */ - static unit *bewegung_blockiert_von(unit * reisender, region * r) { unit *u; double prob = 0.0; - bool contact = false; unit *guard = NULL; + int guard_count = 0; int stealth = eff_stealth(reisender, r); static int gamecookie = -1; static double base_prob = -999; static double skill_prob = -999; static double amulet_prob = -999; + static double guard_number_prob = -999; + static double castle_prob = -999; + static double region_type_prob = -999; const struct resource_type *ramulet = get_resourcetype(R_AMULET_OF_TRUE_SEEING); if (gamecookie < 0 || gamecookie != global.cookie) { - base_prob = - get_param_flt(global.parameters, "rules.guard.base_stop_prob", .3f); - skill_prob = - get_param_flt(global.parameters, "rules.guard.skill_stop_prob", .1f); - amulet_prob = - get_param_flt(global.parameters, "rules.guard.amulet_stop_prob", .1f); + base_prob = get_param_flt(global.parameters, "rules.guard.base_stop_prob", .3f); + skill_prob = get_param_flt(global.parameters, "rules.guard.skill_stop_prob", .1f); + amulet_prob = get_param_flt(global.parameters, "rules.guard.amulet_stop_prob", .1f); + guard_number_prob = get_param_flt(global.parameters, "rules.guard.guard_number_stop_prob", .001f); + castle_prob = get_param_flt(global.parameters, "rules.guard.castle_stop_prob", .1f); + region_type_prob = get_param_flt(global.parameters, "rules.guard.region_type_stop_prob", .1f); gamecookie = global.cookie; } if (fval(u_race(reisender), RCF_ILLUSIONARY)) return NULL; - for (u = r->units; u && !contact; u = u->next) { + for (u = r->units; u; u = u->next) { if (is_guard(u, GUARD_TRAVELTHRU)) { int sk = eff_skill(u, SK_PERCEPTION, r); if (invisible(reisender, u) >= reisender->number) continue; - if (u->faction == reisender->faction) - contact = true; - else if (ucontact(u, reisender)) - contact = true; - else if (alliedunit(u, reisender->faction, HELP_GUARD)) - contact = true; + if ((u->faction == reisender->faction) || (ucontact(u, reisender)) || (alliedunit(u, reisender->faction, HELP_GUARD))) + guard_count = guard_count - u->number; else if (sk >= stealth) { + guard_count =+ u->number; double prob_u = (sk - stealth) * skill_prob; /* amulet counts at most once */ - prob_u += _min(1, _min(u->number, i_get(u->items, ramulet->itype))) * amulet_prob; + prob_u += _min (1, _min(u->number, i_get(u->items, ramulet->itype))) * amulet_prob; + if (u->building && (u->building->type == bt_find("castle")) && u == building_owner(u->building)) + prob_u += castle_prob*buildingeffsize(u->building, 0); if (prob_u >= prob) { prob = prob_u; guard = u; @@ -888,14 +889,25 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r) } } } - if (!contact && guard) { + if (guard) { prob += base_prob; /* 30% base chance */ + prob = +guard_count*guard_number_prob; + if (r->terrain = newterrain(T_GLACIER)) + prob = +region_type_prob*2; + if (r->terrain = newterrain(T_SWAMP)) + prob = +region_type_prob*2; + if (r->terrain = newterrain(T_MOUNTAIN)) + prob = +region_type_prob; + if (r->terrain = newterrain(T_VOLCANO)) + prob = +region_type_prob; + if (r->terrain = newterrain(T_VOLCANO_SMOKING)) + prob = +region_type_prob; - if (chance(prob)) { + if (prob > 0 && chance(prob)) { return guard; } } - return NULL; + return NULL; } static bool is_guardian_u(const unit * guard, unit * u, unsigned int mask) From 61ebd1d6b79e1b89d42fe00d28d9730c7d6ebe8b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 14 Aug 2014 20:08:29 +0200 Subject: [PATCH 3/3] fix accidental assignment instead of comparison. --- src/kernel/move.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/move.c b/src/kernel/move.c index 39504d901..9fc20afbe 100644 --- a/src/kernel/move.c +++ b/src/kernel/move.c @@ -892,15 +892,15 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r) if (guard) { prob += base_prob; /* 30% base chance */ prob = +guard_count*guard_number_prob; - if (r->terrain = newterrain(T_GLACIER)) + if (r->terrain == newterrain(T_GLACIER)) prob = +region_type_prob*2; - if (r->terrain = newterrain(T_SWAMP)) + if (r->terrain == newterrain(T_SWAMP)) prob = +region_type_prob*2; - if (r->terrain = newterrain(T_MOUNTAIN)) + if (r->terrain == newterrain(T_MOUNTAIN)) prob = +region_type_prob; - if (r->terrain = newterrain(T_VOLCANO)) + if (r->terrain == newterrain(T_VOLCANO)) prob = +region_type_prob; - if (r->terrain = newterrain(T_VOLCANO_SMOKING)) + if (r->terrain == newterrain(T_VOLCANO_SMOKING)) prob = +region_type_prob; if (prob > 0 && chance(prob)) {