#include "travel.h"
#include "xom.h"
+static const string TRAP_PROJECTILE_KEY = "trap_projectile";
+
bool trap_def::active() const
{
return type != TRAP_UNASSIGNED;
_mark_net_trapping(you.pos());
}
}
-
- trap_destroyed = true;
}
}
break;
void free_stationary_net(int item_index)
{
item_def &item = env.item[item_index];
- if (item.is_type(OBJ_MISSILES, MI_THROWING_NET))
- {
- const coord_def pos = item.pos;
- // Probabilistically mulch net based on damage done, otherwise
- // reset damage counter (ie: item.net_durability).
- if (x_chance_in_y(-item.net_durability, 9))
- destroy_item(item_index);
- else
- {
- item.net_durability = 0;
- item.net_placed = false;
- }
+ if (!item.is_type(OBJ_MISSILES, MI_THROWING_NET))
+ return;
- // Make sure we don't leave a bad trapping net in the stash
- // FIXME: may leak info if a monster escapes an out-of-sight net.
- StashTrack.update_stash(pos);
- StashTrack.unmark_trapping_nets(pos);
+ const coord_def pos = item.pos;
+ // Probabilistically mulch net based on damage done, otherwise
+ // reset damage counter (ie: item.net_durability).
+ const bool mulch = item.props.exists(TRAP_PROJECTILE_KEY)
+ || x_chance_in_y(-item.net_durability, 9);
+ if (mulch)
+ destroy_item(item_index);
+ else
+ {
+ item.net_durability = 0;
+ item.net_placed = false;
}
+
+ // Make sure we don't leave a bad trapping net in the stash
+ // FIXME: may leak info if a monster escapes an out-of-sight net.
+ StashTrack.update_stash(pos);
+ StashTrack.unmark_trapping_nets(pos);
}
void clear_trapping_net()
else
set_item_ego_type(item, base, SPWPN_NORMAL);
+ // Make nets from net traps always mulch.
+ item.props[TRAP_PROJECTILE_KEY] = true;
+
item_colour(item);
return item;
}