Commit ffc21e26 authored by zengsxing's avatar zengsxing

add 神

parent e4fa92db
No preview for this file type
--黒き魔族-レオ・ウィザード
local s,id,o=GetID()
function s.initial_effect(c)
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_LIMIT_SUMMON_PROC)
e0:SetCondition(s.ttcon)
e0:SetOperation(s.ttop)
e0:SetValue(SUMMON_TYPE_ADVANCE)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_HAND,LOCATION_HAND)
e1:SetTarget(s.eftg)
e1:SetLabelObject(e0)
c:RegisterEffect(e1)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_START)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
--Search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCountLimit(1,id)
e3:SetCondition(s.thcon)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
end
function s.ttcon(e,c,minc)
if c==nil then return true end
local min,max=c:GetTributeRequirement()
return min<=1 and Duel.CheckTribute(c,1)
end
function s.ttop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.SelectTribute(tp,c,1,1)
c:SetMaterial(g)
Duel.Release(g,REASON_SUMMON+REASON_MATERIAL)
end
function s.eftg(e,c)
return c:GetOriginalLevel()<=4 and (c:IsAttackAbove(1351) or c:IsDefenseAbove(1351))
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0
end
function s.thfilter(c)
return c:IsAttack(1350) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if tc==c then tc=Duel.GetAttackTarget() end
if chk==0 then return tc and tc:IsFaceup() and tc:IsAttribute(ATTRIBUTE_LIGHT) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if tc==c then tc=Duel.GetAttackTarget() end
if tc:IsRelateToBattle() then Duel.Destroy(tc,REASON_EFFECT) end
end
......@@ -36,17 +36,50 @@ end
function s.fselect(g)
return g:FilterCount(s.sfilter,nil)==g:FilterCount(s.mfilter,nil)
end
function s.SelectSub(g1,g2,tp)
local max=math.min(#g1,#g2)
local sg1=Group.CreateGroup()
local sg2=Group.CreateGroup()
local sg=sg1:__add(sg2)
local fg=g1:__add(g2)
local finish=false
while true do
finish=#sg1==#sg2 and #sg>0
Debug.Message(#sg1)
Debug.Message(#sg2)
local sc=fg:SelectUnselect(sg,tp,finish,finish,2,max*2)
if not sc then break end
if sg:IsContains(sc) then
if g1:IsContains(sc) then
sg1:RemoveCard(sc)
else
sg2:RemoveCard(sc)
end
else
if g1:IsContains(sc) then
sg1:AddCard(sc)
else
sg2:AddCard(sc)
end
end
sg=sg1:__add(sg2)
fg=g1:__add(g2):Filter(aux.TRUE,sg)
if #sg1>=max then
fg=fg:Filter(aux.TRUE,g1)
end
if #sg2>=max then
fg=fg:Filter(aux.TRUE,g2)
end
end
return sg
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
local g1=Duel.GetMatchingGroup(s.sfilter,tp,LOCATION_GRAVE,0,nil,e)
local g2=Duel.GetMatchingGroup(s.mfilter,tp,LOCATION_GRAVE,0,nil,e)
if chkc then return false end
if chk==0 then return g1:GetCount()>0 and g2:GetCount()>0 end
local max=math.min(#g1,#g2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local tg=g1:Select(tp,1,max,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
tg:Merge(g2:Select(tp,#tg,#tg,nil))
local tg=s.SelectSub(g1,g2,tp)
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_TODECK,tg,#tg,0,0)
end
......@@ -59,7 +92,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
local dg=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if ct>0 and dg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local dc=dg:CancelableSelect(tp,1,ct,nil)
local dc=dg:Select(tp,1,ct,nil)
if dc and dc:GetCount()>0 then
Duel.BreakEffect()
Duel.HintSelection(dc)
......
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