Prettier player_outfit

New ideas, features you wish were in the game.
Post Reply
PowerWyrm
Balrog
Posts: 1574
Joined: Sun 27.11.2005, 15:57

Prettier player_outfit

Post by PowerWyrm » Mon 17.03.2008, 12:38

I've already implemented this for PWMAngband. I added:

- in p_class.txt:

# 'Y' is for starting equipment (ironman characters) - tval of the item, sval of the item,
# minimum amount, maximum amount.

for example (a warrior):

E:75:33:1:1 (1 berserk pot)
E:23:16:1:1 (1 broad sword)
E:37:4:1:1 (1 chain mail)
Y:75:35:5:5 (5 CSW)
Y:70:9:5:5 (5 tele scrolls)

- in parse_c_info():

...
else if (((buf[0] == 'E') && !cfg_ironman) || ((buf[0] == 'Y') && cfg_ironman))
{
/* parse starting eq */
...
}
else if ((buf[0] == 'E') || (buf[0] == 'Y'))
{
/* skip entry */
}

- in player_outfit():

Code: Select all

/* Hack -- Give the player his equipment */
	for (i = 0; i < MAX_START_ITEMS; i++)
	{
		/* Access the item */
		e_ptr = &(p_ptr->cp_ptr->start_items[i]);

		/* Hack	-- Give the player an object */
		if (e_ptr->tval > 0)
		{
			/* Get the object_kind */
			int k_idx = lookup_kind(e_ptr->tval, e_ptr->sval);

			/* Valid item? */
			if (!k_idx) continue;

			/* Prepare the item */
			invcopy(o_ptr, k_idx);
			o_ptr->number = (byte)rand_range(e_ptr->min, e_ptr->max);

			object_aware(Ind, o_ptr);
			object_known(o_ptr);
			inven_carry(Ind, o_ptr);
		}
	}

    /* Hack -- give the player hardcoded equipment XXX */

    /* Hack -- Give the player some food */
    invcopy(o_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
    o_ptr->number = (byte)rand_range(3, 7);
    if (cfg_ironman) o_ptr->number *= 2;
    object_aware(Ind, o_ptr);
    object_known(o_ptr);
    inven_carry(Ind, o_ptr);

    if (cfg_ironman)
    {
    	/* Hack -- Give the player some oil */
    	invcopy(o_ptr, lookup_kind(TV_FLASK, 0));
    	o_ptr->number = (byte)rand_range(6, 14);
    	object_known(o_ptr);
    	inven_carry(Ind, o_ptr);

        /* Hack -- Give the player a lantern */
        invcopy(o_ptr, lookup_kind(TV_LITE, SV_LITE_LANTERN));
        o_ptr->number = 1;
        o_ptr->pval = rand_range(7, 15) * 500;
        object_known(o_ptr);
    	inven_carry(Ind, o_ptr);

        /* Hack -- Give the player some scrolls of teleportation */
        invcopy(o_ptr, lookup_kind(TV_SCROLL, SV_SCROLL_TELEPORT));
    	o_ptr->number = 5;
        object_aware(Ind, o_ptr);
    	object_known(o_ptr);
    	inven_carry(Ind, o_ptr);
    }
    else
    {
    	/* Hack -- Give the player some torches */
    	invcopy(o_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH));
    	o_ptr->number = (byte)rand_range(3, 7);
    	o_ptr->pval = rand_range(3, 7) * 500;
    	object_known(o_ptr);
    	inven_carry(Ind, o_ptr);
    }

    /* Initialize the DM with special powers */
    if (!strcmp(p_ptr->name, cfg_dungeon_master))
    {
        p_ptr->lev = 50;
        p_ptr->exp = 15000000;
        p_ptr->timed[TMD_INVULN] = -1;
        p_ptr->ghost = 1;
        p_ptr->noscore = 1;
    }

    /*
     * Give the DM some interesting stuff
     * In DEBUG mode, everyone gets all that stuff for testing purposes
     */
#ifndef DEBUG
    if (!strcmp(p_ptr->name, cfg_dungeon_master))
    {
#endif
...

Post Reply