Shell
When this card is Normal Summoned: You can change this card to Defense Position, and if you do, inflict 500 damage to your opponent. If this card is sent to the GY by card effect, or destroyed by battle: You can add 1 Level 8 Rock monster from your Deck to your hand, or if "Fossil Fusion" is in your GY, you can Special Summon it instead. For the rest of this turn, you cannot activate cards, or the effects of cards, with the same name as that card. You can only use this effect of "Shell Knight" once per turn.
local CARD_ID_0 = 59419719 --Fossil Fusion

local CARD_ID_0 = 59419719 --Fossil Fusion
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--burn
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_POSITION + CATEGORY_DAMAGE)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_SUMMON_SUCCESS)
	e1:SetTarget(s.damtg)
	e1:SetOperation(s.damop)
	c:RegisterEffect(e1)
	--add/ss rock monster
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetCode(EVENT_BATTLE_DESTROYED)
	e2:SetCountLimit(1, id)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EVENT_TO_GRAVE)
	e3:SetCondition(s.thcon)
	c:RegisterEffect(e3)
end
function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 500)
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if c:IsFaceup() and c:IsAttackPos() and c:IsRelateToEffect(e) and Duel.ChangePosition(c, POS_FACEUP_DEFENSE) then
		Duel.Damage(1 - tp, 500, REASON_EFFECT)
	end
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsReason(REASON_EFFECT)
end
function s.filter(c, e, tp, check)
	return c:IsLevel(8) and c:IsRace(RACE_ROCK) and (c:IsAbleToHand() or check and c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		local check = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, e, tp, check)
	end
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local check = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
	local tc = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, check):GetFirst()
	if tc then
		if check and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not tc:IsAbleToHand() or Duel.SelectOption(tp, 1190, 1152) == 1) then
			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
		else
			Duel.SendtoHand(tc, nil, REASON_EFFECT)
			Duel.ConfirmCards(1 - tp, tc)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_FIELD)
		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
		e1:SetCode(EFFECT_CANNOT_ACTIVATE)
		e1:SetTargetRange(1, 0)
		e1:SetValue(s.aclimit)
		e1:SetLabel(tc:GetCode())
		e1:SetReset(RESET_PHASE + PHASE_END)
		Duel.RegisterEffect(e1, tp)
	end
end
function s.aclimit(e, re, tp)
	local tc = e:GetLabelObject()
	return re:GetHandler():IsCode(e:GetLabel())
end


Shell
When this card is Normal Summoned: You can change this card to Defense Position, and if you do, inflict 500 damage to your opponent. If this card is sent to the GY by card effect, or destroyed by battle: You can add 1 Level 8 Rock monster from your Deck to your hand, or if "Fossil Fusion" is in your GY, you can Special Summon it instead. For the rest of this turn, you cannot activate cards, or the effects of cards, with the same name as that card. You can only use this effect of "Shell Knight" once per turn.
-- Shell
local CARD_ID_0 = 59419719 --Fossil Fusion
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--burn
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_POSITION + CATEGORY_DAMAGE)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_SUMMON_SUCCESS)
	e1:SetTarget(s.damtg)
	e1:SetOperation(s.damop)
	c:RegisterEffect(e1)
	--add/ss rock monster
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 1))
	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_SPECIAL_SUMMON + CATEGORY_DECKDES)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetCode(EVENT_BATTLE_DESTROYED)
	e2:SetCountLimit(1, id)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EVENT_TO_GRAVE)
	e3:SetCondition(s.thcon)
	c:RegisterEffect(e3)
end
function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 500)
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if c:IsFaceup() and c:IsAttackPos() and c:IsRelateToEffect(e) and Duel.ChangePosition(c, POS_FACEUP_DEFENSE) then
		Duel.Damage(1 - tp, 500, REASON_EFFECT)
	end
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsReason(REASON_EFFECT)
end
function s.filter(c, e, tp, check)
	return c:IsLevel(8) and c:IsRace(RACE_ROCK) and (c:IsAbleToHand() or check and c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		local check = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, e, tp, check)
	end
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local check = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(Card.IsCode, tp, LOCATION_GRAVE, 0, 1, nil, CARD_ID_0)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
	local tc = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, check):GetFirst()
	if tc then
		if check and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not tc:IsAbleToHand() or Duel.SelectOption(tp, 1190, 1152) == 1) then
			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
		else
			Duel.SendtoHand(tc, nil, REASON_EFFECT)
			Duel.ConfirmCards(1 - tp, tc)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_FIELD)
		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
		e1:SetCode(EFFECT_CANNOT_ACTIVATE)
		e1:SetTargetRange(1, 0)
		e1:SetValue(s.aclimit)
		e1:SetLabel(tc:GetCode())
		e1:SetReset(RESET_PHASE + PHASE_END)
		Duel.RegisterEffect(e1, tp)
	end
end
function s.aclimit(e, re, tp)
	local tc = e:GetLabelObject()
	return re:GetHandler():IsCode(e:GetLabel())
end

