summaryrefslogtreecommitdiff
path: root/npc/items
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-01-01 20:46:43 -0300
committerJesusaves <cpntb1@ymail.com>2020-01-01 20:46:43 -0300
commit1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0 (patch)
tree5b1264a924ba3fc124f1d51311144eda4b3656fd /npc/items
parent5407e674a17f91c2bdfdcee7ad1efa4ebb6c3046 (diff)
downloadserverdata-1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0.tar.gz
serverdata-1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0.tar.bz2
serverdata-1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0.tar.xz
serverdata-1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0.zip
Mercenary banalization prototype
Diffstat (limited to 'npc/items')
-rw-r--r--npc/items/mercenary.txt46
1 files changed, 46 insertions, 0 deletions
diff --git a/npc/items/mercenary.txt b/npc/items/mercenary.txt
index 15060795d..65ffededd 100644
--- a/npc/items/mercenary.txt
+++ b/npc/items/mercenary.txt
@@ -57,4 +57,50 @@ function script cond_mercboxset {
}
*/
+// Get mercenary ID
+// merc_randid(5★, 4★, 3★, 2★, 1★)
+function script merc_randid {
+ .@s5=getarg(0,0);
+ .@s4=getarg(1,0);
+ .@s3=getarg(2,0);
+ .@s2=getarg(3,0);
+ .@s1=getarg(4,0);
+
+ .@sumup=.@s5+.@s4+.@s3+.@s2+.@s1;
+ /* I wonder if this is needed...?
+ .@s4+=.@s5;
+ .@s3+=.@s4;
+ .@s2+=.@s3;
+ .@s1+=.@s2;
+ */
+
+ // Make the seed. More level and luck increases odds of higher rarity
+ .@seed=max(0, rand(0, .@sumup)-BaseLevel-readparam(bLuk));
+
+ // 5 ★
+ if (.@seed < .@s5) {
+ setarray .@r, 1192, 1191, 1193, 1210;
+ .@n=any_of(.@r);
+ // 4 ★
+ } else if (.@seed < .@s4) {
+ setarray .@r, 1194, 1195, 1209, 1205;
+ .@n=any_of(.@r);
+ // 3 ★
+ } else if (.@seed < .@s3) {
+ setarray .@r, 1196, 1197, 1198, 1208;
+ .@n=any_of(.@r);
+ // 2 ★
+ } else if (.@seed < .@s2) {
+ if (.@mode)
+ setarray .@r, 1200, 1201, 1199, 1207;
+ .@n=any_of(.@r);
+ // 1 ★
+ } else {
+ setarray .@r, 1203, 1204, 1202, 1206;
+ .@n=any_of(.@r);
+ }
+
+ debugmes "Return: %d ([%d, %d, %d])", .@n, .@r[0], .@r[1], .@r[2];
+ return .@n;
+}