name: Dark
card_text: During your Main Phase: You can Fusion Summon 1 Fiend Fusion Monster from your Extra Deck, using monsters from your hand or field as material. You can only use this effect of "Dark Contract with the Swamp King" once per turn. If Summoning a "D/D" Fusion Monster this way, you can also banish monsters from your GY as material. Once per turn, during your Standby Phase: Take 1000 damage.
external_ids: local SETCARD_ID_0 = 0xaf --D/D
  
lua: local SETCARD_ID_0 = 0xaf --D/D
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--fusion summon
  	local e2 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = s.pre_select_mat_location,
  	})
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON + CATEGORY_GRAVE_ACTION)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.damcon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	c:RegisterEffect(e3)
  end
  
  function s.fusfilter(c)
  	return c:IsRace(RACE_FIEND)
  end
  
  function s.pre_select_mat_location(tc)
  	local location = LOCATION_HAND | LOCATION_MZONE
  	if tc:IsSetCard(SETCARD_ID_0) then
  		location = location | LOCATION_GRAVE
  	end
  	return location
  end
  
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  
  function s.damtg(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.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Dark
  During your Main Phase: You can Fusion Summon 1 Fiend Fusion Monster from your Extra Deck, using monsters from your hand or field as material. You can only use this effect of "Dark Contract with the Swamp King" once per turn. If Summoning a "D/D" Fusion Monster this way, you can also banish monsters from your GY as material. Once per turn, during your Standby Phase: Take 1000 damage.
target_text: -- Dark
  local SETCARD_ID_0 = 0xaf --D/D
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--fusion summon
  	local e2 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = s.pre_select_mat_location,
  	})
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON + CATEGORY_GRAVE_ACTION)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.damcon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	c:RegisterEffect(e3)
  end
  
  function s.fusfilter(c)
  	return c:IsRace(RACE_FIEND)
  end
  
  function s.pre_select_mat_location(tc)
  	local location = LOCATION_HAND | LOCATION_MZONE
  	if tc:IsSetCard(SETCARD_ID_0) then
  		location = location | LOCATION_GRAVE
  	end
  	return location
  end
  
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  
  function s.damtg(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.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  