Commit abd0c027 authored by JoyJ's avatar JoyJ

update srv5555 rules

parent 18b83ab8
--村规决斗:基因重组
--开局时,双方将1张DNA改造手术(74701381)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己·对方回合发动。这个效果的发动和效果不会被无效化,双方不能针对这个效果把效果发动。
--随机选自己场上1张卡返回卡组·额外卡组,
--从双方卡组·额外卡组随机取类型相同的1张卡上场。
--如果特殊召唤的卡是XYZ怪兽,则从卡组外将2张【礼品卡】(39526584)当作叠光素材在那些卡下面叠放。
--细则:主要区域的怪兽->卡组的怪兽,或额外卡组的非表侧灵摆·非连接怪兽
--额外区域的怪兽->额外卡组的怪兽
--永续魔法->永续魔法,永续陷阱->永续陷阱,场地->场地
--里侧离场则里侧特殊召唤/盖放,表侧离场则表侧特殊召唤/表侧放置。
--类型在离场时判定。如离场后发生改变(比如二重或陷阱怪兽、装备怪兽)导致没有合适的卡返场,则不返场。
--表侧表示的装备卡估计会在无意义返场后直接送墓。
--2速的自由时点效果,但如果始终未处理,则在结束阶段必须处理。
CUNGUI = {}
CUNGUI.RuleCardCode=74701381
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_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,87654321)
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)
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCondition(aux.TRUE)
e2:SetCode(EVENT_PHASE+PHASE_END)
c:RegisterEffect(e2)
end
function CUNGUI.rulecond(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_END or Duel.GetCurrentChain()>0
end
function CUNGUI.ruletg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetChainLimit(aux.FALSE)
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0)
if #g==0 then return end
g=g:RandomSelect(tp,1)
local c=g:GetFirst()
local from=LOCATION_DECK
local to=c:GetLocation()
local stype=c:GetType()
local pos=c:GetPosition()
local seq=c:GetSequence()
local zone=math.pow(2,seq)
if c:IsLocation(LOCATION_SZONE) then
zone=(zone<<8)
end
if c:IsType(TYPE_MONSTER) then
if c:GetSequence()>=5 then
from=LOCATION_EXTRA
stype=TYPE_MONSTER
else
from=LOCATION_DECK+LOCATION_EXTRA
end
end
Duel.SendtoDeck(c,nil,2,REASON_RULE)
g=Duel.GetMatchingGroup(function(tc) return tc:IsType(stype) end,tp,from,from,nil)
if #g==0 then return end
c=g:GetFirst()
if stype==TYPE_MONSTER then
if c:IsType(TYPE_LINK) then pos=POS_FACEUP_ATTACK end
Duel.SpecialSummonStep(c,0,tp,tp,true,true,pos,zone)
if c:IsType(TYPE_XYZ) then
CUNGUI.AddOverlay(c)
end
c:CompleteProcedure()
Duel.SpecialSummonComplete()
else
if (pos & POS_FACEUP)>0 then
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,pos,true)
else
Duel.SSet(tp,c,tp,false)
end
Duel.MoveSequence(c,seq)
end
end
function CUNGUI.AddOverlay(c)
if not c:IsLocation(LOCATION_MZONE) then return end
local g=Group.CreateGroup()
for i=1,2 do
local tc = Duel.CreateToken(c:GetControler(), 39526584)
g:AddCard(tc)
end
if Duel.SendtoHand(g, c:GetControler(), REASON_RULE)~=2 then return end
Duel.Overlay(c,g)
end
--村规决斗:一期一会
--开局时,双方将1张幸运机会(96012004)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--自己抽卡阶段的通常抽卡后,把手卡抽到5张。
--自己结束阶段。自己的手卡全部返回卡组。
--以上两个效果不受【不能抽卡】【不能返回卡组】的效果影响。
--(均不入连锁)
CUNGUI = {}
CUNGUI.RuleCardCode=96012004
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
--start
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_DRAW)
e1:SetRange(LOCATION_REMOVED)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCountLimit(1)
e1:SetCondition(CUNGUI.con)
e1:SetOperation(CUNGUI.startop)
c:RegisterEffect(e1)
--end
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_REMOVED)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCountLimit(1)
e2:SetCondition(CUNGUI.con)
e2:SetOperation(CUNGUI.endop)
c:RegisterEffect(e2)
end
function CUNGUI.con(e,tp)
return Duel.GetTurnPlayer()==tp
end
function CUNGUI.startop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
local num = 5
if tp~=0 then num = 6 end
local num = 5-(#g)
if num > 0 then
Duel.Draw(tp,num,REASON_RULE)
end
end
function CUNGUI.endop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_RULE)
end
--村规决斗:生死一线
--所有怪兽得到以下效果。
--这张卡被攻击的攻击宣言时才能发动。
--投一个硬币。正面的场合,攻击怪兽破坏;反面的场合,攻击怪兽的攻击力直到结束阶段上升那个攻击力数值。
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)
--coin
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(13893596,0))
e3:SetCategory(CATEGORY_TOGRAVE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_ATTACK_ANNOUNCE)
e3:SetCondition(CUNGUI.cond)
e3:SetCondition(CUNGUI.target)
e3:SetOperation(CUNGUI.operation)
c:RegisterEffect(e3)
end
function CUNGUI.cond(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()==e:GetHandler()
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker()~=nil end
Duel.GetAttacker():CreateEffectRelation(e)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if not tc or not tc:IsRelateToEffect(e) then return end
local result=Duel.TossCoin(tp,1)
if result==1 then
Duel.Destroy(tc,REASON_EFFECT)
else
--atkup
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_UPDATE_ATTACK)
e4:SetValue(tc:GetAttack())
e4:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e4)
end
end
--村规决斗:相位变换
--所有怪兽得到以下效果:
--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,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 e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(42874792,0))
e3:SetCategory(CATEGORY_REMOVE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetTarget(CUNGUI.target)
e3:SetOperation(CUNGUI.operation)
c:RegisterEffect(e3)
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return e:GetHandler():IsAbleToRemove() end
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
if tc:IsRelateToEffect(e) and Duel.Remove(tc,tc:GetPosition(),REASON_EFFECT+REASON_TEMPORARY)~=0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_REMOVED)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetTurnCount())
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCondition(CUNGUI.retcon)
e1:SetOperation(CUNGUI.retop)
tc:RegisterEffect(e1)
end
end
function CUNGUI.retcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==e:GetLabel()
end
function CUNGUI.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.ReturnToField(e:GetHandler())
e:Reset()
end
--村规决斗:天降神兵
--开局时,双方将1张遗言状(85602018)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。从卡组选最多(回合数)只怪兽在场上特殊召唤。
CUNGUI = {}
CUNGUI.RuleCardCode=85602018
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.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,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.GetTurnPlayer()==tp
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(CUNGUI.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,CUNGUI.RuleCardCode)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local max = Duel.GetTurnCount()
if max > 5 then max = 5 end
if max > Duel.GetMZoneCount(tp) then max = Duel.GetMZoneCount(tp) end
local g=Duel.SelectMatchingCard(tp,CUNGUI.spfilter,tp,LOCATION_DECK,0,1,max,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
--村规决斗:背水一战
--自己场上的怪兽攻击力上升
--(8000-自己基本分)/2的数值(向下取整)。
--细则:基本分大于8000的场合,攻击力不会下降。
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.val(e,c)
local val = math.floor((8000-Duel.GetLP(c:GetControler())) / 2)
if val < 0 then val = 0 end
return val
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
--村规决斗:拼命三郎
--所有怪兽得到以下效果:
--这张卡的攻击力上升这张卡的原本守备力数值。
--这张卡的守备力下降这张卡的原本攻击力数值。
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)
--atklimit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(CUNGUI.atkval)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetValue(CUNGUI.defval)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
end
function CUNGUI.atkval(e,c)
return e:GetHandler():GetBaseDefense()
end
function CUNGUI.defval(e,c)
return -e:GetHandler():GetBaseAttack()
end
\ No newline at end of file
--村规决斗:稳步慢行
--双方抽卡阶段的通常抽卡数量,变成直到让自己场上+手卡的卡的数量达到(5+回合数)为止。
--抽卡量最少为1。
CUNGUI={}
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
CUNGUI.Used=0
function CUNGUI.DrawCount(e)
local p=Duel.GetTurnPlayer()
local ct=Duel.GetTurnCount()+5-Duel.GetFieldGroupCount(p,LOCATION_HAND+LOCATION_ONFIELD,0)
if ct<=0 then ct=1 end
return ct
end
\ No newline at end of file
--村规决斗:细水长流
--开局时,双方从卡组选1张魔法·陷阱卡,从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果:
--1回合1次,自己·对方回合才能发动。
--这个效果的发动和效果不能被无效化。
--处理这张卡原本发动时的效果(无需Cost)。
CUNGUI = {}
CUNGUI.RuleCard={}
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
local fc=Duel.SelectMatchingCard(0,Card.IsType,0,LOCATION_DECK,0,1,1,nil,TYPE_SPELL+TYPE_TRAP):GetFirst()
local sc=Duel.SelectMatchingCard(1,Card.IsType,1,LOCATION_DECK,0,1,1,nil,TYPE_SPELL+TYPE_TRAP):GetFirst()
CUNGUI.RegisterCardRule(0,fc)
CUNGUI.RegisterCardRule(1,sc)
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
function CUNGUI.RegisterCardRule(tp,c)
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_QUICK_O)
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:SetTarget(CUNGUI.targ)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.targ(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local te=e:GetHandler():GetActivateEffect()
if not te then return false end
local target = te:GetTarget()
if target then return target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end
return true
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetHandler():GetActivateEffect()
if not te then return end
local operation = te:GetOperation()
if operation then return operation(e,tp,eg,ep,ev,re,r,rp) end
end
--村规决斗:终末波纹
--所有起动效果、自由时点的诱发即时效果,
--变为结束阶段可以处理的效果。
CUNGUI = {}
local reg=Card.RegisterEffect
Card.RegisterEffect=function(c,e,f)
local typ = e:GetType()
local cod = e:GetCode()
if typ == EFFECT_TYPE_IGNITION or (typ == EFFECT_TYPE_QUICK_O and cod==EVENT_FREE_CHAIN) then
e:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e:SetCode(EVENT_PHASE+PHASE_END)
end
return reg(c,e,f)
end
function Auxiliary.PreloadUds()
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