Plunder
Fusion Summon 1 Fiend Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. You can banish this card from your GY, then target 1 "Plunder Patroll" monster you control; equip 1 "Emblem of the Plunder Patroll", or 1 "Plunder Patroll" monster, from your Deck to that target. You can only use this effect of "Plunder Patroll Shipshape Ships Shipping" once per turn.
local CARD_ID_0 = 80621422 --Emblem of the Plunder Patroll
local SETCARD_ID_0 = 0x13f --Plunder

local CARD_ID_0 = 80621422 --Emblem of the Plunder Patroll
local SETCARD_ID_0 = 0x13f --Plunder
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = FusionSpell.CreateSummonEffect(c, {
		fusfilter = s.fusfilter,
	})
	e1:SetDescription(aux.Stringid(id, 0))
	c:RegisterEffect(e1)
	--equip
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetCategory(CATEGORY_EQUIP)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.eqtg)
	e2:SetOperation(s.eqop)
	c:RegisterEffect(e2)
end

function s.fusfilter(c)
	return c:IsRace(RACE_FIEND)
end

function s.eqfilter(c, ec, tp)
	return (c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) or c:IsCode(CARD_ID_0) and c:CheckEquipTarget(ec)) and not c:IsForbidden() and c:CheckUniqueOnField(tp, LOCATION_SZONE)
end

function s.cfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_DECK, 0, 1, nil, c, tp)
end

function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.cfilter(chkc, tp)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, tp) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
	Duel.SelectTarget(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp)
	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_DECK)
end

function s.eqop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local tc = Duel.GetFirstTarget()
	if Duel.GetLocationCount(tp, LOCATION_SZONE) < 1 then
		return
	end
	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tc, tp)
		local sc = g:GetFirst()
		if not sc then
			return
		end
		if not Duel.Equip(tp, sc, tc) then
			return
		end
		--equip limit
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetCode(EFFECT_EQUIP_LIMIT)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
		e1:SetLabelObject(tc)
		e1:SetValue(s.eqlimit)
		sc:RegisterEffect(e1)
	end
end

function s.eqlimit(e, c)
	return c == e:GetLabelObject()
end


Plunder
Fusion Summon 1 Fiend Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. You can banish this card from your GY, then target 1 "Plunder Patroll" monster you control; equip 1 "Emblem of the Plunder Patroll", or 1 "Plunder Patroll" monster, from your Deck to that target. You can only use this effect of "Plunder Patroll Shipshape Ships Shipping" once per turn.
-- Plunder
local CARD_ID_0 = 80621422 --Emblem of the Plunder Patroll
local SETCARD_ID_0 = 0x13f --Plunder
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = FusionSpell.CreateSummonEffect(c, {
		fusfilter = s.fusfilter,
	})
	e1:SetDescription(aux.Stringid(id, 0))
	c:RegisterEffect(e1)
	--equip
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetCategory(CATEGORY_EQUIP)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.eqtg)
	e2:SetOperation(s.eqop)
	c:RegisterEffect(e2)
end

function s.fusfilter(c)
	return c:IsRace(RACE_FIEND)
end

function s.eqfilter(c, ec, tp)
	return (c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) or c:IsCode(CARD_ID_0) and c:CheckEquipTarget(ec)) and not c:IsForbidden() and c:CheckUniqueOnField(tp, LOCATION_SZONE)
end

function s.cfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_DECK, 0, 1, nil, c, tp)
end

function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.cfilter(chkc, tp)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, tp) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
	Duel.SelectTarget(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp)
	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_DECK)
end

function s.eqop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local tc = Duel.GetFirstTarget()
	if Duel.GetLocationCount(tp, LOCATION_SZONE) < 1 then
		return
	end
	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tc, tp)
		local sc = g:GetFirst()
		if not sc then
			return
		end
		if not Duel.Equip(tp, sc, tc) then
			return
		end
		--equip limit
		local e1 = Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetCode(EFFECT_EQUIP_LIMIT)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
		e1:SetLabelObject(tc)
		e1:SetValue(s.eqlimit)
		sc:RegisterEffect(e1)
	end
end

function s.eqlimit(e, c)
	return c == e:GetLabelObject()
end

