summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-13 18:49:33 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-13 20:23:30 +0200
commit3eb4eab63e98e349f2b71ea74b2ded792f15e8d8 (patch)
tree54bd1b6adfbdc53afd4713dfc19a3edaebf88420
parent806d9737befef6ca878befbcddeb30634ce62083 (diff)
Lua: Move "Music" spell functions to C
-rw-r--r--lib/mods/theme/scpt/s_music.lua243
-rw-r--r--lib/scpt/s_music.lua243
-rw-r--r--src/defines.h30
-rw-r--r--src/dungeon.c4
-rw-r--r--src/externs.h61
-rw-r--r--src/spells.pkg61
-rw-r--r--src/spells3.c310
7 files changed, 502 insertions, 450 deletions
diff --git a/lib/mods/theme/scpt/s_music.lua b/lib/mods/theme/scpt/s_music.lua
index 9da6393a..45255485 100644
--- a/lib/mods/theme/scpt/s_music.lua
+++ b/lib/mods/theme/scpt/s_music.lua
@@ -13,13 +13,8 @@ MUSIC_STOP = add_spell
["random"] = SKILL_MUSIC,
["pval"] = 1,
["blind"] = FALSE,
- ["spell"] = function()
- player.start_lasting_spell(0)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return music_stop_singing_spell() end,
+ ["info"] = function() return music_stop_singing_info() end,
["desc"] = {
"Stops the current song, if any."
}
@@ -38,17 +33,9 @@ MUSIC_HOLD = add_spell
["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,
+ ["lasting"] = function() return music_holding_pattern_lasting() end,
+ ["spell"] = function() return music_holding_pattern_spell() end,
+ ["info"] = function() return music_holding_pattern_info() end,
["desc"] = {
"Slows down all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -67,17 +54,9 @@ MUSIC_CONF = add_spell
["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,
+ ["lasting"] = function() return music_illusion_pattern_lasting() end,
+ ["spell"] = function() return music_illusion_pattern_spell() end,
+ ["info"] = function() return music_illusion_pattern_info() end,
["desc"] = {
"Tries to confuse all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -96,17 +75,9 @@ MUSIC_STUN = add_spell
["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,
+ ["lasting"] = function() return music_stun_pattern_lasting() end,
+ ["spell"] = function() return music_stun_pattern_spell() end,
+ ["info"] = function() return music_stun_pattern_info() end,
["desc"] = {
"Stuns all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -126,17 +97,9 @@ MUSIC_LITE = add_spell
["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,
+ ["lasting"] = function() return music_song_of_the_sun_lasting() end,
+ ["spell"] = function() return music_song_of_the_sun_spell() end,
+ ["info"] = function() return music_song_of_the_sun_info() end,
["desc"] = {
"Provides light as long as you sing.",
"Consumes the amount of mana each turn.",
@@ -154,17 +117,9 @@ MUSIC_HEAL = add_spell
["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,
+ ["lasting"] = function() return music_flow_of_life_lasting() end,
+ ["spell"] = function() return music_flow_of_life_spell() end,
+ ["info"] = function() return music_flow_of_life_info() end,
["desc"] = {
"Heals you as long as you sing.",
"Consumes the amount of mana each turn.",
@@ -182,26 +137,9 @@ MUSIC_HERO = add_spell
["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,
+ ["lasting"] = function() return music_heroic_ballad_lasting() end,
+ ["spell"] = function() return music_heroic_ballad_spell() end,
+ ["info"] = function() return music_heroic_ballad_info() end,
["desc"] = {
"Increases melee accuracy",
"At level 10 it increases it even more and reduces armour a bit",
@@ -222,24 +160,9 @@ MUSIC_TIME = add_spell
["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,
+ ["lasting"] = function() return music_hobbit_melodies_lasting() end,
+ ["spell"] = function() return music_hobbit_melodies_spell() end,
+ ["info"] = function() return music_hobbit_melodies_info() end,
["desc"] = {
"Greatly increases your reflexes allowing you to block more melee blows.",
"At level 15 it also makes you faster.",
@@ -258,24 +181,9 @@ MUSIC_MIND = add_spell
["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,
+ ["lasting"] = function() return music_clairaudience_lasting() end,
+ ["spell"] = function() return music_clairaudience_spell() end,
+ ["info"] = function() return music_clairaudience_info() 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,",
@@ -297,17 +205,8 @@ MUSIC_BLOW = add_spell
["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,
+ ["spell"] = function() return music_blow_spell() end,
+ ["info"] = function() return music_blow_info() end,
["desc"] = {
"Produces a powerful, blowing, sound all around you.",
}
@@ -324,17 +223,8 @@ MUSIC_WIND = add_spell
["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,
+ ["spell"] = function() return music_gush_of_wind_spell() end,
+ ["info"] = function() return music_gush_of_wind_info() end,
["desc"] = {
"Produces a outgoing gush of wind that sends monsters away.",
}
@@ -351,13 +241,8 @@ MUSIC_YLMIR = add_spell
["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,
+ ["spell"] = function() return music_horns_of_ylmir_spell() end,
+ ["info"] = function() return music_horns_of_ylmir_info() end,
["desc"] = {
"Produces an earth shaking sound.",
}
@@ -374,70 +259,10 @@ MUSIC_AMBARKANTA = add_spell
["stat"] = A_CHR,
["random"] = SKILL_MUSIC,
["pval"] = 4,
- ["spell"] = function()
- alter_reality()
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return music_ambarkanta_spell() end,
+ ["info"] = function() return music_ambarkanta_info() 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/scpt/s_music.lua b/lib/scpt/s_music.lua
index 9da6393a..45255485 100644
--- a/lib/scpt/s_music.lua
+++ b/lib/scpt/s_music.lua
@@ -13,13 +13,8 @@ MUSIC_STOP = add_spell
["random"] = SKILL_MUSIC,
["pval"] = 1,
["blind"] = FALSE,
- ["spell"] = function()
- player.start_lasting_spell(0)
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return music_stop_singing_spell() end,
+ ["info"] = function() return music_stop_singing_info() end,
["desc"] = {
"Stops the current song, if any."
}
@@ -38,17 +33,9 @@ MUSIC_HOLD = add_spell
["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,
+ ["lasting"] = function() return music_holding_pattern_lasting() end,
+ ["spell"] = function() return music_holding_pattern_spell() end,
+ ["info"] = function() return music_holding_pattern_info() end,
["desc"] = {
"Slows down all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -67,17 +54,9 @@ MUSIC_CONF = add_spell
["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,
+ ["lasting"] = function() return music_illusion_pattern_lasting() end,
+ ["spell"] = function() return music_illusion_pattern_spell() end,
+ ["info"] = function() return music_illusion_pattern_info() end,
["desc"] = {
"Tries to confuse all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -96,17 +75,9 @@ MUSIC_STUN = add_spell
["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,
+ ["lasting"] = function() return music_stun_pattern_lasting() end,
+ ["spell"] = function() return music_stun_pattern_spell() end,
+ ["info"] = function() return music_stun_pattern_info() end,
["desc"] = {
"Stuns all monsters listening the song.",
"Consumes the amount of mana each turn.",
@@ -126,17 +97,9 @@ MUSIC_LITE = add_spell
["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,
+ ["lasting"] = function() return music_song_of_the_sun_lasting() end,
+ ["spell"] = function() return music_song_of_the_sun_spell() end,
+ ["info"] = function() return music_song_of_the_sun_info() end,
["desc"] = {
"Provides light as long as you sing.",
"Consumes the amount of mana each turn.",
@@ -154,17 +117,9 @@ MUSIC_HEAL = add_spell
["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,
+ ["lasting"] = function() return music_flow_of_life_lasting() end,
+ ["spell"] = function() return music_flow_of_life_spell() end,
+ ["info"] = function() return music_flow_of_life_info() end,
["desc"] = {
"Heals you as long as you sing.",
"Consumes the amount of mana each turn.",
@@ -182,26 +137,9 @@ MUSIC_HERO = add_spell
["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,
+ ["lasting"] = function() return music_heroic_ballad_lasting() end,
+ ["spell"] = function() return music_heroic_ballad_spell() end,
+ ["info"] = function() return music_heroic_ballad_info() end,
["desc"] = {
"Increases melee accuracy",
"At level 10 it increases it even more and reduces armour a bit",
@@ -222,24 +160,9 @@ MUSIC_TIME = add_spell
["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,
+ ["lasting"] = function() return music_hobbit_melodies_lasting() end,
+ ["spell"] = function() return music_hobbit_melodies_spell() end,
+ ["info"] = function() return music_hobbit_melodies_info() end,
["desc"] = {
"Greatly increases your reflexes allowing you to block more melee blows.",
"At level 15 it also makes you faster.",
@@ -258,24 +181,9 @@ MUSIC_MIND = add_spell
["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,
+ ["lasting"] = function() return music_clairaudience_lasting() end,
+ ["spell"] = function() return music_clairaudience_spell() end,
+ ["info"] = function() return music_clairaudience_info() 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,",
@@ -297,17 +205,8 @@ MUSIC_BLOW = add_spell
["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,
+ ["spell"] = function() return music_blow_spell() end,
+ ["info"] = function() return music_blow_info() end,
["desc"] = {
"Produces a powerful, blowing, sound all around you.",
}
@@ -324,17 +223,8 @@ MUSIC_WIND = add_spell
["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,
+ ["spell"] = function() return music_gush_of_wind_spell() end,
+ ["info"] = function() return music_gush_of_wind_info() end,
["desc"] = {
"Produces a outgoing gush of wind that sends monsters away.",
}
@@ -351,13 +241,8 @@ MUSIC_YLMIR = add_spell
["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,
+ ["spell"] = function() return music_horns_of_ylmir_spell() end,
+ ["info"] = function() return music_horns_of_ylmir_info() end,
["desc"] = {
"Produces an earth shaking sound.",
}
@@ -374,70 +259,10 @@ MUSIC_AMBARKANTA = add_spell
["stat"] = A_CHR,
["random"] = SKILL_MUSIC,
["pval"] = 4,
- ["spell"] = function()
- alter_reality()
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return music_ambarkanta_spell() end,
+ ["info"] = function() return music_ambarkanta_info() 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/src/defines.h b/src/defines.h
index 439048e8..57c4c674 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -4088,36 +4088,6 @@
#define ALCHEMIST_ENCHANT_AC 0x04
/*
- * Music songs
- */
-#define MUSIC_NONE 0
-#define MUSIC_SLOW 1
-#define MUSIC_CONF 2
-#define MUSIC_STUN 3
-#define MUSIC_LIFE 4
-#define MUSIC_MIND 5
-#define MUSIC_LITE 6
-#define MUSIC_FURY 7
-#define MUSIC_AWARE 8
-#define MUSIC_ID 9
-#define MUSIC_ILLUSION 10
-#define MUSIC_WALL 11
-#define MUSIC_RESIST 12
-#define MUSIC_TIME 13
-#define MUSIC_BETWEEN 14
-#define MUSIC_CHARME 15
-#define MUSIC_VIBRA 16
-#define MUSIC_HOLY 17
-#define MUSIC_HIDE 18
-#define MUSIC_LIBERTY 19
-#define MUSIC_RAISE 20
-#define MUSIC_SHADOW 21
-#define MUSIC_STAR_ID 22
-
-#define MAX_MUSIC 23
-#define MAX_MUSICS 11
-
-/*
* Fate
*/
#define MAX_FATES 200
diff --git a/src/dungeon.c b/src/dungeon.c
index fd2cc546..b23a4829 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -950,8 +950,8 @@ static void check_music()
if (p_ptr->csp < use_mana)
{
msg_print("You stop your spell.");
- p_ptr->music_extra = MUSIC_NONE;
- p_ptr->music_extra2 = MUSIC_NONE;
+ p_ptr->music_extra = 0;
+ p_ptr->music_extra2 = 0;
}
else
{
diff --git a/src/externs.h b/src/externs.h
index 5b935baa..e3ec6ba0 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -1780,6 +1780,67 @@ char *device_radagast_info();
bool_ *device_valaroma();
char *device_valaroma_info();
+extern s32b MUSIC_STOP;
+extern s32b MUSIC_HOLD;
+extern s32b MUSIC_CONF;
+extern s32b MUSIC_STUN;
+extern s32b MUSIC_LITE;
+extern s32b MUSIC_HEAL;
+extern s32b MUSIC_HERO;
+extern s32b MUSIC_TIME;
+extern s32b MUSIC_MIND;
+extern s32b MUSIC_BLOW;
+extern s32b MUSIC_WIND;
+extern s32b MUSIC_YLMIR;
+extern s32b MUSIC_AMBARKANTA;
+
+bool_ *music_stop_singing_spell();
+char *music_stop_singing_info();
+
+int music_holding_pattern_lasting();
+bool_ *music_holding_pattern_spell();
+char *music_holding_pattern_info();
+
+int music_illusion_pattern_lasting();
+bool_ *music_illusion_pattern_spell();
+char *music_illusion_pattern_info();
+
+int music_stun_pattern_lasting();
+bool_ *music_stun_pattern_spell();
+char *music_stun_pattern_info();
+
+int music_song_of_the_sun_lasting();
+bool_ *music_song_of_the_sun_spell();
+char *music_song_of_the_sun_info();
+
+int music_flow_of_life_lasting();
+bool_ *music_flow_of_life_spell();
+char *music_flow_of_life_info();
+
+int music_heroic_ballad_lasting();
+bool_ *music_heroic_ballad_spell();
+char *music_heroic_ballad_info();
+
+int music_hobbit_melodies_lasting();
+bool_ *music_hobbit_melodies_spell();
+char *music_hobbit_melodies_info();
+
+int music_clairaudience_lasting();
+bool_ *music_clairaudience_spell();
+char *music_clairaudience_info();
+
+bool_ *music_blow_spell();
+char *music_blow_info();
+
+bool_ *music_gush_of_wind_spell();
+char *music_gush_of_wind_info();
+
+bool_ *music_horns_of_ylmir_spell();
+char *music_horns_of_ylmir_info();
+
+bool_ *music_ambarkanta_spell();
+char *music_ambarkanta_info();
+
/* randart.c */
extern int get_activation_power(void);
extern void build_prob(cptr learn);
diff --git a/src/spells.pkg b/src/spells.pkg
index b31ff65b..e032b220 100644
--- a/src/spells.pkg
+++ b/src/spells.pkg
@@ -2783,3 +2783,64 @@ bool_ *device_radagast();
char *device_radagast_info();
bool_ *device_valaroma();
char *device_valaroma_info();
+
+extern s32b MUSIC_STOP;
+extern s32b MUSIC_HOLD;
+extern s32b MUSIC_CONF;
+extern s32b MUSIC_STUN;
+extern s32b MUSIC_LITE;
+extern s32b MUSIC_HEAL;
+extern s32b MUSIC_HERO;
+extern s32b MUSIC_TIME;
+extern s32b MUSIC_MIND;
+extern s32b MUSIC_BLOW;
+extern s32b MUSIC_WIND;
+extern s32b MUSIC_YLMIR;
+extern s32b MUSIC_AMBARKANTA;
+
+bool_ *music_stop_singing_spell();
+char *music_stop_singing_info();
+
+int music_holding_pattern_lasting();
+bool_ *music_holding_pattern_spell();
+char *music_holding_pattern_info();
+
+int music_illusion_pattern_lasting();
+bool_ *music_illusion_pattern_spell();
+char *music_illusion_pattern_info();
+
+int music_stun_pattern_lasting();
+bool_ *music_stun_pattern_spell();
+char *music_stun_pattern_info();
+
+int music_song_of_the_sun_lasting();
+bool_ *music_song_of_the_sun_spell();
+char *music_song_of_the_sun_info();
+
+int music_flow_of_life_lasting();
+bool_ *music_flow_of_life_spell();
+char *music_flow_of_life_info();
+
+int music_heroic_ballad_lasting();
+bool_ *music_heroic_ballad_spell();
+char *music_heroic_ballad_info();
+
+int music_hobbit_melodies_lasting();
+bool_ *music_hobbit_melodies_spell();
+char *music_hobbit_melodies_info();
+
+int music_clairaudience_lasting();
+bool_ *music_clairaudience_spell();
+char *music_clairaudience_info();
+
+bool_ *music_blow_spell();
+char *music_blow_info();
+
+bool_ *music_gush_of_wind_spell();
+char *music_gush_of_wind_info();
+
+bool_ *music_horns_of_ylmir_spell();
+char *music_horns_of_ylmir_info();
+
+bool_ *music_ambarkanta_spell();
+char *music_ambarkanta_info();
diff --git a/src/spells3.c b/src/spells3.c
index 6a45a1a3..1cbe0d85 100644
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -133,6 +133,20 @@ s32b DEVICE_THUNDERLORDS;
s32b DEVICE_RADAGAST = -1;
s32b DEVICE_VALAROMA = -1;
+s32b MUSIC_STOP;
+s32b MUSIC_HOLD;
+s32b MUSIC_CONF;
+s32b MUSIC_STUN;
+s32b MUSIC_LITE;
+s32b MUSIC_HEAL;
+s32b MUSIC_HERO;
+s32b MUSIC_TIME;
+s32b MUSIC_MIND;
+s32b MUSIC_BLOW;
+s32b MUSIC_WIND;
+s32b MUSIC_YLMIR;
+s32b MUSIC_AMBARKANTA;
+
/* FIXME: Hackish workaround while we're still tied to Lua. This lets
us return Lua's "nil" and a non-nil value (which is all the s_aux.lua
@@ -3898,3 +3912,299 @@ char *device_valaroma_info()
{
return "";
}
+
+void static start_lasting_spell(int spl)
+{
+ p_ptr->music_extra = -spl;
+}
+
+bool_ *music_stop_singing_spell()
+{
+ start_lasting_spell(0);
+ return CAST;
+}
+
+char *music_stop_singing_info()
+{
+ return "";
+}
+
+static int holding_pattern_power()
+{
+ return 10 + get_level_s(MUSIC_HOLD, 100);
+}
+
+int music_holding_pattern_lasting()
+{
+ project_hack(GF_OLD_SLOW, holding_pattern_power());
+ return get_mana(MUSIC_HOLD);
+}
+
+bool_ *music_holding_pattern_spell()
+{
+ start_lasting_spell(MUSIC_HOLD);
+ return CAST;
+}
+
+char *music_holding_pattern_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "power %d",
+ holding_pattern_power());
+ return buf;
+}
+
+static int illusion_pattern_power()
+{
+ return 10 + get_level_s(MUSIC_CONF, 100);
+}
+
+int music_illusion_pattern_lasting()
+{
+ project_hack(GF_OLD_CONF, illusion_pattern_power());
+ return get_mana(MUSIC_CONF);
+}
+
+bool_ *music_illusion_pattern_spell()
+{
+ start_lasting_spell(MUSIC_CONF);
+ return CAST;
+}
+
+char *music_illusion_pattern_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "power %d",
+ illusion_pattern_power());
+ return buf;
+}
+
+static int stun_pattern_power()
+{
+ return 10 + get_level_s(MUSIC_STUN, 90);
+}
+
+int music_stun_pattern_lasting()
+{
+ project_hack(GF_STUN, stun_pattern_power());
+ return get_mana(MUSIC_STUN);
+}
+
+bool_ *music_stun_pattern_spell()
+{
+ start_lasting_spell(MUSIC_STUN);
+ return CAST;
+}
+
+char *music_stun_pattern_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "power %d",
+ stun_pattern_power());
+ return buf;
+}
+
+int music_song_of_the_sun_lasting()
+{
+ set_lite(5);
+ return 1;
+}
+
+bool_ *music_song_of_the_sun_spell()
+{
+ start_lasting_spell(MUSIC_LITE);
+ return CAST;
+}
+
+char *music_song_of_the_sun_info()
+{
+ return "";
+}
+
+int flow_of_life_hp()
+{
+ return 7 + get_level_s(MUSIC_HEAL, 100);
+}
+
+int music_flow_of_life_lasting()
+{
+ hp_player(flow_of_life_hp());
+ return get_mana(MUSIC_HEAL);
+}
+
+bool_ *music_flow_of_life_spell()
+{
+ start_lasting_spell(MUSIC_HEAL);
+ return CAST;
+}
+
+char *music_flow_of_life_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "heal %d/turn",
+ flow_of_life_hp());
+ return buf;
+}
+
+int music_heroic_ballad_lasting()
+{
+ set_hero(5);
+ if (get_level_s(MUSIC_HERO, 50) >= 10)
+ {
+ set_shero(5);
+ }
+ if (get_level_s(MUSIC_HERO, 50) >= 20)
+ {
+ set_strike(5);
+ }
+ if (get_level_s(MUSIC_HERO, 50) >= 25)
+ {
+ set_oppose_cc(5);
+ }
+ return get_mana(MUSIC_HERO);
+}
+
+bool_ *music_heroic_ballad_spell()
+{
+ start_lasting_spell(MUSIC_HERO);
+ return CAST;
+}
+
+char *music_heroic_ballad_info()
+{
+ return "";
+}
+
+int music_hobbit_melodies_lasting()
+{
+ set_shield(5, 10 + get_level_s(MUSIC_TIME, 50), 0, 0, 0);
+ if (get_level_s(MUSIC_TIME, 50) >= 15)
+ {
+ set_fast(5, 7 + get_level_s(MUSIC_TIME, 10));
+ }
+ return get_mana(MUSIC_TIME);
+}
+
+bool_ *music_hobbit_melodies_spell()
+{
+ start_lasting_spell(MUSIC_TIME);
+ return CAST;
+}
+
+char *music_hobbit_melodies_info()
+{
+ static char buf[128];
+ if (get_level_s(MUSIC_TIME, 50) >= 15)
+ {
+ sprintf(buf, "AC " FMTs32b " speed " FMTs32b,
+ 10 + get_level_s(MUSIC_TIME, 50),
+ 7 + get_level_s(MUSIC_TIME, 10));
+ }
+ else
+ {
+ sprintf(buf, "AC " FMTs32b,
+ 10 + get_level_s(MUSIC_TIME, 50));
+ }
+ return buf;
+}
+
+int music_clairaudience_lasting()
+{
+ set_tim_esp(5);
+ if (get_level_s(MUSIC_MIND, 50) >= 10)
+ {
+ fire_ball(GF_IDENTIFY, 0, 1, 1 + get_level(MUSIC_MIND, 3, 0));
+ }
+ return get_mana(MUSIC_MIND);
+}
+
+bool_ *music_clairaudience_spell()
+{
+ start_lasting_spell(MUSIC_MIND);
+ return CAST;
+}
+
+char *music_clairaudience_info()
+{
+ static char buf[128];
+
+ if (get_level_s(MUSIC_MIND, 50) >= 10)
+ {
+ sprintf(buf, "rad " FMTs32b,
+ 1 + get_level(MUSIC_MIND, 3, 0));
+ return buf;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+bool_ *music_blow_spell()
+{
+ 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 CAST;
+}
+
+char *music_blow_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "dam " FMTs32b "d" FMTs32b " rad " FMTs32b,
+ 2 + get_level(MUSIC_BLOW, 10, 0),
+ 4 + get_level(MUSIC_BLOW, 40, 0),
+ 1 + get_level(MUSIC_BLOW, 12, 0));
+ return buf;
+}
+
+bool_ *music_gush_of_wind_spell()
+{
+ fire_ball(GF_AWAY_ALL,
+ 0,
+ 10 + get_level(MUSIC_BLOW, 40, 0),
+ 1 + get_level(MUSIC_BLOW, 12, 0));
+ return CAST;
+}
+
+char *music_gush_of_wind_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "dist " FMTs32b " rad " FMTs32b,
+ 10 + get_level(MUSIC_BLOW, 40, 0),
+ 1 + get_level(MUSIC_BLOW, 12, 0));
+ return buf;
+}
+
+bool_ *music_horns_of_ylmir_spell()
+{
+ earthquake(p_ptr->py, p_ptr->px, 2 + get_level_s(SHAKE, 10));
+ return CAST;
+}
+
+char *music_horns_of_ylmir_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "rad " FMTs32b,
+ 2 + get_level_s(SHAKE, 10));
+ return buf;
+}
+
+bool_ *music_ambarkanta_spell()
+{
+ alter_reality();
+ return CAST;
+}
+
+char *music_ambarkanta_info()
+{
+ return "";
+}