summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/magic.conf488
-rw-r--r--db/const.txt20
-rw-r--r--db/item_db.txt6
-rw-r--r--npc/011-1_Woodland/_import.txt1
-rw-r--r--npc/011-1_Woodland/auldsbel.txt836
-rw-r--r--npc/012-3_Cave/_import.txt1
-rw-r--r--npc/012-3_Cave/mana-seed.txt265
-rw-r--r--npc/013-3_Cave/barrier.txt2
-rw-r--r--npc/018-1_Woodland_mining_camp/_import.txt1
-rw-r--r--npc/018-1_Woodland_mining_camp/sword.txt12
-rw-r--r--npc/018-3_Cave/_import.txt1
-rw-r--r--npc/018-3_Cave/sword.txt12
-rw-r--r--npc/functions/magic.txt19
13 files changed, 1526 insertions, 138 deletions
diff --git a/conf/magic.conf b/conf/magic.conf
index 390df589..a0eb7b4a 100644
--- a/conf/magic.conf
+++ b/conf/magic.conf
@@ -34,12 +34,22 @@ CONST SFX_DEFAULT = 10
CONST SFX_SUMMON_START = 21
CONST SFX_SUMMON_FIRE = 22
CONST SFX_TELEPORT = 24
+CONST SFX_RAIN = 25
+CONST SFX_HIT = 25
+CONST SFX_ARROW_HAIL = 27
CONST SFX_BARRIER = 10
CONST SFX_UNBARRIER = 10
CONST SFX_HEAL = 3
CONST MAX_RAIN_SPELL_RADIUS = 20
+CONST SCRIPT_XP = "MAGIC_EXPERIENCE"
+CONST SCRIPT_XP_MASK = 0xffff
+CONST SCRIPT_XP_SHIFT = 0
+CONST SCRIPT_LASTSPELL_MASK = 0xff
+CONST SCRIPT_LASTSPELL_SHIFT = 16
+CONST DEBUG = 0
+
# Default sfx on caster
PROCEDURE default_effect() =
sfx(caster, school - MAGIC + 2, 0);
@@ -47,11 +57,62 @@ PROCEDURE default_effect() =
PROCEDURE sfx_generic(target) =
sfx(target, SFX_DEFAULT, 0);
+PROCEDURE set_var(name, mask, shift, value) =
+ set_script_variable(caster, name, script_int(caster, name) & (neg (mask << shift)) | ((value & mask) << shift));
+
+PROCEDURE gain_xp(gain) =
+ IF (level + 3 > skill(caster, MAGIC)) # Level 4 and 5 magic users don't gain anything from spell levels 0 resp. 0+1
+ THEN (
+ index = spell_index(self_spell);
+ last_index = (script_int(caster, SCRIPT_XP) >> SCRIPT_LASTSPELL_SHIFT) & SCRIPT_LASTSPELL_MASK;
+ last_xp = (script_int(caster, SCRIPT_XP) >> SCRIPT_XP_SHIFT) & SCRIPT_XP_MASK;
+ IF (index != last_index)
+ THEN ( # Some variation observed
+ xp = last_xp + gain;
+ IF (xp > SCRIPT_XP_MASK)
+ THEN xp = SCRIPT_XP_MASK;
+ CALL set_var(SCRIPT_XP, SCRIPT_XP_MASK, SCRIPT_XP_SHIFT, xp);
+ CALL set_var(SCRIPT_XP, SCRIPT_LASTSPELL_MASK, SCRIPT_LASTSPELL_SHIFT, index);
+ IF DEBUG THEN message(caster, "Spell xp = " + xp);
+ ) ELSE IF DEBUG THEN message(caster, "Re-cast same spell, xp remain at " + last_xp);
+ )
+
+PROCEDURE create_item(good_item, count, bad_item, difficulty) =
+ score = experience + random(min(spellpower, (experience / 3) + 1));
+ IF (score >= difficulty)
+ THEN create_item(caster, good_item, count);
+ ELSE (
+ score = score + random(luk(caster)) + random(luk(caster));
+ IF (score < difficulty / 3)
+ THEN (
+ message(caster, "Your spell backfires!");
+ IF (random(110) < (luk(caster)))
+ THEN itemheal(caster, 0 - ((level + 1) * (level + 2) * (3 + random(28))), 0);
+ ELSE itemheal(caster, 0 - (level + 1), 0);
+ ) ELSE IF (score < (difficulty * 2) / 3)
+ THEN (
+ IF random(5) = 0
+ THEN (message(caster, "Your spell solidifies into the shape of a mysterious object!");
+ create_item(caster, "Iten", 1);)
+ ELSE message(caster, "Your spell escapes!");
+ ) ELSE (
+ message(caster, "Your spell takes on a mind of its own!");
+ IF random(3) = 0
+ THEN create_item(caster, bad_item, 1);
+ )
+ )
+
# Increase spellpower by school and general magic skill
PROCEDURE adjust_spellpower(school) =
+ experience = (script_int(caster, SCRIPT_XP) >> SCRIPT_XP_SHIFT) & SCRIPT_XP_MASK;
spellpower = spellpower + (skill(caster, MAGIC) + skill(caster, school)) * 10;
- IF ((school = LIFE) && (target = partner(caster)))
- THEN spellpower = spellpower + 200; # Do something for wedding rings, too?
+ # Below, we adjust by special items
+ IF ((school = LIFE || school = NATURE) && (target = partner(caster)))
+ THEN (spellpower = spellpower + 200;
+ IF is_equipped(caster, "WeddingRing")
+ THEN spellpower = spellpower + 50;
+ IF is_equipped(target, "WeddingRing")
+ THEN spellpower = spellpower + 50;)
PROCEDURE heal(target, max_heal) =
CALL default_effect();
@@ -115,162 +176,246 @@ PROCEDURE summon_spell(mob_id, count, delay, lifetime, control_level) =
# Level 0 spells
#--------------------------------------------------------------------------------
-#SPELL reset : "#reset" =
-# EFFECT { skill 340, 0;
-# skill 341, 0;
-# skill 342, 0;
-# skill 343, 0;
-# skill 344, 0;
-# skill 345, 0;
-# }
+SPELL transmute-wood-to-mouboo : "#T00" =
+ LET level = 0
+ school = TRANSMUTE
+ IN (MANA 5, CASTTIME 4000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ COMPONENTS ["RawLog"])
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ CALL create_item("MoubooFigurine", 1, "WarpedLog", 40);
+ CALL gain_xp(1);
+
+SPELL make-sulphur : "#T01" =
+ LET level = 0
+ school = TRANSMUTE
+ IN (MANA 4, CASTTIME 4000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ COMPONENTS ["PileOfAsh"])
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ CALL create_item("SulphurPowder", 1 + spellpower / 100 + (random(max(1, 800 - spellpower)) / 180), "PileOfAsh", 50);
+ CALL gain_xp(1);
-SPELL lesser-heal (target : STRING) : "#imx" =
+SPELL lesser-heal (target : STRING) : "#L00" =
LET level = 0
school = LIFE
- IN (MANA 5, CASTTIME 400,
+ IN (MANA 6, CASTTIME 500,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE if_then_else(failed(pc(target)), 1,
- rdistance(location(caster), location(pc(target))) < 2 + (spellpower / 50)),
- (COMPONENTS ["MaggotSlime"] OR COMPONENTS ["BugLeg"]))
+ rdistance(location(caster), location(pc(target))) < 2 + (spellpower / 100)),
+ (COMPONENTS ["LifeStone"]))
=> EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
IF failed(pc(target))
THEN target = caster; # quest handling goes here
ELSE target = pc(target);
CALL heal(target, 200);
+ CALL gain_xp(1);
-SPELL flare-dart : "#fla" =
+SPELL flare-dart : "#W00" =
LET level = 0
school = WAR
- IN (MANA 15, CASTTIME 500,
+ IN (MANA 10, CASTTIME 500,
REQUIRE skill(caster, MAGIC) > level,
(REQUIRE skill(caster, school) > 2 OR COMPONENTS ["SulphurPowder"]))
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- damage = min(40 + skill(caster, school) * 20,
- 10 + spellpower);
+ damage = 5 * sqrt(spellpower);
damage_bonus = 5 + level(caster) / 3;
- CALL install_attack_spell(3 + spellpower / 30,
+ CALL install_attack_spell(3 + spellpower / 50,
1200,
4, 31);
-
+ CALL gain_xp(1);
ATTRIGGER CALL attack_check(target);
CALL elt_damage (target, damage, damage_bonus, ELT_WATER, ELT_FIRE, 15);
-SPELL magic-blade : "#mbl" =
+
+SPELL magic-blade : "#W01" =
LET level = 0
school = WAR
- IN (MANA 12, CASTTIME 500,
+ IN (MANA 9, CASTTIME 500,
REQUIRE skill(caster, MAGIC) > level)
=> ( COMPONENTS ["SharpKnife"] =>
EFFECT CALL adjust_spellpower(WAR);
CALL default_effect();
- CALL install_melee_spell(10 + spellpower / 10, 900, 30);
- ATTRIGGER CALL melee_damage(target, 60 + spellpower / 20, 5 + str(caster));
+ CALL install_melee_spell(10 + spellpower / 15, 1200, 30);
+ CALL gain_xp(1);
+ ATTRIGGER CALL melee_damage(target, 60, 5 + str(caster));
| COMPONENTS ["Knife"] =>
EFFECT CALL adjust_spellpower(WAR);
CALL default_effect();
- CALL install_melee_spell(10 + spellpower / 10, 900, 30);
- ATTRIGGER CALL melee_damage(target, 40 + spellpower / 20, 5 + str(caster));
+ CALL install_melee_spell(10 + spellpower / 15, 1200, 30);
+ CALL gain_xp(1);
+ ATTRIGGER CALL melee_damage(target, 40, 5 + str(caster));
)
-SPELL aggravate : "#qaw" =
+SPELL aggravate : "#N00" =
LET level = 0
school = NATURE
- IN (MANA 5, CASTTIME 300,
+ IN (MANA 3, CASTTIME 1000,
REQUIRE skill(caster, MAGIC) > level)
- => EFFECT CALL adjust_spellpower(school);
+ => EFFECT CALL adjust_spellpower(school);
CALL default_effect();
FOREACH MOB target IN rbox(location(caster), 1 + spellpower / 20) DO
(CALL sfx_generic(target);
aggravate(target, 0, caster);)
-LOCAL SPELL summon-maggots : "#kbm" =
+LOCAL SPELL summon-maggots : "#A00" =
LET level = 0
school = ASTRAL
- IN (MANA 20, CASTTIME 3000,
+ IN (MANA 21, CASTTIME 6000,
REQUIRE skill(caster, MAGIC) > level,
COMPONENTS ["MaggotSlime"])
=> EFFECT CALL adjust_spellpower(school);
- CALL summon_spell(1002, 3 + spellpower / 15, 5000 - (spellpower * 10), spellpower * 500, 1);
+ CALL gain_xp(1);
+ CALL summon_spell(1002,
+ 1 + ((sqrt(spellpower) + (spellpower / 15)) / 5),
+ 5000 - (spellpower * 5),
+ 10000 + (spellpower * 50), 1);
+
+SPELL detect-magic : "#G00" =
+ LET level = 0
+ school = MAGIC
+ IN (MANA 3, CASTTIME 6000,
+ REQUIRE skill(caster, MAGIC) > level)
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ range = 1 + spellpower / 50;
+ FOREACH NPC n IN rbox(location(caster), range)
+ DO IF (contains_string(name_of(n), "#MAGIC") || contains_string(name_of(n), "#_M"))
+ THEN sfx(n, SFX_DEFAULT, 0);
+ FOREACH SPELL s IN rbox(location(caster), range)
+ DO IF (s <> self_invocation)
+ THEN sfx(s, SFX_DEFAULT, 0);
#--------------------------------------------------------------------------------
# Level 1 spells
#--------------------------------------------------------------------------------
-SPELL make-arrows : "#mkarrows" =
+SPELL make-arrows : "#T10" =
LET level = 1
school = TRANSMUTE
- IN (MANA 20, CASTTIME 2000,
+ IN (MANA 8, CASTTIME 5000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS ["RawLog"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- create_item(caster, "Arrow", 1 + spellpower / 15);
+ CALL create_item("Arrow", 1 + spellpower / 40 + (random(max(1, 800 - spellpower)) / 80), "WarpedLog", 250);
+ CALL gain_xp(1);
-SPELL make-shirt : "#mkshirt" =
+SPELL make-shirt : "#T11" =
LET level = 1
school = TRANSMUTE
- IN (MANA 20, CASTTIME 2000,
+ IN (MANA 25, CASTTIME 5000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS [5 * "CottonCloth"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- create_item(caster, "CottonShirt", 1);
+ CALL create_item("CottonShirt", 1, "CottonCloth", 400);
+ CALL gain_xp(2);
-SPELL make-tanktop : "#mktanktop" =
+SPELL make-tanktop : "#T12" =
LET level = 1
school = TRANSMUTE
- IN (MANA 20, CASTTIME 2000,
+ IN (MANA 25, CASTTIME 5000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS [4 * "CottonCloth"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- create_item(caster, "TanktopWhite", 1);
+ CALL create_item("WhiteTankTop", 1, "CottonCloth", 500);
+ CALL gain_xp(2);
-SPELL make-short-tanktop : "#mkshorttanktop" =
+SPELL make-short-tanktop : "#T13" =
LET level = 1
school = TRANSMUTE
- IN (MANA 20, CASTTIME 2000,
+ IN (MANA 25, CASTTIME 5000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS [3 * "CottonCloth"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- create_item(caster, "ShortTanktopWhite", 1);
+ CALL create_item("WhiteShortTankTop", 1, "CottonCloth", 550);
+ CALL gain_xp(2);
+
+SPELL make-iron-powder : "#T14" =
+ LET level = 1
+ school = TRANSMUTE
+ IN (MANA 8, CASTTIME 5000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ COMPONENTS ["IronOre"])
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ CALL create_item("IronPowder", 1 + spellpower / 140 + (random(max(1, 900 - spellpower)) / 220), "IronOre", 700);
+ CALL gain_xp(3);
+
+SPELL lay-on-hands (target : STRING) : "#L10" =
+ LET level = 1
+ school = LIFE
+ IN (MANA 10, CASTTIME 500,
+ REQUIRE hp(caster) > max_hp(caster) / 20,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE if_then_else(failed(pc(target)), 1,
+ (rdistance(location(caster),
+ location(pc(target))) < 2 + (spellpower / 50))
+ && not (running_status_update(pc(target), SC_HALT_REGENERATE))
+ ))
+ => EFFECT CALL adjust_spellpower(school);
+ IF failed(pc(target))
+ THEN target = caster; # quest handling goes here
+ ELSE target = pc(target);
+ needed = max_hp(target) - hp(target);
+ pay_fraction = max(80, 200 - (vit(caster) + (spellpower / 10))); # Pay at least 40%
+ payment = (needed * pay_fraction) / 200;
+ available = hp(caster) - (max_hp(caster) / 20);
+
+ IF payment < available
+ THEN power = needed;
+ ELSE (payment = available;
+ power = (available * 200) / pay_fraction;
+ )
+
+ instaheal(caster, 0 - payment, 0);
+ CALL quickheal(target, power);
+ status_change(caster, SC_HALT_REGENERATE, 0, 0, 0, 0, 10000);
+ IF ((caster <> target) && (payment >= 100))
+ THEN CALL gain_xp(min(4, payment / 100));
-SPELL lightning-strike : "#kig" =
+SPELL lightning-strike : "#W10" =
LET level = 1
school = WAR
- IN (MANA 25, CASTTIME 1000,
+ IN (MANA 20, CASTTIME 1000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
(REQUIRE skill(caster, school) > 3 OR COMPONENTS ["IronPowder"]))
=> EFFECT CALL adjust_spellpower(school);
- damage = min(100 + skill(caster, school) * 50,
- 50 + spellpower * 2);
- damage_bonus = level(caster) + spellpower;
- CALL install_attack_spell(1 + spellpower / 60,
+ damage = spellpower;
+ damage_bonus = 1 + spellpower / 2;
+ CALL install_attack_spell(1 + spellpower / 90,
3000,
8, 31);
+ CALL gain_xp(2);
ATTRIGGER CALL attack_check(target);
in_rain = 0;
area = location(caster);
FOREACH SPELL s IN rbox(location(caster), MAX_RAIN_SPELL_RADIUS + 1) DO
IF name_of(s) = "rain" THEN (
-# message(caster, "found-rain at " + s.area + " vs. " + location(caster) + " inside: " + is_in(location(caster), s.area));
IF is_in (location(caster), s.area)
THEN (in_rain = in_rain | 1;
area = area + s.area;);
IF is_in (location(target), s.area)
THEN in_rain = in_rain | 2;
);
-# message(caster, "in-rain : " + in_rain);
IF in_rain & 1
THEN (# caster standing in the rain? This is going to be fun.
used = 0;
@@ -284,32 +429,41 @@ SPELL lightning-strike : "#kig" =
) ELSE
CALL elt_damage (target, damage, damage_bonus, ELT_EARTH, ELT_WIND, 17 + random(3));
-SPELL fire-ball : "#pof" =
+LOCAL SPELL arrow-hail : "#W11" =
LET level = 1
school = WAR
- IN (MANA 30, CASTTIME 1000,
+ IN (MANA 25, CASTTIME 5000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
- (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["PileOfAsh"]))
- => EFFECT CALL adjust_spellpower(school);
- damage = min(50 + skill(caster, school) * 40,
- 30 + ((spellpower * 3) / 2));
- damage_bonus = level(caster) + spellpower * 2;
- radius = 2 + spellpower / 50;
- CALL install_attack_spell(1 + spellpower / 60,
- 5000,
- 10, 31);
- ATTRIGGER CALL attack_check(target);
- loc = location(target);
- #WAIT 500;
- sfx(loc, 16, 0);
- FOREACH TARGET target IN rbox(loc, radius)
- DO IF line_of_sight(loc, location(target))
- THEN (divisor = (3 + rdistance(loc, location(target)));
- CALL elt_damage (target, (damage * 3) / divisor, (damage_bonus * 3) / divisor, ELT_WATER, ELT_FIRE, 15);
- )
+ REQUIRE is_exterior(location(caster)),
+ (COMPONENTS [20 * "Arrow"] OR COMPONENTS [20 * "IronArrow"]),
+ (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["SulphurPowder"]))
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ range = 7;
+ area = rbox(awayfrom(location(caster), dir(caster), 1 + range), range);
+ damage = 100;
+ damage_bonus = spellpower / 5;
+ CALL gain_xp(2);
+ FOR i = 0 TO spellpower / 8 DO (
+ FOR j = 0 TO 3 DO (
+ location = random_location(area);
+ sfx(location, SFX_ARROW_HAIL, 0);
+ done = 0;
+ FOREACH TARGET target IN rbox(location, 0) DO (
+ injure(caster, target, damage + random(damage_bonus) + random(damage_bonus), 0);
+ done = 1;
+ BREAK;
+ )
+ IF location(caster) = location && not(done)
+ THEN (itemheal(caster, 0 - (damage + random(damage_bonus) + random(damage_bonus)), 0);
+ sfx(caster, SFX_HIT, 0);
+ )
+ );
+ WAIT (250 - min(spellpower / 3, 180)) + random(50) + random(50);
+ );
-SPELL magic-knuckles (target : PC) : "#iom" =
+SPELL magic-knuckles : "#W12" =
LET level = 1
school = WAR
IN (MANA 20, CASTTIME 500,
@@ -318,16 +472,17 @@ SPELL magic-knuckles (target : PC) : "#iom" =
(REQUIRE skill(caster, school) > 3 OR COMPONENTS ["Beer"]))
=>
EFFECT CALL adjust_spellpower(WAR);
- str = str(target);
- CALL install_melee_spell(10 + spellpower / 12, 1000, 0);
- ATTRIGGER CALL melee_damage(target, 40 + (str / 2) + spellpower / 20, 5 + str);
+ str = str(caster);
+ CALL install_melee_spell(10 + spellpower / 10, 1300, 34);
+ ATTRIGGER CALL melee_damage(target, 30, 5 + (str * 2));
-SPELL flying-backpack (target : PC) : "#uuy" =
+SPELL flying-backpack (target : PC) : "#N10" =
LET level = 1
school = NATURE
IN (MANA 12, CASTTIME 1000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
+ (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["SilkCocoon"]),
REQUIRE rdistance(location(target), location(caster)) < 2 + spellpower / 30)
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
@@ -335,14 +490,14 @@ SPELL flying-backpack (target : PC) : "#uuy" =
THEN sfx(caster, 2, 0);
status_change(target, SC_FLYING_BACKPACK, 0, 0, 0, 0, 5000 + (spellpower * 500));
message (target, "Your backpack is lifted by a mystical force; you no longer feel it pressing on your back.");
+ CALL gain_xp(1);
ATEND message (target, "Your backpack is no longer levitating.");
sfx(target, 2, 0);
-
-SPELL protect (target : PC) : "#ism" =
+SPELL protect (target : PC) : "#N11" =
LET level = 1
school = NATURE
- IN (MANA 18, CASTTIME 1000,
+ IN (MANA 14, CASTTIME 1500,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
(REQUIRE skill(caster, school) > 3 OR COMPONENTS ["HardSpike"]),
@@ -351,27 +506,41 @@ SPELL protect (target : PC) : "#ism" =
sfx(target, 11, 0);
IF (caster <> target)
THEN CALL default_effect();
- status_change(target, SC_PHYS_SHIELD, 5 + max(15, spellpower / 12), 0, 0, 0, 5000 + (spellpower * 500));
+ status_change(target, SC_PHYS_SHIELD, 5 + max(15, spellpower / 20), 0, 0, 0, 5000 + (spellpower * 400));
message (target, "You feel more protected.");
+ CALL gain_xp(2);
ATEND message (target, "You feel less protected.");
sfx(target, 111, 0);
+SPELL happy-curse (target : PC) : "#N12" =
+ LET level = 1
+ school = NATURE
+ IN (MANA 13, CASTTIME 1000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["GingerBreadMan"]),
+ REQUIRE rdistance(location(target), location(caster)) < 1 + spellpower / 100)
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ FOR i = 0 TO (spellpower / 10) DO (emote(target, 3); WAIT 500;);
+ CALL gain_xp(1);
-LOCAL SPELL rain : "#flosh" =
+LOCAL SPELL rain : "#N13" =
LET level = 1
school = NATURE
- IN (MANA 20, CASTTIME 3000,
+ IN (MANA 17, CASTTIME 3000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
(REQUIRE skill(caster, school) > 3 OR COMPONENTS ["BottleOfWater"]))
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
+ CALL gain_xp(1);
range = min(MAX_RAIN_SPELL_RADIUS, 3 + spellpower / 30);
area = rbox(location(caster), range);
FOR i = 0 TO spellpower DO (
FOR j = 0 TO spellpower / 100 DO (
location = random_location(area);
- sfx(location, 25, 0);
+ sfx(location, SFX_RAIN, 0);
FOREACH TARGET target IN rbox(location, 1) DO
IF element(target) = ELT_FIRE
THEN injure(caster, target, 5 + random(5 + spellpower / 10), 0);
@@ -379,63 +548,54 @@ LOCAL SPELL rain : "#flosh" =
WAIT 300 - min(spellpower, 200) + random(100);
);
-SPELL happy-curse (target : PC) : "#happy" =
- LET level = 1
- school = NATURE
- IN (MANA 10, CASTTIME 1000,
- REQUIRE skill(caster, MAGIC) > level,
- REQUIRE skill(caster, school) > level,
- (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["WhiteFur"]),
- REQUIRE rdistance(location(target), location(caster)) < 1 + spellpower / 100)
- => EFFECT CALL adjust_spellpower(school);
- CALL default_effect();
- FOR i = 0 TO (spellpower / 10) DO (emote(target, 3); WAIT 500;);
-
-SPELL barrier (target : PC) : "#iso" =
+SPELL barrier (target : PC) : "#A10" =
LET level = 1
- school = NATURE
- IN (MANA 18, CASTTIME 1000,
+ school = ASTRAL
+ IN (MANA 16, CASTTIME 1000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
- (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["HardSpike"]),
+ (REQUIRE skill(caster, school) > 3 OR COMPONENTS ["SmallMushroom"]),
REQUIRE rdistance(location(target), location(caster)) < 2 + spellpower / 30)
=> EFFECT CALL adjust_spellpower(school);
sfx(target, SFX_BARRIER, 0);
IF (caster <> target)
THEN CALL default_effect();
- status_change(target, SC_MBARRIER, 30 + max(30, spellpower / 8), 0, 0, 0, 2000 + (spellpower * 200));
+ status_change(target, SC_MBARRIER, 20 + max(30, spellpower / 8), 0, 0, 0, 2000 + (spellpower * 200));
message (target, "You are surrounded by a magical barrier.");
+ CALL gain_xp(3);
ATEND message (target, "Your magical barrier disspiates.");
sfx(target, SFX_UNBARRIER, 0);
-LOCAL SPELL summon-scorps : "#kbms" =
+LOCAL SPELL summon-scorps : "#A11" =
LET level = 1
school = ASTRAL
- IN (MANA 25, CASTTIME 3000,
+ IN (MANA 33, CASTTIME 3000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS ["ScorpionStinger"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- CALL summon_spell(1003, 1 + spellpower / 30, 5000 - (spellpower * 9), spellpower * 400, 2);
+ CALL gain_xp(1);
+ CALL summon_spell(1003, 1 + spellpower / 140, 5000 - (spellpower * 9), spellpower * 400, 2);
-LOCAL SPELL summon-red-scorps : "#kbmq" =
+LOCAL SPELL summon-red-scorps : "#A12" =
LET level = 1
school = ASTRAL
- IN (MANA 30, CASTTIME 3000,
+ IN (MANA 39, CASTTIME 3000,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level,
COMPONENTS ["RedScorpionStinger"])
=> EFFECT CALL adjust_spellpower(school);
CALL default_effect();
- CALL summon_spell(1004, 1 + spellpower / 40, 5000 - (spellpower * 8), spellpower * 350, 3);
+ CALL gain_xp(1);
+ CALL summon_spell(1004, 1 + spellpower / 230 + spellpower / 430, 5000 - (spellpower * 8), spellpower * 350, 3);
-SPELL detect-players : "#ewm" =
+SPELL detect-players : "#G10" =
LET level = 1
school = MAGIC
- IN (MANA 10, CASTTIME 300,
+ IN (MANA 7, CASTTIME 300,
REQUIRE skill(caster, MAGIC) > level,
REQUIRE skill(caster, school) > level)
=> EFFECT CALL adjust_spellpower(school);
@@ -453,42 +613,99 @@ SPELL detect-players : "#ewm" =
THEN message(caster, "You sense no-one else nearby.");
ELSE message(caster, "You sense the following: " + message);
+SPELL reveal : "#G11" =
+ LET level = 1
+ school = MAGIC
+ IN (MANA 18, CASTTIME 3000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level)
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ FOREACH PC target IN rbox(location(caster), 1 + spellpower / 100)
+ DO IF has_shroud(target) && level(caster) * 2 > level(target)
+ THEN (unshroud(target);
+ sfx(target, SFX_DEFAULT, 500);)
+
-
-SPELL lay-on-hands (target : STRING) : "#loh" =
+SPELL enchant-lifestone : "#G12" =
LET level = 1
- school = LIFE
- IN (MANA 8, CASTTIME 400,
- REQUIRE hp(caster) > max_hp(caster) / 20,
+ school = MAGIC
+ IN (MANA 15, CASTTIME 4000,
REQUIRE skill(caster, MAGIC) > level,
- REQUIRE if_then_else(failed(pc(target)), 1,
- (rdistance(location(caster),
- location(pc(target))) < 2 + (spellpower / 50))
- && not (running_status_update(pc(target), SC_HALT_REGENERATE))
- ))
+ REQUIRE skill(caster, school) > level,
+ (COMPONENTS ["BugLeg"] OR COMPONENTS["MaggotSlime"]))
=> EFFECT CALL adjust_spellpower(school);
- IF failed(pc(target))
- THEN target = caster; # quest handling goes here
- ELSE target = pc(target);
- needed = max_hp(target) - hp(target);
- pay_fraction = max(80, 200 - (vit(caster) + (spellpower / 10))); # Pay at least 40%
- payment = (needed * pay_fraction) / 200;
- available = hp(caster) - (max_hp(caster) / 20);
+ CALL default_effect();
+ create_item(caster, "LifeStone", 1);
+ CALL gain_xp(1);
- IF payment < available
- THEN power = needed;
- ELSE (payment = available;
- power = (available * 200) / pay_fraction;
+SPELL sense-spouse : "#G13" =
+ LET level = 1
+ school = MAGIC
+ IN (MANA 7, CASTTIME 400,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ REQUIRE is_married(caster),
+ REQUIRE is_equipped(caster, "WeddingRing"))
+ => EFFECT CALL adjust_spellpower(school);
+ CALL default_effect();
+ IF (failed(partner(caster)) || not(is_equipped(partner(caster), "WeddingRing")))
+ THEN (message(caster, "You cannot sense your partner.");
+ ABORT;)
+ partner = partner(caster);
+ name = name_of(partner);
+ IF (is_dead(partner) || (map_nr(location(partner)) <> map_nr(location(caster))))
+ THEN (message(caster, "You cannot sense " + name + " nearby.");
+ ABORT;)
+ IF (map_level(location(partner)) > 2 && map_level(location(caster)) < map_level(location(partner)))
+ THEN (message(caster, "You sense " + name + " somewhere below.");
+ ABORT;)
+ IF (map_level(location(caster)) > 2 && map_level(location(partner)) < map_level(location(caster)))
+ THEN (message(caster, "You sense " + name + " somewhere above.");
+ ABORT;)
+ IF (map_level(location(caster)) <> map_level(location(partner)))
+ THEN message(caster, "You sense " + name + " somewhere in the vincinity.");
+ ELSE (distance = rdistance(location(caster), location(partner));
+ dir = dir_towards(location(caster), location(partner), 1);
+ IF (distance < 3)
+ THEN message(caster, "You sense " + name + " right next to you.");
+ ELSE IF (distance < 30)
+ THEN message(caster, "You sense " + name + " close by, towards the " + dir + ".");
+ ELSE IF (distance < 200)
+ THEN message(caster, "You sense " + name + " nearby, towards the " + dir + ".");
+ ELSE message(caster, "You sense " + name + " in the " + dir + ".");
)
-
- instaheal(caster, 0 - payment, 0);
- CALL quickheal(target, power);
- status_change(caster, SC_HALT_REGENERATE, 0, 0, 0, 0, 10000);
+
#--------------------------------------------------------------------------------
# Level 2 spells
#--------------------------------------------------------------------------------
+SPELL fire-ball : "#pof" =
+ LET level = 2
+ school = WAR
+ IN (MANA 30, CASTTIME 1000,
+ REQUIRE skill(caster, MAGIC) > level,
+ REQUIRE skill(caster, school) > level,
+ COMPONENTS ["PileOfAsh"])
+ => EFFECT CALL adjust_spellpower(school);
+ damage = min(50 + skill(caster, school) * 40,
+ 30 + ((spellpower * 3) / 2));
+ damage_bonus = level(caster) + spellpower * 2;
+ radius = 2 + spellpower / 50;
+ CALL install_attack_spell(1 + spellpower / 60,
+ 5000,
+ 10, 31);
+ ATTRIGGER CALL attack_check(target);
+ loc = location(target);
+ #WAIT 500;
+ sfx(loc, 16, 0);
+ FOREACH TARGET target IN rbox(loc, radius)
+ DO IF line_of_sight(loc, location(target))
+ THEN (divisor = (3 + rdistance(loc, location(target)));
+ CALL elt_damage (target, (damage * 3) / divisor, (damage_bonus * 3) / divisor, ELT_WATER, ELT_FIRE, 15);
+ )
+
SPELL summon-partner : "#aid" =
LET level = 2
school = ASTRAL
@@ -506,6 +723,8 @@ SPELL summon-partner : "#aid" =
WAIT (max (5000, 30000 - (spellpower * 60)));
IF (failed (partner (caster)))
THEN message (caster, "Your partner has abandoned you.");
+ ELSE IF (is_dead (partner (caster)))
+ THEN message (caster, "Something seems to have happened to " + (name_of(partner(caster))) + ".");
ELSE (sfx(location(partner(caster)), SFX_TELEPORT, 0);
dest = awayfrom(location(caster), random_dir(1), 1);
warp(partner(caster), dest);
@@ -642,4 +861,3 @@ LOCAL SPELL mouboo-smell : "#s" =
FOREACH PC p IN rbox(location(caster), 30) DO
message(p, "You notice a strange smell all around you.");
-
diff --git a/db/const.txt b/db/const.txt
index 73e60c04..f372ff14 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -174,3 +174,23 @@ NIBBLE_6_MASK 251658240
NIBBLE_7_SHIFT 28
NIBBLE_7_MASK 4026531840
+
+// Magic skills
+SKILL_MAGIC 340
+SKILL_MAGIC_LIFE 341
+SKILL_MAGIC_WAR 342
+SKILL_MAGIC_TRANSMUTE 343
+SKILL_MAGIC_NATURE 344
+SKILL_MAGIC_ASTRAL 345
+
+// Flags for the magic quests
+MFLAG_DRANK_POTION 1 // Character drank at least one magic potion as prerequisite for the mana seed quest
+MFLAG_KNOWS_MANASEED 2 // Character has found the Mana Seed
+MFLAG_TOUCHED_MANASEED 4 // Character has touched the Mana Seed
+MFLAG_MANASEED_MAXEDOUT 8 // Character has touched the Mana Seed while maxed out on magic
+
+MFLAG_KNOWS_AULDSBEL 16 // Character has met Auldsbel
+MFLAG_KNOWS_WYARA 32 // Character has met Wyara
+MFLAG_KNOWS_SAGATHA 64 // Character has met Sagatha
+MFLAG_KNOWS_MANAPOTION 128 // Has heard about the mana potion
+
diff --git a/db/item_db.txt b/db/item_db.txt
index 721db3ee..ee68f152 100644
--- a/db/item_db.txt
+++ b/db/item_db.txt
@@ -194,7 +194,7 @@
702, WeddingRing, Wedding Ring, 5, 1000, 1, 1, , 0, , 1, 0, 10477567, 2, 128, , 0, 0, {}, {}
703, SulphurPowder, Sulphur Powder, 3, 1000, 100, 2, , , , , , 10477567, 2, , , 0, , {}, {}
704, IronPowder, Iron Powder, 3, 800, 80, 3, , , , , , 10477567, 2, , , 0, , {}, {}
-// RESERVED
+705, ManaPotion, Mana Potion, 0, 2000, 300, 50, , , , , , 10477567, 2, , , 0, , { itemheal 0, 10; callfunc "MagicGainBasic"; }, {}
706, GoldenScorpionStinger, Golden Scorpion Stinger, 3, 2000, 500, 2, , , , , , , , , , , , {}, {}
707, MonsterOilPotion, Monster Oil Potion, 3, 10000, 2000, 50, , , , , , , , , , , , {}, {}
708, LeatherPatch, Leather Patch, 3, 300, 150, 18, , , , , , , , , , , , {}, {}
@@ -217,7 +217,9 @@
725, GMCap, GM Cap, 5, 2000, 500, 10, , 5, , 5, 0, 10477567, 2, 256, , 0, 0, {}, {}
726, GMRobe, GM Robe, 5, 8000, 4000, 5, , 5, , 0, 0, 10477567, 2, 512, , 0, 0, {}, {}
727, Iten, Iten, 3, 0, 0, 100, , , , , , , , , , , , {}, {}
-// RESERVED
+728, MoubooFigurine, Mouboo Figurine, 3, 0, 0, 1, , , , , , , , , , , , {}, {}
+729, WarpedLog, Warped Log, 3, 0, 0, 2, , , , , , , , , , , , {}, {}
+730, Lifestone, Lifestone, 3, 0, 0, 1, , , , , , , , , , , , {}, {}
731, AssassinPants, Assassin Pants, 5, 10000, 3000, 10, , 5, , -5, 0, 10477567, 2, 1, , 0, 0, {}, {}
#ID, Name, Label, Type, Price, Sell, Weight, ATK, DEF, Range, Mbonus, Slot, Job, Gender, Loc, wLV, eLV, View, {UseScript}, {EquipScript}
diff --git a/npc/011-1_Woodland/_import.txt b/npc/011-1_Woodland/_import.txt
index ce529acf..3e18f94e 100644
--- a/npc/011-1_Woodland/_import.txt
+++ b/npc/011-1_Woodland/_import.txt
@@ -2,5 +2,6 @@ map: 011-1.gat
npc: npc/011-1_Woodland/_mobs.txt
npc: npc/011-1_Woodland/_warps.txt
npc: npc/011-1_Woodland/alchemist.txt
+npc: npc/011-1_Woodland/auldsbel.txt
npc: npc/011-1_Woodland/monsters.txt
npc: npc/011-1_Woodland/oscar.txt
diff --git a/npc/011-1_Woodland/auldsbel.txt b/npc/011-1_Woodland/auldsbel.txt
new file mode 100644
index 00000000..5be274a6
--- /dev/null
+++ b/npc/011-1_Woodland/auldsbel.txt
@@ -0,0 +1,836 @@
+// Auldsbel the Wizard
+// Transmutation Magic expert
+
+011-1.gat,50,68,0 script Auldsbel#_M 168,{
+
+ set @RED, 683;
+ set @YELLOW, 682;
+ set @BLUE, 681;
+ set @MAUVE, 680;
+ set @PETAL, 565;
+ set @PEARL, 700;
+ set @BOTTLE_WATER, 541;
+ set @MANA_POTION, 705;
+ set @SMALL_HEALING_POTION, 685;
+ set @MEDIUM_HEALING_POTION, 686;
+ set @IRON_POTION, 567;
+ set @CONCENTRATION_POTION, 568;
+ set @COCOON, 718;
+ set @STINGER, 507;
+ set @RED_STINGER, 517;
+ set @BLACK_STINGER, 709;
+ set @SNAKE_TONGUE, 710;
+ set @CAVE_SNAKE_TONGUE, 713;
+ set @MOUNTAIN_SNAKE_TONGUE, 711;
+ set @GRASS_SNAKE_TONGUE, 712;
+ set @MAGGOT_SLIME, 505;
+
+ set @Q_STATUS_INITIAL, 0;
+ set @Q_STATUS_POSTINTRO, 1;
+
+ set @Q_MASK, NIBBLE_0_MASK | NIBBLE_1_MASK;
+ set @Q_SHIFT, NIBBLE_0_SHIFT;
+
+ set @Q_status, (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;
+
+ set @Q_main_status, @Q_status & 31;
+ set @Q_component_quest, @Q_status >> 5;
+
+ set @has_magic, getskilllv(SKILL_MAGIC);
+
+ set @address$, "chap";
+ if (Sex == 0)
+ set @address$, "girl";
+
+ if (@Q_status >= @Q_STATUS_POSTINTRO)
+ goto L_short_intro;
+
+ mes "[Robed Man]";
+ mes "You notice a middle-aged man in expensive-looking robes.";
+ mes "\"Ah, splendid, you finally came!\"";
+ mes "He motions you to come closer.";
+ next;
+
+ mes "[Robed Man]";
+ mes "The man is visibly excited.";
+ mes "\"Here, I found a silk cocoon. Now if you can just give me the obsidian salt, we can see whether it works!\"";
+ next;
+
+ menu "Whether what works?", L_intro_explain,
+ "What are you talking about?", L_intro_explain,
+ "I don't have any obsidian salt.", L_intro_nopowder,
+ "Do I know you?", L_intro_identity,
+ "Goodbye.", -;
+ close;
+
+ set @name_complaint, 0;
+
+L_intro_explain:
+ mes "[Robed Man]";
+ mes "He frowns.";
+ mes "\"The transmutation experiment, of course! You can't have forgotten already...?\"";
+ next;
+ goto L_intro_identity;
+
+L_intro_nopowder:
+ mes "[Robed Man]";
+ mes "\"What!? You traveled all this way without any obsidian...\"";
+ next;
+ goto L_intro_identity;
+
+L_intro_identity:
+ mes "[Robed Man]";
+ mes "He eyes you more carefully.";
+ if (Sex == 0)
+ mes "\"How odd. I could have sworn that you were a man the last time we met. Not that I mind...\"";
+
+ mes "\"Wait. You're not Padric.\"";
+ next;
+
+ set @xmsg$, "Right... my name is " + strcharinfo(0) + ".";
+ if (strcharinfo(0) == "Padric")
+ set @xmsg$, "Actually, I am, but I don't know you..?";
+
+ menu @xmsg$, L_intro_wrongperson,
+ "You're not very good with faces, are you?", L_intro_nogood,
+ "Who are you?", L_intro_who_are_you,
+ "Goodbye.", -;
+ close;
+
+L_intro_wrongperson:
+ mes "[Robed Man]";
+ mes "He laughs.";
+ mes "\"Ah, I knew it... you're not the first one today, either. I should apologize, I am horrible with faces. Well, if you don't mind, please hurry along, I should go back to my experiments.\"";
+ next;
+
+L_intro_primary_menu:
+ menu "Who are you?", L_intro_who_are_you,
+ "Goodbye.", -;
+ close;
+
+L_intro_nogood:
+ mes "[Robed Man]";
+ mes "He laughs.";
+ mes "\"Yes, you could say that. Well, I shall get back to my experiments, then; I think I shall manage something that requires no obsidian salt instead.\"";
+ next;
+
+ menu "Who are you?", L_intro_who_are_you,
+ "What is obsidian salt, anyway?", L_intro_obsidian_salt,
+ "Goodbye.", -;
+ close;
+
+L_intro_obsidian_salt:
+ mes "[Robed Man]";
+ mes "\"Oh, obsidian salt is a catalyst... or rather a theoretical catalyst. We know that it has to have an application somewhere, and I do have the strong suspicion that it may be linked to natural transmogrification...\"";
+ next;
+ goto L_intro_primary_menu;
+
+L_intro_who_are_you:
+ mes "[Robed Man]";
+ mes "\"Oh, oh my... of course you wouldn't know me, being from the countryside and all.\"";
+ mes "He laughs.";
+ mes "\"Well, my young friend, I am none other than Auldsbel the Mostly Grayish, of the Council of Transmuters!\"";
+ next;
+
+ set @Q_main_status, @Q_STATUS_POSTINTRO;
+ callsub S_update_var;
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_KNOWS_AULDSBEL;
+
+ mes "[Auldsbel the Wizard]";
+ mes "\"That means that I'm a wizard, in case you were wondering.\"";
+ next;
+ goto L_main_menu;
+
+L_short_intro:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Welcome back, Padric!\"";
+ next;
+ goto L_main_menu;
+
+L_main_menu:
+ if (@has_magic)
+ goto L_main_menu_magic;
+
+ menu "How does this 'magic' work?", L_about_magic,
+ "I want to become a wizard!", L_learn_magic,
+ "Where are you from?", L_about_auldsbel,
+ "Do you need help with your experiments?", L_quest,
+ "What do you know about...", L_question,
+ "Goodbye.", -;
+ close;
+
+L_main_menu_magic:
+ menu "How does magic work?", L_about_magic,
+ "Can you teach me a spell?", L_learn_spell,
+ "Where are you from?", L_about_auldsbel,
+ "Do you need help with your experiments?", L_quest,
+ "What do you know about...", L_question,
+ "Goodbye.", -;
+ close;
+
+L_about_magic:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Magic is a universal force that comes from within; only few individuals have the power to channel and manipulate it. Most magic users resort to spells-- prefabricated invocations-- to access and control their magical power.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Most spells are claimed by one of the five schools of magic. To properly use them, a magic user need not only have sufficient prowess in magic overall, but also in the specifics of that particular school.\"";
+ next;
+
+L_about_magic_minimenu:
+ menu
+ "What are the five schools?", L_about_magic_schools,
+ "How can I advance in magic?", L_about_magic_advance,
+ "How do spells work?", L_about_magic_spells,
+ "Where can I learn spells?", L_about_magic_learn,
+ "Never mind.", -;
+ goto L_main_menu;
+
+L_about_magic_schools:
+ mes "[Auldsbel the Wizard]";
+ mes "\"With few exceptions, all spells belong to one of the five schools of magic: Transmutation, War, Astral, Life, and Nature.\"";
+ next;
+
+L_about_schools_minimenu:
+ menu
+ "What's Transmutation magic?", L_about_transmutation,
+ "What's War magic?", L_about_war,
+ "What's Astral magic?", L_about_astral,
+ "What's Life magic?", L_about_life,
+ "What's Nature magic?", L_about_nature,
+ "Are there other spells?", L_about_other_spells,
+ "Thank you.", -;
+ goto L_about_magic_minimenu;
+
+L_about_transmutation:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Transmutation magic deals with forming matter into a new shape. Some advanced transmutation magic can also expose special properties of the material in question.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "He smiles.";
+ mes "\"Transmutation magic is the engine of human civilization. By allowing us to shape buildings, tools, and other items according to the power of our imagination, it gives us mastery over nature.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+L_about_astral:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Astral magic comprises a family of spells that connect the caster to the Astral World. This connection can be used to pull the caster 'through'-- effectively teleporting them-- or to 'pull others through'-- summoning creatures.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"There are also some more direct uses of powers of the Astral World; mainly spells that affect other spells.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+L_about_war:
+ mes "[Auldsbel the Wizard]";
+ mes "\"War magic deals with the inevitable necessity of struggle against other creatures, and sometimes even against other humans. War magic exclusively focusses on dealing damage and destruction.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"If you use War magic, You better have a Transmuter around for the aftermath, to clear up your collateral damage.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+L_about_life:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Life magic deals with healing. Not much of a surprise there.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+L_about_nature:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Nature magic is a rather subtle (and, in my eyes, rather weak) kind of magic that deals with manipulating nature as it is. Think of it as Transmutation magic without being able to actually shape things the way you want.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+L_about_other_spells:
+ mes "[Auldsbel the Wizard]";
+ mes "\"A few spells are not claimed by any particular school of magic. In practice, this means that anyone can cast them if they just have sufficient magical power. The most prominent example is the 'detect magic' spell, '" + getspellinvocation("detect-magic") + "'.\"";
+ next;
+ goto L_about_schools_minimenu;
+
+
+
+L_about_magic_advance:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Advancing in your magical powers must come from two sources: from within and from a person who can guide you in whichever school of magic you wish to advance.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"For advancing in your general magic power, you must practice magical spells. Make sure to vary them; you will learn little if you cast the same spell over and over. Also, spells that consume no components seem not to be very instructive in practice.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Once you have gathered enough spellcasting experience, you should be able to advance to the next level of magic. If you received your magic from a sponsor, you may have to seek out the sponsor again to advance.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Similarly, to advance in a particular school of magic, you should seek out someone sufficiently competent in that school. Each school has a different rite for advancing its students, so make sure to talk to the right person.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"I myself am a Transmutation Wizard. Of course I know some spells from the other schools, but my focus is on Transmutation. Theoretically speaking, I can advance you in this school.\"";
+ next;
+ goto L_about_magic_minimenu;
+
+L_about_magic_learn:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Finding and learning new spells is of course important in a magic user's quest towards becoming a full-fledged wizard.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Some wizards will be willing to share their knowledge, usually for a price. But they are not the only sources of magical spells: many magical books contain spells, and you can occasionally find them written down in the most unusual of places.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Some are even hiding as part of folklore or gossip. Of course, for those it can sometimes be hard to determine just what their prerequisites are...\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"If you decide to hunt for spells, make sure to keep a journal with you. Some spell invocations may only cross your path once in your lifetime; you must not allow them to get away!\"";
+ next;
+ goto L_about_magic_minimenu;
+
+L_about_magic_spells:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Magical spells are shortcuts, true magic bound to a word. No-one today remembers how they were created at the beginning of time, though many have tried to find it out, and failed...\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"These magical words are the spells' invocations. Spoken by someone who can't use magic, or by someone who doesn't satisfy the prerequisites, the word stands just for itself.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"But when spoken by a competent magic user, the word may unleash its effect-- consuming any components it may require, draining the caster's mana, changing the world around it.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Some spells require catalysts on top of components, others vary in power depending on whom they are cast on or under what conditions. However, all spells are affected by the caster's astral power.\"";
+ next;
+
+L_about_spells_minimenu:
+ menu
+ "What is this 'astral power'?", L_about_astral_power,
+ "What is a catalyst?", L_about_catalysts,
+ "What is a component?", L_about_components,
+ "What other prerequisites are there?", L_about_other_prerequisites,
+ "Where can I learn spells?", L_about_magic_learn,
+ "How often can I cast spells?", L_about_speed,
+ "Never mind.", L_about_magic_minimenu;
+ close;
+
+L_about_astral_power:
+ mes "[Auldsbel the Wizard]";
+ mes "\"A person's astral power is determined by several factors: overall experience, intelligence, and any and all equipment the person may be wearing at a given time.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Greater astral power mans more powerful spells. Since equipment can greatly decrease astral power, most magic users tend to be careful about what they wear-- it takes a while to recover astral power even after armour is unequipped.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"The worst offenders are metal items, particularly shields and body armour. Helmets and gloves get in the way, too. Still, a few special or enchanted items may even increase magical power.\"";
+ next;
+ goto L_about_spells_minimenu;
+
+L_about_catalysts:
+ mes "[Auldsbel the Wizard]";
+ mes "\"A catalyst is a material prerequisite to a spell that is not consumed as part of the spell. For example, the Transmuter's Tablet is required to properly perform many of the more powerful transmutation spells, but it is never consumed.\"";
+ next;
+ goto L_about_spells_minimenu;
+
+L_about_components:
+ mes "[Auldsbel the Wizard]";
+ mes "\"A material component is an item that is consumed as part of the spell's magic. For example, when transmuting wood into arrows, you must consume a raw log to shape the arrows out of it.\"";
+ next;
+ goto L_about_spells_minimenu;
+
+L_about_other_prerequisites:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Some spells have additional requirements-- they can only be cast underground, or when you are standing very close to the person you are casting them on, or only when you are wearing a particular enchanted item. Spells are quirky, so read their descriptions carefully-- if you do find a description.\"";
+ next;
+ goto L_about_spells_minimenu;
+
+L_about_speed:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Most spells are effective immediately, unless they require some complex astral connectoin-- summoning or teleporting can take a while to take effect, for example. Still, after casting a spell you usually need a moment to recover before casting the next.\"";
+ next;
+ goto L_about_spells_minimenu;
+
+
+L_about_auldsbel:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Well, there is no harm in giving you the general picture, I suppose.\"";
+ mes "He sighs, as if he had been forced to repeat something one time too many.";
+ mes "\"I am from the Council of Transmuters, the head organ of organized Transmutation magic in the known world.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"The council oversees recruitment, education, accreditation, and, if necessary, disciplining of Transmuters.";
+ mes "It ensures that Transmuter conduct is according to its statutes and acts as representative and point of contact towards other entities.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Of all the schools of magic, the School of Transmutation the most organised by far, and held in high esteem by rulers all across the world. Of course this is not only due to the outstanding and rigid structure of the school, but also because of the exceptional services that its members provide.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"The Council, presently overseen by Lord Transmogrifier Pontorias the Plaid (May His Shape Reflect His Soul Forever), consists of fourty-nine members and is situated in the citadel of Dorngard, in the northern mountains near the Crimson Cascade.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"The Council is souvereign over three hundred acres of land and nearby farming communities and has been ever since Yorick the Younger shaped Dorngard out of a mountain by sheer power of will, to build a home for the school his father had founded.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"The Council has held peaceful relations with nearby realms for almost two centruries now and is widely regarded as a reliable partner in shaping civilization to allow it to evolve towards its next stage.\"";
+ next;
+
+ menu
+ "All right, but what about you?.", L_about_auldsbel_2,
+ "Never mind.", -;
+ goto L_main_menu;
+
+L_about_auldsbel_2:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Oh, myself? I am just vacationing in the area. Very relaxed and peaceful place, the Hurnscald area. And plenty of splendid specimen for experimentation.\"";
+ next;
+ goto L_main_menu;
+
+L_learn_magic:
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel laughs heartily.";
+ mes "\"Hah, if only it were so easy! No, my young friend, I fear that 'learning magic' here is not an option. Either you are born with it, or without.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Sure, there are a few entities that may grant you magic-- Ether Spirits or Mana Seeds or Great Dragons-- but those are the stuff of legends, so I suggest that you don't waste your life trying to find one of them.\"";
+ next;
+ goto L_main_menu;
+
+L_question:
+ set @QQ_ELANORE, 1;
+ set @QQ_MANASEED, 2;
+ set @QQ_WYARA, 3;
+ set @QQ_SAGATHA, 4;
+
+ setarray @choice$, "", "", "", "", "";
+ set @choices_nr, 0;
+ setarray @choice_idx, 0, 0, 0, 0, 0;
+
+ set @choice$[@choices_nr], "...Elanore the Healer?";
+ set @choice_idx[@choices_nr], @QQ_ELANORE;
+ set @choices_nr, @choices_nr + 1;
+
+ if (!(MAGIC_FLAGS & MFLAG_KNOWS_MANASEED))
+ goto L_Q_post_manaseed;
+ set @choice$[@choices_nr], "...the Mana Seed?";
+ set @choice_idx[@choices_nr], @QQ_MANASEED;
+ set @choices_nr, @choices_nr + 1;
+L_Q_post_manaseed:
+
+ if (!(MAGIC_FLAGS & MFLAG_KNOWS_WYARA))
+ goto L_Q_post_wyara;
+ set @choice$[@choices_nr], "...Wyara the Witch?";
+ set @choice_idx[@choices_nr], @QQ_WYARA;
+ set @choices_nr, @choices_nr + 1;
+L_Q_post_wyara:
+
+ if (!(MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA))
+ goto L_Q_post_sagatha;
+ set @choice$[@choices_nr], "...Sagatha the Witch?";
+ set @choice_idx[@choices_nr], @QQ_SAGATHA;
+ set @choices_nr, @choices_nr + 1;
+L_Q_post_sagatha:
+
+ set @choice$[@choices_nr], "...never mind.";
+ set @choice_idx[@choices_nr], 0;
+ set @choices_nr, @choices_nr + 1;
+
+ menu @choice$[0], -,
+ @choice$[1], -,
+ @choice$[2], -,
+ @choice$[3], -,
+ @choice$[4], -;
+
+ set @menu, @menu - 1;
+
+ if (@menu >= @choices_nr)
+ set @menu, 0;
+
+ set @c, @choice_idx[@menu];
+
+// mes "menu = " + @menu + ", c = " + @c + " nr=" + @choices_nr + ", ids = " + @choice_idx[0];
+// next;
+
+ if (@c == 0) goto L_main_menu;
+ if (@c == @QQ_ELANORE) goto L_Q_elanore;
+ if (@c == @QQ_MANASEED) goto L_Q_manaseed;
+ if (@c == @QQ_WYARA) goto L_Q_wyara;
+ if (@c == @QQ_SAGATHA) goto L_Q_sagatha;
+ close;
+
+L_Q_elanore:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Ah, Elanore. A kind little woman. Also a very proficient healer, from what I have been told, though we have interacted little. If you are interested in Life magic, you might want to talk to her.\"";
+ next;
+ goto L_main_menu;
+
+L_Q_wyara:
+ mes "[Auldsbel the Wizard]";
+ mes "\"The village witch? Not exactly the brightest person, but she has managed to figure out how to brew potions. I doubt that she can do any real magic, though.\"";
+ next;
+ goto L_main_menu;
+
+L_Q_sagatha:
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel frowns.";
+ mes "\"That witch, hmm? She's a well-known trouble-maker, and quite a clever one at that; she once prevented us from cutting down a forest near Dorngaard that the villages wanted to use for farming, using some ingenious magic.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"That woman has spent too much time alone in the forests... I have the strong suspicion that she is more loyal towards her animals than towards us humans! I recommend that you stay away from her, if you value your well-being.\"";
+ next;
+ goto L_main_menu;
+
+L_Q_manaseed:
+ mes "[Auldsbel the Wizard]";
+ if (@has_magic)
+ goto L_Q_manaseed_withmagic;
+ if (MAGIC_FLAGS & MFLAG_DRANK_POTION)
+ goto L_Q_manaseed_prepared;
+ if (MAGIC_FLAGS & MFLAG_TOUCHED_MANASEED)
+ goto L_Q_manaseed_touched;
+ mes "\"You have found an acual Mana Seed? That's impossible! Well, very unlikely... Then again, some others have told me similar rumours. I find it hard to believe that...\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Well, if it's true, then try touching it. It should do you no harm, but if you are very, very lucky, it just might grant you some minuscle magical power.\"";
+ next;
+ goto L_main_menu;
+
+L_Q_manaseed_touched:
+ if (MAGIC_FLAGS & MFLAG_DRANK_POTION)
+ goto L_Q_manaseed_prepared;
+ mes "\"So you touched the Mana Seed, and its power flowed right through you? You are lucky-- it is willing to share-- but you are also unlucky, in that you lack the discipline and control needed to contain this power.\"";
+ next;
+
+ if (MAGIC_FLAGS & MFLAG_KNOWS_MANAPOTION)
+ goto L_Q_manaseed_touched_short;
+
+ mes "[Auldsbel the Wizard]";
+ mes "\"Legend has it that you can substitute for such control by imbibing a Mana Potion. I am not sure whether that legend is true, but it might be worth trying out for you.\"";
+ next;
+
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_KNOWS_MANAPOTION;
+L_Q_manaseed_touched_short:
+ menu
+ "Where can I get a Mana Potion?", L_where_mana_potion,
+ "Can you make a Mana Potion?", L_make_mana_potion,
+ "Thank you.", -;
+ goto L_main_menu;
+
+L_where_mana_potion:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Well, quite a few alchemists should be able to brew one for you. Or maybe the village witch, even, though I personally would recommend seeing an alchemist.\"";
+ next;
+ goto L_Q_manaseed_touched_short;
+
+L_make_mana_potion:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Certainly, I can transmute some components into a Mana Potion for you. Let's see... I will need one pearl, 10,000 GP, about twenty Mauve leaves, and some Gamboge ones... ten should do, I think. Oh, and a bottle of water, of course.\"";
+ next;
+ menu
+ "Here you are.", -,
+ "I will look for those items.", L_main_menu,
+ "I'm not interested.", L_Q_manaseed_touched_short;
+
+ if (zeny < 10000)
+ goto L_make_mana_potion_missing;
+ if (countitem(@YELLOW) < 10)
+ goto L_make_mana_potion_missing;
+ if (countitem(@MAUVE) < 20)
+ goto L_make_mana_potion_missing;
+ if (countitem(@PEARL) < 1)
+ goto L_make_mana_potion_missing;
+ if (countitem(@BOTTLE_WATER) < 1)
+ goto L_make_mana_potion_missing;
+
+ set zeny, zeny - 10000;
+ delitem @YELLOW, 10;
+ delitem @MAUVE, 20;
+ delitem @PEARL, 1;
+ delitem @BOTTLE_WATER, 1;
+ getitem @MANA_POTION, 1;
+
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel pockets your GP and the pearl, then stuffs the leaves into the bottle. Holding the bottle between his hands, he focusses briefly. The water and leaves flash bright red, then the leaves dissolve.";
+ next;
+
+ mes "[Auldsbel the Wizard]";
+ mes "The wizard pours the resultant mixture into a different bottle. \"It will lose its power quickly if left in a glass bottle\", he explains.";
+ mes "He hands you the final result, which feels surprisingly heavy.";
+ next;
+
+ menu
+ "Thank you!", L_main_menu,
+ "What about the pearl and GP?", -;
+
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel raises his eyebrows in surprise.";
+ mes "\"Those were payment. You don't expect me to work for free, now do you?\"";
+ next;
+
+ goto L_main_menu;
+
+L_make_mana_potion_missing:
+ mes "[Auldsbel the Wizard]";
+ mes "\"No, I need one pearl, 10,000 GP, 20 Mauve leaves, 10 Gamboge leaves, and one bottle of water.\"";
+ next;
+ goto L_Q_manaseed_touched_short;
+
+L_Q_manaseed_prepared:
+ mes "\"So you found a Mana Seed and preprared yourself by drinking a mana potion? I recommend that you visit the seed again and see if that actually works...\"";
+ next;
+ goto L_main_menu;
+
+L_Q_manaseed_withmagic:
+ if (MAGIC_FLAGS & MFLAG_MANASEED_MAXEDOUT)
+ goto L_Q_manaseed_maxedout;
+ mes "\"I still find it hard to believe that you have found an actual Mana Seed here, in the middle of nowhere... Well, I suggest that you keep visiting it. As your control over magic grows, it may grant you additional power.\"";
+ next;
+ goto L_main_menu;
+
+L_Q_manaseed_maxedout:
+ mes "\"So the mana seed isn't giving you any more power? You might want to try again later; normally those seeds grow in power, over time.\"";
+ next;
+ goto L_main_menu;
+
+L_quest:
+ if (@Q_component_quest == 0)
+ goto L_component_quest_0;
+ if (@Q_component_quest == 1)
+ goto L_component_quest_1;
+ if (@Q_component_quest == 2)
+ goto L_component_quest_2;
+ if (@Q_component_quest == 3)
+ goto L_component_quest_3;
+ if (@Q_component_quest == 4)
+ goto L_component_quest_4;
+ if (@Q_component_quest == 5)
+ goto L_component_quest_5;
+ mes "[Auldsbel the Wizard]";
+ mes "\"You have been very helpful, but at this point I have everything I need. Except perhaps for a Wumpus Egg, though I have no idea where you could find one... If you ever come across one, I will give you a special reward for it, though.\"";
+ next;
+ goto L_main_menu;
+
+L_component_quest_0:
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel is visibly delighted.";
+ mes "\"Ah, indeed, indeed! I can often use help with my experiments, and you just happen to be arriving at a particularly opportune time. See, I found this...\"";
+ mes "He pulls something from his pocket and shows it to you.";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"It's a silk cocoon. This area has been virtually infested with silkworms, from what I have seen. This is splendid! I will try to... do something very special with this one. But for that I will need twenty Mauve leaves.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"There are plenty of Mauve plants around, so I'm sure that you won't have a hard time finding the leaves.\"";
+ next;
+ menu
+ "I have them here.", -,
+ "Sure, I will look for them.", L_main_menu;
+
+ if (countitem (@MAUVE) < 20)
+ goto L_component_quest_missing;
+
+ delitem @MAUVE, 20;
+ set zeny, zeny + 2500;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Well done, my young friend! Here are 2,500 GP to compensate you for your efforts.\"";
+ mes "[You gain 250 experience points]";
+ getexp 250, 0;
+ set @Q_component_quest, 1;
+ callsub S_update_var;
+ next;
+
+ goto L_main_menu;
+
+L_component_quest_1:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Good, good... I am trying to come up with a way to best use the Mauve leaves you brought me, but it seems that I will need further components. I am not sure about the exact composition yet, but I will need a few potions.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Please be a good " + @address$ + " and get me an iron potion, a concentration potion, and three small and three medium healing potions.\"";
+ next;
+ menu
+ "Here you are.", -,
+ "I'm not your 'good " + @address$ + "'!", L_main_menu,
+ "I'll see what I can do.", L_main_menu;
+
+ if (countitem (@SMALL_HEALING_POTION) < 3)
+ goto L_component_quest_missing;
+ if (countitem (@MEDIUM_HEALING_POTION) < 3)
+ goto L_component_quest_missing;
+ if (countitem (@IRON_POTION) < 1)
+ goto L_component_quest_missing;
+ if (countitem (@CONCENTRATION_POTION) < 1)
+ goto L_component_quest_missing;
+
+ delitem @SMALL_HEALING_POTION, 3;
+ delitem @MEDIUM_HEALING_POTION, 3;
+ delitem @IRON_POTION, 1;
+ delitem @CONCENTRATION_POTION, 1;
+ set zeny, zeny + 2500;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Ah, excellent, excellent! These are precisely what I needed. Here are another 2,500 GP to compensate you for your efforts.\"";
+ mes "[You gain 500 experience points]";
+ getexp 500, 0;
+ set @Q_component_quest, 2;
+ callsub S_update_var;
+ next;
+
+ goto L_main_menu;
+
+
+L_component_quest_2:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Ah! Excellent! Yes, yes, indeed I need help. I have managed to transmute the components you brought me into a liquid that I believe to be a demetamorphosis stock, but it seems that the details still need some fine-tuning, and I am out of silk cocoons...\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"I would like to run the next batch of experiments on a larger scale, though. Would you be so kind as to fetch me some one hundred silk cocoons, please?\"";
+ next;
+
+ menu
+ "One hundred cocoons, here you are.", -,
+ "That's a lot; I'll see what I can do.", L_main_menu;
+
+ if (countitem (@COCOON) < 100)
+ goto L_component_quest_missing;
+
+ delitem @COCOON, 20;
+ set zeny, zeny + 5000;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Splendid, splendid! Here are 5,000 GP for you.\"";
+ mes "Auldsbel attempts to cram the cocoons into his pockets, with little success. Finally he gives up and takes them into his hut.";
+ mes "[You gain 2,000 experience points]";
+ getexp 2000, 0;
+ set @Q_component_quest, 3;
+ callsub S_update_var;
+ next;
+
+ goto L_main_menu;
+
+L_component_quest_3:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Yes... I'm actually not certain that my demetamorphosis stock will not drain the life out of these little creatures. Perhaps an alchemical revitalization tincture would be called for. Fortunately this one is easy, I can make it myself.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"I'm still not sure how to integrate it into the spell... but leave that to me. Can you get me twenty-five red scorpion stingers and twenty-five lumps of maggot slime? Those should be just what I need.\"";
+ next;
+ menu
+ "Here are your stingers and slimes.", -,
+ "I will get back to you once I have them.", L_main_menu;
+
+ if (countitem (@RED_STINGER) < 25)
+ goto L_component_quest_missing;
+ if (countitem (@MAGGOT_SLIME) < 25)
+ goto L_component_quest_missing;
+
+ delitem @RED_STINGER, 25;
+ delitem @MAGGOT_SLIME, 25;
+ set zeny, zeny + 5000;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Good " + @address$ + "! Another 5,000 GP for you.\"";
+ mes "\"I believe that I have figured out one possible way to integrate the tincture into the spell... I will let you know how that goes.\"";
+ mes "[You gain 10,000 experience points]";
+ getexp 10000, 0;
+ set @Q_component_quest, 4;
+ callsub S_update_var;
+ next;
+
+ goto L_main_menu;
+
+L_component_quest_4:
+ mes "[Auldsbel the Wizard]";
+ mes "\"Hmmyes... See, the thing is that transmuting living beings is not normally something that transmutation magic can do. It seems that the beings' life force must be overcome to transmute them, but that in turn kills them.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"But I was wondering whether creatures that already can auto-transmute-- or metamorphose, as some people call it-- might not allow themselves to be subjected to magical transmutation more easily... Still, all of my demetamorphosis attempts so far have failed.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"I am thinking of injecting the life force of another creature, perhaps using some astral channelling. Snakes sound most promising, as they have a similar physical shape but a strong life force.\"";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Could you get me twenty regular, cave, and mountain snake tongues, please? So a total of sixty tongues. This is where most of their life force is concentrated, incidentally.\"";
+ next;
+ menu
+ "Here are your tongues.", -,
+ "I will hunt some snakes for you.", L_main_menu;
+
+ if (countitem (@SNAKE_TONGUE) < 20)
+ goto L_component_quest_missing;
+ if (countitem (@CAVE_SNAKE_TONGUE) < 20)
+ goto L_component_quest_missing;
+ if (countitem (@MOUNTAIN_SNAKE_TONGUE) < 20)
+ goto L_component_quest_missing;
+
+ delitem @SNAKE_TONGUE, 20;
+ delitem @CAVE_SNAKE_TONGUE, 20;
+ delitem @MOUNTAIN_SNAKE_TONGUE, 20;
+ set zeny, zeny + 8000;
+ mes "[Auldsbel the Wizard]";
+ mes "\"8,000 GP should cover your efforts, I think.\"";
+ mes "\"Now let's see if this works...\"";
+ mes "[You gain 40,000 experience points]";
+ getexp 40000, 0;
+ set @Q_component_quest, 5;
+ callsub S_update_var;
+ next;
+
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel focuses on the bundle of snake tongues, which begin to assume a bright red colour, then start to glow. Yellow sparks drop to the ground, as Auldsbel rolls the tongues into a ball.";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "He tosses in a cocoon, then squeezes everything together. A bright red flash blinds you momentarily.";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "As Auldsbel opens his hands, there is nothing there.";
+ next;
+ mes "[Auldsbel the Wizard]";
+ mes "He frowns. \"Their life force was still not strong enough. Hmm.\"";
+ next;
+
+ goto L_main_menu;
+
+L_component_quest_5:
+ mes "[Auldsbel the Wizard]";
+ mes "\"I do have another assignment for you, but this one will be tricky. I will need fifty grass snake tongues. I believe that this may be just enough life force to return the silkworm back to its original shape.\"";
+ next;
+ menu
+ "Here they are.", -,
+ "That's quite a challenge.", L_main_menu;
+
+ if (countitem (@GRASS_SNAKE_TONGUE) < 50)
+ goto L_component_quest_missing;
+
+ delitem @GRASS_SNAKE_TONGUE, 50;
+ set zeny, zeny + 10000;
+ mes "[Auldsbel the Wizard]";
+ mes "\"Excellent! Here are 10,000 GP for you, and now let's see how this goes.\"";
+ mes "[You gain 100,000 experience points]";
+ getexp 100000, 0;
+ set @Q_component_quest, 6;
+ callsub S_update_var;
+ next;
+
+ mes "[Auldsbel the Wizard]";
+ mes "Auldsbel rolls the snake tongues into a ball again, whilst chanting some words that you fail to discern. As the ball begins to glow, he tosses in a silkworm cocoon.";
+ mes "He then presses his hands together; you are blinded by a blue flash.";
+ next;
+
+ mes "[Auldsbel the Wizard]";
+ mes "The wizard steps back in horror.";
+ mes "\"Oh my... I should have known. I have stepped into Astral spell territory here. This is bad...\"";
+ mes "He mumbles a brief spell invocation.";
+ mes "\"I suggest that you run.\"";
+ next;
+
+ monster "this", 50, 68, "Grass Snake", 1034, 4;
+ close;
+
+L_component_quest_missing:
+ mes "[Auldsbel the Wizard]";
+ mes "\"No, you are missing some items. Come back later when you have everything!\"";
+ next;
+ goto L_main_menu;
+
+L_learn_spell:
+ mes "[Auldsbel the Wizard]";
+ next;
+ goto L_main_menu;
+
+S_update_var:
+ set @Q_status, @Q_main_status | (@Q_component_quest << 5);
+ set QUEST_MAGIC,
+ (QUEST_MAGIC & ~(@Q_MASK)
+ | (@Q_status << @Q_SHIFT));
+ return;
+}
diff --git a/npc/012-3_Cave/_import.txt b/npc/012-3_Cave/_import.txt
index 92995992..7d427ad8 100644
--- a/npc/012-3_Cave/_import.txt
+++ b/npc/012-3_Cave/_import.txt
@@ -1,4 +1,5 @@
map: 012-3.gat
npc: npc/012-3_Cave/_mobs.txt
npc: npc/012-3_Cave/_warps.txt
+npc: npc/012-3_Cave/mana-seed.txt
npc: npc/012-3_Cave/monsters.txt
diff --git a/npc/012-3_Cave/mana-seed.txt b/npc/012-3_Cave/mana-seed.txt
new file mode 100644
index 00000000..6ad8a37e
--- /dev/null
+++ b/npc/012-3_Cave/mana-seed.txt
@@ -0,0 +1,265 @@
+012-3.gat,62,130,0 script Mana Seed#MAGIC 166,{
+
+ setarray @magic_exp_needed,
+ 0, // level 0
+ 0,
+ 100,
+ 1200,
+ 8000,
+ 40000; // level 5
+
+ setarray @exp_bonus,
+ 0,
+ 1000, // level 1
+ 10000,
+ 100000,
+ 400000,
+ 2000000; // level 5
+
+ setarray @min_level,
+ 0,
+ 10,
+ 30,
+ 50,
+ 65,
+ 80; // level 5
+
+ set @visions_nr, 13;
+ setarray @visions$,
+ "You see a dark underground temple; you are kneeling, praying for the safety of the planet. You smile as a friend joins you in the dark-- but suddenly a shadow falls over you from above, and a stabbing pain...",
+ "It is midnight; you are in an underground cavern deep inside the desert ruins. Slowly, as if half-asleep, you wander up the spiral pathway, towards the ancient vase at its center. As you reach out to touch it...",
+ "The old castle smells of mildew and swamp gas. It has not been used in centuries, but you were here before, when the world was young. You turn to face your companions-- but something is wrong with all three; an ancient force has possessed them...",
+ "As you put the horn to your lips, you feel winds flowing, gathering, condensing in your chest. Soon, you can no longer contain it; the storm unleashes through your mouth, into a deafening fanfare. The black dome around you begins to crack...",
+ "You are alone inside your head, confined by the laughing man's circlet. Powerless, you witness how your hands shoot out flame after flame, incinerating innocents for that man's experiments...",
+ "The village may be in ruins, but it must have been where you grew up. The engravings on the walls-- images of powerful beasts-- look strangely familiar, and you can make out writing, words about you, wishes and prayers for you... You are at home...",
+ "Deep underneath the city, the rocky cavern maze turns into an opulent palace. This must be where the beast of the many eyes resides. Nervously you grip the wand; will the power to repel it be sufficient to defeat it and its magic?",
+ "At the bottom of the abyss, infinity opens before you. You have proven yourself worthy, and the ancient finally reveals its wisdom...",
+ "You may only be children, but you recognize that it is this man only who can save the world. As the walls rush towards you to crush your small group, you exchange a glance with your twin sister-- there is no doubt what you must do...",
+ "The sacred place is surrounded by nothingness; were it not for your magic, you would have no hope of returning. The old and young man stands nearby; he has been waiting for you, for centuries. He has all the time in the world, after all...",
+ "Nothing remains behind. The underground castle is empty now, its chambers plundered, its throne destroyed. Shivering, you climb down the stairs, towards the wailing of the underworld that is waiting beneath...",
+ "You feel soft, fluffy fur brushing against your skin and are filled with happines. Somehow, the word `" + getspellinvocation("happy-curse") + "' comes to mind...";
+
+ set @max_magic, 2;
+
+ set @has_magic, getskilllv(SKILL_MAGIC);
+ set @drank_potion, MAGIC_FLAGS & MFLAG_DRANK_POTION;
+ set @knows_seed, MAGIC_FLAGS & MFLAG_KNOWS_MANASEED;
+
+ if (@has_magic)
+ goto L_magic_start;
+
+ if (@knows_seed)
+ goto L_quick_nomagic;
+
+ // first time here
+
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_KNOWS_MANASEED;
+
+ mes "[Mana Seed]";
+ mes "You see a glowing orb, swimming in the water like a sea rose.";
+ mes "An unearthly glow is emanating from within, lighting up the water and filling the cave with an eerie light.";
+ next;
+
+ mes "[Mana Seed]";
+ if (@drank_potion)
+ mes "Slowly, the tingling sensation you felt before begins to spread through your body again.";
+ mes "What would you like to do?";
+ next;
+ goto L_nomagic_mainmenu;
+
+L_quick_nomagic:
+ mes "[Mana Seed]";
+ mes "Again you stand before the orb.";
+ if (@drank_potion)
+ mes "Slowly, the tingling sensation you felt before begins to spread through your body again.";
+ mes "What would you like to do?";
+ next;
+
+ goto L_nomagic_mainmenu;
+
+// Non-Magic main menu ------------------------------------------------------------
+L_nomagic_mainmenu:
+ menu "Examine it more closely", L_nomagic_examine,
+ "Take it with you", L_nomagic_touch,
+ "Touch it", L_nomagic_touch,
+ "Throw a rock at it", L_nomagic_throwrock,
+ "Destroy it", L_nomagic_destroy,
+ "Leave it alone", L_end;
+ close;
+
+L_nomagic_examine:
+ mes "[Mana Seed]";
+ mes "The orb seems to be perfectly round and emitting a steady glow. It appears to be floating in the water.";
+ next;
+ goto L_nomagic_mainmenu;
+
+L_nomagic_throwrock:
+ mes "[Mana Seed]";
+ mes "Your rock makes hardly a sound as it strikes the orb and glances off into the water, leaving neither scratch nor impression.";
+ mes "The orb budges slightly, but then floats back into its old position, as if it were tethered into place.";
+ next;
+ goto L_nomagic_mainmenu;
+
+L_nomagic_touch:
+ mes "[Mana Seed]";
+ if (@drank_potion)
+ goto L_magic_level_1;
+ mes "As you touch the orb, you feel a terrible force within, separated from you by only the thinnest of membranes-- like a tempest, all packed up in one tiny waterskin.";
+ next;
+ mes "[Mana Seed]";
+ mes "For one instant you feel that force rushing past your hands, through your body, as if you had unleashed this tempest upon yourself. Unable to contain the power, you stumble backwards, away from the orb.";
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_TOUCHED_MANASEED;
+ next;
+ goto L_nomagic_mainmenu;
+
+L_magic_level_1:
+ if (getskilllv(SKILL_MAGIC))
+ goto L_end; // shouldn't be happening
+
+ mes "Again you feel the tempest rushing through the Mana Seed's membrane, into your body. You only manage to hold on to it for an instant and find yourself forced to pull your hands away again quickly.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "But this time something is different-- that tingling sensation is back, and stronger than before. It is spreading through your body, head to toes, and you feel yourself brimming with energy.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "It is a light-headed feeling, and you find yourself forced to sit down for a few seconds to recover.";
+ mes "Something is different. A new power has grown within you and is waiting to be understood.";
+ mes "[1000 experience points]";
+ next;
+
+ skill SKILL_MAGIC, 1;
+ getexp 1000, 0;
+ next;
+
+ goto L_end;
+
+L_nomagic_destroy:
+ mes "[Mana Seed]";
+ mes "Try as you might, the orb seems impervious to all forms of attack you can fathom. You are forced to abandon your efforts.";
+ next;
+ goto L_nomagic_mainmenu;
+
+// Magic main menu ------------------------------------------------------------
+L_magic_start:
+ mes "[Mana Seed]";
+ mes "The Mana Seed is still in the same place as during your last visit, spreading its light throughout the cavern.";
+ mes "What would you like to do?";
+ next;
+
+L_magic_mainmenu:
+ menu "Touch it", L_magic_touch,
+ "Destroy it", L_magic_destroy,
+ "Leave it alone", L_end;
+ close;
+
+L_magic_touch:
+ mes "[Mana Seed]";
+ mes "You touch the Mana Seed again.";
+
+ if (getskilllv(SKILL_MAGIC) >= @max_magic)
+ goto L_magic_maxed_out;
+
+ set @exp_needed, @magic_exp_needed[getskilllv(SKILL_MAGIC) + 1];
+ set @magic_exp, MAGIC_EXPERIENCE & 65535;
+ if (@magic_exp >= @exp_needed)
+ goto L_magic_levelup;
+
+ set @prev_exp_needed, @magic_exp_needed[getskilllv(SKILL_MAGIC)];
+ set @exp_diff, @exp_needed - @prev_exp_needed;
+ set @index, ((@magic_exp - @prev_exp_needed) * 5) / @exp_diff;
+ setarray @messages$,
+ "The orb's energy effortlessly rushes through you, ignoring your feeble attempts at containing it. You will need considerably more practice with your magical skills before you can hope to contain it.",
+ "You only barely manage to hang on to some strands of the orb's energy, but not enough to contain it. You still need noticeably more practice with your magical skills.",
+ "The orb's powers are still no match for you; you will need more practice to contain more of its powers.",
+ "You feel close to being able to contain the orb's powers. Still, some more practice is needed.",
+ "The orb's energy only barely evades your attempts at containing it. Soon you will be able to extract more power from it.";
+
+ mes @messages$[@index];
+ next;
+ goto L_magic_mainmenu;
+
+L_magic_levelup:
+ set @baselevel_needed, @min_level[getskilllv(SKILL_MAGIC) + 1];
+ if (base_level < @baselevel_needed)
+ goto L_insufficient_baselevel;
+ mes "Its energy permeates you, surrounds you. You are suddenly uncertain if it is you who is containing the orb's powers or if it is the orb who is seeking out yours.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "The Seed's tempest is calming beneath your hands, and its energies resonate with yours.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "A feeling of harmony is spreading through your body, and the tingling sensation is back, within and without.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "As the tingling increases, you feel light-headed, weightless.";
+ mes "Everything fades...";
+ next;
+
+ mes "Both the tingling and the sense of harmony have vanished, making room for darkness. You can't feel the Mana Seed anymore...";
+ next;
+
+ mes "... you can't feel anything.";
+ next;
+
+ mes "You are floating...";
+ next;
+
+ mes "The darkness is no longer complete. You begin to make out stars in the distance, circling each other, dancing a cosmic dance.";
+ next;
+
+ mes "Images rush past you, shadows of thoughts and dreams. Some touch you, filling you with powerful emotions-- despair, extasy; sometimes loss, sometimes hope; hate, love.";
+ next;
+
+ mes "Someone else's thoughts pass through your mind...";
+ next;
+
+ set @nr, rand(@visions_nr);
+ mes @visions$[@nr];
+ next;
+
+ mes "The image fades.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "You awaken, lying on the ground.";
+ next;
+
+ mes "[Mana Seed]";
+ mes "Something has changed... you feel more confident in your magical abilities.";
+
+ skill SKILL_MAGIC, 1 + getskilllv(SKILL_MAGIC);
+ set @exp, @exp_bonus[getskilllv(SKILL_MAGIC)];
+ itemheal 0, 10000;
+ getexp @exp, 0;
+ mes "[" + @exp + " experience points]";
+ next;
+
+ goto L_magic_end;
+
+L_magic_maxed_out:
+ mes "Strangely, you feel nothing, as if its membrane had closed towards you.";
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_MANASEED_MAXEDOUT;
+ next;
+
+ goto L_magic_mainmenu;
+
+L_insufficent_baselevel:
+ mes "Its energies rush through you. You fight to keep them under control, to contain them in your body. Alas, your body is too frail-- you have to let go.";
+ mes "Frustrated, you give up. You have the skill needed to control this power, but you will have to grow up some more before your body can handle it.";
+ next;
+ goto L_magic_mainmenu;
+
+L_magic_destroy:
+ mes "[Mana Seed]";
+ mes "Try as you might, you cannot find a way, magical or physical, to destroy the seed. Frustrated, you give up.";
+ next;
+ goto L_magic_mainmenu;
+
+L_end:
+ close;
+}
diff --git a/npc/013-3_Cave/barrier.txt b/npc/013-3_Cave/barrier.txt
index 90d10ce5..004452f9 100644
--- a/npc/013-3_Cave/barrier.txt
+++ b/npc/013-3_Cave/barrier.txt
@@ -1,6 +1,6 @@
//
-013-3.gat,71,21,0 script #DemonMineBarrier1 127,1,1,{
+013-3.gat,71,21,0 script #DemonMineBarrier1#_M 127,1,1,{
if (QUEST_demon_mines >= 2) close;
if (QUEST_demon_mines == 1 && countitem(1198) >= 1) goto L_Has_Jack_O_Soul;
diff --git a/npc/018-1_Woodland_mining_camp/_import.txt b/npc/018-1_Woodland_mining_camp/_import.txt
index 9be2065c..06c8a307 100644
--- a/npc/018-1_Woodland_mining_camp/_import.txt
+++ b/npc/018-1_Woodland_mining_camp/_import.txt
@@ -2,3 +2,4 @@ map: 018-1.gat
npc: npc/018-1_Woodland_mining_camp/_mobs.txt
npc: npc/018-1_Woodland_mining_camp/_warps.txt
npc: npc/018-1_Woodland_mining_camp/miners.txt
+npc: npc/018-1_Woodland_mining_camp/sword.txt
diff --git a/npc/018-1_Woodland_mining_camp/sword.txt b/npc/018-1_Woodland_mining_camp/sword.txt
new file mode 100644
index 00000000..7352384d
--- /dev/null
+++ b/npc/018-1_Woodland_mining_camp/sword.txt
@@ -0,0 +1,12 @@
+018-1.gat,110,43,0 script #IceSword#_M 127,{
+ if (getskilllv(SKILL_MAGIC))
+ goto L_message;
+
+ close;
+
+L_message:
+ mes "[Sword in Pond]";
+ mes "\"Zzzzzz.....\"";
+ next;
+ close;
+}
diff --git a/npc/018-3_Cave/_import.txt b/npc/018-3_Cave/_import.txt
index cf5a8562..2f30ca7c 100644
--- a/npc/018-3_Cave/_import.txt
+++ b/npc/018-3_Cave/_import.txt
@@ -2,3 +2,4 @@ map: 018-3.gat
npc: npc/018-3_Cave/_mobs.txt
npc: npc/018-3_Cave/_warps.txt
npc: npc/018-3_Cave/bookcase.txt
+npc: npc/018-3_Cave/sword.txt
diff --git a/npc/018-3_Cave/sword.txt b/npc/018-3_Cave/sword.txt
new file mode 100644
index 00000000..c4a62a8a
--- /dev/null
+++ b/npc/018-3_Cave/sword.txt
@@ -0,0 +1,12 @@
+018-3.gat,71,127,0 script #DemonSword#_M 127,{
+ if (getskilllv(SKILL_MAGIC))
+ goto L_message;
+
+ close;
+
+L_message:
+ mes "[Sword in Rock]";
+ mes "\"Ouch... my head...\"";
+ next;
+ close;
+}
diff --git a/npc/functions/magic.txt b/npc/functions/magic.txt
new file mode 100644
index 00000000..9cce48c2
--- /dev/null
+++ b/npc/functions/magic.txt
@@ -0,0 +1,19 @@
+// Basic magic functionality
+
+// Magic system uses:
+// - MAGIC_EXP (magic experience points, gained for spellcasting)
+// - MAGIC_FLAGS
+
+// ------------------------------------------------------------
+// Gain initial magic skill
+// ------------------------------------------------------------
+function script MagicGainBasic {
+
+ set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_DRANK_POTION;
+ close;
+
+}
+
+function script MagicGainExp {
+ set MAGIC_EXP, MAGIC_EXP + (@value * @value);
+}