--Semmwaer, Archfiend of Netherland function c155298.initial_effect(c) --synchro material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TO_GRAVE_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetCondition(c155298.rmcon) c:RegisterEffect(e1) --Draw+Discard local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(155298,0)) e2:SetCategory(CATEGORY_DRAW+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,155298) e2:SetTarget(c155298.drtg) e2:SetOperation(c155298.drop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e4=e2:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) --Spsummon local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetRange(LOCATION_GRAVE) e5:SetCountLimit(1,155298+1) e5:SetCondition(c155298.condition) e5:SetTarget(c155298.target) e5:SetOperation(c155298.operation) c:RegisterEffect(e5) end function c155298.rmcon(e) return bit.band(e:GetHandler():GetReason(),REASON_MATERIAL+REASON_SYNCHRO)==REASON_MATERIAL+REASON_SYNCHRO end function c155298.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c155298.drop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_ONFIELD,0,nil) if Duel.Draw(tp,1,REASON_EFFECT)~=0 or g:GetCount()~=0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,1,nil) Duel.Destroy(sg,REASON_EFFECT) end end function c155298.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()==PHASE_MAIN1 end function c155298.filter1(c,e,tp,lv) local clv=c:GetLevel() return clv>0 and c:IsSetCard(0x45) and c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(c155298.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,lv+clv) end function c155298.filter2(c,e,tp,lv) return c:IsLevelBelow(lv) and c:IsSetCard(0x45) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) end function c155298.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c155298.filter1(chkc,e,tp,e:GetHandler():GetLevel()) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and e:GetHandler():IsAbleToRemove() and Duel.IsExistingTarget(c155298.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp,e:GetHandler():GetLevel()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c155298.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp,e:GetHandler():GetLevel()) g:AddCard(e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c155298.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end local lv=c:GetLevel()+tc:GetLevel() local g=Group.FromCards(c,tc) if Duel.Remove(g,POS_FACEUP,REASON_EFFECT)==2 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=-1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,c155298.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,lv) local sp=sg:GetFirst() if Duel.SpecialSummon(sp,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH) e1:SetReset(RESET_EVENT+0xfe0000+RESET_PHASE+PHASE_END) sp:RegisterEffect(e1,true) sp:CompleteProcedure() end end end