add a setting for an alternate resource discovery rule.

This commit is contained in:
Enno Rehling 2020-09-12 16:58:21 +02:00
parent 8cabd04b75
commit 7987317697
2 changed files with 80 additions and 63 deletions

View File

@ -1,63 +1,64 @@
{ {
"include": [ "settings": {
"config://conf/keywords.json", "game.name": "Eressea",
"config://conf/calendar.json", "game.mailcmd": "ERESSEA",
"config://conf/prefixes.json", "game.id": 2,
"config://conf/e2/locales.json", "orders.default": "work",
"config://conf/e2/terrains.json", "NewbieImmunity": 8,
"config://conf/e2/items.json", "modules.market": false,
"config://res/core/ships.xml", "modules.astralspace": true,
"config://res/core/common/buildings.xml", "modules.wormhole": true,
"config://res/eressea/buildings.xml", "modules.iceberg": true,
"config://res/buildings/castle.xml", "modules.volcano": true,
"config://res/eressea/races.xml", "monsters.spawn.chance": 50,
"config://res/eressea/artrewards.xml", "entertain.base": 0,
"config://res/eressea/spells.xml", "entertain.perlevel": 20,
"config://res/eressea/spellbooks/gray.xml", "taxing.perlevel": 20,
"config://res/eressea/spellbooks/gwyrrd.xml", "nmr.timeout": 5,
"config://res/eressea/spellbooks/draig.xml", "nmr.removenewbie": false,
"config://res/eressea/spellbooks/illaun.xml", "GiveRestriction": 3,
"config://res/eressea/spellbooks/cerddor.xml", "hunger.long": false,
"config://res/eressea/spellbooks/tybied.xml" "hunger.damage": "1d8+6",
], "init_spells": 0,
"disabled": [ "game.era": 2,
"jsreport" "game.start": 184,
], "rules.reserve.twophase": true,
"settings": { "rules.give.max_men": -1,
"game.name" : "Eressea", "rules.check_overload": false,
"game.mailcmd" : "ERESSEA", "rules.limit.faction": 2500,
"game.id" : 2, "rules.maxskills.magic": 5,
"orders.default": "work", "rules.guard.base_stop_prob": 0.30,
"NewbieImmunity": 8, "rules.guard.skill_stop_prob": 0.05,
"modules.market": false, "rules.guard.amulet_stop_prob": 0.10,
"modules.astralspace": true, "rules.guard.guard_number_stop_prob": 0.001,
"modules.wormhole": true, "rules.guard.castle_stop_prob": 0.05,
"modules.iceberg": true, "rules.guard.region_type_stop_prob": 0.05,
"modules.volcano": true, "rules.economy.repopulate_maximum": 500,
"monsters.spawn.chance": 50, "rules.lighthouse.unit_capacity": true,
"entertain.base": 0, "resource.visibility.rule": 0
"entertain.perlevel": 20, },
"taxing.perlevel": 20, "disabled": [
"nmr.timeout": 5, "jsreport"
"nmr.removenewbie": false, ],
"GiveRestriction": 3, "include": [
"hunger.long": false, "config://conf/keywords.json",
"hunger.damage": "1d8+6", "config://conf/calendar.json",
"init_spells": 0, "config://conf/prefixes.json",
"game.era": 2, "config://conf/e2/locales.json",
"game.start": 184, "config://conf/e2/terrains.json",
"rules.reserve.twophase": true, "config://conf/e2/items.json",
"rules.give.max_men": -1, "config://res/core/ships.xml",
"rules.check_overload": false, "config://res/core/common/buildings.xml",
"rules.limit.faction": 2500, "config://res/eressea/buildings.xml",
"rules.maxskills.magic": 5, "config://res/buildings/castle.xml",
"rules.guard.base_stop_prob": 0.30, "config://res/eressea/races.xml",
"rules.guard.skill_stop_prob": 0.05, "config://res/eressea/artrewards.xml",
"rules.guard.amulet_stop_prob": 0.10, "config://res/eressea/spells.xml",
"rules.guard.guard_number_stop_prob": 0.001, "config://res/eressea/spellbooks/gray.xml",
"rules.guard.castle_stop_prob": 0.05, "config://res/eressea/spellbooks/gwyrrd.xml",
"rules.guard.region_type_stop_prob": 0.05, "config://res/eressea/spellbooks/draig.xml",
"rules.economy.repopulate_maximum": 500, "config://res/eressea/spellbooks/illaun.xml",
"rules.lighthouse.unit_capacity": true "config://res/eressea/spellbooks/cerddor.xml",
} "config://res/eressea/spellbooks/tybied.xml"
]
} }

View File

@ -118,7 +118,7 @@ static void terraform_default(struct rawmaterial *res, const region * r)
} }
static int visible_default(const rawmaterial * res, int skilllevel) static int visible_default(const rawmaterial * res, int skilllevel)
/* resources are visible, if skill equals minimum skill to mine them /* resources are visible if skill equals minimum skill to mine them
* plus current level of difficulty */ * plus current level of difficulty */
{ {
const struct item_type *itype = res->rtype->itype; const struct item_type *itype = res->rtype->itype;
@ -134,6 +134,16 @@ static int visible_default(const rawmaterial * res, int skilllevel)
return -1; return -1;
} }
static int visible_half_skill(const rawmaterial * res, int skilllevel)
/* resources are visible if skill equals half as much as normal */
{
const struct item_type *itype = res->rtype->itype;
if (res->level + itype->construction->minskill < 2 * (skilllevel + 1)) {
return res->amount;
}
return -1;
}
static void use_default(rawmaterial * res, const region * r, int amount) static void use_default(rawmaterial * res, const region * r, int amount)
{ {
assert(res->amount > 0 && amount >= 0 && amount <= res->amount); assert(res->amount > 0 && amount >= 0 && amount <= res->amount);
@ -171,13 +181,19 @@ struct rawmaterial_type *rmt_get(const struct resource_type *rtype)
struct rawmaterial_type *rmt_create(struct resource_type *rtype) struct rawmaterial_type *rmt_create(struct resource_type *rtype)
{ {
if (!rtype->raw) { if (!rtype->raw) {
int rule = config_get_int("resource.visibility.rule", 0);
rawmaterial_type *rmtype = rtype->raw = malloc(sizeof(rawmaterial_type)); rawmaterial_type *rmtype = rtype->raw = malloc(sizeof(rawmaterial_type));
if (!rmtype) abort(); if (!rmtype) abort();
rmtype->rtype = rtype; rmtype->rtype = rtype;
rmtype->terraform = terraform_default; rmtype->terraform = terraform_default;
rmtype->update = NULL; rmtype->update = NULL;
rmtype->use = use_default; rmtype->use = use_default;
rmtype->visible = visible_default; if (rule == 0) {
rmtype->visible = visible_default;
}
else {
rmtype->visible = visible_half_skill;
}
} }
return rtype->raw; return rtype->raw;
} }