made Xom also be amused at runes being destroyed. Related changes:
Keep track of which items have ever been held by the player with ISFLAG_BEEN_IN_INV.
item_was_destroyed() is called when an item is destroyed (as in dropped in lava, not destroy_item() being called), and item_was_lost() is called if the item was lost (i.e., being left behind in the Abyss).
Keeps track of the number of runes that the character has collected, and how many have been left in the Halls of Zot.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2300 c06c8d41-db1a-0410-9941-cceddc491573
EFWEYIB2R3DPD3JWIPU6LS6SFLPMYN7J7X4GBZR7DJWKHJ3UELSAC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC
SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC
PRQVFUGUGPKI2Q74ODEI3CYUJQB63CKC6ONQTE3BTOHKXG4JCNLQC
4O3VTUJT5T7NBNF3Q45XO2WHS6TCJXVLH6CKX4K36WUBDRT5F6KAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RBC6SN3MFBHGSIHAMKBUD7S7ULXOW7AX3WLAB2DPFMHAADOEIL2QC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
4UXFU3FZOCBSLDQ4S7MJKAE2H7VUHCNRDQMIY6NJ3PHYXWNGISDQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
BDFIS53HAIHOCXQ5BE7WCO2MEOFCUQPFY4JGUWVLWY6JO3IFMEKQC
I2B33Z7NZGC33AMDSSK446AZZYWKPHWLAGULVHKKZU4MVB4BNJOAC
34RCM6RXIWHZMYXNGFQKLKQIAJ6QISIQ3D5HMK4HZNLVX66BSUBAC
GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC
VVEULZ7FMS53F6WZUJLNJ23URJMCCWHBUEDVGKI6R72JO2DLL5HQC
7KWDC7XFNMBLSUO2HISIROBINZBX5T67LJEEXTAORXW2YZ7VWFGAC
void xom_check_lost_item(item_def& item)
static void xom_check_less_runes(int runes_gones)
{
if (player_in_branch(BRANCH_HALL_OF_ZOT) ||
!(branches[BRANCH_HALL_OF_ZOT].branch_flags & BFLAG_HAS_ORB))
{
return;
}
int runes_avail = you.attribute[ATTR_UNIQUE_RUNES]
+ you.attribute[ATTR_DEMONIC_RUNES]
+ you.attribute[ATTR_ABYSSAL_RUNES]
- you.attribute[ATTR_RUNES_IN_ZOT];
int was_avail = runes_avail + runes_gones;
// No longer enough available runes to get into Zot
if (was_avail >= NUMBER_OF_RUNES_NEEDED &&
runes_avail < NUMBER_OF_RUNES_NEEDED)
{
xom_is_stimulated(128, "Xom snickers.", true);
}
}
void xom_check_lost_item(const item_def& item)
// Player voluntarily entered Pan or the Abyss looking
// for runes, yet never found it.
if (item.plus == RUNE_ABYSSAL)
// Player voluntarily entered Pan or the Abyss looking for
// runes, yet never found it.
if (item.plus == RUNE_ABYSSAL &&
you.attribute[ATTR_ABYSSAL_RUNES] == 0)
}
}
void xom_check_destroyed_item(const item_def& item, int cause)
{
int amusement = 0;
if (item.base_type == OBJ_ORBS)
{
xom_is_stimulated(255, "Xom laughs nastily.", true);
return;
}
else if (is_fixed_artefact(item))
xom_is_stimulated(128, "Xom snickers.", true);
else if (is_rune(item))
{
xom_check_less_runes(item.quantity);
if (is_unique_rune(item) || item.plus == RUNE_ABYSSAL)
amusement = 255;
else
amusement = 64 * item.quantity;
if (mons_weight(corpse_class) == 0
|| grid_destroys_items(grd[monster->x][monster->y])
|| coinflip())
{
if (mons_weight(corpse_class) == 0 || coinflip())
int hps_gained = 0;
int max_eat = roll_dice( 1, 10 );
int eaten = 0;
bool eaten_net = false;
int midx = monster_index(monster);
int hps_gained = 0;
int max_eat = roll_dice( 1, 10 );
int eaten = 0;
bool eaten_net = false;
xom_is_stimulated(255, "Xom snickers loudly.", true);
int runes_avail = you.attribute[ATTR_UNIQUE_RUNES]
+ you.attribute[ATTR_DEMONIC_RUNES]
+ you.attribute[ATTR_ABYSSAL_RUNES]
- you.attribute[ATTR_RUNES_IN_ZOT];
if (runes_avail < NUMBER_OF_RUNES_NEEDED)
xom_is_stimulated(255, "Xom snickers loudly.", true);
void destroy_item_stack( int x, int y )
static void handle_gone_item(const item_def &item)
{
if (item.base_type == OBJ_ORBS)
{
set_unique_item_status(OBJ_ORBS, item.sub_type,
UNIQ_LOST_IN_ABYSS);
}
else if (is_fixed_artefact(item))
{
set_unique_item_status(OBJ_WEAPONS, item.special,
UNIQ_LOST_IN_ABYSS);
}
if (is_rune(item))
{
if ((item.flags & ISFLAG_BEEN_IN_INV))
{
if (is_unique_rune(item))
you.attribute[ATTR_UNIQUE_RUNES] -= item.quantity;
else if (item.plus == RUNE_ABYSSAL)
you.attribute[ATTR_ABYSSAL_RUNES] -= item.quantity;
else
you.attribute[ATTR_DEMONIC_RUNES] -= item.quantity;
}
if (player_in_branch(BRANCH_HALL_OF_ZOT)
&& item.x != -1 && item.y != -1)
{
you.attribute[ATTR_RUNES_IN_ZOT] -= item.quantity;
}
}
}
void item_was_lost(const item_def &item)
if (mitm[o].base_type == OBJ_ORBS)
{
set_unique_item_status( OBJ_ORBS, mitm[o].sub_type,
UNIQ_LOST_IN_ABYSS );
}
else if (is_fixed_artefact( mitm[o] ))
{
set_unique_item_status( OBJ_WEAPONS, mitm[o].special,
UNIQ_LOST_IN_ABYSS );
}
item_was_lost(mitm[o]);
mitm[o].base_type = OBJ_UNASSIGNED;
mitm[o].quantity = 0;
}
o = next;
}
}
void destroy_item_stack( int x, int y, int cause )
{
int o = igrd[x][y];
igrd[x][y] = NON_ITEM;
while (o != NON_ITEM)
{
int next = mitm[o].link;
}
static void got_item(item_def& item, int quant)
{
if (!is_rune(item))
return;
// Picking up the rune for the first time.
if (!(item.flags & ISFLAG_BEEN_IN_INV))
{
if (is_unique_rune(item))
you.attribute[ATTR_UNIQUE_RUNES] += quant;
else if (item.plus == RUNE_ABYSSAL)
you.attribute[ATTR_ABYSSAL_RUNES] += quant;
else
you.attribute[ATTR_DEMONIC_RUNES] += quant;
}
item.flags |= ISFLAG_BEEN_IN_INV;
if (mitm[*obj].base_type == OBJ_ORBS && you.level_type == LEVEL_DUNGEON)
if (is_rune(mitm[*obj]))
{
if (player_in_branch(BRANCH_HALL_OF_ZOT))
you.attribute[ATTR_RUNES_IN_ZOT] += mitm[*obj].quantity;
}
else if (mitm[*obj].base_type == OBJ_ORBS
&& you.level_type == LEVEL_DUNGEON)
{
if ((exit_was_near < INFINITE_DISTANCE &&
exit_is_near == INFINITE_DISTANCE)
|| (exit_was_near == INFINITE_DISTANCE &&
exit_is_near < INFINITE_DISTANCE))
int rune_is_near = abyss_rune_nearness();
if ((exit_was_near < INFINITE_DISTANCE
&& exit_is_near == INFINITE_DISTANCE)
|| (rune_was_near < INFINITE_DISTANCE
&& rune_is_near == INFINITE_DISTANCE
&& you.attribute[ATTR_ABYSSAL_RUNES] == 0))
int rune_is_near = abyss_rune_nearness();
if ((rune_was_near < INFINITE_DISTANCE &&
rune_is_near == INFINITE_DISTANCE)
|| (rune_was_near == INFINITE_DISTANCE &&
rune_is_near < INFINITE_DISTANCE))
if ((rune_was_near == INFINITE_DISTANCE
&& rune_is_near < INFINITE_DISTANCE
&& you.attribute[ATTR_ABYSSAL_RUNES] == 0)
|| (exit_was_near == INFINITE_DISTANCE &&
exit_is_near < INFINITE_DISTANCE))
if (mitm[k].base_type == OBJ_ORBS)
{
set_unique_item_status( OBJ_ORBS, mitm[k].sub_type,
UNIQ_LOST_IN_ABYSS );
}
else if (is_fixed_artefact( mitm[k] ))
{
set_unique_item_status( OBJ_WEAPONS, mitm[k].special,
UNIQ_LOST_IN_ABYSS );
}
xom_check_lost_item( mitm[k] );
item_was_lost( mitm[k] );