--Stellarius Miasma of Impiety local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --fusion material c:EnableReviveLimit() --spsummon limit local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(s.splimit) c:RegisterEffect(e0) --atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.val) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --chain resolve attach local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetCountLimit(1,id) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.tgcon) e3:SetOperation(s.tgop) c:RegisterEffect(e3) --set local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCountLimit(1,id+1) e4:SetCondition(s.setcon) e4:SetTarget(s.settg) e4:SetOperation(s.setop) c:RegisterEffect(e4) end s.listed_names={0x12D9} s.material_setcode={0x12D9} function s.splimit(e,se,sp,st) return se:GetHandler():IsCode(997697) or se:GetHandler():IsCode(997699) end function s.val(e,c) return c:GetEquipCount()*100 end function s.chainop(e,tp,eg,ep,ev,re,r,rp) if re:GetHandler():IsSetCard(0x12D9) and re:IsActiveType(TYPE_FUSION) and re:GetOwnerPlayer()==tp and re:GetHandler()~=e:GetHandler() then Duel.SetChainLimit(s.chainlm) end end function s.chainlm(e,rp,tp) return tp==rp end function s.filter(c) return c:IsType(TYPE_XYZ) and c:IsFaceup() end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return rp==tp and re:GetHandler():IsType(TYPE_XYZ) and re:GetHandler():IsSetCard(0x12D9) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if rp~=tp or not re:GetHandler():IsType(TYPE_XYZ) or not re:GetHandler():IsSetCard(0x12D9) or not c:IsLocation(LOCATION_MZONE) or not c:IsFaceup() then return end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) local g2=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) if Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local sg=g:Select(tp,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sc=g2:Select(tp,1,1,sg) local tc=sc:GetFirst() local tc2=sg:GetFirst() if tc and tc2 then local og=tc2:GetOverlayGroup() if #og>0 then Duel.SendtoGrave(og,REASON_RULE) end Duel.Overlay(tc,Group.FromCards(tc2)) end end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.setfilter(c) return c:IsType(TYPE_TRAP+TYPE_SPELL) and c:IsSSetable() and c:IsSetCard(0x12D9) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.setfilter(chkc) end local ct=Duel.GetLocationCount(tp,LOCATION_SZONE) if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ct=ct-1 end if chk==0 then return ct>0 and Duel.IsExistingTarget(s.setfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSSetable() then Duel.SSet(tp,tc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end end