REM Basics

    LEVEL_VERSION(1)
    RUN_AFTER_VICTORY(1)
    SET_GENERATE_SPEED(400)
    START_MONEY(ALL_PLAYERS,0)
    MAX_CREATURES(ALL_PLAYERS,1)

    SET_PLAYER_COLOR(PLAYER0, BLUE)

REM Availability

    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
    MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)

REM Level start conditions, messages, music

    REM "Make your way through this twisted labyrinth without being seen to strengthen your forces in the next realm. If you are caught, it's over for you... you've been given a Horny with concealment abilities to accomplish this task, but beware... hornies are not great casters, the invisibility will not last long. Good luck."
    DISPLAY_OBJECTIVE(902, PLAYER_GOOD)

    SET_MUSIC("campaign_music/spirit_realm.mp3")

    IF_ACTION_POINT(2, PLAYER0)
        REM "In here, your hand of evil cannot reach. Guide your Reaper and proceed carefully. If you draw enemy attention, it's over for you."
        DISPLAY_INFORMATION(903)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,0,0)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,0,0)
        SET_MUSIC("campaign_music/umineko_play.mp3")
    ENDIF

    SET_BOX_TOOLTIP(1,"Conjure Reinforcements") 

REM Logic for loss condition

    CREATE_PARTY(HORNY_PARTY)
        ADD_TO_PARTY(HORNY_PARTY,HORNY,10,0,ATTACK_DUNGEON_HEART,0)

    IF (PLAYER0, ACTIVE_BATTLES > 0)

        QUICK_MESSAGE(4, "Prepare for your punishment.", HORNY)
        QUICK_MESSAGE(2, "You have failed.", HORNY)
        
        REM The enemy has broken through your walls speech
        PLAY_MESSAGE(PLAYER0,SPEECH,7)

        ADD_PARTY_TO_LEVEL(PLAYER_GOOD, HORNY_PARTY, -1, 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD, HORNY_PARTY, -2, 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD, HORNY_PARTY, -3, 1)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD, HORNY_PARTY, -4, 1)

    ENDIF

    IF (PLAYER0, TOTAL_CREATURES == 0)
        LOSE_GAME
    ENDIF

REM Wincon

    IF_ACTION_POINT(1, PLAYER0)
        ADD_PARTY_TO_LEVEL(PLAYER0, HORNY_PARTY, -5, 4)
    ENDIF

    IF (PLAYER_GOOD, DUNGEON_DESTROYED > 0)
        REM "Well done, Keeper. Your work here is done. You may use this special to boost your starting forces in the realm of the Altars of the Abyss."
        DISPLAY_INFORMATION(907)
        CHANGE_SLAB_OWNER(68, 13, PLAYER0, NONE)
        PLAY_MESSAGE(PLAYER0, SOUND, "116")
        CREATE_EFFECT_AT_POS(57, 205, 40)

        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,0,0)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,0,0)

        SET_TIMER(PLAYER0, TIMER7)

    ENDIF

    REM Special box reward
    IF(PLAYER0,BOX1_ACTIVATED == 1)
        PLAY_MESSAGE(PLAYER0,SPEECH,80)
        REM Set the campaign flag for the next level
        SET_FLAG(PLAYER0, CAMPAIGN_FLAG2, 1)
    ENDIF

    REM Slight delay to the win level message
    IF(PLAYER0, TIMER7 > 80)
        WIN_GAME
    ENDIF

    REM Make sure the Hornies can't get hungry or need lair/pay

    SET_CREATURE_CONFIGURATION(HORNY,HungerRate,0)
    SET_CREATURE_CONFIGURATION(HORNY,Pay,0)

REM Just an infinite timer to make creatures happy

    SET_TIMER(PLAYER0, TIMER0)
    IF (PLAYER0, TIMER0 > 0)
        NEXT_COMMAND_REUSABLE
        CHANGE_CREATURES_ANNOYANCE(PLAYER0, HORNY, SET, 0)
    ENDIF
