From bd9d7c6142986a30f6fcd355efe22704f5bf4be4 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 17 Apr 2021 15:36:27 -0300 Subject: Update a bit Sagatha's code --- npc/013-1/sagatha.txt | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/npc/013-1/sagatha.txt b/npc/013-1/sagatha.txt index 12251532..786da773 100644 --- a/npc/013-1/sagatha.txt +++ b/npc/013-1/sagatha.txt @@ -1,46 +1,31 @@ function script QuestSagathaHappy { - @unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT; - if (@unhappiness < @value) - goto L_zero; + .@value = getarg(0, @value); + .@unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT; + if (.@unhappiness < .@value) + .@unhappiness = 0; - @unhappiness = @unhappiness - @value; - goto L_write; + .@unhappiness = .@unhappiness - .@value; -L_zero: - @unhappiness = 0; - goto L_write; - -L_write: - QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (@unhappiness << NIBBLE_3_SHIFT); + QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (.@unhappiness << NIBBLE_3_SHIFT); return; } function script QuestSagathaAnnoy { - @unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT; - if ((@unhappiness + @value) > 15) - goto L_max; - - @unhappiness = @unhappiness + @value; - goto L_write; + .@value = getarg(0, @value); + .@unhappiness = (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT; + if ((.@unhappiness + .@value) > 15) + .@unhappiness = 15; -L_max: - @unhappiness = 15; - goto L_write; - -L_write: - QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (@unhappiness << NIBBLE_3_SHIFT); + .@unhappiness = .@unhappiness + .@value; + QUEST_MAGIC = (QUEST_MAGIC & ~NIBBLE_3_MASK) | (.@unhappiness << NIBBLE_3_SHIFT); return; } function script SagathaStatus { - if (!isequippedcnt(MoubooHead, FluffyHat)) - goto L_Next; - @value = 15; - callfunc "QuestSagathaAnnoy"; - goto L_Next; + if (isequippedcnt(MoubooHead, FluffyHat)) + QuestSagathaAnnoy(15); -L_Next: @mexp = MAGIC_EXP; @has_magic = getskilllv(SKILL_MAGIC); @evil = 0; @@ -65,7 +50,7 @@ L_Next: } 013-1,131,24,0 script Sagatha#_M NPC167,{ - callfunc "SagathaStatus"; + SagathaStatus(); @Q_MASK = NIBBLE_4_MASK | NIBBLE_5_MASK; @Q_SHIFT = NIBBLE_4_SHIFT; -- cgit v1.2.3-60-g2f50