src/project-obj.c
bool project_o(int who, int r, int y, int x, int dam, int typ,
			   const struct object *protected_obj)
{
	struct object *obj = square_object(cave, y, x);
	bool obvious = FALSE;

	/* Scan all objects in the grid */
	while (obj) {
		bool ignore = FALSE;
		bool do_kill = FALSE;
		const char *note_kill = NULL;
		struct object *next = obj->next;
		project_object_handler_context_t context = {
			who,
			r,
			y,
			x,
			dam,
			typ,
			obj,
			obvious,
			do_kill,
			ignore,
			note_kill,
		};
		project_object_handler_f object_handler = object_handlers[typ];

		if (object_handler != NULL)
			object_handler(&context);

		obvious = context.obvious;
		do_kill = context.do_kill && (obj != protected_obj);
		ignore = context.ignore;
		note_kill = context.note_kill;

		/* Attempt to destroy the object */
		if (do_kill) {
			char o_name[80];

			/* Effect "observed" */
			if (obj->marked && !ignore_item_ok(obj)) {
				obvious = TRUE;
				object_desc(o_name, sizeof(o_name), obj, ODESC_BASE);
			}

			/* Artifacts, and other objects, get to resist */
			if (obj->artifact || ignore) {
				/* Observe the resist */
				if (obj->marked && !ignore_item_ok(obj))
					msg("The %s %s unaffected!", o_name,
						VERB_AGREEMENT(obj->number, "is", "are"));
			} else if (obj->mimicking_m_idx) {
				/* Reveal mimics */
				become_aware(cave_monster(cave, obj->mimicking_m_idx));
			} else {
				/* Describe if needed */
				if (obj->marked && note_kill && !ignore_item_ok(obj))
					msgt(MSG_DESTROY, "The %s %s!", o_name, note_kill);

				/* Delete the object */
				square_excise_object(cave, y, x, obj);
				object_delete(&obj);

				/* Redraw */
				square_light_spot(cave, y, x);
			}
		}

		/* Next object */
		obj = next;
	}

	/* Return "Anything seen?" */
	return (obvious);
}
/**
 * Called from project() to affect objects
 *
 * Called for projections with the PROJECT_ITEM flag set, which includes
 * beam, ball and breath effects.
 *
 * \param who is the monster list index of the caster
 * \param r is the distance from the centre of the effect
 * \param y
 * \param x the coordinates of the grid being handled
 * \param dam is the "damage" from the effect at distance r from the centre
 * \param typ is the projection (GF_) type
 * \param protected_obj is an object that should not be affected by the 
 *        projection, typically the object that created it
 * \return whether the effects were obvious
 *
 * Note that this function determines if the player can see anything that
 * happens by taking into account: blindness, line-of-sight, and illumination.
 *
 * Hack -- effects on objects which are memorized but not in view are also seen.
 */
Called from project() to affect objects
Called for projections with the PROJECT_ITEM flag set, which includes
beam, ball and breath effects.



Note that this function determines if the player can see anything that
happens by taking into account: blindness, line-of-sight, and illumination.

- effects on objects which are memorized but not in view are also seen.
Called from project () to affect objects Called for projections with the PROJECT_ITEM flag set which includes beam ball and breath effects . Note that this function determines if the player can see anything that happens by taking into account : blindness line - of - sight and illumination . - effects on objects which are memorized but not in view are also seen .
bool project_o(int who, int r, int y, int x, int dam, int typ,
			   const struct object *protected_obj)
{
	struct object *obj = square_object(cave, y, x);
	bool obvious = FALSE;
	while (obj) {
		bool ignore = FALSE;
		bool do_kill = FALSE;
		const char *note_kill = NULL;
		struct object *next = obj->next;
		project_object_handler_context_t context = {
			who,
			r,
			y,
			x,
			dam,
			typ,
			obj,
			obvious,
			do_kill,
			ignore,
			note_kill,
		};
		project_object_handler_f object_handler = object_handlers[typ];
		if (object_handler != NULL)
			object_handler(&context);
		obvious = context.obvious;
		do_kill = context.do_kill && (obj != protected_obj);
		ignore = context.ignore;
		note_kill = context.note_kill;
		if (do_kill) {
			char o_name[80];
			if (obj->marked && !ignore_item_ok(obj)) {
				obvious = TRUE;
				object_desc(o_name, sizeof(o_name), obj, ODESC_BASE);
			}
			if (obj->artifact || ignore) {
				if (obj->marked && !ignore_item_ok(obj))
					msg("The %s %s unaffected!", o_name,
						VERB_AGREEMENT(obj->number, "is", "are"));
			} else if (obj->mimicking_m_idx) {
				become_aware(cave_monster(cave, obj->mimicking_m_idx));
			} else {
				if (obj->marked && note_kill && !ignore_item_ok(obj))
					msgt(MSG_DESTROY, "The %s %s!", o_name, note_kill);
				square_excise_object(cave, y, x, obj);
				object_delete(&obj);
				square_light_spot(cave, y, x);
			}
		}
		obj = next;
	}
	return (obvious);
}
bool project_o ( int who , int r , int y , int x , int dam , int typ , const struct object * protected_obj ) { struct object * obj = square_object ( cave , y , x ) ; bool obvious = FALSE ; while ( obj ) { bool ignore = FALSE ; bool do_kill = FALSE ; const char * note_kill = NULL ; struct object * next = obj -> next ; project_object_handler_context_t context = { who , r , y , x , dam , typ , obj , obvious , do_kill , ignore , note_kill , } ; project_object_handler_f object_handler = object_handlers [ typ ] ; if ( object_handler != NULL ) object_handler ( & context ) ; obvious = context . obvious ; do_kill = context . do_kill && ( obj != protected_obj ) ; ignore = context . ignore ; note_kill = context . note_kill ; if ( do_kill ) { char o_name [ 80 ] ; if ( obj -> marked && ! ignore_item_ok ( obj ) ) { obvious = TRUE ; object_desc ( o_name , sizeof ( o_name ) , obj , ODESC_BASE ) ; } if ( obj -> artifact || ignore ) { if ( obj -> marked && ! ignore_item_ok ( obj ) ) msg ( " " , o_name , VERB_AGREEMENT ( obj -> number , " " , " " ) ) ; } else if ( obj -> mimicking_m_idx ) { become_aware ( cave_monster ( cave , obj -> mimicking_m_idx ) ) ; } else { if ( obj -> marked && note_kill && ! ignore_item_ok ( obj ) ) msgt ( MSG_DESTROY , " " , o_name , note_kill ) ; square_excise_object ( cave , y , x , obj ) ; object_delete ( & obj ) ; square_light_spot ( cave , y , x ) ; } } obj = next ; } return ( obvious ) ; }
Called from project() to affect objects
 Called for projections with the PROJECT_ITEM flag set, which includes
 beam, ball and breath effects.
Called from project () to affect objects Called for projections with the PROJECT_ITEM flag set which includes beam ball and breath effects .
/* Scan all objects in the grid */ /* Attempt to destroy the object */ /* Effect "observed" */ /* Artifacts, and other objects, get to resist */ /* Observe the resist */ /* Reveal mimics */ /* Describe if needed */ /* Delete the object */ /* Redraw */ /* Next object */ /* Return "Anything seen?" */