--ESPergear Knight: Swordie local cid,id=GetID() function cid.initial_effect(c) aux.AddOrigEvoluteType(c) aux.AddEvoluteProc(c,nil,5,aux.FilterBoolFunction(Card.IsCode,16000020),1,1,cid.matfilter,1,1) c:EnableReviveLimit() --atk local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e3:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP+0x1c0) e3:SetCountLimit(1) e3:SetCost(cid.cost) e3:SetTarget(cid.target) e3:SetOperation(cid.operation) c:RegisterEffect(e3) --Special SUmmon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetCondition(cid.spcon) e4:SetTarget(cid.sumtg) e4:SetOperation(cid.spop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_REMOVE) c:RegisterEffect(e5) local e6=e4:Clone() e6:SetCode(EVENT_TO_DECK) c:RegisterEffect(e6) end function cid.matfilter(c,ec,tp) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_UNION) and c:IsRace(RACE_MACHINE) end function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveEC(tp,3,REASON_COST) end e:GetHandler():RemoveEC(tp,3,REASON_COST) end function cid.filter(c) return c:GetSummonLocation()==LOCATION_EXTRA and not (c:GetAttack()==0 and c:IsDisabled()) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cid.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetHandler()) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) local e8=Effect.CreateEffect(c) e8:SetType(EFFECT_TYPE_SINGLE) e8:SetCode(EFFECT_SET_DEFENSE_FINAL) e8:SetValue(0) e8:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e8) Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetValue(RESET_TURN_SET) e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e3) if tc:IsType(TYPE_TRAPMONSTER) then local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_DISABLE_TRAPMONSTER) e4:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e4) end end end function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function cid.mgfilter(c,e,tp,sync) return not c:IsControler(tp) or not c:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) or not r==REASON_MATERIAL+0x10000000 or not c:IsCanBeSpecialSummoned(e,0,tp,false,false) or c:IsHasEffect(EFFECT_NECRO_VALLEY) end function cid.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) local mg=e:GetHandler():GetMaterial() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end if chk==0 then return mg:GetCount()>0 and ft>=mg:GetCount() and not mg:IsExists(cid.mgfilter,1,nil,e,tp,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,mg,mg:GetCount(),tp,0) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local mg=e:GetHandler():GetMaterial() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end if mg:GetCount()>ft or mg:IsExists(cid.mgfilter,1,nil,e,tp,e:GetHandler()) then return end Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEUP) end