Hello guys, I have a little problem with my card, my card effect is the following.
"Once per turn; while this card is face-up on the field, you can reveal 1 Ritual Monster in your Deck, you must also Tribute monsters from your hand or Deck whose total Levels are equal to the revealed monster Level, then Ritual Summon that monster"
but my problem is the following
when you select monsters to Ritual Summon, its also send to select that monster revealed to Tribute, so its send it to the Graveyard, and Ritual Summon from the Graveyard.
how can I fix this?
Script:
--King of the Warrior
function c14712369.initial_effect(c)
--Special Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(14712369,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,14712369)
e1:SetTarget(c14712369.sptg)
e1:SetOperation(c14712369.spop)
c:RegisterEffect(e1)
end
function c14712369.spfilter(c,e,tp,m)
if bit.band(c:GetType(),0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,false) then return false end
if c.mat_filter then
m=m:Filter(c.mat_filter,nil)
end
return m:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c)
end
function c14712369.matfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsReleasableByEffect()
end
function c14712369.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
if chk==0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local mg=Duel.GetMatchingGroup(c14712369.matfilter,tp,LOCATION_HAND+LOCATION_DECK,0,c)
return Duel.IsExistingMatchingCard(c14712369.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,mg)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c14712369.spop(e,tp,eg,ep,ev,re,r,rp,c)
local sf=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or sf:IsFacedown() or not sf:IsRelateToEffect(e) then return end
local mg=Duel.GetMatchingGroup(c14712369.matfilter,tp,LOCATION_HAND+LOCATION_DECK,0,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c14712369.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,mg)
if tg:GetCount()>0 then
local tc=tg:GetFirst()
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil)
end
Duel.ConfirmCards(tp,tc)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(14712369,1))
local mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
tc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL+REASON_RELEASE)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
end
end
NOTE: I try to use "mg:Remove(Card.IsCode,nil,tc:GetCode)" after "Duel.ConfirmCards(tp,tc)", it work, but if only exists 1 monster with a Level example 7 in your Deck, and your select that monster Level 7 to Special Summon, appear an error.
thanks for attention.
Edited by user
2015-06-13T22:46:38Z
|
Reason: Not specified