Commit da071445 authored by JoyJ's avatar JoyJ

update

parent 4890b754
--村规决斗:孪生兄弟
--所有额外卡组的卡(开始游戏后送去额外的灵摆卡不算)得到以下效果:
--这张卡特殊召唤成功的场合发动。
--将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()
CUNGUI.Used={}
CUNGUI.Used[0]={}
CUNGUI.Used[1]={}
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
CUNGUI.Used[0]={}
CUNGUI.Used[1]={}
local g = Duel.GetMatchingGroup(nil,0,LOCATION_EXTRA,LOCATION_EXTRA,nil)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
if c:IsFaceup() then return end
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66666004,4))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetTarget(CUNGUI.distg2)
e2:SetOperation(CUNGUI.disop2)
c:RegisterEffect(e2)
end
function CUNGUI.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function CUNGUI.distg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return not CUNGUI.Used[tp][e:GetHandler():GetOriginalCode()] end
if not g then
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,0)
else
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,tp,0)
end
end
function CUNGUI.disop2(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetHandler():GetMaterial()
local code = e:GetHandler():GetOriginalCode()
if not g or #g==0 then return end
CUNGUI.Used[tp][code]=true
local tc=Duel.CreateToken(tp,code)
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
end
\ No newline at end of file
--村规决斗:岁月如梭
--开局时,双方将1张【所罗门的律法书】(23471572)从卡组外除外。这张卡不在除外状态的场合立刻除外。
--这张【所罗门的律法书】得到以下效果:
--每个对方的结束阶段发动。掷1个骰子。
--1:跳过自己的下个抽卡阶段。
--2:跳过自己的下个准备阶段。
--3:跳过自己的下个主要阶段1。
--4:跳过自己的下个主要阶段2。
--5:跳过自己的下个战斗阶段。
--6:无事发生。
--这个效果从T2开始发动和处理。
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.RuleCards=Group.CreateGroup()
function CUNGUI.AdjustOperation2(e,tp,eg,ep,ev,re,r,rp)
if (CUNGUI.RuleCards:Filter(Card.IsLocation,nil,LOCATION_REMOVED):GetCount()~=2) then
Duel.Remove(CUNGUI.RuleCards,POS_FACEUP,REASON_RULE)
end
end
function CUNGUI.RegisterRuleEffect(c)
--skip phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66666004,4))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_REMOVED)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetCondition(CUNGUI.condition)
e2:SetOperation(CUNGUI.operation)
c:RegisterEffect(e2)
end
function CUNGUI.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()>1 and Duel.GetTurnPlayer()~=tp
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local dice=Duel.TossDice(tp,1)
if dice==6 then return end
local code=EFFECT_SKIP_DP
if dice==2 then code=EFFECT_SKIP_SP end
if dice==3 then code=EFFECT_SKIP_M1 end
if dice==4 then code=EFFECT_SKIP_BP end
if dice==5 then code=EFFECT_SKIP_M2 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(code)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
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,23471572)
local card2 = Duel.CreateToken(1,23471572)
CUNGUI.RegisterRuleEffect(card1)
CUNGUI.RegisterRuleEffect(card2)
CUNGUI.RuleCards:AddCard(card1)
CUNGUI.RuleCards:AddCard(card2)
Duel.Remove(card1,POS_FACEUP,REASON_RULE)
Duel.Remove(card2,POS_FACEUP,REASON_RULE)
end
--return
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetOperation(CUNGUI.AdjustOperation2)
Duel.RegisterEffect(e2,0)
e:Reset()
end
\ No newline at end of file
--村规决斗:形态变化
--【三形金字塔】卡不在任何场地区域表侧表示存在的场合,
--那个场地区域的控制者从卡组外选1张【三形金字塔】场地,表侧放置到场地区域。
--三型金字塔场地效果修改:
--三形金字塔·大要塞
--①:自己场上怪兽的守备力上升500。
--②:自己场上的怪兽不会被效果破坏。
--③:场地区域的表侧表示的这张卡被送去墓地的场合,以自己墓地1张卡为对象才能发动。那只怪兽加入手卡。
--三形金字塔·巡航机
--①:只要这张卡在场地区域存在,每次怪兽召唤·特殊召唤,自己回复500基本分。
--②:场上有怪兽召唤的场合才能发动。自己从卡组抽1张,那之后选1张手卡丢弃。
--③:场地区域的表侧表示的这张卡被送去墓地的场合才能发动。从卡组把1张卡加入手卡。
--三形金字塔·巨人王
--①:自己场上怪兽的攻击力上升2000。
--②:自己的怪兽进行战斗的场合,直到伤害步骤结束时对方不能把魔法·陷阱·怪兽的效果发动。
--③:场地区域的表侧表示的这张卡被送去墓地的场合才能发动。从手卡把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)
e1=e1:Clone()
Duel.RegisterEffect(e1,1)
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SSET)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(CUNGUI.setlimit)
Duel.RegisterEffect(e2,0)
--cannot activate
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,1)
e3:SetValue(CUNGUI.filter)
Duel.RegisterEffect(e3,0)
end
function CUNGUI.setlimit(e,c,tp)
return c:IsType(TYPE_FIELD)
end
function CUNGUI.filter(e,re,tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function CUNGUI.AdjustFilter(c)
return c:IsCode(9989792,45383307,72772445) and c:IsFaceup()
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetCurrentChain()>0 then return end
if Duel.GetMatchingGroupCount(CUNGUI.AdjustFilter,tp,LOCATION_FZONE,0,nil)<1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local code=Duel.AnnounceCard(tp,9989792,OPCODE_ISCODE,45383307,OPCODE_ISCODE,OPCODE_OR,72772445,OPCODE_ISCODE,OPCODE_OR)
local tc=Duel.CreateToken(tp,code)
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
end
end
--村规决斗:打开盲盒
--开局时,双方将1张吓人手中盒(51697825)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。盲选对方卡组的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: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,51697825)
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.ruleop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_DECK,1,1,nil)
if #g<1 then return end
local tc = g:GetFirst()
Duel.SendtoHand(tc,tp,REASON_RULE)
local e2=Effect.CreateEffect(e:GetHandler())
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)
e2:SetLabelObject(tc)
e2:SetLabel(tc:GetFieldID())
Duel.RegisterEffect(e2,tp)
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
function CUNGUI.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(tp,2000,REASON_EFFECT)
end
--村规决斗:收支平衡
--开局时,双方将1张【霰弹式洗牌】(12183332)从卡组外除外。这张卡不在除外状态的场合立刻除外。
--这张【霰弹式洗牌】得到以下效果:
--在自己的回合,场面每次因这张卡以外的原因发生变化,依次进行如下动作:
--如果自己的卡组数量比墓地数量多,从卡组随机将1张卡送去墓地。
--如果自己的墓地数量比卡组数量多,从墓地随机将1张卡返回卡组。
CUNGUI = {}
CUNGUI.disabled={}
CUNGUI.RuleCards=Group.CreateGroup()
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)
--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.AdjustOperation2)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation2(e,tp,eg,ep,ev,re,r,rp)
if (CUNGUI.RuleCards:Filter(Card.IsLocation,nil,LOCATION_REMOVED):GetCount()~=2) then
Duel.Remove(CUNGUI.RuleCards,POS_FACEUP,REASON_RULE)
end
end
function CUNGUI.RegisterRuleEffect(c)
--return
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetCondition(CUNGUI.condition)
e2:SetOperation(CUNGUI.operation)
Duel.RegisterEffect(e2,0)
end
function CUNGUI.condition(e,tp,eg,ep,ev,re,r,rp)
if not (Duel.GetCurrentChain()==0 and Duel.GetTurnPlayer()==tp) then return false end
if CUNGUI.disabled[tp] then
CUNGUI.disabled[tp]=false
return false
end
end
function CUNGUI.filter(c)
return CUNGUI.RuleCards:IsContains(c)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
local g2=Duel.GetFieldGroup(tp,LOCATION_GRAVE,0)
local g3=nil
if #g1>#g2 then
g3=g1:RandomSelect(tp,1)
Duel.SendtoGrave(g3,REASON_EFFECT)
end
g1=Duel.GetFieldGroup(tp,LOCATION_GRAVE,0)
g2=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
if #g1>#g2 then
g3=g1:RandomSelect(tp,1)
Duel.SendtoDeck(g3,nil,2,REASON_EFFECT)
end
CUNGUI.disabled[tp]=true
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
local card1 = Duel.CreateToken(0,12183332)
local card2 = Duel.CreateToken(1,12183332)
CUNGUI.RegisterRuleEffect(card1)
CUNGUI.RegisterRuleEffect(card2)
CUNGUI.RuleCards:AddCard(card1)
CUNGUI.RuleCards:AddCard(card2)
Duel.Remove(card1,POS_FACEUP,REASON_RULE)
Duel.Remove(card2,POS_FACEUP,REASON_RULE)
e:Reset()
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,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)
--pierce
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_INACTIVATE)
e3:SetCode(EFFECT_PIERCE)
c:RegisterEffect(e3)
--battle indestructable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_INACTIVATE)
e4:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e4:SetValue(1)
c:RegisterEffect(e4)
end
--村规决斗:等价交换
--所有卡得到以下效果:
--这个类型的效果1回合只能使用最多(回合数-1)次。
--把这张卡从手卡返回卡组,支付25%的基本分才能发动。从卡组选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(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)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(3431737,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(CUNGUI.cost)
e1:SetTarget(CUNGUI.target)
e1:SetOperation(CUNGUI.operation)
c:RegisterEffect(e1)
end
CUNGUI.LastUsedTurn = {}
CUNGUI.LastUsedNum = {}
CUNGUI.LastUsedTurn[0] = 0
CUNGUI.LastUsedTurn[1] = 0
CUNGUI.LastUsedNum[0] = 0
CUNGUI.LastUsedNum[1] = 0
function CUNGUI.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local now=Duel.GetTurnCount()
if chk==0 then return c:IsAbleToDeckAsCost() end
Duel.SendtoDeck(c, nil, 2, REASON_COST)
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/4))
end
function CUNGUI.filter(c)
return c:IsAbleToHand()
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local now=Duel.GetTurnCount()-1
if chk==0 then return
Duel.IsExistingMatchingCard(CUNGUI.filter,tp,LOCATION_DECK,0,1,nil)
and (now>CUNGUI.LastUsedTurn[tp] or CUNGUI.LastUsedNum[tp]<CUNGUI.LastUsedTurn[tp]-1) end
local now=Duel.GetTurnCount()
if CUNGUI.LastUsedTurn[tp] ~= now then
CUNGUI.LastUsedTurn[tp]=now
CUNGUI.LastUsedNum[tp]=0
end
CUNGUI.LastUsedNum[tp] = CUNGUI.LastUsedNum[tp] + 1
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tc=Duel.SelectMatchingCard(tp,CUNGUI.filter,tp,LOCATION_DECK,0,1,1,nil)
if tc then
if Duel.SendtoHand(tc,nil,REASON_EFFECT) > 0 then
Duel.ConfirmCards(1-tp,tc)
end
end
end
--村规决斗:随机附赠
--所有怪兽得到以下效果:
--这张卡的效果处理的场合,
--那个效果处理后,随机选1张自己目前控制的卡中
--1张当前可处理的魔法陷阱卡的发动时的代价和效果,进行处理。
--(如果没有任何卡可以处理则不处理)
CUNGUI = {}
CUNGUI.Lock = {}
CUNGUI.NoFunc = {}
function CUNGUI.filter(c,e,tp,eg,ep,ev,re,r,rp)
local te=c:GetActivateEffect()
if not te then return false end
local cond = te:GetCondition()
local cost = te:GetCost()
local targ = te:GetTarget()
return (te:GetCode()==EVENT_FREE_CHAIN or te:GetType()==EFFECT_TYPE_IGNITION) and
(c:GetOriginalType() & (TYPE_MONSTER+TYPE_CONTINUOUS+TYPE_FIELD+TYPE_EQUIP))==0 and
(not cost or cost(e,tp,eg,ep,ev,re,r,rp,0)) and
(not targ or targ(e,tp,eg,ep,ev,re,r,rp,0)) and
not CUNGUI.NoFunc[e]
end
local SetOperation = Effect.SetOperation
Effect.SetOperation = function(e,func)
local typ = e:GetType()
if typ and (typ & 0x7d0)==0 then
SetOperation(e,func)
return
end
SetOperation(e,function(e,tp,eg,ep,ev,re,r,rp)
if func then
func(e,tp,eg,ep,ev,re,r,rp)
else
CUNGUI.NoFunc[e]=true
end
local atyp = e:GetActiveType()
if not CUNGUI.Lock[e] and atyp and (atyp & TYPE_MONSTER)>0 then
local g=Duel.GetMatchingGroup(CUNGUI.filter,tp,0xff,0,nil,e,tp,eg,ep,ev,re,r,rp)
if #g>0 then
CUNGUI.Lock[e]=true
local tc=g:RandomSelect(tp,1):GetFirst()
Duel.Hint(HINT_CARD,tp,tc:GetOriginalCode())
Duel.Hint(HINT_CODE,tp,tc:GetOriginalCode())
local te=tc:GetActivateEffect()
local cond = te:GetCondition()
local cost = te:GetCost()
local target = te:GetTarget()
local operation = te:GetOperation()
Duel.ClearTargetCard()
e:SetProperty(te:GetProperty())
e:GetHandler():CreateEffectRelation(te)
if cost then cost(te,tp,eg,ep,ev,re,r,rp,1) end
if target then target(te,tp,eg,ep,ev,re,r,rp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
local fc=g:GetFirst()
while fc do
fc:CreateEffectRelation(te)
fc=g:GetNext()
end
end
if operation then operation(te,tp,eg,ep,ev,re,r,rp) end
if g then
fc=g:GetFirst()
while fc do
fc:ReleaseEffectRelation(te)
fc=g:GetNext()
end
end
CUNGUI.Lock[e]=false
end
end
end)
end
function Auxiliary.PreloadUds()
end
--村规决斗:随机附赠
--入连锁的效果处理的场合,
--那个效果处理后,随机选1张自己目前控制的卡的效果中
--1个当前可处理的效果的发动时的代价和效果,进行处理。
--(如果没有任何卡可以处理则不处理)
CUNGUI = {}
CUNGUI.NoFunc = {}
CUNGUI.Success=false
function CUNGUI.TestEffect(te,e,tp,eg,ep,ev,re,r,rp)
local cod = e:GetCode()
local cond = te:GetCondition()
local cost = te:GetCost()
local targ = te:GetTarget()
local op = te:GetOperation()
if (not cost or cost(e,tp,eg,ep,ev,re,r,rp,0)) and
(not targ or targ(e,tp,eg,ep,ev,re,r,rp,0)) then
return true end
local err = CUNGUI.None[111]
return CUNGUI.None[111]
end
local SelectTarget = Duel.SelectTarget
CUNGUI.Target=nil
Duel.SelectTarget = function(...)
local g=SelectTarget(...)
CUNGUI.Target=g
g:KeepAlive()
return g
end
local GetFirstTarget = Duel.GetFirstTarget
Duel.GetFirstTarget = function(b)
if GetFirstTarget() then return GetFirstTarget() end
if not CUNGUI.Target then return nil end
return CUNGUI.Target:GetFirst()
end
function CUNGUI.filter(c,e,tp,eg,ep,ev,re,r,rp)
if not CUNGUI.EffectSaver[c] then return false end
for k,te in pairs(CUNGUI.EffectSaver[c]) do
local success,err = pcall(CUNGUI.TestEffect,te,e,tp,eg,ep,ev,re,r,rp)
if success then return err end
end
return false
end
function CUNGUI.GetEffect(c,e,tp,eg,ep,ev,re,r,rp)
local es={}
for k,te in pairs(CUNGUI.EffectSaver[c]) do
local success,_ = pcall(CUNGUI.TestEffect,te,e,tp,eg,ep,ev,re,r,rp)
if success then
table.insert(es,te)
end
end
if #es==0 then return nil end
return es[math.random(#es)]
end
CUNGUI.EffectSaver={}
local RegisterEffect = Card.RegisterEffect
Card.RegisterEffect = function(c,e,forced)
if not CUNGUI.EffectSaver[c] then CUNGUI.EffectSaver[c]={} end
local typ = e:GetType()
local op = e:GetOperation()
if typ and (typ & 0x7d0)>0 and op then
table.insert(CUNGUI.EffectSaver[c],e)
Effect.SetOperationEx(e,e:GetOperation())
end
return RegisterEffect(c,e,forced)
end
Effect.SetOperationEx = function(e,func)
local typ = e:GetType()
if typ and (typ & 0x7d0)==0 then
Effect.SetOperation(e,func)
return
end
Effect.SetOperation(e,function(e,tp,eg,ep,ev,re,r,rp)
if func then
func(e,tp,eg,ep,ev,re,r,rp)
else
CUNGUI.NoFunc[e]=true
end
local atyp = e:GetActiveType()
if not CUNGUI.Lock then
local g=Duel.GetMatchingGroup(CUNGUI.filter,tp,0xff,0xff,nil,e,tp,eg,ep,ev,re,r,rp)
if #g>0 then
CUNGUI.Lock=true
local tc=g:RandomSelect(tp,1):GetFirst()
local tcc=tc:GetOriginalCode()
Duel.Hint(HINT_CARD,tp,tcc)
Duel.Hint(HINT_CODE,tp,tcc)
Duel.Hint(HINT_CODE,1-tp,tcc)
local te=CUNGUI.GetEffect(tc,e,tp,eg,ep,ev,re,r,rp)
if te==nil then
CUNGUI.Lock=false
return
end
local desc = te:GetDescription()
if not desc or desc==0 then desc = 7 end
Duel.Hint(HINT_OPSELECTED,tp,desc)
local cost = te:GetCost()
local target = te:GetTarget()
local operation = te:GetOperation()
Duel.ClearTargetCard()
local prop = e:GetProperty()
e:SetProperty(te:GetProperty())
e:GetHandler():CreateEffectRelation(e)
if cost then pcall(cost,e,tp,eg,ep,ev,re,r,rp,1) end
if target then pcall(target,e,tp,eg,ep,ev,re,r,rp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then
local fc=g:GetFirst()
while fc do
fc:CreateEffectRelation(e)
fc=g:GetNext()
end
end
if operation then pcall(operation,e,tp,eg,ep,ev,re,r,rp) end
if g then
fc=g:GetFirst()
while fc do
fc:ReleaseEffectRelation(e)
fc=g:GetNext()
end
end
e:SetProperty(prop)
end
end
end)
end
function CUNGUI.reset()
CUNGUI.Lock=false
end
function Auxiliary.PreloadUds()
local e4=Effect.GlobalEffect()
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetOperation(CUNGUI.reset)
Duel.RegisterEffect(e4,0)
end
--村规决斗:魔术大师
--所有卡得到以下效果:
--支付500点基本分才能发动。查看自己卡组最上方的卡。
--那之后,可以将那张卡加入手卡,或洗切自己的卡组。
--加入手卡的场合,自己这回合不能再发动此类效果。
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_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)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(51351302,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(CUNGUI.cond)
e1:SetCost(CUNGUI.cost)
e1:SetTarget(CUNGUI.target)
e1:SetOperation(CUNGUI.operation)
c:RegisterEffect(e1)
end
CUNGUI.Used={}
CUNGUI.Used[0]=0
CUNGUI.Used[1]=0
function CUNGUI.cond(e,tp)
return CUNGUI.Used[tp]<Duel.GetTurnCount()
end
function CUNGUI.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,500) end
Duel.PayLPCost(tp,500)
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetDecktopGroup(tp,1)
if g:GetCount()~=0 then
Duel.ConfirmCards(tp,g)
if Duel.SelectYesNo(tp,aux.Stringid(123709,2)) then
CUNGUI.Used[tp] = Duel.GetTurnCount()
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
Duel.ShuffleDeck(tp)
end
end
--トラミッド・クルーザー
function c45383307.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--lp recover
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(45383307,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_FZONE)
e2:SetOperation(c45383307.lpop)
c:RegisterEffect(e2)
e2=e2:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--draw
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(45383307,1))
e3:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_FZONE)
e3:SetTarget(c45383307.drtg)
e3:SetOperation(c45383307.drop)
c:RegisterEffect(e3)
--to hand
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetDescription(aux.Stringid(45383307,2))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(c45383307.thcon)
e4:SetTarget(c45383307.thtg)
e4:SetOperation(c45383307.thop)
c:RegisterEffect(e4)
end
function c45383307.lpop(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(tp,500,REASON_EFFECT)
end
function c45383307.drfilter(c)
return c:IsType(TYPE_MONSTER)
end
function c45383307.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c45383307.drfilter,1,nil)
and Duel.IsPlayerCanDraw(tp,1) end
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c45383307.drop(e,tp,eg,ep,ev,re,r,rp)
if Duel.Draw(tp,1,REASON_EFFECT)~=0 then
Duel.ShuffleHand(tp)
Duel.BreakEffect()
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT+REASON_DISCARD)
end
end
function c45383307.thfilter(c)
return c:IsAbleToHand()
end
function c45383307.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_FZONE) and c:IsPreviousPosition(POS_FACEUP)
end
function c45383307.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c45383307.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c45383307.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c45383307.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--トラミッド・キングゴレム
function c72772445.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetValue(2000)
c:RegisterEffect(e2)
--actlimit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(0,1)
e3:SetValue(1)
e3:SetCondition(c72772445.actcon)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(c72772445.spcon)
e4:SetTarget(c72772445.sptg)
e4:SetOperation(c72772445.spop)
c:RegisterEffect(e4)
end
function c72772445.actfilter(c,tp)
return c and c:IsFaceup() and c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER) and c:IsControler(tp)
end
function c72772445.actcon(e)
local tp=e:GetHandlerPlayer()
return c72772445.actfilter(Duel.GetAttacker(),tp) or c72772445.actfilter(Duel.GetAttackTarget(),tp)
end
function c72772445.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_FZONE) and c:IsPreviousPosition(POS_FACEUP)
end
function c72772445.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c72772445.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c72772445.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c72772445.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c72772445.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--トラミッド・フォートレス
function c9989792.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetValue(500)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TRUE)
e3:SetValue(1)
c:RegisterEffect(e3)
--to hand
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOHAND)
e4:SetDescription(aux.Stringid(9989792,0))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(c9989792.thcon)
e4:SetTarget(c9989792.thtg)
e4:SetOperation(c9989792.thop)
c:RegisterEffect(e4)
end
function c9989792.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_FZONE) and c:IsPreviousPosition(POS_FACEUP)
end
function c9989792.thfilter(c)
return c:IsAbleToHand()
end
function c9989792.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c9989792.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c9989792.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c9989792.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c9989792.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
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