Bei nicht gesetztem Schadenstyp auf Angriffstyp pruefen
Bei physikalischem Angriff Schlagschaden und nur noch bei magischem
Angriff Magie setzen.
Ausserdem eine Fehlermeldung ausgeben, wenn ungueltige Schadenstypen
genutzt werden.
Change-Id: Ic696ba1b4fa7e6bab371498e1a484be3ca462ba4
diff --git a/std/npc/combat.c b/std/npc/combat.c
index f9945f3..e209967 100644
--- a/std/npc/combat.c
+++ b/std/npc/combat.c
@@ -142,18 +142,33 @@
if(rate<=0 || damage<0) return 0;
- if (stringp(dam_type))
- dam_type = ({dam_type});
- else if (!pointerp(dam_type))
- dam_type = ({DT_MAGIC});
-
- // Tatsaechlich ist es immer ein nicht-physischer Angriff, wenn spellarg ein
+ // Tatsaechlich ist es immer ein nicht-physischer Angriff, wenn spellarg ein
// int ist, weil wenn spellarg==0 ist der Default nicht-physischer Angriff
// und bei spellarg!=0 auch. Nur mit einem mapping kann man einen phys.
// Angriff erzeugen.
if (intp(spellarg))
spellarg = ([SP_PHYSICAL_ATTACK: 0]);
+ if(stringp(dam_type))
+ dam_type=({dam_type});
+ else if(!pointerp(dam_type))
+ {
+ if(spellarg[SP_PHYSICAL_ATTACK])
+ dam_type=({DT_BLUDGEON});
+ else
+ dam_type=({DT_MAGIC});
+ }
+
+ foreach(string s : dam_type)
+ {
+ if(!VALID_DAMAGE_TYPE(s))
+ {
+ catch(raise_error(
+ "AddSpell(): Ungueltiger Schadenstyp: "+s);
+ publish);
+ }
+ }
+
// Falls func ein String ist eine Closure erstellen und diese speichern.
if(stringp(func) && sizeof(func))
{