Skip to content

Exchange of the Sheep ​

  • Card ID: 120293030
  • Format: Rush Duel
  • Script: Rush/Scripts/c120293030.lua

Stats ​

FieldValue
Type0x4
ATK0
DEF0
Level/Rank/Link0x0
Race0x0
Attribute0x0
Category0x40120

Card Text ​

text
[REQUIREMENT]	
When your opponent draws a card(s) while you have 15 or more Beast Type monsters in your Graveyard, send your entire hand to the Graveyard.	
[EFFECT]	
Shuffle all cards from the Graveyards into the owners' Decks. Then, you can draw 1 card and show it. If that card is a Level 7 or higher Beast Type monster, you can Special Summon it face-up to your field.

Detected API Calls ​

Script ​

lua
local cm,m=GetID()
cm.name="羊界与咩~界的逆转"
function cm.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_TODECK+CATEGORY_GRAVE_ACTION+CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_DRAW)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
	e1:SetCondition(cm.condition)
	e1:SetCost(cm.cost)
	e1:SetTarget(cm.target)
	e1:SetOperation(cm.activate)
	c:RegisterEffect(e1)
end
--Activate
function cm.confilter(c)
	return c:IsRace(RACE_BEAST)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
	return ep~=tp and Duel.IsExistingMatchingCard(cm.confilter,tp,LOCATION_GRAVE,0,15,nil)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil) end
	local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
	Duel.SendtoGrave(g,REASON_COST)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
	local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil)
	if chk==0 then return g:GetCount()>0 end
	Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
	local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsAbleToDeck),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil)
	if RD.SendToDeckAndExists(mg,e,tp,REASON_EFFECT) then
		if Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
			local tc=Duel.GetDecktopGroup(tp,1):GetFirst()
			Duel.BreakEffect()
			Duel.Draw(tp,1,REASON_EFFECT)
			Duel.ConfirmCards(1-tp,tc)
			if tc:IsLevelAbove(7) and tc:IsRace(RACE_BEAST)
				and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
				and RD.IsCanBeSpecialSummoned(tc,e,tp,POS_FACEUP)
				and Duel.SelectEffectYesNo(tp,tc,aux.Stringid(m,1)) then
				Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
			end
		end
	end
end