当前位置: 首页>>代码示例>>C++>>正文


C++ GET_LEVEL函数代码示例

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


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

示例1: can_edit_zone

int can_edit_zone(struct char_data *ch, zone_rnum rnum)
{
  /* no access if called with bad arguments */
  if (!ch->desc || IS_NPC(ch) || rnum == NOWHERE)
    return FALSE;

  /* always access if ch is high enough level */
  if (GET_LEVEL(ch) >= LVL_GRGOD)
    return (TRUE);
  
  /* always access if a player have helped build the zone in the first place */
  if (is_name(GET_NAME(ch), zone_table[rnum].builders))
    return (FALSE);
  
  /* no access if you haven't been assigned a zone */
  if (GET_OLC_ZONE(ch) == NOWHERE)
    return FALSE;

  /* no access if you're not at least LVL_BUILDER */
  if (GET_LEVEL(ch) < LVL_BUILDER)
    return FALSE;

  /* always access if you're assigned to this zone */
  if (real_zone(GET_OLC_ZONE(ch)) == rnum)
    return TRUE;

  return (FALSE);
}
开发者ID:mysidia,项目名称:circle31dgpy,代码行数:28,代码来源:oasis.c

示例2: pk_reputation_gain

// Calculates the amount of reputation gained by the killer if they
// were to pkill the victim
int
pk_reputation_gain(struct creature *perp, struct creature *victim)
{
    if (perp == victim
        || IS_NPC(perp)
        || IS_NPC(victim))
        return 0;

    // Start with 10 for causing hassle
    int gain = 10;

    // adjust for level/gen difference
    gain += ((GET_LEVEL(perp) + GET_REMORT_GEN(perp) * 50)
             - (GET_LEVEL(victim) + GET_REMORT_GEN(victim) * 50)) / 5;

    // Additional adjustment for killing an innocent
    if (reputation_of(victim) == 0)
        gain *= 2;

    // Additional adjustment for killing a lower gen
    if (GET_REMORT_GEN(perp) > GET_REMORT_GEN(victim))
        gain += (GET_REMORT_GEN(perp) - GET_REMORT_GEN(victim)) * 9;

    if (IS_CRIMINAL(victim))
        gain /= 4;

    gain = MAX(1, gain);

    return gain;
}
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:32,代码来源:pvp.c

示例3: mana_gain

/* manapoint gain per game hour */
int mana_gain(CharData * ch)
{
    int malnourishCount = 0;
    struct affected_type *hjp, *next;

    if (IN_ROOM(ch) == -1) return 0;

    if(!IS_NPC(ch) && ((GET_COND(ch, HUNGER) == 0 && !IS_VAMPIRE(ch)) || GET_COND(ch, THIRST) == 0)) {
        if(ch->desc && percentSuccess(2)) {
            if(!affected_by_spell(ch, SKILL_EMACIATED))
                add_affect( ch, ch, SKILL_EMACIATED, GET_LEVEL(ch), 0, 0, -1,
                        0, FALSE, FALSE, FALSE, FALSE);

            for (hjp = ch->affected; hjp; hjp = next) {
                next = hjp->next;
                if (hjp->type == SKILL_EMACIATED_MANA)
                    malnourishCount++;
            }

            if(malnourishCount < 18)
                add_affect( ch, ch, SKILL_EMACIATED_MANA, GET_LEVEL(ch), APPLY_MANA, -MIN(50, GET_MANA(ch)/20), -1,
                        0, FALSE, FALSE, FALSE, FALSE);
        }
    }

    int base = calcManaBase(ch);
    int multiplier = calcManaMulti(ch);
    int bonus = calcManaBonus(ch);
    
    int gain = base*multiplier/100 + bonus;
    if (affected_by_spell(ch, SKILL_POTENCY)) gain *= 5;
    return (gain);
}
开发者ID:Lundessa,项目名称:NewRavenVM,代码行数:34,代码来源:mudlimits.c

示例4: do_peer

void do_peer(struct char_data *ch, char *argument, int cmd)
{
  void do_look(struct char_data *ch,char *arg,int cmd);

  if( GET_MANA(ch) < (15 - GET_LEVEL(ch,BestThiefClass(ch))/4))
  {
    send_to_char("You don't really see anything...\n\r",ch);
    return;
  }

  if(!*argument)
  {
    send_to_char("You must peer in a direction...\n\r",ch);
    return;
  }

  if(ch->skills[SKILL_PEER].learned < number(1,101))
  {
    do_look(ch,argument,0);
    GET_MANA(ch) -= 5; 
    return;
  }

  GET_MANA(ch) -= (20 - GET_LEVEL(ch,BestThiefClass(ch))/4);
  if(ch->skills[SKILL_PEER].learned < 50)
    ch->skills[SKILL_PEER].learned +=2;

  act("$n peers about the area.", TRUE, ch, 0, 0, TO_ROOM);

  do_look(ch,argument,SKILL_PEER);
}
开发者ID:quixadhal,项目名称:wileymud,代码行数:31,代码来源:skills.c

