Skip to content

Commit

Permalink
Revert "Limits to the number of spells a character can learn."
Browse files Browse the repository at this point in the history
This reverts commit fedb70b.
  • Loading branch information
elunna committed Jan 3, 2024
1 parent e8634bf commit 8747ff5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
1 change: 0 additions & 1 deletion include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,6 @@ E int NDECL (num_spells);
E void NDECL(dump_spells);
E void FDECL(cast_sphere, (short otyp));
E void NDECL(spell_nag);
E boolean NDECL(max_spells_learned);

/* ### steal.c ### */

Expand Down
5 changes: 2 additions & 3 deletions src/pray.c
Original file line number Diff line number Diff line change
Expand Up @@ -1474,9 +1474,8 @@ aligntyp g_align;
otmp->material = objects[otmp->otyp].oc_material;
otmp->owt = weight(otmp);
}
if (!u.uconduct.literate && !max_spells_learned()
&& otmp->otyp != SPE_BLANK_PAPER
&& !known_spell(otmp->otyp)) {
if (!u.uconduct.literate && (otmp->otyp != SPE_BLANK_PAPER)
&& !known_spell(otmp->otyp)) {
if (force_learn_spell(otmp->otyp))
pline("Divine knowledge of %s fills your mind!",
OBJ_NAME(objects[otmp->otyp]));
Expand Down
44 changes: 10 additions & 34 deletions src/spell.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#define CAST_BOOST 500 /* memory increase for successful casting */
#define REINFORCE_BOOST 10000 /* memory increase for reinforce memory */
#define MAX_KNOW 70000 /* Absolute Max timeout */
/* Most spells a player can learn */
#define SPELL_LIMIT ((ACURR(A_WIS) + ACURR(A_INT) + 5) \
/ (primary_caster() ? (Role_if(PM_WIZARD) ? 3 : 4) : 12))

/* x: need to add 1 when used for reading a spellbook rather than for hero
initialization; spell memory is decremented at the end of each turn,
Expand Down Expand Up @@ -52,7 +49,6 @@ STATIC_DCL char *FDECL(spellretention, (int, char *));
STATIC_DCL int NDECL(throwspell);
STATIC_DCL void FDECL(spell_backfire, (int));
STATIC_DCL boolean FDECL(spell_aim_step, (genericptr_t, int, int));
STATIC_DCL boolean NDECL(primary_caster);

static const char clothes[] = { ARMOR_CLASS, 0 };

Expand Down Expand Up @@ -372,15 +368,6 @@ learn(VOID_ARGS)
boolean costly = TRUE;
struct obj *book = context.spbook.book;

if (max_spells_learned()) {
if (ACURR(A_INT) == AMAX(A_INT)
&& ACURR(A_WIS) == AMAX(A_WIS))
You("are not capable of learning any new spells (right now).");
else
You("are not capable of learning any new spells.");
return 0;
}

/* JDS: lenses give 50% faster reading; 33% smaller read time */
if (context.spbook.delay && ublindf && ublindf->otyp == LENSES && rn2(2))
context.spbook.delay++;
Expand Down Expand Up @@ -2063,7 +2050,7 @@ int spell;
int difficulty;
int skill;
int dex_adjust;
boolean paladin_bonus, is_spellcaster, non_casters;
boolean paladin_bonus, primary_casters, non_casters;

/* Calculate intrinsic ability (splcaster) */

Expand Down Expand Up @@ -2096,8 +2083,14 @@ int spell;
paladin_bonus = Role_if(PM_KNIGHT) && spell_skilltype(spellid(spell)) == P_ENCHANTMENT_SPELL;

/* Casting roles */
is_spellcaster = primary_caster();

primary_casters = (Role_if(PM_HEALER)
|| Role_if(PM_PRIEST)
|| Role_if(PM_FLAME_MAGE)
|| Role_if(PM_ICE_MAGE)
|| Role_if(PM_NECROMANCER)
|| Role_if(PM_WIZARD)
|| Role_if(PM_INFIDEL));

non_casters = (Role_if(PM_ARCHEOLOGIST)
|| Role_if(PM_BARBARIAN)
|| Role_if(PM_CAVEMAN)
Expand Down Expand Up @@ -2276,7 +2269,7 @@ int spell;
&& !is_robe(uarm)) {
#define PENALTY_NON_CASTER (spellev(spell) * 10)
#define PENALTY_PRI_CASTER (spellev(spell) * 10) - 30
if (is_spellcaster && spellev(spell) >= 4)
if (primary_casters && spellev(spell) >= 4)
chance -= PENALTY_PRI_CASTER;
if (non_casters)
chance -= PENALTY_NON_CASTER;
Expand Down Expand Up @@ -2515,23 +2508,6 @@ spell_nag()
Your("%s spell is fading!", spellname(i));
}
}
}

STATIC_OVL boolean
primary_caster() {
return (Role_if(PM_HEALER)
|| Role_if(PM_PRIEST)
|| Role_if(PM_FLAME_MAGE)
|| Role_if(PM_ICE_MAGE)
|| Role_if(PM_NECROMANCER)
|| Role_if(PM_WIZARD)
|| Role_if(PM_INFIDEL));
}

boolean
max_spells_learned()
{
return num_spells() >= SPELL_LIMIT;
}

/*spell.c*/

0 comments on commit 8747ff5

Please sign in to comment.