GB Bug

### Collection Grid

*(page 4, column 20, row 2)**(page 4, column 20, row 2)**(page 4, column 1, row 3)*

### Unlock Method

 Defeat Ultra Greed as  Eden

**GB Bug** is an unlockable passive item added in *The Binding of Isaac: Afterbirth*.

## Effects

* Spawns a familiar that bounces diagonally around the room, deals 8 damage per tick or 120 damage per second and applies a random status effect to enemies it comes in contact with. The familiar also has a chance to re-roll pickups that it passes over into other pickups, Chests, or items, in an uncleared room only (with at least one enemy alive).
* Spawns a familiar that follows Isaac. Double tapping the fire button launches it forward, causing it to reroll the first monster, trinket, or pickup it hits. It respawns after clearing a room.
	+ If it cannot reroll an enemy (e.g. a boss), it will deal 8 damage instead.
	+ Items and opened chests cannot be rerolled.
	+ Pickups have a 10% chance of becoming chests (see the algorithm).
		- If a chest is rerolled, it has a 28% chance of staying as some kind of a chest.

## Notes

* GB Bug can block projectiles.
* GB Bug does more damage per second than , with the added random status chance.
* GB Bug is able to reroll Throwable Bombs into normal consumables. After doing so, the corresponding Bomb Grimace will generate another Throwable Bomb, making it able to generate a potentially large amount of free consumables.
* Rerolled champion enemies will retain their color, unless they reroll into a monster that cannot naturally spawn as a champion.
* Caution is advised as GB Bug can also reroll certain entities such as the hot rock left by a dead Coal Spider adding another enemy to the room.
* Familiars that follow behind Isaac have a certain priority in how close their position is to him over other familiars, with GB Bug having 5th priority.

## Interactions

* : Hitting Blood Puppy with GB Bug will transform it into a random enemy and spawn a tamed Blood Puppy.
* : GB Bug will only throw itself at nearby enemies automatically if a fire button is double tapped while King Baby's effect is active.
* : Does not launch itself automatically or at the crosshair while Isaac is firing.
* : The familiar can be duplicated even if it hasn’t respawned; by constantly moving to new rooms, GB Bug can constantly respawn, allowing pickups to be rerolled indefinitely.

## Algorithm

A reverse-engineered algorithm used by GB Bug to determine its rerolls is available:

```
local chestPickupVariants = {
   PickupVariant.PICKUP_CHEST, -- 50
   PickupVariant.PICKUP_BOMBCHEST -- 51
   PickupVariant.PICKUP_SPIKEDCHEST -- 52
   PickupVariant.PICKUP_ETERNALCHEST -- 53
   PickupVariant.PICKUP_MIMICCHEST, -- 54
   PickupVariant.PICKUP_OLDCHEST, -- 55
   PickupVariant.PICKUP_WOODENCHEST, -- 56
   PickupVariant.PICKUP_MEGACHEST, -- 57
   PickupVariant.PICKUP_HAUNTEDCHEST, -- 58
   PickupVariant.PICKUP_LOCKEDCHEST, -- 60
   PickupVariant.PICKUP_REDCHEST, -- 360
   PickupVariant.PICKUP_MOMSCHEST, -- 390
 }
 if (
   (contains(chestPickupVariants, pickupVariant) and (pickupSeed:Next() % 5) == 0)
   or (pickupSeed:Next() % 10) == 0
 ) then
   local chestVariant
   if (pickupSeed:Next() & 3) == 0 then
     chestVariant = PickupVariant.PICKUP_LOCKEDCHEST
   else
     chestVariant = PickupVariant.PICKUP_CHEST
   end
   pickup:Morph(pickup.Type, chestVariant, 0, true, false, false)
 else
   pickup:Morph(pickup.Type, 0, 1, true, false, false)
 end

```

* An explanation of the code: rerolling something has a 10% chance of becoming a chest and 90% chance of becoming a random pickup.
	+ A chest of any kind has an independent 20% extra chance of staying a chest, for a total 28% chance.
	+ If something is rerolled into a chest, it is a random chest according to standard spawning rules 75% of the time, and a locked chest 25% of the time.

## Trivia

* Before *Repentance*, GB Bug's pickup quote was "Game breaking bug, right away!"
	+ This is a reference to a quote by Phil Fish in *Indie Game: The Movie*, where he says the same words when a bug is discovered in the game "FEZ" on the first day it is being shown at PAX.
* This item's in-game appearance may be a reference to "Missingno.", a famous bug occurring in the first Pokémon games.

## References

1. ↑ Researched by Blade
2. ↑ https://twitter.com/edmundmcmillen/status/666029976920043520