diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd6.cc | 106 | ||||
-rw-r--r-- | src/cmd7.cc | 1027 | ||||
-rw-r--r-- | src/cmd7.hpp | 3 | ||||
-rw-r--r-- | src/defines.h | 17 | ||||
-rw-r--r-- | src/dungeon.cc | 10 | ||||
-rw-r--r-- | src/help.cc | 41 | ||||
-rw-r--r-- | src/loadsave.cc | 12 | ||||
-rw-r--r-- | src/object1.cc | 65 | ||||
-rw-r--r-- | src/object1.hpp | 2 | ||||
-rw-r--r-- | src/object2.cc | 61 | ||||
-rw-r--r-- | src/player_type.hpp | 6 | ||||
-rw-r--r-- | src/q_fireprof.cc | 32 | ||||
-rw-r--r-- | src/rune_spell.hpp | 15 | ||||
-rw-r--r-- | src/rune_spell_fwd.hpp | 3 | ||||
-rw-r--r-- | src/skills.cc | 3 | ||||
-rw-r--r-- | src/skills_defs.hpp | 1 | ||||
-rw-r--r-- | src/store.cc | 10 | ||||
-rw-r--r-- | src/tables.cc | 10 |
18 files changed, 29 insertions, 1395 deletions
diff --git a/src/cmd6.cc b/src/cmd6.cc index f7261a96..80a033eb 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -61,12 +61,6 @@ using boost::algorithm::iequals; /* - * Forward declare - */ -static bool_ activate_spell(object_type * o_ptr, byte choice); - - -/* * General function to find an item by its name */ static select_by_name_t select_object_by_name(std::string const &prompt) @@ -4807,8 +4801,6 @@ void do_cmd_activate(void) int item, lev, chance; - char ch, spell_choice; - /* Get an item */ command_wrk = USE_EQUIP; if (!get_item(&item, @@ -4892,15 +4884,8 @@ void do_cmd_activate(void) /* Check the recharge */ if (o_ptr->timeout) { - /* Mage Staff of Spells -- Have another timeout in xtra2 */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL) && o_ptr->xtra2) - { - msg_print("It whines, glows and fades..."); - return; - } - /* Monster eggs */ - else if (o_ptr->tval == TV_EGG) + if (o_ptr->tval == TV_EGG) { msg_print("You resume the development of the egg."); o_ptr->timeout = 0; @@ -4936,61 +4921,6 @@ void do_cmd_activate(void) return; } - /* Mage Staff of Spells */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - while (TRUE) - { - if (!get_com("Use Spell [1] or [2]?", &ch)) - { - return; - } - - if (ch == '1') - { - spell_choice = 1; - break; - } - - if (ch == '2') - { - spell_choice = 2; - break; - } - } - - if (spell_choice == 1) - { - /* Still need to check timeouts because there is another counter */ - if (o_ptr->timeout) - { - msg_print("The first spell is still charging!"); - return; - } - - /* Cast spell 1 */ - activate_spell(o_ptr, spell_choice); - } - else if (spell_choice == 2) - { - /* Still need to check timeouts because there is another counter */ - if (o_ptr->xtra2) - { - msg_print("The second spell is still charging!"); - return; - } - - /* Cast spell 2 */ - activate_spell(o_ptr, spell_choice); - } - - /* Window stuff */ - p_ptr->window |= (PW_INVEN | PW_EQUIP); - - /* Success */ - return; - } - /* Monster eggs */ if (o_ptr->tval == TV_EGG) { @@ -7751,37 +7681,3 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) return NULL; } - - -static bool_ activate_spell(object_type * o_ptr, byte choice) -{ - int mana = 0, gf = 0, mod = 0; - - rune_spell s_ptr; - - - if (choice == 1) - { - gf = o_ptr->pval & 0xFFFF; - mod = o_ptr->pval3 & 0xFFFF; - mana = o_ptr->pval2 & 0xFF; - } - else if (choice == 2) - { - gf = o_ptr->pval >> 16; - mod = o_ptr->pval3 >> 16; - mana = o_ptr->pval2 >> 8; - } - - s_ptr.type = gf; - s_ptr.rune2 = 1 << mod; - s_ptr.mana = mana; - - /* Execute */ - rune_exec(&s_ptr, 0); - - if (choice == 1) o_ptr->timeout = mana * 5; - if (choice == 2) o_ptr->xtra2 = mana * 5; - - return (TRUE); -} diff --git a/src/cmd7.cc b/src/cmd7.cc index 48747cfb..4d491416 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -2421,23 +2421,6 @@ void do_cmd_necromancer(void) } /* - * Hook to determine if an object is "runestone" - */ -static bool item_tester_hook_runestone(object_type const *o_ptr) -{ - return ((o_ptr->tval == TV_RUNE2) && - (o_ptr->sval == RUNE_STONE) && - (o_ptr->pval == 0)); -} - -static bool item_tester_hook_runestone_full(object_type const *o_ptr) -{ - return ((o_ptr->tval == TV_RUNE2) && - (o_ptr->sval == RUNE_STONE) && - (o_ptr->pval != 0)); -} - -/* * math.h(sqrt) is banned of angband so ... :) */ s32b sroot(s32b n) @@ -2459,1016 +2442,6 @@ s32b sroot(s32b n) } -/* - * Damage formula, for runes - */ -void rune_calc_power(s32b *power, s32b *powerdiv) -{ - /* Not too weak power(paranoia) */ - *power = (*power < 1) ? 1 : *power; - *power += 3; - - *power = 37 * sroot(*power) / 10; - - /* To reduce the high level power, while increasing the low levels */ - *powerdiv = *power / 3; - if (*powerdiv < 1) *powerdiv = 1; - - /* Use the spell multiplicator */ - *power *= (p_ptr->to_s / 2) ? (p_ptr->to_s / 2) : 1; -} - - -/* - * Return percentage chance of runespell failure. - */ -int spell_chance_rune(rune_spell* spell) -{ - int chance, minfail; - - s32b power = spell->mana, power_rune = 0, powerdiv = 0; - - - if (spell->rune2 & RUNE_POWER_SURGE) - { - power_rune += 4; - } - if (spell->rune2 & RUNE_ARMAGEDDON) - { - power_rune += 3; - } - if (spell->rune2 & RUNE_SPHERE) - { - power_rune += 2; - } - if (spell->rune2 & RUNE_RAY) - { - power_rune += 1; - } - - rune_calc_power(&power, &powerdiv); - - chance = (5 * power_rune) + (power); - - /* Reduce failure rate by INT/WIS adjustment */ - chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 1); - - /* Extract the minimum failure rate */ - minfail = adj_mag_fail[p_ptr->stat_ind[A_DEX]]; - - /* Return the chance */ - return clamp_failure_chance(chance, minfail); -} - - -/* - * Combine the Runes - */ -int rune_exec(rune_spell *spell, int cost) -{ - int dir, power_rune = 0, mana_used, plev = get_skill(SKILL_RUNECRAFT); - - int chance; - - s32b power, powerdiv; - - int rad = 0, ty = -1, tx = -1, dam = 0, flg = 0; - - - if (spell->rune2 & RUNE_POWER_SURGE) - { - power_rune += 4; - } - if (spell->rune2 & RUNE_ARMAGEDDON) - { - power_rune += 3; - } - if (spell->rune2 & RUNE_SPHERE) - { - power_rune += 2; - } - if (spell->rune2 & RUNE_RAY) - { - power_rune += 1; - } - - - power = spell->mana; - - if (cost && ((power * cost / 100) > p_ptr->csp - (power_rune * (plev / 5)))) - { - power = p_ptr->csp - (power_rune * (plev / 5)); - mana_used = power + (power_rune * (plev / 5)); - } - else - { - mana_used = (power * cost / 100) + (power_rune * (plev / 5)); - } - - rune_calc_power(&power, &powerdiv); - - dam = damroll(powerdiv, power); - - if (wizard) msg_format("Rune %dd%d = dam %d", powerdiv, power, dam); - - /* Extract the base spell failure rate */ - chance = spell_chance_rune(spell); - - /* Failure ? */ - if (rand_int(100) < chance) - { - int insanity = (p_ptr->msane - p_ptr->csane) * 100 / p_ptr->msane; - char sfail[80]; - - /* Flush input if told so */ - flush_on_failure(); - - /* Insane players can see something strange */ - if (rand_int(100) < insanity) - { - get_rnd_line("sfail.txt", sfail); - msg_format("A cloud of %s appears above you.", sfail); - } - - /* Normal failure messages */ - else - { - msg_print("You failed to get the spell off!"); - } - - if (is_magestaff()) energy_use = 80; - else energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); - return (mana_used); - } - - if (spell->rune2 & RUNE_POWER_SURGE) - { - flg |= (PROJECT_VIEWABLE); - ty = p_ptr->py; - tx = p_ptr->px; - } - - if (spell->rune2 & RUNE_ARMAGEDDON) - { - flg |= (PROJECT_THRU); - flg |= (PROJECT_KILL); - flg |= (PROJECT_ITEM); - flg |= (PROJECT_GRID); - flg |= (PROJECT_METEOR_SHOWER); - rad = (power / 8 == 0) ? 1 : power / 8; - rad = (rad > 10) ? 10 : rad; - ty = p_ptr->py; - tx = p_ptr->px; - } - - if (spell->rune2 & RUNE_SPHERE) - { - flg |= (PROJECT_THRU); - flg |= (PROJECT_KILL); - flg |= (PROJECT_ITEM); - flg |= (PROJECT_GRID); - rad = (power / 8 == 0) ? 1 : power / 8; - rad = (rad > 10) ? 10 : rad; - ty = p_ptr->py; - tx = p_ptr->px; - } - - if (spell->rune2 & RUNE_RAY) - { - flg |= (PROJECT_THRU); - flg |= (PROJECT_KILL); - flg |= (PROJECT_BEAM); - ty = -1; - tx = -1; - } - if (spell->rune2 & RUNE_ARROW) - { - flg |= (PROJECT_THRU); - flg |= (PROJECT_STOP); - flg |= (PROJECT_KILL); - ty = -1; - tx = -1; - } - if (spell->rune2 & RUNE_SELF) - { - flg |= (PROJECT_THRU); - flg |= (PROJECT_STOP); - flg |= (PROJECT_KILL); - ty = p_ptr->py; - tx = p_ptr->px; - unsafe = TRUE; - } - - if ((ty == -1) && (tx == -1)) - { - if (!get_aim_dir(&dir)) return (mana_used); - - /* Use the given direction */ - tx = p_ptr->px + ddx[dir]; - ty = p_ptr->py + ddy[dir]; - - /* Hack -- Use an actual "target" */ - if ((dir == 5) && target_okay()) - { - tx = target_col; - ty = target_row; - } - } - - if (flg & PROJECT_VIEWABLE) - { - project_hack(spell->type, dam); - } - else if (flg & PROJECT_METEOR_SHOWER) - { - project_meteor(rad, spell->type, dam, flg); - } - else project(0, rad, ty, tx, dam, spell->type, flg); - - if (unsafe) unsafe = FALSE; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); - - return (mana_used); -} - - -/* - * Test if all runes needed at in the player p_ptr->inventory - */ -bool_ test_runespell(rune_spell *spell) -{ - int i; - - object_type *o_ptr; - - bool_ typeok = FALSE; - - int rune2 = 0; - - - for (i = 0; i < INVEN_WIELD; i++) - { - o_ptr = &p_ptr->inventory[i]; - - if (!o_ptr->k_idx) continue; - - /* Does the rune1(type) match ? */ - if ((o_ptr->tval == TV_RUNE1) && (o_ptr->sval == spell->type)) - { - typeok = TRUE; - } - - if ((o_ptr->tval == TV_RUNE2) && (o_ptr->sval != RUNE_STONE)) - { - /* Add it to the list */ - rune2 |= 1 << o_ptr->sval; - } - } - - /* Need all runes to be present */ - return (typeok && ((rune2 & spell->rune2) == spell->rune2)); -} - - -/* - * Ask for rune, rune2 and mana - */ -bool_ get_runespell(rune_spell *spell) -{ - s32b rune_combine = 0; - - /* Lambda to use for selecting the secondary rune(s) */ - auto rune2_filter = [&](object_type const *o_ptr) -> bool { - return ((o_ptr->tval == TV_RUNE2) && - (o_ptr->sval != RUNE_STONE) && - (!(rune_combine & BIT(o_ptr->sval)))); - }; - - /* Prompt */ - const char *const q = "Use which rune? "; - const char *const s = "You have no rune to use."; - - /* Extract first rune for the base effect */ - int type = 0; - { - int item; - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR), object_filter::TVal(TV_RUNE1))) - { - return FALSE; - } - - object_type *o_ptr = get_object(item); - type = o_ptr->sval; - } - - /* Choose secondary rune(s) */ - int rune2 = 0; - while (1) - { - int item; - if (!get_item(&item, q, nullptr, (USE_INVEN | USE_FLOOR), rune2_filter)) - { - break; - } - - object_type *o_ptr = get_object(item); - - rune_combine |= 1 << o_ptr->sval; - rune2 |= 1 << o_ptr->sval; - } - - if (!rune2) - { - msg_print("You have not selected a second rune!"); - return (FALSE); - } - - int power_rune = 0; - int plev = get_skill(SKILL_RUNECRAFT); - s32b power = get_quantity("Which amount of Mana? ", - p_ptr->csp - (power_rune * (plev / 5))); - if (power < 1) - { - power = 1; - } - - spell->mana = power; - spell->type = type; - spell->rune2 = rune2; - - return (TRUE); -} - - -void do_cmd_rune(void) -{ - rune_spell spell; - - - /* Require some mana */ - if (p_ptr->csp <= 0) - { - msg_print("You have no mana!"); - return; - } - - /* Require lite */ - if (p_ptr->blind || no_lite()) - { - msg_print("You cannot see!"); - return; - } - - /* Not when confused */ - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - if (!get_runespell(&spell)) return; - - /* Execute at normal mana cost */ - p_ptr->csp -= rune_exec(&spell, 100); - - /* Safety :) */ - if (p_ptr->csp < 0) p_ptr->csp = 0; - - /* Take a turn */ - if (is_magestaff()) energy_use = 80; - else energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -/* - * Print a batch of runespells. - */ -static void print_runespell_batch(std::size_t batch, int max) -{ - prt(format(" %-30s Fail Mana Power", "Name"), 1, 20); - - int i; - for (i = 0; i < max; i++) - { - auto spell = &p_ptr->rune_spells[batch * 10 + i]; - - int power = spell->mana; - s32b powerdiv; - rune_calc_power(&power, &powerdiv); - - int const p = power; - int const dp = powerdiv; - - char buff[80]; - strnfmt(buff, 80, " %c) %-30s %4d%% %4d %dd%d ", I2A(i), spell->name, - spell_chance_rune(spell), spell->mana, dp, p); - - prt(buff, 2 + i, 20); - } - prt("", 2 + i, 20); -} - - - -/* - * List ten random spells and ask to pick one. - */ - -static rune_spell* select_runespell_from_batch(std::size_t batch, int *s_idx) -{ - auto &rune_spells = p_ptr->rune_spells; - - character_icky = TRUE; - - int const mut_max = (rune_spells.size() < (batch + 1) * 10) - ? rune_spells.size() - batch * 10 - : 10; - - char tmp[160]; - strnfmt(tmp, 160, "(a-%c, / to rename, - to comment) Select a power: ", - I2A(mut_max - 1)); - prt(tmp, 0, 0); - - rune_spell *ret = nullptr; - - while (1) - { - Term_save(); - - print_runespell_batch(batch, mut_max); - - char which = inkey(); - - Term_load(); - - if (which == ESCAPE) - { - *s_idx = -1; - ret = NULL; - break; - } - else if ((which == '*') || (which == '?') || (which == ' ')) - { - print_runespell_batch(batch, mut_max); - } - else if ((which == '\r') && (mut_max == 1)) - { - *s_idx = batch * 10; - ret = &rune_spells[batch * 10]; - break; - } - else if (which == '/') - { - prt("Rename which power: ", 0, 0); - which = tolower(inkey()); - - if (isalpha(which) && (A2I(which) <= mut_max)) - { - char out_val[30] = { '\0' }; - strcpy(out_val, rune_spells[batch*10 + A2I(which)].name); - if (get_string("Name this power: ", out_val, 29)) - { - strcpy(rune_spells[batch*10 + A2I(which)].name, out_val); - } - prt(tmp, 0, 0); - } - else - { - bell(); - prt(tmp, 0, 0); - } - } - else - { - which = tolower(which); - if (isalpha(which) && (A2I(which) < mut_max)) - { - *s_idx = batch * 10 + A2I(which); - ret = &rune_spells[batch * 10 + A2I(which)]; - break; - } - else - { - bell(); - } - } - } - - character_icky = FALSE; - - return (ret); -} - - -/* - * Pick a random spell from a menu - */ -static rune_spell* select_runespell(int *s_idx) -{ - auto const &rune_spells = p_ptr->rune_spells; - - char which; - - if (rune_spells.empty()) - { - msg_print("There are no runespells you can cast."); - return (NULL); - } - - std::size_t batch_max = (rune_spells.size() - 1) / 10; - - character_icky = TRUE; - Term_save(); - - { - char tmp[160]; - strnfmt(tmp, 160, "(a-%c) Select batch of powers: ", I2A(batch_max)); - prt(tmp, 0, 0); - } - - while (1) - { - which = inkey(); - - if (which == ESCAPE) - { - Term_load(); - character_icky = FALSE; - return (NULL); - } - else if ((which == '\r') && (batch_max == 0)) - { - Term_load(); - character_icky = FALSE; - return (select_runespell_from_batch(0, s_idx)); - - } - else - { - which = tolower(which); - if (isalpha(which) && (static_cast<size_t>(A2I(which)) <= batch_max)) - { - Term_load(); - character_icky = FALSE; - return (select_runespell_from_batch(A2I(which), s_idx)); - } - else - { - bell(); - } - } - } -} - - -/* - * Cast a memorized runespell - * Note that the only limits are antimagic & conf, NOT blind - */ -static void do_cmd_rune_cast() -{ - /* Require some mana */ - if (p_ptr->csp <= 0) - { - msg_print("You have no mana!"); - return; - } - - /* No magic */ - if (p_ptr->antimagic) - { - msg_print("Your anti-magic field disrupts any magic attempts."); - return; - } - - /* No magic */ - if (p_ptr->anti_magic) - { - msg_print("Your anti-magic shell disrupts any magic attempts."); - return; - } - - /* Not when confused */ - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - int s_idx; - rune_spell *s_ptr; - s_ptr = select_runespell(&s_idx); - - if (s_ptr == NULL) return; - - /* Need the runes */ - if (!test_runespell(s_ptr)) - { - msg_print("You lack some essential rune(s) for this runespell!"); - return; - } - - /* Execute at normal mana cost */ - p_ptr->csp -= rune_exec(s_ptr, 100); - - /* Safety :) */ - if (p_ptr->csp < 0) p_ptr->csp = 0; - - /* Take a turn */ - if (is_magestaff()) energy_use = 80; - else energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -/* - * Cast a runespell from a carved runestone - */ -void do_cmd_runestone() -{ - rune_spell s_ptr; - - int item; - - - /* Require some mana */ - if (p_ptr->csp <= 0) - { - msg_print("You have no mana!"); - return; - } - - /* Require lite */ - if (p_ptr->blind || no_lite()) - { - msg_print("You cannot see!"); - return; - } - - /* Not when confused */ - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - /* No magic */ - if (p_ptr->antimagic) - { - msg_print("Your anti-magic field disrupts any magic attempts."); - return; - } - - /* No magic */ - if (p_ptr->anti_magic) - { - msg_print("Your anti-magic shell disrupts any magic attempts."); - return; - } - - /* Get an item */ - if (!get_item(&item, - "Cast from which runestone? ", - "You have no runestone to cast from.", - (USE_INVEN | USE_FLOOR), - item_tester_hook_runestone_full)) - { - return; - } - - /* Get the item */ - object_type *o_ptr = get_object(item); - - s_ptr.type = o_ptr->pval; - s_ptr.rune2 = o_ptr->pval2; - s_ptr.mana = o_ptr->pval3; - - /* Execute less mana */ - p_ptr->csp -= rune_exec(&s_ptr, 75); - - /* Safety :) */ - if (p_ptr->csp < 0) p_ptr->csp = 0; - - /* Take a turn */ - energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -/* - * Add a runespell to the list - */ -void do_cmd_rune_add_mem() -{ - auto &rune_spells = p_ptr->rune_spells; - - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - if (rune_spells.size() >= MAX_RUNES) - { - msg_print("You have already learned the maximum number of runespells!"); - return; - } - - rune_spell s_ptr; - if (!get_runespell(&s_ptr)) return; - - // Create the new rune spell - rune_spell ds; - ds.type = s_ptr.type; - ds.rune2 = s_ptr.rune2; - ds.mana = s_ptr.mana; - strcpy(ds.name, "Unnamed Runespell"); - - get_string("Name this runespell: ", ds.name, 29); - - // Add to list - rune_spells.emplace_back(ds); - - /* Take a turn */ - energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -/* - * Carve a runespell onto a Runestone - */ -void do_cmd_rune_carve() -{ - /* Not when confused */ - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - /* Require lite */ - if (p_ptr->blind || no_lite()) - { - msg_print("You cannot see!"); - return; - } - - if (!get_check("Beware, this will destroy the involved runes, continue?")) - { - return; - } - - rune_spell s_ptr; - if (!get_runespell(&s_ptr)) - { - return; - } - - /* Get an item */ - int item; - if (!get_item(&item, - "Use which runestone? ", - "You have no runestone to use.", - (USE_INVEN | USE_FLOOR), - item_tester_hook_runestone)) - { - return; - } - - /* Get the item */ - object_type *o_ptr = get_object(item); - - o_ptr->pval = s_ptr.type; - o_ptr->pval2 = s_ptr.rune2; - o_ptr->pval3 = s_ptr.mana; - - /* Start with old inscription */ - char out_val[80]; - strcpy(out_val, o_ptr->inscription.c_str()); - - /* Get a new inscription (possibly empty) */ - if (get_string("Name this runestone: ", out_val, 80)) - { - /* Save the inscription */ - o_ptr->inscription = out_val; - - /* Combine the pack */ - p_ptr->notice |= (PN_COMBINE); - - /* Window stuff */ - p_ptr->window |= (PW_INVEN | PW_EQUIP); - } - - /* Delete the runes */ - for (int i = 0; i < INVEN_WIELD; i++) - { - o_ptr = &p_ptr->inventory[i]; - - if (o_ptr->k_idx) - { - bool_ do_del = FALSE; - - if ((o_ptr->tval == TV_RUNE1) && (o_ptr->sval == s_ptr.type)) do_del = TRUE; - if ((o_ptr->tval == TV_RUNE2) && (BIT(o_ptr->sval) & s_ptr.rune2)) do_del = TRUE; - - if (do_del) - { - inc_stack_size_ex(i, -1, OPTIMIZE, NO_DESCRIBE); - } - } - } - - /* Take a turn -- Carving takes a LONG time */ - energy_use = 400; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -/* - * Remove a runespell - */ -void do_cmd_rune_del() -{ - auto &rune_spells = p_ptr->rune_spells; - - if (p_ptr->confused) - { - msg_print("You are too confused!"); - return; - } - - rune_spell *s_ptr; - int s_idx; - s_ptr = select_runespell(&s_idx); - - if (s_ptr == NULL) return; - - /* Delete */ - rune_spells.erase(rune_spells.begin() + s_idx); - - /* Take a turn */ - energy_use = 100; - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - p_ptr->redraw |= (PR_FRAME); -} - - -void do_cmd_rune_add() -{ - int ext = 0; - - char ch; - - - /* Select what to do */ - while (TRUE) - { - if (!get_com("Add to [M]emory(need runes to cast) or " - "Carve a [R]unestone(less mana to cast)", &ch)) - { - ext = 0; - break; - } - if ((ch == 'M') || (ch == 'm')) - { - ext = 1; - break; - } - if ((ch == 'R') || (ch == 'r')) - { - ext = 2; - break; - } - } - - switch (ext) - { - /* Create a Spell in memory */ - case 1: - { - do_cmd_rune_add_mem(); - break; - } - - /* Carve a Runestone */ - case 2: - { - do_cmd_rune_carve(); - break; - } - } -} - - -void do_cmd_runecrafter() -{ - int ext = 0; - - char ch; - - - /* Select what to do */ - while (TRUE) - { - if (!get_com("Rune Spell:[C]reate, [D]elete, C[a]st, D[i]rectly Cast " - "or Use [R]unestone", &ch)) - { - ext = 0; - break; - } - if ((ch == 'C') || (ch == 'c')) - { - ext = 1; - break; - } - if ((ch == 'D') || (ch == 'd')) - { - ext = 2; - break; - } - if ((ch == 'A') || (ch == 'a')) - { - ext = 3; - break; - } - if ((ch == 'I') || (ch == 'i')) - { - ext = 4; - break; - } - if ((ch == 'R') || (ch == 'r')) - { - ext = 5; - break; - } - } - - switch (ext) - { - /* Create a Spell */ - case 1: - { - do_cmd_rune_add(); - break; - } - - /* Delete a Spell */ - case 2: - { - do_cmd_rune_del(); - break; - } - - /* Cast a Spell */ - case 3: - { - do_cmd_rune_cast(); - break; - } - - /* Directly Cast a Spell */ - case 4: - { - do_cmd_rune(); - break; - } - - /* Cast a Runestone */ - case 5: - { - do_cmd_runestone(); - break; - } - } -} - - void do_cmd_unbeliever_antimagic() { if (get_skill(SKILL_ANTIMAGIC) < 20) diff --git a/src/cmd7.hpp b/src/cmd7.hpp index 162e5461..0c650210 100644 --- a/src/cmd7.hpp +++ b/src/cmd7.hpp @@ -1,12 +1,10 @@ #pragma once #include "h-basic.h" -#include "rune_spell_fwd.hpp" #include "object_type_fwd.hpp" extern void do_cmd_pray(void); extern void do_cmd_create_boulder(void); -extern int rune_exec(rune_spell *spell, int cost); extern void necro_info(char *p, int power); extern void mindcraft_info(char *p, int power); extern void symbiotic_info(char *p, int power); @@ -22,7 +20,6 @@ extern void do_cmd_archer(void); extern void do_cmd_set_piercing(void); extern void do_cmd_necromancer(void); extern void do_cmd_unbeliever(void); -extern void do_cmd_runecrafter(void); extern void do_cmd_symbiotic(void); extern s32b sroot(s32b n); extern int clamp_failure_chance(int chance, int minfail); diff --git a/src/defines.h b/src/defines.h index 7f43e7f4..fe690e2b 100644 --- a/src/defines.h +++ b/src/defines.h @@ -381,7 +381,6 @@ #define MKEY_MIMIC 6 #define MKEY_NECRO 7 #define MKEY_POWER_MAGE 8 -#define MKEY_RUNE 9 #define MKEY_FORGING 10 #define MKEY_INCARNATION 11 #define MKEY_SUMMON 13 @@ -654,7 +653,6 @@ #define EGO_MANA 1 #define EGO_POWER 2 #define EGO_MANA_POWER 3 -#define EGO_MSTAFF_SPELL 4 #define EGO_BRAND_POIS 77 #define EGO_BRAND_ELEC 74 #define EGO_BRAND_FIRE 75 @@ -972,8 +970,6 @@ #define TV_HYPNOS 99 /* To wield monsters !:) */ #define TV_GOLD 100 /* Gold can only be picked up by players */ #define TV_RANDART 102 /* Random Artifacts */ -#define TV_RUNE1 104 /* Base runes */ -#define TV_RUNE2 105 /* Modifier runes */ #define TV_BOOK 111 #define TV_SYMBIOTIC_BOOK 112 @@ -2173,19 +2169,6 @@ #define FATE_DIE 6 /* - * Runes definition - */ -#define RUNE_SELF 0x00000001 -#define RUNE_ARROW 0x00000002 -#define RUNE_RAY 0x00000004 -#define RUNE_SPHERE 0x00000008 -#define RUNE_POWER_SURGE 0x00000010 -#define RUNE_ARMAGEDDON 0x00000020 -#define RUNE_MOD_MAX 6 -#define RUNE_STONE 0x000000FF - - -/* * Defines of the different dungeon types */ #define DUNGEON_WILDERNESS 0 diff --git a/src/dungeon.cc b/src/dungeon.cc index e4946959..c1170c93 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -2815,16 +2815,6 @@ static void process_world(void) j++; } } - - /* Recharge second spell in Mage Staffs of Spells */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL) && (o_ptr->xtra2 > 0)) - { - /* Recharge */ - o_ptr->xtra2--; - - /* Notice changes */ - if (o_ptr->xtra2 == 0) j++; - } } /* Notice changes */ diff --git a/src/help.cc b/src/help.cc index 2c5da549..43d4873f 100644 --- a/src/help.cc +++ b/src/help.cc @@ -24,25 +24,24 @@ #include "variable.hpp" #define DESC_MAX 14 -#define TRIGGERED_HELP_MAX 17 +#define TRIGGERED_HELP_MAX 16 #define HELP_VOID_JUMPGATE 0 #define HELP_FOUNTAIN 1 #define HELP_FOUND_OBJECT 2 #define HELP_FOUND_ALTAR 3 #define HELP_FOUND_STAIR 4 -#define HELP_GET_RUNE 5 -#define HELP_GET_ROD 6 -#define HELP_GET_ROD_TIP 7 -#define HELP_GET_DEVICE 8 -#define HELP_WILDERNESS 9 -#define HELP_GAME_TOME 10 -#define HELP_GAME_THEME 11 -#define HELP_1ST_LEVEL 12 -#define HELP_20TH_LEVEL 13 -#define HELP_ID_SPELL_ITM 14 -#define HELP_MELEE_SKILLS 15 -#define HELP_MON_ASK_HELP 16 +#define HELP_GET_ROD 5 +#define HELP_GET_ROD_TIP 6 +#define HELP_GET_DEVICE 7 +#define HELP_WILDERNESS 8 +#define HELP_GAME_TOME 9 +#define HELP_GAME_THEME 10 +#define HELP_1ST_LEVEL 11 +#define HELP_20TH_LEVEL 12 +#define HELP_ID_SPELL_ITM 13 +#define HELP_MELEE_SKILLS 14 +#define HELP_MON_ASK_HELP 15 /** * Game started? @@ -179,7 +178,6 @@ context_help_type class_table[] = { "Priest(Manwe)", "c_pr_man.txt", 0 }, { "Ranger", "c_ranger.txt", 0 }, { "Rogue", "c_rogue.txt", 0 }, - { "Runecrafter", "c_runecr.txt", 0 }, { "Sorceror", "c_sorcer.txt", 0 }, { "Summoner", "c_summon.txt", 0 }, { "Swordmaster", "c_swordm.txt", 0 }, @@ -267,7 +265,6 @@ context_help_type skill_table[] = { "Polearm-mastery", "skills.txt", 7 }, { "Possession", "skills.txt", 45 }, { "Prayer", "skills.txt", 39 }, - { "Runecraft", "skills.txt", 36 }, { "Sling-mastery", "skills.txt", 9 }, { "Sneakiness", "skills.txt", 14 }, { "Spell-power", "skills.txt", 22 }, @@ -333,12 +330,6 @@ static bool_ trigger_found_stairs(void *in, void *out) { return (cave[p->y][p->x].feat == FEAT_MORE); } -static bool_ trigger_get_rune(void *in, void *out) { - hook_get_in *g = (hook_get_in *) in; - return ((g->o_ptr->tval == TV_RUNE1) || - (g->o_ptr->tval == TV_RUNE2)); -} - static bool_ trigger_get_rod(void *in, void *out) { hook_get_in *g = (hook_get_in *) in; return (g->o_ptr->tval == TV_ROD_MAIN); @@ -444,14 +435,6 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] = "But be ready to fight what lies within, for it might not be too friendly.", NULL } }, - { HELP_GET_RUNE, - HOOK_GET, - trigger_get_rune, - { "Ah, a rune! Runes are used with the Runecraft skill to allow you to", - "create spells on your own.", - NULL - } - }, { HELP_GET_ROD, HOOK_GET, trigger_get_rod, diff --git a/src/loadsave.cc b/src/loadsave.cc index e91e8993..731efab2 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -493,15 +493,6 @@ static void do_random_spell(random_spell *s_ptr, ls_flag_t flag) do_std_bool(&s_ptr->untried, flag); } -static void do_rune_spell(rune_spell *s_ptr, ls_flag_t flag) -{ - do_string(s_ptr->name, 30, flag); - do_s16b(&s_ptr->type, flag); - do_s16b(&s_ptr->rune2, flag); - do_s16b(&s_ptr->mana, flag); -} - - /* * Show information on the screen, one line at a time. * @@ -900,9 +891,6 @@ static bool_ do_extra(ls_flag_t flag) /* Random spells */ do_vector(flag, p_ptr->random_spells, do_random_spell); - /* Rune spells */ - do_vector(flag, p_ptr->rune_spells, do_rune_spell); - /* Random seed for object flavors. */ do_seed(&seed_flavor(), flag); diff --git a/src/object1.cc b/src/object1.cc index 4c065b24..8d2a2bb0 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -1358,23 +1358,6 @@ static std::string object_desc_aux(object_type const *o_ptr, int pref, int mode) break; } - case TV_RUNE2: - { - if (o_ptr->sval != RUNE_STONE) - { - modstr = basenm; - basenm = "& Rune~ [#]"; - } - break; - } - - case TV_RUNE1: - { - modstr = basenm; - basenm = "& Rune~ [#]"; - break; - } - case TV_DAEMON_BOOK: case TV_BOOK: { @@ -1980,16 +1963,6 @@ static std::string object_desc_aux(object_type const *o_ptr, int pref, int mode) } } - /* Indicate "charging" Mage Staffs XXX XXX XXX */ - if (known && o_ptr->timeout && (is_ego_p(o_ptr, EGO_MSTAFF_SPELL))) - { - t += " (charging spell1)"; - } - if (known && o_ptr->xtra2 && (is_ego_p(o_ptr, EGO_MSTAFF_SPELL))) - { - t += " (charging spell2)"; - } - /* No more details wanted */ if (mode < 3) @@ -2111,15 +2084,11 @@ void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode) * Determine the "Activation" (if any) for an artifact * Return a string, or NULL for "no activation" */ -cptr item_activation(object_type *o_ptr, byte num) +cptr item_activation(object_type *o_ptr) { - auto const &k_info = game->edit_data.k_info; auto const &a_info = game->edit_data.a_info; auto const &e_info = game->edit_data.e_info; - /* Needed hacks */ - static char rspell[2][80]; - /* Extract the flags */ auto const flags = object_flags(o_ptr); @@ -2134,29 +2103,6 @@ cptr item_activation(object_type *o_ptr, byte num) * for art_name */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - int gf, mod, mana; - - if (!num) - { - gf = o_ptr->pval & 0xFFFF; - mod = o_ptr->pval3 & 0xFFFF; - mana = o_ptr->pval2 & 0xFF; - } - else - { - gf = o_ptr->pval >> 16; - mod = o_ptr->pval3 >> 16; - mana = o_ptr->pval2 >> 8; - } - sprintf(rspell[num], "runespell(%s, %s, %d) every %d turns", - k_info[lookup_kind(TV_RUNE1, gf)].name, - k_info[lookup_kind(TV_RUNE2, mod)].name, - mana, mana * 5); - return rspell[num]; - } - if (o_ptr->tval == TV_EGG) { return "stop or resume the egg development"; @@ -2589,14 +2535,7 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait if (flags & TR_ACTIVATE) { text_out("It can be activated for "); - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - text_out(item_activation(o_ptr, 0)); - text_out(" and "); - text_out(item_activation(o_ptr, 1)); - } - else - text_out(item_activation(o_ptr, 0)); + text_out(item_activation(o_ptr)); /* Mega-hack -- get rid of useless line for e.g. randarts */ if (flags & TR_ACTIVATE_NO_WIELD) diff --git a/src/object1.hpp b/src/object1.hpp index af055985..f585b013 100644 --- a/src/object1.hpp +++ b/src/object1.hpp @@ -36,7 +36,7 @@ extern void show_inven_full(); extern void show_equip_full(); extern void toggle_inven_equip(void); extern bool_ get_item(int *cp, cptr pmt, cptr str, int mode, object_filter_t const &filter = object_filter::True(), select_by_name_t const &select_by_name = select_by_name_t()); -extern cptr item_activation(object_type *o_ptr,byte num); +extern cptr item_activation(object_type *o_ptr); extern void py_pickup_floor(int pickup); extern void object_gain_level(object_type *o_ptr); extern byte object_attr(object_type const *o_ptr); diff --git a/src/object2.cc b/src/object2.cc index 95fcf041..51fdcb95 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -1505,17 +1505,6 @@ bool_ object_similar(object_type const *o_ptr, object_type const *j_ptr) return FALSE; } - case TV_RUNE1: - { - return TRUE; - } - - case TV_RUNE2: - { - if ((o_ptr->sval == RUNE_STONE) || (j_ptr->sval == RUNE_STONE)) return FALSE; - else return TRUE; - } - case TV_INSTRUMENT: { return FALSE; @@ -2559,29 +2548,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power) { case TV_MSTAFF: { - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - int gf[2], i; - - for (i = 0; i < 2; i++) - { - int k = 0; - - gf[i] = 0; - while (!k) - { - k = lookup_kind(TV_RUNE1, (gf[i] = rand_int(MAX_GF))); - } - } - - o_ptr->pval = gf[0] + (gf[1] << 16); - o_ptr->pval3 = rand_int(RUNE_MOD_MAX) + (rand_int(RUNE_MOD_MAX) << 16); - o_ptr->pval2 = randint(70) + (randint(70) << 8); - } - else - { - o_ptr->art_flags |= (TR_SPELL_CONTAIN | TR_WIELD_CAST); - } + o_ptr->art_flags |= (TR_SPELL_CONTAIN | TR_WIELD_CAST); break; } case TV_BOLT: @@ -4212,15 +4179,7 @@ try_an_other_ego: /* Spell in it ? No! */ if (flags & TR_SPELL_CONTAIN) { - /* Mega hack, mage staves of spell cannot SPELL_CONTAIN */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - o_ptr->art_flags &= ~TR_SPELL_CONTAIN; - } - else - { - o_ptr->pval2 = -1; - } + o_ptr->pval2 = -1; } /* Cheat -- describe the item */ @@ -4251,15 +4210,7 @@ try_an_other_ego: /* Spell in it ? No! */ if (flags & TR_SPELL_CONTAIN) { - /* Mega hack, mage staves of spell cannot SPELL_CONTAIN */ - if (is_ego_p(o_ptr, EGO_MSTAFF_SPELL)) - { - o_ptr->art_flags &= ~TR_SPELL_CONTAIN; - } - else - { - o_ptr->pval2 = -1; - } + o_ptr->pval2 = -1; } /* Hacccccccckkkkk attack ! :) -- To prevent som ugly crashs */ @@ -4439,12 +4390,6 @@ static bool kind_is_theme(obj_theme const *theme, int k_idx) case TV_RANDART: prob = theme->magic; break; - case TV_RUNE1: - prob = theme->magic; - break; - case TV_RUNE2: - prob = theme->magic; - break; case TV_BOOK: prob = theme->magic; break; diff --git a/src/player_type.hpp b/src/player_type.hpp index 0015eaef..9b7ac21d 100644 --- a/src/player_type.hpp +++ b/src/player_type.hpp @@ -8,7 +8,6 @@ #include "object_type.hpp" #include "powers.hpp" #include "random_spell.hpp" -#include "rune_spell.hpp" #include "spellbinder.hpp" #include <array> @@ -412,11 +411,6 @@ struct player_type std::vector<random_spell> random_spells; /** - * Runecrafter's selfmade spells. - */ - std::vector<rune_spell> rune_spells; - - /** * Does the player have the given ability? */ bool has_ability(u16b ability_idx) const; diff --git a/src/q_fireprof.cc b/src/q_fireprof.cc index 693248e3..9e36ce5c 100644 --- a/src/q_fireprof.cc +++ b/src/q_fireprof.cc @@ -29,16 +29,16 @@ typedef struct fireproof_settings fireproof_settings; struct fireproof_settings { byte tval; /* tval of object to use. */ + byte sval; /* sval of object to use. */ cptr tval_name; /* descriptive name of tval */ cptr tval_name_plural; /* descriptive name of tval (plural) */ - byte sval_max; /* max sval of object to use; sval will be 1<=X<=sval_max. */ s32b total_points; /* total number of points awarded */ }; static fireproof_settings const *fireproof_get_settings() { static fireproof_settings fireproof_settings = - { TV_RUNE2, "rune", "runes", 5, 24 }; + { TV_SCROLL, SV_SCROLL_FIRE, "scroll", "scrolls", 24 }; return &fireproof_settings; } @@ -61,22 +61,13 @@ static void set_item_points_remaining(s32b v) cquest.data[0] = settings->total_points - v; } -static void fireproof_set_sval(int sval_max) -{ - cquest.data[1] = sval_max; -} - -static int fireproof_get_sval() -{ - return cquest.data[1]; -} - static bool item_tester_hook_eligible(object_type const *o_ptr) { + fireproof_settings const *settings = fireproof_get_settings(); /* check it's the 'marked' item */ - return ((o_ptr->tval == fireproof_get_settings()->tval) && - (o_ptr->sval == fireproof_get_sval()) && - (o_ptr->pval2 == fireproof_get_sval())); + return ((o_ptr->tval == settings->tval) && + (o_ptr->sval == settings->sval) && + (o_ptr->pval2 == settings->sval)); } static object_filter_t const &item_tester_hook_proofable() @@ -378,7 +369,7 @@ static bool_ fireproof_get_hook(void *, void *in_, void *) * generated via random object placement */ if ((p_ptr->inside_quest == QUEST_FIREPROOF) && (cquest.status != QUEST_STATUS_COMPLETED) && - (o_ptr->pval2 == fireproof_get_sval())) + (o_ptr->pval2 == fireproof_get_settings()->sval)) { /* ok mark the quest 'completed' */ cquest.status = QUEST_STATUS_COMPLETED; @@ -489,16 +480,13 @@ static bool_ fireproof_gen_hook(void *, void *, void *) /* no teleport */ dungeon_flags = DF_NO_TELEPORT; - /* determine type of item */ - fireproof_set_sval(randint(settings->sval_max)); - - /* create essence */ + /* create quest item */ { object_type forge; - object_prep(&forge, lookup_kind(settings->tval, fireproof_get_sval())); + object_prep(&forge, lookup_kind(settings->tval, settings->sval)); /* mark item */ - forge.pval2 = fireproof_get_sval(); + forge.pval2 = settings->sval; forge.inscription = "quest"; /* roll for co-ordinates in top half of map */ diff --git a/src/rune_spell.hpp b/src/rune_spell.hpp deleted file mode 100644 index e1e8d190..00000000 --- a/src/rune_spell.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "h-basic.h" - -/** - * Runecrafter prefered spells - */ -struct rune_spell -{ - char name[30] { '\0' }; /* name */ - - s16b type = 0; /* Type of the spell(GF) */ - s16b rune2 = 0; /* Modifiers */ - s16b mana = 0; /* Mana involved */ -}; diff --git a/src/rune_spell_fwd.hpp b/src/rune_spell_fwd.hpp deleted file mode 100644 index eb540a2a..00000000 --- a/src/rune_spell_fwd.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -struct rune_spell; diff --git a/src/skills.cc b/src/skills.cc index 652f925e..8572d07f 100644 --- a/src/skills.cc +++ b/src/skills.cc @@ -1127,9 +1127,6 @@ void do_cmd_activate_skill() case MKEY_POWER_MAGE: do_cmd_powermage(); break; - case MKEY_RUNE: - do_cmd_runecrafter(); - break; case MKEY_FORGING: do_cmd_archer(); break; diff --git a/src/skills_defs.hpp b/src/skills_defs.hpp index b21ea0fb..9bf3c9ce 100644 --- a/src/skills_defs.hpp +++ b/src/skills_defs.hpp @@ -36,7 +36,6 @@ #define SKILL_NECROMANCY 31 #define SKILL_MIMICRY 32 #define SKILL_ANTIMAGIC 33 -#define SKILL_RUNECRAFT 34 /* XXX */ #define SKILL_STEALTH 36 /* XXX */ diff --git a/src/store.cc b/src/store.cc index 8771fcd4..9d4e7f81 100644 --- a/src/store.cc +++ b/src/store.cc @@ -55,7 +55,6 @@ #define STORE_BOOKS "Book Store" #define STORE_PETS "Pet Shop" #define STORE_HUNTING_SUPPLIES "Hunting Supply Store" -#define STORE_RUNIC_MAGIC "Runic Magic Shop" #define STORE_CONSTRUCTION_SUPPLIES "Construction Supply Store" #define STORE_MUSIC "Music Store" @@ -819,15 +818,6 @@ static bool store_will_buy(object_type const *o_ptr) return true; } } - else if ((store_name == STORE_RUNIC_MAGIC)) - { - switch (o_ptr->tval) - { - case TV_RUNE1: - case TV_RUNE2: - return true; - } - } else if ((store_name == STORE_CONSTRUCTION_SUPPLIES)) { switch (o_ptr->tval) diff --git a/src/tables.cc b/src/tables.cc index f87db29c..22e9a98b 100644 --- a/src/tables.cc +++ b/src/tables.cc @@ -3724,8 +3724,6 @@ tval_desc tvals[] = { TV_MSTAFF, "Mage Staff" }, { TV_PARCHMENT, "Parchment" }, { TV_INSTRUMENT, "Musical Instrument" }, - { TV_RUNE1, "Rune 1" }, - { TV_RUNE2, "Rune 2" }, { TV_JUNK, "Junk" }, { 0, NULL } }; @@ -3886,14 +3884,6 @@ tval_desc tval_descs[] = "they can be activated for great or strange effects..." }, { - TV_RUNE1, - "Runes are used with the Runecraft skill to create brand new spells." - }, - { - TV_RUNE2, - "Runes are used with the Runecraft skill to create brand new spells." - }, - { TV_JUNK, "Junk is usually worthless, though experienced archers can " "create ammo with them." |