summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-26 07:15:21 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-26 07:15:21 +0200
commit03aa3417ca54eeb3ebf61557d062a5c31bf0172e (patch)
treeac057913cccd49e99dc0f2d515c94c9c058e00cf
parent79531149c7493b1126febb21bb7bfc958d6d3e2a (diff)
parent049a6c9ad822840b80a52e68a3095a2f072c74a2 (diff)
Merge branch 'unlua'
-rw-r--r--CMakeLists.txt15
-rw-r--r--README.txt13
-rw-r--r--lib/CMakeLists.txt10
-rw-r--r--lib/core/auto.lua859
-rw-r--r--lib/core/building.lua15
-rw-r--r--lib/core/crpt_aux.lua182
-rw-r--r--lib/core/dungeon.lua55
-rw-r--r--lib/core/gen_idx.lua261
-rw-r--r--lib/core/gods.lua40
-rw-r--r--lib/core/help.lua141
-rw-r--r--lib/core/init.lua83
-rw-r--r--lib/core/load.lua37
-rw-r--r--lib/core/load2.lua56
-rw-r--r--lib/core/mimc_aux.lua96
-rw-r--r--lib/core/monsters.lua16
-rw-r--r--lib/core/objects.lua45
-rw-r--r--lib/core/player.lua135
-rw-r--r--lib/core/quests.lua57
-rw-r--r--lib/core/s_aux.lua716
-rw-r--r--lib/core/stores.lua32
-rw-r--r--lib/core/util.lua158
-rw-r--r--lib/core/xml.lua375
-rw-r--r--lib/help/def.aux3
-rw-r--r--lib/mods/CMakeLists.txt1
-rw-r--r--lib/mods/mods_aux.lua185
-rw-r--r--lib/mods/modules.lua5
-rw-r--r--lib/mods/theme/CMakeLists.txt14
-rw-r--r--lib/mods/theme/core/auto.lua859
-rw-r--r--lib/mods/theme/core/building.lua15
-rw-r--r--lib/mods/theme/core/crpt_aux.lua182
-rw-r--r--lib/mods/theme/core/dungeon.lua55
-rw-r--r--lib/mods/theme/core/gen_idx.lua261
-rw-r--r--lib/mods/theme/core/gods.lua40
-rw-r--r--lib/mods/theme/core/help.lua141
-rw-r--r--lib/mods/theme/core/init.lua83
-rw-r--r--lib/mods/theme/core/load.lua37
-rw-r--r--lib/mods/theme/core/load2.lua56
-rw-r--r--lib/mods/theme/core/mimc_aux.lua96
-rw-r--r--lib/mods/theme/core/monsters.lua16
-rw-r--r--lib/mods/theme/core/objects.lua45
-rw-r--r--lib/mods/theme/core/player.lua135
-rw-r--r--lib/mods/theme/core/quests.lua57
-rw-r--r--lib/mods/theme/core/s_aux.lua716
-rw-r--r--lib/mods/theme/core/stores.lua32
-rw-r--r--lib/mods/theme/core/util.lua158
-rw-r--r--lib/mods/theme/core/xml.lua375
-rw-r--r--lib/mods/theme/edit/t_minas.txt2
-rw-r--r--lib/mods/theme/edit/w_info.txt2
-rw-r--r--lib/mods/theme/edit/wf_info.txt6
-rw-r--r--lib/mods/theme/help/def.aux3
-rw-r--r--lib/mods/theme/module.lua48
-rw-r--r--lib/mods/theme/scpt/bounty.lua90
-rw-r--r--lib/mods/theme/scpt/corrupt.lua1089
-rw-r--r--lib/mods/theme/scpt/drunk.lua21
-rw-r--r--lib/mods/theme/scpt/fireprof.lua415
-rw-r--r--lib/mods/theme/scpt/god.lua812
-rw-r--r--lib/mods/theme/scpt/gods.lua26
-rw-r--r--lib/mods/theme/scpt/gods_new.lua454
-rw-r--r--lib/mods/theme/scpt/gondolin.lua63
-rw-r--r--lib/mods/theme/scpt/help.lua445
-rw-r--r--lib/mods/theme/scpt/init.lua56
-rw-r--r--lib/mods/theme/scpt/intro.lua43
-rw-r--r--lib/mods/theme/scpt/joke.lua31
-rw-r--r--lib/mods/theme/scpt/library.lua439
-rw-r--r--lib/mods/theme/scpt/mimic.lua419
-rw-r--r--lib/mods/theme/scpt/misc.lua213
-rw-r--r--lib/mods/theme/scpt/mkeys.lua95
-rw-r--r--lib/mods/theme/scpt/monsters.lua182
-rw-r--r--lib/mods/theme/scpt/player.lua196
-rw-r--r--lib/mods/theme/scpt/powers.lua61
-rw-r--r--lib/mods/theme/scpt/s_air.lua193
-rw-r--r--lib/mods/theme/scpt/s_aule.lua222
-rw-r--r--lib/mods/theme/scpt/s_convey.lua226
-rw-r--r--lib/mods/theme/scpt/s_demon.lua337
-rw-r--r--lib/mods/theme/scpt/s_divin.lua230
-rw-r--r--lib/mods/theme/scpt/s_earth.lua184
-rw-r--r--lib/mods/theme/scpt/s_eru.lua130
-rw-r--r--lib/mods/theme/scpt/s_fire.lua227
-rw-r--r--lib/mods/theme/scpt/s_geom.lua656
-rw-r--r--lib/mods/theme/scpt/s_mana.lua132
-rw-r--r--lib/mods/theme/scpt/s_mandos.lua186
-rw-r--r--lib/mods/theme/scpt/s_manwe.lua144
-rw-r--r--lib/mods/theme/scpt/s_melkor.lua154
-rw-r--r--lib/mods/theme/scpt/s_meta.lua287
-rw-r--r--lib/mods/theme/scpt/s_mind.lua132
-rw-r--r--lib/mods/theme/scpt/s_music.lua443
-rw-r--r--lib/mods/theme/scpt/s_nature.lua184
-rw-r--r--lib/mods/theme/scpt/s_stick.lua494
-rw-r--r--lib/mods/theme/scpt/s_tempo.lua162
-rw-r--r--lib/mods/theme/scpt/s_tulkas.lua81
-rw-r--r--lib/mods/theme/scpt/s_udun.lua180
-rw-r--r--lib/mods/theme/scpt/s_ulmo.lua147
-rw-r--r--lib/mods/theme/scpt/s_varda.lua140
-rw-r--r--lib/mods/theme/scpt/s_water.lua154
-rw-r--r--lib/mods/theme/scpt/s_yavann.lua157
-rw-r--r--lib/mods/theme/scpt/spells.lua627
-rw-r--r--lib/mods/theme/scpt/stores.lua161
-rw-r--r--lib/module.lua36
-rw-r--r--lib/scpt/bounty.lua90
-rw-r--r--lib/scpt/corrupt.lua433
-rw-r--r--lib/scpt/drunk.lua21
-rw-r--r--lib/scpt/fireprof.lua415
-rw-r--r--lib/scpt/god.lua640
-rw-r--r--lib/scpt/gods.lua26
-rw-r--r--lib/scpt/help.lua411
-rw-r--r--lib/scpt/init.lua46
-rw-r--r--lib/scpt/intro.lua39
-rw-r--r--lib/scpt/joke.lua31
-rw-r--r--lib/scpt/library.lua436
-rw-r--r--lib/scpt/mimic.lua419
-rw-r--r--lib/scpt/mkeys.lua95
-rw-r--r--lib/scpt/player.lua76
-rw-r--r--lib/scpt/powers.lua61
-rw-r--r--lib/scpt/s_air.lua193
-rw-r--r--lib/scpt/s_convey.lua227
-rw-r--r--lib/scpt/s_demon.lua337
-rw-r--r--lib/scpt/s_divin.lua230
-rw-r--r--lib/scpt/s_earth.lua184
-rw-r--r--lib/scpt/s_eru.lua130
-rw-r--r--lib/scpt/s_fire.lua227
-rw-r--r--lib/scpt/s_geom.lua656
-rw-r--r--lib/scpt/s_mana.lua132
-rw-r--r--lib/scpt/s_manwe.lua144
-rw-r--r--lib/scpt/s_melkor.lua154
-rw-r--r--lib/scpt/s_meta.lua287
-rw-r--r--lib/scpt/s_mind.lua132
-rw-r--r--lib/scpt/s_music.lua443
-rw-r--r--lib/scpt/s_nature.lua152
-rw-r--r--lib/scpt/s_stick.lua444
-rw-r--r--lib/scpt/s_tempo.lua162
-rw-r--r--lib/scpt/s_tulkas.lua81
-rw-r--r--lib/scpt/s_udun.lua180
-rw-r--r--lib/scpt/s_water.lua154
-rw-r--r--lib/scpt/s_yavann.lua157
-rw-r--r--lib/scpt/spells.lua475
-rw-r--r--lib/scpt/stores.lua132
-rw-r--r--src/CMakeLists.txt39
-rw-r--r--src/angband.h6
-rw-r--r--src/birth.c269
-rw-r--r--src/bldg.c34
-rw-r--r--src/cmd1.c22
-rw-r--r--src/cmd2.c89
-rw-r--r--src/cmd4.c45
-rw-r--r--src/cmd5.c113
-rw-r--r--src/cmd6.c142
-rw-r--r--src/cmd7.c2
-rw-r--r--src/corrupt.c973
-rw-r--r--src/defines.h224
-rw-r--r--src/dungeon.c349
-rw-r--r--src/dungeon.pkg1607
-rw-r--r--src/externs.h727
-rw-r--r--src/files.c67
-rw-r--r--src/generate.c1
-rw-r--r--src/gods.c75
-rw-r--r--src/h-type.h6
-rw-r--r--src/help.c735
-rw-r--r--src/include/sglib.h1952
-rw-r--r--src/init1.c32
-rw-r--r--src/init2.c156
-rw-r--r--src/joke.c34
-rw-r--r--src/lauxlib.h100
-rw-r--r--src/loadsave.c143
-rw-r--r--src/lua/.gitignore2
-rw-r--r--src/lua/CMakeLists.txt11
-rw-r--r--src/lua/array.lua203
-rw-r--r--src/lua/basic.lua190
-rw-r--r--src/lua/class.lua85
-rw-r--r--src/lua/clean.lua74
-rw-r--r--src/lua/code.lua73
-rw-r--r--src/lua/container.lua311
-rw-r--r--src/lua/declaration.lua399
-rw-r--r--src/lua/define.lua72
-rw-r--r--src/lua/doit.lua73
-rw-r--r--src/lua/enumerate.lua93
-rw-r--r--src/lua/feature.lua72
-rw-r--r--src/lua/function.lua317
-rw-r--r--src/lua/lapi.c499
-rw-r--r--src/lua/lapi.h17
-rw-r--r--src/lua/lauxlib.c216
-rw-r--r--src/lua/lauxlib.h100
-rw-r--r--src/lua/lbaselib.c651
-rw-r--r--src/lua/lcode.c701
-rw-r--r--src/lua/lcode.h70
-rw-r--r--src/lua/ldblib.c188
-rw-r--r--src/lua/ldebug.c466
-rw-r--r--src/lua/ldebug.h21
-rw-r--r--src/lua/ldo.c385
-rw-r--r--src/lua/ldo.h33
-rw-r--r--src/lua/lfunc.c109
-rw-r--r--src/lua/lfunc.h24
-rw-r--r--src/lua/lgc.c353
-rw-r--r--src/lua/lgc.h18
-rw-r--r--src/lua/liolib.c710
-rw-r--r--src/lua/llex.c411
-rw-r--r--src/lua/llex.h72
-rw-r--r--src/lua/llimits.h204
-rw-r--r--src/lua/lmem.c150
-rw-r--r--src/lua/lmem.h42
-rw-r--r--src/lua/lobject.c125
-rw-r--r--src/lua/lobject.h204
-rw-r--r--src/lua/lopcodes.h168
-rw-r--r--src/lua/lparser.c1129
-rw-r--r--src/lua/lparser.h60
-rw-r--r--src/lua/lstate.c121
-rw-r--r--src/lua/lstate.h77
-rw-r--r--src/lua/lstring.c155
-rw-r--r--src/lua/lstring.h37
-rw-r--r--src/lua/lstrlib.c621
-rw-r--r--src/lua/ltable.c303
-rw-r--r--src/lua/ltable.h34
-rw-r--r--src/lua/ltests.c543
-rw-r--r--src/lua/ltm.c163
-rw-r--r--src/lua/ltm.h59
-rw-r--r--src/lua/lua.h248
-rw-r--r--src/lua/lua2c.lua29
-rw-r--r--src/lua/luadebug.h46
-rw-r--r--src/lua/lualib.h34
-rw-r--r--src/lua/lundump.c244
-rw-r--r--src/lua/lundump.h35
-rw-r--r--src/lua/lvm.c710
-rw-r--r--src/lua/lvm.h32
-rw-r--r--src/lua/lzio.c84
-rw-r--r--src/lua/lzio.h53
-rw-r--r--src/lua/module.lua69
-rw-r--r--src/lua/operator.lua111
-rw-r--r--src/lua/package.lua222
-rw-r--r--src/lua/print.h55
-rw-r--r--src/lua/tolua.c149
-rw-r--r--src/lua/tolua.h127
-rw-r--r--src/lua/tolua_bd.c214
-rw-r--r--src/lua/tolua_eh.c66
-rw-r--r--src/lua/tolua_eh.h24
-rw-r--r--src/lua/tolua_gp.c197
-rw-r--r--src/lua/tolua_lb.c160
-rw-r--r--src/lua/tolua_rg.c243
-rw-r--r--src/lua/tolua_rg.h22
-rw-r--r--src/lua/tolua_tm.c585
-rw-r--r--src/lua/tolua_tm.h32
-rw-r--r--src/lua/tolua_tt.c316
-rw-r--r--src/lua/tolua_tt.h31
-rw-r--r--src/lua/tolualua.c2975
-rw-r--r--src/lua/tolualua.h2713
-rw-r--r--src/lua/tolualua.pkg21
-rw-r--r--src/lua/typedef.lua59
-rw-r--r--src/lua/variable.lua192
-rw-r--r--src/lua/verbatim.lua77
-rw-r--r--src/lua_bind.c448
-rw-r--r--src/main.c3
-rw-r--r--src/melee1.c2
-rw-r--r--src/mimic.c694
-rw-r--r--src/modules.c1026
-rw-r--r--src/monster.pkg2324
-rw-r--r--src/monster2.c11
-rw-r--r--src/object.pkg1169
-rw-r--r--src/object1.c79
-rw-r--r--src/object2.c133
-rw-r--r--src/player.pkg3519
-rw-r--r--src/player_c.pkg1060
-rw-r--r--src/plots.c164
-rw-r--r--src/plots.h20
-rw-r--r--src/powers.c36
-rw-r--r--src/q_bounty.c111
-rw-r--r--src/q_fireprof.c584
-rw-r--r--src/q_god.c1193
-rw-r--r--src/q_library.c507
-rw-r--r--src/q_shroom.c2
-rw-r--r--src/quest.pkg170
-rw-r--r--src/randart.c3
-rw-r--r--src/range.c9
-rw-r--r--src/script.c521
-rw-r--r--src/skills.c113
-rw-r--r--src/spells.pkg2448
-rw-r--r--src/spells1.c154
-rw-r--r--src/spells2.c389
-rw-r--r--src/spells3.c4924
-rw-r--r--src/spells4.c794
-rw-r--r--src/spells5.c2578
-rw-r--r--src/spells6.c380
-rw-r--r--src/squeltch.c3426
-rw-r--r--src/store.c239
-rw-r--r--src/string_list.c52
-rw-r--r--src/tables.c270
-rw-r--r--src/traps.c11
-rw-r--r--src/types.h363
-rw-r--r--src/util.c21
-rw-r--r--src/util.pkg2683
-rw-r--r--src/variable.c38
-rw-r--r--src/wild.c8
-rw-r--r--src/wizard2.c69
-rw-r--r--src/xtra1.c240
-rw-r--r--src/xtra2.c328
-rw-r--r--src/z_pack.pkg398
292 files changed, 23915 insertions, 66363 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c93bebd6..da5486b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,10 +5,13 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
# We want a readable feature summary.
INCLUDE(FeatureSummary)
+# pkg-config support
+INCLUDE(FindPkgConfig)
+
# Default flags.
IF(CMAKE_COMPILER_IS_GNUCC)
# Let's set sensible options.
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wno-unused-value")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wno-unused-value -Wno-unused-variable")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
ENDIF()
@@ -17,6 +20,16 @@ ENDIF()
ADD_DEFINITIONS(-DUSE_PRECISE_CMOVIE)
#
+# JSON support
+#
+PKG_CHECK_MODULES(JANSSON REQUIRED jansson)
+IF(JANSSON_FOUND)
+ ADD_DEFINITIONS(${JANSSON_CFLAGS})
+ INCLUDE_DIRECTORIES(${JANSSON_INCLUDE_DIRS})
+ SET(LIBS ${LIBS} ${JANSSON_LIBRARIES})
+ENDIF()
+
+#
# X11 support (OPTIONAL)
#
FIND_PACKAGE(X11)
diff --git a/README.txt b/README.txt
index 1e0ad583..cbdd2ff3 100644
--- a/README.txt
+++ b/README.txt
@@ -4,6 +4,15 @@ Using the CMake build system
There are basically two options for how to run ToME once built.
+Prerequisites
+=============
+
+You will need to have the following libraries installed
+on your system somewhere where CMake can find them:
+
+ - jansson
+ See http://www.digip.org/jansson/
+
Option #1 : Run ToME from the build directory
=============================================
@@ -46,6 +55,10 @@ probably missing the
build-essential
+package. You'll also need to install the
+
+ libjansson-dev
+
package.
Each frontend requires the additional packages listed below:
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 44d7d1ee..15591830 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,25 +1,19 @@
-INSTALL(FILES
- module.lua
- DESTINATION ${DEFAULT_PATH}
-)
INSTALL(DIRECTORY
apex
cmov
- core
data
dngn
edit
file
help
info
- mods
note
pref
save
- scpt
user
xtra
DESTINATION ${DEFAULT_PATH}
- PATTERN "*.raw" EXCLUDE
PATTERN "delete.me" EXCLUDE
)
+
+ADD_SUBDIRECTORY (mods)
diff --git a/lib/core/auto.lua b/lib/core/auto.lua
deleted file mode 100644
index b758db52..00000000
--- a/lib/core/auto.lua
+++ /dev/null
@@ -1,859 +0,0 @@
--- This file is the core of the Automatizer
--- Please do not touch unless you know what you are doing
-
-__rules = {}
-__rules_max = 0
-
-rule_aux = {}
-
--- Rule apply function, does .. nothing
-function auto_nothing(obj, item)
- return
-end
-
-function auto_inscribe(obj, item, note)
- if obj.note ~= 0 then return end
- msg_print("<Auto-Inscribe {"..note.."}>")
- obj.note = quark_add(note)
- return TRUE
-end
-
--- Rule apply function, pickup object
-function auto_pickup(obj, item)
- if item >= 0 then return end
- if inven_carry_okay(obj) == FALSE then return end
- msg_print("<Auto-pickup>")
- object_pickup(-item)
- return TRUE
-end
-
--- Rule apply function, destroy item
-function auto_destroy(obj, item)
- -- be carefull to what we can destroy
- -- Unaware things won't be destroyed.
- if is_aware(obj) == FALSE then return end
-
- -- Inscribed things won't be destroyed!
- if obj.note ~= 0 then return end
-
- -- Keep Artifacts -- they cannot be destroyed anyway
- if is_artifact(obj) == TRUE then return end
-
- -- Cannot destroy CURSE_NO_DROP objects
- local f1, f2, f3, f4, f5, esp = object_flags(obj);
- if band(f4, TR4_CURSE_NO_DROP) ~= 0 and band(obj.ident, IDENT_CURSED) then return end
-
- msg_print("<Auto-destroy>")
-
- -- Eliminate the item (from the pack)
- if item >= 0 then
- inven_item_increase(item, -obj.number)
- inven_item_describe(item)
- inven_item_optimize(item)
- -- Eliminate the item (from the floor)
- else
- floor_item_increase(0 - item, -obj.number)
- floor_item_describe(0 - item)
- floor_item_optimize(0 - item)
- end
- return TRUE
-end
-
--- Report the status of an object
-function object_status(obj)
- local sense =
- {
- [SENSE_CURSED] = "bad",
- [SENSE_WORTHLESS] = "very bad",
- [SENSE_AVERAGE] = "average",
- [SENSE_GOOD_LIGHT] = "good",
- [SENSE_GOOD_HEAVY] = "good",
- [SENSE_EXCELLENT] = "very good",
- [SENSE_SPECIAL] = "special",
- [SENSE_TERRIBLE] = "terrible",
- }
-
- if is_known(obj) == FALSE then
- if sense[obj.sense] then
- return sense[obj.sense]
- else
- return ""
- end
- else
-if nil then -- test
- local osense = -1
- local type = select_sense(obj, TRUE, TRUE)
- if type == 1 then
- osense = value_check_aux1(obj)
- elseif type == 2 then
- osense = value_check_aux1_magic(obj)
- end
-print("type : "..type)
- if sense[osense] then
- print("sense: "..sense[osense])
- return sense[osense]
- else
- print("sense: ")
- return ""
- end
-
-else -- the real one
-
- local slot = wield_slot_ideal(obj, TRUE)
-
- -- Arts items
- if is_artifact(obj) == TRUE then
- if band(obj.ident, IDENT_CURSED) == 0 then return "special"
- else return "terrible" end
- -- Ego items
- elseif (obj.name2 > 0 or obj.name2b > 0) then
- if band(obj.ident, IDENT_CURSED) == 0 then return "very good"
- else return "very bad" end
- -- weapon
- elseif (slot == INVEN_WIELD) or (slot == INVEN_BOW) or (slot == INVEN_AMMO) or (slot == INVEN_TOOL) then
- if obj.to_h + obj.to_d < 0 then
- return "bad"
- elseif obj.to_h + obj.to_d > 0 then
- return "good"
- else
- return "average"
- end
- -- armor
- elseif (slot >= INVEN_BODY) and (slot <= INVEN_FEET) then
- if obj.to_a < 0 then
- return "bad"
- elseif obj.to_a > 0 then
- return "good"
- else
- return "average"
- end
- -- ring
- elseif slot == INVEN_RING then
- if (obj.to_d + obj.to_h < 0) or (obj.to_a < 0) or (obj.pval < 0) then
- return "bad"
- else
- return "average"
- end
- -- amulet
- elseif slot == INVEN_NECK then
- if (obj.pval < 0) then
- return "bad"
- else
- return "average"
- end
- -- chests
- elseif obj.tval == TV_CHEST then
- if obj.pval == 0 then
- return "empty"
- elseif obj.pval < 0 then
- return "disarmed"
- else
- return "average"
- end
- else
- return "average"
- end
-end
- end
-end
-
--- Recursive function to generate a rule function tree
-function gen_rule_fct(r)
- -- It is a test rule (or, and, ...)
- if r.label == "and" or r.label == "or" then
- local i
- local fct_tbl = {}
- for i = 1, getn(r) do
- if r[i].label ~= "comment" then
- tinsert(fct_tbl, gen_rule_fct(r[i]))
- end
- end
- if r.label == "and" then
- return function(object)
- local fcts = %fct_tbl
- local i
- for i = 1, getn(fcts) do
- if not fcts[i](object) then return end
- end
- return TRUE
- end
- elseif r.label == "or" then
- return function(object)
- local fcts = %fct_tbl
- local i
- for i = 1, getn(fcts) do
- if fcts[i](object) then return TRUE end
- end
- end
- end
- -- It is a condition rule (name, type, level, ...)
- else
- if r.label == "not" then
- local f
- if not r[1] then
- f = function (object) return TRUE end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object) return not %f(object) end
- elseif r.label == "inventory" then
- local f
- if not r[1] then
- f = function(object) return end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object)
- local i = 0
- while i < INVEN_WIELD do
- if %f(player.inventory(i)) then
- return TRUE
- end
- i = i + 1
- end
- end
- elseif r.label == "equipment" then
- local f
- if not r[1] then
- f = function(object) return end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object)
- local i = INVEN_WIELD
- while i < INVEN_TOTAL do
- if %f(player.inventory(i)) then
- return TRUE
- end
- i = i + 1
- end
- end
- elseif r.label == "name" then
- return function(object) if strlower(object_desc(object, -1, 0)) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "contain" then
- return function(object) if strfind(strlower(object_desc(object, -1, 0)), strlower(%r[1])) then return TRUE end end
- elseif r.label == "symbol" then
- return function(object) if strchar(get_kind(object).d_char) == %r[1] then return TRUE end end
- elseif r.label == "inscribed" then
- return function(object) if object.note ~= 0 and strfind(strlower(quark_str(object.note)), strlower(%r[1])) then return TRUE end end
- elseif r.label == "discount" then
- local d1 = r.args.min
- local d2 = r.args.max
- if tonumber(d1) == nil then d1 = getglobal(d1) else d1 = tonumber(d1) end
- if tonumber(d2) == nil then d2 = getglobal(d2) else d2 = tonumber(d2) end
- return function(object) if is_aware(object) == TRUE and object.discount >= %d1 and object.discount <= %d2 then return TRUE end end
- elseif r.label == "tval" then
- local tv = r[1]
- if tonumber(tv) == nil then tv = getglobal(tv) else tv = tonumber(tv) end
- return function(object) if object.tval == %tv then return TRUE end end
- elseif r.label == "sval" then
- assert(r.args.min and r.args.max, "sval rule lacks min or max")
- local sv1 = r.args.min
- local sv2 = r.args.max
- if tonumber(sv1) == nil then sv1 = getglobal(sv1) else sv1 = tonumber(sv1) end
- if tonumber(sv2) == nil then sv2 = getglobal(sv2) else sv2 = tonumber(sv2) end
- return function(object) if is_aware(object) == TRUE and object.sval >= %sv1 and object.sval <= %sv2 then return TRUE end end
- elseif r.label == "status" then
- return function(object) if object_status(object) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "state" then
- if r[1] == "identified" then
- return function(object) if is_known(object) == TRUE then return TRUE end end
- else
- return function(object) if is_known(object) == FALSE then return TRUE end end
- end
- elseif r.label == "race" then
- return function(object) if strlower(get_race_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "subrace" then
- return function(object) if strlower(get_subrace_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "class" then
- return function(object) if strlower(get_class_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "level" then
- assert(r.args.min and r.args.max, "level rule lacks min or max")
- return function(object) if player.lev >= tonumber(%r.args.min) and player.lev <= tonumber(%r.args.max) then return TRUE end end
- elseif r.label == "skill" then
- assert(r.args.min and r.args.max, "skill rule lacks min or max")
- local s = find_skill_i(r[1])
- assert(s ~= -1, "no skill "..r[1])
- return function(object) if get_skill(%s) >= tonumber(%r.args.min) and get_skill(%s) <= tonumber(%r.args.max) then return TRUE end end
- elseif r.label == "ability" then
- local s = find_ability(r[1])
- assert(s ~= -1, "no ability "..r[1])
- return function(object) if has_ability(%s) == TRUE then return TRUE end end
- end
- end
-end
-
-function auto_inscribe_maker(inscription)
- return function(...)
- arg.n = arg.n + 1
- arg[getn(arg)] = %inscription
- return call(auto_inscribe, arg)
- end
-end
-
--- Generate a rule from a table
-function gen_full_rule(t)
- -- only honor rules for this module
- if not t.args.module then
- t.args.module = "ToME"
- end
-
- if not ((t.args.module == "all") or (t.args.module == game_module)) then
- return function() end
- end
-
- -- Check for which action to do
- local apply_fct = auto_nothing
- if t.args.type == "destroy" then apply_fct = auto_destroy
- elseif t.args.type == "pickup" then apply_fct = auto_pickup
- elseif t.args.type == "inscribe" then apply_fct = auto_inscribe_maker(t.args.inscription)
- end
-
- -- create the function tree
- local rf
- if t[1] then
- rf = gen_rule_fct(t[1])
- else
- rf = function (object) end
- end
-
- -- create the final function
- return function(...)
- local rf = %rf
- if rf(arg[1]) then
- if call(%apply_fct, arg) == TRUE then return TRUE end
- end
- end
-end
-
--- Create a function that checks for the rules(passed in xml form)
-function add_ruleset(s)
- local tbl = xml:collect(s)
- local i
-
- -- Add all rules
- for i = 1, getn(tbl) do
- local t = tbl[i]
-
- if t.label == "rule" then
- -- Create the function tree
- local fct = gen_full_rule(t)
-
- -- Create the test function
- __rules[__rules_max] =
- {
- ["table"] = t,
- ["fct"] = fct
- }
- __rules_max = __rules_max + 1
- end
- end
-end
-
--- Apply the current rules to an object
--- call with at least (object, idx)
-function apply_rules(...)
- local i
- for i = 0, __rules_max - 1 do
- if call(__rules[i].fct, arg) then return TRUE end
- end
- return FALSE
-end
-
--- Clear the current rules
-function clean_ruleset()
- __rules_max = 0
- __rules = {}
-end
-
------- helper fonctions for the GUI
-
-auto_aux = {}
-auto_aux.stack = { n = 0 }
-auto_aux.idx = 1
-auto_aux.rule = 1
-function auto_aux:go_right()
- if auto_aux.rule[1] and type(auto_aux.rule[1]) == "table" then
- tinsert(auto_aux.stack, auto_aux.idx)
- tinsert(auto_aux.stack, auto_aux.rule)
- auto_aux.rule = auto_aux.rule[1]
- auto_aux.idx = 1
- end
-end
-
-function auto_aux:go_left(sel)
- local n = getn(auto_aux.stack)
-
- if n > 0 then
- auto_aux.idx = auto_aux.stack[n - 1]
- auto_aux.rule = auto_aux.stack[n]
- tremove(auto_aux.stack)
- tremove(auto_aux.stack)
- end
-end
-
-function auto_aux:go_down()
- if getn(auto_aux.stack) > 1 then
- if auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx + 1] then
- auto_aux.idx = auto_aux.idx + 1
- auto_aux.rule = auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx]
- end
- end
-end
-
-function auto_aux:go_up()
- if getn(auto_aux.stack) > 1 then
- if auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx - 1] then
- auto_aux.idx = auto_aux.idx - 1
- auto_aux.rule = auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx]
- end
- end
-end
-
-function auto_aux:scroll_up()
- xml.write_off_y = xml.write_off_y - 1
-end
-
-function auto_aux:scroll_down()
- xml.write_off_y = xml.write_off_y + 1
-end
-
-function auto_aux:scroll_left()
- xml.write_off_x = xml.write_off_x + 1
-end
-
-function auto_aux:scroll_right()
- xml.write_off_x = xml.write_off_x - 1
-end
-
-function auto_aux:adjust_current(sel)
- if __rules_max == 0 then return end
-
- xml.write_off_y = 0
- xml.write_off_x = 0
- auto_aux.idx = 1
- auto_aux.stack = { n = 0 }
- auto_aux.rule = __rules[sel].table
-end
-
-function auto_aux:move_up(sel)
- if sel > 0 then
- local u = __rules[sel - 1]
- local d = __rules[sel]
- __rules[sel - 1] = d
- __rules[sel] = u
- return sel - 1
- end
- return sel
-end
-
-function auto_aux:move_down(sel)
- if sel < __rules_max - 1 then
- local u = __rules[sel]
- local d = __rules[sel + 1]
- __rules[sel + 1] = u
- __rules[sel] = d
- return sel + 1
- end
- return sel
-end
-
-function auto_aux:new_rule(sel, nam, typ, arg)
- local r
-
-
- -- nam can also directly be the table itself
- if type(nam) == "table" then
- r =
- {
- ["table"] = nam,
- ["fct"] = function (object) end
- }
- elseif typ == "inscribe" then
- if arg == "" then
- arg = input_box("Inscription?", 79)
- end
- r =
- {
- ["table"] =
- {
- label = "rule",
- args = { name = nam, type = typ, inscription = arg, module = game_module },
- },
- ["fct"] = function (object) end
- }
- else
- r =
- {
- ["table"] =
- {
- label = "rule",
- args = { name = nam, type = typ, module = game_module },
- },
- ["fct"] = function (object) end
- }
- end
- tinsert(__rules, sel, r)
- __rules_max = __rules_max + 1
-end
-
-function auto_aux:rename_rule(sel, nam)
- if sel >= 0 and sel < __rules_max then
- __rules[sel].table.args.name = nam
- end
-end
-
-function auto_aux:save_ruleset()
- xml.write = xml.write_file
-
- print_hook("clean_ruleset()\nadd_ruleset\n[[\n")
- local i
- for i = 0, __rules_max - 1 do
- xml:print_xml(__rules[i].table, '')
- end
- print_hook("]]\n")
-
- xml.write = xml.write_screen
-end
-
-function auto_aux:del_self(sel)
- if auto_aux.rule.label == "rule" then
- tremove(__rules, sel)
- __rules_max = __rules_max - 1
- return sel - 1
- else
- local idx = auto_aux.idx
- auto_aux:go_left(sel)
- tremove(auto_aux.rule, idx)
- return sel
- end
-end
-
-auto_aux.types_desc =
-{
- ["and"] =
- {
- "Check is true if all rules within it are true",
- xml:collect([[<and><foo1>...</foo1><foo2>...</foo2><foo3>...</foo3></and>]]),
- function ()
- return xml:collect("<and></and>")
- end,
- },
- ["or"] =
- {
- "Check is true if at least one rule within it is true",
- xml:collect([[<or><foo1>...</foo1><foo2>...</foo2><foo3>...</foo3></or>]]),
- function ()
- return xml:collect("<or></or>")
- end,
- },
- ["not"] =
- {
- "Invert the result of its child rule",
- xml:collect([[<not><foo1>...</foo1></not>]]),
- function ()
- return xml:collect("<not></not>")
- end,
- },
- ["comment"] =
- {
- "Comments are meaningless",
- xml:collect([[<comment>Comment explaining something</comment>]]),
- function ()
- local n = input_box("Comment?", 79)
- if n == "" then return end
- return xml:collect("<comment>"..n.."</comment>")
- end,
- },
- ["name"] =
- {
- "Check is true if object name matches name",
- xml:collect([[<name>potion of healing</name>]]),
- function ()
- local n = input_box("Object name to match?", 79)
- if n == "" then return end
- return xml:collect("<name>"..n.."</name>")
- end,
- },
- ["contain"] =
- {
- "Check is true if object name contains word",
- xml:collect([[<contain>healing</contain>]]),
- function ()
- local n = input_box("Word to find in object name?", 79)
- if n == "" then return end
- return xml:collect("<contain>"..n.."</contain>")
- end,
- },
- ["inscribed"] =
- {
- "Check is true if object inscription contains word",
- xml:collect([[<inscribed>=g</inscribed>]]),
- function ()
- local n = input_box("Word to find in object inscription?", 79)
- if n == "" then return end
- return xml:collect("<inscribed>"..n.."</inscribed>")
- end,
- },
- ["discount"] =
- {
- "Check is true if object discount is between 2 values",
- xml:collect([[<sval min='50' max='100'></sval>]]),
- function ()
- local s = "<discount "
-
- local n = input_box("Min discount?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max discount?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></discount>"
- return xml:collect(s)
- end,
- },
- ["symbol"] =
- {
- "Check is true if object symbol is ok",
- xml:collect([[<symbol>!</symbol>]]),
- function ()
- local n = input_box("Symbol to match?", 1)
- if n == "" then return end
- return xml:collect("<symbol>"..n.."</symbol>")
- end,
- },
- ["status"] =
- {
- "Check is true if object status is ok",
- xml:collect([[<status>good</status>]]),
- function ()
- local n = msg_box("[t]errible, [v]ery bad, [b]ad, [a]verage, [G]ood, [V]ery good, [S]pecial?")
- local t =
- {
- ["t"] = "terrible",
- ["v"] = "very bad",
- ["b"] = "bad",
- ["a"] = "average",
- ["G"] = "good",
- ["V"] = "very good",
- ["S"] = "special",
- }
- if not t[strchar(n)] then return end
- return xml:collect("<status>"..t[strchar(n)].."</status>")
- end,
- },
- ["state"] =
- {
- "Check is true if object is identified/unidentified",
- xml:collect([[<state>identified</state>]]),
- function ()
- local n = msg_box("[i]dentified, [n]on identified?")
- local t =
- {
- ["i"] = "identified",
- ["n"] = "not identified",
- }
- if not t[strchar(n)] then return end
- return xml:collect("<state>"..t[strchar(n)].."</state>")
- end,
- },
- ["tval"] =
- {
- "Check is true if object tval(from k_info.txt) is ok",
- xml:collect([[<tval>55</tval>]]),
- function ()
- local n = input_box("Tval to match?", 79)
- if n == "" then return end
- return xml:collect("<tval>"..n.."</tval>")
- end,
- },
- ["sval"] =
- {
- {
- "Check is true if object sval(from k_info.txt) is between",
- "2 values",
- },
- xml:collect([[<sval min='0' max='100'></sval>]]),
- function ()
- local s = "<sval "
-
- local n = input_box("Min sval?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max sval?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></sval>"
- return xml:collect(s)
- end,
- },
- ["race"] =
- {
- "Check is true if player race is ok",
- xml:collect([[<race>dunadan</race>]]),
- function ()
- local n = input_box("Player race to match?", 79)
- if n == "" then return end
- return xml:collect("<race>"..n.."</race>")
- end,
- },
- ["subrace"] =
- {
- "Check is true if player subrace is ok",
- xml:collect([[<subrace>vampire</subrace>]]),
- function ()
- local n = input_box("Player subrace to match?", 79)
- if n == "" then return end
- return xml:collect("<subrace>"..n.."</subrace>")
- end,
- },
- ["class"] =
- {
- "Check is true if player class is ok",
- xml:collect([[<class>sorceror</class>]]),
- function ()
- local n = input_box("Player class to match?", 79)
- if n == "" then return end
- return xml:collect("<class>"..n.."</class>")
- end,
- },
- ["level"] =
- {
- "Check is true if player level is between 2 values",
- xml:collect([[<level min='20' max='50'></level>]]),
- function ()
- local s = "<level "
-
- local n = input_box("Min player level?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max player level?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></level>"
-
- return xml:collect(s)
- end,
- },
- ["skill"] =
- {
- "Check is true if player skill level is between 2 values",
- xml:collect([[<skill min='10' max='20'>Divination</skill>]]),
- function ()
- local s = "<skill "
-
- local n = input_box("Min skill level?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max skill level?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'>"
-
- n = input_box("Skill name?", 79)
- if n == "" then return end
- if find_skill_i(n) == -1 then return end
- s = s..n.."</skill>"
-
- return xml:collect(s)
- end,
- },
- ["ability"] =
- {
- "Check is true if player has the ability",
- xml:collect([[<ability>Ammo creation</ability>]]),
- function()
- local n = input_box("Ability name?", 79)
- if n == "" then return end
- if find_ability(n) == -1 then return end
- return xml:collect("<ability>"..n.."</ability>")
- end,
- },
- ["inventory"] =
- {
- {
- "Check is true if something in player's inventory matches",
- "the contained rule",
- },
- xml:collect([[<inventory><foo1>...</foo1></inventory>]]),
- function ()
- return xml:collect("<inventory></inventory>")
- end,
- },
- ["equipment"] =
- {
- {
- "Check is true if something in player's equipment matches",
- "the contained rule",
- },
- xml:collect([[<equipment><foo1>...</foo1></equipment>]]),
- function ()
- return xml:collect("<equipment></equipment>")
- end,
- },
-}
-
-function auto_aux:display_desc(sel)
- local d = auto_aux.types_desc[sel][1]
- if type(d) == "string" then
- c_prt(TERM_WHITE, d, 1, 17)
- else
- local k, e, i
- i = 0
- for k, e in d do
- c_prt(TERM_WHITE, e, 1 + i, 17)
- i = i + 1
- end
- end
-end
-
-function auto_aux:add_child(sel)
- -- <rule> and <not> contain only one match
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "not") and auto_aux.rule[1] then return end
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "equipment") and auto_aux.rule[1] then return end
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "inventory") and auto_aux.rule[1] then return end
-
- -- Only <and> and <or> can contain
- if auto_aux.rule.label ~= "rule" and auto_aux.rule.label ~= "and" and auto_aux.rule.label ~= "or" and auto_aux.rule.label ~= "not" and auto_aux.rule.label ~= "equipment" and auto_aux.rule.label ~= "inventory" then return end
-
- -- get it
- local r = auto_aux.types_desc[sel][3]()
- if not r then return end
-
- -- Ok add it
- tinsert(auto_aux.rule, r[1])
-end
-
-function auto_aux.regen_ruleset()
- local i
- for i = 0, __rules_max - 1 do
- __rules[i].fct = gen_full_rule(__rules[i].table)
- end
-end
-
-
--- Easily add new rules
-function easy_add_rule(typ, mode, do_status, obj)
- local detect_rule
-
- if mode == "tval" then
- detect_rule = "<tval>"..obj.tval.."</tval>"
- elseif mode == "tsval" then
- detect_rule = "<and><tval>"..obj.tval.."</tval><sval min='"..obj.sval.."' max='"..obj.sval.."'></sval></and>"
- elseif mode == "name" then
- detect_rule = "<name>"..strlower(object_desc(obj, -1, 0)).."</name>"
- end
-
- if do_status == TRUE then
- local status = object_status(obj)
- if status and not (status == "") then
- detect_rule = "<and>"..detect_rule.."<status>"..status.."</status></and>"
- end
- end
-
- local rule = "<rule module='"..game_module.."' name='"..typ.."' type='"..typ.."'>"..detect_rule.."</rule>"
- auto_aux:new_rule(0, xml:collect(rule)[1], '')
- auto_aux.regen_ruleset()
- msg_print("Rule added. Please go to the Automatizer screen (press = then T)")
- msg_print("to save the modified ruleset.")
-end
diff --git a/lib/core/building.lua b/lib/core/building.lua
deleted file mode 100644
index 8e88888a..00000000
--- a/lib/core/building.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-__building_actions = {}
-
-function add_building_action(a)
- assert(a.index, "No building action index")
- assert(a.action, "No building action action")
- __building_actions[a.index] = a.action
-end
-
-function __bact_activate(bact)
- if __building_actions[bact] then
- return __building_actions[bact]()
- end
-end
-
-add_hook_script(HOOK_BUILDING_ACTION, "__bact_activate", "__bact_activate")
diff --git a/lib/core/crpt_aux.lua b/lib/core/crpt_aux.lua
deleted file mode 100644
index 97f8d4b6..00000000
--- a/lib/core/crpt_aux.lua
+++ /dev/null
@@ -1,182 +0,0 @@
--- Core functions for corruptions
-
-__corruptions = {}
-__corruptions_max = 0
-__corruptions_callbacks_max = 0
-
--- Get the corruption
-function player.corruption(c, set)
- if set then
- player.corruptions_aux[c + 1] = set
- player.redraw = bor(player.redraw, PR_BASIC)
- player.update = bor(player.update, PU_BONUS, PU_TORCH, PU_BODY, PU_POWERS)
- if (set == TRUE) and (__corruptions[c].gain) then
- __corruptions[c].gain()
- end
- if (set == FALSE) and (__corruptions[c].lose) then
- __corruptions[c].lose()
- end
- else
- return player.corruptions_aux[c + 1]
- end
-end
-
--- Test if we have that corruption
--- We must:
--- 1) have it or be willing to get it
--- 2) have all its dependancies
--- 3) have none of its opposing corruptions
--- 4) pass the possible tests
-function test_depend_corrupt(corrupt, can_gain)
- local i, c
-
- if not can_gain then can_gain = FALSE end
-
- if can_gain == TRUE then
- if (player.corruption(corrupt) ~= FALSE) then
- return FALSE
- end
- else
- if (player.corruption(corrupt) ~= TRUE) then
- return FALSE
- end
- end
-
- for c, i in __corruptions[corrupt].depends do
- if test_depend_corrupt(c) ~= TRUE then
- return FALSE
- end
- end
-
- for c, i in __corruptions[corrupt].oppose do
- if test_depend_corrupt(c) ~= FALSE then
- return FALSE
- end
- end
-
- -- are we even allowed to get it?
- if __corruptions[corrupt].can_gain and (not __corruptions[corrupt].can_gain()) then
- return FALSE
- end
-
- return TRUE
-end
-
--- Gain a new corruption
-function gain_corruption(group)
- local i, max
- local pos = {}
-
- -- Get the list of all possible ones
- max = 0
- for i = 0, __corruptions_max - 1 do
- if __corruptions[i].group == group and test_depend_corrupt(i, TRUE) == TRUE and __corruptions[i].random == TRUE and __corruptions[i].allow() then
- pos[max] = i
- max = max + 1
- end
- end
-
- -- Ok now get one of them
- if (max > 0) then
- local ret = rand_int(max)
-
- player.corruption(pos[ret], TRUE)
- cmsg_print(TERM_L_RED, __corruptions[pos[ret]].get_text)
-
- return pos[ret]
- else
- return -1
- end
-end
-
--- Lose an existing corruption
-function lose_corruption()
- local i, max
- local pos = {}
-
- -- Get the list of all possible ones
- max = 0
- for i = 0, __corruptions_max - 1 do
- if test_depend_corrupt(i) == TRUE and __corruptions[i].removable == TRUE then
- pos[max] = i
- max = max + 1
- end
- end
-
- -- Ok now get one of them
- if (max > 0) then
- local ret = rand_int(max)
-
- player.corruption(pos[ret], FALSE)
- cmsg_print(TERM_L_RED, __corruptions[pos[ret]].lose_text)
-
- -- Ok now lets see if it broke some dependancies
- for i = 0, max - 1 do
- if player.corruption(pos[i]) ~= test_depend_corrupt(pos[i]) then
- player.corruption(pos[i], FALSE)
- cmsg_print(TERM_L_RED, __corruptions[pos[i]].lose_text)
- end
- end
-
- return pos[ret]
- else
- return -1
- end
-end
-
--- Lose all corruptions (for e.g. Potion of New Life)
-function lose_all_corruptions()
- local i;
- for i = 0, __corruptions_max - 1 do
- lose_corruption()
- end
- return -1
-end
-
--- Creates a new corruption
-function add_corruption(c)
- assert(c.color, "No corruption color")
- assert(c.name, "No corruption name")
- assert(c.get_text, "No corruption get_text")
- assert(c.lose_text, "No corruption lose_text")
- assert(c.desc, "No corruption desc")
- assert(c.hooks, "Nothing to do for corruption")
- if not c.random then c.random = TRUE end
- if not c.removable then c.removable = TRUE end
- if not c.allow then c.allow = function() return not nil end end
-
- if c.depends == nil then c.depends = {} end
- if c.oppose == nil then c.oppose = {} end
-
- -- We must make sure the other ones opposes too
- local o, i
- for o, i in c.oppose do
- __corruptions[o].oppose[__corruptions_max] = TRUE
- end
-
- local index, h
- for index, h in c.hooks do
- add_hook_script(index, "__lua__corrupt_callback"..__corruptions_callbacks_max, "__lua__corrupt_callback"..__corruptions_callbacks_max)
- setglobal("__lua__corrupt_callback"..__corruptions_callbacks_max,
- function (...)
- if test_depend_corrupt(%__corruptions_max) == TRUE then
- return call(%h, arg)
- end
- end
- )
- __corruptions_callbacks_max = __corruptions_callbacks_max + 1
- end
-
- if type(c.desc) == "table" then
- local new_desc = ""
- for index, h in c.desc do
- new_desc = new_desc..h.."\n"
- end
- c.desc = new_desc
- end
-
- __corruptions[__corruptions_max] = c
- __corruptions_max = __corruptions_max + 1
- return (__corruptions_max - 1)
-end
-
diff --git a/lib/core/dungeon.lua b/lib/core/dungeon.lua
deleted file mode 100644
index d91d785b..00000000
--- a/lib/core/dungeon.lua
+++ /dev/null
@@ -1,55 +0,0 @@
--- Internal lua file in charge of dungeon stuff
-
-function place_dungeon(y, x, d_idx)
- if d_idx then
- wild_map(y, x).entrance = 1000 + d_idx
- else
- wild_map(y, x).entrance = 0
- end
-end
-
-function dungeon(d_idx)
- return d_info[1 + d_idx]
-end
-
-function wild_feat(wild)
- return wf_info[1 + wild.feat]
-end
-
-function explode_dir(dir)
- return ddy[dir + 1], ddx[dir + 1]
-end
-
-function rotate_dir(dir, mov)
- if mov > 0 then
- if dir == 7 then dir = 8
- elseif dir == 8 then dir = 9
- elseif dir == 9 then dir = 6
- elseif dir == 6 then dir = 3
- elseif dir == 3 then dir = 2
- elseif dir == 2 then dir = 1
- elseif dir == 1 then dir = 4
- elseif dir == 4 then dir = 7
- end
- elseif mov < 0 then
- if dir == 7 then dir = 4
- elseif dir == 4 then dir = 1
- elseif dir == 1 then dir = 2
- elseif dir == 2 then dir = 3
- elseif dir == 3 then dir = 6
- elseif dir == 6 then dir = 9
- elseif dir == 9 then dir = 8
- elseif dir == 8 then dir = 7
- end
- end
-
- return dir
-end
-
--- Place a trap for a specific level
-function place_trap(y, x, level)
- local old_dun = dun_level
- dun_level = level
- %place_trap(y, x)
- dun_level = old_dun
-end
diff --git a/lib/core/gen_idx.lua b/lib/core/gen_idx.lua
deleted file mode 100644
index 5f3af435..00000000
--- a/lib/core/gen_idx.lua
+++ /dev/null
@@ -1,261 +0,0 @@
--- Place here the list of files to parse
-files =
-{
- "birth.txt",
- "experien.hlp",
- "gods.txt",
- "explore.hlp",
- "newbie.hlp",
- "advanced.hlp",
- "help.hlp",
- "general.txt",
- "whattome.txt",
- "dungeon.txt",
- "spoiler.hlp",
- "g_melkor.txt",
- "skills.txt",
- "c_bard.txt",
- "c_druid.txt",
- "c_lorema.txt",
- "c_mage.txt",
- "c_mimic.txt",
- "c_mindcr.txt",
- "c_monk.txt",
- "c_palad.txt",
- "c_posses.txt",
- "c_pr_drk.txt",
- "c_pr_eru.txt",
- "c_pr_man.txt",
- "c_symbia.txt",
- "c_alchem.txt",
- "c_archer.txt",
- "c_assass.txt",
- "c_axemas.txt",
- "c_demono.txt",
- "c_geoman.txt",
- "c_hafted.txt",
- "c_necro.txt",
- "c_polear.txt",
- "c_ranger.txt",
- "c_rogue.txt",
- "c_runecr.txt",
- "c_sorcer.txt",
- "c_swordm.txt",
- "c_thaum.txt",
- "c_unbel.txt",
- "c_warper.txt",
- "c_warrio.txt",
- "m_meta.txt",
- "rm_skel.txt",
- "rm_zomb.txt",
- "luckspoi.txt",
- "m_air.txt",
- "dunspoil.txt",
- "g_eru.txt",
- "g_manwe.txt",
- "g_tulkas.txt",
- "m_divin.txt",
- "m_mimic.txt",
- "m_water.txt",
- "magic.txt",
- "r_drkelf.txt",
- "r_dwarf.txt",
- "r_elf.txt",
- "r_hielf.txt",
- "r_hobbit.txt",
- "r_pettyd.txt",
- "r_wodelf.txt",
- "rm_spec.txt",
- "tome_faq.txt",
- "ability.txt",
- "automat.txt",
- "c_summon.txt",
- "command.txt",
- "corspoil.txt",
- "debug.txt",
- "m_music.txt",
- "rm_barb.txt",
- "macrofaq.txt",
- "m_necrom.txt",
- "m_mindcr.txt",
- "m_symbio.txt",
- "m_thaum.txt",
- "magic.hlp",
- "m_convey.txt",
- "m_fire.txt",
- "m_mana.txt",
- "m_mind.txt",
- "m_nature.txt",
- "m_tempo.txt",
- "m_udun.txt",
- "m_geoman.txt",
- "essences.txt",
- "r_ent.txt",
- "g_yavann.txt",
- "defines.txt",
- "rm_vamp.txt",
- "inscrip.txt",
- "m_earth.txt",
- "option.txt",
- "attack.txt",
- "version.txt",
- "m_demono.txt",
- "r_beorn.txt",
- "r_deathm.txt",
- "r_rohank.txt",
- "r_hafogr.txt",
- "r_human.txt",
- "r_kobold.txt",
- "r_maia.txt",
- "r_orc.txt",
- "r_thlord.txt",
- "r_troll.txt",
- "r_yeek.txt",
- "rm_class.txt",
- "rm_herm.txt",
- "rm_lsoul.txt",
- "wishing.txt",
- "c_priest.txt",
- "fatespoi.txt",
- "gambling.txt",
- "r_dunad.txt",
- "r_gnome.txt",
- "r_hafelf.txt",
- "c_merch.txt",
- "spoil_faq.txt",
-}
-
-out_file = "index.txt"
-
-index = {}
-
-function parse_file(file)
- local fff = openfile(path_build(ANGBAND_DIR_HELP, file), "r")
- local line
-
- line = read(fff, "*l")
- while line do
- local i, j, anchor, name, subname = strfind(line, "~~~~~(%d+)|([%d%a -]+)|([%d%a -]+)")
- if not i then
- i, j, anchor, name = strfind(line, "~~~~~(%d+)|([%d%a -]+)")
-
- subname = nil
- end
-
- if i then
- if not index[name] then
- index[name] = {}
- end
- if subname then
- tinsert(index[name], { __name__ = subname, __file__ = file, __anchor__ = anchor})
- else
- tinsert(index[name], { __name__ = "__primary__", __file__ = file, __anchor__ = anchor})
- end
- end
-
- line = read(fff, "*l")
- end
-
- closefile(fff)
-end
-
-function sort_fct(a, b)
- local i, len
-
- a = a.__name__
- b = b.__name__
-
- if strlen(a) > strlen(b) then len = strlen(b) else len = strlen(a) end
-
- for i = 1, len do
- local ac = strbyte(a, i)
- local bc = strbyte(b, i)
-
- if ac < bc then
- return not nil
- elseif ac > bc then
- return nil
- end
- end
- if strlen(a) > strlen(b) then return nil else return not nil end
-end
-
-function generate_index()
- local k, e, index_list
- for _, e in files do
- parse_file(e)
- end
-
- index_list = {}
- for k, e in index do
- -- Ok either my sort function or lua sort function sucks ass ..
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- tinsert(index_list, {__name__= k, __table__ = e})
- end
-
- -- Ok either my sort function or lua sort function sucks ass ..
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- index = index_list
-end
-
-function out_link(fff, space, name, file, anchor)
- write(fff, space.."*****"..file.."*"..anchor.."["..name.."]\n")
-end
-
-function print_index()
- local i, j, c, new_c
- local fff = openfile(path_build(ANGBAND_DIR_HELP, out_file), "w")
-
- write(fff,
-[[|||||oy
-#####R /----------------------------------------\
-#####R < Help Index >
-#####R \----------------------------------------/
-
-This is the index of everything in the T.o.M.E. documentation.
-
-#####BHit a letter key to jump to the entries for that letter.
-
-Some entries in the index link to the same place as other entries. This is
-intentional, so that the information you want is easy to find.
-
-Don't forget you can browse the help from the *****help.hlp*02[Main menu].
-
-#####sSpotted a problem with the help files, or some content thats missing?
-#####sContact fearoffours@t-o-m-e.net .
-
-]])
-
- c = ' '
- for i = 1, getn(index) do
- new_c = strbyte(index[i].__name__, 1)
- if c ~= new_c then
- c = new_c
- write(fff, "~~~~~"..c.."\n")
- write(fff, "*****/"..strchar(c)..out_file.."*"..c.."["..strchar(c).."]\n")
- end
- for j = 1, getn(index[i].__table__) do
- if index[i].__table__[j].__name__ == "__primary__" then
- out_link(fff, " ", index[i].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__)
- end
- end
- for j = 1, getn(index[i].__table__) do
- if index[i].__table__[j].__name__ ~= "__primary__" then
- out_link(fff, " ", index[i].__table__[j].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__)
- end
- end
- end
- closefile(fff)
-end
-
-generate_index()
-
-print_index()
diff --git a/lib/core/gods.lua b/lib/core/gods.lua
deleted file mode 100644
index 77e0aad5..00000000
--- a/lib/core/gods.lua
+++ /dev/null
@@ -1,40 +0,0 @@
--- Gods helper files
-
--- Gods structs
-
-__gods_hook = {}
-__gods_callbacks = {}
-__gods_callbacks_max = 0
-
-function add_god(q)
- local i, index, d, z, qq
-
- assert(q.name, "No god name")
- assert(q.desc, "No god desc")
- assert(q.hooks, "No god hooks")
-
- i = add_new_gods(q.name);
-
- z = 0
- for index, d in q.desc do
- desc_god(i, z, d);
- z = z + 1
- end
-
- __gods_hook[i] = q.hooks
- for index, d in q.hooks do
- add_hook_script(index, "__lua__gods_callback"..__gods_callbacks_max, "__lua__gods_callback"..__gods_callbacks_max)
- setglobal("__lua__gods_callback"..__gods_callbacks_max, d)
- __gods_callbacks_max = __gods_callbacks_max + 1
- end
- if q.data then
- for index, d in q.data do
- -- Besure it exists
- setglobal(index, d)
-
- -- Make it save & load
- add_loadsave(index, d)
- end
- end
- return i
-end
diff --git a/lib/core/help.lua b/lib/core/help.lua
deleted file mode 100644
index a581fe63..00000000
--- a/lib/core/help.lua
+++ /dev/null
@@ -1,141 +0,0 @@
--- Ingame contextual help
-
--- We use our own hook list as to not overburn the hook proccessor
--- with many hooks that would slow down things
--- It would be very meaningless if the option is not even on
-__ingame_hooks = {}
-
-__ingame_help_max = 0
-
-function ingame_help(t, ...)
- -- This function can also be used to call the callbacks
- if type(t) == "string" then
- local f = getglobal("__ingame_help_fct_"..t)
- call(f, arg)
- return
- end
-
- assert(t.desc or t.fct, "no ingame help desc/fct")
- assert(t.hook or t.callback, "no ingame help hook/callback")
- if t.hook then assert(t.event, "no ingame hepl event needed by hook") end
-
- -- Set it to only trigger once
- setglobal("__ingame_help_activated_"..__ingame_help_max, FALSE)
- -- Save/load it
- add_loadsave("__ingame_help_activated_"..__ingame_help_max, FALSE)
-
- if t.hook then
- -- If the hok list didnt exist yet, add it
- if not __ingame_hooks[t.hook] then
- -- Set it to empty, we'll fill it later
- __ingame_hooks[t.hook] = {}
- -- Add the global hook
- add_hooks
- {
- [t.hook] = function (...)
- if option_ingame_help ~= TRUE then return end
- local k, e
- for k, e in __ingame_hooks[%t.hook] do
- if k ~= "n" then
- call(e, arg)
- end
- end
- end
- }
- end
- if t.desc then
- tinsert(__ingame_hooks[t.hook],
- function (...)
- local tbl = %t
- if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then
- if call(tbl.event, arg) == TRUE then
- local k, e
- for k, e in tbl.desc do
- msg_print(TERM_YELLOW, e)
- end
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- )
- elseif t.fct then
- tinsert(__ingame_hooks[t.hook],
- function (...)
- local tbl = %t
- if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then
- if call(tbl.event, arg) == TRUE then
- if tbl.fct() == TRUE then
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- end
- )
- end
- else
- local no_test = FALSE
- if t.no_test == TRUE then no_test = TRUE end
- if t.desc then
- setglobal
- (
- "__ingame_help_fct_"..(t.callback),
- function (...)
- local tbl = %t
- if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then
- local k, e
- for k, e in tbl.desc do
- msg_print(TERM_YELLOW, e)
- end
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- )
- elseif t.fct then
- setglobal
- (
- "__ingame_help_fct_"..(t.callback),
- function (...)
- local tbl = %t
- if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then
- if call(tbl.fct, arg) == TRUE then
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- )
- end
- end
-
- __ingame_help_max = __ingame_help_max + 1
-end
-
--- Clean up the ingame help seen at birth
-add_hooks
-{
- [HOOK_BIRTH_OBJECTS] = function()
- local i
- for i = 0, __ingame_help_max - 1 do
- setglobal("__ingame_help_activated_"..i, FALSE)
- end
- end
-}
-
-function ingame_clean()
- local i
- for i = 0, __ingame_help_max - 1 do
- setglobal("__ingame_help_activated_"..i, FALSE)
- end
-end
-
--- helper function, brings up a doc
-function ingame_help_doc(name, anchor)
- -- Save screen
- screen_save();
-
- -- Peruse the help file
- if not anchor then anchor = 0 end
- show_file(name, 0, -anchor, 0)
-
- -- Load screen
- screen_load()
-end
diff --git a/lib/core/init.lua b/lib/core/init.lua
deleted file mode 100644
index 11b812d5..00000000
--- a/lib/core/init.lua
+++ /dev/null
@@ -1,83 +0,0 @@
---
--- This file is loaded at the initialisation of ToME
--- Load the system functions
---
-
--- Name of globals to save
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "load.lua")
-
--- Very thin xml parser(49 lines ;)
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "xml.lua")
-
--- various vital helper code
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "s_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "crpt_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "mimc_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "quests.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "gods.lua")
-
--- Load the ingame contextual help
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua")
-
--- let the store specific stuff happen!
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "stores.lua")
-
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
--------------Here we load the non vital scripts---------------
------------------------from lib/scpt--------------------------
---------------------------------------------------------------
---------------------------------------------------------------
-tome_dofile("init.lua")
-
--- The dofile functions for each patch
-patch_dofile = {}
-
--- Now load patches
-function load_patches()
- scansubdir(ANGBAND_DIR_PATCH)
- for i = 0, scansubdir_max - 1 do
- if (scansubdir_result[i + 1] ~= ".") and (scansubdir_result[i + 1] ~= "..") then
- local dir = path_build(ANGBAND_DIR_PATCH, scansubdir_result[i + 1])
- local file = path_build(dir, "patch.lua")
- if file_exist(file) == TRUE then
- patch_init = nil
- tome_dofile_anywhere(dir, "patch.lua", TRUE)
- unset_safe_globals()
- if patch_init == nil then
- set_safe_globals()
- quit("Patch in "..file.." did not include a patch_init() function")
- else
- set_safe_globals()
-
- -- create the dofile function
- patch_dofile[scansubdir_result[i + 1]] = function(f)
- tome_dofile_anywhere(%dir, f, TRUE)
- end
-
- local name, version = patch_init()
- if name == nil or version == nil then
- quit("Patch in "..file.." did not return valid name or version.\nIt must return name, version")
- end
- patch_version(name, version)
- end
- end
- end
- end
-end
-load_patches()
-
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
---
--- Do not thouch after this line
---
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "load2.lua")
diff --git a/lib/core/load.lua b/lib/core/load.lua
deleted file mode 100644
index 9522ec91..00000000
--- a/lib/core/load.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- Savefile stuff
--- Do not meddle in the affairs of savefiles for they are subtle and quick to be become incompatible
-
-__loadsave_name = {}
-__loadsave_max = 0
-__loadsave_tmp = 0
-
-function add_loadsave(name, default)
- assert(name, "No variable name to save")
- assert(default, "No default value")
-
- -- if it is a table we must create many entries
- if type(default) == "table" then
- for k, e in default do
- add_loadsave(name.."."..k, e)
- end
- else
- __loadsave_name[__loadsave_max] = { name = name, default = default }
- __loadsave_max = __loadsave_max + 1
- end
-end
-
--- Example of how to save a table
--- NOTE: { 1, 2, 3 } will NOT work, the key MUST be a string
---[[
-add_loadsave("t",
-{
- foo = 7,
- tab = {
- a = 1,
- b = 2,
- tab = {
- a=1, b=2, c=3,
- },
- },
-})
-]]
diff --git a/lib/core/load2.lua b/lib/core/load2.lua
deleted file mode 100644
index 7e151d91..00000000
--- a/lib/core/load2.lua
+++ /dev/null
@@ -1,56 +0,0 @@
--- Savefile helpers
-
--- function called when a key in the variable part ofthe savefile is read
--- if the key matches what we need, we use it, otehrwise just ignore it
-function __savefile_load(key, val)
- local index, elem
-
- for index, elem in __loadsave_name do
- if (key == elem.name) then
- dostring(elem.name.." = "..val)
- end
- end
-end
-
--- called when the game is saved, can only save numbers
--- assosiate a key with them to allow the loading code to recognize them
-function __savefile_save()
- local index, elem
- for index, elem in __loadsave_name do
- dostring("__loadsave_tmp = "..elem.name)
- save_number_key(elem.name, __loadsave_tmp);
- end
-end
-
-register_savefile(__loadsave_max)
-add_hook_script(HOOK_LOAD_GAME, "__savefile_load", "__hook_load")
-add_hook_script(HOOK_SAVE_GAME, "__savefile_save", "__hook_save")
-
--- Parse a flattened(i.e: foo.bar.zog) table path and recrate tables
-function reconstruct_table(name)
- for i = 1, strlen(name) - 1 do
- if strsub(name, i, i) == "." then
- local tbl = strsub(name, 1, i - 1)
-
- if dostring("return "..tbl) == nil then
- dostring(tbl.."={}")
- end
- end
- end
-end
-
--- Automagically set unkown variables, otherwise the savefile code
--- might get VERY upset
-do
- local k, e
- -- We need to be able to check for unknown globals
- unset_safe_globals()
- for k, e in __loadsave_name do
- reconstruct_table(e.name)
- if dostring("return "..(e.name)) == nil then
- dostring((e.name).." = "..(e.default))
- end
- end
- -- Now taht we did, we set it back, for it is usefull ;)
- set_safe_globals()
-end
diff --git a/lib/core/mimc_aux.lua b/lib/core/mimc_aux.lua
deleted file mode 100644
index cea1f4dc..00000000
--- a/lib/core/mimc_aux.lua
+++ /dev/null
@@ -1,96 +0,0 @@
--- Mimic shapes helper file
-
-__mimics = {}
-__mimics_max = 1
-__mimics_names = {}
-
-function add_mimic_shape(t)
- assert(t.name, "no mimic name")
- assert(t.desc, "no mimic desc")
- assert(t.calc, "no mimic calc")
- assert(t.level, "no mimic level")
- assert(t.duration, "no mimic duration")
-
- if not t.limit then t.limit = 0 end
-
- if not t.obj_name then
- t.obj_name = t.name
- end
-
- t.show_name = '['..t.name..']'
-
- -- if it needs hooks, add them
- if t.hooks then
- add_hooks(t.hooks)
- end
-
- -- Add it in a name to index hash table
- __mimics_names[t.name] = __mimics_max
-
- __mimics[__mimics_max] = t
- __mimics_max = __mimics_max + 1
-end
-
-function resolve_mimic_name(name)
- if __mimics_names[name] then
- return __mimics_names[name]
- else
- return -1
- end
-end
-
-function find_random_mimic_shape(level, limit, realm)
- local mimic, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- mimic = rand_range(1, __mimics_max - 1)
- if (not realm) or (__mimics[mimic].realm == realm) then
- if limit >= __mimics[mimic].limit then
- if (rand_int(__mimics[mimic].level * 3) < level) and (__mimics[mimic].rarity < 100) and (magik(100 - __mimics[mimic].rarity) == TRUE) then
- break
- end
- end
- end
- end
- if tries > 0 then
- return mimic
- else
- return resolve_mimic_name("Abomination")
- end
-end
-
-function get_mimic_info(mimic, info)
- if not __mimics[mimic] then return 0 end
- return __mimics[mimic][info]
-end
-
-function get_mimic_rand_dur(mimic)
- return rand_range(__mimics[mimic].duration[1], __mimics[mimic].duration[2])
-end
-
-function calc_mimic(mimic)
- return __mimics[mimic].calc()
-end
-
-function calc_mimic_power(mimic)
- if __mimics[mimic].power then __mimics[mimic].power() end
-end
-
---- Here comes the only vital shape
-
-add_mimic_shape
-{
- ["name"] = "Abomination",
- ["obj_name"] = "Abominable Cloak",
- ["desc"] = "Abominations are failed experiments of powerful wizards.",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {20, 100},
- ["calc"] = function ()
- apply_flags(TR1_SPEED + TR1_STR + TR1_INT + TR1_WIS + TR1_DEX + TR1_CON + TR1_CHR, 0, 0, 0, 0, 0, -10)
- player.xtra_f3 = bor(player.xtra_f3, TR3_AGGRAVATE)
- end,
-}
diff --git a/lib/core/monsters.lua b/lib/core/monsters.lua
deleted file mode 100644
index ca2851a0..00000000
--- a/lib/core/monsters.lua
+++ /dev/null
@@ -1,16 +0,0 @@
--- SYSTEM FILE
---
--- Monster stuff, do not touch
---
-
-function summon_monster(y, x, lev, friend, typ)
- if type(typ) == "number" then
- if friend == TRUE then
- return summon_specific_friendly(y, x, lev, typ, FALSE)
- else
- return summon_specific(y, x, lev, typ)
- end
- else
- return summon_monster_aux(y, x, lev, friend, typ)
- end
-end
diff --git a/lib/core/objects.lua b/lib/core/objects.lua
deleted file mode 100644
index 97320b82..00000000
--- a/lib/core/objects.lua
+++ /dev/null
@@ -1,45 +0,0 @@
--- SYSTEM FILE
---
--- Lua object funtions
---
-
-function create_object(tval, sval)
- local obj = new_object()
- object_prep(obj, lookup_kind(tval, sval))
- return (obj)
-end
-
-function set_item_tester(tester)
- if tolua.type(tester) == "number" then
- lua_set_item_tester(tester, "")
- end
- if tolua.type(tester) == "string" then
- lua_set_item_tester(0, tester)
- end
- if tolua.type(tester) == "function" then
- __get_item_hook_default = tester
- lua_set_item_tester(0, "__get_item_hook_default")
- end
-end
-
-function create_artifact(a_idx)
- local obj
- local tval, sval
-
- tval = a_info[a_idx + 1].tval
- sval = a_info[a_idx + 1].sval
- obj = create_object(tval, sval)
- obj.name1 = a_idx
- apply_magic(obj, -1, TRUE, TRUE, TRUE)
-
- return (obj)
-end
-
-function get_kind(obj)
- return k_info[obj.k_idx + 1]
-end
-
-function get_item(ask, deny, flags, mask)
- set_item_tester(mask)
- return get_item_aux(0, ask, deny, flags)
-end
diff --git a/lib/core/player.lua b/lib/core/player.lua
deleted file mode 100644
index 16878228..00000000
--- a/lib/core/player.lua
+++ /dev/null
@@ -1,135 +0,0 @@
--- SYSTEM FILE
---
--- Lua player funtions
---
-
--- Gods
-function deity(i)
- return deity_info[1 + i]
-end
-
--------- skill stuff ---------
-
--- Easy skill access
-function skill(i)
- return s_info[i + 1]
-end
-
--- Sart a lasting spell
-function player.start_lasting_spell(spl)
- player.music_extra = -spl
-end
-
--- stat mods
-function player.modify_stat(stat, inc)
- player.stat_add[1 + stat] = player.stat_add[1 + stat] + inc
-end
-
--- powers mods
-function player.add_power(pow)
- player.powers[1 + pow] = TRUE
-end
-
--- easier inventory access
-function player.inventory(i)
- return player.inventory_real[i + 1]
-end
-
--- modify mana
--- returns TRUE if there is a pb
-function increase_mana(amt)
- player.csp = player.csp + amt
- player.redraw = bor(player.redraw, PR_MANA)
- if (player.csp < 0) then
- player.csp = 0
- return TRUE
- end
- if (player.csp > player.msp) then
- player.csp = player.msp
- end
- return FALSE
-end
-
-
--- Return the coordinates of the player whether in wild or not
-function player.get_wild_coord()
- if player.wild_mode == TRUE then
- return player.py, player.px
- else
- return player.wilderness_y, player.wilderness_x
- end
-end
-
--- Create a new power
-__power_fct = {}
-function add_power(p)
- local i
-
- assert(p.name, "No power name!")
- assert(p.desc, "No power desc!")
- assert(p.desc_get, "No power desc get!")
- assert(p.desc_lose, "No power desc lose!")
- assert(p.stat, "No power stat!")
- assert(p.level, "No power level!")
- assert(p.cost, "No power cost!")
- assert(p.fail, "No power fail!")
- assert(p.power, "No power power!")
-
- i = add_new_power(p.name, p.desc, p.desc_get, p.desc_lose, p.level, p.cost, p.stat, p.fail)
- __power_fct[i] = p.power
- return i
-end
-
-function __power_fct_activate(power)
- if __power_fct[power] then
- __power_fct[power]()
- return TRUE
- else
- return FALSE
- end
-end
-
--- Register in the hook list
-add_hook_script(HOOK_ACTIVATE_POWER, "__power_fct_activate", "__power_fct_activate")
-
-
---- Mkeys
-
--- Create a new power
-__mkey_fct = {}
-function add_mkey(p)
- local i
-
- assert(p.mkey, "No mkey mkey!")
- assert(p.fct, "No mkeey fct!")
-
- __mkey_fct[p.mkey] = p.fct
-end
-
-function __mkey_fct_activate(power)
- if __mkey_fct[power] then
- __mkey_fct[power]()
- return TRUE
- else
- return FALSE
- end
-end
-
--- Register in the hook list
-add_hook_script(HOOK_MKEY, "__mkey_fct_activate", "__mkey_fct_activate")
-
-
--- Subraces
-function subrace(racem)
- return race_mod_info[racem + 1]
-end
-
-function subrace_add_power(subrace, power)
- for i = 1, 4 do
- if subrace.powers[i] == -1 then
- subrace.powers[i] = power
- return not nil
- end
- end
- return nil
-end
diff --git a/lib/core/quests.lua b/lib/core/quests.lua
deleted file mode 100644
index dfe9db51..00000000
--- a/lib/core/quests.lua
+++ /dev/null
@@ -1,57 +0,0 @@
--- Quest helper files
-
--- Quest structs
-
-__quest_hook = {}
-__quest_callbacks = {}
-__quest_callbacks_max = 0
-__quest_dynamic_desc = {}
-
-function add_quest(q)
- local i, index, d, z, qq
-
- assert(q.global, "No quest global name")
- assert(q.name, "No quest name")
- assert(q.desc, "No quest desc")
- assert(q.level, "No quest level")
- assert(q.hooks, "No quest hooks")
-
- i = new_quest(q.name);
- setglobal(q.global, i)
-
- -- Make it save & load
- add_loadsave("quest("..q.global..").status", QUEST_STATUS_UNTAKEN)
-
- if type(q.desc) == "table" then
- z = 0
- for index, d in q.desc do
- quest_desc(i, z, d);
- z = z + 1
- end
- else
- __quest_dynamic_desc[i] = q.desc
- quest(i).dynamic_desc = TRUE
- end
- quest(i).level = q.level
- if not q.silent then
- quest(i).silent = FALSE
- else
- quest(i).silent = q.silent
- end
- __quest_hook[i] = q.hooks
- for index, d in q.hooks do
- add_hook_script(index, "__lua__quest_callback"..__quest_callbacks_max, "__lua__quest_callback"..__quest_callbacks_max)
- setglobal("__lua__quest_callback"..__quest_callbacks_max, d)
- __quest_callbacks_max = __quest_callbacks_max + 1
- end
- if q.data then
- for index, d in q.data do
- -- Besure it exists
- setglobal(index, d)
-
- -- Make it save & load
- add_loadsave(index, d)
- end
- end
- return i
-end
diff --git a/lib/core/s_aux.lua b/lib/core/s_aux.lua
deleted file mode 100644
index ec609b04..00000000
--- a/lib/core/s_aux.lua
+++ /dev/null
@@ -1,716 +0,0 @@
--- Functions to help with spells, do not touch
-
-__schools = {}
-__schools_num = 0
-
-__tmp_spells = {}
-__tmp_spells_num = 0
-
-function add_school(s)
- __schools[__schools_num] = s
-
- __schools_num = __schools_num + 1
- return (__schools_num - 1)
-end
-
-function finish_school(i)
- local s
-
- s = __schools[i]
- assert(s.name, "No school name!")
- assert(s.skill, "No school skill!")
-
- -- Need hooks?
- if s.hooks then
- add_hooks(s.hooks)
- end
-
- new_school(i, s.name, s.skill)
-end
-
-function add_spell(s)
- __tmp_spells[__tmp_spells_num] = s
-
- __tmp_spells_num = __tmp_spells_num + 1
- return (__tmp_spells_num - 1)
-end
-
-function finish_spell(must_i)
- local i, s
-
- s = __tmp_spells[must_i]
- assert(s.name, "No spell name!")
- assert(s.school, "No spell school!")
- assert(s.level, "No spell level!")
- assert(s.mana, "No spell mana!")
- if not s.mana_max then s.mana_max = s.mana end
- assert(s.fail, "No spell failure rate!")
- assert(s.spell, "No spell function!")
- if not s.info then s.info = function() return "" end end
- assert(s.desc, "No spell desc!")
- if not s.random then s.random = SKILL_MAGIC end
- if s.lasting then
- assert(type(s.lasting) == "function", "Spell lasting is not function")
- end
- if s.stick then
- local k, e
- for k, e in s.stick do
- if type(k) == "table" then
- assert(e.base_level, "Arg no stick base level")
- assert(e.max_level, "Arg no stick max level")
- end
- end
- end
-
- i = new_spell(must_i, s.name)
- assert(i == must_i, "ACK ! i != must_i ! please contact the maintainer")
- if type(s.school) == "number" then __spell_school[i] = {s.school}
- else __spell_school[i] = s.school end
- spell(i).mana = s.mana
- spell(i).mana_max = s.mana_max
- spell(i).fail = s.fail
- spell(i).skill_level = s.level
- __spell_spell[i] = s.spell
- __spell_info[i] = s.info
- __spell_desc[i] = s.desc
- return i
-end
-
--- Creates the school books array
-__spell_spell = {}
-__spell_info = {}
-__spell_desc = {}
-__spell_school = {}
-school_book = {}
-
--- Find a spell by name
-function find_spell(name)
- local i
-
- i = 0
- while (i < __tmp_spells_num) do
- if __tmp_spells[i].name == name then return i end
- i = i + 1
- end
- return -1
-end
-
--- Find if the school is under the influence of a god, returns nil or the level
-function get_god_level(sch)
- if __schools[sch].gods[player.pgod] then
- return (s_info[__schools[sch].gods[player.pgod].skill + 1].value * __schools[sch].gods[player.pgod].mul) / __schools[sch].gods[player.pgod].div
- else
- return nil
- end
-end
-
--- Change this fct if I want to switch to learnable spells
-function get_level_school(s, max, min)
- local lvl, sch, index, num, bonus
- local allow_spell_power = TRUE
-
- lvl = 0
- num = 0
- bonus = 0
-
- -- No max specified ? assume 50
- if not max then
- max = 50
- end
- if not min then
- min = 1
- end
-
- -- Do we pass tests?
- if __tmp_spells[s].depend then
- if __tmp_spells[s].depend() ~= TRUE then
- return min, "n/a"
- end
- end
-
- for index, sch in __spell_school[s] do
- local r, s, p, ok = 0, 0, 0, 0
-
- -- Does it require we worship a specific god?
- if __schools[sch].god then
- if __schools[sch].god ~= player.pgod then
- if min then return min, "n/a"
- else return 1, "n/a" end
- end
- end
-
- -- Take the basic skill value
- r = s_info[(school(sch).skill) + 1].value
-
- -- Do we pass tests?
- if __schools[sch].depend then
- if __schools[sch].depend() ~= TRUE then
- return min, "n/a"
- end
- end
-
- -- Are we under sorcery effect ?
- if __schools[sch].sorcery then
- s = s_info[SKILL_SORCERY + 1].value
- end
-
- -- Are we affected by spell power ?
- -- All teh schools must allow it for it to work
- if not __schools[sch].spell_power then
- allow_spell_power = nil
- end
-
- -- Are we under a god effect ?
- if __schools[sch].gods then
- p = get_god_level(sch)
- if not p then p = 0 end
- end
-
- -- Find the higher
- ok = r
- if ok < s then ok = s end
- if ok < p then ok = p end
-
- -- Do we need to add a special bonus ?
- if __schools[sch].bonus_level then
- bonus = bonus + (__schools[sch].bonus_level() * (SKILL_STEP / 10))
- end
-
- -- All schools must be non zero to be able to use it
- if ok == 0 then return min, "n/a" end
-
- -- Apply it
- lvl = lvl + ok
- num = num + 1
- end
-
- -- Add the Spellpower skill as a bonus
- if allow_spell_power then
- bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 10))
- end
-
- -- Add bonus from objects
- bonus = bonus + (player.to_s * (SKILL_STEP / 10))
-
- -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative
- -- The loss of information should be negligible since 1 skill = 1000 internally
- lvl = (lvl / num) / 10
- lvl = lua_get_level(s, lvl, max, min, bonus)
-
- return lvl, nil
-end
-
--- This is the function to use when casting through a stick
-function get_level_device(s, max, min)
- local lvl
-
- -- No max specified ? assume 50
- if not max then
- max = 50
- end
-
- lvl = s_info[SKILL_DEVICE + 1].value
- lvl = lvl + (get_level_use_stick * SKILL_STEP)
-
- -- Sticks are limited
- if lvl - ((spell(s).skill_level + 1) * SKILL_STEP) >= get_level_max_stick * SKILL_STEP then
- lvl = (get_level_max_stick + spell(s).skill_level - 1) * SKILL_STEP
- end
-
- -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative
- -- The loss of information should be negligible since 1 skill = 1000 internally
- lvl = lvl / 10
- if not min then
- lvl = lua_get_level(s, lvl, max, 1, 0)
- else
- lvl = lua_get_level(s, lvl, max, min, 0)
- end
-
- return lvl
-end
-
--- The real get_level, works for schooled magic and for innate powers
-get_level_use_stick = -1
-get_level_max_stick = -1
-function get_level(s, max, min)
- if type(s) == "number" then
- -- Ahah shall we use Magic device instead ?
- if get_level_use_stick > -1 then
- return get_level_device(s, max, min)
- else
- local lvl, na = get_level_school(s, max, min)
- return lvl
- end
- else
- return get_level_power(s, max, min)
- end
-end
-
--- Can we cast the spell ?
-function is_ok_spell(s, obj)
- if get_level(s, 50, 0) == 0 then return nil end
- if __tmp_spells[s].pval and obj.pval < __tmp_spells[s].pval then return nil end
- return 1
-end
-
--- Get the amount of mana(or power) needed
-function get_mana(s)
- return spell(s).mana + get_level(s, spell(s).mana_max - spell(s).mana, 0)
-end
-
--- Return the amount of power(mana, piety, whatever) for the spell
-function get_power(s)
- if check_affect(s, "piety", FALSE) then
- return player.grace
- else
- return player.csp
- end
-end
-
--- Return the amount of power(mana, piety, whatever) for the spell
-function get_power_name(s)
- if check_affect(s, "piety", FALSE) then
- return "piety"
- else
- return "mana"
- end
-end
-
--- Get the level of a power
-function get_level_power(s, max, min)
- if not max then max = 50 end
- if not min then min = 1 end
-
- return value_scale(s.get_current_level(), 50, max, min)
-end
-
--- Changes the amount of power(mana, piety, whatever) for the spell
-function adjust_power(s, x)
- if check_affect(s, "piety", FALSE) then
- inc_piety(GOD_ALL, x)
- else
- increase_mana(x)
- end
-end
-
--- Get spell school name(s) as a /-separated string.
-function spell_school_name(s)
- local xx, sch_str
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
- return sch_str
-end
-
--- Print the book and the spells
-function print_book(book, spl, obj)
- local x, y, index, sch, size, s
-
- x = 0
- y = 2
- size = 0
-
- -- 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 color = TERM_L_DARK
- local lvl, na = get_level_school(s, 50, -50)
- local xx, sch_str
-
- if is_ok_spell(s, obj) then
- if get_mana(s) > get_power(s) then color = TERM_ORANGE
- else color = TERM_L_GREEN end
- end
-
- sch_str = spell_school_name(s)
-
- if na then
- c_prt(color, format("%c) %-20s%-16s %3s %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
- else
- c_prt(color, format("%c) %-20s%-16s %3d %4s %3d%s %s", size + strbyte("a"), 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
- prt(format(" %-20s%-16s Level Cost Fail Info", "Name", "School"), 1, x)
- return y
-end
-
--- Output the describtion when it is used as a spell
-function print_spell_desc(s, y)
- local index, desc, x
-
- x = 0
-
- if type(__spell_desc[s]) == "string" then c_prt(TERM_L_BLUE, __spell_desc[s], y, x)
- else
- for index, desc in __spell_desc[s] do
- c_prt(TERM_L_BLUE, desc, y, x)
- y = y + 1
- end
- end
- if check_affect(s, "piety", FALSE) then
- c_prt(TERM_L_WHITE, "It uses piety to cast.", y, x)
- y = y + 1
- end
- if not check_affect(s, "blind") then
- c_prt(TERM_ORANGE, "It is castable even while blinded.", y, x)
- y = y + 1
- end
- if not check_affect(s, "confusion") then
- c_prt(TERM_ORANGE, "It is castable even while confused.", y, x)
- y = y + 1
- end
-end
-
--- Output the desc when sued as a device
-function print_device_desc(s)
- local index, desc
-
- if type(__spell_desc[s]) == "string" then text_out(__spell_desc[s])
- else
- for index, desc in __spell_desc[s] do
- text_out("\n" .. desc)
- end
- end
-end
-
-function book_spells_num(book)
- local size, index, sch
-
- size = 0
-
- -- Hack if the book is 255 it is a random book
- if book == 255 then
- return 1
- end
-
- -- Parse all spells
- for index, s in school_book[book] do
- size = size + 1
- end
- return size
-end
-
-function spell_x(book, spl, s)
- if book == 255 then
- return spl
- else
- local i, x, val
-
- i, val = next(school_book[book], nil)
- x = 0
- while x < s do
- i, val = next(school_book[book], i)
- x = x + 1
- end
- return val
- end
-end
-
-function spell_in_book(book, spell)
- local i, s
-
- for i, s in school_book[book] do
- if s == spell then return TRUE end
- end
- return FALSE
-end
-
--- Returns spell chance of failure for spell
-function spell_chance(s)
- local chance, s_ptr
-
- s_ptr = spell(s)
-
- -- Extract the base spell failure rate
- if get_level_use_stick > -1 then
- chance = lua_spell_device_chance(s_ptr.fail, get_level(s, 50), s_ptr.skill_level)
- else
- chance = lua_spell_chance(s_ptr.fail, get_level(s, 50), s_ptr.skill_level, get_mana(s), get_power(s), get_spell_stat(s))
- end
-
- -- Return the chance
- return chance
-end
-
-function check_affect(s, name, default)
- local s_ptr = __tmp_spells[s]
- local a
-
- if type(s_ptr[name]) == "number" then
- a = s_ptr[name]
- else
- a = default
- end
- if a == FALSE then
- return nil
- else
- return TRUE
- end
-end
-
--- Returns the stat to use for the spell, INT by default
-function get_spell_stat(s)
- if not __tmp_spells[s].stat then return A_INT
- else return __tmp_spells[s].stat end
-end
-
-function cast_school_spell(s, s_ptr, no_cost)
- local use = FALSE
-
- -- No magic
- if (player.antimagic > 0) then
- msg_print("Your anti-magic field disrupts any magic attempts.")
- return
- end
-
- -- No magic
- if (player.anti_magic == TRUE) then
- msg_print("Your anti-magic shell disrupts any magic attempts.")
- return
- end
-
- -- if it costs something then some condition must be met
- if not no_cost then
- -- Require lite
- if (check_affect(s, "blind")) and ((player.blind > 0) or (no_lite() == TRUE)) then
- msg_print("You cannot see!")
- return
- end
-
- -- Not when confused
- if (check_affect(s, "confusion")) and (player.confused > 0) then
- msg_print("You are too confused!")
- return
- end
-
- -- Enough mana
- if (get_mana(s) > get_power(s)) then
- if (get_check("You do not have enough "..get_power_name(s)..", do you want to try anyway?") == FALSE) then return end
- end
-
- -- Invoke the spell effect
- if (magik(spell_chance(s)) == FALSE) then
- if (__spell_spell[s]() ~= nil) then
- use = TRUE
- end
- else
- local index, sch
-
- -- added because this is *extremely* important --pelpel
- if (flush_failure) then flush() end
-
- msg_print("You failed to get the spell off!")
- for index, sch in __spell_school[s] do
- if __schools[sch].fail then
- __schools[sch].fail(spell_chance(s))
- end
- end
- use = TRUE
- end
- else
- __spell_spell[s]()
- end
-
- if use == TRUE then
- -- Reduce mana
- adjust_power(s, -get_mana(s))
-
- -- Take a turn
- if is_magestaff() == TRUE then energy_use = 80
- else energy_use = 100 end
- end
-
- player.redraw = bor(player.redraw, PR_MANA)
- player.window = bor(player.window, PW_PLAYER)
-end
-
-
--- Can the spell be randomly found(in random books)
-function can_spell_random(i)
- return __tmp_spells[i].random
-end
-
--- Find a random spell
-function get_random_spell(typ, level)
- local spl, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- spl = rand_int(__tmp_spells_num)
- if (can_spell_random(spl) == typ) and (rand_int(spell(spl).skill_level * 3) < level) then
- break
- end
- end
- if tries > 0 then
- return spl
- else
- return -1
- end
-end
-
--- Execute a lasting spell
-function exec_lasting_spell(spl)
- assert(__tmp_spells[spl].lasting, "No lasting effect for spell "..__tmp_spells[spl].name.." but called as such")
- return __tmp_spells[spl].lasting()
-end
-
--- Helper function for spell effect to know if they are or not obvious
-function is_obvious(effect, old)
- if old then
- if old == TRUE or effect == TRUE then
- return TRUE
- else
- return FALSE
- end
- else
- return effect
- end
-end
-
--------------------------Sticks-------------------------
-
--- Fire off the spell
-function activate_stick(spl)
- local ret = __spell_spell[spl]()
- local charge, obvious
- if not ret then
- charge = FALSE
- obvious = FALSE
- else
- charge = TRUE
- obvious = ret
- end
- return obvious, charge
-end
-
------------------------------------ Wand, Staves, Rods specific functions ----------------------------
-
--- Get a spell for a given stick(wand, staff, rod)
-function get_random_stick(stick, level)
- local spl, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- spl = rand_int(__tmp_spells_num)
- if __tmp_spells[spl].stick and (type(__tmp_spells[spl].stick[stick]) == "table") then
- if (rand_int(spell(spl).skill_level * 3) < level) and (magik(100 - __tmp_spells[spl].stick[stick].rarity) == TRUE) then
- break
- end
- end
- end
- if tries > 0 then
- return spl
- else
- return -1
- end
-end
-
--- Get a random base level
-function get_stick_base_level(stick, level, spl)
- -- Paranoia
- if spl < 0 or spl >= __tmp_spells_num or not __tmp_spells[spl].stick[stick] then return 0 end
-
- local min, max = __tmp_spells[spl].stick[stick].base_level[1], __tmp_spells[spl].stick[stick].base_level[2]
- local range = max - min;
-
- -- Ok the basic idea is to have a max possible level of half the dungeon level
- if range * 2 > level then range = level / 2 end
-
- -- Randomize a bit
- range = m_bonus(range, dun_level)
-
- -- And get the result
- return min + range
-end
-
--- Get a random max level
-function get_stick_max_level(stick, level, spl)
- -- Paranoia
- if spl < 0 or spl >= __tmp_spells_num or not __tmp_spells[spl].stick[stick] then return 0 end
-
- local min, max = __tmp_spells[spl].stick[stick].max_level[1], __tmp_spells[spl].stick[stick].max_level[2]
- local range = max - min;
-
- -- Ok the basic idea is to have a max possible level of half the dungeon level
- if range * 2 > level then range = level / 2 end
-
- -- Randomize a bit
- range = m_bonus(range, dun_level)
-
- -- And get the result
- return min + range
-end
-
--- Get the number of desired charges
-function get_stick_charges(spl)
- return __tmp_spells[spl].stick.charge[1] + randint(__tmp_spells[spl].stick.charge[2]);
-end
-
--- Get activation desc
-function get_activation_desc(spl)
- local turns
- if type(__tmp_spells[spl].activate) == 'number' then
- turns = __tmp_spells[spl].activate
- else
- turns = __tmp_spells[spl].activate[1] .. '+d' .. __tmp_spells[spl].activate[2]
- end
- return __tmp_spells[spl].desc[1] .. ' every ' .. turns .. ' turns'
-end
-
--- Compute the timeout of an activation
-function get_activation_timeout(spl)
- if type(__tmp_spells[spl].activate) == 'number' then
- return __tmp_spells[spl].activate
- else
- return __tmp_spells[spl].activate[1] + randint(__tmp_spells[spl].activate[2])
- end
-end
-
--- Fire off the spell
-function activate_activation(spl, item)
- __spell_spell[spl](item)
-end
-
-
-------- Add new GF type ----------
-max_gf = MAX_GF
-function add_spell_type(t)
- t.index = max_gf
- max_gf = max_gf + 1
- assert(t.color, "No GF color")
- if not t.monster then t.monster = function() end end
- if not t.angry then t.angry = function() end end
- if not t.object then t.object = function() end end
- if not t.player then t.player = function() end end
- if not t.grid then t.grid = function() end end
-
- add_hooks
- {
- [HOOK_GF_COLOR] = function (gf, new_gfx)
- local t = %t
- if gf == t.index then return TRUE, t.color[new_gfx + 1] end
- end,
- [HOOK_GF_EXEC] = function (action, who, gf, dam, rad, y, x, extra)
- local t = %t
- if t.index == gf then
- return t[action](who, dam, rad, y, x, extra)
- end
- end,
- }
- return t.index
-end
diff --git a/lib/core/stores.lua b/lib/core/stores.lua
deleted file mode 100644
index d4a63168..00000000
--- a/lib/core/stores.lua
+++ /dev/null
@@ -1,32 +0,0 @@
--- Take care of all concerning stores
-function store_buy_list(t)
- assert(type(t) == "table", "store_buy_list got no table")
- add_hooks
- {
- [HOOK_STORE_BUY] = function (index, name, obj)
- local tbl = %t
- local elt = tbl[index]
- if not elt then
- elt = tbl[name]
- end
- if elt then
- if elt then
- if type(elt) == "function" then
- return TRUE, elt(obj)
- elseif type(elt) == "table" then
- local k, e
- for k, e in elt do
- if type(e) == "number" then
- if obj.tval == e then return TRUE, TRUE end
- else
- if (obj.tval == e[1]) and (obj.sval >= e[2]) and (obj.sval <= e[3]) then return TRUE, TRUE end
- end
- end
- elseif elt == -1 then
- return TRUE, FALSE
- end
- end
- end
- end,
- }
-end
diff --git a/lib/core/util.lua b/lib/core/util.lua
deleted file mode 100644
index eea13014..00000000
--- a/lib/core/util.lua
+++ /dev/null
@@ -1,158 +0,0 @@
--- various stuff to make scripters life easier
-
--- Beware of the scary undefined globals
-function safe_getglobal(x)
- local v = rawget(globals(), x)
-
- if v then
- return v
- else
- error("undefined global variable '"..x.."'")
- end
-end
-
-function set_safe_globals()
- settagmethod(tag(nil), "getglobal", safe_getglobal)
-end
-function unset_safe_globals()
- settagmethod(tag(nil), "getglobal", nil)
-end
-
-set_safe_globals()
-
--- Patch modules
-__patch_modules = {}
-
-function patch_version(name, version)
- assert(not __patch_modules[name], "Patch " .. name .. " already loaded!!!")
- __patch_modules[name] = version
-end
-
-function patchs_list()
- local k, e, first
- first = FALSE
- for k, e in __patch_modules do
- if first == FALSE then print_hook("\n\n [Patch modules]\n") first = TRUE end
- print_hook("\n "..k.." version "..e)
- end
- if first == TRUE then print_hook("\n") end
-end
-
-function patchs_display()
- local k, e
- for k, e in __patch_modules do
- msg_print("Patch: "..k.." version "..e)
- end
-end
-
-
--- Better hook interface
-__hooks_list_callback = {}
-__hooks_list_callback_max = 0
-
-function add_hooks(h_table, name_prefix)
- local k, e
-
- if not name_prefix then name_prefix = "" end
- for k, e in h_table do
- add_hook_script(k, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max)
- setglobal("__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, e)
- __hooks_list_callback_max = __hooks_list_callback_max + 1
- end
-end
-
--- Wrapper for the real msg_print and cmsg_print
--- it understands if we want color or not
-function msg_print(c, m)
- if type(c) == "number" then
- cmsg_print(c, m)
- else
- call(%msg_print, { c })
- end
-end
-
--- better timer add function
-__timers_callback_max = 0
-
-function new_timer(t)
- assert(t.delay > 0, "no timer delay")
- assert(t.enabled, "no timer enabled state")
- assert(t.callback, "no timer callback")
-
- local timer
- if type(t.callback) == "function" then
- setglobal("__timers_callback_"..__timers_callback_max, t.callback)
- timer = %new_timer("__timers_callback_"..__timers_callback_max, t.delay)
- __timers_callback_max = __timers_callback_max + 1
- else
- timer = %new_timer(t.callback, t.delay)
- end
-
- timer.enabled = t.enabled
-
- return timer
-end
-
--- saves all timer values
-function save_timer(name)
- add_loadsave(name..".enabled", FALSE)
- add_loadsave(name..".delay", 1)
- add_loadsave(name..".countdown", 1)
-end
-
-
--- displays a scrolling list
-function display_list(y, x, h, w, title, list, begin, sel, sel_color)
- local l = create_list(getn(list))
-
- for i = 1, getn(list) do
- add_to_list(l, i - 1, list[i])
- end
-
- %display_list(y, x, h, w, title, l, getn(list), begin - 1, sel - 1, sel_color)
-
- delete_list(l, getn(list))
-end
-
--- Easier access to special gene stuff
-function set_monster_generation(monster, state)
- if type(monster) == "string" then
- m_allow_special[test_monster_name(monster) + 1] = state
- else
- m_allow_special[monster + 1] = state
- end
-end
-function set_object_generation(obj, state)
- if type(obj) == "string" then
- m_allow_special[test_item_name(obj) + 1] = state
- else
- m_allow_special[obj + 1] = state
- end
-end
-function set_artifact_generation(obj, state)
- m_allow_special[obj + 1] = state
-end
-
--- Strings
-function strcap(str)
- if strlen(str) > 1 then
- return strupper(strsub(str, 1, 1))..strsub(str, 2)
- elseif strlen(str) == 1 then
- return strupper(str)
- else
- return str
- end
-end
-
-function msg_format(...)
- msg_print(call(format, arg))
-end
-
--- A way to check if the game is now running(as opposed to initialization/character gen)
-game = {}
-add_hooks
-{
- [HOOK_GAME_START] = function ()
- game.started = TRUE
- end
-}
diff --git a/lib/core/xml.lua b/lib/core/xml.lua
deleted file mode 100644
index 14f0511f..00000000
--- a/lib/core/xml.lua
+++ /dev/null
@@ -1,375 +0,0 @@
--- The xml module
-xml = {}
-
-function xml:parseargs (s)
- local arg = {}
- gsub(s, "(%w+)=([\"'])(.-)%2", function (w, _, a)
- %arg[w] = a
- end)
- return arg
-end
-
--- s is a xml stream, returns a table
-function xml:collect (s)
- local stack = {n=0}
- local top = {n=0}
- tinsert(stack, top)
- local ni,c,label,args, empty
- local i, j = 1, 1
- while 1 do
- ni,j,c,label,args, empty = strfind(s, "<(%/?)(%w+)(.-)(%/?)>", j)
- if not ni then break end
- local text = strsub(s, i, ni-1)
- if not strfind(text, "^%s*$") then
- tinsert(top, text)
- end
- if empty == "/" then -- empty element tag
- tinsert(top, {n=0, label=label, args=xml:parseargs(args), empty=1})
- elseif c == "" then -- start tag
- top = {n=0, label=label, args=xml:parseargs(args)}
- tinsert(stack, top) -- new level
- else -- end tag
- local toclose = tremove(stack) -- remove top
- top = stack[stack.n]
- if stack.n < 1 then
- error("nothing to close with "..label)
- end
- if toclose.label ~= label then
- error("trying to close "..toclose.label.." with "..label)
- end
- tinsert(top, toclose)
- end
- i = j+1
- end
- local text = strsub(s, i)
- if not strfind(text, "^%s*$") then
- tinsert(stack[stack.n], text)
- end
- if stack.n > 1 then
- error("unclosed "..stack[stack.n].label)
- end
- return stack[1]
-end
-
--- Viewport coordinates
-xml.write_out_y = 0
-xml.write_out_x = 0
-xml.write_out_h = 24
-xml.write_out_w = 80
-
--- Offsets
-xml.write_off_y = 0
-xml.write_off_x = 0
-
--- Current position
-xml.write_y = 0
-xml.write_x = 0
-
-xml.write_screen = function(color, s)
- local i
- for i = 1, strlen(s) do
- local c = strsub(s, i, i + 1)
- if c ~= "\n" then
- if xml.write_y - xml.write_off_y >= 0 and xml.write_y - xml.write_off_y < xml.write_out_h and xml.write_x - xml.write_off_x >= 0 and xml.write_x - xml.write_off_x < xml.write_out_w then
- Term_putch(xml.write_x - xml.write_off_x + xml.write_out_x, xml.write_y - xml.write_off_y + xml.write_out_y, color, strbyte(c))
- end
- xml.write_x = xml.write_x + 1
- else
- xml.write_x = 0
- xml.write_y = xml.write_y + 1
- end
- end
-end
-
-xml.write_file = function (color, s)
- print_hook(s)
-end
-
-xml.write = xml.write_screen
-
-xml.rule2string = {
- ['name'] = {"Its ", "name", " is"},
- ['contain'] = {"Its ", "name", " contains"},
- ['symbol'] = {"Its ", "symbol", " is"},
- ['inscribed'] = {"Its ", "inscription", " contains"},
- ['state'] = {"Its ", "state", " is"},
- ['status'] = {"Its ", "status", " is"},
- ['tval'] = {"Its ", "tval", " is"},
- ['race'] = {"Your ", "race", " is"},
- ['subrace'] = {"Your ", "subrace", " is"},
- ['class'] = {"Your ", "class", " is"},
- ['foo1'] = {"The result of ", "test 1 ", "is"},
- ['foo2'] = {"The result of ", "test 2 ", "is"},
- ['foo3'] = {"The result of ", "test 3 ", "is"},
-}
-
-xml.display_english = 1
-function xml:display_xml(t, tab)
- if xml.display_english then
- xml:english_xml(t, tab)
- else
- xml:print_xml(t, tab)
- end
-end
-
-function xml:english_xml(t, tab, not_flag)
- local i, k, e
- local pre, post, recurse
- local children_not_flag
- local nextlevel
- local bcol, ecol = TERM_L_GREEN, TERM_GREEN
-
- if xml.write_active and t == auto_aux.rule then bcol, ecol = TERM_VIOLET, TERM_VIOLET end
-
- nextlevel = tab .. " "
-
- recurse = 1
-
- if t.label == "rule" then
- if t.args.type == "inscribe" then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "A rule named \"")
- xml.write(TERM_WHITE, tostring(t.args.name))
- xml.write(ecol, "\" to ")
- xml.write(bcol, "inscribe")
- xml.write(ecol, " an item with \"")
- xml.write(TERM_WHITE, t.args.inscription)
- xml.write(ecol, "\" when")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "A rule named \"")
- xml.write(TERM_WHITE, tostring(t.args.name))
- xml.write(ecol, "\" to ")
- xml.write(bcol, t.args.type)
- xml.write(ecol, " when")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "and" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "At least one of the following is false:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "All of the following are true:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "or" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "All of the following are false:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "At least one of the following are true:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "not" then
- if bcol == TERM_VIOLET or getn(t) == 0 then
- xml.write(ecol, "(a negating rule)")
- xml.write(TERM_WHITE, "\n")
- else
- nextlevel = tab
- end
- children_not_flag = not nil
- elseif t.label == "inventory" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Nothing in your ")
- xml.write(bcol, "inventory")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Something in your ")
- xml.write(bcol, "inventory")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "equipment" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Nothing in your ")
- xml.write(bcol, "equipment")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Something in your ")
- xml.write(bcol, "equipment")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "comment" then
- xml.write(TERM_WHITE, tab)
- xml.write(TERM_WHITE, "(" .. t[1] .. ")")
- xml.write(TERM_WHITE, "\n")
- elseif t.label == "skill" then
- local s = t[1]
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your skill in ")
- xml.write(bcol, s)
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your skill in ")
- xml.write(bcol, s)
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "ability" then
- local s = t[1]
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "You do not have the ")
- xml.write(bcol, s)
- xml.write(ecol, " ability")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "You have the ")
- xml.write(bcol, s)
- xml.write(ecol, " ability")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "level" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your ")
- xml.write(bcol, "level")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your ")
- xml.write(bcol, "level")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "sval" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "sval")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "sval")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "discount" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "discount")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "discount")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- else
- if xml.rule2string[t.label] then
- local rule = xml.rule2string[t.label]
- a, b, c = rule[1], rule[2], rule[3]
- if not_flag then c = c .. " not" end
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, a)
- xml.write(bcol, b)
- xml.write(ecol, c)
- xml.write(ecol, " \"")
- xml.write(TERM_WHITE, t[1])
- xml.write(ecol, "\"")
- xml.write(TERM_WHITE, "\n")
- else
- if not_flag then
- xml.write(bcol, "Not:\n")
- tab = tab .. " "
- xml:print_xml(t, tab)
- return
- end
- end
- end
-
- for i = 1, getn(t) do
- if type(t[i]) == "string" then
- -- xml.write(TERM_WHITE, t[i].."\n")
- else
- xml:english_xml(t[i], nextlevel, children_not_flag)
- end
- end
-end
-
-function xml:print_xml(t, tab)
- local i, k, e
- local inside = nil
- local bcol, ecol = TERM_L_GREEN, TERM_GREEN
-
- if xml.write_active and t == auto_aux.rule then bcol, ecol = TERM_VIOLET, TERM_VIOLET end
-
- xml.write(bcol, tab.."<"..t.label)
- for k, e in t.args do
- xml.write(TERM_L_BLUE, " "..k)
- xml.write(TERM_WHITE, "=\"")
- xml.write(TERM_YELLOW, e)
- xml.write(TERM_WHITE, "\"")
- end
- xml.write(bcol, ">")
-
- for i = 1, getn(t) do
- if type(t[i]) == "string" then
- xml.write(TERM_WHITE, t[i])
- else
- if not inside then xml.write(TERM_WHITE, "\n") end
- inside = not nil
- xml:print_xml(t[i], tab.." ")
- end
- end
-
- if not inside then
- xml.write(ecol, "</"..t.label..">\n")
- else
- xml.write(ecol, tab.."</"..t.label..">\n")
- end
-end
-
--- t is a table representing xml, outputs the xml code via xml.write()
-function xml:output(t)
- local i
- for i = 1, getn(t) do
- xml:print_xml(t[i], "")
- end
-end
diff --git a/lib/help/def.aux b/lib/help/def.aux
deleted file mode 100644
index 983e9683..00000000
--- a/lib/help/def.aux
+++ /dev/null
@@ -1,3 +0,0 @@
-file_ext="html"
-link_prefix=""
-link_suffix=""
diff --git a/lib/mods/CMakeLists.txt b/lib/mods/CMakeLists.txt
new file mode 100644
index 00000000..5cce23ea
--- /dev/null
+++ b/lib/mods/CMakeLists.txt
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(theme)
diff --git a/lib/mods/mods_aux.lua b/lib/mods/mods_aux.lua
deleted file mode 100644
index 1562a566..00000000
--- a/lib/mods/mods_aux.lua
+++ /dev/null
@@ -1,185 +0,0 @@
--- Ok some functions that we dont need are dangerous
---[[
-execute = nil
-getenv = nil
-setlocale = nil
-exit = nil
-openfile = nil
-writeto = nil
-readfrom = nil
-appendto = nil
-remove = nil
-rename = nil
-tmpname = nil
-]]
-modules = {}
-
-current_module = nil
-
-function setup_module(mod)
- -- For standart game, nothing needs to be done
- if not mod.layout then return end
-
- for k, e in mod.layout do
- module_reset_dir(k, e)
- end
-end
-
-function init_module(i)
- setup_module(get_module(i))
-end
-
-function max_modules()
- local i = 0
- for k, e in modules do
- if type(k) == "number" and type(e) == "table" then
- i = i + 1
- end
- end
- return i
-end
-
-function get_module_name(j)
- local i = 0
- for k, e in modules do
- if type(k) == "number" and type(e) == "table" then
- if i == j then return e.name end
- i = i + 1
- end
- end
-end
-
-function get_module_desc(j)
- local i = 0
- for k, e in modules do
- if type(k) == "number" and type(e) == "table" then
- if i == j then return e.desc end
- i = i + 1
- end
- end
-end
-
-function get_module(j)
- local i = 0
- for k, e in modules do
- if type(k) == "number" and type(e) == "table" then
- if i == j then return e end
- i = i + 1
- end
- end
-end
-
-function find_module(name)
- local i = 0
- for k, e in modules do
- if type(k) == "number" and type(e) == "table" then
- if name == e.name then return i end
- i = i + 1
- end
- end
-end
-
-function assign_current_module(name)
- current_module = get_module(find_module(name))
-end
-
-function get_module_info(type, subtype)
- if subtype then
- return current_module[type][subtype]
- else
- return current_module[type]
- end
-end
-
-function exec_module_info(type, ...)
- return call(current_module[type], arg)
-end
-
-function module_savefile_loadable(savefile_mod, savefile_death)
- for _, e in current_module.mod_savefiles do
- if e[1] == savefile_mod then
- if e[2] == "all" then
- return TRUE
- elseif e[2] == "alive" and savefile_death == FALSE then
- return TRUE
- elseif e[2] == "dead" and savefile_death == TRUE then
- return TRUE
- end
- end
- end
- return FALSE
-end
-
-function scan_extra_modules()
- scansubdir(ANGBAND_DIR_MODULES)
- for i = 0, scansubdir_max - 1 do
- if (scansubdir_result[i + 1] ~= ".") and (scansubdir_result[i + 1] ~= "..") then
- local dir = path_build(ANGBAND_DIR_MODULES, scansubdir_result[i + 1])
- local file = path_build(dir, "module.lua")
- if file_exist(file) == TRUE then
- tome_dofile_anywhere(dir, "module.lua")
- end
- end
- end
-end
-
-function add_module(t)
- assert(t.name, "No module name")
- assert(type(t.version) == "table", "No module version")
- assert(t.desc, "No module desc")
- assert(t.author, "No module author")
- assert(t.mod_savefiles, "No loadable savefiles module mark")
-
- for _, e in modules do
- if type(e) == "table" and e.name == t.name then
- error("Module name already defined: "..t.name)
- end
- end
-
- if type(t.author) == "string" then
- t.author = { t.author, "unknown@unknown.net" }
- end
-
- for k, e in t.mod_savefiles do
- if type(e) == "string" then t.mod_savefiles[k] = { e, "all" } end
- end
-
- if type(t.desc) == "table" then
- local d = ""
- for k, e in t.desc do
- d = d .. e
- if k < getn(t.desc) then
- d = d .. "\n"
- end
- end
- t.desc = d
- end
-
- if not t.rand_quest then t.rand_quest = FALSE end
- if not t.C_quest then t.C_quest = FALSE end
-
- if not t.base_dungeon then t.base_dungeon = 4 end
- if not t.death_dungeon then t.death_dungeon = 28 end
-
- if not t.astral_dungeon then t.astral_dungeon = 8 end
- if not t.astral_wild_x then t.astral_wild_x = 45 end
- if not t.astral_wild_y then t.astral_wild_y = 19 end
-
- if not t.random_artifact_weapon_chance then
- t.random_artifact_weapon_chance = 30
- end
- if not t.random_artifact_armor_chance then
- t.random_artifact_armor_chance = 20
- end
- if not t.random_artifact_jewelry_chance then
- t.random_artifact_jewelry_chance = 20
- end
-
- if not t.max_plev then t.max_plev = 50 end
- if not t.max_skill_overage then t.max_skill_overage = 4 end
- if not t.skill_per_level then t.skill_per_level = function() return 6 end end
-
- if not t.allow_birth then t.allow_birth = TRUE end
-
- tinsert(modules, t)
-end
diff --git a/lib/mods/modules.lua b/lib/mods/modules.lua
deleted file mode 100644
index 5deddef7..00000000
--- a/lib/mods/modules.lua
+++ /dev/null
@@ -1,5 +0,0 @@
--- Load ToME
-tome_dofile_anywhere(ANGBAND_DIR, "module.lua")
-
--- Look for more modules
-scan_extra_modules()
diff --git a/lib/mods/theme/CMakeLists.txt b/lib/mods/theme/CMakeLists.txt
new file mode 100644
index 00000000..f1160786
--- /dev/null
+++ b/lib/mods/theme/CMakeLists.txt
@@ -0,0 +1,14 @@
+INSTALL(DIRECTORY
+ apex
+ data
+ dngn
+ edit
+ file
+ help
+ note
+ pref
+ save
+ user
+ DESTINATION ${DEFAULT_PATH}/mods/theme
+ PATTERN "delete.me" EXCLUDE
+ )
diff --git a/lib/mods/theme/core/auto.lua b/lib/mods/theme/core/auto.lua
deleted file mode 100644
index b758db52..00000000
--- a/lib/mods/theme/core/auto.lua
+++ /dev/null
@@ -1,859 +0,0 @@
--- This file is the core of the Automatizer
--- Please do not touch unless you know what you are doing
-
-__rules = {}
-__rules_max = 0
-
-rule_aux = {}
-
--- Rule apply function, does .. nothing
-function auto_nothing(obj, item)
- return
-end
-
-function auto_inscribe(obj, item, note)
- if obj.note ~= 0 then return end
- msg_print("<Auto-Inscribe {"..note.."}>")
- obj.note = quark_add(note)
- return TRUE
-end
-
--- Rule apply function, pickup object
-function auto_pickup(obj, item)
- if item >= 0 then return end
- if inven_carry_okay(obj) == FALSE then return end
- msg_print("<Auto-pickup>")
- object_pickup(-item)
- return TRUE
-end
-
--- Rule apply function, destroy item
-function auto_destroy(obj, item)
- -- be carefull to what we can destroy
- -- Unaware things won't be destroyed.
- if is_aware(obj) == FALSE then return end
-
- -- Inscribed things won't be destroyed!
- if obj.note ~= 0 then return end
-
- -- Keep Artifacts -- they cannot be destroyed anyway
- if is_artifact(obj) == TRUE then return end
-
- -- Cannot destroy CURSE_NO_DROP objects
- local f1, f2, f3, f4, f5, esp = object_flags(obj);
- if band(f4, TR4_CURSE_NO_DROP) ~= 0 and band(obj.ident, IDENT_CURSED) then return end
-
- msg_print("<Auto-destroy>")
-
- -- Eliminate the item (from the pack)
- if item >= 0 then
- inven_item_increase(item, -obj.number)
- inven_item_describe(item)
- inven_item_optimize(item)
- -- Eliminate the item (from the floor)
- else
- floor_item_increase(0 - item, -obj.number)
- floor_item_describe(0 - item)
- floor_item_optimize(0 - item)
- end
- return TRUE
-end
-
--- Report the status of an object
-function object_status(obj)
- local sense =
- {
- [SENSE_CURSED] = "bad",
- [SENSE_WORTHLESS] = "very bad",
- [SENSE_AVERAGE] = "average",
- [SENSE_GOOD_LIGHT] = "good",
- [SENSE_GOOD_HEAVY] = "good",
- [SENSE_EXCELLENT] = "very good",
- [SENSE_SPECIAL] = "special",
- [SENSE_TERRIBLE] = "terrible",
- }
-
- if is_known(obj) == FALSE then
- if sense[obj.sense] then
- return sense[obj.sense]
- else
- return ""
- end
- else
-if nil then -- test
- local osense = -1
- local type = select_sense(obj, TRUE, TRUE)
- if type == 1 then
- osense = value_check_aux1(obj)
- elseif type == 2 then
- osense = value_check_aux1_magic(obj)
- end
-print("type : "..type)
- if sense[osense] then
- print("sense: "..sense[osense])
- return sense[osense]
- else
- print("sense: ")
- return ""
- end
-
-else -- the real one
-
- local slot = wield_slot_ideal(obj, TRUE)
-
- -- Arts items
- if is_artifact(obj) == TRUE then
- if band(obj.ident, IDENT_CURSED) == 0 then return "special"
- else return "terrible" end
- -- Ego items
- elseif (obj.name2 > 0 or obj.name2b > 0) then
- if band(obj.ident, IDENT_CURSED) == 0 then return "very good"
- else return "very bad" end
- -- weapon
- elseif (slot == INVEN_WIELD) or (slot == INVEN_BOW) or (slot == INVEN_AMMO) or (slot == INVEN_TOOL) then
- if obj.to_h + obj.to_d < 0 then
- return "bad"
- elseif obj.to_h + obj.to_d > 0 then
- return "good"
- else
- return "average"
- end
- -- armor
- elseif (slot >= INVEN_BODY) and (slot <= INVEN_FEET) then
- if obj.to_a < 0 then
- return "bad"
- elseif obj.to_a > 0 then
- return "good"
- else
- return "average"
- end
- -- ring
- elseif slot == INVEN_RING then
- if (obj.to_d + obj.to_h < 0) or (obj.to_a < 0) or (obj.pval < 0) then
- return "bad"
- else
- return "average"
- end
- -- amulet
- elseif slot == INVEN_NECK then
- if (obj.pval < 0) then
- return "bad"
- else
- return "average"
- end
- -- chests
- elseif obj.tval == TV_CHEST then
- if obj.pval == 0 then
- return "empty"
- elseif obj.pval < 0 then
- return "disarmed"
- else
- return "average"
- end
- else
- return "average"
- end
-end
- end
-end
-
--- Recursive function to generate a rule function tree
-function gen_rule_fct(r)
- -- It is a test rule (or, and, ...)
- if r.label == "and" or r.label == "or" then
- local i
- local fct_tbl = {}
- for i = 1, getn(r) do
- if r[i].label ~= "comment" then
- tinsert(fct_tbl, gen_rule_fct(r[i]))
- end
- end
- if r.label == "and" then
- return function(object)
- local fcts = %fct_tbl
- local i
- for i = 1, getn(fcts) do
- if not fcts[i](object) then return end
- end
- return TRUE
- end
- elseif r.label == "or" then
- return function(object)
- local fcts = %fct_tbl
- local i
- for i = 1, getn(fcts) do
- if fcts[i](object) then return TRUE end
- end
- end
- end
- -- It is a condition rule (name, type, level, ...)
- else
- if r.label == "not" then
- local f
- if not r[1] then
- f = function (object) return TRUE end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object) return not %f(object) end
- elseif r.label == "inventory" then
- local f
- if not r[1] then
- f = function(object) return end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object)
- local i = 0
- while i < INVEN_WIELD do
- if %f(player.inventory(i)) then
- return TRUE
- end
- i = i + 1
- end
- end
- elseif r.label == "equipment" then
- local f
- if not r[1] then
- f = function(object) return end
- else
- f = gen_rule_fct(r[1])
- end
- return function(object)
- local i = INVEN_WIELD
- while i < INVEN_TOTAL do
- if %f(player.inventory(i)) then
- return TRUE
- end
- i = i + 1
- end
- end
- elseif r.label == "name" then
- return function(object) if strlower(object_desc(object, -1, 0)) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "contain" then
- return function(object) if strfind(strlower(object_desc(object, -1, 0)), strlower(%r[1])) then return TRUE end end
- elseif r.label == "symbol" then
- return function(object) if strchar(get_kind(object).d_char) == %r[1] then return TRUE end end
- elseif r.label == "inscribed" then
- return function(object) if object.note ~= 0 and strfind(strlower(quark_str(object.note)), strlower(%r[1])) then return TRUE end end
- elseif r.label == "discount" then
- local d1 = r.args.min
- local d2 = r.args.max
- if tonumber(d1) == nil then d1 = getglobal(d1) else d1 = tonumber(d1) end
- if tonumber(d2) == nil then d2 = getglobal(d2) else d2 = tonumber(d2) end
- return function(object) if is_aware(object) == TRUE and object.discount >= %d1 and object.discount <= %d2 then return TRUE end end
- elseif r.label == "tval" then
- local tv = r[1]
- if tonumber(tv) == nil then tv = getglobal(tv) else tv = tonumber(tv) end
- return function(object) if object.tval == %tv then return TRUE end end
- elseif r.label == "sval" then
- assert(r.args.min and r.args.max, "sval rule lacks min or max")
- local sv1 = r.args.min
- local sv2 = r.args.max
- if tonumber(sv1) == nil then sv1 = getglobal(sv1) else sv1 = tonumber(sv1) end
- if tonumber(sv2) == nil then sv2 = getglobal(sv2) else sv2 = tonumber(sv2) end
- return function(object) if is_aware(object) == TRUE and object.sval >= %sv1 and object.sval <= %sv2 then return TRUE end end
- elseif r.label == "status" then
- return function(object) if object_status(object) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "state" then
- if r[1] == "identified" then
- return function(object) if is_known(object) == TRUE then return TRUE end end
- else
- return function(object) if is_known(object) == FALSE then return TRUE end end
- end
- elseif r.label == "race" then
- return function(object) if strlower(get_race_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "subrace" then
- return function(object) if strlower(get_subrace_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "class" then
- return function(object) if strlower(get_class_name()) == strlower(%r[1]) then return TRUE end end
- elseif r.label == "level" then
- assert(r.args.min and r.args.max, "level rule lacks min or max")
- return function(object) if player.lev >= tonumber(%r.args.min) and player.lev <= tonumber(%r.args.max) then return TRUE end end
- elseif r.label == "skill" then
- assert(r.args.min and r.args.max, "skill rule lacks min or max")
- local s = find_skill_i(r[1])
- assert(s ~= -1, "no skill "..r[1])
- return function(object) if get_skill(%s) >= tonumber(%r.args.min) and get_skill(%s) <= tonumber(%r.args.max) then return TRUE end end
- elseif r.label == "ability" then
- local s = find_ability(r[1])
- assert(s ~= -1, "no ability "..r[1])
- return function(object) if has_ability(%s) == TRUE then return TRUE end end
- end
- end
-end
-
-function auto_inscribe_maker(inscription)
- return function(...)
- arg.n = arg.n + 1
- arg[getn(arg)] = %inscription
- return call(auto_inscribe, arg)
- end
-end
-
--- Generate a rule from a table
-function gen_full_rule(t)
- -- only honor rules for this module
- if not t.args.module then
- t.args.module = "ToME"
- end
-
- if not ((t.args.module == "all") or (t.args.module == game_module)) then
- return function() end
- end
-
- -- Check for which action to do
- local apply_fct = auto_nothing
- if t.args.type == "destroy" then apply_fct = auto_destroy
- elseif t.args.type == "pickup" then apply_fct = auto_pickup
- elseif t.args.type == "inscribe" then apply_fct = auto_inscribe_maker(t.args.inscription)
- end
-
- -- create the function tree
- local rf
- if t[1] then
- rf = gen_rule_fct(t[1])
- else
- rf = function (object) end
- end
-
- -- create the final function
- return function(...)
- local rf = %rf
- if rf(arg[1]) then
- if call(%apply_fct, arg) == TRUE then return TRUE end
- end
- end
-end
-
--- Create a function that checks for the rules(passed in xml form)
-function add_ruleset(s)
- local tbl = xml:collect(s)
- local i
-
- -- Add all rules
- for i = 1, getn(tbl) do
- local t = tbl[i]
-
- if t.label == "rule" then
- -- Create the function tree
- local fct = gen_full_rule(t)
-
- -- Create the test function
- __rules[__rules_max] =
- {
- ["table"] = t,
- ["fct"] = fct
- }
- __rules_max = __rules_max + 1
- end
- end
-end
-
--- Apply the current rules to an object
--- call with at least (object, idx)
-function apply_rules(...)
- local i
- for i = 0, __rules_max - 1 do
- if call(__rules[i].fct, arg) then return TRUE end
- end
- return FALSE
-end
-
--- Clear the current rules
-function clean_ruleset()
- __rules_max = 0
- __rules = {}
-end
-
------- helper fonctions for the GUI
-
-auto_aux = {}
-auto_aux.stack = { n = 0 }
-auto_aux.idx = 1
-auto_aux.rule = 1
-function auto_aux:go_right()
- if auto_aux.rule[1] and type(auto_aux.rule[1]) == "table" then
- tinsert(auto_aux.stack, auto_aux.idx)
- tinsert(auto_aux.stack, auto_aux.rule)
- auto_aux.rule = auto_aux.rule[1]
- auto_aux.idx = 1
- end
-end
-
-function auto_aux:go_left(sel)
- local n = getn(auto_aux.stack)
-
- if n > 0 then
- auto_aux.idx = auto_aux.stack[n - 1]
- auto_aux.rule = auto_aux.stack[n]
- tremove(auto_aux.stack)
- tremove(auto_aux.stack)
- end
-end
-
-function auto_aux:go_down()
- if getn(auto_aux.stack) > 1 then
- if auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx + 1] then
- auto_aux.idx = auto_aux.idx + 1
- auto_aux.rule = auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx]
- end
- end
-end
-
-function auto_aux:go_up()
- if getn(auto_aux.stack) > 1 then
- if auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx - 1] then
- auto_aux.idx = auto_aux.idx - 1
- auto_aux.rule = auto_aux.stack[getn(auto_aux.stack)][auto_aux.idx]
- end
- end
-end
-
-function auto_aux:scroll_up()
- xml.write_off_y = xml.write_off_y - 1
-end
-
-function auto_aux:scroll_down()
- xml.write_off_y = xml.write_off_y + 1
-end
-
-function auto_aux:scroll_left()
- xml.write_off_x = xml.write_off_x + 1
-end
-
-function auto_aux:scroll_right()
- xml.write_off_x = xml.write_off_x - 1
-end
-
-function auto_aux:adjust_current(sel)
- if __rules_max == 0 then return end
-
- xml.write_off_y = 0
- xml.write_off_x = 0
- auto_aux.idx = 1
- auto_aux.stack = { n = 0 }
- auto_aux.rule = __rules[sel].table
-end
-
-function auto_aux:move_up(sel)
- if sel > 0 then
- local u = __rules[sel - 1]
- local d = __rules[sel]
- __rules[sel - 1] = d
- __rules[sel] = u
- return sel - 1
- end
- return sel
-end
-
-function auto_aux:move_down(sel)
- if sel < __rules_max - 1 then
- local u = __rules[sel]
- local d = __rules[sel + 1]
- __rules[sel + 1] = u
- __rules[sel] = d
- return sel + 1
- end
- return sel
-end
-
-function auto_aux:new_rule(sel, nam, typ, arg)
- local r
-
-
- -- nam can also directly be the table itself
- if type(nam) == "table" then
- r =
- {
- ["table"] = nam,
- ["fct"] = function (object) end
- }
- elseif typ == "inscribe" then
- if arg == "" then
- arg = input_box("Inscription?", 79)
- end
- r =
- {
- ["table"] =
- {
- label = "rule",
- args = { name = nam, type = typ, inscription = arg, module = game_module },
- },
- ["fct"] = function (object) end
- }
- else
- r =
- {
- ["table"] =
- {
- label = "rule",
- args = { name = nam, type = typ, module = game_module },
- },
- ["fct"] = function (object) end
- }
- end
- tinsert(__rules, sel, r)
- __rules_max = __rules_max + 1
-end
-
-function auto_aux:rename_rule(sel, nam)
- if sel >= 0 and sel < __rules_max then
- __rules[sel].table.args.name = nam
- end
-end
-
-function auto_aux:save_ruleset()
- xml.write = xml.write_file
-
- print_hook("clean_ruleset()\nadd_ruleset\n[[\n")
- local i
- for i = 0, __rules_max - 1 do
- xml:print_xml(__rules[i].table, '')
- end
- print_hook("]]\n")
-
- xml.write = xml.write_screen
-end
-
-function auto_aux:del_self(sel)
- if auto_aux.rule.label == "rule" then
- tremove(__rules, sel)
- __rules_max = __rules_max - 1
- return sel - 1
- else
- local idx = auto_aux.idx
- auto_aux:go_left(sel)
- tremove(auto_aux.rule, idx)
- return sel
- end
-end
-
-auto_aux.types_desc =
-{
- ["and"] =
- {
- "Check is true if all rules within it are true",
- xml:collect([[<and><foo1>...</foo1><foo2>...</foo2><foo3>...</foo3></and>]]),
- function ()
- return xml:collect("<and></and>")
- end,
- },
- ["or"] =
- {
- "Check is true if at least one rule within it is true",
- xml:collect([[<or><foo1>...</foo1><foo2>...</foo2><foo3>...</foo3></or>]]),
- function ()
- return xml:collect("<or></or>")
- end,
- },
- ["not"] =
- {
- "Invert the result of its child rule",
- xml:collect([[<not><foo1>...</foo1></not>]]),
- function ()
- return xml:collect("<not></not>")
- end,
- },
- ["comment"] =
- {
- "Comments are meaningless",
- xml:collect([[<comment>Comment explaining something</comment>]]),
- function ()
- local n = input_box("Comment?", 79)
- if n == "" then return end
- return xml:collect("<comment>"..n.."</comment>")
- end,
- },
- ["name"] =
- {
- "Check is true if object name matches name",
- xml:collect([[<name>potion of healing</name>]]),
- function ()
- local n = input_box("Object name to match?", 79)
- if n == "" then return end
- return xml:collect("<name>"..n.."</name>")
- end,
- },
- ["contain"] =
- {
- "Check is true if object name contains word",
- xml:collect([[<contain>healing</contain>]]),
- function ()
- local n = input_box("Word to find in object name?", 79)
- if n == "" then return end
- return xml:collect("<contain>"..n.."</contain>")
- end,
- },
- ["inscribed"] =
- {
- "Check is true if object inscription contains word",
- xml:collect([[<inscribed>=g</inscribed>]]),
- function ()
- local n = input_box("Word to find in object inscription?", 79)
- if n == "" then return end
- return xml:collect("<inscribed>"..n.."</inscribed>")
- end,
- },
- ["discount"] =
- {
- "Check is true if object discount is between 2 values",
- xml:collect([[<sval min='50' max='100'></sval>]]),
- function ()
- local s = "<discount "
-
- local n = input_box("Min discount?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max discount?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></discount>"
- return xml:collect(s)
- end,
- },
- ["symbol"] =
- {
- "Check is true if object symbol is ok",
- xml:collect([[<symbol>!</symbol>]]),
- function ()
- local n = input_box("Symbol to match?", 1)
- if n == "" then return end
- return xml:collect("<symbol>"..n.."</symbol>")
- end,
- },
- ["status"] =
- {
- "Check is true if object status is ok",
- xml:collect([[<status>good</status>]]),
- function ()
- local n = msg_box("[t]errible, [v]ery bad, [b]ad, [a]verage, [G]ood, [V]ery good, [S]pecial?")
- local t =
- {
- ["t"] = "terrible",
- ["v"] = "very bad",
- ["b"] = "bad",
- ["a"] = "average",
- ["G"] = "good",
- ["V"] = "very good",
- ["S"] = "special",
- }
- if not t[strchar(n)] then return end
- return xml:collect("<status>"..t[strchar(n)].."</status>")
- end,
- },
- ["state"] =
- {
- "Check is true if object is identified/unidentified",
- xml:collect([[<state>identified</state>]]),
- function ()
- local n = msg_box("[i]dentified, [n]on identified?")
- local t =
- {
- ["i"] = "identified",
- ["n"] = "not identified",
- }
- if not t[strchar(n)] then return end
- return xml:collect("<state>"..t[strchar(n)].."</state>")
- end,
- },
- ["tval"] =
- {
- "Check is true if object tval(from k_info.txt) is ok",
- xml:collect([[<tval>55</tval>]]),
- function ()
- local n = input_box("Tval to match?", 79)
- if n == "" then return end
- return xml:collect("<tval>"..n.."</tval>")
- end,
- },
- ["sval"] =
- {
- {
- "Check is true if object sval(from k_info.txt) is between",
- "2 values",
- },
- xml:collect([[<sval min='0' max='100'></sval>]]),
- function ()
- local s = "<sval "
-
- local n = input_box("Min sval?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max sval?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></sval>"
- return xml:collect(s)
- end,
- },
- ["race"] =
- {
- "Check is true if player race is ok",
- xml:collect([[<race>dunadan</race>]]),
- function ()
- local n = input_box("Player race to match?", 79)
- if n == "" then return end
- return xml:collect("<race>"..n.."</race>")
- end,
- },
- ["subrace"] =
- {
- "Check is true if player subrace is ok",
- xml:collect([[<subrace>vampire</subrace>]]),
- function ()
- local n = input_box("Player subrace to match?", 79)
- if n == "" then return end
- return xml:collect("<subrace>"..n.."</subrace>")
- end,
- },
- ["class"] =
- {
- "Check is true if player class is ok",
- xml:collect([[<class>sorceror</class>]]),
- function ()
- local n = input_box("Player class to match?", 79)
- if n == "" then return end
- return xml:collect("<class>"..n.."</class>")
- end,
- },
- ["level"] =
- {
- "Check is true if player level is between 2 values",
- xml:collect([[<level min='20' max='50'></level>]]),
- function ()
- local s = "<level "
-
- local n = input_box("Min player level?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max player level?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'></level>"
-
- return xml:collect(s)
- end,
- },
- ["skill"] =
- {
- "Check is true if player skill level is between 2 values",
- xml:collect([[<skill min='10' max='20'>Divination</skill>]]),
- function ()
- local s = "<skill "
-
- local n = input_box("Min skill level?", 79)
- if n == "" then return end
- s = s.."min='"..n.."' "
-
- n = input_box("Max skill level?", 79)
- if n == "" then return end
- s = s.."max='"..n.."'>"
-
- n = input_box("Skill name?", 79)
- if n == "" then return end
- if find_skill_i(n) == -1 then return end
- s = s..n.."</skill>"
-
- return xml:collect(s)
- end,
- },
- ["ability"] =
- {
- "Check is true if player has the ability",
- xml:collect([[<ability>Ammo creation</ability>]]),
- function()
- local n = input_box("Ability name?", 79)
- if n == "" then return end
- if find_ability(n) == -1 then return end
- return xml:collect("<ability>"..n.."</ability>")
- end,
- },
- ["inventory"] =
- {
- {
- "Check is true if something in player's inventory matches",
- "the contained rule",
- },
- xml:collect([[<inventory><foo1>...</foo1></inventory>]]),
- function ()
- return xml:collect("<inventory></inventory>")
- end,
- },
- ["equipment"] =
- {
- {
- "Check is true if something in player's equipment matches",
- "the contained rule",
- },
- xml:collect([[<equipment><foo1>...</foo1></equipment>]]),
- function ()
- return xml:collect("<equipment></equipment>")
- end,
- },
-}
-
-function auto_aux:display_desc(sel)
- local d = auto_aux.types_desc[sel][1]
- if type(d) == "string" then
- c_prt(TERM_WHITE, d, 1, 17)
- else
- local k, e, i
- i = 0
- for k, e in d do
- c_prt(TERM_WHITE, e, 1 + i, 17)
- i = i + 1
- end
- end
-end
-
-function auto_aux:add_child(sel)
- -- <rule> and <not> contain only one match
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "not") and auto_aux.rule[1] then return end
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "equipment") and auto_aux.rule[1] then return end
- if (auto_aux.rule.label == "rule" or auto_aux.rule.label == "inventory") and auto_aux.rule[1] then return end
-
- -- Only <and> and <or> can contain
- if auto_aux.rule.label ~= "rule" and auto_aux.rule.label ~= "and" and auto_aux.rule.label ~= "or" and auto_aux.rule.label ~= "not" and auto_aux.rule.label ~= "equipment" and auto_aux.rule.label ~= "inventory" then return end
-
- -- get it
- local r = auto_aux.types_desc[sel][3]()
- if not r then return end
-
- -- Ok add it
- tinsert(auto_aux.rule, r[1])
-end
-
-function auto_aux.regen_ruleset()
- local i
- for i = 0, __rules_max - 1 do
- __rules[i].fct = gen_full_rule(__rules[i].table)
- end
-end
-
-
--- Easily add new rules
-function easy_add_rule(typ, mode, do_status, obj)
- local detect_rule
-
- if mode == "tval" then
- detect_rule = "<tval>"..obj.tval.."</tval>"
- elseif mode == "tsval" then
- detect_rule = "<and><tval>"..obj.tval.."</tval><sval min='"..obj.sval.."' max='"..obj.sval.."'></sval></and>"
- elseif mode == "name" then
- detect_rule = "<name>"..strlower(object_desc(obj, -1, 0)).."</name>"
- end
-
- if do_status == TRUE then
- local status = object_status(obj)
- if status and not (status == "") then
- detect_rule = "<and>"..detect_rule.."<status>"..status.."</status></and>"
- end
- end
-
- local rule = "<rule module='"..game_module.."' name='"..typ.."' type='"..typ.."'>"..detect_rule.."</rule>"
- auto_aux:new_rule(0, xml:collect(rule)[1], '')
- auto_aux.regen_ruleset()
- msg_print("Rule added. Please go to the Automatizer screen (press = then T)")
- msg_print("to save the modified ruleset.")
-end
diff --git a/lib/mods/theme/core/building.lua b/lib/mods/theme/core/building.lua
deleted file mode 100644
index 8e88888a..00000000
--- a/lib/mods/theme/core/building.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-__building_actions = {}
-
-function add_building_action(a)
- assert(a.index, "No building action index")
- assert(a.action, "No building action action")
- __building_actions[a.index] = a.action
-end
-
-function __bact_activate(bact)
- if __building_actions[bact] then
- return __building_actions[bact]()
- end
-end
-
-add_hook_script(HOOK_BUILDING_ACTION, "__bact_activate", "__bact_activate")
diff --git a/lib/mods/theme/core/crpt_aux.lua b/lib/mods/theme/core/crpt_aux.lua
deleted file mode 100644
index 97f8d4b6..00000000
--- a/lib/mods/theme/core/crpt_aux.lua
+++ /dev/null
@@ -1,182 +0,0 @@
--- Core functions for corruptions
-
-__corruptions = {}
-__corruptions_max = 0
-__corruptions_callbacks_max = 0
-
--- Get the corruption
-function player.corruption(c, set)
- if set then
- player.corruptions_aux[c + 1] = set
- player.redraw = bor(player.redraw, PR_BASIC)
- player.update = bor(player.update, PU_BONUS, PU_TORCH, PU_BODY, PU_POWERS)
- if (set == TRUE) and (__corruptions[c].gain) then
- __corruptions[c].gain()
- end
- if (set == FALSE) and (__corruptions[c].lose) then
- __corruptions[c].lose()
- end
- else
- return player.corruptions_aux[c + 1]
- end
-end
-
--- Test if we have that corruption
--- We must:
--- 1) have it or be willing to get it
--- 2) have all its dependancies
--- 3) have none of its opposing corruptions
--- 4) pass the possible tests
-function test_depend_corrupt(corrupt, can_gain)
- local i, c
-
- if not can_gain then can_gain = FALSE end
-
- if can_gain == TRUE then
- if (player.corruption(corrupt) ~= FALSE) then
- return FALSE
- end
- else
- if (player.corruption(corrupt) ~= TRUE) then
- return FALSE
- end
- end
-
- for c, i in __corruptions[corrupt].depends do
- if test_depend_corrupt(c) ~= TRUE then
- return FALSE
- end
- end
-
- for c, i in __corruptions[corrupt].oppose do
- if test_depend_corrupt(c) ~= FALSE then
- return FALSE
- end
- end
-
- -- are we even allowed to get it?
- if __corruptions[corrupt].can_gain and (not __corruptions[corrupt].can_gain()) then
- return FALSE
- end
-
- return TRUE
-end
-
--- Gain a new corruption
-function gain_corruption(group)
- local i, max
- local pos = {}
-
- -- Get the list of all possible ones
- max = 0
- for i = 0, __corruptions_max - 1 do
- if __corruptions[i].group == group and test_depend_corrupt(i, TRUE) == TRUE and __corruptions[i].random == TRUE and __corruptions[i].allow() then
- pos[max] = i
- max = max + 1
- end
- end
-
- -- Ok now get one of them
- if (max > 0) then
- local ret = rand_int(max)
-
- player.corruption(pos[ret], TRUE)
- cmsg_print(TERM_L_RED, __corruptions[pos[ret]].get_text)
-
- return pos[ret]
- else
- return -1
- end
-end
-
--- Lose an existing corruption
-function lose_corruption()
- local i, max
- local pos = {}
-
- -- Get the list of all possible ones
- max = 0
- for i = 0, __corruptions_max - 1 do
- if test_depend_corrupt(i) == TRUE and __corruptions[i].removable == TRUE then
- pos[max] = i
- max = max + 1
- end
- end
-
- -- Ok now get one of them
- if (max > 0) then
- local ret = rand_int(max)
-
- player.corruption(pos[ret], FALSE)
- cmsg_print(TERM_L_RED, __corruptions[pos[ret]].lose_text)
-
- -- Ok now lets see if it broke some dependancies
- for i = 0, max - 1 do
- if player.corruption(pos[i]) ~= test_depend_corrupt(pos[i]) then
- player.corruption(pos[i], FALSE)
- cmsg_print(TERM_L_RED, __corruptions[pos[i]].lose_text)
- end
- end
-
- return pos[ret]
- else
- return -1
- end
-end
-
--- Lose all corruptions (for e.g. Potion of New Life)
-function lose_all_corruptions()
- local i;
- for i = 0, __corruptions_max - 1 do
- lose_corruption()
- end
- return -1
-end
-
--- Creates a new corruption
-function add_corruption(c)
- assert(c.color, "No corruption color")
- assert(c.name, "No corruption name")
- assert(c.get_text, "No corruption get_text")
- assert(c.lose_text, "No corruption lose_text")
- assert(c.desc, "No corruption desc")
- assert(c.hooks, "Nothing to do for corruption")
- if not c.random then c.random = TRUE end
- if not c.removable then c.removable = TRUE end
- if not c.allow then c.allow = function() return not nil end end
-
- if c.depends == nil then c.depends = {} end
- if c.oppose == nil then c.oppose = {} end
-
- -- We must make sure the other ones opposes too
- local o, i
- for o, i in c.oppose do
- __corruptions[o].oppose[__corruptions_max] = TRUE
- end
-
- local index, h
- for index, h in c.hooks do
- add_hook_script(index, "__lua__corrupt_callback"..__corruptions_callbacks_max, "__lua__corrupt_callback"..__corruptions_callbacks_max)
- setglobal("__lua__corrupt_callback"..__corruptions_callbacks_max,
- function (...)
- if test_depend_corrupt(%__corruptions_max) == TRUE then
- return call(%h, arg)
- end
- end
- )
- __corruptions_callbacks_max = __corruptions_callbacks_max + 1
- end
-
- if type(c.desc) == "table" then
- local new_desc = ""
- for index, h in c.desc do
- new_desc = new_desc..h.."\n"
- end
- c.desc = new_desc
- end
-
- __corruptions[__corruptions_max] = c
- __corruptions_max = __corruptions_max + 1
- return (__corruptions_max - 1)
-end
-
diff --git a/lib/mods/theme/core/dungeon.lua b/lib/mods/theme/core/dungeon.lua
deleted file mode 100644
index d91d785b..00000000
--- a/lib/mods/theme/core/dungeon.lua
+++ /dev/null
@@ -1,55 +0,0 @@
--- Internal lua file in charge of dungeon stuff
-
-function place_dungeon(y, x, d_idx)
- if d_idx then
- wild_map(y, x).entrance = 1000 + d_idx
- else
- wild_map(y, x).entrance = 0
- end
-end
-
-function dungeon(d_idx)
- return d_info[1 + d_idx]
-end
-
-function wild_feat(wild)
- return wf_info[1 + wild.feat]
-end
-
-function explode_dir(dir)
- return ddy[dir + 1], ddx[dir + 1]
-end
-
-function rotate_dir(dir, mov)
- if mov > 0 then
- if dir == 7 then dir = 8
- elseif dir == 8 then dir = 9
- elseif dir == 9 then dir = 6
- elseif dir == 6 then dir = 3
- elseif dir == 3 then dir = 2
- elseif dir == 2 then dir = 1
- elseif dir == 1 then dir = 4
- elseif dir == 4 then dir = 7
- end
- elseif mov < 0 then
- if dir == 7 then dir = 4
- elseif dir == 4 then dir = 1
- elseif dir == 1 then dir = 2
- elseif dir == 2 then dir = 3
- elseif dir == 3 then dir = 6
- elseif dir == 6 then dir = 9
- elseif dir == 9 then dir = 8
- elseif dir == 8 then dir = 7
- end
- end
-
- return dir
-end
-
--- Place a trap for a specific level
-function place_trap(y, x, level)
- local old_dun = dun_level
- dun_level = level
- %place_trap(y, x)
- dun_level = old_dun
-end
diff --git a/lib/mods/theme/core/gen_idx.lua b/lib/mods/theme/core/gen_idx.lua
deleted file mode 100644
index 5f3af435..00000000
--- a/lib/mods/theme/core/gen_idx.lua
+++ /dev/null
@@ -1,261 +0,0 @@
--- Place here the list of files to parse
-files =
-{
- "birth.txt",
- "experien.hlp",
- "gods.txt",
- "explore.hlp",
- "newbie.hlp",
- "advanced.hlp",
- "help.hlp",
- "general.txt",
- "whattome.txt",
- "dungeon.txt",
- "spoiler.hlp",
- "g_melkor.txt",
- "skills.txt",
- "c_bard.txt",
- "c_druid.txt",
- "c_lorema.txt",
- "c_mage.txt",
- "c_mimic.txt",
- "c_mindcr.txt",
- "c_monk.txt",
- "c_palad.txt",
- "c_posses.txt",
- "c_pr_drk.txt",
- "c_pr_eru.txt",
- "c_pr_man.txt",
- "c_symbia.txt",
- "c_alchem.txt",
- "c_archer.txt",
- "c_assass.txt",
- "c_axemas.txt",
- "c_demono.txt",
- "c_geoman.txt",
- "c_hafted.txt",
- "c_necro.txt",
- "c_polear.txt",
- "c_ranger.txt",
- "c_rogue.txt",
- "c_runecr.txt",
- "c_sorcer.txt",
- "c_swordm.txt",
- "c_thaum.txt",
- "c_unbel.txt",
- "c_warper.txt",
- "c_warrio.txt",
- "m_meta.txt",
- "rm_skel.txt",
- "rm_zomb.txt",
- "luckspoi.txt",
- "m_air.txt",
- "dunspoil.txt",
- "g_eru.txt",
- "g_manwe.txt",
- "g_tulkas.txt",
- "m_divin.txt",
- "m_mimic.txt",
- "m_water.txt",
- "magic.txt",
- "r_drkelf.txt",
- "r_dwarf.txt",
- "r_elf.txt",
- "r_hielf.txt",
- "r_hobbit.txt",
- "r_pettyd.txt",
- "r_wodelf.txt",
- "rm_spec.txt",
- "tome_faq.txt",
- "ability.txt",
- "automat.txt",
- "c_summon.txt",
- "command.txt",
- "corspoil.txt",
- "debug.txt",
- "m_music.txt",
- "rm_barb.txt",
- "macrofaq.txt",
- "m_necrom.txt",
- "m_mindcr.txt",
- "m_symbio.txt",
- "m_thaum.txt",
- "magic.hlp",
- "m_convey.txt",
- "m_fire.txt",
- "m_mana.txt",
- "m_mind.txt",
- "m_nature.txt",
- "m_tempo.txt",
- "m_udun.txt",
- "m_geoman.txt",
- "essences.txt",
- "r_ent.txt",
- "g_yavann.txt",
- "defines.txt",
- "rm_vamp.txt",
- "inscrip.txt",
- "m_earth.txt",
- "option.txt",
- "attack.txt",
- "version.txt",
- "m_demono.txt",
- "r_beorn.txt",
- "r_deathm.txt",
- "r_rohank.txt",
- "r_hafogr.txt",
- "r_human.txt",
- "r_kobold.txt",
- "r_maia.txt",
- "r_orc.txt",
- "r_thlord.txt",
- "r_troll.txt",
- "r_yeek.txt",
- "rm_class.txt",
- "rm_herm.txt",
- "rm_lsoul.txt",
- "wishing.txt",
- "c_priest.txt",
- "fatespoi.txt",
- "gambling.txt",
- "r_dunad.txt",
- "r_gnome.txt",
- "r_hafelf.txt",
- "c_merch.txt",
- "spoil_faq.txt",
-}
-
-out_file = "index.txt"
-
-index = {}
-
-function parse_file(file)
- local fff = openfile(path_build(ANGBAND_DIR_HELP, file), "r")
- local line
-
- line = read(fff, "*l")
- while line do
- local i, j, anchor, name, subname = strfind(line, "~~~~~(%d+)|([%d%a -]+)|([%d%a -]+)")
- if not i then
- i, j, anchor, name = strfind(line, "~~~~~(%d+)|([%d%a -]+)")
-
- subname = nil
- end
-
- if i then
- if not index[name] then
- index[name] = {}
- end
- if subname then
- tinsert(index[name], { __name__ = subname, __file__ = file, __anchor__ = anchor})
- else
- tinsert(index[name], { __name__ = "__primary__", __file__ = file, __anchor__ = anchor})
- end
- end
-
- line = read(fff, "*l")
- end
-
- closefile(fff)
-end
-
-function sort_fct(a, b)
- local i, len
-
- a = a.__name__
- b = b.__name__
-
- if strlen(a) > strlen(b) then len = strlen(b) else len = strlen(a) end
-
- for i = 1, len do
- local ac = strbyte(a, i)
- local bc = strbyte(b, i)
-
- if ac < bc then
- return not nil
- elseif ac > bc then
- return nil
- end
- end
- if strlen(a) > strlen(b) then return nil else return not nil end
-end
-
-function generate_index()
- local k, e, index_list
- for _, e in files do
- parse_file(e)
- end
-
- index_list = {}
- for k, e in index do
- -- Ok either my sort function or lua sort function sucks ass ..
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- sort(e, sort_fct)
- tinsert(index_list, {__name__= k, __table__ = e})
- end
-
- -- Ok either my sort function or lua sort function sucks ass ..
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- sort(index_list, sort_fct)
- index = index_list
-end
-
-function out_link(fff, space, name, file, anchor)
- write(fff, space.."*****"..file.."*"..anchor.."["..name.."]\n")
-end
-
-function print_index()
- local i, j, c, new_c
- local fff = openfile(path_build(ANGBAND_DIR_HELP, out_file), "w")
-
- write(fff,
-[[|||||oy
-#####R /----------------------------------------\
-#####R < Help Index >
-#####R \----------------------------------------/
-
-This is the index of everything in the T.o.M.E. documentation.
-
-#####BHit a letter key to jump to the entries for that letter.
-
-Some entries in the index link to the same place as other entries. This is
-intentional, so that the information you want is easy to find.
-
-Don't forget you can browse the help from the *****help.hlp*02[Main menu].
-
-#####sSpotted a problem with the help files, or some content thats missing?
-#####sContact fearoffours@t-o-m-e.net .
-
-]])
-
- c = ' '
- for i = 1, getn(index) do
- new_c = strbyte(index[i].__name__, 1)
- if c ~= new_c then
- c = new_c
- write(fff, "~~~~~"..c.."\n")
- write(fff, "*****/"..strchar(c)..out_file.."*"..c.."["..strchar(c).."]\n")
- end
- for j = 1, getn(index[i].__table__) do
- if index[i].__table__[j].__name__ == "__primary__" then
- out_link(fff, " ", index[i].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__)
- end
- end
- for j = 1, getn(index[i].__table__) do
- if index[i].__table__[j].__name__ ~= "__primary__" then
- out_link(fff, " ", index[i].__table__[j].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__)
- end
- end
- end
- closefile(fff)
-end
-
-generate_index()
-
-print_index()
diff --git a/lib/mods/theme/core/gods.lua b/lib/mods/theme/core/gods.lua
deleted file mode 100644
index 77e0aad5..00000000
--- a/lib/mods/theme/core/gods.lua
+++ /dev/null
@@ -1,40 +0,0 @@
--- Gods helper files
-
--- Gods structs
-
-__gods_hook = {}
-__gods_callbacks = {}
-__gods_callbacks_max = 0
-
-function add_god(q)
- local i, index, d, z, qq
-
- assert(q.name, "No god name")
- assert(q.desc, "No god desc")
- assert(q.hooks, "No god hooks")
-
- i = add_new_gods(q.name);
-
- z = 0
- for index, d in q.desc do
- desc_god(i, z, d);
- z = z + 1
- end
-
- __gods_hook[i] = q.hooks
- for index, d in q.hooks do
- add_hook_script(index, "__lua__gods_callback"..__gods_callbacks_max, "__lua__gods_callback"..__gods_callbacks_max)
- setglobal("__lua__gods_callback"..__gods_callbacks_max, d)
- __gods_callbacks_max = __gods_callbacks_max + 1
- end
- if q.data then
- for index, d in q.data do
- -- Besure it exists
- setglobal(index, d)
-
- -- Make it save & load
- add_loadsave(index, d)
- end
- end
- return i
-end
diff --git a/lib/mods/theme/core/help.lua b/lib/mods/theme/core/help.lua
deleted file mode 100644
index a581fe63..00000000
--- a/lib/mods/theme/core/help.lua
+++ /dev/null
@@ -1,141 +0,0 @@
--- Ingame contextual help
-
--- We use our own hook list as to not overburn the hook proccessor
--- with many hooks that would slow down things
--- It would be very meaningless if the option is not even on
-__ingame_hooks = {}
-
-__ingame_help_max = 0
-
-function ingame_help(t, ...)
- -- This function can also be used to call the callbacks
- if type(t) == "string" then
- local f = getglobal("__ingame_help_fct_"..t)
- call(f, arg)
- return
- end
-
- assert(t.desc or t.fct, "no ingame help desc/fct")
- assert(t.hook or t.callback, "no ingame help hook/callback")
- if t.hook then assert(t.event, "no ingame hepl event needed by hook") end
-
- -- Set it to only trigger once
- setglobal("__ingame_help_activated_"..__ingame_help_max, FALSE)
- -- Save/load it
- add_loadsave("__ingame_help_activated_"..__ingame_help_max, FALSE)
-
- if t.hook then
- -- If the hok list didnt exist yet, add it
- if not __ingame_hooks[t.hook] then
- -- Set it to empty, we'll fill it later
- __ingame_hooks[t.hook] = {}
- -- Add the global hook
- add_hooks
- {
- [t.hook] = function (...)
- if option_ingame_help ~= TRUE then return end
- local k, e
- for k, e in __ingame_hooks[%t.hook] do
- if k ~= "n" then
- call(e, arg)
- end
- end
- end
- }
- end
- if t.desc then
- tinsert(__ingame_hooks[t.hook],
- function (...)
- local tbl = %t
- if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then
- if call(tbl.event, arg) == TRUE then
- local k, e
- for k, e in tbl.desc do
- msg_print(TERM_YELLOW, e)
- end
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- )
- elseif t.fct then
- tinsert(__ingame_hooks[t.hook],
- function (...)
- local tbl = %t
- if getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE then
- if call(tbl.event, arg) == TRUE then
- if tbl.fct() == TRUE then
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- end
- )
- end
- else
- local no_test = FALSE
- if t.no_test == TRUE then no_test = TRUE end
- if t.desc then
- setglobal
- (
- "__ingame_help_fct_"..(t.callback),
- function (...)
- local tbl = %t
- if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then
- local k, e
- for k, e in tbl.desc do
- msg_print(TERM_YELLOW, e)
- end
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- )
- elseif t.fct then
- setglobal
- (
- "__ingame_help_fct_"..(t.callback),
- function (...)
- local tbl = %t
- if ((option_ingame_help == TRUE) or (%no_test == TRUE)) and (getglobal("__ingame_help_activated_"..%__ingame_help_max) == FALSE) then
- if call(tbl.fct, arg) == TRUE then
- setglobal("__ingame_help_activated_"..%__ingame_help_max, TRUE)
- end
- end
- end
- )
- end
- end
-
- __ingame_help_max = __ingame_help_max + 1
-end
-
--- Clean up the ingame help seen at birth
-add_hooks
-{
- [HOOK_BIRTH_OBJECTS] = function()
- local i
- for i = 0, __ingame_help_max - 1 do
- setglobal("__ingame_help_activated_"..i, FALSE)
- end
- end
-}
-
-function ingame_clean()
- local i
- for i = 0, __ingame_help_max - 1 do
- setglobal("__ingame_help_activated_"..i, FALSE)
- end
-end
-
--- helper function, brings up a doc
-function ingame_help_doc(name, anchor)
- -- Save screen
- screen_save();
-
- -- Peruse the help file
- if not anchor then anchor = 0 end
- show_file(name, 0, -anchor, 0)
-
- -- Load screen
- screen_load()
-end
diff --git a/lib/mods/theme/core/init.lua b/lib/mods/theme/core/init.lua
deleted file mode 100644
index 11b812d5..00000000
--- a/lib/mods/theme/core/init.lua
+++ /dev/null
@@ -1,83 +0,0 @@
---
--- This file is loaded at the initialisation of ToME
--- Load the system functions
---
-
--- Name of globals to save
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "load.lua")
-
--- Very thin xml parser(49 lines ;)
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "xml.lua")
-
--- various vital helper code
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "s_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "crpt_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "mimc_aux.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "quests.lua")
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "gods.lua")
-
--- Load the ingame contextual help
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua")
-
--- let the store specific stuff happen!
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "stores.lua")
-
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
--------------Here we load the non vital scripts---------------
------------------------from lib/scpt--------------------------
---------------------------------------------------------------
---------------------------------------------------------------
-tome_dofile("init.lua")
-
--- The dofile functions for each patch
-patch_dofile = {}
-
--- Now load patches
-function load_patches()
- scansubdir(ANGBAND_DIR_PATCH)
- for i = 0, scansubdir_max - 1 do
- if (scansubdir_result[i + 1] ~= ".") and (scansubdir_result[i + 1] ~= "..") then
- local dir = path_build(ANGBAND_DIR_PATCH, scansubdir_result[i + 1])
- local file = path_build(dir, "patch.lua")
- if file_exist(file) == TRUE then
- patch_init = nil
- tome_dofile_anywhere(dir, "patch.lua", TRUE)
- unset_safe_globals()
- if patch_init == nil then
- set_safe_globals()
- quit("Patch in "..file.." did not include a patch_init() function")
- else
- set_safe_globals()
-
- -- create the dofile function
- patch_dofile[scansubdir_result[i + 1]] = function(f)
- tome_dofile_anywhere(%dir, f, TRUE)
- end
-
- local name, version = patch_init()
- if name == nil or version == nil then
- quit("Patch in "..file.." did not return valid name or version.\nIt must return name, version")
- end
- patch_version(name, version)
- end
- end
- end
- end
-end
-load_patches()
-
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
---
--- Do not thouch after this line
---
-tome_dofile_anywhere(ANGBAND_DIR_CORE, "load2.lua")
diff --git a/lib/mods/theme/core/load.lua b/lib/mods/theme/core/load.lua
deleted file mode 100644
index 9522ec91..00000000
--- a/lib/mods/theme/core/load.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- Savefile stuff
--- Do not meddle in the affairs of savefiles for they are subtle and quick to be become incompatible
-
-__loadsave_name = {}
-__loadsave_max = 0
-__loadsave_tmp = 0
-
-function add_loadsave(name, default)
- assert(name, "No variable name to save")
- assert(default, "No default value")
-
- -- if it is a table we must create many entries
- if type(default) == "table" then
- for k, e in default do
- add_loadsave(name.."."..k, e)
- end
- else
- __loadsave_name[__loadsave_max] = { name = name, default = default }
- __loadsave_max = __loadsave_max + 1
- end
-end
-
--- Example of how to save a table
--- NOTE: { 1, 2, 3 } will NOT work, the key MUST be a string
---[[
-add_loadsave("t",
-{
- foo = 7,
- tab = {
- a = 1,
- b = 2,
- tab = {
- a=1, b=2, c=3,
- },
- },
-})
-]]
diff --git a/lib/mods/theme/core/load2.lua b/lib/mods/theme/core/load2.lua
deleted file mode 100644
index 7e151d91..00000000
--- a/lib/mods/theme/core/load2.lua
+++ /dev/null
@@ -1,56 +0,0 @@
--- Savefile helpers
-
--- function called when a key in the variable part ofthe savefile is read
--- if the key matches what we need, we use it, otehrwise just ignore it
-function __savefile_load(key, val)
- local index, elem
-
- for index, elem in __loadsave_name do
- if (key == elem.name) then
- dostring(elem.name.." = "..val)
- end
- end
-end
-
--- called when the game is saved, can only save numbers
--- assosiate a key with them to allow the loading code to recognize them
-function __savefile_save()
- local index, elem
- for index, elem in __loadsave_name do
- dostring("__loadsave_tmp = "..elem.name)
- save_number_key(elem.name, __loadsave_tmp);
- end
-end
-
-register_savefile(__loadsave_max)
-add_hook_script(HOOK_LOAD_GAME, "__savefile_load", "__hook_load")
-add_hook_script(HOOK_SAVE_GAME, "__savefile_save", "__hook_save")
-
--- Parse a flattened(i.e: foo.bar.zog) table path and recrate tables
-function reconstruct_table(name)
- for i = 1, strlen(name) - 1 do
- if strsub(name, i, i) == "." then
- local tbl = strsub(name, 1, i - 1)
-
- if dostring("return "..tbl) == nil then
- dostring(tbl.."={}")
- end
- end
- end
-end
-
--- Automagically set unkown variables, otherwise the savefile code
--- might get VERY upset
-do
- local k, e
- -- We need to be able to check for unknown globals
- unset_safe_globals()
- for k, e in __loadsave_name do
- reconstruct_table(e.name)
- if dostring("return "..(e.name)) == nil then
- dostring((e.name).." = "..(e.default))
- end
- end
- -- Now taht we did, we set it back, for it is usefull ;)
- set_safe_globals()
-end
diff --git a/lib/mods/theme/core/mimc_aux.lua b/lib/mods/theme/core/mimc_aux.lua
deleted file mode 100644
index cea1f4dc..00000000
--- a/lib/mods/theme/core/mimc_aux.lua
+++ /dev/null
@@ -1,96 +0,0 @@
--- Mimic shapes helper file
-
-__mimics = {}
-__mimics_max = 1
-__mimics_names = {}
-
-function add_mimic_shape(t)
- assert(t.name, "no mimic name")
- assert(t.desc, "no mimic desc")
- assert(t.calc, "no mimic calc")
- assert(t.level, "no mimic level")
- assert(t.duration, "no mimic duration")
-
- if not t.limit then t.limit = 0 end
-
- if not t.obj_name then
- t.obj_name = t.name
- end
-
- t.show_name = '['..t.name..']'
-
- -- if it needs hooks, add them
- if t.hooks then
- add_hooks(t.hooks)
- end
-
- -- Add it in a name to index hash table
- __mimics_names[t.name] = __mimics_max
-
- __mimics[__mimics_max] = t
- __mimics_max = __mimics_max + 1
-end
-
-function resolve_mimic_name(name)
- if __mimics_names[name] then
- return __mimics_names[name]
- else
- return -1
- end
-end
-
-function find_random_mimic_shape(level, limit, realm)
- local mimic, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- mimic = rand_range(1, __mimics_max - 1)
- if (not realm) or (__mimics[mimic].realm == realm) then
- if limit >= __mimics[mimic].limit then
- if (rand_int(__mimics[mimic].level * 3) < level) and (__mimics[mimic].rarity < 100) and (magik(100 - __mimics[mimic].rarity) == TRUE) then
- break
- end
- end
- end
- end
- if tries > 0 then
- return mimic
- else
- return resolve_mimic_name("Abomination")
- end
-end
-
-function get_mimic_info(mimic, info)
- if not __mimics[mimic] then return 0 end
- return __mimics[mimic][info]
-end
-
-function get_mimic_rand_dur(mimic)
- return rand_range(__mimics[mimic].duration[1], __mimics[mimic].duration[2])
-end
-
-function calc_mimic(mimic)
- return __mimics[mimic].calc()
-end
-
-function calc_mimic_power(mimic)
- if __mimics[mimic].power then __mimics[mimic].power() end
-end
-
---- Here comes the only vital shape
-
-add_mimic_shape
-{
- ["name"] = "Abomination",
- ["obj_name"] = "Abominable Cloak",
- ["desc"] = "Abominations are failed experiments of powerful wizards.",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {20, 100},
- ["calc"] = function ()
- apply_flags(TR1_SPEED + TR1_STR + TR1_INT + TR1_WIS + TR1_DEX + TR1_CON + TR1_CHR, 0, 0, 0, 0, 0, -10)
- player.xtra_f3 = bor(player.xtra_f3, TR3_AGGRAVATE)
- end,
-}
diff --git a/lib/mods/theme/core/monsters.lua b/lib/mods/theme/core/monsters.lua
deleted file mode 100644
index ca2851a0..00000000
--- a/lib/mods/theme/core/monsters.lua
+++ /dev/null
@@ -1,16 +0,0 @@
--- SYSTEM FILE
---
--- Monster stuff, do not touch
---
-
-function summon_monster(y, x, lev, friend, typ)
- if type(typ) == "number" then
- if friend == TRUE then
- return summon_specific_friendly(y, x, lev, typ, FALSE)
- else
- return summon_specific(y, x, lev, typ)
- end
- else
- return summon_monster_aux(y, x, lev, friend, typ)
- end
-end
diff --git a/lib/mods/theme/core/objects.lua b/lib/mods/theme/core/objects.lua
deleted file mode 100644
index 97320b82..00000000
--- a/lib/mods/theme/core/objects.lua
+++ /dev/null
@@ -1,45 +0,0 @@
--- SYSTEM FILE
---
--- Lua object funtions
---
-
-function create_object(tval, sval)
- local obj = new_object()
- object_prep(obj, lookup_kind(tval, sval))
- return (obj)
-end
-
-function set_item_tester(tester)
- if tolua.type(tester) == "number" then
- lua_set_item_tester(tester, "")
- end
- if tolua.type(tester) == "string" then
- lua_set_item_tester(0, tester)
- end
- if tolua.type(tester) == "function" then
- __get_item_hook_default = tester
- lua_set_item_tester(0, "__get_item_hook_default")
- end
-end
-
-function create_artifact(a_idx)
- local obj
- local tval, sval
-
- tval = a_info[a_idx + 1].tval
- sval = a_info[a_idx + 1].sval
- obj = create_object(tval, sval)
- obj.name1 = a_idx
- apply_magic(obj, -1, TRUE, TRUE, TRUE)
-
- return (obj)
-end
-
-function get_kind(obj)
- return k_info[obj.k_idx + 1]
-end
-
-function get_item(ask, deny, flags, mask)
- set_item_tester(mask)
- return get_item_aux(0, ask, deny, flags)
-end
diff --git a/lib/mods/theme/core/player.lua b/lib/mods/theme/core/player.lua
deleted file mode 100644
index 16878228..00000000
--- a/lib/mods/theme/core/player.lua
+++ /dev/null
@@ -1,135 +0,0 @@
--- SYSTEM FILE
---
--- Lua player funtions
---
-
--- Gods
-function deity(i)
- return deity_info[1 + i]
-end
-
--------- skill stuff ---------
-
--- Easy skill access
-function skill(i)
- return s_info[i + 1]
-end
-
--- Sart a lasting spell
-function player.start_lasting_spell(spl)
- player.music_extra = -spl
-end
-
--- stat mods
-function player.modify_stat(stat, inc)
- player.stat_add[1 + stat] = player.stat_add[1 + stat] + inc
-end
-
--- powers mods
-function player.add_power(pow)
- player.powers[1 + pow] = TRUE
-end
-
--- easier inventory access
-function player.inventory(i)
- return player.inventory_real[i + 1]
-end
-
--- modify mana
--- returns TRUE if there is a pb
-function increase_mana(amt)
- player.csp = player.csp + amt
- player.redraw = bor(player.redraw, PR_MANA)
- if (player.csp < 0) then
- player.csp = 0
- return TRUE
- end
- if (player.csp > player.msp) then
- player.csp = player.msp
- end
- return FALSE
-end
-
-
--- Return the coordinates of the player whether in wild or not
-function player.get_wild_coord()
- if player.wild_mode == TRUE then
- return player.py, player.px
- else
- return player.wilderness_y, player.wilderness_x
- end
-end
-
--- Create a new power
-__power_fct = {}
-function add_power(p)
- local i
-
- assert(p.name, "No power name!")
- assert(p.desc, "No power desc!")
- assert(p.desc_get, "No power desc get!")
- assert(p.desc_lose, "No power desc lose!")
- assert(p.stat, "No power stat!")
- assert(p.level, "No power level!")
- assert(p.cost, "No power cost!")
- assert(p.fail, "No power fail!")
- assert(p.power, "No power power!")
-
- i = add_new_power(p.name, p.desc, p.desc_get, p.desc_lose, p.level, p.cost, p.stat, p.fail)
- __power_fct[i] = p.power
- return i
-end
-
-function __power_fct_activate(power)
- if __power_fct[power] then
- __power_fct[power]()
- return TRUE
- else
- return FALSE
- end
-end
-
--- Register in the hook list
-add_hook_script(HOOK_ACTIVATE_POWER, "__power_fct_activate", "__power_fct_activate")
-
-
---- Mkeys
-
--- Create a new power
-__mkey_fct = {}
-function add_mkey(p)
- local i
-
- assert(p.mkey, "No mkey mkey!")
- assert(p.fct, "No mkeey fct!")
-
- __mkey_fct[p.mkey] = p.fct
-end
-
-function __mkey_fct_activate(power)
- if __mkey_fct[power] then
- __mkey_fct[power]()
- return TRUE
- else
- return FALSE
- end
-end
-
--- Register in the hook list
-add_hook_script(HOOK_MKEY, "__mkey_fct_activate", "__mkey_fct_activate")
-
-
--- Subraces
-function subrace(racem)
- return race_mod_info[racem + 1]
-end
-
-function subrace_add_power(subrace, power)
- for i = 1, 4 do
- if subrace.powers[i] == -1 then
- subrace.powers[i] = power
- return not nil
- end
- end
- return nil
-end
diff --git a/lib/mods/theme/core/quests.lua b/lib/mods/theme/core/quests.lua
deleted file mode 100644
index dfe9db51..00000000
--- a/lib/mods/theme/core/quests.lua
+++ /dev/null
@@ -1,57 +0,0 @@
--- Quest helper files
-
--- Quest structs
-
-__quest_hook = {}
-__quest_callbacks = {}
-__quest_callbacks_max = 0
-__quest_dynamic_desc = {}
-
-function add_quest(q)
- local i, index, d, z, qq
-
- assert(q.global, "No quest global name")
- assert(q.name, "No quest name")
- assert(q.desc, "No quest desc")
- assert(q.level, "No quest level")
- assert(q.hooks, "No quest hooks")
-
- i = new_quest(q.name);
- setglobal(q.global, i)
-
- -- Make it save & load
- add_loadsave("quest("..q.global..").status", QUEST_STATUS_UNTAKEN)
-
- if type(q.desc) == "table" then
- z = 0
- for index, d in q.desc do
- quest_desc(i, z, d);
- z = z + 1
- end
- else
- __quest_dynamic_desc[i] = q.desc
- quest(i).dynamic_desc = TRUE
- end
- quest(i).level = q.level
- if not q.silent then
- quest(i).silent = FALSE
- else
- quest(i).silent = q.silent
- end
- __quest_hook[i] = q.hooks
- for index, d in q.hooks do
- add_hook_script(index, "__lua__quest_callback"..__quest_callbacks_max, "__lua__quest_callback"..__quest_callbacks_max)
- setglobal("__lua__quest_callback"..__quest_callbacks_max, d)
- __quest_callbacks_max = __quest_callbacks_max + 1
- end
- if q.data then
- for index, d in q.data do
- -- Besure it exists
- setglobal(index, d)
-
- -- Make it save & load
- add_loadsave(index, d)
- end
- end
- return i
-end
diff --git a/lib/mods/theme/core/s_aux.lua b/lib/mods/theme/core/s_aux.lua
deleted file mode 100644
index ec609b04..00000000
--- a/lib/mods/theme/core/s_aux.lua
+++ /dev/null
@@ -1,716 +0,0 @@
--- Functions to help with spells, do not touch
-
-__schools = {}
-__schools_num = 0
-
-__tmp_spells = {}
-__tmp_spells_num = 0
-
-function add_school(s)
- __schools[__schools_num] = s
-
- __schools_num = __schools_num + 1
- return (__schools_num - 1)
-end
-
-function finish_school(i)
- local s
-
- s = __schools[i]
- assert(s.name, "No school name!")
- assert(s.skill, "No school skill!")
-
- -- Need hooks?
- if s.hooks then
- add_hooks(s.hooks)
- end
-
- new_school(i, s.name, s.skill)
-end
-
-function add_spell(s)
- __tmp_spells[__tmp_spells_num] = s
-
- __tmp_spells_num = __tmp_spells_num + 1
- return (__tmp_spells_num - 1)
-end
-
-function finish_spell(must_i)
- local i, s
-
- s = __tmp_spells[must_i]
- assert(s.name, "No spell name!")
- assert(s.school, "No spell school!")
- assert(s.level, "No spell level!")
- assert(s.mana, "No spell mana!")
- if not s.mana_max then s.mana_max = s.mana end
- assert(s.fail, "No spell failure rate!")
- assert(s.spell, "No spell function!")
- if not s.info then s.info = function() return "" end end
- assert(s.desc, "No spell desc!")
- if not s.random then s.random = SKILL_MAGIC end
- if s.lasting then
- assert(type(s.lasting) == "function", "Spell lasting is not function")
- end
- if s.stick then
- local k, e
- for k, e in s.stick do
- if type(k) == "table" then
- assert(e.base_level, "Arg no stick base level")
- assert(e.max_level, "Arg no stick max level")
- end
- end
- end
-
- i = new_spell(must_i, s.name)
- assert(i == must_i, "ACK ! i != must_i ! please contact the maintainer")
- if type(s.school) == "number" then __spell_school[i] = {s.school}
- else __spell_school[i] = s.school end
- spell(i).mana = s.mana
- spell(i).mana_max = s.mana_max
- spell(i).fail = s.fail
- spell(i).skill_level = s.level
- __spell_spell[i] = s.spell
- __spell_info[i] = s.info
- __spell_desc[i] = s.desc
- return i
-end
-
--- Creates the school books array
-__spell_spell = {}
-__spell_info = {}
-__spell_desc = {}
-__spell_school = {}
-school_book = {}
-
--- Find a spell by name
-function find_spell(name)
- local i
-
- i = 0
- while (i < __tmp_spells_num) do
- if __tmp_spells[i].name == name then return i end
- i = i + 1
- end
- return -1
-end
-
--- Find if the school is under the influence of a god, returns nil or the level
-function get_god_level(sch)
- if __schools[sch].gods[player.pgod] then
- return (s_info[__schools[sch].gods[player.pgod].skill + 1].value * __schools[sch].gods[player.pgod].mul) / __schools[sch].gods[player.pgod].div
- else
- return nil
- end
-end
-
--- Change this fct if I want to switch to learnable spells
-function get_level_school(s, max, min)
- local lvl, sch, index, num, bonus
- local allow_spell_power = TRUE
-
- lvl = 0
- num = 0
- bonus = 0
-
- -- No max specified ? assume 50
- if not max then
- max = 50
- end
- if not min then
- min = 1
- end
-
- -- Do we pass tests?
- if __tmp_spells[s].depend then
- if __tmp_spells[s].depend() ~= TRUE then
- return min, "n/a"
- end
- end
-
- for index, sch in __spell_school[s] do
- local r, s, p, ok = 0, 0, 0, 0
-
- -- Does it require we worship a specific god?
- if __schools[sch].god then
- if __schools[sch].god ~= player.pgod then
- if min then return min, "n/a"
- else return 1, "n/a" end
- end
- end
-
- -- Take the basic skill value
- r = s_info[(school(sch).skill) + 1].value
-
- -- Do we pass tests?
- if __schools[sch].depend then
- if __schools[sch].depend() ~= TRUE then
- return min, "n/a"
- end
- end
-
- -- Are we under sorcery effect ?
- if __schools[sch].sorcery then
- s = s_info[SKILL_SORCERY + 1].value
- end
-
- -- Are we affected by spell power ?
- -- All teh schools must allow it for it to work
- if not __schools[sch].spell_power then
- allow_spell_power = nil
- end
-
- -- Are we under a god effect ?
- if __schools[sch].gods then
- p = get_god_level(sch)
- if not p then p = 0 end
- end
-
- -- Find the higher
- ok = r
- if ok < s then ok = s end
- if ok < p then ok = p end
-
- -- Do we need to add a special bonus ?
- if __schools[sch].bonus_level then
- bonus = bonus + (__schools[sch].bonus_level() * (SKILL_STEP / 10))
- end
-
- -- All schools must be non zero to be able to use it
- if ok == 0 then return min, "n/a" end
-
- -- Apply it
- lvl = lvl + ok
- num = num + 1
- end
-
- -- Add the Spellpower skill as a bonus
- if allow_spell_power then
- bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 10))
- end
-
- -- Add bonus from objects
- bonus = bonus + (player.to_s * (SKILL_STEP / 10))
-
- -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative
- -- The loss of information should be negligible since 1 skill = 1000 internally
- lvl = (lvl / num) / 10
- lvl = lua_get_level(s, lvl, max, min, bonus)
-
- return lvl, nil
-end
-
--- This is the function to use when casting through a stick
-function get_level_device(s, max, min)
- local lvl
-
- -- No max specified ? assume 50
- if not max then
- max = 50
- end
-
- lvl = s_info[SKILL_DEVICE + 1].value
- lvl = lvl + (get_level_use_stick * SKILL_STEP)
-
- -- Sticks are limited
- if lvl - ((spell(s).skill_level + 1) * SKILL_STEP) >= get_level_max_stick * SKILL_STEP then
- lvl = (get_level_max_stick + spell(s).skill_level - 1) * SKILL_STEP
- end
-
- -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative
- -- The loss of information should be negligible since 1 skill = 1000 internally
- lvl = lvl / 10
- if not min then
- lvl = lua_get_level(s, lvl, max, 1, 0)
- else
- lvl = lua_get_level(s, lvl, max, min, 0)
- end
-
- return lvl
-end
-
--- The real get_level, works for schooled magic and for innate powers
-get_level_use_stick = -1
-get_level_max_stick = -1
-function get_level(s, max, min)
- if type(s) == "number" then
- -- Ahah shall we use Magic device instead ?
- if get_level_use_stick > -1 then
- return get_level_device(s, max, min)
- else
- local lvl, na = get_level_school(s, max, min)
- return lvl
- end
- else
- return get_level_power(s, max, min)
- end
-end
-
--- Can we cast the spell ?
-function is_ok_spell(s, obj)
- if get_level(s, 50, 0) == 0 then return nil end
- if __tmp_spells[s].pval and obj.pval < __tmp_spells[s].pval then return nil end
- return 1
-end
-
--- Get the amount of mana(or power) needed
-function get_mana(s)
- return spell(s).mana + get_level(s, spell(s).mana_max - spell(s).mana, 0)
-end
-
--- Return the amount of power(mana, piety, whatever) for the spell
-function get_power(s)
- if check_affect(s, "piety", FALSE) then
- return player.grace
- else
- return player.csp
- end
-end
-
--- Return the amount of power(mana, piety, whatever) for the spell
-function get_power_name(s)
- if check_affect(s, "piety", FALSE) then
- return "piety"
- else
- return "mana"
- end
-end
-
--- Get the level of a power
-function get_level_power(s, max, min)
- if not max then max = 50 end
- if not min then min = 1 end
-
- return value_scale(s.get_current_level(), 50, max, min)
-end
-
--- Changes the amount of power(mana, piety, whatever) for the spell
-function adjust_power(s, x)
- if check_affect(s, "piety", FALSE) then
- inc_piety(GOD_ALL, x)
- else
- increase_mana(x)
- end
-end
-
--- Get spell school name(s) as a /-separated string.
-function spell_school_name(s)
- local xx, sch_str
- xx = nil
- sch_str = ""
- for index, sch in __spell_school[s] do
- if xx then
- sch_str = sch_str.."/"..school(sch).name
- else
- xx = 1
- sch_str = sch_str..school(sch).name
- end
- end
- return sch_str
-end
-
--- Print the book and the spells
-function print_book(book, spl, obj)
- local x, y, index, sch, size, s
-
- x = 0
- y = 2
- size = 0
-
- -- 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 color = TERM_L_DARK
- local lvl, na = get_level_school(s, 50, -50)
- local xx, sch_str
-
- if is_ok_spell(s, obj) then
- if get_mana(s) > get_power(s) then color = TERM_ORANGE
- else color = TERM_L_GREEN end
- end
-
- sch_str = spell_school_name(s)
-
- if na then
- c_prt(color, format("%c) %-20s%-16s %3s %4s %3d%s %s", size + strbyte("a"), spell(s).name, sch_str, na, get_mana(s), spell_chance(s), "%", __spell_info[s]()), y, x)
- else
- c_prt(color, format("%c) %-20s%-16s %3d %4s %3d%s %s", size + strbyte("a"), 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
- prt(format(" %-20s%-16s Level Cost Fail Info", "Name", "School"), 1, x)
- return y
-end
-
--- Output the describtion when it is used as a spell
-function print_spell_desc(s, y)
- local index, desc, x
-
- x = 0
-
- if type(__spell_desc[s]) == "string" then c_prt(TERM_L_BLUE, __spell_desc[s], y, x)
- else
- for index, desc in __spell_desc[s] do
- c_prt(TERM_L_BLUE, desc, y, x)
- y = y + 1
- end
- end
- if check_affect(s, "piety", FALSE) then
- c_prt(TERM_L_WHITE, "It uses piety to cast.", y, x)
- y = y + 1
- end
- if not check_affect(s, "blind") then
- c_prt(TERM_ORANGE, "It is castable even while blinded.", y, x)
- y = y + 1
- end
- if not check_affect(s, "confusion") then
- c_prt(TERM_ORANGE, "It is castable even while confused.", y, x)
- y = y + 1
- end
-end
-
--- Output the desc when sued as a device
-function print_device_desc(s)
- local index, desc
-
- if type(__spell_desc[s]) == "string" then text_out(__spell_desc[s])
- else
- for index, desc in __spell_desc[s] do
- text_out("\n" .. desc)
- end
- end
-end
-
-function book_spells_num(book)
- local size, index, sch
-
- size = 0
-
- -- Hack if the book is 255 it is a random book
- if book == 255 then
- return 1
- end
-
- -- Parse all spells
- for index, s in school_book[book] do
- size = size + 1
- end
- return size
-end
-
-function spell_x(book, spl, s)
- if book == 255 then
- return spl
- else
- local i, x, val
-
- i, val = next(school_book[book], nil)
- x = 0
- while x < s do
- i, val = next(school_book[book], i)
- x = x + 1
- end
- return val
- end
-end
-
-function spell_in_book(book, spell)
- local i, s
-
- for i, s in school_book[book] do
- if s == spell then return TRUE end
- end
- return FALSE
-end
-
--- Returns spell chance of failure for spell
-function spell_chance(s)
- local chance, s_ptr
-
- s_ptr = spell(s)
-
- -- Extract the base spell failure rate
- if get_level_use_stick > -1 then
- chance = lua_spell_device_chance(s_ptr.fail, get_level(s, 50), s_ptr.skill_level)
- else
- chance = lua_spell_chance(s_ptr.fail, get_level(s, 50), s_ptr.skill_level, get_mana(s), get_power(s), get_spell_stat(s))
- end
-
- -- Return the chance
- return chance
-end
-
-function check_affect(s, name, default)
- local s_ptr = __tmp_spells[s]
- local a
-
- if type(s_ptr[name]) == "number" then
- a = s_ptr[name]
- else
- a = default
- end
- if a == FALSE then
- return nil
- else
- return TRUE
- end
-end
-
--- Returns the stat to use for the spell, INT by default
-function get_spell_stat(s)
- if not __tmp_spells[s].stat then return A_INT
- else return __tmp_spells[s].stat end
-end
-
-function cast_school_spell(s, s_ptr, no_cost)
- local use = FALSE
-
- -- No magic
- if (player.antimagic > 0) then
- msg_print("Your anti-magic field disrupts any magic attempts.")
- return
- end
-
- -- No magic
- if (player.anti_magic == TRUE) then
- msg_print("Your anti-magic shell disrupts any magic attempts.")
- return
- end
-
- -- if it costs something then some condition must be met
- if not no_cost then
- -- Require lite
- if (check_affect(s, "blind")) and ((player.blind > 0) or (no_lite() == TRUE)) then
- msg_print("You cannot see!")
- return
- end
-
- -- Not when confused
- if (check_affect(s, "confusion")) and (player.confused > 0) then
- msg_print("You are too confused!")
- return
- end
-
- -- Enough mana
- if (get_mana(s) > get_power(s)) then
- if (get_check("You do not have enough "..get_power_name(s)..", do you want to try anyway?") == FALSE) then return end
- end
-
- -- Invoke the spell effect
- if (magik(spell_chance(s)) == FALSE) then
- if (__spell_spell[s]() ~= nil) then
- use = TRUE
- end
- else
- local index, sch
-
- -- added because this is *extremely* important --pelpel
- if (flush_failure) then flush() end
-
- msg_print("You failed to get the spell off!")
- for index, sch in __spell_school[s] do
- if __schools[sch].fail then
- __schools[sch].fail(spell_chance(s))
- end
- end
- use = TRUE
- end
- else
- __spell_spell[s]()
- end
-
- if use == TRUE then
- -- Reduce mana
- adjust_power(s, -get_mana(s))
-
- -- Take a turn
- if is_magestaff() == TRUE then energy_use = 80
- else energy_use = 100 end
- end
-
- player.redraw = bor(player.redraw, PR_MANA)
- player.window = bor(player.window, PW_PLAYER)
-end
-
-
--- Can the spell be randomly found(in random books)
-function can_spell_random(i)
- return __tmp_spells[i].random
-end
-
--- Find a random spell
-function get_random_spell(typ, level)
- local spl, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- spl = rand_int(__tmp_spells_num)
- if (can_spell_random(spl) == typ) and (rand_int(spell(spl).skill_level * 3) < level) then
- break
- end
- end
- if tries > 0 then
- return spl
- else
- return -1
- end
-end
-
--- Execute a lasting spell
-function exec_lasting_spell(spl)
- assert(__tmp_spells[spl].lasting, "No lasting effect for spell "..__tmp_spells[spl].name.." but called as such")
- return __tmp_spells[spl].lasting()
-end
-
--- Helper function for spell effect to know if they are or not obvious
-function is_obvious(effect, old)
- if old then
- if old == TRUE or effect == TRUE then
- return TRUE
- else
- return FALSE
- end
- else
- return effect
- end
-end
-
--------------------------Sticks-------------------------
-
--- Fire off the spell
-function activate_stick(spl)
- local ret = __spell_spell[spl]()
- local charge, obvious
- if not ret then
- charge = FALSE
- obvious = FALSE
- else
- charge = TRUE
- obvious = ret
- end
- return obvious, charge
-end
-
------------------------------------ Wand, Staves, Rods specific functions ----------------------------
-
--- Get a spell for a given stick(wand, staff, rod)
-function get_random_stick(stick, level)
- local spl, tries
-
- tries = 1000
- while tries > 0 do
- tries = tries - 1
- spl = rand_int(__tmp_spells_num)
- if __tmp_spells[spl].stick and (type(__tmp_spells[spl].stick[stick]) == "table") then
- if (rand_int(spell(spl).skill_level * 3) < level) and (magik(100 - __tmp_spells[spl].stick[stick].rarity) == TRUE) then
- break
- end
- end
- end
- if tries > 0 then
- return spl
- else
- return -1
- end
-end
-
--- Get a random base level
-function get_stick_base_level(stick, level, spl)
- -- Paranoia
- if spl < 0 or spl >= __tmp_spells_num or not __tmp_spells[spl].stick[stick] then return 0 end
-
- local min, max = __tmp_spells[spl].stick[stick].base_level[1], __tmp_spells[spl].stick[stick].base_level[2]
- local range = max - min;
-
- -- Ok the basic idea is to have a max possible level of half the dungeon level
- if range * 2 > level then range = level / 2 end
-
- -- Randomize a bit
- range = m_bonus(range, dun_level)
-
- -- And get the result
- return min + range
-end
-
--- Get a random max level
-function get_stick_max_level(stick, level, spl)
- -- Paranoia
- if spl < 0 or spl >= __tmp_spells_num or not __tmp_spells[spl].stick[stick] then return 0 end
-
- local min, max = __tmp_spells[spl].stick[stick].max_level[1], __tmp_spells[spl].stick[stick].max_level[2]
- local range = max - min;
-
- -- Ok the basic idea is to have a max possible level of half the dungeon level
- if range * 2 > level then range = level / 2 end
-
- -- Randomize a bit
- range = m_bonus(range, dun_level)
-
- -- And get the result
- return min + range
-end
-
--- Get the number of desired charges
-function get_stick_charges(spl)
- return __tmp_spells[spl].stick.charge[1] + randint(__tmp_spells[spl].stick.charge[2]);
-end
-
--- Get activation desc
-function get_activation_desc(spl)
- local turns
- if type(__tmp_spells[spl].activate) == 'number' then
- turns = __tmp_spells[spl].activate
- else
- turns = __tmp_spells[spl].activate[1] .. '+d' .. __tmp_spells[spl].activate[2]
- end
- return __tmp_spells[spl].desc[1] .. ' every ' .. turns .. ' turns'
-end
-
--- Compute the timeout of an activation
-function get_activation_timeout(spl)
- if type(__tmp_spells[spl].activate) == 'number' then
- return __tmp_spells[spl].activate
- else
- return __tmp_spells[spl].activate[1] + randint(__tmp_spells[spl].activate[2])
- end
-end
-
--- Fire off the spell
-function activate_activation(spl, item)
- __spell_spell[spl](item)
-end
-
-
-------- Add new GF type ----------
-max_gf = MAX_GF
-function add_spell_type(t)
- t.index = max_gf
- max_gf = max_gf + 1
- assert(t.color, "No GF color")
- if not t.monster then t.monster = function() end end
- if not t.angry then t.angry = function() end end
- if not t.object then t.object = function() end end
- if not t.player then t.player = function() end end
- if not t.grid then t.grid = function() end end
-
- add_hooks
- {
- [HOOK_GF_COLOR] = function (gf, new_gfx)
- local t = %t
- if gf == t.index then return TRUE, t.color[new_gfx + 1] end
- end,
- [HOOK_GF_EXEC] = function (action, who, gf, dam, rad, y, x, extra)
- local t = %t
- if t.index == gf then
- return t[action](who, dam, rad, y, x, extra)
- end
- end,
- }
- return t.index
-end
diff --git a/lib/mods/theme/core/stores.lua b/lib/mods/theme/core/stores.lua
deleted file mode 100644
index d4a63168..00000000
--- a/lib/mods/theme/core/stores.lua
+++ /dev/null
@@ -1,32 +0,0 @@
--- Take care of all concerning stores
-function store_buy_list(t)
- assert(type(t) == "table", "store_buy_list got no table")
- add_hooks
- {
- [HOOK_STORE_BUY] = function (index, name, obj)
- local tbl = %t
- local elt = tbl[index]
- if not elt then
- elt = tbl[name]
- end
- if elt then
- if elt then
- if type(elt) == "function" then
- return TRUE, elt(obj)
- elseif type(elt) == "table" then
- local k, e
- for k, e in elt do
- if type(e) == "number" then
- if obj.tval == e then return TRUE, TRUE end
- else
- if (obj.tval == e[1]) and (obj.sval >= e[2]) and (obj.sval <= e[3]) then return TRUE, TRUE end
- end
- end
- elseif elt == -1 then
- return TRUE, FALSE
- end
- end
- end
- end,
- }
-end
diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua
deleted file mode 100644
index eea13014..00000000
--- a/lib/mods/theme/core/util.lua
+++ /dev/null
@@ -1,158 +0,0 @@
--- various stuff to make scripters life easier
-
--- Beware of the scary undefined globals
-function safe_getglobal(x)
- local v = rawget(globals(), x)
-
- if v then
- return v
- else
- error("undefined global variable '"..x.."'")
- end
-end
-
-function set_safe_globals()
- settagmethod(tag(nil), "getglobal", safe_getglobal)
-end
-function unset_safe_globals()
- settagmethod(tag(nil), "getglobal", nil)
-end
-
-set_safe_globals()
-
--- Patch modules
-__patch_modules = {}
-
-function patch_version(name, version)
- assert(not __patch_modules[name], "Patch " .. name .. " already loaded!!!")
- __patch_modules[name] = version
-end
-
-function patchs_list()
- local k, e, first
- first = FALSE
- for k, e in __patch_modules do
- if first == FALSE then print_hook("\n\n [Patch modules]\n") first = TRUE end
- print_hook("\n "..k.." version "..e)
- end
- if first == TRUE then print_hook("\n") end
-end
-
-function patchs_display()
- local k, e
- for k, e in __patch_modules do
- msg_print("Patch: "..k.." version "..e)
- end
-end
-
-
--- Better hook interface
-__hooks_list_callback = {}
-__hooks_list_callback_max = 0
-
-function add_hooks(h_table, name_prefix)
- local k, e
-
- if not name_prefix then name_prefix = "" end
- for k, e in h_table do
- add_hook_script(k, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, "__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max)
- setglobal("__"..name_prefix.."__hooks_list_callback"..__hooks_list_callback_max, e)
- __hooks_list_callback_max = __hooks_list_callback_max + 1
- end
-end
-
--- Wrapper for the real msg_print and cmsg_print
--- it understands if we want color or not
-function msg_print(c, m)
- if type(c) == "number" then
- cmsg_print(c, m)
- else
- call(%msg_print, { c })
- end
-end
-
--- better timer add function
-__timers_callback_max = 0
-
-function new_timer(t)
- assert(t.delay > 0, "no timer delay")
- assert(t.enabled, "no timer enabled state")
- assert(t.callback, "no timer callback")
-
- local timer
- if type(t.callback) == "function" then
- setglobal("__timers_callback_"..__timers_callback_max, t.callback)
- timer = %new_timer("__timers_callback_"..__timers_callback_max, t.delay)
- __timers_callback_max = __timers_callback_max + 1
- else
- timer = %new_timer(t.callback, t.delay)
- end
-
- timer.enabled = t.enabled
-
- return timer
-end
-
--- saves all timer values
-function save_timer(name)
- add_loadsave(name..".enabled", FALSE)
- add_loadsave(name..".delay", 1)
- add_loadsave(name..".countdown", 1)
-end
-
-
--- displays a scrolling list
-function display_list(y, x, h, w, title, list, begin, sel, sel_color)
- local l = create_list(getn(list))
-
- for i = 1, getn(list) do
- add_to_list(l, i - 1, list[i])
- end
-
- %display_list(y, x, h, w, title, l, getn(list), begin - 1, sel - 1, sel_color)
-
- delete_list(l, getn(list))
-end
-
--- Easier access to special gene stuff
-function set_monster_generation(monster, state)
- if type(monster) == "string" then
- m_allow_special[test_monster_name(monster) + 1] = state
- else
- m_allow_special[monster + 1] = state
- end
-end
-function set_object_generation(obj, state)
- if type(obj) == "string" then
- m_allow_special[test_item_name(obj) + 1] = state
- else
- m_allow_special[obj + 1] = state
- end
-end
-function set_artifact_generation(obj, state)
- m_allow_special[obj + 1] = state
-end
-
--- Strings
-function strcap(str)
- if strlen(str) > 1 then
- return strupper(strsub(str, 1, 1))..strsub(str, 2)
- elseif strlen(str) == 1 then
- return strupper(str)
- else
- return str
- end
-end
-
-function msg_format(...)
- msg_print(call(format, arg))
-end
-
--- A way to check if the game is now running(as opposed to initialization/character gen)
-game = {}
-add_hooks
-{
- [HOOK_GAME_START] = function ()
- game.started = TRUE
- end
-}
diff --git a/lib/mods/theme/core/xml.lua b/lib/mods/theme/core/xml.lua
deleted file mode 100644
index 14f0511f..00000000
--- a/lib/mods/theme/core/xml.lua
+++ /dev/null
@@ -1,375 +0,0 @@
--- The xml module
-xml = {}
-
-function xml:parseargs (s)
- local arg = {}
- gsub(s, "(%w+)=([\"'])(.-)%2", function (w, _, a)
- %arg[w] = a
- end)
- return arg
-end
-
--- s is a xml stream, returns a table
-function xml:collect (s)
- local stack = {n=0}
- local top = {n=0}
- tinsert(stack, top)
- local ni,c,label,args, empty
- local i, j = 1, 1
- while 1 do
- ni,j,c,label,args, empty = strfind(s, "<(%/?)(%w+)(.-)(%/?)>", j)
- if not ni then break end
- local text = strsub(s, i, ni-1)
- if not strfind(text, "^%s*$") then
- tinsert(top, text)
- end
- if empty == "/" then -- empty element tag
- tinsert(top, {n=0, label=label, args=xml:parseargs(args), empty=1})
- elseif c == "" then -- start tag
- top = {n=0, label=label, args=xml:parseargs(args)}
- tinsert(stack, top) -- new level
- else -- end tag
- local toclose = tremove(stack) -- remove top
- top = stack[stack.n]
- if stack.n < 1 then
- error("nothing to close with "..label)
- end
- if toclose.label ~= label then
- error("trying to close "..toclose.label.." with "..label)
- end
- tinsert(top, toclose)
- end
- i = j+1
- end
- local text = strsub(s, i)
- if not strfind(text, "^%s*$") then
- tinsert(stack[stack.n], text)
- end
- if stack.n > 1 then
- error("unclosed "..stack[stack.n].label)
- end
- return stack[1]
-end
-
--- Viewport coordinates
-xml.write_out_y = 0
-xml.write_out_x = 0
-xml.write_out_h = 24
-xml.write_out_w = 80
-
--- Offsets
-xml.write_off_y = 0
-xml.write_off_x = 0
-
--- Current position
-xml.write_y = 0
-xml.write_x = 0
-
-xml.write_screen = function(color, s)
- local i
- for i = 1, strlen(s) do
- local c = strsub(s, i, i + 1)
- if c ~= "\n" then
- if xml.write_y - xml.write_off_y >= 0 and xml.write_y - xml.write_off_y < xml.write_out_h and xml.write_x - xml.write_off_x >= 0 and xml.write_x - xml.write_off_x < xml.write_out_w then
- Term_putch(xml.write_x - xml.write_off_x + xml.write_out_x, xml.write_y - xml.write_off_y + xml.write_out_y, color, strbyte(c))
- end
- xml.write_x = xml.write_x + 1
- else
- xml.write_x = 0
- xml.write_y = xml.write_y + 1
- end
- end
-end
-
-xml.write_file = function (color, s)
- print_hook(s)
-end
-
-xml.write = xml.write_screen
-
-xml.rule2string = {
- ['name'] = {"Its ", "name", " is"},
- ['contain'] = {"Its ", "name", " contains"},
- ['symbol'] = {"Its ", "symbol", " is"},
- ['inscribed'] = {"Its ", "inscription", " contains"},
- ['state'] = {"Its ", "state", " is"},
- ['status'] = {"Its ", "status", " is"},
- ['tval'] = {"Its ", "tval", " is"},
- ['race'] = {"Your ", "race", " is"},
- ['subrace'] = {"Your ", "subrace", " is"},
- ['class'] = {"Your ", "class", " is"},
- ['foo1'] = {"The result of ", "test 1 ", "is"},
- ['foo2'] = {"The result of ", "test 2 ", "is"},
- ['foo3'] = {"The result of ", "test 3 ", "is"},
-}
-
-xml.display_english = 1
-function xml:display_xml(t, tab)
- if xml.display_english then
- xml:english_xml(t, tab)
- else
- xml:print_xml(t, tab)
- end
-end
-
-function xml:english_xml(t, tab, not_flag)
- local i, k, e
- local pre, post, recurse
- local children_not_flag
- local nextlevel
- local bcol, ecol = TERM_L_GREEN, TERM_GREEN
-
- if xml.write_active and t == auto_aux.rule then bcol, ecol = TERM_VIOLET, TERM_VIOLET end
-
- nextlevel = tab .. " "
-
- recurse = 1
-
- if t.label == "rule" then
- if t.args.type == "inscribe" then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "A rule named \"")
- xml.write(TERM_WHITE, tostring(t.args.name))
- xml.write(ecol, "\" to ")
- xml.write(bcol, "inscribe")
- xml.write(ecol, " an item with \"")
- xml.write(TERM_WHITE, t.args.inscription)
- xml.write(ecol, "\" when")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "A rule named \"")
- xml.write(TERM_WHITE, tostring(t.args.name))
- xml.write(ecol, "\" to ")
- xml.write(bcol, t.args.type)
- xml.write(ecol, " when")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "and" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "At least one of the following is false:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "All of the following are true:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "or" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "All of the following are false:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "At least one of the following are true:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "not" then
- if bcol == TERM_VIOLET or getn(t) == 0 then
- xml.write(ecol, "(a negating rule)")
- xml.write(TERM_WHITE, "\n")
- else
- nextlevel = tab
- end
- children_not_flag = not nil
- elseif t.label == "inventory" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Nothing in your ")
- xml.write(bcol, "inventory")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Something in your ")
- xml.write(bcol, "inventory")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "equipment" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Nothing in your ")
- xml.write(bcol, "equipment")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Something in your ")
- xml.write(bcol, "equipment")
- xml.write(ecol, " matches the following:")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "comment" then
- xml.write(TERM_WHITE, tab)
- xml.write(TERM_WHITE, "(" .. t[1] .. ")")
- xml.write(TERM_WHITE, "\n")
- elseif t.label == "skill" then
- local s = t[1]
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your skill in ")
- xml.write(bcol, s)
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your skill in ")
- xml.write(bcol, s)
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "ability" then
- local s = t[1]
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "You do not have the ")
- xml.write(bcol, s)
- xml.write(ecol, " ability")
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "You have the ")
- xml.write(bcol, s)
- xml.write(ecol, " ability")
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "level" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your ")
- xml.write(bcol, "level")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Your ")
- xml.write(bcol, "level")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "sval" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "sval")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "sval")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- elseif t.label == "discount" then
- if not_flag then
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "discount")
- xml.write(ecol, " is not from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- else
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, "Its ")
- xml.write(bcol, "discount")
- xml.write(ecol, " is from ")
- xml.write(TERM_WHITE, tostring(t.args.min))
- xml.write(ecol, " to ")
- xml.write(TERM_WHITE, tostring(t.args.max))
- xml.write(TERM_WHITE, "\n")
- end
- else
- if xml.rule2string[t.label] then
- local rule = xml.rule2string[t.label]
- a, b, c = rule[1], rule[2], rule[3]
- if not_flag then c = c .. " not" end
- xml.write(TERM_WHITE, tab)
- xml.write(ecol, a)
- xml.write(bcol, b)
- xml.write(ecol, c)
- xml.write(ecol, " \"")
- xml.write(TERM_WHITE, t[1])
- xml.write(ecol, "\"")
- xml.write(TERM_WHITE, "\n")
- else
- if not_flag then
- xml.write(bcol, "Not:\n")
- tab = tab .. " "
- xml:print_xml(t, tab)
- return
- end
- end
- end
-
- for i = 1, getn(t) do
- if type(t[i]) == "string" then
- -- xml.write(TERM_WHITE, t[i].."\n")
- else
- xml:english_xml(t[i], nextlevel, children_not_flag)
- end
- end
-end
-
-function xml:print_xml(t, tab)
- local i, k, e
- local inside = nil
- local bcol, ecol = TERM_L_GREEN, TERM_GREEN
-
- if xml.write_active and t == auto_aux.rule then bcol, ecol = TERM_VIOLET, TERM_VIOLET end
-
- xml.write(bcol, tab.."<"..t.label)
- for k, e in t.args do
- xml.write(TERM_L_BLUE, " "..k)
- xml.write(TERM_WHITE, "=\"")
- xml.write(TERM_YELLOW, e)
- xml.write(TERM_WHITE, "\"")
- end
- xml.write(bcol, ">")
-
- for i = 1, getn(t) do
- if type(t[i]) == "string" then
- xml.write(TERM_WHITE, t[i])
- else
- if not inside then xml.write(TERM_WHITE, "\n") end
- inside = not nil
- xml:print_xml(t[i], tab.." ")
- end
- end
-
- if not inside then
- xml.write(ecol, "</"..t.label..">\n")
- else
- xml.write(ecol, tab.."</"..t.label..">\n")
- end
-end
-
--- t is a table representing xml, outputs the xml code via xml.write()
-function xml:output(t)
- local i
- for i = 1, getn(t) do
- xml:print_xml(t[i], "")
- end
-end
diff --git a/lib/mods/theme/edit/t_minas.txt b/lib/mods/theme/edit/t_minas.txt
index b96481d8..cea53634 100644
--- a/lib/mods/theme/edit/t_minas.txt
+++ b/lib/mods/theme/edit/t_minas.txt
@@ -15,7 +15,7 @@ F:w:8:3:0:0:0:0:0:24
# Quest 16 finished, reward is a between gate
?:[EQU $QUEST16 5]
-F:Z:176:3:0:0:0:0:0:0
+F:Z:176:3:0:0:0:0:0:2
?:1
diff --git a/lib/mods/theme/edit/w_info.txt b/lib/mods/theme/edit/w_info.txt
index 18cf7a0f..6ca43cfd 100644
--- a/lib/mods/theme/edit/w_info.txt
+++ b/lib/mods/theme/edit/w_info.txt
@@ -14,7 +14,7 @@ W:D:XWWWWAAAAAW%AAAA========WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
W:D:XWWWWWWAAWAAAWW===========WWWWWWW...WWWWWWWWWW..........WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW.EEEEEEEEEEEX
W:D:XWWWWWWWWWWWWWW==========..WWW....WWWWWWWW................WWWWGGGGWWWWWWWW......WWWWW.EEEEEEEEEEEEEEX
W:D:XTM.MMMMWWWW===...====...........HHHH..................GGGGGGGWWWDWWWW.........WWWW.EEEEEEEEEEEEEEEEX
-W:D:XT.2MMM=======.BB.=............HHHHHHHH..&&&&&...J..GGGGGGGGGGGGG.................tEEEEEtEEEEttEEEEEX
+W:D:XT.2MMM=======.BB.=............HHHHHHHH..&&&&&......GGGGGGGGGGGGG.................tEEEEEtEEEEttEEEEEX
?:[EQU $TOWN_DESTROY2 1]
W:M:0:1
W:D:XT.PMMM=======.BB.=............HHHHHHHH..&&&&&......GGGGGGGGGGGGG.................tEEEEEtEEEEttEEEEEX
diff --git a/lib/mods/theme/edit/wf_info.txt b/lib/mods/theme/edit/wf_info.txt
index acdba872..4b7f9991 100644
--- a/lib/mods/theme/edit/wf_info.txt
+++ b/lib/mods/theme/edit/wf_info.txt
@@ -301,12 +301,6 @@ D:Anduin, the great river
W:35:0:0:227:3:~
X:187:227:187:84:84:227:84:84:222:227:84:84:227:84:84:227:88:94
-# Former location of Gondolin (to avoid silliness with Maeglin quest)
-N:48:Secret Valley
-D:the secret valley with directions to Gondolin
-W:0:0:12:89:1:J
-X:228:228:228:228:228:228:228:228:228:228:228:228:228:228:228:228:228:228
-
### New Towns ###
# Beorn's Halls
diff --git a/lib/mods/theme/help/def.aux b/lib/mods/theme/help/def.aux
deleted file mode 100644
index 983e9683..00000000
--- a/lib/mods/theme/help/def.aux
+++ /dev/null
@@ -1,3 +0,0 @@
-file_ext="html"
-link_prefix=""
-link_suffix=""
diff --git a/lib/mods/theme/module.lua b/lib/mods/theme/module.lua
deleted file mode 100644
index cc0b6f08..00000000
--- a/lib/mods/theme/module.lua
+++ /dev/null
@@ -1,48 +0,0 @@
-add_module
-{
- ["name"] = "Theme",
- ["version"] = { 1, 2, 0 },
- ["author"] = { "furiosity", "furiosity@gmail.com" },
- ["desc"] = {
- "A module that goes back to Tolkien roots, though by no means canonical.",
- "A new wilderness map, new monsters, objects, artifacts, uniques, ego items,",
- "terrain features, gods, races, subraces, and classes. Have fun. :-)",
- },
-
- ["rand_quest"] = TRUE,
- ["C_quest"] = TRUE,
-
- ["base_dungeon"] = 4,
- ["death_dungeon"] = 28,
-
- ["astral_dungeon"] = 8,
- ["astral_wild_x"] = 45,
- ["astral_wild_y"] = 19,
-
- ["random_artifact_weapon_chance"] = 30,
- ["random_artifact_armor_chance"] = 30,
- ["random_artifact_jewelry_chance"] = 30,
-
- ["max_plev"] = 50,
- ["max_skill_overage"] = 5,
-
- ["mod_savefiles"]=
- {
- "Theme",
- },
- ["layout"] =
- {
- ["apex"] = "theme",
- ["core"] = "theme",
- ["data"] = "theme",
- ["dngn"] = "theme",
- ["edit"] = "theme",
- ["file"] = "theme",
- ["help"] = "theme",
- ["note"] = "theme",
- ["save"] = "theme",
- ["scpt"] = "theme",
- ["user"] = "theme",
- ["pref"] = "theme",
- },
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/bounty.lua b/lib/mods/theme/scpt/bounty.lua
deleted file mode 100644
index 94c15598..00000000
--- a/lib/mods/theme/scpt/bounty.lua
+++ /dev/null
@@ -1,90 +0,0 @@
--- The bounty quest! bring back corpses to increase your monster lore skill
-
-add_quest
-{
- ["global"] = "BOUNTY_QUEST",
- ["name"] = "Bounty quest",
- ["desc"] = function()
- if quest(BOUNTY_QUEST).status == QUEST_STATUS_TAKEN then
- print_hook("#####yBounty quest!\n")
- print_hook("You must bring back "..monster_race_desc(bounty_quest_monster, 0).." corpse to the beastmaster.\n")
- print_hook("\n")
- end
- end,
- ["level"] = -1,
- ["data"] = {
- ["bounty_quest_monster"] = 0,
- },
- ["hooks"] = {
- -- Start the game without the quest, need to request it
- [HOOK_BIRTH_OBJECTS] = function()
- quest(BOUNTY_QUEST).status = QUEST_STATUS_UNTAKEN
- end,
- },
-}
-
-add_building_action
-{
- -- Index is used in ba_info.txt to set the actions
- ["index"] = 54,
- ["action"] = function()
- if quest(BOUNTY_QUEST).status == QUEST_STATUS_UNTAKEN then
- quest(BOUNTY_QUEST).status = QUEST_STATUS_TAKEN
- bounty_quest_monster = get_new_bounty_monster(3 + ((player.lev * 3) / 2))
-
- msg_print("You must bring me back "..monster_race_desc(bounty_quest_monster, 0).." corpse.")
- else
- msg_print("You still must bring me back "..monster_race_desc(bounty_quest_monster, 0).." corpse.")
- end
- end
-}
-
-add_building_action
-{
- -- Index is used in ba_info.txt to set the actions
- ["index"] = 55,
- ["action"] = function()
- if quest(BOUNTY_QUEST).status == QUEST_STATUS_TAKEN then
- local ret, item
-
- -- Ask for an item
- ret, item = get_item("What corpse to return?",
- "You have no corpse to return.",
- bor(USE_INVEN),
- function (obj)
- if (obj.tval == TV_CORPSE) and (obj.pval2 == bounty_quest_monster) then
- return TRUE
- end
- return FALSE
- end
- )
-
- -- Ok we got the corpse!
- if ret == TRUE then
- -- Take the corpse from the inventory
- inven_item_increase(item, -1)
- inven_item_optimize(item)
-
- msg_print("Ah well done adventurer!")
- msg_print("As a reward I will teach you a bit of monster lore.")
-
- if skill(SKILL_LORE).mod == 0 then
- skill(SKILL_LORE).mod = 900
- skill(SKILL_LORE).dev = TRUE
- end
- skill(SKILL_LORE).value = skill(SKILL_LORE).value + skill(SKILL_LORE).mod
- if skill(SKILL_PRESERVATION).mod == 0 then
- skill(SKILL_PRESERVATION).value = 800
- skill(SKILL_PRESERVATION).mod = 800
- skill(SKILL_PRESERVATION).dev = TRUE
- msg_print("I see you don't know the corpse preservation skill, I shall teach you it too.")
- end
-
- quest(BOUNTY_QUEST).status = QUEST_STATUS_UNTAKEN
- bounty_quest_monster = 0
- end
- else
- msg_print("You do not have any bounty quest yet.")
- end
- end
-}
diff --git a/lib/mods/theme/scpt/corrupt.lua b/lib/mods/theme/scpt/corrupt.lua
deleted file mode 100644
index f402add3..00000000
--- a/lib/mods/theme/scpt/corrupt.lua
+++ /dev/null
@@ -1,1089 +0,0 @@
--- Definition of the corruptions
--- Theme adds the restriction T-Plus has for Maiar: they may only gain the Balrog corruptions.
-
--- The Balrog corruptions
-CORRUPT_BALROG_AURA = add_corruption
-{
- ["color"] = TERM_ORANGE,
- ["name"] = "Balrog Aura",
- ["get_text"] = "A corrupted wall of flames surrounds you.",
- ["lose_text"] = "The wall of corrupted flames abandons you.",
- ["desc"] =
- {
- " Surrounds you with a fiery aura",
- " But it can burn scrolls when you read them"
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.xtra_f3 = bor(player.xtra_f3, TR3_SH_FIRE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_LITE1)
- end,
- [HOOK_READ] = function(obj)
- if magik(5) == TRUE then
- msg_print("Your demon aura burns the scroll before you read it!")
- return TRUE, TRUE, FALSE
- else
- return FALSE
- end
- end,
- },
-}
-
-CORRUPT_BALROG_WINGS = add_corruption
-{
- ["color"] = TERM_ORANGE,
- ["name"] = "Balrog Wings",
- ["get_text"] = "Wings of shadow grow in your back.",
- ["lose_text"] = "The wings in your back fall apart.",
- ["desc"] =
- {
- " Creates ugly, but working, wings allowing you to fly",
- " But it reduces charisma by 4 and dexterity by 2"
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.xtra_f4 = bor(player.xtra_f4, TR4_FLY)
- player.modify_stat(A_CHR, -4)
- player.modify_stat(A_DEX, -2)
- end,
- },
-}
-
-CORRUPT_BALROG_STRENGTH = add_corruption
-{
- ["color"] = TERM_ORANGE,
- ["name"] = "Balrog Strength",
- ["get_text"] = "Your muscles get unnatural strength.",
- ["lose_text"] = "Your muscles get weaker again.",
- ["desc"] =
- {
- " Provides 3 strength and 1 constitution",
- " But it reduces charisma by 1 and dexterity by 3"
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.modify_stat(A_STR, 3)
- player.modify_stat(A_CON, 1)
- player.modify_stat(A_DEX, -3)
- player.modify_stat(A_CHR, -1)
- end,
- },
-}
-
-CORRUPT_BALROG_FORM = add_corruption
-{
- ["color"] = TERM_YELLOW,
- ["name"] = "Balrog Form",
- ["get_text"] = "You feel the might of a Balrog inside you.",
- ["lose_text"] = "The presence of the Balrog seems to abandon you.",
- ["desc"] =
- {
- " Allows you to turn into a Balrog at will",
- " You need Balrog Wings, Balrog Aura and Balrog Strength to activate it"
- },
- ["depends"] =
- {
- [CORRUPT_BALROG_AURA] = TRUE,
- [CORRUPT_BALROG_WINGS] = TRUE,
- [CORRUPT_BALROG_STRENGTH] = TRUE
- },
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_BALROG)
- end,
- },
-}
-
-
--- The Demon corruptions
-CORRUPT_DEMON_SPIRIT = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Demon Spirit",
- ["get_text"] = "Your spirit opens to corrupted thoughts.",
- ["lose_text"] = "Your spirit closes again to the corrupted thoughts.",
- ["desc"] =
- {
- " Increases your intelligence by 1",
- " But reduce your charisma by 2",
- },
-["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.modify_stat(A_INT, 1)
- player.modify_stat(A_CHR, -2)
- end,
- },
-}
-
-CORRUPT_DEMON_HIDE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Demon Hide",
- ["get_text"] = "Your skin grows into a thick hide.",
- ["lose_text"] = "Your skin returns to a natural state.",
- ["desc"] =
- {
- " Increases your armour class by your level",
- " Provides immunity to fire at level 40",
- " But reduces speed by your level / 7",
- },
-["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.to_a = player.to_a + player.lev
- player.dis_to_a = player.dis_to_a + player.lev
- player.pspeed = player.pspeed - (player.lev / 7)
- if player.lev >= 40 then player.xtra_f2 = bor(player.xtra_f2, TR2_IM_FIRE) end
- end,
- },
-}
-
-CORRUPT_DEMON_BREATH = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Demon Breath",
- ["get_text"] = "Your breath becomes mephitic.",
- ["lose_text"] = "Your breath is once again normal.",
- ["desc"] =
- {
- " Provides fire breath",
- " But gives a small chance to spoil potions when you quaff them",
- },
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_BR_FIRE)
- end,
- [HOOK_QUAFF] = function(obj)
- if magik(9) == TRUE then
- msg_print("Your demon breath spoils the potion!")
- return TRUE, FALSE
- else
- return FALSE
- end
- end,
- },
-}
-
-CORRUPT_DEMON_REALM = add_corruption
-{
- ["color"] = TERM_L_RED,
- ["name"] = "Demon Realm",
- ["get_text"] = "You feel more attuned to the demon realm.",
- ["lose_text"] = "You lose your attunement to the demon realm.",
- ["desc"] =
- {
- " Provides access to the demon school skill and the use of demonic equipment",
- " You need Demon Spirit, Demon Hide and Demon Breath to activate it"
- },
- ["depends"] =
- {
- [CORRUPT_DEMON_SPIRIT] = TRUE,
- [CORRUPT_DEMON_HIDE] = TRUE,
- [CORRUPT_DEMON_BREATH] = TRUE
- },
-["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- -- 1500 may seem a lot, but people are rather unlikely to get the corruption very soon
- -- due to the dependencies
- if s_info[SKILL_DAEMON + 1].mod == 0 then s_info[SKILL_DAEMON + 1].mod = 1500 end
- s_info[SKILL_DAEMON + 1].hidden = FALSE;
- end,
- },
-}
-
-
--- Teleportation corruptions
-
--- Random teleportation will ask for confirmation 70% of the time
--- But 30% of the time it will teleport, without asking
-CORRUPT_RANDOM_TELEPORT = add_corruption
-{
- ["color"] = TERM_GREEN,
- ["name"] = "Random teleportation",
- ["get_text"] = "Space seems to fizzle around you.",
- ["lose_text"] = "Space solidify again around you.",
- ["desc"] =
- {
- " Randomly teleports you around",
- },
-["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- -- No oppose field, it will be automatically set when we declare the anti-telep corruption to oppose us
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.xtra_f3 = bor(player.xtra_f3, TR3_TELEPORT)
- end,
- [HOOK_PROCESS_WORLD] = function()
- if rand_int(300) == 1 then
- if magik(70) == TRUE then
- if get_check("Teleport?") == TRUE then
- teleport_player(50)
- end
- else
- disturb(0, 0)
- msg_print("Your corruption takes over you, you teleport!")
- teleport_player(50)
- end
- end
- end,
- },
-}
-
--- Anti-teleportation corruption, can be stopped with this power
-CORRUPT_ANTI_TELEPORT = add_corruption
-{
- ["color"] = TERM_GREEN,
- ["name"] = "Anti-teleportation",
- ["get_text"] = "Space continuum freezes around you.",
- ["lose_text"] = "Space continuum can once more be altered around you.",
- ["desc"] =
- {
- " Prevents all teleportations, be it of you or monsters",
- },
- ["oppose"] =
- {
- [CORRUPT_RANDOM_TELEPORT] = TRUE
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_BIRTH_OBJECTS] = function()
- player.corrupt_anti_teleport_stopped = FALSE
- end,
- [HOOK_CALC_POWERS] = function()
- player.add_power(POWER_COR_SPACE_TIME)
- end,
- [HOOK_CALC_BONUS] = function()
- if player.corrupt_anti_teleport_stopped == FALSE then
- player.resist_continuum = TRUE
- end
- end,
- [HOOK_PROCESS_WORLD] = function()
- if player.corrupt_anti_teleport_stopped == TRUE then
- local amt = player.msp + player.csp
- amt = amt / 100
- if (amt < 1) then amt = 1 end
- increase_mana(-amt)
- if player.csp == 0 then
- player.corrupt_anti_teleport_stopped = FALSE
- msg_print("You stop controlling your corruption.")
- player.update = bor(player.update, PU_BONUS)
- end
- end
- end,
- },
-}
-
-
--- Troll blood
-CORRUPT_TROLL_BLOOD = add_corruption
-{
- ["color"] = TERM_GREEN,
- ["name"] = "Troll Blood",
- ["get_text"] = "Your blood thickens, you sense corruption in it.",
- ["lose_text"] = "Your blood returns to a normal state.",
- ["desc"] =
- {
- " Troll blood flows in your veins, granting increased regeneration",
- " It also enables you to feel the presence of other troll beings",
- " But it will make your presence more noticeable and aggravating",
- },
- ["can_gain"] = function()
- -- Ok trolls should not get this one. never.
- local str = get_race_name()
- if (str == "Maia") or (str == "Troll") then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN, TR3_AGGRAVATE)
- player.xtra_esp = bor(player.xtra_esp, ESP_TROLL)
- end,
- },
-}
-
--- The vampire corruption set
-CORRUPT_VAMPIRE_TEETH = add_corruption
-{
- ["group"] = "Vampire",
- ["removable"] = FALSE,
- ["color"] = TERM_L_DARK,
- ["name"] = "Vampiric Teeth",
- ["get_text"] = "You grow vampiric teeth!",
- ["lose_text"] = "BUG! this should not happen",
- ["desc"] =
- {
- " Your teeth allow you to drain blood to feed yourself",
- " However your stomach now only accepts blood.",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["allow"] = function()
- if test_race_flags(1, PR1_NO_SUBRACE_CHANGE) == FALSE then return not nil else return nil end
- end,
- ["gain"] = function()
- switch_subrace(SUBRACE_SAVE, TRUE);
-
- subrace_add_power(subrace(SUBRACE_SAVE), PWR_VAMPIRISM)
- subrace(SUBRACE_SAVE).flags1 = bor(subrace(SUBRACE_SAVE).flags1, PR1_VAMPIRE, PR1_UNDEAD, PR1_NO_SUBRACE_CHANGE)
- end,
- ["hooks"] =
- {
- },
-}
-CORRUPT_VAMPIRE_STRENGTH = add_corruption
-{
- ["group"] = "Vampire",
- ["removable"] = FALSE,
- ["color"] = TERM_L_DARK,
- ["name"] = "Vampiric Strength",
- ["get_text"] = "Your body seems more dead than alive.",
- ["lose_text"] = "BUG! this should not happen",
- ["desc"] =
- {
- " Your body seems somewhat dead",
- " In this near undead state it has improved strength, constitution and intelligence",
- " But reduced dexterity, wisdom and charisma.",
- },
- ["depends"] =
- {
- [CORRUPT_VAMPIRE_TEETH] = TRUE,
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["gain"] = function()
- -- Apply the bonuses/penalities
- subrace(SUBRACE_SAVE).r_mhp = subrace(SUBRACE_SAVE).r_mhp + 1
- subrace(SUBRACE_SAVE).r_exp = subrace(SUBRACE_SAVE).r_exp + 100
-
- subrace(SUBRACE_SAVE).r_adj[A_STR + 1] = subrace(SUBRACE_SAVE).r_adj[A_STR + 1] + 3
- subrace(SUBRACE_SAVE).r_adj[A_INT + 1] = subrace(SUBRACE_SAVE).r_adj[A_INT + 1] + 2
- subrace(SUBRACE_SAVE).r_adj[A_WIS + 1] = subrace(SUBRACE_SAVE).r_adj[A_WIS + 1] - 3
- subrace(SUBRACE_SAVE).r_adj[A_DEX + 1] = subrace(SUBRACE_SAVE).r_adj[A_DEX + 1] - 2
- subrace(SUBRACE_SAVE).r_adj[A_CON + 1] = subrace(SUBRACE_SAVE).r_adj[A_CON + 1] + 1
- subrace(SUBRACE_SAVE).r_adj[A_CHR + 1] = subrace(SUBRACE_SAVE).r_adj[A_CHR + 1] - 4
-
- -- be reborn!
- do_rebirth()
- cmsg_print(TERM_L_DARK, "You feel death slipping inside.")
- end,
- ["hooks"] =
- {
- },
-}
-CORRUPT_VAMPIRE_VAMPIRE = add_corruption
-{
- ["group"] = "Vampire",
- ["removable"] = FALSE,
- ["color"] = TERM_L_DARK,
- ["name"] = "Vampire",
- ["get_text"] = "You die to be reborn in a Vampire form.",
- ["lose_text"] = "BUG! this should not happen",
- ["desc"] =
- {
- " You are a Vampire. As such you resist cold, poison, darkness and nether.",
- " Your life is sustained, but you cannot stand the light of the sun."
- },
- ["depends"] =
- {
- [CORRUPT_VAMPIRE_STRENGTH] = TRUE,
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["gain"] = function()
- -- Be a Vampire and be proud of it
- local title = get_subrace_title(SUBRACE_SAVE)
- if title == " " or title == "Vampire" then
- title = "Vampire"
- subrace(SUBRACE_SAVE).place = FALSE
- else
- title = "Vampire "..title
- end
- set_subrace_title(SUBRACE_SAVE, title)
-
- -- Bonus/and .. not bonus :)
- subrace(SUBRACE_SAVE).flags1 = bor(subrace(SUBRACE_SAVE).flags1, PR1_HURT_LITE)
- subrace(SUBRACE_SAVE).oflags2[2] = bor(subrace(SUBRACE_SAVE).oflags2[2], TR2_RES_POIS, TR2_RES_NETHER, TR2_RES_COLD, TR2_RES_DARK, TR2_HOLD_LIFE)
- subrace(SUBRACE_SAVE).oflags3[2] = bor(subrace(SUBRACE_SAVE).oflags3[2], TR3_LITE1)
- end,
- ["hooks"] =
- {
- },
-}
-
--- The old activable corruptions / mutations
-
-MUT1_SPIT_ACID = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Ancalagon's Breath",
- ["get_text"] = "You gain the ability to spit acid.",
- ["lose_text"] = "You lose the ability to spit acid.",
- ["desc"] =
- {
- " Fires an acid ball.",
- " Damage=level Radius 1+(level/30)",
- " Level=9, Cost=9, Stat=DEX, Difficulty=15",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_SPIT_ACID)
- end,
- },
-}
-
-MUT1_BR_FIRE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Smaug's Breath",
- ["get_text"] = "You gain the ability to breathe fire.",
- ["lose_text"] = "You lose the ability to breathe fire.",
- ["desc"] =
- {
- " Fires a fire ball.",
- " Damage=2*level Radius 1+(level/20)",
- " Level=20, Cost=10, Stat=CON, Difficulty=18",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_BR_FIRE)
- end,
- },
-}
-
-MUT1_HYPN_GAZE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Glaurung's Gaze",
- ["get_text"] = "Your eyes look mesmerizing...",
- ["lose_text"] = "Your eyes look uninteresting.",
- ["desc"] =
- {
- " Tries to make a monster your pet.",
- " Power=level",
- " Level=12, Cost=12, Stat=CHR, Difficulty=18",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_HYPN_GAZE)
- end,
- },
-}
-
-MUT1_TELEKINES = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Saruman's Power",
- ["get_text"] = "You gain the ability to move objects telekinetically.",
- ["lose_text"] = "You lose the ability to move objects telekinetically.",
- ["desc"] =
- {
- " Move an object in line of sight to you.",
- " Max weight equal to (level) pounds",
- " Level=9, Cost=9, Stat=WIS, Difficulty=14",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_TELEKINES)
- end,
- },
-}
-
-MUT1_VTELEPORT = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Teleport",
- ["get_text"] = "You gain the power of teleportation at will.",
- ["lose_text"] = "You lose the power of teleportation at will.",
- ["desc"] =
- {
- " Teleports the player at will.",
- " Distance 10+4*level squares",
- " Level=7, Cost=7, Stat=WIS, Difficulty=15",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_VTELEPORT)
- end,
- },
-}
-
-MUT1_MIND_BLST = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Glaurung's Spell",
- ["get_text"] = "You gain the power of Mind Blast.",
- ["lose_text"] = "You lose the power of Mind Blast.",
- ["desc"] =
- {
- " Fires a mind blasting bolt (psi damage).",
- " Psi Damage (3+(level-1)/5)d3",
- " Level=5, Cost=3, Stat=WIS, Difficulty=15",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_MIND_BLST)
- end,
- },
-}
-
-MUT1_VAMPIRISM = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Vampiric Drain",
- ["get_text"] = "You become vampiric.",
- ["lose_text"] = "You are no longer vampiric.",
- ["desc"] =
- {
- " You can drain life from a foe like a vampire.",
- " Drains (level+1d(level))*(level/10) hitpoints,",
- " heals you and satiates you. Doesn't work on all monsters",
- " Level=4, Cost=5, Stat=CON, Difficulty=9",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_VAMPIRISM)
- end,
- },
-}
-
-MUT1_SMELL_MET = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Carcharoth's Nose",
- ["get_text"] = "You smell a metallic odour.",
- ["lose_text"] = "You no longer smell a metallic odour.",
- ["desc"] =
- {
- " You can detect nearby precious metal (treasure).",
- " Radius 25",
- " Level=3, Cost=2, Stat=INT, Difficulty=12",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_SMELL_MET)
- end,
- },
-}
-
-MUT1_SMELL_MON = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Huan's Nose",
- ["get_text"] = "You smell filthy monsters.",
- ["lose_text"] = "You no longer smell filthy monsters.",
- ["desc"] =
- {
- " You can detect nearby monsters.",
- " Radius 25",
- " Level=5, Cost=4, Stat=INT, Difficulty=15",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_SMELL_MON)
- end,
- },
-}
-
-MUT1_BLINK = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Blink",
- ["get_text"] = "You gain the power of minor teleportation.",
- ["lose_text"] = "You lose the power of minor teleportation.",
- ["desc"] =
- {
- " You can teleport yourself short distances (10 squares).",
- " Level=3, Cost=3, Stat=WIS, Difficulty=12",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_BLINK)
- end,
- },
-}
-
-MUT1_EAT_ROCK = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Eat Rock",
- ["get_text"] = "The walls look delicious.",
- ["lose_text"] = "The walls look unappetizing.",
- ["desc"] =
- {
- " You can consume solid rock with food benefit,",
- " leaving an empty space behind.",
- " Level=8, Cost=12, Stat=CON, Difficulty=18",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_EAT_ROCK)
- end,
- },
-}
-
-MUT1_SWAP_POS = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Swap Position",
- ["get_text"] = "You feel like walking a mile in someone else's shoes.",
- ["lose_text"] = "You feel like staying in your own shoes.",
- ["desc"] =
- {
- " You can switch locations with another being,",
- " unless it resists teleportation.",
- " Level=15, Cost=12, Stat=DEX, Difficulty=16",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_SWAP_POS)
- end,
- },
-}
-
-MUT1_SHRIEK = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Shriek",
- ["get_text"] = "Your vocal cords get much tougher.",
- ["lose_text"] = "Your vocal cords get much weaker.",
- ["desc"] =
- {
- " Fires a sound ball and aggravates monsters.",
- " Damage=level*4, Radius=8, centered on player",
- " Level=4, Cost=4, Stat=CON, Difficulty=6",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_SHRIEK)
- end,
- },
-}
-
-MUT1_ILLUMINE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Illuminate",
- ["get_text"] = "You can light up rooms with your presence.",
- ["lose_text"] = "You can no longer light up rooms with your presence.",
- ["desc"] =
- {
- " You can emit bright light that illuminates an area.",
- " Damage=2d(level/2) Radius=(level/10)+1",
- " Level=3, Cost=2, Stat=INT, Difficulty=10",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_ILLUMINE)
- end,
- },
-}
-
-MUT1_DET_CURSE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Detect Curses",
- ["get_text"] = "You can feel evil magics.",
- ["lose_text"] = "You can no longer feel evil magics.",
- ["desc"] =
- {
- " You can feel the danger of evil magic.",
- " It detects cursed items in the inventory",
- " Level=7, Cost=14, Stat=WIS, Difficulty=14",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_DET_CURSE)
- end,
- },
-}
-
-MUT1_BERSERK = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Berserk",
- ["get_text"] = "You feel a controlled rage.",
- ["lose_text"] = "You no longer feel a controlled rage.",
- ["desc"] =
- {
- " You can drive yourself into a berserk frenzy.",
- " It grants super-heroism. Duration=10+1d(level)",
- " Level=8, Cost=8, Stat=STR, Difficulty=14",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_BERSERK)
- end,
- },
-}
-
-
-MUT1_MIDAS_TCH = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Midas touch",
- ["get_text"] = "You gain the Midas touch.",
- ["lose_text"] = "You lose the Midas touch.",
- ["desc"] =
- {
- " You can turn ordinary items to gold.",
- " Turns a non-artifact object into 1/3 its value in gold",
- " Level=10, Cost=5, Stat=INT, Difficulty=12",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_MIDAS_TCH)
- end,
- },
-}
-
-MUT1_GROW_MOLD = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Grow Mold",
- ["get_text"] = "You feel a sudden affinity for mold.",
- ["lose_text"] = "You feel a sudden dislike for mold.",
- ["desc"] =
- {
- " You can cause mold to grow near you.",
- " Summons up to 8 molds around the player",
- " Level=1, Cost=6, Stat=CON, Difficulty=14",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_GROW_MOLD)
- end,
- },
-}
-
-MUT1_RESIST = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Resist Elements",
- ["get_text"] = "You feel like you can protect yourself.",
- ["lose_text"] = "You feel like you might be vulnerable.",
- ["desc"] =
- {
- " You can harden yourself to the ravages of the elements.",
- " Level-dependent chance of gaining resistances to the four ",
- " elements and poison. Duration=20 + d20",
- " Level=10, Cost=12, Stat=CON, Difficulty=12",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_RESIST)
- end,
- },
-}
-
-MUT1_EARTHQUAKE = add_corruption
-{
- ["color"] = TERM_RED,
- ["name"] = "Earthquake",
- ["get_text"] = "You gain the ability to wreck the dungeon.",
- ["lose_text"] = "You lose the ability to wreck the dungeon.",
- ["desc"] =
- {
- " You can bring down the dungeon around your ears.",
- " Radius=10, center on the player",
- " Level=12, Cost=12, Stat=STR, Difficulty=16",
- },
- ["can_gain"] = function()
- -- Maiar can't get this one!
- local str = get_race_name()
- if str == "Maia" then
- return nil
- else
- return not nil
- end
- end,
- ["hooks"] =
- {
- [HOOK_CALC_POWERS] = function()
- player.add_power(PWR_EARTHQUAKE)
- end,
- },
-}
---[[
-CORRUPT_ = add_corruption
-{
- ["color"] = TERM_GREEN,
- ["name"] = "",
- ["get_text"] = "",
- ["lose_text"] = "",
- ["desc"] =
- {
- " ",
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- end,
- },
-}
-]]
diff --git a/lib/mods/theme/scpt/drunk.lua b/lib/mods/theme/scpt/drunk.lua
deleted file mode 100644
index 7d90af8d..00000000
--- a/lib/mods/theme/scpt/drunk.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- silly function that allows a drunk to take a bottle of wine/ale from the player
-
-function drunk_takes_wine(m_idx, item)
-
- m_ptr = monster(m_idx)
- o_ptr = get_object(item)
-
- if (m_ptr.r_idx == test_monster_name("Singing, happy drunk"))
- and (o_ptr.tval == TV_FOOD) and ((o_ptr.sval == 38) or (o_ptr.sval == 39)) then
-
- cmsg_print(TERM_YELLOW, "'Hic!'")
-
- inven_item_increase(item, -1)
- inven_item_optimize(item)
- return TRUE
- else
- return FALSE
- end
-end
-
-add_hook_script(HOOK_GIVE, "drunk_takes_wine", "drunk_takes_wine")
diff --git a/lib/mods/theme/scpt/fireprof.lua b/lib/mods/theme/scpt/fireprof.lua
deleted file mode 100644
index 8691b821..00000000
--- a/lib/mods/theme/scpt/fireprof.lua
+++ /dev/null
@@ -1,415 +0,0 @@
--- The Old Mages/Fireproofing quest: Bring back a rune from a fiery cave and get some books/scrolls/staves fireproofed in return
-
-fireproof_quest = {}
-
-
--- change this constant (and the FOO_POINTS ones) to adjust the no of items fire-proofed as a reward
-fireproof_quest.TOTAL_ITEM_POINTS = 24
-
--- These constants are how many 'points' each type of item will take up. So currently, you can fireproof 3 books, 4 staves or 12 scrolls.
-fireproof_quest.BOOK_POINTS = 4
-fireproof_quest.STAFF_POINTS = 3
-fireproof_quest.SCROLL_POINTS = 1
-
-add_quest
-{
- ["global"] = "FIREPROOF_QUEST",
- ["name"] = "Old Mages quest",
- ["desc"] = function()
- local num_books, num_staff, num_scroll
-
- num_books = fireproof_quest.item_points_remaining / fireproof_quest.BOOK_POINTS
- num_staff = fireproof_quest.item_points_remaining / fireproof_quest.STAFF_POINTS
- num_scroll = fireproof_quest.item_points_remaining / fireproof_quest.SCROLL_POINTS
-
- -- Quest taken
- if (quest(FIREPROOF_QUEST).status == QUEST_STATUS_TAKEN) then
- print_hook("#####yAn Old Mages Quest!\n")
- print_hook("Retrieve the strange rune for the old mage in Lothlorien.\n")
- print_hook("\n")
- -- essence retrieved, not taken to mage
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_COMPLETED) then
- print_hook("#####yAn Old Mages Quest!\n")
- print_hook("You have retrieved the rune for the old mage in Lothlorien. Perhaps you \n")
- print_hook("should see about a reward.\n")
- print_hook("\n")
- -- essence returned, not all books fireproofed
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_FINISHED) and (fireproof_quest.item_points_remaining > 0) then
- print_hook("#####yAn Old Mages Quest!\n")
- print_hook("You have retrieved the rune for the old mage in Lothlorien. He will still \n")
- print_hook("fireproof "..num_books.." book(s) or "..num_staff.." staff/staves or "..num_scroll.." scroll(s) for you.\n")
- print_hook("\n")
- end
- end,
- ["level"] = 20,
- ["data"] = {
- -- store some variables
- ["fireproof_quest.item_points_remaining"] = fireproof_quest.TOTAL_ITEM_POINTS,
- ["fireproof_quest.essence"] = 0,
- },
- ["hooks"] = {
- -- Start the game without the quest, need to request it
- [HOOK_BIRTH_OBJECTS] = function()
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_UNTAKEN
-
- -- reset some variables on birth
- fireproof_quest.item_points_remaining = fireproof_quest.TOTAL_ITEM_POINTS
- fireproof_quest.essence = 0
- end,
- [HOOK_GEN_QUEST] = function()
- local essence, y, x, traps, tries, trap_y, trap_x, grid
-
- -- Only if player doing this quest
- if (player.inside_quest ~= FIREPROOF_QUEST) then
- return FALSE
- else
- -- load the map
- load_map("fireprof.map", 2, 2)
-
- -- no teleport
- level_flags2 = DF2_NO_TELEPORT
-
- -- determine type of rune
- fireproof_quest.essence = randint(5)
-
- -- create essence
- essence = create_object(TV_RUNE2, fireproof_quest.essence)
-
- -- mark rune
- essence.pval2 = fireproof_quest.essence
- essence.note = quark_add("quest")
-
- -- roll for co-ordinates in top half of map
- y = randint(3) + 2
- x = randint(45) + 2
-
- -- drop it
- drop_near(essence, -1, y, x)
-
- -- how many traps to generate
- traps = rand_range(10, 30)
-
- -- generate the traps
- while (traps > 0) do
-
- -- initialise tries variable
- tries = 0
-
- -- make sure it's a safe place
- while (tries == 0) do
-
- -- get grid coordinates
- trap_y = randint(19) + 2
- trap_x = randint(45) + 2
- grid = cave(trap_y, trap_x)
-
- -- are the coordinates on a stair, or a wall?
- if (cave_is(grid, FF1_PERMANENT) ~= 0) or (cave_is(grid, FF1_FLOOR) == 0) then
-
- -- try again
- tries = 0
- else
- -- not a stair, then stop this 'while'
- tries = 1
- end
- end
-
- -- randomise level of trap
- trap_level = rand_range(20, 40)
-
- -- put the trap there
- place_trap(trap_y, trap_x, trap_level)
-
- -- that's one less trap to place
- traps = traps - 1
- end
- return TRUE
- end
- end,
- [HOOK_STAIR] = function()
- local ret
-
- -- only ask this if player about to go up stairs of quest and hasn't retrieved rune
- if (player.inside_quest ~= FIREPROOF_QUEST) or
- (quest(FIREPROOF_QUEST).status == QUEST_STATUS_COMPLETED) then
- return FALSE
- else
- if cave(player.py, player.px).feat ~= FEAT_LESS then return end
-
- -- flush all pending input
- flush()
-
- -- confirm
- ret = get_check("Really abandon the quest?")
-
- -- if yes, then
- if (ret == TRUE) then
-
- -- fail the quest
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_FAILED
- return FALSE
- else
- -- if no, they stay in the quest
- return TRUE
- end
- end
- end,
- [HOOK_GET] = function(o_ptr)
-
- -- if they're in the quest and haven't picked up the rune already, continue
- if (player.inside_quest ~= FIREPROOF_QUEST) or
- (quest(FIREPROOF_QUEST).status == QUEST_STATUS_COMPLETED) then
- return FALSE
- else
-
- -- check that it's the real rune and not another one generated via the random object placing in fireproof.map
- if (o_ptr.pval2 == fireproof_quest.essence) then
-
- -- ok mark the quest 'completed'
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_COMPLETED
- msg_print(TERM_YELLOW, "Fine! Looks like you've found it.")
- end
- end
- end,
-
- },
-}
-
--- add the bit that determines what happens when the request 'q'uest bit is done in the wizard spire
-add_building_action
-{
- -- Index is used in ba_info.txt to set the actions
- ["index"] = 56,
- ["action"] = function()
-
- local num_books, num_staff, num_scroll
-
- num_books = fireproof_quest.item_points_remaining / fireproof_quest.BOOK_POINTS
- num_staff = fireproof_quest.item_points_remaining / fireproof_quest.STAFF_POINTS
- num_scroll = fireproof_quest.item_points_remaining / fireproof_quest.SCROLL_POINTS
-
- -- the quest hasn;t been requested already, right?
- if quest(FIREPROOF_QUEST).status == QUEST_STATUS_UNTAKEN then
-
- -- quest has been taken now
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_TAKEN
- fireproof_quest.item_points_remaining = fireproof_quest.TOTAL_ITEM_POINTS
-
- -- issue instructions
- msg_print("I need a very special rune for a spell I am working on. I am too old to ")
- msg_print("fetch it myself. Please bring it back to me. You can find it north of here.")
- msg_print("Be careful with it, it's fragile and might be destroyed easily.")
-
- return TRUE, FALSE, TRUE
- -- if quest completed (rune was retrieved)
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_COMPLETED) then
-
- -- ask for rune
- ret, item = get_item("Which rune?",
- "You have no runes to return",
- bor(USE_INVEN),
- function (obj)
-
- -- check it's the 'marked' rune
- if (obj.tval == TV_RUNE2) and (obj.sval == fireproof_quest.essence) and (obj.pval2 == fireproof_quest.essence) then
- return TRUE
- end
- return FALSE
- end
- )
-
- -- didn't get the rune?
- if (ret == FALSE) then
- return TRUE
-
- -- got the rune!
- else
-
- -- take rune
- inven_item_increase(item, -1)
- inven_item_optimize(item)
- msg_print("Great! Let me fireproof some of your items in thanks. I can do "..num_books.." books, ")
- msg_print(num_staff.." staves, or "..num_scroll.." scrolls.")
-
- -- how many items to proof?
- local items = fireproof_quest.item_points_remaining
-
- -- repeat till up to 3 (value defined as TOTAL_ITEM_POINTS constant) books fireproofed
- while items > 0 do
- ret = fireproof()
-
- -- don't loop the fireproof if there's nothing to fireproof
- if ret == FALSE then
- break
- end
-
- -- subtract item points
- items = fireproof_quest.item_points_remaining
- end
-
- -- have they all been done?
- if (fireproof_quest.item_points_remaining == 0) then
- -- mark quest to make sure no more quests are given
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_REWARDED
- else
- -- mark in preparation of anymore books to fireproof
- quest(FIREPROOF_QUEST).status = QUEST_STATUS_FINISHED
- end
-
-
- end
-
- -- if the player asks for a quest when they already have it, but haven't failed it, give them some extra instructions
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_TAKEN) then
- msg_print("The rune is in a cave just behind the shop.")
-
- -- ok not all books have been fireproofed... lets do the rest
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_FINISHED) then
-
- -- how many books still to proof?
- local items = fireproof_quest.item_points_remaining
-
- -- repeat as necessary
- while items > 0 do
- ret = fireproof()
-
- -- don't loop the fireproof if there's nothing to fireproof
- if ret == FALSE then
- break
- else
- -- have they all been done?
- if (fireproof_quest.item_points_remaining == 0) then quest(FIREPROOF_QUEST).status = QUEST_STATUS_REWARDED end
- end
-
- -- subtract item points
- items = fireproof_quest.item_points_remaining
- end
-
- -- quest failed or completed, then give no more quests
- elseif (quest(FIREPROOF_QUEST).status == QUEST_STATUS_FAILED) or (quest(FIREPROOF_QUEST).status == QUEST_STATUS_REWARDED) then
- msg_print("I have no more quests for you")
- end
- return TRUE
- end,
-}
-
--- the routine that checks for a book and actually fireproofs it
-function fireproof()
-
- local ret, item, obj2, stack, obj3, carry_it
-
- ret, item = get_item("Which item shall I fireproof?",
- "You have no more items I can fireproof, come back when you have some.",
- bor(USE_INVEN),
- function (obj)
-
- -- get some flags
- local f1, f2, f3, f4, f5, esp = object_flags(obj)
-
- -- is it a book/staff/scroll, is it already fireproof?
- if ((obj.tval == TV_BOOK) or (obj.tval == TV_SCROLL) or (obj.tval == TV_STAFF)) and (band(f3, TR3_IGNORE_FIRE) == 0) then
- return TRUE
- end
- return FALSE
- end
- )
-
- -- get the object type from the number
- obj2 = get_object(item)
-
- -- check we have enough points (if we 'got' an item)
- if (ret == TRUE) then
- ret2, stack = enough_points(obj2)
- end
-
- -- did either routine fail?
- if (ret == FALSE) or (ret2 == FALSE) then
- return FALSE
- else
-
- -- are we part of the items from a stack?
- if (obj2.number ~= stack) then
-
- -- make a new object to handle
- object_copy(obj_forge, obj2)
-
- -- give it the right number of items
- obj_forge.number = stack
-
- -- adjust for number of items in pack not to be fireproofed
- obj2.number = obj2.number - stack
- obj3 = obj_forge
-
- -- we'll need to add this to the inventory after fireproofing
- carry_it = TRUE
- else
-
- -- use the whole stack
- obj3 = obj2
-
- -- we'll be dealing this while it's still in the inventory
- carry_it = FALSE
- end
-
- -- make it fireproof
- obj3.name2 = 149
-
- -- apply it, making sure the pvals don't change with apply_magic (it would change the type of book!)
- local oldpval = obj3.pval
- local oldpval2 = obj3.pval2
- local oldpval3 = obj3.pval3
- apply_magic(obj3, -1, FALSE, FALSE, FALSE)
- obj3.pval = oldpval
- obj3.pval2 = oldpval2
- obj3.pval3 = oldpval3
-
- -- put it in the inventory if it's only part of a stack
- if (carry_it == TRUE) then
- inven_carry(obj3, TRUE)
- end
-
- -- id and notice it
- set_known(obj3)
- set_aware(obj3)
-
- return TRUE
- end
-end
-
--- This function makes sure the player has enough 'points' left to fireproof stuff.
-function enough_points(obj)
- local item_value, stack
-
- -- are the items in a stack?
- if (obj.number > 1) then
-
- -- how many to fireproof?
- stack = get_quantity("How many would you like fireproofed?", obj.number)
- else
- stack = 1
- end
-
- -- check for item type and multiply number in the stack by the amount of points per item of that type
- if (obj.tval == TV_BOOK) then
- item_value = fireproof_quest.BOOK_POINTS * stack
- elseif (obj.tval == TV_STAFF) then
- item_value = fireproof_quest.STAFF_POINTS * stack
- elseif (obj.tval == TV_SCROLL) then
- item_value = fireproof_quest.SCROLL_POINTS * stack
- end
-
- -- do we have enough points?
- if (item_value > fireproof_quest.item_points_remaining) then
- msg_print("I do not have enough fireproofing material for that.")
- return FALSE
- else
- -- if so then subtract those points before we do the fireproofing
- fireproof_quest.item_points_remaining = fireproof_quest.item_points_remaining - item_value
- end
-
- -- Used all the points? the quest is completely rewarded.
- if fireproof_quest.item_points_remaining == 0 then quest(FIREPROOF_QUEST).status = QUEST_STATUS_REWARDED end
-
- return TRUE, stack
-end
-
diff --git a/lib/mods/theme/scpt/god.lua b/lib/mods/theme/scpt/god.lua
deleted file mode 100644
index 7567178c..00000000
--- a/lib/mods/theme/scpt/god.lua
+++ /dev/null
@@ -1,812 +0,0 @@
--- The god quest: find randomly placed relic in a randomly placed dungeon!
-
--- set some global variables (stored in the save file via the ["data"] key)
-god_quest = {}
-
--- increase this number to make god quests more common, to a max value of 100
-god_quest.CHANCE_OF_GOD_QUEST = 21
-
--- increase this number to make more quests
-god_quest.MAX_NUM_GOD_QUESTS = 7
-
--- d_idx of the god_quest (Lost Temple) dungeon
-god_quest.DUNGEON_GOD = 30
-
-add_quest
-{
- ["global"] = "GOD_QUEST",
- ["name"] = "God quest",
- ["desc"] = function()
-
- if quest(GOD_QUEST).status == QUEST_STATUS_TAKEN then
-
- -- get the direction that the dungeon lies from lothlorien/angband
- local home, home_axis, home_distance, home2, home2_axis, home2_distance = get_god_quest_axes()
-
- print_hook("#####yGod quest "..god_quest.quests_given.."!\n")
- print_hook("Thou art to find the lost temple of thy God and\n");
- print_hook("to retrieve the lost part of the relic for thy God! \n")
- if home_axis ~= "close" then
- print_hook("The temple lies "..home_distance.." to the "..home_axis.." of "..home..", \n")
- else
- print_hook("The temple lies very close to "..home..", \n")
- end
- if home2_axis ~= "close" then
- print_hook( "and "..home2_distance.." to the "..home2_axis.." of "..home2..", I can feel it.' \n")
- else
- print_hook("and very close to "..home2..", I can feel it.' \n")
- end
- print_hook("\n")
- end
- end,
- ["level"] = -1,
- ["data"] = {
- ["god_quest.relic_num"] = 1,
- ["god_quest.quests_given"] = 0,
- ["god_quest.relics_found"] = 0,
- ["god_quest.dun_mindepth"] = 1,
- ["god_quest.dun_maxdepth"] = 4,
- ["god_quest.dun_minplev"] = 0,
- ["god_quest.relic_gen_tries"] = 0,
- ["god_quest.relic_generated"] = FALSE,
- ["god_quest.dung_x"] = 1,
- ["god_quest.dung_y"] = 1,
- ["god_quest.player_x"] = 0,
- ["god_quest.player_y"] = 0,
- },
- ["hooks"] = {
- -- Start the game without the quest, given it by chance
- [HOOK_BIRTH_OBJECTS] = function()
- quest(GOD_QUEST).status = QUEST_STATUS_UNTAKEN
-
- -- initialise save-file stored variables when new character is created
- god_quest.relic_num = 1
- god_quest.quests_given = 0
- god_quest.relics_found = 0
- god_quest.dun_mindepth = 1
- god_quest.dun_maxdepth = 4
- god_quest.dun_minplev = 0
- god_quest.relic_gen_tries = 0
- god_quest.relic_generated = FALSE
- end,
- [HOOK_PLAYER_LEVEL] = function(gained)
- local home_axis, home
-
- if gained > 0 then
- -- roll for chance of quest
- local give_god_quest = magik(god_quest.CHANCE_OF_GOD_QUEST)
-
- -- check player is worshipping a god, not already on a god quest.
- if (player.astral ~= FALSE) or (player.pgod <= 0)
- or (quest(GOD_QUEST).status == QUEST_STATUS_TAKEN) or (quest(GOD_QUEST).status == QUEST_STATUS_FAILED)
- or (god_quest.quests_given >= god_quest.MAX_NUM_GOD_QUESTS) or (give_god_quest == FALSE)
- or ((current_dungeon_idx == god_quest.DUNGEON_GOD) and (dun_level > 0)) or (player.lev <= god_quest.dun_minplev) then
- -- Don't let a player get quests with trickery
- if player.lev > god_quest.dun_minplev then
- god_quest.dun_minplev = player.lev
- end
- return
- else
- -- each god has different characteristics, so the quests are differnet depending on your god
- if player.pgod == GOD_ERU then
- god_quest.relic_num = 7
- elseif player.pgod == GOD_MANWE then
- god_quest.relic_num = 8
- elseif player.pgod == GOD_TULKAS then
- god_quest.relic_num = 9
- elseif player.pgod == GOD_MELKOR then
- god_quest.relic_num = 10
- elseif player.pgod == GOD_YAVANNA then
- god_quest.relic_num = 11
- elseif player.pgod == GOD_AULE then
- god_quest.relic_num = 16
- elseif player.pgod == GOD_VARDA then
- god_quest.relic_num = 17
- elseif player.pgod == GOD_ULMO then
- god_quest.relic_num = 18
- elseif player.pgod == GOD_MANDOS then
- god_quest.relic_num = 19
- end
-
- -- This var will need resetting
- god_quest.relic_generated = FALSE
- quest(GOD_QUEST).status = QUEST_STATUS_TAKEN
- god_quest.quests_given = god_quest.quests_given + 1
-
- -- actually place the dungeon in a random place
- place_rand_dung()
-
- -- store the variables of the coords where the player was given the quest
- god_quest.player_y, god_quest.player_x = player.get_wild_coord()
-
- -- establish direction of player and 'home' from dungeon
- local home, home_axis, home_distance, home2, home2_axis, home2_distance = get_god_quest_axes()
-
- -- God issues instructions
- cmsg_print(TERM_L_BLUE, "The voice of "..deity(player.pgod).name.." booms in your head:")
-
- cmsg_print(TERM_YELLOW, "'I have a task for thee.")
- cmsg_print(TERM_YELLOW, "Centuries ago an ancient relic of mine was broken apart.")
- cmsg_print(TERM_YELLOW, "The pieces of it have been lost in fallen temples.")
- cmsg_print(TERM_YELLOW, "Thou art to find my lost temple and retrieve a piece of the relic.")
- cmsg_print(TERM_YELLOW, "When thy task is done, thou art to lift it in the air and call upon my name.")
- cmsg_print(TERM_YELLOW, "I shall then come to reclaim what is mine!")
- if home_axis ~= "close" then
- cmsg_print(TERM_YELLOW, "The temple lies "..home_distance.." to the "..home_axis.." of "..home..", ")
- else
- cmsg_print(TERM_YELLOW, "The temple lies very close to "..home..",")
- end
-
- if home2_axis ~= "close" then
- cmsg_print(TERM_YELLOW, "and "..home2_distance.." to the "..home2_axis.." of "..home2..", I can feel it.'")
- else
- cmsg_print(TERM_YELLOW, "and very close to "..home2..", I can feel it.'")
- end
-
- -- Prepare depth of dungeon. If this was generated in set_god_dungeon_attributes(),
- -- then we'd have trouble if someone levelled up in the dungeon!
- god_quest.dun_mindepth = player.lev*2/3
- god_quest.dun_maxdepth = god_quest.dun_mindepth + 4
- end
- end
- end,
- [HOOK_LEVEL_END_GEN] = function()
- local chance
-
- -- Check for dungeon
- if (current_dungeon_idx ~= god_quest.DUNGEON_GOD) or (quest(GOD_QUEST).status == QUEST_STATUS_UNTAKEN) then
- return
- -- if the relic has been created at this point, then it was created on the *PREVIOUS* call of HOOK_LEVEL_END_GEN, and
- -- therefore the player has caused another level generation in the temple and hence failed the quest.
- elseif (god_quest.relic_generated == TRUE) and quest(GOD_QUEST).status ~= QUEST_STATUS_FAILED then
-
- -- fail the quest, don't give another one, don't give this message again
- quest(GOD_QUEST).status = QUEST_STATUS_FAILED
- -- God issues instructions
- cmsg_print(TERM_L_BLUE, "The voice of "..deity(player.pgod).name.." booms in your head:")
-
- cmsg_print(TERM_YELLOW, "'Thou art a fool!")
- cmsg_print(TERM_YELLOW, "I told thee to look carefully for the relic. It appears thou hast missed the")
- cmsg_print(TERM_YELLOW, "opportunity to claim it in my name, as I sense that those monsters who ")
- cmsg_print(TERM_YELLOW, "have overrun my temple have destroyed it themselves.")
- cmsg_print(TERM_YELLOW, "I shall not ask thee to do such a thing again, as thou hast failed me in this")
- cmsg_print(TERM_YELLOW, "simple task!'")
- else
- -- Force relic generation on 5th attempt if others have been unsuccessful.
- if (god_quest.relic_gen_tries == 4) and (god_quest.relic_generated == FALSE) then
- generate_relic()
- else
- -- 1/5 chance of generation
- chance = randint(5)
- if (chance == 5) then
- generate_relic()
- else
- god_quest.relic_gen_tries = god_quest.relic_gen_tries + 1
- end
- end
- end
- end,
- [HOOK_ENTER_DUNGEON] = function(d_idx)
- -- call the function to set the dungeon variables (dependant on pgod) the first time we enter the dungeon
- if d_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
- end,
- [HOOK_GEN_LEVEL_BEGIN] = function()
- -- call the function to set the dungeon variables (dependant on pgod) when we WoR back into the dungeon
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
- end,
- [HOOK_STAIR] = function()
- -- call the function to set the dungeon variables (dependant on pgod) every time we go down a level
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
- end,
- [HOOK_GET] = function(o_ptr, item)
- -- Is it the relic, and check to make sure the relic hasn't already been identified
- if (quest(GOD_QUEST).status == QUEST_STATUS_TAKEN) and (o_ptr.tval == TV_JUNK) and (o_ptr.sval == god_quest.relic_num)
- and (o_ptr.pval ~= TRUE) and (god_quest.relics_found < god_quest.quests_given) then
-
- -- more God talky-talky
- cmsg_print(TERM_L_BLUE, deity(player.pgod).name.." speaks to you:")
-
- -- Is it the last piece of the relic?
- if (god_quest.quests_given == god_quest.MAX_NUM_GOD_QUESTS) then
- cmsg_print(TERM_YELLOW, "'At last! Thou hast found all of the relic pieces.")
-
- -- reward player by increasing prayer skill
- cmsg_print(TERM_YELLOW, "Thou hast done exceptionally well! I shall increase thy prayer skill even more!'")
- skill(SKILL_PRAY).value = skill(SKILL_PRAY).value + (10 * (skill(SKILL_PRAY).mod))
-
- -- Take the relic piece
- floor_item_increase(item, -1)
- floor_item_optimize(item)
- else
- cmsg_print(TERM_YELLOW, "'Well done! Thou hast found part of the relic.")
- cmsg_print(TERM_YELLOW, "I shall surely ask thee to find more of it later!")
- cmsg_print(TERM_YELLOW, "I will take it from thee for now'")
-
- -- Take the relic piece
- floor_item_increase(item, -1)
- floor_item_optimize(item)
-
- -- reward player by increasing prayer skill
- cmsg_print(TERM_YELLOW, "'As a reward, I shall teach thee how to pray better'")
- skill(SKILL_PRAY).value = skill(SKILL_PRAY).value + (5 * (skill(SKILL_PRAY).mod))
- end
-
- -- relic piece has been identified
- o_ptr.pval = TRUE
- god_quest.relics_found = god_quest.relics_found + 1
-
- -- Make sure quests can be given again if neccesary
- quest(GOD_QUEST).status = QUEST_STATUS_UNTAKEN
- return TRUE
- end
- end,
- [HOOK_CHAR_DUMP] = function()
-
- if (god_quest.quests_given > 0) then
-
- local relics = god_quest.relics_found
- local append_text = ""
- if (god_quest.relics_found == god_quest.MAX_NUM_GOD_QUESTS) then
- relics = "all"
- append_text = " and pleased your god"
- else
- if (god_quest.relics_found == 0) then
- relics = "none"
- end
- if (quest(GOD_QUEST).status == QUEST_STATUS_FAILED) then
- append_text = " and failed in your quest"
- end
- end
-
- print_hook("\n You found "..(relics).." of the relic pieces"..(append_text)..".")
-
- end
- end,
- },
-}
-
--- this function places the lost temple at a randomly determined place.
-function place_rand_dung()
- local tries, grid
-
- -- erase old dungeon
- if (god_quest.quests_given > 0) then
- place_dungeon(god_quest.dung_y, god_quest.dung_x)
-
- -- erase old recall level
- max_dlv[god_quest.DUNGEON_GOD + 1] = 0
- end
-
- -- initialise tries variable
- tries = 1000
-
- while tries > 0 do
-
- tries = tries - 1
- -- get grid coordinates, within a range which prevents dungeon being generated at the very edge of the wilderness (would crash the game).
- god_quest.dung_x = rand_range(1, max_wild_x-2)
- god_quest.dung_y = rand_range(1, max_wild_y-2)
-
- -- Is there a town/dungeon/potentially impassable feature there, ?
- if (wild_map(god_quest.dung_y, god_quest.dung_x).entrance ~= 0)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).entrance ~= 0)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_EDGE)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_WATER)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_TREES)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_SHALLOW_LAVA)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_LAVA)
- or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_MOUNTAIN) then
- -- try again
- else
- --neither player, nor wall, then stop this 'while'
- break
- end
- end
-
- -- Uhuh BAD ! lets use the default location up bree
- if tries == 0 then
- god_quest.dung_x = 32
- god_quest.dung_y = 19
- end
-
- -- create god dungeon in that place
- place_dungeon(god_quest.dung_y, god_quest.dung_x, god_quest.DUNGEON_GOD)
-
-end
-
--- this function generates the relic at a randomly determined place in the temple.
-function generate_relic()
- local tries, grid, x, y, relic
-
- -- initialise tries variable
- tries = 1000
-
- while (tries > 0) do
-
- tries = tries - 1
- -- get grid coordinates from current height/width, minus one to prevent relic being generated in outside wall. (would crash the game)
- y = randint(cur_hgt-1)
- x = randint(cur_wid-1)
- grid = cave(y, x)
-
- -- are the coordinates on a floor, not on a permanent feature (eg stairs), and not on a trap ?
- if (cave_is(grid, FF1_FLOOR) == TRUE) and (cave_is(grid, FF1_PERMANENT) == FALSE) and (grid.t_idx == 0) then break end
-
- end
-
- -- create relic
- relic = create_object(TV_JUNK, god_quest.relic_num)
-
- -- inscribe it to prevent automatizer 'accidents'
- relic.note = quark_add("quest")
-
- -- If no safe co-ords were found, put it in the players backpack
- if tries == 0 then
-
- -- explain it
- msg_print(TERM_L_BLUE, "You luckily stumble across the relic on the stairs!")
-
- if (inven_carry_okay(relic)) then
- inven_carry(relic, FALSE)
- else
- -- no place found, drop it on the stairs
- drop_near(relic, -1, player.py, player.px)
- end
-
- else
- -- drop it
- drop_near(relic, -1, y, x)
- end
-
- -- Only generate once!
- god_quest.relic_generated = TRUE
-
- -- Reset some variables
- god_quest.relic_gen_tries = 0
-
-end
-
-
-
-
-function set_god_dungeon_attributes()
-
- -- dungeon properties altered according to which god player is worshipping,
- if player.pgod == GOD_ERU then
-
- -- The Eru temple is based on Meneltarma.
- -- W: Not too many monsters (they'll be tough though, with big levels)
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 14
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 200
-
- -- L: Dirt and grass. More dirt at bottom, more grass at top. rocky ground would be nice
- dungeon(god_quest.DUNGEON_GOD).floor1 = 88
- dungeon(god_quest.DUNGEON_GOD).floor2 = 89
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 70
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 30
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[2] = 10
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[2] = 90
-
- -- A: Outer wall mountain chain. other walls granite
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 97
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 57
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 97
- dungeon(god_quest.DUNGEON_GOD).fill_method = 2
-
- -- O: "At Meneltarma no weapon or tool had ever been borne" (but invaders would have left a small number)
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 45
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 5
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 45
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 5
-
- -- F: A large pillar, with stairs created at edges. (You can't climb a rock through the middle, can you?)
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_BIG, DF1_NO_DOORS, DF1_CIRCULAR_ROOMS, DF1_EMPTY, DF1_TOWER, DF1_FLAT, DF1_ADJUST_LEVEL_2)
- dungeon(god_quest.DUNGEON_GOD).flags2 = bor(DF2_ADJUST_LEVEL_1_2, DF2_NO_SHAFT, DF2_ADJUST_LEVEL_PLAYER)
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 50
-
- -- M: We want evil or flying characters
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags3 = RF3_EVIL
-
- dungeon(god_quest.DUNGEON_GOD).rules[2].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[2].percent = 50
-
- -- M: We want evil or flying characters
- dungeon(god_quest.DUNGEON_GOD).rules[2].mflags7 = RF7_CAN_FLY
-
-
- elseif player.pgod == GOD_MANWE then
-
- -- Manwe's lost temple is high in the clouds
- -- W: Has average number of monsters.
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 18
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 160
-
-
- -- L: floor will be 'cloud-like vapour' and pools of 'condensing water'
- dungeon(god_quest.DUNGEON_GOD).floor1 = 208
- dungeon(god_quest.DUNGEON_GOD).floor2 = 209
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 85
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 15
-
- -- A: Outer wall is 'hail stone wall', inner wall 'dense fog'. FIlled at max smoothing, like islands.
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 211
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 210
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 211
- dungeon(god_quest.DUNGEON_GOD).fill_method = 4
-
- -- O: Can't imagine Manwe having much treasure. Little need for tools in a cloud temple. lots of magical stuff though...
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 15
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 25
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 55
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 5
-
- -- F: It's open, goes up like a tower, give it a few interesting rooms, make the monsters hard(ish).
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DOORS, DF1_TOWER, DF1_CAVERN, DF1_ADJUST_LEVEL_2)
- dungeon(god_quest.DUNGEON_GOD).flags2 = bor(DF2_NO_SHAFT, DF2_ADJUST_LEVEL_PLAYER)
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[2].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[2].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[3].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[3].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[4].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[4].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[5].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[5].percent = 20
-
- -- M: We want air(poison-type) or flying characters. Orcs too. They would have ransacked his elf-loving temple :)
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags2 = RF2_INVISIBLE
- dungeon(god_quest.DUNGEON_GOD).rules[2].mflags3 = bor(RF3_ORC, RF3_IM_POIS)
- dungeon(god_quest.DUNGEON_GOD).rules[3].mflags4 = bor(RF4_BR_POIS, RF4_BR_GRAV)
- dungeon(god_quest.DUNGEON_GOD).rules[4].mflags5 = RF5_BA_POIS
- dungeon(god_quest.DUNGEON_GOD).rules[5].mflags7 = RF7_CAN_FLY
-
-
- elseif player.pgod == GOD_TULKAS then
-
- -- Tulkas dungeon is quite normal, possibly a bit boring to be honest. Maybe I should add something radical to it.
- -- 'The house of Tulkas in the midmost of Valmar was a house of mirth and revelry. It sprang into the air with many storeys,
- -- and had a tower of bronze and pillars of copper in a wide arcade'
- -- W: but with lots of monsters
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 20
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 120
-
- -- L: floor is normal
- dungeon(god_quest.DUNGEON_GOD).floor1 = 1
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 100
-
- -- A: Granite walls
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 56
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 58
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 57
- dungeon(god_quest.DUNGEON_GOD).fill_method = 0
-
- -- O: Loads of combat drops
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 10
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 70
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 5
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 15
-
- -- F: fairly standard
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DESTROY, DF1_ADJUST_LEVEL_2)
- dungeon(god_quest.DUNGEON_GOD).flags2 = DF2_ADJUST_LEVEL_PLAYER
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 100
-
- -- M: plenty demons please
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags3 = bor(RF3_DEMON, RF3_EVIL)
-
-
- elseif player.pgod == GOD_MELKOR then
-
- -- Melkors dungeon will be dark, fiery and stuff
- -- Many many monsters! (but prob ADJUST_LEVEL_1_2)
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 24
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 80
-
-
- -- L: floor is dirt/mud/nether
- dungeon(god_quest.DUNGEON_GOD).floor1 = 88
- dungeon(god_quest.DUNGEON_GOD).floor2 = 94
- dungeon(god_quest.DUNGEON_GOD).floor3 = 102
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 45
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 45
- dungeon(god_quest.DUNGEON_GOD).floor_percent3[1] = 10
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[2] = 35
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[2] = 35
- dungeon(god_quest.DUNGEON_GOD).floor_percent3[2] = 30
-
- -- A: Granite walls to fill but glass walls for room perimeters (you can see the nasty monsters coming)
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 188
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 188
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 57
- dungeon(god_quest.DUNGEON_GOD).fill_method = 1
-
- -- O: Even drops
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 25
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 25
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 25
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 25
-
- -- F: Small, lava rivers, nasty monsters hehehehehe
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_SMALL, DF1_LAVA_RIVERS, DF1_ADJUST_LEVEL_1)
- dungeon(god_quest.DUNGEON_GOD).flags2 = bor(DF2_ADJUST_LEVEL_1_2, DF2_ADJUST_LEVEL_PLAYER)
-
- -- R: No restrictions on monsters here
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 0
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 80
-
- -- R: Apart from making sure we have some GOOD ones
- dungeon(god_quest.DUNGEON_GOD).rules[2].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[2].percent = 20
-
- -- M:
- dungeon(god_quest.DUNGEON_GOD).rules[2].mflags3 = RF3_GOOD
-
- elseif player.pgod == GOD_YAVANNA then
-
- -- Yavannas dungeon will be very natural, tress and stuff.
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 22
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 100
-
- -- L: floor is grass/flowers, plus dirt so not always regenerating quick!
- dungeon(god_quest.DUNGEON_GOD).floor1 = 89
- dungeon(god_quest.DUNGEON_GOD).floor2 = 199
- dungeon(god_quest.DUNGEON_GOD).floor3 = 88
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 40
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 15
- dungeon(god_quest.DUNGEON_GOD).floor_percent3[1] = 45
-
- -- A: Tree walls to fill, small trees for inner walls
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 96
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 202
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 96
- dungeon(god_quest.DUNGEON_GOD).fill_method = 1
-
- -- O: nt much combat.. tools where ransackers have tried to chop trees down.
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 20
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 10
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 30
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 40
-
- -- F: Natural looking
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DOORS, DF1_WATER_RIVERS, DF1_NO_DESTROY, DF1_ADJUST_LEVEL_1, DF1_NO_RECALL)
- dungeon(god_quest.DUNGEON_GOD).flags2 = bor(DF2_ADJUST_LEVEL_1_2, DF2_NO_SHAFT, DF2_NO_GENO, DF2_ADJUST_LEVEL_PLAYER)
-
- -- R: Demons, Undead, non-living
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 100
-
- -- M:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags3 = bor(RF3_DEMON, RF3_UNDEAD, RF3_NONLIVING)
-
- elseif player.pgod == GOD_AULE then
-
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 24
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 80
-
- -- L: floor is dirt/mud/shallow water
- dungeon(god_quest.DUNGEON_GOD).floor1 = 88
- dungeon(god_quest.DUNGEON_GOD).floor2 = 94
- dungeon(god_quest.DUNGEON_GOD).floor3 = 84
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 45
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 45
- dungeon(god_quest.DUNGEON_GOD).floor_percent3[1] = 10
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[2] = 35
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[2] = 35
- dungeon(god_quest.DUNGEON_GOD).floor_percent3[2] = 30
-
- -- A: Grey mountains, inner walls are low hills
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 216
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 216
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 213
- dungeon(god_quest.DUNGEON_GOD).fill_method = 1
-
- -- O: Weapons and tools only
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 0
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 50
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 0
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 50
-
- -- F: Small, no destroyed levels, min monster level = dungeon level
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_SMALL, DF1_NO_DESTROY, DF1_ADJUST_LEVEL_1, DF1_NO_STREAMERS)
-
- -- R: No restrictions on monsters here
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 0
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 80
-
- elseif player.pgod == GOD_VARDA then
-
- -- Varda lives with Manwe, so high in the clouds
- -- W: Has average number of monsters.
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 18
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 160
-
-
- -- L: floor will be grass and flowers
- dungeon(god_quest.DUNGEON_GOD).floor1 = 89
- dungeon(god_quest.DUNGEON_GOD).floor2 = 82
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 85
- dungeon(god_quest.DUNGEON_GOD).floor_percent2[1] = 15
-
- -- A: Outer wall is 'hail stone wall', inner wall 'dense fog'. Filled at max smoothing, like islands.
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 211
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 210
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 211
- dungeon(god_quest.DUNGEON_GOD).fill_method = 4
-
- -- O: Varda likes magical items and tools, not much treasure or weapons
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 15
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 5
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 55
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 25
-
- -- F: It's open, goes up like a tower, give it a few interesting rooms, make the monsters hard(ish).
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DOORS, DF1_TOWER, DF1_CAVERN, DF1_ADJUST_LEVEL_1)
- dungeon(god_quest.DUNGEON_GOD).flags2 = bor(DF2_NO_SHAFT, DF2_ADJUST_LEVEL_PLAYER)
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[2].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[2].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[3].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[3].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[4].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[4].percent = 20
- dungeon(god_quest.DUNGEON_GOD).rules[5].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[5].percent = 20
-
- -- M: We want air(poison-type) or flying characters. Orcs too.
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags2 = RF2_INVISIBLE
- dungeon(god_quest.DUNGEON_GOD).rules[2].mflags3 = bor(RF3_ORC, RF3_IM_POIS)
- dungeon(god_quest.DUNGEON_GOD).rules[3].mflags4 = bor(RF4_BR_POIS, RF4_BR_GRAV)
- dungeon(god_quest.DUNGEON_GOD).rules[4].mflags5 = RF5_BA_POIS
- dungeon(god_quest.DUNGEON_GOD).rules[5].mflags7 = RF7_CAN_FLY
-
-
- elseif player.pgod == GOD_ULMO then
-
- -- Mandos dungeon is basically Tulkas, except with undead.
- -- W: but with lots of monsters
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 20
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 120
-
- -- L: floor is dirt
- dungeon(god_quest.DUNGEON_GOD).floor1 = 88
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 100
-
- -- A: Cheat: walls are water.
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 187
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 238
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 84
- dungeon(god_quest.DUNGEON_GOD).fill_method = 0
-
- -- O: Lots of treasure, not much else.
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 90
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 0
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 5
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 5
-
- -- F: fairly standard
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DESTROY, DF1_ADJUST_LEVEL_2)
- dungeon(god_quest.DUNGEON_GOD).flags2 = DF2_ADJUST_LEVEL_PLAYER
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 35
- dungeon(god_quest.DUNGEON_GOD).rules[2].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[2].percent = 30
- dungeon(god_quest.DUNGEON_GOD).rules[3].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[3].percent = 30
-
- -- M: Aquatic creatures only.
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags3 = RF7_CAN_FLY
- dungeon(god_quest.DUNGEON_GOD).rules[2].mflags3 = RF7_AQUATIC
- dungeon(god_quest.DUNGEON_GOD).rules[3].mflags3 = RF3_RES_WATE
-
- elseif player.pgod == GOD_MANDOS then
-
- -- Mandos dungeon is basically Tulkas, except with undead.
- -- W: but with lots of monsters
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_level = 20
- dungeon(god_quest.DUNGEON_GOD).min_m_alloc_chance = 120
-
- -- L: floor is normal
- dungeon(god_quest.DUNGEON_GOD).floor1 = 1
- dungeon(god_quest.DUNGEON_GOD).floor_percent1[1] = 100
-
- -- A: Granite walls
- dungeon(god_quest.DUNGEON_GOD).fill_type1 = 56
- dungeon(god_quest.DUNGEON_GOD).fill_percent1[1] = 100
- dungeon(god_quest.DUNGEON_GOD).outer_wall = 58
- dungeon(god_quest.DUNGEON_GOD).inner_wall = 57
- dungeon(god_quest.DUNGEON_GOD).fill_method = 0
-
- -- O: Loads of combat drops
- dungeon(god_quest.DUNGEON_GOD).objs.treasure = 10
- dungeon(god_quest.DUNGEON_GOD).objs.combat = 70
- dungeon(god_quest.DUNGEON_GOD).objs.magic = 5
- dungeon(god_quest.DUNGEON_GOD).objs.tools = 15
-
- -- F: fairly standard
- dungeon(god_quest.DUNGEON_GOD).flags1 = bor(DF1_NO_DESTROY, DF1_ADJUST_LEVEL_2)
- dungeon(god_quest.DUNGEON_GOD).flags2 = DF2_ADJUST_LEVEL_PLAYER
-
- -- R:
- dungeon(god_quest.DUNGEON_GOD).rules[1].mode = 3
- dungeon(god_quest.DUNGEON_GOD).rules[1].percent = 100
-
- -- M: vampires!
- dungeon(god_quest.DUNGEON_GOD).rules[1].r_char = "V"
- dungeon(god_quest.DUNGEON_GOD).rules[1].mflags3 = bor(RF3_UNDEAD, RF3_EVIL)
-
- end
-
- -- W: All dungeons are 5 levels deep, and created at 2/3 of the player clvl when the quest is given
- dungeon(god_quest.DUNGEON_GOD).mindepth = god_quest.dun_mindepth
- dungeon(god_quest.DUNGEON_GOD).maxdepth = god_quest.dun_maxdepth
- dungeon(god_quest.DUNGEON_GOD).minplev = god_quest.dun_minplev
-
-end
-
--- Calling this function returns the direction the dungeon is in from the players position at the time
--- the quest was given, and also the direction from angband (if the player is worshipping Melkor) or lothlorien.
-function get_god_quest_axes()
- local home, home_y_coord, home_x_coord, home_axis, home2, home2_y_coord, home2_x_coord, home2_axis, mydistance
-
- -- different values for different gods...
- if player.pgod ~= GOD_MELKOR then
-
- -- one of the valar, "home" is lothlorien, home2 is Minas Arnor
- home = "Bree"
- home_y_coord = 21
- home_x_coord = 35
- home2 = "Minas Anor"
- home2_y_coord = 56
- home2_x_coord = 60
- else
- -- Melkor, "home" is angband, home2 is Barad-dur
- home = "the Pits of Angband"
- home_y_coord = 7
- home_x_coord = 11
- home2 = "the Land of Mordor"
- home2_y_coord = 49
- home2_x_coord = 70
- end
-
- home_axis = compass(home_y_coord, home_x_coord, god_quest.dung_y, god_quest.dung_x)
- home2_axis = compass(home2_y_coord, home2_x_coord, god_quest.dung_y, god_quest.dung_x)
-
- home_distance = approximate_distance(home_y_coord, home_x_coord, god_quest.dung_y, god_quest.dung_x)
- home2_distance = approximate_distance(home2_y_coord, home2_x_coord, god_quest.dung_y, god_quest.dung_x)
-
- return home, home_axis, home_distance, home2, home2_axis, home2_distance
-end
diff --git a/lib/mods/theme/scpt/gods.lua b/lib/mods/theme/scpt/gods.lua
deleted file mode 100644
index 014a4423..00000000
--- a/lib/mods/theme/scpt/gods.lua
+++ /dev/null
@@ -1,26 +0,0 @@
-add_hooks
-{
- [HOOK_FOLLOW_GOD] = function(god, action)
- if action == "ask" then
- if not (god == GOD_MELKOR) then
- local i = INVEN_WIELD
- while i < INVEN_TOTAL do
- -- 13 is ART_POWER
- if player.inventory(i).name1 == 13 then
- msg_print("The One Ring has corrupted you, and you are rejected.")
- return TRUE
- end
- i = i + 1
- end
- end
- end
- return FALSE
- end,
- [HOOK_RECALC_SKILLS] = function()
- if not (player.pgod == GOD_NONE) and (get_skill(SKILL_ANTIMAGIC) > 0) then
- msg_print("You no longer believe.")
- abandon_god(GOD_ALL)
- end
- return FALSE
- end,
-}
diff --git a/lib/mods/theme/scpt/gods_new.lua b/lib/mods/theme/scpt/gods_new.lua
deleted file mode 100644
index 8153d453..00000000
--- a/lib/mods/theme/scpt/gods_new.lua
+++ /dev/null
@@ -1,454 +0,0 @@
--- This file contains all the new gods
-
-add_loadsave("GRACE_DELAY",0)
-
-function aule_stone_skin()
-local type
- if player.grace >= 10000 then
- type = SHIELD_COUNTER
- else
- type = 0
- end
-
- set_shield(randint(10) + 10 + (player.grace / 100), 10 + (player.grace / 100), type, 2 + (player.grace / 200), 3 + (player.grace / 400))
-end
-
-GOD_AULE = add_god
-{
- ["name"] = "Aule the Smith",
- ["desc"] =
- {
- "Aule is a smith, and the creator of the Dwarves."
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- if (player.pgod == GOD_AULE) and (player.grace > 0) then
- -- Resist fire, not shown on the character screen (?)
- if (player.grace > 5000) then
- player.resist_fire = TRUE
- end
-
- local bonus = player.grace / 5000
- if bonus > 5 then
- bonus = 5
- end
- player.to_h = player.to_h + bonus
- player.dis_to_h = player.dis_to_h + bonus
- player.to_d = player.to_d + bonus
- player.dis_to_d = player.dis_to_d + bonus
-
- end
- end,
- [HOOK_PROCESS_WORLD] = function()
- if (player.pgod == GOD_AULE) then
- GRACE_DELAY = GRACE_DELAY + 1
- if GRACE_DELAY >= 15 then
- -- Aule likes Dwarves and Dark Elves (Eol's influence here)
- if
- (get_race_name() ~= "Dwarf") and
- (get_race_name() ~= "Petty-dwarf") and
- (get_race_name() ~= "Gnome") and
- (get_race_name() ~= "Dark-Elf") then
- set_grace(player.grace - 1)
- end
-
- -- Search inventory for axe or hammer - Gain 1 point of grace for each hammer or axe
- for i = 0, INVEN_TOTAL - 1 do
- if ((player.inventory(i).tval) == TV_AXE) then
- set_grace(player.grace + 1)
- end
- if ((player.inventory(i).tval) == TV_HAFTED) then
- if (((player.inventory(i).sval) == SV_WAR_HAMMER) or ((player.inventory(i).sval) == SV_LUCERN_HAMMER) or ((player.inventory(i).sval) == SV_GREAT_HAMMER)) then
- set_grace(player.grace + 1)
- end
- end
- end
-
- if (player.praying == TRUE) then
- set_grace(player.grace - 2)
-
- -- Chance of casting Stoneskin if praying
- local chance
- if (player.grace >= 50000) then
- chance = 50000
- else
- chance = 50000 - player.grace
- end
-
- if (randint(100000) <= 100000 / chance) then
- aule_stone_skin()
- msg_print("Aule casts Stone Skin on you.")
- end
-
- end
- GRACE_DELAY = 0
- end
-
- end
- end,
- [HOOK_SACRIFICE_GOD] = function()
- if (player.pgod == GOD_AULE) then
- local ret, item, obj, value
- ret, item = get_item(
- "Sacrifice which item? ",
- "You have nothing to sacrifice.",
- USE_INVEN,
- function(obj)
- -- perhaps restrict this only to metal armour and weapons
- if (obj.found == OBJ_FOUND_SELFMADE) then
- return TRUE
- end
- return FALSE
- end
- )
-
- -- Item selected
- if ret == TRUE then
- -- Increase piety by the value of the item / 10
- -- object_value is not available in Lua, therefore I used the
- -- cost of the base item, without magical boni
- obj = get_object(item)
- -- value = object_value(obj)/10
- value = k_info[obj.k_idx + 1].cost/10
-
- set_grace(player.grace + value)
-
- -- remove the object
- inven_item_increase(item, -1)
- inven_item_optimize(item)
- end
- end
- end,
- [HOOK_MONSTER_DEATH] = function(m_idx)
- if (player.pgod == GOD_AULE) then
- m_ptr = monster(m_idx)
- if
- (m_ptr.r_idx == test_monster_name("Petty-dwarf")) or
- (m_ptr.r_idx == test_monster_name("Petty-dwarf mage")) or
- (m_ptr.r_idx == test_monster_name("Dark dwarven warrior")) or
- (m_ptr.r_idx == test_monster_name("Dark dwarven smith")) or
- (m_ptr.r_idx == test_monster_name("Dark dwarven lord")) or
- (m_ptr.r_idx == test_monster_name("Dark dwarven priest")) or
- (m_ptr.r_idx == test_monster_name("Dwarven warrior")) then
- -- Aule dislikes you killing dwarves
- set_grace(player.grace - 20)
- end
- if
- (m_ptr.r_idx == test_monster_name("Nar, the Dwarf")) or
- (m_ptr.r_idx == test_monster_name("Naugladur, Lord of Nogrod")) or
- (m_ptr.r_idx == test_monster_name("Telchar the Smith")) or
- (m_ptr.r_idx == test_monster_name("Fundin Bluecloak")) or
- (m_ptr.r_idx == test_monster_name("Khim, Son of Mim")) or
- (m_ptr.r_idx == test_monster_name("Ibun, Son of Mim")) or
- (m_ptr.r_idx == test_monster_name("Mim, Betrayer of Turin")) then
- -- These uniques earn a bigger penalty
- set_grace(player.grace - 500)
- end
- end
- end,
- }
-}
-
-GOD_VARDA = add_god
-{
- ["name"] = "Varda Elentari",
- ["desc"] =
- {
- "The Queen of the Stars. In light is her power and joy."
- },
- ["hooks"] =
- {
- [HOOK_PROCESS_WORLD] = function()
- if (player.pgod == GOD_VARDA) then
- GRACE_DELAY = GRACE_DELAY + 1
-
- -- piety increase if in light
- if (GRACE_DELAY >= 15) then
- if band(cave(player.py, player.px).info, CAVE_GLOW) ~= 0 then
- set_grace(player.grace + 2)
- end
- if (
- (get_race_name() == "Orc") or
- (get_race_name() == "Troll") or
- (get_race_name() == "Dragon") or
- (get_race_name() == "Demon")) then
- -- Varda hates evils
- set_grace(player.grace - 2)
- else
- set_grace(player.grace - 1)
- end
-
- if (player.praying == TRUE) then
- set_grace(player.grace - 1)
- end
- GRACE_DELAY = 0
- end
- end
- end,
- [HOOK_CALC_LITE] = function()
- if (player.pgod == GOD_VARDA) then
- -- increase lite radius
- player.cur_lite = player.cur_lite + 1
- end
- end,
- [HOOK_GF_EXEC] = function (target, who, type, dam, r, y, x, m_ptr)
- if (player.pgod == GOD_VARDA) then
- if ((type == GF_LITE) or (type == GF_LITE_WEAK)) then
- -- Raise piety for using lite
- set_grace(player.grace + 1)
- end
- end
- end,
- },
-}
-
-GOD_ULMO = add_god
-{
- ["name"] = "Ulmo",
- ["desc"] =
- {
- "Ulmo is called Lord of Waters, he rules all that is water on Arda."
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- if (player.pgod == GOD_ULMO) then
- player.water_breath = TRUE
- end
- if (player.pgod == GOD_ULMO) and (player.grace > 0) then
- local bonus = player.grace / 5000
- if bonus > 5 then
- bonus = 5
- end
-
- if ((player.grace > 1000) and (player.praying == TRUE)) then
- player.resist_pois = TRUE
- end
- if ((player.grace > 15000) and (player.praying == TRUE)) then
- player.magic_breath = TRUE
- end
- end
- end,
-
- [HOOK_MONSTER_DEATH] = function(m_idx)
- if (player.pgod == GOD_ULMO) then
- m_ptr = monster(m_idx)
- if
- (m_ptr.r_idx == test_monster_name("Swordfish")) or
- (m_ptr.r_idx == test_monster_name("Barracuda")) or
- (m_ptr.r_idx == test_monster_name("Globefish")) or
- (m_ptr.r_idx == test_monster_name("Aquatic bear")) or
- (m_ptr.r_idx == test_monster_name("Pike")) or
- (m_ptr.r_idx == test_monster_name("Electric eel")) or
- (m_ptr.r_idx == test_monster_name("Giant crayfish")) or
- (m_ptr.r_idx == test_monster_name("Mermaid")) or
- (m_ptr.r_idx == test_monster_name("Leviathan")) or
- (m_ptr.r_idx == test_monster_name("Box jellyfish")) or
- (m_ptr.r_idx == test_monster_name("Giant piranha")) or
- (m_ptr.r_idx == test_monster_name("Piranha")) or
- (m_ptr.r_idx == test_monster_name("Ocean naga")) or
- (m_ptr.r_idx == test_monster_name("Whale")) or
- (m_ptr.r_idx == test_monster_name("Octopus")) or
- (m_ptr.r_idx == test_monster_name("Giant octopus")) or
- (m_ptr.r_idx == test_monster_name("Drowned soul")) or
- (m_ptr.r_idx == test_monster_name("Tiger shark")) or
- (m_ptr.r_idx == test_monster_name("Hammerhead shark")) or
- (m_ptr.r_idx == test_monster_name("Great white shark")) or
- (m_ptr.r_idx == test_monster_name("White shark")) or
- (m_ptr.r_idx == test_monster_name("Stargazer")) or
- (m_ptr.r_idx == test_monster_name("Flounder")) or
- (m_ptr.r_idx == test_monster_name("Giant turtle")) or
- (m_ptr.r_idx == test_monster_name("Killer whale")) or
- (m_ptr.r_idx == test_monster_name("Water naga")) or
- (m_ptr.r_idx == test_monster_name("Behemoth")) then
- -- He doesn't like it if you kill these monsters
- set_grace(player.grace - 20)
- end
- if
- (m_ptr.r_idx == test_monster_name("Seahorse")) or
- (m_ptr.r_idx == test_monster_name("Aquatic elven warrior")) or
- (m_ptr.r_idx == test_monster_name("Aquatic elven mage")) or
- (m_ptr.r_idx == test_monster_name("Wavelord")) or
- (m_ptr.r_idx == test_monster_name("The Watcher in the Water")) then
- -- These monsters earn higher penalties
- set_grace(player.grace - 500)
- end
- end
- end,
- [HOOK_GF_EXEC] = function (target, who, type, dam, r, y, x, m_ptr)
- if (player.pgod == GOD_ULMO) then
- if ((type == GF_FIRE) or (type == GF_HELL_FIRE) or (type == GF_HOLY_FIRE) or (type == GF_LAVA_FLOW) or (type == GF_METEOR) or (type == GF_NUKE) or (type == GF_PLASMA)) then
- -- Reduce piety for using any kind of fire magic
- set_grace(player.grace - 5)
- end
- end
- end,
- [HOOK_PROCESS_WORLD] = function()
- if (player.pgod == GOD_ULMO) then
- GRACE_DELAY = GRACE_DELAY + 1
- if GRACE_DELAY >= 15 then
- -- Ulmo likes the Edain (except Easterlings)
- if
- (get_race_name() == "Human") or
- (get_race_name() == "Dunadan") or
- (get_race_name() == "Druadan") or
- (get_race_name() == "RohanKnight") then
- set_grace(player.grace + 1)
-
- elseif (
- (get_race_name() == "Easterling") or
- (get_race_name() == "Demon") or
- (get_race_name() == "Orc")) then
- -- hated races
- set_grace(player.grace - 2)
- else
- set_grace(player.grace + 1)
- end
-
- if (player.praying == TRUE) then
- set_grace(player.grace - 1)
- end
- -- Search inventory for axe or hammer - Gain 1 point of grace for each hammer or axe
- for i = 0, INVEN_TOTAL - 1 do
- if ((player.inventory(i).tval) == TV_POLEARM) then
- if ((player.inventory(i).sval) == SV_TRIDENT) then
- set_grace(player.grace + 1)
- end
- end
- end
-
- GRACE_DELAY = 0
- end
-
- end
- end,
- },
-}
-
-GOD_MANDOS = add_god
-{
- ["name"] = "Mandos",
- ["desc"] =
- {
- "The Doomsman of the Valar and keeper of the slain."
- },
- ["hooks"] =
- {
- [HOOK_CALC_BONUS] = function()
- if (player.pgod == GOD_MANDOS) then
- player.resist_neth = TRUE
- end
- if (player.pgod == GOD_MANDOS) and (player.grace > 0) then
- local bonus = player.grace / 5000
- if bonus > 5 then
- bonus = 5
- end
-
- if ((player.grace > 10000) and (player.praying == TRUE)) then
- player.resist_continuum = TRUE
- end
-
- if ((player.grace > 20000) and (player.praying == TRUE)) then
- player.immune_neth = TRUE
- end
- end
- end,
- [HOOK_PROCESS_WORLD] = function()
- if (player.pgod == GOD_MANDOS) then
- GRACE_DELAY = GRACE_DELAY + 1
- if GRACE_DELAY >= 15 then
- -- He loves astral beings
- if (get_subrace_name() == "LostSoul") then
- set_grace(player.grace + 1)
- end
-
- -- He likes High Elves only, though, as races
- if (get_race_name() ~= "High-Elf") then
- set_grace(player.grace - 1)
- end
- end
- -- piety increase if (condition)
- if (GRACE_DELAY >= 15) then
- if (
- (get_subrace_name() == "Vampire") or
- (get_race_name() == "Demon")) then
- -- hated races
- set_grace(player.grace - 10)
- else
- set_grace(player.grace + 2)
- end
- -- he really doesn't like to be disturbed
- if (player.praying == TRUE) then
- set_grace(player.grace - 5)
- end
- GRACE_DELAY = 0
- end
-
- end
- end,
- [HOOK_MONSTER_DEATH] = function(m_idx)
- if (player.pgod == GOD_MANDOS) then
- m_ptr = monster(m_idx)
- if
- (m_ptr.r_idx == test_monster_name("Vampire")) or
- (m_ptr.r_idx == test_monster_name("Master vampire")) or
- (m_ptr.r_idx == test_monster_name("Oriental vampire")) or
- (m_ptr.r_idx == test_monster_name("Vampire lord")) or
- (m_ptr.r_idx == test_monster_name("Vampire orc")) or
- (m_ptr.r_idx == test_monster_name("Vampire yeek")) or
- (m_ptr.r_idx == test_monster_name("Vampire ogre")) or
- (m_ptr.r_idx == test_monster_name("Vampire troll")) or
- (m_ptr.r_idx == test_monster_name("Vampire dwarf")) or
- (m_ptr.r_idx == test_monster_name("Vampire gnome")) or
- (m_ptr.r_idx == test_monster_name("Elder vampire")) then
- -- He really likes it if you kill Vampires (but not the adventurer kind :P)
- set_grace(player.grace + 50)
- end
-
- if
- (m_ptr.r_idx == test_monster_name("Vampire elf")) or
- (m_ptr.r_idx == test_monster_name("Thuringwethil, the Vampire Messenger")) then
- -- He *loves* it if you kill vampire Elves
- -- He will also thank you extra kindly if you kill Thuringwethil
- set_grace(player.grace + 200)
- end
-
- if
- (m_ptr.r_idx == test_monster_name("Dark elf")) or
- (m_ptr.r_idx == test_monster_name("Dark elven druid")) or
- (m_ptr.r_idx == test_monster_name("Eol, the Dark Elf")) or
- (m_ptr.r_idx == test_monster_name("Maeglin, the Traitor of Gondolin")) or
- (m_ptr.r_idx == test_monster_name("Dark elven mage")) or
- (m_ptr.r_idx == test_monster_name("Dark elven warrior")) or
- (m_ptr.r_idx == test_monster_name("Dark elven priest")) or
- (m_ptr.r_idx == test_monster_name("Dark elven lord")) or
- (m_ptr.r_idx == test_monster_name("Dark elven warlock")) or
- (m_ptr.r_idx == test_monster_name("Dark elven sorcerer")) then
- -- He doesn't like it if you kill normal Elves (means more work for him :P)
- set_grace(player.grace - 20)
- end
- if
- (m_ptr.r_idx == test_monster_name("Glorfindel of Rivendell")) or
- (m_ptr.r_idx == test_monster_name("Finrod Felagund")) or
- (m_ptr.r_idx == test_monster_name("Thranduil, King of the Wood Elves")) or
- (m_ptr.r_idx == test_monster_name("Aquatic elven warrior")) or
- (m_ptr.r_idx == test_monster_name("Aquatic elven mage")) or
- (m_ptr.r_idx == test_monster_name("High-elven ranger")) or
- (m_ptr.r_idx == test_monster_name("Elven archer")) then
- -- He hates it if you kill coaligned Elves
- set_grace(player.grace - 200)
- end
- if
- (m_ptr.r_idx == test_monster_name("Child spirit")) or
- (m_ptr.r_idx == test_monster_name("Young spirit")) or
- (m_ptr.r_idx == test_monster_name("Mature spirit")) or
- (m_ptr.r_idx == test_monster_name("Experienced spirit")) or
- (m_ptr.r_idx == test_monster_name("Wise spirit")) then
- -- He *hates* it if you kill the coaligned Spirits
- set_grace(player.grace - 1000)
- end
- end
- end
- }
-}
diff --git a/lib/mods/theme/scpt/gondolin.lua b/lib/mods/theme/scpt/gondolin.lua
deleted file mode 100644
index c85d8f53..00000000
--- a/lib/mods/theme/scpt/gondolin.lua
+++ /dev/null
@@ -1,63 +0,0 @@
--- This script makes the void jumpgates between Minas Anor and Gondolin appear in Gondolin rather than in a weird wilderness spot
--- as well as making the Save Gondolin quest take the player straight to Gondolin instead of the Secret Valley.
--- Many thanks to TheFalcon for the code.
-
-function minas_gate()
- if (quest(16).status == QUEST_STATUS_FINISHED) and (player.wilderness_y == 56) and (player.wilderness_x == 60) and (player.wild_mode == FALSE) then
- cave(35,10).feat = 159
- end
-end
-
-add_hook_script(HOOK_QUEST_FINISH, "minas_gate", "minas_gate")
-add_hook_script(HOOK_WILD_GEN, "minas_gate", "minas_gate")
-
-function minas_jump(direction)
- if (quest(16).status == QUEST_STATUS_FINISHED) and (player.wilderness_y == 56) and (player.wilderness_x == 60) and (player.wild_mode == FALSE) then
- if (player.px == 10) and (player.py == 35) then
- if (direction == "down") then
- player.wilderness_x = 3
- player.wilderness_y = 11
- player.wild_mode = FALSE
- player.px = 119
- player.py = 25
- player.oldpx = player.px
- player.oldpy = player.py
- dun_level = 0
- player.leaving = TRUE
- return TRUE
- end
- end
- end
-end
-
-add_hook_script(HOOK_STAIR, "minas_jump", "minas_jump")
-
-add_loadsave("tolan_count", 0)
-
-function tolan_travel()
- if (quest(15).status == QUEST_STATUS_TAKEN) and (tolan_count == 0) then
- player.wilderness_x = 3
- player.wilderness_y = 11
- player.wild_mode = FALSE
- player.px = 117
- player.py = 25
- player.oldpx = player.px
- player.oldpy = player.py
- dun_level = 0
- player.leaving = TRUE
- tolan_count = 1
- return TRUE
- end
-end
-
-add_hook_script(HOOK_END_TURN, "tolan_travel", "tolan_travel")
-
-add_hooks
-{
- [HOOK_BIRTH] = function()
- if tolan_count >=1
- then tolan_count = 0
- else
- end
- end
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua
deleted file mode 100644
index 4e244df6..00000000
--- a/lib/mods/theme/scpt/help.lua
+++ /dev/null
@@ -1,445 +0,0 @@
--- Ingame contextual help
-
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------------------Here comes the definition of help-----------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-
-ingame_help
-{
- ["hook"] = HOOK_MOVE,
- ["event"] = function(y, x) if cave(y, x).feat == FEAT_BETWEEN then return TRUE end end,
- ["desc"] =
- {
- "Void Jumpgates can be entered by pressing the > key. They will transport",
- "you to another jumpgate, but beware of the cold damage that might kill you.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_MOVE,
- ["event"] = function(y, x) if cave(y, x).feat == FEAT_FOUNTAIN then return TRUE end end,
- ["desc"] =
- {
- "Fountains are always magical. You can quaff from them by pressing H.",
- "Beware that unlike potions they cannot be identified.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_MOVE,
- ["event"] = function(y, x) if cave(y, x).o_idx ~= 0 then return TRUE end end,
- ["desc"] =
- {
- "So you found your first item! Nice, eh? Now when you stumble across",
- "objects, you can pick them up by pressing g, and if you are wondering",
- "what they do, press I (then *, then the letter for the item) to get",
- "some basic information. You may also want to identify them with scrolls,",
- "staves, rods or spells.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_MOVE,
- ["event"] = function(y, x) if (cave(y, x).feat >= FEAT_ALTAR_HEAD) and (cave(y, x).feat <= FEAT_ALTAR_TAIL) then return TRUE end end,
- ["desc"] =
- {
- "Altars are the way to reach the Valar, powers of the world,",
- "usualy called Gods. You can press O to become a follower.",
- "Beware that once you follow a god, you are not allowed to change.",
- "For an exact description of what gods do and want, read the documentation."
- }
-}
-
--- Beware this one, if Bree is moved from 21, 34 (y, x) on the wilderness map it will break
-ingame_help
-{
- ["hook"] = HOOK_END_TURN,
- ["event"] = function(y, x)
- if ((player.wilderness_x ~= 34) or (player.wilderness_y ~= 21) and (player.astral == FALSE)) then return TRUE end
- end,
- ["desc"] =
- {
- "Ahh wilderness travel... The overview mode will allow you to travel",
- "fast, but that comes to the cost of GREATLY increased food consumption.",
- "So you should bring lots of food and really watch your hunger status.",
- "To enter the overview mode, press < while in the wilderness.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev > 1 then return TRUE end end,
- ["desc"] =
- {
- "Ok, so you now gained a level, and you have skill points to spend.",
- "To do so simply press G to learn skills. Reading the documentation",
- "about skills and abilities is also strongly recommended.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_MOVE,
- ["event"] = function(y, x) if cave(y, x).feat == FEAT_MORE then return TRUE end end,
- ["desc"] =
- {
- "Ah, this is a stair, or a way into something. Press > to enter it.",
- "But be ready to fight what lies within, for it might not be too friendly.",
- }
-}
-
-ingame_help
-{
- ["callback"] = "monster_chat",
- ["desc"] =
- {
- "Somebody is speaking to you it seems. You can talk back with the Y key.",
- "This can lead to quests. You can also give items to 'monsters' with the y key.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_END_TURN,
- ["event"] = function(y, x) return TRUE end,
- ["desc"] =
- {
- "Welcome to Theme! I am the spirit of knowledge and my task is to help you",
- "to get used to how to play. I have prepared a #vparchment#y for you to #vread#y.",
- "Press r, then space then select it. You can also check the documentation",
- "by pressing ? at (nearly) any time.",
- "The first place you can explore is Barrow-downs. Go to the west of town",
- "and you should see a #v>#y there.",
- "If you miss any of this you can press ctrl+p to see your message log.",
- "Now I must reveal your task here. You are on a quest to investigate",
- "the dreadful tower of Dol Guldur in the Mirkwood forest to see what evil",
- "lurks there, but beware, you are not yet ready.",
- "If you do not want me to bother you any more with tips, press = then go",
- "into the ToME options and deactivate the ingame_help option.",
- "You can see your quest log by pressing ctrl+q. Now go to your destiny!",
- }
-}
-
-ingame_help
-{
- ["no_test"] = TRUE,
- ["callback"] = "select_context",
- ["fct"] = function(typ, name)
- -- list of files for classes, { filename, anchor }
- local t =
- {
- ["race"] =
- {
- ["Beorning"] = { "r_beorn.txt", 0 },
- ["Dragon"] = { "r_dragon.txt", 0 },
- ["Dark-Elf"] = { "r_drkelf.txt", 0 },
- ["Dunadan"] = { "r_dunad.txt", 0 },
- ["Dwarf"] = { "r_dwarf.txt", 0 },
- ["Elf"] = { "r_elf.txt", 0 },
- ["Ent"] = { "r_ent.txt", 0 },
- ["Gnome"] = { "r_gnome.txt", 0 },
- ["Half-Elf"] = { "r_hafelf.txt", 0 },
- ["Half-Ogre"] = { "r_hafogr.txt", 0 },
- ["High-Elf"] = { "r_hielf.txt", 0 },
- ["Hobbit"] = { "r_hobbit.txt", 0 },
- ["Human"] = { "r_human.txt", 0 },
- ["Druadan"] = { "r_druadan.txt", 0 },
- ["Maia"] = { "r_maia.txt", 0 },
- ["Orc"] = { "r_orc.txt", 0 },
- ["Petty-Dwarf"] = { "r_pettyd.txt", 0 },
- ["RohanKnight"] = { "r_rohank.txt", 0 },
- ["Eagle"] = { "r_eagle.txt", 0 },
- ["Troll"] = { "r_troll.txt", 0 },
- ["Wood-Elf"] = { "r_wodelf.txt", 0 },
- ["Yeek"] = { "r_yeek.txt", 0 },
- ["Easterling"] = { "r_easterl.txt", 0 },
- ["Demon"] = { "r_demon.txt", 0},
- },
- ["subrace"] =
- {
- ["Barbarian"] = { "rm_barb.txt", 0 },
- ["Classical"] = { "rm_class.txt", 0 },
- ["Corrupted"] = { "rm_corru.txt", 0 },
- ["Hermit"] = { "rm_herm.txt", 0 },
- ["LostSoul"] = { "rm_lsoul.txt", 0 },
- ["Skeleton"] = { "rm_skel.txt", 0 },
- ["Spectre"] = { "rm_spec.txt", 0 },
- ["Vampire"] = { "rm_vamp.txt", 0 },
- ["Zombie"] = { "rm_zomb.txt", 0 },
- ["Red"] = {"rm_red.txt", 0 },
- ["Black"] = {"rm_black.txt", 0 },
- ["Green"] = {"rm_green.txt", 0 },
- ["Blue"] = {"rm_blue.txt", 0 },
- ["White"] = {"rm_white.txt", 0 },
- ["Ethereal"] = {"rm_ether.txt", 0 },
- ["(Narrog)"] = {"rm_narrog.txt", 0 },
- ["(Aewrog)"] = {"rm_aewrog.txt", 0 },
- ["(Hurog)"] = {"rm_hurog.txt", 0 },
- ["(Sarnrog)"] = {"rm_sarnrog.txt", 0 },
- ["(Caborrog)"] = {"rm_cabrog.txt", 0 },
- ["(Draugrog)"] = {"rm_drarog.txt", 0 },
- ["(Lygrog)"] = {"rm_lygrog.txt", 0 },
- ["(Limrog)"] = {"rm_limrog.txt", 0 },
- ["(Rawrog)"] = {"rm_rawrog.txt", 0 },
- ["(Adanrog)"] = {"rm_adanrog.txt", 0 },
- },
- ["class"] =
- {
- ["Archer"] = { "c_archer.txt", 0 },
- ["Ascetic"] = { "c_ascet.txt", 0 },
- ["Assassin"] = { "c_assass.txt", 0 },
- ["Axemaster"] = { "c_axemas.txt", 0 },
- ["Bard"] = { "c_bard.txt", 0 },
- ["Clairvoyant"] = {"c_clairv.txt", 0},
- ["Dark-Priest"] = { "c_pr_drk.txt", 0 },
- ["Demonologist"] = { "c_demono.txt", 0 },
- ["Druid"] = { "c_druid.txt", 0 },
- ["Geomancer"] = { "c_geoman.txt", 0 },
- ["Haftedmaster"] = { "c_hafted.txt", 0 },
- ["Loremaster"] = { "c_lorema.txt", 0 },
- ["Mage"] = { "c_mage.txt", 0 },
- ["Mercenary"] = { "c_mercen.txt", 0 },
- ["Mimic"] = { "c_mimic.txt", 0 },
- ["Mindcrafter"] = { "c_mindcr.txt", 0 },
- ["Monk"] = { "c_monk.txt", 0 },
- ["Necromancer"] = { "c_necro.txt", 0 },
- ["Pacifist"] = { "c_pacif.txt", 0 },
- ["Paladin"] = { "c_palad.txt", 0 },
- ["Peace-mage"] = { "c_peacemag.txt", 0 },
- ["Polearmmaster"] = { "c_polear.txt", 0 },
- ["Possessor"] = { "c_posses.txt", 0 },
- ["Priest"] = { "c_priest.txt", 0 },
- ["Priest(Eru)"] = { "c_pr_eru.txt", 0 },
- ["Priest(Mandos)"] = { "c_pr_mand.txt", 0 },
- ["Priest(Manwe)"] = { "c_pr_man.txt", 0 },
- ["Priest(Ulmo)"] = { "c_pr_ulmo.txt", 0 },
- ["Priest(Varda)"] = { "c_pr_varda.txt", 0 },
- ["Ranger"] = { "c_ranger.txt", 0 },
- ["Rogue"] = { "c_rogue.txt", 0 },
- ["Runecrafter"] = { "c_runecr.txt", 0 },
- ["Sniper"] = {"c_sniper.txt", 0 },
- ["Sorceror"] = { "c_sorcer.txt", 0 },
- ["Stonewright"] = { "c_stonewr.txt", 0 },
- ["Summoner"] = { "c_summon.txt", 0 },
- ["Swordmaster"] = { "c_swordm.txt", 0 },
- ["Symbiant"] = { "c_symbia.txt", 0 },
- ["Thaumaturgist"] = { "c_thaum.txt", 0 },
- ["Trapper"] = { "c_trapper.txt", 0 },
- ["Unbeliever"] = { "c_unbel.txt", 0 },
- ["Wainrider"] = { "c_wainrid.txt", 0 },
- ["War-mage"] = { "c_warmage.txt", 0 },
- ["Warper"] = { "c_warper.txt", 0 },
- ["Warrior"] = { "c_warrio.txt", 0 },
- },
- ["god"] =
- {
- ["Aule the Smith"] = { "g_aule.txt", 0 },
- ["Eru Iluvatar"] = { "g_eru.txt", 0 },
- ["Mandos"] = { "g_mandos.txt", 0 },
- ["Manwe Sulimo"] = { "g_manwe.txt", 0 },
- ["Melkor Bauglir"] = { "g_melkor.txt", 0 },
- ["Tulkas"] = { "g_tulkas.txt", 0 },
- ["Ulmo"] = { "g_ulmo.txt", 0 },
- ["Varda Elentari"] = { "g_varda.txt", 0 },
- ["Yavanna Kementari"] = { "g_yavann.txt", 0 },
- },
- ["skill"] =
- {
- ["Air"] = { "skills.txt", 27 },
- ["Alchemy"] = { "skills.txt", 49 },
- ["Antimagic"] = { "skills.txt", 50 },
- ["Archery"] = { "skills.txt", 08 },
- ["Axe-mastery"] = { "skills.txt", 05 },
- ["Backstab"] = { "skills.txt", 18 },
- ["Barehand-combat"] = { "skills.txt", 13 },
- ["Boomerang-mastery"] = { "skills.txt", 12 },
- ["Boulder-throwing"] = { "skills.txt", 58 },
- ["Bow-mastery"] = { "skills.txt", 10 },
- ["Combat"] = { "skills.txt", 01 },
- ["Conveyance"] = { "skills.txt", 30 },
- ["Corpse-preservation"] = { "skills.txt", 44 },
- ["Critical-hits"] = { "skills.txt", 04 },
- ["Crossbow-mastery"] = { "skills.txt", 11 },
- ["Demonology"] = { "skills.txt", 52 },
- ["Disarming"] = { "skills.txt", 16 },
- ["Divination"] = { "skills.txt", 31 },
- ["Dodging"] = { "skills.txt", 20 },
- ["Druidistic"] = { "skills.txt", 40 },
- ["Earth"] = { "skills.txt", 28 },
- ["Fire"] = { "skills.txt", 25 },
- ["Geomancy"] = { "skills.txt", 60 },
- ["Hafted-mastery"] = { "skills.txt", 06 },
- ["Magic"] = { "skills.txt", 21 },
- ["Magic-Device"] = { "skills.txt", 54 },
- ["Mana"] = { "skills.txt", 24 },
- ["Meta"] = { "skills.txt", 29 },
- ["Mimicry"] = { "skills.txt", 47 },
- ["Mind"] = { "skills.txt", 33 },
- ["Mindcraft"] = { "skills.txt", 41 },
- ["Monster-lore"] = { "skills.txt", 42 },
- ["Music"] = { "skills.txt", 59 },
- ["Nature"] = { "skills.txt", 34 },
- ["Necromancy"] = { "skills.txt", 35 },
- ["Polearm-mastery"] = { "skills.txt", 07 },
- ["Possession"] = { "skills.txt", 45 },
- ["Prayer"] = { "skills.txt", 39 },
- ["Runecraft"] = { "skills.txt", 36 },
- ["Sling-mastery"] = { "skills.txt", 09 },
- ["Sneakiness"] = { "skills.txt", 14 },
- ["Spell-power"] = { "skills.txt", 22 },
- ["Spirituality"] = { "skills.txt", 38 },
- ["Sorcery"] = { "skills.txt", 23 },
- ["Stealing"] = { "skills.txt", 19 },
- ["Stealth"] = { "skills.txt", 15 },
- ["Stunning-blows"] = { "skills.txt", 53 },
- ["Summoning"] = { "skills.txt", 43 },
- ["Sword-mastery"] = { "skills.txt", 03 },
- ["Symbiosis"] = { "skills.txt", 46 },
- ["Temporal"] = { "skills.txt", 32 },
- ["Thaumaturgy"] = { "skills.txt", 37 },
- ["Udun"] = { "skills.txt", 48 },
- ["Weaponmastery"] = { "skills.txt", 02 },
- ["Water"] = { "skills.txt", 26 },
- },
- ["ability"] =
- {
- ["Spread blows"] = { "ability.txt", 02 },
- ["Tree walking"] = { "ability.txt", 03 },
- ["Perfect casting"] = { "ability.txt", 04 },
- ["Extra Max Blow(1)"] = { "ability.txt", 05 },
- ["Extra Max Blow(2)"] = { "ability.txt", 06 },
- ["Ammo creation"] = { "ability.txt", 07 },
- ["Touch of death"] = { "ability.txt", 08 },
- ["Artifact Creation"] = { "ability.txt", 09 },
- ["Far reaching attack"] = { "ability.txt", 10 },
- ["Trapping"] = { "ability.txt", 11 },
- ["Undead Form"] = { "ability.txt", 12 },
- },
- }
-
- if t[typ][name] then ingame_help_doc(t[typ][name][1], t[typ][name][2])
- else ingame_help_doc("help.hlp", 0)
- end
- end,
-}
-
-ingame_help
-{
- ["hook"] = HOOK_IDENTIFY,
- ["event"] = function(i, mode)
- if mode == "full" then
- local obj = get_object(i)
- local f1, f2, f3, f4, f5, esp = object_flags(obj)
- if band(f5, TR5_SPELL_CONTAIN) ~= 0 then return TRUE end
- end
- end,
- ["desc"] =
- {
- "Ah, an item that can contain a spell. To use it you must have some levels of",
- "Magic skill and then you get the option to copy a spell when pressing m.",
- "Then just select which spell to copy and to which object. Note that doing so",
- "is permanent; the spell cannot be removed or changed later.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_BATERIE then return TRUE end end,
- ["desc"] =
- {
- "Ah, an essence! Those magical containers stores energies. They are used",
- "with the Alchemy skill to create or modify the powers of items.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_RUNE1 or obj.tval == TV_RUNE2 then return TRUE end end,
- ["desc"] =
- {
- "Ah, a rune! Runes are used with the Runecraft skill to allow you to",
- "create spells on your own.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_ROD_MAIN then return TRUE end end,
- ["desc"] =
- {
- "This is a rod. You will need to attach a rod tip to it before you",
- "can use it. This main part of the rod may give the rod bonuses",
- "like quicker charging time, or a larger capacity for charges.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_ROD then return TRUE end end,
- ["desc"] =
- {
- "You've found a rod-tip! You will need to attach it to a rod base",
- "before you can use it. Once it has been attatched (use the 'z' key)",
- "you cannot unattach it! The rod tip will determine the effect of",
- "the rod. To use your rod, 'z'ap it once it has been assembled.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_TRAPKIT then return TRUE end end,
- ["desc"] =
- {
- "Ooooh, a trapping kit. If you have ability in the trapping skill,",
- "you can lay this trap (via the 'm' key) to harm unsuspecting foes.",
- "You'll generally need either some ammo or magic device depending",
- "on the exact type of trap kit.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_RECALC_SKILLS,
- ["event"] = function() if game.started and (get_melee_skills() > 1) then return TRUE end end,
- ["desc"] =
- {
- "Ah, you now possess more than one melee type. To switch between them press m",
- "and select the switch melee type option.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_GET,
- ["event"] = function(obj, idx) if obj.tval == TV_WAND or obj.tval == TV_STAFF then return TRUE end end,
- ["desc"] =
- {
- "You've found a magical device, either a staff or a wand. Each staff",
- "contains a spell, often from one of the primary magic schools. There",
- "is a lot of information you can find about this object if you identify",
- "it and 'I'nspect it. Check the help file on Magic for more about these.",
- }
-}
-
-ingame_help
-{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev >= 20 then return TRUE end end,
- ["desc"] =
- {
- "I see you are now at least level 20. Nice! If you want to gloat about your",
- "character you could press 'C' then 'f' to make a character dump and post it to",
- "http://angband.oook.cz/ where it will end up in the ladder.",
- }
-}
diff --git a/lib/mods/theme/scpt/init.lua b/lib/mods/theme/scpt/init.lua
deleted file mode 100644
index 958d8f7d..00000000
--- a/lib/mods/theme/scpt/init.lua
+++ /dev/null
@@ -1,56 +0,0 @@
---
--- This file is loaded at the initialisation of ToME
---
-
--- Load the class specific stuff
-tome_dofile("player.lua")
-
--- Load the ingame contextual help
-tome_dofile("help.lua")
-
--- let the store specific stuff happen!
-tome_dofile("stores.lua")
-
--- Add various 'U' powers
-tome_dofile("powers.lua")
-
--- Add the mimic shapes
-tome_dofile("mimic.lua")
-
--- Add the corruptions
-tome_dofile("corrupt.lua")
-
--- Add the mkey activations
-tome_dofile("mkeys.lua")
-
--- Add god stuff
-tome_dofile("gods.lua")
-tome_dofile("gods_new.lua")
-
--- Add the schools of magic
-tome_dofile("spells.lua")
-
--- Add some quests
-tome_dofile("bounty.lua")
-tome_dofile("god.lua")
-tome_dofile("fireprof.lua")
-tome_dofile("library.lua")
-
--- Add joke stuff
-tome_dofile("drunk.lua")
-tome_dofile("joke.lua")
-
--- Some tests, if the file is not present, this is fine
-tome_dofile_anywhere(ANGBAND_DIR_SCPT, "dg_test.lua", FALSE)
-
--- A nice custom intro :)
-tome_dofile("intro.lua")
-
--- Add monster interaction
-tome_dofile("monsters.lua")
-
--- Add miscellaneous stuff
-tome_dofile("misc.lua")
-
--- Add map-related quest fix
-tome_dofile("gondolin.lua") \ No newline at end of file
diff --git a/lib/mods/theme/scpt/intro.lua b/lib/mods/theme/scpt/intro.lua
deleted file mode 100644
index 3cdce225..00000000
--- a/lib/mods/theme/scpt/intro.lua
+++ /dev/null
@@ -1,43 +0,0 @@
-function tome_intro()
- screen_save()
- Term_clear()
-
- if (TRUE == drop_text_left(TERM_L_BLUE, "Three Rings for the Elven-kings under the sky,", 10, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_BLUE, "Seven for the Dwarf-lords in their halls of stone,", 11, -1)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_L_BLUE, "Nine for Mortal Men doomed to die,", 12, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_BLUE, "One for the Dark Lord on his dark throne", 13, -1)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_L_BLUE, "In the land of Mordor, where the Shadows lie.", 14, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_BLUE, "One Ring to rule them all, One Ring to find them,", 15, -1)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_L_BLUE, "One Ring to bring them all and in the darkness bind them", 16, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_BLUE, "In the land of Mordor, where the Shadows lie.", 17, -1)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_GREEN, "--J.R.R. Tolkien", 18, 0)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_WHITE, "[Press any key to continue]", 23, -1)) then screen_load() return end
-
- Term_putch(0, 0, TERM_DARK, 32)
- inkey_scan = FALSE
- inkey()
-
- Term_clear()
-
- if (TRUE == drop_text_left(TERM_L_BLUE, "furiosity", 8, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_WHITE, "in collaboration with", 9, -1)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_L_GREEN, "DarkGod and all the ToME contributors,", 10, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_GREEN, "module creators, t-o-m-e.net forum posters,", 11, -1)) then screen_load() return end
- if (TRUE == drop_text_left(TERM_WHITE, "and", 12, 0)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_L_GREEN, "by the grace of the Valar", 13, -1)) then screen_load() return end
-
- if (TRUE == drop_text_left(TERM_WHITE, "present", 15, 1)) then screen_load() return end
- if (TRUE == drop_text_right(TERM_YELLOW, "Theme (a module for ToME)", 16, 0)) then screen_load() return end
-
- if (TRUE == drop_text_left(TERM_WHITE, "[Press any key to continue]", 23, -1)) then screen_load() return end
- Term_putch(0, 0, TERM_DARK, 32)
-
- inkey_scan = FALSE
-
- inkey()
-
- screen_load()
- return
-end
-
-add_hook_script(HOOK_INIT, "tome_intro", "lua_intro_init")
diff --git a/lib/mods/theme/scpt/joke.lua b/lib/mods/theme/scpt/joke.lua
deleted file mode 100644
index 2d87b651..00000000
--- a/lib/mods/theme/scpt/joke.lua
+++ /dev/null
@@ -1,31 +0,0 @@
--- Place a monster in a good spot
-function gen_joke_place_monster(r_idx)
- local try = 1000
- local x
- local y
- while try > 0 do
- x = randint(cur_hgt - 4) + 2
- y = randint(cur_wid - 4) + 2
- if not (0 == place_monster_one(y, x, r_idx, 0, FALSE, MSTATUS_ENEMY)) then
- return
- end
- try = try - 1
- end
-end
-
--- Check if a special joke monster can be generated here
-function gen_joke_monsters()
- if joke_monsters == FALSE then
- return
- end
-
- -- Neil
- if (current_dungeon_idx == 20) and (dun_level == 72) then
- neil = test_monster_name("Neil, the Sorceror")
- m_allow_special[neil + 1] = TRUE
- gen_joke_place_monster(neil)
- m_allow_special[neil + 1] = FALSE
- end
-end
-
-add_hook_script(HOOK_LEVEL_END_GEN, "gen_joke_monsters", "gen_joke_monsters")
diff --git a/lib/mods/theme/scpt/library.lua b/lib/mods/theme/scpt/library.lua
deleted file mode 100644
index a16d37ef..00000000
--- a/lib/mods/theme/scpt/library.lua
+++ /dev/null
@@ -1,439 +0,0 @@
--- Library quest in Minas Anor
-
--- Partially based on Fireproofing quest
-
-library_quest = {}
-
--- Map helper
-library_quest.place_random = function(minY, minX, maxY, maxX, monster)
- y = randint(maxY - minY + 1) + minY
- x = randint(maxX - minX + 1) + minX
- return place_monster_one(y, x, monster, 0, TRUE, MSTATUS_ENEMY)
-end
-
--- Book creation helpers
-library_quest.bookable_spells =
-{
- MANATHRUST, DELCURSES,
- GLOBELIGHT, FIREGOLEM, FIREFLASH, FIREWALL,
- GEYSER, VAPOR, ENTPOTION,
- NOXIOUSCLOUD, POISONBLOOD,
- STONESKIN, DIG,
- RECHARGE, DISPERSEMAGIC,
- BLINK, DISARM, TELEPORT,
- SENSEMONSTERS, SENSEHIDDEN, REVEALWAYS, IDENTIFY, VISION,
- MAGELOCK, SLOWMONSTER, ESSENCESPEED,
- CHARM, CONFUSE, ARMOROFFEAR, STUN,
- GROWTREE, HEALING, RECOVERY,
- ERU_SEE, ERU_LISTEN,
- MANWE_BLESS, MANWE_SHIELD,
- YAVANNA_CHARM_ANIMAL, YAVANNA_GROW_GRASS, YAVANNA_TREE_ROOTS,
- TULKAS_AIM, TULKAS_SPIN,
- MELKOR_CURSE, MELKOR_CORPSE_EXPLOSION, DRAIN,
- AULE_FIREBRAND, AULE_CHILD,
- VARDA_LIGHT_VALINOR, VARDA_EVENSTAR,
- ULMO_BELEGAER, ULMO_WRATH,
- MANDOS_TEARS_LUTHIEN, MANDOS_TALE_DOOM
-}
-
-library_quest.get_term_size = function()
- local width = 0
- local height = 0
- ret, width, height = Term_get_size(width, height)
- return width, height
-end
-
-library_quest.book_slots_left = function()
- if school_book[61][1] == -1 then
- return 3
- elseif school_book[61][2] == -1 then
- return 2
- elseif school_book[61][3] == -1 then
- return 1
- else
- return 0
- end
-end
-
-library_quest.book_contains_spell = function(spell)
- if school_book[61][1] == spell then
- return TRUE
- elseif school_book[61][2] == spell then
- return TRUE
- elseif school_book[61][3] == spell then
- return TRUE
- else
- return FALSE
- end
-end
-
-library_quest.add_spell = function(spell)
- if school_book[61][1] == -1 then
- school_book[61][1] = spell
- return TRUE
- elseif school_book[61][2] == -1 then
- school_book[61][2] = spell
- return TRUE
- elseif school_book[61][3] == -1 then
- school_book[61][3] = spell
- return TRUE
- else
- return FALSE
- end
-end
-
-library_quest.remove_spell = function(spell)
- if school_book[61][1] == spell then
- school_book[61][1] = school_book[61][2]
- school_book[61][2] = school_book[61][3]
- school_book[61][3] = -1
- return TRUE
- elseif school_book[61][2] == spell then
- school_book[61][2] = school_book[61][3]
- school_book[61][3] = -1
- return TRUE
- elseif school_book[61][3] == spell then
- school_book[61][3] = -1
- return TRUE
- else
- return FALSE
- end
-end
-
--- 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
-
--- spell selection routines inspired by skills.c
-library_quest.print_spells = function(first, current)
- Term_clear()
- width, height = library_quest.get_term_size()
- slots = library_quest.book_slots_left()
-
- c_prt(TERM_WHITE, "Book Creation Screen", 0, 0);
- c_prt(TERM_WHITE, "Up/Down to move, Right/Left to modify, I to describe, Esc to Save/Cancel", 1, 0);
-
- if slots == 0 then
- c_prt(TERM_L_RED, "The book can hold no more spells.", 2, 0);
- elseif slots == 1 then
- c_prt(TERM_L_BLUE, "The book can hold 1 more spell.", 2, 0);
- else
- c_prt(TERM_L_BLUE, "The book can hold "..slots.." more spells.", 2, 0);
- end
-
- row = 3;
- for index, spell in library_quest.bookable_spells do
- if index >= first then
- if index == current then
- color = TERM_GREEN
- elseif library_quest.book_contains_spell(spell) == TRUE then
- color = TERM_WHITE
- else
- color = TERM_ORANGE
- end
- library_quest.print_spell(color, row, spell)
-
- if row == height - 1 then
- return
- end
- row = row + 1
- end
- end
-end
-
-library_quest.fill_book = function()
- -- Always start with a cleared book
- school_book[61] = {-1, -1, -1}
-
- screen_save()
- width, height = library_quest.get_term_size()
- -- room for legend
- margin = 3
-
- first = 1
- current = 1
- done = FALSE
-
- while done == FALSE do
- library_quest.print_spells(first, current)
-
- inkey_scan = FALSE
- inkey_base = TRUE
- char = inkey()
- dir = get_keymap_dir(char)
- if char == ESCAPE then
- if library_quest.book_slots_left() == 0 then
- flush()
- done = get_check("Really create the book?")
- else
- done = TRUE
- end
- elseif char == strbyte('\r') then
- -- TODO: make tree of schools
- elseif char == strbyte('n') then
- current = current + height
- elseif char == strbyte('p') then
- current = current - height
- elseif char == strbyte('I') then
- print_spell_desc(library_quest.bookable_spells[current], 0)
- inkey()
- elseif dir == 2 then
- current = current + 1
- elseif dir == 8 then
- current = current - 1
- elseif dir == 6 then
- if library_quest.book_contains_spell(library_quest.bookable_spells[current]) == FALSE then
- library_quest.add_spell(library_quest.bookable_spells[current])
- end
- elseif dir == 4 then
- library_quest.remove_spell(library_quest.bookable_spells[current])
- end
- total = getn(library_quest.bookable_spells)
- if current > total then
- current = total
- elseif current < 1 then
- current = 1
- end
-
- if current > (first + height - margin - 1) then
- first = current - height + margin + 1
- elseif first > current then
- first = current
- end
- end
-
- screen_load()
-end
-
--- Quest data and hooks
-add_quest
-{
- ["global"] = "LIBRARY_QUEST",
- ["name"] = "Library quest",
- ["desc"] = function()
- -- Quest taken
- if (quest(LIBRARY_QUEST).status == QUEST_STATUS_TAKEN) then
- print_hook("#####yAn Old Mages Quest! (Danger Level: 35)\n")
- print_hook("Make the library safe for the old mage in Minas Anor.\n")
- print_hook("\n")
- -- Quest done, book not gotten yet
- elseif (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then
- print_hook("#####yAn Old Mages Quest!\n")
- print_hook("You have made the library safe for the old mage in Minas Anor.\n")
- print_hook("Perhaps you should see about a reward.\n")
- print_hook("\n")
- end
- end,
- ["level"] = 35,
- ["data"] =
- {
- ["school_book[61][1]"] = -1,
- ["school_book[61][2]"] = -1,
- ["school_book[61][3]"] = -1
- },
- ["hooks"] =
- {
- -- Start the game without the quest, need to request it
- [HOOK_BIRTH_OBJECTS] = function()
- quest(LIBRARY_QUEST).status = QUEST_STATUS_UNTAKEN
- school_book[61] = {-1, -1, -1}
- end,
-
- [HOOK_GEN_QUEST] = function()
- -- Only if player doing this quest
- if (player.inside_quest ~= LIBRARY_QUEST) then
- return FALSE
- end
-
- load_map("library.map", 2, 2)
- level_flags2 = DF2_NO_GENO
-
- -- generate the Liches 518
- liches = damroll(4, 2) -- plus one on the map
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 4, 14, 37, 518) then
- liches = liches - 1
- end
- end
-
- -- generate the Monastic liches 611
- liches = damroll(1, 2)
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 34, 37, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 34, 14, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate even more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 4, 37, 34, 611) then
- liches = liches - 1
- end
- end
-
- -- Flesh golem 256
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 256) then
- golems = golems - 1
- end
- end
-
- -- Clay golem 261
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 261) then
- golems = golems - 1
- end
- end
-
- -- Iron golem 367
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 367) then
- golems = golems - 1
- end
- end
-
- -- Mithril Golem 464
- golems = 1
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 464) then
- golems = golems - 1
- end
- end
-
- -- one Master lich is on the map
-
- return TRUE
- end,
- [HOOK_STAIR] = function()
- local ret
-
- -- only ask this if player about to go up stairs of quest and hasn't won yet
- if (player.inside_quest ~= LIBRARY_QUEST) or (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then
- return FALSE
- end
-
- if cave(player.py, player.px).feat ~= FEAT_LESS then return end
-
- -- flush all pending input
- flush()
-
- -- confirm
- ret = get_check("Really abandon the quest?")
-
- -- if yes, then
- if ret == TRUE then
- -- fail the quest
- quest(LIBRARY_QUEST).status = QUEST_STATUS_FAILED
- return FALSE
- else
- -- if no, they stay in the quest
- return TRUE
- end
- end,
- [HOOK_MONSTER_DEATH] = function()
- -- if they're in the quest and haven't won, continue
- if (player.inside_quest ~= LIBRARY_QUEST) or (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then
- return FALSE
- end
-
- i = 1
- count = -1
- while i <= m_max do
- local monster = m_list[i]
- if (monster.r_idx > 0) and (monster.status <= MSTATUS_ENEMY) then
- count = count + 1
- end
- i = i + 1
- end
-
- if count == 0 then
- quest(LIBRARY_QUEST).status = QUEST_STATUS_COMPLETED
- msg_print(TERM_YELLOW, "The library is safe now.")
- end
- end,
- },
-}
-
--- Library store action
-add_building_action
-{
- ["index"] = 61,
- ["action"] = function()
- -- the quest hasn't been requested already, right?
- if quest(LIBRARY_QUEST).status == QUEST_STATUS_UNTAKEN then
- -- quest has been taken now
- quest(LIBRARY_QUEST).status = QUEST_STATUS_TAKEN
-
- -- issue instructions
- msg_print("I need get some stock from my main library, but it is infested with monsters!")
- msg_print("Please use the side entrance and vanquish the intruders for me.")
-
- return TRUE, FALSE, TRUE
- -- if quest completed
- elseif (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then
- msg_print("Thank you! Let me make a special book for you.")
- msg_print("Tell me three spells and I will write them in the book.")
- library_quest.fill_book()
- if library_quest.book_slots_left() == 0 then
- quest(LIBRARY_QUEST).status = QUEST_STATUS_REWARDED
- book = create_object(TV_BOOK, 61)
- book.art_name = quark_add(player_name())
- book.found = OBJ_FOUND_REWARD
- set_aware(book)
- set_known(book)
- inven_carry(book, FALSE)
- end
-
- -- if the player asks for a quest when they already have it, but haven't failed it, give them some extra instructions
- elseif (quest(LIBRARY_QUEST).status == QUEST_STATUS_TAKEN) then
- msg_print("Please use the side entrance and vanquish the intruders for me.")
-
- -- quest failed or completed, then give no more quests
- elseif (quest(LIBRARY_QUEST).status == QUEST_STATUS_FAILED) or (quest(LIBRARY_QUEST).status == QUEST_STATUS_REWARDED) then
- msg_print("I have no more quests for you.")
- end
- return TRUE
- end,
-}
diff --git a/lib/mods/theme/scpt/mimic.lua b/lib/mods/theme/scpt/mimic.lua
deleted file mode 100644
index f38f70f7..00000000
--- a/lib/mods/theme/scpt/mimic.lua
+++ /dev/null
@@ -1,419 +0,0 @@
--- Define the various possible mimic shapes
-
--- Nature shapes
-add_mimic_shape
-{
- ["name"] = "Mouse",
- ["obj_name"] = "Mouse Fur",
- ["desc"] = "Mice are small, fast and very stealthy",
- ["realm"] = "nature",
- ["level"] = 1,
- ["rarity"] = 10,
- ["duration"] = {20, 40},
- ["calc"] = function ()
- -- Mice run!
- player.pspeed = player.pspeed + 5 + (player.mimic_level / 7)
-
- -- They can crtawl under your armor to hit you ;)
- player.to_h = player.to_h + 10 + (player.mimic_level / 5)
- player.dis_to_h = player.dis_to_h + 10 + (player.mimic_level / 5)
-
- -- But they are not very powerfull
- player.to_d = player.to_d / 5
- player.dis_to_d = player.dis_to_d / 5
-
- -- But they are stealthy
- player.skill_stl = player.skill_stl + 10 + (player.mimic_level / 5)
-
- -- Stat mods
- player.modify_stat(A_STR, -5)
- player.modify_stat(A_DEX, 3)
- player.modify_stat(A_CON, 1)
-
- end,
- ["power"] = function()
- if player.mimic_level >= 30 then
- player.add_power(POWER_INVISIBILITY)
- end
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Eagle",
- ["obj_name"] = "Feathered Cloak",
- ["desc"] = "Eagles are master of the air, good hunters with excellent vision.",
- ["realm"] = "nature",
- ["level"] = 10,
- ["rarity"] = 30,
- ["duration"] = {10, 50},
- ["calc"] = function ()
- player.ffall = TRUE
- player.pspeed = player.pspeed + 2 + (player.mimic_level / 6)
-
- player.modify_stat(A_STR, -3)
- player.modify_stat(A_DEX, 2 + (player.mimic_level / 15))
- player.modify_stat(A_CON, 4 + (player.mimic_level / 20))
- player.modify_stat(A_INT, -1)
- player.modify_stat(A_WIS, 1)
- player.modify_stat(A_CHR, -1)
-
- if player.mimic_level >= 20 then
- player.xtra_f4 = bor(player.xtra_f4, TR4_FLY)
- player.xtra_f3 = bor(player.xtra_f3, TR3_SEE_INVIS)
- end
- if player.mimic_level >= 25 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- end
- if player.mimic_level >= 30 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_ELEC)
- end
- if player.mimic_level >= 30 then
- player.xtra_f3 = bor(player.xtra_f3, TR3_SH_ELEC)
- end
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Wolf",
- ["obj_name"] = "Wolf Pelt",
- ["desc"] = "Wolves are masters of movement, strong and have excellent eyesight.",
- ["realm"] = "nature",
- ["level"] = 20,
- ["rarity"] = 40,
- ["duration"] = {10, 50},
- ["calc"] = function ()
- player.modify_stat(A_STR, 2 + (player.mimic_level / 20))
- player.modify_stat(A_DEX, 3 + (player.mimic_level / 20))
- player.modify_stat(A_INT, -3)
- player.modify_stat(A_CHR, -2)
-
- player.pspeed = player.pspeed + 10 + (player.mimic_level / 5)
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_FEAR)
-
- if player.mimic_level >= 10 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_COLD)
- end
- if player.mimic_level >= 15 then
- player.xtra_f3 = bor(player.xtra_f3, TR3_SEE_INVIS)
- end
- if player.mimic_level >= 30 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_DARK)
- end
- if player.mimic_level >= 35 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_CONF)
- end
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Spider",
- ["obj_name"] = "Spider Web",
- ["desc"] = "Spiders are clever and become good climbers.",
- ["realm"] = "nature",
- ["level"] = 25,
- ["rarity"] = 50,
- ["duration"] = {10, 50},
- ["calc"] = function ()
- player.modify_stat(A_STR, -4)
- player.modify_stat(A_DEX, 1 + (player.mimic_level / 8))
- player.modify_stat(A_INT, 1 + (player.mimic_level / 5))
- player.modify_stat(A_WIS, 1 + (player.mimic_level / 5))
- player.modify_stat(A_CON, -5)
- player.modify_stat(A_CHR, -10)
-
- player.pspeed = player.pspeed + 5
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_FEAR)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_DARK)
-
- if player.mimic_level >= 40 then
- player.xtra_f4 = bor(player.xtra_f4, TR4_CLIMB)
- end
-
- end,
- ["power"] = function()
- if player.mimic_level >= 25 then
- player.add_power(POWER_WEB)
- end
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Elder Ent",
- ["obj_name"] = "Entish Bark",
- ["desc"] = "Ents are powerful tree-like beings dating from the dawn of time.",
- ["realm"] = "nature",
- ["level"] = 40,
- ["rarity"] = 60,
- ["duration"] = {10, 30},
- ["limit"] = TRUE,
- ["calc"] = function ()
- player.pspeed = player.pspeed - 5 - (player.mimic_level / 10)
-
- player.to_a = player.to_a + 10 + player.mimic_level
- player.dis_to_a = player.dis_to_a + 10 + player.mimic_level
-
- player.modify_stat(A_STR, player.mimic_level / 5)
- player.modify_stat(A_INT, - (player.mimic_level / 7))
- player.modify_stat(A_WIS, - (player.mimic_level / 7))
- player.modify_stat(A_DEX, -4)
- player.modify_stat(A_CON, player.mimic_level / 5)
- player.modify_stat(A_CHR, -7)
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_COLD)
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN)
- player.xtra_f3 = bor(player.xtra_f3, TR3_SEE_INVIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_SENS_FIRE)
- end,
- ["power"] = function ()
- player.add_power(PWR_GROW_TREE)
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Vapour",
- ["obj_name"] = "Cloak of Mist",
- ["desc"] = "A sentient cloud, darting around",
- ["realm"] = "nature",
- ["level"] = 15,
- ["rarity"] = 10,
- ["duration"] = {10, 40},
- ["calc"] = function ()
-
- player.pspeed = player.pspeed + 5
-
- --Try to hit a cloud!
- player.to_a = player.to_a + 40 + player.mimic_level
- player.dis_to_a = player.dis_to_a + 40 + player.mimic_level
-
- --Try to hit WITH a cloud!
- player.to_h = player.to_h - 40
- player.dis_to_h = player.dis_to_h -40
-
- -- Stat mods
- player.modify_stat(A_STR, -4)
- player.modify_stat(A_DEX, 5)
- player.modify_stat(A_CON, -4)
- player.modify_stat(A_CHR, -10)
-
- -- But they are stealthy
- player.skill_stl = player.skill_stl + 10 + (player.mimic_level / 5)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_SHARDS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_COLD)
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN)
- player.xtra_f3 = bor(player.xtra_f3, TR3_SEE_INVIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_SENS_FIRE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_FEATHER)
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Serpent",
- ["obj_name"] = "Snakeskin Cloak",
- ["desc"] = "Serpents are fast, lethal predators.",
- ["realm"] = "nature",
- ["level"] = 30,
- ["rarity"] = 25,
- ["duration"] = {15, 20},
- ["calc"] = function ()
- player.pspeed = player.pspeed + 10 + (player.mimic_level / 6)
- player.to_a = player.to_a + 3 + (player.mimic_level / 8)
- player.dis_to_a = player.dis_to_a + 3 + (player.mimic_level / 8)
-
- player.modify_stat(A_STR, player.mimic_level / 8)
- player.modify_stat(A_INT, -6)
- player.modify_stat(A_WIS, -6)
- player.modify_stat(A_DEX, -4)
- player.modify_stat(A_CON, player.mimic_level / 7)
- player.modify_stat(A_CHR, -6)
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- if player.mimic_level >= 25 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- end
- end,
-}
-
-add_mimic_shape
-{
- ["name"] = "Mumak",
- ["obj_name"] = "Mumak Hide",
- ["desc"] = "A giant, elaphantine form.",
- ["realm"] = "nature",
- ["level"] = 40,
- ["rarity"] = 40,
- ["duration"] = {15, 20},
- ["calc"] = function ()
- player.pspeed = player.pspeed - 5 - (player.mimic_level / 10)
- player.to_a = player.to_a + 10 + (player.mimic_level / 6)
- player.dis_to_a = player.dis_to_a + 10 + (player.mimic_level / 6)
- player.to_d = player.to_d + 5 + ((player.mimic_level * 2) / 3)
- player.dis_to_d = player.dis_to_d + 5 + ((player.mimic_level * 2) / 3)
-
- player.modify_stat(A_STR, player.mimic_level / 4)
- player.modify_stat(A_INT, -8)
- player.modify_stat(A_WIS, -4)
- player.modify_stat(A_DEX, -5)
- player.modify_stat(A_CON, player.mimic_level / 3)
- player.modify_stat(A_CHR, -10)
-
- if player.mimic_level >= 10 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_FEAR)
- end
- if player.mimic_level >= 25 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_CONF)
- end
- if player.mimic_level >= 30 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- end
- if player.mimic_level >= 35 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_NEXUS)
- end
- end,
-}
-
---------- Extra shapes -----------
-
--- For Beornings
-add_mimic_shape
-{
- ["name"] = "Bear",
- ["desc"] = "A fierce, terrible bear.",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {50, 200},
- ["limit"] = TRUE,
- ["calc"] = function ()
- player.pspeed = player.pspeed - 5 + (player.mimic_level / 5)
-
- player.to_a = player.to_a + 5 + ((player.mimic_level * 2) / 3)
- player.dis_to_a = player.dis_to_a + 5 + ((player.mimic_level * 2) / 3)
-
- player.modify_stat(A_STR, player.mimic_level / 11)
- player.modify_stat(A_INT, player.mimic_level / 11)
- player.modify_stat(A_WIS, player.mimic_level / 11)
- player.modify_stat(A_DEX, -1)
- player.modify_stat(A_CON, player.mimic_level / 11)
- player.modify_stat(A_CHR, -10)
-
- if player.mimic_level >= 10 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_FREE_ACT)
- end
- if player.mimic_level >= 20 then
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN)
- end
- if player.mimic_level >= 30 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_CONF)
- end
- if player.mimic_level >= 35 then
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_NEXUS)
- end
-
- -- activate the skill
- skill(SKILL_BEAR).hidden = FALSE
- end,
-}
-
--- For balrog corruptions
-add_mimic_shape
-{
- ["name"] = "Balrog",
- ["desc"] = "A corrupted maia.",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {30, 70},
- ["limit"] = TRUE,
- ["calc"] = function ()
- player.modify_stat(A_STR, 5 + player.mimic_level / 5)
- player.modify_stat(A_INT, player.mimic_level / 10)
- player.modify_stat(A_WIS, - ( 5 + player.mimic_level / 10))
- player.modify_stat(A_DEX, player.mimic_level / 10)
- player.modify_stat(A_CON, 5 + player.mimic_level / 5)
- player.modify_stat(A_CHR, - ( 5 + player.mimic_level / 10))
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_ACID)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_FIRE)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_ELEC)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_DARK)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_CHAOS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_HOLD_LIFE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_FEATHER)
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN)
- player.xtra_f3 = bor(player.xtra_f3, TR3_SH_FIRE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_LITE1)
- return 1
- end,
-}
-
--- For avatar spell
-add_mimic_shape
-{
- ["name"] = "Maia",
- ["desc"] = "A near god-like being.",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {30, 70},
- ["limit"] = TRUE,
- ["calc"] = function ()
- player.modify_stat(A_STR, 5 + player.mimic_level / 5)
- player.modify_stat(A_INT, 5 + player.mimic_level / 5)
- player.modify_stat(A_WIS, 5 + player.mimic_level / 5)
- player.modify_stat(A_DEX, 5 + player.mimic_level / 5)
- player.modify_stat(A_CON, 5 + player.mimic_level / 5)
- player.modify_stat(A_CHR, 5 + player.mimic_level / 5)
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_FIRE)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_ELEC)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_ACID)
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_COLD)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_LITE)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_DARK)
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_CHAOS)
- player.xtra_f2 = bor(player.xtra_f2, TR2_HOLD_LIFE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_FEATHER)
- player.xtra_f3 = bor(player.xtra_f3, TR3_REGEN)
- return 2
- end,
-}
-
--- For Geomancy
-add_mimic_shape
-{
- ["name"] = "Fire Elem.",
- ["desc"] = "A towering column of flames",
- ["realm"] = nil,
- ["level"] = 1,
- ["rarity"] = 101,
- ["duration"] = {10, 10},
- ["limit"] = TRUE,
- ["calc"] = function ()
- player.modify_stat(A_STR, 5 + (player.mimic_level / 5))
- player.modify_stat(A_DEX, 5 + (player.mimic_level / 5))
- player.modify_stat(A_WIS, -5 - (player.mimic_level / 5))
-
- player.xtra_f2 = bor(player.xtra_f2, TR2_IM_FIRE)
- -- was immune to poison in the 3.0.0 version
- player.xtra_f2 = bor(player.xtra_f2, TR2_RES_POIS)
- player.xtra_f3 = bor(player.xtra_f3, TR3_SH_FIRE)
- player.xtra_f3 = bor(player.xtra_f3, TR3_LITE1)
- return 0
- end,
-}
diff --git a/lib/mods/theme/scpt/misc.lua b/lib/mods/theme/scpt/misc.lua
deleted file mode 100644
index acb45f3c..00000000
--- a/lib/mods/theme/scpt/misc.lua
+++ /dev/null
@@ -1,213 +0,0 @@
--- New scrolls
-function sterilize_scroll(tval, sval)
- if tval == 70 and sval == 54 then
- msg_print("A neutralising wave radiates from you!")
- set_no_breeders(randint(100) + 100)
- return TRUE
- end
-end
-
-add_hook_script(HOOK_READ, "sterilize_scroll", "sterilize_scroll")
-
--- Neil's automagic statgain script
-
-player.last_rewarded_level = 1
-add_loadsave("player.last_rewarded_level", 1)
-
-add_hooks
- {
- [HOOK_PLAYER_LEVEL] = function()
- while player.last_rewarded_level * 5 <= player.lev do
- do_inc_stat(A_STR)
- do_inc_stat(A_INT)
- do_inc_stat(A_WIS)
- do_inc_stat(A_DEX)
- do_inc_stat(A_CON)
- do_inc_stat(A_CHR)
- player.last_rewarded_level = player.last_rewarded_level + 1
- end
- end,
- }
-
-add_hooks
-{
- [HOOK_BIRTH_OBJECTS] = function()
- if player.last_rewarded_level >= 1
- then player.last_rewarded_level = 1
- else
- end
- end
-}
-
--- silly function that allows a drunk to take a bottle of wine/ale from the player
-
-function drunk_takes_wine(m_idx, item)
-
- m_ptr = monster(m_idx)
- o_ptr = get_object(item)
-
- if (m_ptr.r_idx == test_monster_name("Singing, happy drunk"))
- and (o_ptr.tval == TV_FOOD) and ((o_ptr.sval == 38) or (o_ptr.sval == 39)) then
-
- cmsg_print(TERM_YELLOW, "'Hic!'")
-
- inven_item_increase(item, -1)
- inven_item_optimize(item)
-
--- HackSmurf: the drunk may drop an empty bottle
- bottle = create_object(TV_BOTTLE,1)
- drop_near(bottle, 50, player.py, player.px)
- return TRUE
- else
- return FALSE
- end
-end
-
-add_hook_script(HOOK_GIVE, "drunk_takes_wine", "drunk_takes_wine")
-
--- winged races are allowed soft armor only, no cloaks (from T-Plus)
-function __hook_wings_wear(obj)
- local str = get_race_name()
- local type = obj.tval
- if (str == "Dragon" or str == "Eagle") and (type == 35 or type == 37 or type == 38) then
- return TRUE, -1
- end
-end
-
-add_hook_script(HOOK_WIELD_SLOT, "__hook_wings_wear", "__hook_wings_wear")
-
--- A not-too-scummy way of generating junk for ammo
-function food_vessel(object)
- if ((object.tval == 80) and (object.sval == 43)) or
- ((object.tval == 80) and (object.sval == 44)) then
- local obj = create_object(TV_JUNK, 3)
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- return FALSE
- end
-end
-
-add_hook_script(HOOK_EAT, "food_vessel", "food_vessel")
-
--- Longbottom Leaf *is* a great stress reliever:
-function longbottom_leaf(object)
- if (object.tval == 80) and (object.sval == 45) then
- msg_print("What a stress reliever!")
- heal_insanity(1000)
- return FALSE
- end
-end
-add_hook_script(HOOK_EAT, "longbottom_leaf", "longbottom_leaf")
-
--- Hobbits like food
-function hobbit_food(m_idx, item)
-
- m_ptr = monster(m_idx)
- o_ptr = get_object(item)
-
- if (m_ptr.r_idx == test_monster_name("Scruffy-looking hobbit"))
- and (o_ptr.tval == TV_FOOD) then
- cmsg_print(TERM_YELLOW, "'Yum!'")
- inven_item_increase(item, -1)
- inven_item_optimize(item)
- return TRUE
- else
- return FALSE
- end
-end
-
-add_hook_script(HOOK_GIVE, "hobbit_food", "hobbit_food")
-
--- Smeagol likes rings
-function smeagol_ring(m_idx, item)
-
- m_ptr = monster(m_idx)
- o_ptr = get_object(item)
-
- if (m_ptr.r_idx == test_monster_name("Smeagol"))
- and (o_ptr.tval == TV_RING) then
-
- cmsg_print(TERM_YELLOW, "'MY... PRECIOUSSSSS!!!'")
-
- inven_item_increase(item, -1)
- inven_item_optimize(item)
- return TRUE
- else
- return FALSE
- end
-end
-
-add_hook_script(HOOK_GIVE, "smeagol_ring", "smeagol_ring")
-
--- functions to check for Map and Key of Thror before proceeding in Erebor
--- Thank you, Massimiliano Marangio :-)
-add_hooks
-{
- [HOOK_STAIR] = function(direction)
- if ((current_dungeon_idx == 20) and (dun_level == 60) and (direction == "down")) then
- local i
- local mapkey = 0
- for i = 0, INVEN_TOTAL - 1 do
- if ((player.inventory(i).name1 == 209) or (player.inventory(i).name1 == 210)) then
- mapkey = mapkey + 1
- end
- end
-
- if (mapkey == 2) then
- msg_print("The moon-letters on the map show you the keyhole! You use the key to enter.")
- return FALSE
- else
- msg_print("You have found a door, but you cannot find a way to enter. Ask in Dale, perhaps?")
- return TRUE
- end
- end
- return FALSE
- end,
-}
-
--- function to make the Dale mayor tell you about how to get to Erebor 61
-add_building_action
-{
- ["index"] = 66,
- ["action"] = function()
- msg_print("You will need Thorin's Key and Thrain's Map to get anywhere in Erebor. One may be found in the Barrow-Downs. The other, in Mirkwood.")
- end
-}
-
--- function to make Melkor like it if a player quaffs potions of corruption
-function melkor_potion_corruption(object)
- if (player.pgod == GOD_MELKOR) then
- if (object.tval == TV_POTION) and (object.sval == SV_POTION_MUTATION) then
- msg_print("Your quaffing of this potion pleases Melkor!")
- set_grace(player.grace + 2)
- return FALSE
- end
- end
-end
-add_hook_script(HOOK_QUAFF, "melkor_potion_corruption", "melkor_potion_corruption")
-
--- function to check for Key of Orthanc before proceeding to the final level in Isengard
-add_hooks
-{
- [HOOK_STAIR] = function(direction)
- if ((current_dungeon_idx == 36) and (dun_level == 39) and (direction == "down")) then
- local i
- local orthkey = 0
- for i = 0, INVEN_TOTAL - 1 do
- if (player.inventory(i).name1 == 15) then
- orthkey = orthkey + 1
- end
- end
-
- if (orthkey == 1) then
- msg_print("#BYou have the key to the tower of Orthanc! You may proceed.#w")
- return FALSE
- else
- msg_print("#yYou may not enter Orthanc without the key to the gates!#w Rumours say the key was lost in the Mines of Moria...")
- return TRUE
- end
- end
- return FALSE
- end,
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/mkeys.lua b/lib/mods/theme/scpt/mkeys.lua
deleted file mode 100644
index 07105c64..00000000
--- a/lib/mods/theme/scpt/mkeys.lua
+++ /dev/null
@@ -1,95 +0,0 @@
--- Mkeys for skills & abilities
-
-GF_INSTA_DEATH = add_spell_type
-{
- ["color"] = { TERM_DARK, 0 },
- ["angry"] = function() return TRUE, TRUE end,
- ["monster"] = function(who, dam, rad, y, x, monst)
- local race = race_info_idx(monst.r_idx, monst.ego)
- if magik(5) == FALSE or band(race.flags1, RF1_UNIQUE) ~= FALSE or band(race.flags3, RF3_UNDEAD) ~= FALSE or band(race.flags3, RF3_NONLIVING) ~= FALSE then
- return TRUE, FALSE
- else
- -- Reduce the exp gained this way
- monst.level = monst.level / 3
- return TRUE, FALSE, 32535, 0, 0, 0, 0, 0, 0, 0, " faints.", " is sucked out of life."
- end
- end,
-}
-
--- Death touch ability
-add_mkey
-{
- ["mkey"] = 100,
- ["fct"] = function()
- if player.csp > 40 then
- increase_mana(-40)
- set_project(randint(30) + 10, GF_INSTA_DEATH, 1, 0, bor(PROJECT_STOP, PROJECT_KILL))
- energy_use = 100
- else
- msg_print("You need at least 40 mana.")
- end
- end,
-}
-
-
--- Geomancy skill
-add_mkey
-{
- ["mkey"] = 101,
- ["fct"] = function()
- local s
-
- -- No magic
- if (player.antimagic > 0) then
- msg_print("Your anti-magic field disrupts any magic attempts.")
- return
- end
-
- local obj = get_object(INVEN_WIELD)
- if (obj.k_idx <= 0) or (obj.tval ~= TV_MSTAFF) then
- msg_print('You must wield a magestaff to use Geomancy.')
- return
- end
-
- s = get_school_spell("cast", "is_ok_spell", 62);
-
- -- Actualy cast the choice
- if (s ~= -1) then
- cast_school_spell(s, spell(s))
- end
- end,
-}
-
--- Far reaching attack of polearms
-add_mkey
-{
- ["mkey"] = 102,
- ["fct"] = function()
- local weapon = get_object(INVEN_WIELD);
- if weapon.tval == TV_POLEARM then
- else
- msg_print("You will need a long polearm for this!")
- return
- end
-
- ret, dir = get_rep_dir()
- if ret == FALSE then return end
-
- local dy, dx = explode_dir(dir)
- dy = dy * 2
- dx = dx * 2
- targety = player.py + dy
- targetx = player.px + dx
-
- local max_blows = get_skill_scale(SKILL_POLEARM, player.num_blow / 2)
- if max_blows == 0 then max_blows = 1 end
-
- if get_skill(SKILL_POLEARM) >= 40 then
- energy_use = energy_use + 200
- return project(0, 0, targety, targetx, max_blows, GF_ATTACK, bor(PROJECT_BEAM, PROJECT_KILL))
- else
- energy_use = energy_use + 200
- return project(0, 0, targety, targetx, max_blows, GF_ATTACK, bor(PROJECT_BEAM, PROJECT_STOP, PROJECT_KILL))
- end
- end,
-}
diff --git a/lib/mods/theme/scpt/monsters.lua b/lib/mods/theme/scpt/monsters.lua
deleted file mode 100644
index ad3a5628..00000000
--- a/lib/mods/theme/scpt/monsters.lua
+++ /dev/null
@@ -1,182 +0,0 @@
--- This file holds various things that govern monster behaviour with respect to the player
-
--- Enables player to push past any monster who is >= MSTATUS_NEUTRAL.
--- Written by BauMog for the Intets Hevn module; permission granted to use in the Theme module
-
--- Adapted from defines.h
-function cave_floor_bold(y, x)
- local c_ptr = cave(y, x);
- if(cave_is(c_ptr, FF1_FLOOR) == TRUE) and (c_ptr.feat ~= FEAT_MON_TRAP) then
- return TRUE
- else
- return FALSE
- end
-end
-
--- Adapted from cmd1.c
-function __hook_push_past(y, x)
- local c_ptr = cave(y, x);
-
- if(c_ptr.m_idx > 0) then
- m_ptr = monster(c_ptr.m_idx);
- if(m_ptr.status >= MSTATUS_NEUTRAL) then
- if(cave_floor_bold(y, x) == TRUE) or (m_ptr.flags2 == RF2_PASS_WALL) then
- msg_print(format("You push past %s.", monster_desc(m_ptr, 0)));
- m_ptr.fy = player.py;
- m_ptr.fx = player.px;
- cave(player.py, player.px).m_idx = c_ptr.m_idx;
- c_ptr.m_idx = 0;
- else
- msg_print(format("%s is in your way!", monster_desc(m_ptr, 0)));
- energy_use = 0;
- end
- end
- end
-
-end
-
-add_hook_script(HOOK_MOVE, "__hook_push_past", "__hook_push_past");
-
--- Monster vs. Player Race alignment script
--- From T-Plus by Ingeborg S. Norden
-
-monst_al = {}
-
-function monst_al_add(status, mrs, prs)
-for i,v in mrs do
--- added end
-if not monst_al[v] then monst_al[v] = {} end
-for j, w in prs do
-monst_al[v][w] = status
-end
-end
-end
-
-function monst_al_get(mr,pr)
- if monst_al[mr] then return monst_al[mr][pr]
- else return end
-end
-
--- Maia aggravation for evil beings (provided that no demonic corruptions are present)
--- Based on parts of angel.lua from T-Plus by Ingeborg S. Norden
-
--- cast dispel evil with 0 damage every 10 turns
-
-TIMER_AGGRAVATE_EVIL = new_timer
-{
- ["enabled"] = FALSE,
- ["delay"] = 10,
- ["callback"] = function()
- dispel_evil(0)
- end,
-}
-
-add_hooks{
-[HOOK_GAME_START] = function()
-
- if ((get_race_name() == "Maia") and
- (player.corruption(CORRUPT_BALROG_AURA) ~= TRUE) and
- (player.corruption(CORRUPT_BALROG_WINGS) ~= TRUE) and
- (player.corruption(CORRUPT_BALROG_STRENGTH) ~= TRUE) and
- (player.corruption(CORRUPT_BALROG_FORM) ~= TRUE)) then
- -- "Proper" Maiar aggravate evil beings
- TIMER_AGGRAVATE_EVIL.enabled = TRUE
- -- Good beings (except swans, GWoPs, Wyrm Spirits, and some joke uniques) are coaligned with Maiar
-
- monst_al_add(MSTATUS_FRIEND, {25, 29, 45, 97, 109, 147, 225, 335, 346, 443, 581, 629, 699, 853, 984, 1007, 1017}, {21})
-
- -- Non-evil humanoids are neutral to Humans, Dunedain, Druedain, Rohirrim
- elseif ((get_race_name() == "Human") or
- (get_race_name() == "Dunadan") or
- (get_race_name() == "Druadan") or
- (get_race_name() == "RohanKnight")) then
- monst_al_add(MSTATUS_NEUTRAL, {43, 45, 46, 83, 93, 97, 109, 110, 142, 147, 216, 225, 293, 345, 346, 693, 699, 937, 988, 997, 998, 1000},{0, 8, 12, 16})
-
- -- Non-evil sentient (and non-animal) creatures are neutral to Hobbits, Elves, Wood-Elves
- elseif ((get_race_name() == "Hobbit") or
- (get_race_name() == "Elf") or
- (get_race_name() == "Wood-Elf")) then
- monst_al_add(MSTATUS_NEUTRAL, {43, 45, 46, 83, 93, 97, 109, 110, 142, 147, 216, 225, 293, 345, 346, 693, 699, 937, 988, 997, 998, 1000, 74, 103, 882, 1017},{2, 3, 20})
-
- -- Gnome monsters are neutral to Gnomes
- elseif get_race_name() == "Gnome" then
- monst_al_add(MSTATUS_NEUTRAL, {103, 281, 680, 984, 1001, 1003, 1007, 1011, 1014, 1016},{4})
-
- -- Dwarven monsters are neutral to Petty-dwarves and Dwarves
- elseif ((get_race_name() == "Dwarf") or
- (get_race_name() == "Petty-Dwarf")) then
- monst_al_add(MSTATUS_NEUTRAL, {111, 112, 179, 180, 181, 182},{5, 13})
-
- -- If an Orc character worships Melkor, lower-level Orcs are neutral (not Uruk-hai, however)
- elseif ((get_race_name() == "Orc") and
- (player.pgod == GOD_MELKOR)) then
- monst_al_add(MSTATUS_FRIEND, {87, 118, 126, 149, 244, 251, 264},{6})
-
- -- If a Troll character worships Melkor, Trolls are neutral (not Eldraks, Ettins, and War trolls, though)
- elseif ((get_race_name() == "Troll") and
- (player.pgod == GOD_MELKOR)) then
- monst_al_add(MSTATUS_NEUTRAL, {297, 401, 403, 424, 454, 491, 496, 509, 538},{7})
-
- -- Ogres are neutral to Half-Ogres
- elseif get_race_name() == "Half-Ogre" then
- monst_al_add(MSTATUS_NEUTRAL, {262, 285, 415, 430, 479, 745, 918},{10})
-
- -- Bears are neutral to Beornings, except werebears.
- elseif get_race_name() == "Beorning" then
- monst_al_add(MSTATUS_NEUTRAL, {160, 173, 191, 854, 855, 867, 873},{11})
-
- -- Dark elven monsters are coaligned with Dark Elves
- elseif get_race_name() == "Dark-Elf" then
- monst_al_add(MSTATUS_FRIEND, {122, 178, 183, 226, 348, 375, 400, 657},{14})
-
- -- Plants are coaligned with Ents
- elseif get_race_name() == "Ent" then
- monst_al_add(MSTATUS_FRIEND, {248, 266, 317, 329, 396},{15})
-
- -- And since the above is largely useless except out in the wild...
- -- If an Ent worships Yavanna, lower-level animals are coaligned
- -- should make the early game a bit easier for Ents.
- elseif ((get_race_name() == "Ent") and
- (player.pgod == GOD_YAVANNA)) then
- monst_al_add(MSTATUS_FRIEND, {21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 49, 50, 52, 56, 57, 58, 59, 60, 61, 62, 69, 70, 75, 77, 78, 79, 86, 88, 89, 90, 95, 96, 105, 106, 114, 119, 120, 121, 123, 127, 134, 141, 143, 151, 154, 155, 156, 160, 161, 168, 171, 173, 174, 175, 176, 187, 191, 196, 197, 198, 210, 211, 213, 230, 236, 250, 259},{15})
-
- -- All non-evil non-neutral birds are coaligned with Eagles
- elseif get_race_name() == "Eagle" then
- monst_al_add(MSTATUS_FRIEND, {61, 141, 151, 279},{17})
-
- -- Hatchling dragons are coaligned with Dragons
- elseif get_race_name() == "Dragon" then
- monst_al_add(MSTATUS_FRIEND, {163, 164, 165, 166, 167, 204, 218, 219, 911},{18})
-
- -- Yeeks are neutral to Yeeks
- elseif get_race_name() == "Yeek" then
- monst_al_add(MSTATUS_NEUTRAL, {580, 583, 594, 653, 655, 659, 661},{19})
-
- -- Oathbreakers are coaligned if player is wielding Anduril
- -- It's dirty, but it works, and it doesn't bother checking demons and the races who can't wield weapons.
- elseif get_object(INVEN_WIELD).name1 == 83 then
- monst_al_add(MSTATUS_FRIEND, {731},{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23})
- end
-end,
-
-[HOOK_LEVEL_END_GEN] = function()
-
-for i=0,m_max-1 do
- local monst = monster(i)
- local s = monst_al_get(monst.r_idx, player.prace)
- if s then monst.status = s end
-end
-
-end,
-
-[HOOK_NEW_MONSTER] = function()
-
-for i=0,m_max-1 do
- local monst = monster(i)
- local s = monst_al_get(monst.r_idx, player.prace)
- if s then monst.status = s end
-end
-
-end,
-
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/player.lua b/lib/mods/theme/scpt/player.lua
deleted file mode 100644
index fd11ed9d..00000000
--- a/lib/mods/theme/scpt/player.lua
+++ /dev/null
@@ -1,196 +0,0 @@
-------------------------------------------------------------------------------
------------------------ Hook to create birth objects -------------------------
-------------------------------------------------------------------------------
-function __birth_hook_objects()
-
- -- Grace delay for adding piety
- GRACE_DELAY = 0
-
- -- Provide a book of Geyser to Geomancers
- if get_class_name() == "Geomancer" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Geyser")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Provide a book of prayer to priests
- if get_class_name() == "Priest(Eru)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("See the Music")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Priest(Manwe)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Manwe's Blessing")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Druid" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Charm Animal")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Dark-Priest" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Curse")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Paladin" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Divine Aim")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Stonewright" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Firebrand")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Priest(Varda)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Light of Valinor")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Priest(Ulmo)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Song of Belegaer")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
- if get_class_name() == "Priest(Mandos)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Tears of Luthien")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- if get_class_name() == "Mimic" then
- local obj = create_object(TV_CLOAK, 100);
- obj.pval2 = resolve_mimic_name("Mouse")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the undeads, as undeads with the corruptions
- if get_subrace_name() == "Vampire" then
- player.corruption(CORRUPT_VAMPIRE_TEETH, TRUE)
- player.corruption(CORRUPT_VAMPIRE_STRENGTH, TRUE)
- player.corruption(CORRUPT_VAMPIRE_VAMPIRE, TRUE)
- end
-
- -- Start the Red (Fire) dragons with a book of Light (Theme)
- if get_subrace_name() == "Red" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Globe of Light")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Black (Water) dragons with a book of Geyser (Theme)
- if get_subrace_name() == "Black" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Geyser")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Green (Air) dragons with a book of Noxious Cloud (Theme)
- if get_subrace_name() == "Green" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Noxious Cloud")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Blue (Earth) dragons with a book of Stone Skin (Theme)
- if get_subrace_name() == "Blue" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Stone Skin")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the White dragons with a book of Sense Monsters (Theme)
- if get_subrace_name() == "White" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Sense Monsters")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Ethereal dragons with a book of Recharge (Theme)
- if get_subrace_name() == "Ethereal" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Recharge")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Aewroeg with a book of Charm (Theme)
- if get_subrace_name() == "(Aewrog)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Charm")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Narroeg with a book of blink (Theme)
- if get_subrace_name() == "(Narrog)" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Phase Door")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Peace-mages with a book of blink (Theme)
- if get_class_name() == "Peace-mage" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Phase Door")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Start the Wainriders with a book of Curse (Theme)
- if get_class_name() == "Wainrider" then
- local obj = create_object(TV_BOOK, 255);
- obj.pval = find_spell("Curse")
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- end
-
- -- Provide everyone with a scroll of WoR (Theme)
- local obj = create_object(TV_SCROLL, SV_SCROLL_WORD_OF_RECALL);
- inven_carry(obj, FALSE)
- end_object(obj)
- identify_pack_fully()
-end
-
--- Register in the hook list
-add_hook_script(HOOK_BIRTH_OBJECTS, "__birth_hook_objects", "__birth_hook_objects")
diff --git a/lib/mods/theme/scpt/powers.lua b/lib/mods/theme/scpt/powers.lua
deleted file mode 100644
index ff4c62c5..00000000
--- a/lib/mods/theme/scpt/powers.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- Various 'U' powers
-
--- Invisibility power, for the mouse mimic shape
-POWER_INVISIBILITY = add_power
-{
- ["name"] = "invisibility",
- ["desc"] = "You are able melt into the shadows to become invisible.",
- ["desc_get"] = "You suddenly become able to melt into the shadows.",
- ["desc_lose"] = "You lose your shadow-melting ability.",
- ["level"] = 30,
- ["cost"] = 10,
- ["stat"] = A_DEX,
- ["fail"] = 20,
- ["power"] = function()
- set_invis(20 + randint(30), 30)
- end,
-}
-
--- Web power, for the spider mimic shape
-POWER_WEB = add_power
-{
- ["name"] = "web",
- ["desc"] = "You are able throw a thick and very resistant spider web.",
- ["desc_get"] = "You suddenly become able to weave webs.",
- ["desc_lose"] = "You lose your web-weaving capability.",
- ["level"] = 25,
- ["cost"] = 30,
- ["stat"] = A_DEX,
- ["fail"] = 20,
- ["power"] = function()
- -- Warning, beware of f_info changes .. I hate to do that ..
- grow_things(16, 1 + (player.lev / 10))
- end,
-}
-
--- Activating/stopping space-continuum
--- When stopped it will induce constant mana loss
-player.corrupt_anti_teleport_stopped = FALSE
-add_loadsave("player.corrupt_anti_teleport_stopped", FALSE)
-POWER_COR_SPACE_TIME = add_power
-{
- ["name"] = "control space/time continuum",
- ["desc"] = "You are able to control the space/time continuum.",
- ["desc_get"] = "You become able to control the space/time continuum.",
- ["desc_lose"] = "You are no more able to control the space/time continuum.",
- ["level"] = 1,
- ["cost"] = 10,
- ["stat"] = A_WIS,
- ["fail"] = 10,
- ["power"] = function()
- if player.corrupt_anti_teleport_stopped == TRUE then
- player.corrupt_anti_teleport_stopped = FALSE
- msg_print("You stop controlling your corruption.")
- player.update = bor(player.update, PU_BONUS)
- else
- player.corrupt_anti_teleport_stopped = TRUE
- msg_print("You start controlling your corruption, teleportation works once more.")
- player.update = bor(player.update, PU_BONUS)
- end
- end,
-}
diff --git a/lib/mods/theme/scpt/s_air.lua b/lib/mods/theme/scpt/s_air.lua
deleted file mode 100644
index afd1f584..00000000
--- a/lib/mods/theme/scpt/s_air.lua
+++ /dev/null
@@ -1,193 +0,0 @@
--- handle the air school
-
-NOXIOUSCLOUD = add_spell
-{
- ["name"] = "Noxious Cloud",
- ["school"] = {SCHOOL_AIR},
- ["level"] = 3,
- ["mana"] = 3,
- ["mana_max"] = 30,
- ["fail"] = 20,
- ["stick"] =
- {
- ["charge"] = { 5, 7 },
- [TV_WAND] =
- {
- ["rarity"] = 15,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir, type
-
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- if get_level(NOXIOUSCLOUD, 50) >= 30 then type = GF_UNBREATH
- else type = GF_POIS end
- fire_cloud(type, dir, 7 + get_level(NOXIOUSCLOUD, 150), 3, 5 + get_level(NOXIOUSCLOUD, 40))
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(7 + get_level(NOXIOUSCLOUD, 150)).." rad 3 dur "..(5 + get_level(NOXIOUSCLOUD, 40))
- end,
- ["desc"] = {
- "Creates a cloud of poison",
- "The cloud will persist for some turns, damaging all monsters passing by",
- "At spell level 30 it turns into a thick gas attacking all living beings"
- }
-}
-
-AIRWINGS = add_spell
-{
- ["name"] = "Wings of Winds",
- ["school"] = {SCHOOL_AIR, SCHOOL_CONVEYANCE},
- ["level"] = 22,
- ["mana"] = 30,
- ["mana_max"] = 40,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 7, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 27,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- if get_level(AIRWINGS, 50) >= 16 then
- if player.tim_fly == 0 then return set_tim_fly(randint(10) + 5 + get_level(AIRWINGS, 25)) end
- else
- if player.tim_ffall == 0 then return set_tim_ffall(randint(10) + 5 + get_level(AIRWINGS, 25)) end
- end
- return FALSE
- end,
- ["info"] = function()
- return "dur "..(5 + get_level(AIRWINGS, 25)).."+d10"
- end,
- ["desc"] = {
- "Grants the power of levitation",
- "At level 16 it grants the power of controlled flight"
- }
-}
-
-INVISIBILITY = add_spell
-{
- ["name"] = "Invisibility",
- ["school"] = {SCHOOL_AIR},
- ["level"] = 16,
- ["mana"] = 10,
- ["mana_max"] = 20,
- ["fail"] = 50,
- ["inertia"] = { 1, 30 },
- ["spell"] = function()
- if player.tim_invisible == 0 then return set_invis(randint(20) + 15 + get_level(INVISIBILITY, 50), 20 + get_level(INVISIBILITY, 50)) end
- end,
- ["info"] = function()
- return "dur "..(15 + get_level(INVISIBILITY, 50)).."+d20 power "..(20 + get_level(INVISIBILITY, 50))
- end,
- ["desc"] = {
- "Grants invisibility"
- }
-}
-
-POISONBLOOD = add_spell
-{
- ["name"] = "Poison Blood",
- ["school"] = {SCHOOL_AIR},
- ["level"] = 12,
- ["mana"] = 10,
- ["mana_max"] = 20,
- ["fail"] = 30,
- ["stick"] =
- {
- ["charge"] = { 10, 15 },
- [TV_WAND] =
- {
- ["rarity"] = 45,
- ["base_level"] = { 1, 25 },
- ["max_level"] = { 35, 50 },
- },
- },
- ["inertia"] = { 1, 35 },
- ["spell"] = function()
- local obvious = nil
- if player.oppose_pois == 0 then obvious = set_oppose_pois(randint(30) + 25 + get_level(POISONBLOOD, 25)) end
- if (player.tim_poison == 0) and (get_level(POISONBLOOD, 50) >= 15) then obvious = is_obvious(set_poison(randint(30) + 25 + get_level(POISONBLOOD, 25)), obvious) end
- return obvious
- end,
- ["info"] = function()
- return "dur "..(25 + get_level(POISONBLOOD, 25)).."+d30"
- end,
- ["desc"] = {
- "Grants resist poison",
- "At level 15 it provides poison branding to wielded weapon"
- }
-}
-
-THUNDERSTORM = add_spell
-{
- ["name"] = "Thunderstorm",
- ["school"] = {SCHOOL_AIR, SCHOOL_NATURE},
- ["level"] = 25,
- ["mana"] = 40,
- ["mana_max"] = 60,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 5, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 85,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["inertia"] = { 2, 15 },
- ["spell"] = function()
- if player.tim_thunder == 0 then return set_tim_thunder(randint(10) + 10 + get_level(THUNDERSTORM, 25), 5 + get_level(THUNDERSTORM, 10), 10 + get_level(THUNDERSTORM, 25)) end
- return FALSE
- end,
- ["info"] = function()
- return "dam "..(5 + get_level(THUNDERSTORM, 10)).."d"..(10 + get_level(THUNDERSTORM, 25)).." dur "..(10 + get_level(THUNDERSTORM, 25)).."+d10"
- end,
- ["desc"] = {
- "Charges up the air around you with electricity",
- "Each turn it will throw a thunder bolt at a random monster in sight",
- "The thunder does 3 types of damage, one third of lightning",
- "one third of sound and one third of light"
- }
-}
-
-STERILIZE = add_spell
-{
- ["name"] = "Sterilize",
- ["school"] = {SCHOOL_AIR},
- ["level"] = 20,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 50,
- ["stick"] =
- {
- ["charge"] = { 7, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 20,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["spell"] = function()
- set_no_breeders((30) + 20 + get_level(STERILIZE, 70))
- return TRUE
- end,
- ["info"] = function()
- return "dur "..(20 + get_level(STERILIZE, 70)).."+d30"
- end,
- ["desc"] = {
- "Prevents explosive breeding for a while."
- }
-}
diff --git a/lib/mods/theme/scpt/s_aule.lua b/lib/mods/theme/scpt/s_aule.lua
deleted file mode 100644
index d3ca4733..00000000
--- a/lib/mods/theme/scpt/s_aule.lua
+++ /dev/null
@@ -1,222 +0,0 @@
--- Spells for Aule school
-
-BOOK_AULE = 63
-
-AULE_FIREBRAND = add_spell
-{
- ["name"] = "Firebrand",
- ["school"] = {SCHOOL_AULE},
- ["level"] = 1,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local type, rad
- local level = get_level(AULE_FIREBRAND)
- type = GF_FIRE
-
- if (get_level(AULE_FIREBRAND) > 30) then
- type = GF_HOLY_FIRE
- end
-
- rad = 0
- if (level >= 15) then
- rad = 1
- end
- return set_project(level + randint(20),
- type, 4 + level, rad,
- bor(PROJECT_STOP, PROJECT_KILL))
- end,
- ["info"] = function()
- local level = get_level(AULE_FIREBRAND)
- return "dur "..(level).."+d20 dam "..(4 + level).."/blow"
- end,
- ["desc"] = {
- "Imbues your melee weapon with fire to deal more damage",
- "At level 15 it spreads over a 1 radius zone around your target",
- "At level 30 it deals holy fire damage"
- }
-}
-
-AULE_ENCHANT_WEAPON = add_spell
-{
- ["name"] = "Enchant Weapon",
- ["school"] = {SCHOOL_AULE},
- ["level"] = 10,
- ["mana"] = 100,
- ["mana_max"] = 200,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local level = get_level(AULE_ENCHANT_WEAPON)
- local num_h, num_d, num_p
-
- local ret, item, obj
-
- num_h = 1 + randint(level/12)
- num_d = 0
- num_p = 0
- if (level >= 5) then
- num_d = 1 + randint(level/12)
- end
- if (level >= 45) then
- num_p = 1
- end
- --return enchant_spell(num_h, num_d, 0, num_p)
-
- ret, item = get_item("Which object do you want to enchant?",
- "You have no objects to enchant.",
- bor(USE_INVEN),
- function (obj)
- if obj.name1 > 0 then return FALSE end
- if (obj.tval == TV_MSTAFF) then
- return TRUE
- elseif (obj.tval == TV_BOW) then
- return TRUE
- elseif (obj.tval == TV_HAFTED) then
- return TRUE
- elseif (obj.tval == TV_POLEARM) then
- return TRUE
- elseif (obj.tval == TV_SWORD) then
- return TRUE
- elseif (obj.tval == TV_AXE) then
- return TRUE
- end
- return FALSE
- end
- )
- if ret == FALSE then return FALSE end
-
- obj = get_object(item)
-
- obj.to_h = obj.to_h + num_h
- obj.to_d = obj.to_d + num_h
- obj.pval = obj.pval + num_p
-
- return TRUE
-
- end,
- ["info"] = function()
- return "tries "..(1 + get_level(AULE_ENCHANT_WEAPON)/12)
- end,
- ["desc"] = {
- "Tries to enchant a weapon to-hit",
- "At level 5 it also enchants to-dam",
- "At level 45 it enhances the special powers of magical weapons",
- "The might of the enchantment increases with the level"
- }
-}
-
-AULE_ENCHANT_ARMOUR = add_spell {
- ["name"] = "Enchant Armour",
- ["school"] = {SCHOOL_AULE},
- ["level"] = 15,
- ["mana"] = 100,
- ["mana_max"] = 200,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local level = get_level(AULE_ENCHANT_ARMOUR)
- local num_h, num_d, num_a, num_p
- local ret, item, obj
-
- num_a = 1 + randint(level/10)
- num_h = 0
- num_d = 0
- num_p = 0
- if (level >= 20) then
- num_h = 1
- num_d = 1
- end
- if (level >= 40) then
- num_p = 1
- end
- --return enchant_spell(num_h, num_d, num_a, num_p)
-
- ret, item = get_item("Which object do you want to enchant?",
- "You have no objects to enchant.",
- bor(USE_INVEN),
- function (obj)
- if obj.name1 > 0 then return FALSE end
- if (obj.tval == TV_BOOTS) then
- return TRUE
- elseif (obj.tval == TV_GLOVES) then
- return TRUE
- elseif (obj.tval == TV_HELM) then
- return TRUE
- elseif (obj.tval == TV_CROWN) then
- return TRUE
- elseif (obj.tval == TV_SHIELD) then
- return TRUE
- elseif (obj.tval == TV_CLOAK) then
- return TRUE
- elseif (obj.tval == TV_SOFT_ARMOR) then
- return TRUE
- elseif (obj.tval == TV_HARD_ARMOR) then
- return TRUE
- elseif (obj.tval == TV_DRAG_ARMOR) then
- return TRUE
- end
- return FALSE
- end
- )
- if ret == FALSE then return FALSE end
-
- obj = get_object(item)
-
- obj.to_h = obj.to_h + num_h
- obj.to_d = obj.to_d + num_h
- obj.pval = obj.pval + num_p
- obj.to_a = obj.to_a + num_h
-
- return TRUE
-
- end,
- ["info"] = function()
- return "tries "..(1 + get_level(AULE_ENCHANT_ARMOUR)/10)
- end,
- ["desc"] = {
- "Tries to enchant a piece of armour",
- "At level 20 it also enchants to-hit and to-dam",
- "At level 40 it enhances the special powers of magical armour",
- "The might of the enchantment increases with the level"
- }
-}
-
-AULE_CHILD = add_spell
-{
- ["name"] = "Child of Aule",
- ["school"] = {SCHOOL_AULE},
- ["level"] = 20,
- ["mana"] = 200,
- ["mana_max"] = 500,
- ["fail"] = 40,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local y, x, m_idx
-
- y, x = find_position(player.py, player.px)
- m_idx = place_monster_one(y, x, test_monster_name("Dwarven warrior"), 0, FALSE, MSTATUS_FRIEND)
-
- if m_idx ~= 0 then
- monster_set_level(m_idx, 20 + get_level(AULE_CHILD, 70, 0))
- return TRUE
- end
- end,
- ["info"] = function()
- return "level "..(20 + get_level(AULE_CHILD, 70))
- end,
- ["desc"] = {
- "Summons a levelled Dwarven warrior to help you battle the forces",
- "of Morgoth"
- }
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/s_convey.lua b/lib/mods/theme/scpt/s_convey.lua
deleted file mode 100644
index 1105a850..00000000
--- a/lib/mods/theme/scpt/s_convey.lua
+++ /dev/null
@@ -1,226 +0,0 @@
--- handle the conveyance school
-
-BLINK = add_spell
-{
- ["name"] = "Phase Door",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 3,
- ["fail"] = 10,
- ["inertia"] = { 1, 5 },
- ["spell"] = function()
- if get_level(BLINK, 50) >= 30 then
- local oy, ox = player.py, player.px
-
- teleport_player(10 + get_level(BLINK, 8))
- create_between_gate(0, oy, ox)
- return TRUE
- else
- teleport_player(10 + get_level(BLINK, 8))
- return TRUE
- end
- end,
- ["info"] = function()
- return "distance "..(10 + get_level(BLINK, 8))
- end,
- ["desc"] = {
- "Teleports you on a small scale range",
- "At level 30 it creates void jumpgates",
- }
-}
-
-DISARM = add_spell
-{
- ["name"] = "Disarm",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 3,
- ["mana"] = 2,
- ["mana_max"] = 4,
- ["fail"] = 15,
- ["stick"] =
- {
- ["charge"] = { 10, 15 },
- [TV_STAFF] =
- {
- ["rarity"] = 4,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 10, 50 },
- },
- },
- ["spell"] = function()
- local obvious
- obvious = destroy_doors_touch()
- if get_level(DISARM, 50) >= 10 then obvious = is_obvious(destroy_traps_touch(), obvious) end
- return obvious
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Destroys doors and disarms traps",
- "At level 10 it unlocks doors and disarms traps",
- }
-}
-
-TELEPORT = add_spell
-{
- ["name"] = "Teleportation",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 10,
- ["mana"] = 8,
- ["mana_max"] = 14,
- ["fail"] = 30,
- ["stick"] =
- {
- ["charge"] = { 7, 7 },
- [TV_STAFF] =
- {
- ["rarity"] = 50,
- ["base_level"] = { 1, 20 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- player.energy = player.energy - (25 - get_level(TELEPORT, 50))
- teleport_player(100 + get_level(TELEPORT, 100))
- return TRUE
- end,
- ["info"] = function()
- return "distance "..(100 + get_level(TELEPORT, 100))
- end,
- ["desc"] = {
- "Teleports you around the level. The casting time decreases with level",
- }
-}
-
-TELEAWAY = add_spell
-{
- ["name"] = "Teleport Away",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 23,
- ["mana"] = 15,
- ["mana_max"] = 40,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 3, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 75,
- ["base_level"] = { 1, 20 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir
-
- if get_level(TELEAWAY, 50) >= 20 then
- return project_los(GF_AWAY_ALL, 100)
- elseif get_level(TELEAWAY, 50) >= 10 then
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_AWAY_ALL, dir, 100, 3 + get_level(TELEAWAY, 4))
- else
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return teleport_monster(dir)
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Teleports a line of monsters away",
- "At level 10 it turns into a ball",
- "At level 20 it teleports all monsters in sight"
- }
-}
-
-RECALL = add_spell
-{
- ["name"] = "Recall",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 30,
- ["mana"] = 25,
- ["mana_max"] = 25,
- ["fail"] = 60,
- ["spell"] = function()
- local ret, x, y, c_ptr
- ret, x, y = tgt_pt()
- if ret == FALSE then return end
- c_ptr = cave(y, x)
- if (y == player.py) and (x == player.px) then
- local d = 21 - get_level(RECALL, 15)
- if d < 0 then
- d = 0
- end
- local f = 15 - get_level(RECALL, 10)
- if f < 1 then
- f = 1
- end
- recall_player(d, f)
- return TRUE
- elseif c_ptr.m_idx > 0 then
- swap_position(y, x)
- return TRUE
- elseif c_ptr.o_idx > 0 then
- set_target(y, x)
- if get_level(RECALL, 50) >= 15 then
- fetch(5, 10 + get_level(RECALL, 150), FALSE)
- else
- fetch(5, 10 + get_level(RECALL, 150), TRUE)
- end
- return TRUE
- end
- end,
- ["info"] = function()
- local d = 21 - get_level(RECALL, 15)
- if d < 0 then
- d = 0
- end
- local f = 15 - get_level(RECALL, 10)
- if f < 1 then
- f = 1
- end
- return "dur "..f.."+d"..d.." weight "..(1 + get_level(RECALL, 15)).."lb"
- end,
- ["desc"] = {
- "Cast on yourself it will recall you to the surface/dungeon.",
- "Cast at a monster you will swap positions with the monster.",
- "Cast at an object it will fetch the object to you."
- }
-}
-
-PROBABILITY_TRAVEL = add_spell
-{
- ["name"] = "Probability Travel",
- ["school"] = {SCHOOL_CONVEYANCE},
- ["level"] = 35,
- ["mana"] = 30,
- ["mana_max"] = 50,
- ["fail"] = 90,
- ["stick"] =
- {
- ["charge"] = { 1, 2 },
- [TV_STAFF] =
- {
- ["rarity"] = 97,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 8, 25 },
- },
- },
- ["inertia"] = { 6, 40 },
- ["spell"] = function()
- return set_prob_travel(randint(20) + get_level(PROBABILITY_TRAVEL, 60))
- end,
- ["info"] = function()
- return "dur "..get_level(PROBABILITY_TRAVEL, 60).."+d20"
- end,
- ["desc"] = {
- "Renders you immaterial, when you hit a wall you travel through it and",
- "instantly appear on the other side of it. You can also float up and down",
- "at will"
- }
-}
diff --git a/lib/mods/theme/scpt/s_demon.lua b/lib/mods/theme/scpt/s_demon.lua
deleted file mode 100644
index ada97310..00000000
--- a/lib/mods/theme/scpt/s_demon.lua
+++ /dev/null
@@ -1,337 +0,0 @@
--- handle the demonology school
-
--- Demonblade
-DEMON_BLADE = add_spell
-{
- ["name"] = "Demon Blade",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 1,
- ["mana"] = 4,
- ["mana_max"] = 44,
- ["fail"] = 10,
- ["random"] = 0,
- ["stick"] =
- {
- ["charge"] = { 3, 7 },
- [TV_WAND] =
- {
- ["rarity"] = 75,
- ["base_level"] = { 1, 17 },
- ["max_level"] = { 20, 40 },
- },
- },
- ["spell"] = function()
- local type, rad
-
- type = GF_FIRE
- if get_level(DEMON_BLADE) >= 30 then type = GF_HELL_FIRE end
-
- rad = 0
- if get_level(DEMON_BLADE) >= 45 then rad = 1 end
-
- return set_project(randint(20) + get_level(DEMON_BLADE, 80),
- type,
- 4 + get_level(DEMON_BLADE, 40),
- rad,
- bor(PROJECT_STOP, PROJECT_KILL))
- end,
- ["info"] = function()
- return "dur "..(get_level(DEMON_BLADE, 80)).."+d20 dam "..(4 + get_level(DEMON_BLADE, 40)).."/blow"
- end,
- ["desc"] = {
- "Imbues your blade with fire to deal more damage",
- "At level 30 it deals hellfire damage",
- "At level 45 it spreads over a 1 radius zone around your target",
- }
-}
-
-DEMON_MADNESS = add_spell
-{
- ["name"] = "Demon Madness",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 10,
- ["mana"] = 5,
- ["mana_max"] = 20,
- ["fail"] = 25,
- ["random"] = 0,
- ["spell"] = function()
- local ret, dir, type, y1, x1, y2, x2
-
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- type = GF_CHAOS
- if magik(33) == TRUE then type = GF_CONFUSION end
- if magik(33) == TRUE then type = GF_CHARM end
-
- -- Calc the coordinates of arrival
- y1, x1 = get_target(dir)
- y2 = player.py - (y1 - player.py)
- x2 = player.px - (x1 - player.px)
-
- local obvious = nil
- obvious = project(0, 1 + get_level(DEMON_MADNESS, 4, 0),
- y1, x1,
- 20 + get_level(DEMON_MADNESS, 200),
- type, bor(PROJECT_STOP, PROJECT_GRID, PROJECT_ITEM, PROJECT_KILL))
- obvious = is_obvious(project(0, 1 + get_level(DEMON_MADNESS, 4, 0),
- y2, x2,
- 20 + get_level(DEMON_MADNESS, 200),
- type, bor(PROJECT_STOP, PROJECT_GRID, PROJECT_ITEM, PROJECT_KILL)), obvious)
- return obvious
- end,
- ["info"] = function()
- return "dam "..(20 + get_level(DEMON_MADNESS, 200)).." rad "..(1 + get_level(DEMON_MADNESS, 4, 0))
- end,
- ["desc"] = {
- "Fire 2 balls in opposite directions of randomly chaos, confusion or charm",
- }
-}
-
-DEMON_FIELD = add_spell
-{
- ["name"] = "Demon Field",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 20,
- ["mana"] = 20,
- ["mana_max"] = 60,
- ["fail"] = 60,
- ["random"] = 0,
- ["spell"] = function()
- local ret, dir
-
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_cloud(GF_NEXUS, dir, 20 + get_level(DEMON_FIELD, 70), 7, 30 + get_level(DEMON_FIELD, 100))
- end,
- ["info"] = function()
- return "dam "..(20 + get_level(DEMON_FIELD, 70)).." dur "..(30 + get_level(DEMON_FIELD, 100))
- end,
- ["desc"] = {
- "Fires a cloud of deadly nexus over a radius of 7",
- }
-}
-
--- Demonshield
-
-DOOM_SHIELD = add_spell
-{
- ["name"] = "Doom Shield",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 1,
- ["mana"] = 2,
- ["mana_max"] = 30,
- ["fail"] = 10,
- ["random"] = 0,
- ["spell"] = function()
- return set_shield(randint(10) + 20 + get_level(DOOM_SHIELD, 100), -300 + get_level(DOOM_SHIELD, 100), SHIELD_COUNTER, 1 + get_level(DOOM_SHIELD, 14), 10 + get_level(DOOM_SHIELD, 15))
- end,
- ["info"] = function()
- return "dur "..(20 + get_level(DOOM_SHIELD, 100)).."+d10 dam "..(1 + get_level(DOOM_SHIELD, 14)).."d"..(10 + get_level(DOOM_SHIELD, 15))
- end,
- ["desc"] = {
- "Raises a mirror of pain around you, doing very high damage to your foes",
- "that dare hit you, but greatly reduces your armour class",
- }
-}
-
-UNHOLY_WORD = add_spell
-{
- ["name"] = "Unholy Word",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 25,
- ["mana"] = 15,
- ["mana_max"] = 45,
- ["fail"] = 55,
- ["random"] = 0,
- ["spell"] = function()
- local ret, x, y, c_ptr
- ret, x, y = tgt_pt()
- if ret == FALSE then return end
- c_ptr = cave(y, x)
-
- -- ok that is a monster
- if c_ptr.m_idx > 0 then
- local m_ptr = monster(c_ptr.m_idx)
- if m_ptr.status ~= MSTATUS_PET then
- msg_print("You can only target a pet.")
- return
- end
-
- -- Oups he is angry now
- if magik(30 - get_level(UNHOLY_WORD, 25, 0)) == TRUE then
- local m_name = monster_desc(m_ptr, 0).." turns against you."
- msg_print(strupper(strsub(m_name, 0, 1))..strsub(m_name, 2))
- else
- local m_name = monster_desc(m_ptr, 0)
- msg_print("You consume "..m_name..".")
-
- local heal = (m_ptr.hp * 100) / m_ptr.maxhp
- heal = ((30 + get_level(UNHOLY_WORD, 50, 0)) * heal) / 100
-
- hp_player(heal)
-
- delete_monster_idx(c_ptr.m_idx)
- end
- return TRUE
- end
- end,
- ["info"] = function()
- return "heal mhp% of "..(30 + get_level(UNHOLY_WORD, 50, 0)).."%"
- end,
- ["desc"] = {
- "Kills a pet to heal you",
- "There is a chance that the pet won't die but will turn against you",
- "it will decrease with higher level",
- }
-}
-
-DEMON_CLOAK = add_spell
-{
- ["name"] = "Demon Cloak",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 20,
- ["mana"] = 10,
- ["mana_max"] = 40,
- ["fail"] = 70,
- ["random"] = 0,
- ["spell"] = function()
- return set_tim_reflect(randint(5) + 5 + get_level(DEMON_CLOAK, 15, 0))
- end,
- ["info"] = function()
- return "dur "..(5 + get_level(DEMON_CLOAK, 15, 0)).."+d5"
- end,
- ["desc"] = {
- "Raises a mirror that can reflect bolts and arrows for a time",
- }
-}
-
-
--- Demonhorn
-DEMON_SUMMON = add_spell
-{
- ["name"] = "Summon Demon",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 5,
- ["mana"] = 10,
- ["mana_max"] = 50,
- ["fail"] = 30,
- ["random"] = 0,
- ["spell"] = function()
- local type = SUMMON_DEMON
- local level = dun_level
- local minlevel = 4
- if level < minlevel then level=minlevel end
- summon_specific_level = 5 + get_level(DEMON_SUMMON, 100)
- if get_level(DEMON_SUMMON) >= 35 then type = SUMMON_HI_DEMON end
- if summon_monster(player.py, player.px, level, TRUE, type) == TRUE then
- return TRUE
- else
- msg_print("Something blocks your summoning!")
- return FALSE
- end
- end,
- ["info"] = function()
- return "level "..(5 + get_level(DEMON_SUMMON, 100))
- end,
- ["desc"] = {
- "Summons a leveled demon to your side",
- "At level 35 it summons a high demon",
- }
-}
-
-DISCHARGE_MINION = add_spell
-{
- ["name"] = "Discharge Minion",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 10,
- ["mana"] = 20,
- ["mana_max"] = 50,
- ["fail"] = 30,
- ["random"] = 0,
- ["spell"] = function()
- local ret, x, y, c_ptr
- ret, x, y = tgt_pt()
- if ret == FALSE then return end
- c_ptr = cave(y, x)
-
- -- ok that is a monster
- if c_ptr.m_idx > 0 then
- local m_ptr = monster(c_ptr.m_idx)
- if m_ptr.status ~= MSTATUS_PET then
- msg_print("You can only target a pet.")
- return
- end
-
- local dam = m_ptr.hp
- delete_monster_idx(c_ptr.m_idx)
- dam = (dam * (20 + get_level(DISCHARGE_MINION, 60, 0))) / 100
- if dam > 100 + get_level(DISCHARGE_MINION, 500, 0) then
- dam = 100 + get_level(DISCHARGE_MINION, 500, 0)
- end
-
- -- We use project instead of fire_ball because we must tell it exactly where to land
- return project(0, 2,
- y, x,
- dam,
- GF_GRAVITY, bor(PROJECT_STOP, PROJECT_GRID, PROJECT_ITEM, PROJECT_KILL))
- end
- end,
- ["info"] = function()
- return "dam "..(20 + get_level(DISCHARGE_MINION, 60, 0)).."% max "..(100 + get_level(DISCHARGE_MINION, 500, 0))
- end,
- ["desc"] = {
- "The targeted pet will explode in a burst of gravity",
- }
-}
-
-CONTROL_DEMON = add_spell
-{
- ["name"] = "Control Demon",
- ["school"] = {SCHOOL_DEMON},
- ["level"] = 25,
- ["mana"] = 30,
- ["mana_max"] = 70,
- ["fail"] = 55,
- ["random"] = 0,
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- return fire_ball(GF_CONTROL_DEMON, dir, 50 + get_level(CONTROL_DEMON, 250), 0)
- end,
- ["info"] = function()
- return "power "..(50 + get_level(CONTROL_DEMON, 250))
- end,
- ["desc"] = {
- "Attempts to control a demon",
- }
-}
-
--- ok we need to have different wield slots
-add_hooks
-{
- [HOOK_WIELD_SLOT] = function (obj, ideal)
- if (obj.tval == TV_DAEMON_BOOK) then
- local slot
- if (obj.sval == SV_DEMONBLADE) then
- if(ideal == TRUE) then
- slot = INVEN_WIELD
- else
- slot = get_slot(INVEN_WIELD)
- end
- elseif (obj.sval == SV_DEMONSHIELD) then
- if(ideal == TRUE) then
- slot = INVEN_ARM
- else
- slot = get_slot(INVEN_ARM)
- end
- elseif (obj.sval == SV_DEMONHORN) then
- if(ideal == TRUE) then
- slot = INVEN_HEAD
- else
- slot = get_slot(INVEN_HEAD)
- end
- end
- return TRUE, slot
- end
- end,
-}
diff --git a/lib/mods/theme/scpt/s_divin.lua b/lib/mods/theme/scpt/s_divin.lua
deleted file mode 100644
index 60b0275f..00000000
--- a/lib/mods/theme/scpt/s_divin.lua
+++ /dev/null
@@ -1,230 +0,0 @@
--- Handles thhe divination school
-
-
-STARIDENTIFY = add_spell
-{
- ["name"] = "Greater Identify",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 35,
- ["mana"] = 30,
- ["mana_max"] = 30,
- ["fail"] = 80,
- ["spell"] = function()
- if get_check("Cast on yourself?") == TRUE then
- self_knowledge()
- else
- identify_fully()
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Asks for an object and fully identify it, providing the full list of powers",
- "Cast at yourself it will reveal your powers"
- }
-}
-
-IDENTIFY = add_spell
-{
- ["name"] = "Identify",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 8,
- ["mana"] = 10,
- ["mana_max"] = 50,
- ["fail"] = 40,
- ["stick"] =
- {
- ["charge"] = { 7, 10 },
- [TV_STAFF] =
- {
- ["rarity"] = 45,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 15, 40 },
- },
- },
- ["spell"] = function()
- if get_level(IDENTIFY, 50) >= 27 then
- local obvious
- obvious = identify_pack()
- obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, get_level(IDENTIFY, 3)), obvious)
- if obvious == TRUE then
- player.notice = bor(player.notice, PN_COMBINE, PN_REORDER)
- end
- return obvious
- elseif get_level(IDENTIFY, 50) >= 17 then
- local obvious
- obvious = identify_pack()
- obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, 0), obvious)
- if obvious == TRUE then
- player.notice = bor(player.notice, PN_COMBINE, PN_REORDER)
- end
- return obvious
- else
- if ident_spell() == TRUE then return TRUE else return end
- end
- end,
- ["info"] = function()
- if get_level(IDENTIFY, 50) >= 27 then
- return "rad "..(get_level(IDENTIFY, 3))
- else
- return ""
- end
- end,
- ["desc"] = {
- "Asks for an object and identifies it",
- "At level 17 it identifies all objects in the inventory",
- "At level 27 it identifies all objects in the inventory and in a",
- "radius on the floor, as well as probing monsters in that radius"
- }
-}
-
-VISION = add_spell
-{
- ["name"] = "Vision",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 15,
- ["mana"] = 7,
- ["mana_max"] = 55,
- ["fail"] = 45,
- ["stick"] =
- {
- ["charge"] = { 4, 6 },
- [TV_STAFF] =
- {
- ["rarity"] = 60,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 10, 30 },
- },
- },
- ["inertia"] = { 2, 200 },
- ["spell"] = function()
- if get_level(VISION, 50) >= 25 then
- wiz_lite_extra()
- else
- map_area()
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Detects the layout of the surrounding area",
- "At level 25 it maps and lights the whole level",
- }
-}
-
-SENSEHIDDEN = add_spell
-{
- ["name"] = "Sense Hidden",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 5,
- ["mana"] = 2,
- ["mana_max"] = 10,
- ["fail"] = 25,
- ["stick"] =
- {
- ["charge"] = { 1, 15 },
- [TV_STAFF] =
- {
- ["rarity"] = 20,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 10, 50 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- local obvious = nil
- obvious = detect_traps(15 + get_level(SENSEHIDDEN, 40, 0))
- if get_level(SENSEHIDDEN, 50) >= 15 then
- obvious = is_obvious(set_tim_invis(10 + randint(20) + get_level(SENSEHIDDEN, 40)), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- if get_level(SENSEHIDDEN, 50) >= 15 then
- return "rad "..(15 + get_level(SENSEHIDDEN, 40)).." dur "..(10 + get_level(SENSEHIDDEN, 40)).."+d20"
- else
- return "rad "..(15 + get_level(SENSEHIDDEN, 40))
- end
- end,
- ["desc"] = {
- "Detects the traps in a certain radius around you",
- "At level 15 it allows you to sense invisible for a while"
- }
-}
-
-REVEALWAYS = add_spell
-{
- ["name"] = "Reveal Ways",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 9,
- ["mana"] = 3,
- ["mana_max"] = 15,
- ["fail"] = 20,
- ["stick"] =
- {
- ["charge"] = { 6, 6 },
- [TV_STAFF] =
- {
- ["rarity"] = 35,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- local obvious
- obvious = detect_doors(10 + get_level(REVEALWAYS, 40, 0))
- obvious = is_obvious(detect_stairs(10 + get_level(REVEALWAYS, 40, 0)), obvious)
- return obvious
- end,
- ["info"] = function()
- return "rad "..(10 + get_level(REVEALWAYS, 40))
- end,
- ["desc"] = {
- "Detects the doors/stairs/ways in a certain radius around you",
- }
-}
-
-SENSEMONSTERS = add_spell
-{
- ["name"] = "Sense Monsters",
- ["school"] = {SCHOOL_DIVINATION},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 20,
- ["fail"] = 10,
- ["stick"] =
- {
- ["charge"] = { 5, 10 },
- [TV_STAFF] =
- {
- ["rarity"] = 37,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 15, 40 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- local obvious
- obvious = detect_monsters_normal(10 + get_level(SENSEMONSTERS, 40, 0))
- if get_level(SENSEMONSTERS, 50) >= 30 then
- obvious = is_obvious(set_tim_esp(10 + randint(10) + get_level(SENSEMONSTERS, 20)), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- if get_level(SENSEMONSTERS, 50) >= 30 then
- return "rad "..(10 + get_level(SENSEMONSTERS, 40)).." dur "..(10 + get_level(SENSEMONSTERS, 20)).."+d10"
- else
- return "rad "..(10 + get_level(SENSEMONSTERS, 40))
- end
- end,
- ["desc"] = {
- "Detects all monsters near you",
- "At level 30 it allows you to sense monster minds for a while"
- }
-}
diff --git a/lib/mods/theme/scpt/s_earth.lua b/lib/mods/theme/scpt/s_earth.lua
deleted file mode 100644
index 23aa001c..00000000
--- a/lib/mods/theme/scpt/s_earth.lua
+++ /dev/null
@@ -1,184 +0,0 @@
--- The earth school
-
-STONESKIN = add_spell
-{
- ["name"] = "Stone Skin",
- ["school"] = SCHOOL_EARTH,
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 50,
- ["fail"] = 10,
- ["inertia"] = { 2, 50 },
- ["spell"] = function()
- local type
- if get_level(STONESKIN, 50) >= 25 then
- type = SHIELD_COUNTER
- else
- type = 0
- end
- return set_shield(randint(10) + 10 + get_level(STONESKIN, 100), 10 + get_level(STONESKIN, 50), type, 2 + get_level(STONESKIN, 5), 3 + get_level(STONESKIN, 5))
- end,
- ["info"] = function()
- if get_level(STONESKIN, 50) >= 25 then
- return "dam "..(2 + get_level(STONESKIN, 5)).."d"..(3 + get_level(STONESKIN, 5)).." dur "..(10 + get_level(STONESKIN, 100)).."+d10 AC "..(10 + get_level(STONESKIN, 50))
- else
- return "dur "..(10 + get_level(STONESKIN, 100)).."+d10 AC "..(10 + get_level(STONESKIN, 50))
- end
- end,
- ["desc"] = {
- "Creates a shield of earth around you to protect you",
- "At level 25 it starts dealing damage to attackers"
- }
-}
-
-DIG = add_spell
-{
- ["name"] = "Dig",
- ["school"] = SCHOOL_EARTH,
- ["level"] = 12,
- ["mana"] = 14,
- ["mana_max"] = 14,
- ["fail"] = 20,
- ["stick"] =
- {
- ["charge"] = { 15, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 25,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 1, 1 },
- },
- },
- ["spell"] = function()
- local ret, dir
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return wall_to_mud(dir)
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Digs a hole in a wall much faster than any shovels",
- }
-}
-
-STONEPRISON = add_spell
-{
- ["name"] = "Stone Prison",
- ["school"] = SCHOOL_EARTH,
- ["level"] = 25,
- ["mana"] = 30,
- ["mana_max"] = 50,
- ["fail"] = 65,
- ["stick"] =
- {
- ["charge"] = { 5, 3 },
- [TV_WAND] =
- {
- ["rarity"] = 57,
- ["base_level"] = { 1, 3 },
- ["max_level"] = { 5, 20 },
- },
- },
- ["spell"] = function()
- local ret, x, y
- if get_level(STONEPRISON, 50) >= 10 then
- ret, x, y = tgt_pt()
- else
- y = player.py
- x = player.px
- end
- wall_stone(y, x)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Creates a prison of walls around you",
- "At level 10 it allows you to target a monster"
- }
-}
-
-STRIKE = add_spell
-{
- ["name"] = "Strike",
- ["school"] = {SCHOOL_EARTH},
- ["level"] = 30,
- ["mana"] = 30,
- ["mana_max"] = 50,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 2, 6 },
- [TV_WAND] =
- {
- ["rarity"] = 635,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 10, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir, rad
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- if get_level(STRIKE, 50) >= 12 then
- return fire_ball(GF_FORCE, dir, 50 + get_level(STRIKE, 50), 1)
- else
- return fire_ball(GF_FORCE, dir, 50 + get_level(STRIKE, 50), 0)
- end
- end,
- ["info"] = function()
- if get_level(STRIKE, 50) >= 12 then
- return "dam "..(50 + get_level(STRIKE, 50)).." rad 1"
- else
- return "dam "..(50 + get_level(STRIKE, 50))
- end
- end,
- ["desc"] = {
- "Creates a micro-ball of force that will push monsters backwards",
- "If the monster is caught near a wall, it'll be crushed against it",
- "At level 12 it turns into a ball of radius 1"
- }
-}
-
-SHAKE = add_spell
-{
- ["name"] = "Shake",
- ["school"] = {SCHOOL_EARTH},
- ["level"] = 27,
- ["mana"] = 25,
- ["mana_max"] = 30,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 5, 10 },
- [TV_STAFF] =
- {
- ["rarity"] = 75,
- ["base_level"] = { 1, 3 },
- ["max_level"] = { 9, 20 },
- },
- },
- ["inertia"] = { 2, 50 },
- ["spell"] = function()
- local ret, x, y
- if get_level(SHAKE, 50) >= 10 then
- ret, x, y = tgt_pt()
- if ret == FALSE then return end
- else
- x = player.px
- y = player.py
- end
- earthquake(y, x, 4 + get_level(SHAKE, 10));
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(4 + get_level(SHAKE, 10))
- end,
- ["desc"] = {
- "Creates a localised earthquake",
- "At level 10 it can be targeted at any location"
- }
-}
diff --git a/lib/mods/theme/scpt/s_eru.lua b/lib/mods/theme/scpt/s_eru.lua
deleted file mode 100644
index c0cb0aaf..00000000
--- a/lib/mods/theme/scpt/s_eru.lua
+++ /dev/null
@@ -1,130 +0,0 @@
--- Handle Eru Iluvatar magic school
-
-ERU_SEE = add_spell
-{
- ["name"] = "See the Music",
- ["school"] = {SCHOOL_ERU},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 50,
- ["fail"] = 20,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local obvious
- obvious = set_tim_invis(randint(20) + 10 + get_level(ERU_SEE, 100))
- if get_level(ERU_SEE) >= 30 then
- wiz_lite_extra()
- obvious = TRUE
- elseif get_level(ERU_SEE) >= 10 then
- map_area()
- obvious = TRUE
- end
- if get_level(ERU_SEE) >= 20 then
- obvious = is_obvious(set_blind(0), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return "dur "..(10 + get_level(ERU_SEE, 100)).."+d20"
- end,
- ["desc"] = {
- "Allows you to 'see' the Great Music from which the world",
- "originates, allowing you to see unseen things",
- "At level 10 it allows you to see your surroundings",
- "At level 20 it allows you to cure blindness",
- "At level 30 it allows you to fully see all the level"
- }
-}
-
-ERU_LISTEN = add_spell
-{
- ["name"] = "Listen to the Music",
- ["school"] = {SCHOOL_ERU},
- ["level"] = 7,
- ["mana"] = 15,
- ["mana_max"] = 200,
- ["fail"] = 25,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- if get_level(ERU_LISTEN) >= 30 then
- ident_all()
- identify_pack()
- return TRUE
- elseif get_level(ERU_LISTEN) >= 14 then
- identify_pack()
- return TRUE
- else
- return ident_spell()
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Allows you to listen to the Great Music from which the world",
- "originates, allowing you to understand the meaning of things",
- "At level 14 it allows you to identify all your pack",
- "At level 30 it allows you to identify all items on the level",
- }
-}
-
-ERU_UNDERSTAND = add_spell
-{
- ["name"] = "Know the Music",
- ["school"] = {SCHOOL_ERU},
- ["level"] = 30,
- ["mana"] = 200,
- ["mana_max"] = 600,
- ["fail"] = 50,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- if get_level(ERU_UNDERSTAND) >= 10 then
- identify_pack_fully()
- return TRUE
- else
- return identify_fully()
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Allows you to understand the Great Music from which the world",
- "originates, allowing you to know the full abilities of things",
- "At level 10 it allows you to *identify* all your pack",
- }
-}
-
-ERU_PROT = add_spell
-{
- ["name"] = "Lay of Protection",
- ["school"] = {SCHOOL_ERU},
- ["level"] = 35,
- ["mana"] = 400,
- ["mana_max"] = 400,
- ["fail"] = 80,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return fire_ball(GF_MAKE_GLYPH, 0, 1, 1 + get_level(ERU_PROT, 2, 0))
- end,
- ["info"] = function()
- return "rad "..(1 + get_level(ERU_PROT, 2, 0))
- end,
- ["desc"] = {
- "Creates a circle of safety around you",
- }
-}
diff --git a/lib/mods/theme/scpt/s_fire.lua b/lib/mods/theme/scpt/s_fire.lua
deleted file mode 100644
index dbbf7604..00000000
--- a/lib/mods/theme/scpt/s_fire.lua
+++ /dev/null
@@ -1,227 +0,0 @@
--- handle the fire school
-
-GLOBELIGHT = add_spell
-{
- ["name"] = "Globe of Light",
- ["school"] = {SCHOOL_FIRE},
- ["level"] = 1,
- ["mana"] = 2,
- ["mana_max"] = 15,
- ["fail"] = 10,
- ["stick"] =
- {
- ["charge"] = { 10, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 7,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 10, 45 },
- },
- },
- ["inertia"] = { 1, 40 },
- ["spell"] = function()
- local obvious
- if get_level(GLOBELIGHT, 50) >= 3 then
- obvious = lite_area(10, 4)
- else
- lite_room(player.py, player.px)
- obvious = TRUE
- end
- if get_level(GLOBELIGHT, 50) >= 15 then
- obvious = is_obvious(fire_ball(GF_LITE, 0, 10 + get_level(GLOBELIGHT, 100), 5 + get_level(GLOBELIGHT, 6)), obvious)
- player.update = bor(player.update, PU_VIEW)
- end
- return obvious
- end,
- ["info"] = function()
- if get_level(GLOBELIGHT, 50) >= 15 then
- return "dam "..(10 + get_level(GLOBELIGHT, 100)).." rad "..(5 + get_level(GLOBELIGHT, 6))
- else
- return ""
- end
- end,
- ["desc"] = {
- "Creates a globe of pure light",
- "At level 3 it starts damaging monsters",
- "At level 15 it starts creating a more powerful kind of light",
- }
-}
-
-FIREFLASH = add_spell
-{
- ["name"] = "Fireflash",
- ["school"] = {SCHOOL_FIRE},
- ["level"] = 10,
- ["mana"] = 5,
- ["mana_max"] = 70,
- ["fail"] = 35,
- ["stick"] =
- {
- ["charge"] = { 5, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 35,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 15, 35 },
- },
- },
- ["spell"] = function()
- local ret, dir, type
- if (get_level(FIREFLASH, 50) >= 20) then
- type = GF_HOLY_FIRE
- else
- type = GF_FIRE
- end
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(type, dir, 20 + get_level(FIREFLASH, 500), 2 + get_level(FIREFLASH, 5))
- end,
- ["info"] = function()
- return "dam "..(20 + get_level(FIREFLASH, 500)).." rad "..(2 + get_level(FIREFLASH, 5))
- end,
- ["desc"] = {
- "Conjures a ball of fire to burn your foes to ashes",
- "At level 20 it turns into a ball of holy fire"
- }
-}
-
-FIERYAURA = add_spell
-{
- ["name"] = "Fiery Shield",
- ["school"] = {SCHOOL_FIRE},
- ["level"] = 20,
- ["mana"] = 20,
- ["mana_max"] = 60,
- ["fail"] = 50,
- ["stick"] =
- {
- ["charge"] = { 3, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 50,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 5, 40 },
- },
- },
- ["inertia"] = { 2, 15 },
- ["spell"] = function()
- local type
- if (get_level(FIERYAURA, 50) >= 8) then
- type = SHIELD_GREAT_FIRE
- else
- type = SHIELD_FIRE
- end
- return set_shield(randint(20) + 10 + get_level(FIERYAURA, 70), 10, type, 5 + get_level(FIERYAURA, 10), 5 + get_level(FIERYAURA, 7))
- end,
- ["info"] = function()
- return "dam "..(5 + get_level(FIERYAURA, 15)).."d"..(5 + get_level(FIERYAURA, 7)).." dur "..(10 + get_level(FIERYAURA, 70)).."+d20"
- end,
- ["desc"] = {
- "Creates a shield of fierce flames around you",
- "At level 8 it turns into a greater kind of flame that can not be resisted"
- }
-}
-
-FIREWALL = add_spell
-{
- ["name"] = "Firewall",
- ["school"] = {SCHOOL_FIRE},
- ["level"] = 15,
- ["mana"] = 25,
- ["mana_max"] = 100,
- ["fail"] = 40,
- ["stick"] =
- {
- ["charge"] = { 4, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 55,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 5, 40 },
- },
- },
- ["spell"] = function()
- local ret, dir, type
- if (get_level(FIREWALL, 50) >= 6) then
- type = GF_HELL_FIRE
- else
- type = GF_FIRE
- end
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- fire_wall(type, dir, 40 + get_level(FIREWALL, 150), 10 + get_level(FIREWALL, 14))
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(40 + get_level(FIREWALL, 150)).." dur "..(10 + get_level(FIREWALL, 14))
- end,
- ["desc"] = {
- "Creates a fiery wall to incinerate monsters stupid enough to attack you",
- "At level 6 it turns into a wall of hell fire"
- }
-}
-
-FIREGOLEM = add_spell
-{
- ["name"] = "Fire Golem",
- ["school"] = {SCHOOL_FIRE, SCHOOL_MIND},
- ["level"] = 7,
- ["mana"] = 16,
- ["mana_max"] = 70,
- ["fail"] = 40,
- ["spell"] = function()
- local m_idx, y, x, ret, item
-
- -- Can we reconnect ?
- if do_control_reconnect() == TRUE then
- msg_print("Control re-established.")
- return
- end
-
- ret, item = get_item("Which light source do you want to use to create the golem?",
- "You have no light source for the golem",
- bor(USE_INVEN, USE_EQUIP),
- function (obj)
- if (obj.tval == TV_LITE) and ((obj.sval == SV_LITE_TORCH) or (obj.sval == SV_LITE_LANTERN)) then
- return TRUE
- end
- return FALSE
- end
- )
- if ret == FALSE then return TRUE end
- inven_item_increase(item, -1)
- inven_item_describe(item)
- inven_item_optimize(item)
-
- -- Summon it
- m_allow_special[1043 + 1] = TRUE
- y, x = find_position(player.py, player.px)
- m_idx = place_monster_one(y, x, 1043, 0, FALSE, MSTATUS_FRIEND)
- m_allow_special[1043 + 1] = FALSE
-
- -- level it
- if m_idx ~= 0 then
- monster_set_level(m_idx, 7 + get_level(FIREGOLEM, 70))
- player.control = m_idx
- monster(m_idx).mflag = bor(monster(m_idx).mflag, MFLAG_CONTROL)
- end
- return TRUE
- end,
- ["info"] = function()
- return "golem level "..(7 + get_level(FIREGOLEM, 70))
- end,
- ["desc"] = {
- "Creates a fiery golem and controls it",
- "During the control the available keylist is:",
- "Movement keys: movement of the golem(depending on its speed",
- " it can move more than one square)",
- ", : pickup all items on the floor",
- "d : drop all carried items",
- "i : list all carried items",
- "m : end the possession/use golem powers",
- "Most of the other keys are disabled, you cannot interact with your",
- "real body while controlling the golem",
- "But to cast the spell you will need a lantern or a wooden torch to",
- "Create the golem from"
- }
-}
diff --git a/lib/mods/theme/scpt/s_geom.lua b/lib/mods/theme/scpt/s_geom.lua
deleted file mode 100644
index b9730318..00000000
--- a/lib/mods/theme/scpt/s_geom.lua
+++ /dev/null
@@ -1,656 +0,0 @@
--- Geomancy school
-
-function geomancy_random_wall(y, x)
- local c_ptr = cave(y, x)
-
- -- Do not destroy permanent things
- if cave_is(c_ptr, FF1_PERMANENT) ~= FALSE then return end
-
- local feat = nil
- local table =
- {
- [1] = { SKILL_FIRE, FEAT_SANDWALL, 1},
-
- [2] = { SKILL_WATER, FEAT_TREES, 1},
- [3] = { SKILL_WATER, FEAT_ICE_WALL, 12},
-
- [4] = { SKILL_EARTH, FEAT_WALL_EXTRA, 1},
- }
-
- while feat == nil do
- local t = table[randint(getn(table))]
-
- -- Do we meet the requirements ?
- -- And then select the features based on skill proportions
- if get_skill(t[1]) >= t[3] and magik(get_skill_scale(t[1], 100)) == TRUE then
- feat = t[2]
- end
- end
-
- cave_set_feat(y, x, feat)
-end
-
-
-GF_ELEMENTAL_WALL = add_spell_type
-{
- ["color"] = { TERM_GREEN, 0 },
- ["angry"] = function() return TRUE, FALSE end,
- ["grid"] = function(who, dam, rad, y, x)
- if player.py ~= y or player.px ~= x then
- geomancy_random_wall(y, x)
- end
- end,
-}
-
-function geomancy_random_floor(y, x, kill_wall)
- local c_ptr = cave(y, x)
-
- -- Do not destroy permanent things
- if cave_is(c_ptr, FF1_PERMANENT) ~= FALSE then return end
- if not kill_wall then
- if cave_is(c_ptr, FF1_FLOOR) ~= TRUE then return end
- end
-
- local feat = nil
- local table =
- {
- [1] = { SKILL_FIRE, FEAT_SAND, 1},
- [2] = { SKILL_FIRE, FEAT_SHAL_LAVA, 8},
- [3] = { SKILL_FIRE, FEAT_DEEP_LAVA, 18},
-
- [4] = { SKILL_WATER, FEAT_SHAL_WATER, 1},
- [5] = { SKILL_WATER, FEAT_DEEP_WATER, 8},
- [6] = { SKILL_WATER, FEAT_ICE, 18},
-
- [7] = { SKILL_EARTH, FEAT_GRASS, 1},
- [8] = { SKILL_EARTH, FEAT_FLOWER, 8},
- [9] = { SKILL_EARTH, FEAT_DARK_PIT, 18},
- }
-
- while feat == nil do
- local t = table[randint(getn(table))]
-
- -- Do we meet the requirements ?
- -- And then select the features based on skill proportions
- if get_skill(t[1]) >= t[3] and magik(get_skill_scale(t[1], 100)) == TRUE then
- feat = t[2]
- end
- end
-
- cave_set_feat(y, x, feat)
-end
-
-
-GF_ELEMENTAL_GROWTH = add_spell_type
-{
- ["color"] = { TERM_GREEN, 0 },
- ["angry"] = function() return TRUE, FALSE end,
- ["grid"] = function(who, dam, rad, y, x)
- geomancy_random_floor(y, x)
- end,
-}
-
-CALL_THE_ELEMENTS = add_spell
-{
- ["name"] = "Call the Elements",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 1,
- ["mana"] = 2,
- ["mana_max"] = 20,
- ["fail"] = 10,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- ["spell"] = function()
- local ret, dir = 0, 0
-
- if get_level(CALL_THE_ELEMENTS) >= 17 then
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- end
-
- fire_ball(GF_ELEMENTAL_GROWTH, dir, 1, 1 + get_level(CALL_THE_ELEMENTS, 5, 0))
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(1 + get_level(CALL_THE_ELEMENTS, 5, 0))
- end,
- ["desc"] = {
- "Randomly creates various elements around you",
- "Each type of element chance is controlled by your level",
- "in the corresponding skill",
- "At level 17 it can be targeted",
- }
-}
-
--- Seperate function because an other spell needs it
-function channel_the_elements(y, x, level, silent)
- local t =
- {
- -- Earth stuff
- [FEAT_GRASS] = function()
- hp_player(player.mhp * (5 + get_skill_scale(SKILL_EARTH, 20)) / 100)
- end,
- [FEAT_FLOWER] = function()
- hp_player(player.mhp * (5 + get_skill_scale(SKILL_EARTH, 30)) / 100)
- end,
- [FEAT_DARK_PIT] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- local type = GF_DARK
- if get_skill(SKILL_EARTH) >= 18 then type = GF_NETHER end
- fire_bolt(type, dir, damroll(10, get_skill(SKILL_EARTH)))
- end,
-
- -- Water stuff
- [FEAT_SHAL_WATER] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- local type = GF_WATER
- if get_skill(SKILL_WATER) >= 18 then type = GF_WAVE end
-
- if get_skill(SKILL_WATER) >= 8 then
- fire_beam(type, dir, damroll(3, get_skill(SKILL_WATER)))
- else
- fire_bolt(type, dir, damroll(3, get_skill(SKILL_WATER)))
- end
- end,
- [FEAT_DEEP_WATER] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- local type = GF_WATER
- if get_skill(SKILL_WATER) >= 18 then type = GF_WAVE end
-
- if get_skill(SKILL_WATER) >= 8 then
- fire_beam(type, dir, damroll(5, get_skill(SKILL_WATER)))
- else
- fire_bolt(type, dir, damroll(5, get_skill(SKILL_WATER)))
- end
- end,
- [FEAT_ICE] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- if get_skill(SKILL_WATER) >= 12 then
- fire_ball(GF_ICE, dir, get_skill_scale(SKILL_WATER, 340), 3)
- else
- fire_bolt(GF_ICE, dir, damroll(3, get_skill(SKILL_WATER)))
- end
- end,
-
- -- Fire stuff
- [FEAT_SAND] = function()
- local type
- if (get_level(FIERYAURA, 50) >= 8) then
- type = SHIELD_GREAT_FIRE
- else
- type = SHIELD_FIRE
- end
- local dur = randint(20) + %level + get_skill(SKILL_AIR)
- set_shield(dur, 0, type, 5 + get_skill_scale(SKILL_FIRE, 20), 5 + get_skill_scale(SKILL_FIRE, 14))
- set_blind(dur)
- end,
- [FEAT_SHAL_LAVA] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- if get_skill(SKILL_FIRE) >= 15 then
- fire_bolt(GF_HELL_FIRE, dir, damroll(get_skill_scale(SKILL_FIRE, 30), 15))
- else
- fire_bolt(GF_FIRE, dir, damroll(get_skill_scale(SKILL_FIRE, 30), 15))
- end
- end,
- [FEAT_DEEP_LAVA] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- if get_skill(SKILL_FIRE) >= 15 then
- fire_ball(GF_HELL_FIRE, dir, damroll(get_skill_scale(SKILL_FIRE, 30), 15), 3)
- else
- fire_ball(GF_FIRE, dir, damroll(get_skill_scale(SKILL_FIRE, 30), 15), 3)
- end
- end,
- }
-
- if t[cave(y, x).feat] then
- t[cave(y, x).feat]()
-
- if magik(100 - level) == TRUE then
- if cave(y, x).feat == FEAT_FLOWER then
- cave_set_feat(y, x, FEAT_GRASS)
- else
- cave_set_feat(y, x, FEAT_FLOOR)
- end
- msg_print("The area is drained.")
- end
- elseif not silent then
- msg_print("You cannot channel this area.")
- end
-end
-
-CHANNEL_ELEMENTS = add_spell
-{
- ["name"] = "Channel Elements",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 3,
- ["mana"] = 3,
- ["mana_max"] = 30,
- ["fail"] = 20,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- ["spell"] = function()
- channel_the_elements(player.py, player.px, get_level(CHANNEL_ELEMENTS), nil)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Draws on the caster's immediate environs to form an attack or other effect.",
- "Grass/Flower heals.",
- "Water creates water bolt attacks.",
- "Ice creates ice bolt attacks.",
- "Sand creates a wall of thick, blinding, burning sand around you.",
- "Lava creates fire bolt attacks.",
- "Deep lava creates fire ball attacks.",
- "Chasm creates darkness bolt attacks.",
- "At Earth level 18, darkness becomes nether.",
- "At Water level 8, water attacks become beams with a striking effect.",
- "At Water level 12, ice attacks become balls of ice shards.",
- "At Water level 18, water attacks push monsters back.",
- "At Fire level 15, fire become hellfire.",
- }
-}
-
-ELEMENTAL_WAVE = add_spell
-{
- ["name"] = "Elemental Wave",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 15,
- ["mana"] = 15,
- ["mana_max"] = 50,
- ["fail"] = 20,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- ["spell"] = function()
- local ret, dir = get_rep_dir()
- if ret == FALSE then return end
-
- local y, x = explode_dir(dir)
- y = y + player.py
- x = x + player.px
-
- local t =
- {
- -- Earth stuff
- [FEAT_GRASS] = { GF_POIS, GF_POIS, 10 + get_skill_scale(SKILL_EARTH, 200) },
- [FEAT_FLOWER] = { GF_POIS, GF_POIS, 10 + get_skill_scale(SKILL_EARTH, 300) },
- -- cannot turn chasm into a wave
-
- -- Water stuff
- [FEAT_SHAL_WATER] = { GF_WATER, GF_WATER, 10 + get_skill_scale(SKILL_WATER, 200) },
- [FEAT_DEEP_WATER] = { GF_WATER, GF_WATER, 10 + get_skill_scale(SKILL_WATER, 300) },
- [FEAT_ICE] = { GF_ICE, GF_ICE, 10 + get_skill_scale(SKILL_WATER, 200) },
-
- -- Fire stuff
- [FEAT_SAND] = { GF_LITE, GF_LITE, 10 + get_skill_scale(SKILL_FIRE, 400) },
- [FEAT_SHAL_LAVA] = { GF_FIRE, GF_HOLY_FIRE, 10 + get_skill_scale(SKILL_FIRE, 200) },
- [FEAT_DEEP_LAVA] = { GF_FIRE, GF_HOLY_FIRE, 10 + get_skill_scale(SKILL_FIRE, 300) },
- }
-
-
- local effect = t[cave(y, x).feat]
- if not effect then
- msg_print("You cannot channel this area.")
- else
- local typ = effect[1]
- if get_level(ELEMENTAL_WAVE) >= 20 then typ = effect[2] end
-
- cave_set_feat(y, x, FEAT_FLOOR)
-
- fire_wave(typ, 0, effect[3], 0, 6 + get_level(ELEMENTAL_WAVE, 20), EFF_WAVE + EFF_LAST + getglobal("EFF_DIR"..dir))
- end
-
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Draws on an adjacent special square to project a slow-moving",
- "wave of that element in that direction",
- "Abyss squares cannot be channeled into a wave.",
- }
-}
-
-VAPORIZE = add_spell
-{
- ["name"] = "Vaporize",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 4,
- ["mana"] = 3,
- ["mana_max"] = 30,
- ["fail"] = 15,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- -- Must have at least 4 Air
- ["random"] = 0,
- ["depend"] = function()
- if get_skill(SKILL_AIR) >= 4 then return TRUE end
- end,
- ["spell"] = function()
- local t =
- {
- -- Earth stuff
- [FEAT_GRASS] = { GF_POIS, GF_POIS, 5 + get_skill_scale(SKILL_EARTH, 100) },
- [FEAT_FLOWER] = { GF_POIS, GF_POIS, 5 + get_skill_scale(SKILL_EARTH, 150) },
- [FEAT_DARK_PIT] = { GF_DARK, GF_DARK, 5 + get_skill_scale(SKILL_EARTH, 200) },
-
- -- Water stuff
- [FEAT_SHAL_WATER] = { GF_WATER, GF_WATER, 5 + get_skill_scale(SKILL_WATER, 100) },
- [FEAT_DEEP_WATER] = { GF_WATER, GF_WATER, 5 + get_skill_scale(SKILL_WATER, 150) },
- [FEAT_ICE] = { GF_ICE, GF_ICE, 5 + get_skill_scale(SKILL_WATER, 100) },
-
- -- Fire stuff
- [FEAT_SAND] = { GF_LITE, GF_LITE, 5 + get_skill_scale(SKILL_FIRE, 200) },
- [FEAT_SHAL_LAVA] = { GF_FIRE, GF_HOLY_FIRE, 5 + get_skill_scale(SKILL_FIRE, 100) },
- [FEAT_DEEP_LAVA] = { GF_FIRE, GF_HOLY_FIRE, 5 + get_skill_scale(SKILL_FIRE, 150) },
- }
-
- local effect = t[cave(player.py, player.px).feat]
- if not effect then
- msg_print("You cannot channel this area.")
- else
- local typ = effect[1]
- if get_level(VAPORIZE) >= 20 then typ = effect[2] end
-
- cave_set_feat(player.py, player.px, FEAT_FLOOR)
-
- fire_cloud(typ, 0, effect[3], 1 + get_level(VAPORIZE, 4), 10 + get_level(VAPORIZE, 20))
- end
-
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(1 + get_level(VAPORIZE, 4)).." dur "..(10 + get_level(VAPORIZE, 20))
- end,
- ["desc"] = {
- "Draws upon your immediate environs to form a cloud of damaging vapors",
- }
-}
-
-geomancy_can_tunnel =
-{
- [FEAT_WALL_EXTRA] = TRUE,
- [FEAT_WALL_OUTER] = TRUE,
- [FEAT_WALL_INNER] = TRUE,
- [FEAT_WALL_SOLID] = TRUE,
-
- [FEAT_MAGMA] = TRUE,
- [FEAT_QUARTZ] = TRUE,
- [FEAT_MAGMA_H] = TRUE,
- [FEAT_QUARTZ_H] = TRUE,
- [FEAT_MAGMA_K] = TRUE,
- [FEAT_QUARTZ_K] = TRUE,
-
- [FEAT_TREES] = TRUE,
- [FEAT_DEAD_TREE] = TRUE,
-
- [FEAT_SANDWALL] = TRUE,
- [FEAT_SANDWALL_H] = TRUE,
- [FEAT_SANDWALL_K] = TRUE,
-
- [FEAT_ICE_WALL] = TRUE,
-}
-
--- Dig & sprew
-function geomancy_dig(oy, ox, dir, length)
- local dy, dx = explode_dir(dir)
- local y = dy + oy
- local x = dx + ox
-
- for i = 1, length do
- local c_ptr = cave(y, x)
- local ox = x - dx
- local oy = y - dy
-
- -- stop at the end of tunnelable things
- if not geomancy_can_tunnel[c_ptr.feat] then break end
-
- if geomancy_can_tunnel[cave(y - 1, x - 1).feat] then geomancy_random_wall(y - 1, x - 1) end
- if geomancy_can_tunnel[cave(y - 1, x).feat] then geomancy_random_wall(y - 1, x) end
- if geomancy_can_tunnel[cave(y - 1, x + 1).feat] then geomancy_random_wall(y - 1, x + 1) end
-
- if geomancy_can_tunnel[cave(y, x - 1).feat] then geomancy_random_wall(y, x - 1) end
- if geomancy_can_tunnel[cave(y, x + 1).feat] then geomancy_random_wall(y, x + 1) end
-
- if geomancy_can_tunnel[cave(y + 1, x - 1).feat] then geomancy_random_wall(y + 1, x - 1) end
- if geomancy_can_tunnel[cave(y + 1, x).feat] then geomancy_random_wall(y + 1, x) end
- if geomancy_can_tunnel[cave(y + 1, x + 1).feat] then geomancy_random_wall(y + 1, x + 1) end
-
- y = y + dy
- x = x + dx
- end
-
- y = y - dy
- x = x - dx
- while (y ~= oy) or (x ~= ox) do
- geomancy_random_floor(y, x, TRUE)
-
- -- Should we branch ?
- if magik(20) == TRUE then
- local rot = 1
- if magik(50) == TRUE then rot = -1 end
- geomancy_dig(y, x, rotate_dir(dir, rot), length / 3)
- end
-
- y = y - dy
- x = x - dx
- end
-end
-
-GEOLYSIS = add_spell
-{
- ["name"] = "Geolysis",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 7,
- ["mana"] = 15,
- ["mana_max"] = 40,
- ["fail"] = 15,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- -- Must have at least 7 Earth
- ["depend"] = function()
- if get_skill(SKILL_EARTH) >= 7 then return TRUE end
- end,
- ["spell"] = function()
- local ret, dir = get_rep_dir()
- if ret == FALSE then return end
-
- msg_print("Elements recombine before you, laying down an open path.")
- geomancy_dig(player.py, player.px, dir, 5 + get_level(GEOLYSIS, 12))
-
- return TRUE
- end,
- ["info"] = function()
- return "length "..(5 + get_level(GEOLYSIS, 12))
- end,
- ["desc"] = {
- "Burrows deeply and slightly at random into a wall,",
- "leaving behind tailings of various different sorts of walls in the passage.",
- }
-}
-
-player.dripping_tread = 0
-add_loadsave("player.dripping_tread", 0)
-add_hooks
-{
- [HOOK_MOVED] = function(oy, ox)
- if player.dripping_tread > 0 then
- geomancy_random_floor(oy, ox)
- player.dripping_tread = player.dripping_tread - 1
- if player.dripping_tread == 0 then
- msg_print("You stop dripping raw elemental energies.")
- end
- end
- end
-}
-DRIPPING_TREAD = add_spell
-{
- ["name"] = "Dripping Tread",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 10,
- ["mana"] = 15,
- ["mana_max"] = 25,
- ["fail"] = 15,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- -- Must have at least 10 Water
- ["depend"] = function()
- if get_skill(SKILL_WATER) >= 10 then return TRUE end
- end,
- ["spell"] = function()
- if player.dripping_tread == 0 then
- player.dripping_tread = randint(15) + 10 + get_level(DRIPPING_TREAD)
- msg_print("You start dripping raw elemental energies.")
- else
- player.dripping_tread = 0
- msg_print("You stop dripping raw elemental energies.")
- end
- return TRUE
- end,
- ["info"] = function()
- return "dur "..(10 + get_level(DRIPPING_TREAD)).."+d15 movs"
- end,
- ["desc"] = {
- "Causes you to leave random elemental forms behind as you walk",
- }
-}
-
-GROW_BARRIER = add_spell
-{
- ["name"] = "Grow Barrier",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 12,
- ["mana"] = 30,
- ["mana_max"] = 40,
- ["fail"] = 15,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- ["random"] = 0,
- -- Must have at least 12 Earth
- ["depend"] = function()
- if get_skill(SKILL_EARTH) >= 12 then return TRUE end
- end,
- ["spell"] = function()
- local ret, dir = 0, 0
-
- if get_level(GROW_BARRIER) >= 20 then
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- end
-
- fire_ball(GF_ELEMENTAL_WALL, dir, 1, 1)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Creates impassable terrain (walls, trees, etc.) around you.",
- "At level 20 it can be projected around another area.",
- }
-}
-
-ELEMENTAL_MINION = add_spell
-{
- ["name"] = "Elemental Minion",
- ["school"] = {SCHOOL_GEOMANCY},
- ["level"] = 20,
- ["mana"] = 40,
- ["mana_max"] = 80,
- ["fail"] = 25,
- -- Unnafected by blindness
- ["random"] = 0,
- -- Must have at least 12 Earth
- ["spell"] = function()
- local ret, dir = 0, 0
-
- ret, dir = get_rep_dir()
- if ret == FALSE then return end
-
- local t =
- {
- [FEAT_WALL_EXTRA] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_WALL_OUTER] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_WALL_INNER] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_WALL_SOLID] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_MAGMA] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_QUARTZ] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_MAGMA_H] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_QUARTZ_H] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_MAGMA_K] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
- [FEAT_QUARTZ_K] = { SKILL_EARTH, { "Earth elemental", "Xorn", "Xaren" } },
-
- [FEAT_DARK_PIT] = { SKILL_AIR, { "Air elemental", "Ancient blue dragon", "Great Storm Wyrm", "Sky Drake" } },
-
- [FEAT_SANDWALL] = { SKILL_FIRE, { "Fire elemental", "Ancient red dragon" } },
- [FEAT_SANDWALL_H] = { SKILL_FIRE, { "Fire elemental", "Ancient red dragon" } },
- [FEAT_SANDWALL_K] = { SKILL_FIRE, { "Fire elemental", "Ancient red dragon" } },
- [FEAT_SHAL_LAVA] = { SKILL_FIRE, { "Fire elemental", "Ancient red dragon" } },
- [FEAT_DEEP_LAVA] = { SKILL_FIRE, { "Fire elemental", "Ancient red dragon" } },
-
- [FEAT_ICE_WALL] = { SKILL_WATER, { "Water elemental", "Water troll", "Water demon" } },
- [FEAT_SHAL_WATER] = { SKILL_WATER, { "Water elemental", "Water troll", "Water demon" } },
- [FEAT_DEEP_WATER] = { SKILL_WATER, { "Water elemental", "Water troll", "Water demon" } },
- }
-
- local y, x = explode_dir(dir)
- y = y + player.py
- x = x + player.px
-
- local effect = t[cave(y, x).feat]
- if not effect then
- msg_print("You cannot summon from this area.")
- else
- local skill = effect[1]
- local types = effect[2]
-
- local max = get_skill_scale(skill, getn(types))
- if max == 0 then max = 1 end
-
- local r_idx = test_monster_name(types[rand_range(1, max)])
-
- -- Summon it
- local my, mx = find_position(y, x)
- local m_idx = place_monster_one(my, mx, r_idx, 0, FALSE, MSTATUS_FRIEND)
-
- -- level it
- if m_idx ~= 0 then
- monster_set_level(m_idx, 10 + get_level(ELEMENTAL_MINION, 120))
- end
-
- cave_set_feat(y, x, FEAT_FLOOR)
- end
-
- return TRUE
- end,
- ["info"] = function()
- return "min level "..(10 + get_level(ELEMENTAL_MINION, 120))
- end,
- ["desc"] = {
- "Summons a minion from a nearby element.",
- "Walls can summon Earth elmentals, Xorns and Xarens",
- "Dark Pits can summon Air elementals, Ancient blue dragons, Great Storm Wyrms",
- "and Sky Drakes",
- "Sandwalls and lava can summon Fire elementals and Ancient red dragons",
- "Icewall, and water can summon Water elementals, Water trolls and Water demons",
- }
-}
diff --git a/lib/mods/theme/scpt/s_mana.lua b/lib/mods/theme/scpt/s_mana.lua
deleted file mode 100644
index 736b06b0..00000000
--- a/lib/mods/theme/scpt/s_mana.lua
+++ /dev/null
@@ -1,132 +0,0 @@
--- The mana school
-
-function get_manathrust_dam()
- return 3 + get_level(MANATHRUST, 50), 1 + get_level(MANATHRUST, 20)
-end
-
-MANATHRUST = add_spell
-{
- ["name"] = "Manathrust",
- ["school"] = SCHOOL_MANA,
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 25,
- ["fail"] = 10,
- ["stick"] =
- {
- ["charge"] = { 7, 10 },
- [TV_WAND] =
- {
- ["rarity"] = 5,
- ["base_level"] = { 1, 20 },
- ["max_level"] = { 15, 33 },
- },
- },
- ["spell"] = function()
- local ret, dir
-
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt(GF_MANA, dir, damroll(get_manathrust_dam()))
- end,
- ["info"] = function()
- local x, y
-
- x, y = get_manathrust_dam()
- return "dam "..x.."d"..y
- end,
- ["desc"] = {
- "Conjures up mana into a powerful bolt",
- "The damage is irresistible and will increase with level"
- }
-}
-
-DELCURSES = add_spell
-{
- ["name"] = "Remove Curses",
- ["school"] = SCHOOL_MANA,
- ["level"] = 10,
- ["mana"] = 20,
- ["mana_max"] = 40,
- ["fail"] = 30,
- ["stick"] =
- {
- ["charge"] = { 3, 8 },
- [TV_STAFF] =
- {
- ["rarity"] = 70,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 15, 50 },
- },
- },
- ["inertia"] = { 1, 10 },
- ["spell"] = function()
- local done
-
- if get_level(DELCURSES, 50) >= 20 then done = remove_all_curse()
- else done = remove_curse() end
- if done == TRUE then msg_print("The curse is broken!") end
- return done
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Remove curses of worn objects",
- "At level 20 switches to *remove curses*"
- }
-}
-
-RESISTS = add_spell
-{
- ["name"] = "Elemental Shield",
- ["school"] = SCHOOL_MANA,
- ["level"] = 20,
- ["mana"] = 17,
- ["mana_max"] = 20,
- ["fail"] = 40,
- ["inertia"] = { 2, 25 },
- ["spell"] = function()
- local obvious
- if player.oppose_fire == 0 then obvious = set_oppose_fire(randint(10) + 15 + get_level(RESISTS, 50)) end
- if player.oppose_cold == 0 then obvious = is_obvious(set_oppose_cold(randint(10) + 15 + get_level(RESISTS, 50)), obvious) end
- if player.oppose_elec == 0 then obvious = is_obvious(set_oppose_elec(randint(10) + 15 + get_level(RESISTS, 50)), obvious) end
- if player.oppose_acid == 0 then obvious = is_obvious(set_oppose_acid(randint(10) + 15 + get_level(RESISTS, 50)), obvious) end
- return obvious
- end,
- ["info"] = function()
- return "dur "..(15 + get_level(RESISTS, 50)).."+d10"
- end,
- ["desc"] = {
- "Provide resistances to the four basic elements",
- }
-}
-
-MANASHIELD = add_spell
-{
- ["name"] = "Disruption Shield",
- ["school"] = SCHOOL_MANA,
- ["level"] = 45,
- ["mana"] = 50,
- ["mana_max"] = 50,
- ["fail"] = 90,
- ["inertia"] = { 9, 10},
- ["spell"] = function()
- if get_level(MANASHIELD, 50) >= 5 then
- if (player.invuln == 0) then
- return set_invuln(randint(5) + 3 + get_level(MANASHIELD, 10))
- end
- else
- if (player.disrupt_shield == 0) then return set_disrupt_shield(randint(5) + 3 + get_level(MANASHIELD, 10)) end
- end
- end,
- ["info"] = function()
- return "dur "..(3 + get_level(MANASHIELD, 10)).."+d5"
- end,
- ["desc"] = {
- "Uses mana instead of hp to take damage",
- "At level 5 switches to Globe of Invulnerability.",
- "The spell breaks as soon as a melee, shooting, throwing or magical",
- "skill action is attempted, and lasts only a short time."
- }
-}
diff --git a/lib/mods/theme/scpt/s_mandos.lua b/lib/mods/theme/scpt/s_mandos.lua
deleted file mode 100644
index cc7e346a..00000000
--- a/lib/mods/theme/scpt/s_mandos.lua
+++ /dev/null
@@ -1,186 +0,0 @@
--- Spells for the school of Mandos
-
-BOOK_MANDOS = 66
-
--- precognition timer for high-level spell [from T-Plus by Ingeborg S. Norden]
-
-add_loadsave("tim_precognition",0)
-
-function set_precognition(v)
- local notice = FALSE
- if (v < 0) then v = 0 end
- if (v > 10000) then v = 10000 end
-
- -- Check if the state will change
- if (v > 0) and (tim_precognition == 0) then
- msg_print("You feel able to predict the future.")
- notice = TRUE
- elseif (v == 0) and (tim_precognition > 0) then
- msg_print("You feel less able to predict the future.")
- notice = TRUE
- end
-
- -- set the new value
- tim_precognition = v
-
- if (notice == TRUE) then
- player.update = bor(player.update, PU_BONUS)
- disturb(0,0)
- end
- return notice
-end
-
--- related hooks
-
-add_hooks{
- [HOOK_CALC_BONUS] = function()
- if (tim_precognition > 0) then
- --player.precognition = TRUE
- apply_flags(0, 0, 0, TR4_PRECOGNITION, 0, 0, 0, 0, 0, 0, 0)
- end
- end,
-
- [HOOK_PROCESS_WORLD] = function()
- if (tim_precognition > 0) then
- set_precognition(tim_precognition - 1)
- end
- end,
-}
-
--- "Tears of Luthien" based on Holy Word from T-Plus
-MANDOS_TEARS_LUTHIEN = add_spell
-{
- ["name"] = "Tears of Luthien",
- ["school"] = {SCHOOL_MANDOS},
- ["level"] = 5,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 25,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local level = get_level(MANDOS_TEARS_LUTHIEN, 30)
- local obvious = hp_player(10 * level)
- obvious = is_obvious (set_stun(0), obvious)
- obvious = is_obvious (set_cut(0), obvious)
- obvious = is_obvious (set_afraid(0), obvious)
- return obvious
- end,
- ["info"] = function()
- local level = get_level(MANDOS_TEARS_LUTHIEN, 30)
- return "heals "..(10 * level)
- end,
- ["desc"] = {
- "Calls upon the spirit of Luthien to ask Mandos for healing and succour."
- }
-}
-
--- "Spirit of the Feanturi" based on Restore Mind from T-Plus
-MANDOS_SPIRIT_FEANTURI = add_spell {
- ["name"] = "Feanturi",
- ["school"] = {SCHOOL_MANDOS},
- ["level"] = 10,
- ["mana"] = 40,
- ["mana_max"] = 200,
- ["fail"] = 50,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local level = get_level(MANDOS_SPIRIT_FEANTURI, 50)
- local obvious
- obvious = set_afraid(0)
- obvious = is_obvious(set_confused(0), obvious)
-
- if level >= 20 then
- obvious = is_obvious(do_res_stat(A_WIS, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_INT, TRUE), obvious)
- end
-
- if level >= 30 then
- obvious = is_obvious(set_image(0), obvious)
- obvious = is_obvious(heal_insanity(player.msane * level / 100), obvious)
- end
-
- return obvious
- end,
-
- ["info"] = function()
- local level = get_level(MANDOS_SPIRIT_FEANTURI, 50)
- if level >= 20 then
- return "heals "..level.."%"
- else
- return ""
- end
- end,
- ["desc"] = {
- "Channels the power of Mandos to cure fear and confusion.",
- "At level 20 it restores lost INT and WIS",
- "At level 30 it cures hallucinations and restores a percentage of lost sanity"
- }
-}
-
--- "Tale of Doom" based on Foretell from T-Plus
-MANDOS_TALE_DOOM = add_spell
-{
- ["name"] = "Tale of Doom",
- ["school"] = {SCHOOL_MANDOS},
- ["level"] = 25,
- ["mana"] = 60,
- ["mana_max"] = 300,
- ["stat"] = A_WIS,
- ["fail"] = 75,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return set_precognition(5 + get_level(MANDOS_TALE_DOOM,10))
- end,
- ["info"] = function()
- return "dur "..(5 + get_level(MANDOS_TALE_DOOM,10))
- end,
- ["desc"] = {
- "Allows you to predict the future for a short time."
- }
-}
-
--- "Call to the Halls" based on Call Blessed Soul from T-Plus
-MANDOS_CALL_HALLS= add_spell
-
-{
- ["name"] = "Call to the Halls",
- ["school"] = {SCHOOL_MANDOS},
- ["level"] = 30,
- ["mana"] = 80,
- ["mana_max"] = 400,
- ["fail"] = 95,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local y, x, m_idx
- local summons =
- {
- test_monster_name("Experienced spirit"),
- test_monster_name("Wise spirit"),
- }
- y, x = find_position(player.py, player.px)
- m_idx = place_monster_one(y, x, summons[rand_range(1, 2)], 0, FALSE, MSTATUS_FRIEND)
- if m_idx ~= 0 then
- monster_set_level(m_idx, 20 + get_level(MANDOS_CALL_HALLS, 70, 0))
- return TRUE
- end
- end,
-
- ["info"] = function()
- return "level "..(get_level(MANDOS_CALL_HALLS, 70))
- end,
- ["desc"] = {
- "Summons a leveled spirit from the Halls of Mandos",
- "to fight for you."
-
- }
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/s_manwe.lua b/lib/mods/theme/scpt/s_manwe.lua
deleted file mode 100644
index 6f0f9661..00000000
--- a/lib/mods/theme/scpt/s_manwe.lua
+++ /dev/null
@@ -1,144 +0,0 @@
--- Handle Manwe Sulimo magic school
-
-MANWE_SHIELD = add_spell
-{
- ["name"] = "Wind Shield",
- ["school"] = {SCHOOL_MANWE},
- ["level"] = 10,
- ["mana"] = 100,
- ["mana_max"] = 500,
- ["fail"] = 30,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local dur = get_level(MANWE_SHIELD, 50) + 10 + randint(20)
- local obvious
-
- obvious = set_protevil(dur)
- if get_level(MANWE_SHIELD) >= 10 then
- local type
-
- type = 0
- if get_level(MANWE_SHIELD) >= 20 then
- type = SHIELD_COUNTER
- end
- obvious = is_obvious(set_shield(dur, get_level(MANWE_SHIELD, 30), type, 1 + get_level(MANWE_SHIELD, 2), 1 + get_level(MANWE_SHIELD, 6)), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- local desc = "dur "..(get_level(MANWE_SHIELD, 50) + 10).."+d20"
-
- if get_level(MANWE_SHIELD) >= 10 then
- desc = desc.." AC "..(get_level(MANWE_SHIELD, 30))
- end
- if get_level(MANWE_SHIELD) >= 20 then
- desc = desc.." dam "..(1 + get_level(MANWE_SHIELD, 2)).."d"..(1 + get_level(MANWE_SHIELD, 6))
- end
- return desc
- end,
- ["desc"] = {
- "It surrounds you with a shield of wind that deflects blows from evil monsters",
- "At level 10 it increases your armour rating",
- "At level 20 it retaliates against monsters that melee you",
- }
-}
-
-MANWE_AVATAR = add_spell
-{
- ["name"] = "Avatar",
- ["school"] = {SCHOOL_MANWE},
- ["level"] = 35,
- ["mana"] = 1000,
- ["mana_max"] = 1000,
- ["fail"] = 80,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return set_mimic(get_level(MANWE_AVATAR, 20) + randint(10), resolve_mimic_name("Maia"), player.lev)
- end,
- ["info"] = function()
- return "dur "..(get_level(MANWE_AVATAR, 20)).."+d10"
- end,
- ["desc"] = {
- "It turns you into a full grown Maia",
- }
-}
-
-MANWE_BLESS = add_spell
-{
- ["name"] = "Manwe's Blessing",
- ["school"] = {SCHOOL_MANWE},
- ["level"] = 1,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 20,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local dur = get_level(MANWE_BLESS, 70) + 30 + randint(40)
- local obvious
-
- obvious = set_blessed(dur)
- obvious = is_obvious(set_afraid(0), obvious)
- obvious = is_obvious(set_lite(0), obvious)
- if get_level(MANWE_BLESS) >= 10 then
- obvious = is_obvious(set_hero(dur), obvious)
- end
- if get_level(MANWE_BLESS) >= 20 then
- obvious = is_obvious(set_shero(dur), obvious)
- end
- if get_level(MANWE_BLESS) >= 30 then
- obvious = is_obvious(set_holy(dur), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return "dur "..(get_level(MANWE_BLESS, 70) + 30).."+d40"
- end,
- ["desc"] = {
- "Manwe's Blessing removes your fears, blesses you and surrounds you with",
- "holy light",
- "At level 10 it also grants heroism",
- "At level 20 it also grants super heroism",
- "At level 30 it also grants holy luck and life protection",
- }
-}
-
-MANWE_CALL = add_spell
-{
- ["name"] = "Manwe's Call",
- ["school"] = {SCHOOL_MANWE},
- ["level"] = 20,
- ["mana"] = 200,
- ["mana_max"] = 500,
- ["fail"] = 40,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local y, x, m_idx
-
- y, x = find_position(player.py, player.px)
- m_idx = place_monster_one(y, x, test_monster_name("Great eagle"), 0, FALSE, MSTATUS_FRIEND)
-
- if m_idx ~= 0 then
- monster_set_level(m_idx, 20 + get_level(MANWE_CALL, 70, 0))
- return TRUE
- end
- end,
- ["info"] = function()
- return "level "..(get_level(MANWE_CALL, 70) + 20)
- end,
- ["desc"] = {
- "Manwe's Call summons a Great Eagle to help you battle the forces",
- "of Morgoth"
- }
-}
diff --git a/lib/mods/theme/scpt/s_melkor.lua b/lib/mods/theme/scpt/s_melkor.lua
deleted file mode 100644
index b2c693dd..00000000
--- a/lib/mods/theme/scpt/s_melkor.lua
+++ /dev/null
@@ -1,154 +0,0 @@
--- handle the melkor school
-
--- Not included in the spell code directly because I need to call it from somewhere else too
-function do_melkor_curse(who)
- local m_ptr = monster(who)
-
- if get_level(MELKOR_CURSE) >= 35 then
- local r_ptr = race_info_idx(m_ptr.r_idx, m_ptr.ego)
-
- m_ptr.maxhp = m_ptr.maxhp - r_ptr.hside;
- if m_ptr.maxhp < 1 then m_ptr.maxhp = 1 end
- if m_ptr.hp > m_ptr.maxhp then m_ptr.hp = m_ptr.maxhp end
- player.redraw = bor(player.redraw, PR_HEALTH)
- end
- if get_level(MELKOR_CURSE) >= 25 then
- m_ptr.speed = m_ptr.speed - get_level(MELKOR_CURSE, 7)
- m_ptr.mspeed = m_ptr.mspeed - get_level(MELKOR_CURSE, 7)
-
- if m_ptr.speed < 70 then m_ptr.speed = 70 end
- if m_ptr.mspeed < 70 then m_ptr.mspeed = 70 end
- end
- if get_level(MELKOR_CURSE) >= 15 then
- m_ptr.ac = m_ptr.ac - get_level(MELKOR_CURSE, 50)
-
- if m_ptr.ac < -70 then m_ptr.ac = -70 end
- end
-
- local i, pow
- i = 1
- pow = get_level(MELKOR_CURSE, 2)
- while (i <= 4) do
- if m_ptr.blow[i].d_dice > 0 then
- if m_ptr.blow[i].d_dice < pow then
- pow = m_ptr.blow[i].d_dice
- end
- if m_ptr.blow[i].d_side < pow then
- pow = m_ptr.blow[i].d_side
- end
- m_ptr.blow[i].d_dice = m_ptr.blow[i].d_dice - pow
- end
- i = i + 1
- end
-
- local m_name = monster_desc(m_ptr, 0).." looks weaker."
- msg_print(strupper(strsub(m_name, 0, 1))..strsub(m_name, 2))
-
- -- wake it
- m_ptr.csleep = 0;
-end
-
-MELKOR_CURSE = add_spell
-{
- ["name"] = "Curse",
- ["school"] = {SCHOOL_MELKOR},
- ["level"] = 1,
- ["mana"] = 50,
- ["mana_max"] = 300,
- ["fail"] = 20,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- if target_who == -1 then
- msg_print("You must target a monster.")
- else
- do_melkor_curse(target_who)
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "It curses a monster, reducing its melee power",
- "At level 5 it can be auto-casted (with no piety cost) while fighting",
- "At level 15 it also reduces armor",
- "At level 25 it also reduces speed",
- "At level 35 it also reduces max life (but it is never fatal)",
- }
-}
-
-MELKOR_CORPSE_EXPLOSION = add_spell
-{
- ["name"] = "Corpse Explosion",
- ["school"] = {SCHOOL_MELKOR},
- ["level"] = 10,
- ["mana"] = 100,
- ["mana_max"] = 500,
- ["fail"] = 45,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return fire_ball(GF_CORPSE_EXPL, 0, 20 + get_level(MELKOR_CORPSE_EXPLOSION, 70), 2 + get_level(MELKOR_CORPSE_EXPLOSION, 5))
- end,
- ["info"] = function()
- return "dam "..(20 + get_level(MELKOR_CORPSE_EXPLOSION, 70)).."%"
- end,
- ["desc"] = {
- "It makes corpses in an area around you explode for a percent of their",
- "hit points as damage",
- }
-}
-
-MELKOR_MIND_STEAL = add_spell
-{
- ["name"] = "Mind Steal",
- ["school"] = {SCHOOL_MELKOR},
- ["level"] = 20,
- ["mana"] = 1000,
- ["mana_max"] = 3000,
- ["fail"] = 90,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- if target_who == -1 then
- msg_print("You must target a monster.")
- else
- local chance, m_ptr, r_ptr
-
- m_ptr = monster(target_who)
- r_ptr = race_info_idx(m_ptr.r_idx, m_ptr.ego)
- chance = get_level(MELKOR_MIND_STEAL)
- if (randint(m_ptr.level) < chance) and (band(r_ptr.flags1, RF1_UNIQUE) == 0) then
- player.control = target_who
- m_ptr.mflag = bor(m_ptr.mflag, MFLAG_CONTROL)
-
- local m_name = monster_desc(m_ptr, 0).." falls under your control."
- msg_print(strupper(strsub(m_name, 0, 1))..strsub(m_name, 2))
- else
- local m_name = monster_desc(m_ptr, 0).." resists."
- msg_print(strupper(strsub(m_name, 0, 1))..strsub(m_name, 2))
- end
- return TRUE
- end
- end,
- ["info"] = function()
- return "chance 1d(mlvl)<"..(get_level(MELKOR_MIND_STEAL))
- end,
- ["desc"] = {
- "It allows your spirit to temporarily leave your own body, which will",
- "be vulnerable, to control one of your enemies body."
- }
-}
diff --git a/lib/mods/theme/scpt/s_meta.lua b/lib/mods/theme/scpt/s_meta.lua
deleted file mode 100644
index eab691d8..00000000
--- a/lib/mods/theme/scpt/s_meta.lua
+++ /dev/null
@@ -1,287 +0,0 @@
--- handle the meta school
-
-RECHARGE = add_spell
-{
- ["name"] = "Recharge",
- ["school"] = {SCHOOL_META},
- ["level"] = 5,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 20,
- ["spell"] = function()
- return recharge(60 + get_level(RECHARGE, 140))
- end,
- ["info"] = function()
- return "power "..(60 + get_level(RECHARGE, 140))
- end,
- ["desc"] = {
- "Taps on the ambient mana to recharge an object's power (charges or mana)",
- }
-}
-
-function get_spellbinder_max()
- local i
-
- i = get_level(SPELLBINDER, 4)
- if i > 4 then i = 4 end
- return i
-end
---'
-SPELLBINDER = add_spell
-{
- ["name"] = "Spellbinder",
- ["school"] = {SCHOOL_META},
- ["level"] = 20,
- ["mana"] = 100,
- ["mana_max"] = 300,
- ["fail"] = 85,
- ["spell"] = function()
- local i, ret, c
-
- if player.spellbinder_num ~= 0 then
- local t =
- {
- [SPELLBINDER_HP75] = "75% HP",
- [SPELLBINDER_HP50] = "50% HP",
- [SPELLBINDER_HP25] = "25% HP",
- }
- msg_print("The spellbinder is already active.")
- msg_print("It will trigger at "..t[player.spellbinder_trigger]..".")
- msg_print("With the spells: ")
- for i = 1, player.spellbinder_num do
- msg_print(spell(player.spellbinder[i]).name)
- end
- return TRUE
- end
-
- ret, c = get_com("Trigger at [a]75% hp [b]50% hp [c]25% hp?", strbyte("a"))
- if ret == FALSE then return TRUE end
-
- if c == strbyte("a") then
- player.spellbinder_trigger = SPELLBINDER_HP75
- elseif c == strbyte("b") then
- player.spellbinder_trigger = SPELLBINDER_HP50
- elseif c == strbyte("c") then
- player.spellbinder_trigger = SPELLBINDER_HP25
- else
- return
- end
- player.spellbinder_num = get_spellbinder_max()
- i = player.spellbinder_num
- while i > 0 do
- local s
-
- s = get_school_spell("bind", "is_ok_spell", 0)
- if s == -1 then
- player.spellbinder_trigger = 0
- player.spellbinder_num = 0
- return TRUE
- else
- if spell(s).skill_level > 7 + get_level(SPELLBINDER, 35) then
- msg_print("You are only allowed spells with a base level of "..(7 + get_level(SPELLBINDER, 35))..".");
- return TRUE
- end
- end
- player.spellbinder[i] = s
- i = i - 1
- end
- player.energy = player.energy - 3100;
- msg_print("Spellbinder ready.")
- return TRUE
- end,
- ["info"] = function()
- return "number "..(get_spellbinder_max()).." max level "..(7 + get_level(SPELLBINDER, 35))
- end,
- ["desc"] = {
- "Stores spells in a trigger.",
- "When the condition is met all spells fire off at the same time",
- "This spell takes a long time to cast so you are advised to prepare it",
- "in a safe area.",
- "Also it will use the mana for the Spellbinder and the mana for the",
- "selected spells"
- }
-}
-
-DISPERSEMAGIC = add_spell
-{
- ["name"] = "Disperse Magic",
- ["school"] = {SCHOOL_META},
- ["level"] = 15,
- ["mana"] = 30,
- ["mana_max"] = 60,
- ["fail"] = 40,
- -- Unnafected by blindness
- ["blind"] = FALSE,
- -- Unnafected by confusion
- ["confusion"] = FALSE,
- ["stick"] =
- {
- ["charge"] = { 5, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 25,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 5, 40 },
- },
- },
- ["inertia"] = { 1, 5 },
- ["spell"] = function()
- local obvious
- obvious = set_blind(0)
- obvious = is_obvious(set_lite(0), obvious)
- if get_level(DISPERSEMAGIC, 50) >= 5 then
- obvious = is_obvious(set_confused(0), obvious)
- obvious = is_obvious(set_image(0), obvious)
- end
- if get_level(DISPERSEMAGIC, 50) >= 10 then
- obvious = is_obvious(set_slow(0), obvious)
- obvious = is_obvious(set_fast(0, 0), obvious)
- obvious = is_obvious(set_light_speed(0), obvious)
- end
- if get_level(DISPERSEMAGIC, 50) >= 15 then
- obvious = is_obvious(set_stun(0), obvious)
- obvious = is_obvious(set_meditation(0), obvious)
- obvious = is_obvious(set_cut(0), obvious)
- end
- if get_level(DISPERSEMAGIC, 50) >= 20 then
- obvious = is_obvious(set_hero(0), obvious)
- obvious = is_obvious(set_shero(0), obvious)
- obvious = is_obvious(set_blessed(0), obvious)
- obvious = is_obvious(set_shield(0, 0, 0, 0, 0), obvious)
- obvious = is_obvious(set_afraid(0), obvious)
- obvious = is_obvious(set_parasite(0, 0), obvious)
- obvious = is_obvious(set_mimic(0, 0, 0), obvious)
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Dispels a lot of magic that can affect you, be it good or bad",
- "Level 1: blindness and light",
- "Level 5: confusion and hallucination",
- "Level 10: speed (both bad or good) and light speed",
- "Level 15: stunning, meditation, cuts",
- "Level 20: hero, super hero, bless, shields, afraid, parasites, mimicry",
- }
-}
-
-TRACKER = add_spell
-{
- ["name"] = "Tracker",
- ["school"] = {SCHOOL_META, SCHOOL_CONVEYANCE},
- ["level"] = 30,
- ["mana"] = 50,
- ["mana_max"] = 50,
- ["fail"] = 95,
- ["spell"] = function()
- if last_teleportation_y == -1 then
- msg_print("There has not been any teleporatation here.")
- return TRUE
- end
- teleport_player_to(last_teleportation_y, last_teleportation_x)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Tracks down the last teleportation that happened on the level and teleports",
- "you to it",
- }
-}
-
--- Saves the values of the timer
-save_timer("TIMER_INERTIA_CONTROL")
-add_loadsave("player.inertia_controlled_spell", -1)
-player.inertia_controlled_spell = -1
-
--- Automatically cast the inertia controlled spells
-TIMER_INERTIA_CONTROL = new_timer
-{
- ["enabled"] = FALSE,
- ["delay"] = 10,
- ["callback"] = function()
- -- Don't cast a controlled spell in wilderness mode
- if player.antimagic then
- msg_print("Your anti-magic field disrupts any magic attempts.")
- elseif player.anti_magic then
- msg_print("Your anti-magic shell disrupts any magic attempts.")
- elseif (player.inertia_controlled_spell ~= -1) and (player.wild_mode == FALSE) then
- __spell_spell[player.inertia_controlled_spell]()
- end
- end,
-}
-
-stop_inertia_controlled_spell = function()
- player.inertia_controlled_spell = -1
- TIMER_INERTIA_CONTROL.enabled = FALSE
- player.update = bor(player.update, PU_MANA)
- return TRUE
-end
-
-add_hooks
-{
- -- Reduce the mana by four times the cost of the spell
- [HOOK_CALC_MANA] = function(msp)
- if player.inertia_controlled_spell ~= -1 then
- msp = msp - (get_mana(player.inertia_controlled_spell) * 4)
- if msp < 0 then msp = 0 end
- return TRUE, msp
- end
- end,
-
- -- Stop a previous spell at birth
- [HOOK_BIRTH_OBJECTS] = function()
- stop_inertia_controlled_spell()
- end,
-}
-
-INERTIA_CONTROL = add_spell
-{
- ["name"] = "Inertia Control",
- ["school"] = {SCHOOL_META},
- ["level"] = 37,
- ["mana"] = 300,
- ["mana_max"] = 700,
- ["fail"] = 95,
- ["spell"] = function()
- if player.inertia_controlled_spell ~= -1 then
- msg_print("You cancel your inertia flow control.")
- return stop_inertia_controlled_spell()
- end
-
- local s = get_school_spell("control", "is_ok_spell", 0)
- if s == -1 then
- return stop_inertia_controlled_spell()
- end
-
- local inertia = __tmp_spells[s].inertia
-
- if inertia == nil then
- msg_print("This spell inertia flow can not be controlled.")
- return stop_inertia_controlled_spell()
- end
- if inertia[1] > get_level(INERTIA_CONTROL, 10) then
- msg_print("This spell inertia flow("..inertia[1]..") is too strong to be controlled by your current spell.")
- return stop_inertia_controlled_spell()
- end
-
- player.inertia_controlled_spell = s
- TIMER_INERTIA_CONTROL.enabled = TRUE
- TIMER_INERTIA_CONTROL.delay = inertia[2]
- TIMER_INERTIA_CONTROL.countdown = TIMER_INERTIA_CONTROL.delay
- player.update = bor(player.update, PU_MANA)
- msg_print("Inertia flow controlling spell "..spell(s).name..".")
- return TRUE
- end,
- ["info"] = function()
- return "level "..get_level(INERTIA_CONTROL, 10)
- end,
- ["desc"] = {
- "Changes the energy flow of a spell to be continuously recasted",
- "at a given interval. The inertia controlled spell reduces your",
- "maximum mana by four times its cost.",
- }
-}
diff --git a/lib/mods/theme/scpt/s_mind.lua b/lib/mods/theme/scpt/s_mind.lua
deleted file mode 100644
index d1b25e9e..00000000
--- a/lib/mods/theme/scpt/s_mind.lua
+++ /dev/null
@@ -1,132 +0,0 @@
--- handle the mind school
-
-CHARM = add_spell
-{
- ["name"] = "Charm",
- ["school"] = {SCHOOL_MIND},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 20,
- ["fail"] = 10,
- ["stick"] =
- {
- ["charge"] = { 7, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 35,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 20, 40 },
- },
- },
- ["spell"] = function()
- if get_level(CHARM, 50) >= 35 then
- return project_los(GF_CHARM, 10 + get_level(CHARM, 150))
- elseif get_level(CHARM, 50) >= 15 then
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_CHARM, dir, 10 + get_level(CHARM, 150), 3)
- else
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt(GF_CHARM, dir, 10 + get_level(CHARM, 150))
- end
- end,
- ["info"] = function()
- return "power "..(10 + get_level(CHARM, 150))
- end,
- ["desc"] = {
- "Tries to manipulate the mind of a monster to make it friendly",
- "At level 15 it turns into a ball",
- "At level 35 it affects all monsters in sight"
- }
-}
-
-CONFUSE = add_spell
-{
- ["name"] = "Confuse",
- ["school"] = {SCHOOL_MIND},
- ["level"] = 5,
- ["mana"] = 5,
- ["mana_max"] = 30,
- ["fail"] = 20,
- ["stick"] =
- {
- ["charge"] = { 3, 4 },
- [TV_WAND] =
- {
- ["rarity"] = 45,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 20, 40 },
- },
- },
- ["spell"] = function()
- if get_level(CONFUSE, 50) >= 35 then
- return project_los(GF_OLD_CONF, 10 + get_level(CONFUSE, 150))
- elseif get_level(CONFUSE, 50) >= 15 then
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_OLD_CONF, dir, 10 + get_level(CONFUSE, 150), 3)
- else
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt(GF_OLD_CONF, dir, 10 + get_level(CONFUSE, 150))
- end
- end,
- ["info"] = function()
- return "power "..(10 + get_level(CONFUSE, 150))
- end,
- ["desc"] = {
- "Tries to manipulate the mind of a monster to confuse it",
- "At level 15 it turns into a ball",
- "At level 35 it affects all monsters in sight"
- }
-}
-
-ARMOROFFEAR = add_spell
-{
- ["name"] = "Armor of Fear",
- ["school"] = SCHOOL_MIND,
- ["level"] = 10,
- ["mana"] = 10,
- ["mana_max"] = 50,
- ["fail"] = 35,
- ["inertia"] = { 2, 20 },
- ["spell"] = function()
- return set_shield(randint(10) + 10 + get_level(ARMOROFFEAR, 100), 10, SHIELD_FEAR, 1 + get_level(ARMOROFFEAR, 7), 5 + get_level(ARMOROFFEAR, 20))
- end,
- ["info"] = function()
- return "dur "..(10 + get_level(ARMOROFFEAR, 100)).." power "..(1 + get_level(ARMOROFFEAR, 7)).."d"..(5 + get_level(ARMOROFFEAR, 20))
- end,
- ["desc"] = {
- "Creates a shield of pure fear around you. Any monster attempting to hit you",
- "must save or flee",
- }
-}
-
-STUN = add_spell
-{
- ["name"] = "Stun",
- ["school"] = {SCHOOL_MIND},
- ["level"] = 15,
- ["mana"] = 10,
- ["mana_max"] = 90,
- ["fail"] = 45,
- ["spell"] = function()
- if get_level(STUN, 50) >= 20 then
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_STUN, dir, 10 + get_level(STUN, 150), 3)
- else
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt(GF_STUN, dir, 10 + get_level(STUN, 150))
- end
- end,
- ["info"] = function()
- return "power "..(10 + get_level(STUN, 150))
- end,
- ["desc"] = {
- "Tries to manipulate the mind of a monster to stun it",
- "At level 20 it turns into a ball",
- }
-}
diff --git a/lib/mods/theme/scpt/s_music.lua b/lib/mods/theme/scpt/s_music.lua
deleted file mode 100644
index 9da6393a..00000000
--- a/lib/mods/theme/scpt/s_music.lua
+++ /dev/null
@@ -1,443 +0,0 @@
--- handle the music school
--- *ALL* lasting spell must return the mana cost in the lasting function
-
-MUSIC_STOP = add_spell
-{
- ["name"] = "Stop singing(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = -400,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 1,
- ["blind"] = FALSE,
- ["spell"] = function()
- player.start_lasting_spell(0)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Stops the current song, if any."
- }
-}
-
---- Drums
-MUSIC_HOLD = add_spell
-{
- ["name"] = "Holding Pattern(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 10,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 1,
- ["blind"] = FALSE,
- ["lasting"] = function()
- project_los(GF_OLD_SLOW, 10 + get_level(MUSIC_HOLD, 100))
- return get_mana(MUSIC_HOLD)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_HOLD)
- return TRUE
- end,
- ["info"] = function()
- return "power "..(10 + get_level(MUSIC_HOLD, 100))
- end,
- ["desc"] = {
- "Slows down all monsters listening the song.",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_CONF = add_spell
-{
- ["name"] = "Illusion Pattern(II)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 5,
- ["mana"] = 2,
- ["mana_max"] = 15,
- ["fail"] = 30,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 2,
- ["blind"] = FALSE,
- ["lasting"] = function()
- project_los(GF_OLD_CONF, 10 + get_level(MUSIC_CONF, 100))
- return get_mana(MUSIC_CONF)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_CONF)
- return TRUE
- end,
- ["info"] = function()
- return "power "..(10 + get_level(MUSIC_CONF, 100))
- end,
- ["desc"] = {
- "Tries to confuse all monsters listening the song.",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_STUN = add_spell
-{
- ["name"] = "Stun Pattern(IV)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 10,
- ["mana"] = 3,
- ["mana_max"] = 25,
- ["fail"] = 45,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 4,
- ["blind"] = FALSE,
- ["lasting"] = function()
- project_los(GF_STUN, 10 + get_level(MUSIC_STUN, 90))
- return get_mana(MUSIC_STUN)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_STUN)
- return TRUE
- end,
- ["info"] = function()
- return "power "..(10 + get_level(MUSIC_STUN, 90))
- end,
- ["desc"] = {
- "Stuns all monsters listening the song.",
- "Consumes the amount of mana each turn.",
- }
-}
-
---- Harps
-MUSIC_LITE = add_spell
-{
- ["name"] = "Song of the Sun(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 1,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["blind"] = FALSE,
- ["pval"] = 1,
- ["lasting"] = function()
- set_lite(5)
- return 1
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_LITE)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Provides light as long as you sing.",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_HEAL = add_spell
-{
- ["name"] = "Flow of Life(II)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 7,
- ["mana"] = 5,
- ["mana_max"] = 30,
- ["fail"] = 35,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 2,
- ["lasting"] = function()
- hp_player(7 + get_level(MUSIC_HEAL, 100))
- return get_mana(MUSIC_HEAL)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_HEAL)
- return TRUE
- end,
- ["info"] = function()
- return "heal "..(7 + get_level(MUSIC_HEAL, 100)).."/turn"
- end,
- ["desc"] = {
- "Heals you as long as you sing.",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_HERO = add_spell
-{
- ["name"] = "Heroic Ballad(II)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 10,
- ["mana"] = 4,
- ["mana_max"] = 14,
- ["fail"] = 45,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 2,
- ["lasting"] = function()
- set_hero(5)
- if get_level(MUSIC_HERO) >= 10 then
- set_shero(5)
- end
- if get_level(MUSIC_HERO) >= 20 then
- set_strike(5)
- end
- if get_level(MUSIC_HERO) >= 25 then
- set_oppose_cc(5)
- end
- return get_mana(MUSIC_HERO)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_HERO)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Increases melee accuracy",
- "At level 10 it increases it even more and reduces armour a bit",
- "At level 20 it increases it again",
- "At level 25 it grants protection against chaos and confusion",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_TIME = add_spell
-{
- ["name"] = "Hobbit Melodies(III)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 20,
- ["mana"] = 10,
- ["mana_max"] = 30,
- ["fail"] = 70,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 3,
- ["lasting"] = function()
- set_shield(5, 10 + get_level(MUSIC_TIME, 50), 0, 0, 0)
- if get_level(MUSIC_TIME) >= 15 then
- set_fast(5, 7 + get_level(MUSIC_TIME, 10))
- end
- return get_mana(MUSIC_TIME)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_TIME)
- return TRUE
- end,
- ["info"] = function()
- if get_level(MUSIC_TIME) >= 15 then
- return "AC "..(10 + get_level(MUSIC_TIME, 50)).." speed "..(7 + get_level(MUSIC_TIME, 10))
- else
- return "AC "..(10 + get_level(MUSIC_TIME, 50))
- end
- end,
- ["desc"] = {
- "Greatly increases your reflexes allowing you to block more melee blows.",
- "At level 15 it also makes you faster.",
- "Consumes the amount of mana each turn.",
- }
-}
-
-MUSIC_MIND = add_spell
-{
- ["name"] = "Clairaudience(IV)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 25,
- ["mana"] = 15,
- ["mana_max"] = 30,
- ["fail"] = 75,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 4,
- ["lasting"] = function()
- set_tim_esp(5)
- if get_level(MUSIC_MIND) >= 10 then
- fire_ball(GF_IDENTIFY, 0, 1, 1 + get_level(MUSIC_MIND, 3, 0))
- end
- return get_mana(MUSIC_MIND)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_MIND)
- return TRUE
- end,
- ["info"] = function()
- if get_level(MUSIC_MIND) >= 10 then
- return "rad "..(1 + get_level(MUSIC_MIND, 3, 0))
- else
- return ""
- end
- end,
- ["desc"] = {
- "Allows you to sense monster minds as long as you sing.",
- "At level 10 it identifies all objects in a radius on the floor,",
- "as well as probing monsters in that radius.",
- "Consumes the amount of mana each turn.",
- }
-}
-
---- Horns
-
-MUSIC_BLOW = add_spell
-{
- ["name"] = "Blow(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 4,
- ["mana"] = 3,
- ["mana_max"] = 30,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 1,
- ["spell"] = function()
- fire_ball(GF_SOUND,
- 0,
- damroll(2 + get_level(MUSIC_BLOW, 10, 0), 4 + get_level(MUSIC_BLOW, 40, 0)),
- 1 + get_level(MUSIC_BLOW, 12, 0)
- )
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(2 + get_level(MUSIC_BLOW, 10, 0)).."d"..(4 + get_level(MUSIC_BLOW, 40, 0)).." rad "..(1 + get_level(MUSIC_BLOW, 12, 0))
- end,
- ["desc"] = {
- "Produces a powerful, blowing, sound all around you.",
- }
-}
-
-MUSIC_WIND = add_spell
-{
- ["name"] = "Gush of Wind(II)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 14,
- ["mana"] = 15,
- ["mana_max"] = 45,
- ["fail"] = 30,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 2,
- ["spell"] = function()
- fire_ball(GF_AWAY_ALL,
- 0,
- 10 + get_level(MUSIC_BLOW, 40, 0),
- 1 + get_level(MUSIC_BLOW, 12, 0)
- )
- return TRUE
- end,
- ["info"] = function()
- return "dist "..(10 + get_level(MUSIC_BLOW, 40, 0)).." rad "..(1 + get_level(MUSIC_BLOW, 12, 0))
- end,
- ["desc"] = {
- "Produces a outgoing gush of wind that sends monsters away.",
- }
-}
-
-MUSIC_YLMIR = add_spell
-{
- ["name"] = "Horns of Ylmir(III)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 20,
- ["mana"] = 25,
- ["mana_max"] = 30,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 3,
- ["spell"] = function()
- earthquake(player.py, player.px, 2 + get_level(SHAKE, 10))
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(2 + get_level(SHAKE, 10))
- end,
- ["desc"] = {
- "Produces an earth shaking sound.",
- }
-}
-
-MUSIC_AMBARKANTA = add_spell
-{
- ["name"] = "Ambarkanta(IV)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 25,
- ["mana"] = 70,
- ["mana_max"] = 70,
- ["fail"] = 60,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 4,
- ["spell"] = function()
- alter_reality()
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Produces a reality shaking sound that transports you to a nearly",
- "identical reality.",
- }
-}
-
-
---[[
-MUSIC_ = add_spell
-{
- ["name"] = "(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 1,
- ["lasting"] = function()
- return get_mana(MUSIC_)
- end,
- ["spell"] = function()
- player.start_lasting_spell(MUSIC_)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "",
- "Consumes the amount of mana each turn.",
- }
-}
-
-or
-
-MUSIC_ = add_spell
-{
- ["name"] = "(I)",
- ["school"] = {SCHOOL_MUSIC},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 20,
- ["stat"] = A_CHR,
- ["random"] = SKILL_MUSIC,
- ["pval"] = 1,
- ["spell"] = function()
-
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "",
- }
-}
-]]
diff --git a/lib/mods/theme/scpt/s_nature.lua b/lib/mods/theme/scpt/s_nature.lua
deleted file mode 100644
index 3d44c569..00000000
--- a/lib/mods/theme/scpt/s_nature.lua
+++ /dev/null
@@ -1,184 +0,0 @@
--- handle the nature school
-
-GROWTREE = add_spell
-{
- ["name"] = "Grow Trees",
- ["school"] = {SCHOOL_NATURE, SCHOOL_TEMPORAL},
- ["level"] = 6,
- ["mana"] = 6,
- ["mana_max"] = 30,
- ["fail"] = 35,
- ["inertia"] = { 5, 50 },
- ["spell"] = function()
- grow_trees(2 + get_level(GROWTREE, 7))
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(2 + get_level(GROWTREE, 7))
- end,
- ["desc"] = {
- "Makes trees grow extremely quickly around you",
- }
-}
-
-HEALING = add_spell
-{
- ["name"] = "Healing",
- ["school"] = {SCHOOL_NATURE},
- ["level"] = 10,
- ["mana"] = 15,
- ["mana_max"] = 50,
- ["fail"] = 45,
- ["stick"] =
- {
- ["charge"] = { 2, 3 },
- [TV_STAFF] =
- {
- ["rarity"] = 90,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 20, 40 },
- },
- },
- ["spell"] = function()
- return hp_player(player.mhp * (15 + get_level(HEALING, 35)) / 100)
- end,
- ["info"] = function()
- return "heal "..(15 + get_level(HEALING, 35)).."% = "..(player.mhp * (15 + get_level(HEALING, 35)) / 100).."hp"
- end,
- ["desc"] = {
- "Heals a percent of hitpoints",
- }
-}
-
-RECOVERY = add_spell
-{
- ["name"] = "Recovery",
- ["school"] = {SCHOOL_NATURE},
- ["level"] = 15,
- ["mana"] = 10,
- ["mana_max"] = 25,
- ["fail"] = 60,
- ["stick"] =
- {
- ["charge"] = { 5, 10 },
- [TV_STAFF] =
- {
- ["rarity"] = 50,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 10, 30 },
- },
- },
- ["inertia"] = { 2, 100 },
- ["spell"] = function()
- local obvious
- obvious = set_poisoned(player.poisoned / 2)
- if get_level(RECOVERY, 50) >= 5 then
- obvious = is_obvious(set_poisoned(0), obvious)
- obvious = is_obvious(set_cut(0), obvious)
- end
- if get_level(RECOVERY, 50) >= 10 then
- obvious = is_obvious(do_res_stat(A_STR, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_CON, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_DEX, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_WIS, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_INT, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_CHR, TRUE), obvious)
- end
- if get_level(RECOVERY, 50) >= 15 then
- obvious = is_obvious(restore_level(), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Reduces the length of time that you are poisoned",
- "At level 5 it cures poison and cuts",
- "At level 10 it restores drained stats",
- "At level 15 it restores lost experience"
- }
-}
-
-REGENERATION = add_spell
-{
- ["name"] = "Regeneration",
- ["school"] = {SCHOOL_NATURE},
- ["level"] = 20,
- ["mana"] = 30,
- ["mana_max"] = 55,
- ["fail"] = 70,
- ["inertia"] = { 4, 40 },
- ["spell"] = function()
- if player.tim_regen == 0 then return set_tim_regen(randint(10) + 5 + get_level(REGENERATION, 50), 300 + get_level(REGENERATION, 700)) end
- end,
- ["info"] = function()
- return "dur "..(5 + get_level(REGENERATION, 50)).."+d10 power "..(300 + get_level(REGENERATION, 700))
- end,
- ["desc"] = {
- "Increases your body's regeneration rate",
- }
-}
-
-
-SUMMONANNIMAL = add_spell
-{
- ["name"] = "Summon Animal",
- ["school"] = {SCHOOL_NATURE},
- ["level"] = 25,
- ["mana"] = 25,
- ["mana_max"] = 50,
- ["fail"] = 90,
- ["stick"] =
- {
- ["charge"] = { 1, 3 },
- [TV_WAND] =
- {
- ["rarity"] = 85,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 15, 45 },
- },
- },
- ["spell"] = function()
- summon_specific_level = 25 + get_level(SUMMONANNIMAL, 50)
- return summon_monster(player.py, player.px, dun_level, TRUE, SUMMON_ANIMAL)
- end,
- ["info"] = function()
- return "level "..(25 + get_level(SUMMONANNIMAL, 50))
- end,
- ["desc"] = {
- "Summons a leveled animal to your aid",
- }
-}
-
--- From T-Plus
-GROW_ATHELAS = add_spell {
- ["name"] = "Grow Athelas",
- ["school"] = {SCHOOL_NATURE},
- ["level"] = 30,
- ["mana"] = 60,
- ["mana_max"] = 100,
- ["fail"] = 95,
- ["stick"] =
- {
- ["charge"] = { 1, 3 },
- [TV_WAND] =
- {
- ["rarity"] = 85,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 15, 45 },
- },
- },
- ["spell"] = function()
- if (player.black_breath == TRUE) then
- msg_print("The hold of the Black Breath on you is broken!")
- player.black_breath = FALSE
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Cures the Black Breath",
- }
-}
diff --git a/lib/mods/theme/scpt/s_stick.lua b/lib/mods/theme/scpt/s_stick.lua
deleted file mode 100644
index 9bbd641a..00000000
--- a/lib/mods/theme/scpt/s_stick.lua
+++ /dev/null
@@ -1,494 +0,0 @@
--- Spells that are stick or artifacts/... only
-
-DEVICE_HEAL_MONSTER = add_spell
-{
- ["name"] = "Heal Monster",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 3,
- ["mana"] = 5,
- ["mana_max"] = 20,
- ["fail"] = 15,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 10, 10 },
- [TV_WAND] =
- {
- ["rarity"] = 17,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_ball(GF_OLD_HEAL, dir, 20 + get_level(DEVICE_HEAL_MONSTER, 380), 0)
- end,
- ["info"] = function()
- return "heal "..(20 + get_level(DEVICE_HEAL_MONSTER, 380))
- end,
- ["desc"] = {
- "Heals a monster",
- }
-}
-
-DEVICE_SPEED_MONSTER = add_spell
-{
- ["name"] = "Haste Monster",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 10,
- ["mana"] = 10,
- ["mana_max"] = 10,
- ["fail"] = 30,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 10, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 7,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_ball(GF_OLD_SPEED, dir, 1, 0)
- end,
- ["info"] = function()
- return "speed +10"
- end,
- ["desc"] = {
- "Haste a monster",
- }
-}
-
-DEVICE_WISH = add_spell
-{
- ["name"] = "Wish",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 50,
- ["mana"] = 400,
- ["mana_max"] = 400,
- ["fail"] = 99,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 1, 2 },
- [TV_STAFF] =
- {
- ["rarity"] = 98,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 1, 1 },
- },
- },
- ["spell"] = function()
- make_wish()
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "This grants you a wish, beware of what you ask for!",
- }
-}
-
-DEVICE_SUMMON = add_spell
-{
- ["name"] = "Summon",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 5,
- ["mana"] = 5,
- ["mana_max"] = 25,
- ["fail"] = 20,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 1, 20 },
- [TV_STAFF] =
- {
- ["rarity"] = 13,
- ["base_level"] = { 1, 40 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["spell"] = function()
- local i, obvious
- obvious = nil
- for i = 1, 4 + get_level(DEVICE_SUMMON, 30) do
- obvious = is_obvious(summon_specific(player.py, player.px, dun_level, 0), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Summons hostile monsters near you",
- }
-}
-
-DEVICE_MANA = add_spell
-{
- ["name"] = "Mana",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 30,
- ["mana"] = 1,
- ["mana_max"] = 1,
- ["fail"] = 80,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 2, 3 },
- [TV_STAFF] =
- {
- ["rarity"] = 78,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 20, 35 },
- },
- },
- ["spell"] = function()
- increase_mana((player.msp * (20 + get_level(DEVICE_MANA, 50))) / 100)
- return TRUE
- end,
- ["info"] = function()
- return "restore "..(20 + get_level(DEVICE_MANA, 50)).."%"
- end,
- ["desc"] = {
- "Restores a part(or all) of your mana",
- }
-}
-
-DEVICE_NOTHING = add_spell
-{
- ["name"] = "Nothing",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 0,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 0, 0 },
- [TV_WAND] =
- {
- ["rarity"] = 3,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 1, 1 },
- },
- [TV_STAFF] =
- {
- ["rarity"] = 3,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 1, 1},
- },
- },
- ["spell"] = function()
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "It does nothing.",
- }
-}
-
-DEVICE_MAGGOT = add_spell
-{
- ["name"] = "Artifact Maggot",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 7,
- ["mana_max"] = 7,
- ["fail"] = 20,
- ["random"] = -1,
- ["activate"] = { 10, 50 },
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_TURN_ALL, dir, 40, 2)
- end,
- ["info"] = function()
- return "power 40 rad 2"
- end,
- ["desc"] = {
- "terrify",
- }
-}
-
-DEVICE_HOLY_FIRE = add_spell
-{
- ["name"] = "Holy Fire of Mithrandir",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 30,
- ["mana"] = 50,
- ["mana_max"] = 150,
- ["fail"] = 75,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 2, 5 },
- [TV_STAFF] =
- {
- -- Rarity higher than 100 to be sure to not have it generated randomly
- ["rarity"] = 999,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 35, 35 },
- },
- },
- ["spell"] = function()
- return project_los(GF_HOLY_FIRE, 50 + get_level(DEVICE_HOLY_FIRE, 300))
- end,
- ["info"] = function()
- return "dam "..(50 + get_level(DEVICE_HOLY_FIRE, 250))
- end,
- ["desc"] = {
- "The Holy Fire created by this staff will deeply(double damage) burn",
- "all that is evil.",
- }
-}
-
--- Ok the Eternal Flame, to craete one of the 4 ultimate arts
--- needed to enter the last level of the Void
-DEVICE_ETERNAL_FLAME = add_spell
-{
- ["name"] = "Artifact Eternal Flame",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 0,
- ["random"] = -1,
- ["activate"] = { 0, 0 },
- ["spell"] = function(flame_item)
- local ret, item, obj
-
- ret, item = get_item("Which object do you want to imbue?",
- "You have no objects to imbue.",
- bor(USE_INVEN),
- function (obj)
- if obj.name1 > 0 or obj.name2 > 0 then return FALSE end
- if (obj.tval == TV_SWORD) and (obj.sval == SV_LONG_SWORD) then
- return TRUE
- elseif (obj.tval == TV_MSTAFF) and (obj.sval == SV_MSTAFF) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_HEAVY_XBOW) then
- return TRUE
- elseif (obj.tval == TV_DRAG_ARMOR) and (obj.sval == SV_DRAGON_POWER) then
- return TRUE
- elseif (obj.tval == TV_HAFTED) and (obj.sval == SV_LUCERN_HAMMER) then
- return TRUE
- elseif (obj.tval == TV_POLEARM) and (obj.sval == SV_TRIDENT) then
- return TRUE
- elseif (obj.tval == TV_AXE) and (obj.sval == SV_BATTLE_AXE) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_LONG_BOW) then
- return TRUE
- elseif (obj.tval == TV_BOOMERANG) and (obj.sval == SV_BOOM_METAL) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_SLING) then
- return TRUE
- elseif (obj.tval == TV_SWORD) and (obj.sval == SV_RAPIER) then
- return TRUE
- elseif (obj.tval == TV_AMULET) and (obj.sval == SV_AMULET_SPELL) then
- return TRUE
- end
- return FALSE
- end
- )
- if ret == FALSE then return FALSE end
-
- obj = get_object(item)
-
- if (obj.tval == TV_SWORD) and (obj.sval == SV_LONG_SWORD) then
- obj.name1 = 147
- elseif (obj.tval == TV_MSTAFF) and (obj.sval == SV_MSTAFF) then
- obj.name1 = 127
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_HEAVY_XBOW) then
- obj.name1 = 152
- elseif (obj.tval == TV_DRAG_ARMOR) and (obj.sval == SV_DRAGON_POWER) then
- obj.name1 = 17
- elseif (obj.tval == TV_HAFTED) and (obj.sval == SV_LUCERN_HAMMER) then
- obj.name1 = 241
- elseif (obj.tval == TV_POLEARM) and (obj.sval == SV_TRIDENT) then
- obj.name1 = 242
- elseif (obj.tval == TV_AXE) and (obj.sval == SV_BROAD_AXE) then
- obj.name1 = 243
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_LONG_BOW) then
- obj.name1 = 245
- elseif (obj.tval == TV_BOOMERANG) and (obj.sval == SV_BOOM_METAL) then
- obj.name1 = 247
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_SLING) then
- obj.name1 = 246
- elseif (obj.tval == TV_SWORD) and (obj.sval == SV_RAPIER) then
- obj.name1 = 244
- elseif (obj.tval == TV_AMULET) and (obj.sval == SV_AMULET_SPELL) then
- obj.name1 = 248
- end
- apply_magic(obj, -1, TRUE, TRUE, TRUE)
-
- obj.found = OBJ_FOUND_SELFMADE
-
- inven_item_increase(flame_item, -1)
- inven_item_describe(flame_item)
- inven_item_optimize(flame_item)
-
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Imbuing an object with the eternal fire",
- }
-}
-
-DEVICE_THUNDERLORDS = add_spell
-{
- ["name"] = "Artifact Thunderlords",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 1,
- ["fail"] = 20,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 5, 5 },
- [TV_STAFF] =
- {
- -- Rarity higher than 100 to be sure to not have it generated randomly
- ["rarity"] = 999,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 1, 1 },
- },
- },
- ["spell"] = function()
- if dun_level > 0 then
- msg_print("As you blow the horn, an Eagle of Manwe appears overhead.")
- recall_player(0, 1)
- else
- msg_print("You cannot use it there.")
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "An Eagle of Manwe will appear to transport you quickly to the town.",
- }
-}
-
--- Two new spells from T-Plus by Ingeborg S. Norden, for artifact activations:
-
-DEVICE_RADAGAST = add_spell
-{
- ["name"] = "Artifact Radagast",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 10,
- ["random"] = -1,
- ["activate"] = 15000,
- ["spell"] = function()
- msg_print(TERM_GREEN, "The staff's power cleanses you completely!")
- remove_all_curse()
- do_res_stat(A_STR, TRUE)
- do_res_stat(A_CON, TRUE)
- do_res_stat(A_DEX, TRUE)
- do_res_stat(A_WIS, TRUE)
- do_res_stat(A_INT, TRUE)
- do_res_stat(A_CHR, TRUE)
- restore_level()
- clean_corruptions()
- hp_player(5000)
- heal_insanity(5000)
- set_poisoned(0)
- set_blind(0)
- set_confused(0)
- set_image(0)
- set_stun(0)
- set_cut(0)
- set_parasite(0, 0)
-
- if (player.black_breath) == TRUE then
- msg_print("The hold of the Black Breath on you is broken!")
- end
- player.black_breath = FALSE
-
- player.update = bor(player.update, PU_BONUS)
- player.window = bor(player.window, PW_PLAYER)
-
- return TRUE
- end,
-
- ["info"] = function()
- return ""
- end,
-
- ["desc"] = {
- "purity and health",
- }
-}
-
-DEVICE_VALAROMA = add_spell
-{
- ["name"] = "Artifact Valaroma",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 25,
- ["random"] = -1,
- ["activate"] = 250,
- ["spell"] = function()
- local power = 5 * player.lev
- banish_evil(power)
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "banish evil (level x5)",
- }
-}
---[[ Template
-DEVICE_ = add_spell
-{
- ["name"] = "",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 2,
- ["mana_max"] = 15,
- ["fail"] = 10,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 10, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 7,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["spell"] = function()
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "",
- }
-}
-]]
diff --git a/lib/mods/theme/scpt/s_tempo.lua b/lib/mods/theme/scpt/s_tempo.lua
deleted file mode 100644
index d3d2fbb5..00000000
--- a/lib/mods/theme/scpt/s_tempo.lua
+++ /dev/null
@@ -1,162 +0,0 @@
--- Handles thhe temporal school
-
-
-MAGELOCK = add_spell
-{
- ["name"] = "Magelock",
- ["school"] = {SCHOOL_TEMPORAL},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 35,
- ["fail"] = 10,
- ["stick"] =
- {
- ["charge"] = { 7, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 30,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 15, 45 },
- },
- },
- ["spell"] = function()
- if get_level(MAGELOCK, 50) >= 30 then
- local ret, x, y, c_ptr
-
- if get_level(MAGELOCK, 50) >= 40 then
- ret, x, y = tgt_pt()
- if ret == FALSE then return end
- if cave_is(cave(y, x), FF1_FLOOR) == FALSE or cave_is(cave(y, x), FF1_PERMANENT) == TRUE or los(player.py, player.px, y, x) == FALSE then
- msg_print("You cannot place it there.")
- return TRUE
- end
- else
- y = player.py
- x = player.px
- end
- cave_set_feat(y, x, 3)
- return TRUE
- else
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return wizard_lock(dir)
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Magically locks a door",
- "At level 30 it creates a glyph of warding",
- "At level 40 the glyph can be placed anywhere in the field of vision"
- }
-}
-
-SLOWMONSTER = add_spell
-{
- ["name"] = "Slow Monster",
- ["school"] = {SCHOOL_TEMPORAL},
- ["level"] = 10,
- ["mana"] = 10,
- ["mana_max"] = 15,
- ["fail"] = 35,
- ["stick"] =
- {
- ["charge"] = { 5, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 23,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["spell"] = function()
- local ret, dir
-
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- if get_level(SLOWMONSTER, 50) >= 20 then
- return fire_ball(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160), 1)
- else
- return fire_bolt(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160))
- end
- end,
- ["info"] = function()
- if get_level(SLOWMONSTER, 50) >= 20 then
- return "power "..(40 + get_level(SLOWMONSTER, 160)).." rad 1"
- else
- return "power "..(40 + get_level(SLOWMONSTER, 160))
- end
- end,
- ["desc"] = {
- "Magically slows down the passing of time around a monster",
- "At level 20 it affects a zone"
- }
-}
-
-ESSENCESPEED = add_spell
-{
- ["name"] = "Essence of Speed",
- ["school"] = {SCHOOL_TEMPORAL},
- ["level"] = 15,
- ["mana"] = 20,
- ["mana_max"] = 40,
- ["fail"] = 50,
- ["stick"] =
- {
- ["charge"] = { 3, 3 },
- [TV_WAND] =
- {
- ["rarity"] = 80,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 10, 39 },
- },
- },
- ["inertia"] = { 5, 20 },
- ["spell"] = function()
- if player.fast == 0 then return set_fast(10 + randint(10) + get_level(ESSENCESPEED, 50), 5 + get_level(ESSENCESPEED, 20)) end
- end,
- ["info"] = function()
- return "dur "..(10 + get_level(ESSENCESPEED, 50)).."+d10 speed "..(5 + get_level(ESSENCESPEED, 20))
- end,
- ["desc"] = {
- "Magically decreases the passing of time around you, making you move faster with",
- "respect to the rest of the universe."
- }
-}
-
-BANISHMENT = add_spell
-{
- ["name"] = "Banishment",
- ["school"] = {SCHOOL_TEMPORAL, SCHOOL_CONVEYANCE},
- ["level"] = 30,
- ["mana"] = 30,
- ["mana_max"] = 40,
- ["fail"] = 95,
- ["stick"] =
- {
- ["charge"] = { 1, 3 },
- [TV_WAND] =
- {
- ["rarity"] = 98,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 10, 36 },
- },
- },
- ["inertia"] = { 5, 50 },
- ["spell"] = function()
- local obvious
- obvious = project_los(GF_AWAY_ALL, 40 + get_level(BANISHMENT, 160))
- if get_level(BANISHMENT, 50) >= 15 then
- obvious = is_obvious(project_los(GF_STASIS, 20 + get_level(BANISHMENT, 120)), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return "power "..(40 + get_level(BANISHMENT, 160))
- end,
- ["desc"] = {
- "Disrupts the space/time continuum in your area and teleports all monsters away.",
- "At level 15 it may also lock them in a time bubble for a while."
- }
-}
diff --git a/lib/mods/theme/scpt/s_tulkas.lua b/lib/mods/theme/scpt/s_tulkas.lua
deleted file mode 100644
index 4afa8082..00000000
--- a/lib/mods/theme/scpt/s_tulkas.lua
+++ /dev/null
@@ -1,81 +0,0 @@
--- Handle Tulkas magic school
-
-TULKAS_AIM = add_spell
-{
- ["name"] = "Divine Aim",
- ["school"] = {SCHOOL_TULKAS},
- ["level"] = 1,
- ["mana"] = 30,
- ["mana_max"] = 500,
- ["fail"] = 20,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local dur = get_level(TULKAS_AIM, 50) + randint(10)
- local obvious
-
- obvious = set_strike(dur)
- if get_level(TULKAS_AIM) >= 20 then
- obvious = is_obvious(set_tim_deadly(dur), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return "dur "..(get_level(TULKAS_AIM, 50)).."+d10"
- end,
- ["desc"] = {
- "It makes you more accurate in combat",
- "At level 20 all your blows are critical hits",
- }
-}
-
-TULKAS_WAVE = add_spell
-{
- ["name"] = "Wave of Power",
- ["school"] = {SCHOOL_TULKAS},
- ["level"] = 20,
- ["mana"] = 200,
- ["mana_max"] = 200,
- ["fail"] = 75,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_bolt(GF_ATTACK, dir, get_level(TULKAS_WAVE, player.num_blow))
- end,
- ["info"] = function()
- return "blows "..(get_level(TULKAS_WAVE, player.num_blow))
- end,
- ["desc"] = {
- "It allows you to project a number of melee blows across a distance",
- }
-}
-
-TULKAS_SPIN = add_spell
-{
- ["name"] = "Whirlwind",
- ["school"] = {SCHOOL_TULKAS},
- ["level"] = 10,
- ["mana"] = 100,
- ["mana_max"] = 100,
- ["fail"] = 45,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return fire_ball(GF_ATTACK, 0, 1, 1)
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "It allows you to spin around and hit all monsters nearby",
- }
-}
diff --git a/lib/mods/theme/scpt/s_udun.lua b/lib/mods/theme/scpt/s_udun.lua
deleted file mode 100644
index c4266239..00000000
--- a/lib/mods/theme/scpt/s_udun.lua
+++ /dev/null
@@ -1,180 +0,0 @@
--- handle the udun school
-
-DRAIN = add_spell
-{
- ["name"] = "Drain",
- ["school"] = {SCHOOL_UDUN, SCHOOL_MANA},
- ["level"] = 1,
- ["mana"] = 0,
- ["mana_max"] = 0,
- ["fail"] = 20,
- ["spell"] = function()
- local ret, item, obj, o_name, add
-
- -- Ask for an item
- ret, item = get_item("What item to drain?", "You have nothing you can drain", USE_INVEN,
- function (obj)
- if (obj.tval == TV_WAND) or (obj.tval == TV_ROD_MAIN) or (obj.tval == TV_STAFF) then
- return TRUE
- end
- return FALSE
- end
- )
-
- if ret == TRUE then
- -- get the item
- obj = get_object(item)
-
- add = 0
- if (obj.tval == TV_STAFF) or (obj.tval == TV_WAND) then
- local kind = get_kind(obj)
-
- add = kind.level * obj.pval * obj.number
-
- -- Destroy it!
- inven_item_increase(item, -99)
- inven_item_describe(item)
- inven_item_optimize(item)
- end
- if obj.tval == TV_ROD_MAIN then
- add = obj.timeout
- obj.timeout = 0;
-
- --Combine / Reorder the pack (later)
- player.notice = bor(player.notice, PN_COMBINE, PN_REORDER)
- player.window = bor(player.window, PW_INVEN, PW_EQUIP, PW_PLAYER)
- end
- increase_mana(add)
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Drains the mana contained in wands, staves and rods to increase yours",
- }
-}
-
-GENOCIDE = add_spell
-{
- ["name"] = "Genocide",
- ["school"] = {SCHOOL_UDUN, SCHOOL_NATURE},
- ["level"] = 25,
- ["mana"] = 50,
- ["mana_max"] = 50,
- ["fail"] = 90,
- ["stick"] =
- {
- ["charge"] = { 2, 2 },
- [TV_STAFF] =
- {
- ["rarity"] = 85,
- ["base_level"] = { 1, 1 },
- ["max_level"] = { 5, 15 },
- },
- },
- ["spell"] = function()
- local type
-
- type = 0
- if get_level(GENOCIDE) >= 10 then type = 1 end
- if type == 0 then
- genocide(TRUE)
- return TRUE
- else
- if get_check("Genocide all monsters near you? ") == TRUE then
- mass_genocide(TRUE)
- else
- genocide(TRUE)
- end
- return TRUE
- end
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Genocides all monsters of a race on the level",
- "At level 10 it can genocide all monsters near you"
- }
-}
-
-WRAITHFORM = add_spell
-{
- ["name"] = "Wraithform",
- ["school"] = {SCHOOL_UDUN, SCHOOL_CONVEYANCE},
- ["level"] = 30,
- ["mana"] = 20,
- ["mana_max"] = 40,
- ["fail"] = 95,
- ["inertia"] = { 4, 30 },
- ["spell"] = function()
- return set_shadow(randint(30) + 20 + get_level(WRAITHFORM, 40))
- end,
- ["info"] = function()
- return "dur "..(20 + get_level(WRAITHFORM, 40)).."+d30"
- end,
- ["desc"] = {
- "Turns you into an immaterial being",
- }
-}
-
-FLAMEOFUDUN = add_spell
-{
- ["name"] = "Flame of Udun",
- ["school"] = {SCHOOL_UDUN, SCHOOL_FIRE},
- ["level"] = 35,
- ["mana"] = 70,
- ["mana_max"] = 100,
- ["fail"] = 95,
- ["inertia"] = { 7, 15 },
- ["spell"] = function()
- return set_mimic(randint(15) + 5 + get_level(FLAMEOFUDUN, 30), resolve_mimic_name("Balrog"), get_level(FLAMEOFUDUN))
- end,
- ["info"] = function()
- return "dur "..(5 + get_level(FLAMEOFUDUN, 30)).."+d15"
- end,
- ["desc"] = {
- "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/mods/theme/scpt/s_ulmo.lua b/lib/mods/theme/scpt/s_ulmo.lua
deleted file mode 100644
index a2c24b29..00000000
--- a/lib/mods/theme/scpt/s_ulmo.lua
+++ /dev/null
@@ -1,147 +0,0 @@
--- Spells for Ulmo's school
-
-BOOK_ULMO = 65
-
--- "Song of Belegaer" copied from Geyser
-ULMO_BELEGAER = add_spell
-{
- ["name"] = "Song of Belegaer",
- ["school"] = SCHOOL_ULMO,
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 100,
- ["fail"] = 25,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt_or_beam(2 * get_level(ULMO_BELEGAER, 85), GF_WATER, dir, damroll(get_geyser_damage()))
- end,
- ["info"] = function()
- local n, d
- n, d = get_geyser_damage()
- return "dam "..n.."d"..d
- end,
- ["desc"] =
- {
- "Channels the power of the Great Sea into your fingertips.",
- "Sometimes it can blast through its first target."
- },
-}
-
--- "Draught of Ulmonan" copied with tweaks from T-Plus Nature spell "Restore Body"
-ULMO_DRAUGHT_ULMONAN = add_spell
-{
- ["name"] = "Draught of Ulmonan",
- ["school"] = {SCHOOL_ULMO},
- ["level"] = 15,
- ["mana"] = 25,
- ["mana_max"] = 200,
- ["fail"] = 50,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local level = get_level(ULMO_DRAUGHT_ULMONAN, 50)
- local obvious = hp_player(5 * level)
- obvious = is_obvious(set_poisoned(0), obvious)
- obvious = is_obvious(set_cut(0), obvious)
- obvious = is_obvious(set_stun(0), obvious)
- obvious = is_obvious(set_blind(0), obvious)
- if level >= 10 then
- obvious = is_obvious(do_res_stat(A_STR, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_CON, TRUE), obvious)
- obvious = is_obvious(do_res_stat(A_DEX, TRUE), obvious)
- end
- if level >= 20 then
- obvious = is_obvious(set_parasite(0, 0), obvious)
- obvious = is_obvious(set_mimic(0, 0, 0), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- local level = get_level(ULMO_DRAUGHT_ULMONAN, 50)
- return "cure "..(5 * level)
- end,
- ["desc"] = {
- "Fills you with a draught with powerful curing effects,",
- "prepared by Ulmo himself.",
- "Level 1: blindness, poison, cuts and stunning",
- "Level 10: drained STR, DEX and CON",
- "Level 20: parasites and mimicry",
- },
-}
-
--- "Call of the Ulumuri" based on Call Blessed Soul from T-Plus
-ULMO_CALL_ULUMURI = add_spell
-
-{
- ["name"] = "Call of the Ulumuri",
- ["school"] = {SCHOOL_ULMO},
- ["level"] = 20,
- ["mana"] = 50,
- ["mana_max"] = 300,
- ["fail"] = 75,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local y, x, m_idx
- local summons =
- {
- test_monster_name("Water spirit"),
- test_monster_name("Water elemental"),
- }
- y, x = find_position(player.py, player.px)
- m_idx = place_monster_one(y, x, summons[rand_range(1, 2)], 0, FALSE, MSTATUS_FRIEND)
- if m_idx ~= 0 then
- monster_set_level(m_idx, 30 + get_level(ULMO_CALL_ULUMURI, 70, 0))
- return TRUE
- end
- end,
-
- ["info"] = function()
- return "level "..(get_level(ULMO_CALL_ULUMURI, 70))
- end,
- ["desc"] = {
- "Summons a leveled water spirit or elemental",
- "to fight for you",
-
- },
-}
-
--- "Wrath of Ulmo" based on Firewall
-ULMO_WRATH = add_spell
-{
- ["name"] = "Wrath of Ulmo",
- ["school"] = {SCHOOL_ULMO},
- ["level"] = 30,
- ["mana"] = 100,
- ["mana_max"] = 400,
- ["fail"] = 95,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir, type
- if (get_level(ULMO_WRATH, 50) >= 30) then
- type = GF_WAVE
- else
- type = GF_WATER
- end
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- fire_wall(type, dir, 40 + get_level(ULMO_WRATH, 150), 10 + get_level(ULMO_WRATH, 14))
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(40 + get_level(ULMO_WRATH, 150)).." dur "..(10 + get_level(ULMO_WRATH, 14))
- end,
- ["desc"] = {
- "Conjures up a sea storm.",
- "At level 30 it turns into a more forceful storm."
- }
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/s_varda.lua b/lib/mods/theme/scpt/s_varda.lua
deleted file mode 100644
index f4f46a83..00000000
--- a/lib/mods/theme/scpt/s_varda.lua
+++ /dev/null
@@ -1,140 +0,0 @@
--- Spells for Varda school (From Annals of Ea module)
-
-BOOK_VARDA = 64
-
--- Holy light spell copied from Globe of Light
-VARDA_LIGHT_VALINOR = add_spell
-{
- ["name"] = "Light of Valinor",
- ["school"] = {SCHOOL_VARDA},
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 100,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local obvious
- if get_level(VARDA_LIGHT_VALINOR, 50) >= 3 then
- obvious = lite_area(10, 4)
- else
- lite_room(player.py, player.px)
- obvious = TRUE
- end
- if get_level(VARDA_LIGHT_VALINOR, 50) >= 15 then
- obvious = is_obvious(fire_ball(GF_LITE, 0, 10 + get_level(VARDA_LIGHT_VALINOR, 100), 5 + get_level(GLOBELIGHT, 6)), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- if get_level(VARDA_LIGHT_VALINOR, 50) >= 15 then
- return "dam "..(10 + get_level(VARDA_LIGHT_VALINOR, 100)).." rad "..(5 + get_level(VARDA_LIGHT_VALINOR, 6))
- else
- return ""
- end
- end,
- ["desc"] = {
- "Lights a room",
- "At level 3 it starts damaging monsters",
- "At level 15 it starts creating a more powerful kind of light",
- }
-}
-
-VARDA_CALL_ALMAREN = add_spell
-{
- ["name"] = "Call of Almaren",
- ["school"] = {SCHOOL_VARDA},
- ["level"] = 10,
- ["mana"] = 5,
- ["mana_max"] = 150,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local power = 5 * player.lev
- if (get_level(VARDA_CALL_ALMAREN) >= 20) then
- dispel_evil(power)
- else
- banish_evil(power)
- end
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Banishes evil beings",
- "At level 20 it dispels evil beings",
- }
-}
-
-VARDA_EVENSTAR = add_spell
-{
- ["name"] = "Evenstar",
- ["school"] = {SCHOOL_VARDA},
- ["level"] = 20,
- ["mana"] = 20,
- ["mana_max"] = 200,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- if (get_level(VARDA_EVENSTAR) >= 40) then
- -- Enlightenment
- wiz_lite_extra()
- -- Identify
- identify_pack()
- -- Self knowledge
- self_knowledge()
- else
- wiz_lite_extra()
- end
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "Maps and lights the whole level.",
- "At level 40 it maps and lights the whole level,",
- "in addition to letting you know yourself better",
- "and identifying your whole pack.",
- }
-}
-
-VARDA_STARKINDLER = add_spell
-{
- ["name"] = "Star Kindler",
- ["school"] = {SCHOOL_VARDA},
- ["level"] = 30,
- ["mana"] = 50,
- ["mana_max"] = 250,
- ["fail"] = 20,
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local power = player.lev / 5
- local ret, dir
-
- ret, dir = get_aim_dir()
-
- if ret == FALSE then return end
- for i = 1, power do
- fire_ball(GF_LITE, dir, 20 + get_level(VARDA_STARKINDLER, 100), 10)
- end
-
- return FALSE
- end,
- ["info"] = function()
- local power = player.lev / 5
- return "dam "..(20 + get_level(VARDA_STARKINDLER, 100)).." rad 10"
- end,
- ["desc"] = {
- "Does multiple bursts of light damage.",
- "The damage increases with level.",
- }
-} \ No newline at end of file
diff --git a/lib/mods/theme/scpt/s_water.lua b/lib/mods/theme/scpt/s_water.lua
deleted file mode 100644
index 739b066b..00000000
--- a/lib/mods/theme/scpt/s_water.lua
+++ /dev/null
@@ -1,154 +0,0 @@
--- handle the water school
-
-TIDALWAVE = add_spell
-{
- ["name"] = "Tidal Wave",
- ["school"] = {SCHOOL_WATER},
- ["level"] = 16,
- ["mana"] = 16,
- ["mana_max"] = 40,
- ["fail"] = 65,
- ["stick"] =
- {
- ["charge"] = { 6, 5 },
- [TV_WAND] =
- {
- ["rarity"] = 54,
- ["base_level"] = { 1, 10 },
- ["max_level"] = { 20, 50 },
- },
- },
- ["inertia"] = { 4, 100 },
- ["spell"] = function()
- fire_wave(GF_WAVE, 0, 40 + get_level(TIDALWAVE, 200), 0, 6 + get_level(TIDALWAVE, 10), EFF_WAVE)
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(40 + get_level(TIDALWAVE, 200)).." rad "..(6 + get_level(TIDALWAVE, 10))
- end,
- ["desc"] = {
- "Summons a monstrous tidal wave that will expand and crush the",
- "monsters under its mighty waves."
- }
-}
-
-ICESTORM = add_spell
-{
- ["name"] = "Ice Storm",
- ["school"] = {SCHOOL_WATER},
- ["level"] = 22,
- ["mana"] = 30,
- ["mana_max"] = 60,
- ["fail"] = 80,
- ["stick"] =
- {
- ["charge"] = { 3, 7 },
- [TV_WAND] =
- {
- ["rarity"] = 65,
- ["base_level"] = { 1, 5 },
- ["max_level"] = { 25, 45 },
- },
- },
- ["inertia"] = { 3, 40 },
- ["spell"] = function()
- local type
-
- if get_level(ICESTORM, 50) >= 10 then type = GF_ICE
- else type = GF_COLD end
- fire_wave(type, 0, 80 + get_level(ICESTORM, 200), 1 + get_level(ICESTORM, 3, 0), 20 + get_level(ICESTORM, 70), EFF_STORM)
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(80 + get_level(ICESTORM, 200)).." rad "..(1 + get_level(ICESTORM, 3, 0)).." dur "..(20 + get_level(ICESTORM, 70))
- end,
- ["desc"] = {
- "Engulfs you in a storm of roaring cold that strikes your foes.",
- "At level 10 it turns into shards of ice."
- }
-}
-
-ENTPOTION = add_spell
-{
- ["name"] = "Ent's Potion",
- ["school"] = {SCHOOL_WATER},
- ["level"] = 6,
- ["mana"] = 7,
- ["mana_max"] = 15,
- ["fail"] = 35,
- ["inertia"] = { 1, 30 },
- ["spell"] = function()
- set_food(PY_FOOD_MAX - 1)
- msg_print("The Ent's Potion fills your stomach.")
- if get_level(ENTPOTION, 50) >= 5 then
- set_afraid(0)
- end
- if get_level(ENTPOTION, 50) >= 12 then
- set_hero(player.hero + randint(25) + 25 + get_level(ENTPOTION, 40))
- end
- return TRUE
- end,
- ["info"] = function()
- if get_level(ENTPOTION, 50) >= 12 then
- return "dur "..(25 + get_level(ENTPOTION, 40)).."+d25"
- else
- return ""
- end
- end,
- ["desc"] = {
- "Fills up your stomach.",
- "At level 5 it boldens your heart.",
- "At level 12 it makes you heroic."
- }
-}
-
-VAPOR = add_spell
-{
- ["name"] = "Vapor",
- ["school"] = {SCHOOL_WATER},
- ["level"] = 2,
- ["mana"] = 2,
- ["mana_max"] = 12,
- ["fail"] = 20,
- ["inertia"] = { 1, 30 },
- ["spell"] = function()
- fire_cloud(GF_WATER, 0, 3 + get_level(VAPOR, 20), 3 + get_level(VAPOR, 9, 0), 5)
- return TRUE
- end,
- ["info"] = function()
- return "dam "..(3 + get_level(VAPOR, 20)).." rad "..(3 + get_level(VAPOR, 9, 0)).." dur 5"
- end,
- ["desc"] = {
- "Fills the air with toxic moisture to eradicate annoying critters."
- }
-}
-
-function get_geyser_damage()
- return get_level(GEYSER, 10), 3 + get_level(GEYSER, 35)
-end
-
-GEYSER = add_spell
-{
- ["name"] = "Geyser",
- ["school"] = SCHOOL_WATER,
- ["level"] = 1,
- ["mana"] = 1,
- ["mana_max"] = 35,
- ["fail"] = 5,
- ["spell"] = function()
- local ret, dir
- ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_bolt_or_beam(2 * get_level(GEYSER, 85), GF_WATER, dir, damroll(get_geyser_damage()))
- end,
- ["info"] = function()
- local n, d
- n, d = get_geyser_damage()
- return "dam "..n.."d"..d
- end,
- ["desc"] =
- {
- "Shoots a geyser of water from your fingertips.",
- "Sometimes it can blast through its first target."
- },
-}
diff --git a/lib/mods/theme/scpt/s_yavann.lua b/lib/mods/theme/scpt/s_yavann.lua
deleted file mode 100644
index 2f594e85..00000000
--- a/lib/mods/theme/scpt/s_yavann.lua
+++ /dev/null
@@ -1,157 +0,0 @@
--- Handle Yavanna kementari magic school
-
-YAVANNA_CHARM_ANIMAL = add_spell
-{
- ["name"] = "Charm Animal",
- ["school"] = {SCHOOL_YAVANNA},
- ["level"] = 1,
- ["mana"] = 10,
- ["mana_max"] = 100,
- ["fail"] = 30,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_ball(GF_CONTROL_ANIMAL, dir, 10 + get_level(YAVANNA_CHARM_ANIMAL, 170), get_level(YAVANNA_CHARM_ANIMAL, 2))
- end,
- ["info"] = function()
- return "power "..(10 + get_level(YAVANNA_CHARM_ANIMAL, 170)).." rad "..(get_level(YAVANNA_CHARM_ANIMAL, 2))
- end,
- ["desc"] = {
- "It tries to tame an animal",
- }
-}
-
-YAVANNA_GROW_GRASS = add_spell
-{
- ["name"] = "Grow Grass",
- ["school"] = {SCHOOL_YAVANNA},
- ["level"] = 10,
- ["mana"] = 70,
- ["mana_max"] = 150,
- ["fail"] = 65,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- grow_grass(get_level(YAVANNA_GROW_GRASS, 4))
- return TRUE
- end,
- ["info"] = function()
- return "rad "..(get_level(YAVANNA_GROW_GRASS, 4))
- end,
- ["desc"] = {
- "Create a floor of grass around you. While on grass and praying",
- "a worshipper of Yavanna will know a greater regeneration rate"
- }
-}
-
-YAVANNA_TREE_ROOTS = add_spell
-{
- ["name"] = "Tree Roots",
- ["school"] = {SCHOOL_YAVANNA},
- ["level"] = 15,
- ["mana"] = 50,
- ["mana_max"] = 1000,
- ["fail"] = 70,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- return set_roots(10 + get_level(YAVANNA_TREE_ROOTS, 30), 10 + get_level(YAVANNA_TREE_ROOTS, 60), 10 + get_level(YAVANNA_TREE_ROOTS, 20))
- end,
- ["info"] = function()
- return "dur "..(10 + get_level(YAVANNA_TREE_ROOTS, 30)).." AC "..(10 + get_level(YAVANNA_TREE_ROOTS, 60)).." dam "..(10 + get_level(YAVANNA_TREE_ROOTS, 20))
- end,
- ["desc"] = {
- "Creates roots deep in the floor from your feet, making you more stable and able",
- "to make stronger attacks, but prevents any movement (even teleportation).",
- "It also makes you recover from stunning almost immediately."
- }
-}
-
-YAVANNA_WATER_BITE = add_spell
-{
- ["name"] = "Water Bite",
- ["school"] = {SCHOOL_YAVANNA},
- ["level"] = 20,
- ["mana"] = 150,
- ["mana_max"] = 300,
- ["fail"] = 90,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local rad
-
- rad = 0
- if get_level(YAVANNA_WATER_BITE) >= 25 then rad = 1 end
-
- return set_project(randint(30) + 30 + get_level(YAVANNA_WATER_BITE, 150),
- GF_WATER,
- 10 + get_level(YAVANNA_WATER_BITE),
- rad,
- bor(PROJECT_STOP, PROJECT_KILL))
- end,
- ["info"] = function()
- return "dur "..(30 + get_level(YAVANNA_WATER_BITE, 150)).."+d30 dam "..(10 + get_level(YAVANNA_WATER_BITE)).."/blow"
- end,
- ["desc"] = {
- "Imbues your melee weapon with a natural stream of water",
- "At level 25, it spreads over a 1 radius zone around your target"
- }
-}
-
-YAVANNA_UPROOT = add_spell
-{
- ["name"] = "Uproot",
- ["school"] = {SCHOOL_YAVANNA},
- ["level"] = 35,
- ["mana"] = 250,
- ["mana_max"] = 350,
- ["fail"] = 95,
- -- Uses piety to cast
- ["piety"] = TRUE,
- ["stat"] = A_WIS,
- ["random"] = SKILL_SPIRITUALITY,
- ["spell"] = function()
- local m_idx, x, y, c_ptr, ret, dir
-
- ret, dir = get_rep_dir()
- if ret == FALSE then return end
- y, x = explode_dir(dir)
- y, x = y + player.py, x + player.px
- c_ptr = cave(y, x)
-
- if c_ptr.feat == FEAT_TREES then