Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DirtyTears = RegisterMod("Miserere", 1)
- local game = Game()
- local pooptear = {
- BASE_CHANCE = 15,
- MAX_LUCK = 10,
- STONE_BONUS = 1.5,
- SCALE = 2,
- TurnChance = 0
- }
- CollectibleType.COLLECTIBLE_MISERERE = IsaacGetItemIdByName("Miserere")
- -- on post peffect update
- function DirtyTears:onUpdate(player)
- if game:GetFrameCount() == 1 then
- Isaac.Spawn(EntityType,ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MISERERE, Vector(250, 250), Vector(0,0), nil)
- end
- if player:HasCollectible(-- Miserere) then
- for _, entity in pairs(Isaac.GetRoomEntities()) do
- local tearData = entity:GetData()
- local sprite = entity:GetSprite()
- if entity.Type == EntityType.ENTITY_TEAR then
- local tear = entity:ToTear()
- if entityVariant ~= TearVariant.PoopTear then
- tear:ChangeVariant(TearVariant.PoopTear)
- -- add first flags?
- else
- if tearData.PoopType == nil then
- -- check if the tear can be a variant
- if player:HasTrinket(-- Pinkey Eye)
- or player:HasTrinketEffect(-- Pinkey Eye)
- or player:HasCollectible(-- Bozo)
- or player:HasCollectible(-- Midas Touch)
- or player:HasTrinket(--Meconium)
- or player:HasTrinketEffect(-- Meconium)
- or player:HasCollectible(-- Hallowed Ground) then
- -- get rng
- local rng = player:GetCollectibleRNG(-- Miserere)
- local roll = rng:RandomInt(100)
- -- will the tear be a variant
- if roll <= ((100 - pooptear.BASE_CHANCE) × player.Luck / pooptear.MAX.LUCK) + pooptear.BASE_CHANCE) then
- -- which variants are possible
- local poopVariant = {1, 2, 3, 4, 5} -- 1=holy, 2=dank, 3=golden, 4=rainbow, 5=red
- if not (player:HasTrinket(-- Pinky Eye)
- or player:HasTrinketEffect(-- Pinky Eye)) then
- table.remove(poopVariant, 5)
- end
- if not (player:HasCollectible(-- Bozo)) then
- table.remove(poopVariants, 4)
- end
- if not (player:HasCollectible(-- Mida's Touch)) then
- table.remove(poopVariant, 3)
- end
- if not (player:HasTrinket(-- Meconium)
- or player:HasTrinketEffect(-- Meconium)) then
- table.remove(poopVariant, 2)
- end
- if not (player:HasCollectible(-- Hallowed Ground) then
- table.remove(poopVariant, 1)
- end
- -- saftey check
- if poopVariant[1] == nil then -- somehow the poop got emptied
- tearData.PoopType == 0 -- a normal poop tear
- else -- should happen normaly
- local pickPoop = math.random(#poopVariant)
- if poopVariant[pickPoop] == 1 then
- tearData.PoopType = 1 -- Holy Poop
- elseif poopVariant[pickPoop] == 2 then
- tearData.PoopType = 2 -- Dank Poop
- elseif poopVariant[pickPoop] == 3 then
- tearData.PoopType = 3 -- Golden Poop
- elseif poopVariant[pickPoop] == 4 then
- tearData.PoopType = 4 -- Rainbow Poop
- elseif poopVariant[pickPoop] == 5 then
- tearData.PoopType = 5 -- Red Poop
- end
- end
- if tearData.PoopType == 1 then -- Holy Poop
- if tearData.HasCostume == nil then
- if tear:TearFlags() == TearFlags.TEAR_PIERCING then
- tearData.HasCostume = true
- sprite:ReplaceSpritesheet(0, "gfx/...../holy_poop_tear_piercing.png")
- sprite:LoadGraphics()
- else
- tearData.HasCostume = true
- sprite:ReplaceSpritesheet(0, "gfx/...../holy_poop_tear.png")
- sprite:LoadGraphics()
- end
- end
- if player:HasTrinket(-- Petrified Poop)
- or player:HasTrinketEffect(-- Petrified Poop) then
- tear.CollisionDamage = tear.CollisionDamage * pooptear.STONE_BONUS
- end
- tear:SetSize(tear.Size * pooptear.SCALE, Vector(pooptear.SCALE, pooptear.SCALE), 8)
- elseif tearData.PoopType == 2 then -- Dank
- elseif tearData.PoopType == 3 then -- Golden
- elseif tearData.PoopType == 4 then -- Rainbow
- elseif tearData.PoopType == 5 then -- Red
- end
- else
- tearData.PoopType = 0
- end
- else
- tearData.PoopType = 0
- end
- -- do stuff for tearData.PoopType 0
- if tearData.PoopType == 0 then
- end
- end
- end
- end
- end
- end
- end
- DirtyTears:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, DirtyTears.onUpdate)
Advertisement
Add Comment
Please, Sign In to add comment