forked from github/server
add a setting for an alternate resource discovery rule.
This commit is contained in:
parent
8cabd04b75
commit
7987317697
|
@ -1,28 +1,4 @@
|
|||
{
|
||||
"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",
|
||||
|
@ -58,6 +34,31 @@
|
|||
"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
|
||||
}
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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,14 +181,20 @@ 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;
|
||||
if (rule == 0) {
|
||||
rmtype->visible = visible_default;
|
||||
}
|
||||
else {
|
||||
rmtype->visible = visible_half_skill;
|
||||
}
|
||||
}
|
||||
return rtype->raw;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue