name: World
card_text: When an opponent's monster activates its effect while you control a "Krawler" monster: The activated effect becomes "return 1 face-up monster your opponent controls to the hand". You can banish this card from your GY, then target 1 Link Monster on the field; Special Summon 1 "Krawler" monster from your hand, Deck, or GY to your zone the target points to, in face-down Defense Position. You can only use 1 "World Legacy's Mind Meld" effect per turn, and only once that turn.
external_ids: local SETCARD_ID_0 = 0x104 --Krawler
  
lua: local SETCARD_ID_0 = 0x104 --Krawler
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--change effect
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.cecondition)
  	e1:SetTarget(s.cetarget)
  	e1:SetOperation(s.ceoperation)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.sptarget)
  	e2:SetOperation(s.spoperation)
  	c:RegisterEffect(e2)
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	local sg = Duel.SelectMatchingCard(tp, s.thfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	if sg:GetCount() > 0 then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.cecondition(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.thfilter(c)
  	return c:IsFaceup() and c:IsAbleToHand()
  end
  function s.cetarget(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, rp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.ceoperation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Group.CreateGroup()
  	Duel.ChangeTargetCard(ev, g)
  	Duel.ChangeChainOperation(ev, s.repop)
  end
  function s.spfilter1(c, e, tp)
  	local zone = bit.band(c:GetLinkedZone(tp), 0x1f)
  	return c:IsFaceup() and c:IsType(TYPE_LINK) and zone > 0 and Duel.IsExistingMatchingCard(s.spfilter2, tp, 0x13, 0, 1, c, e, tp, zone)
  end
  function s.spfilter2(c, e, tp, zone)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEDOWN_DEFENSE, tp, zone)
  end
  function s.sptarget(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return s.spfilter1(chkc, e, tp) and chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.spfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, 0x13)
  end
  function s.spoperation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		local zone = bit.band(tc:GetLinkedZone(tp), 0x1f)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter2), tp, 0x13, 0, 1, 1, c, e, tp, zone)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEDOWN_DEFENSE, zone)
  			Duel.ConfirmCards(1 - tp, sg)
  		end
  	end
  end
  
  
source_text: World
  When an opponent's monster activates its effect while you control a "Krawler" monster: The activated effect becomes "return 1 face-up monster your opponent controls to the hand". You can banish this card from your GY, then target 1 Link Monster on the field; Special Summon 1 "Krawler" monster from your hand, Deck, or GY to your zone the target points to, in face-down Defense Position. You can only use 1 "World Legacy's Mind Meld" effect per turn, and only once that turn.
target_text: -- World
  local SETCARD_ID_0 = 0x104 --Krawler
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--change effect
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.cecondition)
  	e1:SetTarget(s.cetarget)
  	e1:SetOperation(s.ceoperation)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.sptarget)
  	e2:SetOperation(s.spoperation)
  	c:RegisterEffect(e2)
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	local sg = Duel.SelectMatchingCard(tp, s.thfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	if sg:GetCount() > 0 then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.cecondition(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.thfilter(c)
  	return c:IsFaceup() and c:IsAbleToHand()
  end
  function s.cetarget(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, rp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.ceoperation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Group.CreateGroup()
  	Duel.ChangeTargetCard(ev, g)
  	Duel.ChangeChainOperation(ev, s.repop)
  end
  function s.spfilter1(c, e, tp)
  	local zone = bit.band(c:GetLinkedZone(tp), 0x1f)
  	return c:IsFaceup() and c:IsType(TYPE_LINK) and zone > 0 and Duel.IsExistingMatchingCard(s.spfilter2, tp, 0x13, 0, 1, c, e, tp, zone)
  end
  function s.spfilter2(c, e, tp, zone)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEDOWN_DEFENSE, tp, zone)
  end
  function s.sptarget(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return s.spfilter1(chkc, e, tp) and chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.spfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, 0x13)
  end
  function s.spoperation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		local zone = bit.band(tc:GetLinkedZone(tp), 0x1f)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter2), tp, 0x13, 0, 1, 1, c, e, tp, zone)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEDOWN_DEFENSE, zone)
  			Duel.ConfirmCards(1 - tp, sg)
  		end
  	end
  end
  
  