--Fiendroot, the Possessed Tree local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddOrigBigbangType(c) aux.AddBigbangProc(c,Card.IsNeutral,1,1,s.matfilter1,1) --If this card is Bigbang Summoned: You can excavate the top 3 cards of your Deck, and if you do, you can either add to your hand or send to the GY 1 excavated Plant monster, also shuffle the rest into your Deck. local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,{id,0}) e1:SetCondition(s.excon) e1:SetTarget(s.extg) e1:SetOperation(s.exop) c:RegisterEffect(e1) --Once per turn you can target 1 face-up Attack Position monster your opponent controls; equip it to this card. local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) --Gains ATK equal to half the combined ATK of the monsters equipped to it. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(s.atkval) c:RegisterEffect(e3) end function s.matfilter1(c) return c:IsRace(RACE_PLANT) and not c:IsNeutral() end function s.excon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_BIGBANG) end function s.extg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetDecktopGroup(tp,3) if chk==0 then return g:IsExists(Card.IsAbleToHand,1,nil) or g:IsExists(Card.IsAbleToGrave,1,nil) end end function s.filter(c,e) return c:IsRace(RACE_PLANT) and (c:IsAbleToHand() or c:IsAbleToGrave()) end function s.exop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetDecktopGroup(tp,3) if #g==3 then Duel.ConfirmDecktop(tp,3) local tg=g:Filter(s.filter,nil,e) if #tg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD) local sg=tg:Select(tp,1,1,nil) local tc=sg:GetFirst() if tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectYesNo(tp,aux.Stringid(id,0))) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) else Duel.SendtoGrave(tc,REASON_EFFECT) end end Duel.ShuffleDeck(tp) end end function s.eqfilter(c) return c:IsFaceup() and c:IsAttackPos() and c:IsAbleToChangeControler() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.eqfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.eqfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or not tc:IsType(TYPE_MONSTER) then return end if not Duel.Equip(tp,tc,c) then return end local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_EQUIP_LIMIT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetValue(s.eqlimit) e2:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e2) end function s.eqlimit(e,c) return e:GetOwner()==c and not c:IsDisabled() end function s.atkval(e,c) local tp=c:GetControler() local tot=0 local eq=c:GetEquipGroup() local tc=eq:GetFirst() for tc in aux.Next(eq) do tot=tot+tc:GetAttack() end return tot/2 end