From d98fd020485c2b8c2dc2201241dfabc8742e5ca1 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Sat, 29 Jul 2017 18:46:45 -0500 Subject: [PATCH] Weight CUTWOOD jobs by KILL_PLANT ethic; fix #1115 --- plugins/labormanager/labormanager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/labormanager/labormanager.cpp b/plugins/labormanager/labormanager.cpp index 5fb8dc60e..c1d163cfb 100644 --- a/plugins/labormanager/labormanager.cpp +++ b/plugins/labormanager/labormanager.cpp @@ -67,6 +67,8 @@ #include #include #include +#include +#include #include "labormanager.h" #include "joblabormapper.h" @@ -1465,6 +1467,7 @@ private: for (int ma = 0; ma < 13; ma++) attr_weight += (skill_attr_weights[skill].mental_attr_weights[ma]) * (d->dwarf->status.current_soul->mental_attrs[ma].value - 1000); } + } int score = skill_level * 1000 - (d->high_skill - skill_level) * 2000 + (xp / (skill_level + 5) * 10) + attr_weight; @@ -1485,6 +1488,17 @@ private: score += 5000; } + // This should reweight assigning CUTWOOD jobs based on a citizen's ethic toward killing plants + + if (labor == df::unit_labor::CUTWOOD) + { + auto c_id = d->dwarf->cultural_identity; + auto culture = world->cultural_identities.all[c_id]; + auto ethics = culture->ethic[df::ethic_type::KILL_PLANT]; + if (ethics != df::ethic_response::NOT_APPLICABLE && ethics != df::ethic_response::REQUIRED) + score += 10000 * (df::ethic_response::ACCEPTABLE - ethics); + } + score -= Units::computeMovementSpeed(d->dwarf); return score;