Esempio n. 1
0
static int _get_powers(spell_info* spells, int max)
{
    int ct = 0;
    spell_info* spell = &spells[ct++];

    if (is_good_realm(p_ptr->realm1))
    {
        spell->level = 30;
        spell->cost = 30;
        spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_WIS]);
        spell->fn = holy_lance_spell;
    }
    else
    {
        spell->level = 30;
        spell->cost = 30;
        spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_WIS]);
        spell->fn = hell_lance_spell;
    }

    return ct;
}
Esempio n. 2
0
static int _get_powers(spell_info* spells, int max)
{
    int ct = 0;
    spell_info* spell = &spells[ct++];

    if (is_good_realm(p_ptr->realm1))
    {
        spell->level = 35;
        spell->cost = 70;
        spell->fail = calculate_fail_rate(spell->level, 90, p_ptr->stat_ind[A_WIS]);
        spell->fn = bless_weapon_spell;
    }
    else
    {
        spell->level = 42;
        spell->cost = 40;
        spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_WIS]);
        spell->fn = evocation_spell;
    }

    return ct;
}
Esempio n. 3
0
/*
 * Destroy an item
 */
void do_cmd_destroy(void)
{
    int          item, amt = 1;
    int          old_number;
    bool         force = FALSE;
    object_type *o_ptr;
    object_type  forge;
    object_type *q_ptr = &forge;
    bool         is_equipped = FALSE;
    char         o_name[MAX_NLEN];
    char         out_val[MAX_NLEN+40];

    cptr q, s;
    int mode = USE_INVEN | USE_FLOOR;

    if (p_ptr->pclass == CLASS_RUNE_KNIGHT)
        mode |= USE_EQUIP;

    if (p_ptr->special_defense & KATA_MUSOU)
    {
        set_action(ACTION_NONE);
    }

    /* Hack -- force destruction */
    if (command_arg > 0) force = TRUE;


    /* Get an item */
    q = "Destroy which item? ";
    s = "You have nothing to destroy.";

    if (!get_item(&item, q, s, mode)) return;

    /* Get the item (in the pack) */
    if (item >= 0)
    {
        o_ptr = &inventory[item];
        is_equipped = equip_is_valid_slot(item);
    }

    /* Get the item (on the floor) */
    else
    {
        o_ptr = &o_list[0 - item];
    }

    /* Hack for Rune Knight: They can destroy worn equipment, but only
       if it has the Sacrifice rune.  get_item() is not smart enough
       to handle this restriction ... */
    if (is_equipped && o_ptr->rune != RUNE_SACRIFICE)
    {
        msg_print("You must first remove that item before destroying it.");
        return;
    }

    /* Verify unless quantity given beforehand */
    if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
    {
        object_desc(o_name, o_ptr, OD_OMIT_PREFIX);

        /* Make a verification */
        sprintf(out_val, 
            "Really destroy %s? [y/n/Auto]",
            o_name);

        msg_print(NULL);

        /* HACK : Add the line to message buffer */
        message_add(out_val);
        p_ptr->window |= (PW_MESSAGE);
        window_stuff();

        /* Get an acceptable answer */
        while (TRUE)
        {
            char i;

            /* Prompt */
            prt(out_val, 0, 0);

            i = inkey();

            /* Erase the prompt */
            prt("", 0, 0);


            if (i == 'y' || i == 'Y')
            {
                break;
            }
            if (i == ESCAPE || i == 'n' || i == 'N')
            {
                /* Cancel */
                return;
            }
            if (i == 'A')
            {
                /* Add an auto-destroy preference line */
                if (autopick_autoregister(o_ptr))
                {
                    /* Auto-destroy it */
                    autopick_alter_item(item, TRUE);
                }

                /* The object is already destroyed. */
                return;
            }
        } /* while (TRUE) */
    }

    /* See how many items */
    if (o_ptr->number > 1)
    {
        /* Get a quantity */
        amt = get_quantity(NULL, o_ptr->number);

        /* Allow user abort */
        if (amt <= 0) return;
    }


    /* Describe the object */
    old_number = o_ptr->number;
    o_ptr->number = amt;
    object_desc(o_name, o_ptr, 0);
    o_ptr->number = old_number;

    /* Take a turn */
    energy_use = 100;

    /* Artifacts cannot be destroyed */
    if (!can_player_destroy_object(o_ptr))
    {
        energy_use = 0;

        /* Message */
        msg_format("You cannot destroy %s.", o_name);

        /* Done */
        return;
    }

    object_copy(q_ptr, o_ptr);

    stats_on_p_destroy(o_ptr, amt);

    if (prace_is_(RACE_MON_JELLY))
        jelly_eat_object(o_ptr);
    else if (prace_is_(RACE_MON_SWORD) && object_is_melee_weapon(o_ptr))
        sword_absorb_object(o_ptr);
    else if (prace_is_(RACE_MON_RING) && object_is_jewelry(o_ptr))
        ring_absorb_object(o_ptr);
    else
        msg_format("You destroy %s.", o_name);

    if (o_ptr->rune == RUNE_SACRIFICE)
    {
        int add_hp = is_equipped ? p_ptr->mhp : p_ptr->mhp/3;
        int add_sp = is_equipped ? p_ptr->msp : p_ptr->msp/3;

        msg_print("You feel a surge of wondrous power enter your body.");
        
        p_ptr->chp = MIN(p_ptr->mhp, p_ptr->chp + add_hp);
        p_ptr->chp_frac = 0;
        p_ptr->csp = MIN(p_ptr->msp, p_ptr->csp + add_sp);
        p_ptr->csp_frac = 0;

        p_ptr->redraw |= (PR_MANA);
        p_ptr->window |= (PW_PLAYER);
        p_ptr->window |= (PW_SPELL);
        p_ptr->redraw |= (PR_HP);

        if (is_equipped)
        {
            blast_object(o_ptr);
            o_ptr->curse_flags = TRC_HEAVY_CURSE;
        }
    }
    else if (is_equipped)
        blast_object(o_ptr);

    sound(SOUND_DESTITEM);

    /* Reduce the charges of rods/wands */
    reduce_charges(o_ptr, amt);

    /* Eliminate the item (from the pack) */
    if (item >= 0)
    {
        if (!is_equipped)
        {
            inven_item_increase(item, -amt);
            inven_item_describe(item);
            inven_item_optimize(item);
        }
    }

    /* Eliminate the item (from the floor) */
    else
    {
        floor_item_increase(0 - item, -amt);
        floor_item_describe(0 - item);
        floor_item_optimize(0 - item);
    }

    if ( p_ptr->pclass == CLASS_NECROMANCER
      && (q_ptr->tval == TV_LIFE_BOOK || q_ptr->tval == TV_CRUSADE_BOOK) )
    {
        int sp = 0;
        int osp = p_ptr->csp;
        switch (q_ptr->sval)
        {
        case 0: sp = 10; break;
        case 1: sp = 25; break;
        case 2: sp = 100; break;
        case 3: sp = 666; break;
        }

        p_ptr->csp += sp;
        if (p_ptr->csp >= p_ptr->msp)
        {
            p_ptr->csp = p_ptr->msp;
            p_ptr->csp_frac = 0;
        }

        if (p_ptr->csp > osp)
            msg_print("You feel your head clear.");

        p_ptr->redraw |= (PR_MANA);
    }

    if (high_level_book(q_ptr))
    {
        bool gain_expr = FALSE;

        if (p_ptr->prace == RACE_ANDROID)
        {
        }
        else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
        {
            gain_expr = TRUE;
        }
        else if (p_ptr->pclass == CLASS_PALADIN)
        {
            if (is_good_realm(p_ptr->realm1))
            {
                if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
            }
            else
            {
                if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
            }
        }

        if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
        {
            s32b tester_exp = p_ptr->max_exp / 20;
            if (tester_exp > 10000) tester_exp = 10000;
            if (q_ptr->sval < 3) tester_exp /= 4;
            if (tester_exp<1) tester_exp = 1;

            msg_print("You feel more experienced.");
            gain_exp(tester_exp * amt);
        }
    }

    if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
    {
        virtue_add(VIRTUE_UNLIFE, 1);
        virtue_add(VIRTUE_VITALITY, -1);
    }
    else if ( high_level_book(q_ptr) 
           && (q_ptr->tval == TV_DEATH_BOOK || q_ptr->tval == TV_NECROMANCY_BOOK) )
    {
        virtue_add(VIRTUE_UNLIFE, -1);
        virtue_add(VIRTUE_VITALITY, 1);
    }    

    if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
        virtue_add(VIRTUE_ENCHANTMENT, -1);
    
    if (object_value_real(q_ptr) > 30000)
        virtue_add(VIRTUE_SACRIFICE, 2);
    
    else if (object_value_real(q_ptr) > 10000)
        virtue_add(VIRTUE_SACRIFICE, 1);

    if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
        virtue_add(VIRTUE_HARMONY, 1);

    if (equip_is_valid_slot(item)) 
        calc_android_exp();
}
Esempio n. 4
0
bool priest_is_good(void)
{
    if (p_ptr->pclass == CLASS_PRIEST && is_good_realm(p_ptr->realm1))
        return TRUE;
    return FALSE;
}
Esempio n. 5
0
/* HACK: This should be handled by the class_t entry point ...
   This is just here while I am refactoring code!!! */
