forked from github/server
new spell lists for E2K9
new magic code for E2K9
This commit is contained in:
parent
591c85d4c7
commit
708a6ceb8e
29 changed files with 742 additions and 774 deletions
|
@ -1324,7 +1324,7 @@ report_computer(const char * filename, report_context * ctx, const char * charse
|
|||
}
|
||||
fprintf(F, "%d;Rekrutierungskosten\n", f->race->recruitcost);
|
||||
fprintf(F, "%d;Anzahl Personen\n", count_all(f));
|
||||
fprintf(F, "\"%s\";Magiegebiet\n", magietypen[f->magiegebiet]);
|
||||
fprintf(F, "\"%s\";Magiegebiet\n", magic_school[f->magiegebiet]);
|
||||
|
||||
if (f->race == new_race[RC_HUMAN]) {
|
||||
fprintf(F, "%d;Anzahl Immigranten\n", count_migrants(f));
|
||||
|
|
|
@ -370,13 +370,15 @@ give_unit(unit * u, unit * u2, order * ord)
|
|||
}
|
||||
}
|
||||
if (has_skill(u, SK_MAGIC)) {
|
||||
sc_mage * mage;
|
||||
if (count_skill(u2->faction, SK_MAGIC) + u->number >
|
||||
skill_limit(u2->faction, SK_MAGIC))
|
||||
{
|
||||
cmistake(u, ord, 155, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
if (u2->faction->magiegebiet != find_magetype(u)) {
|
||||
mage = get_mage(u);
|
||||
if (!mage || u2->faction->magiegebiet != mage->magietyp) {
|
||||
cmistake(u, ord, 157, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ use_antimagiccrystal(unit * u, const struct item_type * itype, int amount, struc
|
|||
for (i=0;i!=amount;++i) {
|
||||
int effect, duration = 2;
|
||||
double force;
|
||||
spell *sp = find_spell(M_GRAU, "antimagiczone");
|
||||
spell *sp = find_spell(M_NONE, "antimagiczone");
|
||||
attrib ** ap = &r->attribs;
|
||||
unused(ord);
|
||||
assert(sp);
|
||||
|
|
|
@ -3409,7 +3409,7 @@ update_spells(void)
|
|||
if (u->faction!=NULL && u->number>0) {
|
||||
sc_mage *m = get_mage(u);
|
||||
if (!is_monsters(u->faction) && m != NULL) {
|
||||
if (m->magietyp == M_GRAU) continue;
|
||||
if (m->magietyp == M_GRAY) continue;
|
||||
updatespelllist(u);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1936,7 +1936,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars
|
|||
rnl(F);
|
||||
sprintf(buf, "%s, %s/%s (%s)", factionname(f),
|
||||
LOC(f->locale, rc_name(f->race, 1)),
|
||||
LOC(f->locale, mkname("school", magietypen[f->magiegebiet])),
|
||||
LOC(f->locale, mkname("school", magic_school[f->magiegebiet])),
|
||||
f->email);
|
||||
centre(F, buf, true);
|
||||
if (f->alliance!=NULL) {
|
||||
|
|
|
@ -67,10 +67,10 @@ spy_message(int spy, const unit *u, const unit *target)
|
|||
|
||||
ADDMSG(&u->faction->msgs, msg_message("spyreport", "spy target status", u, target, str));
|
||||
if (spy > 20) {
|
||||
sc_mage * m = get_mage(target);
|
||||
sc_mage * mage = get_mage(target);
|
||||
/* bei Magiern Zaubersprüche und Magiegebiet */
|
||||
if (m) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("spyreport_mage", "target type", target, magietypen[find_magetype(target)]));
|
||||
if (mage) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("spyreport_mage", "target type", target, magic_school[mage->magietyp]));
|
||||
}
|
||||
}
|
||||
if (spy > 6) {
|
||||
|
|
|
@ -435,8 +435,9 @@ teach_cmd(unit * u, struct order * ord)
|
|||
if (sk == SK_MAGIC) {
|
||||
/* ist der Magier schon spezialisiert, so versteht er nur noch
|
||||
* Lehrer seines Gebietes */
|
||||
if (find_magetype(u2) != 0 && find_magetype(u) != find_magetype(u2))
|
||||
{
|
||||
sc_mage * mage1 = get_mage(u);
|
||||
sc_mage * mage2 = get_mage(u2);
|
||||
if (!mage2 || !mage1 || mage1->magietyp!=mage2->magietyp) {
|
||||
if (feedback) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_different_magic", "target", u2));
|
||||
}
|
||||
|
@ -549,7 +550,7 @@ learn_cmd(unit * u, order * ord)
|
|||
if (is_familiar(u)){
|
||||
/* Vertraute zählen nicht zu den Magiern einer Partei,
|
||||
* können aber nur Graue Magie lernen */
|
||||
mtyp = M_GRAU;
|
||||
mtyp = M_GRAY;
|
||||
if (!is_mage(u)) create_mage(u, mtyp);
|
||||
} else if (!has_skill(u, SK_MAGIC)) {
|
||||
int mmax = skill_limit(u->faction, SK_MAGIC);
|
||||
|
@ -560,7 +561,7 @@ learn_cmd(unit * u, order * ord)
|
|||
return 0;
|
||||
}
|
||||
mtyp = getmagicskill(u->faction->locale);
|
||||
if (mtyp == M_NONE || mtyp == M_GRAU) {
|
||||
if (mtyp == M_NONE || mtyp == M_GRAY) {
|
||||
/* wurde kein Magiegebiet angegeben, wird davon
|
||||
* ausgegangen, daß das normal gelernt werden soll */
|
||||
if(u->faction->magiegebiet != 0) {
|
||||
|
|
|
@ -93,12 +93,12 @@ out_faction(FILE *file, const struct faction *f)
|
|||
if (alliances!=NULL) {
|
||||
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
||||
f->name, itoa36(f->no), f->alliance?f->alliance->id:0,
|
||||
LOC(default_locale, rc_name(f->race, 0)), magietypen[f->magiegebiet],
|
||||
LOC(default_locale, rc_name(f->race, 0)), magic_school[f->magiegebiet],
|
||||
f->no_units, f->num_total, f->money, turn - f->lastorders);
|
||||
} else {
|
||||
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d NMR\n",
|
||||
factionname(f), LOC(default_locale, rc_name(f->race, 0)),
|
||||
magietypen[f->magiegebiet], f->no_units, f->num_total, f->money,
|
||||
magic_school[f->magiegebiet], f->no_units, f->num_total, f->money,
|
||||
turn - f->lastorders);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2057,9 +2057,25 @@ init_locale(const struct locale * lang)
|
|||
#endif
|
||||
|
||||
tokens = get_translations(lang, UT_MAGIC);
|
||||
for (i=0;i!=MAXMAGIETYP;++i) {
|
||||
var.i = i;
|
||||
addtoken(tokens, LOC(lang, mkname("school", magietypen[i])), var);
|
||||
if (tokens) {
|
||||
const char * str = get_param(global.parameters, "rules.magic.playerschools");
|
||||
char * sstr, * tok;
|
||||
if (str==NULL) {
|
||||
str = "gwyrrd illaun draig cerddor tybied";
|
||||
}
|
||||
|
||||
sstr = strdup(str);
|
||||
tok = strtok(sstr, " ");
|
||||
while (tok) {
|
||||
for (i=0;i!=MAXMAGIETYP;++i) {
|
||||
if (strcmp(tok, magic_school[i])==0) break;
|
||||
}
|
||||
assert(i!=MAXMAGIETYP);
|
||||
var.i = i;
|
||||
addtoken(tokens, LOC(lang, mkname("school", tok)), var);
|
||||
tok = strtok(NULL, " ");
|
||||
}
|
||||
free(sstr);
|
||||
}
|
||||
|
||||
tokens = get_translations(lang, UT_DIRECTIONS);
|
||||
|
|
|
@ -74,14 +74,15 @@
|
|||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
const char *magietypen[MAXMAGIETYP] =
|
||||
const char *magic_school[MAXMAGIETYP] =
|
||||
{
|
||||
"gray",
|
||||
"illaun",
|
||||
"tybied",
|
||||
"cerddor",
|
||||
"gwyrrd",
|
||||
"draig"
|
||||
"draig",
|
||||
"common"
|
||||
};
|
||||
|
||||
attrib_type at_reportspell = {
|
||||
|
@ -219,11 +220,11 @@ void read_spellist(struct spell_list ** slistp, struct storage * store)
|
|||
if (store->version<SPELLNAME_VERSION) {
|
||||
int i = store->r_int(store);
|
||||
if (i < 0) break;
|
||||
sp = find_spellbyid(M_GRAU, (spellid_t)i);
|
||||
sp = find_spellbyid(M_NONE, (spellid_t)i);
|
||||
} else {
|
||||
store->r_tok_buf(store, spname, sizeof(spname));
|
||||
if (strcmp(spname, "end")==0) break;
|
||||
sp = find_spell(M_GRAU, spname);
|
||||
sp = find_spell(M_NONE, spname);
|
||||
}
|
||||
if (sp!=NULL) {
|
||||
add_spell(slistp, sp);
|
||||
|
@ -327,20 +328,6 @@ get_mage(const unit * u)
|
|||
return (sc_mage *) NULL;
|
||||
}
|
||||
|
||||
magic_t
|
||||
find_magetype(const unit * u)
|
||||
{
|
||||
sc_mage *m;
|
||||
|
||||
/* Null abfangen! */
|
||||
m = get_mage(u);
|
||||
|
||||
if (!m)
|
||||
return 0;
|
||||
|
||||
return m->magietyp;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Ausgabe der Spruchbeschreibungen
|
||||
* Anzeige des Spruchs nur, wenn die Stufe des besten Magiers vorher
|
||||
|
@ -360,7 +347,7 @@ read_seenspell(attrib * a, struct storage * store)
|
|||
store->r_tok_buf(store, token, sizeof(token));
|
||||
i = atoi(token);
|
||||
if (i!=0) {
|
||||
sp = find_spellbyid(M_GRAU, (spellid_t)i);
|
||||
sp = find_spellbyid(M_NONE, (spellid_t)i);
|
||||
} else {
|
||||
int mtype;
|
||||
mtype = store->r_int(store);
|
||||
|
@ -397,7 +384,23 @@ already_seen(const faction * f, const spell * sp)
|
|||
return false;
|
||||
}
|
||||
|
||||
#define GRAYSPELLS 2 /* number of new gray spells per level */
|
||||
static boolean know_school(const faction * f, magic_t school)
|
||||
{
|
||||
static int common = MAXMAGIETYP;
|
||||
if (f->magiegebiet==school) return true;
|
||||
if (common==MAXMAGIETYP) {
|
||||
const char * school = get_param(global.parameters, "rules.magic.common");
|
||||
for (common=0;common!=MAXMAGIETYP;++common) {
|
||||
if (strcmp(school, magic_school[common])==0) break;
|
||||
}
|
||||
if (common==MAXMAGIETYP) {
|
||||
common = M_NONE;
|
||||
}
|
||||
}
|
||||
return school==common;
|
||||
}
|
||||
|
||||
#define COMMONSPELLS 1 /* number of new common spells per level */
|
||||
#define MAXSPELLS 256
|
||||
|
||||
/** update the spellbook with a new level
|
||||
|
@ -406,16 +409,16 @@ already_seen(const faction * f, const spell * sp)
|
|||
void
|
||||
update_spellbook(faction * f, int level)
|
||||
{
|
||||
spell * grayspells[MAXSPELLS];
|
||||
spell * commonspells[MAXSPELLS];
|
||||
int numspells = 0;
|
||||
spell_list * slist;
|
||||
|
||||
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||
spell * sp = slist->data;
|
||||
if (sp->magietyp == M_GRAU && level<f->max_spelllevel && sp->level<=level) {
|
||||
grayspells[numspells++] = sp;
|
||||
if (sp->magietyp == M_COMMON && level<f->max_spelllevel && sp->level<=level) {
|
||||
commonspells[numspells++] = sp;
|
||||
} else {
|
||||
if (sp->magietyp == f->magiegebiet && sp->level <= level) {
|
||||
if (know_school(f, sp->magietyp) && sp->level <= level) {
|
||||
if (!has_spell(f->spellbook, sp)) {
|
||||
add_spell(&f->spellbook, sp);
|
||||
}
|
||||
|
@ -424,7 +427,7 @@ update_spellbook(faction * f, int level)
|
|||
}
|
||||
while (numspells>0 && level>f->max_spelllevel) {
|
||||
int i;
|
||||
for (i=0;i!=GRAYSPELLS;++i) {
|
||||
for (i=0;i!=COMMONSPELLS;++i) {
|
||||
int maxspell = numspells;
|
||||
int spellno = -1;
|
||||
spell * sp;
|
||||
|
@ -433,13 +436,13 @@ update_spellbook(faction * f, int level)
|
|||
--maxspell;
|
||||
}
|
||||
spellno = rng_int() % maxspell;
|
||||
sp = grayspells[spellno];
|
||||
sp = commonspells[spellno];
|
||||
}
|
||||
while (maxspell>0 && sp && sp->level<=f->max_spelllevel);
|
||||
|
||||
if (sp) {
|
||||
add_spell(&f->spellbook, sp);
|
||||
grayspells[spellno] = 0;
|
||||
commonspells[spellno] = 0;
|
||||
}
|
||||
}
|
||||
++f->max_spelllevel;
|
||||
|
@ -451,10 +454,10 @@ void wyrm_update(unit * u, struct sc_mage * mage, int sk)
|
|||
{
|
||||
spell_list * slist, ** slistp;
|
||||
/* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */
|
||||
spell * sp = find_spellbyid(M_GRAU, SPL_BECOMEWYRM);
|
||||
spell * sp = find_spellbyid(M_GRAY, SPL_BECOMEWYRM);
|
||||
|
||||
if (fspecial(u->faction, FS_WYRM) && !has_spell(u, sp) && sp->level<=sk) {
|
||||
add_spell(mage, find_spellbyid(M_GRAU, SPL_BECOMEWYRM));
|
||||
add_spell(mage, find_spellbyid(M_GRAY, SPL_BECOMEWYRM));
|
||||
}
|
||||
|
||||
/* Transformierte Wyrm-Magier bekommen Drachenodem */
|
||||
|
@ -463,19 +466,19 @@ void wyrm_update(unit * u, struct sc_mage * mage, int sk)
|
|||
switch (urc) {
|
||||
/* keine breaks! Wyrme sollen alle drei Zauber können.*/
|
||||
case RC_WYRM:
|
||||
sp = find_spellbyid(M_GRAU, SPL_WYRMODEM);
|
||||
sp = find_spellbyid(M_GRAY, SPL_WYRMODEM);
|
||||
slistp = get_spelllist(mage, u->faction);
|
||||
if (sp!=NULL && !has_spell(*slistp, sp) && sp->level<=sk) {
|
||||
add_spell(slistp, sp);
|
||||
}
|
||||
case RC_DRAGON:
|
||||
sp = find_spellbyid(M_GRAU, SPL_DRAGONODEM);
|
||||
sp = find_spellbyid(M_GRAY, SPL_DRAGONODEM);
|
||||
slistp = get_spelllist(mage, u->faction);
|
||||
if (sp!=NULL && !has_spell(*slistp, sp) && sp->level<=sk) {
|
||||
add_spell(slistp, sp);
|
||||
}
|
||||
case RC_FIREDRAGON:
|
||||
sp = find_spellbyid(M_GRAU, SPL_FIREDRAGONODEM);
|
||||
sp = find_spellbyid(M_GRAY, SPL_FIREDRAGONODEM);
|
||||
slistp = get_spelllist(mage, u->faction);
|
||||
if (sp!=NULL && !has_spell(*slistp, sp) && sp->level<=sk) {
|
||||
add_spell(slistp, sp);
|
||||
|
@ -493,15 +496,14 @@ updatespelllist(unit * u)
|
|||
int sk = eff_skill(u, SK_MAGIC, u->region);
|
||||
spell_list * slist = spells;
|
||||
struct sc_mage * mage = get_mage(u);
|
||||
magic_t gebiet = find_magetype(u);
|
||||
boolean ismonster = is_monsters(u->faction);
|
||||
|
||||
/* Magier mit keinem bzw M_GRAU bekommen weder Sprüche angezeigt noch
|
||||
/* Magier mit keinem bzw M_GRAY bekommen weder Sprüche angezeigt noch
|
||||
* neue Sprüche in ihre List-of-known-spells. Das sind zb alle alten
|
||||
* Drachen, die noch den Skill Magie haben */
|
||||
|
||||
if (FactionSpells()) {
|
||||
spells = u->faction->spellbook;
|
||||
slist = u->faction->spellbook;
|
||||
}
|
||||
|
||||
for (;slist!=NULL;slist=slist->next) {
|
||||
|
@ -509,7 +511,7 @@ updatespelllist(unit * u)
|
|||
if (sp->level<=sk) {
|
||||
boolean know = u_hasspell(u, sp);
|
||||
|
||||
if (know || (gebiet!=M_GRAU && sp->magietyp == gebiet)) {
|
||||
if (know || know_school(u->faction, sp->magietyp)) {
|
||||
faction * f = u->faction;
|
||||
|
||||
if (!know) add_spell(get_spelllist(mage, u->faction), sp);
|
||||
|
@ -966,31 +968,33 @@ pay_spell(unit * u, const spell * sp, int cast_level, int range)
|
|||
boolean
|
||||
knowsspell(const region * r, const unit * u, const spell * sp)
|
||||
{
|
||||
/* Ist überhaupt ein gültiger Spruch angegeben? */
|
||||
if (!sp || (sp->id == SPL_NOSPELL)) {
|
||||
return false;
|
||||
}
|
||||
/* Magier? */
|
||||
if (get_mage(u) == NULL) {
|
||||
log_warning(("%s ist kein Magier, versucht aber zu zaubern.\n",
|
||||
unitname(u)));
|
||||
return false;
|
||||
}
|
||||
/* steht der Spruch in der Spruchliste? */
|
||||
if (!u_hasspell(u, sp)) {
|
||||
/* ist der Spruch aus einem anderen Magiegebiet? */
|
||||
if (find_magetype(u) != sp->magietyp) {
|
||||
return false;
|
||||
}
|
||||
if (eff_skill(u, SK_MAGIC, u->region) >= sp->level) {
|
||||
log_warning(("%s ist hat die erforderliche Stufe, kennt aber %s nicht.\n",
|
||||
unitname(u), spell_name(sp, default_locale)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
sc_mage * mage;
|
||||
/* Ist überhaupt ein gültiger Spruch angegeben? */
|
||||
if (!sp || (sp->id == SPL_NOSPELL)) {
|
||||
return false;
|
||||
}
|
||||
/* Magier? */
|
||||
mage = get_mage(u);
|
||||
if (mage == NULL) {
|
||||
log_warning(("%s ist kein Magier, versucht aber zu zaubern.\n",
|
||||
unitname(u)));
|
||||
return false;
|
||||
}
|
||||
/* steht der Spruch in der Spruchliste? */
|
||||
if (!u_hasspell(u, sp)) {
|
||||
/* ist der Spruch aus einem anderen Magiegebiet? */
|
||||
if (know_school(u->faction, sp->magietyp)) {
|
||||
return false;
|
||||
}
|
||||
if (eff_skill(u, SK_MAGIC, u->region) >= sp->level) {
|
||||
log_warning(("%s ist hat die erforderliche Stufe, kennt aber %s nicht.\n",
|
||||
unitname(u), spell_name(sp, default_locale)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* hier sollten alle potentiellen Fehler abgefangen sein */
|
||||
return true;
|
||||
/* hier sollten alle potentiellen Fehler abgefangen sein */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Um einen Spruch zu beherrschen, muss der Magier die Stufe des
|
||||
|
@ -1326,7 +1330,7 @@ fumble(region * r, unit * u, const spell * sp, int cast_grade)
|
|||
|
||||
if (btype) patzer -= btype->fumblebonus;
|
||||
/* CHAOSPATZERCHANCE 10 : +10% Chance zu Patzern */
|
||||
if (sp->magietyp == M_CHAOS) {
|
||||
if (sp->magietyp == M_DRAIG) {
|
||||
patzer += CHAOSPATZERCHANCE;
|
||||
}
|
||||
if (is_cursed(u->attribs, C_MBOOST, 0) == true) {
|
||||
|
|
|
@ -83,16 +83,18 @@ typedef struct strarray {
|
|||
|
||||
/* typedef unsigned char magic_t; */
|
||||
enum {
|
||||
M_GRAU, /* none */
|
||||
M_TRAUM, /* Illaun */
|
||||
M_ASTRAL, /* Tybied */
|
||||
M_BARDE, /* Cerddor */
|
||||
M_DRUIDE, /* Gwyrrd */
|
||||
M_CHAOS, /* Draig */
|
||||
MAXMAGIETYP,
|
||||
M_NONE = (magic_t) -1
|
||||
M_GRAY = 0, /* Gray */
|
||||
M_ILLAUN = 1, /* Illaun */
|
||||
M_TYBIED = 2, /* Tybied */
|
||||
M_CERDDOR = 3, /* Cerddor */
|
||||
M_GWYRRD = 4, /* Gwyrrd */
|
||||
M_DRAIG = 5, /* Draig */
|
||||
M_COMMON = 6, /* common spells */
|
||||
MAXMAGIETYP,
|
||||
/* this enum is stored in the datafile, so do not change the numbers around */
|
||||
M_NONE = (magic_t) -1
|
||||
};
|
||||
extern const char *magietypen[MAXMAGIETYP];
|
||||
extern const char *magic_school[MAXMAGIETYP];
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Magier:
|
||||
|
@ -262,8 +264,6 @@ sc_mage * create_mage(struct unit *u, magic_t mtyp);
|
|||
* und initialisiert den Magiertypus mit mtyp. */
|
||||
sc_mage * get_mage(const struct unit *u);
|
||||
/* gibt u->mage zurück, bei nicht-Magiern *NULL */
|
||||
magic_t find_magetype(const struct unit *u);
|
||||
/* gibt den Magietyp der struct unit zurück, bei nicht-Magiern 0 */
|
||||
boolean is_mage(const struct unit *u);
|
||||
/* gibt true, wenn u->mage gesetzt. */
|
||||
boolean is_familiar(const struct unit *u);
|
||||
|
|
|
@ -1323,7 +1323,7 @@ movement_speed(unit * u)
|
|||
* Nicht kumulativ mit anderen Beschleunigungen! */
|
||||
if (mp*dk <= BP_WALKING*u->race->speed && is_astral(u->region) && is_mage(u)) {
|
||||
sc_mage * mage = get_mage(u);
|
||||
if (mage->magietyp == M_ASTRAL || mage->magietyp == M_TRAUM) {
|
||||
if (mage->magietyp == M_TYBIED || mage->magietyp == M_ILLAUN) {
|
||||
mp *= 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -801,8 +801,9 @@ spskill(char * buffer, size_t size, const struct locale * lang, const struct uni
|
|||
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
||||
|
||||
if (sv->id == SK_MAGIC){
|
||||
if (find_magetype(u) != M_GRAU){
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, mkname("school", magietypen[find_magetype(u)])), size);
|
||||
sc_mage * mage = get_mage(u);
|
||||
if (mage && mage->magietyp != M_GRAY) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, mkname("school", magic_school[mage->magietyp])), size);
|
||||
tsize += bytes;
|
||||
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ find_spell(magic_t mtype, const char * name)
|
|||
while (slist) {
|
||||
spell * sp = slist->data;
|
||||
if (strcmp(name, sp->sname)==0) {
|
||||
if (sp->magietyp==mtype) return sp;
|
||||
if (mtype==M_NONE || sp->magietyp==mtype) return sp;
|
||||
spx = sp;
|
||||
}
|
||||
slist = slist->next;
|
||||
|
@ -180,7 +180,7 @@ find_spellbyid(magic_t mtype, spellid_t id)
|
|||
spell* sp = slist->data;
|
||||
unsigned int hashid = hashstring(sp->sname);
|
||||
if (hashid==id) {
|
||||
if (sp->magietyp==mtype || mtype==M_GRAU) {
|
||||
if (sp->magietyp==mtype || mtype==M_NONE) {
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1204,13 +1204,13 @@ add_spells(equipment * eq, xmlNodeSetPtr nsetItems)
|
|||
for (i=0;i!=nsetItems->nodeNr;++i) {
|
||||
xmlNodePtr node = nsetItems->nodeTab[i];
|
||||
xmlChar * propValue;
|
||||
magic_t mtype = M_GRAU;
|
||||
magic_t mtype = M_NONE;
|
||||
struct spell * sp;
|
||||
|
||||
propValue = xmlGetProp(node, BAD_CAST "school");
|
||||
if (propValue!=NULL) {
|
||||
for (mtype=0;mtype!=MAXMAGIETYP;++mtype) {
|
||||
if (strcmp((const char*)propValue, magietypen[mtype])==0) break;
|
||||
if (strcmp((const char*)propValue, magic_school[mtype])==0) break;
|
||||
}
|
||||
assert(mtype!=MAXMAGIETYP);
|
||||
xmlFree(propValue);
|
||||
|
@ -1408,7 +1408,7 @@ parse_spells(xmlDocPtr doc)
|
|||
propValue = xmlGetProp(node, BAD_CAST "type");
|
||||
assert(propValue!=NULL);
|
||||
for (sp->magietyp=0;sp->magietyp!=MAXMAGIETYP;++sp->magietyp) {
|
||||
if (strcmp(magietypen[sp->magietyp], (const char *)propValue)==0) break;
|
||||
if (strcmp(magic_school[sp->magietyp], (const char *)propValue)==0) break;
|
||||
}
|
||||
assert(sp->magietyp!=MAXMAGIETYP);
|
||||
xmlFree(propValue);
|
||||
|
|
|
@ -200,7 +200,7 @@ age_hurting(attrib * a) {
|
|||
if (b==NULL) return AT_AGE_REMOVE;
|
||||
for (u=b->region->units;u;u=u->next) {
|
||||
if (u->building==b) {
|
||||
if (u->faction->magiegebiet==M_CHAOS) {
|
||||
if (u->faction->magiegebiet==M_DRAIG) {
|
||||
active ++;
|
||||
ADDMSG(&b->region->msgs, msg_message("praytoigjarjuk", "unit", u));
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ age_hurting(attrib * a) {
|
|||
}
|
||||
if (active) for (u=b->region->units;u;u=u->next) if (playerrace(u->faction->race)) {
|
||||
int i;
|
||||
if (u->faction->magiegebiet!=M_CHAOS) {
|
||||
if (u->faction->magiegebiet!=M_DRAIG) {
|
||||
for (i=0;i!=active;++i) u->hp = (u->hp+1) / 2; /* make them suffer, but not die */
|
||||
ADDMSG(&b->region->msgs, msg_message("cryinpain", "unit", u));
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ tower_init(void)
|
|||
b->size = 10;
|
||||
if (i!=0) {
|
||||
sprintf(buf, "Turm des %s",
|
||||
LOC(default_locale, mkname("school", magietypen[i])));
|
||||
LOC(default_locale, mkname("school", magic_school[i])));
|
||||
}
|
||||
else sprintf(buf, "Turm der Ahnungslosen");
|
||||
set_string(&b->name, buf);
|
||||
|
|
|
@ -38,7 +38,7 @@ oldfamiliars(unit * u)
|
|||
/* these familiars have no special skills.
|
||||
*/
|
||||
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
|
||||
create_mage(u, M_GRAU);
|
||||
create_mage(u, M_GRAY);
|
||||
equip_unit(u, get_equipment(fname));
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -152,7 +152,7 @@ lua_initfamiliar(unit * u)
|
|||
}
|
||||
|
||||
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
|
||||
create_mage(u, M_GRAU);
|
||||
create_mage(u, M_GRAY);
|
||||
equip_unit(u, get_equipment(fname));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace luabind;
|
|||
static const char *
|
||||
spell_getschool(const spell& sp)
|
||||
{
|
||||
return magietypen[sp.magietyp];
|
||||
return magic_school[sp.magietyp];
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -422,7 +422,7 @@ static const char *
|
|||
unit_getmagic(const unit * u)
|
||||
{
|
||||
sc_mage * mage = get_mage(u);
|
||||
return mage?magietypen[mage->magietyp]:NULL;
|
||||
return mage?magic_school[mage->magietyp]:NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -431,7 +431,7 @@ unit_setmagic(unit * u, const char * type)
|
|||
sc_mage * mage = get_mage(u);
|
||||
magic_t mtype;
|
||||
for (mtype=0;mtype!=MAXMAGIETYP;++mtype) {
|
||||
if (strcmp(magietypen[mtype], type)==0) break;
|
||||
if (strcmp(magic_school[mtype], type)==0) break;
|
||||
}
|
||||
if (mtype==MAXMAGIETYP) return;
|
||||
if (mage==NULL) {
|
||||
|
|
|
@ -609,7 +609,7 @@ write_spells(void)
|
|||
strcat(components, LOC(loc, spc->type->_name[0]));
|
||||
strcat(components, ",");
|
||||
}
|
||||
fprintf(F, "%s;%d;%s;%s\n", LOC(loc, mkname("spell", sp->sname)), sp->level, LOC(loc, mkname("school", magietypen[sp->magietyp])), components);
|
||||
fprintf(F, "%s;%d;%s;%s\n", LOC(loc, mkname("spell", sp->sname)), sp->level, LOC(loc, mkname("school", magic_school[sp->magietyp])), components);
|
||||
}
|
||||
fclose(F);
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ static const char *
|
|||
unit_getmagic(const unit * u)
|
||||
{
|
||||
sc_mage * mage = get_mage(u);
|
||||
return mage?magietypen[mage->magietyp]:NULL;
|
||||
return mage?magic_school[mage->magietyp]:NULL;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_magic(lua_State* tolua_S)
|
||||
|
@ -234,7 +234,7 @@ unit_setmagic(unit * u, const char * type)
|
|||
sc_mage * mage = get_mage(u);
|
||||
magic_t mtype;
|
||||
for (mtype=0;mtype!=MAXMAGIETYP;++mtype) {
|
||||
if (strcmp(magietypen[mtype], type)==0) break;
|
||||
if (strcmp(magic_school[mtype], type)==0) break;
|
||||
}
|
||||
if (mtype==MAXMAGIETYP) return;
|
||||
if (mage==NULL) {
|
||||
|
|
|
@ -733,7 +733,7 @@ tolua_write_spells(lua_State* tolua_S)
|
|||
if (sp->sp_function!=fun) {
|
||||
xmlNodePtr node = xmlNewNode(NULL, BAD_CAST "spell");
|
||||
xmlNewProp(node, BAD_CAST "name", BAD_CAST sp->sname);
|
||||
xmlNewProp(node, BAD_CAST "type", BAD_CAST magietypen[sp->magietyp]);
|
||||
xmlNewProp(node, BAD_CAST "type", BAD_CAST magic_school[sp->magietyp]);
|
||||
xmlNewProp(node, BAD_CAST "rank", xml_i(sp->rank));
|
||||
xmlNewProp(node, BAD_CAST "level", xml_i(sp->level));
|
||||
xmlNewProp(node, BAD_CAST "index", xml_i(sp->id));
|
||||
|
@ -779,7 +779,7 @@ tolua_write_spells(lua_State* tolua_S)
|
|||
static int
|
||||
tolua_get_spell_text(lua_State *tolua_S)
|
||||
{
|
||||
const struct locale * loc = find_locale("en");
|
||||
const struct locale * loc = default_locale;
|
||||
spell * self = (spell *)tolua_tousertype(tolua_S, 1, 0);
|
||||
lua_pushstring(tolua_S, spell_info(self, loc));
|
||||
return 1;
|
||||
|
@ -789,7 +789,7 @@ static int
|
|||
tolua_get_spell_school(lua_State *tolua_S)
|
||||
{
|
||||
spell * self = (spell *)tolua_tousertype(tolua_S, 1, 0);
|
||||
lua_pushstring(tolua_S, magietypen[self->magietyp]);
|
||||
lua_pushstring(tolua_S, magic_school[self->magietyp]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -804,8 +804,9 @@ tolua_get_spell_level(lua_State *tolua_S)
|
|||
static int
|
||||
tolua_get_spell_name(lua_State *tolua_S)
|
||||
{
|
||||
const struct locale * lang = default_locale;
|
||||
spell * self = (spell *)tolua_tousertype(tolua_S, 1, 0);
|
||||
lua_pushstring(tolua_S, self->sname);
|
||||
lua_pushstring(tolua_S, spell_name(self, lang));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ lua_initfamiliar(unit * u)
|
|||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
create_mage(u, M_GRAU);
|
||||
create_mage(u, M_GRAY);
|
||||
|
||||
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
|
||||
equip_unit(u, get_equipment(fname));
|
||||
|
|
|
@ -4493,7 +4493,7 @@
|
|||
</string>
|
||||
<string name="reanimate">
|
||||
<text locale="de">Wiederbelebung</text>
|
||||
<text locale="en">Ressurection</text>
|
||||
<text locale="en">Resurrection</text>
|
||||
</string>
|
||||
<string name="analysedream">
|
||||
<text locale="de">Traumbilder analysieren</text>
|
||||
|
@ -4665,11 +4665,10 @@
|
|||
</text>
|
||||
</string>
|
||||
<string name="song_of_slavery">
|
||||
<text locale="de">
|
||||
Dieser mächtige Bann raubt dem Opfer seinen freien Willen und
|
||||
unterwirft sie den Befehlen des Barden. Für einige Zeit wird das Opfer
|
||||
<text locale="de">Dieser mächtige Bann raubt dem Opfer seinen freien Willen
|
||||
und unterwirft sie den Befehlen des Barden. Für einige Zeit wird das Opfer
|
||||
sich völlig von seinen eigenen Leuten abwenden und der Partei des Barden
|
||||
zugehörig fühlen."
|
||||
zugehörig fühlen.
|
||||
</text>
|
||||
</string>
|
||||
<string name="song_of_peace">
|
||||
|
@ -6668,6 +6667,10 @@
|
|||
</namespace>
|
||||
|
||||
<namespace name="school">
|
||||
<string name="common">
|
||||
<text locale="de">Gemein</text>
|
||||
<text locale="en">common</text>
|
||||
</string>
|
||||
<string name="nomagic">
|
||||
<text locale="de">Kein Magiegebiet</text>
|
||||
<text locale="en">no magic school yet</text>
|
||||
|
|
|
@ -123,9 +123,11 @@
|
|||
<param name="rules.combat.herospeed" value="3"/>
|
||||
<param name="rules.combat.skill_bonus" value="0"/>
|
||||
<param name="rules.combat.loot" value="3"/> <!-- only self + monsters -->
|
||||
<param name="rules.cavalry.skill" value="4"/>
|
||||
<param name="rules.cavalry.mode" value="1"/>
|
||||
<param name="rules.cavalry.skill" value="4"/>
|
||||
<param name="rules.cavalry.mode" value="1"/>
|
||||
<param name="rules.magic.factionlist" value="1"/>
|
||||
<param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone -->
|
||||
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
|
||||
<param name="rules.economy.taxation" value="1"/>
|
||||
<param name="rules.give" value="3"/> <!-- only self + peasants -->
|
||||
<param name="rules.help.mask" value="fight guard money"/>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -255,7 +255,7 @@ local function test_spells()
|
|||
u:clear_orders()
|
||||
u:add_item("money", 10000)
|
||||
u:set_skill("magic", 5)
|
||||
u:add_order("LERNE MAGIE Tybied")
|
||||
u:add_order("LERNE MAGIE Illaun")
|
||||
process_orders()
|
||||
local sp
|
||||
local nums = 0
|
||||
|
@ -264,8 +264,9 @@ local function test_spells()
|
|||
nums = nums + 1
|
||||
end
|
||||
end
|
||||
assert(nums>0)
|
||||
for sp in u.spells do
|
||||
nums = nums - 1
|
||||
nums = nums - 1
|
||||
end
|
||||
assert(nums==0)
|
||||
end
|
||||
|
@ -312,8 +313,6 @@ local function test_alliance()
|
|||
assert(f1.alliance~=nil)
|
||||
assert(f2.alliance~=nil)
|
||||
assert(f2.alliance==f1.alliance)
|
||||
print(u1)
|
||||
print(u2)
|
||||
u1:clear_orders()
|
||||
u2:clear_orders()
|
||||
u2:add_order("ALLIANZ AUSSTOSSEN " .. itoa36(f1.id))
|
||||
|
@ -337,6 +336,15 @@ local function test_alliance()
|
|||
assert(f2.alliance~=nil)
|
||||
end
|
||||
|
||||
local function spells_csv()
|
||||
local f = io.open("spells.csv", "w")
|
||||
for sp in spells() do
|
||||
f:write('"' .. sp.name .. '",' .. sp.level .. ',' .. sp.school .. ',"' .. sp.text .. '"\n')
|
||||
end
|
||||
f:close()
|
||||
fail = 1
|
||||
end
|
||||
|
||||
loadscript("extensions.lua")
|
||||
tests = {
|
||||
["alliance"] = test_alliance,
|
||||
|
@ -356,7 +364,6 @@ tests = {
|
|||
["spells"] = test_spells
|
||||
}
|
||||
mytests = {
|
||||
["spells"] = test_spells
|
||||
}
|
||||
fail = 0
|
||||
for k, v in pairs(tests) do
|
||||
|
@ -369,6 +376,8 @@ for k, v in pairs(tests) do
|
|||
end
|
||||
end
|
||||
|
||||
-- spells_csv()
|
||||
|
||||
if fail > 0 then
|
||||
print(fail .. " tests failed.")
|
||||
io.stdin:read()
|
||||
|
|
Loading…
Reference in a new issue