name: Samsara
card_text: During your End Phase, if you control no Spell or Trap Cards, you can Special Summon this card from your Graveyard in face-up Attack Position. This card's controller takes 1000 damage during each of their Standby Phases.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.sscon)
  	e1:SetTarget(s.sstg)
  	e1:SetOperation(s.ssop)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.dmcon)
  	e2:SetTarget(s.dmtg)
  	e2:SetOperation(s.dmop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.sscon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.sstg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.ssop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, 0, 1, nil) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, tp, false, false, POS_FACEUP_ATTACK)
  	end
  end
  function s.dmcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.dmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, 0, 0, tp, 1000)
  end
  function s.dmop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then
  		return
  	end
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Samsara
  During your End Phase, if you control no Spell or Trap Cards, you can Special Summon this card from your Graveyard in face-up Attack Position. This card's controller takes 1000 damage during each of their Standby Phases.
target_text: -- Samsara
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.sscon)
  	e1:SetTarget(s.sstg)
  	e1:SetOperation(s.ssop)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.dmcon)
  	e2:SetTarget(s.dmtg)
  	e2:SetOperation(s.dmop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.sscon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.sstg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.ssop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_ONFIELD, 0, 1, nil) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, tp, false, false, POS_FACEUP_ATTACK)
  	end
  end
  function s.dmcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.dmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, 0, 0, tp, 1000)
  end
  function s.dmop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then
  		return
  	end
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  