本文整理汇总了C++中player_inc_timed函数的典型用法代码示例。如果您正苦于以下问题:C++ player_inc_timed函数的具体用法?C++ player_inc_timed怎么用?C++ player_inc_timed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了player_inc_timed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}