Example #1
0
void sun_problem_check(struct char_data *ch) {
  if (SUNPROBLEM(ch)) {
    if ((time_info.hours > 5 && time_info.hours < 18) &&
        (OUTSIDE(ch) && !IS_SET(real_roomp(ch->in_room)->room_flags, DARK))) {
      if (!IS_AFFECTED2(ch, AFF2_SUN_BLIND)) {
        sun_blind(ch);
      }
    }
    else if (IS_AFFECTED2(ch, AFF2_SUN_BLIND)) {
      remove_sun_blind(ch);
    }
  }
}
Example #2
0
void sun_blind(struct char_data *ch) {
  struct affected_type af;

  if (get_max_level(ch) >= LOW_IMMORTAL)
    return;

  if (IS_AFFECTED2(ch, AFF2_SUN_BLIND))
    return;

  if (IS_AFFECTED(ch, AFF_BLIND))
    return;

  if (affected_by_spell(ch, SPELL_SUN_BLIND))
    affect_from_char(ch, SPELL_SUN_BLIND);

  send_to_char("Aaarrrggghh! The sun burns your eyes!\n\r", ch);

  af.type = SPELL_SUN_BLIND;
  af.location = APPLY_HITROLL;
  af.modifier = -4;
  af.duration = (number(1, 2) + (5 - get_max_level(ch) / 10));
  af.bitvector = 0;
  affect_to_char(ch, &af);

  af.location = APPLY_AC;
  af.modifier = +20;
  affect_to_char(ch, &af);

  af.modifier = 0;
  af.location = APPLY_BV2;
  af.bitvector = AFF2_SUN_BLIND;
  affect_to_char(ch, &af);
}
Example #3
0
void global_sun_problem_check(bool light) {
  struct descriptor_data *i;

  for (i = descriptor_list; i; i = i->next)
    if (!i->connected) {
      if (OUTSIDE(i->character)) {
        if (SUNPROBLEM(i->character)) {
          if (!IS_AFFECTED2(i->character, AFF2_SUN_BLIND)) {
            if (light)
              sun_blind(i->character);
            else
              remove_sun_blind(i->character);
          }
        }
      }
    }

}
Example #4
0
int spell_thieves_cant( int sn, int level, CHAR_DATA *ch, void *vo )
{
    AFFECT_DATA af;

    if ( IS_AFFECTED2( ch, AFF_SHADOW_PLANE ))
    {
      send_to_char(AT_WHITE, "You must leave the shadow realm.\n\r", ch);
      return SKPELL_MISSED;
    }
 
    af.duration  = ch->level/4;
    af.level = ch->level;
    af.location  = APPLY_DEX;
    af.modifier = ch->level/25;
    af.bitvector = AFF_THIEVESCANT;
    affect_to_char4(ch , &af);
    send_to_char(AT_ORANGE, "The knowledge of the thieves flows through you!\n\r", ch);
    return SKPELL_NO_DAMAGE;
}
Example #5
0
void do_quit( CHAR_DATA * ch, char * argument ) {
  DESCRIPTOR_DATA * d;
  CHAR_DATA       * PeT;
  CHAR_DATA       * gch;

  if ( ch->position == POS_FIGHTING ) {
    send_to_char( AT_WHITE, "No way! You are fighting.\n\r", ch );
    return;
  }

  if ( ch->position  < POS_STUNNED  ) {
    send_to_char( AT_WHITE, "You're not DEAD yet.\n\r", ch );
    return;
  }

  if ( ch->combat_timer ) {
    send_to_char( AT_WHITE, "Your adrenaline is pumping too hard.\n\r", ch );
    return;
  }

  if ( ch->in_room->vnum == ROOM_VNUM_SMITHY ) {
    send_to_char( AT_WHITE, "You cannot quit in this room.\n\r", ch );
    return;
  }

  if ( ch->questobj ) {
    if ( ch->questobj->carried_by == ch ) {
      extract_obj( ch->questobj );
    } else {
      ch->questobj->timer = 1;
    }
  }

  send_to_char( AT_BLUE, "[ The clear sky of reality slowly crosses the horizon.\n\r", ch );
  send_to_char( AT_BLUE, "  With much effort you tear yourself free of the storm, but\n\r  ", ch );
  send_to_char( AT_BLUE, "deep within your heart you know that there is no escaping\n\r ", ch );
  send_to_char( AT_BLUE, " the storm that rages within... ]\n\r\n\r", ch );
  send_to_char( C_DEFAULT, "", ch );

  if (   !CHECK_BIT( ch->act, PLR_WIZINVIS ) && !IS_AFFECTED2( ch, AFF_PLOADED ) ) {
    act( AT_BLOOD, "$n has left the game.", ch, NULL, NULL, TO_ROOM );

    if ( !CHECK_BIT( ch->act, PLR_CLOAKED ) ) {
      info( "%s has left the storm.", (int)( ch->name ), 0 );
    }
  } else {
    for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) {
      if ( ch != gch && get_trust( gch ) >= ch->wizinvis ) {
        act( AT_BLOOD, "$N slightly phased has left the storm.", gch, NULL, ch, TO_CHAR );
      }
    }
  }

  if ( IS_AFFECTED2( ch, AFF_PLOADED ) ) {
    REMOVE_BIT( ch->affected_by2, AFF_PLOADED );
  }

  if ( ch->level != L_IMP ) {
    sprintf( log_buf, "$N has quit in room vnum %d.", ch->in_room->vnum );
    wiznet( log_buf, ch, NULL, WIZ_LOGINS, 0, get_trust( ch ) );
  }

  if ( CHECK_BIT( ch->act, PLR_QUEST ) ) {
    REMOVE_BIT( ch->act, PLR_QUEST );
  }

  if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
    REMOVE_BIT( ch->act, PLR_QUESTOR );
  }

  save_char_obj( ch );
  save_finger( ch );

  for ( PeT = ch->in_room->people; PeT; PeT = PeT->next_in_room ) {
    if ( IS_NPC( PeT ) ) {
      if ( CHECK_BIT( PeT->act, ACT_PET ) && ( PeT->master == ch ) ) {
        extract_char( PeT, TRUE );
        break;
      }
    }
  }

  d = ch->desc;
  extract_char( ch, TRUE );

  if ( d ) {
    close_socket( d );
  }

  return;
}
Example #6
0
int mag_affect_char(struct spell_info_type *sinfo, int affect_flag, struct char_data *caster, struct char_data *vict, int level)
{
  struct affected_type af;
  int i;
  int spell = 0;
  int unaffect = 0;
  int circle = (level + 4) / 5;

  /* innate */
  if (level == -1) {
    SET_BIT(AFF_FLAGS(vict), affect_flag);
    return 1;
  }

  if (sinfo->unaffect) {
    spell = spells[find_spell_num(sinfo->unaffect)].spellindex;
    unaffect = 1;
  }

  if (!unaffect) {
    af.type = sinfo->spellindex;
    af.bitvector = sinfo->spell_plr_bit;
    af.bitvector2 = sinfo->spell_plr_bit2;
    af.bitvector3 = sinfo->spell_plr_bit3;

    if (sinfo->spell_duration)
      af.duration = sinfo->spell_duration * 12;
    else
      af.duration = (SECS_PER_MUD_HOUR * level) / 15; /* level/3 mud hours duration */

    af.duration = modBySpecialization(caster, sinfo, af.duration);
    gain_exp(caster, af.duration * 2);
    if (strcmp(sinfo->command, "stoneskin") == 0)
      af.duration = level * 5;
    for (i = 0; i < NUM_MODIFY; i++) {
      af.modifier[i] = 0;
      af.location[i] = 0;
    }

    for (i = 0; i < NUM_MODIFY; i++) {
      if (sinfo->plr_aff[i].location) {
        if (strcmp(sinfo->command, "vitality") == 0 || strcmp(sinfo->command, "vigorize") == 0)
          af.modifier[i] = (sinfo->plr_aff[i].modifier * level);
        else if (strcmp(sinfo->command, "barkskin") == 0) {
          af.modifier[i] = (sinfo->plr_aff[i].modifier - (3.5 * circle));
        } else
          af.modifier[i] = sinfo->plr_aff[i].modifier;
        af.location[i] = sinfo->plr_aff[i].location;
      }
    }
    if (IS_NPC(vict) && IS_AFFECTED(vict, sinfo->spell_plr_bit) && IS_AFFECTED2(vict, sinfo->spell_plr_bit2) && IS_AFFECTED3(vict, sinfo->spell_plr_bit3) && !affected_by_spell(vict, sinfo->spellindex))
      return 0;

    if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect))
      return 0;

    affect_join(vict, &af, sinfo->accum_duration, sinfo->avg_duration, sinfo->accum_affect, sinfo->avg_affect);
  } else {
    if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect))
      return 0;
    affect_from_char(vict, spell);
  }
  return 1;
}
Example #7
0
/* allows supermob to add affects like poisoned, diseased, etc.. -Flux */
void do_mpaffect( CHAR_DATA *ch, char *argument )
{
 CHAR_DATA	*victim;
 AFFECT_DATA	af;
 char		arg[MAX_INPUT_LENGTH];
 char		arg2[MAX_INPUT_LENGTH];
 long		affect;
 bool		affect2 = FALSE;

 if ( !IS_NPC( ch ) )
 {
  typo_message( ch );
  return;
 }

 if ( IS_SET( ch->act , ACT_PET ) || IS_AFFECTED( ch, AFF_CHARM ) )
      return;

    argument = one_argument( argument, arg );
    argument = one_argument( argument, arg2 );

    if ( arg[0] == '\0' || arg2[0] == '\0' )
    {
        sprintf( log_buf, "MpAffect - no argument: vnum %d name %s short %s.",
                 ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
    }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
        sprintf( log_buf, "Mpaffect - Victim not in room: vnum %d name %s short %s.",
                 ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
        return;
    }

    if ( victim == ch )
    {
        sprintf( log_buf, "Mpaffect - Bad victim to attack: vnum %d name %s short %s.",
                 ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
        return;
    }


    if ( IS_AFFECTED( ch, AFF_CHARM ) && ch->master == victim )
    {
        sprintf( log_buf, "Mpaffect - Charmed mob attacking master: vnum %d name %s short %s.",
                 ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
        return;
    }

    affect = flag_value( mpaffect_flags, arg2 );

    if ( affect == -99 || affect == -1 )
    {
     sprintf( log_buf, "Mpaffect - invalid affect type: vnum %d, name %s, short %s.",
	ch->pIndexData->vnum, ch->name, ch->short_descr );
     bug( log_buf, -1 );
     return;
    }            

   if ( !str_cmp( arg2, "poison" ) || !str_cmp( arg2, "insanity" ) )
   {
    if ( IS_AFFECTED( ch, affect ) )
     return;
    affect2 = FALSE;
   }
   else
   {
    if ( IS_AFFECTED2( ch, affect ) )
     return;
    affect2 = TRUE;
   }

       if ( affect == AFF_POISON && affect2 == FALSE )
        af.type      = gsn_poison;
       else if ( affect == AFF_DISEASED && affect2 == TRUE )
        af.type      = gsn_plague;
       else if ( affect == AFF_PLASMA && affect2 == TRUE )
        af.type      = gsn_plasma;
       else if ( affect == AFF_HALLUCINATING && affect2 == TRUE )
        af.type      = gsn_hallucinate;
       else if ( affect == AFF_INSANE && affect2 == FALSE )
        af.type      = gsn_insane;

        af.level     = victim->level;
        af.duration  = dice( 1, 25 );
        af.location  = APPLY_NONE;
        af.modifier  = 0;
        af.bitvector = affect;
       if ( !affect2 )
        affect_to_char( victim, &af );
       else
        affect_to_char2( victim, &af );

 return;
}
Example #8
0
int skill_double_backstab( int sn, int level, CHAR_DATA *ch, void *vo )
{
    OBJ_DATA  *obj;
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    
    one_argument( target_name, arg );
        
    if ( arg[0] == '\0' )
    {
	send_to_char(C_DEFAULT, "Double Backstab whom?\n\r", ch );
	return SKPELL_MISSED;
    }
    
    if ( !( victim = get_char_room( ch, arg ) ) )
    {
	send_to_char(C_DEFAULT, "They aren't here.\n\r", ch );
	return SKPELL_MISSED;
    }
  
    if ( victim == ch )   
    {
	send_to_char(C_DEFAULT, "How can you sneak up on yourself?\n\r", ch );
	return SKPELL_MISSED;
    } 
   
    if ( !( obj = get_eq_char( ch, WEAR_WIELD ) ) || obj->value[3] != 11 )
    {
	send_to_char(C_DEFAULT, "You need to wield a piercing weapon.\n\r", ch );
	return SKPELL_MISSED;
    }
    
    if ( victim->fighting )
    {
	send_to_char(C_DEFAULT, "You can't double backstab a fighting person.\n\r", ch );
	return SKPELL_MISSED;
    }
      
    if ( victim->hit < (victim->max_hit - 200) )
    {
	act(C_DEFAULT, "$N is hurt and suspicious ... you can't sneak up.", ch, NULL, victim, TO_CHAR );
	return SKPELL_MISSED;
    }
     
    if ( !is_pkillable( ch, victim ) )
    {
	return SKPELL_MISSED;
    }
     
    if ( IS_AFFECTED2( ch, AFF_SHADOW_PLANE ))
    {
	send_to_char(AT_WHITE, "You must leave the shadow realm.\n\r", ch);
	return SKPELL_MISSED;
    }

    if ( IS_AFFECTED4( ch, AFF_BURROW ))
    {
	send_to_char(AT_WHITE, "You must wait until the earth heals you.\n\r", ch);
	return SKPELL_MISSED;
    }
    
    if ( IS_AFFECTED2( victim, AFF_SHADOW_PLANE ))
    {
	send_to_char(AT_WHITE, "You can not attack someone who is in the shadow plane.\n\r", ch);
	return SKPELL_MISSED;
    }

    if ( IS_AFFECTED4( victim, AFF_BURROW ))
    {
	send_to_char(AT_WHITE, "You can not attack someone who is burrowed.\n\r", ch);
	return SKPELL_MISSED;
    }
 
    if ( IS_AFFECTED( victim, AFF_PEACE ) )
    {
	send_to_char(AT_WHITE, "A wave of peace overcomes you.\n\r", ch);
	return SKPELL_MISSED;
    }
  
    if (!IS_NPC(victim))
	ch->pkill_timer = 0;
  
    check_killer( ch, victim );
    WAIT_STATE( ch, skill_table[sn].beats );
    if ( !IS_AWAKE( victim ) || IS_NPC( ch ) || number_percent( ) < ( ch->pcdata->learned[sn] / 10 ) )
    {
	multi_hit( ch, victim, sn );
	multi_hit( ch, victim, sn );
    }
    else
    {
	return SKPELL_ZERO_DAMAGE;
    }
   
    return SKPELL_NO_DAMAGE;
}