name: Kiseitai
card_text: When your opponent's monster attacks this card in face-down Defense Position, this card becomes an Equip Spell Card equipped to the attacking monster (No damage calculation is conducted). During each of your opponent's Standby Phases, increase your Life Points by half of the ATK of the monster equipped with this card.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_CONFIRM)
  	e1:SetCondition(s.eqcon)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttackTarget() == e:GetHandler() and e:GetHandler():GetBattlePosition() == POS_FACEDOWN_DEFENSE
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetAttacker()
  	if not tc:IsRelateToBattle() or not c:IsRelateToBattle() then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 or tc:IsFacedown() then
  		Duel.Destroy(c, REASON_EFFECT)
  		return
  	end
  	Duel.Equip(tp, c, tc)
  	local e1 = Effect.CreateEffect(tc)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_EQUIP_LIMIT)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e1:SetValue(s.eqlimit)
  	c:RegisterEffect(e1)
  	--recover
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_RECOVER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.recon)
  	e2:SetTarget(s.retg)
  	e2:SetOperation(s.reop)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.recon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.retg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local ec = e:GetHandler():GetEquipTarget()
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, tp, math.ceil(ec:GetAttack() / 2))
  end
  function s.reop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	local ec = c:GetEquipTarget()
  	if ec then
  		local atk = ec:GetAttack()
  		Duel.Recover(tp, math.ceil(atk / 2), REASON_EFFECT)
  	end
  end
  
  
source_text: Kiseitai
  When your opponent's monster attacks this card in face-down Defense Position, this card becomes an Equip Spell Card equipped to the attacking monster (No damage calculation is conducted). During each of your opponent's Standby Phases, increase your Life Points by half of the ATK of the monster equipped with this card.
target_text: -- Kiseitai
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_CONFIRM)
  	e1:SetCondition(s.eqcon)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetAttackTarget() == e:GetHandler() and e:GetHandler():GetBattlePosition() == POS_FACEDOWN_DEFENSE
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetAttacker()
  	if not tc:IsRelateToBattle() or not c:IsRelateToBattle() then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 or tc:IsFacedown() then
  		Duel.Destroy(c, REASON_EFFECT)
  		return
  	end
  	Duel.Equip(tp, c, tc)
  	local e1 = Effect.CreateEffect(tc)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_EQUIP_LIMIT)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e1:SetValue(s.eqlimit)
  	c:RegisterEffect(e1)
  	--recover
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_RECOVER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.recon)
  	e2:SetTarget(s.retg)
  	e2:SetOperation(s.reop)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.recon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.retg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local ec = e:GetHandler():GetEquipTarget()
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, tp, math.ceil(ec:GetAttack() / 2))
  end
  function s.reop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	local ec = c:GetEquipTarget()
  	if ec then
  		local atk = ec:GetAttack()
  		Duel.Recover(tp, math.ceil(atk / 2), REASON_EFFECT)
  	end
  end
  
  