diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-07-28 17:33:35 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-07-28 17:33:35 -0300 |
commit | 7ff182e303ca082516b24a4b9edea57fd91cf5af (patch) | |
tree | 7646f5d560d3560270efd6732136928d25664d96 | |
parent | 89b1e540bfda6d9ff8ddf3a238197b401368c9d4 (diff) | |
download | serverdata-7ff182e303ca082516b24a4b9edea57fd91cf5af.tar.gz serverdata-7ff182e303ca082516b24a4b9edea57fd91cf5af.tar.bz2 serverdata-7ff182e303ca082516b24a4b9edea57fd91cf5af.tar.xz serverdata-7ff182e303ca082516b24a4b9edea57fd91cf5af.zip |
Homunculus Evolution (Tier 2 only) (tested)
-rw-r--r-- | npc/031-6/siegfried.txt | 246 | ||||
-rw-r--r-- | npc/config/homunculus.txt | 91 | ||||
-rw-r--r-- | npc/items/teleporter.txt | 24 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
4 files changed, 307 insertions, 55 deletions
diff --git a/npc/031-6/siegfried.txt b/npc/031-6/siegfried.txt index 45b1c87df..f0133b2cd 100644 --- a/npc/031-6/siegfried.txt +++ b/npc/031-6/siegfried.txt @@ -5,87 +5,239 @@ // Homunculus Evolution System 031-6,75,64,0 script Siegfried NPC_RED_OFFICER,{ + function attributeText; + function attributeTime; mesn; mesq l("My name is Siegfried. Welcome to my humble abode."); - if (is_staff()) goto L_Main; // TODO FIXME: Restrict on tier + game storyline + if ($GAME_STORYLINE >= 4 && HEC_GetTier() == 1) goto L_Main; + if ($GAME_STORYLINE >= 5 && HEC_GetTier() == 2) goto L_Main; + // Not unlocked by game storyline mesq l("In future I'll have something to discuss with you, but today is not the day."); close; -OnInit: - .sex = G_MALE; - .distance = 5; - end; - L_Main: next; mesn; + // Not summoned if (!gethominfo(0)) { mesq l("I used to take care of Homunculus a few centuries ago, before it became lost knowledge. A pity that my knowledge is no longer useful to anyone."); close; } + // Sleeping if (homstatus()) { mesq l("To be honest, I wouldn't believe anyone claiming to have a homunculus if I don't see for my own eyes. Homunculus creation is, after all, lost knowledge."); close; } - mesn; - mesq l("Oh, what lovely Lv %d Homunculus you have here!", gethominfo(6)); + // Active + mesq l("Oh, what lovely Lv %d %s Homunculus you have here!", gethominfo(6), HEC_GetCName()); if (!gethominfo(5)) mesq l("I don't suppose it have a name yet?"); else - mesq l("\"%s\", hm? That's a fine name for a Homunculus, in my not so humble opinion.", gethominfo(2)); + mesq l("...\"%s\", hm? That's a fine name for a Homunculus, in my not so humble opinion.", gethominfo(2)); next; + .@type = gethominfo(1); .@loya = gethominfo(3) / 100; - .@next = 50; // TODO FIXME: PLACEHOLDER, level to evolve, from npc/config tree + .@next = HEC_GetTier() * 50; mesn; - if (.@loya < 900) + + // Loyalty not yet earned + if (.@loya < 900) { mesq l("When it reaches over 900 intimacy, it'll unlock better skills and bonuses to you. Let me know when this happen."); - else if (gethominfo(6) < .@next) - mesq l("Once it reaches level %d who knows, something nice might happen.", .@next); - else + close; + // Level not yet reached + } else if (gethominfo(6) <= .@next) { + mesq l("Once it reaches level %d who knows, something nice might happen.", .@next + 1); + close; + // No evolution available (yet) + } else if (HEC_SimpleEvolve() < 1) { mesq l("And it's so loyal to you... Maybe you should consider requesting the evolution feature soon."); - goto L_HDebug; + close; + // All conditions met + } else { + mesq l("And it's so loyal to you... You probably could evolve it."); + } + goto L_Evolution; -L_HDebug: - if (!is_admin()) close; +L_Evolution: + next; + if (!.@next) end; + mesn; + mesq l("Now, you have a Tier %d homunculi. The highest the tier, the more difficult to evolve it is. For a simple Tier 2 evolution I can do it myself, whereas a Tier 3 evolution requires an Embryo.", HEC_GetTier()); next; mesn; - mesq ("Do you want me to change its class or level? Free of charge for debug purposes."); + mesq l("Evolving your Homunculus will drain 900 points of intimacy and %d levels. Homunculus are slightly weak right after evolving, but some healthy exercise will put them in form in no time.", .@next); + mesc l("In theory, I could also change it to another type without losing any levels, but I ran out of %s.", b(l("Jesusalva's Magic Debug Powder"))); next; - select - ("Change to [Elli]"), - ("Change to [Piou]"), - ("Set level to 50"), - ("Reset level to 3"), - ("Add +100 intimacy"); - switch (@menu) { - case 1: debugmes sethomunclass(6010); break; - case 2: debugmes sethomunclass(6006); break; - case 3: sethomunlevel(50); break; - case 4: sethomunlevel(3); break; - case 5: atcommand("@homfriendly "+(gethominfo(3)/100+100)); break; + switch (HEC_GetTier()) { + case 1: + mesn; + mesq l("For Tier 2 Evolution, I'll need %s GP, %d %s, a %s and a %s.", 5000, 10, getitemlink(FluoPowder), getitemlink(Trout), getitemlink(Tench)); + if (Zeny < 5000) close; + if (countitem(FluoPowder) < 10) close; + if (!countitem(Trout)) close; + if (!countitem(Tench)) close; + next; + mesc l("Evolve your Homunculus? This is irreversible!"), 1; + mesc l("Class after evolution: %s", HEC_GetCName(HEC_SimpleEvolve())); + if (select("No:Yes:Never") != 2) { closeclientdialog; close;} + // Initiate the Riddle, consume the GP and Intimacy first + // Only drain 899 units to give you a "grace" period for the puzzle. + Zeny -= 5000; + atcommand("@homfriendly "+(gethominfo(3)/100-899)); + mesn; + mesq l("Alright, for such simple evolution I can do it myself. It'll evolve to a %s Type Homunculus.", b(HEC_GetCName(HEC_SimpleEvolve()))); + next; + mesn; + mesq l("But you'll still need to help me! The homunculus evolve when four aspects evolve: They are %s, %s, %s and %s.", l("%%A Existence"), l("%%D Rationality"), l("%%F Emotionality"), l("%%? Inexistence")); + next; + mesn; + mesq l("I can only evolve two aspects at once. Whenever an aspect evolves, I need to sacrifice an aspect, so to start the process, I'll use the fish to bootstrap a null aspect."); // For tier 3, fish wouldn't be enough. + next; + mesn; + mesq l("Once I finish evolving the two aspects, you'll be able to decide which aspect you'll downgrade to resume the evolution process. However, you only have %s time units to evolve the four aspects!", b("200")); + next; + mesn; + mesq l("If you can't evolve the four aspects in the alloted time, I'll revert the evolution, but all your money and the Homunculus Intimacy will be consumed. So worth noting that if the intimacy drops to zero, it dies."); + next; + mesn; + mesq l("Ready? Let's begin."); + .@time=0; + .@attr=0; + goto L_Evol2Puzzle; + default: + mesn; + mesq l("I don't know how to evolve your homunculus."); } + close; + +L_Evol2Puzzle: + // INHERITED: .@time / .@attr + clear; + mesc l("Time spent: %d/%d", .@time, 200); + mes ""; + mesc l("Evolved attributes: %s", attributeText(.@attr)); + mes ""; + mes l("Evolution time:"); + mesc ("%%A 10"); + mesc ("%%D 20"); + mesc ("%%F 90"); + mesc ("%%? 120"); + // Reset the buffers + .@tf=0; .@fa=.@attr; // tf = time buffer; fa = final attribute + mes ""; + mes l("Which attribute do you wish to evolve first?"); + menuint + // TODO FIXME: Need menuimage because emotes doesn't work...? WTF? + rif(!(.@fa & 1), l("%%A Existence")), 1, + rif(!(.@fa & 2), l("%%D Rationality")), 2, + rif(!(.@fa & 4), l("%%F Emotionality")), 4, + rif(!(.@fa & 8), l("%%? Inexistence")), 8; + mes ""; + .@fa = .@fa | @menuret; + .@tf = max(.@tf, attributeTime(@menuret)); + mes ""; + mes l("Which attribute do you wish to evolve next?"); + menuint + rif(!(.@fa & 1), l("%%A Existence")), 1, + rif(!(.@fa & 2), l("%%D Rationality")), 2, + rif(!(.@fa & 4), l("%%F Emotionality")), 4, + rif(!(.@fa & 8), l("%%? Inexistence")), 8, + l("None"), 0; + mes ""; + .@fa = .@fa | @menuret; + .@tf = max(.@tf, attributeTime(@menuret)); + // Apply the time change + .@time += .@tf; .@tf = 0; + mes b(l("Time spent: %d/%d", .@time, 200)); + // You finished + if (.@fa == 15) goto L_Evol2Finish; + // Update the display with the temporary data in the making + clear; + mesc l("Time spent: %d/%d", .@time, 200); + mes ""; + mesc l("Evolved attributes: %s", attributeText(.@fa)); + mes ""; + mes l("Evolution time:"); + mesc ("%%A 10"); + mesc ("%%D 20"); + mesc ("%%F 90"); + mesc ("%%? 120"); + // Revert one attribute + mes ""; + mesc l("Which attribute do you wish to downgrade?"), 1; + menuint + rif((.@fa & 1), l("%%A Existence")), 1, + rif((.@fa & 2), l("%%D Rationality")), 2, + rif((.@fa & 4), l("%%F Emotionality")), 4, + rif((.@fa & 8), l("%%? Inexistence")), 8; + .@fa = .@fa ^ @menuret; + .@attr = .@fa; + .@time += attributeTime(@menuret); + // Continue the cycle + goto L_Evol2Puzzle; + +L_Evol2Finish: + // Validate if you really won + if (.@time < 120 || .@time > 200) goto L_Evol2Fail; + if (gethominfo(6) <= .@next) goto L_Evol2Fail; + if (.@next < 1) Exception("Illegal value for level cost", RB_SPEECH|RB_DEBUGMES|RB_PLEASEREPORT|RB_ISFATAL); + // Consume the materials + delitem Trout, 1; + delitem Tench, 1; + delitem FluoPowder, 10; + // Perform the Evolution + .@evol = sethomunclass(HEC_SimpleEvolve()); + if (.@evol) + Exception(sprintf("Illegal Homunculus Evolution performed, error %d for type %d.", .@evol, HEC_SimpleEvolve()), RB_IRCBROADCAST|RB_SPEECH|RB_DEBUGMES|RB_PLEASEREPORT|RB_ISFATAL); + // Reset the Homunculus level + .@level = gethominfo(6) - .@next; + sethomunlevel(.@level); + // Update player display atcommand("@refresh"); atcommand("@hominfo"); - next; - goto L_HDebug; + // Finale + clear; + mesn; + mesq l("Congratulations! Your homunculus has just evolved."); + close; -// Server Happy Hour -// Used to be Sunday 18:00~20:00 -// Then it is Sunday 16:00~20:00 -// Currently it is the whole weekend -OnSat0000: - if (debug) end; - $@EXP_EVENT=($GAME_STORYLINE >= 5 ? 15 : 10); - $@EXP_EVENT_TIME=48; - donpcevent "@exprate::OnPlayerCall"; - end; +L_Evol2Fail: + clear; + mesc l(".:: Failure ::."), 1; + mesc l("You took too long."), 1; + debugmes "Spent %d time units", .@time; + close; -OnSun0000: - disablenpc .name$; - end; +function attributeText { + .@a$=""; .@a=getarg(0); + if (.@a & 1) + .@a$+=l("%%A Existence"); + .@a$+=" "; + if (.@a & 2) + .@a$+=l("%%D Rationality"); + .@a$+=" "; + if (.@a & 4) + .@a$+=l("%%F Emotionality"); + .@a$+=" "; + if (.@a & 8) + .@a$+=l("%%? Inexistence"); + return .@a$; +} + +function attributeTime { + switch (getarg(0)) { + case 0: return 0; + case 1: return 10; + case 2: return 20; + case 4: return 90; + case 8: return 120; + default: Exception("Invalid attribute selected"); return 9999; + } +} -OnMon0000: - enablenpc .name$; +OnInit: + .sex = G_MALE; + .distance = 5; end; } diff --git a/npc/config/homunculus.txt b/npc/config/homunculus.txt new file mode 100644 index 000000000..15b3fb6cd --- /dev/null +++ b/npc/config/homunculus.txt @@ -0,0 +1,91 @@ +// TMW2 script +// Author: Jesusalva <admin@tmw2.org> +// +// Homunculus Evolution Configuration +// Defines what evolves to what and their tiers and all that... + +function script HEC_GetTier { + switch (getarg(0, gethominfo(1))) { + case 6001: + case 6002: + case 6003: + case 6004: + case 6005: + case 6006: + case 6007: + case 6008: + return 1; + case 6020: + case 6021: + case 6022: + case 6023: + return 2; + // Elli's case, or no homunculus found + default: + return -1; + } +} + + +// Returns -1 if no evolution available, 0 if it is complex (wrong function), or ID +function script HEC_SimpleEvolve { + switch (getarg(0, gethominfo(1))) { + case 6001: + case 6005: + return 6020; + case 6004: + case 6006: + return 6021; + case 6002: + case 6003: + return 6022; + case 6007: + case 6008: + return 6023; + // Tier 2 -> 3 are complex evolutions with two choices + case 6020: + case 6021: + case 6022: + case 6023: + return 0; + // No evolution available + default: + return -1; + } +} + +// Return the class name from DB +function script HEC_GetCName { + switch (getarg(0, gethominfo(1))) { + case 6001: + return l("Mage"); + case 6002: + return l("Tanker"); + case 6003: + return l("Agile"); + case 6004: + return l("Strong"); + case 6005: + return l("Lucky"); + case 6006: + return l("Accurate"); + case 6007: + return l("All Rounder"); + case 6008: + return l("Superior Machine"); + case 6010: + return l("Elanore"); + case 6020: + return l("Ranger"); + case 6021: + return l("Warrior"); + case 6022: + return l("Stalwart"); + case 6023: + return l("Paladin"); + // ??? + default: + return l("ERROR"); + } +} + diff --git a/npc/items/teleporter.txt b/npc/items/teleporter.txt index ebc722103..81ea4f1f3 100644 --- a/npc/items/teleporter.txt +++ b/npc/items/teleporter.txt @@ -8,26 +8,31 @@ - script Warp Crystal NPC_HIDDEN,{ close; +function ReturnItem { + getitem @itemid, 1; + @itemid=0; + if (getarg(0, false)) + end; + return; +} + function Cooldown { mesn; mesc l("Successive warps cause time-space distortions and are thus not allowed."); mesc l("You can use it again in %s.", FuzzyTime(TELEPORTER_TIME)); - getitem @itemid, 1; + ReturnItem(false); close; } -function ReturnItem { - getitem @itemid, 1; - end; -} - OnUse: // Receives @dest$ + if (@dest$ == "") + ReturnItem(true); if (TELEPORTER_TIME > gettimetick(2)) Cooldown(); if (BaseLevel < 20) { dispbottom l("The might contained in this curious object is too powerful. You have to be at least level 20 to harness it."); - ReturnItem(); + ReturnItem(true); } // TODO: Are you already at target point? @@ -37,13 +42,15 @@ OnUse: .@timet=limit(0, gettimetick(2)-TELEPORTER_TIME, 3600); .@prop=.@timet*2777/1000; // Make it range from 0~10000 .@adj_breakrate=limit( 500, .@prop, 9500 ); + if ($EVENT$ == "Rebirth") .@adj_breakrate /= 2; else if ($EVENT$ == "Siege") .@adj_breakrate /= 3; + //debugmes "Adjusted break ratio: %d", .@adj_breakrate; if (rand(10000) > .@adj_breakrate) - getitem @itemid, 1; + ReturnItem(false); else getitem BrokenWarpCrystal, 1; @@ -54,5 +61,6 @@ OnUse: // Save new location and warp you there EnterTown(@dest$); ReturnTown(); + @itemid=0; end; } diff --git a/npc/scripts.conf b/npc/scripts.conf index d1a12a38f..e61b5db50 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -39,6 +39,7 @@ "npc/config/location.txt", "npc/config/traps.txt", "npc/config/magic.txt", +"npc/config/homunculus.txt", "npc/functions/maze.txt", // Misc functions |