summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-13 18:55:53 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-13 18:55:53 +0000
commit2bd8f39fa42d7c774a27121c2ce3bf82e0104993 (patch)
tree069b83e5b94614e675ee1804c07b661821712f54
parentbe6a0a38de9cba44caca289f155d46df6324d0a5 (diff)
downloadcrawl-ref-2bd8f39fa42d7c774a27121c2ce3bf82e0104993.tar.gz
crawl-ref-2bd8f39fa42d7c774a27121c2ce3bf82e0104993.zip
Made Tome of Destruction more consistent for those with high Evoc.
Made manuals visibly different from spellbooks. Also, you can't cancel reading a manual; so you risk wasting it if you read all unIDed books. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2851 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/it_use3.cc137
-rw-r--r--crawl-ref/source/it_use3.h8
-rw-r--r--crawl-ref/source/item_use.cc27
-rw-r--r--crawl-ref/source/itemname.cc2
-rw-r--r--crawl-ref/source/xom.cc2
-rw-r--r--crawl-ref/source/xom.h2
6 files changed, 77 insertions, 101 deletions
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index f9ff196124..126bdcdfb4 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -796,16 +796,11 @@ static bool disc_of_storms(void)
return (ret);
} // end disc_of_storms()
-void tome_of_power(char sc_read_2)
+void tome_of_power(int slot)
{
- int temp_rand = 0; // probability determination {dlb}
-
int powc = 5 + you.skills[SK_EVOCATIONS]
+ roll_dice( 5, you.skills[SK_EVOCATIONS] );
- spell_type spell_casted = SPELL_NO_SPELL;
- struct bolt beam;
-
msg::stream << "The book opens to a page covered in "
<< weird_writing() << '.' << std::endl;
@@ -814,7 +809,7 @@ void tome_of_power(char sc_read_2)
if (!yesno("Read it?"))
return;
- set_ident_flags( you.inv[sc_read_2], ISFLAG_IDENT_MASK );
+ set_ident_flags( you.inv[slot], ISFLAG_KNOW_TYPE );
if (you.mutation[MUT_BLURRY_VISION] > 0
&& random2(4) < you.mutation[MUT_BLURRY_VISION])
@@ -826,46 +821,35 @@ void tome_of_power(char sc_read_2)
mpr("You find yourself reciting the magical words!");
exercise( SK_EVOCATIONS, 1 );
- temp_rand = random2(50) + random2( you.skills[SK_EVOCATIONS] / 3 );
-
- switch (random2(50))
+ if ( random2(50) < 7 )
{
- case 0:
- case 3:
- case 4:
- case 6:
- case 7:
- case 8:
- case 9:
mpr("A cloud of weird smoke pours from the book's pages!");
big_cloud( random_smoke_type(), KC_YOU,
you.x_pos, you.y_pos, 20, 10 + random2(8) );
xom_is_stimulated(16);
- return;
- case 1:
- case 14:
+ }
+ else if ( random2(43) < 2 )
+ {
mpr("A cloud of choking fumes pours from the book's pages!");
big_cloud(CLOUD_POISON, KC_YOU,
you.x_pos, you.y_pos, 20, 7 + random2(5));
xom_is_stimulated(64);
- return;
-
- case 2:
- case 13:
+ }
+ else if ( random2(41) < 2 )
+ {
mpr("A cloud of freezing gas pours from the book's pages!");
big_cloud(CLOUD_COLD, KC_YOU, you.x_pos, you.y_pos, 20, 8 + random2(5));
xom_is_stimulated(64);
- return;
-
- case 5:
- case 11:
- case 12:
+ }
+ else if ( random2(39) < 3 )
+ {
if (one_chance_in(5))
{
mpr("The book disappears in a mighty explosion!");
- dec_inv_item_quantity( sc_read_2, 1 );
+ dec_inv_item_quantity( slot, 1 );
}
+ bolt beam;
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 15 );
// unsure about this // BEAM_EXPLOSION instead? [dlb]
@@ -877,16 +861,16 @@ void tome_of_power(char sc_read_2)
// your explosion, (not someone else's explosion)
beam.beam_source = NON_MONSTER;
beam.thrower = KILL_YOU;
- beam.aux_source = "an exploding Tome of Power";
+ beam.aux_source = "an exploding tome of Destruction";
beam.ex_size = 2;
beam.is_tracer = false;
beam.is_explosion = true;
explosion(beam);
xom_is_stimulated(255);
- return;
-
- case 10:
+ }
+ else if (one_chance_in(36))
+ {
if (create_monster( MONS_ABOMINATION_SMALL, 6, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
{
@@ -894,65 +878,62 @@ void tome_of_power(char sc_read_2)
mpr("It doesn't look too friendly.");
}
xom_is_stimulated(255);
- return;
}
+ else
+ {
+ viewwindow(1, false);
- viewwindow(1, false);
-
- temp_rand = random2(23) + random2( you.skills[SK_EVOCATIONS] / 3 );
-
- if (temp_rand > 25)
- temp_rand = 25;
-
- spell_casted = ((temp_rand > 19) ? SPELL_FIREBALL :
- (temp_rand > 16) ? SPELL_BOLT_OF_FIRE :
- (temp_rand > 13) ? SPELL_BOLT_OF_COLD :
- (temp_rand > 11) ? SPELL_LIGHTNING_BOLT :
- (temp_rand > 10) ? SPELL_LEHUDIBS_CRYSTAL_SPEAR :
- (temp_rand > 9) ? SPELL_VENOM_BOLT :
- (temp_rand > 8) ? SPELL_BOLT_OF_DRAINING :
- (temp_rand > 7) ? SPELL_BOLT_OF_INACCURACY :
- (temp_rand > 6) ? SPELL_STICKY_FLAME :
- (temp_rand > 5) ? SPELL_TELEPORT_SELF :
- (temp_rand > 4) ? SPELL_CIGOTUVIS_DEGENERATION :
- (temp_rand > 3) ? SPELL_POLYMORPH_OTHER :
- (temp_rand > 2) ? SPELL_MEPHITIC_CLOUD :
- (temp_rand > 1) ? SPELL_THROW_FLAME :
- (temp_rand > 0) ? SPELL_THROW_FROST
- : SPELL_MAGIC_DART);
-
- your_spells( spell_casted, powc, false );
-} // end tome_of_power()
-
-void skill_manual(char sc_read_2)
-{
- set_ident_flags( you.inv[sc_read_2], ISFLAG_IDENT_MASK );
-
- const int skill = you.inv[sc_read_2].plus;
-
- const char* skname = skill_name(skill);
- mprf("This is a manual of %s!", skname);
+ int temp_rand = random2(23) + random2(you.skills[SK_EVOCATIONS] / 3);
+
+ if (temp_rand > 25)
+ temp_rand = 25;
+
+ const spell_type spell_casted =
+ ((temp_rand > 24) ? SPELL_LEHUDIBS_CRYSTAL_SPEAR :
+ (temp_rand > 21) ? SPELL_BOLT_OF_FIRE :
+ (temp_rand > 18) ? SPELL_BOLT_OF_COLD :
+ (temp_rand > 16) ? SPELL_LIGHTNING_BOLT :
+ (temp_rand > 10) ? SPELL_FIREBALL :
+ (temp_rand > 9) ? SPELL_VENOM_BOLT :
+ (temp_rand > 8) ? SPELL_BOLT_OF_DRAINING :
+ (temp_rand > 7) ? SPELL_BOLT_OF_INACCURACY :
+ (temp_rand > 6) ? SPELL_STICKY_FLAME :
+ (temp_rand > 5) ? SPELL_TELEPORT_SELF :
+ (temp_rand > 4) ? SPELL_CIGOTUVIS_DEGENERATION :
+ (temp_rand > 3) ? SPELL_POLYMORPH_OTHER :
+ (temp_rand > 2) ? SPELL_MEPHITIC_CLOUD :
+ (temp_rand > 1) ? SPELL_THROW_FLAME :
+ (temp_rand > 0) ? SPELL_THROW_FROST
+ : SPELL_MAGIC_DART);
+
+ your_spells( spell_casted, powc, false );
+ }
+}
+void skill_manual(int slot)
+{
+ // Removed confirmation request because you know it's
+ // a manual in advance.
you.turn_is_over = true;
+ item_def& manual(you.inv[slot]);
+ set_ident_flags( manual, ISFLAG_KNOW_TYPE );
+ const int skill = manual.plus;
- if (!yesno("Read it?"))
- return;
-
- mprf("You read about %s.", skname);
+ mprf("You read about %s.", skill_name(skill));
exercise(skill, 500);
if (one_chance_in(10))
{
- mpr("The book crumbles into dust.");
- dec_inv_item_quantity( sc_read_2, 1 );
+ mpr("The manual crumbles into dust.");
+ dec_inv_item_quantity( slot, 1 );
}
else
{
- mpr("The book looks somewhat more worn.");
+ mpr("The manual looks somewhat more worn.");
}
xom_is_stimulated(14);
-} // end skill_manual()
+}
static bool box_of_beasts()
{
diff --git a/crawl-ref/source/it_use3.h b/crawl-ref/source/it_use3.h
index 2e5efae7c3..8c5cfc3e37 100644
--- a/crawl-ref/source/it_use3.h
+++ b/crawl-ref/source/it_use3.h
@@ -17,28 +17,28 @@
/* ***********************************************************************
* called from: item_use
* *********************************************************************** */
-void skill_manual(char sc_read_2);
+void skill_manual(int slot);
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: item_use - spl-book
* *********************************************************************** */
-void tome_of_power(char sc_read_2);
+void tome_of_power(int slot);
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
-bool evoke_wielded(void);
+bool evoke_wielded();
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
-void special_wielded(void);
+void special_wielded();
#endif
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 522b130787..3e048b4b97 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3672,20 +3672,17 @@ static bool enchant_armour( void )
static void handle_read_book( int item_slot )
{
- int spell, spell_index;
+ item_def& book(you.inv[item_slot]);
- if (you.inv[item_slot].sub_type == BOOK_DESTRUCTION)
+ if (book.sub_type == BOOK_DESTRUCTION)
{
if (silenced(you.x_pos, you.y_pos))
- {
mpr("This book does not work if you cannot read it aloud!");
- return;
- }
-
- tome_of_power(item_slot);
+ else
+ tome_of_power(item_slot);
return;
}
- else if (you.inv[item_slot].sub_type == BOOK_MANUAL)
+ else if (book.sub_type == BOOK_MANUAL)
{
skill_manual(item_slot);
return;
@@ -3694,25 +3691,23 @@ static void handle_read_book( int item_slot )
while (true)
{
// Spellbook
- spell = read_book( you.inv[item_slot], RBOOK_READ_SPELL );
+ const int ltr = read_book( book, RBOOK_READ_SPELL );
- if (spell < 'a' || spell > 'h') //jmf: was 'g', but 8=h
+ if (ltr < 'a' || ltr > 'h') //jmf: was 'g', but 8=h
{
mesclr( true );
return;
}
- spell_index = letter_to_index( spell );
-
- const spell_type nthing =
- which_spell_in_book(you.inv[item_slot].sub_type, spell_index);
- if (nthing == SPELL_NO_SPELL)
+ const spell_type spell = which_spell_in_book(book.sub_type,
+ letter_to_index(ltr));
+ if (spell == SPELL_NO_SPELL)
{
mesclr( true );
return;
}
- describe_spell( nthing );
+ describe_spell( spell );
}
}
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index eaacf8c987..0ca583f975 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1441,7 +1441,7 @@ std::string item_def::name_aux( description_level_type desc,
{
buff << book_secondary_string(this->special / 10)
<< book_primary_string(this->special % 10)
- << "book";
+ << (item_typ == BOOK_MANUAL ? "manual" : "book");
}
else if (item_typ == BOOK_MANUAL)
buff << "manual of " << skill_name(it_plus);
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index a29e27a63c..ff97c70785 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -195,7 +195,7 @@ void xom_is_stimulated(int maxinterestingness, xom_message_type message_type,
force_message);
}
-void xom_is_stimulated(int maxinterestingness, std::string message,
+void xom_is_stimulated(int maxinterestingness, const std::string& message,
bool force_message)
{
const char* message_array[6];
diff --git a/crawl-ref/source/xom.h b/crawl-ref/source/xom.h
index eade8784bd..ec8878c9b1 100644
--- a/crawl-ref/source/xom.h
+++ b/crawl-ref/source/xom.h
@@ -25,7 +25,7 @@ enum xom_message_type
void xom_is_stimulated(int maxinterestingness,
xom_message_type message_type = XM_NORMAL,
bool force_message = false);
-void xom_is_stimulated(int maxinterestingness, std::string message,
+void xom_is_stimulated(int maxinterestingness, const std::string& message,
bool force_message = false);
bool xom_is_nice();
void xom_acts(bool niceness, int sever);