Commit 4890b754 authored by JoyJ's avatar JoyJ

update srv5555 scripts

parent 5f7ede10
--村规决斗:水涨船高
--开局时,后攻方抽1张。
--所有怪兽得到以下效果:
--①:每次对方把效果发动,这张卡的攻击力·守备力上升300。
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: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.DRAW then
CUNGUI.DRAW = true
Duel.Draw(1,1,REASON_RULE)
end
local g = Duel.GetMatchingGroup(Card.IsType,0,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--attack up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(aux.chainreg)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetRange(LOCATION_MZONE)
e2:SetOperation(CUNGUI.atkop)
c:RegisterEffect(e2)
end
function CUNGUI.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if re:GetHandlerPlayer()~=tp and c:GetFlagEffect(1)>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(300)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
end
end
\ No newline at end of file
--村规决斗:乱打一气
--所有怪兽得到以下效果:
--①这张卡可以攻击的场合必须作出攻击。
--②这张卡可以向对方怪兽全部各作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: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,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
--attack all
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_ATTACK_ALL)
e3:SetValue(1)
c:RegisterEffect(e3)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66666004,4))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(CUNGUI.condition)
e2:SetTarget(CUNGUI.target)
e2:SetOperation(CUNGUI.operation)
c:RegisterEffect(e2)
end
function CUNGUI.condition(e,tp)
return Duel.GetAttacker()==e:GetHandler()
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local d1=Duel.Draw(tp,1,REASON_EFFECT)
local d2=Duel.Draw(1-tp,1,REASON_EFFECT)
end
\ No newline at end of file
--村规决斗:拼多多多
--要支付Cost时,投1个骰子。
--不是1或6的场合,无需支付。
--是1或6的场合,需要支付2次。第2次支付失败的场合,发动无效。
local OrigRegister = Card.RegisterEffect
CUNGUI = {}
Card.RegisterEffect = function(c,e,b)
local f=e:GetCost()
if f then
e:SetCost(CUNGUI.CreateFunction(f))
end
return OrigRegister(c,e,b)
end
function Auxiliary.PreloadUds()
end
function CUNGUI.CreateFunction(f)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local dice = Duel.TossDice(tp,1)
if dice==1 or dice==6 then
f(e,tp,eg,ep,ev,re,r,rp)
if not f(e,tp,eg,ep,ev,re,r,rp,0) then
Duel.NegateActivation(0)
return false
else
f(e,tp,eg,ep,ev,re,r,rp,chk)
return true
end
else
return true
end
end
end
\ No newline at end of file
--村规决斗:莫误班车
--所有选发效果变为必发效果。
local OrigRegister = Card.RegisterEffect
CUNGUI = {}
Card.RegisterEffect = function(c,e,b)
local typ = e:GetType()
if (typ & 0x7d0)>0 and e:GetOperation()~=nil then
if (typ & EFFECT_TYPE_QUICK_O) > 0 then
typ = typ - EFFECT_TYPE_QUICK_O
typ = typ | EFFECT_TYPE_QUICK_F
end
if (typ & EFFECT_TYPE_TRIGGER_O) > 0 then
typ = typ - EFFECT_TYPE_TRIGGER_O
typ = typ | EFFECT_TYPE_TRIGGER_F
end
e:SetType(typ)
local p = e:GetProperty() or 0
p = p | EFFECT_FLAG_DELAY
e:SetProperty(p)
end
return OrigRegister(c,e,b)
end
function Auxiliary.PreloadUds()
end
--村规决斗:罪域骨王
--游戏开始时,各自从卡组外将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)
--return
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetCountLimit(1)
e2:SetOperation(CUNGUI.AdjustOperation2)
Duel.RegisterEffect(e2,0)
end
CUNGUI.RegisteredMonsters = Group.CreateGroup()
function CUNGUI.AdjustOperation2(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.GetMatchingGroup(Card.IsCode,0,LOCATION_REMOVED,LOCATION_REMOVED,nil,36021814)
if #g > 0 then
Duel.SendtoGrave(g,REASON_RULE+REASON_RETURN)
end
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
if not CUNGUI.INIT then
CUNGUI.INIT = true
local card1 = Duel.CreateToken(0,36021814)
local card2 = Duel.CreateToken(1,36021814)
CUNGUI.RegisteredMonsters:AddCard(card1)
CUNGUI.RegisteredMonsters:AddCard(card2)
Duel.SendtoHand(card1, nil, REASON_RULE)
Duel.SendtoHand(card2, nil, REASON_RULE)
end
local g = Duel.GetMatchingGroup(Card.IsType,0,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
aux.EnableChangeCode(c,32274490,LOCATION_GRAVE)
end
\ No newline at end of file
--村规决斗:神陆零式
--双方场上的怪兽攻击力上升对方基本分一半的数值(向下取整)。
CUNGUI = {}
function CUNGUI.Init()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(CUNGUI.val)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.filter(c,race)
return c:IsFaceup() and c:IsRace(race)
end
function CUNGUI.val(e,c)
return math.floor(Duel.GetLP(1-c:GetControler()) / 2)
end
function Auxiliary.PreloadUds()
-- one 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)
CUNGUI.Init()
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:天地创造
--开局时,双方将3张【贤者之石-萨巴希尔】(80831721)从卡组外表侧表示除外。
--这场决斗中这些卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这些卡得到以下效果。
--这个效果的发动和效果不会被无效化。
--宣言1个卡名才能发动。
--这张卡撕碎,那个卡名的卡从卡组外加入手卡·额外卡组。
--这场决斗中,双方因这个效果加入的卡造成的效果伤害变为0。
--(即使发生过位置移动,也视为同一张卡)
CUNGUI = {}
local OrigAnnounceCard = Duel.AnnounceCard
Duel.AnnounceCard = function(...)
local id=80831721
while id==80831721 do
id=OrigAnnounceCard(...)
end
return id
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.INIT then
CUNGUI.INIT = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
for i=0,1 do
if CUNGUI.RuleCard[i] then Duel.Remove(CUNGUI.RuleCard[i],POS_FACEUP,REASON_RULE) end
end
end
CUNGUI.RuleCard={}
CUNGUI.RuleCard[0]=Group.CreateGroup()
CUNGUI.RuleCard[1]=Group.CreateGroup()
CUNGUI.CreatedCard={}
function CUNGUI.RegisterCardRule(tp)
for i=1,3 do
local c=Duel.CreateToken(tp,80831721)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]:AddCard(c)
--forbid
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66666004,4))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetTarget(CUNGUI.ruletg)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetValue(CUNGUI.damval)
Duel.RegisterEffect(e1,0)
end
end
function CUNGUI.ruletg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(Duel.AnnounceCard(tp))
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local c=Duel.CreateToken(tp,e:GetLabel())
CUNGUI.RuleCard[tp]:RemoveCard(e:GetHandler())
Debug.Message(c)
CUNGUI.CreatedCard[c]=true
Duel.Exile(e:GetHandler(),REASON_RULE)
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
function CUNGUI.damval(e,re,val,r,rp,rc)
if not re then return val end
local c=re:GetHandler()
if bit.band(r,REASON_EFFECT)~=0 and c and CUNGUI.CreatedCard[c] then return 0
else return val end
end
--村规决斗:按图索骥
--开局时,双方将1张大融合(7614732)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,这张卡在除外的状态才能发动。这个效果的发动和效果不会被无效化。
--将1张随机融合怪兽卡从卡组外加入额外卡组,
--那张卡上记载的所有卡名的卡各1张
--和1张【融合】(24094653)从卡组外加入手卡·额外卡组。
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.INIT then
CUNGUI.INIT = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
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={}
CUNGUI.FusionCards={284224,464362,1412158,1516510,1546123,1546124,1561110,1641882,1906812,1945387,2111707,2129638,2504891,2519690,3113836,3366982,3410461,3544583,3642509,3779662,3897065,4167084,4591250,4628897,4688231,4796100,5128859,5368615,5600127,6150044,6150045,6182103,6602300,6840573,6855503,7243511,7631534,8198620,8327462,8463720,8692301,9293977,9603252,9653271,9910360,10040267,10248389,10365322,10383554,10526791,10817524,10920352,10960419,11039171,11270236,11321089,11443677,11502550,11901678,12015000,12307878,12652643,12678870,13108445,13293158,13331639,13529466,13722870,13735899,13756293,13803864,13857930,14017402,14225239,15237615,15291624,15661378,15989522,16006416,16114248,16304628,16507828,17032740,17412721,17745969,17881964,18313046,18386170,18514525,18666161,18832779,18967507,19066538,19261966,19355597,19747827,20366274,20366275,21113684,21140872,21175632,21225115,21947653,22061412,22070401,22093873,22160245,22638495,22804644,22900219,22908820,23204029,23995346,23995347,23995348,24550676,24672164,24799107,25119460,25366484,25586143,25655502,25793414,26273196,27134689,27346636,27873305,28016193,28593363,28677304,29095552,29343734,29357956,29455728,29929832,30086349,30757127,30864377,31111109,31339260,32355828,32485271,32615065,32751480,32752319,32775808,32828466,33026283,33129626,33250142,33574806,33652635,33691040,33964637,34848821,35187185,35752363,35809262,35877582,36256625,36841733,37057012,37261776,37421579,37440988,37491810,37542782,37663536,37678339,37818794,39512984,39915560,40080312,40101111,40173854,40391316,40418351,40636712,40854197,41209827,41209828,41232647,41373230,41436536,41462083,41462084,41517968,41544074,41578483,41685633,41721210,42166000,42717221,43228023,43378048,43387895,43892408,43892409,44146295,44373896,44509529,45014450,45170821,45231177,45231178,45349196,45655875,46354113,46696593,46759931,47611119,47737087,48063985,48156348,48424886,48791583,48832775,48996569,49161188,49352945,49513164,49597193,49820233,49868263,50237654,50282757,50608164,50855622,50907446,51570882,51777272,51788412,51828629,52031567,53262004,53315891,53539634,54401832,54541900,54622031,54702678,54752875,54757758,55171412,55615891,56413937,56532353,56655675,56907389,57157964,57477163,57594700,58147549,58293343,58332301,58468105,58481572,58528964,58601383,58859575,59036972,59255742,59531356,59642500,60110982,60237530,60461804,60493189,61204971,62111090,62624486,62873545,63519819,64463828,64599569,64655485,65029288,65172015,66235877,66309175,66889139,67985943,68507541,68745629,69394324,69946549,70219023,70534340,70681994,71159974,71616908,71628381,72064891,72272462,72378329,72664875,72869010,72926163,72959823,73285669,73452089,74009824,74157028,74506079,74583607,74703140,74711057,74822425,74889525,74936480,75286621,75380687,75906310,75923050,76263644,76614340,76815942,77693536,78084378,78512663,78734254,78778375,79194594,79206925,79229522,79864860,80071763,80516007,80532587,80727036,80889750,81003500,81197327,81566151,81612598,81997228,82315403,82734805,82956492,83121692,83340560,83656563,83743222,83866861,84058253,84243274,84433295,84569886,84687358,84988419,85059922,85507811,85545073,85684223,85908279,86099788,86164529,86165817,86240887,86274272,86346643,86520461,86676862,86805855,87116928,87182127,87746184,87751584,88305705,88753594,88820235,89112729,89870349,90050480,90140980,90307498,90555947,90579153,90660762,90957527,91034681,91272072,91998119,91998120,91998121,92798873,92892239,93379652,93657021,93729065,93877990,94566432,94905343,94977269,94977270,95144193,95463814,95486586,95793022,95952802,96220350,96334243,96897184,97165977,97300502,98502113,98502114,98502115,98927491,99267150,99267151,99551425,99724761,99916754}
function CUNGUI.RegisterCardRule(tp)
local c=Duel.CreateToken(tp,7614732)
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_IGNITION)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local index=#CUNGUI.FusionCards
local code=CUNGUI.FusionCards[math.random(index)]
local c=Duel.CreateToken(tp,code)
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
local fc=Duel.CreateToken(tp,24094653)
Duel.SendtoHand(fc,nil,REASON_EFFECT)
if not c.card_code_list then return end
for lcode,_ in pairs(c.card_code_list) do
local tc=Duel.CreateToken(tp,lcode)
Duel.SendtoHand(tc,tp,REASON_EFFECT)
end
end
--村规决斗:波动决斗
--所有怪兽得到以下效果:
--这张卡进行战斗后发动。
--这张卡的攻击力/守备力随机上升或下降。最少为-30%,最多为60%。
--这个效果上升和下降的攻击力不会被无效化,离场后仍然有效。
--具体规则:
--投一个硬币,如果是反面则下降,如果是正面则上升。
--再投一个骰子,如果是下降则按点数下降5%/10%/15%/20%/25%/30%,
--如果是上升则按点数上升10%/20%/30%/40%/50%/60%。
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,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA+LOCATION_MZONE,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA+LOCATION_MZONE,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(1621413,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLED)
e1:SetOperation(CUNGUI.operation)
c:RegisterEffect(e1)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local coin=Duel.TossCoin(tp,1) * 2 - 1
local atk=Duel.TossDice(tp,1) * c:GetAttack() * 0.1
local def=Duel.TossDice(tp,1) * c:GetDefense() * 0.1
if coin < 0 then
atk = atk * 0.5
def = def * 0.5
end
atk = atk * coin
def = def * coin
atk = math.ceil(atk)
def = math.ceil(def)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetValue(def)
c:RegisterEffect(e2)
end
This diff is collapsed.
This diff is collapsed.
--村规决斗:真假猴王
--开局时,双方将1张高尚仪式术(36350300)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。这个效果的处理不会被无效化。
--从卡组外将1张有任意卡名记述的随机仪式魔法卡加入手卡,那些记述的卡名各2张从卡组外加入手卡。
CUNGUI = {}
CUNGUI.RandomCard = {7986397,8198712,8955148,9236985,9786492,9845733,11398951,14094090,14735698,16494704,17888577,18803791,20071842,21082832,22398665,23459650,23965037,27383110,28429121,30392583,31002402,31066283,32828635,33031674,34767865,34834619,36350300,37626500,38784726,39399168,39996157,41182875,41426869,43417563,43694075,44221928,45410988,45948430,46052429,46159582,47435107,51124303,52913738,54539105,55761792,58827995,59820352,60234913,60365591,60369732,60921537,62835876,69035382,72446038,73055622,76792184,76806714,77454922,78577570,79306385,80566312,80811661,81756897,81933259,85327820,86758915,94377247,94666032,96420087,97211663}
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)
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do
math.random(1000)
end
end
function CUNGUI.AdjustOperation()
if not CUNGUI.INIT then
CUNGUI.INIT = 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 c=Duel.CreateToken(tp,36350300)
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
end
function CUNGUI.CheckCard(c)
return c.card_code_list ~= nil
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local rand = math.random(#CUNGUI.RandomCard)
local code = CUNGUI.RandomCard[rand]
local card = Duel.CreateToken(tp,code)
while not CUNGUI.CheckCard(card) do
table.remove(CUNGUI.RandomCard,rand)
rand = math.random(#CUNGUI.RandomCard)
code = CUNGUI.RandomCard[rand]
card = Duel.CreateToken(tp,code)
end
Duel.SendtoHand(card,nil,REASON_RULE)
for lcode,_ in pairs(card.card_code_list) do
local tc=Duel.CreateToken(tp,lcode)
Duel.SendtoHand(tc,tp,REASON_EFFECT)
tc=Duel.CreateToken(tp,lcode)
Duel.SendtoHand(tc,tp,REASON_EFFECT)
end
end
--村规决斗:七战之才
--开局时,双方将1张胜利龙(44910027)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.INIT then
CUNGUI.INIT = 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 c=Duel.CreateToken(tp,44910027)
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)
Duel.AddCustomActivityCounter(66666004,ACTIVITY_CHAIN,aux.FALSE)
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.GetCustomActivityCount(66666004,1-tp,ACTIVITY_CHAIN)~=0
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local list = {18144506,12580477,4031928,44763025,55144522,79571449,85602018}
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local code=Duel.AnnounceCard(tp,18144506,OPCODE_ISCODE,12580477,OPCODE_ISCODE,OPCODE_OR,4031928,
OPCODE_ISCODE,OPCODE_OR,44763025,OPCODE_ISCODE,OPCODE_OR,55144522,OPCODE_ISCODE,OPCODE_OR,79571449,OPCODE_ISCODE,OPCODE_OR,85602018,OPCODE_ISCODE,OPCODE_OR)
local tc=Duel.CreateToken(tp,code)
Duel.SendtoHand(tc,nil,REASON_RULE)
end
--村规决斗:互助联盟
--所有卡得到以下效果:
--自己场上的卡被战斗·效果破坏的场合,可以作为代替把自己场上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: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(nil,0,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,LOCATION_DECK+LOCATION_HAND+LOCATION_EXTRA,nil)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--destroy replace
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DESTROY_REPLACE)
e1:SetRange(LOCATION_ONFIELD)
e1:SetTarget(CUNGUI.desreptg)
e1:SetValue(CUNGUI.desrepval)
e1:SetOperation(CUNGUI.desrepop)
c:RegisterEffect(e1)
end
function CUNGUI.repfilter(c,tp)
return c:IsControler(tp) and c:IsLocation(LOCATION_ONFIELD)
and c:IsReason(REASON_BATTLE+REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function CUNGUI.desfilter(c,e,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_ONFIELD)
and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED+STATUS_BATTLE_DESTROYED)
end
function CUNGUI.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(CUNGUI.repfilter,1,nil,tp)
and Duel.IsExistingMatchingCard(CUNGUI.desfilter,tp,LOCATION_ONFIELD,0,1,nil,e,tp) end
if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
local g=Duel.SelectMatchingCard(tp,CUNGUI.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil,e,tp)
e:SetLabelObject(g:GetFirst())
g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true)
return true
end
return false
end
function CUNGUI.desrepval(e,c)
return CUNGUI.repfilter(c,e:GetHandlerPlayer())
end
function CUNGUI.desrepop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,2881864)
local tc=e:GetLabelObject()
tc:SetStatus(STATUS_DESTROY_CONFIRMED,false)
Duel.Destroy(tc,REASON_EFFECT+REASON_REPLACE)
end
--村规决斗:无证驾驶
--进行各种选卡动作时,
--不再过滤特定的卡。
--每个回合把手卡抽到5张(最少为1)。
--细则:
--大部分情况下,并不改变卡片的发动条件;
--只是在选取对象和处理卡的选择时可以任意选。
--不会扩大选取范围。
CUNGUI = {}
local SelectMatchingCard = Duel.SelectMatchingCard
Duel.SelectMatchingCard = function(tp,f,tp2,s,o,min,max,ex,...)
return SelectMatchingCard(tp,aux.TRUE,tp2,s,o,min,max,nil,...)
end
local SelectTarget = Duel.SelectTarget
Duel.SelectTarget = function(tp,f,tp2,s,o,min,max,ex,...)
return SelectTarget(tp,aux.TRUE,tp2,s,o,min,max,nil,...)
end
local DiscardHand = Duel.DiscardHand
Duel.DiscardHand = function(tp,f,min,max,reason)
return DiscardHand(tp,aux.TRUE,min,max,reason)
end
local SelectReleaseGroup = Duel.SelectReleaseGroup
Duel.SelectReleaseGroup = function(tp,f,min,max,ex,...)
return SelectReleaseGroup(tp,aux.TRUE,min,max,nil,...)
end
local SelectReleaseGroupEx = Duel.SelectReleaseGroupEx
Duel.SelectReleaseGroupEx = function(tp,f,min,max,ex,...)
return SelectReleaseGroupEx(tp,aux.TRUE,min,max,nil,...)
end
local SelectSubGroup = Group.SelectSubGroup
Group.SelectSubGroup = function(g,tp,f,cancelable,min,max,...)
return SelectSubGroup(g,tp,aux.TRUE,cancelable,min,max,...)
end
local GetFirstMatchingCard = Duel.GetFirstMatchingCard
Duel.GetFirstMatchingCard = function(f,tp,s,o,ex,...)
return SelectMatchingCard(tp,aux.TRUE,tp,s,o,1,1,nil,...)
end
function Auxiliary.PreloadUds()
--Draw
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DRAW_COUNT)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetValue(CUNGUI.DrawCount)
Duel.RegisterEffect(e2,0)
end
function CUNGUI.DrawCount(e)
if Duel.GetTurnCount()==1 then return 0 end
local p=Duel.GetTurnPlayer()
local ct=Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
if ct>4 then return 1
else return 5-ct end
end
\ No newline at end of file
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