• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ player_inc_timed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中player_inc_timed函数的典型用法代码示例。如果您正苦于以下问题:C++ player_inc_timed函数的具体用法?C++ player_inc_timed怎么用?C++ player_inc_timed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了player_inc_timed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: project_player_handler_WATER

static void project_player_handler_WATER(project_player_handler_context_t *context)
{
	/* Confusion */
	(void)player_inc_timed(player, TMD_CONFUSED, 5 + randint1(5), true, true);

	/* Stun */
	(void)player_inc_timed(player, TMD_STUN, randint1(40), true, true);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:8,代码来源:project-player.c


示例2: project_player_handler_ICE

static void project_player_handler_ICE(project_player_handler_context_t *context)
{
	if (!player_is_immune(player, ELEM_COLD))
		inven_damage(player, PROJ_COLD, MIN(context->dam * 5, 300));

	/* Cuts */
	if (!player_resists(player, ELEM_SHARD))
		(void)player_inc_timed(player, TMD_CUT, damroll(5, 8), true, false);
	else
		msg("You resist the effect!");

	/* Stun */
	(void)player_inc_timed(player, TMD_STUN, randint1(15), true, true);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:14,代码来源:project-player.c


示例3: project_player_handler_SHARD

static void project_player_handler_SHARD(project_player_handler_context_t *context)
{
    /* Cuts */
    if (!player_resists(player, ELEM_SHARD))
        (void)player_inc_timed(player, TMD_CUT, randint1(context->dam),
                               TRUE, FALSE);
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,代码来源:project-player.c


示例4: project_player_swap_stats

/**
 * Swap stats at random to temporarily scramble the player's stats.
 */
static void project_player_swap_stats(void)
{
	int max1, cur1, max2, cur2, i, j, swap;

	// Fisher-Yates shuffling algorithm.
	for (i = STAT_MAX - 1; i > 0; --i) {
		j = randint0(i);

		max1 = player->stat_max[i];
		cur1 = player->stat_cur[i];
		max2 = player->stat_max[j];
		cur2 = player->stat_cur[j];

		player->stat_max[i] = max2;
		player->stat_cur[i] = cur2;
		player->stat_max[j] = max1;
		player->stat_cur[j] = cur1;

		/* Record what we did */
		swap = player->stat_map[i];
		player->stat_map[i] = player->stat_map[j];
		player->stat_map[j] = swap;
	}

	player_inc_timed(player, TMD_SCRAMBLE, randint0(20) + 20, true, true);

	return;
}
开发者ID:datatypevoid,项目名称:angband,代码行数:31,代码来源:project-player.c


示例5: melee_effect_timed

/**
 * Do damage as the result of a melee attack that has a status effect.
 *
 * \param context is the information for the current attack.
 * \param type is the TMD_ constant for the effect.
 * \param amount is the amount that the timer should be increased by.
 * \param of_flag is the OF_ flag that is passed on to monster learning for
 * this effect.
 * \param attempt_save indicates if a saving throw should be attempted for
 * this effect.
 * \param save_msg is the message that is displayed if the saving throw is
 * successful.
 */
static void melee_effect_timed(melee_effect_handler_context_t *context,
							   int type, int amount, int of_flag,
							   bool attempt_save, const char *save_msg)
{
	/* Take damage */
	take_hit(context->p, context->damage, context->ddesc);

	/* Player is dead */
	if (context->p->is_dead)
		return;

	/* Perform a saving throw if desired. */
	if (attempt_save && randint0(100) < context->p->state.skills[SKILL_SAVE]) {
		if (save_msg != NULL)
			msg("%s", save_msg);

		context->obvious = TRUE;
	}
	else {
		/* Increase timer for type. */
		if (player_inc_timed(context->p, type, amount, TRUE, TRUE))
			context->obvious = TRUE;
	}

	/* Learn about the player */
	update_smart_learn(context->mon, context->p, of_flag, 0, -1);
}
开发者ID:Elfin-Jedi,项目名称:My-Angband-4.0.5,代码行数:40,代码来源:mon-blow-effects.c


示例6: project_player_handler_LIGHT

static void project_player_handler_LIGHT(project_player_handler_context_t *context)
{
    if (player_resists(player, ELEM_LIGHT)) {
        msg("You resist the effect!");
        return;
    }

    (void)player_inc_timed(player, TMD_BLIND, 2 + randint1(5), TRUE, TRUE);
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:9,代码来源:project-player.c


示例7: project_player_handler_DARK_WEAK

static void project_player_handler_DARK_WEAK(project_player_handler_context_t *context)
{
	if (player_resists(player, ELEM_DARK)) {
		msg("You resist the effect!");
		return;
	}

	(void)player_inc_timed(player, TMD_BLIND, 3 + randint1(5), true, true);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:9,代码来源:project-player.c


示例8: project_player_handler_PLASMA

static void project_player_handler_PLASMA(project_player_handler_context_t *context)
{
    /* Stun */
    if (!player_of_has(player, OF_PROT_STUN)) {
        int duration = 5 + randint1(context->dam * 3 / 4);
        if (duration > 35) duration = 35;
        (void)player_inc_timed(player, TMD_STUN, duration, TRUE, TRUE);
    }
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:9,代码来源:project-player.c


示例9: project_player_handler_CHAOS

static void project_player_handler_CHAOS(project_player_handler_context_t *context)
{
    if (player_resists(player, ELEM_CHAOS)) {
        msg("You resist the effect!");
        return;
    }

    /* Hallucination */
    (void)player_inc_timed(player, TMD_IMAGE, randint1(10), TRUE, FALSE);

    /* Confusion */
    (void)player_inc_timed(player, TMD_CONFUSED, 10 + randint0(20), TRUE, TRUE);

    /* Life draining */
    if (player_of_has(player, OF_HOLD_LIFE)) {
        msg("You feel your life force draining away!");
        player_exp_lose(player, 5000 + (player->exp / 100) * z_info->life_drain_percent, FALSE);
    }
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:19,代码来源:project-player.c


示例10: project_player_handler_GRAVITY

static void project_player_handler_GRAVITY(project_player_handler_context_t *context)
{
    msg("Gravity warps around you.");

    /* Blink */
    if (randint1(127) > player->lev) {
        const char *five = "5";
        effect_simple(EF_TELEPORT, five, 0, 1, 0, NULL);
    }

    /* Slow */
    (void)player_inc_timed(player, TMD_SLOW, 4 + randint0(4), TRUE, FALSE);

    /* Stun */
    if (!player_of_has(player, OF_PROT_STUN)) {
        int duration = 5 + randint1(context->dam / 3);
        if (duration > 35) duration = 35;
        (void)player_inc_timed(player, TMD_STUN, duration, TRUE, TRUE);
    }
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:20,代码来源:project-player.c


示例11: project_player_handler_SHARD

static void project_player_handler_SHARD(project_player_handler_context_t *context)
{
	if (player_resists(player, ELEM_SHARD)) {
		msg("You resist the effect!");
		return;
	}

	/* Cuts */
	(void)player_inc_timed(player, TMD_CUT, randint1(context->dam), true,
						   false);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:11,代码来源:project-player.c


示例12: project_player_handler_FORCE

static void project_player_handler_FORCE(project_player_handler_context_t *context)
{
	char grids_away[5];

	/* Stun */
	(void)player_inc_timed(player, TMD_STUN, randint1(20), true, true);

	/* Thrust player away. */
	strnfmt(grids_away, sizeof(grids_away), "%d", 3 + context->dam / 20);
	effect_simple(EF_THRUST_AWAY, context->origin, grids_away, context->y, context->x, 0, NULL);
}
开发者ID:datatypevoid,项目名称:angband,代码行数:11,代码来源:project-player.c


示例13: melee_effect_handler_POISON

/**
 * Melee effect handler: Poison the player.
 *
 * We can't use melee_effect_timed(), because this is both and elemental attack
 * and a status attack. Note the FALSE value for pure_element for
 * melee_effect_elemental().
 */
static void melee_effect_handler_POISON(melee_effect_handler_context_t *context)
{
	melee_effect_elemental(context, GF_POIS, FALSE);

	/* Take "poison" effect */
	if (player_inc_timed(context->p, TMD_POISONED, 5 + randint1(context->rlev),
						 TRUE, TRUE))
		context->obvious = TRUE;

	/* Learn about the player */
	update_smart_learn(context->m_ptr, context->p, 0, 0, ELEM_POIS);
}
开发者ID:Daedelus01,项目名称:angband,代码行数:19,代码来源:mon-blow-effects.c


示例14: melee_effect_handler_HALLU

/**
 * Melee effect handler: Make the player hallucinate.
 *
 * Note that we don't use melee_effect_timed(), due to the different monster
 * learning function.
 */
static void melee_effect_handler_HALLU(melee_effect_handler_context_t *context)
{
	/* Take damage */
	take_hit(context->p, context->damage, context->ddesc);

	/* Increase "image" */
	if (player_inc_timed(context->p, TMD_IMAGE, 3 + randint1(context->rlev / 2),
						 TRUE, TRUE))
		context->obvious = TRUE;

	/* Learn about the player */
	update_smart_learn(context->m_ptr, context->p, 0, 0, ELEM_CHAOS);
}
开发者ID:Daedelus01,项目名称:angband,代码行数:19,代码来源:mon-blow-effects.c


示例15: project_player_handler_SOUND

static void project_player_handler_SOUND(project_player_handler_context_t *context)
{
	if (player_resists(player, ELEM_SOUND)) {
		msg("You resist the effect!");
		return;
	}

	/* Stun */
	if (!player_of_has(player, OF_PROT_STUN)) {
		int duration = 5 + randint1(context->dam / 3);
		if (duration > 35) duration = 35;
		(void)player_inc_timed(player, TMD_STUN, duration, TRUE, TRUE);
	}
}
开发者ID:TricksterWolf,项目名称:ponyband,代码行数:14,代码来源:project-player.c


示例16: melee_effect_handler_POISON

/**
 * Melee effect handler: Poison the player.
 *
 * We can't use melee_effect_timed(), because this is both and elemental attack
 * and a status attack. Note the false value for pure_element for
 * melee_effect_elemental().
 */
static void melee_effect_handler_POISON(melee_effect_handler_context_t *context)
{
	melee_effect_elemental(context, GF_POIS, false);

	/* Player is dead */
	if (context->p->is_dead)
		return;

	/* Take "poison" effect */
	if (player_inc_timed(context->p, TMD_POISONED, 5 + randint1(context->rlev),
						 true, true))
		context->obvious = true;

	/* Learn about the player */
	update_smart_learn(context->mon, context->p, 0, 0, ELEM_POIS);
}
开发者ID:BardurArantsson,项目名称:angband,代码行数:23,代码来源:mon-blows.c


示例17: melee_effect_handler_HALLU

/**
 * Melee effect handler: Make the player hallucinate.
 *
 * Note that we don't use melee_effect_timed(), due to the different monster
 * learning function.
 */
static void melee_effect_handler_HALLU(melee_effect_handler_context_t *context)
{
	/* Take damage */
	take_hit(context->p, context->damage, context->ddesc);

	/* Player is dead */
	if (context->p->is_dead)
		return;

	/* Increase "image" */
	if (player_inc_timed(context->p, TMD_IMAGE, 3 + randint1(context->rlev / 2),
						 true, true))
		context->obvious = true;

	/* Learn about the player */
	update_smart_learn(context->mon, context->p, 0, 0, ELEM_CHAOS);
}
开发者ID:BardurArantsson,项目名称:angband,代码行数:23,代码来源:mon-blows.c


示例18: make_attack_normal


//.........这里部分代码省略.........
			if (p->is_dead) {
				do_cut = false;
				do_stun = false;
			}

			/* Hack -- only one of cut or stun */
			if (do_cut && do_stun) {
				/* Cancel cut */
				if (randint0(100) < 50)
					do_cut = 0;

				/* Cancel stun */
				else
					do_stun = 0;
			}

			/* Handle cut */
			if (do_cut) {
				/* Critical hit (zero if non-critical) */
				tmp = monster_critical(dice, rlev, damage);

				/* Roll for damage */
				switch (tmp) {
					case 0: k = 0; break;
					case 1: k = randint1(5); break;
					case 2: k = randint1(5) + 5; break;
					case 3: k = randint1(20) + 20; break;
					case 4: k = randint1(50) + 50; break;
					case 5: k = randint1(100) + 100; break;
					case 6: k = 300; break;
					default: k = 500; break;
				}

				/* Apply the cut */
				if (k) (void)player_inc_timed(p, TMD_CUT, k, true, true);
			}

			/* Handle stun */
			if (do_stun) {
				/* Critical hit (zero if non-critical) */
				tmp = monster_critical(dice, rlev, damage);

				/* Roll for damage */
				switch (tmp) {
					case 0: k = 0; break;
					case 1: k = randint1(5); break;
					case 2: k = randint1(10) + 10; break;
					case 3: k = randint1(20) + 20; break;
					case 4: k = randint1(30) + 30; break;
					case 5: k = randint1(40) + 40; break;
					case 6: k = 100; break;
					default: k = 200; break;
				}

				/* Apply the stun */
				if (k)
					(void)player_inc_timed(p, TMD_STUN, k, true, true);
			}
		} else {
			/* Visible monster missed player, so notify if appropriate. */
			if (mflag_has(mon->mflag, MFLAG_VISIBLE) &&
				monster_blow_method_miss(method)) {
				/* Disturbing */
				disturb(p, 1);
				msg("%s misses you.", m_name);
			}
		}

		/* Analyze "visible" monsters only */
		if (visible) {
			/* Count "obvious" attacks (and ones that cause damage) */
			if (obvious || damage || (lore->blows[ap_cnt].times_seen > 10)) {
				/* Count attacks of this type */
				if (lore->blows[ap_cnt].times_seen < UCHAR_MAX)
					lore->blows[ap_cnt].times_seen++;
			}
		}

		/* Skip the other blows if necessary */
		if (do_break) break;
	}

	/* Blink away */
	if (blinked) {
		char dice[5];
		msg("There is a puff of smoke!");
		strnfmt(dice, sizeof(dice), "%d", z_info->max_sight * 2 + 5);
		effect_simple(EF_TELEPORT, dice, 0, 0, 0, NULL);
	}

	/* Always notice cause of death */
	if (p->is_dead && (lore->deaths < SHRT_MAX))
		lore->deaths++;

	/* Learn lore */
	lore_update(mon->race, lore);

	/* Assume we attacked */
	return (true);
}
开发者ID:CrypticGator,项目名称:angband,代码行数:101,代码来源:mon-attack.c


示例19: do_side_effects

/**
 * Apply side effects from a spell attack to the player
 *
 * \param spell is the attack type
 * \param dam is the amount of damage caused by the attack
 * \param m_idx is the attacking monster
 * \param rlev is its level
 * \param seen is whether @ can see it
 */
static void do_side_effects(int spell, int dam, int m_idx, bool seen)
{
	monster_type *m_ptr = cave_monster(cave, m_idx);
	monster_race *r_ptr = &r_info[m_ptr->r_idx];

	const struct spell_effect *re_ptr;
	const struct mon_spell *rs_ptr = &mon_spell_table[spell];

	int i, choice[99], dur = 0, j = 0, count = 0;
	s32b d = 0;

	bool sustain = FALSE, perma = FALSE, chosen[RSE_MAX] = { 0 };

	/* Extract the monster level */
	int rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);

	/* First we note all the effects we'll be doing. */
	for (re_ptr = spell_effect_table; re_ptr->index < RSE_MAX; re_ptr++) {
		if ((re_ptr->method && (re_ptr->method == rs_ptr->index)) ||
				(re_ptr->gf && (re_ptr->gf == rs_ptr->gf))) {

			/* If we have a choice of effects, we create a cum freq table */
			if (re_ptr->chance) {
				for (i = j; i < (j + re_ptr->chance); i++)
					choice[i] = re_ptr->index;
				j = i;
			}
			else
				chosen[re_ptr->index] = TRUE;
		}
	}

	/* If we have built a cum freq table, choose an effect from it */
	if (j)
		chosen[choice[randint0(j)]] = TRUE;

	/* Now we cycle through again to activate the chosen effects */
	for (re_ptr = spell_effect_table; re_ptr->index < RSE_MAX; re_ptr++) {
		if (chosen[re_ptr->index]) {

			/*
			 * Check for resistance - there are three possibilities:
			 * 1. Immunity to the attack type if side_immune is TRUE
			 * 2. Resistance to the attack type if it affords no immunity
			 * 3. Resistance to the specific side-effect
			 *
			 * TODO - add interesting messages to the RSE_ and GF_ tables
			 * to replace the generic ones below. (See #1376)
			 */
			if (re_ptr->res_flag)
				update_smart_learn(m_ptr, p_ptr, re_ptr->res_flag);

			if ((rs_ptr->gf && check_side_immune(rs_ptr->gf)) ||
					check_state(p_ptr, re_ptr->res_flag, p_ptr->state.flags)) {
				msg("You resist the effect!");
				continue;
			}

			/* Allow saving throw if available */
			if (re_ptr->save &&
					randint0(100) < p_ptr->state.skills[SKILL_SAVE]) {
				msg("You avoid the effect!");
				continue;
			}

			/* Implement the effect */
			if (re_ptr->timed) {

				/* Calculate base duration (m_bonus is not used) */
				dur = randcalc(re_ptr->base, 0, RANDOMISE);

				/* Calculate the damage-dependent duration (m_bonus is
				 * used as a cap) */
				dur += damcalc(re_ptr->dam.dice, re_ptr->dam.sides *
						dam / 100, RANDOMISE);

				if (re_ptr->dam.m_bonus && (dur > re_ptr->dam.m_bonus))
					dur = re_ptr->dam.m_bonus;

				/* Apply the effect - we have already checked for resistance */
				(void)player_inc_timed(p_ptr, re_ptr->flag, dur, TRUE, FALSE);

			} else {
				switch (re_ptr->flag) {
					case S_INV_DAM:
						if (dam > 0)
							inven_damage(p_ptr, re_ptr->gf, MIN(dam *
								randcalc(re_ptr->dam, 0, RANDOMISE), 300));
						break;

					case S_TELEPORT: /* m_bonus is used as a clev filter */
//.........这里部分代码省略.........
开发者ID:Colt374,项目名称:angband,代码行数:101,代码来源:mon-spell.c


示例20: cast_mage_spell


//.........这里部分代码省略.........
		case SPELL_DETECT_INVISIBLE:
		{
			(void)detect_monsters_normal(TRUE);
			(void)detect_monsters_invis(TRUE);
			break;
		}

		case SPELL_TREASURE_DETECTION:
		{
			(void)detect_treasure(TRUE, FALSE);
			break;
		}

		case SPELL_SHOCK_WAVE:
		{
			fire_ball(GF_SOUND, dir, 10 + plev, 2);
			break;
		}

		case SPELL_EXPLOSION:
		{
			fire_ball(GF_SHARD, dir, 20 + (plev * 2), 2);
			break;
		}

		case SPELL_MASS_BANISHMENT:
		{
			(void)mass_banishment();
			break;
		}

		case SPELL_RESIST_FIRE:
		{
			(void)player_inc_timed(p_ptr, TMD_OPP_FIRE, randint1(20) + 20, TRUE, TRUE);
			break;
		}

		case SPELL_RESIST_COLD:
		{
			(void)player_inc_timed(p_ptr, TMD_OPP_COLD, randint1(20) + 20, TRUE, TRUE);
			break;
		}

		case SPELL_ELEMENTAL_BRAND: /* elemental brand */
		{
			return brand_ammo();
		}

		case SPELL_RESIST_POISON:
		{
			(void)player_inc_timed(p_ptr, TMD_OPP_POIS, randint1(20) + 20, TRUE, TRUE);
			break;
		}

		case SPELL_RESISTANCE:
		{
			int time = randint1(20) + 20;
			(void)player_inc_timed(p_ptr, TMD_OPP_ACID, time, TRUE, TRUE);
			(void)player_inc_timed(p_ptr, TMD_OPP_ELEC, time, TRUE, TRUE);
			(void)player_inc_timed(p_ptr, TMD_OPP_FIRE, time, TRUE, TRUE);
			(void)player_inc_timed(p_ptr, TMD_OPP_COLD, time, TRUE, TRUE);
			(void)player_inc_timed(p_ptr, TMD_OPP_POIS, time, TRUE, TRUE);
			break;
		}

		case SPELL_HEROISM:
开发者ID:DaPortlyJester,项目名称:angband,代码行数:67,代码来源:x-spell.c



注:本文中的player_inc_timed函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ player_lock函数代码示例发布时间:2022-05-30
下一篇:
C++ playerLink函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap