#apply
#include "../_include.txt"
#include "../../define/_const_achieve.txt"

/*
スイッチの判定は行われない

@param
達成を判定するスイッチのID番号
*/
cev[CEV_SET_ACHIEVEMENT] .name(">>>>実績をトリガーする") {
    defv {
        a_id = TV_SET_ACHIEVEMENT
    }

    deft {
        strLine = TS_SET_ACHIEVEMENT
    }

    def {
        LAY_MESSAGE = 8

        PIC_TEXT = 300
        PIC_SHADOW

        TEXT_X = 0
        TEXT_Y = 8
    }

    def {
        baseStrPicCmd = {
            .topLeft
            .chromakey(1)
            .font("", 10)
            .spacing(0, 4)
            .skin ""
            .mapLayer(LAY_MESSAGE)
            .noframe
            .noGradation
            .eraseWhenTransfer
        }
    }

    strLine.asg(__str("\c[4]☆\c[0] "))
    __loop AC_LIST $arr $acIdx bl {
        __loop $arr $var $idx bl {
            __if $idx == AC_INDEX_ACHIEVED bl {
                $ACHIEVE_ID = __id($var)
                $ACHIEVE_ID += 0
            }
            __if $idx == AC_INDEX_NAME bl {
                $NAME = $var
                @if a_id == $ACHIEVE_ID bl {
                    s[a_id].on
                    strLine.cat($NAME)
                }
            }
        }
    }

    @se.play "Holy5" .opt(60, 80, 50)
    //ピクチャはマップが変わるまで残る
    @pic.strpic [PIC_TEXT] strLine .pos(TEXT_X, TEXT_Y) .trans(-1000) baseStrPicCmd
    @pic.move [PIC_TEXT] .relative .pos(0, 0) .scale(0) .trans(1100) .time(40) .keepRgbs
    @pic.strpic [PIC_SHADOW] strLine .pos(TEXT_X, TEXT_Y) .trans(0) .rgbs(200, 200, 200, 100) baseStrPicCmd
    @pic.move [PIC_SHADOW] .relative .pos(0, 0) .scale(0) .trans(100) .scale(50) .time(5) .keepRgbs

    //変数を初期化する
    a_id = 0
    strLine.asg("")
}