diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index fcebf99a0..3737c7998 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -21,6 +21,7 @@ #include "build.h" #include "building.h" #include "curse.h" +#include "equipment.h" #include "faction.h" #include "goodies.h" #include "group.h" @@ -827,10 +828,18 @@ remove_troop(troop dt) rmtroop(dt); if (!df->alive && du->race->itemdrop) { + char eqname[64]; + const struct equipment * eq; item * drops = du->race->itemdrop(du->race, du->number-df->run.number); + if (drops != NULL){ i_merge(&du->items, &drops); } + sprintf(eqname, "%s_spoils", du->race->_name[0]); + eq = get_equipment(eqname); + if (eq!=NULL) { + equip_items(&du->items, eq); + } } } diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index 3491c4421..2c907261e 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -306,39 +306,6 @@ oldfamiliars(unit * u) equip_unit(u, get_equipment(fname)); } -static item * -dragon_drops(const struct race * rc, int size) -{ - item * itm = NULL; - switch (old_race(rc)) { - case RC_FIREDRAGON: - i_add(&itm, i_new(olditemtype[I_DRACHENBLUT], size)); - break; - case RC_DRAGON: - i_add(&itm, i_new(olditemtype[I_DRACHENBLUT], size * 4)); - i_add(&itm, i_new(olditemtype[I_DRAGONHEAD], size)); - break; - case RC_WYRM: - i_add(&itm, i_new(olditemtype[I_DRACHENBLUT], size * 10)); - i_add(&itm, i_new(olditemtype[I_DRAGONHEAD], size)); - break; - case RC_SEASERPENT: - i_add(&itm, i_new(olditemtype[I_DRACHENBLUT], size * 6)); - i_add(&itm, i_new(olditemtype[I_SEASERPENTHEAD], size)); - break; - } - return itm; -} - -static item * -phoenix_drops(const struct race *rc, int size) -{ - const item_type * it_phoenixfeather = it_find("phoenixfeather"); - item *itm = NULL; - if (it_phoenixfeather!=NULL) i_add(&itm, i_new(it_phoenixfeather, size)); - return itm; -} - static item * default_spoil(const struct race * rc, int size) { @@ -461,8 +428,6 @@ register_races(void) /* function itemdrop * to generate battle spoils * race->itemdrop() */ - register_function((pf_generic)dragon_drops, "dragondrops"); - register_function((pf_generic)phoenix_drops, "phoenixdrops"); register_function((pf_generic)default_spoil, "defaultdrops"); sprintf(zBuffer, "%s/races.xml", resourcepath()); diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index d7e1914c6..b0c908ace 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -544,17 +544,17 @@ race_compat(void) /* required for old_race, do not change order! */ const char * oldracenames[MAXRACES] = { "dwarf", "elf", "orc", "goblin", "human", "troll", "demon", "insect", - "halfling", "cat", "aquarian", "uruk", "snotling", "undead", "illusion", - "youngdragon", "dragon", "wyrm", "ent", "catdragon", "dracoid", - "special", "spell", "irongolem", "stonegolem", "shadowdemon", - "shadowmaster", "mountainguard", "alp", "toad", "braineater", "peasant", - "wolf", "lynx", "tunnelworm", "eagle", "rat", "songdragon", "nymph", - "unicorn", "direwolf", "ghost", "imp", "dreamcat", "fairy", "owl", - "hellcat", "tiger", "dolphin", "giantturtle", "kraken", "seaserpent", - "shadowknight", "centaur", "skeleton", "skeletonlord", "zombie", - "juju-zombie", "ghoul", "ghast", "museumghost", "gnome", "template", - "clone", "shadowdragon", "shadowbat", "nightmare", "vampunicorn", - "phoenix" + "halfling", "cat", "aquarian", "uruk", "snotling", "undead", "illusion", + "youngdragon", "dragon", "wyrm", "ent", "catdragon", "dracoid", + "special", "spell", "irongolem", "stonegolem", "shadowdemon", + "shadowmaster", "mountainguard", "alp", "toad", "braineater", "peasant", + "wolf", "lynx", "tunnelworm", "eagle", "rat", "songdragon", "nymph", + "unicorn", "direwolf", "ghost", "imp", "dreamcat", "fairy", "owl", + "hellcat", "tiger", "dolphin", "giantturtle", "kraken", "seaserpent", + "shadowknight", "centaur", "skeleton", "skeletonlord", "zombie", + "juju-zombie", "ghoul", "ghast", "museumghost", "gnome", "template", + "clone", "shadowdragon", "shadowbat", "nightmare", "vampunicorn", + "phoenix" }; int i; diff --git a/src/common/settings-wdw.h b/src/common/settings-wdw.h index dadb586ed..e565631b2 100644 --- a/src/common/settings-wdw.h +++ b/src/common/settings-wdw.h @@ -54,6 +54,5 @@ #undef ARENA_MODULE #undef WORMHOLE_MODULE #undef XECMD_MODULE -#define WDW_PHOENIX #define WDW_PYRAMIDSPELL #define WDW_PYRAMID diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index 0a952a739..1d64a23db 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -212,9 +212,6 @@ - - @@ -370,6 +367,9 @@ + + diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 463c14817..fadd81139 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -876,60 +876,6 @@ fix_road_borders(void) } } -#ifdef WDW_PHOENIX -static region * -random_land_region(void) -{ - region *r; - int c = 0; - - /* count the available regions */ - for(r=regions; r; r=r->next) { - if (r->land && rplane(r)==NULL) ++c; - } - - /* choose one */ - c = rand()%c; - - /* this is a bit obfuscated, but should be correct */ - for(r=regions; c > 0; r=r->next) { - if (r->land && rplane(r)==NULL) --c; - } - - return(r); -} - -static void -check_phoenix(void) -{ - const race * phoenix_race = rc_find("phoenix"); - unit * phoenix; - region * r; - faction *f; - - /* check if there is a phoenix in the world */ - for(f=factions; f; f=f->next) { - unit *u; - - for(u=f->units; u; u=u->nextF) { - if(u->race == phoenix_race) { - return; - } - } - } - - f = findfaction(MONSTER_FACTION); - if (f==NULL) return; - - /* it is not, so we create it */ - r = random_land_region(); - phoenix = createunit(r, f, 1, phoenix_race); - phoenix->name = strdup("Der Phönix"); - - /* TODO: generate an appropriate region message */ -} -#endif - static void fix_dissolve(unit * u, int value, char mode) { @@ -1146,10 +1092,6 @@ korrektur(void) /* Immer ausführen! Erschafft neue Teleport-Regionen, wenn nötig */ create_teleport_plane(); -#ifdef WDW_PHOENIX - check_phoenix(); -#endif - if (global.data_versionname; - return r.terrain->_name; + return NULL; } static void diff --git a/src/res/equipment.xml b/src/res/equipment.xml index d17c6fd98..654c52af1 100644 --- a/src/res/equipment.xml +++ b/src/res/equipment.xml @@ -331,5 +331,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/res/hse-05-01.xml b/src/res/hse-05-01.xml index 6137faf38..bda4b8130 100644 --- a/src/res/hse-05-01.xml +++ b/src/res/hse-05-01.xml @@ -67,7 +67,6 @@ - diff --git a/src/res/hse4.xml b/src/res/hse4.xml index 57668f43c..f43fc081e 100644 --- a/src/res/hse4.xml +++ b/src/res/hse4.xml @@ -71,7 +71,6 @@ - diff --git a/src/res/races.xml b/src/res/races.xml index 52954989d..955a59a91 100644 --- a/src/res/races.xml +++ b/src/res/races.xml @@ -658,7 +658,6 @@ - @@ -673,7 +672,6 @@ - @@ -687,7 +685,6 @@ - @@ -701,7 +698,6 @@ - @@ -1127,7 +1123,6 @@ - @@ -1288,7 +1283,6 @@ - @@ -1321,98 +1315,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -31,39 +32,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -161,5 +129,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/scripts/wdw-run.lua b/src/scripts/wdw-run.lua index e836d0a31..6bce3060b 100644 --- a/src/scripts/wdw-run.lua +++ b/src/scripts/wdw-run.lua @@ -12,6 +12,7 @@ function process(orders) -- set up the sphinx -- init_sphinxhints() + update_phoenix() sphinx_handler() sphinx_weekly() @@ -57,6 +58,7 @@ scripts = { "extensions.lua", "write_emails.lua", "wdw/sphinx.lua", + "wdw/phoenix.lua", "wdw/standings.lua" } diff --git a/src/scripts/wdw/phoenix.lua b/src/scripts/wdw/phoenix.lua new file mode 100644 index 000000000..7955da923 --- /dev/null +++ b/src/scripts/wdw/phoenix.lua @@ -0,0 +1,31 @@ +function update_phoenix() + local f + for f in factions() do + local u + for u in f.units do + if u.race=="phoenix" then + return + end + end + end + f = get_faction(0) + if (f~=nil) then + local r, nregions = 0 + for r in regions() do + nregions = nregions+1 + end + local rno = math.random(nregions) + for r in regions() do + rno = rno - 1 + if rno <=1 then + if r.plane_id==0 and r.name~=nil then + local u = add_unit(f, r) + u.race = "phoenix" + u.name = "Der Phönix" + -- TODO: generate an appropriate region message + break + end + end + end + end +end diff --git a/src/todo.txt b/src/todo.txt index 92f3db464..221f983af 100644 --- a/src/todo.txt +++ b/src/todo.txt @@ -21,7 +21,6 @@ Code cleanup: Larger Features: - eressea (b/g)zip reports? -- mailit-format ändern? - NO_RUNNING - ZERSTÖRE - Man sollte alle Materialien zurückkriegen können: @@ -46,20 +45,13 @@ Old Terrain still needed: - monster.c, ent movement - economy.c, insekten -mailit-format ändern? - - [11:01] am besten wäre, wenn mailit nur die optionen, nicht das ganze script enthielte - [11:01] und ein skript dann mailit als input nähme - [11:02] also nur enno@eressea.upb.de pka3 BZIP2 nr cr zv - unterschiede in vin3 + wdw per config statt defines? #define NEWATSROI 1 #define ATSBONUS 2 #define ROIBONUS 4 - #define WDW_PHOENIX - #define WDW_PYRAMIDSPE + #define WDW_PYRAMIDSPELL #define ARENA_MODULE #define WORMHOLE_MODULE