Exemple #1
0
void
perform_net_load(struct descriptor_data *d, char *arg)
{
    int skill_num, percent;
    long int cost;

    skip_spaces(&arg);
    if (!*arg) {
        d_printf(d, "Usage: load <program>\r\n");
        return;
    }

    skill_num = find_skill_num(arg);
    if (skill_num < 1) {
        d_printf(d, "Error: program '%s' not found\r\n", arg);
        return;
    }

    if ((SPELL_GEN(skill_num, CLASS_CYBORG) > 0
            && GET_CLASS(d->creature) != CLASS_CYBORG)
        || (GET_REMORT_GEN(d->creature) < SPELL_GEN(skill_num, CLASS_CYBORG))
        || (GET_LEVEL(d->creature) < SPELL_LEVEL(skill_num, CLASS_CYBORG))) {
        d_printf(d, "Error: resources unavailable to load '%s'\r\n", arg);
        return;
    }

    if (GET_SKILL(d->creature, skill_num) >= LEARNED(d->creature)) {
        d_printf(d, "Program fully installed on local system.\r\n");
        return;
    }

    cost = GET_SKILL_COST(d->creature, skill_num);
    d_printf(d, "Program cost: %10ld  Account balance; %'" PRId64 "\r\n",
        cost, d->account->bank_future);

    if (d->account->bank_future < cost) {
        d_printf(d, "Error: insufficient funds in your account\r\n");
        return;
    }

    withdraw_future_bank(d->account, cost);
    percent = MIN(MAXGAIN(d->creature),
        MAX(MINGAIN(d->creature), GET_INT(d->creature) * 2));
    percent = MIN(LEARNED(d->creature) -
        GET_SKILL(d->creature, skill_num), percent);
    SET_SKILL(d->creature, skill_num, GET_SKILL(d->creature,
            skill_num) + percent);
    d_printf(d,
        "Program download: %s terminating, %d percent transfer.\r\n",
        spell_to_str(skill_num), percent);
    if (GET_SKILL(d->creature, skill_num) >= LEARNED(d->creature))
        d_printf(d, "Program fully installed on local system.\r\n");
    else
        d_printf(d, "Program %d%% installed on local system.\r\n",
            GET_SKILL(d->creature, skill_num));
}
Exemple #2
0
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);
}
Exemple #3
0
void do_track( CHAR_DATA* ch, const char* argument)
{
    CHAR_DATA *vict;
    char arg[MAX_INPUT_LENGTH];
    int dir, maxdist;

    if( !IS_NPC( ch ) && ch->pcdata->learned[gsn_track] <= 0 )
    {
        send_to_char( "You do not know of this skill yet.\r\n", ch );
        return;
    }

    one_argument( argument, arg );
    if( arg[0] == '\0' )
    {
        send_to_char( "Whom are you trying to track?\r\n", ch );
        return;
    }

    WAIT_STATE( ch, skill_table[gsn_track]->beats );

    if( !( vict = get_char_world( ch, arg ) ) )
    {
        send_to_char( "You can't find a trail of anyone like that.\r\n", ch );
        return;
    }

    maxdist = 100 + ch->level * 30;

    if( !IS_NPC( ch ) )
        maxdist = ( maxdist * LEARNED( ch, gsn_track ) ) / 100;

    dir = find_first_step( ch->in_room, vict->in_room, maxdist );

    switch ( dir )
    {
    case BFS_ERROR:
        send_to_char( "Hmm... something seems to be wrong.\r\n", ch );
        break;
    case BFS_ALREADY_THERE:
        send_to_char( "You're already in the same room!\r\n", ch );
        break;
    case BFS_NO_PATH:
        send_to_char( "You can't sense a trail from here.\r\n", ch );
        learn_from_failure( ch, gsn_track );
        break;
    default:
        ch_printf( ch, "You sense a trail %s from here...\r\n", dir_name[dir] );
        learn_from_success( ch, gsn_track );
        break;
    }
}
Exemple #4
0
/* Some initializations for characters, including initial skills
   If mode == 0, then act as though the character was entering the
   game for the first time.  Otherwise, act as though the character
   is being set to that level.
 */
