summaryrefslogtreecommitdiff
path: root/lib/scpt
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-18 13:52:06 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-18 19:48:30 +0200
commitc1f2b8f2d299d22be4ad3f2f176b6e106eeff6dc (patch)
treef43acfe2b42b0f00a21ceb083857424bbb63d5ef /lib/scpt
parent4dd2ffb52df44aa78719a49492db9e79b6b01215 (diff)
Lua: Move school_book[] to C
Diffstat (limited to 'lib/scpt')
-rw-r--r--lib/scpt/init.lua3
-rw-r--r--lib/scpt/library.lua39
-rw-r--r--lib/scpt/s_udun.lua39
-rw-r--r--lib/scpt/spells.lua142
4 files changed, 2 insertions, 221 deletions
diff --git a/lib/scpt/init.lua b/lib/scpt/init.lua
index 655c4bd7..55a6ce63 100644
--- a/lib/scpt/init.lua
+++ b/lib/scpt/init.lua
@@ -20,9 +20,6 @@ tome_dofile("spells.lua")
-- Post-spell creation initialization
initialize_bookable_spells()
--- Add some quests
-tome_dofile("library.lua")
-
-- Add joke stuff
tome_dofile("drunk.lua")
tome_dofile("joke.lua")
diff --git a/lib/scpt/library.lua b/lib/scpt/library.lua
deleted file mode 100644
index 7e25904e..00000000
--- a/lib/scpt/library.lua
+++ /dev/null
@@ -1,39 +0,0 @@
--- Library quest in Minas Anor
-
--- Partially based on Fireproofing quest
-
-library_quest = {}
-
--- Print a spell (taken from s_aux)
-function library_quest.print_spell(color, y, spl)
- local x, index, sch, size, s
-
- x = 0
- size = 0
- book = 255
- obj = nil
-
- -- Hack if the book is 255 it is a random book
- if book == 255 then
- school_book[book] = {spl}
- end
-
- -- Parse all spells
- for index, s in school_book[book] do
- local lvl, na = get_level_school(s, 50, -50)
- local xx, sch_str
-
- sch_str = spell_school_name(s)
-
- if s == spl then
- if na then
- c_prt(color, format("%-20s%-16s %3s %4s %3d%s %s", spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
- else
- c_prt(color, format("%-20s%-16s %3d %4s %3d%s %s", spell(s).name, sch_str, lvl, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
- end
- y = y + 1
- size = size + 1
- end
- end
- return y
-end
diff --git a/lib/scpt/s_udun.lua b/lib/scpt/s_udun.lua
index 3ddfeb14..bb12ac7f 100644
--- a/lib/scpt/s_udun.lua
+++ b/lib/scpt/s_udun.lua
@@ -72,42 +72,3 @@ FLAMEOFUDUN = add_spell
"Turns you into a powerful Balrog",
}
}
-
-
--- Return the number of Udun/Melkor spells in a given book
-function udun_in_book(sval, pval)
- local i, y, index, sch, s
-
- i = 0
-
- -- Hack if the book is 255 it is a random book
- if sval == 255 then
- school_book[sval] = {pval}
- end
- -- Parse all spells
- for index, s in school_book[sval] do
- for index, sch in __spell_school[s] do
- if sch == SCHOOL_UDUN then i = i + 1 end
- if sch == SCHOOL_MELKOR then i = i + 1 end
- end
- end
- return i
-end
-
--- Return the total level of spells
-function levels_in_book(sval, pval)
- local i, y, index, sch, s
-
- i = 0
-
- -- Hack if the book is 255 it is a random book
- if sval == 255 then
- school_book[sval] = {pval}
- end
-
- -- Parse all spells
- for index, s in school_book[sval] do
- i = i + __tmp_spells[s].level
- end
- return i
-end
diff --git a/lib/scpt/spells.lua b/lib/scpt/spells.lua
index 24b4f02b..4bd5d7ea 100644
--- a/lib/scpt/spells.lua
+++ b/lib/scpt/spells.lua
@@ -317,143 +317,5 @@ tome_dofile("s_stick.lua")
-- Musics
tome_dofile("s_music.lua")
--- List of spellbooks
-
--- Create the crystal of mana
-school_book[0] = {
- MANATHRUST, DELCURSES, RESISTS, MANASHIELD,
-}
-
--- The book of the eternal flame
-school_book[1] = {
- GLOBELIGHT, FIREGOLEM, FIREFLASH, FIREWALL, FIERYAURA,
-}
-
--- The book of the blowing winds
-school_book[2] = {
- NOXIOUSCLOUD, POISONBLOOD, INVISIBILITY, STERILIZE, AIRWINGS, THUNDERSTORM,
-}
-
--- The book of the impenetrable earth
-school_book[3] = {
- STONESKIN, DIG, STONEPRISON, SHAKE, STRIKE,
-}
-
--- The book of the unstopable wave
-school_book[4] = {
- GEYSER, VAPOR, ENTPOTION, TIDALWAVE, ICESTORM
-}
-
--- Create the book of translocation
-school_book[5] = {
- BLINK, DISARM, TELEPORT, TELEAWAY, RECALL, PROBABILITY_TRAVEL,
-}
-
--- Create the book of the tree
-school_book[6] = {
- GROWTREE, HEALING, RECOVERY, REGENERATION, SUMMONANNIMAL,
-}
-
--- Create the book of Knowledge
-school_book[7] = {
- SENSEMONSTERS, SENSEHIDDEN, REVEALWAYS, IDENTIFY, VISION, STARIDENTIFY,
-}
-
--- Create the book of the Time
-school_book[8] = {
- MAGELOCK, SLOWMONSTER, ESSENCESPEED, BANISHMENT,
-}
-
--- Create the book of meta spells
-school_book[9] = {
- RECHARGE, DISPERSEMAGIC, SPELLBINDER, TRACKER, INERTIA_CONTROL,
-}
-
--- Create the book of the mind
-school_book[10] = {
- CHARM, CONFUSE, ARMOROFFEAR, STUN,
-}
-
--- Create the book of hellflame
-school_book[11] = {
- DRAIN, GENOCIDE, WRAITHFORM, FLAMEOFUDUN,
-}
-
--- Create the book of eru
-school_book[20] = {
- ERU_SEE, ERU_LISTEN, ERU_UNDERSTAND, ERU_PROT,
-}
-
--- Create the book of manwe
-school_book[21] = {
- MANWE_BLESS, MANWE_SHIELD, MANWE_CALL, MANWE_AVATAR,
-}
-
--- Create the book of tulkas
-school_book[22] = {
- TULKAS_AIM, TULKAS_SPIN, TULKAS_WAVE,
-}
-
--- Create the book of melkor
-school_book[23] = {
- MELKOR_CURSE, MELKOR_CORPSE_EXPLOSION, MELKOR_MIND_STEAL,
-}
-
--- Create the book of yavanna
-school_book[24] = {
- YAVANNA_CHARM_ANIMAL, YAVANNA_GROW_GRASS, YAVANNA_TREE_ROOTS, YAVANNA_WATER_BITE, YAVANNA_UPROOT,
-}
-
--- Create the book of beginner's cantrip
-school_book[50] = {
- MANATHRUST, GLOBELIGHT, ENTPOTION, BLINK, SENSEMONSTERS, SENSEHIDDEN,
-}
-
--- Create the book of teleporatation
-school_book[51] = {
- BLINK, TELEPORT, TELEAWAY
-}
-
--- Create the book of summoning
-school_book[52] = {
- FIREGOLEM, SUMMONANNIMAL
-}
-
-
--- Create the Armageddon Demonblade
-school_book[55] = {
- DEMON_BLADE, DEMON_MADNESS, DEMON_FIELD,
-}
-
--- Create the Shield Demonblade
-school_book[56] = {
- DOOM_SHIELD, DEMON_CLOAK, UNHOLY_WORD,
-}
-
--- Create the Control Demonblade
-school_book[57] = {
- DEMON_SUMMON, DISCHARGE_MINION, CONTROL_DEMON,
-}
-
--- Create the Drums
-school_book[58] = {
- MUSIC_STOP, MUSIC_HOLD, MUSIC_CONF, MUSIC_STUN,
-}
-
--- Create the Harps
-school_book[59] = {
- MUSIC_STOP, MUSIC_LITE, MUSIC_HERO, MUSIC_HEAL, MUSIC_TIME, MUSIC_MIND,
-}
-
--- Create the Horns
-school_book[60] = {
- MUSIC_STOP, MUSIC_BLOW, MUSIC_WIND, MUSIC_YLMIR, MUSIC_AMBARKANTA,
-}
-
--- Book of the Player, filled in by the Library Quest
-school_book[61] = { }
-
--- Geomancy spells, not a real book
-school_book[62] = {
- CALL_THE_ELEMENTS, CHANNEL_ELEMENTS, ELEMENTAL_WAVE, VAPORIZE, GEOLYSIS, DRIPPING_TREAD, GROW_BARRIER, ELEMENTAL_MINION
-}
+-- Initialize spellbooks
+init_school_books()