summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 17:31:31 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 17:31:31 +0000
commitd733df05e5309444cb83c028c0515467c87ae4c6 (patch)
treeceafd9ecdfdea838a3a3ba59937154b74b58d784 /crawl-ref/source
parent74114bc4feef8e1edcea61cc836b9f4946b17223 (diff)
downloadcrawl-ref-d733df05e5309444cb83c028c0515467c87ae4c6.tar.gz
crawl-ref-d733df05e5309444cb83c028c0515467c87ae4c6.zip
Changed unwield_item() to actually unwield the item, and to have it
unwield your weapon rather than something arbitrary (I found no cases in the code where this wasn't what was wanted.) Implemented some of David's deck changes: - decks weigh half as much - names changed - Draw Card doesn't cost piety; cost upped to 2 MP - Nemelex card power bonus now applies even when not praying - Damnation can now banish extra targets (your own chance of banishment remains the same.) - Nemelex doesn't accept sacrificed decks. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2082 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc2
-rw-r--r--crawl-ref/source/debug.cc5
-rw-r--r--crawl-ref/source/decks.cc38
-rw-r--r--crawl-ref/source/delay.cc3
-rw-r--r--crawl-ref/source/food.cc2
-rw-r--r--crawl-ref/source/it_use2.cc29
-rw-r--r--crawl-ref/source/it_use2.h2
-rw-r--r--crawl-ref/source/item_use.cc12
-rw-r--r--crawl-ref/source/itemname.cc4
-rw-r--r--crawl-ref/source/itemprop.cc5
-rw-r--r--crawl-ref/source/items.cc22
-rw-r--r--crawl-ref/source/religion.cc5
-rw-r--r--crawl-ref/source/spells3.cc3
-rw-r--r--crawl-ref/source/transfor.cc5
14 files changed, 75 insertions, 62 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index a36ec6d9f4..550890b41d 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -281,7 +281,7 @@ static const ability_def Ability_List[] =
// Nemelex
{ ABIL_NEMELEX_PEEK_DECK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT },
- { ABIL_NEMELEX_DRAW_CARD, "Draw Card", 1, 0, 0, 1, ABFLAG_NONE },
+ { ABIL_NEMELEX_DRAW_CARD, "Draw Card", 2, 0, 0, 0, ABFLAG_NONE },
{ ABIL_NEMELEX_TRIPLE_DRAW, "Triple Draw", 2, 0, 100, 2, ABFLAG_NONE },
{ ABIL_NEMELEX_STACK_DECK, "Stack Deck", 5, 0, 150, 6, ABFLAG_NONE },
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 6deb102853..dd5ebc914d 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -2136,10 +2136,7 @@ int fsim_kit_equip(const std::string &kit)
}
}
else if (you.equip[EQ_WEAPON] != -1)
- {
- unwield_item(you.equip[EQ_WEAPON], false);
- you.equip[EQ_WEAPON] = -1;
- }
+ unwield_item(false);
if (!missile.empty())
{
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 1f58a6a8c3..66602c0667 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -404,7 +404,7 @@ bool deck_triple_draw()
{
mpr("The deck of cards disappears in a puff of smoke.");
if ( slot == you.equip[EQ_WEAPON] )
- unwield_item(slot);
+ unwield_item();
dec_inv_item_quantity( slot, 1 );
}
@@ -630,13 +630,32 @@ static void damnation_card(int power, deck_rarity_type rarity)
return;
}
- // pick a random monster nearby to banish (or yourself)
- const int mon_to_banish = choose_random_nearby_monster(1);
+ // Calculate how many extra banishments you get.
+ const int power_level = get_power_level(power, rarity);
+ int nemelex_bonus = 0;
+ if ( you.religion == GOD_NEMELEX_XOBEH && !player_under_penance() )
+ nemelex_bonus = you.piety / 20;
+ int extra_targets = power_level + random2(you.skills[SK_EVOCATIONS] +
+ nemelex_bonus) / 12;
+
+ for ( int i = 0; i < 1 + extra_targets; ++i )
+ {
+ // pick a random monster nearby to banish (or yourself)
+ const int mon_to_banish = choose_random_nearby_monster(1);
+
+ // bonus banishments only banish monsters
+ if ( i != 0 && mon_to_banish == NON_MONSTER )
+ continue;
+
+ if ( mon_to_banish == NON_MONSTER ) // banish yourself!
+ {
+ banished(DNGN_ENTER_ABYSS);
+ break; // don't banish anything else
+ }
+ else
+ menv[mon_to_banish].banish();
+ }
- if ( mon_to_banish == NON_MONSTER ) // banish yourself!
- banished(DNGN_ENTER_ABYSS);
- else
- menv[mon_to_banish].banish();
}
static void warpwright_card(int power, deck_rarity_type rarity)
@@ -788,7 +807,10 @@ static void battle_lust_card(int power, deck_rarity_type rarity)
if ( power_level >= 2 )
you.duration[DUR_SLAYING] = random2(power/6) + 1;
else if ( power_level == 1 )
+ {
+ // FIXME change to "go berserk next turn"
go_berserk(false);
+ }
else if ( power_level == 0 )
potion_effect(POT_MIGHT, random2(power/4));
}
@@ -1229,7 +1251,7 @@ static int card_power(deck_rarity_type rarity)
{
result -= you.penance[GOD_NEMELEX_XOBEH];
}
- else if ( you.religion == GOD_NEMELEX_XOBEH && you.duration[DUR_PRAYER] )
+ else if ( you.religion == GOD_NEMELEX_XOBEH )
{
result = you.piety;
result *= (you.skills[SK_EVOCATIONS] + 25);
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index e18e7a8c12..05474129c5 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -603,8 +603,7 @@ static void finish_delay(const delay_queue_item &delay)
// so that temporary brands and such are cleared. -- bwr
if (delay.parm1 == you.equip[EQ_WEAPON])
{
- unwield_item( delay.parm1 );
- you.equip[EQ_WEAPON] = -1;
+ unwield_item();
canned_msg( MSG_EMPTY_HANDED );
}
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index a137943d04..87fdbb15dd 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -141,7 +141,7 @@ void weapon_switch( int targ )
// code is a mess... this whole function's purpose was to
// isolate this hack until there's a proper way to do things. -- bwr
if (you.equip[EQ_WEAPON] != -1)
- unwield_item(you.equip[EQ_WEAPON], false);
+ unwield_item(false);
you.equip[EQ_WEAPON] = targ;
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index fd96c674aa..de7f018b9d 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -358,8 +358,13 @@ bool potion_effect( potion_type pot_eff, int pow )
return (effect);
} // end potion_effect()
-void unwield_item(char unw, bool showMsgs)
+void unwield_item(bool showMsgs)
{
+ const int unw = you.equip[EQ_WEAPON];
+ if ( unw == -1 )
+ return;
+
+ you.equip[EQ_WEAPON] = -1;
you.special_wield = SPWLD_NONE;
you.wield_change = true;
@@ -392,7 +397,8 @@ void unwield_item(char unw, bool showMsgs)
case SPWPN_STAFF_OF_WUCAD_MU:
you.inv[unw].plus = 0;
you.inv[unw].plus2 = 0;
- miscast_effect( SPTYP_DIVINATION, 9, 90, 100, "the Staff of Wucad Mu" );
+ miscast_effect( SPTYP_DIVINATION, 9, 90, 100,
+ "the Staff of Wucad Mu" );
break;
default:
break;
@@ -401,14 +407,14 @@ void unwield_item(char unw, bool showMsgs)
return;
}
- int brand = get_weapon_brand( you.inv[unw] );
+ const int brand = get_weapon_brand( you.inv[unw] );
if (is_random_artefact( you.inv[unw] ))
unuse_randart(unw);
if (brand != SPWPN_NORMAL)
{
- std::string msg = you.inv[unw].name(DESC_CAP_YOUR);
+ const std::string msg = you.inv[unw].name(DESC_CAP_YOUR);
switch (brand)
{
@@ -459,7 +465,8 @@ void unwield_item(char unw, bool showMsgs)
// if it's to be allowed as a player spell. -- bwr
// int effect = 9 - random2avg( you.skills[SK_TRANSLOCATIONS] * 2, 2 );
- miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100, "a distortion effect" );
+ miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100,
+ "a distortion effect" );
break;
// when more are added here, *must* duplicate unwielding
@@ -470,24 +477,14 @@ void unwield_item(char unw, bool showMsgs)
{
you.duration[DUR_WEAPON_BRAND] = 0;
set_item_ego_type( you.inv[unw], OBJ_WEAPONS, SPWPN_NORMAL );
- // we're letting this through
+ // we're letting this through even if hiding messages
mpr("Your branding evaporates.");
}
} // end if
}
if (player_equip( EQ_STAFF, STAFF_POWER ))
- {
- // XXX: Ugly hack so that this currently works (don't want to
- // mess with the fact that currently this function doesn't
- // actually unwield the item, but we need it out of the player's
- // hand for this to work. -- bwr
- int tmp = you.equip[ EQ_WEAPON ];
-
- you.equip[ EQ_WEAPON ] = -1;
calc_mp();
- you.equip[ EQ_WEAPON ] = tmp;
- }
return;
} // end unwield_item()
diff --git a/crawl-ref/source/it_use2.h b/crawl-ref/source/it_use2.h
index 06e2a20942..b5e49770b1 100644
--- a/crawl-ref/source/it_use2.h
+++ b/crawl-ref/source/it_use2.h
@@ -39,6 +39,6 @@ void unwear_armour(char unw);
/* ***********************************************************************
* called from: decks - it_use3 - item_use - items - spells3 - transfor
* *********************************************************************** */
-void unwield_item(char unw, bool showMsgs = true);
+void unwield_item(bool showMsgs = true);
#endif
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index aad322f3c9..b2506eb227 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -230,11 +230,10 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages)
{
if (you.equip[EQ_WEAPON] != -1)
{
- unwield_item(you.equip[EQ_WEAPON], show_weff_messages);
- you.turn_is_over = true;
-
- you.equip[EQ_WEAPON] = -1;
+ unwield_item(show_weff_messages);
canned_msg( MSG_EMPTY_HANDED );
+
+ you.turn_is_over = true;
you.time_taken *= 3;
you.time_taken /= 10;
}
@@ -257,7 +256,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages)
// Go ahead and wield the weapon.
if (you.equip[EQ_WEAPON] != -1)
- unwield_item(you.equip[EQ_WEAPON], show_weff_messages);
+ unwield_item(show_weff_messages);
you.equip[EQ_WEAPON] = item_slot;
@@ -1554,8 +1553,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// like temporary branding. -- bwr
if (throw_2 == you.equip[EQ_WEAPON] && you.inv[throw_2].quantity == 1)
{
- unwield_item( throw_2 );
- you.equip[EQ_WEAPON] = -1;
+ unwield_item();
canned_msg( MSG_EMPTY_HANDED );
}
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index d8f7aa3030..73d44a9c81 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -689,8 +689,8 @@ static const char* deck_rarity_name(deck_rarity_type rarity)
{
switch (rarity)
{
- case DECK_RARITY_COMMON: return "common";
- case DECK_RARITY_RARE: return "rare";
+ case DECK_RARITY_COMMON: return "plain";
+ case DECK_RARITY_RARE: return "ornate";
case DECK_RARITY_LEGENDARY: return "legendary";
}
return "buggy rarity";
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 1b01db585d..c855954829 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -2192,6 +2192,11 @@ int item_mass( const item_def &item )
break;
case OBJ_MISCELLANY:
+ if ( is_deck(item) )
+ {
+ unit_mass = 50;
+ break;
+ }
switch (item.sub_type)
{
case MISC_BOTTLED_EFREET:
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index a4146a1475..ae6b7a94ea 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -242,12 +242,12 @@ bool dec_inv_item_quantity( int obj, int amount )
{
if (you.equip[i] == obj)
{
- you.equip[i] = -1;
if (i == EQ_WEAPON)
{
- unwield_item( obj );
+ unwield_item();
canned_msg( MSG_EMPTY_HANDED );
}
+ you.equip[i] = -1;
}
}
@@ -1670,8 +1670,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
// like temporary brands. -- bwr
if (item_dropped == you.equip[EQ_WEAPON])
{
- unwield_item(item_dropped);
- you.equip[EQ_WEAPON] = -1;
+ unwield_item();
canned_msg( MSG_EMPTY_HANDED );
}
@@ -2532,13 +2531,10 @@ void handle_time( long time_delta )
if (you.inv[i].base_type == OBJ_FOOD)
{
if (you.equip[EQ_WEAPON] == i)
- {
- unwield_item(you.equip[EQ_WEAPON]);
- you.equip[EQ_WEAPON] = -1;
- you.wield_change = true;
- }
+ unwield_item();
- mpr( "Your equipment suddenly weighs less.", MSGCH_ROTTEN_MEAT );
+ mpr("Your equipment suddenly weighs less.", MSGCH_ROTTEN_MEAT);
+ // FIXME should replace with a destroy_item call
you.inv[i].quantity = 0;
burden_change();
continue;
@@ -2550,11 +2546,9 @@ void handle_time( long time_delta )
if (!mons_skeleton( you.inv[i].plus ))
{
if (you.equip[EQ_WEAPON] == i)
- {
- unwield_item(you.equip[EQ_WEAPON]);
- you.equip[EQ_WEAPON] = -1;
- }
+ unwield_item();
+ // FIXME should replace with a destroy_item call
you.inv[i].quantity = 0;
burden_change();
continue;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 22426c71a8..a960a4b778 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -350,7 +350,7 @@ void inc_penance(int god, int val)
// orcish bonuses don't apply under penance
if (god == GOD_BEOGH)
- you.redraw_armour_class = 1;
+ you.redraw_armour_class = true;
}
if (you.penance[god] + val > 200)
@@ -2769,6 +2769,9 @@ static bool god_likes_item(god_type god, const item_def& item)
{
case GOD_KIKUBAAQUDGHA: case GOD_TROG:
return item.base_type == OBJ_CORPSES;
+
+ case GOD_NEMELEX_XOBEH:
+ return !is_deck(item);
default:
return true;
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 694d429888..6275da2ff0 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -463,7 +463,7 @@ void dancing_weapon(int pow, bool force_hostile)
}
// We are successful:
- unwield_item( wpn ); // remove wield effects
+ unwield_item(); // unwield the weapon (including removing wield effects)
// copy item (done here after any wield effects are removed)
mitm[i] = you.inv[wpn];
@@ -478,7 +478,6 @@ void dancing_weapon(int pow, bool force_hostile)
mprf("%s dances into the air!", you.inv[wpn].name(DESC_CAP_YOUR).c_str());
you.inv[ wpn ].quantity = 0;
- you.equip[EQ_WEAPON] = -1;
menv[summs].inv[MSLOT_WEAPON] = i;
menv[summs].colour = mitm[i].colour;
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index a3716de77a..0266b66d15 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -48,9 +48,8 @@ bool remove_equipment(std::set<equipment_type> removed)
if ( removed.find(EQ_WEAPON) != removed.end() &&
you.equip[EQ_WEAPON] != -1)
{
- unwield_item(you.equip[EQ_WEAPON]);
- you.equip[EQ_WEAPON] = -1;
- mpr("You are empty-handed.");
+ unwield_item();
+ canned_msg(MSG_EMPTY_HANDED);
you.wield_change = true;
}