From 4e279bcf145eac9ebf49b95a702a1fc62680a10a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 13 Jul 2018 23:01:44 -0300 Subject: Introduce #parum and the Magic Experience System. If you re-cast something, no Mana Exp Points are gained. Only pseudo-magic skills count. --- db/re/item_db.conf | 19 +++++++++++++++ db/re/skill_db.conf | 9 +++++++ npc/config/magic.txt | 47 ++++++++++++++++++++++++++--------- npc/magic/parum.txt | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ npc/magic/zarkor.txt | 5 +++- npc/scripts.conf | 1 + 6 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 npc/magic/parum.txt diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 4314e1ab9..e648aa379 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -4410,6 +4410,25 @@ item_db: ( Sell: 5 Weight: 10 }, +{ + Id: 883 + AegisName: "WarpedLog" + Name: "Warped Log" + Type: "IT_ETC" + Buy: 15 + Sell: 5 + Weight: 8 +}, +{ + Id: 884 + AegisName: "MoubooFigurine" + Name: "Mouboo Figurine" + Type: "IT_ETC" + Buy: 45 + Sell: 15 + Weight: 9 +}, + // { Id: 1000 diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf index 9a28f9f13..6b387fdb5 100644 --- a/db/re/skill_db.conf +++ b/db/re/skill_db.conf @@ -38347,6 +38347,15 @@ skill_db: ( Self: true } }, +{ + Id: 20024 + Name: "TMW2_PARUM" + Description: "Wood Transmutation" + MaxLevel: 1 + SkillType: { + Self: true + } +}, { Id: 20031 Name: "TMW2_FAKESKILL" diff --git a/npc/config/magic.txt b/npc/config/magic.txt index 1617bfeff..587b2f081 100644 --- a/npc/config/magic.txt +++ b/npc/config/magic.txt @@ -5,24 +5,30 @@ // // Used for our pseudo-magic. // These are only helpers, you can add more restrictions and effects freely. +// Important Variables: MAGIC_EXP, LAST_SKILL -// SkillID, Mana, MobID{, MP per level, MobPerSkillLevel=2} -function script SummonMagic { +// SkillID, EXP Points +function script GetManaExp { .@sk=getarg(0); - .@mp=getarg(1); - .@id=getarg(2); - .@adj=getarg(4,2); - - if (.@adj < 1) { - debugmes "\033[31mInvalid MobPerSkillLevel for SummonMagic (.@adj): "+.@adj+"\033[0m"; - dispbottom l("Invalid parameter specified, blame saulc."); + .@pt=getarg(1); + if (LAST_SKILL == .@sk) end; - } + LAST_SKILL=.@sk; + MAGIC_EXP=MAGIC_EXP+.@pt; + end; +} +// SkillID, Mana{, MP per level} +function script MagicCheck { // PRE EXECUTION + // Load Variables + .@sk=getarg(0); + .@mp=getarg(1); + .@amp=getarg(2,0); + // Check Skill if (getskilllv(.@sk) < 1) - end; + return 0; // Load mana cost .@amp=getarg(3,0); @@ -31,9 +37,28 @@ function script SummonMagic { // Check mana if (readparam(Sp) < .@mp) { dispbottom l("Insufficient mana: @@/@@.", readparam(Sp), .@mp); + return 0; + } + return 1; +} + +// SkillID, Mana, MobID{, MP per level, MobPerSkillLevel=2} +function script SummonMagic { + .@sk=getarg(0); + .@mp=getarg(1); + .@id=getarg(2); + .@adj=getarg(4,2); + + if (.@adj < 1) { + debugmes "\033[31mInvalid MobPerSkillLevel for SummonMagic (.@adj): "+.@adj+"\033[0m"; + dispbottom l("Invalid parameter specified, blame saulc."); end; } + // PRE EXECUTION + if (!MagicCheck(.@sk, .@mp, .@amp)) + end; + // EXECUTION // Apply costs diff --git a/npc/magic/parum.txt b/npc/magic/parum.txt new file mode 100644 index 000000000..951a71699 --- /dev/null +++ b/npc/magic/parum.txt @@ -0,0 +1,69 @@ +// TMW2 script +// Author: Jesusalva +// +// Magic Script: TMW2_PARUM +// +// Attempts to transmutate Raw Logs. +// May create arrows, Mouboo Figurines, Warped Logs. +// With enough ManaExp may create WoodenLog. +// Is not powerful enough to create overly complex stuff like Wooden Sword, Wooden Shield or Wooden Bow +// Final item is random + +- script sk#parum 32767,{ + end; + +/* +OnFriendlyDeath: + emote 4; + end; +*/ + +OnCall: + // Other requeriments + if (countitem(RawLog) < 1) { + dispbottom l("You need @@ to cast this skill.", getitemlink(RawLog)); + end; + } + + // Check cooldown + /* TODO */ + // This will only vanish upon logout =/ + if (@parum_at > gettimetick(2)) { + dispbottom l("Skill is in cooldown."); + end; + } + + // Check requisites + if (!MagicCheck(TMW2_PARUM, 50)) + end; + + // Create the stuff based on MAGIC_EXP + .@r=rand(1,41); + if (.@r < 42-(MAGIC_EXP/2)) { + getitem WarpedLog, 1; + } else { + if (.@r > 30) + getitem MoubooFigurine, 1; + else if (.@r > 20 && MAGIC_EXP > 82) + getitem WoodenLog, 1; + else + getitem Arrow, .@r; + } + // I know, the code is not very sane. A number from 0 to 40 is cast. + // You will get lots of useless Warped Logs until you have 82 MExp. + // If you do not get a Warped Log, you have 25% chances of getting the + // Mouboo figurine. The other will be arrows, unless you hit the 82 MExp value + // which will add 25% chances to get a Wooden Log too. These values are estimate. + + + // Get a few mana experience points (this is NOT used by Soul Menhir) + GetManaExp(TMW2_PARUM, rand(1,3)); + + // set cooldown + @parum_at=gettimetick(2)+4; + end; + +OnInit: + bindatcmd "sk-parum", "sk#parum::OnCall", 0, 100, 0; + end; +} diff --git a/npc/magic/zarkor.txt b/npc/magic/zarkor.txt index b1da8ec6e..18718c811 100644 --- a/npc/magic/zarkor.txt +++ b/npc/magic/zarkor.txt @@ -34,9 +34,12 @@ OnCall: // Summon Magic SummonMagic(TMW2_ZARKOR, 400, CaveMaggot, 75, 2); + // Get a single mana experience point (this is NOT used by Soul Menhir) + GetManaExp(TMW2_ZARKOR, 1); + /* // set cooldown - @skzarkor_cooldown=gettimetick(0)+20; + @skzarkor_cooldown=gettimetick(2)+20; */ @zark_caveat=1; end; diff --git a/npc/scripts.conf b/npc/scripts.conf index 02d71e1dd..0af3f5237 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -83,6 +83,7 @@ // Magic Commands "npc/magic/zarkor.txt", +"npc/magic/parum.txt", // Maps specific scripts @include "npc/_import.txt" -- cgit v1.2.3-70-g09d2