--[[ Festering Hate Odio Marcescente Card Author: Burndown Scripted by: XGlitchy30 ]] local s,id=GetID() function s.initial_effect(c) --[[When this card is activated: You can activate 1 "BRAIN Boot Sector" directly from your Deck.]] local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRelevantTimings() e1:SetCountLimit(1,id|EFFECT_COUNT_CODE_OATH|EFFECT_COUNT_CODE_CHAIN) e1:SetOperation(s.activate) c:RegisterEffect(e1) --[[Once per turn, when a monster you control destroys an opponent's monster by battle, or a card(s) your opponent controls is destroyed by your card effect: You can draw 1 card.]] local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:OPT(true) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.drawcon1) e2:SetTarget(s.drawtg) e2:SetOperation(s.drawop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET|EFFECT_FLAG_DAMAGE_STEP) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.drawcon2) c:RegisterEffect(e3) end function s.filter(c,tp) return c:IsCode(CARD_BRAIN_BOOT_SECTOR) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) and c:GetActivateEffect() and c:GetActivateEffect():IsActivatable(tp,true,true) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() if tc then local field=tc:IsType(TYPE_FIELD) if field then local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0) if fc then Duel.SendtoGrave(fc,REASON_RULE) Duel.BreakEffect() end Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) else Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end local te=tc:GetActivateEffect() te:UseCountLimit(tp,1,true) local tep=tc:GetControler() local cost=te:GetCost() if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end if field then Duel.RaiseEvent(tc,CARD_ANCIENT_PIXIE_DRAGON,te,0,tp,tp,Duel.GetCurrentChain()) end end end end --E2 function s.drawcon1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not eg then return end for rc in aux.Next(eg) do if rc:IsStatus(STATUS_OPPO_BATTLE) then if rc:IsRelateToBattle() then if rc:IsControler(tp) then return true end else if rc:IsPreviousControler(tp) then return true end end end end return false end function s.drawtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drawop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end --E3 function s.lffilter(c,tp,re) return c:IsPreviousControler(1-tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_EFFECT) end function s.drawcon2(e,tp,eg,ep,ev,re,r,rp) return rp==tp and eg:IsExists(s.lffilter,1,nil,tp,re) end