--Tri-Brigade Hideout --scripted by Emiliv --When this card is activated: You can take 1 "Tri-Brigade" card either send it to the GY or add it to your Hand. --All link monsters you control gain 500 ATK. --Once per Turn if your opponent activates a card or effect that targets a Beast, Beast-Warrior or Winged-Beast monster you control: You can send this card to the GY and if you do negate that activation or effect. --You can only activate 1 "Tri-Brigade Hideout" per Turn. function c99900202.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,999000202+EFFECT_COUNT_CODE_OATH) e1:SetOperation(c99900202.activate) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(c99900202.atktg) e2:SetValue(800) c:RegisterEffect(e2) --trg negate local e3 = Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(999000202,0)) e3:SetCategory(CATEGORY_NEGATE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(c99900202.discon) e3:SetCost(c99900202.discost) e3:SetTarget(c99900202.distg) e3:SetOperation(c99900202.disop) c:RegisterEffect(e3) end --activate functions function c99900202.filter(c) return c:IsSetCard(0x14d) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or c:IsAbleToGrave()) end function c99900202.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c99900202.filter,tp,LOCATION_DECK,0,nil) if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(999000202,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD) local tc=g:Select(tp,1,1,nil) if tc and Duel.SelectOption(tp,1190,1191)==0 then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) else Duel.SendtoGrave(tc,REASON_EFFECT) end end end --atk gain function c99900202.atktg(e,c) return c:IsType(TYPE_LINK) end --target negate function c99900202.tfilter(c,tp) return c:IsLocation(LOCATION_ONFIELD) and c:IsControler(tp) and c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) end function c99900202.discon(e,tp,eg,ep,ev,re,r,rp) if rp==tp or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(c99900202.tfilter,1,nil,tp) and Duel.IsChainNegatable(ev) end function c99900202.discost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED) end Duel.SendtoGrave(c,REASON_COST) end function c99900202.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function c99900202.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end