name: Truckroid
card_text: When this card destroys an opponent's monster by battle and sends it to the Graveyard: Equip the destroyed monster to this card. This card gains ATK equal to the combined ATK of the monsters equipped to it by this effect.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCondition(s.eqcon)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = c:GetBattleTarget()
  	if not c:IsRelateToBattle() or c:IsFacedown() then
  		return false
  	end
  	e:SetLabelObject(tc)
  	return tc:IsLocation(LOCATION_GRAVE) and tc:IsType(TYPE_MONSTER) and tc:IsReason(REASON_BATTLE) and not tc:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local tc = e:GetLabelObject()
  	Duel.SetTargetCard(tc)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, tc, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		local atk = tc:GetTextAttack()
  		if atk < 0 then
  			atk = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		if atk > 0 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e2:SetValue(atk)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  
  
source_text: Truckroid
  When this card destroys an opponent's monster by battle and sends it to the Graveyard: Equip the destroyed monster to this card. This card gains ATK equal to the combined ATK of the monsters equipped to it by this effect.
target_text: -- Truckroid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCondition(s.eqcon)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = c:GetBattleTarget()
  	if not c:IsRelateToBattle() or c:IsFacedown() then
  		return false
  	end
  	e:SetLabelObject(tc)
  	return tc:IsLocation(LOCATION_GRAVE) and tc:IsType(TYPE_MONSTER) and tc:IsReason(REASON_BATTLE) and not tc:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local tc = e:GetLabelObject()
  	Duel.SetTargetCard(tc)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, tc, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		local atk = tc:GetTextAttack()
  		if atk < 0 then
  			atk = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		if atk > 0 then
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_EQUIP)
  			e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e2:SetValue(atk)
  			tc:RegisterEffect(e2)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  
  