--Mysterious Gardna function c53313906.initial_effect(c) aux.AddOrigPandemoniumType(c) --P-If a monster battles, during damage calculation (in either player's turn): You can make the battle damage you take from this battle 0, then Special Summon this card from your Spell & Trap Zone. local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_CAL) e1:SetHintTiming(TIMING_DAMAGE_CAL) e1:SetRange(LOCATION_SZONE) e1:SetCondition(aux.PandActCheck) e1:SetTarget(c53313906.atkcost) e1:SetOperation(c53313906.atkop) c:RegisterEffect(e1) aux.EnablePandemoniumAttribute(c,e1) --M-While you control another "Mysterious" monster other than "Mysterious Gardna", this card cannot be destroyed by battle. local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetCondition(c53313906.indcon) e2:SetValue(1) c:RegisterEffect(e2) --M-If this card is Tributed for a Tribute Summon: You can Set this card to your Spell/Trap Zone. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_RELEASE) e3:SetCondition(c53313906.thcon) e3:SetTarget(c53313906.thtg) e3:SetOperation(c53313906.thop) c:RegisterEffect(e3) end function c53313906.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetBattleDamage(tp)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c53313906.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetOperation(c53313906.damop) e1:SetReset(RESET_PHASE+PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) if c:IsRelateToEffect(e) then Duel.BreakEffect() c:SetCardData(CARDDATA_TYPE,TYPE_MONSTER+TYPE_EFFECT) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function c53313906.damop(e,tp,eg,ep,ev,re,r,rp) Duel.ChangeBattleDamage(tp,0) end function c53313906.filter(c) return c:IsFaceup() and not c:IsCode(53313906) and c:IsSetCard(0xcf6) end function c53313906.indcon(e) return Duel.IsExistingMatchingCard(c53313906.filter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler()) end function c53313906.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_SUMMON) end function c53313906.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsPandemoniumSSetable() end if e:GetHandler():IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end end function c53313906.thop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler() if tc:IsRelateToEffect(e) and tc:IsPandemoniumSSetable() then Duel.PandSSet(tc,e,tp,REASON_EFFECT) end end