forked from github/server
New feature: learning speed
- final version and parameters for e2k9
This commit is contained in:
parent
d871101994
commit
52127ced69
|
@ -154,14 +154,20 @@ const attrib_type at_learning = {
|
|||
static int
|
||||
study_days(unit * student, skill_t sk)
|
||||
{
|
||||
int speed = 30 + student->race->study_speed_base;
|
||||
if (student->race->study_speed) speed += student->race->study_speed[sk];
|
||||
int speed = 30;
|
||||
if (student->race->study_speed) {
|
||||
speed += student->race->study_speed[sk];
|
||||
}
|
||||
if (speed<30) {
|
||||
skill * sv = get_skill(student, sk);
|
||||
if (sv==0) return 30;
|
||||
}
|
||||
return student->number * speed;
|
||||
}
|
||||
|
||||
static int
|
||||
teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
|
||||
boolean report, int * academy)
|
||||
boolean report, int * academy)
|
||||
{
|
||||
teaching_info * teach = NULL;
|
||||
attrib * a;
|
||||
|
@ -179,7 +185,7 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
|
|||
return 0;
|
||||
}
|
||||
|
||||
n = study_days(student, sk);
|
||||
n = 30;
|
||||
a = a_find(student->attribs, &at_learning);
|
||||
if (a!=NULL) {
|
||||
teach = (teaching_info*)a->data.v;
|
||||
|
@ -487,6 +493,7 @@ study_speedup(unit * u)
|
|||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
int
|
||||
learn_cmd(unit * u, order * ord)
|
||||
{
|
||||
|
@ -703,8 +710,8 @@ learn_cmd(unit * u, order * ord)
|
|||
}
|
||||
|
||||
multi *= study_speedup(u);
|
||||
|
||||
days = (int)((u->number * 30 + teach->value) * multi);
|
||||
days = study_days(u, sk);
|
||||
days = (int)((days + teach->value) * multi);
|
||||
|
||||
/* the artacademy currently improves the learning of entertainment
|
||||
of all units in the region, to be able to make it cumulative with
|
||||
|
|
|
@ -75,7 +75,6 @@ typedef struct race {
|
|||
const spell * precombatspell;
|
||||
struct att attack[10];
|
||||
char bonus[MAXSKILLS];
|
||||
char study_speed_base;
|
||||
signed char * study_speed; /* study-speed-bonus in points/turn (0=30 Tage) */
|
||||
boolean __remove_me_nonplayer;
|
||||
int flags;
|
||||
|
|
|
@ -1541,7 +1541,7 @@ parse_races(xmlDocPtr doc)
|
|||
xmlChar * propValue;
|
||||
race * rc;
|
||||
xmlXPathObjectPtr result;
|
||||
int k;
|
||||
int k, study_speed_base;
|
||||
struct att * attack;
|
||||
|
||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||
|
@ -1565,7 +1565,7 @@ parse_races(xmlDocPtr doc)
|
|||
rc->speed = (float)xml_fvalue(node, "speed", 1.0F);
|
||||
rc->hitpoints = xml_ivalue(node, "hp", 0);
|
||||
rc->armor = (char)xml_ivalue(node, "ac", 0);
|
||||
rc->study_speed_base = xml_ivalue(node, "studyspeed", 0);
|
||||
study_speed_base = xml_ivalue(node, "studyspeed", 0);
|
||||
|
||||
rc->at_default = (char)xml_ivalue(node, "unarmedattack", -2);
|
||||
rc->df_default = (char)xml_ivalue(node, "unarmeddefense", -2);
|
||||
|
@ -1627,7 +1627,7 @@ parse_races(xmlDocPtr doc)
|
|||
for (k=0;k!=result->nodesetval->nodeNr;++k) {
|
||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||
int mod = xml_ivalue(node, "modifier", 0);
|
||||
int speed = xml_ivalue(node, "speed", 0);
|
||||
int speed = xml_ivalue(node, "speed", study_speed_base);
|
||||
skill_t sk;
|
||||
|
||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||
|
|
|
@ -24,20 +24,25 @@
|
|||
<familiar race="imp"/>
|
||||
</race>
|
||||
|
||||
<race name="uruk" magres="-0.05" maxaura="1.0" regaura="1.0" recruitcost="70" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<race name="uruk" studyspeed="-5" magres="-0.05" maxaura="1.0" regaura="1.0" recruitcost="70" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<param name="other_race" value="troll"/>
|
||||
<param name="other_cost" value="500"/>
|
||||
<skill name="armorer" modifier="1"/>
|
||||
|
||||
<skill name="bow" speed="+5"/>
|
||||
<skill name="building" modifier="1"/>
|
||||
<skill name="cartmaking" modifier="-1"/>
|
||||
<skill name="catapult" speed="+5"/>
|
||||
<skill name="crossbow" speed="+5"/>
|
||||
<skill name="forestry" modifier="1"/>
|
||||
<skill name="herbalism" modifier="-2"/>
|
||||
<skill name="melee" speed="+5"/>
|
||||
<skill name="mining" modifier="1"/>
|
||||
<skill name="quarrying" modifier="1"/>
|
||||
<skill name="riding" modifier="-99"/>
|
||||
<skill name="sailing" modifier="-1"/>
|
||||
<skill name="stamina" speed="0"/>
|
||||
<skill name="shipcraft" modifier="-1"/>
|
||||
<skill name="tactics" modifier="1"/>
|
||||
<skill name="training" modifier="-1"/>
|
||||
|
|
Loading…
Reference in New Issue