diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-07-27 17:10:22 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-07-27 17:10:22 -0300 |
commit | cc1eaecd044d712597521891342d1860e1a14976 (patch) | |
tree | df211cb65be1c25b8ff0c84efa87fbc577b7c1fa | |
parent | 437c2252c05d52215c7642448ff93b025c46e2c3 (diff) | |
download | serverdata-cc1eaecd044d712597521891342d1860e1a14976.tar.gz serverdata-cc1eaecd044d712597521891342d1860e1a14976.tar.bz2 serverdata-cc1eaecd044d712597521891342d1860e1a14976.tar.xz serverdata-cc1eaecd044d712597521891342d1860e1a14976.zip |
Evol Potions can now be given to Homunculus with right-click menu.
-rw-r--r-- | db/re/item_db.conf | 25 | ||||
-rw-r--r-- | npc/commands/kami.txt | 4 | ||||
-rw-r--r-- | npc/items/homun_heal.txt | 75 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
4 files changed, 99 insertions, 6 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 88970c427..f4517f021 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -500,7 +500,10 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - callfunc("ItHeal2", 4, 2); + if (@useType == 1) + callfunc("HomunHeal", 40, 5); + else + callfunc("ItHeal2", 4, 2); "> }, { @@ -515,7 +518,10 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - callfunc("ItHeal2", 4, 4); + if (@useType == 1) + callfunc("HomunHeal", 65, 5); + else + callfunc("ItHeal2", 4, 4); "> }, { @@ -530,7 +536,10 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - callfunc("ItHeal2", 4, 6); + if (@useType == 1) + callfunc("HomunHeal", 90, 5); + else + callfunc("ItHeal2", 4, 6); "> }, { @@ -545,7 +554,10 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - callfunc("ItHeal2", 4, 8); + if (@useType == 1) + callfunc("HomunHeal", 115, 5); + else + callfunc("ItHeal2", 4, 8); "> }, { @@ -560,7 +572,10 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - callfunc("ItHeal2", 4, 10); + if (@useType == 1) + callfunc("HomunHeal", 140, 5); + else + callfunc("ItHeal2", 4, 10); "> }, { diff --git a/npc/commands/kami.txt b/npc/commands/kami.txt index 8ac29c7f8..ff1fb623e 100644 --- a/npc/commands/kami.txt +++ b/npc/commands/kami.txt @@ -69,7 +69,9 @@ OnPurify: end; OnHarm: - harm(getcharid(3), 500, HARM_PHYS); + //harm(getcharid(3), 500, HARM_PHYS); + .@hp = getunitdata(gethomunid(), UDT_MAXHP) - 1; + harm(gethomunid(), .@hp, HARM_MISC); end; OnHarm2: diff --git a/npc/items/homun_heal.txt b/npc/items/homun_heal.txt new file mode 100644 index 000000000..4f4bc3c9f --- /dev/null +++ b/npc/items/homun_heal.txt @@ -0,0 +1,75 @@ +// TMW-2 Script. +// Author: +// Jesusalva +// Description: +// Homunculus HP and MP healing, based on Reid's work +// +// Variables: +// @heal +// Amount in % of max HP to heal. Can exceed 100% +// @delay +// How long it takes to heal the @heal amount +// +// Vitality increases heal value. If "item" is set, it'll be deleted later + +// HomunHeal(heal, delay{, item=None}) +function script HomunHeal { + .@heal=getarg(0); + .@delay=getarg(1); + .@item=getarg(2, 0); + + // Do you have a Homunculus? + if (!gethominfo(0)) { + dispbottom l("You do not own an Homunculus."); + return; + } + // Is the homunculus active? + if (homstatus() != 0) { + dispbottom l("Your homunculus is sleeping! Wake them up!"); + return; + } + // Do we even have a valid GID? + if (gethomunid() < 1) { + Exception("Homunculus has no Game ID!", RB_DEBUGMES|RB_DISPBOTTOM|RB_ISFATAL); + return; + } + + // Retrieve the Homunculus status, each 5 vit gives 1% bonus + .@vit = getunitdata(gethomunid(), UDT_VIT) / 5; + .@mhp = getunitdata(gethomunid(), UDT_MAXHP); + + // Calculate healing value in % + .@min=.@heal * ( 75 + .@vit) / 100; + .@max=.@heal * (100 + .@vit) / 100; + + // Make these abstract % in absolute values + .@min=max(1, .@mhp*.@min/100); + .@max=max(3, .@mhp*.@max/100); + + // Calculate how much it'll heal + @val1 = rand2(.@min, .@max); + + // Update val1 to be the healing per tick + @val1 = (@val1 / .@delay) + 1; + + // Decide the healing bonus type. We have four types: S, L, G and M + // By default, we use 'S' + .@skill = SC_S_LIFEPOTION; + + // Put the delay in ms + .@delay *= 1000; + + // If an item was specified, delete it here + if (.@item) + delitem .@item, 1; + + // Debug information + if ($@GM_OVERRIDE) + debugmes("Skill %d GID %d Ticks %d Value %d", .@skill, gethomunid(), .@delay, @val1); + + // Apply the effect and finish + sc_end(.@skill, gethomunid()); + sc_start2(.@skill, .@delay, @val1, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE, gethomunid()); + return @val1; +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index 79a81df81..d1a12a38f 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -85,6 +85,7 @@ "npc/items/croconut.txt", "npc/items/emptybox.txt", "npc/items/grenade.txt", +"npc/items/homun_heal.txt", "npc/items/lofteleporter.txt", "npc/items/maps.txt", "npc/items/mercenary.txt", |