World
All "Mekk-Knight" monsters on the field gain 300 ATK/DEF. Once per turn: You can discard 1 "Mekk-Knight" monster or 1 "World Legacy" card; draw 1 card. You can banish 8 "Mekk-Knight" monsters with different names from your GY and/or face-up from your field; send your opponent's entire hand and Extra Deck to the GY.
local SETCARD_ID_0 = 0x10c --Mekk-Knight

local SETCARD_ID_0 = 0x10c --Mekk-Knight
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)
	--atk/def
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_UPDATE_ATTACK)
	e2:SetRange(LOCATION_FZONE)
	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
	e2:SetValue(300)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EFFECT_UPDATE_DEFENSE)
	c:RegisterEffect(e3)
	--draw
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 0))
	e4:SetCategory(CATEGORY_DRAW)
	e4:SetType(EFFECT_TYPE_IGNITION)
	e4:SetRange(LOCATION_FZONE)
	e4:SetCountLimit(1)
	e4:SetCost(s.drcost)
	e4:SetTarget(s.drtg)
	e4:SetOperation(s.drop)
	c:RegisterEffect(e4)
	--to grave
	local e5 = Effect.CreateEffect(c)
	e5:SetDescription(aux.Stringid(id, 1))
	e5:SetCategory(CATEGORY_TOGRAVE)
	e5:SetType(EFFECT_TYPE_IGNITION)
	e5:SetRange(LOCATION_FZONE)
	e5:SetCost(s.tgcost)
	e5:SetTarget(s.tgtg)
	e5:SetOperation(s.tgop)
	c:RegisterEffect(e5)
end
function s.costfilter1(c)
	return ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0xfe)) and c:IsDiscardable()
end
function s.drcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.costfilter1, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
	Duel.DiscardHand(tp, s.costfilter1, 1, 1, REASON_DISCARD + REASON_COST)
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanDraw(tp, 1)
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
	Duel.Draw(p, d, REASON_EFFECT)
end
function s.costfilter2(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsAbleToRemoveAsCost()
end
function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
	local g = Duel.GetMatchingGroup(s.costfilter2, tp, LOCATION_ONFIELD + LOCATION_GRAVE, 0, nil)
	if chk == 0 then
		return g:GetClassCount(Card.GetCode) >= 8
	end
	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	aux.GCheckAdditional = aux.dncheck
	local rg = g:SelectSubGroup(tp, aux.TRUE, false, 8, 8)
	aux.GCheckAdditional = nil
	Duel.Remove(rg, POS_FACEUP, REASON_COST)
end
function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, 1, nil)
	end
	local g = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g, g:GetCount(), 0, 0)
end
function s.tgop(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, nil)
	Duel.SendtoGrave(g, REASON_EFFECT)
end


World
All "Mekk-Knight" monsters on the field gain 300 ATK/DEF. Once per turn: You can discard 1 "Mekk-Knight" monster or 1 "World Legacy" card; draw 1 card. You can banish 8 "Mekk-Knight" monsters with different names from your GY and/or face-up from your field; send your opponent's entire hand and Extra Deck to the GY.
-- World
local SETCARD_ID_0 = 0x10c --Mekk-Knight
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)
	--atk/def
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_UPDATE_ATTACK)
	e2:SetRange(LOCATION_FZONE)
	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
	e2:SetValue(300)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EFFECT_UPDATE_DEFENSE)
	c:RegisterEffect(e3)
	--draw
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 0))
	e4:SetCategory(CATEGORY_DRAW)
	e4:SetType(EFFECT_TYPE_IGNITION)
	e4:SetRange(LOCATION_FZONE)
	e4:SetCountLimit(1)
	e4:SetCost(s.drcost)
	e4:SetTarget(s.drtg)
	e4:SetOperation(s.drop)
	c:RegisterEffect(e4)
	--to grave
	local e5 = Effect.CreateEffect(c)
	e5:SetDescription(aux.Stringid(id, 1))
	e5:SetCategory(CATEGORY_TOGRAVE)
	e5:SetType(EFFECT_TYPE_IGNITION)
	e5:SetRange(LOCATION_FZONE)
	e5:SetCost(s.tgcost)
	e5:SetTarget(s.tgtg)
	e5:SetOperation(s.tgop)
	c:RegisterEffect(e5)
end
function s.costfilter1(c)
	return ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0xfe)) and c:IsDiscardable()
end
function s.drcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.costfilter1, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
	Duel.DiscardHand(tp, s.costfilter1, 1, 1, REASON_DISCARD + REASON_COST)
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanDraw(tp, 1)
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
	Duel.Draw(p, d, REASON_EFFECT)
end
function s.costfilter2(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsAbleToRemoveAsCost()
end
function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
	local g = Duel.GetMatchingGroup(s.costfilter2, tp, LOCATION_ONFIELD + LOCATION_GRAVE, 0, nil)
	if chk == 0 then
		return g:GetClassCount(Card.GetCode) >= 8
	end
	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	aux.GCheckAdditional = aux.dncheck
	local rg = g:SelectSubGroup(tp, aux.TRUE, false, 8, 8)
	aux.GCheckAdditional = nil
	Duel.Remove(rg, POS_FACEUP, REASON_COST)
end
function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, 1, nil)
	end
	local g = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g, g:GetCount(), 0, 0)
end
function s.tgop(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(Card.IsAbleToGrave, tp, 0, LOCATION_HAND + LOCATION_EXTRA, nil)
	Duel.SendtoGrave(g, REASON_EFFECT)
end

