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 b7aad91ffb
commit 7c44ff2241
2 changed files with 80 additions and 63 deletions

View File

@ -1,63 +1,64 @@
{
"include": [
"config://conf/keywords.json",
"config://conf/calendar.json",
"config://conf/prefixes.json",
"config://conf/e2/locales.json",
"config://conf/e2/terrains.json",
"config://conf/e2/items.json",
"config://res/core/ships.xml",
"config://res/core/common/buildings.xml",
"config://res/eressea/buildings.xml",
"config://res/buildings/castle.xml",
"config://res/eressea/races.xml",
"config://res/eressea/artrewards.xml",
"config://res/eressea/spells.xml",
"config://res/eressea/spellbooks/gray.xml",
"config://res/eressea/spellbooks/gwyrrd.xml",
"config://res/eressea/spellbooks/draig.xml",
"config://res/eressea/spellbooks/illaun.xml",
"config://res/eressea/spellbooks/cerddor.xml",
"config://res/eressea/spellbooks/tybied.xml"
],
"disabled": [
"jsreport"
],
"settings": {
"game.name" : "Eressea",
"game.mailcmd" : "ERESSEA",
"game.id" : 2,
"orders.default": "work",
"NewbieImmunity": 8,
"modules.market": false,
"modules.astralspace": true,
"modules.wormhole": true,
"modules.iceberg": true,
"modules.volcano": true,
"monsters.spawn.chance": 50,
"entertain.base": 0,
"entertain.perlevel": 20,
"taxing.perlevel": 20,
"nmr.timeout": 5,
"nmr.removenewbie": false,
"GiveRestriction": 3,
"hunger.long": false,
"hunger.damage": "1d8+6",
"init_spells": 0,
"game.era": 2,
"game.start": 184,
"rules.reserve.twophase": true,
"rules.give.max_men": -1,
"rules.check_overload": false,
"rules.limit.faction": 2500,
"rules.maxskills.magic": 5,
"rules.guard.base_stop_prob": 0.30,
"rules.guard.skill_stop_prob": 0.05,
"rules.guard.amulet_stop_prob": 0.10,
"rules.guard.guard_number_stop_prob": 0.001,
"rules.guard.castle_stop_prob": 0.05,
"rules.guard.region_type_stop_prob": 0.05,
"rules.economy.repopulate_maximum": 500,
"rules.lighthouse.unit_capacity": true
}
"settings": {
"game.name": "Eressea",
"game.mailcmd": "ERESSEA",
"game.id": 2,
"orders.default": "work",
"NewbieImmunity": 8,
"modules.market": false,
"modules.astralspace": true,
"modules.wormhole": true,
"modules.iceberg": true,
"modules.volcano": true,
"monsters.spawn.chance": 50,
"entertain.base": 0,
"entertain.perlevel": 20,
"taxing.perlevel": 20,
"nmr.timeout": 5,
"nmr.removenewbie": false,
"GiveRestriction": 3,
"hunger.long": false,
"hunger.damage": "1d8+6",
"init_spells": 0,
"game.era": 2,
"game.start": 184,
"rules.reserve.twophase": true,
"rules.give.max_men": -1,
"rules.check_overload": false,
"rules.limit.faction": 2500,
"rules.maxskills.magic": 5,
"rules.guard.base_stop_prob": 0.30,
"rules.guard.skill_stop_prob": 0.05,
"rules.guard.amulet_stop_prob": 0.10,
"rules.guard.guard_number_stop_prob": 0.001,
"rules.guard.castle_stop_prob": 0.05,
"rules.guard.region_type_stop_prob": 0.05,
"rules.economy.repopulate_maximum": 500,
"rules.lighthouse.unit_capacity": true,
"resource.visibility.rule": 0
},
"disabled": [
"jsreport"
],
"include": [
"config://conf/keywords.json",
"config://conf/calendar.json",
"config://conf/prefixes.json",
"config://conf/e2/locales.json",
"config://conf/e2/terrains.json",
"config://conf/e2/items.json",
"config://res/core/ships.xml",
"config://res/core/common/buildings.xml",
"config://res/eressea/buildings.xml",
"config://res/buildings/castle.xml",
"config://res/eressea/races.xml",
"config://res/eressea/artrewards.xml",
"config://res/eressea/spells.xml",
"config://res/eressea/spellbooks/gray.xml",
"config://res/eressea/spellbooks/gwyrrd.xml",
"config://res/eressea/spellbooks/draig.xml",
"config://res/eressea/spellbooks/illaun.xml",
"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)
/* 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 */
{
const struct item_type *itype = res->rtype->itype;
@ -134,6 +134,16 @@ static int visible_default(const rawmaterial * res, int skilllevel)
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)
{
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)
{
if (!rtype->raw) {
int rule = config_get_int("resource.visibility.rule", 0);
rawmaterial_type *rmtype = rtype->raw = malloc(sizeof(rawmaterial_type));
if (!rmtype) abort();
rmtype->rtype = rtype;
rmtype->terraform = terraform_default;
rmtype->update = NULL;
rmtype->use = use_default;
rmtype->visible = visible_default;
if (rule == 0) {
rmtype->visible = visible_default;
}
else {
rmtype->visible = visible_half_skill;
}
}
return rtype->raw;
}