示例#1
0
/*
 * Set a shimmering cloud effect.  Return false if it could not be set.
 */
bool set_effect_shimmering_cloud(int f_idx, byte y, byte x, byte repeats, u16b power, s16b source, u16b flag)
{
	feature_type *f_ptr = &f_info[f_idx];
	int x_idx = x_pop();
	int countdown;
	int effect_power;

	/*All full*/
	if (!x_idx) return (FALSE);

	/* Determine how powerful this should be. */
	effect_power = (f_ptr->x_damage * power) / 100;

	/* These are hidden, and displayed as bursts. */
	flag |= (EF1_HIDDEN);

	/* Get the countdown */
	countdown = f_ptr->x_timeout_set + randint(f_ptr->x_timeout_rand);

	/* Keep it in bounds */
	if (countdown >= MAX_UCHAR) countdown = MAX_UCHAR - 1;

	/* Create the effect */
	effect_prep(x_idx, EFFECT_SHIMMERING_CLOUD, f_idx, y, x, (byte)countdown, repeats, effect_power, source, flag);

	return (TRUE);
}
示例#2
0
/*
 * Set a smart trap effect.  Return false if it could not be set.
 */
bool set_effect_trap_smart(int f_idx, byte y, byte x, u16b flags)
{
	int x_idx = x_pop();
	int countdown;
	int trap_power;

	feature_type *f_ptr = &f_info[f_idx];

	/*All full*/
	if (!x_idx) return (FALSE);

	trap_power = (f_ptr->x_damage * (MAX(1, effective_depth(p_ptr->depth))) / 100);

	/*
	 * Avoid unfair instadeaths for the player by creating the trap only partially charged.
	 */
	countdown = (f_ptr->x_timeout_set + rand_int(f_ptr->x_timeout_rand)) /2;
	if (countdown <=3) countdown = 4;

	/*Keep it in bounds*/
	if (countdown >= MAX_UCHAR) countdown = MAX_UCHAR - 1;

	flags |= (EF1_TRAP_SMART | EF1_PERMANENT | EF1_HIDDEN | EF1_HURT_PLAY);

	effect_prep(x_idx, EFFECT_TRAP_SMART, f_idx, y, x, (byte)countdown, 1, trap_power, SOURCE_TRAP, flags);

	return (TRUE);
}
示例#3
0
/*
 * Set an inscription effect. Return TRUE on success
 */
bool set_effect_inscription(int f_idx, byte y, byte x, s16b source, u16b flag)
{
	/* Get the first effect on that grid */
	int x_idx = cave_x_idx[y][x];

	/* Scan the effects */
	while (x_idx)
	{
		/* Get the effect */
		effect_type *x_ptr = &x_list[x_idx];

		/* Ignore locations already inscribed */
		if (x_ptr->x_type == EFFECT_INSCRIPTION) return (FALSE);

		/* Get the next effect */
		x_idx = x_ptr->next_x_idx;
	}

	/* Get an empty entry */
	x_idx = x_pop();

	/* All full */
	if (!x_idx) return (FALSE);

	/* Dumb effect */
	flag |= (EF1_SKIP);

	/* Create the effect */
	effect_prep(x_idx, EFFECT_INSCRIPTION, f_idx, y, x, 0, 0, 0, source, flag);

	return (TRUE);
}
示例#4
0
/*
 * Set a lingering cloud effect.  Return false if it could not be set.
 */
bool set_effect_lingering_cloud(int f_idx, byte y, byte x,	u16b power, s16b source, u16b flag)
{
	int x_idx = x_pop();
	int countdown;
	int effect_power;

	feature_type *f_ptr = &f_info[f_idx];

	/*All full*/
	if (!x_idx) return (FALSE);

	/* Determine how powerful this should be. */
	effect_power = (f_ptr->x_damage * power) / 100;

	/* Calculate countdown */
	countdown = (effect_power / 1000) + f_ptr->x_timeout_set + randint(f_ptr->x_timeout_rand);

	/* Keep it in bounds */
	if (countdown >= MAX_UCHAR) countdown = MAX_UCHAR - 1;

	/* Create the effect */
	effect_prep(x_idx, EFFECT_LINGERING_CLOUD, f_idx, y, x, (byte)countdown, 0, effect_power, source, flag);

	return (TRUE);
}
示例#5
0
/*
 * Read an object
 *
 * This function attempts to "repair" old savefiles, and to extract
 * the most up to date values for various object fields.
 */