int get_class_powers(spell_info* spells, int max)
{
	int ct = 0;

	switch (p_ptr->pclass)
	{
		case CLASS_WARRIOR:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 40;
			spell->cost = 75;
			spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_DEX]);
			spell->fn = sword_dance_spell;
			break;
		}
		case CLASS_HIGH_MAGE:
			if (p_ptr->realm1 == REALM_HEX)
			{
				spell_info* spell = &spells[ct++];
				spell->level = 1;
				spell->cost = 0;
				spell->fail = 0;
				spell->fn = hex_stop_spelling_spell;
				break;
			}
			/* vvvvvv FALL THRU ON PURPOSE vvvvvvv */
		case CLASS_MAGE:
		case CLASS_SORCERER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 1;
			spell->fail = calculate_fail_rate(spell->level, 90, p_ptr->stat_ind[A_INT]);
			spell->fn = eat_magic_spell;
			break;
		}
		case CLASS_PRIEST:
			if (is_good_realm(p_ptr->realm1))
			{
				spell_info* spell = &spells[ct++];
				spell->level = 35;
				spell->cost = 70;
				spell->fail = calculate_fail_rate(spell->level, 90, p_ptr->stat_ind[A_WIS]);
				spell->fn = bless_weapon_spell;
			}
			else
			{
				spell_info* spell = &spells[ct++];
				spell->level = 42;
				spell->cost = 40;
				spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_WIS]);
				spell->fn = evocation_spell;
			}
			break;

		case CLASS_RANGER:
		case CLASS_SNIPER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 15;
			spell->cost = 20;
			spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_INT]);
			spell->fn = probing_spell;
			break;
		}
		case CLASS_PALADIN:
			if (is_good_realm(p_ptr->realm1))
			{
				spell_info* spell = &spells[ct++];
				spell->level = 30;
				spell->cost = 30;
				spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_WIS]);
				spell->fn = holy_lance_spell;
			}
			else
			{
				spell_info* spell = &spells[ct++];
				spell->level = 30;
				spell->cost = 30;
				spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_WIS]);
				spell->fn = hell_lance_spell;
			}
			break;

		case CLASS_WARRIOR_MAGE:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 50, p_ptr->stat_ind[A_INT]);
			spell->fn = hp_to_sp_spell;

			spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 50, p_ptr->stat_ind[A_INT]);
			spell->fn = sp_to_hp_spell;
			break;
		}
		case CLASS_CHAOS_WARRIOR:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 40;
			spell->cost = 50;
			spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_INT]);
			spell->fn = confusing_lights_spell;
			break;
		}
		case CLASS_MONK:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = monk_posture_spell;

			spell = &spells[ct++];
			spell->level = 30;
			spell->cost = 30;
			spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_STR]);
			spell->fn = monk_double_attack_spell;
			break;
		}
		case CLASS_TOURIST:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = take_photo_spell;

			spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 20;
			spell->fail = calculate_fail_rate(spell->level, 30, p_ptr->stat_ind[A_INT]);
			spell->fn = identify_fully_spell;
			break;
		}
		case CLASS_IMITATOR:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 30;
			spell->cost = 100;
			spell->fail = calculate_fail_rate(spell->level, 90, p_ptr->stat_ind[A_DEX]);
			spell->fn = double_revenge_spell;
			break;
		}
		case CLASS_BEASTMASTER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_CHR]);
			spell->fn = dominate_living_I_spell;

			spell = &spells[ct++];
			spell->level = 30;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_CHR]);
			spell->fn = dominate_living_II_spell;
			break;
		}
		case CLASS_ARCHER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = create_ammo_spell;
			break;
		}
		case CLASS_MAGIC_EATER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = absorb_magic_spell;
			break;
		}
		case CLASS_BARD:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = bard_stop_singing_spell;
			break;
		}
		case CLASS_RED_MAGE:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 48;
			spell->cost = 20;
			spell->fail = 0;
			spell->fn = double_magic_spell;
			break;
		}
		case CLASS_SAMURAI:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = samurai_concentration_spell;

			spell = &spells[ct++];
			spell->level = 25;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = samurai_posture_spell;
			break;
		}
		case CLASS_BLUE_MAGE:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = blue_learning_spell;
			break;
		}
		case CLASS_CAVALRY:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 10;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 50, p_ptr->stat_ind[A_STR]);
			spell->fn = rodeo_spell;
			break;
		}
		case CLASS_BERSERKER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 10;
			spell->cost = 10;
			spell->fail = calculate_fail_rate(spell->level, 70, p_ptr->stat_ind[A_DEX]);
			spell->fn = recall_spell;
			break;
		}
		case CLASS_MIRROR_MASTER:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 1;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = break_mirrors_spell;

			spell = &spells[ct++];
			spell->level = 30;
			spell->cost = 0;
			spell->fail = calculate_fail_rate(spell->level, 50, p_ptr->stat_ind[A_INT]);
			spell->fn = mirror_concentration_spell;
			break;
		}
		case CLASS_SMITH:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 5;
			spell->cost = 15;
			spell->fail = calculate_fail_rate(spell->level, 80, p_ptr->stat_ind[A_INT]);
			spell->fn = smith_judgment_spell;
			break;
		}
		case CLASS_NINJA:
		{
			spell_info* spell = &spells[ct++];
			spell->level = 20;
			spell->cost = 0;
			spell->fail = 0;
			spell->fn = quick_walk_spell;
			break;
		}
	}

	return ct;
}