summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authorChris Oelmueller <chris.oelmueller@gmail.com>2014-04-23 18:40:47 +0200
committerNicholas Feinberg <pleasingfung@gmail.com>2014-06-14 23:00:53 -0700
commitccee9314cab70c44495d53600391b8ef0cee2e95 (patch)
tree764fafa5f96bc0cb72636169ab036bd69262ba19 /crawl-ref/source/tags.cc
parent2ff73b2fa81b0674be7a6592ab0f38b3867a949e (diff)
downloadcrawl-ref-ccee9314cab70c44495d53600391b8ef0cee2e95.tar.gz
crawl-ref-ccee9314cab70c44495d53600391b8ef0cee2e95.zip
Plus2: Upgrade old weapons
Their new (single) enchantment is the old to-dam if negative, else the max of its to-hit and to-dam enchantments. Blowguns already only used to-hit while setting to-dam to 0, so their levels are unchanged. In the interest of a simple and consistent upgrade path, this was chosen over weighted averages of the enchantments and whatnot. For very specific cases, the change will buff existing items quite a bit; this is a bonus for players.
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 4e64edfe39..ec6b52dfdb 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -3858,6 +3858,21 @@ void unmarshallItem(reader &th, item_def &item)
item.sub_type = SCR_ENCHANT_WEAPON;
}
}
+
+ if (th.getMinorVersion() < TAG_MINOR_WEAPON_PLUSES)
+ {
+ int acc, dam, slay = 0;
+
+ if (item.base_type == OBJ_WEAPONS)
+ {
+ acc = item.plus;
+ dam = item.plus2;
+ slay = dam < 0 ? dam : max(acc,dam);
+
+ item.plus = slay;
+ item.plus2 = 0;
+ }
+ }
#endif
if (is_unrandom_artefact(item))