示例5: gain_exp_regardless

void gain_exp_regardless(struct char_data * ch, int gain)
{
  int is_altered = FALSE;
  int num_levels = 0;

  GET_EXP(ch) += gain;
  if (GET_EXP(ch) < 0)
    GET_EXP(ch) = 0;

  if (!IS_NPC(ch)) {
    while (GET_LEVEL(ch) < LVL_IMPL &&
	GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) {
      GET_LEVEL(ch) += 1;
      num_levels++;
      advance_level(ch);
      is_altered = TRUE;
    }

    if (is_altered) {
      sprintf(buf, "%s advanced %d level%s to level %d.",
		GET_NAME(ch), num_levels, num_levels == 1 ? "" : "s",
		GET_LEVEL(ch));
      mudlog(buf, BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
      if (num_levels == 1)
        send_to_char("You rise a level!\r\n", ch);
      else {
	sprintf(buf, "You rise %d levels!\r\n", num_levels);
	send_to_char(buf, ch);
      }
      set_title(ch, NULL);
      check_autowiz(ch);
    }
  }
}
开发者ID:matthewbode,项目名称:mg2,代码行数:34,代码来源:limits.c

示例6: mag_savingthrow

int mag_savingthrow(struct char_data * ch, int type)
{
  int save;

  /* negative apply_saving_throw values make saving throws better! */
  if (!ch) {
    return 0;
  }

  if (IS_NPC(ch)) {
    save = class_saving_throws[(int) CLASS_WARRIOR][type] - (GET_LEVEL(ch) / 3);
    save += mob_race_saving_throws[(int) GET_RACE(ch)][type];
  } else {
    save = class_saving_throws[(int) GET_CLASS(ch)][type] - (GET_LEVEL(ch) / 4);
    save += race_saving_throws[(int) GET_RACE(ch)][type];
  }

  save += GET_SAVE(ch, type);

  /* throwing a 0 is always a failure */
  if (MAX(1, save) < number(0, 20))
    return TRUE;
  else
    return FALSE;
}
开发者ID:nawglan,项目名称:ShadowWind,代码行数:25,代码来源:magic.c

示例7: gain_skill_prof

void
gain_skill_prof(struct creature *ch, int skl)
{
    int learned;
    if (skl == SKILL_READ_SCROLLS || skl == SKILL_USE_WANDS)
        learned = 10;
    else
        learned = LEARNED(ch);

    // NPCs don't learn
    if (IS_NPC(ch))
        return;

    // You can't gain in a skill that you don't really know
    if (GET_LEVEL(ch) < SPELL_LEVEL(skl, GET_CLASS(ch))) {
        if (!IS_REMORT(ch))
            return;
        if (GET_LEVEL(ch) < SPELL_LEVEL(skl, GET_REMORT_CLASS(ch)))
            return;
    }
    // Check for remort classes too
    if (SPELL_GEN(skl, GET_CLASS(ch)) > 0 &&
        GET_REMORT_GEN(ch) < SPELL_GEN(skl, GET_CLASS(ch)))
        return;

    if (GET_SKILL(ch, skl) >= (learned - 10))
        if ((GET_SKILL(ch, skl) - GET_LEVEL(ch)) <= 66)
            SET_SKILL(ch, skl, GET_SKILL(ch, skl) + 1);
}
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:29,代码来源:char_class.c

示例8: quest_join

void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
{
  qst_vnum vnum;
  qst_rnum rnum;
  char buf[MAX_INPUT_LENGTH];

  if (!*argument)
    snprintf(buf, sizeof(buf),
             "%s What quest did you wish to join?", GET_NAME(ch));
  else if (GET_QUEST(ch) != NOTHING)
    snprintf(buf, sizeof(buf),
             "%s But you are already part of a quest!", GET_NAME(ch));
  else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
    snprintf(buf, sizeof(buf),
             "%s I don't know of such a quest!", GET_NAME(ch));
  else if ((rnum = real_quest(vnum)) == NOTHING)
    snprintf(buf, sizeof(buf),
             "%s I don't know of such a quest!", GET_NAME(ch));
  else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
    snprintf(buf, sizeof(buf),
             "%s You are not experienced enough for that quest!", GET_NAME(ch));
  else if (GET_LEVEL(ch) > QST_MAXLEVEL(rnum))
    snprintf(buf, sizeof(buf),
             "%s You are too experienced for that quest!", GET_NAME(ch));
  else if (is_complete(ch, vnum))
    snprintf(buf, sizeof(buf),
             "%s You have already completed that quest!", GET_NAME(ch));
  else if ((QST_PREV(rnum) != NOTHING) && !is_complete(ch, QST_PREV(rnum)))
    snprintf(buf, sizeof(buf),
             "%s That quest is not available to you yet!", GET_NAME(ch));
  else if ((QST_PREREQ(rnum) != NOTHING) &&
           (real_object(QST_PREREQ(rnum)) != NOTHING) &&
           (get_obj_in_list_num(real_object(QST_PREREQ(rnum)),
       ch->carrying) == NULL))
    snprintf(buf, sizeof(buf),
             "%s You need to have %s first!", GET_NAME(ch),
      obj_proto[real_object(QST_PREREQ(rnum))].short_description);
  else {
    act("You join the quest.",    TRUE, ch, NULL, NULL, TO_CHAR);
    act("$n has joined a quest.", TRUE, ch, NULL, NULL, TO_ROOM);
    snprintf(buf, sizeof(buf),
             "%s Listen carefully to the instructions.", GET_NAME(ch));
    do_tell(qm, buf, cmd_tell, 0);
    set_quest(ch, rnum);
    send_to_char(ch, "%s", QST_INFO(rnum));
    if (QST_TIME(rnum) != -1)
      snprintf(buf, sizeof(buf),
        "%s You have a time limit of %d turn%s to complete the quest.",
        GET_NAME(ch), QST_TIME(rnum), QST_TIME(rnum) == 1 ? "" : "s");
    else
      snprintf(buf, sizeof(buf),
        "%s You can take however long you want to complete the quest.",
 GET_NAME(ch));
  }
  do_tell(qm, buf, cmd_tell, 0);
  save_char(ch);
}
开发者ID:mystickdreamer,项目名称:tba365,代码行数:57,代码来源:quest.c

示例9: BestClassBIT

int BestClassBIT(struct char_data *ch)
{
  int max=0, iClass=0, i;

  for (i=0; i< MAX_CLASS; i++)
    if (max < GET_LEVEL(ch,i)) 
    {
      max = GET_LEVEL(ch, i);
      iClass = i;
    }

  assert(max > 0);

  switch(iClass) 
  {
  case MAGE_LEVEL_IND:
    return(1);
    break;
  case CLERIC_LEVEL_IND:
    return(2);
    break;
  case WARRIOR_LEVEL_IND:
    return(4);
    break;
  case THIEF_LEVEL_IND:
    return(8);
    break; 
  case DRUID_LEVEL_IND:
    return(16);
    break;
  case MONK_LEVEL_IND:
    return(32);
    break;
  case BARBARIAN_LEVEL_IND:
    return(64);
    break;
  case SORCERER_LEVEL_IND:
    return(128);
    break;   
  case PALADIN_LEVEL_IND:
    return(256);
    break;      
  case RANGER_LEVEL_IND:
    return(512);
    break;   
  case PSI_LEVEL_IND: 
    return(1024);
    break;
  default:  
    mudlog( LOG_SYSERR, "Error in BestClassBIT"); 
    break; 
 } /* switch */
 
  return(iClass);
}
开发者ID:frasten,项目名称:openleu,代码行数:55,代码来源:multiclass.c

示例10: doInvigorate

/*
** doInvigorate
*/
void
doInvigorate(CharData* ch)
{
   int gain = 0;

   gain += number(1, GET_LEVEL(ch)/3);
   gain += number(1, (GET_MAX_HIT(ch) - GET_LEVEL(ch)*12)/15);

   if (GET_HIT(ch) < GET_MAX_HIT(ch)) 
       GET_HIT(ch) = MIN( GET_MAX_HIT(ch), GET_HIT(ch) + gain );
}
开发者ID:Lundessa,项目名称:NewRavenVM,代码行数:14,代码来源:mudlimits.c

示例11: GetMaxLevel

int GetMaxLevel(struct char_data *ch)
{
  register int max=0, i;

  for (i=0; i< MAX_CLASS; i++) {
    if (GET_LEVEL(ch, i) > max)
      max = GET_LEVEL(ch,i);
  }

  return(max);
}
开发者ID:frasten,项目名称:openleu,代码行数:11,代码来源:multiclass.c

示例12: Crash_offer_rent

int Crash_offer_rent(struct char_data * ch, struct char_data * receptionist,
			 int display, int factor)
{
  char buf[MAX_INPUT_LENGTH];
  int i;
  long totalcost = 0, numitems = 0, norent = 0;

  norent = Crash_report_unrentables(ch, receptionist, ch->carrying);
  for (i = 0; i < NUM_WEARS; i++)
    norent += Crash_report_unrentables(ch, receptionist, GET_EQ(ch, i));

  if (norent)
    return 0;

  totalcost = min_rent_cost * factor;

  Crash_report_rent(ch, receptionist, ch->carrying, &totalcost, &numitems, display, factor);

  for (i = 0; i < NUM_WEARS; i++)
    Crash_report_rent(ch, receptionist, GET_EQ(ch, i), &totalcost, &numitems, display, factor);

  if (!numitems) {
    sprintf(buf, "%s But you are not carrying anything!  Just quit!", GET_NAME(ch));
    do_tell(receptionist, buf, 0, 0);
    return (0);
  }
  if (numitems > max_obj_save) {
    sprintf(buf, "%s Sorry, but I cannot store more than %d items.",
		GET_NAME(ch), max_obj_save);
    do_tell(receptionist, buf, 0, 0);
    return (0);
  }
  if (display) {
    sprintf(buf, "%s Plus, my %d coin fee..", GET_NAME(ch),
	    min_rent_cost * factor);
    do_tell(receptionist, buf, 0, 0);
    sprintf(buf, "%s Totalling %ld, minus your rent credit of %ld...",
	    GET_NAME(ch), totalcost, (long)(GET_LEVEL(ch) * 800));
    do_tell(receptionist, buf, 0, 0);
    totalcost = MAX(0, (int)(totalcost - (GET_LEVEL(ch) * 800)));
    sprintf(buf, "%s That will be %ld coin%s%s.", GET_NAME(ch),
	    totalcost, (totalcost == 1 ? "" : "s"),
	    (factor == RENT_FACTOR ? " per day" : ""));
    do_tell(receptionist, buf, 0, 0);
    if (totalcost > GET_GOLD(ch)) {
      sprintf(buf, "%s ...which I see you can't afford.", GET_NAME(ch));
      do_tell(receptionist, buf, 0, 0);
      return (0);
    } else if (factor == RENT_FACTOR)
      Crash_rent_deadline(ch, receptionist, totalcost);
  }
  return (totalcost);
}
开发者ID:sean,项目名称:dominionmud,代码行数:53,代码来源:objsave.c

示例13: Board_write_message

void Board_write_message(int board_type, struct char_data *ch, char *arg)
{
    char buf[200], buf2[200];
    char *tmstr;
    int ct, len;

    if (GET_LEVEL(ch) < WRITE_LVL(board_type)) {
	send_to_char("You are not advanced enough to write on this board.\n\r", ch);
	return;
    }

   if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) {
	send_to_char("The board is full.\n\r", ch);
	return;
   }

   if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) {
	send_to_char("The board is malfunctioning - sorry.\n\r", ch);
	log("Board: failed to find empty slot on write.");
	return;
   }

   /* skip blanks */
   /* RT removed for(; isspace(*arg); arg++); */
   if (!*arg) {
     send_to_char("We must have a headline!\n\r", ch);
     return;
   }

   ct = time(0);
   tmstr = (char *) asctime(localtime(&ct));
   *(tmstr + strlen(tmstr) - 1) = '\0';

   sprintf(buf2, "(%s)", GET_NAME(ch));
   sprintf(buf, "%6.10s %-12s :: %s", tmstr, buf2, arg);
   len = strlen(buf) + 1;
   if (!(NEW_MSG_INDEX(board_type).heading = (char *)malloc(sizeof(char)*len))) {
		send_to_char("The board is malfunctioning - sorry.\n\r", ch);
		return;
   }
   strcpy(NEW_MSG_INDEX(board_type).heading, buf);
   NEW_MSG_INDEX(board_type).heading[len-1] = '\0';
   NEW_MSG_INDEX(board_type).level = GET_LEVEL(ch);

   send_to_char("Write your message.  Terminate with a @.\n\r\n\r", ch);
   act("$n starts to write a message.", TRUE, ch, 0, 0, TO_ROOM);
 
   ch->desc->str = &(msg_storage[NEW_MSG_INDEX(board_type).slot_num]);
   ch->desc->max_str = MAX_MESSAGE_LENGTH;
   
   num_of_msgs[board_type]++;
}
开发者ID:MUDOmnibus,项目名称:Rom1,代码行数:52,代码来源:board.c

