Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if entities.Variant == 3 then -- fortune teller
- -- get rng
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_SMELTER)
- local roll = rng:RandomInt(100)
- -- remove slot
- entities:Remove()
- -- replace it with a soul heart or Fragmented Card
- if roll >= 15 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_SOUL, entities.Position, Vector(0,0), entities)
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FRAGMENTED_CARD, entities.Position, Vector(0,0), entities)
- end
- elseif entities.Variant == 4 then -- normal beggar
- if entities:GetSprite():IsEventTriggered("Prize") then
- -- Isaac.ConsoleOutput("Pay Prize")
- waitForBeggar = true
- collectible.Beggar = true
- end
- elseif entities.Variant == 5 then -- demon beggar
- if entities:GetSprite():IsEventTriggered("Prize") then
- -- Isaac.ConsoleOutput("Pay Prize")
- waitForBeggar = true
- collectible.DemonBeggar = true
- end
- elseif entities.Variant == 6 then -- shell game
- if entities:GetSprite():IsEventTriggered("Prize") then
- -- Isaac.ConsoleOutput("Pay Prize")
- waitForBeggar = true
- collectible.ShellGame = true
- end
- elseif entities.Variant == 7 then -- key beggar
- if entities:GetSprite():IsEventTriggered("Prize") then
- -- Isaac.ConsoleOutput("Pay Prize")
- waitForBeggar = true
- collectible.KeyBeggar = true
- end
- elseif entities.Variant == 9 then -- bomb beggar
- if entities:GetSprite():IsEventTriggered("Prize") then
- -- Isaac.ConsoleOutput("Pay Prize")
- waitForBeggar = true
- collectible.BombBeggar = true
- end
- elseif entities.Variant == 10 then -- reroll maschine
- local restock = entities
- local sprite = restock:GetSprite()
- local numTrinkets = 0 -- keeps track of the number of trinkets in the room
- -- First check if the player inserted a coin
- if sprite:IsOverlayPlaying("CoinInsert") then
- if sprite:GetOverlayFrame() == 7 then
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_SMELTER)
- local roll = rng:RandomInt(100)
- if roll < 50 then
- -- check for the room the restock machine is in
- if roomType == RoomType.ROOM_TREASURE then
- -- Isaac.ConsoleOutput("Yess!")
- -- get the pool first
- local poolBase = {5,8,14,16,25,30,31,33,53,54,55,57,60,68,70,71,77,81,86,90,93,95,97,98,99,127} -- used to determine pool and poolBackwards
- -- reroll stuff!
- TrinketReroll(poolBase)
- -- check how many times the machine rerolled the trinkets
- rerollItemRo = rerollItemRo + 1
- elseif roomType == RoomType.ROOM_SECRET then
- -- get the pool first
- local poolBase = {15,28,32,83,84,91} -- used to determine pool and poolBackwards
- -- reroll stuff!
- TrinketReroll(poolBase)
- -- check how many times the machine rerolled the trinkets
- rerollSecretRo = rerollSecretRo + 1
- end
- end
- end
- end
- -- check for explosions close to the machine and trigger the reroll if necessary
- for _, entitiis in pairs(Isaac.GetRoomEntities()) do
- -- Isaac.ConsoleOutput("Yess!")
- if entitiis.Type == EntityType.ENTITY_EFFECT then
- local effect = entitiis
- local reRoll = false
- if effect.Variant == EffectVariant.BOMB_EXPLOSION
- or effect.Variant == EffectVariant.MOM_FOOT_STOMP
- or effect.Variant == EffectVariant.SHOCKWAVE then
- if effect:GetData().Exploded == nil then
- -- if (restock.Position - effect.Position):Length() <= restock.Size + effect.Size then
- if (restock.Position:Distance(effect.Position) < 83) then
- -- set the data for the effect
- effect:GetData().Exploded = true
- -- Isaac.ConsoleOutput("Uhh?")
- if restock:GetData().OutOfStock == nil
- or restock:GetData().OutOfStock == false then -- the restock machine isn't supposed to be out of stock
- if roomType == RoomType.ROOM_TREASURE
- and reRoll == false then
- -- Isaac.ConsoleOutput("Yess!")
- -- get the pool first
- local poolBase = {5,8,14,16,25,30,31,33,53,54,55,57,60,68,70,71,77,81,86,90,93,95,97,98,99,127} -- used to determine pool and poolBackwards
- -- reroll stuff!
- TrinketReroll(poolBase)
- -- check how many times the machine rerolled the trinkets
- rerollItemRo = rerollItemRo + 1
- reRoll = true
- elseif roomType == RoomType.ROOM_SECRET
- and reRoll == false then
- -- get the pool first
- local poolBase = {15,28,32,83,84,91} -- used to determine pool and poolBackwards
- -- reroll stuff!
- TrinketReroll(poolBase)
- -- check how many times the machine rerolled the trinkets
- rerollSecretRo = rerollSecretRo + 1
- reRoll = true
- end
- end
- end
- end
- end
- end
- end
- -- check for trinkets in the room and block the restock machine if too much are in there
- for _, entiti in pairs(Isaac.FindInRadius(player.Position, 1500, EntityPartition.PICKUP)) do
- if entiti.Variant == PickupVariant.PICKUP_TRINKET then
- numTrinkets = numTrinkets + 1
- end
- end
- if numTrinkets >= 7 then
- if restock:GetData().OutOfStock == nil
- or restock:GetData().OutOfStock == false then
- sprite:ReplaceSpritesheet(0, "gfx/items/slots/custom/slot_010_out_of_stock.png")
- sprite:LoadGraphics()
- -- make it intengable to other entities
- restock.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
- -- set the data
- restock:GetData().OutOfStock = true
- end
- else
- if restock:GetData().OutOfStock == true then -- the spritesheet got replaced before
- sprite:ReplaceSpritesheet(0, "gfx/items/slots/custom/slot_010_restockmachine.png")
- sprite:LoadGraphics()
- -- make it tengable to the player and bombs again
- restock.EntityCollisionClass = EntityCollisionClass.ENTCOLL_ALL -- | EntityCollisionClass.ENTCOLL_PLAYEROBJECTS
- -- set the data so that it can trigger again
- restock:GetData().OutOfStock = false
- end
- end
- -- destroy the restock machine once it is used to many times
- if rerollItemRo >= 6 then
- if roomType == RoomType.ROOM_TREASURE
- and restock:GetData().IsBroken == nil then
- -- let it play the death animation
- sprite:Play("Death", false)
- -- then kill it off
- restock:Die()
- restock:GetData().IsBroken = true
- end
- end
- if rerollSecretRo >= 6 then
- if roomType == RoomType.ROOM_SECRET
- and restock:GetData().IsBroken == nil then
- -- let it play the death animation
- sprite:Play("Death", false)
- -- then kill it off
- restock:Die()
- restock:GetData().IsBroken = true
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment