Josh64

Dirty Tears

Mar 29th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. local DirtyTears = RegisterMod("Miserere", 1)
  2. local game = Game()
  3.  
  4. local pooptear = {
  5. BASE_CHANCE = 15,
  6. MAX_LUCK = 10,
  7. STONE_BONUS = 1.5,
  8. SCALE = 2,
  9. TurnChance = 0
  10. }
  11.  
  12. CollectibleType.COLLECTIBLE_MISERERE = IsaacGetItemIdByName("Miserere")
  13.  
  14. -- on post peffect update
  15. function DirtyTears:onUpdate(player)
  16. if game:GetFrameCount() == 1 then
  17. Isaac.Spawn(EntityType,ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MISERERE, Vector(250, 250), Vector(0,0), nil)
  18. end
  19.  
  20. if player:HasCollectible(-- Miserere) then
  21. for _, entity in pairs(Isaac.GetRoomEntities()) do
  22. local tearData = entity:GetData()
  23. local sprite = entity:GetSprite()
  24. if entity.Type == EntityType.ENTITY_TEAR then
  25. local tear = entity:ToTear()
  26. if entityVariant ~= TearVariant.PoopTear then
  27. tear:ChangeVariant(TearVariant.PoopTear)
  28. -- add first flags?
  29. else
  30. if tearData.PoopType == nil then
  31. -- check if the tear can be a variant
  32. if player:HasTrinket(-- Pinkey Eye)
  33. or player:HasTrinketEffect(-- Pinkey Eye)
  34. or player:HasCollectible(-- Bozo)
  35. or player:HasCollectible(-- Midas Touch)
  36. or player:HasTrinket(--Meconium)
  37. or player:HasTrinketEffect(-- Meconium)
  38. or player:HasCollectible(-- Hallowed Ground) then
  39. -- get rng
  40. local rng = player:GetCollectibleRNG(-- Miserere)
  41. local roll = rng:RandomInt(100)
  42. -- will the tear be a variant
  43. if roll <= ((100 - pooptear.BASE_CHANCE) × player.Luck / pooptear.MAX.LUCK) + pooptear.BASE_CHANCE) then
  44. -- which variants are possible
  45. local poopVariant = {1, 2, 3, 4, 5} -- 1=holy, 2=dank, 3=golden, 4=rainbow, 5=red
  46. if not (player:HasTrinket(-- Pinky Eye)
  47. or player:HasTrinketEffect(-- Pinky Eye)) then
  48. table.remove(poopVariant, 5)
  49. end
  50. if not (player:HasCollectible(-- Bozo)) then
  51. table.remove(poopVariants, 4)
  52. end
  53. if not (player:HasCollectible(-- Mida's Touch)) then
  54. table.remove(poopVariant, 3)
  55. end
  56. if not (player:HasTrinket(-- Meconium)
  57. or player:HasTrinketEffect(-- Meconium)) then
  58. table.remove(poopVariant, 2)
  59. end
  60. if not (player:HasCollectible(-- Hallowed Ground) then
  61. table.remove(poopVariant, 1)
  62. end
  63. -- saftey check
  64. if poopVariant[1] == nil then -- somehow the poop got emptied
  65. tearData.PoopType == 0 -- a normal poop tear
  66. else -- should happen normaly
  67. local pickPoop = math.random(#poopVariant)
  68. if poopVariant[pickPoop] == 1 then
  69. tearData.PoopType = 1 -- Holy Poop
  70. elseif poopVariant[pickPoop] == 2 then
  71. tearData.PoopType = 2 -- Dank Poop
  72. elseif poopVariant[pickPoop] == 3 then
  73. tearData.PoopType = 3 -- Golden Poop
  74. elseif poopVariant[pickPoop] == 4 then
  75. tearData.PoopType = 4 -- Rainbow Poop
  76. elseif poopVariant[pickPoop] == 5 then
  77. tearData.PoopType = 5 -- Red Poop
  78. end
  79. end
  80. if tearData.PoopType == 1 then -- Holy Poop
  81. if tearData.HasCostume == nil then
  82. if tear:TearFlags() == TearFlags.TEAR_PIERCING then
  83. tearData.HasCostume = true
  84. sprite:ReplaceSpritesheet(0, "gfx/...../holy_poop_tear_piercing.png")
  85. sprite:LoadGraphics()
  86. else
  87. tearData.HasCostume = true
  88. sprite:ReplaceSpritesheet(0, "gfx/...../holy_poop_tear.png")
  89. sprite:LoadGraphics()
  90. end
  91. end
  92. if player:HasTrinket(-- Petrified Poop)
  93. or player:HasTrinketEffect(-- Petrified Poop) then
  94. tear.CollisionDamage = tear.CollisionDamage * pooptear.STONE_BONUS
  95. end
  96. tear:SetSize(tear.Size * pooptear.SCALE, Vector(pooptear.SCALE, pooptear.SCALE), 8)
  97.  
  98. elseif tearData.PoopType == 2 then -- Dank
  99. elseif tearData.PoopType == 3 then -- Golden
  100. elseif tearData.PoopType == 4 then -- Rainbow
  101. elseif tearData.PoopType == 5 then -- Red
  102. end
  103. else
  104. tearData.PoopType = 0
  105. end
  106. else
  107. tearData.PoopType = 0
  108. end
  109. -- do stuff for tearData.PoopType 0
  110. if tearData.PoopType == 0 then
  111.  
  112. end
  113. end
  114. end
  115. end
  116. end
  117. end
  118. end
  119. DirtyTears:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, DirtyTears.onUpdate)
Advertisement
Add Comment
Please, Sign In to add comment