An ATproto social media client -- with an independent Appview.
at main 21 lines 644 B view raw
1// It should roll when: 2// - We're going from 1 to 0 (roll backwards) 3// - The count is anywhere between 1 and 999 4// - The count is going up and is a multiple of 100 5// - The count is going down and is 1 less than a multiple of 100 6export function decideShouldRoll(isSet: boolean, count: number) { 7 let shouldRoll = false 8 if (!isSet && count === 1) { 9 shouldRoll = true 10 } else if (count > 1 && count < 1000) { 11 shouldRoll = true 12 } else if (count > 0) { 13 const mod = count % 100 14 if (isSet && mod === 0) { 15 shouldRoll = true 16 } else if (!isSet && mod === 99) { 17 shouldRoll = true 18 } 19 } 20 return shouldRoll 21}