#include "omo_09.h"
#include "entity.h"

#include "world/common/entity/Chest.inc.c"

EvtScript N(EVS_OpenChest_Dictionary) = {
    EVT_SET(LVarA, ITEM_DICTIONARY)
    EVT_SET(LVarB, ITEM_TYPE_KEY)
    EVT_SET(GF_OMO09_Chest_Dictionary, TRUE)
    EVT_EXEC_WAIT(N(EVS_Chest_GetItem))
    EVT_SET(GF_MAC00_DictionaryStolen, TRUE)
    EVT_RETURN
    EVT_END
};

EvtScript N(EVS_MakeEntities) = {
    EVT_CALL(MakeItemEntity, ITEM_COIN, -760, 10, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinA)
    EVT_CALL(MakeItemEntity, ITEM_COIN, -700, 10, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinB)
    EVT_CALL(MakeItemEntity, ITEM_COIN, -640, 10, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinC)
    EVT_CALL(MakeItemEntity, ITEM_COIN, -440, 10, 100, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinD)
    EVT_CALL(MakeItemEntity, ITEM_COIN, -380, 10, 100, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinE)
    EVT_CALL(MakeItemEntity, ITEM_COIN, -320, 10, 100, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinF)
    EVT_CALL(MakeItemEntity, ITEM_STAR_PIECE, 1800, 25, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_StarPiece)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1775, 25, -50, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinG)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1825, 25, -50, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinH)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1750, 25, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinI)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1850, 25, 0, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinJ)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1775, 25, 50, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinK)
    EVT_CALL(MakeItemEntity, ITEM_COIN, 1825, 25, 50, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_CoinL)
    EVT_CALL(MakeEntity, EVT_PTR(Entity_MulticoinBlock), 1285, 230, -50, 0, MAKE_ENTITY_END)
    EVT_CALL(AssignBlockFlag, GF_OMO09_MultiCoinBrick)
    EVT_CALL(UseDynamicShadow, TRUE)
    EVT_CALL(MakeEntity, EVT_PTR(Entity_Chest), 1950, 150, -31, 0, 0, MAKE_ENTITY_END)
    EVT_CALL(AssignChestFlag, GF_OMO09_Chest_Dictionary)
    EVT_CALL(AssignScript, EVT_PTR(N(EVS_OpenChest_Dictionary)))
    EVT_IF_EQ(GF_OMO09_Defeated_MysteryNoteThief, TRUE)
        EVT_IF_EQ(GF_OMO09_Item_MysteryNote, FALSE)
            EVT_CALL(MakeItemEntity, ITEM_MYSTERY_NOTE, 142, 10, -96, ITEM_SPAWN_MODE_FIXED_NEVER_VANISH, GF_OMO09_Item_MysteryNote)
        EVT_END_IF
    EVT_END_IF
    EVT_RETURN
    EVT_END
};
