Commit 8b306bed authored by wind2009's avatar wind2009 Committed by GitHub

Update ドレイク・シャーク (#2854)

Sync script from 紋章獣グリフォン
parent 5d9d3779
--ドレイク・シャーク
local s,id,o=GetID()
function s.initial_effect(c)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e0:SetCode(EVENT_ADJUST)
e0:SetRange(0xff)
e0:SetOperation(s.adjustop)
c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
......@@ -18,7 +25,9 @@ function s.initial_effect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(id)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(id)
e2:SetRange(0xff)
e2:SetTarget(s.sxyzfilter)
e2:SetCountLimit(1,id+o)
c:RegisterEffect(e2)
--material effect
......@@ -33,21 +42,79 @@ function s.initial_effect(c)
e3:SetTarget(s.xyztg)
e3:SetOperation(s.xyzop)
c:RegisterEffect(e3)
if not s.global_check then
s.global_check=true
end
function s.sxyzfilter(e,c)
return c:IsAttribute(ATTRIBUTE_WATER)
end
function s.Drake_shark_f(function_f,int_lv,card_c)
return function (c)
return c:IsXyzLevel(card_c,int_lv) and (not function_f or function_f(c))
end
end
function s.sxfilter(c,tp,xc)
local te=c:IsHasEffect(id,tp)
if te then
local etg=te:GetTarget()
return not etg or etg(te,xc)
end
return false
end
function s.sxvalue(c,tp,xc)
local te=c:IsHasEffect(id,tp)
if te then
local etg=te:GetTarget()
if not etg or etg(te,xc) then
return te:GetValue()
end
end
end
function s.Drake_shark_gf(int_ct,int_tp,xc)
return function (g)
local ct=g:GetCount()
local eg=g:Filter(s.sxfilter,nil,int_tp,xc)
if #eg>0 then
ct=ct+eg:GetClassCount(s.sxvalue,int_tp,xc)
end
local tc=g:GetFirst()
while tc do
local te=tc:IsHasEffect(EFFECT_XYZ_LEVEL,int_tp)
if te then
local evf=te:GetValue()
if evf then
local ev=evf(te,tc,xc)
local lmct=(ev>>12)&0xf
if lmct>0 and lmct>g:GetCount() then
return false
end
end
end
tc=g:GetNext()
end
return ct>=int_ct
end
end
function s.xfilter(c,tp)
return c:IsHasEffect(id,tp)
end
function s.eftfilter(c,tp)
local te=c:IsHasEffect(id,tp)
return te:GetValue()
end
function s.gcheck(g,tp)
return g:GetClassCount(s.eftfilter,tp)==g:GetCount()
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(0,81096431)==0 then
Duel.RegisterFlagEffect(0,81096431,0,0,1)
Drake_shark_AddXyzProcedure=aux.AddXyzProcedure
function aux.AddXyzProcedure(card_c,function_f,int_lv,int_ct,function_alterf,int_dese,int_maxc,function_op)
if card_c:IsAttribute(ATTRIBUTE_WATER) and int_ct>=3 then
if int_ct>=3 then
if function_alterf then
Drake_shark_XyzLevelFreeOperationAlter=Auxiliary.XyzLevelFreeOperationAlter
function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
if og:GetCount()==minc and og:IsExists(s.xfilter,1,nil) then
local ttc=og:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
Auxiliary.Drake_Solve(tp,og,maxc,minc)
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
......@@ -60,11 +127,7 @@ function s.initial_effect(c)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if mg:GetCount()==minc and mg:IsExists(s.xfilter,1,nil) then
local ttc=mg:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
Auxiliary.Drake_Solve(tp,mg,maxc,minc)
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
......@@ -86,18 +149,14 @@ function s.initial_effect(c)
end
end
end
aux.AddXyzProcedureLevelFree(card_c,s.f(function_f,int_lv,card_c),s.gf(int_ct,card_c:GetOwner()),int_ct-1,int_ct,function_alterf,int_dese,function_op)
aux.AddXyzProcedureLevelFree(card_c,s.Drake_shark_f(function_f,int_lv,card_c),s.Drake_shark_gf(int_ct,card_c:GetOwner(),card_c),int_ct-2,int_ct,function_alterf,int_dese,function_op)
Auxiliary.XyzLevelFreeOperationAlter=Drake_shark_XyzLevelFreeOperationAlter
else
Drake_shark_XyzLevelFreeOperation=Auxiliary.XyzLevelFreeOperation
function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
if og:GetCount()==minct and og:IsExists(s.xfilter,1,nil) then
local ttc=og:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
Auxiliary.Drake_Solve(tp,og,maxct,minct)
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
......@@ -110,11 +169,7 @@ function s.initial_effect(c)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if mg:GetCount()==minct and mg:IsExists(s.xfilter,1,nil) then
local ttc=mg:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
Auxiliary.Drake_Solve(tp,mg,maxct,minct)
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
......@@ -136,7 +191,7 @@ function s.initial_effect(c)
end
end
end
aux.AddXyzProcedureLevelFree(card_c,s.f(function_f,int_lv,card_c),s.gf(int_ct,card_c:GetOwner()),int_ct-1,int_ct)
aux.AddXyzProcedureLevelFree(card_c,s.Drake_shark_f(function_f,int_lv,card_c),s.Drake_shark_gf(int_ct,card_c:GetOwner(),card_c),int_ct-2,int_ct)
Auxiliary.XyzLevelFreeOperation=Drake_shark_XyzLevelFreeOperation
end
else
......@@ -147,20 +202,18 @@ function s.initial_effect(c)
end
end
end
local rg=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_EXTRA,LOCATION_EXTRA,nil,TYPE_MONSTER)
for tc in aux.Next(rg) do
if tc.initial_effect then
local Traitor_initial_effect=s.initial_effect
s.initial_effect=function() end
tc:ReplaceEffect(id,0)
s.initial_effect=Traitor_initial_effect
tc.initial_effect(tc)
end
end
end
end
function s.f(function_f,int_lv,card_c)
return function (c)
return c:IsXyzLevel(card_c,int_lv) and (not function_f or function_f(c))
end
end
function s.gf(int_ct,int_tp)
return function (g)
return g:GetCount()==int_ct or g:GetCount()==int_ct-1 and g:IsExists(s.xfilter,1,nil,int_tp)
end
end
function s.xfilter(c,tp)
return c:IsHasEffect(id,tp)
e:Reset()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_DRAW)
......@@ -202,3 +255,30 @@ function s.xyzop(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(c,Group.FromCards(tc))
end
end
function Auxiliary.Drake_Solve(tp,g,maxct,minct,chkg)
if g:GetCount()<maxct and g:GetCount()>=minct and maxct==minct+2 then
local et=maxct-g:GetCount()
local exg=g:Filter(Card.IsHasEffect,nil,81096431,tp)
local ext=exg:GetClassCount(s.eftfilter,tp)
if (et==0 or et==ext) and #exg>0 then
for ttc in aux.Next(exg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
elseif #exg>0 then
local st=et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,s.gcheck,false,st,st,tp)
for ttc in aux.Next(reg) do
local tte=ttc:IsHasEffect(81096431,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
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