summaryrefslogtreecommitdiff
path: root/npc/items/mercenary.txt
blob: c87081760fb15a8448764c0ea659ac8df4cd551b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Core functions for Mercenary boxset

// Main loop
// merc_boxset(5★, 4★, 3★, 2★, 1★)
function	script	merc_boxset	{
    .@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;

    // Make the seed. More level and luck increases odds of higher rarity
	.@seed=rand(0, .@sumup)-BaseLevel-readparam(bLuk);

	// 5 ★
	if (.@seed < .@s5) {
		setarray .@r, MercCard_AndreiSakar, MercCard_Woody, MercCard_Lilanna, MercCard_Xanthem;
		.@n=any_of(.@r);
	// 4 ★
	} else if (.@seed < .@s4) {
		setarray .@r, MercCard_Aisen, MercCard_Msawis, MercCard_Swezanne, MercCard_DragonStar;
		.@n=any_of(.@r);
	// 3 ★
	} else if (.@seed < .@s3) {
		setarray .@r, MercCard_Saulc, MercCard_Crazyfefe, MercCard_LawnCable, MercCard_Arthur;
		.@n=any_of(.@r);
	// 2 ★
	} else if (.@seed < .@s2) {
		setarray .@r, MercCard_Pookie, MercCard_Jesusalva, MercCard_Demure, MercCard_EarthWitch;
		.@n=any_of(.@r);
	// 1 ★
	} else {
		setarray .@r, MercCard_Apane, MercCard_Soren, MercCard_GonzoDark, MercCard_Rosa;
		.@n=any_of(.@r);
	}

	getitem .@r[.@n], 1;
    return;
}

/*
// Setup a merc_boxset based on level (TODO)
function	script	cond_mercboxset	{
    return;
}
*/