summaryrefslogtreecommitdiff
path: root/npc/magic/level2-shear.txt
blob: f848b36d6f6eb10bb36fcd62a99cfd5f89ae5663 (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
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_CHIPCHIP (Level 1)
// School: Nature 2

function	script	SK_Shear	{
	.@mobGD=getarg(0, @skillTarget);
    if (.@mobGD <= 0)
        return;

    // We only want monsters
	if (getunittype(.@mobGD) != UNITTYPE_MOB) {
		dispbottom l("This skill can only be used on monsters!");
		return;
	}

    // Global data
    setarray .@valid,   Fluffy, EasterFluffy, SpikyMushroom,      Mouboo, MauvePlant, CobaltPlant, GambogePlant, AlizarinPlant,   Silkworm,      Pinkie;
    setarray .@prize, WhiteFur,     WhiteFur,     HardSpike, CottonCloth,  MauveHerb,  CoblatHerb,  GambogeHerb,  AlizarinHerb, SilkCocoon, PinkAntenna;
    setarray .@score,      300,          300,           250,         175,        700,         700,          700,           700,        300,         180;

    // Specific data
	.@mobID=getunitdata(.@mobGD, UDT_CLASS);
    .@matk=AdjustSpellpower(40+(10*@skillLv));
    .@idx=array_find(.@valid, .@mobID);

    // Invalid target
    if (.@idx < 0) return;

    // Not yet sheared
    if (array_rfind(@shear, .@mobGD) < 0) {
        array_push(@shear, @mobGD);
        if (.@matk > .@score[.@idx])
            getitem .@prize[.@idx], 1;
    }

    // Sagratha bonus
    if (.@mobId == Fluffy || .@mobId == Mouboo || .@mobId == Pinkie)
        QuestSagathaHappy(any(true, true, false));

    // Special effect
    specialeffect(FX_MAGIC_SHEAR_CAST, AREA, getcharid(3));
    specialeffect(FX_MAGIC_SHEAR_CAST, AREA, .@mobGD);

    // Truncate.
    // We're saving the GID so it must be "big enough"
    // But not too big so rfind() is not expensive
    if (getarraysize(@study) > 99) {
        deletearray(@study, 30);
    }
    return;
}