summaryrefslogtreecommitdiff
path: root/conf/magic.conf
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-11-29 14:19:55 -0700
committerFate <fate-tmw@googlemail.com>2008-11-29 14:19:55 -0700
commitf763e5f1d4ccae17321c305794b78fd0f103d901 (patch)
tree9e15b314c9091b1ae00ab014b71c63e2595fe8e3 /conf/magic.conf
parent93fa76598a16b915595a4cbc1d28fe4350401cb1 (diff)
downloadserverdata-f763e5f1d4ccae17321c305794b78fd0f103d901.tar.gz
serverdata-f763e5f1d4ccae17321c305794b78fd0f103d901.tar.bz2
serverdata-f763e5f1d4ccae17321c305794b78fd0f103d901.tar.xz
serverdata-f763e5f1d4ccae17321c305794b78fd0f103d901.zip
Spell adjustments
Diffstat (limited to 'conf/magic.conf')
-rw-r--r--conf/magic.conf152
1 files changed, 121 insertions, 31 deletions
diff --git a/conf/magic.conf b/conf/magic.conf
index 390df589..5ae0bba1 100644
--- a/conf/magic.conf
+++ b/conf/magic.conf
@@ -40,6 +40,13 @@ 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 = 1
+
# Default sfx on caster
PROCEDURE default_effect() =
sfx(caster, school - MAGIC + 2, 0);
@@ -47,8 +54,54 @@ 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?
@@ -115,85 +168,123 @@ 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 lesser-heal (target : STRING) : "#imx" =
+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, "PileOfAsh", 50);
+ CALL gain_xp(1);
+
+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, 900, 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, 900, 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 strstr(name_of(n), "#MAGIC") || strstr(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);
#--------------------------------------------------------------------------------
@@ -642,4 +733,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.");
-