Commit fa845320 authored by JoyJ's avatar JoyJ

update srv5555 scripts

parent 0d24659b
--村规决斗:天女散花
--所有卡随机得到以下效果(每张卡获得固定的随机效果)
--这张卡从场上送去墓地的场合:
--不去墓地从游戏中除外
--不去墓地回到手卡
--不去墓地回到卡组·额外卡组
--正常送去墓地
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)
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
local g = Duel.GetMatchingGroup(aux.TRUE,0,0x7f,0x7f,nil)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
if not CUNGUI.DrawInit then
CUNGUI.DrawInit = true
Duel.Draw(1,2,REASON_RULE)
end
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--redirect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCondition(CUNGUI.recon)
local rand = math.random(4)
if rand == 1 then
e2:SetValue(LOCATION_REMOVED)
elseif rand == 2 then
e2:SetValue(LOCATION_HAND)
elseif rand == 3 then
e2:SetValue(LOCATION_DECKBOT)
elseif rand == 4 then
e2:SetValue(0)
end
c:RegisterEffect(e2)
end
function CUNGUI.recon(e)
local c=e:GetHandler()
return c:IsLocation(LOCATION_ONFIELD)
end
--村规决斗:万象之壶
--开局时,双方将1张强欲之壶(55144522)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。选自己任意数量的手卡(至少1)返回卡组,
--从卡组外把(返回数量*2)张名字中带有【壶】的随机卡加入手卡。
--这个效果的处理不会被无效。
CUNGUI = {}
CUNGUI.RuleCardCode=55144522
CUNGUI.CreateCards={3549275,3900605,4896788,22123627,24137081,33508719,33784505,
34124316,35261759,40736921,49238328,50045299,51790181,55144522,55567161,55763552,
64014615,67169062,67248304,70278545,73414375,76515293,78706415,79106360,81171949,
81492226,84211599,86801871,87614611,91501248,96598015,98645731,98672567,99284890}
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
if not CUNGUI.RuleCardInit then
CUNGUI.RuleCardInit = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
if not CUNGUI.DrawInit then
CUNGUI.DrawInit = true
--Duel.Draw(1,1,REASON_RULE)
end
if CUNGUI.RuleCard[0] and (not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[0]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and (not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[1]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[1],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[0],POS_FACEUP)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[1],POS_FACEUP)
end
end
CUNGUI.RuleCard={}
function CUNGUI.RegisterCardRule(tp)
local c=Duel.CreateToken(tp,CUNGUI.RuleCardCode)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
--forbid
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66666004,4))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetCondition(CUNGUI.rulecond)
e1:SetTarget(CUNGUI.ruletg)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.rulecond(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetCurrentChain()<1 and Duel.GetTurnPlayer()==tp
end
function CUNGUI.ruletg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMatchingGroupCount(nil,tp,LOCATION_HAND,0,nil)>0 end
Duel.Hint(HINT_CARD,1-tp,e:GetHandler():GetCode())
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,1,99,nil)
local ct=Duel.SendtoDeck(g,nil,2,REASON_RULE)*2
local g=Group.CreateGroup()
for _=1,ct do
local code=CUNGUI.CreateCards[math.random(1,#CUNGUI.CreateCards)]
g:AddCard(Duel.CreateToken(tp,code))
end
Duel.SendtoHand(g,nil,REASON_RULE)
end
--村规决斗:天赋君权
--开局时,双方将1张特殊二重召唤(26120084)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。这个效果不会被无效化。
--选自己1张手卡·场上的卡,那张卡再次得到那张卡上记载的所有文本。
--这个效果得到的
--【这个卡名的这个效果1回合只能使用X次】【决斗中只能使用X次】【在场上只能使用X次】类效果,
--都变成【1回合X次】类效果。
--细则:
--那张卡发生移动后,得到的效果依然有效。
--效果得到的只有【卡片上记载的文本】,
--不会重复得到村规给予的效果,也不会得到村规的效果重复给予的效果。
--村规赋予的效果可以在同一张卡上无限叠加。
CUNGUI = {}
CUNGUI.RuleCardCode=26120084
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
if not CUNGUI.RuleCardInit then
CUNGUI.RuleCardInit = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
if not CUNGUI.DrawInit then
CUNGUI.DrawInit = true
Duel.Draw(1,1,REASON_RULE)
end
if CUNGUI.RuleCard[0] and (not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[0]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and (not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[1]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[1],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[0],POS_FACEUP)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[1],POS_FACEUP)
end
end
CUNGUI.RuleCard={}
function CUNGUI.RegisterCardRule(tp)
local c=Duel.CreateToken(tp,CUNGUI.RuleCardCode)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
--forbid
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66666004,4))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetCondition(CUNGUI.rulecond)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.rulecond(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetCurrentChain()<1 and Duel.GetTurnPlayer()==tp
end
local CountLimitOrig = Effect.SetCountLimit
local CountLimitEx = function(e,count,code)
return CountLimitOrig(e,count)
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local c=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil):GetFirst()
if not c:IsPublic() then
Duel.ConfirmCards(1-tp,c)
else
Duel.Hint(HINT_CARD,1-tp,c:GetCode())
end
Effect.SetCountLimit = CountLimitEx
local init=_G["c"..c:GetOriginalCode()]
if init and init.initial_effect then init.initial_effect(c) end
Effect.SetCountLimit = CountLimitOrig
end
--村规决斗:断开连接
--连锁发生的场合,除了最后1个效果,其余的效果全部无效化。
CUNGUI = {}
CUNGUI.RuleCardCode=3285551
function Auxiliary.PreloadUds()
--disable
local e1=Effect.GlobalEffect()
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_CHAINING)
e1:SetTarget(CUNGUI.target)
e1:SetOperation(CUNGUI.activate)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ng=Group.CreateGroup()
local dg=Group.CreateGroup()
for i=1,ev-1 do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
ng:AddCard(tc)
if tc:IsRelateToEffect(te) then
dg:AddCard(tc)
end
end
Duel.SetTargetCard(dg)
Duel.SetOperationInfo(0,CATEGORY_NEGATE,ng,ng:GetCount(),0,0)
end
function CUNGUI.activate(e,tp,eg,ep,ev,re,r,rp)
local dg=Group.CreateGroup()
for i=1,ev-1 do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
local tc=te:GetHandler()
if Duel.NegateActivation(i) and tc:IsRelateToEffect(e) and tc:IsRelateToEffect(te) then
dg:AddCard(tc)
end
end
end
\ No newline at end of file
--村规决斗:无限剑制
--开局时,双方将1张执念之剑(98495314)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--主要阶段才能处理这个效果。从卡组外把1张【执念之剑】(98495314)加入手卡。这个效果不会被无效化。
--(没有次数限制)
CUNGUI = {}
CUNGUI.RuleCardCode=3285551
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
if not CUNGUI.RuleCardInit then
CUNGUI.RuleCardInit = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
if not CUNGUI.DrawInit then
CUNGUI.DrawInit = true
--Duel.Draw(1,1,REASON_RULE)
end
if CUNGUI.RuleCard[0] and (not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[0]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and (not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[1]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[1],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[0],POS_FACEUP)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[1],POS_FACEUP)
end
end
CUNGUI.RuleCard={}
function CUNGUI.RegisterCardRule(tp)
local c=Duel.CreateToken(tp,CUNGUI.RuleCardCode)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
--forbid
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66666004,4))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FREE_CHAIN)
--e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetCondition(CUNGUI.rulecond)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.rulecond(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetCurrentChain()<1 and Duel.GetTurnPlayer()==tp
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.CreateToken(tp, 98495314)
Duel.SendtoHand(tc, tp, REASON_EFFECT)
end
--村规决斗:礼尚往来
--所有卡得到以下效果:
--此类效果回合玩家1回合只能使用2次,非回合玩家1回合只能使用1次,结束阶段不能发动。
--这个效果发动的回合,对方可以进行通常召唤最多2次。
--自己·对方回合,把手卡的这张卡给对方展示才能发动。
--选对方1张能加入自己手卡的卡加入这张卡的持有者的手卡。那之后,这张卡交给对方。
--这个效果加入自己手卡的卡在下个回合的结束阶段未发生过移动的场合,自己受到2000点伤害。
--细则:
--可以选场上·墓地·手卡·除外的卡,但未公开区域是盲选。
--当然会被屋敷童·灰流丽无效。
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)
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
CUNGUI.Used={}
CUNGUI.Used[0]=0
CUNGUI.Used[1]=0
end
CUNGUI.Used[0]=0
CUNGUI.Used[1]=0
local g = Duel.GetMatchingGroup(aux.TRUE,0,0x7f,0x7f,nil)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66666004,4))
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_GRAVE_ACTION)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_HAND)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetTarget(CUNGUI.sptg)
e2:SetOperation(CUNGUI.spop)
c:RegisterEffect(e2)
end
CUNGUI.Used={}
function CUNGUI.filter(c)
return c:IsAbleToHandAsCost() or c:IsLocation(LOCATION_HAND)
end
function CUNGUI.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.filter,tp,0,0x7f,1,nil)
and CUNGUI.Used[tp]==0 or (Duel.GetTurnPlayer()==tp and CUNGUI.Used[tp]<2)
and Duel.GetCurrentPhase()~=PHASE_END end
CUNGUI.Used[tp]=CUNGUI.Used[tp]+1
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetValue(2)
Duel.RegisterEffect(e1,tp)
end
function CUNGUI.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,CUNGUI.filter,tp,0,0x7f,1,1,nil)
if #g>0 and Duel.SendtoHand(g,tp,REASON_EFFECT)>0 and c:IsRelateToEffect(e) then
Duel.SendtoHand(c,1-tp,REASON_EFFECT)
c=g:GetFirst()
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetCondition(CUNGUI.damcon)
e2:SetOperation(CUNGUI.damop)
e2:SetReset(RESET_PHASE+PHASE_END,2)
e2:SetLabelObject(c)
e2:SetLabel(c:GetFieldID())
Duel.RegisterEffect(e2,tp)
end
end
function CUNGUI.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():IsLocation(LOCATION_HAND) and e:GetLabelObject():GetFieldID() == e:GetLabel()
end
CUNGUI.EffectSaver={}
function CUNGUI.damop(e,tp,eg,ep,ev,re,r,rp)
if not CUNGUI.EffectSaver[e] then
CUNGUI.EffectSaver[e]=true
return
end
local c=e:GetLabelObject()
if c:GetFieldID()==e:GetLabel() then
Duel.Damage(tp,2000,REASON_EFFECT)
end
end
\ No newline at end of file
--村规决斗:秽土转生
--所有【这个卡名1回合只能使用……/这个卡名的效果决斗中只能使用……/这个卡名的效果在场上只能使用……】的效果,变为【1回合……】的效果。
--开局时,把双方额外卡组的所有卡复制1份,加入各自的额外卡组。
--双方将1张转生炎兽的圣域(1295111)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。这些效果的发动和效果不会被无效化。
--主要阶段才能发动。只用自己场上1只连接怪兽为素材,从额外卡组把1张同名卡连接召唤。
--主要阶段才能发动。只用自己场上1只超量怪兽为素材,从额外卡组把1张同名卡超量召唤。
--主要阶段才能发动。只用自己场上1只融合怪兽为素材,从额外卡组把1张同名卡融合召唤。
--主要阶段才能发动。只用自己场上1只同调怪兽为素材,从额外卡组把1张同名卡同调召唤。
CUNGUI = {}
CUNGUI.RuleCardCode=1295111
EFFECT_FLAG_NO_TURN_RESET = 0
EFFECT_COUNT_CODE_DUEL = 0
local scl = Effect.SetCountLimit
Effect.SetCountLimit = function(e,limit)
return scl(e,limit)
end
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
if not CUNGUI.RuleCardInit then
CUNGUI.RuleCardInit = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
if CUNGUI.RuleCard[0] and (not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[0]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and (not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[1]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[1],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[0],POS_FACEUP)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[1],POS_FACEUP)
end
end
CUNGUI.RuleCard={}
function CUNGUI.RegisterCardRule(tp)
local g=Duel.GetFieldGroup(tp,LOCATION_EXTRA,0)
for mc in aux.Next(g) do
local nc=Duel.CreateToken(tp,mc:GetOriginalCode())
Duel.SendtoDeck(nc,nil,0,REASON_RULE)
end
local c=Duel.CreateToken(tp,CUNGUI.RuleCardCode)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
--synchro
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(50091196,1)) --同调召唤
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetTarget(CUNGUI.ruletg_synchro)
e1:SetOperation(CUNGUI.ruleop_synchro)
c:RegisterEffect(e1)
e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(5352328,1)) --超量召唤
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetTarget(CUNGUI.ruletg_xyz)
e1:SetOperation(CUNGUI.ruleop_xyz)
c:RegisterEffect(e1)
e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(65741786,0)) --连接召唤
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetTarget(CUNGUI.ruletg_link)
e1:SetOperation(CUNGUI.ruleop_link)
c:RegisterEffect(e1)
e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(1264319,0))--融合召唤
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetTarget(CUNGUI.ruletg_fusion)
e1:SetOperation(CUNGUI.ruleop_fusion)
end
function CUNGUI.rule_syncfilter2(c,cc,tp)
return c:IsCanBeSynchroMaterial(cc) and Duel.GetLocationCountFromEx(tp,tp,c,cc)
end
function CUNGUI.rule_syncfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false)
and Duel.IsExistingMatchingCard(CUNGUI.rule_syncfilter2,tp,LOCATION_MZONE,0,1,nil,c,tp)
end
function CUNGUI.ruletg_synchro(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.rule_syncfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function CUNGUI.ruleop_synchro(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(CUNGUI.rule_syncfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg2=Duel.SelectMatchingCard(tp,CUNGUI.rule_syncfilter2,tp,LOCATION_MZONE,0,1,1,nil,tc,tp)
Duel.SynchroSummon(tp,tc,nil,sg2)
end
end
function CUNGUI.rule_xyzfilter2(c,cc,tp)
return c:IsCanBeXyzMaterial(cc) and Duel.GetLocationCountFromEx(tp,tp,c,cc)
end
function CUNGUI.rule_xyzfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
and Duel.IsExistingMatchingCard(CUNGUI.rule_xyzfilter2,tp,LOCATION_MZONE,0,1,nil,c,tp)
end
function CUNGUI.ruletg_xyz(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.rule_xyzfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function CUNGUI.ruleop_xyz(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(CUNGUI.rule_xyzfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg2=Duel.SelectMatchingCard(tp,CUNGUI.rule_xyzfilter2,tp,LOCATION_MZONE,0,1,1,nil,tc,tp)
Duel.XyzSummon(tp,tc,sg2)
end
end
function CUNGUI.rule_linkfilter2(c,cc,tp)
return c:IsCanBeLinkMaterial(cc) and Duel.GetLocationCountFromEx(tp,tp,c,cc)
end
function CUNGUI.rule_linkfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_LINK,tp,false,false)
and Duel.IsExistingMatchingCard(CUNGUI.rule_linkfilter2,tp,LOCATION_MZONE,0,1,nil,c,tp)
end
function CUNGUI.ruletg_link(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.rule_linkfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function CUNGUI.ruleop_link(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(CUNGUI.rule_linkfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local sg2=Duel.SelectMatchingCard(tp,CUNGUI.rule_linkfilter2,tp,LOCATION_MZONE,0,1,1,nil,tc,tp)
Duel.LinkSummon(tp,tc,sg2)
end
end
function CUNGUI.rule_fusionfilter2(c,cc,tp)
return c:IsCanBeLinkMaterial(cc) and Duel.GetLocationCountFromEx(tp,tp,c,cc)
end
function CUNGUI.rule_fusionfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)
and Duel.IsExistingMatchingCard(CUNGUI.rule_fusionfilter2,tp,LOCATION_MZONE,0,1,nil,c,tp)
end
function CUNGUI.ruletg_fusion(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.rule_fusionfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function CUNGUI.ruleop_fusion(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(CUNGUI.rule_fusionfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local sg2=Duel.SelectMatchingCard(tp,CUNGUI.rule_fusionfilter2,tp,LOCATION_MZONE,0,1,1,nil,tc,tp)
Duel.SendtoGrave(sg2,REASON_EFFECT)
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
--村规决斗:老二次元
--入连锁的效果处理时,投一个骰子。
--1、2:以对方视角把效果处理2次。
--3、4:处理1次,再以对方视角处理1次。
--5、6:效果处理2次。
--细则:
--对任何效果有效,但处理后不一定有意义。
local OrigRegister = Card.RegisterEffect
local OrigClone = Effect.Clone
CUNGUI = {}
CUNGUI.EffectSaver={}
function Auxiliary.PreloadUds()
Card.RegisterEffect = function(c,e,b)
local typ = e:GetType()
if (typ & 0x7d0)>0 and e:GetOperation()~=nil then
CUNGUI.EffectSaver[e] = e:GetOperation()
e:SetOperation(CUNGUI.Operation)
end
return OrigRegister(c,e,b)
end
Effect.Clone = function(e)
local ce = OrigClone(e)
if e:GetOperation() == CUNGUI.Operation then
ce:SetOperation(CUNGUI.EffectSaver[e])
end
return ce
end
-- 1 more draw
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_ADJUST)
e1:SetOperation(function(e)
Duel.Draw(1,1,REASON_RULE)
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.Operation(e,tp,eg,ep,ev,re,r,rp)
local dice = math.random(1,6)
if dice < 3 then
CUNGUI.EffectSaver[e](e,1-tp,eg,ep,ev,re,r,rp)
CUNGUI.EffectSaver[e](e,1-tp,eg,ep,ev,re,r,rp)
elseif dice < 5 then
CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
CUNGUI.EffectSaver[e](e,1-tp,eg,ep,ev,re,r,rp)
else
CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
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