forked from github/server
Gewichtsangaben bei der Anzeige von items
This commit is contained in:
parent
d6cd1c0efe
commit
a653ea0824
|
@ -2304,37 +2304,33 @@ display_item(faction *f, unit *u, const item_type * itype)
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if (u && *i_find(&u->items, itype) == NULL) return false;
|
if (u && *i_find(&u->items, itype) == NULL) return false;
|
||||||
/*
|
|
||||||
info = mkname("info", itype->rtype->_name[0]);
|
name = resourcename(itype->rtype, 0);
|
||||||
name = LOC(u->faction->locale, info);
|
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
|
||||||
if (strcmp(name, info)==0) {
|
fp = fopen(filename, "r");
|
||||||
*/
|
if (!fp) {
|
||||||
name = resourcename(itype->rtype, 0);
|
name = locale_string(f->locale, resourcename(itype->rtype, 0));
|
||||||
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
|
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
|
||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
if (!fp) {
|
}
|
||||||
name = locale_string(f->locale, resourcename(itype->rtype, 0));
|
if (!fp) {
|
||||||
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
|
name = resourcename(itype->rtype, 0);
|
||||||
fp = fopen(filename, "r");
|
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), name);
|
||||||
}
|
fp = fopen(filename, "r");
|
||||||
if (!fp) {
|
}
|
||||||
name = resourcename(itype->rtype, 0);
|
if (!fp) return false;
|
||||||
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), name);
|
|
||||||
fp = fopen(filename, "r");
|
|
||||||
}
|
|
||||||
if (!fp) return false;
|
|
||||||
|
|
||||||
buf[0]='\0';
|
buf[0]='\0';
|
||||||
while (fgets(t, NAMESIZE, fp) != NULL) {
|
while (fgets(t, NAMESIZE, fp) != NULL) {
|
||||||
if (t[strlen(t) - 1] == '\n') {
|
if (t[strlen(t) - 1] == '\n') {
|
||||||
t[strlen(t) - 1] = 0;
|
t[strlen(t) - 1] = 0;
|
||||||
}
|
|
||||||
strcat(buf, t);
|
|
||||||
}
|
}
|
||||||
fclose(fp);
|
strcat(buf, t);
|
||||||
name = buf;
|
}
|
||||||
/* } */
|
fclose(fp);
|
||||||
ADDMSG(&f->msgs, msg_message("displayitem", "item description", itype->rtype, strdup(name)));
|
name = buf;
|
||||||
|
ADDMSG(&f->msgs, msg_message("displayitem", "weight item description",
|
||||||
|
itype->weight/1000, itype->rtype, strdup(name)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,266 +499,266 @@ learn(void)
|
||||||
|
|
||||||
if (u->race == new_race[RC_INSECT] && r_insectstalled(r)
|
if (u->race == new_race[RC_INSECT] && r_insectstalled(r)
|
||||||
&& !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
|
&& !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (attacked(u)) {
|
if (attacked(u)) {
|
||||||
cmistake(u, u->thisorder, 52, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 52, MSG_PRODUCE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
if ((u->race->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
|
||||||
sprintf(buf, "%s können nichts lernen", LOC(default_locale, rc_name(u->race, 1)));
|
sprintf(buf, "%s können nichts lernen", LOC(default_locale, rc_name(u->race, 1)));
|
||||||
mistake(u, u->thisorder, buf, MSG_EVENT);
|
mistake(u, u->thisorder, buf, MSG_EVENT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_tokens(u->thisorder);
|
init_tokens(u->thisorder);
|
||||||
skip_token();
|
skip_token();
|
||||||
sk = getskill(u->faction->locale);
|
sk = getskill(u->faction->locale);
|
||||||
|
|
||||||
if (sk < 0) {
|
if (sk < 0) {
|
||||||
|
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) {
|
||||||
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Hack: Talente mit Malus -99 können nicht gelernt werden */
|
||||||
|
if (u->race->bonus[sk] == -99) {
|
||||||
|
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* snotlings können Talente nur bis T8 lernen */
|
||||||
|
if (u->race == new_race[RC_SNOTLING]){
|
||||||
|
if (get_level(u, sk) >= 8){
|
||||||
|
cmistake(u, u->thisorder, 308, MSG_EVENT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) {
|
}
|
||||||
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
|
||||||
|
p = studycost = study_cost(u, sk);
|
||||||
|
a = a_find(u->attribs, &at_learning);
|
||||||
|
if (a!=NULL) {
|
||||||
|
teach = (teaching_info*)a->data.v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* keine kostenpflichtigen Talente für Migranten. Vertraute sind
|
||||||
|
* keine Migranten, wird in is_migrant abgefangen. Vorsicht,
|
||||||
|
* studycost darf hier noch nicht durch Akademie erhöht sein */
|
||||||
|
if (studycost > 0 && !ExpensiveMigrants() && is_migrant(u)) {
|
||||||
|
sprintf(buf, "Migranten können keine kostenpflichtigen Talente lernen");
|
||||||
|
mistake(u, u->thisorder, buf, MSG_EVENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Akademie: */
|
||||||
|
{
|
||||||
|
struct building * b = inside_building(u);
|
||||||
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
|
|
||||||
|
if (btype == bt_find("academy")) {
|
||||||
|
studycost = max(50, studycost * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sk == SK_MAGIC) {
|
||||||
|
if (u->number > 1){
|
||||||
|
cmistake(u, u->thisorder, 106, MSG_MAGIC);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Hack: Talente mit Malus -99 können nicht gelernt werden */
|
if (is_familiar(u)){
|
||||||
if (u->race->bonus[sk] == -99) {
|
/* Vertraute zählen nicht zu den Magiern einer Partei,
|
||||||
cmistake(u, u->thisorder, 77, MSG_EVENT);
|
* können aber nur Graue Magie lernen */
|
||||||
continue;
|
mtyp = M_GRAU;
|
||||||
}
|
if (!has_skill(u, SK_MAGIC)) {
|
||||||
/* snotlings können Talente nur bis T8 lernen */
|
|
||||||
if (u->race == new_race[RC_SNOTLING]){
|
|
||||||
if (get_level(u, sk) >= 8){
|
|
||||||
cmistake(u, u->thisorder, 308, MSG_EVENT);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p = studycost = study_cost(u, sk);
|
|
||||||
a = a_find(u->attribs, &at_learning);
|
|
||||||
if (a!=NULL) {
|
|
||||||
teach = (teaching_info*)a->data.v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* keine kostenpflichtigen Talente für Migranten. Vertraute sind
|
|
||||||
* keine Migranten, wird in is_migrant abgefangen. Vorsicht,
|
|
||||||
* studycost darf hier noch nicht durch Akademie erhöht sein */
|
|
||||||
if (studycost > 0 && !ExpensiveMigrants() && is_migrant(u)) {
|
|
||||||
sprintf(buf, "Migranten können keine kostenpflichtigen Talente lernen");
|
|
||||||
mistake(u, u->thisorder, buf, MSG_EVENT);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Akademie: */
|
|
||||||
{
|
|
||||||
struct building * b = inside_building(u);
|
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
|
||||||
|
|
||||||
if (btype == bt_find("academy")) {
|
|
||||||
studycost = max(50, studycost * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sk == SK_MAGIC) {
|
|
||||||
if (u->number > 1){
|
|
||||||
cmistake(u, u->thisorder, 106, MSG_MAGIC);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (is_familiar(u)){
|
|
||||||
/* Vertraute zählen nicht zu den Magiern einer Partei,
|
|
||||||
* können aber nur Graue Magie lernen */
|
|
||||||
mtyp = M_GRAU;
|
|
||||||
if (!has_skill(u, SK_MAGIC)) {
|
|
||||||
create_mage(u, mtyp);
|
|
||||||
}
|
|
||||||
} else if (!has_skill(u, SK_MAGIC)){
|
|
||||||
/* Die Einheit ist noch kein Magier */
|
|
||||||
if (count_skill(u->faction, SK_MAGIC) + u->number >
|
|
||||||
max_skill(u->faction, SK_MAGIC))
|
|
||||||
{
|
|
||||||
sprintf(buf, "Es kann maximal %d Magier pro Partei geben",
|
|
||||||
max_skill(u->faction, SK_MAGIC));
|
|
||||||
mistake(u, u->thisorder, buf, MSG_EVENT);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
mtyp = getmagicskill();
|
|
||||||
if (mtyp == M_NONE || mtyp == M_GRAU) {
|
|
||||||
/* wurde kein Magiegebiet angegeben, wird davon
|
|
||||||
* ausgegangen, daß das normal gelernt werden soll */
|
|
||||||
if(u->faction->magiegebiet != 0) {
|
|
||||||
mtyp = u->faction->magiegebiet;
|
|
||||||
} else {
|
|
||||||
/* Es wurde kein Magiegebiet angegeben und die Partei
|
|
||||||
* hat noch keins gewählt. */
|
|
||||||
cmistake(u, u->thisorder, 178, MSG_MAGIC);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mtyp != u->faction->magiegebiet){
|
|
||||||
/* Es wurde versucht, ein anderes Magiegebiet zu lernen
|
|
||||||
* als das der Partei */
|
|
||||||
if (u->faction->magiegebiet != 0){
|
|
||||||
cmistake(u, u->thisorder, 179, MSG_MAGIC);
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
/* Lernt zum ersten mal Magie und legt damit das
|
|
||||||
* Magiegebiet der Partei fest */
|
|
||||||
u->faction->magiegebiet = mtyp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
create_mage(u, mtyp);
|
create_mage(u, mtyp);
|
||||||
} else {
|
|
||||||
/* ist schon ein Magier und kein Vertrauter */
|
|
||||||
if(u->faction->magiegebiet == 0){
|
|
||||||
/* die Partei hat noch kein Magiegebiet gewählt. */
|
|
||||||
mtyp = getmagicskill();
|
|
||||||
if (mtyp == M_NONE){
|
|
||||||
cmistake(u, u->thisorder, 178, MSG_MAGIC);
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
/* Legt damit das Magiegebiet der Partei fest */
|
|
||||||
u->faction->magiegebiet = mtyp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else if (!has_skill(u, SK_MAGIC)){
|
||||||
if (sk == SK_ALCHEMY) {
|
/* Die Einheit ist noch kein Magier */
|
||||||
maxalchemy = eff_skill(u, SK_ALCHEMY, r);
|
if (count_skill(u->faction, SK_MAGIC) + u->number >
|
||||||
if (has_skill(u, SK_ALCHEMY)==0
|
max_skill(u->faction, SK_MAGIC))
|
||||||
&& count_skill(u->faction, SK_ALCHEMY) + u->number >
|
{
|
||||||
max_skill(u->faction, SK_ALCHEMY)) {
|
sprintf(buf, "Es kann maximal %d Magier pro Partei geben",
|
||||||
sprintf(buf, "Es kann maximal %d Alchemisten pro Partei geben",
|
max_skill(u->faction, SK_MAGIC));
|
||||||
max_skill(u->faction, SK_ALCHEMY));
|
mistake(u, u->thisorder, buf, MSG_EVENT);
|
||||||
mistake(u, u->thisorder, buf, MSG_EVENT);
|
continue;
|
||||||
|
}
|
||||||
|
mtyp = getmagicskill();
|
||||||
|
if (mtyp == M_NONE || mtyp == M_GRAU) {
|
||||||
|
/* wurde kein Magiegebiet angegeben, wird davon
|
||||||
|
* ausgegangen, daß das normal gelernt werden soll */
|
||||||
|
if(u->faction->magiegebiet != 0) {
|
||||||
|
mtyp = u->faction->magiegebiet;
|
||||||
|
} else {
|
||||||
|
/* Es wurde kein Magiegebiet angegeben und die Partei
|
||||||
|
* hat noch keins gewählt. */
|
||||||
|
cmistake(u, u->thisorder, 178, MSG_MAGIC);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (mtyp != u->faction->magiegebiet){
|
||||||
|
/* Es wurde versucht, ein anderes Magiegebiet zu lernen
|
||||||
|
* als das der Partei */
|
||||||
|
if (u->faction->magiegebiet != 0){
|
||||||
|
cmistake(u, u->thisorder, 179, MSG_MAGIC);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
/* Lernt zum ersten mal Magie und legt damit das
|
||||||
|
* Magiegebiet der Partei fest */
|
||||||
|
u->faction->magiegebiet = mtyp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
create_mage(u, mtyp);
|
||||||
|
} else {
|
||||||
|
/* ist schon ein Magier und kein Vertrauter */
|
||||||
|
if(u->faction->magiegebiet == 0){
|
||||||
|
/* die Partei hat noch kein Magiegebiet gewählt. */
|
||||||
|
mtyp = getmagicskill();
|
||||||
|
if (mtyp == M_NONE){
|
||||||
|
cmistake(u, u->thisorder, 178, MSG_MAGIC);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
/* Legt damit das Magiegebiet der Partei fest */
|
||||||
|
u->faction->magiegebiet = mtyp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (studycost) {
|
}
|
||||||
money = get_pooled(u, r, R_SILVER);
|
if (sk == SK_ALCHEMY) {
|
||||||
money = min(money, studycost * u->number);
|
maxalchemy = eff_skill(u, SK_ALCHEMY, r);
|
||||||
}
|
if (has_skill(u, SK_ALCHEMY)==0
|
||||||
if (money < studycost * u->number) {
|
&& count_skill(u->faction, SK_ALCHEMY) + u->number >
|
||||||
studycost = p; /* Ohne Univertreurung */
|
max_skill(u->faction, SK_ALCHEMY)) {
|
||||||
money = min(money, studycost);
|
sprintf(buf, "Es kann maximal %d Alchemisten pro Partei geben",
|
||||||
if (p>0 && money < studycost * u->number) {
|
max_skill(u->faction, SK_ALCHEMY));
|
||||||
|
mistake(u, u->thisorder, buf, MSG_EVENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (studycost) {
|
||||||
|
money = get_pooled(u, r, R_SILVER);
|
||||||
|
money = min(money, studycost * u->number);
|
||||||
|
}
|
||||||
|
if (money < studycost * u->number) {
|
||||||
|
studycost = p; /* Ohne Univertreurung */
|
||||||
|
money = min(money, studycost);
|
||||||
|
if (p>0 && money < studycost * u->number) {
|
||||||
#ifdef PARTIAL_STUDY
|
#ifdef PARTIAL_STUDY
|
||||||
cmistake(u, u->thisorder, 65, MSG_EVENT);
|
cmistake(u, u->thisorder, 65, MSG_EVENT);
|
||||||
multi = money / (double)(studycost * u->number);
|
multi = money / (double)(studycost * u->number);
|
||||||
#else
|
#else
|
||||||
cmistake(u, u->thisorder, 65, MSG_EVENT);
|
cmistake(u, u->thisorder, 65, MSG_EVENT);
|
||||||
continue; /* nein, Silber reicht auch so nicht */
|
continue; /* nein, Silber reicht auch so nicht */
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (teach==NULL) {
|
if (teach==NULL) {
|
||||||
a = a_add(&u->attribs, a_new(&at_learning));
|
a = a_add(&u->attribs, a_new(&at_learning));
|
||||||
teach = (teaching_info*)a->data.v;
|
teach = (teaching_info*)a->data.v;
|
||||||
teach->teachers[0] = 0;
|
teach->teachers[0] = 0;
|
||||||
|
}
|
||||||
|
if (money>0) {
|
||||||
|
use_pooled(u, r, R_SILVER, money);
|
||||||
|
add_message(&u->faction->msgs, msg_message("studycost",
|
||||||
|
"unit region cost skill", u, u->region, money, sk));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_effect(u, oldpotiontype[P_WISE])) {
|
||||||
|
l = min(u->number, get_effect(u, oldpotiontype[P_WISE]));
|
||||||
|
teach->value += l * 10;
|
||||||
|
change_effect(u, oldpotiontype[P_WISE], -l);
|
||||||
|
}
|
||||||
|
if (get_effect(u, oldpotiontype[P_FOOL])) {
|
||||||
|
l = min(u->number, get_effect(u, oldpotiontype[P_FOOL]));
|
||||||
|
teach->value -= l * 30;
|
||||||
|
change_effect(u, oldpotiontype[P_FOOL], -l);
|
||||||
|
}
|
||||||
|
|
||||||
|
warrior_skill = fspecial(u->faction, FS_WARRIOR);
|
||||||
|
if(warrior_skill > 0) {
|
||||||
|
if(sk == SK_CROSSBOW || sk == SK_LONGBOW
|
||||||
|
|| sk == SK_CATAPULT || sk == SK_SWORD || sk == SK_SPEAR
|
||||||
|
|| sk == SK_AUSDAUER || sk == SK_WEAPONLESS)
|
||||||
|
{
|
||||||
|
teach->value += u->number * (5+warrior_skill*5);
|
||||||
|
} else {
|
||||||
|
teach->value -= u->number * (5+warrior_skill*5);
|
||||||
|
teach->value = max(0, teach->value);
|
||||||
}
|
}
|
||||||
if (money>0) {
|
}
|
||||||
use_pooled(u, r, R_SILVER, money);
|
|
||||||
add_message(&u->faction->msgs, msg_message("studycost",
|
if (p != studycost) {
|
||||||
"unit region cost skill", u, u->region, money, sk));
|
/* ist_in_gebaeude(r, u, BT_UNIVERSITAET) == 1) { */
|
||||||
|
/* p ist Kosten ohne Uni, studycost mit; wenn
|
||||||
|
* p!=studycost, ist die Einheit zwangsweise
|
||||||
|
* in einer Uni */
|
||||||
|
teach->value += u->number * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_cursed(r->attribs,C_BADLEARN,0)) {
|
||||||
|
teach->value -= u->number * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
days = (int)((u->number * 30 + 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
|
||||||
|
with an academy */
|
||||||
|
|
||||||
|
if(buildingtype_exists(r, bt_find("artacademy"))) {
|
||||||
|
days *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fval(u, UFL_HUNGER)) days /= 2;
|
||||||
|
|
||||||
|
while (days) {
|
||||||
|
if (days>=u->number*30) {
|
||||||
|
learn_skill(u, sk, 1.0);
|
||||||
|
days -= u->number*30;
|
||||||
|
} else {
|
||||||
|
double chance = (double)days/u->number/30;
|
||||||
|
learn_skill(u, sk, chance);
|
||||||
|
days = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (get_effect(u, oldpotiontype[P_WISE])) {
|
if (a!=NULL) {
|
||||||
l = min(u->number, get_effect(u, oldpotiontype[P_WISE]));
|
if (teach!=NULL) {
|
||||||
teach->value += l * 10;
|
int index = 0;
|
||||||
change_effect(u, oldpotiontype[P_WISE], -l);
|
while (teach->teachers[index] && index!=MAXTEACHERS) {
|
||||||
}
|
unit * teacher = teach->teachers[index++];
|
||||||
if (get_effect(u, oldpotiontype[P_FOOL])) {
|
if (teacher->faction != u->faction) {
|
||||||
l = min(u->number, get_effect(u, oldpotiontype[P_FOOL]));
|
add_message(&u->faction->msgs, msg_message("teach_student",
|
||||||
teach->value -= l * 30;
|
"teacher student skill", teacher, u, sk));
|
||||||
change_effect(u, oldpotiontype[P_FOOL], -l);
|
add_message(&teacher->faction->msgs, msg_message("teach_teacher",
|
||||||
}
|
"teacher student skill level", teacher, u, sk,
|
||||||
|
effskill(u, sk)));
|
||||||
warrior_skill = fspecial(u->faction, FS_WARRIOR);
|
|
||||||
if(warrior_skill > 0) {
|
|
||||||
if(sk == SK_CROSSBOW || sk == SK_LONGBOW
|
|
||||||
|| sk == SK_CATAPULT || sk == SK_SWORD || sk == SK_SPEAR
|
|
||||||
|| sk == SK_AUSDAUER || sk == SK_WEAPONLESS)
|
|
||||||
{
|
|
||||||
teach->value += u->number * (5+warrior_skill*5);
|
|
||||||
} else {
|
|
||||||
teach->value -= u->number * (5+warrior_skill*5);
|
|
||||||
teach->value = max(0, teach->value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p != studycost) {
|
|
||||||
/* ist_in_gebaeude(r, u, BT_UNIVERSITAET) == 1) { */
|
|
||||||
/* p ist Kosten ohne Uni, studycost mit; wenn
|
|
||||||
* p!=studycost, ist die Einheit zwangsweise
|
|
||||||
* in einer Uni */
|
|
||||||
teach->value += u->number * 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_cursed(r->attribs,C_BADLEARN,0)) {
|
|
||||||
teach->value -= u->number * 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
days = (int)((u->number * 30 + 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
|
|
||||||
with an academy */
|
|
||||||
|
|
||||||
if(buildingtype_exists(r, bt_find("artacademy"))) {
|
|
||||||
days *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fval(u, UFL_HUNGER)) days /= 2;
|
|
||||||
|
|
||||||
while (days) {
|
|
||||||
if (days>=u->number*30) {
|
|
||||||
learn_skill(u, sk, 1.0);
|
|
||||||
days -= u->number*30;
|
|
||||||
} else {
|
|
||||||
double chance = (double)days/u->number/30;
|
|
||||||
learn_skill(u, sk, chance);
|
|
||||||
days = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (a!=NULL) {
|
|
||||||
if (teach!=NULL) {
|
|
||||||
int index = 0;
|
|
||||||
while (teach->teachers[index] && index!=MAXTEACHERS) {
|
|
||||||
unit * teacher = teach->teachers[index++];
|
|
||||||
if (teacher->faction != u->faction) {
|
|
||||||
add_message(&u->faction->msgs, msg_message("teach_student",
|
|
||||||
"teacher student skill", teacher, u, sk));
|
|
||||||
add_message(&teacher->faction->msgs, msg_message("teach_teacher",
|
|
||||||
"teacher student skill level", teacher, u, sk,
|
|
||||||
effskill(u, sk)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a_remove(&u->attribs, a);
|
|
||||||
a = NULL;
|
|
||||||
}
|
}
|
||||||
|
a_remove(&u->attribs, a);
|
||||||
|
a = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Anzeigen neuer Tränke */
|
/* Anzeigen neuer Tränke */
|
||||||
/* Spruchlistenaktualiesierung ist in Regeneration */
|
/* Spruchlistenaktualiesierung ist in Regeneration */
|
||||||
|
|
||||||
if (sk == SK_ALCHEMY) {
|
if (sk == SK_ALCHEMY) {
|
||||||
const potion_type * ptype;
|
const potion_type * ptype;
|
||||||
faction * f = u->faction;
|
faction * f = u->faction;
|
||||||
int skill = eff_skill(u, SK_ALCHEMY, r);
|
int skill = eff_skill(u, SK_ALCHEMY, r);
|
||||||
if (skill>maxalchemy) {
|
if (skill>maxalchemy) {
|
||||||
for (ptype=potiontypes; ptype; ptype=ptype->next) {
|
for (ptype=potiontypes; ptype; ptype=ptype->next) {
|
||||||
if (skill == ptype->level * 2) {
|
if (skill == ptype->level * 2) {
|
||||||
attrib * a = a_find(f->attribs, &at_showitem);
|
attrib * a = a_find(f->attribs, &at_showitem);
|
||||||
while (a && a->data.v != ptype) a=a->nexttype;
|
while (a && a->data.v != ptype) a=a->nexttype;
|
||||||
if (!a) {
|
if (!a) {
|
||||||
a = a_add(&f->attribs, a_new(&at_showitem));
|
a = a_add(&f->attribs, a_new(&at_showitem));
|
||||||
a->data.v = (void*) ptype->itype;
|
a->data.v = (void*) ptype->itype;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1987,7 +1987,7 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
||||||
switch(a->type) {
|
switch(a->type) {
|
||||||
case AT_STANDARD: /* Waffen, mag. Gegenstände, Kampfzauber */
|
case AT_STANDARD: /* Waffen, mag. Gegenstände, Kampfzauber */
|
||||||
case AT_COMBATSPELL:
|
case AT_COMBATSPELL:
|
||||||
if (af->magic > 0) {
|
if (numattack==0 && af->magic > 0) {
|
||||||
/* Magier versuchen immer erstmal zu zaubern, erst wenn das
|
/* Magier versuchen immer erstmal zu zaubern, erst wenn das
|
||||||
* fehlschlägt, wird af->magic == 0 und der Magier kämpft
|
* fehlschlägt, wird af->magic == 0 und der Magier kämpft
|
||||||
* konventionell weiter */
|
* konventionell weiter */
|
||||||
|
@ -2027,11 +2027,11 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
||||||
}
|
}
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
|
|
||||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
if (td.fighter->person[td.index].last_action < b->turn) {
|
||||||
td.fighter->person[td.index].last_action = b->turn;
|
td.fighter->person[td.index].last_action = b->turn;
|
||||||
td.fighter->action_counter++;
|
td.fighter->action_counter++;
|
||||||
}
|
}
|
||||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
if (ta.fighter->person[ta.index].last_action < b->turn) {
|
||||||
ta.fighter->person[ta.index].last_action = b->turn;
|
ta.fighter->person[ta.index].last_action = b->turn;
|
||||||
ta.fighter->action_counter++;
|
ta.fighter->action_counter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4050,7 +4050,7 @@ sp_charmingsong(castorder *co)
|
||||||
int tb = 0;
|
int tb = 0;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
if(pa->param[0]->flag == TARGET_NOTFOUND) return 0;
|
if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;
|
||||||
|
|
||||||
target = pa->param[0]->data.u;
|
target = pa->param[0]->data.u;
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,10 @@
|
||||||
<type>
|
<type>
|
||||||
<arg name="item" type="resource"/>
|
<arg name="item" type="resource"/>
|
||||||
<arg name="description" type="string"/>
|
<arg name="description" type="string"/>
|
||||||
|
<arg name="weight" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"$resource($item,1): $description"</text>
|
<text locale="de">"$resource($item,1) ($int($weight) GE): $description"</text>
|
||||||
|
<text locale="en">"$resource($item,1) ($int($weight) st): $description"</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="healall" section="events">
|
<message name="healall" section="events">
|
||||||
<type>
|
<type>
|
||||||
|
|
|
@ -213,6 +213,14 @@ function test_parser()
|
||||||
write_game("parser")
|
write_game("parser")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_fail()
|
||||||
|
plain = terraform(0, 0, "plain")
|
||||||
|
skill = 5
|
||||||
|
|
||||||
|
f = add_faction("enno@eressea.de", "human", "de")
|
||||||
|
print(f)
|
||||||
|
end
|
||||||
|
|
||||||
test_fail()
|
test_fail()
|
||||||
-- test_handler()
|
-- test_handler()
|
||||||
-- test_parser()
|
-- test_parser()
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
The crash of the day:
|
weights in item descriptions
|
||||||
giving units names or descriptions that exceed NAMESIZE/DISPLAYSIZE can be a bad thing.
|
|
||||||
|
|
||||||
[11:01] <Enno`> am besten wäre, wenn mailit nur die optionen, nicht das ganze script enthielte
|
[11:01] <Enno`> am besten wäre, wenn mailit nur die optionen, nicht das ganze script enthielte
|
||||||
[11:01] <Enno`> und ein skript dann mailit als input nähme
|
[11:01] <Enno`> und ein skript dann mailit als input nähme
|
||||||
|
|
Loading…
Reference in New Issue