name: Spear
card_text: If this card attacks a Defense Position monster, inflict piercing battle damage. If this card attacks, it is changed to Defense Position at the end of the Damage Step.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--to defense
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetCondition(s.poscon)
  	e1:SetOperation(s.posop)
  	c:RegisterEffect(e1)
  	--pierce
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e2)
  end
  function s.poscon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler() == Duel.GetAttacker() and e:GetHandler():IsRelateToBattle()
  end
  function s.posop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsAttackPos() then
  		Duel.ChangePosition(c, POS_FACEUP_DEFENSE)
  	end
  end
  
  
source_text: Spear
  If this card attacks a Defense Position monster, inflict piercing battle damage. If this card attacks, it is changed to Defense Position at the end of the Damage Step.
target_text: -- Spear
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to defense
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetCondition(s.poscon)
  	e1:SetOperation(s.posop)
  	c:RegisterEffect(e1)
  	--pierce
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e2)
  end
  function s.poscon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler() == Duel.GetAttacker() and e:GetHandler():IsRelateToBattle()
  end
  function s.posop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsAttackPos() then
  		Duel.ChangePosition(c, POS_FACEUP_DEFENSE)
  	end
  end
  
  