local m=31420010 local cm=_G["c"..m] cm.name="Bond of the Tokeito" function cm.initial_effect(c) aux.EnablePendulumAttribute(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_ADJUST) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_HAND) e2:SetCondition(cm.wincon) e2:SetOperation(cm.winop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e3:SetRange(LOCATION_PZONE) e3:SetTargetRange(1,0) e3:SetValue(cm.actlimit) --c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(31420002,0)) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e4:SetRange(LOCATION_PZONE) e4:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0) e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x5311)) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(31420002,1)) e5:SetType(EFFECT_TYPE_FIELD) e5:SetRange(LOCATION_PZONE) e5:SetTargetRange(LOCATION_HAND,0) e5:SetCode(EFFECT_SUMMON_PROC) e5:SetCountLimit(1) e5:SetCondition(cm.ntcon) e5:SetTarget(cm.nttg) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetCategory(CATEGORY_NEGATE) e6:SetType(EFFECT_TYPE_QUICK_O) e6:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e6:SetCode(EVENT_CHAINING) e6:SetRange(LOCATION_MZONE) e6:SetCondition(cm.negcon) e6:SetCost(cm.negcost) e6:SetTarget(cm.negtg) e6:SetOperation(cm.negop) c:RegisterEffect(e6) Duel.AddCustomActivityCounter(31420002,ACTIVITY_CHAIN,cm.chainfilter) end function cm.chainfilter(re,tp,cid) return re:GetHandler():IsSetCard(0x5311) or re:GetHandler():IsType(TYPE_SPELL) or re:GetHandler():IsType(TYPE_TRAP) end function cm.winfilter(c) local res=0 if c:IsSetCard(0x5311) and c:IsType(TYPE_MONSTER) then res=1 end return res end function cm.check(g) return g:GetCount()==6 and g:GetClassCount(Card.GetCode)==6 and g:GetSum(cm.winfilter)==6 end function cm.wincon(e,tp,eg,ep,ev,re,r,rp) return cm.check(Duel.GetFieldGroup(tp,LOCATION_HAND,0)) or cm.check(Duel.GetFieldGroup(tp,0,LOCATION_HAND)) end function cm.winop(e,tp,eg,ep,ev,re,r,rp) local winmessage = 0x60 local g1=Duel.GetFieldGroup(tp,LOCATION_HAND,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_HAND) local wtp=cm.check(g1) local wntp=cm.check(g2) if wtp and not wntp then Duel.ConfirmCards(1-tp,g1) Duel.Win(tp,winmessage) elseif not wtp and wntp then Duel.ConfirmCards(tp,g2) Duel.Win(1-tp,winmessage) elseif wtp and wntp then Duel.ConfirmCards(1-tp,g1) Duel.ConfirmCards(tp,g2) Duel.Win(PLAYER_NONE,winmessage) end end function cm.actlimit(e,re,tp) return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsSetCard(0x5311) end function cm.ntcon(e,c,minc) if c==nil then return true end return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function cm.nttg(e,c) return c:IsSetCard(0x5311) end function cm.negcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev) and Duel.IsPlayerCanDraw(re:GetHandlerPlayer(),1) end function cm.negcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToHandAsCost() end--and Duel.GetCustomActivityCount(31420002,tp,ACTIVITY_CHAIN)==0 end Duel.SendtoHand(e:GetHandler(),nil,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(cm.aclimit) e1:SetReset(RESET_PHASE+PHASE_END) --Duel.RegisterEffect(e1,tp) end function cm.aclimit(e,re,tp) return not (re:GetHandler():IsSetCard(0x5311) or re:GetHandler():IsType(TYPE_SPELL) or re:GetHandler():IsType(TYPE_TRAP)) end function cm.negtg(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 cm.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end Duel.Draw(re:GetHandler():GetControler(),1,REASON_EFFECT) end