コード例 #1
0
ファイル: mudlimits.c プロジェクト: Lundessa/NewRavenVM
int calcManaMulti(CharData *ch) {
    int multi = 100;

    if(ROOM_FLAGGED(ch->in_room, ROOM_MANA_REGEN))
        multi += 50;
    
    if(IS_AFFECTED(ch, AFF_WRAITHFORM))
        multi += 25;

    if((GET_CLASS(ch) == CLASS_SHADOW_DANCER) && (IS_DARK(ch->in_room) || IS_AFFECTED(ch, AFF_SHADOW_SPHERE)))
        multi += 50;

    if(IS_AFFECTED(ch, AFF_POISON))
        multi -= 100;

    if(!IS_NPC(ch)) {
        if( !IS_NPC(ch) && ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT ))
            multi -= 90;
        else if (!GET_COND(ch, THIRST) && IS_AMARA(ch))
            multi -= 90;
        else if (IS_IZARTI(ch) && IS_EVIL(ch))
            multi -= 90;
        else if (IS_DEMON(ch) && IS_GOOD(ch))
            multi -= 90;
    }

    if(GET_RACE(ch) == RACE_STROLL)
        multi += 100;

    /* Position calculations    */
    switch (GET_POS(ch)) {
        case POS_MEDITATING:
        case POS_SLEEPING:
            multi += 120;
            break;
        case POS_RESTING:
            multi += 60;
            break;
    }

    multi += (int)GET_SKILL(ch, SKILL_DEVOTION);

    // Don't let a player's regeneration completely stagnate...
    multi = MAX(multi, 25);
    return multi;
}
コード例 #2
0
ファイル: limits.cpp プロジェクト: bodrich/bylins
// manapoint gain pr. game hour
int mana_gain(CHAR_DATA * ch)
{
	int gain = 0, restore = int_app[GET_REAL_INT(ch)].mana_per_tic, percent = 100;
	int stopmem = FALSE;

	if (IS_NPC(ch))
	{
		gain = GET_LEVEL(ch);
	}
	else
	{
		if (!ch->desc || STATE(ch->desc) != CON_PLAYING)
			return (0);

		if (!IS_MANA_CASTER(ch))
			gain =
				graf(age(ch)->year, restore - 8, restore - 4, restore,
					 restore + 5, restore, restore - 4, restore - 8);
		else
			gain = mana_gain_cs[GET_REAL_INT(ch)];

		// Room specification
		if (LIKE_ROOM(ch))
			percent += 25;
		// Weather specification
		if (average_day_temp() < -20)
			percent -= 10;
		else if (average_day_temp() < -10)
			percent -= 5;
	}

	if (world[IN_ROOM(ch)]->fires)
		percent += MAX(50, 10 + world[IN_ROOM(ch)]->fires * 5);

	if (AFF_FLAGGED(ch, AFF_DEAFNESS))
		percent += 15;

	// Skill/Spell calculations


	// Position calculations
	if (ch->get_fighting())
		percent -= 90;
	else
		switch (GET_POS(ch))
		{
		case POS_SLEEPING:
			if (IS_MANA_CASTER(ch))
			{
				percent += 80;
			}
			else
			{
				stopmem = TRUE;
				percent = 0;
			}
			break;
		case POS_RESTING:
			percent += 45;
			break;
		case POS_SITTING:
			percent += 30;
			break;
		case POS_STANDING:
			break;
		default:
			stopmem = TRUE;
			percent = 0;
			break;
		}

	if (!IS_MANA_CASTER(ch) &&
			(AFF_FLAGGED(ch, AFF_HOLD) ||
			 AFF_FLAGGED(ch, AFF_BLIND) ||
			 AFF_FLAGGED(ch, AFF_SLEEP) ||
			 ((IN_ROOM(ch) != NOWHERE) && IS_DARK(IN_ROOM(ch)) && !can_use_feat(ch, DARK_READING_FEAT))))
	{
		stopmem = TRUE;
		percent = 0;
	}
	if (!IS_NPC(ch))
	{
		if (GET_COND(ch, FULL) == 0)
			percent -= 50;
		if (GET_COND(ch, THIRST) == 0)
			percent -= 25;
		if (GET_COND(ch, DRUNK) >= CHAR_DRUNKED)
			percent -= 10;
	}

	if (!IS_MANA_CASTER(ch))
		percent += GET_MANAREG(ch);
	if (AFF_FLAGGED(ch, AFF_POISON) && percent > 0)
		percent /= 4;
	percent = MAX(0, MIN(250, percent));
	gain = gain * percent / 100;
	return (stopmem ? 0 : gain);
}
コード例 #3
0
void do_look(struct char_data *ch, char *argument, int cmd)
{
    char buffer[MAX_STRING_LENGTH];
    char arg1[MAX_STRING_LENGTH];
    char arg2[MAX_STRING_LENGTH];
    int keyword_no;
    int j, bits, temp;
    bool found;
    struct obj_data *tmp_object, *found_object;
    struct char_data *tmp_char;
    char *tmp_desc;
    static char *keywords[]= {
        "north",
        "east",
        "south",
        "west",
        "up",
        "down",
        "in",
        "at",
        "",  /* Look at '' case */
        "\n"
    };

    if (!ch->desc)
        return;

    if (GET_POS(ch) < POSITION_SLEEPING)
        send_to_char("You can't see anything but stars!\n\r", ch);
    else if (GET_POS(ch) == POSITION_SLEEPING)
        send_to_char("You can't see anything, you're sleeping!\n\r", ch);
    else if ( IS_AFFECTED(ch, AFF_BLIND) )
        send_to_char("You can't see a damn thing, you're blinded!\n\r", ch);
    else if ( IS_DARK(ch->in_room) )
        send_to_char("It is pitch black...\n\r", ch);
    else {
        argument_split_2(argument,arg1,arg2);
        keyword_no = search_block(arg1, keywords, FALSE); /* Partiel Match */

        if ((keyword_no == -1) && *arg1) {
            keyword_no = 7;
            strcpy(arg2, arg1); /* Let arg2 become the target object (arg1) */
        }

        found = FALSE;
        tmp_object = 0;
        tmp_char	 = 0;
        tmp_desc	 = 0;

        switch(keyword_no) {
        /* look <dir> */
        case 0 :
        case 1 :
        case 2 :
        case 3 :
        case 4 :
        case 5 : {

            if (EXIT(ch, keyword_no)) {

                if (EXIT(ch, keyword_no)->general_description) {
                    send_to_char(EXIT(ch, keyword_no)->
                                 general_description, ch);
                } else {
                    send_to_char("You see nothing special.\n\r", ch);
                }

                if (IS_SET(EXIT(ch, keyword_no)->exit_info, EX_CLOSED) &&
                        (EXIT(ch, keyword_no)->keyword)) {
                    sprintf(buffer, "The %s is closed.\n\r",
                            fname(EXIT(ch, keyword_no)->keyword));
                    send_to_char(buffer, ch);
                }	else {
                    if (IS_SET(EXIT(ch, keyword_no)->exit_info, EX_ISDOOR) &&
                            EXIT(ch, keyword_no)->keyword) {
                        sprintf(buffer, "The %s is open.\n\r",
                                fname(EXIT(ch, keyword_no)->keyword));
                        send_to_char(buffer, ch);
                    }
                }
            } else {
                send_to_char("Nothing special there...\n\r", ch);
            }
        }
        break;

        /* look 'in'	*/
        case 6: {
            if (*arg2) {
                /* Item carried */

                bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
                                    FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);

                if (bits) { /* Found something */
                    if (GET_ITEM_TYPE(tmp_object)== ITEM_DRINKCON)
                    {
                        if (tmp_object->obj_flags.value[1] <= 0) {
                            act("It is empty.", FALSE, ch, 0, 0, TO_CHAR);
                        } else {
                            temp=((tmp_object->obj_flags.value[1]*3)/tmp_object->obj_flags.value[0]);
                            sprintf(buffer,"It's %sfull of a %s liquid.\n\r",
                                    fullness[temp],color_liquid[tmp_object->obj_flags.value[2]]);
                            send_to_char(buffer, ch);
                        }
                    } else if (GET_ITEM_TYPE(tmp_object) == ITEM_CONTAINER) {
                        if (!IS_SET(tmp_object->obj_flags.value[1],CONT_CLOSED)) {
                            send_to_char(fname(tmp_object->name), ch);
                            switch (bits) {
                            case FIND_OBJ_INV :
                                send_to_char(" (carried) : \n\r", ch);
                                break;
                            case FIND_OBJ_ROOM :
                                send_to_char(" (here) : \n\r", ch);
                                break;
                            case FIND_OBJ_EQUIP :
                                send_to_char(" (used) : \n\r", ch);
                                break;
                            }
                            list_obj_to_char(tmp_object->contains, ch, 2, TRUE);
                        }
                        else
                            send_to_char("It is closed.\n\r", ch);
                    } else {
                        send_to_char("That is not a container.\n\r", ch);
                    }
                } else { /* wrong argument */
                    send_to_char("You do not see that item here.\n\r", ch);
                }
            } else { /* no argument */
                send_to_char("Look in what?!\n\r", ch);
            }
        }
        break;

        /* look 'at'	*/
        case 7 : {


            if (*arg2) {

                bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
                                    FIND_OBJ_EQUIP | FIND_CHAR_ROOM, ch, &tmp_char, &found_object);

                if (tmp_char) {
                    show_char_to_char(tmp_char, ch, 1);
                    if (ch != tmp_char) {
                        act("$n looks at you.", TRUE, ch, 0, tmp_char, TO_VICT);
                        act("$n looks at $N.", TRUE, ch, 0, tmp_char, TO_NOTVICT);
                    }
                    return;
                }


                /* Search for Extra Descriptions in room and items */

                /* Extra description in room?? */
                if (!found) {
                    tmp_desc = find_ex_description(arg2,
                                                   world[ch->in_room].ex_description);
                    if (tmp_desc) {
                        page_string(ch->desc, tmp_desc, 0);
                        return; /* RETURN SINCE IT WAS A ROOM DESCRIPTION */
                        /* Old system was: found = TRUE; */
                    }
                }

                /* Search for extra descriptions in items */

                /* Equipment Used */

                if (!found) {
                    for (j = 0; j< MAX_WEAR && !found; j++) {
                        if (ch->equipment[j]) {
                            if (CAN_SEE_OBJ(ch,ch->equipment[j])) {
                                tmp_desc = find_ex_description(arg2,
                                                               ch->equipment[j]->ex_description);
                                if (tmp_desc) {
                                    page_string(ch->desc, tmp_desc, 1);
                                    found = TRUE;
                                }
                            }
                        }
                    }
                }

                /* In inventory */

                if (!found) {
                    for(tmp_object = ch->carrying;
                            tmp_object && !found;
                            tmp_object = tmp_object->next_content) {
                        if CAN_SEE_OBJ(ch, tmp_object) {
                            tmp_desc = find_ex_description(arg2,
                                                           tmp_object->ex_description);
                            if (tmp_desc) {
                                page_string(ch->desc, tmp_desc, 1);
                                found = TRUE;
                            }
                        }
                    }
                }

                /* Object In room */

                if (!found) {
                    for(tmp_object = world[ch->in_room].contents;
                            tmp_object && !found;
                            tmp_object = tmp_object->next_content) {
                        if CAN_SEE_OBJ(ch, tmp_object) {
                            tmp_desc = find_ex_description(arg2,
                                                           tmp_object->ex_description);
                            if (tmp_desc) {
                                page_string(ch->desc, tmp_desc, 1);
                                found = TRUE;
                            }
                        }
                    }
                }
                /* wrong argument */

                if (bits) { /* If an object was found */
                    if (!found)
                        show_obj_to_char(found_object, ch, 5); /* Show no-description */
                    else
                        show_obj_to_char(found_object, ch, 6); /* Find hum, glow etc */
                } else if (!found) {
                    send_to_char("You do not see that here.\n\r", ch);
                }
            } else {
                /* no argument */

                send_to_char("Look at what?\n\r", ch);
            }
        }