forked from github/server
Bugfix "Astrale Integrität"
Beschleunigung einiger Skill-Durchläufe
This commit is contained in:
parent
7201ca85ac
commit
29340f9217
7 changed files with 38 additions and 36 deletions
|
@ -578,7 +578,7 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
boolean itemcloak = is_cursed(u->attribs, C_ITEMCLOAK, 0);
|
boolean itemcloak = is_cursed(u->attribs, C_ITEMCLOAK, 0);
|
||||||
building * b;
|
building * b;
|
||||||
const char * pzTmp;
|
const char * pzTmp;
|
||||||
skill_t sk;
|
skill * sv;
|
||||||
strlist *S;
|
strlist *S;
|
||||||
const attrib *a_fshidden = NULL;
|
const attrib *a_fshidden = NULL;
|
||||||
|
|
||||||
|
@ -712,14 +712,15 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
|
|
||||||
/* talents */
|
/* talents */
|
||||||
pr = 0;
|
pr = 0;
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (has_skill(u, sk)) {
|
if (sv->level>0) {
|
||||||
|
skill_t sk = sv->id;
|
||||||
int esk = eff_skill(u, sk, r);
|
int esk = eff_skill(u, sk, r);
|
||||||
if (!pr) {
|
if (!pr) {
|
||||||
pr = 1;
|
pr = 1;
|
||||||
fprintf(F, "TALENTE\n");
|
fprintf(F, "TALENTE\n");
|
||||||
}
|
}
|
||||||
fprintf(F, "%d %d;%s\n", u->number*level_days(get_level(u, sk)), esk,
|
fprintf(F, "%d %d;%s\n", u->number*level_days(sv->level), esk,
|
||||||
add_translation(skillname(sk, NULL), skillname(sk, f->locale)));
|
add_translation(skillname(sk, NULL), skillname(sk, f->locale)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -864,25 +864,25 @@ learn_monster(unit *u)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
int n;
|
int n;
|
||||||
skill_t sk;
|
skill * sv;
|
||||||
|
|
||||||
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
|
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
|
||||||
* Lerntage hat. */
|
* Lerntage hat. */
|
||||||
|
|
||||||
for(sk=0;sk<MAXSKILLS;sk++)
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (has_skill(u, sk)) c++;
|
if (sv->level>0) ++c;
|
||||||
|
}
|
||||||
|
|
||||||
if(c == 0) return;
|
if(c == 0) return;
|
||||||
|
|
||||||
n = rand()%c + 1;
|
n = rand()%c + 1;
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
for (sk=0;sk<MAXSKILLS;sk++) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (has_skill(u, sk)) {
|
if (sv->level>0) {
|
||||||
c++;
|
if (++c == n) {
|
||||||
if(c == n) {
|
|
||||||
sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_STUDY]),
|
sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_STUDY]),
|
||||||
skillname(sk, u->faction->locale));
|
skillname(sv->id, u->faction->locale));
|
||||||
set_string(&u->thisorder, buf);
|
set_string(&u->thisorder, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3170,7 +3170,6 @@ typedef struct summary {
|
||||||
summary *
|
summary *
|
||||||
make_summary(boolean count_new)
|
make_summary(boolean count_new)
|
||||||
{
|
{
|
||||||
char sk;
|
|
||||||
faction *f;
|
faction *f;
|
||||||
region *r;
|
region *r;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -3228,6 +3227,8 @@ make_summary(boolean count_new)
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
if (u->faction->no != MONSTER_FACTION) {
|
if (u->faction->no != MONSTER_FACTION) {
|
||||||
|
skill * sv;
|
||||||
|
|
||||||
s->nunits++;
|
s->nunits++;
|
||||||
s->playerpop += u->number;
|
s->playerpop += u->number;
|
||||||
s->spielerpferde += get_item(u, I_HORSE);
|
s->spielerpferde += get_item(u, I_HORSE);
|
||||||
|
@ -3264,9 +3265,9 @@ make_summary(boolean count_new)
|
||||||
|
|
||||||
s->spielerpferde += get_item(u, I_HORSE);
|
s->spielerpferde += get_item(u, I_HORSE);
|
||||||
|
|
||||||
for (sk = 0; sk < MAXSKILLS; sk++) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
int aktskill;
|
skill_t sk = sv->id;
|
||||||
aktskill = eff_skill(u, sk, r);
|
int aktskill = eff_skill(u, sk, r);
|
||||||
if (aktskill > s->maxskill) s->maxskill = aktskill;
|
if (aktskill > s->maxskill) s->maxskill = aktskill;
|
||||||
}
|
}
|
||||||
if (!fval(f, FL_DH)) {
|
if (!fval(f, FL_DH)) {
|
||||||
|
|
|
@ -490,10 +490,10 @@ static skill_t
|
||||||
random_skill(unit *u)
|
random_skill(unit *u)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
skill_t sk;
|
skill * sv;
|
||||||
|
|
||||||
for(sk=0;sk<MAXSKILLS;sk++) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (get_level(u, sk)) n++;
|
if (sv->level>0) ++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n == 0)
|
if(n == 0)
|
||||||
|
@ -501,10 +501,9 @@ random_skill(unit *u)
|
||||||
|
|
||||||
n = rand()%n;
|
n = rand()%n;
|
||||||
|
|
||||||
for(sk=0;sk<MAXSKILLS;sk++) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (get_level(u, sk)) {
|
if (sv->level>0) {
|
||||||
if(n == 0) return sk;
|
if (n-- == 0) return sv->id;
|
||||||
n--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -785,11 +785,11 @@ scale_number (unit * u, int n)
|
||||||
}
|
}
|
||||||
data->value = snew;
|
data->value = snew;
|
||||||
}
|
}
|
||||||
for (sk = 0; sk < MAXSKILLS; sk++) {
|
if (u->number==0 || n==0) {
|
||||||
if (n==0 || u->number == 0) {
|
for (sk = 0; sk < MAXSKILLS; sk++) {
|
||||||
remove_skill(u, sk);
|
remove_skill(u, sk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_number(u, n);
|
set_number(u, n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1263,14 +1263,15 @@ target_resists_magic(unit *magician, void *obj, int objtyp, int t_bonus)
|
||||||
case TYP_UNIT:
|
case TYP_UNIT:
|
||||||
{
|
{
|
||||||
int at, pa = 0;
|
int at, pa = 0;
|
||||||
skill_t i;
|
skill * sv;
|
||||||
|
unit * u = (unit*)obj;
|
||||||
|
|
||||||
if(fspecial(((unit *)obj)->faction, FS_MAGICIMMUNE)) return true;
|
if (fspecial(u->faction, FS_MAGICIMMUNE)) return true;
|
||||||
|
|
||||||
at = effskill(magician, SK_MAGIC);
|
at = effskill(magician, SK_MAGIC);
|
||||||
|
|
||||||
for (i=0;i<MAXSKILLS;i++) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
int sk = effskill((unit *)obj, i);
|
int sk = effskill(u, sv->id);
|
||||||
if (pa < sk) pa = sk;
|
if (pa < sk) pa = sk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6381,7 +6381,7 @@ sp_disruptastral(castorder *co)
|
||||||
|
|
||||||
rl = all_in_range(rt, (int)(power/5));
|
rl = all_in_range(rt, (int)(power/5));
|
||||||
|
|
||||||
for(rl2=rl; rl; rl=rl->next) {
|
for (rl2=rl; rl2!=NULL; rl2=rl2->next) {
|
||||||
attrib *a, *a2;
|
attrib *a, *a2;
|
||||||
spec_direction *sd;
|
spec_direction *sd;
|
||||||
|
|
||||||
|
@ -6391,7 +6391,7 @@ sp_disruptastral(castorder *co)
|
||||||
/* Nicht-Permanente Tore zerstören */
|
/* Nicht-Permanente Tore zerstören */
|
||||||
a = a_find(r->attribs, &at_direction);
|
a = a_find(r->attribs, &at_direction);
|
||||||
|
|
||||||
while(a) {
|
while (a!=NULL) {
|
||||||
a2 = a->nexttype;
|
a2 = a->nexttype;
|
||||||
sd = (spec_direction *)(a->data.v);
|
sd = (spec_direction *)(a->data.v);
|
||||||
if(sd->duration != -1) a_remove(&r->attribs, a);
|
if(sd->duration != -1) a_remove(&r->attribs, a);
|
||||||
|
@ -6424,9 +6424,9 @@ sp_disruptastral(castorder *co)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kontakt unterbinden */
|
/* Kontakt unterbinden */
|
||||||
create_curse(mage,&rl2->region->attribs, ct_find("astralblock"),
|
create_curse(mage, &rl2->region->attribs, ct_find("astralblock"),
|
||||||
power, duration, 100, 0);
|
power, duration, 100, 0);
|
||||||
addmessage(r, 0, "Mächtige Magie verhindert den Kontakt zur Realität.",
|
addmessage(rl2->region, 0, "Mächtige Magie verhindert den Kontakt zur Realität.",
|
||||||
MSG_COMMENT, ML_IMPORTANT);
|
MSG_COMMENT, ML_IMPORTANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue