local m=11110112 local cm=_G["c"..m] cm.name="Ichyaltean Dominance" function cm.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(cm.target) e2:SetValue(1) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,m) e3:SetCost(cm.togcost) e3:SetTarget(cm.togtg) e3:SetOperation(cm.togop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DRAW) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_RELEASE) e4:SetTarget(cm.rltg) e4:SetOperation(cm.rlop) e4:SetCountLimit(1,m+100000000) c:RegisterEffect(e4) end function cm.target(e,c) return c:IsSetCard(0x2a7) and c:IsType(TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK) end function cm.togfilter_rel(c) return c:IsSetCard(0x2a7) and c:IsReleasable() end function cm.togcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.togfilter_rel,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local sg=Duel.SelectMatchingCard(tp,cm.togfilter_rel,tp,LOCATION_HAND,0,1,1,nil) Duel.Release(sg,REASON_COST) end function cm.togfilter_tog(c) return c:IsSetCard(0x2a7) and c:IsAbleToGrave() end function cm.togtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.togfilter_tog,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cm.togop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cm.togfilter_tog,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function cm.rlfilter(c) return c:IsSetCard(0x2a7) and c:IsType(TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK) end function cm.rltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.rlfilter,tp,LOCATION_MZONE,0,1,nil) and eg:IsExists(Card.IsSetCard,1,nil,0x2a7) and Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function cm.rlop(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