Routine fuer "Teure Fremde" hat auch Untote korrigiert.

This commit is contained in:
Enno Rehling 2007-03-11 20:52:09 +00:00
parent 8b2897406c
commit e9feec08ba
5 changed files with 44 additions and 39 deletions

View File

@ -2035,8 +2035,8 @@ password_cmd(unit * u, struct order * ord)
strncpy(pbuf, s, 31);
pbuf[31] = 0;
c = pbuf;
while(*c) {
if(!isalnum(*c)) pwok = false;
while (*c) {
if (!isalnum(*c)) pwok = false;
c++;
}
if (pwok == false) {

View File

@ -1153,9 +1153,10 @@ demon_skillchanges(void)
while (weeks--) learn_skill(u, sv->id, 1.0);
}
if (sv->old>sv->level) {
log_printf("%s dropped from %u to %u:%u in %s\n",
unitname(u), sv->old, sv->level,
sv->weeks, skillname(sv->id, NULL));
if (!quiet) {
log_printf("%s dropped from %u to %u:%u in %s\n",
unitname(u), sv->old, sv->level, sv->weeks, skillname(sv->id, NULL));
}
}
}
++sv;

View File

@ -80,13 +80,13 @@ getmagicskill(void)
boolean
is_migrant(unit *u)
{
if (u->race == u->faction->race) return false;
if (u->race == u->faction->race) return false;
if (is_familiar(u)) return false;
if (fval(u->race, RCF_UNDEAD|RCF_ILLUSIONARY)) return false;
if (is_familiar(u)) return false;
if (u->race == new_race[RC_TOAD]) return false;
if (u->race == new_race[RC_TOAD]) return false;
return true;
return true;
}
/* ------------------------------------------------------------- */

View File

@ -103,15 +103,15 @@ enable_skill(const char * skname, boolean value)
skill_t
sk_find(const char * name)
{
skill_t i;
if (name==NULL) return NOSKILL;
skill_t i;
if (name==NULL) return NOSKILL;
if (strncmp(name, "sk_", 3)==0) name+=3;
for (i=0;i!=MAXSKILLS;++i) {
for (i=0;i!=MAXSKILLS;++i) {
if (skill_enabled[i]) {
if (strcmp(name, skillnames[i])==0) return i;
}
}
return NOSKILL;
}
return NOSKILL;
}
/** skillmod attribut **/

View File

@ -217,12 +217,18 @@ warn_items(void)
static boolean
kor_teure_talente(unit *u)
{
if(effskill(u, SK_TACTICS) >= 1 ||
effskill(u, SK_MAGIC) >= 1 ||
effskill(u, SK_ALCHEMY) >= 1 ||
effskill(u, SK_HERBALISM) >= 1 ||
effskill(u, SK_SPY) >= 1) {
return true;
const skill_t expskills[] = { SK_ALCHEMY, SK_HERBALISM, SK_MAGIC, SK_SPY, SK_TACTICS, NOSKILL };
skill * sv = u->skills;
for (;sv!=u->skills+u->skill_size;++sv) {
int l = 0, h = 4;
skill_t sk = sv->id;
assert(expskills[h]==NOSKILL);
while (l<h) {
int m = (l+h)/2;
if (sk==expskills[m]) return true;
else if (sk>expskills[m]) l=m+1;
else h=m;
}
}
return false;
}
@ -231,25 +237,23 @@ static void
no_teurefremde(boolean convert)
{
const curse_type * slave_ct = ct_find("slavery");
region *r;
faction * f;
for(r=regions;r;r=r->next) {
unit *u;
for(u=r->units;u;u=u->next) {
if (u->faction->no != MONSTER_FACTION && playerrace(u->faction->race)
&& is_migrant(u) && kor_teure_talente(u))
{
if (slave_ct && curse_active(get_curse(u->attribs, slave_ct)))
continue;
log_warning(("Teurer Migrant: %s, Partei %s\n",
unitname(u), factionname(u->faction)));
if (convert) {
u->race = u->faction->race;
u->irace = u->faction->race;
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
unitname(u));
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
for (f=factions;f;f=f->next) {
if (f->no != MONSTER_FACTION) {
unit *u;
for (u=f->units;u;u=u->nextF) {
if (is_migrant(u) && kor_teure_talente(u)) {
if (slave_ct && curse_active(get_curse(u->attribs, slave_ct)))
continue;
log_warning(("Teurer Migrant: %s, Partei %s\n", unitname(u), factionname(f)));
if (convert) {
u->race = f->race;
u->irace = f->race;
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
unitname(u));
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
}
}
}
}