示例14: getLevelFromCCTLut

/*----------------------------------------------------------------------------*
 *  NAME
 *      getLevelFromCCTLut
 *
 *  DESCRIPTION
 *      This function linearly interpolates the color value from LUT and
 *      color temperature.
 *
 *  RETURNS
 *      Level of the colour from 0 - 255.
 *
 *---------------------------------------------------------------------------*/
static uint8 getLevelFromCCTLut(uint16 temp, const uint16 *color_lut,
                                             uint16 sizeof_lut)
{
    uint16 idx;
    int16  x2,y2,x1,y1;
    int32  val;
    uint16 thk = temp/CCT_TEMP_FACTOR;

    for (idx = 0; idx < sizeof_lut; idx++)
    {
        /* Find the temperature just greater than temperature to be set */
        if (thk < GET_TEMP(color_lut[idx]))
        {
            if (0 == idx)
            {
                /* if the temperature is less than first LUT element
                 * then saturate at that value.
                 */
                return GET_LEVEL(color_lut[idx]);
            }
            else
            {
                /* Get the points on interpolation line
                 * Multiply temperature by unit factor to get value
                 * in Kelvin.
                 */
                y1 = (int16)GET_LEVEL(color_lut[idx - 1]);
                x1 = (int16)GET_TEMP(color_lut[idx - 1]) * CCT_TEMP_FACTOR;
                y2 = (int16)GET_LEVEL(color_lut[idx]);
                x2 = (int16)GET_TEMP(color_lut[idx]) * CCT_TEMP_FACTOR;

                /* Apply Straight Line interpolation.
                 * y = y1 + ((y2 - y1) * (x -x1))/(x2 - x1)
                 */
                val = ((int32)(y2 - y1))*((int16)temp - x1);
                val = (val)/(x2 - x1) + y1;

                /* return the calculated value */
                return ((uint8)val);
            }
        }
    }

    /* If temperature is greater than last element in LUT,
     * saturate to the highest
     */
    return GET_LEVEL(color_lut[sizeof_lut - 1]);

}
开发者ID:yuchaosydney,项目名称:CsrmeshPlay,代码行数:61,代码来源:light_hw.c

