forked from github/server
Auto Lehrer
Config via study.speedup (sollte in E2 und E3 schon mit dem Wert 0 in der XML stehen) Wert 1: Wenn das gerade gelernte Talent wenig Lerntage hat als 1/3 der max. möglichen (ohne Bonus wie Akademie) hat, dann gibt es die doppelten Lerntage. Entspricht etwa dem alten Lehrer Schema. Wert 2: Es werden die Lerntage aller Talente der Einheit als Vergleichswert genommen, dann aber gegen den halben maximalen Lerntagewert. Es werden niemals die Lerntage der aktuellen Stufe mit eingerechnet, sondern nur die durchschnittlichen Lerntage der bereits fertig gelernten Stufen. In E2 sollte der Lehre Befehl deaktiviert werden wenn diese Option aktiviert wird.
This commit is contained in:
parent
27ddeb7adc
commit
aa07c550ab
38
src/study.c
38
src/study.c
|
@ -493,25 +493,31 @@ int teach_cmd(unit * u, struct order *ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double study_speedup(unit * u)
|
static double study_speedup(unit * u, skill_t s, int rule_type)
|
||||||
{
|
{
|
||||||
#define MINTURN 5 /* 5 */
|
#define MINTURN 16
|
||||||
#define OFSTURN 2 /* 2 */
|
double learnweeks = 0;
|
||||||
|
int i;
|
||||||
if (turn > MINTURN) {
|
if (turn > MINTURN) {
|
||||||
static int speed_rule = -1;
|
if (rule_type == 1) {
|
||||||
if (speed_rule < 0) {
|
|
||||||
speed_rule = get_param_int(global.parameters, "study.speedup", 0);
|
|
||||||
}
|
|
||||||
if (speed_rule == 1) {
|
|
||||||
double learn_age = OFSTURN;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i != u->skill_size; ++i) {
|
for (i = 0; i != u->skill_size; ++i) {
|
||||||
skill *sv = u->skills + i;
|
skill *sv = u->skills + i;
|
||||||
double learn_time = sv->level * (sv->level + 1) / 2.0;
|
if (sv->id == s){
|
||||||
learn_age += learn_time;
|
learnweeks = sv->level * (sv->level + 1) / 2.0;
|
||||||
|
if (learnweeks < turn / 3) {
|
||||||
|
return 2.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (learn_age < turn) {
|
return 2.0; /* If the skill was not found it is the first study. */
|
||||||
return 2.0 - learn_age / turn;
|
}
|
||||||
|
if (rule_type == 2) {
|
||||||
|
for (i = 0; i != u->skill_size; ++i) {
|
||||||
|
skill *sv = u->skills + i;
|
||||||
|
learnweeks = +(sv->level * (sv->level + 1) / 2.0);
|
||||||
|
}
|
||||||
|
if (learnweeks < turn / 3) {
|
||||||
|
return 2.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,6 +537,7 @@ int learn_cmd(unit * u, order * ord)
|
||||||
int money = 0;
|
int money = 0;
|
||||||
skill_t sk;
|
skill_t sk;
|
||||||
int maxalchemy = 0;
|
int maxalchemy = 0;
|
||||||
|
int speed_rule = get_param_int(global.parameters, "study.speedup", 0);
|
||||||
static int learn_newskills = -1;
|
static int learn_newskills = -1;
|
||||||
if (learn_newskills < 0) {
|
if (learn_newskills < 0) {
|
||||||
const char *str = get_param(global.parameters, "study.newskills");
|
const char *str = get_param(global.parameters, "study.newskills");
|
||||||
|
@ -539,7 +546,6 @@ int learn_cmd(unit * u, order * ord)
|
||||||
else
|
else
|
||||||
learn_newskills = 1;
|
learn_newskills = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((u_race(u)->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
if ((u_race(u)->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_race_nolearn", "race",
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_race_nolearn", "race",
|
||||||
u_race(u)));
|
u_race(u)));
|
||||||
|
@ -732,7 +738,7 @@ int learn_cmd(unit * u, order * ord)
|
||||||
teach->value -= u->number * 10;
|
teach->value -= u->number * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
multi *= study_speedup(u);
|
multi *= study_speedup(u, sk, speed_rule);
|
||||||
days = study_days(u, sk);
|
days = study_days(u, sk);
|
||||||
days = (int)((days + teach->value) * multi);
|
days = (int)((days + teach->value) * multi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue