Commit bff68eb5 authored by mercury233's avatar mercury233

add cards DUOV

parent e7071a1e
--Hollow Giants
function c15462014.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c15462014.actcon)
c:RegisterEffect(e1)
--disable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DISABLE)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c15462014.distg)
c:RegisterEffect(e2)
--send to GY
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_BATTLE_DESTROYED)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c15462014.tgcon)
e3:SetTarget(c15462014.tgtg)
e3:SetOperation(c15462014.tgop)
c:RegisterEffect(e3)
end
function c15462014.cfilter(c)
return c:GetSummonLocation()==LOCATION_EXTRA
end
function c15462014.actcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c15462014.cfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(c15462014.cfilter,tp,0,LOCATION_MZONE,1,nil)
end
function c15462014.distg(e,c)
return c:GetSummonLocation()==LOCATION_EXTRA
end
function c15462014.egfilter(c)
local d=c:GetBattleTarget()
return c:GetSummonLocation()==LOCATION_EXTRA and d:GetSummonLocation()==LOCATION_EXTRA
end
function c15462014.pcheck(c,tp)
return c:GetPreviousControler()==tp
end
function c15462014.tgcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c15462014.egfilter,1,nil)
end
function c15462014.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
local tg,pct,player=eg:Filter(c15462014.egfilter,nil),0,0
for p=0,1 do
if tg:IsExists(c15462014.pcheck,1,nil,p) then
pct=pct+1
player=p
end
end
if pct==2 then player=PLAYER_ALL end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,player,1000)
end
function c15462014.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
local tg=eg:Filter(c15462014.egfilter,nil)
for p=0,1 do
if tg:IsExists(c15462014.pcheck,1,nil,p) then
Duel.Damage(p,1000,REASON_EFFECT,true)
end
end
Duel.RDComplete()
end
end
--Mayakashi Mayhem
function c41867019.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--choose effect
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW+CATEGORY_TOGRAVE+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c41867019.effcon)
e2:SetTarget(c41867019.efftg)
e2:SetOperation(c41867019.effop)
c:RegisterEffect(e2)
end
function c41867019.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_ZOMBIE) and c:GetSummonLocation()~=LOCATION_EXTRA
end
function c41867019.setfilter(c)
return c:IsSetCard(0x121) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() and not c:IsCode(41867019)
end
function c41867019.tgfilter(c)
return c:IsFaceup() and c:IsAbleToGrave()
end
function c41867019.effcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c41867019.cfilter,1,nil)
end
function c41867019.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetFlagEffect(tp,41867019)==0 then
Duel.RegisterFlagEffect(tp,41867019,RESET_PHASE+PHASE_END,0,1)
end
local flag=Duel.GetFlagEffectLabel(tp,41867019)
local b1=Duel.IsPlayerCanDraw(tp,1) and bit.band(flag,0x1)==0
local b2=Duel.IsExistingMatchingCard(c41867019.setfilter,tp,LOCATION_DECK,0,1,nil) and bit.band(flag,0x2)==0
local b3=Duel.IsExistingMatchingCard(c41867019.tgfilter,tp,0,LOCATION_MZONE,1,nil) and bit.band(flag,0x4)==0
local b4=bit.band(flag,0x8)==0
return Duel.GetFlagEffect(tp,41867020)==0 and (b1 or b2 or b3 or b4)
end
Duel.RegisterFlagEffect(tp,41867020,RESET_CHAIN,0,1)
end
function c41867019.effop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetFlagEffect(tp,41867019)==0 then
Duel.RegisterFlagEffect(tp,41867019,RESET_PHASE+PHASE_END,0,1)
end
local flag=Duel.GetFlagEffectLabel(tp,41867019)
local off=1
local ops={}
local opval={}
local b1=Duel.IsPlayerCanDraw(tp,1) and bit.band(flag,0x1)==0
local b2=Duel.IsExistingMatchingCard(c41867019.setfilter,tp,LOCATION_DECK,0,1,nil) and bit.band(flag,0x2)==0
local b3=Duel.IsExistingMatchingCard(c41867019.tgfilter,tp,0,LOCATION_MZONE,1,nil) and bit.band(flag,0x4)==0
local b4=bit.band(flag,0x8)==0
if b1 then
ops[off]=aux.Stringid(41867019,0)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(41867019,1)
opval[off-1]=2
off=off+1
end
if b3 then
ops[off]=aux.Stringid(41867019,2)
opval[off-1]=3
off=off+1
end
if b4 then
ops[off]=aux.Stringid(41867019,3)
opval[off-1]=4
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
if sel==1 then
Duel.Draw(tp,1,REASON_EFFECT)
Duel.SetFlagEffectLabel(tp,41867019,flag|0x1)
elseif sel==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,c41867019.setfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SSet(tp,g)
end
Duel.SetFlagEffectLabel(tp,41867019,flag|0x2)
elseif sel==3 then
local g=Duel.GetMatchingGroup(c41867019.tgfilter,tp,0,LOCATION_MZONE,nil)
if #g>0 then
local tg=g:GetMinGroup(Card.GetAttack)
if #tg>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=tg:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.SendtoGrave(sg,REASON_EFFECT)
else
Duel.SendtoGrave(tg,REASON_EFFECT)
end
end
Duel.SetFlagEffectLabel(tp,41867019,flag|0x4)
else
Duel.Damage(1-tp,800,REASON_EFFECT)
Duel.SetFlagEffectLabel(tp,41867019,flag|0x8)
end
end
--Traptrix Genlisea
function c88078306.initial_effect(c)
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c88078306.efilter)
c:RegisterEffect(e1)
--set
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_LEAVE_GRAVE)
e2:SetDescription(aux.Stringid(88078306,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,88078306)
e2:SetCost(c88078306.setcost)
e2:SetTarget(c88078306.settg)
e2:SetOperation(c88078306.setop)
c:RegisterEffect(e2)
end
function c88078306.efilter(e,te)
local c=te:GetHandler()
return c:GetType()==TYPE_TRAP and c:IsSetCard(0x4c,0x89)
end
function c88078306.setfilter(c)
return c:IsSetCard(0x4c,0x89) and c:GetType()==TYPE_TRAP and c:IsSSetable()
end
function c88078306.fselect(g)
return g:GetClassCount(Card.GetLocation)==g:GetCount() and aux.dncheck(g)
end
function c88078306.setcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c88078306.settg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c88078306.setfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,nil)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>=2 and g:CheckSubGroup(c88078306.fselect,2,2) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0)
end
function c88078306.setop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<2 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c88078306.setfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=g:SelectSubGroup(tp,c88078306.fselect,false,2,2)
if sg and #sg==2 then
if Duel.SSet(tp,sg)==0 then return end
local tc=sg:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(LOCATION_REMOVED)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
tc:RegisterEffect(e1)
tc=sg:GetNext()
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment