Spell Stock is used to cast Spells and is labeled in brackets next to the MP cost, under "cost(stock)". The amount of spell stock used to cast a spell is random, but proportional to the MP cost, for example: a spell that costs 10 MP to cast will use about 10 stock, when the spell level is 1. This amount will be reduced as the spell level goes higher. In Elona+, as of version 1.19, the Spell Stock cost has been reduced to 1/3 of what it used to be. As of Elona+ version 1.59 you can pay platinum to a town wizard NPC to practice the spells you know without consuming any spell stock.
Spell Stock can be gained by reading spellbooks, scrolls of wonder, or by having a Strange Dream while sleeping.
Spell Stock from Spellbooks[]
The amount of Spell Stock gained by reading Spellbooks is a random amount based on your Memorization Skill and the amount of stock you currently have. The higher your memorization skill, the more stock you gain. The higher your current spell stock, the less stock you gain.
The exact formula is not known. However, a roughly accurate formula seems to be:
RandMod * (Memorization + 100) / (50 * ln(10 + 2 * CurrentSpellStock))
Where "RandMod" is a random number between around 0.6 and 1.1, somewhat bell curving towards values in the middle, (presumably, this is some sort of XdY function,) and "ln" is the natural logarithm. (That is, loge(10 + 2 *CurrentSpellStock).)
This means that, with 0 Memorization and 0 spell stock in a spell, you get roughly 60 to 110 spell stock. At 0 Memorization, and 10,000 spell stock in a spell, you get around 12 to 22 spell stock.
Memorization essentially is a percentile multiplier on spell stock gained - 50 memorization will get you 50% more spell stock for any given amount of current spell stock, 100 memorization doubles spell stock gained, and 900 gives you ten times the normal spell stock per reading of a spellbook.
The difficulty of the spell, literacy, attributes, and any other factor have no impact upon spell stock gained.
Tips on maximizing spell stock[]
Because any successful reading of a spellbook will get you from 0 spell stock to at least close to 100 spell stock, gains in spell stock are basically halved after your first reading from 0 spell stock.
You can hypothetically get the most out of a reading of a spellbook by depleting your spell stock back to 0 before reading the spellbook for that spell again. For spells you will need in combat, it's probably not safe to leave it this way, but if you are only using spells for training your spell levels or for non-combat purposes, it makes the most of your spell stock. Create Door, Identify, and 4 Dimensional Pocket, for example, are spells you probably aren't using much in combat, and can be used for training your casting level in heavy grinding. Short Teleport costs very little to cast as it levels and uses very little stock.
On the other end, the reduction in spell stock gained beyond a few hundred spell stock is fairly negligible, although it is still present. You only get around 30% more spell stock you would gain if you read a spellbook at 200 spell stock as you would at 1000 spell stock, and the drop-off is essentially negligible from 1000 spell stock on. You might as well just read through whole books to clear them from your inventory if you are going to be keeping any significant amount of stock in them.
Since memorization functionally serves as a percentile bonus to what spell stocks you gain, the difference between having 10 points of Memorization and 11 is largely negligible. Getting Memorization up to 50, which is probably something that will take hundreds of hours, still only nets you a 50% bonus. Generally speaking, any character who isn't going to be a dedicated mage can probably do without the Memorization skill.
The Magic Device skill, meanwhile, can be of particular use to mages. Specifically, the ability to Draw Charge and Fill Charge can be used to drain rods you wouldn't use anyway to recharge rare or expensive spell books. (Excepting spell books of Harvest, Dominate, Wish, and other restricted spells.) A rod of magic missile with 10 charges in it is often only 1,000 gp, while some spell books can go for 3,000 gp just for the book plus 2,000 gp per charge. It isn't perfect - books can explode, so only do this at one charge left - but it can save a lot of money in the long run, or save a wizard's life if they really needed more of that Cure of Eris to survive a dungeon. Gardening at a farm can provide players with an abundance of extra rods to drain.
Elona+[]
As of version 2.02, spellbooks now recover a constant amount of spell stock, instead of recovering an amount that has drastically decreased with current stock.
- This means that it's no longer more efficient to use up all spell stock before reading another spellbook.
- The amount of spell stock gained (and Memorization skill experience gained) have also been greatly increased.
Spell Stock from Other Sources[]
The amount of spell stock gained by reading scrolls of wonder or having strange dreams is always 200.
Technical Details[]
Note: This information pertains to the current version of Elona+. It does not match with figures from vanilla Elona.
Stock Cost[]
The following snippet of code is used to determine the stock cost for casting a spell.
StockCost = (Spell.BaseCost() * 200) / (Caster.SpellLevel(Spell) * 3 + 100); If(StockCost < Spell.BaseCost() / 5) StockCost = Spell.BaseCost() / 5; StockCost = rnd(StockCost/6 + 1) + StockCost/6; If(StockCost < 1) StockCost = 1; *rnd() generates a random number between 0 and the number inside the () -1.
By solving the first formula for Spell.BaseCost() / 5, we can ascertain that every spell technically reaches its minimum stock cost at spell level 300, though many spells will effectively reach minimum stock cost before that point.
Stock Gain[]
The following snippet of code is used to determine how much stock is gained from reading a spell book.
(rnd(51) + 50) * (90 + Reader.MemorizationLevel + Reader.HasMemorization() * 20) / limit(100 + Reader.CurrentStock(Spell)/2, 50, 1000) + 1
In a more human readable form, this formula is (A * B / C) + 1 where
- A = 50 plus a random value between 0 and 50.
- B = 90 + your Memorization level, with an additional + 20 if you have the Memorization skill.
- C = 100 + CurrentSpellStock/2. This variable has a minimum value of 50 (though effectively 100, as you cannot have negative spell stock) and a maximum of 1000 (1800 stock).
For example, reading a spellbook while having 200 stock in the spell and a memorization level of 30 would result in stock gains between 36 and 71.