====== Conversion Bomb ====== {{ unit_cbomb.png }} The CBomb, or Conversion Bomb, is a bomb that when activated will convert creeper in a range around the unit into anticreeper. ===== Unit Stats ===== * Requires 44.8 Energy to construct. * Maximum ammo capacity of 250. * Fits in a box of 20 by 21 terrain pixels. ===== Unit Usage ===== The Conversion Bomb must be fully charged with ammunition in order to function. When charged, it will change to a glowing purple/orange look.\\ {{ cbomb_charged.png }} Now, it can be detonated in one of two ways - selecting it and pressing the Destroy button, or moving it into creeper and allowing it to succumb to the damage. The Conversion Bomb's detonation range depends on how intact the bomb is at the time of detonation. If at least 50% or more of the unit is assembled at its location, the explosion range will be maximized. If not enough of the unit has managed to reassemble due to pixels in transit being damaged, the range of the explosion will be severely reduced, or the explosion may not occur at all. ===== Spoilers ===== { "type": "unit", "displayname": "CBomb", "permanentinventory": true, "image": "body.png", "position": [0, 0], "pivot": [0.5, 0.5], "movable": true, "maxammo": 250, "parts": [ {"part": "armed.json", "name": "armed", "position": [0, 0], "active": false}, ], "controllers": [ {"name": "ondestroy_sandexplosion"} ], "scripts": [ {"name": "cbomb.irpl"} ] } The associated cbomb.irpl script: $RANGE:30 if (<-armed !) if (GetAmmo(self) GetMaxAmmo(self) >=) SetActive(<-armedPart true) true ->armed endif endif :Awake GetChild(self "armed") ->armedPart false ->armed :Destroyed if (GetAmmo(self) GetMaxAmmo(self) >=) GetAllPixelCount(self) ->pixelCounts <-pixelCounts[0] ->pixel_none <-pixelCounts[1] ->pixel_onboard <-pixelCounts[2] ->pixel_inroute <-pixelCounts[3] ->pixel_dead <-pixel_onboard <-pixel_dead + ->pixel_total if (<-pixel_total eq0) 0 ->percentComplete else <-pixel_total <-pixel_inroute - <-pixel_total asfloat / ->percentComplete endif #DebugAllSp("NONE:" <-pixel_none "ONBOARD:" <-pixel_onboard "INROUTE:" <-pixel_inroute "DEAD:" <-pixel_dead "TOTAL:" <-pixel_total) #DebugAllSp("% Complete: " <-percentComplete) GetPosition(self) ->pos ConvertCreeperToAC(<-pos.x <-pos.y <-RANGE <-percentComplete * false) endif \\ {{page>navigation}}