src/project-player.c
bool project_p(int who, int r, int y, int x, int dam, int typ)
{
	bool blind, seen;
	bool obvious = TRUE;

	/* Source monster */
	struct monster *mon;

	/* Monster name (for damage) */
	char killer[80];

	project_player_handler_f player_handler = player_handlers[typ];
	project_player_handler_context_t context = {
		who,
		r,
		y,
		x,
		dam,
		typ,
		obvious,
	};

	/* No player here */
	if (!(cave->squares[y][x].mon < 0)) return (FALSE);

	/* Never affect projector */
	if (cave->squares[y][x].mon == who) return (FALSE);

	/* Source monster */
	mon = cave_monster(cave, who);

	/* Player blind-ness */
	blind = (player->timed[TMD_BLIND] ? TRUE : FALSE);

	/* Extract the "see-able-ness" */
	seen = (!blind && mflag_has(mon->mflag, MFLAG_VISIBLE));

	/* Get the monster's real name */
	monster_desc(killer, sizeof(killer), mon, MDESC_DIED_FROM);

	/* Let player know what is going on */
	if (!seen)
		msg("You are hit by %s!", gf_blind_desc(typ));

	/* Adjust damage for resistance, immunity or vulnerability, and apply it */
	dam = adjust_dam(player, typ, dam, RANDOMISE,
					 player->state.el_info[typ].res_level);
	if (dam)
		take_hit(player, dam, killer);

	/* Handle side effects */
	if ((player_handler != NULL) && !player->is_dead)
		player_handler(&context);

	obvious = context.obvious;

	/* Disturb */
	disturb(player, 1);

	/* Return "Anything seen?" */
	return (obvious);
}
/**
 * Called from project() to affect the player
 *
 * Called for projections with the PROJECT_PLAY flag set, which includes
 * bolt, 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
 * \return whether the effects were obvious
 *
 * If "r" is non-zero, then the blast was centered elsewhere; the damage
 * is reduced in project() before being passed in here.  This can happen if a
 * monster breathes at the player and hits a wall instead.
 *
 * We assume the player is aware of some effect, and always return "TRUE".
 */
Called from project() to affect the player
Called for projections with the PROJECT_PLAY flag set, which includes
bolt, beam, ball and breath effects.



If "r" is non-zero, then the blast was centered elsewhere; the damage
is reduced in project() before being passed in here.  This can happen if a
monster breathes at the player and hits a wall instead.

We assume the player is aware of some effect, and always return "TRUE".
Called from project () to affect the player Called for projections with the PROJECT_PLAY flag set which includes bolt beam ball and breath effects . If " r " is non - zero then the blast was centered elsewhere ; the damage is reduced in project () before being passed in here . This can happen if a monster breathes at the player and hits a wall instead . We assume the player is aware of some effect and always return " TRUE " .
bool project_p(int who, int r, int y, int x, int dam, int typ)
{
	bool blind, seen;
	bool obvious = TRUE;
	struct monster *mon;
	char killer[80];
	project_player_handler_f player_handler = player_handlers[typ];
	project_player_handler_context_t context = {
		who,
		r,
		y,
		x,
		dam,
		typ,
		obvious,
	};
	if (!(cave->squares[y][x].mon < 0)) return (FALSE);
	if (cave->squares[y][x].mon == who) return (FALSE);
	mon = cave_monster(cave, who);
	blind = (player->timed[TMD_BLIND] ? TRUE : FALSE);
	seen = (!blind && mflag_has(mon->mflag, MFLAG_VISIBLE));
	monster_desc(killer, sizeof(killer), mon, MDESC_DIED_FROM);
	if (!seen)
		msg("You are hit by %s!", gf_blind_desc(typ));
	dam = adjust_dam(player, typ, dam, RANDOMISE,
					 player->state.el_info[typ].res_level);
	if (dam)
		take_hit(player, dam, killer);
	if ((player_handler != NULL) && !player->is_dead)
		player_handler(&context);
	obvious = context.obvious;
	disturb(player, 1);
	return (obvious);
}
bool project_p ( int who , int r , int y , int x , int dam , int typ ) { bool blind , seen ; bool obvious = TRUE ; struct monster * mon ; char killer [ 80 ] ; project_player_handler_f player_handler = player_handlers [ typ ] ; project_player_handler_context_t context = { who , r , y , x , dam , typ , obvious , } ; if ( ! ( cave -> squares [ y ] [ x ] . mon < 0 ) ) return ( FALSE ) ; if ( cave -> squares [ y ] [ x ] . mon == who ) return ( FALSE ) ; mon = cave_monster ( cave , who ) ; blind = ( player -> timed [ TMD_BLIND ] ? TRUE : FALSE ) ; seen = ( ! blind && mflag_has ( mon -> mflag , MFLAG_VISIBLE ) ) ; monster_desc ( killer , sizeof ( killer ) , mon , MDESC_DIED_FROM ) ; if ( ! seen ) msg ( " " , gf_blind_desc ( typ ) ) ; dam = adjust_dam ( player , typ , dam , RANDOMISE , player -> state . el_info [ typ ] . res_level ) ; if ( dam ) take_hit ( player , dam , killer ) ; if ( ( player_handler != NULL ) && ! player -> is_dead ) player_handler ( & context ) ; obvious = context . obvious ; disturb ( player , 1 ) ; return ( obvious ) ; }
Called from project() to affect the player
 Called for projections with the PROJECT_PLAY flag set, which includes
 bolt, beam, ball and breath effects.
Called from project () to affect the player Called for projections with the PROJECT_PLAY flag set which includes bolt beam ball and breath effects .
/* Source monster */ /* Monster name (for damage) */ /* No player here */ /* Never affect projector */ /* Source monster */ /* Player blind-ness */ /* Extract the "see-able-ness" */ /* Get the monster's real name */ /* Let player know what is going on */ /* Adjust damage for resistance, immunity or vulnerability, and apply it */ /* Handle side effects */ /* Disturb */ /* Return "Anything seen?" */