name: Giant
card_text: You can flip this card into face-down Defense Position once per turn during your Main Phase. If the ATK of a monster on your opponent's side of the field that attacks this card in face-down Defense Position is lower than the DEF of this monster, the attacking monster is destroyed.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--turn set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(s.descon)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanTurnSet() and c:GetFlagEffect(id) == 0
  	end
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET + RESET_PHASE + PHASE_END, 0, 1)
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, c, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		Duel.ChangePosition(c, POS_FACEDOWN_DEFENSE)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return aux.dsercon(e, tp, eg, ep, ev, re, r, rp)
  		and Duel.GetAttackTarget() == e:GetHandler()
  		and e:GetHandler():GetBattlePosition() == POS_FACEDOWN_DEFENSE
  		and Duel.GetAttacker():GetAttack() < e:GetHandler():GetDefense()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, Duel.GetAttacker(), 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if not a:IsRelateToBattle() then
  		return
  	end
  	Duel.Destroy(a, REASON_EFFECT)
  end
  
  
source_text: Giant
  You can flip this card into face-down Defense Position once per turn during your Main Phase. If the ATK of a monster on your opponent's side of the field that attacks this card in face-down Defense Position is lower than the DEF of this monster, the attacking monster is destroyed.
target_text: -- Giant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--turn set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(s.descon)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanTurnSet() and c:GetFlagEffect(id) == 0
  	end
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET + RESET_PHASE + PHASE_END, 0, 1)
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, c, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		Duel.ChangePosition(c, POS_FACEDOWN_DEFENSE)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return aux.dsercon(e, tp, eg, ep, ev, re, r, rp)
  		and Duel.GetAttackTarget() == e:GetHandler()
  		and e:GetHandler():GetBattlePosition() == POS_FACEDOWN_DEFENSE
  		and Duel.GetAttacker():GetAttack() < e:GetHandler():GetDefense()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, Duel.GetAttacker(), 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if not a:IsRelateToBattle() then
  		return
  	end
  	Duel.Destroy(a, REASON_EFFECT)
  end
  
  