Magie-Updates

This commit is contained in:
Enno Rehling 2009-07-13 16:19:01 +00:00
parent 75234b303b
commit e129125a90
5 changed files with 73 additions and 57 deletions

View file

@ -3481,20 +3481,41 @@ defaultorders (void)
static void static void
update_spells(void) update_spells(void)
{ {
region *r; faction * f;
for(r=regions; r; r=r->next) {
for (f=factions;f;f=f->next) {
if (f->magiegebiet!=M_NONE && !is_monsters(f)) {
unit * mages[MAXMAGICIANS];
unit *u; unit *u;
for(u=r->units;u;u=u->next) { int maxlevel = 0, n = 0, i;
if (u->faction!=NULL && u->number>0) {
sc_mage *m = get_mage(u); for (u=f->units;u && n<MAXMAGICIANS;u=u->nextF) {
if (!is_monsters(u->faction) && m != NULL) { if (u->number>0) {
if (m->magietyp == M_GRAY) continue; sc_mage *mage = get_mage(u);
updatespelllist(u); if (mage) {
} int level = eff_skill(u, SK_MAGIC, u->region);
if (level>maxlevel) maxlevel = level;
mages[n++] = u;
} }
} }
} }
if (FactionSpells() && maxlevel>f->max_spelllevel) {
update_spellbook(f, maxlevel);
for (i=0;i!=n;++i) {
sc_mage *mage = get_mage(mages[i]);
while (mage->spells) {
spell_list * slist = mage->spells;
mage->spells = slist->next;
free(slist);
}
}
}
for (i=0;i!=n;++i) {
updatespelllist(mages[i]);
}
}
}
} }
static void static void

View file

@ -793,14 +793,9 @@ learn_cmd(unit * u, order * ord)
} }
else if (sk==SK_MAGIC) { else if (sk==SK_MAGIC) {
sc_mage * mage = get_mage(u); sc_mage * mage = get_mage(u);
int level = eff_skill(u, SK_MAGIC, r);
if (FactionSpells() && level>u->faction->max_spelllevel) {
update_spellbook(u->faction, level);
}
if (!mage) { if (!mage) {
mage = create_mage(u, u->faction->magiegebiet); mage = create_mage(u, u->faction->magiegebiet);
} }
updatespelllist(u);
} }
return 0; return 0;

View file

