summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defines.h6
-rw-r--r--src/init1.cc19
-rw-r--r--src/monster_race.hpp3
-rw-r--r--src/xtra2.cc38
4 files changed, 25 insertions, 41 deletions
diff --git a/src/defines.h b/src/defines.h
index dc9dbfb8..519dc535 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -678,19 +678,13 @@
/*** Artifact indexes (see "lib/edit/a_info.txt") ***/
-#define ART_PALANTIR 202
#define ART_ANCHOR 14
#define ART_POWER 13
-#define ART_MARDA 26
#define ART_MORGOTH 34
#define ART_NARSIL 164
-#define ART_CALRIS 71
#define ART_GLAMDRING 73
#define ART_ANDURIL 83
-#define ART_ANGUIREL 84
-#define ART_NIMLOTH 99
#define ART_GROND 111
-#define ART_GOTHMOG 123
/* Spell for various object */
#define SPELL_ID_PLAIN 1
diff --git a/src/init1.cc b/src/init1.cc
index 75a75d3a..10698d2d 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -5769,6 +5769,25 @@ errr init_r_info_txt(FILE *fp)
continue;
}
+ /* Process 'A' for standard artifact drop (one line only) */
+ if (buf[0] == 'A')
+ {
+ int artifact_idx;
+ int artifact_chance;
+
+ /* Scan for values */
+ if (2 != sscanf(buf + 2, "%d:%d",
+ &artifact_idx,
+ &artifact_chance)) return (1);
+
+ /* Save the values */
+ r_ptr->artifact_idx = artifact_idx;
+ r_ptr->artifact_chance = artifact_chance;
+
+ /* Next... */
+ continue;
+ }
+
/* Process 'W' for "More Info" (one line only) */
if (buf[0] == 'W')
{
diff --git a/src/monster_race.hpp b/src/monster_race.hpp
index 7e5d5082..f756d6ff 100644
--- a/src/monster_race.hpp
+++ b/src/monster_race.hpp
@@ -59,6 +59,9 @@ struct monster_race
byte body_parts[BODY_MAX]; /* To help to decide what to use when body changing */
+ byte artifact_idx; /* Artifact index of standard artifact dropped; 0 if none. */
+ int artifact_chance; /* Percentage chance of dropping the artifact. */
+
byte level; /* Level of creature */
byte rarity; /* Rarity of creature */
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 707005cd..d3e01b71 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -2771,40 +2771,8 @@ void monster_death(int m_idx)
}
else
{
- byte a_idx = 0;
- int chance = 0;
- int I_kind = 0;
-
- if (strstr(r_ptr->name, "Marda, rider of the Gold Laronth"))
- {
- a_idx = ART_MARDA;
- chance = 50;
- }
- else if (strstr(r_ptr->name, "Saruman of Many Colours"))
- {
- a_idx = ART_PALANTIR;
- chance = 30;
- }
- else if (strstr(r_ptr->name, "Hagen, son of Alberich"))
- {
- a_idx = ART_NIMLOTH;
- chance = 66;
- }
- else if (strstr(r_ptr->name, "Durin's Bane"))
- {
- a_idx = ART_CALRIS;
- chance = 60;
- }
- else if (strstr(r_ptr->name, "Gothmog, the High Captain of Balrogs"))
- {
- a_idx = ART_GOTHMOG;
- chance = 50;
- }
- else if (strstr(r_ptr->name, "Eol, the Dark Elf"))
- {
- a_idx = ART_ANGUIREL;
- chance = 50;
- }
+ byte a_idx = r_ptr->artifact_idx;
+ int chance = r_ptr->artifact_chance;
if ((a_idx > 0) && ((randint(99) < chance) || (wizard)))
{
@@ -2819,7 +2787,7 @@ void monster_death(int m_idx)
object_wipe(q_ptr);
/* Acquire the "kind" index */
- I_kind = lookup_kind(a_ptr->tval, a_ptr->sval);
+ int I_kind = lookup_kind(a_ptr->tval, a_ptr->sval);
/* Create the artifact */
object_prep(q_ptr, I_kind);