From eae61da171bd07d54eb09775a244257411359221 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 10 Jul 2007 19:35:05 +0000 Subject: Monster enchantment overhaul: * Enchantment degree is converted into duration up-front. The average enchantment duration should be nearly the same as before, but we guarantee minimum durations on enchantments. Enchantment duration variance is much less, needs testing to see whether this makes enchantments and summoning too strong. * Enchantments that rely on degree (like poison, sticky flame) still use it. * Durations are now based on individual movement ticks, not turns (10 ticks = 1 normal player turn). * Breaks saves, abjuration doesn't work (will fix). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1828 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tags.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/tags.cc') diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 8b779c0995..c4d039134f 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1426,6 +1426,8 @@ static void marshall_mon_enchant(tagHeader &th, const mon_enchant &me) marshallShort(th, me.ench); marshallShort(th, me.degree); marshallShort(th, me.who); + marshallShort(th, me.duration); + marshallShort(th, me.maxduration); } static mon_enchant unmarshall_mon_enchant(tagHeader &th) @@ -1434,6 +1436,8 @@ static mon_enchant unmarshall_mon_enchant(tagHeader &th) me.ench = static_cast( unmarshallShort(th) ); me.degree = unmarshallShort(th); me.who = static_cast( unmarshallShort(th) ); + me.duration = unmarshallShort(th); + me.maxduration = unmarshallShort(th); return (me); } @@ -1455,7 +1459,7 @@ static void marshall_monster(tagHeader &th, const monsters &m) for (mon_enchant_list::const_iterator i = m.enchantments.begin(); i != m.enchantments.end(); ++i) { - marshall_mon_enchant(th, *i); + marshall_mon_enchant(th, i->second); } marshallShort(th, m.type); @@ -1612,7 +1616,10 @@ static void unmarshall_monster(tagHeader &th, monsters &m) m.enchantments.clear(); const int nenchs = unmarshallShort(th); for (int i = 0; i < nenchs; ++i) - m.enchantments.insert( unmarshall_mon_enchant(th) ); + { + mon_enchant me = unmarshall_mon_enchant(th); + m.enchantments[me.ench] = me; + } m.type = unmarshallShort(th); m.hit_points = unmarshallShort(th); -- cgit v1.2.3-54-g00ecf