Commit 2934935f authored by JoyJ's avatar JoyJ

update srv5555 scripts

parent 67f1ac3e
--村规决斗:谁是小丑
--开局时,双方从卡组外将1张【娱乐法师 戏法小丑】表侧表示从游戏中除外。
--这张【娱乐法师 戏法小丑】得到以下效果。
--①自己准备阶段,这张卡不在场上的场合发动。
--投1个硬币。如果是正面,这张卡在自己场上特殊召唤,自己受到1000点伤害。
--③这张卡离开场上的场合从游戏中除外,不在场上存在的场合(比如作为超量素材)从游戏中除外。
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.RegisterForbiddenRule(0)
CUNGUI.RegisterForbiddenRule(1)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED+LOCATION_ONFIELD) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED+LOCATION_ONFIELD) 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.ForbiddenEffects={}
CUNGUI.ForbiddenEffects[0]={}
CUNGUI.ForbiddenEffects[1]={}
function CUNGUI.RegisterForbiddenRule(tp)
local c=Duel.CreateToken(tp,67696066)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetDescription(aux.Stringid(102380,1))
e2:SetCategory(CATEGORY_DICE)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetRange(LOCATION_OVERLAY+LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e2:SetCountLimit(1)
e2:SetCondition(CUNGUI.damcon)
e2:SetOperation(CUNGUI.damop)
c:RegisterEffect(e2)
end
function CUNGUI.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function CUNGUI.damop(e,tp,eg,ep,ev,re,r,rp)
local dice=Duel.TossCoin(tp,1)
if dice==1 then
if Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)>0 then
Duel.Damage(tp,1000,REASON_EFFECT)
end
end
end
--村规决斗:献上祭品
--所有怪兽得到以下效果:
--这张卡可以把自己场上的表侧表示的2只与这张卡同种族或同属性的怪兽送去墓地,
--从手卡·卡组特殊召唤。
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)
--spsummon proc
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(CUNGUI.spcon)
e1:SetOperation(CUNGUI.spop)
e1:SetValue(SUMMON_VALUE_SELF)
c:RegisterEffect(e1)
end
function CUNGUI.CreateFilter(c)
local race=c:GetRace()
local attr=c:GetAttribute()
return function(c)
return c:IsFaceup() and (c:IsRace(race) or c:IsAttribute(attr)) and c:IsAbleToGraveAsCost()
end
end
function CUNGUI.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2
and Duel.IsExistingMatchingCard(CUNGUI.CreateFilter(e:GetHandler()),tp,LOCATION_MZONE,0,2,nil)
end
function CUNGUI.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,CUNGUI.CreateFilter(e:GetHandler()),tp,LOCATION_MZONE,0,2,2,nil)
Duel.SendtoGrave(g,REASON_COST)
end
\ No newline at end of file
--村规决斗:万物互联
--进行各种选卡动作时,
--可以选择双方的任何卡。
--每个回合把手卡抽到5张(最少为1)。
--细则:
--大部分情况下,并不改变卡片的发动条件;
--只是在选取对象和处理卡的选择时可以任意选。
CUNGUI = {}
local SelectMatchingCard = Duel.SelectMatchingCard
Duel.SelectMatchingCard = function(tp,f,tp2,s,o,min,max,ex,...)
local g3=Group.CreateGroup()
repeat
local g1=SelectMatchingCard(tp,nil,tp2,0x7f,0,0,max,nil,...) or Group.CreateGroup()
local g2=SelectMatchingCard(tp,nil,tp2,0,0x7f,0,max,nil,...) or Group.CreateGroup()
g3=Group.CreateGroup()
g3:Merge(g1)
g3:Merge(g2)
until g3 and #g3>=min and #g3<=max
return g3
end
local SelectTarget = Duel.SelectTarget
Duel.SelectTarget = function(tp,f,tp2,s,o,min,max,ex,...)
local g3=Group.CreateGroup()
repeat
local g1=SelectTarget(tp,nil,tp2,0x7f,0,0,max,nil,...) or Group.CreateGroup()
local g2=SelectTarget(tp,nil,tp2,0,0x7f,0,max,nil,...) or Group.CreateGroup()
g3=Group.CreateGroup()
g3:Merge(g1)
g3:Merge(g2)
until g3 and #g3>=min and #g3<=max
return g3
end
local DiscardHand = Duel.DiscardHand
Duel.DiscardHand = function(tp,f,min,max,reason)
local g3=Group.CreateGroup()
repeat
local g1=SelectMatchingCard(tp,Card.IsDiscardable,tp2,0x7f,0,0,max,nil) or Group.CreateGroup()
local g2=SelectMatchingCard(tp,Card.IsDiscardable,tp2,0,0x7f,0,max,nil) or Group.CreateGroup()
g3=Group.CreateGroup()
g3:Merge(g1)
g3:Merge(g2)
until g3 and #g3>=min and #g3<=max
Duel.SendtoGrave(g3,reason | REASON_DISCARD)
end
local SelectReleaseGroup = Duel.SelectReleaseGroup
Duel.SelectReleaseGroup = function(tp,f,min,max,ex,...)
local g3=Group.CreateGroup()
repeat
local g1=SelectMatchingCard(tp,Card.IsReleasable,tp2,0x7f,0,0,max,nil) or Group.CreateGroup()
local g2=SelectMatchingCard(tp,Card.IsReleasable,tp2,0,0x7f,0,max,nil) or Group.CreateGroup()
g3=Group.CreateGroup()
g3:Merge(g1)
g3:Merge(g2)
until g3 and #g3>=min and #g3<=max
return g3
end
local SelectReleaseGroupEx = Duel.SelectReleaseGroupEx
Duel.SelectReleaseGroupEx = function(tp,f,min,max,ex,...)
local g3=Group.CreateGroup()
repeat
local g1=SelectMatchingCard(tp,Card.IsReleasable,tp2,0x7f,0,0,max,nil) or Group.CreateGroup()
local g2=SelectMatchingCard(tp,Card.IsReleasable,tp2,0,0x7f,0,max,nil) or Group.CreateGroup()
g3=Group.CreateGroup()
g3:Merge(g1)
g3:Merge(g2)
until g3 and #g3>=min and #g3<=max
return g3
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
--村规决斗:传世经典
--开局时,双方查看对方卡组,相互选2张卡。
--双方选好后,那些卡加入各自的额外卡组。
--那些因此加入额外卡组的卡和同名的卡,
--仅限其持有者,在决斗中不能使用。
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.ForbidCard(c)
local tp=c:GetControler()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_FORBIDDEN)
e1:SetRange(LOCATION_SZONE)
e1:SetTargetRange(0x7f,0x7f)
e1:SetTarget(CUNGUI.bantg)
e1:SetLabel(c:GetCode())
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_TARGET)
e2:SetCode(EFFECT_ADD_TYPE)
e2:SetValue(TYPE_PENDULUM)
c:RegisterEffect(e2)
end
function CUNGUI.bantg(e,c)
local code1,code2=c:GetOriginalCodeRule()
local fcode=e:GetLabel()
return (code1==fcode or code2==fcode)
end
function CUNGUI.AdjustOperation(e)
local g=Group.CreateGroup()
for tp=0,1 do
if #Duel.GetFieldGroup(tp,0,LOCATION_DECK)>1 then
Duel.ConfirmCards(tp,Duel.GetFieldGroup(tp,0,LOCATION_DECK))
g:Merge(Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_DECK,2,2,nil))
end
end
g:ForEach(CUNGUI.ForbidCard)
Duel.SendtoExtraP(g,nil,REASON_RULE)
e:Reset()
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