void
do_start(struct creature *ch, int mode)
{
    void advance_level(struct creature *ch, int8_t keep_internal);
    int8_t new_player = 0;
    int i;
    struct obj_data *implant_save[NUM_WEARS];
    struct obj_data *tattoo_save[NUM_WEARS];

    // remove implant affects
    for (i = 0; i < NUM_WEARS; i++) {
        if (GET_IMPLANT(ch, i))
            implant_save[i] = raw_unequip_char(ch, i, EQUIP_IMPLANT);
        else
            implant_save[i] = NULL;
        if (GET_TATTOO(ch, i))
            tattoo_save[i] = raw_unequip_char(ch, i, EQUIP_TATTOO);
        else
            tattoo_save[i] = NULL;
    }

    if (GET_EXP(ch) == 0 && !IS_REMORT(ch) && !IS_VAMPIRE(ch))
        new_player = true;

    GET_LEVEL(ch) = 1;
    GET_EXP(ch) = 1;

    if (mode)
        roll_real_abils(ch);

    for (i = 1; i <= MAX_SKILLS; i++)
        SET_SKILL(ch, i, 0);

    if (IS_VAMPIRE(ch))
        GET_LIFE_POINTS(ch) = 1;
    else
        GET_LIFE_POINTS(ch) = 3 * (GET_WIS(ch) + GET_CON(ch)) / 40;

    ch->points.max_hit = 20;
    ch->points.max_mana = 100;
    ch->points.max_move = 82;

    if (IS_TABAXI(ch)) {
        SET_SKILL(ch, SKILL_CLAW, LEARNED(ch));
        SET_SKILL(ch, SKILL_BITE, LEARNED(ch));
    }
    if (IS_ELF(ch)) {
        SET_SKILL(ch, SKILL_ARCHERY, LEARNED(ch));
    }

    switch (GET_CLASS(ch)) {
    case CLASS_MAGIC_USER:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_CLERIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_THIEF:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        SET_SKILL(ch, SKILL_SNEAK, 10);
        SET_SKILL(ch, SKILL_HIDE, 5);
        SET_SKILL(ch, SKILL_STEAL, 15);
        break;
    case CLASS_WARRIOR:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_BARB:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        break;
    case CLASS_PSIONIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_PHYSIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_CYBORG:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_KNIGHT:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_RANGER:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        GET_MAX_MOVE(ch) += dice(4, 9);
        break;
    case CLASS_MONK:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_MERCENARY:
        SET_SKILL(ch, SKILL_PUNCH, 20);
    case CLASS_BARD:
        SET_SKILL(ch, SKILL_PUNCH, 25);
        SET_SKILL(ch, SKILL_ARCHERY, 25);
        break;

    }

    if (new_player) {
        if (PAST_CLASS(GET_CLASS(ch))) {
            deposit_past_bank(ch->desc->account,
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch));
            ch->points.gold =
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch);
        } else if (FUTURE_CLASS(GET_CLASS(ch))) {
            deposit_future_bank(ch->desc->account,
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch));
            ch->points.cash =
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch);
        }

        // New players do not start with the gown at this point
        // This has been left in for reference for generic newbie starting gear for the future.
        // New players start with a hospital gown and items most dear to them
        /*
        struct obj_data *gown = read_object(33800);
        if (gown != NULL) {
            equip_char(ch, gown, WEAR_ABOUT, EQUIP_WORN);
        }
        */

        // Good clerics start with a holy symbol on neck
        if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_GOOD(ch)) {
            struct obj_data *talisman = read_object(1280);
            if (talisman != NULL) {
                equip_char(ch, talisman, WEAR_NECK_1, EQUIP_WORN);
            }
        }

        // Evil clerics start with a holy symbol on hold
        if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_EVIL(ch)) {
            struct obj_data *symbol = read_object(1260);
            if (symbol != NULL) {
                equip_char(ch, symbol, WEAR_HOLD, EQUIP_WORN);
            }
        }

        // Good knights start with a holy symbol on finger
        if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_GOOD(ch)) {
            struct obj_data *ring = read_object(1287);
            if (ring != NULL) {
                equip_char(ch, ring, WEAR_FINGER_L, EQUIP_WORN);
            }
        }

        // Evil knights start with a holy symbol on neck
        if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_EVIL(ch)) {
            struct obj_data *pendant = read_object(1270);
            if (pendant != NULL) {
                equip_char(ch, pendant, WEAR_NECK_1, EQUIP_WORN);
            }
        }

        // Bards start with a percussion instrument held, and stringed in inventory
        if (GET_CLASS(ch) == CLASS_BARD) {
            struct obj_data *lute = read_object(3218);
            if (lute != NULL) {
                obj_to_char(lute, ch);
            }
        }
   
        set_title(ch, "the complete newbie");
    }

    advance_level(ch, 0);

    GET_MAX_MOVE(ch) += GET_CON(ch);

    GET_HIT(ch) = GET_MAX_HIT(ch);
    GET_MANA(ch) = GET_MAX_MANA(ch);
    GET_MOVE(ch) = GET_MAX_MOVE(ch);

    GET_COND(ch, THIRST) = 24;
    GET_COND(ch, FULL) = 24;
    GET_COND(ch, DRUNK) = 0;

    if (new_player) {
        ch->player.time.played = 0;
        ch->player.time.logon = time(NULL);
    }

    for (i = 0; i < NUM_WEARS; i++) {
        if (implant_save[i])
            equip_char(ch, implant_save[i], i, EQUIP_IMPLANT);
        if (tattoo_save[i])
            equip_char(ch, tattoo_save[i], i, EQUIP_TATTOO);
    }
}