// Boss' Lordboi
ON INIT {
 SET £helping_buddy "GOBLIN_BASE_0050"
 SET £flee_marker "FLEE_MARKER_0049"
 SET §reflection_mode 0
 SET §zuk_dead 0
 SET §cowardice 0
 SET £key_carried "KEY_BASE_0005portcullis"
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 4 
 SET §delation 0
 ACCEPT
}

ON INITEND {
 SET_NPC_STAT life 10
 SET_NPC_STAT damages 3
 SENDEVENT -ir DURABILITY 100 "42"
 LOADANIM ACTION2 "goblin_misc_here"
 BEHAVIOR FRIENDLY
 SETTARGET GOBLIN_BASE_0050
 TWEAK SKIN "npc_Goblin_base_body" "npc_Goblin_lordboi"
 ACCEPT
}

ON RELOAD {
 SET §enemy 1
 ACCEPT
}

ON REACHEDTARGET {
  IF (^TARGET == MARKER_0849) {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0704
    ACCEPT
  }
  IF (^TARGET == MARKER_0704) {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0418
    ACCEPT
  }
  IF (^TARGET == MARKER_0418) {
    BEHAVIOR FRIENDLY
    SETTARGET GOBLIN_BASE_0050
    ACCEPT
  }
  IF (^TARGET == MARKER_0173) {
   SETMOVEMODE WALK
   BEHAVIOR GO_HOME
   SETTARGET PLAYER
   ACCEPT
  }
 ACCEPT
}

ON CUSTOM {
  IF (§fighting_mode != 0) ACCEPT
  IF (§looking_for != 0) ACCEPT
  IF (^$PARAM1 == "DELATION") {
    TIMERhide 1 5 GOTO DELATION
    ACCEPT
  }
  IF (^$PARAM1 == "WARNING" ) {
    IF (§delation == 1) ACCEPT
    SPEAK [Goblin_eh_eh] SENDEVENT CUSTOM GOBLIN_BASE_0050 "TRASH_TALK"
    ACCEPT
  }
  IF (^$PARAM1 == "THREAT" ) {
    IF (§delation == 1) ACCEPT
    SPEAK [Goblin_irritate] SENDEVENT CUSTOM GOBLIN_BASE_0050 "MOANAGAIN"
    ACCEPT
  }
  IF (^$PARAM1 == "COMON" ) {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0849
    SPEAK [Goblin_zuk_help_boss] NOP
    ACCEPT
  }
  IF (^$PARAM1 == "ZUK_ANSWERED" ) {
    SPEAK [Goblin_zuk_trash] GOTO SNEAKOUT
    ACCEPT
  }
 ACCEPT
}

>>DELATION
  IF (^TALKING == 1) {
    TIMERtryagain 1 3 GOTO DELATION
    ACCEPT
  }
 SET §delation 1
 FORCEANGLE 0
 PLAYANIM ACTION2
 SPEAK KILLALL
 SPEAK [Goblin_zuk_plate_on_table] NOP
 TIMERdelation 1 4 SENDEVENT CUSTOM GOBLIN_BASE_0050 "LOOK"
 ACCEPT

>>SNEAKOUT
 SENDEVENT CUSTOM GOBLIN_BASE_0050 "BOSS_ATTACK"
 TIMERlaugh 1 2 GOTO RUN
 ACCEPT

>>RUN
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0173
 SETMOVEMODE RUN
 SPEAK [Goblin_laugh] NOP
 ACCEPT

ON DIE {
 SENDEVENT CUSTOM GOBLIN_BASE_0049 "LITTLE_GOB_DEAD"
 SENDEVENT CUSTOM GOBLIN_BASE_0050 "LITTLE_GOB_DEAD"
 ACCEPT
}