First test to remove items from code: AXE and RUSTY_AXE are out.

Rewriting the rust-spell. Now affecting armor as well (with lower chance)
This commit is contained in:
Enno Rehling 2005-10-02 17:04:16 +00:00
parent b04b01814b
commit 6b87faf047
7 changed files with 87 additions and 69 deletions

View File

@ -61,7 +61,6 @@ enum {
WP_SPEAR, WP_SPEAR,
WP_GREATSWORD, WP_GREATSWORD,
WP_SWORD, WP_SWORD,
WP_AXE,
WP_LANCE, WP_LANCE,
WP_RUSTY_SWORD, WP_RUSTY_SWORD,
WP_RUSTY_GREATSWORD, WP_RUSTY_GREATSWORD,
@ -128,16 +127,12 @@ static weapondata weapontable[WP_MAX + 1] =
{0.00, "2d8+3", "2d8+3", I_GREATSWORD, SK_SWORD, -1, -2, false, false, { RL_NONE, 0}, CUT }, {0.00, "2d8+3", "2d8+3", I_GREATSWORD, SK_SWORD, -1, -2, false, false, { RL_NONE, 0}, CUT },
/* Schwert */ /* Schwert */
{0.00, "1d9+2", "1d9+2", I_SWORD, SK_SWORD, 0, 0, false, false, { RL_NONE, 0}, CUT }, {0.00, "1d9+2", "1d9+2", I_SWORD, SK_SWORD, 0, 0, false, false, { RL_NONE, 0}, CUT },
/* Kriegsaxt */
{0.00, "2d6+4", "2d6+4", I_AXE, SK_SWORD, 1, -2, false, false, { RL_NONE, 0}, CUT },
/* Lanze */ /* Lanze */
{0.00, "1d5", "2d6+5", I_LANCE, SK_SPEAR, 0, -2, false, false, { RL_NONE, 0}, PIERCE }, {0.00, "1d5", "2d6+5", I_LANCE, SK_SPEAR, 0, -2, false, false, { RL_NONE, 0}, PIERCE },
/* Rostiges Schwert */ /* Rostiges Schwert */
{0.00, "1d9", "1d9", I_RUSTY_SWORD, SK_SWORD, -1, -1, false, false, { RL_NONE, 0}, CUT }, {0.00, "1d9", "1d9", I_RUSTY_SWORD, SK_SWORD, -1, -1, false, false, { RL_NONE, 0}, CUT },
/* Rostiger Zweihänder */ /* Rostiger Zweihänder */
{0.00, "2d8", "2d8", I_RUSTY_GREATSWORD, SK_SWORD, -2, -3, false, false, { RL_NONE, 0}, CUT }, {0.00, "2d8", "2d8", I_RUSTY_GREATSWORD, SK_SWORD, -2, -3, false, false, { RL_NONE, 0}, CUT },
/* Rostige Axt */
{0.00, "2d6", "2d6", I_RUSTY_AXE, SK_SWORD, 0, -3, false, false, { RL_NONE, 0}, CUT },
/* Rostige Hellebarde */ /* Rostige Hellebarde */
{0.00, "2d6", "2d6", I_RUSTY_HALBERD, SK_SPEAR, -2, 1, false, false, { RL_NONE, 0}, CUT }, {0.00, "2d6", "2d6", I_RUSTY_HALBERD, SK_SPEAR, -2, 1, false, false, { RL_NONE, 0}, CUT },
/* Unbewaffnet */ /* Unbewaffnet */

View File

@ -314,8 +314,6 @@ sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
/* da n min(force, x), sollte force maximal auf 0 sinken */ /* da n min(force, x), sollte force maximal auf 0 sinken */
assert(force >= 0); assert(force >= 0);
/* Eisenwaffen: I_SWORD, I_GREATSWORD, I_AXE, I_HALBERD (50%) */
if (df->weapons) { if (df->weapons) {
int w; int w;
for (w=0;df->weapons[w].type!=NULL;++w) { for (w=0;df->weapons[w].type!=NULL;++w) {

View File

@ -980,10 +980,6 @@ static t_item itemdata[MAXITEMS] = {
{"Bihänder", "Bihänder", "Bihänder", "Bihänder"}, {"Bihänder", "Bihänder", "Bihänder", "Bihänder"},
IS_PRODUCT, SK_WEAPONSMITH, 4, {2, 0, 0, 0, 0, 0}, 200, 0, 0, NULL IS_PRODUCT, SK_WEAPONSMITH, 4, {2, 0, 0, 0, 0, 0}, 200, 0, 0, NULL
}, },
{ /* I_AXE 36 */
{"Kriegsaxt", "Kriegsäxte", "Kriegsaxt", "Kriegsäxte"},
IS_PRODUCT, SK_WEAPONSMITH, 3, {1, 1, 0, 0, 0, 0}, 200, 0, 0, NULL
},
{ /* I_LAENSWORD 38 */ { /* I_LAENSWORD 38 */
{"Laenschwert", "Laenschwerter", "Laenschwert", "Laenschwerter"}, {"Laenschwert", "Laenschwerter", "Laenschwert", "Laenschwerter"},
IS_PRODUCT, SK_WEAPONSMITH, 8, {0, 0, 0, 0, 1, 0}, 100, 0, 0, NULL IS_PRODUCT, SK_WEAPONSMITH, 8, {0, 0, 0, 0, 1, 0}, 100, 0, 0, NULL
@ -1122,10 +1118,6 @@ static t_item itemdata[MAXITEMS] = {
{"Rostiger Zweihänder", "Rostige Zweihänder", "Rostiger Zweihänder", "Rostige Zweihänder"}, {"Rostiger Zweihänder", "Rostige Zweihänder", "Rostiger Zweihänder", "Rostige Zweihänder"},
IS_PRODUCT, SK_WEAPONSMITH, 4, {2, 0, 0, 0, 0, 0}, 200, 0, 0, NULL IS_PRODUCT, SK_WEAPONSMITH, 4, {2, 0, 0, 0, 0, 0}, 200, 0, 0, NULL
}, },
{ /* I_RUSTY_AXE */
{"Rostige Kriegsaxt", "Rostige Kriegsäxte", "Rostige Kriegsaxt", "Rostige Kriegsäxte"},
IS_PRODUCT, SK_WEAPONSMITH, 3, {1, 1, 0, 0, 0, 0}, 200, 0, 0, NULL
},
{ /* I_RUSTY_HALBERD */ { /* I_RUSTY_HALBERD */
{"Rostige Hellebarde", "Rostige Hellebarden", "Rostige Hellebarde", "Rostige Hellebarden"}, {"Rostige Hellebarde", "Rostige Hellebarden", "Rostige Hellebarde", "Rostige Hellebarden"},
IS_PRODUCT, SK_WEAPONSMITH, 3, {1, 1, 0, 0, 0, 0}, 200, 0, 0, NULL IS_PRODUCT, SK_WEAPONSMITH, 3, {1, 1, 0, 0, 0, 0}, 200, 0, 0, NULL

View File

@ -304,7 +304,6 @@ enum {
I_DRAGONHEAD, I_DRAGONHEAD,
I_CHASTITY_BELT, /* bleibt */ I_CHASTITY_BELT, /* bleibt */
I_GREATSWORD, I_GREATSWORD,
I_AXE,
I_LAENSWORD, I_LAENSWORD,
I_LAEN, I_LAEN,
I_SHIELD, I_SHIELD,
@ -345,7 +344,6 @@ enum {
I_SACK_OF_CONSERVATION, I_SACK_OF_CONSERVATION,
I_SPHERE_OF_INVISIBILITY, I_SPHERE_OF_INVISIBILITY,
I_RUSTY_GREATSWORD, I_RUSTY_GREATSWORD,
I_RUSTY_AXE,
I_RUSTY_HALBERD, I_RUSTY_HALBERD,
MAX_ITEMS /* do not use outside item.c ! */ MAX_ITEMS /* do not use outside item.c ! */
}; };
@ -379,7 +377,6 @@ enum {
R_DRAGONHEAD, R_DRAGONHEAD,
R_CHASTITY_BELT, R_CHASTITY_BELT,
R_GREATSWORD, R_GREATSWORD,
R_AXE,
R_EOGSWORD, R_EOGSWORD,
R_EOG, R_EOG,
R_SHIELD, R_SHIELD,

View File

@ -1287,75 +1287,85 @@ patzer_ents(castorder *co)
* Gebiet: Gwyrrd * Gebiet: Gwyrrd
* Wirkung: * Wirkung:
* Zerstört zwischen Stufe und Stufe*10 Eisenwaffen * Zerstört zwischen Stufe und Stufe*10 Eisenwaffen
* Eisenwaffen: I_SWORD, I_GREATSWORD, I_AXE, I_HALBERD
* *
* Flag: * Flag:
* (FARCASTING | SPELLLEVEL | UNITSPELL | TESTCANSEE | TESTRESISTANCE) * (FARCASTING | SPELLLEVEL | UNITSPELL | TESTCANSEE | TESTRESISTANCE)
*/ */
/* Syntax: ZAUBER [REGION x y] [STUFE 2] "Rosthauch" 1111 2222 3333 */ /* Syntax: ZAUBER [REGION x y] [STUFE 2] "Rosthauch" 1111 2222 3333 */
typedef struct iron_weapon {
const struct item_type * type;
const struct item_type * rusty;
float chance;
struct iron_weapon * next;
} iron_weapon;
static iron_weapon * ironweapons = NULL;
void
add_ironweapon(const struct item_type * type, const struct item_type * rusty, float chance)
{
iron_weapon * iweapon = malloc(sizeof(iron_weapon));
iweapon->type = type;
iweapon->rusty = rusty;
iweapon->chance = chance;
iweapon->next = ironweapons;
ironweapons = iweapon;
}
static int static int
sp_rosthauch(castorder *co) sp_rosthauch(castorder *co)
{ {
unit *u; int n;
int ironweapon;
int i, n;
int success = 0; int success = 0;
region *r = co->rt; region *r = co->rt;
unit *mage = (unit *)co->magician; unit *mage = (unit *)co->magician;
int cast_level = co->level; int cast_level = co->level;
double force = co->force; int force = (int)co->force;
spellparameter *pa = co->par; spellparameter *pa = co->par;
if (ironweapons==NULL) {
add_ironweapon(it_find("sword"), it_find("rustysword"), 1.0);
add_ironweapon(it_find("axe"), it_find("rustyaxe"), 1.0);
add_ironweapon(it_find("greatsword"), it_find("rustygreatsword"), 1.0);
add_ironweapon(it_find("halberd"), it_find("rustyhalberd"), 0.5f);
#ifndef NO_RUSTY_ARMOR
add_ironweapon(it_find("shield"), it_find("rustyshield"), 0.5f);
add_ironweapon(it_find("chainmail"), it_find("rustychainmail"), 0.2f);
#endif
}
force = rand()%((int)(force * 10)) + force; force = rand()%((int)(force * 10)) + force;
/* fuer jede Einheit */ /* fuer jede Einheit */
for (n = 0; n < pa->length; n++) { for (n = 0; n < pa->length; n++) {
static const item_type * it_halberd = NULL; unit *u = pa->param[n]->data.u;
if (it_halberd==NULL) it_halberd = it_find("halberd"); int ironweapon = 0;
if (force<=0) break; iron_weapon * iweapon = ironweapons;
if(pa->param[n]->flag == TARGET_RESISTS if (force<=0) break;
|| pa->param[n]->flag == TARGET_NOTFOUND) if (pa->param[n]->flag & (TARGET_RESISTS|TARGET_NOTFOUND)) continue;
continue;
u = pa->param[n]->data.u; for (;iweapon!=NULL;iweapon=iweapon->next) {
item ** ip = i_find(&u->items, iweapon->type);
if (ip) {
int i = min((*ip)->number, force);
if (iweapon->chance<1.0) {
i = (int)(i*iweapon->chance);
}
if (i>0) {
force -= i;
ironweapon += i;
i_change(ip, iweapon->type, -i);
if (iweapon->rusty) {
i_change(&u->items, iweapon->rusty, i);
}
}
}
if (force<=0) break;
}
/* Eisenwaffen: I_SWORD, I_GREATSWORD, I_AXE, I_HALBERD (50% Chance)*/ if (ironweapon>0) {
ironweapon = 0;
i = min(get_item(u, I_SWORD), (int)force);
if (i > 0) {
change_item(u, I_SWORD, -i);
change_item(u, I_RUSTY_SWORD, i);
force -= i;
ironweapon += i;
}
i = min(get_item(u, I_GREATSWORD), (int)force);
if (i > 0){
change_item(u, I_GREATSWORD, -i);
change_item(u, I_RUSTY_GREATSWORD, i);
force -= i;
ironweapon += i;
}
i = min(get_item(u, I_AXE), (int)force);
if (i > 0){
change_item(u, I_AXE, -i);
change_item(u, I_RUSTY_AXE, i);
force -= i;
ironweapon += i;
}
i = min(i_get(u->items, it_halberd), (int)force);
if (i > 0){
if(rand()%100 < 50){
i_change(&u->items, it_halberd, -i);
i_change(&u->items, olditemtype[I_RUSTY_HALBERD], i);
force -= i;
ironweapon += i;
}
}
if (ironweapon) {
/* {$mage mage} legt einen Rosthauch auf {target}. {amount} Waffen /* {$mage mage} legt einen Rosthauch auf {target}. {amount} Waffen
* wurden vom Rost zerfressen */ * wurden vom Rost zerfressen */
ADDMSG(&mage->faction->msgs, msg_message( ADDMSG(&mage->faction->msgs, msg_message(

View File

@ -9,14 +9,14 @@
<startup race="dwarf"> <startup race="dwarf">
<item name="axe" amount="1"/> <item name="axe" amount="1"/>
<item name="chainmail" amount="1"/> <item name="chainmail" amount="1"/>
<skill name="sk_sword" level="1"/> <skill name="sk_melee" level="1"/>
</startup> </startup>
<startup race="elf"> <startup race="elf">
<item name="fairyboot" amount="1"/> <item name="fairyboot" amount="1"/>
</startup> </startup>
<startup race="uruk"> <startup race="uruk">
<skill name="sk_spear" level="4"/> <skill name="sk_spear" level="4"/>
<skill name="sk_sword" level="4"/> <skill name="sk_melee" level="4"/>
<skill name="sk_crossbow" level="4"/> <skill name="sk_crossbow" level="4"/>
<skill name="sk_catapult" level="4"/> <skill name="sk_catapult" level="4"/>
<skill name="sk_bow" level="4"/> <skill name="sk_bow" level="4"/>

View File

@ -54,6 +54,32 @@
</item> </item>
</resource> </resource>
<resource name="axe">
<item weight="200">
<construction skill="sk_weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="sk_melee" offmod="1" defmod="-2">
<damage type="rider" value="2d6+4"/>
<damage type="footman" value="2d6+4"/>
</weapon>
</item>
</resource>
<resource name="rustyaxe">
<item weight="200">
<construction skill="sk_weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="sk_melee" offmod="0" defmod="-3">
<damage type="rider" value="2d6"/>
<damage type="footman" value="2d6"/>
</weapon>
</item>
</resource>
<resource name="mallorncrossbow"> <resource name="mallorncrossbow">
<item weight="100"> <item weight="100">
<construction skill="sk_weaponsmithing" minskill="5" reqsize="1"> <construction skill="sk_weaponsmithing" minskill="5" reqsize="1">