From 902d2d55970c2631f4f4cfca2b930a501a686110 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 18 Nov 2012 22:06:47 +0400 Subject: [PATCH] Try reducing the replace with sparring chance due to xp gain overkill. Also add more debug spam to make behavior tracking easier. --- plugins/tweak.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index cf6326936..7143e715e 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -797,10 +797,10 @@ struct military_training_ct_hook : df::activity_event_combat_trainingst { // If the xp gap is low, sometimes replace with sparring if ((maxv - minv) < 64*15 && spar == units.size() && - random_int(20) >= 5 + (maxv-minv)/64) + random_int(45) >= 30 + (maxv-minv)/64) { - out.print("Replacing %s demonstration (xp %d-%d) with sparring.\n", - ENUM_KEY_STR(job_skill, sd->skill).c_str(), minv, maxv); + out.print("Replacing %s demonstration (xp %d-%d, gap %d) with sparring.\n", + ENUM_KEY_STR(job_skill, sd->skill).c_str(), minv, maxv, maxv-minv); if (auto spar = df::allocate()) { @@ -822,13 +822,19 @@ struct military_training_ct_hook : df::activity_event_combat_trainingst { // If the teacher has less xp than somebody else, switch if (best >= 0 && maxv > cur_xp) { - out.print("Replacing %s teacher %d (%d xp) with %d (%d xp)\n", + out.print("Replacing %s teacher %d (%d xp) with %d (%d xp); xp gap %d.\n", ENUM_KEY_STR(job_skill, sd->skill).c_str(), - sd->unit_id, cur_xp, units[best], maxv); + sd->unit_id, cur_xp, units[best], maxv, maxv-minv); sd->hist_figure_id = sd->participants.histfigs[best]; sd->unit_id = units[best]; } + else + { + out.print("Not changing %s demonstration (xp %d-%d, gap %d).\n", + ENUM_KEY_STR(job_skill, sd->skill).c_str(), + minv, maxv, maxv-minv); + } } } }