--Tribolazione tramite Automazione --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) aux.AddOrigDriveType(c) --Drive Effects aux.AddDriveProc(c,1) local d1=c:DriveEffect(4,0,CATEGORY_DRAW,EFFECT_TYPE_QUICK_O,EFFECT_FLAG_PLAYER_TARGET,nil,nil,s.drawcost,s.drawtg,s.drawop) local d2=c:DriveEffect(-13,1,{CATEGORY_REMOVE,CATEGORY_CHANGE_ENERGY},EFFECT_TYPE_QUICK_O,true,nil,nil,nil,s.rmtg,s.rmop) --SS local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_GRAVE) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:HOPT() e1:SetCondition(s.spcon3) e1:SetTarget(s.sptg3) e1:SetOperation(s.spop3) c:RegisterEffect(e1) --energy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,4)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:HOPT() e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.drcostfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost() end function s.drawcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.drcostfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.drcostfilter,tp,LOCATION_MZONE,0,1,1,nil) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) end end function s.drawtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.drawop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) Duel.SetCustomOperationInfo(0,CATEGORY_CHANGE_ENERGY,e:GetHandler(),1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetTargetCards() if #g~=0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 and g:IsExists(Card.IsBanished,1,nil) and c:IsRelateToChain() and c:IsEngaged() then Duel.BreakEffect() c:ChangeEnergy(0,tp,REASON_EFFECT) end end function s.spcon3(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsSummonType,1,nil,SUMMON_TYPE_DRIVE) and not eg:IsContains(e:GetHandler()) end function s.sptg3(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.thfil(c) return c:IsMonster(TYPE_DRIVE) and c:IsAbleToHand() end function s.spop3(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToChain() and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.HintSelection(g) Duel.SendtoGrave(g,REASON_EFFECT) end end end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local eng=Duel.GetEngagedCard(tp) if chk==0 then return eng~=nil and eng:IsCanUpdateEnergy(-3,tp,REASON_COST) end eng:UpdateEnergy(-3,tp,REASON_COST) end function s.filter(c) return c:IsSetCard(0x660) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.Search(g,tp) end end