1. Set up the tiles. Add to f_info (and remember to increase limit in misc.text): --Was 214, 252 was next smallest unused number for the tile index N:252:magic circle G:.:v F:FLOOR | DONT_NOTICE_RUNNING | SUPPORT_LIGHT | CAN_RUN D:0:There is an aura of power here. 2. Set up ability in ab_info --Was 7, now 12, for same reason as above N:7:Draw circle D:You can make magic circles D:Prereq: Magic@30, INT@17, Meta@10 --m code was 102, now 133 A:102:Draw magic circle --Reduced to 21 (3.5 levels of skillpoints), was 30 (5 levels of skillpoints) I:21 k:30:Magic k:10:Meta S:17:INT 3. Set up mkey.lua --^mkeys.lua in Furyband (though I'm not sure of the utility of the name change, personally) add_mkey { --Was 105, now 133 ["mkey"] = 133, ["fct"] = function() --Cost was 50, changed to 30. No particular reason other than personal bias if player.csp > 30 then increase_mana(-30) cave_set_feat(player.py, player.px, 215) energy_use = 100 else msg_print("You need at least 30 mana.") end end, } 4. Make it actually work! Add to spells.lua... -- These functions overwrite (hopefully) the functions in lib\core\s_aux.lua -- Only a couple of lines are changed, however 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 dependancies? 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 -- 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 -- double for magic circle -- CHANGE1! if cave(player.py, player.px).feat == 214 then bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 5)) else bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 10)) end 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 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 -- 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 -- destroy magic circle -- CHANGE2 if cave(player.py, player.px).feat == 214 then cave_set_feat(player.py, player.px, 1) end end player.redraw = bor(player.redraw, PR_MANA) player.window = bor(player.window, PW_PLAYER) end