summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-06-16 19:07:28 +0000
committerFate <fate-tmw@googlemail.com>2009-06-16 19:07:28 +0000
commit14bce66d32c572f69718f3bfe25eb16213705e50 (patch)
tree96e7256cbbf73b4cf79473ee0775fa72b4b77b3c
parent019faa40cd140261846320d1741f3872b8d36e81 (diff)
downloadserverdata-14bce66d32c572f69718f3bfe25eb16213705e50.tar.gz
serverdata-14bce66d32c572f69718f3bfe25eb16213705e50.tar.bz2
serverdata-14bce66d32c572f69718f3bfe25eb16213705e50.tar.xz
serverdata-14bce66d32c572f69718f3bfe25eb16213705e50.zip
Added SkillUp function and used it whenever we magic-skill-up
-rw-r--r--db/const.txt8
-rw-r--r--npc/001-1_Tulimshar/elanore.txt16
-rw-r--r--npc/005-1_Snake_desert/spirit.txt13
-rw-r--r--npc/009-2_Hurnscald/wyara.txt13
-rw-r--r--npc/009-3_Cave_beneath_Hurnscald/sword.txt4
-rw-r--r--npc/011-1_Woodland/auldsbel.txt23
-rw-r--r--npc/012-3_Cave/mana-seed.txt17
-rw-r--r--npc/013-1_Woodland_hills/sagatha.txt59
-rw-r--r--npc/015-1_Woodland/sword.txt13
-rw-r--r--npc/functions/magic.txt25
10 files changed, 125 insertions, 66 deletions
diff --git a/db/const.txt b/db/const.txt
index 3091efb3..abd3b5e6 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -154,6 +154,14 @@ cDarkGreen 9
sc_poison 132
sc_slowpoison 14
+sfx_skillup 1
+sfx_magic_generic 2
+sfx_magic_life 3
+sfx_magic_war 4
+sfx_magic_transmute 5
+sfx_magic_nature 6
+sfx_magic_astral 7
+
NIBBLE_0_SHIFT 0
NIBBLE_0_MASK 15
diff --git a/npc/001-1_Tulimshar/elanore.txt b/npc/001-1_Tulimshar/elanore.txt
index 2157a8dd..0b0b9c92 100644
--- a/npc/001-1_Tulimshar/elanore.txt
+++ b/npc/001-1_Tulimshar/elanore.txt
@@ -28,6 +28,10 @@ function script ElanoreFix {
set @Q_status, (QUEST_MAGIC2 & @Q_MASK) >> @Q_SHIFT;
set @Q_heal_exp, MAGIC_EXPERIENCE >> 24;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_LIFE;
+ set @SUP_name$, "Life Magic";
+
set @STATUS_INITIAL, 0;
set @STATUS_LEARNED_LIGHT_HEAL, 1;
set @STATUS_MASTERED_LIGHT_HEAL, 2;
@@ -336,14 +340,12 @@ L_Teach_AdvanceTo2_skip:
mes "[Elanore the Healer]";
mes "You feel a strange, tingling kind of warmth spread through your body.";
- mes "[5000 experience points]";
- mes "[Level 2 in Life Magic]";
set @Q_status, @STATUS_MASTERED_LIGHT_HEAL;
callsub S_update_var;
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_LIFE) < 2)
- setskill SKILL_MAGIC_LIFE, 2;
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callfunc "SkillUp";
close;
L_Teach_CheckAdvanceTo2_fail:
@@ -628,8 +630,8 @@ L_CurePoison:
mes "She performs a complicated gesture.";
sc_end(sc_poison);
sc_end(sc_slowpoison);
- misceffect 3, strcharinfo(0);
- misceffect 3;
+ misceffect sfx_magic_life, strcharinfo(0);
+ misceffect sfx_magic_life;
next;
diff --git a/npc/005-1_Snake_desert/spirit.txt b/npc/005-1_Snake_desert/spirit.txt
index a7f8dd04..1af21869 100644
--- a/npc/005-1_Snake_desert/spirit.txt
+++ b/npc/005-1_Snake_desert/spirit.txt
@@ -8,6 +8,10 @@ L_message:
set @Q_SHIFT, NIBBLE_0_SHIFT;
set @Q_status, (QUEST_MAGIC2 & @Q_MASK) >> @Q_SHIFT;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_NATURE;
+ set @SUP_name$, "Nature Magic";
+
set @Q_STATUS_INITIAL, 0;
set @Q_STATUS_ONQUEST, 1;
set @Q_STATUS_STUDENT0, 2;
@@ -158,12 +162,9 @@ L_Q_magic_1:
mes "[Earth Spirit]";
mes "\"Well done, very well done! Consider yourself my student now.\"";
- mes "[5000 experience points]";
- if (getskilllv(SKILL_MAGIC_NATURE) < 2)
- mes "[Level 2 in Nature Magic]";
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_NATURE) < 2)
- setskill SKILL_MAGIC_NATURE, 2;
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callfunc "SkillUp";
next;
set @Q_status, @Q_STATUS_STUDENT0;
diff --git a/npc/009-2_Hurnscald/wyara.txt b/npc/009-2_Hurnscald/wyara.txt
index e82457e0..01793fee 100644
--- a/npc/009-2_Hurnscald/wyara.txt
+++ b/npc/009-2_Hurnscald/wyara.txt
@@ -6,6 +6,10 @@
set @Q_SHIFT, NIBBLE_2_SHIFT;
set @Q_status, (QUEST_MAGIC2 & @Q_MASK) >> @Q_SHIFT;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_NATURE;
+ set @SUP_name$, "Nature Magic";
+
set @STATUS_INITIAL, 0;
set @STATUS_PURIFY_EXPLAINED, 1;
set @STATUS_PURIFY_ONCE, 2;
@@ -433,12 +437,11 @@ L_Magic_purify_done:
mes "[Wyara the Witch]";
mes "Slowly, the sensation recedes, but you feel changed.";
- mes "[5000 experience points]";
- mes "[Level 2 in Nature Magic]";
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_NATURE) < 2)
- setskill SKILL_MAGIC_NATURE, 2;
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callfunc "SkillUp";
+
set @Q_status, @STATUS_PURIFY_OVER;
callsub S_update_var;
close;
diff --git a/npc/009-3_Cave_beneath_Hurnscald/sword.txt b/npc/009-3_Cave_beneath_Hurnscald/sword.txt
index 2b5c5f75..2ff1d958 100644
--- a/npc/009-3_Cave_beneath_Hurnscald/sword.txt
+++ b/npc/009-3_Cave_beneath_Hurnscald/sword.txt
@@ -8,6 +8,10 @@ L_message:
set @Q_SHIFT, NIBBLE_6_SHIFT;
set @Q_status, (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_WAR;
+ set @SUP_name$, "War Magic";
+
set @STATUS_INITIAL, 0;
set @STATUS_LEARNED_FLAREDART, 1;
set @STATUS_LEARNED_MAGICBLADE, 2;
diff --git a/npc/011-1_Woodland/auldsbel.txt b/npc/011-1_Woodland/auldsbel.txt
index ea83ab57..fd4e2b47 100644
--- a/npc/011-1_Woodland/auldsbel.txt
+++ b/npc/011-1_Woodland/auldsbel.txt
@@ -5,6 +5,10 @@
set @mexp, MAGIC_EXPERIENCE & 65535;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_TRANSMUTE;
+ set @SUP_name$, "Transmutation Magic";
+
set @Q_STATUS_INITIAL, 0;
set @Q_STATUS_POSTINTRO, 1;
set @Q_STATUS_INITIATION, 2; // quest for being able to cast `create mouboo figurine'
@@ -909,6 +913,7 @@ L_component_quest_5:
mes "\"I suggest that you run.\"";
next;
+ misceffect sfx_magic_transmute;
monster "this", 50, 68, "Grass Snake", 1034, 4;
close;
@@ -1021,14 +1026,13 @@ LL_initiation_check:
mes "[Auldsbel the Wizard]";
mes "You feel new powers flowing into your body!";
- mes "[5000 experience points]";
- mes "[Level 2 in Transmutation Magic]";
set @Q_main_status, @Q_STATUS_STUDENT;
callsub S_update_var;
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_TRANSMUTE) < 2)
- setskill SKILL_MAGIC_TRANSMUTE, 2;
+
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callfunc "SkillUp";
next;
goto L_main_menu;
@@ -1235,14 +1239,13 @@ LL_student_4:
set @Q_main_status, @Q_STATUS_STUDENT5;
callsub S_update_var;
- getexp 30000, 0;
- if (getskilllv(SKILL_MAGIC_TRANSMUTE) < 3)
- setskill SKILL_MAGIC_TRANSMUTE, 3;
mes "[Auldsbel the Wizard]";
mes "You feel new powers flowing into your body!";
- mes "[30000 experience points]";
- mes "[Level 3 in Transmutation Magic]";
+
+ set @SUP_xp, 30000;
+ set @SUP_lvl, 3;
+ callfunc "SkillUp";
next;
goto L_main_menu;
diff --git a/npc/012-3_Cave/mana-seed.txt b/npc/012-3_Cave/mana-seed.txt
index 30f9776e..982e8eb6 100644
--- a/npc/012-3_Cave/mana-seed.txt
+++ b/npc/012-3_Cave/mana-seed.txt
@@ -45,6 +45,10 @@
set @drank_potion, MAGIC_FLAGS & MFLAG_DRANK_POTION;
set @knows_seed, MAGIC_FLAGS & MFLAG_KNOWS_MANASEED;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC;
+ set @SUP_name$, "Magic";
+
if (@has_magic)
goto L_magic_start;
@@ -126,9 +130,9 @@ L_magic_level_1:
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]";
- setskill SKILL_MAGIC, 1;
- getexp 1000, 0;
+ set @SUP_xp, 1000;
+ set @SUP_lvl, 1;
+ callfunc "SkillUp";
next;
goto L_end;
@@ -230,11 +234,10 @@ L_magic_levelup:
mes "[Mana Seed]";
mes "Something has changed... you feel more confident in your magical abilities.";
- setskill SKILL_MAGIC, 1 + getskilllv(SKILL_MAGIC);
- set @exp, @exp_bonus[getskilllv(SKILL_MAGIC)];
+ set @SUP_xp, @exp_bonus[1 + getskilllv(SKILL_MAGIC)];
+ set @SUP_lvl, 1 + getskilllv(SKILL_MAGIC);
+ callfunc "SkillUp";
itemheal 0, 10000;
- getexp @exp, 0;
- mes "[" + @exp + " experience points]";
next;
goto L_end;
diff --git a/npc/013-1_Woodland_hills/sagatha.txt b/npc/013-1_Woodland_hills/sagatha.txt
index ffa42aa8..f1f14130 100644
--- a/npc/013-1_Woodland_hills/sagatha.txt
+++ b/npc/013-1_Woodland_hills/sagatha.txt
@@ -35,26 +35,6 @@ L_write:
}
//----------------------------------------
-function script SagathaHatAttack {
- mes "The witch seems to be trembling with disgust as she stares at your headgear.";
- mes "\"Do you think that is funny?\" she snarls.";
- next;
- if (MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA)
- mes "[Sagatha the Witch]";
- if (!(MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA))
- mes "[Witch]";
-
- mes "\"You have no idea what that poor creature felt!\"";
- mes "She snaps her fingers.";
- mes "\"Let me show you...\"";
- misceffect 4, strcharinfo(0);
- misceffect 4;
- heal -300, 0;
- next;
- return;
-}
-
-//----------------------------------------
function script SagathaStatus {
if (getequipid(equip_head) != 1216 && getequipid(equip_head) != 752)
goto L_next;
@@ -110,7 +90,7 @@ L_next:
// if fluffyhat
if (getequipid(equip_head) == 752)
- callfunc "SagathaHatAttack";
+ goto L_hat_attack;
if (@evil)
goto L_evil;
@@ -146,6 +126,23 @@ L_next:
close;
+L_hat_attack:
+ mes "The witch seems to be trembling with disgust as she stares at your headgear.";
+ mes "\"Do you think that is funny?\" she snarls.";
+ next;
+ if (MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA)
+ mes "[Sagatha the Witch]";
+ if (!(MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA))
+ mes "[Witch]";
+
+ mes "\"You have no idea what that poor creature felt!\"";
+ mes "She snaps her fingers.";
+ mes "\"Let me show you...\"";
+ misceffect sfx_magic_war, strcharinfo(0);
+ misceffect sfx_magic_war;
+ heal -300, 0;
+ close;
+
L_intro_name:
mes "[Sagatha the Witch]";
mes "\"They call me Sagatha.\"";
@@ -213,14 +210,12 @@ L_teach_initial:
mes "[Sagatha the Witch]";
mes "She snaps her fingers, and without warning you begin to acutely sense the magical energies around you, for a brief instant!";
- mes "[5000 experience points]";
- mes "[Level 2 in Astral Magic]";
set @Q_status, @STATUS_STUDENT;
callsub S_update_var;
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_ASTRAL) < 2)
- setskill SKILL_MAGIC_ASTRAL, 2;
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callsub S_up_astral;
next;
mes "[Sagatha the Witch]";
@@ -420,6 +415,18 @@ L_Q_auldsbel:
L_close:
close;
+S_up_astral:
+ set @SUP_id, SKILL_MAGIC_ASTRAL;
+ set @SUP_name$, "Astral Magic";
+ callfunc "SkillUp";
+ return;
+
+S_up_nature:
+ set @SUP_id, SKILL_MAGIC_NATURE;
+ set @SUP_name$, "Nature Magic";
+ callfunc "SkillUp";
+ return;
+
S_update_var:
set QUEST_MAGIC,
(QUEST_MAGIC & ~(@Q_MASK)
diff --git a/npc/015-1_Woodland/sword.txt b/npc/015-1_Woodland/sword.txt
index 1536fb52..5c154e46 100644
--- a/npc/015-1_Woodland/sword.txt
+++ b/npc/015-1_Woodland/sword.txt
@@ -8,6 +8,10 @@ L_message:
set @Q_SHIFT, NIBBLE_6_SHIFT;
set @Q_status, (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;
+ // Set up SkillUp function
+ set @SUP_id, SKILL_MAGIC_WAR;
+ set @SUP_name$, "War Magic";
+
set @STATUS_INITIAL, 0;
set @STATUS_LEARNED_FLAREDART, 1;
set @STATUS_LEARNED_MAGICBLADE, 2;
@@ -218,14 +222,13 @@ L_Levelup2_yes:
mes "[Mystic Sword]";
mes "The sensation and the noises vanish as quickly as they came.";
- mes "[5000 experience points]";
- mes "[Level 2 in War Magic]";
set @Q_status, @STATUS_LEVEL2;
callsub S_update_var;
- getexp 5000, 0;
- if (getskilllv(SKILL_MAGIC_WAR) < 2)
- setskill SKILL_MAGIC_WAR, 2;
+
+ set @SUP_xp, 5000;
+ set @SUP_lvl, 2;
+ callfunc "SkillUp";
next;
mes "[Mystic Sword]";
diff --git a/npc/functions/magic.txt b/npc/functions/magic.txt
index 0094e94a..2bf8ef64 100644
--- a/npc/functions/magic.txt
+++ b/npc/functions/magic.txt
@@ -136,3 +136,28 @@ L_Q_post_imp:
set @c, @choice_idx[@menu];
return @c;
}
+
+
+// ------------------------------------------------------------
+// Level up a skill
+// @SUP_id skill ID to level up
+// @SUP_lvl skill level to attain
+// @SUP_name$ name of the skill to level up
+// @SUP_xp # of experience points to award if the level up succeeds
+// ------------------------------------------------------------
+function script SkillUp {
+ if (getskilllv(@SUP_id) >= @SUP_lvl)
+ goto L_shortcut;
+
+ misceffect sfx_skillup, strcharinfo(0);
+ setskill @SUP_id, @SUP_lvl;
+ getexp @SUP_xp, 0;
+ if (@SUP_xp)
+ mes "[" + @SUP_xp + " experience points]";
+ mes "[Level " + @SUP_lvl + " in " + @SUP_name$ + "]";
+ return;
+
+L_shortcut:
+ mes "[You already have level " + getskilllv(@SUP_id) + " in " + @SUP_name$ + "]";
+ return;
+}