static errr rd_effect(void)
{

	int x_idx;
	byte type;
	u16b f_idx;
	byte y;
	byte x;
	byte countdown;
	byte repeats;
	u16b power;
	s16b source;
	u16b flags;

	x_idx = x_pop();

	/*something is wrong*/
	if (!x_idx) return (-1);

	/*Read the effect*/
	rd_byte(&type);
	rd_u16b(&f_idx);


	rd_byte(&y);
	rd_byte(&x);

	rd_byte(&countdown);

	rd_byte(&repeats);

	rd_u16b(&power);

	rd_s16b(&source);

	rd_u16b(&flags);

	/*Write it, unless it is an empty effect*/
	if (type) effect_prep(x_idx, type, f_idx, y, x, countdown, repeats, power, source, flags);

	/* Read a new field, a monster race for inscriptions */
	if (!older_than(0,4,8))
	{
		s16b r_idx;

		rd_s16b(&r_idx);

		x_list[x_idx].x_r_idx = (type ? r_idx: 0);
	}

	/* Success */
	return (0);
}
示例#6
0
/*
 * Set a passive trap effect.  Return false if it could not be set.
 */
bool set_effect_trap_passive(int f_idx, byte y, byte x)
{
	int x_idx = x_pop();
	u16b flags = 0L;

	/*All full*/
	if (!x_idx) return (FALSE);

	flags |= (EF1_TRAP_DUMB | EF1_PERMANENT | EF1_SKIP | EF1_HIDDEN | EF1_HURT_PLAY);

	effect_prep(x_idx, EFFECT_TRAP_DUMB, f_idx, y, x, 1, 1, 0, SOURCE_TRAP, flags);

	return (TRUE);
}
示例#7
0
/*
 * Set a permanent cloud effect.  Return false if it could not be set.
 * Currently assumes neither players nor monsters can set permanent effects (use of SOURCE_EFFECT)
 */
bool set_effect_permanent_cloud(int f_idx, byte y, byte x,	u16b power, u16b flag)
{
	int x_idx = x_pop();

	/*All full*/
	if (!x_idx) return (FALSE);

	flag |= (EF1_PERMANENT  | EF1_HURT_PLAY);

	effect_prep(x_idx, EFFECT_PERMANENT_CLOUD, f_idx, y, x, 1, 1, power, SOURCE_EFFECT, flag);

	return (TRUE);

}
示例#8
0
/*
 * Set a glyph.  Return false if it could not be set.
 */
bool set_effect_glyph(byte y, byte x)
{
	int x_idx = x_pop();
	u16b flags = 0L;

	/*All full*/
	if (!x_idx) return (FALSE);

	flags |= (EF1_GLYPH | EF1_PERMANENT | EF1_SKIP);

	effect_prep(x_idx, EFFECT_GLYPH, FEAT_GLYPH, y, x, 1, 1, 0, SOURCE_TRAP, flags);

	/* RE-do the flow */
	p_ptr->update |= (PU_FLOW_DOORS | PU_FLOW_NO_DOORS);

	return (TRUE);
}
示例#9
0
/*
 * Set a monster trap effect.  Return false if it could not be set.
 */
bool set_effect_trap_player(int f_idx, byte y, byte x)
{
	int x_idx = x_pop();
	u16b flags = 0L;

	/*All full*/
	if (!x_idx) return (FALSE);

	flags |= (EF1_TRAP_PLAYER | EF1_PERMANENT | EF1_SKIP);

	effect_prep(x_idx, EFFECT_TRAP_PLAYER, f_idx, y, x, 1, 1, 0, SOURCE_TRAP, flags);

	/* RE-do the flow */
	p_ptr->update |= (PU_FLOW_DOORS | PU_FLOW_NO_DOORS);

	return (TRUE);
}
示例#10
0
/*
 * Set a glacier effect.  Return false if it could not be set.
 */
bool set_effect_glacier(int f_idx, byte y, byte x, s16b source, u16b flag)
{
	int x_idx = x_pop();
	int countdown;

	/* Get the feature */
	feature_type *f_ptr = &f_info[f_idx];

	/* All full */
	if (!x_idx) return (FALSE);

	/* Calculate countdown */
	countdown = f_ptr->x_timeout_set + randint(f_ptr->x_timeout_rand);

	/* Keep it in bounds */
	if (countdown >= MAX_UCHAR) countdown = MAX_UCHAR - 1;

	/* Create the effect */
	effect_prep(x_idx, EFFECT_GLACIER, f_idx, y, x, (byte)countdown, 0, 0, source, flag);

	return (TRUE);
}