--村规决斗:限界突破 II
--【光道】怪兽得到以下效果:
--①只要这张卡在场上存在,光·暗属性怪兽和通常魔法卡以外的卡送去墓地时不去墓地从游戏中除外。
--②这个卡名的这个效果1回合只能使用1次,这张卡被送去墓地或除外的场合才能发动。
--这张卡在自己场上特殊召唤。那之后,可以从自己卡组上方把2张卡送去墓地。
--
--【剑斗】怪兽得到以下效果:
--①这个卡名的这个效果1回合只能使用1次,自己·对方回合可以发动。
--自己手卡·场上的这张卡返回卡组,从卡组·额外卡组把1只
--这个回合没有特殊召唤过的「剑斗兽」怪兽在自己场上无视召唤条件特殊召唤。
--这个效果的发动后,这个回合自己不是「剑斗兽」怪兽不能把效果发动。
--
--【黑羽】怪兽得到以下效果:
--①卡名1回合1次,这个效果的发动后,自己不是「黑羽」怪兽或「黑羽龙」或「黑羽强袭龙」不能把效果发动。
--这张卡从手卡给对方观看才能发动。从卡组外把1张「黑旋风」或「黑羽之旋风」在场上发动,这张卡不用解放作召唤。
--这个效果发动的「黑旋风」「黑羽之旋风」在结束阶段破坏。
CUNGUI = {}
function Auxiliary.PreloadUds()
--adjust
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_ADJUST)
e1:SetCountLimit(1)
e1:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
CUNGUI.RegisteredMonsters = Group.CreateGroup()
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.GetMatchingGroup(Card.IsType,0,0x7f,0x7f,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
if not c:IsType(TYPE_MONSTER) then return end
if c:IsSetCard(0x19) then --剑斗
CUNGUI.RegisterGladiatorBeasts(c)
elseif c:IsSetCard(0x33) then --黑羽
CUNGUI.RegisterBlackwing(c)
elseif c:IsSetCard(0x38) then --光道
CUNGUI.RegisterLightsworn(c)
end
end
function CUNGUI.RegisterGladiatorBeasts(c)
--①这个卡名的这个效果1回合只能使用1次,自己·对方回合可以发动。
--自己手卡·场上的这张卡返回卡组,从卡组·额外卡组把1只这个回合
--没有特殊召唤过的「剑斗兽」怪兽在自己场上无视召唤条件特殊召唤。
--这个效果的发动后,这个回合自己不是「剑斗兽」怪兽不能把效果发动。
if not CUNGUI.GBInit then
CUNGUI.GBInit=true
CUNGUI.GBSpecialSummon={}
CUNGUI.GBSpecialSummon[0]={}
CUNGUI.GBSpecialSummon[1]={}
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_FZONE)
e1:SetOperation(CUNGUI.gbregop)
Duel.RegisterEffect(e1,0)
e1=e1:Clone()
Duel.RegisterEffect(e1,1)
end
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(423585,1))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1,c:GetCode()+10)
e2:SetRange(LOCATION_MZONE+LOCATION_HAND)
e2:SetTarget(CUNGUI.gbsptg)
e2:SetOperation(CUNGUI.gbspop)
c:RegisterEffect(e2)
end
function CUNGUI.gbsptgfilter(c,e,tp)
return c:IsSetCard(0x19) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,SUMMON_VALUE_GLADIATOR,tp,true,false)
and ((not CUNGUI.GBSpecialSummon[tp][c:GetCode()]) or CUNGUI.GBSpecialSummon[tp][c:GetCode()]<Duel.GetTurnCount())
and (Duel.GetLocationCountFromEx(tp,tp,e:GetHandler(),c)
or (not c:IsExtraDeckMonster() and Duel.GetMZoneCount(tp,e:GetHandler(),tp)))
end
function CUNGUI.gbsptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(CUNGUI.gbsptgfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function CUNGUI.gbspop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(CUNGUI.gbactlimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
if e:GetHandler():IsRelateToChain(0) and Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_EFFECT)>0 then
local g=Duel.SelectMatchingCard(tp,CUNGUI.gbsptgfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_VALUE_GLADIATOR,tp,tp,true,false,POS_FACEUP)
end
end
end
function CUNGUI.gbactlimit(e,re,rp)
local rc=re:GetHandler()
return re:IsActiveType(TYPE_MONSTER) and not rc:IsSetCard(0x19)
end
function CUNGUI.gbregconfilter(c,tp)
return c:IsSummonPlayer(tp) and c:IsSetCard(0x19)
end
function CUNGUI.gbregop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(CUNGUI.gbregconfilter,nil,tp)
for c in aux.Next(g) do
CUNGUI.GBSpecialSummon[tp][c:GetCode()]=Duel.GetTurnCount()
end
end
function CUNGUI.RegisterBlackwing(c)
--①卡名1回合1次,这个效果的发动后,自己不是「黑羽」怪兽或「黑羽龙」或「黑羽强袭龙」不能把效果发动。
--这张卡从手卡给对方观看才能发动。从卡组外把1张「黑旋风」或「黑羽之旋风」在场上发动,这张卡不用解放作召唤。
--这个效果发动的「黑旋风」「黑羽之旋风」在结束阶段破坏。
--search and normal summon / gy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(80921533,0))
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,c:GetCode()+10)
e1:SetCost(CUNGUI.bfsumcost)
e1:SetTarget(CUNGUI.bfsumtg)
e1:SetOperation(CUNGUI.bfsumop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(CUNGUI.bfntcon)
e2:SetValue(SUMMON_TYPE_NORMAL)
c:RegisterEffect(e2)
e1:SetLabelObject(e2)
if not CUNGUI.BFInit then
CUNGUI.BFInit=true
CUNGUI.C91351370={}
CUNGUI.C7602800={}
Duel.DisableActionCheck(true)
CUNGUI.C91351370[0]=Duel.CreateToken(0,91351370)
CUNGUI.C91351370[1]=Duel.CreateToken(1,91351370)
CUNGUI.C7602800[0]=Duel.CreateToken(0,7602800)
CUNGUI.C7602800[1]=Duel.CreateToken(1,7602800)
Duel.DisableActionCheck(false)
end
end
function CUNGUI.bfntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.CheckTribute(c,0)
end
function CUNGUI.bfcfilter(c)
return c:IsSetCard(0x33) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function CUNGUI.bfsumcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsPublic() end
Duel.ConfirmCards(1-tp,c)
Duel.ShuffleHand(tp)
end
function CUNGUI.bftest(tp)
return not ((CUNGUI.C91351370[tp]:IsForbidden() and CUNGUI.C91351370[tp]:CheckUniqueOnField(tp)) and
(CUNGUI.C7602800[tp]:IsForbidden() and CUNGUI.C7602800[tp]:CheckUniqueOnField(tp)))
end
function CUNGUI.bfsumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0
or not CUNGUI.bftest(tp) then return false end
return e:GetHandler():IsSummonable(true,e:GetLabelObject())
end
end
function CUNGUI.bfsumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_CANNOT_ACTIVATE)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e0:SetTargetRange(1,0)
e0:SetValue(CUNGUI.bfactlimit)
e0:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e0,tp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local code=0
if (CUNGUI.C91351370[tp]:IsForbidden() and CUNGUI.C91351370[tp]:CheckUniqueOnField(tp)) then
code=7602800
elseif (CUNGUI.C7602800[tp]:IsForbidden() and CUNGUI.C7602800[tp]:CheckUniqueOnField(tp)) then
code=91351370
else
code=Duel.AnnounceCard(tp,91351370,OPCODE_ISCODE,7602800,OPCODE_ISCODE,OPCODE_OR)
end
local tc=Duel.CreateToken(tp,code)
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetOperation(CUNGUI.bftgop)
tc:RegisterEffect(e1)
if not c:IsRelateToEffect(e) then return end
local se=e:GetLabelObject()
if c:IsSummonable(true,se) then
Duel.BreakEffect()
Duel.Summon(tp,c,true,se)
end
end
end
function CUNGUI.bfactlimit(e,re,rp)
--9012916 73218989 0x33
local rc=re:GetHandler()
return re:IsActiveType(TYPE_MONSTER) and not rc:IsSetCard(0x33)
and not rc:IsCode(9012916)
and not rc:IsCode(73218989)
end
function CUNGUI.bfsplimit(e,c)
return not c:IsAttribute(ATTRIBUTE_DARK) and c:IsLocation(LOCATION_EXTRA)
end
function CUNGUI.bftgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Destroy(c,REASON_EFFECT)
end
function CUNGUI.RegisterLightsworn(c)
--①只要这张卡在场上存在,光·暗属性怪兽和通常魔法卡以外的卡送去墓地时不去墓地从游戏中除外。
--②这个卡名的这个效果1回合只能使用1次,这张卡被送去墓地或除外的场合才能发动。
--这张卡在自己场上特殊召唤。那之后,可以从自己卡组上方把2张卡送去墓地。
--remove
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(CUNGUI.lsrmtarget)
e1:SetTargetRange(0xff,0xff)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
e2:SetDescription(aux.Stringid(54895237,0))
e2:SetCountLimit(1,c:GetCode()+10)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetTarget(CUNGUI.lstarget)
e2:SetOperation(CUNGUI.lsoperation)
c:RegisterEffect(e2)
local e3=e2:Clone()
e2:SetCode(EVENT_REMOVE)
end
function CUNGUI.lsrmtarget(e,c)
if c:IsType(TYPE_SPELL) then
return c:IsType(TYPE_QUICKPLAY+TYPE_FIELD+TYPE_EQUIP+TYPE_RITUAL+TYPE_CONTINUOUS)
end
if c:IsType(TYPE_MONSTER) then
return not c:IsAttribute(ATTRIBUTE_DARK+ATTRIBUTE_LIGHT)
end
return true
end
function CUNGUI.lstarget(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2)
end
function CUNGUI.lsoperation(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)>0
and Duel.SelectYesNo(tp,aux.Stringid(2843014,0)) then
Duel.DiscardDeck(tp,2,REASON_EFFECT)
end
end