@ -415,7 +415,7 @@ update_spellbook(faction * f, int level)
for (slist=spells;slist!=NULL;slist=slist->next) { for (slist=spells;slist!=NULL;slist=slist->next) {
spell * sp = slist->data; spell * sp = slist->data;
if (sp->magietyp == M_COMMON && level<f->max_spelllevel && sp->level<=level) { if (sp->magietyp == M_COMMON && level>f->max_spelllevel && sp->level<=level) {
commonspells[numspells++] = sp; commonspells[numspells++] = sp;
} else { } else {
if (know_school(f, sp->magietyp) && sp->level <= level) { if (know_school(f, sp->magietyp) && sp->level <= level) {
@ -511,7 +511,7 @@ updatespelllist(unit * u)
if (sp->level<=sk) { if (sp->level<=sk) {
boolean know = u_hasspell(u, sp); boolean know = u_hasspell(u, sp);
if (know || know_school(u->faction, sp->magietyp)) { if (know || sp->magietyp==M_COMMON || know_school(u->faction, sp->magietyp)) {
faction * f = u->faction; faction * f = u->faction;
if (!know) add_spell(get_spelllist(mage, u->faction), sp); if (!know) add_spell(get_spelllist(mage, u->faction), sp);

View file

@ -154,7 +154,7 @@
<param name="rules.cavalry.mode" value="1"/> <param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/> <param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/> <param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="0"/> <param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/> <param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone --> <param name="rules.magic.common" value="tybied"/> <!-- tybied spells can be cast by anyone -->
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest --> <param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->

View file

@ -276,7 +276,7 @@
<!-- end cerddor --> <!-- end cerddor -->
<!-- new gwyrrd --> <!-- new gwyrrd -->
<spell name="blessedharvest" type="gwyrrd" rank="5" level="20" index="25" ship="true" far="true" variable="true"> <spell name="blessedharvest" type="gray" rank="5" level="1" index="25" ship="true" far="true" variable="true">
<!-- Segen der Erde --> <!-- Segen der Erde -->
<resource name="aura" amount="1" cost="level"/> <resource name="aura" amount="1" cost="level"/>
</spell> </spell>
@ -561,15 +561,6 @@
<spell name="double_time" type="common" rank="5" level="11" index="80" parameters="u+" los="true" ship="true" variable="true"> <spell name="double_time" type="common" rank="5" level="11" index="80" parameters="u+" los="true" ship="true" variable="true">
<resource name="aura" amount="5" cost="level"/> <resource name="aura" amount="5" cost="level"/>
</spell> </spell>
<spell name="fiery_dragonbreath" type="common" rank="5" level="3" index="81" combat="2">
<resource name="aura" amount="1" cost="fixed"/>
</spell>
<spell name="icy_dragonbreath" type="common" rank="5" level="6" index="82" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="powerful_dragonbreath" type="common" rank="5" level="12" index="83" combat="2">
<resource name="aura" amount="3" cost="fixed"/>
</spell>
<spell name="magicstreet" type="common" rank="5" level="4" index="84" ship="true" far="true" variable="true"> <spell name="magicstreet" type="common" rank="5" level="4" index="84" ship="true" far="true" variable="true">
<resource name="aura" amount="1" cost="level"/> <resource name="aura" amount="1" cost="level"/>
<resource name="stone" amount="1" cost="fixed"/> <resource name="stone" amount="1" cost="fixed"/>
@ -593,9 +584,6 @@
<spell name="break_curse" type="common" rank="3" level="7" index="107" syntax="spellid" parameters="kcc?" los="true" ship="true" far="true" variable="true"> <spell name="break_curse" type="common" rank="3" level="7" index="107" syntax="spellid" parameters="kcc?" los="true" ship="true" far="true" variable="true">
<resource name="aura" amount="3" cost="level"/> <resource name="aura" amount="3" cost="level"/>
</spell> </spell>
<spell name="meteor_rain" type="common" rank="5" level="3" index="108" variable="true" combat="2">
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="fish_shield" type="common" rank="2" level="8" index="109" variable="true" combat="1"> <spell name="fish_shield" type="common" rank="2" level="8" index="109" variable="true" combat="1">
<resource name="aura" amount="4" cost="level"/> <resource name="aura" amount="4" cost="level"/>
</spell> </spell>
@ -646,41 +634,53 @@
<spell name="shockwave" type="common" rank="5" level="5" index="163" variable="true" combat="2"> <spell name="shockwave" type="common" rank="5" level="5" index="163" variable="true" combat="2">
<resource name="aura" amount="1" cost="level"/> <resource name="aura" amount="1" cost="level"/>
</spell> </spell>
<spell name="wyrm_transformation" type="common" rank="5" level="1" index="166">
<resource name="aura" amount="1" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<spell name="eternal_walls" type="common" rank="5" level="7" index="167" parameters="b" ship="true" variable="true"> <spell name="eternal_walls" type="common" rank="5" level="7" index="167" parameters="b" ship="true" variable="true">
<resource name="aura" amount="50" cost="fixed"/> <resource name="aura" amount="50" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/> <resource name="permaura" amount="1" cost="fixed"/>
</spell> </spell>
<spell name="drain_skills" type="common" rank="5" level="12" index="174" combat="2">
<resource name="aura" amount="4" cost="fixed"/>
</spell>
<spell name="aura_of_fear" type="common" rank="5" level="12" index="175" combat="2">
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="shadowcall" type="common" rank="5" level="12" index="176" combat="1">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="immolation" type="common" rank="5" level="12" index="180" combat="2">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="firestorm" type="common" rank="5" level="8" index="181" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="coldfront" type="common" rank="5" level="8" index="182" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="acidrain" type="common" rank="5" level="8" index="183" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<!-- end common spells --> <!-- end common spells -->
<!-- gray spells: given to individuals --> <!-- gray spells: given to individuals or monsters -->
<spell name="fiery_dragonbreath" type="gray" rank="5" level="3" index="81" combat="2">
<resource name="aura" amount="1" cost="fixed"/>
</spell>
<spell name="icy_dragonbreath" type="gray" rank="5" level="6" index="82" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="powerful_dragonbreath" type="gray" rank="5" level="12" index="83" combat="2">
<resource name="aura" amount="3" cost="fixed"/>
</spell>
<spell name="meteor_rain" type="gray" rank="5" level="3" index="108" variable="true" combat="2">
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="wyrm_transformation" type="gray" rank="5" level="1" index="166">
<resource name="aura" amount="1" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<spell name="transferauratraum" type="gray" rank="1" level="3" index="30" syntax="aura" parameters="ui" ship="true"> <spell name="transferauratraum" type="gray" rank="1" level="3" index="30" syntax="aura" parameters="ui" ship="true">
<!-- Traum der Magie --> <!-- Traum der Magie -->
<resource name="aura" amount="2" cost="fixed"/> <resource name="aura" amount="2" cost="fixed"/>
</spell> </spell>
<spell name="drain_skills" type="gray" rank="5" level="12" index="174" combat="2">
<resource name="aura" amount="4" cost="fixed"/>
</spell>
<spell name="aura_of_fear" type="gray" rank="5" level="12" index="175" combat="2">
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="shadowcall" type="gray" rank="5" level="12" index="176" combat="1">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="immolation" type="gray" rank="5" level="12" index="180" combat="2">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="firestorm" type="gray" rank="5" level="8" index="181" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="coldfront" type="gray" rank="5" level="8" index="182" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="acidrain" type="gray" rank="5" level="8" index="183" combat="2">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<!-- end gray spells --> <!-- end gray spells -->
</spells> </spells>