-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.lua
49 lines (44 loc) · 1.43 KB
/
utils.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
if __eidTrinketDescriptions == nil then
__eidTrinketDescriptions = {}
end
return {
isFire = function(entityRef)
return (entityRef.Type == EntityType.ENTITY_FIREPLACE or
(entityRef.Type == EntityType.ENTITY_EFFECT and
(entityRef.Variant == EffectVariant.BLUE_FLAME or
entityRef.Variant == EffectVariant.RED_CANDLE_FLAME or
entityRef.Variant == EffectVariant.HOT_BOMB_FIRE)))
end,
chance = function(x, affectedByLuck)
-- Takes percentage, i.e. 20 for 20%
if not affectedByLuck then
return math.random() < (x / 100)
else
local player = Isaac.GetPlayer(0)
-- +5% chance for every luck up
local modifier = x + 5 * player.Luck
return math.random() < (x / 100)
end
end,
log = function(text)
if TrinketPatches.debug then
print("[TP] "..tostring(text))
end
end,
register = function(arg)
return setmetatable({arg}, {
__concat = function(_, f)
TrinketPatches.mod:AddCallback(ModCallbacks[arg], f)
return f
end
})
end,
registerEID = function(description)
return setmetatable({description}, {
__concat = function(_, item)
__eidTrinketDescriptions[item] = description
return item
end
})
end
}