Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion collective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,8 @@ void Collective::onEvent(const GameEvent& event) {
auto victim = info.victim;
if (creatures.contains(victim)) {
if (Random.roll(30)) {
if (Random.roll(2)) {
int resistance = victim->getAttributes().getSkills().getValue(SkillId::NOBILITY) * 10;
if (!Random.roll(2 + resistance)) {
victim->dieWithReason("killed by torture");
} else {
control->addMessage("A prisoner is converted to your side");
Expand Down Expand Up @@ -1319,6 +1320,12 @@ void Collective::onAppliedSquare(WCreature c, Position pos) {
case FurnitureType::GALLOWS:
taskMap->addTask(Task::kill(this, c), pos, MinionActivity::WORKING);
break;
case FurnitureType::TREASURE_CHEST: {
int ransomValue = c->getAttributes().getSkills().getValue(SkillId::NOBILITY) * 300;
returnResource({ResourceId::GOLD, ransomValue});
banishCreature(c);
break;
}
case FurnitureType::TORTURE_TABLE:
taskMap->addTask(Task::torture(this, c), pos, MinionActivity::WORKING);
break;
Expand Down
1 change: 1 addition & 0 deletions collective_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ const MinionActivityInfo& CollectiveConfig::getActivityInfo(MinionActivity task)
case MinionActivity::BE_WHIPPED: return {FurnitureType::WHIPPING_POST, "being whipped"};
case MinionActivity::BE_TORTURED: return {FurnitureType::TORTURE_TABLE, "being tortured"};
case MinionActivity::BE_EXECUTED: return {FurnitureType::GALLOWS, "being executed"};
case MinionActivity::BE_RANSOMED: return {FurnitureType::TREASURE_CHEST, "being ransomed"};
case MinionActivity::CRAFT: return {[](WConstCollective col, WConstCreature c, FurnitureType t) {
if (auto type = getWorkshopType(t))
return !c || !col || (c->getAttributes().getSkills().getValue(getWorkshopInfo(*type).skill) > 0 &&
Expand Down
9 changes: 9 additions & 0 deletions creature_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::DEMON_LORD:
return CATTR(
c.viewId = ViewId::DEMON_LORD;
c.skills.setValue(SkillId::NOBILITY, 0.1);
c.attr = LIST(40_dam, 45_def, 50_spell_dam );
c.body = Body::humanoidSpirit(Body::Size::LARGE);
c.body->addWings();
Expand Down Expand Up @@ -1197,6 +1198,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::KNIGHT:
return CATTR(
c.viewId = ViewId::KNIGHT;
c.skills.setValue(SkillId::NOBILITY, 0.1);
c.attr = LIST(36_dam, 28_def );
c.body = Body::humanoid(Body::Size::LARGE);
c.maxLevelIncrease[ExperienceType::MELEE] = 4;
Expand All @@ -1216,6 +1218,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::AVATAR:
return CATTR(
c.viewId = ViewId::DUKE;
c.skills.setValue(SkillId::NOBILITY, 0.8);
c.attr = LIST(43_dam, 32_def );
c.body = Body::humanoid(Body::Size::LARGE);
c.permanentEffects[LastingEffect::MELEE_RESISTANCE] = 1;
Expand Down Expand Up @@ -1500,6 +1503,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::GNOME_CHIEF:
return CATTR(
c.viewId = ViewId::GNOME_BOSS;
c.skills.setValue(SkillId::NOBILITY, 0.3);
c.attr = LIST(15_dam, 16_def );
c.body = Body::humanoid(Body::Size::MEDIUM);
c.skills.setValue(SkillId::JEWELER, 1);
Expand Down Expand Up @@ -1596,6 +1600,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::DWARF_BARON:
return CATTR(
c.viewId = ViewId::DWARF_BARON;
c.skills.setValue(SkillId::NOBILITY, 0.8);
c.attr = LIST(28_dam, 32_def );
c.body = Body::humanoid(Body::Size::MEDIUM);
c.body->setWeight(120);
Expand Down Expand Up @@ -1624,6 +1629,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::LIZARDLORD:
return CATTR(
c.viewId = ViewId::LIZARDLORD;
c.skills.setValue(SkillId::NOBILITY, 0.5);
c.attr = LIST(30_dam, 16_def );
c.body = Body::humanoid(Body::Size::MEDIUM);
c.permanentEffects[LastingEffect::POISON_RESISTANT] = 1;
Expand Down Expand Up @@ -1674,6 +1680,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::ELF_LORD:
return CATTR(
c.viewId = ViewId::ELF_LORD;
c.skills.setValue(SkillId::NOBILITY, 0.6);
c.attr = LIST(22_dam, 14_def, 16_spell_dam, 30_ranged_dam );
c.body = Body::humanoid(Body::Size::MEDIUM);
c.chatReactionFriendly = "curses all dwarves"_s;
Expand Down Expand Up @@ -1732,6 +1739,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::DARK_ELF_LORD:
return CATTR(
c.viewId = ViewId::DARK_ELF_LORD;
c.skills.setValue(SkillId::NOBILITY, 0.6);
c.attr = LIST(22_dam, 14_def, 16_spell_dam );
c.body = Body::humanoid(Body::Size::MEDIUM);
c.chatReactionFriendly = "curses all dwarves"_s;
Expand Down Expand Up @@ -2035,6 +2043,7 @@ CreatureAttributes CreatureFactory::getAttributesFromId(CreatureId id) {
case CreatureId::ELEMENTALIST:
return CATTR(
c.viewId = ViewId::ELEMENTALIST;
c.skills.setValue(SkillId::NOBILITY, 0.1);
c.attr = LIST(15_dam, 20_def, 15_spell_dam );
c.body = Body::humanoid(Body::Size::LARGE);
c.skills.setValue(SkillId::LABORATORY, 1);
Expand Down
1 change: 1 addition & 0 deletions gui_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,7 @@ static string getTaskText(MinionActivity option) {
case MinionActivity::THRONE: return "Throne";
case MinionActivity::BE_WHIPPED: return "Being whipped";
case MinionActivity::BE_TORTURED: return "Being tortured";
case MinionActivity::BE_RANSOMED: return "Being ransomed";
case MinionActivity::BE_EXECUTED: return "Being executed";
}
}
Expand Down
1 change: 1 addition & 0 deletions minion_activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RICH_ENUM(
THRONE,
BE_WHIPPED,
BE_TORTURED,
BE_RANSOMED,
BE_EXECUTED,
CONSTRUCTION,
DIGGING,
Expand Down
4 changes: 4 additions & 0 deletions minion_activity_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bool MinionActivityMap::canChooseRandomly(WConstCreature c, MinionActivity t) co
case MinionActivity::BE_EXECUTED:
case MinionActivity::BE_WHIPPED:
case MinionActivity::BE_TORTURED:
case MinionActivity::BE_RANSOMED:
return false;
case MinionActivity::SLEEP:
return !c->isAffected(LastingEffect::RESTED);
Expand Down Expand Up @@ -73,6 +74,9 @@ bool MinionActivityMap::isAvailable(WConstCollective col, WConstCreature c, Mini
case MinionActivity::BE_EXECUTED:
case MinionActivity::BE_TORTURED:
return col->hasTrait(c, MinionTrait::PRISONER);
case MinionActivity::BE_RANSOMED:
return col->hasTrait(c, MinionTrait::PRISONER) &&
c->getAttributes().getSkills().getValue(SkillId::NOBILITY) > 0;
case MinionActivity::CRAFT:
return c->getAttributes().getSkills().getValue(SkillId::FORGE) > 0 ||
c->getAttributes().getSkills().getValue(SkillId::WORKSHOP) > 0 ||
Expand Down
1 change: 1 addition & 0 deletions skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void Skill::init() {
Skill::set(SkillId::LABORATORY, new Skill("laboratory", "Craft items in the laboratory.", false));
Skill::set(SkillId::JEWELER, new Skill("jeweler", "Craft items at the jeweler's shop.", false));
Skill::set(SkillId::FURNACE, new Skill("furnace", "Craft items at the furnace.", false));
Skill::set(SkillId::NOBILITY, new Skill("nobility", "Resist torture but can be ransomed for gold.", false));
}

bool Skill::transferOnConsumption() const {
Expand Down
3 changes: 2 additions & 1 deletion skill.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RICH_ENUM(SkillId,
FURNACE,
EXPLORE,
EXPLORE_NOCTURNAL,
EXPLORE_CAVES
EXPLORE_CAVES,
NOBILITY
);

class Creature;
Expand Down
1 change: 1 addition & 0 deletions task.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Task : public UniqueEntity<Task>, public OwnedObject<Task> {
static PTask pickItem(WTaskCallback, Position, vector<WItem>);
static PTask kill(WTaskCallback, WCreature);
static PTask torture(WTaskCallback, WCreature);
static PTask ransom(WTaskCallback, WCreature);
static PTask sacrifice(WTaskCallback, WCreature);
static PTask disappear();
static PTask chain(PTask, PTask);
Expand Down