summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-03-27 15:46:59 +0200
committerBardur Arantsson <bardur@scientician.net>2016-03-27 15:47:19 +0200
commit4fbb684dead05e8579046b997888abc6bb76af25 (patch)
tree5faa163352211319037b2f0ae3d5a7e362372bf8
parent17b80947b08764700c4162e443fc6956b758486d (diff)
Avoid hardcoding most artifact numbers
-rw-r--r--lib/edit/a_info.txt39
-rw-r--r--lib/mods/theme/edit/a_info.txt39
-rw-r--r--src/defines.h194
-rw-r--r--src/init1.cc6
-rw-r--r--src/object2.cc75
5 files changed, 101 insertions, 252 deletions
diff --git a/lib/edit/a_info.txt b/lib/edit/a_info.txt
index a586b5ff..645af426 100644
--- a/lib/edit/a_info.txt
+++ b/lib/edit/a_info.txt
@@ -264,6 +264,7 @@ F:IM_COLD
F:INSTA_ART
F:INT
F:LUCK
+F:RANDOM_POWER
F:RES_BLIND
F:SEE_INVIS
F:SPEED
@@ -297,6 +298,7 @@ F:IM_ELEC
F:INSTA_ART
F:INT
F:LUCK
+F:RANDOM_POWER
F:REGEN
F:RES_DISEN
F:RES_POIS
@@ -344,6 +346,8 @@ F:INT
F:INVIS
F:MANA
F:PERMA_CURSE
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:REGEN
F:RES_BLIND
F:RES_DISEN
@@ -539,6 +543,7 @@ W:30:3:200:30000
P:19:1d4:0:0:15
F:DEX
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_CONF
@@ -588,6 +593,7 @@ F:ACTIVATE
F:CHR
F:ESP_ORC
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_DARK
@@ -609,6 +615,7 @@ W:20:3:220:32000
P:14:1d4:-2:0:15
F:CHR
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -631,6 +638,7 @@ F:ACTIVATE
F:CON
F:HIDE_TYPE
F:INT
+F:RANDOM_RESIST
F:RES_ACID
F:RES_CONF
F:RES_POIS
@@ -687,6 +695,7 @@ F:ESP_THUNDERLORD
F:FLY
F:IM_FIRE
F:INT
+F:RANDOM_RESIST
F:REFLECT
F:RES_ACID
F:RES_COLD
@@ -708,6 +717,7 @@ W:20:3:60:25000
P:11:1d1:-1:0:25
F:DEX
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_SHARDS
F:SPECIAL_GENE
@@ -752,6 +762,7 @@ F:ESP_ORC
F:FREE_ACT
F:HIDE_TYPE
F:IM_ACID
+F:RANDOM_RESIST
F:RES_CHAOS
F:RES_SOUND
F:STR
@@ -765,6 +776,7 @@ N:31:of Celegorm
I:34:4:0
W:30:3:60:12000
P:4:1d2:0:0:20
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_DARK
@@ -783,6 +795,7 @@ I:34:5:0
W:40:9:120:160000
P:5:1d3:0:0:20
F:ESP_EVIL
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -876,6 +889,7 @@ F:ESP_EVIL
F:ESP_NONLIVING
F:FREE_ACT
F:HIDE_TYPE
+F:RANDOM_POWER
F:SEE_INVIS
F:STR
D:The midnight-hued steel circlet of the sorceress-queen Beruthiel, which
@@ -894,6 +908,7 @@ F:ESP_ORC
F:ESP_TROLL
F:HIDE_TYPE
F:INT
+F:RANDOM_RESIST
F:RES_BLIND
F:WIS
D:The hunting cap of King Thranduil, to whose ears come all the secrets of
@@ -1025,6 +1040,8 @@ F:ACTIVATE
F:CON
F:HIDE_TYPE
F:LITE1
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:REGEN
F:RES_BLIND
F:RES_CHAOS
@@ -1122,6 +1139,7 @@ F:CHR
F:DEX
F:FREE_ACT
F:HIDE_TYPE
+F:RANDOM_POWER
F:RES_ACID
F:RES_COLD
F:RES_FIRE
@@ -1174,6 +1192,7 @@ F:HIDE_TYPE
F:INT
F:INVIS
F:LUCK
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_FIRE
@@ -1352,6 +1371,7 @@ F:DEX
F:FREE_ACT
F:HIDE_TYPE
F:LUCK
+F:RANDOM_POWER
F:RES_ACID
F:SHOW_MODS
a:BO_MISS_2
@@ -1406,6 +1426,7 @@ P:6:1d1:0:0:20
F:CLIMB
F:CON
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_FEAR
F:SPEED
F:STR
@@ -1454,6 +1475,7 @@ F:DEX
F:FREE_ACT
F:HIDE_TYPE
F:INT
+F:RANDOM_RES_OR_POWER
F:SEE_INVIS
F:SHOW_MODS
F:SLAY_GIANT
@@ -1499,6 +1521,7 @@ F:ACTIVATE
F:BRAND_FIRE
F:LEVELS
F:LITE1
+F:RANDOM_RESIST
F:RES_FIRE
F:SHOW_MODS
a:BO_FIRE_1
@@ -1514,6 +1537,7 @@ P:0:1d4:4:6:0
F:ACTIVATE
F:BRAND_COLD
F:LEVELS
+F:RANDOM_RESIST
F:RES_COLD
F:SHOW_MODS
a:BO_COLD_1
@@ -1529,6 +1553,7 @@ P:0:1d4:4:6:0
F:ACTIVATE
F:BRAND_ELEC
F:LEVELS
+F:RANDOM_RESIST
F:RES_ELEC
F:SHOW_MODS
a:BO_ELEC_1
@@ -1647,6 +1672,7 @@ F:BRAND_FIRE
F:ESP_ORC
F:HIDE_TYPE
F:LITE1
+F:RANDOM_RES_OR_POWER
F:RES_FIRE
F:RES_LITE
F:SEARCH
@@ -1699,6 +1725,7 @@ F:ESP_DRAGON
F:ESP_ORC
F:HIDE_TYPE
F:LITE1
+F:RANDOM_RES_OR_POWER
F:RES_COLD
F:RES_COLD
F:RES_DARK
@@ -1726,6 +1753,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:KILL_DRAGON
F:MUST2H
+F:RANDOM_RES_OR_POWER
F:REGEN
F:RES_FIRE
F:RES_POIS
@@ -1755,6 +1783,7 @@ F:HIDE_TYPE
F:INFRA
F:KILL_DRAGON
F:MUST2H
+F:RANDOM_RES_OR_POWER
F:RES_CHAOS
F:RES_FIRE
F:SEE_INVIS
@@ -1913,6 +1942,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:LITE1
F:LUCK
+F:RANDOM_RES_OR_POWER
F:RES_DISEN
F:RES_FEAR
F:RES_FIRE
@@ -2030,6 +2060,7 @@ F:ESP_UNDEAD
F:FREE_ACT
F:LEVELS
F:LITE1
+F:RANDOM_RESIST
F:RES_LITE
F:SEE_INVIS
F:SHOW_MODS
@@ -2054,6 +2085,7 @@ P:0:2d5:9:11:0
F:BLESSED
F:BLOWS
F:INT
+F:RANDOM_RES_OR_POWER
F:RES_CHAOS
F:RES_DISEN
F:RES_NEXUS
@@ -2524,6 +2556,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:HOLD_LIFE
F:IM_ACID
+F:RANDOM_POWER
F:REGEN
F:RES_NETHER
F:SEE_INVIS
@@ -2577,6 +2610,7 @@ F:CLONE
F:FREE_ACT
F:INFRA
F:LEVELS
+F:RANDOM_RES_OR_POWER
F:REGEN
F:RES_BLIND
F:RES_FEAR
@@ -2741,6 +2775,8 @@ F:COULD2H
F:FREE_ACT
F:HIDE_TYPE
F:KILL_DRAGON
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -2813,6 +2849,7 @@ F:CHR
F:HIDE_TYPE
F:HOLD_LIFE
F:INT
+F:RANDOM_POWER
F:RES_FIRE
F:RES_NETHER
F:SEARCH
@@ -2877,6 +2914,7 @@ F:ESP_ORC
F:ESP_TROLL
F:HIDE_TYPE
F:INFRA
+F:RANDOM_RESIST
F:REGEN
F:RES_COLD
F:RES_LITE
@@ -2961,6 +2999,7 @@ W:50:25:110:50000
P:0:0d0:10:14:0
F:ACTIVATE
F:HIDE_TYPE
+F:RANDOM_RES_OR_POWER
F:RES_FIRE
F:SHOW_MODS
F:SPEED
diff --git a/lib/mods/theme/edit/a_info.txt b/lib/mods/theme/edit/a_info.txt
index 2e5a1f43..f1e19dbf 100644
--- a/lib/mods/theme/edit/a_info.txt
+++ b/lib/mods/theme/edit/a_info.txt
@@ -286,6 +286,7 @@ F:IM_COLD
F:INSTA_ART
F:INT
F:LUCK
+F:RANDOM_POWER
F:RES_BLIND
F:SEE_INVIS
F:SPEED
@@ -319,6 +320,7 @@ F:IM_ELEC
F:INSTA_ART
F:INT
F:LUCK
+F:RANDOM_POWER
F:REGEN
F:RES_DISEN
F:RES_POIS
@@ -366,6 +368,8 @@ F:INT
F:INVIS
F:MANA
F:PERMA_CURSE
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:REGEN
F:RES_BLIND
F:RES_DISEN
@@ -559,6 +563,7 @@ W:30:3:200:30000
P:19:1d4:0:0:15
F:DEX
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_CONF
@@ -608,6 +613,7 @@ F:ACTIVATE
F:CHR
F:ESP_ORC
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_DARK
@@ -629,6 +635,7 @@ W:20:3:220:32000
P:14:1d4:-2:0:15
F:CHR
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -651,6 +658,7 @@ F:ACTIVATE
F:CON
F:HIDE_TYPE
F:INT
+F:RANDOM_RESIST
F:RES_ACID
F:RES_CONF
F:RES_POIS
@@ -692,6 +700,7 @@ F:CON
F:DEX
F:HIDE_TYPE
F:INT
+F:RANDOM_RESIST
F:STR
F:WIS
Z:teleport
@@ -708,6 +717,7 @@ W:20:3:60:25000
P:11:1d1:-1:0:25
F:DEX
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_ACID
F:RES_SHARDS
F:SPECIAL_GENE
@@ -752,6 +762,7 @@ F:ESP_ORC
F:FREE_ACT
F:HIDE_TYPE
F:IM_ACID
+F:RANDOM_RESIST
F:RES_CHAOS
F:RES_SOUND
F:STR
@@ -765,6 +776,7 @@ N:31:of Celegorm
I:34:4:0
W:30:3:60:12000
P:4:1d2:0:0:20
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_DARK
@@ -783,6 +795,7 @@ I:34:5:0
W:40:9:120:160000
P:5:1d3:0:0:20
F:ESP_EVIL
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -876,6 +889,7 @@ F:ESP_EVIL
F:ESP_NONLIVING
F:FREE_ACT
F:HIDE_TYPE
+F:RANDOM_POWER
F:SEE_INVIS
F:STR
D:The midnight-hued steel circlet of the sorceress-queen Beruthiel, which
@@ -894,6 +908,7 @@ F:ESP_ORC
F:ESP_TROLL
F:HIDE_TYPE
F:INT
+F:RANDOM_RESIST
F:RES_BLIND
F:WIS
D:The hunting cap of King Thranduil, to whose ears come all the secrets of
@@ -1025,6 +1040,8 @@ F:ACTIVATE
F:CON
F:HIDE_TYPE
F:LITE1
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:REGEN
F:RES_BLIND
F:RES_CHAOS
@@ -1121,6 +1138,7 @@ F:CHR
F:DEX
F:FREE_ACT
F:HIDE_TYPE
+F:RANDOM_POWER
F:RES_ACID
F:RES_COLD
F:RES_FIRE
@@ -1173,6 +1191,7 @@ F:HIDE_TYPE
F:INT
F:INVIS
F:LUCK
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_FIRE
@@ -1360,6 +1379,7 @@ F:DEX
F:FREE_ACT
F:HIDE_TYPE
F:LUCK
+F:RANDOM_POWER
F:RES_ACID
F:SHOW_MODS
a:BO_MISS_2
@@ -1414,6 +1434,7 @@ P:6:1d1:0:0:20
F:CLIMB
F:CON
F:HIDE_TYPE
+F:RANDOM_RESIST
F:RES_FEAR
F:SPEED
F:STR
@@ -1462,6 +1483,7 @@ F:DEX
F:FREE_ACT
F:HIDE_TYPE
F:INT
+F:RANDOM_RES_OR_POWER
F:SEE_INVIS
F:SHOW_MODS
F:SLAY_GIANT
@@ -1509,6 +1531,7 @@ F:ACTIVATE
F:BRAND_FIRE
F:LEVELS
F:LITE1
+F:RANDOM_RESIST
F:RES_FIRE
F:SHOW_MODS
a:BO_FIRE_1
@@ -1524,6 +1547,7 @@ P:0:1d4:4:6:0
F:ACTIVATE
F:BRAND_COLD
F:LEVELS
+F:RANDOM_RESIST
F:RES_COLD
F:SHOW_MODS
a:BO_COLD_1
@@ -1539,6 +1563,7 @@ P:0:1d4:4:6:0
F:ACTIVATE
F:BRAND_ELEC
F:LEVELS
+F:RANDOM_RESIST
F:RES_ELEC
F:SHOW_MODS
a:BO_ELEC_1
@@ -1658,6 +1683,7 @@ F:BRAND_FIRE
F:ESP_ORC
F:HIDE_TYPE
F:LITE1
+F:RANDOM_RES_OR_POWER
F:RES_FIRE
F:RES_LITE
F:SEARCH
@@ -1701,6 +1727,7 @@ F:ESP_DRAGON
F:ESP_ORC
F:HIDE_TYPE
F:LITE1
+F:RANDOM_RES_OR_POWER
F:RES_COLD
F:RES_COLD
F:RES_DARK
@@ -1727,6 +1754,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:KILL_DRAGON
F:MUST2H
+F:RANDOM_RES_OR_POWER
F:REGEN
F:RES_FIRE
F:RES_POIS
@@ -1757,6 +1785,7 @@ F:HIDE_TYPE
F:INFRA
F:KILL_DRAGON
F:MUST2H
+F:RANDOM_RES_OR_POWER
F:RES_CHAOS
F:RES_FIRE
F:SEE_INVIS
@@ -1917,6 +1946,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:LITE1
F:LUCK
+F:RANDOM_RES_OR_POWER
F:RES_DISEN
F:RES_FEAR
F:RES_FIRE
@@ -2035,6 +2065,7 @@ F:ESP_UNDEAD
F:FREE_ACT
F:LEVELS
F:LITE1
+F:RANDOM_RESIST
F:RES_LITE
F:SEE_INVIS
F:SHOW_MODS
@@ -2058,6 +2089,7 @@ P:0:2d5:9:11:0
F:BLESSED
F:BLOWS
F:INT
+F:RANDOM_RES_OR_POWER
F:RES_CHAOS
F:RES_DISEN
F:RES_NEXUS
@@ -2520,6 +2552,7 @@ F:FREE_ACT
F:HIDE_TYPE
F:HOLD_LIFE
F:IM_ACID
+F:RANDOM_POWER
F:REGEN
F:RES_NETHER
F:SEE_INVIS
@@ -2573,6 +2606,7 @@ F:HOLD_LIFE
F:KILL_UNDEAD
F:LITE1
F:LUCK
+F:RANDOM_RES_OR_POWER
F:RES_DISEN
F:RES_FEAR
F:RES_MORGUL
@@ -2733,6 +2767,8 @@ F:COULD2H
F:FREE_ACT
F:HIDE_TYPE
F:KILL_DRAGON
+F:RANDOM_POWER
+F:RANDOM_RESIST
F:RES_ACID
F:RES_COLD
F:RES_ELEC
@@ -2805,6 +2841,7 @@ F:CHR
F:HIDE_TYPE
F:HOLD_LIFE
F:INT
+F:RANDOM_POWER
F:RES_FIRE
F:RES_NETHER
F:SEARCH
@@ -2867,6 +2904,7 @@ F:ESP_ORC
F:ESP_TROLL
F:HIDE_TYPE
F:INFRA
+F:RANDOM_RESIST
F:REGEN
F:RES_COLD
F:RES_LITE
@@ -2951,6 +2989,7 @@ W:50:25:110:50000
P:0:0d0:10:14:0
F:ACTIVATE
F:HIDE_TYPE
+F:RANDOM_RES_OR_POWER
F:RES_FIRE
F:SHOW_MODS
F:SPEED
diff --git a/src/defines.h b/src/defines.h
index 224f5bd9..dc9dbfb8 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -678,208 +678,19 @@
/*** Artifact indexes (see "lib/edit/a_info.txt") ***/
-
-/* Lites */
-#define ART_GALADRIEL 1
-#define ART_ELENDIL 2
-#define ART_THRAIN 3
#define ART_PALANTIR 202
-#define ART_UNDEATH 200
-#define ART_STONE_LORE 15
-#define ART_PALANTIR_ITHIL 208
-
-/* Amulets */
-#define ART_CARLAMMAS 4
-#define ART_INGWE 5
-#define ART_DWARVES 6
#define ART_ANCHOR 14
-#define ART_ELESSAR 206
-#define ART_EVENSTAR 207
-
-/* Rings */
-#define ART_FLAR 7
-#define ART_BARAHIR 8
-#define ART_TULKAS 9
-#define ART_NARYA 10
-#define ART_NENYA 11
-#define ART_VILYA 12
#define ART_POWER 13
-/* 14 used by the anchor of space-time */
-/* 15 used by the stone of lore */
-
-/* Dragon Scale */
-#define ART_RAZORBACK 16
-#define ART_BLADETURNER 17
-#define ART_MEDIATOR 166
-
-/* Hard Armour */
-#define ART_HIMRING 167
-#define ART_SOULKEEPER 19
-#define ART_ISILDUR 20
-#define ART_ROHIRRIM 21
-#define ART_BELEGENNON 22
-#define ART_CELEBORN 23
-#define ART_ARVEDUI 24
-#define ART_CASPANION 25
-
-/* Thunderlord flying suit */
#define ART_MARDA 26
-#define ART_TRON 27
-
-/* Soft Armour */
-#define ART_THALKETTOTH 28
-
-/* Shields */
-#define ART_THORIN 30
-#define ART_CELEGORM 31
-#define ART_ANARION 32
-#define ART_GILGALAD 169
-#define ART_HARADRIM 176
-
-/* Helms and Crowns */
#define ART_MORGOTH 34
-#define ART_BERUTHIEL 35
-#define ART_THRANDUIL 36
-#define ART_THENGEL 37
-#define ART_HAMMERHAND 38
-#define ART_DOR 39
-#define ART_HOLHENNETH 40
-#define ART_GORLIM 41
-#define ART_GONDOR 42
-#define ART_KNOWLEDGE 160
-#define ART_NUMENOR 43
-#define ART_CELEBRIMBOR 170
-
-/* Cloaks */
-#define ART_COLLUIN 44
-#define ART_HOLCOLLETH 45
-#define ART_THINGOL 46
-#define ART_THORONGIL 47
-#define ART_COLANNON 48
-#define ART_LUTHIEN 49
-#define ART_TUOR 50
-
-/* Gloves */
-#define ART_CAMBELEG 52
-#define ART_CAMMITHRIM 53
-#define ART_PAURHACH 54
-#define ART_PAURNIMMEN 55
-#define ART_PAURAEGEN 56
-#define ART_PAURNEN 57
-#define ART_CAMLOST 58
-#define ART_FINGOLFIN 59
-#define ART_EOL 178
-
-/* Boots */
-#define ART_FEANOR 60
-#define ART_DAL 61
-#define ART_THROR 62
-
-/* Swords */
#define ART_NARSIL 164
-#define ART_MAEDHROS 64
-#define ART_ANGRIST 65
-#define ART_NARTHANC 66
-#define ART_NIMTHANC 67
-#define ART_DETHANC 68
-#define ART_RILIA 69
-#define ART_BELANGIL 70
#define ART_CALRIS 71
-#define ART_ARUNRUTH 72
#define ART_GLAMDRING 73
-#define ART_AEGLIN 74
-#define ART_ORCRIST 75
-#define ART_GURTHANG 76
-#define ART_ZARCUTHRA 77
-#define ART_MORMEGIL 78
-#define ART_GONDRICAM 79
-#define ART_CRISDURIAN 80
-#define ART_AGLARANG 81
-#define ART_RINGIL 82
#define ART_ANDURIL 83
#define ART_ANGUIREL 84
-#define ART_ELVAGIL 85
-#define ART_FORASGIL 86
-#define ART_CARETH 87
-#define ART_STING 88
-#define ART_HARADEKKET 89
-#define ART_GILETTAR 90
-#define ART_DOOMCALLER 91
-#define ART_VORPAL_BLADE 92
-#define ART_ERU 147
-
-/* Polearms */
-#define ART_THEODEN 93
-#define ART_PAIN 94
-#define ART_OSONDIR 95
-#define ART_TIL 96
-#define ART_AEGLOS 97
-#define ART_OROME 98
#define ART_NIMLOTH 99
-#define ART_EORLINGAS 100
-#define ART_DURIN 101
-#define ART_EONWE 102
-#define ART_BALLI 103
-#define ART_LOTHARANG 104
-#define ART_MUNDWINE 105
-#define ART_BARUKKHELED 106
-#define ART_WRATH 107
-#define ART_ULMO 108
-#define ART_AVAVIR 109
-#define ART_FUNDIN 175
-
-/* The sword of the Dawn */
-#define ART_DAWN 110
-
-/* Hafted */
-#define ART_MELKOR 18
-#define ART_HURIN 33
#define ART_GROND 111
-#define ART_TOTILA 112
-#define ART_THUNDERFIST 113
-#define ART_BLOODSPIKE 114
-#define ART_FIRESTAR 115
-#define ART_TARATOL 116
-#define ART_AULE 117
-#define ART_NAR 118
-#define ART_ERIRIL 119
-#define ART_OLORIN 120
-#define ART_DEATHWREAKER 121
-#define ART_TURMIL 122
#define ART_GOTHMOG 123
-#define ART_AXE_GOTHMOG 145
-#define ART_SKULLCLEAVER 177
-
-#define ART_NAIN 174
-
-/* Bows */
-#define ART_BELTHRONDING 124
-#define ART_BARD 125
-#define ART_CUBRAGOL 126
-#define ART_UMBAR 171
-
-/* Mage Staffs */
-#define ART_GANDALF 127
-
-/* Boomerangs */
-#define ART_BEOR 128
-#define ART_GLIMDRIR 129
-
-/* Musical Instrument */
-#define ART_MAGLOR 137
-#define ART_SKY 138
-#define ART_DAERON 139
-#define ART_DRUEDAIN 141
-#define ART_ROHAN 142
-#define ART_HELM 143
-#define ART_BOROMIR 144
-
-/* Diggers */
-#define ART_EREBOR 140
-
-#define ART_ORCHAST 156
-#define ART_NIGHT 157
-#define ART_NATUREBANE 158
/* Spell for various object */
#define SPELL_ID_PLAIN 1
@@ -2663,7 +2474,10 @@
#define TR5_ACTIVATE_NO_WIELD 0x00002000L /* Can be 'A'ctivated without being wielded */
#define TR5_MAGIC_BREATH 0x00004000L /* Can breath anywere */
#define TR5_WATER_BREATH 0x00008000L /* Can breath underwater */
-#define TR5_WIELD_CAST 0x00010000L /* Need to be wielded to cast spelsl fomr it(if it can be wiekded) */
+#define TR5_WIELD_CAST 0x00010000L /* Must be wielded to cast spell from it */
+#define TR5_RANDOM_RESIST 0x00020000L /* Grants random resistance */
+#define TR5_RANDOM_POWER 0x00040000L /* Grants random power */
+#define TR5_RANDOM_RES_OR_POWER 0x00080000L /* Grants random resistance OR power (50-50 chance) */
/* ESP defines */
#define ESP_ORC 0x00000001L
diff --git a/src/init1.cc b/src/init1.cc
index 56b1a3ac..75a75d3a 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -722,9 +722,9 @@ cptr k_info_flags5[] =
"MAGIC_BREATH",
"WATER_BREATH",
"WIELD_CAST",
- "XXX8X17",
- "XXX8X18",
- "XXX8X19",
+ "RANDOM_RESIST",
+ "RANDOM_POWER",
+ "RANDOM_RES_OR_POWER",
"XXX8X20",
"XXX8X21",
"XXX8X22",
diff --git a/src/object2.cc b/src/object2.cc
index c9853932..145aab4c 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -2043,76 +2043,33 @@ static void object_mention(object_type *o_ptr)
void random_artifact_resistance(object_type * o_ptr)
{
- bool_ give_resistance = FALSE, give_power = FALSE;
-
- switch (o_ptr->name1)
- {
- case ART_CELEBORN:
- case ART_ARVEDUI:
- case ART_CASPANION:
- case ART_TRON:
- case ART_ROHIRRIM:
- case ART_CELEGORM:
- case ART_ANARION:
- case ART_THRANDUIL:
- case ART_LUTHIEN:
- case ART_THROR:
- case ART_THORIN:
- case ART_NIMTHANC:
- case ART_DETHANC:
- case ART_NARTHANC:
- case ART_STING:
- case ART_TURMIL:
- case ART_THALKETTOTH:
- {
- /* Give a resistance */
- give_resistance = TRUE;
- }
- break;
- case ART_MAEDHROS:
- case ART_GLAMDRING:
- case ART_ORCRIST:
- case ART_ANDURIL:
- case ART_ZARCUTHRA:
- case ART_GURTHANG:
- case ART_HARADEKKET:
- case ART_CUBRAGOL:
- case ART_DAWN:
- {
- /* Give a resistance OR a power */
- if (randint(2) == 1) give_resistance = TRUE;
- else give_power = TRUE;
- }
- break;
- case ART_NENYA:
- case ART_VILYA:
- case ART_BERUTHIEL:
- case ART_FINGOLFIN:
- case ART_THINGOL:
- case ART_ULMO:
- case ART_OLORIN:
+ auto f5 = a_info[o_ptr->name1].flags5;
+
+ // Check flags
+ bool give_resistance = (f5 & TR5_RANDOM_RESIST);
+ bool give_power = (f5 & TR5_RANDOM_POWER);
+ if (f5 & TR5_RANDOM_RES_OR_POWER)
+ {
+ if (randint(2) == 1)
{
- /* Give a power */
- give_power = TRUE;
+ give_resistance = true;
}
- break;
- case ART_POWER:
- case ART_GONDOR:
- case ART_AULE:
+ else
{
- /* Give both */
- give_power = TRUE;
- give_resistance = TRUE;
+ give_power = true;
}
- break;
}
+ // Grant the resistance/power
if (give_power)
{
o_ptr->xtra1 = EGO_XTRA_ABILITY;
/* Randomize the "xtra" power */
- if (o_ptr->xtra1) o_ptr->xtra2 = randint(256);
+ if (o_ptr->xtra1)
+ {
+ o_ptr->xtra2 = randint(256);
+ }
}
artifact_bias = 0;