summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
committerBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
commit33e7dc3baa6b375efb6d8989ffe3c50511291228 (patch)
tree16c72b093ab53f33be5386a842450da8cdf117cf /src
parentcc50d2db6418690470ead3faf71e0818eff1b8e4 (diff)
Remove Alchemist class and associated skills/code
Alchemy has always been ridiculously broken and there's been a huge amount of horrible code to support it. Sorry to any fans of Alchemy, but it's got to go.
Diffstat (limited to 'src')
-rw-r--r--src/alchemist_recipe.hpp11
-rw-r--r--src/alchemist_recipe_fwd.hpp3
-rw-r--r--src/artifact_select_flag.hpp18
-rw-r--r--src/artifact_select_flag_fwd.hpp3
-rw-r--r--src/birth.cc10
-rw-r--r--src/cmd2.hpp1
-rw-r--r--src/cmd6.cc38
-rw-r--r--src/cmd7.cc3081
-rw-r--r--src/cmd7.hpp2
-rw-r--r--src/defines.h34
-rw-r--r--src/flags_group.hpp2
-rw-r--r--src/help.cc44
-rw-r--r--src/init1.cc383
-rw-r--r--src/init1.hpp1
-rw-r--r--src/init2.cc23
-rw-r--r--src/loadsave.cc20
-rw-r--r--src/object1.cc14
-rw-r--r--src/object2.cc11
-rw-r--r--src/object_kind.hpp2
-rw-r--r--src/q_fireprof.cc17
-rw-r--r--src/skills.cc3
-rw-r--r--src/skills_defs.hpp1
-rw-r--r--src/spells2.cc5
-rw-r--r--src/store.cc1
-rw-r--r--src/tables.cc15
-rw-r--r--src/variable.cc20
-rw-r--r--src/variable.hpp8
-rw-r--r--src/wizard1.cc244
-rw-r--r--src/xtra2.cc38
29 files changed, 26 insertions, 4027 deletions
diff --git a/src/alchemist_recipe.hpp b/src/alchemist_recipe.hpp
deleted file mode 100644
index e87531f6..00000000
--- a/src/alchemist_recipe.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "h-basic.h"
-
-struct alchemist_recipe
-{
- int sval_essence;
- byte tval;
- byte sval;
- byte qty;
-};
diff --git a/src/alchemist_recipe_fwd.hpp b/src/alchemist_recipe_fwd.hpp
deleted file mode 100644
index d1a8bb77..00000000
--- a/src/alchemist_recipe_fwd.hpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-struct alchemist_recipe;
diff --git a/src/artifact_select_flag.hpp b/src/artifact_select_flag.hpp
deleted file mode 100644
index 313f3a19..00000000
--- a/src/artifact_select_flag.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-#include "h-basic.h"
-
-struct artifact_select_flag {
- byte group; /* Flag group to display it in */
- int flag; /* item flag to set */
- byte level; /* Player skill level to start at */
- char *desc; /* Display this description to select flag */
- u32b xp; /* xp cost for this flag */
- bool_ pval; /* indicates this flag benifits from pval */
- char *item_desc; /* Description of required item */
- char *item_descp; /* Description of required item; plural */
- byte rtval; /* Required items' tval */
- byte rsval; /* Required items' sval */
- int rpval; /* Required items' pval (zero for no req) */
- int rflag[6]; /* Monster Race flags for required Corpses */
-};
diff --git a/src/artifact_select_flag_fwd.hpp b/src/artifact_select_flag_fwd.hpp
deleted file mode 100644
index f56ec3c9..00000000
--- a/src/artifact_select_flag_fwd.hpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-struct artifact_select_flag;
diff --git a/src/birth.cc b/src/birth.cc
index 9716cc8b..f6120a5a 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -891,9 +891,6 @@ static void player_wipe(void)
/* Reset "aware" */
k_ptr->aware = FALSE;
- /* Reset "know" */
- k_ptr->know = FALSE;
-
/* Reset "artifact" */
k_ptr->artifact = 0;
}
@@ -925,13 +922,6 @@ static void player_wipe(void)
/* Hack -- Well fed player */
p_ptr->food = PY_FOOD_FULL - 1;
- /* Wipe the alchemists' recipes */
- for ( i = 0 ; i < 32 ; i++)
- alchemist_known_egos[i] = 0;
- for ( i = 0 ; i < 6 ; i++)
- alchemist_known_artifacts[i] = 0;
- alchemist_gained = 0;
-
/* Clear "cheat" options */
cheat_peek = FALSE;
cheat_hear = FALSE;
diff --git a/src/cmd2.hpp b/src/cmd2.hpp
index 41030995..142238ab 100644
--- a/src/cmd2.hpp
+++ b/src/cmd2.hpp
@@ -30,5 +30,4 @@ extern void do_cmd_boomerang(void);
extern void do_cmd_immovable_special(void);
extern void fetch(int dir, int wgt, bool_ require_los);
extern void do_cmd_sacrifice(void);
-extern void do_cmd_create_artifact(object_type *q_ptr);
extern void do_cmd_steal(void);
diff --git a/src/cmd6.cc b/src/cmd6.cc
index 97ee2cb0..f27281db 100644
--- a/src/cmd6.cc
+++ b/src/cmd6.cc
@@ -2492,8 +2492,6 @@ void do_cmd_quaff_potion(void)
{
int ident, lev;
- object_type *q_ptr, forge;
-
/* Get an item */
int item;
if (!get_item(&item,
@@ -2548,22 +2546,6 @@ void do_cmd_quaff_potion(void)
gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
}
- if (get_skill(SKILL_ALCHEMY))
- {
- if (item >= 0)
- {
- q_ptr = &forge;
- object_prep(q_ptr, lookup_kind(TV_BOTTLE, 1));
- q_ptr->number = 1;
- object_aware(q_ptr);
- object_known(q_ptr);
-
- q_ptr->ident |= IDENT_STOREB;
-
- (void)inven_carry(q_ptr, FALSE);
- }
- }
-
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
@@ -3642,24 +3624,6 @@ void do_cmd_read_scroll(void)
/* Destroy scroll */
inc_stack_size(item, -1);
-
- /* Alchemists end up with a "drained" scroll instead */
- if (get_skill(SKILL_ALCHEMY))
- {
- if (item >= 0)
- {
- object_type *q_ptr, forge;
-
- q_ptr = &forge;
- object_prep(q_ptr, lookup_kind(TV_SCROLL, SV_SCROLL_NOTHING));
- object_aware(q_ptr);
- object_known(q_ptr);
-
- q_ptr->ident |= IDENT_STOREB;
-
- (void)inven_carry(q_ptr, FALSE);
- }
- }
}
@@ -5159,7 +5123,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item)
if (!spell && o_ptr->name1)
spell = a_info[o_ptr->name1].activate;
- /* Random and Alchemist Artifacts */
+ /* Random Artifacts */
if (!spell && o_ptr->art_name)
spell = o_ptr->xtra2;
diff --git a/src/cmd7.cc b/src/cmd7.cc
index 4338cb52..ef314efc 100644
--- a/src/cmd7.cc
+++ b/src/cmd7.cc
@@ -8,8 +8,6 @@
#include "cmd7.hpp"
-#include "alchemist_recipe.hpp"
-#include "artifact_select_flag.hpp"
#include "cave.hpp"
#include "cave_type.hpp"
#include "cmd1.hpp"
@@ -1199,3085 +1197,6 @@ void do_cmd_beastmaster(void)
/*
- * Set of variables and functions to create an artifact
- */
-
-
-/* LOG2 is a constant (compile-time) method of converting a single
- * set bit into a number. Works well, but for variable (runtime)
- * expressions, use a loop instead.. much smaller code*/
-#define LOG2(x) ( (x) & 0xFFFF? BLOG16(x) : BLOG16((x)>>16) + 16 )
-#define BLOG16(x) ( (x) & 0xFF ? BLOG8(x) : BLOG8 ((x)>>8 ) + 8 )
-#define BLOG8(x) ( (x) & 0xF ? BLOG4(x) : BLOG4 ((x)>>4 ) + 4 )
-#define BLOG4(x) ( (x) & 0x3 ? BLOG2(x) : BLOG2 ((x)>>2 ) + 2 )
-#define BLOG2(x) ( (x) & 0x1 ? 0 : 1 )
-
-int flags_select[32*5];
-int activation_select;
-
-/*
- Display a group of flags from a_select flags, and return
- the number of flags displayed (even invisible ones)
- */
-int show_flags(byte group, int pval)
-{
- int i, x, color = TERM_WHITE;
- int items = 0;
-
- char ttt[80];
-
- Term_clear();
-
- group++; /* Adjust - no zero group */
-
- for ( i = 0 ; a_select_flags[i].group ; i++)
- {
- if (a_select_flags[i].group != group)
- continue;
-
- if (a_select_flags[i].xp == 0)
- break;
- else
- {
- sprintf(ttt, "%c) %s",
- (items < 26) ? I2A(items) : ('0' + items - 26),
- a_select_flags[i].desc);
- if ( wizard )
- {
- sprintf(ttt, "%c) %s (exp " FMTu32b ")",
- (items < 26) ? I2A(items) : ('0' + items - 26),
- a_select_flags[i].desc,
- a_select_flags[i].xp);
- }
-
- /* Note: Somebody is VERY clever, and it wasn't me. Text printed as
- * TERM_DARK is actually printed as TERM_BLUE *SPACES* to prevent the
- * player from using a 'cut-and-paste' enabled terminal to see
- * what he shouldn't. Thus, simply setting the color to TERM_DARK
- * will entirely prevent the unspoiled player from knowing that it's
- * even possible. */
-
- switch (flags_select[i])
- {
- case 1:
- color = TERM_YELLOW;
- break; /* Flag was set by the player (just now)*/
- case 0:
- color = TERM_WHITE;
- break; /* This flag can be set, player is 'aware' of it*/
- case - 1:
- color = TERM_L_GREEN;
- break; /* Flag is already set*/
- case - 2:
- color = TERM_DARK;
- break; /* Invisible option */
- case - 3:
- color = TERM_RED;
- break; /* Flag is set, but player isn't 'aware' of it */
- case - 4:
- color = TERM_L_DARK;
- break; /* Flag is not set, player is 'aware', but it's beyond thier skill */
- default:
- color = TERM_DARK;
- break; /* Just in Case*/
- }
- }
-
- if (wizard && color == TERM_DARK)
- {
- color = TERM_BLUE;
- }
-
- if (items < 16) x = 5;
- else x = 45;
- c_prt(color, ttt, ((items < 16) ? items : items - 16) + 5, x);
- items++;
-
- }
- return items;
-}
-
-void show_levels(void)
-{
- Term_clear();
- c_prt(TERM_WHITE, "[a] Stats, sustains, luck, speed, vision, etc. ", 3, 10);
- c_prt(TERM_WHITE, "[b] Misc. (Auras, light, see invis, etc) ", 4, 10);
- c_prt(TERM_WHITE, "[c] Weapon Branding ", 5, 10);
- c_prt(TERM_WHITE, "[d] Resistances and Immunities ", 6, 10);
- c_prt(TERM_WHITE, "[e] ESP and Curses ", 7, 10);
- c_prt(TERM_WHITE, "[f] Activation ", 8, 10);
- c_prt(TERM_DARK , "[g] Abilities Gained ", 9, 10);
- c_prt(TERM_WHITE, "[h] Display Required Essences and items ", 10, 10);
- c_prt(TERM_WHITE, "[i] Done! Finalize and commit changes. ", 11, 10);
- /*No need to return anything - if the valid selections change, it'll be a code level change.*/
-}
-
-s32b get_flags_exp(int pval, int oldpval)
-{
- int i;
- s32b exp = 0;
-
- for (i = 0 ; a_select_flags[i].group ; i++ )
- {
- if (a_select_flags[i].xp == 0)
- break;
- else
- {
- if ( a_select_flags[i].group <= 5 && flags_select[i] )
- {
- s32b xp = a_select_flags[i].xp;
- int factor = 1, oldfactor = 0;
-
- /* don't even look at flags which the user can't set
- * because they also can't change the pval when a pval-
- * dependant flag is set, flags which they can't set
- * cannot effect the exp in any way, whether their set or not
- */
- if ( flags_select[i] < -1 )
- continue;
- if ( flags_select[i] == -1 )
- oldfactor = 1;
-
- if (a_select_flags[i].pval)
- {
- /* (1/4)x^2 + x
- * I wanted something smaller than x^2 or x^x
- * this is because although a ring of speed +10 is
- * more than 10 times better than a ring of speed +1,
- * I don't think it's 100 times better. More like 30.
- * this function yields:
- * 1=1 * 2=3 * 3=5 * 4=8 * 5=11 * 6=15 * 7=21
- * 8=24 * 9=29 * 10=35 * 11=41 * 12=48 * 13=55
- * 14=63 * 15=71 * 20=120 * 25=181 * 30=255
- * which I think is acceptable.
- * briefly, to get a +30 speed ring, it would be:
- * 255*50000 or over 12 million experience
- * points. For reference, a level 50 human requires
- * 5 million xp. I'm sure it's doable, but it'd be
- * *HARD*
- * a speed+10 artifact would require 1.75 million.
- * much more doable, but not too easily.
- */
- factor = (pval * pval / 4 + pval);
- if ( flags_select[i] == -1 )
- {
- oldfactor = oldpval * oldpval / 4 + oldpval;
- }
- }
- exp += xp * factor - xp * oldfactor;
- }
- if ( a_select_flags[i].group == 88 && a_select_flags[i].flag == -activation_select )
- {
- exp += a_select_flags[i].xp;
- }
- }
- }
-
- return exp;
-}
-
-/* returns the 'real quantity' of items needed to empower
- * a particular flag to a particular pval.
- * Note that this routine returns zero for any flag that
- * doesn't require some sort of action.
- */
-int calc_rqty(int i, int pval, int oldpval)
-{
- /* return 0 if flag is greater than size of flags_select && ! activation */
- if ( a_select_flags[i].group > 5 )
- {
- if ( activation_select == a_select_flags[i].flag)
- return 1;
- else
- return 0;
- }
-
- /* return 0 if the flag wasn't set */
- if ( flags_select[i] < -1 || flags_select[i] == 0 )
- return 0;
-
- /* Return change in pval if the flag was already set */
- if ( flags_select[i] == -1 && a_select_flags[i].pval)
- return pval - oldpval;
-
- /* Return pval if the flag will be set this time */
- else if ( a_select_flags[i].pval )
- return pval;
-
- /* Return 0 if the flag is unknown */
- else if ( flags_select[i] == -1 )
- return 0;
- return 1;
-}
-
-/* Handle the various items that creating artifacts requires.
- * Mode = 0 to print a description,
- * 1 to use up the items
- * -1 to check to see if the items exist
- * Note that this function is called ONLY from the
- * other artifact item helper function.
- */
-
-
-static int check_artifact_items(int pval, int oldpval, int mode)
-{
- int i, j, k, row = 1 , col = 15, rqty, orqty, trqty;
- bool_ good = TRUE;
- int temporary = -1;
- char ch;
-
- /* For temporary items, waive the item requirements,
- * except for the corpse... */
- for ( j = 0 ; a_select_flags[j].group ; j++)
- if (a_select_flags[j].flag == 4*32 && flags_select[j] == 1 )
- temporary = j;
- /* Check for enough items */
- for (i = 0; a_select_flags[i].group ; i++)
- {
- /* For temporary items, ignore
- everything except the one item
- */
- if (temporary != -1 && i != temporary)
- continue;
-
- /* Calc quantity is done per flag, because
- some have a pval, some don't, some where already
- set at pval=2, etc
- */
- rqty = orqty = calc_rqty(i, pval, oldpval);
-
- /* If no item is associated with this flag,
- or this flag wasn't set or didn't change */
- if ( !a_select_flags[i].rtval || !rqty)
- continue;
-
- for ( k = 0 ; k < INVEN_WIELD ; k++ )
- {
- object_type *o_ptr = &p_ptr->inventory[k];
-
- /* Note here that an rsval of -1 (which is read is 0xff
- for a byte..) matches anything. */
- if (o_ptr->tval == a_select_flags[i].rtval
- && (o_ptr->sval == a_select_flags[i].rsval
- || a_select_flags[i].rsval == (byte) - 1 ) )
- {
- /* Corpse validation is COMPLICATED!
- * But at least we don't have to do this twice.
- */
- if ( a_select_flags[i].rtval == TV_CORPSE )
- {
- bool_ itemgood = TRUE;
-
- /*Specified race not this one */
- if ( o_ptr->pval2 != a_select_flags[i].rpval && a_select_flags[i].rpval)
- continue;
-
- /* Race flag (any monster who...)*/
- for ( j = 0 ; !a_select_flags[i].rpval && a_select_flags[i].rflag[j] && j < 6 && itemgood ; j++)
- {
- int flag = a_select_flags[i].rflag[j] / 32;
- u32b mask = 1 << (a_select_flags[i].rflag[j] % 32);
-
- switch (flag)
- {
- case 0:
- if ( !(r_info[o_ptr->pval2].flags1 & mask) ) itemgood = FALSE;
- break;
- case 1:
- if ( !(r_info[o_ptr->pval2].flags2 & mask) ) itemgood = FALSE;
- break;
- case 2:
- if ( !(r_info[o_ptr->pval2].flags3 & mask) ) itemgood = FALSE;
- break;
- case 3:
- if ( !(r_info[o_ptr->pval2].flags4 & mask) ) itemgood = FALSE;
- break;
- case 4:
- if ( !(r_info[o_ptr->pval2].flags5 & mask) ) itemgood = FALSE;
- break;
- case 5:
- if ( !(r_info[o_ptr->pval2].flags6 & mask) ) itemgood = FALSE;
- break;
- case 6:
- if ( !(r_info[o_ptr->pval2].flags7 & mask) ) itemgood = FALSE;
- break;
- case 7:
- if ( !(r_info[o_ptr->pval2].flags8 & mask) ) itemgood = FALSE;
- break;
- case 8:
- if ( !(r_info[o_ptr->pval2].flags9 & mask) ) itemgood = FALSE;
- break;
- default:
- msg_print("This code should never be hit!");
- }
- }
- if ( ! itemgood )
- continue;
-
- }
- /* Validate pval of good item */
- else if ( a_select_flags[i].rpval)
- {
- /* Must have matching signs */
- if ( (o_ptr->pval < 0) != (a_select_flags[i].rpval < 0))
- continue;
- /* Must be greater than */
- if ( abs(o_ptr->pval) < abs(a_select_flags[i].rpval))
- continue;
- }
-
- trqty = MIN(o_ptr->number, rqty);
- rqty -= trqty;
-
- if ( mode == 1 )
- {
- inc_stack_size_ex(k, -trqty, NO_OPTIMIZE, DESCRIBE);
- }
- }/* if p_ptr->inventory item is acceptable */
-
- } /*end of looping through the p_ptr->inventory*/
-
- if (rqty)
- {
- good = FALSE;
- /* Oops, we didn't have enough of this object
- when actually creating the artifact.
- unset this flag
- */
- if ( mode == 1 )
- {
- flags_select[i] = -4;
- }
- /* we only return false for mode -1,
- * for mode 0 we display stuff, and for
- * mode 1 we want to continue destroying things
- * even if the player is missing one small item,
- * because there's no way to change things now.
- * We may have already destroyed a unique corpse,
- * or some other hard-to-find item.
- */
- if ( mode == -1 )
- return FALSE;
- }
-
- /* Display a description of the required object, if needed */
- /* Note that the tests for good items HAVE to be in a different
- place, because otherwise we don't know how many the player
- has, as opposed to how many they need.
- */
- if ( mode == 0 )
- {
- char *o_name = a_select_flags[i].item_desc;
- if (orqty > 1 && a_select_flags[i].pval && a_select_flags[i].item_descp)
- o_name = a_select_flags[i].item_descp;
-
- if ( rqty )
- {
- if ( orqty > 1 )
- c_prt(TERM_RED, format(" you are missing %d of the %d %s", rqty, orqty, o_name), row++, col);
- else if ( is_a_vowel(o_name[0]))
- c_prt(TERM_RED, format(" you are missing an %s", o_name), row++, col);
- else
- c_prt(TERM_RED, format(" you are missing a %s", o_name), row++, col);
- }
- else
- {
- if ( orqty > 1 )
- c_prt(TERM_GREEN, format(" you have the %d %s", orqty, o_name), row++, col);
- else if ( is_a_vowel(o_name[0]))
- c_prt(TERM_GREEN, format(" you have an %s", o_name), row++, col);
- else
- c_prt(TERM_GREEN, format(" you have a %s", o_name), row++, col);
- }
-
- if ( row > 21 )
- {
- row = 1;
- if (!good)
- (void)get_com("You are missing some items:", &ch);
- else
- (void)get_com("You have these needed items on hand:", &ch);
- }
-
- }
-
- } /* End of group associated with this a_select_flags entry */
-
- if ( mode == 0 )
- {
- while ( row < 22 )
- c_prt(TERM_GREEN, " ", row++, col);
- if (!good)
- (void)get_com("You are missing some items:", &ch);
- else
- (void)get_com("You have these needed items on hand:", &ch);
- }
- return good;
-}
-
-/* Display a list of required essences,
- * and/or use up the essences. */
-bool_ artifact_display_or_use(int pval, int oldpval, bool_ use)
-{
- int essence[MAX_BATERIE_SVAL];
- int essenceh[MAX_BATERIE_SVAL];
- int al_idx, i, j, k;
- bool_ enough;
-
- /* Temporary Items require only one item, and no essences. */
- for ( i = 0 ; a_select_flags[i].group ; i++)
- if ( a_select_flags[i].flag == 32*4)
- {
- if ( use )
- return check_artifact_items(pval, oldpval, 1);
- else
- return check_artifact_items(pval, oldpval, 0);
- }
-
- for ( i = 0 ; i < MAX_BATERIE_SVAL ; i++ )
- essence[i] = essenceh[i] = 0;
-
- /* Accumulate a list of required essences */
- for ( al_idx = 0; al_idx < max_al_idx ; al_idx++ )
- if ( alchemist_recipes[al_idx].tval == 0 )
- for ( i = 0 ; a_select_flags[i].group ; i++)
- {
- int rqty = calc_rqty(i, pval, oldpval);
-
- /* If the flag isn't being set, rqty will be zero */
- if ( !rqty)
- continue;
-
- if ( alchemist_recipes[al_idx].sval == a_select_flags[i].flag )
- essence[alchemist_recipes[al_idx].sval_essence] +=
- alchemist_recipes[al_idx].qty * rqty;
- }
-
- /* The essence array now contains a list of all essences
- * that will be consumed in the creation of this artifact */
-
- /* Check for existence of required quatities of essences. */
- for ( i = 0 ; i < INVEN_WIELD ; i++ )
- {
- for ( j = 0 ; j < MAX_BATERIE_SVAL ; j++)
- if ( p_ptr->inventory[i].tval == TV_BATERIE && p_ptr->inventory[i].sval == j + 1)
- {
- essenceh[j] += p_ptr->inventory[i].number;
- }
- }
-
- /* Check for enough essences */
- enough = TRUE;
- for ( i = 0 ; i < MAX_BATERIE_SVAL ; i++)
- if ( essenceh[i] < essence[i] )
- {
- enough = FALSE;
- break;
- }
-
- /* Check for items */
- if ( enough )
- enough = check_artifact_items(pval, oldpval, -1);
-
-
- /* Display recipe list if they don't have enough, or not enough exp */
- if (!enough || !use )
- {
- int row = 1 , col = 15;
- bool_ good = FALSE;
- char ch;
-
- /* display of list of required essences */
- /* Note: there are only 12 or so essences, so this list
- * will ALWAYS fit on the screen */
- for ( i = 0 ; i < MAX_BATERIE_SVAL ; i++)
- if ( essence[i] )
- {
- int missing = -MIN(essenceh[i] - essence[i], 0);
- good = TRUE;
- if ( missing )
- c_prt(TERM_RED, format("%d of the required %d essences of %s",
- missing, essence[i],
- k_info[lookup_kind(TV_BATERIE, i + 1)].name ),
- row++, col);
- else
- c_prt(TERM_GREEN, format("you have the needed %d essences of %s",
- essence[i],
- k_info[lookup_kind(TV_BATERIE, i + 1)].name ),
- row++, col);
- }
-
- if (good)
- {
- /* blank the bottom row */
- c_prt(TERM_WHITE, " ", row++, col);
-
- /* and wait for a key */
- (void)get_com("You are currently missing:", &ch);
- }
-
- /* Display a list of needed items as well */
- check_artifact_items(pval, oldpval, 0);
-
- return FALSE;
- }
-
- /* If we get to this point in the code, then the player
- * has the required essences and items in their p_ptr->inventory */
-
- /* If they do have enough, and they have enough exp, consume them */
- for (i = 0 ; i < MAX_BATERIE_SVAL ; i++)
- for ( k = 0 ; k < INVEN_WIELD && essence[i] > 0 ; k++)
- if (p_ptr->inventory[k].tval == TV_BATERIE
- && p_ptr->inventory[k].sval == i + 1
- && essence[i])
- {
- int num = p_ptr->inventory[k].number;
-
- inc_stack_size_ex(k, MAX( -essence[i], -num), NO_OPTIMIZE, DESCRIBE);
-
- essence[i] -= MIN(num, essence[i]);
- }
-
- /* Destroy the items needed */
- check_artifact_items(pval, oldpval, 1);
-
- return TRUE;
-}
-
-
-void display_activation_info(int num)
-{
- object_type forge;
- int i;
-
-
- /* find the a_select_flags number of this activation type... */
- for ( i = 0 ; a_select_flags[i].group ; i++)
- if (a_select_flags[i].group == 88 && a_select_flags[i].flag == -num )
- break;
-
- object_wipe(&forge);
- forge.xtra2 = num;
- /* Print out various information about this activation... */
- /* min level, experience, required items (and essences)
- full description (from activation_aux) */
- if (wizard)
- c_prt(TERM_WHITE, format(" number:%d ", num), 5, 5);
- else
- c_prt(TERM_WHITE, " ", 5, 5);
- c_prt(TERM_WHITE, format(" Level:%d ", a_select_flags[i].level), 6, 5);
- c_prt(TERM_WHITE, format(" Exp :%d ", a_select_flags[i].xp), 7, 5);
- c_prt(TERM_WHITE, format(" Item :%s ", a_select_flags[i].item_desc), 8, 5);
- c_prt(TERM_WHITE, " ", 9, 5);
- c_prt(TERM_WHITE, format(" %s ", activation_aux(&forge, 0, 0)), 9, 5);
- c_prt(TERM_WHITE, " ", 10, 5);
- inkey();
-}
-
-void select_an_activation(void)
-{
- int i, lev, wid, hgt, begin = 0, sel = 0;
- u32b max;
- cptr act_list[150]; /* currently, ~127 hardcoded activations */
- int act_ref[150];
- char c;
- /* How do we want to do this? */
- /* Ideally, we let them select from a list, which includes all the activations that they've ecountered in any form.
- Problems with this idea include mainly the lack of any (current) place to store which activations they've seen, and
- that they'll not get credit for any seen before we start tracking it.
-
- So - list is everything. If they select one which they're to low-level for
- or if the explicitly request it, we'll display info about this item.
- We'll also get our descriptions from the activation_aux(ACT_CONSTANT)
- function, because they are more complete, and include even lua-scripted ones.
- msg_print("Since the code to actually let you select one isn't here");
- msg_print("You will automatically get the activation 'Dawn'");
- activation_select = ACT_DAWN;
- */
-
- /* Build a list of available activations at the player's level */
- lev = get_skill(SKILL_ALCHEMY);
- for ( i = max = 0 ; max < (sizeof(act_list) / sizeof(cptr)) && a_select_flags[i].group ; i++)
- if (a_select_flags[i].group == 88 && a_select_flags[i].level <= lev )
- {
- act_ref[max] = -a_select_flags[i].flag; /* Activation number */
- act_list[max++] = a_select_flags[i].desc; /* Description */
- }
-
- /* Select from that list, using the util.c function display_list to display the scrolled list */
- /* Note: I think that there is only one other place that uses this function. Should be more! */
- while (1)
- {
- Term_clear();
- Term_get_size(&wid, &hgt);
-
- c_prt(TERM_WHITE, "Enter to select, ? for more information, 2 and 8 to scroll ", 0, 0);
- display_list(1, 0, hgt - 2, wid - 2, "Select an Activation", act_list, max, begin, sel, TERM_L_GREEN);
-
- c = inkey();
-
- if (c == ESCAPE) break;
- else if (c == '8')
- {
- sel--;
- if (sel < 0)
- {
- sel = max - 1;
- begin = max - hgt;
- if (begin < 0) begin = 0;
- }
- if (sel < begin) begin = sel;
- }
- else if (c == '2')
- {
- sel++;
- if (sel >= (s32b)max)
- {
- sel = 0;
- begin = 0;
- }
- if (sel >= begin + hgt - 1) begin++;
- }
- else if (c == '?')
- {
- display_activation_info(act_ref[sel]);
- }
- else if (c == '\r')
- {
- display_activation_info(act_ref[sel]);
- activation_select = act_ref[sel];
- return;
- }
- }
- activation_select = 0;
-}
-
-
-/* Consume 'num' magic essences and return true.
- * If there aren't enough essences, return false */
-
-bool_ magic_essence(int num)
-{
- int i;
- int j = 0;
-
- for (i = 0; i < INVEN_WIELD; i++)
- {
- object_type *o_ptr = &p_ptr->inventory[i];
-
- /* Count the magic essences */
- if (o_ptr->k_idx && (o_ptr->tval == TV_BATERIE) && (o_ptr->sval == SV_BATERIE_MAGIC)) j += o_ptr->number;
- }
-
- /* Abort if not enough essences. */
- if (j < num) return FALSE;
-
- /* Consume them */
- i = 0;
- j = num;
- while (i < INVEN_WIELD)
- {
- object_type *o_ptr = &p_ptr->inventory[i];
-
- if (o_ptr->k_idx && (o_ptr->tval == TV_BATERIE) && (o_ptr->sval == SV_BATERIE_MAGIC))
- {
- /* This can lead to invalid object pointer for objects
- * that come after the magic essences. Therefore, every
- * artifactable object should come before the essences.
- */
- j -= o_ptr->number;
- inc_stack_size(i, -num);
- num = j;
- if (num <= 0) break;
- /* Stay on this slot; do not increment i. */
- }
- else
- {
- /* Move on to the next slot. */
- i++;
- }
- }
-
- /* Sanity check. */
- if (num > 0)
- {
- msg_format("ERROR: Couldn't destroy %d essences!", num);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-void do_cmd_create_artifact(object_type *q_ptr)
-{
- int max, i = 0, j, cur_set = 0, abord = FALSE, done = FALSE;
- int skill;
- s32b exp = 0;
-
- char out_val[160];
- char choice = 0;
- bool_ lockpval = FALSE;
- int pval;
- int oldpval;
- energy_use = 100;
-
- pval = q_ptr->pval;
- oldpval = pval;
- skill = get_skill(SKILL_ALCHEMY);
-
- if ( !pval )
- pval = 1;
- /* No activation added on this round */
- activation_select = 0;
-
- /* Save the current flags */
- for (i = 0 ; a_select_flags[i].group ; i++)
- {
- if ( a_select_flags[i].flag < 0 || a_select_flags[i].group > 5)
- continue;
-
- flags_select[i] = 0;
-
- switch (a_select_flags[i].flag / 32)
- {
- case 0:
- if (q_ptr->art_flags1 & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- case 1:
- if (q_ptr->art_flags2 & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- case 2:
- if (q_ptr->art_flags3 & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- case 3:
- if (q_ptr->art_flags4 & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- case 4:
- if (q_ptr->art_flags5 & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- case 5:
- if (q_ptr->art_esp & 1 << (a_select_flags[i].flag % 32)) flags_select[i] = -1;
- break;
- default:
- /*This will not be hit, inspite of activations, because of the <= 5 above...*/
- break;
- }
- /*
- this would learn about ALL flags....
- if(wizard)
- alchemist_known_artifacts[a_select_flags[i].flag/32] = 0xffffffffL;
- */
-
- /* Set various flags if they haven't *ID*'d an artifact with this flag set.*/
- if ( !(alchemist_known_artifacts[a_select_flags[i].flag / 32] & (1 << (a_select_flags[i].flag % 32)) ))
- {
- /* If this item has an ability that depends on pval which the player
- * cannot set, don't allow them to change the pval either. */
- if ( a_select_flags[i].pval && flags_select[i])
- lockpval = TRUE;
-
- /* Set the color and set-ablitity of this flag */
- if ( flags_select[i] )
- flags_select[i] = -3;
- else
- flags_select[i] = -2;
- continue;
- }
- else if ( skill < a_select_flags[i].level )
- {
- /* If the alchemist has not passed the skill level for this flag,
- Set this flag as unsettable.
- */
- if ( flags_select[i])
- lockpval = TRUE;
- else
- flags_select[i] = -4;
- }
- }
-
- /* Save the screen */
- character_icky = TRUE;
- Term_save();
- Term_clear();
-
-
- /* Everlasting love ... ... nevermind :) */
- while ( !done && !abord)
- {
- c_prt((q_ptr->exp - exp > 0) ? TERM_L_GREEN : TERM_L_RED, format("Experience left: %ld", q_ptr->exp - exp), 2, 0);
-
- /* Display the menu, but don't display it if we just
- * displayed a message (it erases the screen, creating a blink message */
- if ( cur_set < 6 || cur_set == 7 )
- show_levels();
-
- c_prt((q_ptr->exp - exp > 0) ? TERM_L_GREEN : TERM_L_RED, format("Experience left: %ld", q_ptr->exp - exp), 2, 0);
-
- prt("Enter to accept, Escape to abort", 1, 0);
-
- abord = !get_com("Play around with which group of powers?[a-g]", &choice);
-
- if ( choice == ESCAPE)
- abord = TRUE;
-
- if ( abord )
- continue; /*or break, same diff */
-
- if ( isalpha(choice))
- {
- if (isupper(choice))
- choice = tolower(choice);
- cur_set = A2I(choice);
- }
- else
- {
- bell();
- continue;
- }
-
- if ( cur_set == 5 )
- {
- if (q_ptr->xtra2 && !activation_select
- && !get_check("This item already activates! Choose a different activation?")) continue;
- select_an_activation();
- exp = get_flags_exp(pval, oldpval);
- continue;
- }
- if ( cur_set == 6 )
- {
- msg_print("This option is not available");
- continue;
- }
- if ( cur_set == 7 )
- {
- artifact_display_or_use(pval, oldpval, FALSE);
- continue;
- }
- if ( cur_set == 8 )
- {
- if (q_ptr->exp - exp < 0)
- msg_print("Not enough experience for the flags you've selected.");
- else
- done = TRUE;
- continue;
- }
-
- if (cur_set < 0 || cur_set > 4 )
- {
- bell();
- continue;
- }
-
-
- while (!done && !abord)
- {
- /* Chose the flags */
- exp = 0;
- max = show_flags(cur_set, pval);
- exp = get_flags_exp(pval, oldpval);
- c_prt((q_ptr->exp - exp > 0) ? TERM_L_GREEN : TERM_L_RED, format("Experience left: %ld", q_ptr->exp - exp), 2, 0);
-
- /* Build a prompt (accept all flags) */
- if (max <= 26)
- {
- /* Build a prompt (accept all flags) */
- strnfmt(out_val, 78, "(Flags %c-%c, I,D to change power level) Add/Remove which flag? ",
- I2A(0), I2A(max - 1));
- }
- else
- {
- strnfmt(out_val, 78, "(Flags %c-%c, I,D to change power level) Add/Remove which flag? ",
- I2A(0), '0' + max - 27);
- }
- c_prt(TERM_L_BLUE, format("Power(I/D to increase/decrease): %d", pval), 3, 0);
-
- /* Get a spell from the user */
- while (!(done = !get_com(out_val, &choice)))
- {
- if (choice == 'I')
- {
- if ( lockpval )
- {
- msg_print("You cannot do that - you don't know how!");
- continue;
- }
- if (q_ptr->exp - exp < 0)
- {
- msg_print("Not enough experience. Decrease power or deselect flags.");
- continue;
- }
- pval++;
- break;
- }
- else if (choice == 'D')
- {
- if ( lockpval )
- {
- msg_print("You cannot do that - you don't know how!");
- continue;
- }
- pval--;
- if (pval < oldpval) pval = oldpval;
- break;
- }
- else if (choice == '\r' || choice == ESCAPE || choice == ' ')
- {
- done = TRUE;
- break;
- }
- else if (isalpha(choice))
- {
- /* Lowercase */
- if (isupper(choice)) choice = tolower(choice);
-
- /* Extract request */
- i = (islower(choice) ? A2I(choice) : -1);
- }
- else
- {
- i = D2I(choice) + 26;
-
- /* Illegal */
- if (i < 26) i = -1;
- }
-
- /* Totally Illegal */
- if ((i < 0) || (i >= max))
- {
- bell();
- continue;
- }
- else
- {
- /*Find the i'th flag in group cur_set...*/
- for ( j = 0 ; a_select_flags[j].group ; j++)
- if (a_select_flags[j].group == cur_set + 1)
- if (!i--) break;
-
- if ( flags_select[j] == -4 )
- {
- msg_format("You need at least %d skill in alchemy.",
- a_select_flags[j].level);
- continue;
- }
- if ( flags_select[j] != 0 && flags_select[j] != 1)
- {
- bell();
- continue;
- }
- if (flags_select[j]) flags_select[j] = 0;
- else if (!flags_select[j])
- {
- if (q_ptr->exp - exp < 0)
- {
- msg_print("Not enough experience. Decrease power or deselect flags.");
- continue;
- }
- flags_select[j] = 1;
- }
- break;
- }
- }
- }/*sub-screen select and redraw loop*/
- done = FALSE;
- Term_clear();
- }/* main screen (flag select screen) select and redraw loop*/
-
- /* Abort if not enough experience, or no flags added */
- if ( q_ptr->exp - exp < 0 || exp == 0 )
- abord = TRUE;
-
- /* Display the recipe, or use up the essences.
- * Note that this has to be done before the screen
- * is restored. This is because it's also called from
- * within the loop to display the required items. */
- if ( !abord )
- if (!artifact_display_or_use(pval, oldpval, TRUE))
- abord = TRUE;
-
- /* Restore the screen */
- Term_load();
- character_icky = FALSE;
-
- /* Return if abort, or missing ingredients */
- if ( abord )
- return;
-
- /* Actually create the artifact */
- q_ptr->exp -= exp;
- q_ptr->art_flags4 &= ~TR4_ART_EXP;
- q_ptr->pval = pval;
-
- /* Just to be sure */
- q_ptr->art_flags3 |= ( TR3_IGNORE_ACID | TR3_IGNORE_ELEC |
- TR3_IGNORE_FIRE | TR3_IGNORE_COLD );
-
- {
- int now = 0, before = 0;
- char dummy_name[80];
- char new_name[80];
-
- /* Apply the flags */
- for (i = 0; a_select_flags[i].group ; i++)
- {
- if (flags_select[i] < 0)
- before++;
- else if ( flags_select[i] == 1)
- {
- now++;
- switch (a_select_flags[i].flag / 32)
- {
- case 0:
- q_ptr->art_flags1 |= 1 << (a_select_flags[i].flag % 32);
- break;
- case 1:
- q_ptr->art_flags2 |= 1 << (a_select_flags[i].flag % 32);
- break;
- case 2:
- q_ptr->art_flags3 |= 1 << (a_select_flags[i].flag % 32);
- break;
- case 3:
- q_ptr->art_flags4 |= 1 << (a_select_flags[i].flag % 32);
- break;
- case 4:
- q_ptr->art_flags5 |= 1 << (a_select_flags[i].flag % 32);
- break;
- case 5:
- q_ptr->art_esp |= 1 << (a_select_flags[i].flag % 32);
- break;
- default:
- msg_print("error: this code can't ever be hit!");
- }
- }
- }
-
- if ( activation_select )
- {
- q_ptr->art_flags3 |= TR3_ACTIVATE;
- q_ptr->xtra2 = activation_select;
- }
-
-
- /* Set the 'show modifier' flag */
- q_ptr->art_flags3 |= TR3_SHOW_MODS;
-
- /* For temporary items, set a timeout.
- * alchemist_skill^2 for now */
- if ( q_ptr->art_flags5 & TR5_TEMPORARY )
- {
- int lev = get_skill(SKILL_ALCHEMY);
- q_ptr->timeout = lev * lev * 3;
- }
-
- /* Describe the new artifact */
- object_out_desc(q_ptr, NULL, FALSE, TRUE);
-
-
- /* Name the new artifact */
- strcpy(dummy_name, "of an Alchemist");
- if (!(get_string("What do you want to call the artifact? ", dummy_name, 80)))
- strcpy(new_name, "of an Alchemist");
- else
- {
- if ((strncmp(dummy_name, "of ", 3) == 0) ||
- (strncmp(dummy_name, "Of ", 3) == 0) ||
- ((dummy_name[0] == '\'') &&
- (dummy_name[strlen(dummy_name) - 1] == '\'')))
- {
- strcpy(new_name, dummy_name);
- }
- else
- {
- strcpy(new_name, "called '");
- strcat(new_name, dummy_name);
- strcat(new_name, "'");
- }
- }
- /* Identify it fully */
- object_aware(q_ptr);
- object_known(q_ptr);
-
- /* Mark the item as fully known */
- q_ptr->ident |= (IDENT_MENTAL);
- q_ptr->ident |= IDENT_STOREB; /* This will be used later on... */
-
- /* Save the inscription */
- q_ptr->art_name = quark_add(new_name);
- q_ptr->found = OBJ_FOUND_SELFMADE;
-
- done = FALSE;
- while (!done && get_com("Do you want to let this item continue to gain experience?", &choice))
- {
- switch (choice)
- {
- case 'y':
- case 'Y':
- if (magic_essence(get_skill(SKILL_ALCHEMY)))
- q_ptr->art_flags4 |= TR4_ART_EXP;
- else
- msg_format("Oh, NO! You don't have enough magic essences. You needed %d.", get_skill(SKILL_ALCHEMY));
- done = TRUE;
- break;
- case 'n':
- case 'N':
- q_ptr->exp = 0;
- done = TRUE;
- break;
- }
- }
-
- /* Cycle through the p_ptr->inventory, and optimize everything.
- * This wasn't done earlier, because if we had, then
- * things in the p_ptr->inventory would shift around, and q_ptr
- * wouldn't point to the right thing. BUT, at this point
- * we don't need q_ptr anymore, so optimizing the p_ptr->inventory
- * becomes sane. Sticky bug to figure out, let me tell you.
- * Note also that this is cycling backwards - this is so
- * that the same effect doesn't cause us to skip items. */
- for ( i = INVEN_WIELD - 1 ; i >= 0 ; i-- )
- inven_item_optimize(i);
- }
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP);
-}
-
-/*
- * Test to see if this tval/sval combo is in the alchemists'
- * recipes as a createable item. Used to determine if we
- * should extract from it.
- */
-static bool_ alchemist_exists(int tval, int sval, int ego, int artifact)
-{
- int al_idx;
-
- /* To prevent conflicts with recipes for ego-items.
- * artifact not used, simplifies the loop below. */
- if ((tval == 1) || artifact)
- return FALSE;
-
- /*Search for recipes with this tval/sval combo as the final result*/
- for (al_idx = 0 ; al_idx < max_al_idx ; al_idx++)
- {
- int rtval = alchemist_recipes[al_idx].tval;
- int rsval = alchemist_recipes[al_idx].sval;
-
- /* Accept ego wands and staves since ego is extracted last */
- if (((!ego || tval == TV_WAND || tval == TV_STAFF) && rtval == tval && rsval == sval) ||
- ( ego && rtval == 1 && rsval == ego))
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-/*
- * Hook to determine if an object can have things extracted from it.
- */
-bool item_tester_hook_extractable(object_type const *o_ptr)
-{
-
- /* No artifacts */
- if (artifact_p(o_ptr))
- {
- return false;
- }
-
- /* No cursed things */
- if (cursed_p(o_ptr))
- {
- return false;
- }
-
- /* If we REALLY wanted to rebalance alchemists,
- * we'd test for 'fully identified this object kind' here.
- */
- return ((o_ptr->tval == TV_ROD_MAIN && o_ptr->pval != 0)
- || alchemist_exists(o_ptr->tval, o_ptr->sval, o_ptr->name2, o_ptr->name1));
-}
-
-/*
- * Hook to determine if an object is empowerable (NOT rechargeable)
- */
-static bool item_tester_hook_empower(object_type const *o_ptr)
-{
- int sval = -1;
- int lev = get_skill(SKILL_ALCHEMY);
- /* after level 25, can empower ego items to create artifacts
- * and double ego items.
- * after level 50, can empower artifacts to create powerful artifacts
- */
-
- /* Never Empower a cursed item */
- if ( cursed_p(o_ptr))
- {
- return false;
- }
-
- /* Allow finalizing a self created artifact */
- if (artifact_p(o_ptr)
- && (o_ptr->art_flags4 & TR4_ART_EXP)
- && !(o_ptr->art_flags4 & TR4_ULTIMATE))
- return true;
-
- switch ( o_ptr->tval)
- {
- /* Empowerable objects: Traditional alchemist stuff */
- case TV_WAND:
- sval = SV_WAND_NOTHING;
- break;
- case TV_RING:
- sval = SV_RING_NOTHING;
- break;
- case TV_STAFF:
- sval = SV_STAFF_NOTHING;
- break;
- case TV_BOTTLE:
- sval = 1;
- break;
- case TV_AMULET:
- sval = SV_AMULET_NOTHING;
- break;
- case TV_SCROLL:
- sval = SV_SCROLL_NOTHING;
- break;
- case TV_ROD:
- sval = SV_ROD_NOTHING;
- break;
- case TV_ROD_MAIN:
- sval = -1;
- break;
- case TV_BOOK:
- sval = -1;
- break;
-
- /* Ego item stuff */
- /* Disallow ego dragon armour before you can create artifacts.*/
- case TV_DRAG_ARMOR:
- if ( lev < 25)
- return false;
- /* FALL THROUGH! no break here. */
-
- /* weapons */
-
- case TV_DAEMON_BOOK:
- case TV_SWORD:
- case TV_HAFTED:
- case TV_POLEARM:
- case TV_AXE:
- case TV_MSTAFF:
-
- /* misc other items */
- case TV_BOW:
- case TV_BOOMERANG:
- case TV_INSTRUMENT:
- case TV_DIGGING:
- case TV_LITE:
-
- /* Ammo */
- case TV_SHOT:
- case TV_ARROW:
- case TV_BOLT:
-
- /* Armor of various sorts */
- case TV_BOOTS:
- case TV_GLOVES:
- case TV_HELM:
- case TV_CROWN:
- case TV_SHIELD:
- case TV_CLOAK:
- case TV_SOFT_ARMOR:
- case TV_HARD_ARMOR:
-
- /* Disallow ANY creation of ego items below level 5*/
- if ( lev < 5)
- return false;
-
- /* empowering an ego item creates an artifact or a
- * double ego item, disallow below level 25 */
- if ( lev < 25 && o_ptr->name2)
- return false;
-
- /* Disallow double-ego and artifact unless the character has
- * the artifact creation ability. */
- if (!has_ability(AB_CREATE_ART) &&
- (artifact_p(o_ptr) || (o_ptr->name2 && o_ptr->name2b)))
- return false;
-
- /* Otherwise... */
- return true;
-
- default:
- return false;
- }
-
- /* Return to the traditional alchemist objects.
- * All ego items and artifacts returning TRUE are accepted as artifactable
- * at level 25. If we want double ego non wieldable items (Fireproof Staff
- * of Plenty) the artifactable test in do_cmd_alchemist() must be changed,
- * e.g. checking if the item is wearable.
- * For now, we disallow non-wearable ego-items and artifacts here.
- */
-
- if ((o_ptr->name2 || artifact_p(o_ptr)) &&
- o_ptr->tval != TV_RING && o_ptr->tval != TV_AMULET)
- return false;
-
- /* return true if it's a 'of nothing' item;
- * does nothing for TV_ROD_MAIN and TV_BOOK
- */
- return (sval == o_ptr->sval
-
- /* or if it's artifactable */
- || ((lev >= 50 || (lev >= 25 && !artifact_p(o_ptr))) &&
- (o_ptr->tval == TV_RING || o_ptr->tval == TV_AMULET))
-
- /* or if it's egoable (note that normal egos start at level 5, wands and such start at 15) */
- || (!o_ptr->name2 && lev >= 15));
-}
-
-/* Extract a rod tip from a rod */
-static void rod_tip_extract(object_type *o_ptr)
-{
- object_type *q_ptr;
- object_type forge;
-
- /* Get local object */
- q_ptr = &forge;
-
- /* Paranoia, return if it's a rod of nothing */
- if (o_ptr->pval == SV_ROD_NOTHING)
- return;
-
- /* Extract the rod tip */
- object_prep(q_ptr, lookup_kind(TV_ROD, o_ptr->pval));
-
- q_ptr->number = o_ptr->number;
-
- object_aware(q_ptr);
- object_known(q_ptr);
- (void)inven_carry(q_ptr, FALSE);
-
- /* Remove it from the rod */
- o_ptr->pval = SV_ROD_NOTHING;
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN);
-}
-
-
-/* Begin & finish an art */
-static void do_cmd_toggle_artifact(object_type *o_ptr)
-{
- char o_name[80];
-
- if (!(o_ptr->art_flags4 & TR4_ART_EXP))
- {
- bool_ okay = TRUE;
-
- msg_print("Creating an artifact will result into a permanent loss of 10 hp.");
- if (!get_check("Are you sure you want to do that?")) return;
-
- if (!magic_essence(get_skill(SKILL_ALCHEMY)))
- {
- msg_format("You need %d magic essences.", get_skill(SKILL_ALCHEMY));
- return;
- }
-
- /* Description */
- object_desc(o_name, o_ptr, FALSE, 0);
-
- if (o_ptr->number > 1)
- {
- msg_print("Not enough energy to enchant more than one object!");
- msg_format("%d of your %s %s destroyed!", (o_ptr->number) - 1, o_name, (o_ptr->number > 2 ? "were" : "was"));
- o_ptr->number = 1;
- }
- okay = TRUE;
-
- if (!okay) return;
-
- /* he/she got warned */
- p_ptr->hp_mod -= 10;
-
- /* Ok toggle it */
- o_ptr->art_flags4 |= TR4_ART_EXP;
- o_ptr->name2 = 0;
- o_ptr->name2b = 0;
- o_ptr->art_name = quark_add("Becoming");
-
- /* Copy the object_kind flags to the artifact flags.
- * Note that this is only needed so that flags set in the
- * 'kind' area are visible when finalizing the artifact.
- */
- {
- u32b f1, f2, f3, f4, f5, esp;
-
- object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);
-
- o_ptr->art_flags1 |= f1;
- o_ptr->art_flags2 |= f2;
- o_ptr->art_flags3 |= f3;
- o_ptr->art_flags4 |= f4;
- o_ptr->art_flags5 |= f5;
- o_ptr->art_esp |= esp;
- }
-
- p_ptr->update |= (PU_HP);
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
- }
- else
- {
- do_cmd_create_artifact(o_ptr);
- }
-}
-
-/*
- * Test to see if they have all the ingredients to create an item.
- * (doesn't count base item)
- * creates 'tocreate' items (may be -1, but no more than that!)
- * if tocreate=0, will return true if the player has enough
- * in their p_ptr->inventory to empower that item.
- */
-static bool_ alchemist_items_check(int tval, int sval, int ego, int tocreate, bool_ message)
-{
- int al_idx, j;
- bool_ exists = FALSE;
-
-
- for ( al_idx = 0 ; al_idx < max_al_idx ; al_idx++ )
- if ((ego && alchemist_recipes[al_idx].sval == ego
- && alchemist_recipes[al_idx].tval == 1 )
- || (!ego && alchemist_recipes[al_idx].sval == sval
- && alchemist_recipes[al_idx].tval == tval))
- {
- exists = TRUE;
- /* Create the essences */
- if (tocreate > 0)
- {
- object_type forge;
- object_type *o_ptr = &forge;
-
- object_wipe(o_ptr);
- object_prep(o_ptr, lookup_kind(TV_BATERIE, alchemist_recipes[al_idx].sval_essence));
- o_ptr->number = alchemist_recipes[al_idx].qty * tocreate;
- /* Don't bother with apply_magic */
-
- /* Randomly decrease the number of essences created */
- if ( randint(3) == 1
- && randint(52) > get_skill(SKILL_ALCHEMY))
- o_ptr->number /= randint(2) + 1;
- if ( o_ptr->number == 0)
- continue;
- object_aware(o_ptr);
- object_known(o_ptr);
- if (inven_carry_okay(o_ptr))
- {
- int i;
- inven_carry(o_ptr, FALSE);
- for (i = 0; i < INVEN_WIELD ; i++)
- if (p_ptr->inventory[i].tval == o_ptr->tval && p_ptr->inventory[i].sval == o_ptr->sval)
- {
- if ( message )
- inven_item_describe(i);
- break;
- }
-
- }
- else
- drop_near(o_ptr, 0, p_ptr->py, p_ptr->px);
-
- o_ptr->ident |= IDENT_STOREB;
- }
- else if ( tocreate < -1)
- {
- /*It's not valid to create more than one
- * thing at a time, so if it's less than -1,
- * it must be time to display a recipe
- */
- msg_format("%d essences of %d",
- alchemist_recipes[al_idx].qty,
- al_idx);
- }
- else /* Destroy the essences (tocreate == -1)
- * or check for existence(tocreate == 0)*/
- {
- int rqty = alchemist_recipes[al_idx].qty;
- for (j = 0; j < INVEN_WIELD; j++)
- {
- object_type *o_ptr = &p_ptr->inventory[j];
- if (o_ptr->k_idx
- && (o_ptr->tval == TV_BATERIE )
- && (o_ptr->sval == alchemist_recipes[al_idx].sval_essence )
- && (o_ptr->number >= rqty ))
- {
- /* At this point, the item is required, destroy it. */
- if ( tocreate )
- {
- inc_stack_size_ex(j, 0 - rqty, OPTIMIZE, message ? DESCRIBE : NO_DESCRIBE);
- }
-
- /* When we find enough of the item, break out of the
- * 'search through the p_ptr->inventory' loop */
- break;
- }
- }
- if ( j == INVEN_WIELD)
- /* This ingredient was not found, cannot do recipe */
- return FALSE;
- }/*destroying items, or just checking for existence */
- }
- return exists;
-}
-
-/* This function lists all the ingredients
- * needed to create something.
- */
-static void alchemist_display_recipe(int tval, int sval, int ego)
-{
- int al_idx;
- int row = 1, col = 15;
- char o_name[80];
- char ch;
- object_type *o_ptr, forge;
-
- /* Display the ingredients for a recipe */
- for ( al_idx = 0 ; al_idx < max_al_idx ; al_idx++ )
- if ((ego && alchemist_recipes[al_idx].sval == ego
- && alchemist_recipes[al_idx].tval == 1 )
- || (!ego && alchemist_recipes[al_idx].sval == sval
- && alchemist_recipes[al_idx].tval == tval))
- {
- int qty = alchemist_recipes[al_idx].qty;
- c_prt(TERM_GREEN,
- format(" %d essence%s %s ", qty,
- qty > 1 ? "s" : "",
- k_info[lookup_kind(TV_BATERIE, alchemist_recipes[al_idx].sval_essence)].name),
- row++, col);
- }
-
- c_prt(TERM_WHITE, " ", row++, col);
-
- if (!ego)
- {
- /* Find the name of that object */
- o_ptr = &forge;
- object_prep(o_ptr, lookup_kind(tval, sval));
- o_ptr->name2 = ego;
- apply_magic(o_ptr, get_skill(SKILL_ALCHEMY) * 2, FALSE, FALSE, FALSE, boost::make_optional(0));
- object_aware(o_ptr);
- object_known(o_ptr);
- /* the 0 mode means only the text, leaving off any numbers */
- object_desc(o_name, o_ptr, FALSE, 0);
- }
- else
- {
- /* Display the ego item name */
- strcpy(o_name, e_info[ego].name);
- }
-
- /* Display a short message about it, and wait for a key. */
- (void)get_com(format("ingredients needed to create a %s", o_name), &ch);
-
-}
-
-/*
- The select array is a simple array of 'use this char to select item x'
- It has 88 items (three columns of 20 each)
- selectitem is initilized with the reverse mappings:
- selectitem[selectchar[x]] == x is always true.
- */
-char selectchar[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*():;,.<=>[]{}/=?+'~";
-byte selectitem[256];
-
-void strip_and_print(const char *str, int color, int num)
-{
- int row = 2 + (num % 20), col = 40 * (num / 20);
- int ch, max_len = 0;
- char buf[80];
- char *string;
-
- if (num > 60)
- {
- msg_print("Attempting to display too many items!");
- return;
- }
- ch = selectchar[num];
- if (selectitem[ch] != num)
- {
- int i;
- for ( i = 0 ; i < 256 ; i++)
- selectitem[i] = 0xff;
- for ( i = 0 ; selectchar[i] ; i++)
- selectitem[(byte)selectchar[i]] = i;
- }
-
- /* Skip past leading characters */
- while ((*str == ' ') || (*str == '&')) str++;
-
- /* Copy useful chars */
- for (string = buf; *str; str++)
- if (*str != '~') *string++ = *str;
-
- /* Terminate the new name */
- *string = '\0';
-
- /* strip the name down to size
- if (76-col < (signed)max_len)
- max_len = 76-col;
- else
- max_len = 30-6;*/
- max_len = 39;
-
- string = buf;
- if (strlen(string) > (unsigned)max_len)
- string = string + (strlen(string) - max_len);
-
- /* Print it */
- c_prt(color, format("[%c] %s", ch, string), row, col);
-}
-
-/* Display a list of known recipies that can be made with
- * materials on hand (including the passed tval). Also
- * calls the recipe_display function, if requested by the
- * player or there aren't enough essences to make the
- * requested object.
- *
- * Note: sval is ignored if !ego, tval is the only determinant
- * of what recipies are available otherwise.
- *
- * This function needs to be able to scroll a list, because
- * there are SO MANY potions. :)
- */
-static int alchemist_recipe_select(int *tval, int sval, int ego, bool_ recipe)
-{
- int i, mod40 = 0, num, max_num = 0;
-
- cptr tval_desc2 = "";
- char ch;
- bool_ done = FALSE;
-
- int choice[60];
- int validc[60];
-
- const char *string;
-
-
- /* Save and clear the screen */
- character_icky = TRUE;
- Term_save();
- Term_clear();
-
- /* Base object type chosen, fill in tval */
- for ( num = 0 ; num < 40 ; num ++)
- if (tvals[num].tval == *tval)
- {
- tval_desc2 = tvals[num].desc;
- }
-
- while (!done)
- {
- Term_clear();
- if (ego)
- {
- /* Find matching ego items */
- for (num = 0, i = 1; (num < 40) && (i < max_e_idx) ; i++)
- {
- int j;
- ego_item_type *e_ptr = &e_info[i];
-
- /* Skip if unknown ego type */
- if ( !(alchemist_known_egos[i / 32] & (1 << (i % 32))))
- continue;
-
- /* search in permitted tvals/svals for allowed egos */
- for ( j = 0 ; j < 6 ; j ++ )
- if ( e_ptr->tval[j] == *tval
- && sval >= e_ptr->min_sval[j]
- && sval <= e_ptr->max_sval[j])
- {
- int color = TERM_GREEN;
-
- /*Reject if not opposite end of name
- prefixes only on postfix egos,
- postfixes only on prefix egos.
- */
- if (ego != -1 && e_ptr->before == e_info[ego].before)
- continue;
-
- /*Color it red of the alchemist doesn't have the essences to create it*/
- if (!alchemist_items_check(*tval, 0, i, 0, TRUE))
- color = TERM_RED;
-
- /* add this ego to the list*/
- strip_and_print(e_info[i].name, color, num);
- validc[num] = color;
- choice[num++] = i;
- break;
- }
- }
- }
- else
- {
- char skipped = 0;
- num = 0;
- if (mod40 != 0)
- {
- strip_and_print("--MORE--", TERM_WHITE, num);
- validc[num] = TERM_WHITE;
- choice[num++] = -1;
- }
-
- for (i = 1; (num < 39) && (i < max_k_idx); i++)
- {
- object_kind *k_ptr = &k_info[i];
-
- /* Analyze matching items */
- if (k_ptr->tval == *tval || (k_ptr->tval == TV_POTION2 && *tval == TV_POTION))
- {
- char color = TERM_GREEN;
- /* Hack -- Skip instant artifacts */
- if (k_ptr->flags3 & (TR3_INSTA_ART)) continue;
-
- /*Don't display recipes that the alchemist doesn't know about*/
- if (!k_ptr->know && !wizard) continue;
-
- /*Skip recipes that are somehow known, but don't exist*/
- if (!alchemist_exists(k_ptr->tval, k_ptr->sval, 0, 0))
- continue;
-
- /* Skip the first 39 if they hit 'more' */
- if (skipped++ < mod40*39)
- continue;
-
- /* Color 'unable to create' items different */
- if (!alchemist_items_check(k_ptr->tval, k_ptr->sval, 0, 0, TRUE))
- color = TERM_RED;
-
- /* Acquire the "name" of object "i" */
- /* and print it in it's place */
- strip_and_print(k_ptr->name, color, num);
-
- /* Remember the object index */
- validc[num] = color;
- choice[num++] = i;
- }
- }
- if (num == 39)
- {
- strip_and_print("--MORE--", TERM_WHITE, num);
- validc[num] = TERM_WHITE;
- choice[num++] = -1;
- }
- }
-
- /* We need to know the maximal possible remembered object_index */
- max_num = num;
- string = "What Kind of %s? (* to see recipe) [%c-%c,*]";
- num = 0xff;
-
- /* Pretend they're all undoable if we where called to display recipes */
- if (recipe)
- {
- for ( num = 0 ; num < max_num ; num++)
- if (validc[num] != TERM_WHITE) validc[num] = TERM_RED;
- string = "show which %s recipe? [%c-%c]";
- }
-
- while (num == 0xff || num >= max_num)
- {
- ch = selectchar[max_num - 1];
- /* Choose! */
- if ( max_num == 0 || !get_com(format(string, tval_desc2, selectchar[0], ch), &ch))
- {
- break;
- }
-
- /* Extra breaks for recipe */
- if (recipe && (ch == '\r' || ch == ' ' || ch == ESCAPE ))
- break;
-
- /* Analyze choice */
- num = selectitem[(byte)ch];
-
- /* Pretend that we don't have enough essences for anything */
- if (ch == '*' )
- {
- for ( num = 0 ; num < max_num ; num++)
- if (validc[num] != TERM_WHITE) validc[num] = TERM_RED;
- string = "Show which %s recipe? [%c-%c]";
- }
- }
- if ( num == 0xff || max_num == 0 || num >= max_num)
- break;
-
- if ( validc[num] == TERM_WHITE )
- {
- if (num == 0)
- mod40--;
- else
- mod40++;
- if ( mod40 < 0)
- mod40 = 0;
- continue;
- }
-
- /* If we don't have enough essences, or user asked for recipes */
- if ( validc[num] != TERM_GREEN )
- {
- /* Display the recipe */
- if (ego)
- alchemist_display_recipe(*tval, sval, choice[num]);
- else
- alchemist_display_recipe(k_info[choice[num]].tval, k_info[choice[num]].sval, 0);
- }
- else
- done = TRUE;
-
- }/*while(!done)*/
-
- /* Restore screen contents */
- Term_load();
- character_icky = FALSE;
-
- /* User abort, or no choices */
- if (max_num == 0 || num == 0xff || num >= max_num)
- {
- if (max_num == 0)
- msg_print("You don't know of anything you can make using that.");
- return ( -1);
- }
- if ( validc[num] != TERM_GREEN )
- return ( -1);
-
- /* And return successful */
- if ( ego )
- return choice[num];
-
- /* Set the tval, should be the same unless they selected a potion2 */
- if (*tval != k_info[choice[num]].tval && *tval != TV_POTION)
- msg_print("Coding error: tval != TV_POTION");
- *tval = k_info[choice[num]].tval;
- return ( k_info[choice[num]].sval );
-}
-
-/* Display a list of recipes that need a particular essence.
- * Note that we display a list of essences first,
- * so in effect, this is the alchemist's recipe book.
- */
-static void alchemist_recipe_book(void)
-{
- int num, max_num, i, al_idx, bat, kidx;
- int choice[61], choice2[61];
- int mod40;
- bool_ essence[MAX_BATERIE_SVAL + 1];
- char ch;
-
- /* Save and clear the screen */
- character_icky = TRUE;
- Term_save();
-
- while ( TRUE )
- {
- Term_clear();
-
- num = 0;
-
- /* Display bateries */
-
- /* start with assumption that the alchemist knows about no recipes */
- for (i = 0; i < MAX_BATERIE_SVAL + 1 ; i++)
- essence[i] = FALSE;
-
- /* cycle through all alchemist recipes */
- for (al_idx = 0 ; al_idx < max_al_idx ; al_idx++)
- /* if we aren't already going to display this essence */
- if (!essence[alchemist_recipes[al_idx].sval_essence])
- {
-
- /*Note that we don't display artifact recipes here...*/
- /*This is partially because artifacts often require exotic
- ingredients as well */
-
- if (!alchemist_recipes[al_idx].tval)
- continue;
-
- if (alchemist_recipes[al_idx].tval == 1)
- {
- if (alchemist_known_egos[alchemist_recipes[al_idx].sval / 32]
- & (1 << (alchemist_recipes[al_idx].sval % 32)) )
- essence[alchemist_recipes[al_idx].sval_essence] = TRUE;
- continue;
- }
-
- kidx = lookup_kind(alchemist_recipes[al_idx].tval, alchemist_recipes[al_idx].sval);
- if (alchemist_recipes[al_idx].tval != 1 && k_info[kidx].know)
- essence[alchemist_recipes[al_idx].sval_essence] = TRUE;
-
- }
- for (num = 0, i = 0; i < MAX_BATERIE_SVAL + 7 ; i++)
- if (essence[i] || i > MAX_BATERIE_SVAL)
- {
- int kidx = lookup_kind(TV_BATERIE, i);
- if (i > MAX_BATERIE_SVAL)
- {
- switch (i)
- {
- case (MAX_BATERIE_SVAL + 1): strip_and_print("Scrolls", TERM_WHITE, num);
- break;
- case (MAX_BATERIE_SVAL + 2): strip_and_print("Potions", TERM_WHITE, num);
- break;
- case (MAX_BATERIE_SVAL + 3): strip_and_print("Wands", TERM_WHITE, num);
- break;
- case (MAX_BATERIE_SVAL + 4): strip_and_print("Rings", TERM_WHITE, num);
- break;
- case (MAX_BATERIE_SVAL + 5): strip_and_print("Staves", TERM_WHITE, num);
- break;
- case (MAX_BATERIE_SVAL + 6): strip_and_print("Amulets", TERM_WHITE, num);
- break;
- default:
- continue;
- }
- }
- else
- {
- /* add this essence to the list*/
- strip_and_print(k_info[kidx].name, TERM_WHITE, num);
- }
-
- choice[num++] = i;
- }
- max_num = num;
- if ( max_num == 0)
- {
- /*Note that this should never actually happen, as any skill
- at alchemy automatically gets you some recipes, and this
- procedure shouldn't be called for players without alchemist skill
- */
- msg_print("You don't know any recipes!");
- msg_print("You can't be an alchemist without recipes!");
- break;
- }
-
- while (num == 0xff || num >= max_num)
- {
- ch = selectchar[max_num - 1];
- /* Choose! */
- if ( max_num == 0 ||
- !get_com(format("Which Type of Recipe?[a-%c]", selectchar[max_num - 1]), &ch))
- break;
-
- /* Analyze choice - note that the cast to byte prevents overflow*/
- num = selectitem[(byte)ch];
-
- }
- /* This break, and the break for no recipes above,
- are the only exits from this procedure.
- */
- if ( num == 0xff || num >= max_num)
- break;
-
- /* Save the baterie index */
- bat = choice[num];
- num = 0;
-
- /*Display the 'type of object' recipe screen*/
- if (bat > MAX_BATERIE_SVAL)
- {
- int tval;
- switch (bat)
- {
- case MAX_BATERIE_SVAL + 1:
- tval = TV_SCROLL;
- break;
- case MAX_BATERIE_SVAL + 2:
- tval = TV_POTION;
- break;
- case MAX_BATERIE_SVAL + 3:
- tval = TV_WAND;
- break;
- case MAX_BATERIE_SVAL + 4:
- tval = TV_RING;
- break;
- case MAX_BATERIE_SVAL + 5:
- tval = TV_STAFF;
- break;
- case MAX_BATERIE_SVAL + 6:
- tval = TV_AMULET;
- break;
- }
- Term_load();
- alchemist_recipe_select(&tval, 0, FALSE, TRUE);
- Term_save();
- continue;
- }
- mod40 = 0;
- while ( TRUE )
- {
- int skipped;
-
- Term_clear();
- num = 0;
-
- if (mod40)
- {
- strip_and_print("--MORE--", TERM_WHITE, num);
- choice[num] = -2;
- choice2[num++] = 0;
- }
-
- /* Display all items made with this essence */
- for ( al_idx = 0 , skipped = 0 ; al_idx < max_al_idx ; al_idx++)
- if ( alchemist_recipes[al_idx].sval_essence == bat)
- {
- int sval = alchemist_recipes[al_idx].sval;
- int tval = alchemist_recipes[al_idx].tval;
- char names[200] = "";
-
- if (alchemist_recipes[al_idx].tval == 1)
- {
- /* Ego items */
- ego_item_type *e_ptr = &e_info[sval];
- int j, k;
-
- if ( !(alchemist_known_egos[sval / 32] & (1 << (sval % 32))))
- continue;
-
- for ( j = 0 ; j < 6 && e_ptr->tval[j] ; j ++ )
- {
- if ( j > 0 && e_ptr->tval[j] == e_ptr->tval[j - 1])
- continue;
- for ( k = 0; tvals[k].tval; k++)
- if (tvals[k].tval == e_ptr->tval[j])
- {
- strcat(names, tvals[k].desc);
- strcat(names, ", ");
- break;
- }
- }
- strcat(names, e_ptr->name);
- }
- else
- {
- /* Normal Items */
- int kidx = lookup_kind(tval, sval);
- int k;
- if ( !k_info[kidx].know )
- continue;
-
- for ( k = 0; tvals[k].tval; k++)
- if (tvals[k].tval == tval)
- {
- strcat(names, tvals[k].desc);
- break;
- }
- strcat(names, " of ");
- strcat(names, k_info[kidx].name);
-
- }
-
- /*Skip the first mod40 pages of recipes*/
- if (skipped++ < mod40*38)
- continue;
-
- /* add this object kind to the list*/
- strip_and_print(names, TERM_WHITE, num);
- choice[num] = tval;
- choice2[num++] = sval;
- if (num > 38)
- {
- strip_and_print("--MORE--", TERM_WHITE, num);
- choice[num] = -1;
- choice2[num++] = 0;
- break;
- }
-
- }/*Loop through tidx/sidx*/
-
- max_num = num;
- while (num == 0xff || num >= max_num)
- {
- ch = selectchar[max_num - 1];
- /* Choose! */
- if ( max_num == 0 || !get_com(
- format("Examine which recipe?[%c-%c]", selectchar[0], ch)
- , &ch))
- {
- break;
- }
-
- /* Analyze choice */
- num = selectitem[(byte)ch];
- }
-
- if ( choice[num] < 0)
- {
- if (choice[num] < -1)
- mod40--;
- else
- mod40++;
- continue;
- }
-
- if ( num == 0xff || num >= max_num)
- break;
-
- /* Display the recipe */
- if (choice[num] == 1)
- alchemist_display_recipe(0, 0, choice2[num]);
- else
- alchemist_display_recipe(choice[num], choice2[num], 0);
- }
- /*
- break is at top of loop, after essence list
- if( num < 0 || num >= max_num)
- break;
- */
-
- }/*show recipes*/
-
- /* Restore screen contents */
- Term_load();
- character_icky = FALSE;
-}
-
-/* Set the 'known' flags for all objects with a level <= lev
- * This lets the budding alchemist create basic items.
- */
-void alchemist_learn_all(int lev)
-{
- int i;
-
- if ( !get_skill(SKILL_ALCHEMY) )
- return;
-
- /* msg_format("You learn about level %d items",lev); */
-
- for ( i = 0 ; i < max_k_idx ; i++ )
- if ( k_info[i].level <= lev )
- if (alchemist_exists(k_info[i].tval, k_info[i].sval, 0, 0))
- k_info[i].know = TRUE;
-}
-
-void alchemist_learn_ego(int ego)
-{
- int i;
-
- /* some Paranoia*/
- if ( !ego || ego >= max_e_idx )
- return;
-
- /* Get the ego items name */
- const char *name = e_info[ego].name;
- while (strchr(name, ' '))
- name = strchr(name, ' ') + 1;
-
- /* Don't learn about egos without recipes, and
- * always learn about the passed ego item. */
- if (alchemist_exists(0, 0, ego, 0))
- {
- alchemist_known_egos[ego / 32] |= (1 << (ego % 32));
- }
- else
- {
- return;
- }
-
- /* Don't mass learn about egos that have no name. */
- if ( name[0] == 0 )
- {
- return;
- }
-
- /* Look through all ego's for matching name */
- /* Note that the original ego is marked here too */
- for ( i = 0 ; i < max_e_idx ; i++ )
- if ( strstr(e_info[i].name, name) != NULL /*Last word of name exists in this ego's name*/
- && alchemist_exists(0, 0, i, 0) /*There exists a recipe for this*/
- && !(alchemist_known_egos[i / 32] & (1 << (i % 32)) ) ) /*Not already known*/
- {
- alchemist_known_egos[i / 32] |= (1 << (i % 32));
- }
-
- return;
-}
-
-/* Alchemist has learned about a new item.
- * Learn about not only it, but ALL egos with the
- * same name.
- */
-int alchemist_learn_object(object_type *o_ptr)
-{
-
- /* Allow alchemist to create this item,
- and.. learn about it even if the player
- doesn't currently have the alchemy skill
- */
- k_info[o_ptr->k_idx].know = TRUE;
-
- /* Not Paranoia, identify_fully calls this always */
- if ( !get_skill(SKILL_ALCHEMY) )
- return FALSE;
-
- if ( artifact_p(o_ptr) )
- {
- char o_name[80];
- u32b f1, f2, f3, f4, f5, esp;
- object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);
-
- /* Randarts and normal artifacts both*/
- alchemist_known_artifacts[0] |= f1;
- alchemist_known_artifacts[1] |= f2;
- alchemist_known_artifacts[2] |= f3;
- alchemist_known_artifacts[3] |= f4;
- alchemist_known_artifacts[4] |= f5;
- alchemist_known_artifacts[5] |= esp;
-
- object_desc(o_name, o_ptr, 1, 0);
- msg_format("You learn all about the abilities of %s!", o_name);
- }
- if (o_ptr->name2)
- alchemist_learn_ego(o_ptr->name2);
-
- if (o_ptr->name2b)
- alchemist_learn_ego(o_ptr->name2b);
-
- return (TRUE);
-}
-
-/* Alchemist has gained a level - set the ego flags
- * for all egos <= lev/4.
- */
-static void alchemist_gain_level(int lev)
-{
- object_type forge;
- object_type *o_ptr = &forge;
-
- if ( lev == 0)
- {
- /* Learn about potions of Detonation */
- k_info[417].know = TRUE;
- }
- if ( lev == 5)
- {
- int ego;
- int egos[] = {
- 7/*armor of resist fire*/
- , 18/*shield of resist fire*/
- , 74/*shocking weapon*/
- , 75/*fiery weapon*/
- , 76/*frozen weapon*/
- , 77/*Venomous weapon*/
- , 78/*Chaotic weapon*/
- , 115/*projectile of venom*/
- , 116/*projectile of Acid*/
- , 122/*projectile of flame*/
- , 123/*projectile of frost*/
- , 137/*Lite of fearlessness*/
- , 0 /*terminator*/
- };
- object_wipe(o_ptr);
- /* learn about some basic ego items */
- /* Note that this is just to get you started. */
- for ( ego = 0 ; egos[ego] ; ego++)
- {
- o_ptr->name2 = egos[ego];
- alchemist_learn_object(o_ptr);
- }
- msg_print("You recall your old master teaching you about elemental item infusing.");
- }
- if ( lev == 10)
- {
- /*For 'hard rooms' Players only, learn about diggers.*/
- if (ironman_rooms)
- {
- msg_print("There's gotta be an easier way to get into all these vaults!");
- object_wipe(o_ptr);
- o_ptr->name2 = 101; /* Ego item, 'of digging' */
- alchemist_learn_object(o_ptr);
- }
- }
- if ( lev == 25)
- {
- msg_print("You recall your old master reminiscing about legendary infusings");
- msg_print("and the Philosophers' stone.");
-
- /* No auto-learn on artifacts - by this level, you'll have *ID*'d several */
- }
- if ( lev == 25)
- {
- msg_print("You wonder about shocking daggers of slay evil.");
- }
- if ( lev == 50)
- {
- /* learn about Temporary item creation */
- /* Note that this is the ONLY way to learn this,
- because spells which create a temporary item
- also fully ID it. */
- alchemist_known_artifacts[4] |= TR5_TEMPORARY;
- msg_print("It suddenly occurs to you that artifacts don't *HAVE* to be permanent...");
- }
-
- /* Every Four Levels, learn about items that are
- * less than that.
- * Note that this isn't a significant effect after the
- * first few levels, as the level at which you are learning
- * things here quickly drops behind the level at which you
- * are finding items.
- */
- if ( (lev & 0x3) != 0 )
- return;
- lev = (lev >> 2) + 1;
- alchemist_learn_all(lev);
-
-}
-
-/* This, in combination with some code in loadsave.c,
- insures that alchemist_gain_level is called EXACTLY
- once with each possible value during the characters
- lifetime.
- */
-void alchemist_check_level()
-{
- u32b lev = get_skill(SKILL_ALCHEMY);
- if ( alchemist_gained > lev )
- return;
- /*Paranoia*/
- if ( !lev )
- return;
- while ( alchemist_gained <= lev )
- alchemist_gain_level(alchemist_gained++);
-}
-
-/*
- * do_cmd_cast calls this function if the player's class
- * is 'alchemist'.
- */
-void do_cmd_alchemist(void)
-{
- int item, ext = 0;
- int value, basechance;
- int askill;
- bool_ repeat = 0;
- char ch;
-
- object_type *o_ptr, *q_ptr;
- object_type forge, forge2;
- byte carry_o_ptr = FALSE;
-
- /* With the new skill system, we can no longer depend on
- * check_exp to handle the changes and learning involved in
- * gaining levels.
- * So we'll have to check for it here.
- */
- alchemist_check_level();
- askill = get_skill(SKILL_ALCHEMY);
-
-
- q_ptr = &forge;
-
- o_ptr = &p_ptr->inventory[INVEN_HANDS];
- if ((o_ptr->tval != TV_GLOVES) || (o_ptr->sval != SV_SET_OF_LEATHER_GLOVES))
- {
- msg_print("You must wear gloves in order to do alchemy.");
- return;
- }
-
- if (p_ptr->confused)
- {
- msg_print("You are too confused!");
- return;
- }
-
- while (TRUE)
- {
- if (!get_com("[P]ower, [R]echarge or [L]eech an item, [E]xtract essences, or recipe [B]ook?", &ch))
- {
- ext = 0;
- break;
- }
- if (ch == ' ' )
- {
- ext = 0;
- break;
- }
- if (ch == 'P' || ch == 'p')
- {
- ext = 1;
- break;
- }
- if (ch == 'E' || ch == 'e')
- {
- ext = 2;
- break;
- }
- if (ch == 'R' || ch == 'r')
- {
- ext = 3;
- break;
- }
- if (ch == 'L' || ch == 'l')
- {
- ext = 2;
- repeat = 1;
- break;
- }
- if (ch == 'B' || ch == 'b')
- {
- ext = 4;
- break;
- }
- }
-
- /**********Add a power*********/
- if (ext == 1)
- {
- int i, qty, tval, sval = 0, ego = 0;
- char o_name[200];
-
- /* Get an item */
- if (!get_item(&item,
- "Empower which item? ",
- "You have no empowerable items.",
- (USE_INVEN | USE_FLOOR), item_tester_hook_empower)) return;
-
- /* Get the item */
- o_ptr = get_object(item);
-
- /* Create an artifact from an ego or double ego item,
- * from a previous artifact, or finish an artifact
- */
- if ((askill >= 25) && (artifact_p(o_ptr) || o_ptr->name2) && has_ability(AB_CREATE_ART))
- {
- if (get_check("Create an artifact?"))
- {
- do_cmd_toggle_artifact(o_ptr);
- return;
- }
- /* Don't change artifacts or double ego items further */
- else if (artifact_p(o_ptr) || (o_ptr->name2 && o_ptr->name2b))
- return;
- }
- /*Ok, now we have the item, so we can now pick recipes.
- Note: No recipe is known unless we have 'extracted' from
- that object type. I.E. the 'know' flag (also greater identify)
- is set.
- */
-
- /* Here we're not setting what kind of ego item it IS,
- * where' just deciding that it CAN be an ego item */
- if ( o_ptr->name2 ) /* creating a DUAL ego */
- ego = TRUE;
- if ( o_ptr->tval < 40 && o_ptr->tval != TV_BOTTLE)
- ego = TRUE;
- if ( o_ptr->tval == TV_ROD_MAIN || o_ptr->tval == TV_DAEMON_BOOK || o_ptr->tval == TV_BOOK)
- ego = TRUE;
-
- sval = o_ptr->sval;
- if (!ego)
- {
- switch ( o_ptr->tval)
- {
- case TV_WAND:
- sval = SV_WAND_NOTHING;
- break;
- case TV_RING:
- sval = SV_RING_NOTHING;
- break;
- case TV_STAFF:
- sval = SV_STAFF_NOTHING;
- break;
- case TV_BOTTLE:
- sval = 1;
- break;
- case TV_AMULET:
- sval = SV_AMULET_NOTHING;
- break;
- case TV_SCROLL:
- sval = SV_SCROLL_NOTHING;
- break;
- case TV_ROD:
- sval = SV_ROD_NOTHING;
- break;
- }
- }
- if ( o_ptr->sval != sval )
- ego = TRUE;
-
- tval = o_ptr->tval;
- sval = o_ptr->sval;
-
- /*HACK - bottles don't have the same tval as potions*/
- /*Everything else will have the same tval after empowering*/
- if (tval == TV_BOTTLE) tval = TV_POTION;
- if (ego)
- if (o_ptr->name2)
- ego = alchemist_recipe_select(&tval, sval, o_ptr->name2, FALSE);
- else
- ego = alchemist_recipe_select(&tval, sval, -1, FALSE);
- else
- sval = alchemist_recipe_select(&tval, 0, 0, FALSE);
-
- if ( sval < 0 || ego < 0)
- return;
-
- /* Check to make sure we have enough essences */
- /* theoretically this is taken care of by recipe_select*/
- /* but we'll double check just for paranoia. */
- if (!alchemist_items_check(tval, sval, ego, 0, TRUE))
- {
- msg_print("You do not have enough essences.");
- return;
- }
-
- /* Take a turn */
- energy_use = 100;
-
- /* Use up the essences */
- (void)alchemist_items_check(tval, sval, ego, -1, TRUE);
-
- /* Enchant stacks of ammunition at a time */
- if ( o_ptr->tval == TV_SHOT || o_ptr->tval == TV_ARROW || o_ptr->tval == TV_BOLT )
- {
- qty = 1;
- while (qty < o_ptr->number && alchemist_items_check(tval, sval, ego, -1, FALSE))
- qty++;
- }
- else
- qty = 1;
-
- /* Copy the object */
- q_ptr = &forge;
- object_copy(q_ptr, o_ptr);
-
- if ( o_ptr->tval == TV_WAND)
- {
- /* distribute charges on wands */
- q_ptr->pval = o_ptr->pval / o_ptr->number;
- o_ptr->pval -= q_ptr->pval;
- }
-
- o_ptr = q_ptr;
- o_ptr->number = qty;
- carry_o_ptr = TRUE;
-
- /* Destroy the initial object */
- inc_stack_size(item, -qty);
-
-
- if ( ego )
- {
- int pval, pval2;
- s32b pval3;
-
- pval = o_ptr->pval;
- pval2 = o_ptr->pval2;
- pval3 = o_ptr->pval3;
-
- if (o_ptr->name2)
- o_ptr->name2b = ego;
- else
- o_ptr->name2 = ego;
- o_ptr->pval = randint(e_info[ego].max_pval - 1) + 1;
- /* dilemma - how to prevent creation of cursed items,
- * without allowing the creation of artifacts?
- * We can't, unless we want to finalize the ego flags ourselves.
- */
- apply_magic(o_ptr, askill * 2, FALSE, FALSE, FALSE);
- /* Remember what the old pval was, so that we can re-apply it. */
- if ( o_ptr->tval == TV_WAND
- || o_ptr->tval == TV_RING
- || o_ptr->tval == TV_AMULET
- || o_ptr->tval == TV_STAFF)
- {
- o_ptr->pval = pval;
- o_ptr->pval2 = pval2;
- o_ptr->pval3 = pval3;
- }
- else if (o_ptr->tval == TV_ROD_MAIN)
- {
- o_ptr->pval = pval;
- }
- else if ((o_ptr->tval == TV_BOOK) && (o_ptr->sval == 255))
- {
- o_ptr->pval = pval;
- }
- else if (o_ptr->tval == TV_SHOT
- || o_ptr->tval == TV_ARROW
- || o_ptr->tval == TV_BOLT)
- {
- o_ptr->pval2 = pval2;
- }
- else if (o_ptr->tval == TV_INSTRUMENT)
- {
- o_ptr->pval2 = pval2;
- }
-
- /* Calculate failure rate, lev=val/2500+5 */
- value = MIN(e_info[o_ptr->name2].cost, 50000);
- if (o_ptr->name2b) value += MIN(e_info[o_ptr->name2b].cost, 50000);
- basechance = (value / 1000 + 5 - get_skill_scale(SKILL_ALCHEMY, 100) ) * 10;
- if ( basechance < 0) basechance = 0;
- if ( basechance > 100) basechance = 100;
-
- value = object_value_real(o_ptr);
-
- }
- else /* not an ego item */
- {
- o_ptr = &forge;
- object_wipe(o_ptr);
- object_prep(o_ptr, lookup_kind(tval, sval));
- apply_magic(o_ptr, askill * 2, FALSE, FALSE, FALSE, boost::make_optional(0));
- if ( o_ptr->tval == TV_WAND || o_ptr->tval == TV_STAFF)
- o_ptr->pval = 0;
- value = object_value_real(o_ptr);
-
- basechance = k_info[o_ptr->k_idx].level - askill * 2;
- basechance *= 10;
-
- /* Can't fail more that 100% of the time... */
- if (basechance > 100)
- basechance = 100;
- /* Always success in creation of potion of detonations */
- if (o_ptr->tval == TV_POTION && o_ptr->sval == SV_POTION_DETONATIONS)
- {
- basechance /= 10;
- }
- }
-
- /* Use up gold to create items */
- /* this has the effect of making the alchemist
- chronically short of funds, unless he finds the
- philosopher's stone. It also means the easiest
- things to make are 'bad', like a potion of
- detonations...
- */
- /* Problem - to restrictive. We need something
- which requires less money. But at the same time,
- we don't want an 'easy cash' situation. Maybe something
- like '10% * level difference', meaning at skill level 5,
- level one items are free? But egos are frequently level
- zero! Maybe egos are forced to level 25? with a cost ceiling?
- I mean, Potions and scrolls are really the problem causing the
- 'easy cash' situation, it's ego items. Ego items require
- relatively few essences, and the rewards are HUGE. Most powerful
- potions and scrolls require rare essences. Maybe force all egos
- to require a magic essence? But then you'd get lots of magic
- from distilling them. Maybe consumed in the creation? then when
- you got a powerful item, you could make one ego item...
- But if making things doesn't take gold, what about the cash
- does the Philosopher's stone do?
- Time*/
-
- if (basechance > 0 && value)
- {
- char string[80];
- string[0] = '0';
- string[1] = 0;
-
- msg_format("The chance of success is only %d%%!", 100-basechance);
- get_string("How much gold do you want to add?", string, 50);
- i = atoi(string);
- /* Note: don't trust the user to enter a positive number... */
- if ( i < 0)
- i = 0;
- if ( i > p_ptr->au)
- i = p_ptr->au;
-
- if (i)
- {
- basechance = basechance - (i * 20) / value;
- msg_format("The chance of success improved to %d%%.", 100-basechance);
- }
-
- if (randint(100) < basechance )
- /*creation failed, even with the extra gold...*/
- carry_o_ptr = FALSE;
-
- /* Redraw gold */
- p_ptr->au -= i;
- p_ptr->redraw |= (PR_FRAME);
- }
-
- /* Set fully identified
- * After all, the player just made it...
- */
- object_aware(o_ptr);
- object_known(o_ptr);
- o_ptr->ident |= IDENT_MENTAL;
- o_ptr->found = OBJ_FOUND_SELFMADE;
-
- object_desc(o_name, o_ptr, FALSE, 0);
-
- if ( carry_o_ptr)
- {
- msg_format("You have successfully created %s %s",
- (o_ptr->number > 1 ? "some" : (is_a_vowel(o_name[0]) ? "an" : "a")),
- o_name);
-
- if (inven_carry_okay(o_ptr))
- inven_carry(o_ptr, FALSE);
- else
- {
- drop_near(o_ptr, 0, p_ptr->py, p_ptr->px);
- msg_format("You drop the %s", o_name);
- }
- carry_o_ptr = FALSE;
- }
- else /* don't carry, or in other words... */
- {
- int level = k_info[o_ptr->k_idx].level;
- if (o_ptr->name1) /* created ego item */
- level += e_info[o_ptr->name2].level;
-
- msg_format("Your attempt backfires! Your %s explodes!", o_name);
- take_hit(damroll(3, level - askill ) , "Alchemical Explosion");
- p_ptr->redraw |= (PR_FRAME);
- }
-
- /* Combine / Reorder the pack (later) */
- p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
- /* Optimize the entire p_ptr->inventory - needed because we
- don't know how many essences where used, and we may
- have 'used up' a wielded item as well.
- */
- for ( item = 0 ; item < INVEN_TOTAL ; item++ )
- inven_item_optimize(item);
-
- /**********Extract a power*********/
- }
- else if (ext == 2)
- {
- int ego;
- bool_ discharge_stick = FALSE;
-
- /* s_ptr holds the empty items */
- object_type *s_ptr = NULL;
- bool_ carry_s_ptr = FALSE;
-
- /* Get an item */
- if (!get_item(&item,
- "Extract from which item? ",
- "You have no item to extract power from.",
- (USE_INVEN | USE_FLOOR),
- item_tester_hook_extractable)) return;
-
- /* Get the item */
- o_ptr = get_object(item);
-
- /* This is to prevent creating magic essences by extracting
- * from a recharged wand of dragon breath or something.
- */
- if (( o_ptr->tval == TV_WAND || o_ptr->tval == TV_STAFF )
- && o_ptr->art_flags4 & TR4_RECHARGED)
- {
- msg_print("You cannot extract essences after it's been magically recharged.");
- return;
- }
-
- /* Take a turn */
- energy_use = 100;
-
- /* Handle Rods before the loop, since they don't stack */
- if (o_ptr->tval == TV_ROD_MAIN && o_ptr->pval != SV_ROD_NOTHING)
- {
- rod_tip_extract(o_ptr);
- return;
- }
-
- do
- { /* Repeat (for leech command) */
-
- /* Create the items.
- * we don't care if they drop to the ground,
- * and if no action was taken, return
- */
- ego = 0;
- if ( o_ptr->name2)
- ego = o_ptr->name2;
-
- /* For ego staves and wands (not of nothing), discharge before extracting the ego */
- discharge_stick = (o_ptr->pval > 0 &&
- ((o_ptr->tval == TV_STAFF && o_ptr->sval != SV_STAFF_NOTHING) ||
- (o_ptr->tval == TV_WAND && o_ptr->sval != SV_WAND_NOTHING)));
- if (discharge_stick)
- ego = 0;
-
- if (!alchemist_items_check(o_ptr->tval, o_ptr->sval, ego, 1, TRUE))
- {
- msg_print("You cannot extract anything from that item.");
- return;
- }
-
- if (o_ptr->name2b && !alchemist_items_check(o_ptr->tval, o_ptr->sval, o_ptr->name2b, 1, TRUE))
- {
- /* do nothing - if the second ego can't be extracted
- because there is no recipe for it, simply destroy it
- */
- }
-
- /* Once in three times, learn how to make the item */
- /* Sorry for the complicated if! Basically, if it's an
- * unknown regular item or an unknown ego item, there's
- * a one in 3 chance that it'll be id'd */
- if (((!ego && !k_info[o_ptr->k_idx].know)
- || (ego && !(alchemist_known_egos[ego / 32] & (1 << (ego % 32)))))
- && randint(3) == 1)
- {
- msg_print("While destroying it, you gain insight into this item.");
- /* If over level 10, the player has a chance of 'greater ID'
- * on extracted items
- */
- if (askill > 9)
- object_out_desc(o_ptr, NULL, FALSE, TRUE);
- alchemist_learn_object(o_ptr);
- }
-
- /* Always learn what kind of thing it is */
- object_known(o_ptr);
- object_aware(o_ptr);
-
- /* If it's a wand or staff with charges (but not of nothing),
- * decrease number of charges, unstacking if needed.
- * Otherwise, create the 'of nothing' item and destroy the old one.
- */
- if (discharge_stick)
- {
- /* Unstack staves */
- if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
- {
- /* Create one local copy of the staff */
- q_ptr = &forge2;
- object_copy(q_ptr, o_ptr);
-
- /* Modify quantity */
- q_ptr->number = 1;
-
- /* Unstack the copied staff */
- o_ptr->number--;
-
- /* Use the local copy of the staff */
- o_ptr = q_ptr;
- carry_o_ptr = TRUE;
- }
- /* remove one charge */
- o_ptr->pval--;
- }
- else
- {
- /* Create the empty, plain item */
- /* If the item was already created, increase the number */
- if (carry_s_ptr)
- {
- s_ptr->number++;
- }
- else
- {
- /* Otherwise we must create a local copy of the empty item */
- int tval, sval;
- bool_ create_item = TRUE;
-
- tval = o_ptr->tval;
- if ( !ego && (tval == TV_POTION || tval == TV_POTION2))
- tval = TV_BOTTLE;
-
- sval = o_ptr->sval;
-
- if (!ego)
- {
- switch ( tval)
- {
- case TV_WAND:
- sval = SV_WAND_NOTHING;
- break;
- case TV_RING:
- sval = SV_RING_NOTHING;
- break;
- case TV_STAFF:
- sval = SV_STAFF_NOTHING;
- break;
- case TV_BOTTLE:
- sval = 1;
- break;
- case TV_AMULET:
- sval = SV_AMULET_NOTHING;
- break;
- case TV_SCROLL:
- sval = SV_SCROLL_NOTHING;
- break;
- case TV_ROD:
- sval = SV_ROD_NOTHING;
- break;
- default:
- create_item = FALSE;
- }
- }
-
- if (create_item)
- {
- /* Create the empty item */
- s_ptr = &forge;
- object_wipe(s_ptr);
- object_prep(s_ptr, lookup_kind(tval, sval));
- s_ptr->number = 1;
-
- /* Force creation of non ego non cursed */
- apply_magic(s_ptr, 0, FALSE, FALSE, FALSE, boost::make_optional(0));
-
- /* Hack -- remove possible curse */
- if (cursed_p(s_ptr))
- {
- s_ptr->art_flags3 &= ~(TR3_CURSED | TR3_HEAVY_CURSE);
- s_ptr->ident &= ~(IDENT_CURSED);
- }
-
- /* Restore pvals (e.g. charges ==0) of the item */
- if (ego && ((tval == TV_WAND) || (tval == TV_STAFF) ||
- (tval == TV_RING) || (tval == TV_AMULET)))
- {
- s_ptr->pval = o_ptr->pval;
- s_ptr->pval2 = o_ptr->pval2;
- s_ptr->pval3 = o_ptr->pval3;
- }
- /* Restore the spell stored in a random book */
- else if ((o_ptr->tval == TV_BOOK) && (o_ptr->sval == 255))
- {
- s_ptr->pval = o_ptr->pval;
- }
- /* Restore the type of explosive ammo */
- else if (o_ptr->tval == TV_SHOT || o_ptr->tval == TV_ARROW
- || o_ptr->tval == TV_BOLT)
- {
- s_ptr->pval2 = o_ptr->pval2;
- }
- /* Restore the music stored in an instrument */
- else if (o_ptr->tval == TV_INSTRUMENT)
- {
- s_ptr->pval2 = o_ptr->pval2;
- }
-
- object_aware(s_ptr);
- object_known(s_ptr);
- s_ptr->ident |= IDENT_STOREB;
-
- /* The empty item will be added to the p_ptr->inventory later */
- carry_s_ptr = TRUE;
- }
- }
-
- /* Now, we can delete the original (leeched) object.
- * Is o_ptr an p_ptr->inventory / floor item or a local copy?
- */
- if (!carry_o_ptr)
- {
- /* Break the leech-loop if it was the last item */
- if (o_ptr->number == 1)
- repeat = 0;
-
- inc_stack_size(item, -1);
- }
- else
- {
- /* Forget the local object */
- carry_o_ptr = FALSE;
-
- /* reset o_ptr to the original stack,
- * which contains at least another item */
- o_ptr = get_object(item);
- }
- }
- }
- while ( repeat == 1);
-
- /* If we carry empty items, add them to the p_ptr->inventory */
- if (carry_s_ptr)
- inven_carry(s_ptr, TRUE);
-
- /* Combine / Reorder the pack (later) */
- p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
- /* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
-
- /******* Recharge an item *******/
- }
- else if (ext == 3)
- {
- int item;
-
- /* Get an item */
- if (!get_item(&item,
- "Recharge which item? ",
- "You have no rechargable items.",
- (USE_INVEN | USE_FLOOR),
- item_tester_hook_recharge()))
- {
- return;
- }
-
- /* Get the item */
- o_ptr = get_object(item);
-
- /* Make sure we have enough essences to recharge this */
- if (!alchemist_items_check(o_ptr->tval, o_ptr->sval, 0, 0, TRUE))
- {
- msg_print("You don't have the essences to recharge this item.");
- return;
- }
-
- /* Take a turn */
- energy_use = 100;
-
- /* Destroy the essences */
- (void)alchemist_items_check(o_ptr->tval, o_ptr->sval, 0, -1, TRUE);
-
- if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
- {
- /* Unstack staves */
- /* Get local object */
- q_ptr = &forge2;
-
- /* Obtain a local object */
- object_copy(q_ptr, o_ptr);
-
- /* Modify quantity */
- q_ptr->number = 1;
-
- /* Unstack the used item */
- o_ptr->number--;
-
- o_ptr = q_ptr;
- carry_o_ptr = TRUE;
- }
- o_ptr->pval++;
- }
- else if ( ext == 4)
- {
- alchemist_recipe_book();
- }
- /* Just in case - */
- if (carry_o_ptr)
- {
- /* the o_ptr item was probably an unstacked staff
- * Anyway, we need to add it to the p_ptr->inventory */
- if (inven_carry_okay(o_ptr))
- inven_carry(o_ptr, TRUE);
- else
- drop_near(o_ptr, 0, p_ptr->py, p_ptr->px);
- }
-}
-
-
-/*
* Command to ask favors from your god.
*/
void do_cmd_pray(void)
diff --git a/src/cmd7.hpp b/src/cmd7.hpp
index da96bb57..162e5461 100644
--- a/src/cmd7.hpp
+++ b/src/cmd7.hpp
@@ -15,8 +15,6 @@ extern void do_cmd_summoner(void);
extern void do_cmd_mindcraft(void);
extern void do_cmd_mimic(void);
extern void use_ability_blade(void);
-extern int alchemist_learn_object(object_type *o_ptr);
-extern void do_cmd_alchemist(void);
extern void do_cmd_beastmaster(void);
extern void do_cmd_powermage(void);
extern void do_cmd_possessor(void);
diff --git a/src/defines.h b/src/defines.h
index 2c05acf5..ee875b6a 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -434,7 +434,6 @@
/* XXX */
#define MKEY_MINDCRAFT 2
#define MKEY_ANTIMAGIC 3
-#define MKEY_ALCHEMY 5
#define MKEY_MIMIC 6
#define MKEY_NECRO 7
#define MKEY_POWER_MAGE 8
@@ -1192,8 +1191,6 @@
#define TV_SKELETON 1 /* Skeletons ('s') */
#define TV_BOTTLE 2 /* Empty bottles ('!') */
-/* XXX */
-#define TV_BATERIE 4 /* For the Alchemists */
#define TV_SPIKE 5 /* Spikes ('~') */
#define TV_MSTAFF 6 /* Mage Staffs */
#define TV_CHEST 7 /* Chests ('~') */
@@ -1844,27 +1841,6 @@
#define SV_FOOD_GREAT_HEALTH 41
#define SV_FOOD_FORTUNE_COOKIE 42
-/* The "sval" codes for TV_BATERIE */
-#define SV_BATERIE_POISON 1
-#define SV_BATERIE_EXPLOSION 2
-#define SV_BATERIE_TELEPORT 3
-#define SV_BATERIE_COLD 4
-#define SV_BATERIE_FIRE 5
-#define SV_BATERIE_ACID 6
-#define SV_BATERIE_LIFE 7
-#define SV_BATERIE_CONFUSION 8
-#define SV_BATERIE_LITE 9
-#define SV_BATERIE_CHAOS 10
-#define SV_BATERIE_TIME 11
-#define SV_BATERIE_MAGIC 12
-#define SV_BATERIE_XTRA_LIFE 13
-#define SV_BATERIE_DARKNESS 14
-#define SV_BATERIE_KNOWLEDGE 15
-#define SV_BATERIE_FORCE 16
-#define SV_BATERIE_LIGHTNING 17
-#define SV_BATERIE_MANA 18
-#define MAX_BATERIE_SVAL 18
-
/* The "sval" codes for TV_CORPSE */
#define SV_CORPSE_CORPSE 1
#define SV_CORPSE_SKELETON 2
@@ -2687,7 +2663,6 @@
#define TR4_LITE2 0x04000000L /* lite radius 2 */
#define TR4_LITE3 0x08000000L /* lite radius 3 */
#define TR4_FUEL_LITE 0x10000000L /* fuelable lite */
-#define TR4_ART_EXP 0x20000000L /* Will accumulate xp */
#define TR4_CURSE_NO_DROP 0x40000000L /* The obj wont be dropped */
#define TR4_NO_RECHARGE 0x80000000L /* Object Cannot be recharged */
#define TR4_NULL_MASK 0xFFFFFFFCL
@@ -3434,14 +3409,6 @@
#define INIT_POSITION 0x10
/*
- * Alchemists defines
- */
-#define MAX_ALCHEMIST_RECIPES 20
-#define ALCHEMIST_ENCHANT_DAM 0x01
-#define ALCHEMIST_ENCHANT_PVAL 0x02
-#define ALCHEMIST_ENCHANT_AC 0x04
-
-/*
* Fate
*/
#define MAX_FATES 200
@@ -3852,7 +3819,6 @@
#define AB_MAX_BLOW2 4
#define AB_AMMO_CREATION 5
#define AB_DEATH_TOUCH 6
-#define AB_CREATE_ART 7
#define AB_FAR_REACHING 8
#define AB_TRAPPING 9
#define AB_UNDEAD_FORM 10
diff --git a/src/flags_group.hpp b/src/flags_group.hpp
index f71e3704..bdf5216b 100644
--- a/src/flags_group.hpp
+++ b/src/flags_group.hpp
@@ -3,7 +3,7 @@
#include "h-basic.h"
/**
- * For level gaining artifacts, artifact creation, ...
+ * For level gaining artifacts
*/
struct flags_group
{
diff --git a/src/help.cc b/src/help.cc
index 29ebf033..a6d83079 100644
--- a/src/help.cc
+++ b/src/help.cc
@@ -23,27 +23,26 @@
#include "variable.hpp"
#define DESC_MAX 14
-#define TRIGGERED_HELP_MAX 19
+#define TRIGGERED_HELP_MAX 18
#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_ESSENCE 5
-#define HELP_GET_RUNE 6
-#define HELP_GET_ROD 7
-#define HELP_GET_ROD_TIP 8
-#define HELP_GET_TRAP_KIT 9
-#define HELP_GET_DEVICE 10
-#define HELP_WILDERNESS 11
-#define HELP_GAME_TOME 12
-#define HELP_GAME_THEME 13
-#define HELP_1ST_LEVEL 14
-#define HELP_20TH_LEVEL 15
-#define HELP_ID_SPELL_ITM 16
-#define HELP_MELEE_SKILLS 17
-#define HELP_MON_ASK_HELP 18
+#define HELP_GET_RUNE 5
+#define HELP_GET_ROD 6
+#define HELP_GET_ROD_TIP 7
+#define HELP_GET_TRAP_KIT 8
+#define HELP_GET_DEVICE 9
+#define HELP_WILDERNESS 10
+#define HELP_GAME_TOME 11
+#define HELP_GAME_THEME 12
+#define HELP_1ST_LEVEL 13
+#define HELP_20TH_LEVEL 14
+#define HELP_ID_SPELL_ITM 15
+#define HELP_MELEE_SKILLS 16
+#define HELP_MON_ASK_HELP 17
/**
* Game started?
@@ -157,7 +156,6 @@ context_help_type subrace_table[] =
context_help_type class_table[] =
{
/* ToME */
- { "Alchemist", "c_alchem.txt", 0 },
{ "Archer", "c_archer.txt", 0 },
{ "Assassin", "c_assass.txt", 0 },
{ "Axemaster", "c_axemas.txt", 0 },
@@ -234,7 +232,6 @@ context_help_type god_table[] =
context_help_type skill_table[] =
{
{ "Air", "skills.txt", 27 },
- { "Alchemy", "skills.txt", 49 },
{ "Antimagic", "skills.txt", 50 },
{ "Archery", "skills.txt", 8 },
{ "Axe-mastery", "skills.txt", 5 },
@@ -303,7 +300,6 @@ context_help_type ability_table[] =
{ "Extra Max Blow(2)", "ability.txt", 6 },
{ "Ammo creation", "ability.txt", 7 },
{ "Touch of death", "ability.txt", 8 },
- { "Artifact Creation", "ability.txt", 9 },
{ "Far reaching attack", "ability.txt", 10 },
{ "Trapping", "ability.txt", 11 },
{ "Undead Form", "ability.txt", 12 },
@@ -339,11 +335,6 @@ static bool_ trigger_found_stairs(void *in, void *out) {
return (cave[p->y][p->x].feat == FEAT_MORE);
}
-static bool_ trigger_get_essence(void *in, void *out) {
- hook_get_in *g = (hook_get_in *) in;
- return (g->o_ptr->tval == TV_BATERIE);
-}
-
static bool_ trigger_get_rune(void *in, void *out) {
hook_get_in *g = (hook_get_in *) in;
return ((g->o_ptr->tval == TV_RUNE1) ||
@@ -461,13 +452,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_ESSENCE,
- HOOK_GET,
- trigger_get_essence,
- { "Ah, an essence! Those magical containers stores energies. They are used",
- "with the Alchemy skill to create or modify the powers of items.",
- NULL }
- },
{ HELP_GET_RUNE,
HOOK_GET,
trigger_get_rune,
diff --git a/src/init1.cc b/src/init1.cc
index 1f2023f0..d9ad1ccf 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -1,9 +1,7 @@
#include "init1.hpp"
#include "ability_type.hpp"
-#include "alchemist_recipe.hpp"
#include "artifact_type.hpp"
-#include "artifact_select_flag.hpp"
#include "cave.hpp"
#include "cave_type.hpp"
#include "dungeon_info_type.hpp"
@@ -696,7 +694,7 @@ cptr k_info_flags4[] =
"LITE2",
"LITE3",
"FUEL_LITE",
- "ART_EXP",
+ "XXX5",
"CURSE_NO_DROP",
"NO_RECHARGE"
};
@@ -1215,30 +1213,6 @@ d_info_dtypes[] =
{NULL, 0}
};
-/* Essence names for al_info.txt */
-static const char *essence_names[] =
-{
- "No name here", /* can't be matched, sscanf stops at spaces */
- "POISON",
- "EXPLOSION",
- "TELEPORT",
- "COLD",
- "FIRE",
- "ACID",
- "LIFE",
- "CONFUSION",
- "LITE",
- "CHAOS",
- "TIME",
- "MAGIC",
- "EXTRALIFE",
- "DARKNESS",
- "KNOWLEDGE",
- "FORCE",
- "LIGHTNING",
- "MANA",
- ""
-};
static const char *activation_names[] =
{
"NO_ACTIVATION", /* 0*/
@@ -4307,355 +4281,6 @@ errr init_k_info_txt(FILE *fp)
return (0);
}
-/*Get a kind flag, return flag*32+bit number or -1 for unknown*/
-
-int get_k_flag(char *what)
-{
- int i;
-
- /* Check flags1 */
- for (i = 0; i < 32; i++)
- {
- if (streq(what, k_info_flags1[i]))
- return i;
- if (streq(what, k_info_flags2[i]))
- return 1*32 + i;
- if (streq(what, k_info_flags2_trap[i]))
- return 1*32 + i;
- if (streq(what, k_info_flags3[i]))
- return 2*32 + i;
- if (streq(what, k_info_flags4[i]))
- return 3*32 + i;
- if (streq(what, k_info_flags5[i]))
- return 4*32 + i;
- if (streq(what, esp_flags[i]))
- return 5*32 + i;
- }
-
- /* Oops */
- msg_format("Unknown object flag '%s'.", what);
-
- /* Error */
- return ( -1);
-
-}
-
-int get_r_flag(char *what)
-{
- int i;
-
- /* Check flags */
- /* this processes all r_info_flag arrays in parallel.
- Seemed like a good idea at the time..
- */
- for (i = 0; i < 32; i++)
- {
- if (streq(what, r_info_flags1[i]))
- return i;
- if (streq(what, r_info_flags2[i]))
- return 1*32 + i;
- if (streq(what, r_info_flags3[i]))
- return 2*32 + i;
- if (streq(what, r_info_flags4[i]))
- return 3*32 + i;
- if (streq(what, r_info_flags5[i]))
- return 4*32 + i;
- if (streq(what, r_info_flags6[i]))
- return 5*32 + i;
- if (streq(what, r_info_flags7[i]))
- return 6*32 + i;
- if (streq(what, r_info_flags8[i]))
- return 7*32 + i;
- if (streq(what, r_info_flags9[i]))
- return 8*32 + i;
- }
-
- /* Oops */
- msg_format("Unknown race flag '%s'.", what);
-
- /* Error */
- return ( -1);
-}
-int init_al_info_essence(char *essence)
-{
- int i;
- for ( i = 0 ; essence_names[i][0] ; i++)
- if (!strncmp(essence_names[i], essence, 9))
- {
- return i;
- }
- return -1;
-}
-/*
- * Initialize the "al_info" array, by parsing an ascii "template" file
- */
-errr init_al_info_txt(FILE *fp)
-{
- int al_idx = 0, a_idx = 0;
- char *s, *t;
- struct artifact_select_flag *a_ptr = NULL;
- char buf[1024];
-
- /* Not ready yet */
- bool_ okay = FALSE;
-
- /* Just before the first record */
- error_idx = -1;
-
- /* Just before the first line */
- error_line = -1;
-
- /* Parse */
- while (0 == my_fgets(fp, buf, 1024))
- {
- /* Advance the line number */
- error_line++;
-
- /* Skip comments and blank lines */
- if (!buf[0] || (buf[0] == '#')) continue;
-
- /* Verify correct "colon" format */
- if (buf[1] != ':') return (1);
-
- /* Hack -- Process 'V' for "Version" */
- if (buf[0] == 'V')
- {
- int v1, v2, v3;
-
- /* Scan for the values */
- if (3 != sscanf(buf + 2, "%d.%d.%d", &v1, &v2, &v3)) return (2);
-
- /* Okay to proceed */
- okay = TRUE;
-
- /* Continue */
- continue;
- }
-
- /* No version yet */
- if (!okay) return (2);
-
- /* Process 'I' for "Info" (one line only) */
- if (buf[0] == 'I')
- {
- int tval, sval, qty;
-
- /* Scan for the values */
- if (3 != sscanf(buf + 2, "%d:%d:%d",
- &tval, &sval, &qty))
- {
- return (1);
- }
-
- /* ignore everything after the first space. */
- s = strchr(buf, ' ');
- if (s != NULL)
- *s = 0;
-
- /* Save the values */
- alchemist_recipes[al_idx].tval = tval;
- alchemist_recipes[al_idx].sval = sval;
- alchemist_recipes[al_idx].qty = qty;
- alchemist_recipes[al_idx].sval_essence = init_al_info_essence(strrchr(buf, ':') + 1);
- if (alchemist_recipes[al_idx].sval_essence < 0)
- return 5;
-
- al_idx++;
- if (al_idx >= max_al_idx)
- return 7;
- /* Next... */
- continue;
- }
- if (buf[0] == 'a')
- {
- int qty;
- if ( 1 != sscanf(buf + 2, "%d", &qty))
- {
- return (1);
- }
- s = strrchr(buf, ':');
- *(s++) = 0;
- t = strchr(s, ' ');
- *(t++) = 0;
- alchemist_recipes[al_idx].tval = 0;
- alchemist_recipes[al_idx].sval = get_k_flag(s);
- alchemist_recipes[al_idx].qty = qty;
- alchemist_recipes[al_idx].sval_essence = init_al_info_essence(t);
- if (alchemist_recipes[al_idx].sval_essence < 0)
- return 1;
-
- al_idx++;
- if (al_idx >= max_al_idx)
- return 7; /* 7 is an 'out of memory' error */
-
- continue;
- }
- if (buf[0] == 'A')
- {
- int group, level, pval, rtval, rsval, rpval;
- long xp;
- /*Verify that complete description information is
- Recorded for previous Artifact flag
- */
- if (a_ptr
- && (!a_ptr->group || !a_ptr->desc || !a_ptr->item_desc != !a_ptr->rtval)
- )
- return (1);
-
- a_ptr = &a_select_flags[a_idx++];
-
- if ( 7 != sscanf(buf + 2, "%d:%d:%d:%d:%d:%d:%ld",
- &group, &rtval, &rsval, &rpval, &pval, &level, &xp))
- return (1);
- a_ptr->group = group;
- a_ptr->rtval = rtval;
- a_ptr->rsval = rsval;
- a_ptr->rpval = rpval;
- a_ptr->pval = pval;
- a_ptr->level = level;
- a_ptr->xp = xp;
- continue;
- }
-
- /*Anything else here MUST be a artifact flag line*/
- if ( !a_ptr)
- return (3);
-
- if (buf[0] == 'F')
- {
- /* Get the Item flag associated with this */
- a_ptr->flag = get_k_flag(buf + 2);
- if (a_ptr->flag == -1)
- return (1);
- continue;
- }
- if (buf[0] == 'x')
- {
- /* Get the activation name associated with this */
- a_ptr->flag = -get_activation(buf + 2);
- if (a_ptr->flag == 1)
- return (1);
- a_ptr->group = 88;
- a_ptr->pval = 0;
- continue;
- }
- /* Get the race flags associated with this */
- if (buf[0] == 'f')
- {
- char *s, *t;
- int idx = 0;
-
- if ( a_ptr->rflag[0] )
- {
- msg_print("duplicate f: entries for one corpse");
- return (5);
- }
-
- if ( a_ptr->rtval != TV_CORPSE )
- {
- msg_print("f: section for corpse flags only");
- return (5);
- }
- if ( a_ptr->rpval )
- {
- msg_print("Can't specify r_info.txt index with f: section");
- return (5);
- }
-
- /* Parse every entry textually */
- for (s = buf + 2; *s; )
- {
- /* Find the end of this entry */
- for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
-
- /* Nuke and skip any dividers */
- if (*t)
- {
- *t++ = '\0';
- while ((*t == ' ') || (*t == '|')) t++;
- }
-
- if ( idx > 5 )
- {
- msg_print("Limit on race flags is currently 6");
- return (5);
- }
-
- /* Parse this entry */
- a_ptr->rflag[idx] = get_r_flag(s);
- if (a_ptr->rflag[idx++] == -1)
- return (5);
-
- /* Start the next entry */
- s = t;
- }
-
- /* Next... */
- continue;
- }
-
- /* Process 'p' for "Plural Description" */
- /* Only valid for flag which depend on pval */
- if (buf[0] == 'p')
- {
- /* Reject if doesn't depend on pval */
- if (!a_ptr->pval)
- return (1);
-
- /* Acquire the description */
- s = buf + 2;
-
- /* Copy plural description */
- assert(!a_ptr->item_descp);
- a_ptr->item_descp = my_strdup(s);
-
- /* Next... */
- continue;
- }
-
- /* Process 'D' for "Description" (one line only) */
- if (buf[0] == 'D')
- {
- /* Acquire the description */
- s = buf + 2;
-
- /* Copy description */
- assert(!a_ptr->desc);
- a_ptr->desc = my_strdup(s);
-
- /* Next... */
- continue;
- }
-
- /* Process 'd' for "Item Description" (one line only) */
- if (buf[0] == 'd')
- {
- /* Acquire the name */
- s = buf + 2;
-
- /* Reject if we already have a description */
- if (a_ptr->item_desc)
- return (7);
-
- /* Copy description */
- assert(!a_ptr->item_desc);
- a_ptr->item_desc = my_strdup(s);
-
- /* Next... */
- continue;
- }
-
- /* Oops */
- return (6);
- }
-
- /* No version yet */
- if (!okay) return (2);
-
- /* Success */
- return (0);
-}
-
/*
* Grab one flag in an artifact_type from a textual string
*/
@@ -10619,12 +10244,6 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
max_a_idx = atoi(zz[1]);
}
- /* Maximum al_idx */
- else if (zz[0][0] == 'a')
- {
- max_al_idx = atoi(zz[1]);
- }
-
/* Maximum e_idx */
else if (zz[0][0] == 'E')
{
diff --git a/src/init1.hpp b/src/init1.hpp
index 69bcec9b..766e467d 100644
--- a/src/init1.hpp
+++ b/src/init1.hpp
@@ -12,7 +12,6 @@ extern errr init_v_info_txt(FILE *fp);
extern errr init_f_info_txt(FILE *fp);
extern errr init_k_info_txt(FILE *fp);
extern errr init_a_info_txt(FILE *fp);
-extern errr init_al_info_txt(FILE *fp);
extern errr init_ra_info_txt(FILE *fp);
extern errr init_e_info_txt(FILE *fp);
extern errr init_r_info_txt(FILE *fp);
diff --git a/src/init2.cc b/src/init2.cc
index f80b832a..35d42a17 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -2,9 +2,7 @@
#include "init2.h"
#include "ability_type.hpp"
-#include "alchemist_recipe.hpp"
#include "alloc_entry.hpp"
-#include "artifact_select_flag.hpp"
#include "artifact_type.hpp"
#include "cave.hpp"
#include "cave_type.hpp"
@@ -600,23 +598,6 @@ namespace {
};
- struct al_info_traits {
-
- static constexpr char const *name = "al_info.txt";
-
- static void allocate()
- {
- alchemist_recipes = make_array<alchemist_recipe>(max_al_idx);
- a_select_flags = make_array<artifact_select_flag>(max_al_idx);
- }
-
- static errr parse(FILE *fp)
- {
- return init_al_info_txt(fp);
- }
-
- };
-
}
template<typename T> static errr init_x_info() {
@@ -1403,10 +1384,6 @@ void init_angband(void)
note("[Initialising arrays... (abilities)]");
if (init_x_info<ab_info_traits>()) quit("Cannot initialise abilities");
- /* Initialise alchemy info */
- note("[Initialising arrays... (alchemy)]");
- if (init_x_info<al_info_traits>()) quit("Cannot initialise alchemy");
-
/* Initialise player info */
note("[Initialising arrays... (players)]");
if (init_x_info<p_info_traits>()) quit("Cannot initialise players");
diff --git a/src/loadsave.cc b/src/loadsave.cc
index 13e4911f..c7ebf68d 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -184,7 +184,6 @@ static void do_xtra(int k_idx, ls_flag_t flag)
{
if (k_ptr->aware) tmp8u |= 0x01;
if (k_ptr->tried) tmp8u |= 0x02;
- if (k_ptr->know) tmp8u |= 0x04;
if (k_ptr->artifact) tmp8u |= 0x80;
do_byte(&tmp8u, flag);
@@ -195,7 +194,6 @@ static void do_xtra(int k_idx, ls_flag_t flag)
do_byte(&tmp8u, flag);
k_ptr->aware = ((tmp8u & 0x01) ? TRUE : FALSE);
k_ptr->tried = ((tmp8u & 0x02) ? TRUE : FALSE);
- k_ptr->know = ((tmp8u & 0x04) ? TRUE : FALSE);
k_ptr->artifact = ((tmp8u & 0x80) ? TRUE : FALSE);
return;
}
@@ -586,24 +584,6 @@ static bool_ do_extra(ls_flag_t flag)
do_s16b(&p_ptr->luck_base, flag);
do_s16b(&p_ptr->luck_max, flag);
- /* Found 24 unused bytes here...
- Converted it to be the alchemist's
- known artifact flags.
- Note that the ego flags and the gained levels
- record are recorded here too, but we use the
- _ver_ format to protect save file compatablity.
- Note that the other alchemist knowledge (item types known)
- is stored in do_aux, and is a bit flag in a previously
- unused bit.
- */
- for (i = 0; i < 6 ; ++i)
- do_u32b(&alchemist_known_artifacts[i], flag);
-
- for (i = 0; i < 32 ; ++i)
- do_u32b(&alchemist_known_egos[i], flag);
-
- do_u32b(&alchemist_gained, flag);
-
do_s32b(&p_ptr->au, flag);
do_s32b(&p_ptr->max_exp, flag);
diff --git a/src/object1.cc b/src/object1.cc
index eca26087..c38f2254 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -425,7 +425,6 @@ static bool_ object_easy_know(int i)
case TV_SCROLL:
case TV_ROD:
case TV_ROD_MAIN:
- case TV_BATERIE:
{
if (k_ptr->flags3 & TR3_NORM_ART)
return ( FALSE );
@@ -1519,13 +1518,6 @@ void object_desc(char *buf, object_type *o_ptr, int pref, int mode)
break;
}
- case TV_BATERIE:
- {
- modstr = basenm;
- basenm = "& Essence~ of #";
- break;
- }
-
case TV_PARCHMENT:
{
modstr = basenm;
@@ -2011,12 +2003,6 @@ void object_desc(char *buf, object_type *o_ptr, int pref, int mode)
t = object_desc_num(t, o_ptr->elevel);
t = object_desc_chr(t, ')');
}
- if ((f4 & TR4_ART_EXP) && known)
- {
- t = object_desc_str(t, " (Exp:");
- t = object_desc_num(t, o_ptr->exp);
- t = object_desc_chr(t, ')');
- }
/* Hack -- Chests must be described in detail */
if (o_ptr->tval == TV_CHEST)
diff --git a/src/object2.cc b/src/object2.cc
index b0e33365..98d22c2e 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -1709,13 +1709,6 @@ bool_ object_similar(object_type const *o_ptr, object_type const *j_ptr)
break;
}
- /* UHH ugly hack for the fireproof quest, sorry */
- case TV_BATERIE:
- {
- if (o_ptr->pval2 != j_ptr->pval2) return (FALSE);
- break;
- }
-
/* Various */
default:
{
@@ -4382,6 +4375,7 @@ static bool kind_is_theme(int k_idx)
prob = match_theme.combat;
break;
case TV_HAFTED:
+ // FIXME: These cases can be shortened drastically
prob = match_theme.combat;
break;
case TV_POLEARM:
@@ -4436,9 +4430,6 @@ static bool kind_is_theme(int k_idx)
case TV_POTION2:
prob = match_theme.magic;
break;
- case TV_BATERIE:
- prob = match_theme.magic;
- break;
case TV_RANDART:
prob = match_theme.magic;
break;
diff --git a/src/object_kind.hpp b/src/object_kind.hpp
index 40a77589..a67d1d61 100644
--- a/src/object_kind.hpp
+++ b/src/object_kind.hpp
@@ -73,8 +73,6 @@ struct object_kind
bool_ tried; /* The player has "tried" one of the items */
- bool_ know; /* extractable flag for the alchemist */
-
u32b esp; /* ESP flags */
u32b oesp; /* Obvious ESP flags */
diff --git a/src/q_fireprof.cc b/src/q_fireprof.cc
index b11c9667..c561dbc6 100644
--- a/src/q_fireprof.cc
+++ b/src/q_fireprof.cc
@@ -36,22 +36,9 @@ struct fireproof_settings
static fireproof_settings const *fireproof_get_settings()
{
- static fireproof_settings fireproof_settings_tome =
- { TV_BATERIE, "essence", "essences", 18, 12 };
- static fireproof_settings fireproof_settings_theme =
+ static fireproof_settings fireproof_settings =
{ TV_RUNE2, "rune", "runes", 5, 24 };
-
- if (game_module_idx == MODULE_TOME)
- {
- return &fireproof_settings_tome;
- }
- if (game_module_idx == MODULE_THEME)
- {
- return &fireproof_settings_theme;
- }
- /* If we get here we're in trouble. */
- assert(FALSE);
- return NULL;
+ return &fireproof_settings;
}
/* These constants are how many 'points' each type of item will take
diff --git a/src/skills.cc b/src/skills.cc
index 330aa9ba..997b3bc8 100644
--- a/src/skills.cc
+++ b/src/skills.cc
@@ -1010,9 +1010,6 @@ void do_cmd_activate_skill()
case MKEY_MINDCRAFT:
do_cmd_mindcraft();
break;
- case MKEY_ALCHEMY:
- do_cmd_alchemist();
- break;
case MKEY_MIMIC:
do_cmd_mimic();
break;
diff --git a/src/skills_defs.hpp b/src/skills_defs.hpp
index 59e1f059..1dbdee9f 100644
--- a/src/skills_defs.hpp
+++ b/src/skills_defs.hpp
@@ -40,7 +40,6 @@
#define SKILL_SNEAK 35
#define SKILL_STEALTH 36
#define SKILL_DISARMING 37
-#define SKILL_ALCHEMY 39
#define SKILL_STEALING 40
#define SKILL_SORCERY 41
#define SKILL_HAND 42
diff --git a/src/spells2.cc b/src/spells2.cc
index 631ff30e..d62d03dc 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -500,9 +500,6 @@ static void make_item_fully_identified(object_type *o_ptr)
/* Mark the item as fully known */
o_ptr->ident |= (IDENT_MENTAL);
-
- /* For those with alchemist skills, learn how to create it */
- alchemist_learn_object(o_ptr);
}
/*
@@ -3783,7 +3780,7 @@ bool_ recharge(int power)
}
}
- /* Mark as recharged -- For alchemists */
+ /* Mark as recharged */
o_ptr->art_flags4 |= TR4_RECHARGED;
/* Inflict the penalties for failing a recharge. */
diff --git a/src/store.cc b/src/store.cc
index 8e9512cd..dad3c820 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -757,7 +757,6 @@ static bool store_will_buy(object_type const *o_ptr)
case TV_SCROLL:
case TV_POTION2:
case TV_POTION:
- case TV_BATERIE:
case TV_BOTTLE:
return true;
}
diff --git a/src/tables.cc b/src/tables.cc
index 42244d6c..ea148654 100644
--- a/src/tables.cc
+++ b/src/tables.cc
@@ -4060,22 +4060,12 @@ monster_power monster_powers[96] =
tval_desc tval_descs[] =
{
{
- TV_BATERIE,
- "Essences contain primitive magic forces which users of the "
- "Alchemy skill can use to create powerful magic items from "
- "other magic items."
- },
- {
TV_MSTAFF,
"Mage Staves are the spellcaster's weapons of choice. "
"They all reduce spellcasting time to 80% of "
"normal time and some will yield even greater powers."
},
{
- 3,
- "XXX"
- },
- {
TV_PARCHMENT,
"Parchments can contain useful information ... or useless "
"junk."
@@ -4245,7 +4235,7 @@ tval_desc tval_descs[] =
},
{
TV_BOTTLE,
- "An empty bottle. Maybe an alchemist could refill it."
+ "An empty bottle."
},
{
TV_SPIKE,
@@ -4262,8 +4252,7 @@ tval_desc tval_descs[] =
{
TV_GLOVES,
"Handgear is used to protect hands, but nonmagical ones "
- "can sometimes hinder spellcasting. Alchemists need "
- "gloves in order to do alchemy."
+ "can sometimes hinder spellcasting."
},
{
TV_HELM,
diff --git a/src/variable.cc b/src/variable.cc
index ca4aca01..c2fe5de5 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -482,14 +482,6 @@ player_spec *spp_ptr;
/*
- * More spell info
- */
-u32b alchemist_known_egos[32];
-u32b alchemist_known_artifacts[6];
-u32b alchemist_gained;
-
-
-/*
* Calculated base hp values for player at each level,
* store them so that drain life + restore life does not
* affect hit points. Also prevents shameless use of backup
@@ -498,12 +490,6 @@ u32b alchemist_gained;
s16b player_hp[PY_MAX_LEVEL];
/*
- * The alchemy recipe arrays
- */
-alchemist_recipe *alchemist_recipes;
-artifact_select_flag *a_select_flags;
-
-/*
* The vault generation arrays
*/
vault_type *v_info;
@@ -786,11 +772,6 @@ u16b max_v_idx;
u16b max_f_idx;
/*
- * Maximum number of alchemist recipies in al_info.txt
- */
-u16b max_al_idx;
-
-/*
* Maximum number of artifacts in a_info.txt
*/
u16b max_a_idx;
@@ -1095,7 +1076,6 @@ tval_desc tvals[] =
{ TV_FOOD, "Food" },
{ TV_FLASK, "Flask" },
{ TV_MSTAFF, "Mage Staff" },
- { TV_BATERIE, "Essence" },
{ TV_PARCHMENT, "Parchment" },
{ TV_INSTRUMENT, "Musical Instrument" },
{ TV_RUNE1, "Rune 1" },
diff --git a/src/variable.hpp b/src/variable.hpp
index 74c74f77..c09e41c0 100644
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -2,9 +2,7 @@
#include "angband.h"
#include "ability_type_fwd.hpp"
-#include "alchemist_recipe_fwd.hpp"
#include "alloc_entry_fwd.hpp"
-#include "artifact_select_flag_fwd.hpp"
#include "artifact_type_fwd.hpp"
#include "birther.hpp"
#include "cave_type_fwd.hpp"
@@ -191,12 +189,7 @@ extern player_race *rp_ptr;
extern player_race_mod *rmp_ptr;
extern player_class *cp_ptr;
extern player_spec *spp_ptr;
-extern u32b alchemist_known_egos[32];
-extern alchemist_recipe *alchemist_recipes;
-extern u32b alchemist_known_artifacts[6];
-extern u32b alchemist_gained;
extern s16b player_hp[PY_MAX_LEVEL];
-extern artifact_select_flag *a_select_flags;
extern ability_type *ab_info;
extern skill_type *s_info;
extern vault_type *v_info;
@@ -234,7 +227,6 @@ extern wilderness_map **wild_map;
extern u16b old_max_s_idx;
extern u16b max_ab_idx;
extern u16b max_s_idx;
-extern u16b max_al_idx;
extern u16b max_r_idx;
extern u16b max_re_idx;
extern u16b max_k_idx;
diff --git a/src/wizard1.cc b/src/wizard1.cc
index 476def67..6762da3f 100644
--- a/src/wizard1.cc
+++ b/src/wizard1.cc
@@ -1,7 +1,5 @@
#include "wizard1.hpp"
-#include "alchemist_recipe.hpp"
-#include "artifact_select_flag.hpp"
#include "artifact_type.hpp"
#include "cmd7.hpp"
#include "ego_item_type.hpp"
@@ -240,8 +238,6 @@ static grouper group_item[] =
{ TV_RUNE1, "Runes" },
{ TV_RUNE2, NULL },
- { TV_BATERIE, "Essences" },
-
{ TV_PARCHMENT, "Parchments" },
{ TV_DIGGING, "Tools" },
@@ -2330,237 +2326,6 @@ static void spoil_mon_info(cptr fname)
msg_print("Successfully created a spoiler file.");
}
-
-static const char *long_intro =
- "Essences are the tools of the trade for Alchemists, "
- "and unfortunately are useless for any other class. "
- "Alchemists use essences to create magical items for them to use.\n\n"
- "They can be either found on the floor while exploring the dungeon, "
- "or extracted from other magical items the alchemist finds "
- "during their adventures.\n\n"
- "To create an artifact, the alchemist will have to sacrifice 10 hit points, "
- "and an amount of magic essence similar to his skill in alchemy. "
- "The alchemist then allows the artifact to gain experience, "
- "and when it has enough, "
- "uses that experience to add abilities to the artifact. "
- "The alchemist can allow the artifact to continue to gain experience, "
- "thus keeping open the option to add more abilities later. "
- "This requires a similar amount of magic essence, "
- "but does not require the sacrifice of other hit points.\n\n"
- "Note that the experience you gain is divided among the artifacts "
- "that you have as well as going to yourself, "
- "so you will gain levels more slowly when empowering artifacts. "
- "Also, the artifact only gets 60% of the experience. "
- "So killing a creature worth 20xp would gain 10 for you, "
- "and 6 for the artifact.\n\n"
- "You can also modify existing artifacts when you attain skill level 50. "
- "Also at skill level 50 you will gain the ability to make temporary artifacts, "
- "which don't require the complex empowerments that regular items require, "
- "but also vanish after awhile.\n\n"
- "You cannot give an artifact an ability "
- "unless you have *Identified* an artifact which has that ability.\n\n"
- "For every four levels gained in the alchemy skill, "
- "the alchemist learns about objects of level (skill level)/4, "
- "starting by learning about level 1 objects at skill level 0. "
- "(actually 1, but who's counting?)\n\n"
- "At skill level 5 you gain the ability to make ego items - but watch it! "
- "Your base failure rate will be 90%, "
- "and won't be 0% until you reach skill level 50. "
- "Adding gold will increase the chances of success "
- "in direct proportion to the value of the item you are trying to create. "
- "Note that this results in automatic success "
- "when the item you are trying to create "
- "happens to pick up a curse in the process.\n\n"
- "At skill level 5 you also gain knowledge of some basic ego item recipes. "
- "These are: Acidic, Shocking, Fiery, Frozen, Venomous, and Chaotic weapons, "
- "Resist Fire armour, and light sources of Fearlessness.\n\n"
- "At skill level 10 you will gain knowledge of digging ego items, "
- "if you have selected the option "
- "'always generate very unusual rooms' (ironman_rooms).\n\n"
- "At skill level 15 you can create ego wands, staves, rings, etc.\n\n"
- "At skill level 25 you gain the ability to empower artifacts "
- "and double ego items.\n\n"
- "At skill level 50 you gain the ability to create temporary artifacts, "
- "which don't require any exotic ingredients "
- "beyond a single corpse of any type.\n\n"
- "Between skill levels 25 and 50, "
- "you will steadily gain the ability to set more and more flags.\n\n"
- "To finalise an artifact, you 'P'ower it, and select the powers you want.\n"
- "Powers are divided into the following six categories:\n"
- "*****essences.txt*03[Stats, Sustains, Luck, Speed, Vision, etc.]\n"
- "*****essences.txt*04[Misc. (Auras, Light, See Invisibility, etc.)]\n"
- "*****essences.txt*05[Weapon Brands]\n"
- "*****essences.txt*06[Resistances and Immunities]\n"
- "*****essences.txt*07[ESP and Curses]\n"
- "*****essences.txt*08[Artifact Activations]\n";
-
-/*
- * Create a spoiler file for essences
- */
-static void spoil_bateries(cptr fname)
-{
- int j, i, tval, sval, group;
- object_type forge, *o_ptr;
-
- char buf[1024];
-
- tval = sval = group = -1;
-
- /* Build the filename */
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
-
- /* File type is "TEXT" */
- FILE_TYPE(FILE_TYPE_TEXT);
-
- fff = my_fopen(buf, "w");
-
- /* Oops */
- if (!fff)
- {
- msg_print("Cannot create spoiler file.");
- return;
- }
-
- /* Dump the header */
-
- fprintf(fff,
- "|||||oy\n"
- "~~~~~01|Spoilers|Essences\n"
- "~~~~~02|Alchemist|Essence Spoiler\n"
- "#####REssence Spoiler for %s\n"
- "#####R-----------------------------------\n\n",
- get_version_string());
-
-
- /*New code starts here -*/
- /*print header, including artifact header*/
- /*Cycle through artifact flags*/
- /* print desc*/
- /* cycle through all alchemist_recipies*/
- /* print matching*/
- /*Print items header.*/
- /*Cycle through alchemist_recipies*/
- /* sval or tval changed?*/
- /* skip artifacts (tval=0)*/
- /* print item desc (ego (tval=1) or item)*/
- /* print essences required*/
- /*Done!*/
-
- /*Print basic header.*/
- spoil_out(long_intro);
-
- /*Cycle through artifact flags*/
- for ( i = 0 ; a_select_flags[i].group ; i++ )
- {
- if ( a_select_flags[i].group != group )
- {
- group = a_select_flags[i].group;
- spoil_out("\n~~~~~");
- switch (group)
- {
- case 1:
- spoil_out("03\n#####GStats, Sustains, Luck, Speed, Vision, etc.\n");
- break;
- case 2:
- spoil_out("04\n#####GMisc. (Auras, Light, See Invisibility, etc.)\n");
- break;
- case 3:
- spoil_out("05\n#####GWeapon Brands\n");
- break;
- case 4:
- spoil_out("06\n#####GResistances and Immunities\n");
- break;
- case 5:
- spoil_out("07\n#####GESP and Curses\n");
- break;
- case 88:
- spoil_out("08\n#####GArtifact Activations\n");
- break;
- default:
- spoil_out(format("09\n#####GExtra Group=%d\n", group));
- }
- spoil_out("lvl xp Power\n");
-
- }
- /* print desc*/
- spoil_out(format("%-2d %8d %-24s %s\n",
- a_select_flags[i].level,
- a_select_flags[i].xp,
- a_select_flags[i].desc,
- a_select_flags[i].item_desc));
- /* cycle through all alchemist_recipies*/
- for ( j = 0 ; j < max_al_idx ; j++ )
- {
- /* print matching*/
- if (alchemist_recipes[j].tval == 0
- && alchemist_recipes[j].sval == a_select_flags[i].flag
- && alchemist_recipes[j].qty
- )
- {
- spoil_out(format(" %d essences of %s\n", alchemist_recipes[j].qty,
- k_info[lookup_kind(TV_BATERIE, alchemist_recipes[j].sval_essence)].name));
- }
- }
- }
-
- spoil_out("\n\nThe following basic item recipes also exist:\n");
- /*Cycle through alchemist_recipies*/
- for ( i = 0 ; i < max_al_idx ; i ++)
- {
- alchemist_recipe *ar_ptr = &alchemist_recipes[i];
-
- /* sval or tval changed?*/
- if (tval != ar_ptr->tval || sval != ar_ptr->sval)
- {
- char o_name[80];
- /* skip artifacts (tval=0)*/
- if (ar_ptr->tval == 0 )
- continue;
-
- tval = ar_ptr->tval;
- sval = ar_ptr->sval;
-
- /* print item desc (ego (tval=1)or item)*/
- if (ar_ptr->tval == 1)
- {
- strcpy(o_name, e_info[ar_ptr->sval].name);
- }
- else
- {
- /* Find the name of that object */
- o_ptr = &forge;
- object_wipe(o_ptr);
- object_prep(o_ptr, lookup_kind(tval, sval));
- apply_magic(o_ptr, 1, FALSE, FALSE, FALSE);
- object_aware(o_ptr);
- object_known(o_ptr);
- o_ptr->name2 = o_ptr->name2b = 0;
- /* the 0 mode means only the text, leaving off any numbers */
- object_desc(o_name, o_ptr, FALSE, 0);
- }
- spoil_out("\n");
- spoil_out(o_name);
- }
- /* print essence required*/
- spoil_out(format(" %d %s", ar_ptr->qty,
- k_info[lookup_kind(TV_BATERIE, ar_ptr->sval_essence)].name));
- }
-
- spoil_out(NULL);
-
- /* Check for errors */
- if (ferror(fff) || my_fclose(fff))
- {
- msg_print("Cannot close spoiler file.");
- return;
- }
-
- /* Message */
- msg_print("Successfully created a spoiler file.");
- return;
-}
-
-
/*
* Print a bookless spell list
*/
@@ -2686,8 +2451,7 @@ void do_cmd_spoilers()
prt("(2) Full Artifact Info (artifact.spo)", 6, 5);
prt("(3) Brief Monster Info (mon-desc.spo)", 7, 5);
prt("(4) Full Monster Info (mon-info.spo)", 8, 5);
- prt("(5) Full Essences Info (ess-info.spo)", 9, 5);
- prt("(6) Spell Info (spell.spo)", 10, 5);
+ prt("(5) Spell Info (spell.spo)", 10, 5);
/* Prompt */
prt("Command: ", 12, 0);
@@ -2728,12 +2492,6 @@ void do_cmd_spoilers()
/* Option (5) */
else if (i == '5')
{
- spoil_bateries("ess-info.spo");
- }
-
- /* Option (6) */
- else if (i == '6')
- {
spoil_spells("spell.spo");
}
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 6ddf4ac9..d1eaa977 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -2084,44 +2084,10 @@ void check_experience_obj(object_type *o_ptr)
/*
- * Gain experience (share it to objects if needed)
+ * Gain experience
*/
void gain_exp(s32b amount)
{
- int i, num = 1;
-
- /* Count the gaining xp objects */
- for (i = INVEN_WIELD; i < INVEN_TOTAL; i++)
- {
- object_type *o_ptr = &p_ptr->inventory[i];
- u32b f1, f2, f3, f4, f5, esp;
-
- object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);
-
- if (!o_ptr->k_idx) continue;
-
- if (f4 & TR4_ART_EXP) num++;
- }
-
- /* Now give the xp */
- for (i = INVEN_WIELD; i < INVEN_TOTAL; i++)
- {
- object_type *o_ptr = &p_ptr->inventory[i];
- u32b f1, f2, f3, f4, f5, esp;
-
- object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);
-
- if (!o_ptr->k_idx) continue;
-
- if (f4 & TR4_ART_EXP)
- {
- o_ptr->exp += 2 * amount / (num * 3);
-
- /* Hack -- upper limit */
- if (o_ptr->exp > PY_MAX_EXP) o_ptr->exp = PY_MAX_EXP;
- }
- }
-
if ((p_ptr->max_exp > 0) && (race_flags1_p(PR1_CORRUPT)))
{
if ((randint(p_ptr->max_exp) < amount) || (randint(12000000) < amount))
@@ -2133,7 +2099,7 @@ void gain_exp(s32b amount)
};
/* Gain some experience */
- p_ptr->exp += amount / num;
+ p_ptr->exp += amount;
/* Slowly recover from experience drainage */
if (p_ptr->exp < p_ptr->max_exp)