示例15: do_eat

void do_eat(struct char_data *ch, char *argument, int cmd)
{
	char buf[100];
	struct obj_data *temp;
	struct affected_type af;

	one_argument(argument,buf);

	if(!(temp = get_obj_in_list_vis(ch,buf,ch->carrying)))
	{
		act("You can't find it!",FALSE,ch,0,0,TO_CHAR);
		return;
	}

	if((temp->obj_flags.type_flag != ITEM_FOOD) && (GET_LEVEL(ch) < 22))
	{
		act("Your stomach refuses to eat that!?!",FALSE,ch,0,0,TO_CHAR);
		return;
	}

	if(GET_COND(ch,FULL)>20) /* Stomach full */
	{	
		act("You are to full to eat more!",FALSE,ch,0,0,TO_CHAR);
		return;
	}

	act("$n eats $p",TRUE,ch,temp,0,TO_ROOM);
	act("You eat the $o.",FALSE,ch,temp,0,TO_CHAR);

	gain_condition(ch,FULL,temp->obj_flags.value[0]);

	if(GET_COND(ch,FULL)>20)
		act("You are full.",FALSE,ch,0,0,TO_CHAR);

	if(temp->obj_flags.value[3] && (GET_LEVEL(ch) < 21)) /* The shit was poisoned ! */
	{
		act("Ooups, it tasted rather strange ?!!?",FALSE,ch,0,0,TO_CHAR);
		act("$n coughs and utters some strange sounds.",FALSE,ch,0,0,TO_ROOM);

		af.type = SPELL_POISON;
		af.duration = temp->obj_flags.value[0]*2;
		af.modifier = 0;
		af.location = APPLY_NONE;
		af.bitvector = AFF_POISON;
		affect_join(ch,&af, FALSE, FALSE);
	}

	extract_obj(temp);
}
开发者ID:MUDOmnibus,项目名称:DikuMUD-Alfa,代码行数:49,代码来源:act.obj2.c


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