summaryrefslogtreecommitdiff
path: root/world/map/npc/items/check_wand.txt
blob: 0e0a9a7ee4a349d6f87f722a6aded0492f460231 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Wands
// Author: Wushin
function|script|WandMana|,
{
    if(isin("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2) && ((@Duel_Fighter != 1) || ($@Duel_NoMagic == 1)))
      goto L_Return;
    callfunc "CheckWand";
    set @WandCost, (@Wand * ((MaxSp / 10) + 2));
    set @WandAttack, 0;
    if (!(@Wand))
        goto L_NoWand;
    if (Sp >= @WandCost)
        goto L_Attack;
    goto L_LowSp;

L_Attack:
    set Sp, (Sp - @WandCost);
    set @WandAttack, 1;
    goto L_Return;

L_NoWand:
    message strcharinfo(0), "You need a wand Equipped!";
    set @WandAttack, 0;
    goto L_Return;

L_LowSp:
    message strcharinfo(0), "Out of Mana";
    set @WandAttack, 0;
    goto L_Return;

L_Return:
    return;
}
function|script|CheckWand|,
{
    setarray $@Wands, 758, 1171;
    setarray $@WandsPwr, 2, 1;
    setarray $@WandsAnim, 35, 33;
    set @Wand, 0;
    set @wand_loop, 0;
    goto L_Loop;

L_Loop:
    if ((getequipid(equip_hand1) == $@Wands[@wand_loop]) || (getequipid(equip_hand2) == $@Wands[@wand_loop]))
        goto L_SetWand;
    goto L_LoopAgain;

L_SetWand:
    set @Wand, $@WandsPwr[@wand_loop];
    set @WandID, $@WandsAnim[@wand_loop];
    callfunc "MorganState";
    if (@morgan == 2)
        goto L_SetCastOnce;
    goto L_Return;

L_LoopAgain:
    set @wand_loop, (@wand_loop + 1);
    if (@wand_loop >= getarraysize($@Wands))
        goto L_Return;
    goto L_Loop;

L_SetCastOnce:
    set @morgan_tmp, 3;
    callfunc "SetMorganMask";
    goto L_Return;

L_Return:
    return;
}