/**************************************************
*   Handle the installation of cursed scrolls     *
*   Any thing missing, new cursed scrolls, etc.   *
**************************************************/


//Include the cursed scroll list
INCLUDE ~./%MOD_FOLDER%/registration/scroll-lists/%bz_game_code%/core/cursed.tph~


/****************************************************************
*   Check for IWD (missing scrolls) and install ones from BG1   *
*   then add to ~cursed_scrolls~ array                          *
****************************************************************/
//Check for IWD (missing scrolls) and install ones from BG1 & add to ~cursed_scrolls~ array
ACTION_IF (GAME_IS ~iwdee~) THEN
BEGIN
    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL10.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20010
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL11.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20011
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL12.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20012
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL13.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20013
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL14.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20014
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL16.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20016
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL17.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20017
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    COPY ~./%MOD_FOLDER%/comp/crafting-scroll/%bz_edition_code%/ITM/cursed/SCRL18.ITM~ ~override~
        SAY NAME1 @20009
        SAY NAME2 @20018
	    SAY UNIDENTIFIED_DESC @20040
	    SAY IDENTIFIED_DESC @20041

    ACTION_DEFINE_ASSOCIATIVE_ARRAY
    ~cursed_scrolls~
    BEGIN
        /*
        [key]                   // 0
        */
        ~SCRL10~ => ~SCRL10~    //Cursed Scroll of Weakness
        ~SCRL11~ => ~SCRL11~    //Cursed Scroll of Clumsiness
        ~SCRL12~ => ~SCRL12~    //Cursed Scroll of Foolishness
        ~SCRL13~ => ~SCRL13~    //Cursed Scroll of Ugliness
        ~SCRL14~ => ~SCRL14~    //Cursed Scroll of Summon Monster
        ~SCRL16~ => ~SCRL16~    //Cursed Scroll of Petrification
        ~SCRL17~ => ~SCRL17~    //Cursed Scroll of Ailment
        ~SCRL18~ => ~SCRL18~    //Cursed Scroll of Stupidity
    END
END
/***************************************************
*   END: install missing cursed scrolls from BGs   *
***************************************************/



/*****************************************
*   Random Treasure for cursed scrolls   *
*****************************************/
INCLUDE ~./%MOD_FOLDER%/comp/shared/fn-add_random_treasure_from_array.tph~

//Register the random treasure for cursed scrolls -- read ~cursed_scrolls~ array and add to 2DA in-game
LAUNCH_ACTION_FUNCTION ~bz_add_random_treasure_from_array~
STR_VAR
    ~Loot_RESREF~ = ~BZSCLCUR~
    ~SourceArray~ = ~cursed_scrolls~  //uses the `value` in whatever array, using ACTION_PHP_EACH
END
/*****************************************
*   END: Random Treasure for cursed scrolls   *
*****************************************/
