summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-11 13:38:28 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-11 13:38:28 +0000
commitebc2cb26f221bbce6a2cf5cbd3ce250af75e914f (patch)
tree8d64cd38054d2b584c5ad8849ee42b936475783f
parent89adf4610b5206a5f42187ee90cd01e54583f5d9 (diff)
downloadcrawl-ref-ebc2cb26f221bbce6a2cf5cbd3ce250af75e914f.tar.gz
crawl-ref-ebc2cb26f221bbce6a2cf5cbd3ce250af75e914f.zip
After discussion with dpeg, added a Scroll of Antimagic,
taking probability (equal to ?oHolyWord) from the ?oPaper. Effects apply to all creatures within LOS, including you, with no magic resistance check: - Remove all magical enchantments (e.g. Haste, but not Poison) - Cut magic resistance in half for 40 turns. (This does not affect magic-immunes.) Balance testing, etc., needed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7211 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc1
-rw-r--r--crawl-ref/source/enum.h2
-rw-r--r--crawl-ref/source/item_use.cc90
-rw-r--r--crawl-ref/source/itemname.cc1
-rw-r--r--crawl-ref/source/itemprop.h1
-rw-r--r--crawl-ref/source/makeitem.cc97
-rw-r--r--crawl-ref/source/misc.cc23
-rw-r--r--crawl-ref/source/mon-util.cc8
-rw-r--r--crawl-ref/source/output.cc15
-rw-r--r--crawl-ref/source/player.cc4
10 files changed, 146 insertions, 96 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index a81e3b017d..0d8d9afdee 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2750,6 +2750,7 @@ static void _decrement_durations()
_decrement_a_duration(DUR_BARGAIN, "You feel less charismatic.");
_decrement_a_duration(DUR_CONF, "You feel less confused.");
+ _decrement_a_duration(DUR_LOWERED_MR, "You feel more resistant to magic.");
if (you.duration[DUR_PARALYSIS] || you.duration[DUR_PETRIFIED])
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 13acab5ed4..6856219604 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1129,6 +1129,7 @@ enum duration_type
DUR_SAGE,
DUR_TELEPATHY,
DUR_PETRIFIED,
+ DUR_LOWERED_MR,
NUM_DURATIONS
};
@@ -1166,6 +1167,7 @@ enum enchant_type
ENCH_NEUTRAL,
ENCH_PETRIFYING,
ENCH_PETRIFIED,
+ ENCH_LOWERED_MR,
// Update enchantment names in mon-util.cc when adding or removing
// enchantments.
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 8ae9be4044..a63819553e 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4271,17 +4271,50 @@ static bool _scroll_modify_item(item_def scroll)
return (false);
}
-void read_scroll( int slot )
+static void _antimagic_scroll()
{
- int affected = 0;
- int i;
- int count;
- int nthing;
- struct bolt beam;
+ // First cast antimagic on yourself.
+ antimagic();
+
+ const enchant_type lost_enchantments[] = {
+ ENCH_SLOW,
+ ENCH_HASTE,
+ ENCH_FEAR,
+ ENCH_CONFUSION,
+ ENCH_INVIS,
+ ENCH_BACKLIGHT,
+ ENCH_CHARM,
+ ENCH_PARALYSIS,
+ ENCH_PETRIFYING,
+ ENCH_PETRIFIED
+ };
+
+ mon_enchant lowered_mr(ENCH_LOWERED_MR, 1, KC_YOU, 40);
+
+ // All nearby creatures lose all magical enchantments, and halve
+ // their MR halved (if they're not magic-immune.)
+ for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
+ {
+ const unsigned short targ_monst = env.mgrid(*ri);
+ if (targ_monst != NON_MONSTER)
+ {
+ monsters& mon = menv[targ_monst];
+ for (unsigned int i = 0; i < ARRAYSZ(lost_enchantments); ++i)
+ mon.del_ench(lost_enchantments[i], true, true);
+
+ mon.add_ench(lowered_mr);
+
+ // Annoying but not enough to turn friendlies against you.
+ behaviour_event(&mon, ME_ANNOY, MHITYOU);
+ }
+ }
- // added: scroll effects are never tracers.
- beam.is_tracer = false;
+ you.duration[DUR_LOWERED_MR] = 40;
+ mpr("Magic dampens around you!");
+}
+void read_scroll(int slot)
+{
if (you.duration[DUR_BERSERKER])
{
canned_msg(MSG_TOO_BERSERK);
@@ -4461,16 +4494,20 @@ void read_scroll( int slot )
break;
case SCR_IMMOLATION:
+ {
mpr("The scroll explodes in your hands!");
// We do this here to prevent it from blowing itself up.
set_ident_type( scroll, ID_KNOWN_TYPE );
dec_inv_item_quantity( item_slot, 1 );
- // unsure about this // BEAM_EXPLOSION instead? {dlb}
- beam.flavour = BEAM_FIRE;
+ bolt beam;
+
+ beam.is_tracer = false;
+ // unsure about this: BEAM_EXPLOSION instead? {dlb}
+ beam.flavour = BEAM_FIRE;
beam.type = dchar_glyph(DCHAR_FIRED_BURST);
- beam.damage = dice_def( 3, 10 );
+ beam.damage = dice_def(3, 10);
beam.target = you.pos();
beam.name = "fiery explosion";
beam.colour = RED;
@@ -4485,21 +4522,20 @@ void read_scroll( int slot )
explosion(beam, false, false, true, true, true, false);
break;
+ }
case SCR_CURSE_WEAPON:
- nthing = you.equip[EQ_WEAPON];
-
- if (nthing == -1
- || you.inv[nthing].base_type != OBJ_WEAPONS
- || item_cursed( you.inv[nthing] ))
+ if (!you.weapon()
+ || you.weapon()->base_type != OBJ_WEAPONS
+ || item_cursed(*you.weapon()))
{
canned_msg(MSG_NOTHING_HAPPENS);
id_the_scroll = false;
}
else
- {
+ {
// Also sets wield_change.
- do_curse_item( you.inv[nthing], false );
+ do_curse_item( *you.weapon(), false );
learned_something_new(TUT_YOU_CURSED);
}
break;
@@ -4566,15 +4602,16 @@ void read_scroll( int slot )
break;
case SCR_CURSE_ARMOUR:
+ {
// make sure there's something to curse first
- count = 0;
- affected = EQ_WEAPON;
- for (i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++)
+ int count = 0;
+ int affected = EQ_WEAPON;
+ for (int i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++)
{
- if (you.equip[i] != -1 && !item_cursed( you.inv[you.equip[i]] ))
+ if (you.equip[i] != -1 && !item_cursed(you.inv[you.equip[i]]))
{
count++;
- if (one_chance_in( count ))
+ if (one_chance_in(count))
affected = i;
}
}
@@ -4590,6 +4627,7 @@ void read_scroll( int slot )
do_curse_item( you.inv[you.equip[affected]], false );
learned_something_new(TUT_YOU_CURSED);
break;
+ }
case SCR_HOLY_WORD:
{
@@ -4625,6 +4663,10 @@ void read_scroll( int slot )
break;
}
+ case SCR_ANTIMAGIC:
+ _antimagic_scroll();
+ break;
+
default:
mpr("Read a buggy scroll, please report this.");
break;
@@ -4649,7 +4691,7 @@ void read_scroll( int slot )
// a dangerous monster nearby...
xom_is_stimulated(255);
}
-} // end read_scroll()
+}
void examine_object(void)
{
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 3a7d4f05c2..fd6dcb96fb 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -551,6 +551,7 @@ static const char* scroll_type_name(int scrolltype)
case SCR_RECHARGING: return "recharging";
case SCR_ENCHANT_WEAPON_III: return "enchant weapon III";
case SCR_HOLY_WORD: return "holy word";
+ case SCR_ANTIMAGIC: return "antimagic";
default: return "bugginess";
}
}
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 65ff241f7b..aae23b1768 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -318,6 +318,7 @@ enum scroll_type
SCR_RECHARGING,
SCR_ENCHANT_WEAPON_III,
SCR_HOLY_WORD,
+ SCR_ANTIMAGIC,
NUM_SCROLLS
};
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index d4dcf01cfa..cedc817167 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2374,72 +2374,57 @@ static void _generate_scroll_item(item_def& item, int force_type,
item.sub_type = force_type;
else
{
- // only used in certain cases {dlb}
const int depth_mod = random2(1 + item_level);
- const int temp_rand = random2(935);
- item.sub_type =
- ((temp_rand > 766) ? SCR_IDENTIFY : // 17.97%
- (temp_rand > 644) ? SCR_REMOVE_CURSE : // 13.05%
- (temp_rand > 569) ? SCR_TELEPORTATION : // 8.02%
- (temp_rand > 509) ? SCR_DETECT_CURSE : // 6.42%
- (temp_rand > 479) ? SCR_FEAR : // 3.21%
- (temp_rand > 449) ? SCR_NOISE : // 3.21%
- (temp_rand > 419) ? SCR_MAGIC_MAPPING : // 3.21%
- (temp_rand > 389) ? SCR_FOG : // 3.21%
- (temp_rand > 359) ? SCR_RANDOM_USELESSNESS :// 3.21%
- (temp_rand > 329) ? SCR_CURSE_WEAPON : // 3.21%
- (temp_rand > 299) ? SCR_CURSE_ARMOUR : // 3.21%
- (temp_rand > 269) ? SCR_RECHARGING : // 3.21%
- (temp_rand > 239) ? SCR_BLINKING : // 3.21%
- (temp_rand > 209) ? SCR_PAPER : // 3.21%
- (temp_rand > 179) ? SCR_ENCHANT_ARMOUR : // 3.21%
- (temp_rand > 149) ? SCR_ENCHANT_WEAPON_I : // 3.21%
- (temp_rand > 119) ? SCR_ENCHANT_WEAPON_II : // 3.21%
-
- // Crawl is kind to newbie adventurers {dlb}:
- // yes -- these five are messy {dlb}:
- // yes they are a hellish mess of tri-ops and long lines,
- // this formating is somewhat better -- bwr
- (temp_rand > 89) ?
- ((item_level < 4) ? SCR_TELEPORTATION
- : SCR_IMMOLATION) : // 3.21%
- (temp_rand > 74) ?
- ((depth_mod < 4) ? SCR_TELEPORTATION
- : SCR_ACQUIREMENT) : // 1.60%
- (temp_rand > 59) ?
- ((depth_mod < 4) ? SCR_DETECT_CURSE
- : SCR_SUMMONING) : // 1.60%
- (temp_rand > 44) ?
- ((depth_mod < 4) ? SCR_TELEPORTATION // 1.60%
- : SCR_ENCHANT_WEAPON_III) :
- (temp_rand > 29) ?
- ((depth_mod < 7) ? SCR_DETECT_CURSE
- : SCR_TORMENT) : // 1.60%
- (temp_rand > 14) ?
- ((depth_mod < 7) ? SCR_DETECT_CURSE
- : SCR_HOLY_WORD) : // 1.60%
- // default:
- ((depth_mod < 7) ? SCR_TELEPORTATION // 1.60%
- : SCR_VORPALISE_WEAPON));
+ // total weight: 10000
+ item.sub_type = random_choose_weighted(
+ 1797, SCR_IDENTIFY,
+ 1305, SCR_REMOVE_CURSE,
+ 802, SCR_TELEPORTATION,
+ 642, SCR_DETECT_CURSE,
+ 321, SCR_FEAR,
+ 321, SCR_NOISE,
+ 321, SCR_MAGIC_MAPPING,
+ 321, SCR_FOG,
+ 321, SCR_RANDOM_USELESSNESS,
+ 321, SCR_CURSE_WEAPON,
+ 321, SCR_CURSE_ARMOUR,
+ 321, SCR_RECHARGING,
+ 321, SCR_BLINKING,
+ 161, SCR_PAPER,
+ 321, SCR_ENCHANT_ARMOUR,
+ 321, SCR_ENCHANT_WEAPON_I,
+ 321, SCR_ENCHANT_WEAPON_II,
+
+ // Don't create ?oImmolation at low levels (encourage read-ID)
+ 321, (item_level < 4 ? SCR_TELEPORTATION : SCR_IMMOLATION),
+
+ // Medium-level scrolls
+ 160, (depth_mod < 4 ? SCR_TELEPORTATION : SCR_ACQUIREMENT),
+ 160, (depth_mod < 4 ? SCR_TELEPORTATION : SCR_ENCHANT_WEAPON_III),
+ 160, (depth_mod < 4 ? SCR_DETECT_CURSE : SCR_SUMMONING),
+ 160, (depth_mod < 4 ? SCR_PAPER : SCR_ANTIMAGIC),
+
+ // High-level scrolls
+ 160, (depth_mod < 7 ? SCR_TELEPORTATION : SCR_VORPALISE_WEAPON),
+ 160, (depth_mod < 7 ? SCR_DETECT_CURSE : SCR_TORMENT),
+ 160, (depth_mod < 7 ? SCR_DETECT_CURSE : SCR_HOLY_WORD),
+ 0);
}
// determine quantity
- if ( item.sub_type == SCR_VORPALISE_WEAPON
- || item.sub_type == SCR_ENCHANT_WEAPON_III
- || item.sub_type == SCR_ACQUIREMENT
- || item.sub_type == SCR_TORMENT
- || item.sub_type == SCR_HOLY_WORD )
+ if (item.sub_type == SCR_VORPALISE_WEAPON
+ || item.sub_type == SCR_ENCHANT_WEAPON_III
+ || item.sub_type == SCR_ACQUIREMENT
+ || item.sub_type == SCR_TORMENT
+ || item.sub_type == SCR_HOLY_WORD)
{
item.quantity = 1;
}
else
{
- const int tmp = random2(48);
- if ( tmp == 1 )
- item.quantity = 2;
- else if ( tmp == 0 )
- item.quantity = 3;
+ if (one_chance_in(24))
+ item.quantity = (coinflip() ? 2 : 3);
else
item.quantity = 1;
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index c55e4573b2..b411f205c7 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2388,25 +2388,22 @@ std::vector<monsters*> get_nearby_monsters(bool want_move,
std::vector<monsters*> mons;
- // Sweep every square within range.
+ // Sweep every visible square within range.
for ( radius_iterator ri(you.pos(), range); ri; ++ri )
{
const unsigned short targ_monst = env.mgrid(*ri);
if (targ_monst != NON_MONSTER)
{
- if (see_grid(*ri))
+ monsters *mon = &menv[targ_monst];
+ if (mon->alive()
+ && (!require_visible || player_monster_visible(mon))
+ && !mons_is_submerged(mon)
+ && (!mons_is_mimic(mon->type) || mons_is_known_mimic(mon))
+ && (!dangerous_only || !mons_is_safe(mon, want_move)))
{
- monsters *mon = &menv[targ_monst];
- if (mon->alive()
- && (!require_visible || player_monster_visible(mon))
- && !mons_is_submerged(mon)
- && (!mons_is_mimic(mon->type) || mons_is_known_mimic(mon))
- && (!dangerous_only || !mons_is_safe(mon, want_move)))
- {
- mons.push_back(mon);
- if (just_check) // stop once you find one
- return mons;
- }
+ mons.push_back(mon);
+ if (just_check) // stop once you find one
+ return mons;
}
}
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 5c70b00cb2..d15988d629 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -936,6 +936,9 @@ int mons_resist_magic( const monsters *mon )
u += 30;
}
+ if (mon->has_ench(ENCH_LOWERED_MR))
+ u /= 2;
+
return (u);
}
@@ -5897,6 +5900,7 @@ void monsters::timeout_enchantments(int levels)
case ENCH_SICK: case ENCH_SLEEPY: case ENCH_PARALYSIS:
case ENCH_PETRIFYING: case ENCH_PETRIFIED:
case ENCH_BATTLE_FRENZY: case ENCH_NEUTRAL:
+ case ENCH_LOWERED_MR:
lose_ench_levels(i->second, levels);
break;
@@ -6029,6 +6033,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_ABJ:
case ENCH_CHARM:
case ENCH_SLEEP_WARY:
+ case ENCH_LOWERED_MR:
decay_enchantment(me);
break;
@@ -7004,7 +7009,8 @@ static const char *enchant_names[] =
"rot", "summon", "abj", "backlit", "charm", "fire",
"gloshifter", "shifter", "tp", "wary", "submerged",
"short-lived", "paralysis", "sick", "sleep", "fatigue", "held",
- "blood-lust", "neutral", "petrifying", "petrified", "bug"
+ "blood-lust", "neutral", "petrifying", "petrified", "magic-vulnerable",
+ "bug"
};
static const char *_mons_enchantment_name(enchant_type ench)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 27c83fefda..fd97e6a5ec 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -596,8 +596,10 @@ static void _get_status_lights(std::vector<status_light>& out)
if (you.duration[DUR_REPEL_UNDEAD])
{
- int color = _dur_colour( LIGHTGREY, (you.duration[DUR_REPEL_UNDEAD] <= 4) );
- out.push_back(status_light(color, "Holy"));
+ int colour = _dur_colour(LIGHTGREY,
+ (you.duration[DUR_REPEL_UNDEAD] <= 4));
+
+ out.push_back(status_light(colour, "Holy"));
}
if (you.duration[DUR_TELEPORT])
@@ -686,6 +688,11 @@ static void _get_status_lights(std::vector<status_light>& out)
out.push_back(status_light(RED, "Conf"));
}
+ if (you.duration[DUR_LOWERED_MR])
+ {
+ out.push_back(status_light(RED, "-MR"));
+ }
+
if (you.duration[DUR_BEHELD])
{
out.push_back(status_light(RED, "Bhld"));
@@ -2117,6 +2124,10 @@ std::string _status_mut_abilities()
// if (you.duration[DUR_CONTROL_TELEPORT])
// text += "control teleport, ";
+// MR output already says so
+// if (you.duration[DUR_LOWERED_MR])
+// text += "vulnerable to magic, ";
+
if (you.duration[DUR_DEATH_CHANNEL])
text += "death channel, ";
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 8e61018fdc..cfec9d3b8a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1162,6 +1162,10 @@ int player_res_magic(void)
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_LICH)
rm += 50;
+ // Enchantment effect
+ if (you.duration[DUR_LOWERED_MR])
+ rm /= 2;
+
return rm;
}