Commit d1339716 authored by JoyJ's avatar JoyJ

add dc server port 5555 scripts

parent 6c412f43
--黒衣竜アルビオン
function c25451383.initial_effect(c)
--change name
aux.EnableChangeCode(c,68468459,LOCATION_MZONE+LOCATION_GRAVE)
--to grave
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(25451383,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,25451383)
e1:SetTarget(c25451383.target)
e1:SetOperation(c25451383.operation)
c:RegisterEffect(e1)
end
function c25451383.costfilter(c)
return c:IsAbleToGraveAsCost()
end
function c25451383.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local b1=Duel.IsExistingMatchingCard(c25451383.costfilter,tp,LOCATION_HAND,0,1,c)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
local b2=Duel.IsExistingMatchingCard(c25451383.costfilter,tp,LOCATION_DECK,0,1,nil)
and c:IsAbleToDeck() and (c:IsLocation(LOCATION_GRAVE) or Duel.IsPlayerCanDraw(tp,1))
if chk==0 then return b1 or b2 end
local g=Group.CreateGroup()
local g1=Duel.GetMatchingGroup(c25451383.costfilter,tp,LOCATION_HAND,0,c)
local g2=Duel.GetMatchingGroup(c25451383.costfilter,tp,LOCATION_DECK,0,nil)
if b1 then
g:Merge(g1)
end
if b2 then
g:Merge(g2)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=g:Select(tp,1,1,nil):GetFirst()
if tc:IsLocation(LOCATION_HAND) then
e:SetLabel(1)
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
if tc:IsLocation(LOCATION_DECK) and c:IsLocation(LOCATION_HAND) then
e:SetLabel(2)
e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
if tc:IsLocation(LOCATION_DECK) and c:IsLocation(LOCATION_GRAVE) then
e:SetLabel(3)
e:SetCategory(CATEGORY_TODECK)
Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,0,0)
end
Duel.SendtoGrave(tc,REASON_COST)
end
function c25451383.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local label=e:GetLabel()
if label==1 then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
if label==2 then
if Duel.SendtoDeck(c,nil,SEQ_DECKBOTTOM,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_DECK) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
if label==3 then
Duel.SendtoDeck(c,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
end
end
--灰燼竜バスタード
function c41373230.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,68468459,aux.FilterBoolFunction(Card.IsAttackAbove,2500),1,true,true)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MATERIAL_CHECK)
e1:SetValue(c41373230.matcheck)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c41373230.imcon)
e2:SetOperation(c41373230.imop)
c:RegisterEffect(e2)
--to grave
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetOperation(c41373230.regop)
c:RegisterEffect(e3)
--to hand/spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(41373230,0))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_GRAVE)
e4:SetCountLimit(1,41373230)
e4:SetCondition(c41373230.thcon)
e4:SetTarget(c41373230.thtg)
e4:SetOperation(c41373230.thop)
c:RegisterEffect(e4)
end
function c41373230.matfilter(c)
return c:IsFusionType(TYPE_MONSTER) and c:GetOriginalLevel()>0
end
function c41373230.matcheck(e,c)
local g=c:GetMaterial():Filter(c41373230.matfilter,nil)
local atk=g:GetSum(Card.GetOriginalLevel)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk*100)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_DISABLE)
c:RegisterEffect(e1)
end
function c41373230.imcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c41373230.imop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c41373230.efilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
function c41373230.efilter(e,te)
return e:GetHandler()~=te:GetHandler() and te:GetActivateLocation()==LOCATION_MZONE and te:IsActiveType(TYPE_MONSTER)
and te:IsActivated() and te:GetHandler():GetSummonLocation()==LOCATION_EXTRA
end
function c41373230.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
c:RegisterFlagEffect(41373230,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function c41373230.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(41373230)>0
end
function c41373230.thfilter(c,e,tp)
if not c:IsType(TYPE_MONSTER) then return false end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c41373230.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c41373230.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,0,tp,LOCATION_DECK)
end
function c41373230.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c41373230.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
--烙印竜アルビオン
function c87746184.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,68468459,aux.FilterBoolFunction(Card.IsFusionAttribute,ATTRIBUTE_LIGHT),1,true,true)
--fusion summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(87746184,0))
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,87746184)
e1:SetCondition(c87746184.condition)
e1:SetTarget(c87746184.target)
e1:SetOperation(c87746184.activate)
c:RegisterEffect(e1)
--to grave
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetOperation(c87746184.regop)
c:RegisterEffect(e2)
--to hand/set
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(87746184,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,87746185)
e3:SetCondition(c87746184.thcon)
e3:SetTarget(c87746184.thtg)
e3:SetOperation(c87746184.thop)
c:RegisterEffect(e3)
end
function c87746184.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION) and Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0
end
function c87746184.filter1(c,e)
return c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c87746184.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsLevelBelow(8) and not c:IsCode(87746184) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c87746184.filter3(c,e)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c87746184.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c87746184.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c87746184.filter3,tp,LOCATION_GRAVE,0,nil,e)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(c87746184.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c87746184.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE)
end
function c87746184.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
if Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)~=0 then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(c87746184.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c87746184.filter3,tp,LOCATION_GRAVE,0,nil,e)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(c87746184.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c87746184.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c87746184.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
c:RegisterFlagEffect(87746184,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function c87746184.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(87746184)>0
end
function c87746184.thfilter(c)
if not c:IsType(TYPE_SPELL+TYPE_TRAP) then return false end
return c:IsAbleToHand() or c:IsSSetable()
end
function c87746184.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c87746184.thfilter,tp,LOCATION_DECK,0,1,nil) end
end
function c87746184.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c87746184.thfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not tc:IsSSetable() or Duel.SelectOption(tp,1190,1153)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SSet(tp,tc)
end
end
end
--村规决斗:次元暗面
--怪兽的原本攻防变为卡片密码末位*500
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e1:SetOperation(function(e)
local g=Duel.GetMatchingGroup(Card.IsType,0,0xff,0xff,nil,TYPE_MONSTER)
local card=g:GetFirst()
while card do
--base attack
local e1=Effect.CreateEffect(card)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_REPEAT+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(0xff)
e1:SetValue(card:GetOriginalCode() % 10 * 500)
card:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
card:RegisterEffect(e2)
card=g:GetNext()
end
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:超速大师
--大师规则5的超速规则。
RushDuel={}
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e1:SetOperation(function(e)
--Draw 1 For First Hand
if not Auxiliary.Load2PickRule then
Duel.Draw(0,1,REASON_RULE)
end
--Legend Card
local g=Duel.GetMatchingGroup(Card.IsCode,0,0xff,0xff,nil,120000000)
local legend=g:GetFirst()
while legend do
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ADD_CODE)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(0xff)
e1:SetValue(legend:GetOriginalCode())
legend:RegisterEffect(e1)
legend=g:GetNext()
end
e:Reset()
end)
Duel.RegisterEffect(e1,0)
--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(RushDuel.DrawCount)
Duel.RegisterEffect(e2,0)
--Hand Limit
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_HAND_LIMIT)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,1)
e3:SetValue(100)
Duel.RegisterEffect(e3,0)
--Summon Limit
local e4=Effect.GlobalEffect()
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,1)
e4:SetValue(100)
Duel.RegisterEffect(e4,0)
--Lock Zone
local e5=Effect.GlobalEffect()
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_DISABLE_FIELD)
e5:SetOperation(RushDuel.DisableZone)
-- Duel.RegisterEffect(e5,0)
--Skip M2
local e6=Effect.GlobalEffect()
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_SKIP_M2)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1,1)
Duel.RegisterEffect(e6,0)
--Trap Chain
local e7=Effect.GlobalEffect()
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e7:SetCode(EVENT_CHAINING)
e7:SetOperation(RushDuel.TrapChainLimitOperation)
Duel.RegisterEffect(e7,0)
--Once Per Turn
local e5=Effect.GlobalEffect()
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_ACTIVATE_COST)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(1,0)
e5:SetTarget(RushDuel.OncePerTurnTarget)
e5:SetCost(RushDuel.OncePerTurnCost)
e5:SetOperation(RushDuel.OncePerTurnOperation)
local e6=Effect.GlobalEffect()
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e6:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e6:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetLabelObject(e5)
Duel.RegisterEffect(e6,0)
end
function RushDuel.DrawCount(e)
local p=Duel.GetTurnPlayer()
local ct=Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
if ct>4 then return 1
else return 5-ct end
end
--Lock Zone
function RushDuel.DisableZone(e,tp)
return 0x11111111
end
--Trap Chain
function RushDuel.TrapChainLimitOperation(e,tp,eg,ep,ev,re,r,rp)
local time=re:GetCode()
if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_TRAP) then
Duel.SetChainLimit(RushDuel.chaintime)
end
end
function RushDuel.chaintime(e,rp,tp)
return not (e:IsHasType(EFFECT_TYPE_ACTIVATE) and e:IsActiveType(TYPE_TRAP))
end
--Once per turn
function RushDuel.OncePerTurnTarget(e,te,tp)
return te:GetHandler()==e:GetHandler()
end
function RushDuel.OncePerTurnCost(e,te,tp)
return e:GetHandler():GetFlagEffect(10001)==0
end
function RushDuel.OncePerTurnOperation(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(10001,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
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)
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)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE)
e1:SetDescription(aux.Stringid(41546,1))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e1:SetCondition(CUNGUI.condition)
e1:SetTarget(CUNGUI.target)
e1:SetOperation(CUNGUI.activate)
c:RegisterEffect(e1)
end
function CUNGUI.condition(e,tp)
return Duel.GetAttacker() == e:GetHandler()
end
function CUNGUI.filter(c,e,tp)
local tc = e:GetHandler()
return c:IsRace(tc:GetRace()) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.filter,tp,LOCATION_DECK,0,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function CUNGUI.activate(e,tp,eg,ep,ev,re,r,rp)
local success = false
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,CUNGUI.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then success = Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_ATTACK) end
end
end
--村规决斗:贤者之石
--所有魔法·陷阱卡发动时的效果处理改为:
--宣言1个卡名。那个卡名的怪兽从卡组外加入卡组·额外卡组。
--加入了主卡组,且这个回合第一次以此类效果将怪兽加入主卡组的场合,再从卡组选1只怪兽加入手卡。
--所有陷阱卡都可以在自己的回合从手卡发动。
--后攻多抽2张。
CUNGUI = {}
CUNGUI.turn = {}
CUNGUI.registered = {}
CUNGUI.turn[0] = 0
CUNGUI.turn[1] = 0
Register = Card.RegisterEffect
Card.RegisterEffect = function(c,e,forced)
if (e:GetType() & EFFECT_TYPE_ACTIVATE) > 0 and not CUNGUI.registered[c] then
if not e:GetDescription() then
e:SetDescription(aux.Stringid(5772618,0))
end
CUNGUI.registered[c] = true
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_TOEXTRA)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(10000)
e1:SetDescription(aux.Stringid(269012,1))
e1:SetCondition(aux.TRUE)
e1:SetCost(aux.TRUE)
e1:SetTarget(aux.TRUE)
e1:SetOperation(CUNGUI.Operation)
Register(c,e1)
end
Register(c,e,forced)
end
function CUNGUI.Condition(e)
return Duel.GetTurnPlayer() == e:GetHandler():GetControler()
end
function CUNGUI.filter(c)
return c:IsAbleToHand() and c:IsType(TYPE_MONSTER)
end
function CUNGUI.Operation(e,tp,eg,ep,ev,re,r,rp)
local card = Duel.AnnounceCard(tp,TYPE_MONSTER)
local token = Duel.CreateToken(tp,card)
Duel.SendtoDeck(token,nil,2,REASON_RULE)
if token:IsLocation(LOCATION_DECK) and CUNGUI.turn[tp]~=Duel.GetTurnCount() then
CUNGUI.turn[tp]=Duel.GetTurnCount()
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
end
\ No newline at end of file
--村规决斗:顺风飙车
--每次因通常抽卡以外抽卡的场合,那个对方从卡组抽2张。
--每次卡因抽卡以外的方式加入手卡的场合,那个原本所有者的对方(如果有多张,则取第一张的原本所有者)从卡组抽2张。
CUNGUI = {}
function Auxiliary.PreloadUds()
local Draw0 = Duel.Draw
Duel.Draw = function(tp, count, reason)
Draw0(tp, count, reason)
Draw0(1-tp, 2, reason)
end
local SendtoHand0 = Duel.SendtoHand
Duel.SendtoHand = function(tg,tp,reason)
SendtoHand0(tg,tp,reason)
if tp==nil then
if Auxiliary.GetValueType(tg) == "Card" then
tp = tg:GetOwner()
else
tp = tg:GetFirst():GetOwner()
end
end
Duel.Draw(1-tp,2)
end
end
--村规决斗:你忍一下
--所有怪兽得到以下效果:
--这张卡的攻击力变成原本的1/100(向上取整)。
--直接攻击成功时,对方失去这张卡原本攻击力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,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
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(math.floor(c:GetBaseAttack() / 100.0 + 0.5))
c:RegisterEffect(e1)
--attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENSE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(math.floor(c:GetBaseDefense() / 100.0 + 0.5))
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(56052205,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetCondition(CUNGUI.condition)
e2:SetOperation(CUNGUI.operation)
c:RegisterEffect(e2)
end
function CUNGUI.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x12) and not c:IsCode(56052205)
end
function CUNGUI.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and Duel.GetAttackTarget()==nil and e:GetHandler():GetBaseAttack()>0
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local lp = Duel.GetLP(1-tp) - e:GetHandler():GetBaseAttack() * 2
if lp < 0 then lp = 0 end
Duel.SetLP(1-tp, lp)
end
--村规决斗:断绝不死
--送去墓地的卡直接消失。
--被除外的卡直接消失。
-->ygopro客户端引擎不支持,废弃
CUNGUI = {}
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)
local g = Duel.GetMatchingGroup(nil,0,LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_GRAVE+LOCATION_REMOVED,nil)
Duel.Exile(g,REASON_RULE)
end)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:人海战术
--所有(非衍生物)怪兽得到以下效果:
--这张卡召唤·特殊召唤成功时发动。
--宣言1个数字(1-12),从卡组外在自己场上将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_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)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(645087,1))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(CUNGUI.tkop)
c:RegisterEffect(e1)
local e2 = e1:Clone()
e2:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e2)
end
function CUNGUI.tkop(e,tp,eg,ep,ev,re,r,rp)
local lv = Duel.AnnounceLevel(tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,73915052,nil,TYPES_TOKEN_MONSTER,0,0,lv,RACE_BEAST,ATTRIBUTE_EARTH) then return end
local token=Duel.CreateToken(tp,32274490)
if not Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) then return end
local e1=Effect.CreateEffect(token)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(lv)
token:RegisterEffect(e1)
local e2=Effect.CreateEffect(token)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(1)
token:RegisterEffect(e2)
local e3=Effect.CreateEffect(token)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SET_DEFENSE_FINAL)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(0)
token:RegisterEffect(e3)
local e4=Effect.CreateEffect(token)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CHANGE_CODE)
e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(e:GetHandler():GetCode())
token:RegisterEffect(e4)
local e5=Effect.CreateEffect(token)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CHANGE_RACE)
e5:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e5:SetValue(e:GetHandler():GetRace())
token:RegisterEffect(e5)
local e6=Effect.CreateEffect(token)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e6:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetValue(e:GetHandler():GetAttribute())
token:RegisterEffect(e6)
Duel.SpecialSummonComplete()
end
\ No newline at end of file
--村规决斗:大联合军
--双方场上的怪兽攻防上升各自场上那个种族的怪兽数量*200。
--这个基数每回合都会上升200点。
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)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
Duel.RegisterEffect(e2,0)
end
function CUNGUI.filter(c,race)
return c:IsFaceup() and c:IsRace(race)
end
function CUNGUI.val(e,c)
return Duel.GetMatchingGroupCount(CUNGUI.filter,c:GetControler(),LOCATION_MZONE,0,nil,c:GetRace())
* 200 * Duel.GetTurnCount()
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(nil,0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_HAND,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 e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCondition(CUNGUI.spcon)
c:RegisterEffect(e1)
end
function CUNGUI.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
\ No newline at end of file
--村规决斗:不关你事
--所有(入连锁的)效果得到以下追加文本:
--自己在这场决斗中是后攻,且这个效果的发动是自己整场决斗中第一次把效果发动的场合,
--这个效果的发动和效果不能被无效化,对方不能针对这个效果的发动把魔法·陷阱·怪兽的效果发动。
CUNGUI = {}
CUNGUI.Registered = Group.CreateGroup()
CUNGUI.PropertySaver = {}
local OrigClone = Effect.Clone
local OrigRegisterEffect = Card.RegisterEffect
Card.RegisterEffect = function(c,e)
local target = e:GetTarget()
local typ = e:GetType()
if typ and (typ & 0x7d0)>0 then
e:SetTarget(CUNGUI.GetNewTarget(target))
end
OrigRegisterEffect(c,e)
end
function CUNGUI.GetNewTarget(target)
return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then
if not target then return true end
return target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
if CUNGUI.PropertySaver[e] then
e:SetProperty(CUNGUI.PropertySaver[e])
CUNGUI.PropertySaver[e]=false
end
if tp~=0 and not CUNGUI.used and e:IsHasType(0x7d0) then
CUNGUI.used=true
if not CUNGUI.PropertySaver[e] then CUNGUI.PropertySaver[e]=e:GetProperty() end
local prop=CUNGUI.PropertySaver[e]
prop = prop | 0x2000600
e:SetProperty(prop)
Duel.SetChainLimit(CUNGUI.climit)
end
if not target then return true end
return target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
end
function CUNGUI.climit(e,ep,tp)
return tp==ep
end
\ No newline at end of file
--村规决斗:强力赠礼
--所有怪兽得到以下效果:
--这张卡可以把对方场上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: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)
if not CUNGUI.drawed then
CUNGUI.drawed = true
Duel.Draw(0,1,REASON_RULE)
end
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
CUNGUI.RegisteredMonsters:AddCard(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
e1:SetRange(LOCATION_HAND)
e1:SetTargetRange(POS_FACEUP,1)
e1:SetCondition(CUNGUI.spcon)
e1:SetOperation(CUNGUI.spop)
c:RegisterEffect(e1)
end
function CUNGUI.spfilter(c,tp)
return c:IsReleasable() and Duel.GetMZoneCount(1-tp,c,tp)>0
end
function CUNGUI.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.IsExistingMatchingCard(CUNGUI.spfilter,tp,0,LOCATION_MZONE,1,nil,tp)
end
function CUNGUI.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,CUNGUI.spfilter,tp,0,LOCATION_MZONE,1,1,nil,tp)
Duel.Release(g,REASON_COST)
Duel.Draw(0,1,REASON_COST)
Duel.Draw(1,1,REASON_COST)
end
\ No newline at end of file
--村规决斗:三生三世
--双方没有手卡限制。
--作为通常抽卡的代替:
--回合玩家将手卡送去墓地
--那些卡以外的墓地的卡返回卡组
--那些回到卡组的卡以外的卡组的卡加入手卡
CUNGUI = {}
function Auxiliary.PreloadUds()
--search
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PREDRAW)
e2:SetCondition(CUNGUI.ReplaceDrawCond)
e2:SetTarget(CUNGUI.ReplaceDrawTarg)
e2:SetOperation(CUNGUI.ReplaceDrawOp)
Duel.RegisterEffect(e2,0)
--search
e2=e2:Clone()
Duel.RegisterEffect(e2,1)
--Hand Limit
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_HAND_LIMIT)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,1)
e3:SetValue(100)
Duel.RegisterEffect(e3,0)
end
function CUNGUI.ReplaceDrawCond(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and Duel.GetDrawCount(tp)>0
end
function CUNGUI.ReplaceDrawTarg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
aux.DrawReplaceCount=0
aux.DrawReplaceMax=dt
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_DRAW)
e1:SetValue(0)
Duel.RegisterEffect(e1,tp)
end
end
function CUNGUI.ReplaceDrawOp(e,tp,eg,ep,ev,re,r,rp)
aux.DrawReplaceCount=aux.DrawReplaceCount+1
if aux.DrawReplaceCount>aux.DrawReplaceMax then return end
local deck=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
local hand=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
local grave=Duel.GetFieldGroup(tp,LOCATION_GRAVE,0)
if #deck > 0 then Duel.SendtoHand(deck, nil, REASON_RULE) end
if #hand > 0 then Duel.SendtoGrave(hand, REASON_RULE) end
if #grave > 0 then Duel.SendtoDeck(grave, nil, 2,REASON_RULE) end
end
--村规决斗:虹色重启
--所有陷阱卡得到以下效果:
--这张卡也能支付一半基本分,抽2张卡并从手卡发动。
--细则:类似【红色重启】的卡仍要支付这个基本分。
--结局相当于支付3/4的基本分发动。
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.Registered = Group.CreateGroup()
CUNGUI.CostSaver = {}
local OrigClone = Effect.Clone
local OrigRegisterEffect = Card.RegisterEffect
Card.RegisterEffect = function(c,e)
local cost = e:GetCost()
local typ = e:GetType()
if typ and (typ & EFFECT_TYPE_ACTIVATE)>0 then
e:SetCost(CUNGUI.cost)
CUNGUI.CostSaver[e] = cost
end
OrigRegisterEffect(c,e)
end
Effect.Clone = function(e)
local ce = OrigClone(e)
local typ = e:GetType()
if e:GetCost() == CUNGUI.cost then
ce:SetCost(CUNGUI.CostSaver[e])
end
return ce
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.GetMatchingGroup(Card.IsType,0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_HAND,nil,TYPE_TRAP)
g:ForEach(CUNGUI.RegisterSpecialEffects)
end
function CUNGUI.RegisterSpecialEffects(c)
if CUNGUI.Registered:IsContains(c) then return end
CUNGUI.Registered:AddCard(c)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
OrigRegisterEffect(c,e2)
end
function CUNGUI.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local origCost = CUNGUI.CostSaver[e]
if chk==0 then return origCost == nil or origCost(e,tp,eg,ep,ev,re,r,rp,chk) end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) and e:GetHandler():IsType(TYPE_TRAP) then
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
Duel.Draw(tp,2,REASON_COST)
end
if origCost ~= nil then return origCost(e,tp,eg,ep,ev,re,r,rp,chk) end
end
--村规决斗:二权分立
--因选择各类召唤素材、是否发动诱发效果【以外】而进行各种选择时,那个原本玩家的对方进行选择。
--细则:
--不包括替对方宣言卡名、种族等。
CUNGUI = {}
function Auxiliary.PreloadUds()
local SelectMatchingCard = Duel.SelectMatchingCard
Duel.SelectMatchingCard = function(tp,...)
return SelectMatchingCard(1-tp,...)
end
local GroupSelect = Group.Select
Group.Select = function(g,tp,...)
return GroupSelect(g,1-tp,...)
end
local GroupSelectUnselect = Group.SelectUnselect
Group.SelectUnselect = function(cg,sg,tp,...)
return GroupSelectUnselect(cg,sg,1-tp,...)
end
local GroupSelectWithSumEqual = Group.SelectWithSumEqual
Group.SelectWithSumEqual = function(g,tp,...)
return GroupSelectWithSumEqual(g,1-tp,...)
end
local GroupSelectWithSumGreater = Group.SelectWithSumGreater
Group.SelectWithSumGreater = function(g,tp,...)
return GroupSelectWithSumGreater(g,1-tp,...)
end
local SelectTarget = Duel.SelectTarget
Duel.SelectTarget = function(tp,...)
return SelectTarget(1-tp,...)
end
local SelectYesNo = Duel.SelectYesNo
Duel.SelectYesNo = function(tp,...)
return SelectYesNo(1-tp,...)
end
local SelectDisableField = Duel.SelectDisableField
Duel.SelectDisableField = function(tp,...)
return SelectDisableField(1-tp,...)
end
local SelectOption = Duel.SelectOption
Duel.SelectOption = function(tp,...)
return SelectOption(1-tp,...)
end
local SelectPosition = Duel.SelectPosition
Duel.SelectPosition = function(tp,...)
return SelectPosition(1-tp,...)
end
end
\ No newline at end of file
--村规决斗:烙印之战
--以下怪兽均不在自己场上存在时,宣言1个未因这个效果宣言过的卡名,那个卡名的卡从卡组外表侧攻击表示放置到场上。
--这个效果放置的怪兽当作正规召唤使用,不受其他卡的效果影响,不能解放,不能作为融合·同调·超量·连接召唤的素材。
--应宣言却无法宣言(即,5只龙均已用过)的场合,基本分变为0。
--【铁驱龙 迅妖龙】【黑衣龙 白界龙】【痕食龙 盗兽龙】【灰烬龙 落胤龙】【烙印龙 白界龙】
--以上龙的效果有所加强(在extra文件夹里)
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.PlayerDragonList = {}
CUNGUI.PlayerDragonList[0] = Group.CreateGroup()
CUNGUI.PlayerDragonList[1] = Group.CreateGroup()
function CUNGUI.ToGraveFilter(c)
return c:GetSequence() <= 5
end
function CUNGUI.CheckPlayer(tp)
if Duel.GetMZoneCount(tp) == 0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0) == 0 then
return
end
local g = Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,table.unpack(CUNGUI.DragonList))
if not g or #g == 0 then
if #CUNGUI.PlayerDragonList[tp]==0 then
Duel.SetLP(tp,0)
return
end
local index = 1
local afilter = {}
for i = 1,#CUNGUI.DragonList do
if CUNGUI.PlayerDragonList[tp]:IsExists(Card.IsCode,1,nil,CUNGUI.DragonList[i]) then
index = i + 1
afilter = {CUNGUI.DragonList[i],OPCODE_ISCODE}
break
end
end
for i = index,#CUNGUI.DragonList do
if CUNGUI.PlayerDragonList[tp]:IsExists(Card.IsCode,1,nil,CUNGUI.DragonList[i]) then
table.insert(afilter,CUNGUI.DragonList[i])
table.insert(afilter,OPCODE_ISCODE)
table.insert(afilter,OPCODE_OR)
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,table.unpack(afilter))
if Duel.GetMZoneCount(tp) == 0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc = Duel.SelectMatchingCard(tp,CUNGUI.ToGraveFilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
Duel.SendtoGrave(tc,REASON_RULE)
end
local cg=CUNGUI.PlayerDragonList[tp]:Filter(Card.IsCode,nil,ac)
if not cg or #cg == 0 then return end
local mc = cg:GetFirst()
if not Duel.MoveToField(mc, tp, tp, LOCATION_MZONE,POS_FACEUP_ATTACK, true) then return end
CUNGUI.PlayerDragonList[tp]:RemoveCard(mc)
CUNGUI.RegisterMonsterSpecialEffects(mc)
mc:CompleteProcedure()
end
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
if not CUNGUI.DragonList then
CUNGUI.DragonList = {1906812,25451383,34848821,41373230,87746184}
for code=1,#CUNGUI.DragonList do
CUNGUI.PlayerDragonList[0]:AddCard(Duel.CreateToken(tp,CUNGUI.DragonList[code]))
CUNGUI.PlayerDragonList[1]:AddCard(Duel.CreateToken(tp,CUNGUI.DragonList[code]))
end
end
tp = Duel.GetTurnPlayer()
CUNGUI.CheckPlayer(tp)
CUNGUI.CheckPlayer(1-tp)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
c:RegisterEffect(e3)
local e4=e1:Clone()
e4:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e4)
local e4=e1:Clone()
e4:SetCode(EFFECT_UNRELEASABLE_SUM)
c:RegisterEffect(e4)
local e5=e1:Clone()
e5:SetCode(EFFECT_UNRELEASABLE_NONSUM)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_IMMUNE_EFFECT)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e6:SetRange(LOCATION_MZONE)
e6:SetValue(CUNGUI.efilter)
c:RegisterEffect(e6)
end
function CUNGUI.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
\ No newline at end of file
--村规决斗:无限起动
--每次把卡的效果发动,发动那个效果的对方抽1张卡。
CUNGUI = {}
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e1:SetOperation(function(e)
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetOperation(CUNGUI.operation)
Duel.RegisterEffect(e2,0)
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(1-rp,1,REASON_RULE)
end
\ No newline at end of file
--村规决斗:稻草地狱
--通常魔法卡·速攻魔法卡·通常陷阱卡·反击陷阱卡发动后不送去墓地,直接盖伏。
--那些盖伏的卡当回合不能再次发动。
CUNGUI = {}
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e1:SetOperation(function(e)
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(CUNGUI.condition)
e2:SetTarget(CUNGUI.target)
e2:SetOperation(CUNGUI.operation)
Duel.RegisterEffect(e2,0)
e:Reset()
end)
local ex = e1:Clone()
ex:SetOperation(function(e)
if Duel.GetTurnCount() > 1 then
Duel.Draw(Duel.GetTurnPlayer(), 1, REASON_RULE)
e:Reset()
end
end)
Duel.RegisterEffect(e1,0)
Duel.RegisterEffect(ex,0)
end
function CUNGUI.condition(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and not re:GetHandler():IsType(TYPE_CONTINUOUS) and not re:GetHandler():IsType(TYPE_PENDULUM)
and not re:GetHandler():IsType(TYPE_FIELD)
end
function CUNGUI.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return re:GetHandler():IsCanTurnSet() end
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if rc:IsRelateToEffect(re) then
rc:CancelToGrave()
if Duel.ChangePosition(rc,POS_FACEDOWN) then
rc:SetStatus(STATUS_SET_TURN,false)
Duel.RaiseEvent(rc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
local e1=Effect.CreateEffect(rc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
rc:RegisterEffect(e1)
end
end
end
\ No newline at end of file
--村规决斗:永不卡手
--结束阶段开始时,回合玩家选手上·场上一半以下(向下取整)的卡回卡组洗切(至少1)
--那些卡返回卡组,再随机取相同数量的手上·场上的卡回卡组洗切
--然后抽与那个总数量相同数量的卡
CUNGUI = {}
CUNGUI.EndPhaseEffects = {}
function CUNGUI.B2S(b)
if b then return "TRUE" end
return "FALSE"
end
function CUNGUI.CheckGroup(g)
return g:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD)
end
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE_START+PHASE_END)
e1:SetCountLimit(1)
e1:SetOperation(CUNGUI.Operation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.Operation(e,tp,eg,ep,ev,re,r,rp)
local p = Duel.GetTurnPlayer()
local g = Duel.GetMatchingGroup(Card.IsAbleToDeck, p, LOCATION_HAND+LOCATION_ONFIELD, 0, nil)
local max = math.floor(#g / 2)
if max == 0 then return end
local g2
while not g2 do
if g:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD) then
g2 = g:SelectSubGroup(p, CUNGUI.CheckGroup, true, 1, max)
else
g2 = g:SelectSubGroup(p, aux.TRUE, true, 1, max)
end
end
g:Sub(g2)
g = g:RandomSelect(p, #g2)
g2:Merge(g)
Duel.SendtoDeck(g2, nil, 2, REASON_RULE)
Duel.ShuffleDeck(p)
Duel.Draw(p, #g2, REASON_RULE)
end
\ No newline at end of file
--村规决斗:拿钱说话
--怪兽召唤·特殊召唤时,使其上场的玩家
--选1张手卡·墓地的卡里侧表示除外
--双方每个抽卡阶段的通常抽卡的数量,
--都比上个对方回合多1张
CUNGUI = {}
function Auxiliary.PreloadUds()
--Duel Start
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(CUNGUI.Operation)
Duel.RegisterEffect(e1,0)
local ex = e1:Clone()
ex:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(ex,0)
--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.Operation(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.SelectMatchingCard(rp, nil, rp, LOCATION_HAND+LOCATION_GRAVE, 0, 1, 1, nil)
if g then
Duel.Remove(g, POS_FACEDOWN, REASON_RULE)
end
end
function CUNGUI.DrawCount(e)
return Duel.GetTurnCount()
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
--special summon
local e1=Effect.GlobalEffect()
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(CUNGUI.spop)
Duel.RegisterEffect(e1,0)
e:Reset()
end
function CUNGUI.cfilter(c)
local tp=c:GetOwner()
local rp=c:GetReasonPlayer()
return rp==1-tp and not c:IsReason(REASON_BATTLE)
end
function CUNGUI.spop(e,tp,eg,ep,ev,re,r,rp)
if not eg then return end
local g = eg:Filter(CUNGUI.cfilter,nil)
local dam0=0
local dam1=0
local tc=g:GetFirst()
while tc do
local atk=tc:GetTextAttack()
if atk<0 then atk=0 end
if tc:GetOwner() == 1 then
dam0=dam0+atk
else
dam1=dam1+atk
end
tc=eg:GetNext()
end
Duel.Damage(0,dam0,REASON_RULE)
Duel.Damage(1,dam1,REASON_RULE)
end
--村规决斗:暗影之诗
--初始基本分为20。所有【失去基本分】【改变基本分】【支付基本分】的动作,需要和改变的实际生命值按1/400处理(改变基本分向上取整,支付基本分向下取整)。
--所有【恢复生命】效果变为1/400(向上取整),所有伤害变为原来的1/400(向上取整)。
--导致基本分超过20的处理只会把基本分变为20。
--所有怪兽在出场的回合不能攻击,所有怪兽不会被战斗破坏,所有怪兽可以直接攻击。
--怪兽与怪兽战斗的场合,双方受到的战斗伤害变为0,守备力下降对方怪兽的攻击力数值。伤害计算后,守备力为0的怪兽被破坏(当作战斗破坏)。
--第4回合后,所有怪兽得到以下效果。
--这个类型的效果1回合只能使用1次。这只怪兽的攻击力/守备力提高800点,【出场的回合不能攻击】的效果当作【出场的回合不能直接攻击】使用。
--这个效果在决斗中先攻者只能使用2次,后攻者只能使用3次。
--第一回合有1费,第二回合有2费,以此类推,最多为10。自己的回合开始时回复费用。
--通常召唤次数不限。通常召唤成功时,那个攻击力与守备力之和每有1000就要支付1费。费用不足的场合,每缺少1费支付1点生命代替,且那个回合不能再把怪兽通常召唤。
--陷阱/魔法的效果发动时要支付1费。没有费用的场合,自己不能把魔法·陷阱的效果发动。
--先攻抽1张,后攻第1回合抽2张。
--手卡上限是9张。任何时刻手卡超过9张时,新加入的那些卡直接送去墓地(有多张同时加入,则直到剩下9张为止随机送去墓地)。
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.SVCosts = {}
CUNGUI.SVCosts[0]=0
CUNGUI.SVCosts[1]=0
local OrigSetLP=Duel.SetLP
local OrigRecover=Duel.Recover
local OrigCheckLPCost=Duel.CheckLPCost
local OrigPayLPCost=Duel.PayLPCost--CheckLPCost PayLPCost
--REWRITES
function CUNGUI.NewSetLP(p,lp)
lp=math.ceil(lp/400)
if lp > 20 then lp = 20 end
OrigSetLP(p,lp)
end
function CUNGUI.NewRecover(player,value,reason,...)
value=math.ceil(value/400)
if Duel.GetLP(player)+value > 20 then value = 20 - Duel.GetLP(player) end
if value == 0 then
Duel.RaiseEvent(nil,EVENT_RECOVER,nil,reason,player,player,0)
else
OrigRecover(player,value,reason,...)
end
end
function CUNGUI.NewCheckLPCost(player,cost)
cost = math.floor(cost/400)
return OrigCheckLPCost(player,cost)
end
function CUNGUI.NewPayLPCost(player,cost)
cost = math.floor(cost/400)
return OrigPayLPCost(player,cost)
end
--REWRITES END
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.RegisterMonsterRuleEffects)
g = Duel.GetMatchingGroup(Card.IsType,0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_HAND,nil,TYPE_SPELL+TYPE_TRAP)
g:ForEach(CUNGUI.RegisterSpellTrapRuleEffects)
Duel.SetLP(0,20)
Duel.SetLP(1,20)
Duel.SetLP=CUNGUI.NewSetLP
Duel.Recover=CUNGUI.NewRecover
Duel.CheckLPCost=CUNGUI.NewCheckLPCost
Duel.PayLPCost=CUNGUI.NewPayLPCost
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetValue(CUNGUI.ChangeDamage)
Duel.RegisterEffect(e1,0)
--Recover SVCost
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ADJUST)
e2:SetCountLimit(1)
e2:SetOperation(CUNGUI.RecoverSVCost)
Duel.RegisterEffect(e2,0)
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAINING)
e3:SetOperation(CUNGUI.DecreaseCostWhenUsingSpellOrTrap)
Duel.RegisterEffect(e3,0)
--cannot activate
local e4=Effect.GlobalEffect()
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EFFECT_CANNOT_ACTIVATE)
e4:SetTargetRange(1,1)
e4:SetValue(CUNGUI.LimitSpellAndTrapWhenNoCost)
Duel.RegisterEffect(e4,0)
--Remove Summon Limit
local e5=Effect.GlobalEffect()
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,1)
e5:SetValue(100)
Duel.RegisterEffect(e5,0)
local e6=Effect.GlobalEffect()
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_MSET)
e6:SetOperation(CUNGUI.MonsterUseCostMSet)
Duel.RegisterEffect(e6,0)
local e7=Effect.GlobalEffect()
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_HAND_LIMIT)
e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e7:SetTargetRange(1,1)
e7:SetValue(9)
Duel.RegisterEffect(e7,0)
local e8=Effect.GlobalEffect()
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_TO_HAND)
e8:SetOperation(CUNGUI.AdjustHand)
Duel.RegisterEffect(e8,0)
-- one more draw
local e9=Effect.GlobalEffect()
e9:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e9:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e9:SetCode(EVENT_ADJUST)
e9:SetCountLimit(1)
e9:SetOperation(function(ee)
if Duel.GetTurnCount()==1 then
Duel.Draw(0,1,REASON_RULE)
elseif Duel.GetTurnCount()==2 then
Duel.Draw(1,1,REASON_RULE)
ee:Reset()
end
end)
Duel.RegisterEffect(e9,0)
e:Reset()
end
function CUNGUI.AdjustHand(e,tp,eg,ep,ev,re,r,rp)
tp = eg:GetFirst():GetControler()
local hand = Duel.GetFieldGroup(tp,LOCATION_HAND,0)
if #hand < 10 then return end
if #hand - #eg < 10 then
if #hand - #eg < 9 then
local g2=eg:RandomSelect(tp,9-(#hand-#eg))
eg:Sub(g2)
end
else
hand:Sub(eg)
local g2=hand:RandomSelect(tp,#hand-9)
eg:Merge(g2)
end
Duel.SendtoGrave(eg,REASON_RULE+REASON_ADJUST)
end
function CUNGUI.LimitSpellAndTrapWhenNoCost(e,re,tp)
local rc=re:GetHandler()
return CUNGUI.SVCosts[rc:GetControler()]<1 and not rc:IsType(TYPE_MONSTER)
end
function CUNGUI.DecreaseCostWhenUsingSpellOrTrap(e,tp,eg,ep,ev,re,r,rp)
if re:IsActiveType(TYPE_MONSTER) then return end
local p = re:GetOwner():GetControler()
CUNGUI.SVCosts[p] = CUNGUI.SVCosts[p] - 1
Debug.Message("已支付1费以发动魔法·陷阱效果。当前费用:"..CUNGUI.SVCosts[p])
end
function CUNGUI.RecoverSVCost(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetTurnCount()
local svcost=math.ceil(tc/2)
if svcost > 10 then svcost = 10 end
CUNGUI.SVCosts[Duel.GetTurnPlayer()]=svcost
Duel.Hint(HINT_NUMBER,PLAYER_ALL,svcost)
Debug.Message("已回复费用,当前费用:"..svcost)
if tc==4 or tc==5 then
Debug.Message("回合玩家已可进化。当前进化点:"..(tc-2))
end
end
function CUNGUI.ChangeDamage(e,re,val,r,rp,rc)
return math.ceil(val/400)
end
function CUNGUI.RegisterMonsterRuleEffects(c)
--indes
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
c:RegisterEffect(e1)
--damage val
local e2=e1:Clone()
e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCondition(CUNGUI.DamageValCondition)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EVENT_BATTLED)
e3:SetRange(LOCATION_MZONE)
e3:SetOperation(CUNGUI.BattleDestroy)
c:RegisterEffect(e3)
--cannot attack
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetOperation(CUNGUI.AttackLimit)
c:RegisterEffect(e4)
local ex4=e4:Clone()
ex4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(ex4)
--evolution
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(18563744,0))
e5:SetCategory(CATEGORY_ATKCHANGE)
e5:SetProperty(EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1,98765432)
e5:SetTarget(CUNGUI.EvolutionTarget)
e5:SetOperation(CUNGUI.Evolution)
c:RegisterEffect(e5)
--use cost
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e6:SetProperty(EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e6:SetCode(EVENT_SUMMON_SUCCESS)
e6:SetOperation(CUNGUI.MonsterUseCost)
c:RegisterEffect(e6)
--sum limit
local e7=Effect.CreateEffect(c)
e7:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_CANNOT_SUMMON)
e7:SetCondition(CUNGUI.SummonLimit)
c:RegisterEffect(e7)
local ex7=e7:Clone()
ex7:SetCode(EFFECT_CANNOT_MSET)
c:RegisterEffect(ex7)
--direct attack
local e8=Effect.CreateEffect(c)
e8:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e8:SetType(EFFECT_TYPE_SINGLE)
e8:SetCode(EFFECT_DIRECT_ATTACK)
c:RegisterEffect(e8)
end
function CUNGUI.RegisterSpellTrapRuleEffects(c)
end
function CUNGUI.SummonLimit(e)
return CUNGUI.SVCosts[e:GetHandler():GetControler()]<1
end
function CUNGUI.MonsterUseCost(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local atk=c:GetTextAttack()
if atk < 0 then atk = 0 end
local def=c:GetTextDefense()
if def < 0 then def = 0 end
local needCost = math.floor((atk+def)/1000)
if CUNGUI.SVCosts[rp]>=needCost then
CUNGUI.SVCosts[rp] = CUNGUI.SVCosts[rp] - needCost
Debug.Message("已支付"..needCost.."费以召唤怪兽。当前费用:"..CUNGUI.SVCosts[rp])
else
needCost = needCost - CUNGUI.SVCosts[rp]
if needCost > Duel.GetLP(rp) then needCost = Duel.GetLP(rp) end
CUNGUI.SVCosts[rp] = 0
OrigPayLPCost(rp,needCost)
Debug.Message("已支付全部剩余费用与"..needCost.."点基本分以召唤怪兽。")
end
end
function CUNGUI.MonsterUseCostMSet(e,tp,eg,ep,ev,re,r,rp)
if not eg or #eg==0 then return end
local c=eg:GetFirst()
local atk=c:GetTextAttack()
if atk < 0 then atk = 0 end
local def=c:GetTextDefense()
if def < 0 then def = 0 end
local needCost = math.floor((atk+def)/1000)
if CUNGUI.SVCosts[rp]>=needCost then
CUNGUI.SVCosts[rp] = CUNGUI.SVCosts[rp] - needCost
Debug.Message("已支付"..needCost.."费以覆盖怪兽。当前费用:"..CUNGUI.SVCosts[rp])
else
needCost = needCost - CUNGUI.SVCosts[rp]
if needCost > Duel.GetLP(rp) then needCost = Duel.GetLP(rp) end
CUNGUI.SVCosts[rp] = 0
OrigPayLPCost(rp,needCost)
Debug.Message("已支付全部剩余费用与"..needCost.."点基本分以召唤怪兽。")
end
end
CUNGUI.SVEvolutionPoints = {}
CUNGUI.SVEvolutionPoints[0]=2
CUNGUI.SVEvolutionPoints[1]=3
function CUNGUI.EvolutionTarget(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(98765432)==0
and Duel.GetTurnCount()>3
and CUNGUI.SVEvolutionPoints[tp]>0 end
Duel.SetChainLimit(aux.FALSE)
end
function CUNGUI.Evolution(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
c:RegisterFlagEffect(98765432,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,0,1)
CUNGUI.SVEvolutionPoints[tp] = CUNGUI.SVEvolutionPoints[tp] - 1
CUNGUI.AddAttack(c,800)
CUNGUI.AddDefense(c,800)
if CUNGUI.AttackLimitEffects[c] and CUNGUI.AttackLimitEffects[c]:GetLabel()==Duel.GetTurnCount() then
CUNGUI.AttackLimitEffects[c]:Reset()
CUNGUI.AttackLimitEffects[c]=false
--cannot direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
Debug.Message("已进行进化。当前进化点:"..CUNGUI.SVEvolutionPoints[tp])
end
CUNGUI.AttackLimitEffects={}
function CUNGUI.AttackLimit(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetLabel(Duel.GetTurnCount())
c:RegisterEffect(e1)
CUNGUI.AttackLimitEffects[c]=e1
end
function CUNGUI.DamageValCondition(e)
return e:GetHandler():GetBattleTarget()~=nil
end
function CUNGUI.AddDefense(c,num)
if num==0 then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_DEFENSE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(num)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
function CUNGUI.AddAttack(c,num)
if num==0 then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(num)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
function CUNGUI.BattleDestroy(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local d=c:GetBattleTarget()
if d and Duel.GetAttacker()~=c then return end
if d then
CUNGUI.AddDefense(c,-d:GetAttack())
CUNGUI.AddDefense(d,-c:GetAttack())
end
if d and c:GetDefense()<1 then
Duel.Destroy(c,REASON_BATTLE+REASON_RULE)
end
if d and d:GetDefense()<1 then
Duel.Destroy(d,REASON_BATTLE+REASON_RULE)
end
end
--村规决斗:汉诺之塔
--所有起动效果变为2速。
--T2多抽1张。
local OrigSetType = Effect.SetType
function Auxiliary.PreloadUds()
Effect.SetType = function(e,typ)
if typ==EFFECT_TYPE_IGNITION then typ=EFFECT_TYPE_QUICK_O end
OrigSetType(e,typ)
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
\ No newline at end of file
--村规决斗:犹豫败北
--每个回合不再限制总时间,但每一步行动都只有10秒钟的时间。
CUNGUI = {}
function Auxiliary.PreloadUds()
CUNGUI.AnnouceCardOrig = Duel.AnnounceCard
Duel.AnnounceCard = function(player,...)
local time = 10
if Duel.GetTurnCount() < 3 then time = 20 end
Duel.ResetTimeLimit(player,30)
CUNGUI.AnnouceCardOrig(player,...)
Duel.ResetTimeLimit(player,time)
end
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetOperation(function(e)
local time = 10
if Duel.GetTurnCount() < 3 then time = 20 end
for p=0,1 do
Duel.ResetTimeLimit(p,time)
end
end)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:众生平等
--所有怪兽都可以不用解放作通常召唤。
--所有怪兽都可以从手卡特殊召唤。
--以上2种方式的通常召唤与特殊召唤,每个玩家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(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.GetMatchingGroup(Card.IsType,0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_HAND,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterSummonCondition)
e:Reset()
end
function CUNGUI.RegisterSummonCondition(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(32446630,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,23456789)
c:RegisterEffect(e1,true)
--summon & set with no tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(78651105,0))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCondition(CUNGUI.ntcon)
e2:SetCountLimit(1,23456789)
c:RegisterEffect(e2,true)
local e3=e2:Clone()
e3:SetCode(EFFECT_SET_PROC)
c:RegisterEffect(e3,true)
end
function CUNGUI.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and c:IsLevelAbove(5) and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
--村规决斗:寄生宝札
--怪兽被战斗破坏的场合,双方从卡组抽1张。
CUNGUI = {}
function Auxiliary.PreloadUds()
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(e)
local e3=Effect.GlobalEffect()
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BATTLE_DESTROYED)
e3:SetOperation(CUNGUI.drop)
Duel.RegisterEffect(e3,0)
e:Reset()
end
function CUNGUI.drop(e,tp,eg,ep,ev,re,r,rp)
local tp = Duel.GetTurnPlayer()
Duel.Draw(tp,1,REASON_RULE)
Duel.Draw(1-tp,1,REASON_RULE)
end
--村规决斗:影流之主
--所有怪兽得到以下效果:
--(仅通常怪兽)这张卡也当作效果怪兽使用。
--这张卡只要在场上存在,就尽可能地占据3个格子。
--这张卡在1个战斗阶段可以攻击3次。
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)
if c:IsType(TYPE_NORMAL) then
--Normal monster
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_ADD_TYPE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(TYPE_EFFECT)
c:RegisterEffect(e1)
end
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_USE_EXTRA_MZONE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(2)
c:RegisterEffect(e3)
--triple attack
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EXTRA_ATTACK)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(2)
c:RegisterEffect(e4)
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
CUNGUI = {}
function CUNGUI.IsCard(c)
return Auxiliary.GetValueType(c) == "Card"
end
OrigPayLPCost = Duel.CheckLPCost
Duel.CheckLPCost = function(tp,cost)
return true
end
OrigPayLPCost = Duel.PayLPCost
Duel.PayLPCost = function(player,cost)
Duel.Recover(player,cost,REASON_COST)
end
OrigIsAbleToDeckAsCost = Card.IsAbleToDeckAsCost
Card.IsAbleToDeckAsCost = function(c)
local tc = Duel.GetFieldGroup(c:GetControler(),LOCATION_DECK,0):GetFirst()
if c:IsLocation(LOCATION_GRAVE) then return tc and OrigIsAbleToGraveAsCost(tc) end
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_HAND) then return Duel.IsPlayerCanDraw(c:GetControler(),1) end
if c:IsLocation(LOCATION_REMOVED) then
return tc and OrigIsAbleToRemoveAsCost(tc)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
return tc and tc:IsCanBeXyzMaterial(oc)
end
return false
end
function CUNGUI.SendtoDeckOperation(c,reason)
local tp = c:GetControler()
local tc = Duel.GetFieldGroup(tp,LOCATION_DECK,0):GetFirst()
if c:IsLocation(LOCATION_GRAVE) then return OrigSendtoGrave(tc,reason) end
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_HAND) then return Duel.Draw(tp,1,reason) end
if c:IsLocation(LOCATION_REMOVED) then return OrigRemove(tc,c:GetPosition(),reason) end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
Duel.Overlay(oc,tc)
end
end
OrigSendtoDeck = Duel.SendtoDeck
Duel.SendtoDeck = function(tg,tp,seq,reason)
if not (reason & REASON_COST)>0 then return OrigSendtoDeck(tg,tp,seq,reason) end
if CUNGUI.IsCard(tg) then tg = Group.FromCards(tg) end
for c in aux.Next(tg) do
CUNGUI.SendtoDeckOperation(c,reason)
end
end
OrigIsDiscardable = Card.IsDiscardable
Card.IsDiscardable = function(card,reason)
if not reason then reason = REASON_COST end
if (reason & REASON_COST)==0 then return OrigIsDiscardable(card,reason) end
local tp = card:GetControler()
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
return Duel.IsExistingMatchingCard(Card.IsAbleToHandAsCost,tp,loc,0,1,nil)
end
OrigDiscardHand = Duel.DiscardHand
Duel.DiscardHand = function(tp,f,min,max,reason,ex,...)
if not reason then reason = REASON_COST end
if (reason & REASON_COST)==0 then return OrigDiscardHand(tp,f,min,max,reason,ex,...) end
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
local g = Duel.SelectMatchingCard(tp,Card.IsAbleToHandAsCost,tp,loc,0,min,max,ex,...)
if not g or #g == 0 then return end
return OrigSendtoHand(g,nil,reason)
end
OrigIsPlayerCanDiscardDeckAsCost = Duel.IsPlayerCanDiscardDeckAsCost
Duel.IsPlayerCanDiscardDeckAsCost = function(tp,count)
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
local g=Duel.GetMatchingGroup(nil,tp,loc,0,nil)
local g2=Group.CreateGroup()
local tc = g:GetFirst()
count = count - 1
while count > 0 do
g2:AddCard(tc)
tc=g:GetNext()
count = count - 1
end
local g3=g2:Filter(OrigIsAbleToDeckAsCost,nil)
return #g3 == count
end
OrigDiscardDeck = Duel.DiscardDeck
Duel.DiscardDeck = function(tp,count,reason)
if not (reason & REASON_COST) == 0 then return OrigDiscardDeck(tp,count,reason) end
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
local g=Duel.GetMatchingGroup(nil,tp,loc,0,nil)
local g2=Group.CreateGroup()
local tc = g:GetFirst()
count = count - 1
while count > 0 do
g2:AddCard(tc)
tc=g:GetNext()
count = count - 1
end
local g3=g2:Filter(OrigIsAbleToDeckAsCost,nil)
return OrigSendtoDeck(g3,nil,0,reason)
end
OrigIsAbleToRemoveAsCost = Card.IsAbleToRemoveAsCost
Card.IsAbleToRemoveAsCost = function(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_REMOVED,0)
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_DECK) then
return tg:IsExists(OrigIsAbleToDeckAsCost,1,nil)
end
if c:IsLocation(LOCATION_EXTRA) then
return tg:IsExists(OrigIsAbleToExtraAsCost,1,nil)
end
if c:IsLocation(LOCATION_HAND) then
return tg:IsExists(OrigIsAbleToHandAsCost,1,nil)
end
if c:IsLocation(LOCATION_GRAVE) then
return tg:IsExists(OrigIsAbleToGraveAsCost,1,nil)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
return tg:IsExists(Card.IsCanBeXyzMaterial,1,nil,oc)
end
return false
end
function CUNGUI.RemoveOperations(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_REMOVED,0)
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_DECK) then
local g2 = tg:Filter(OrigIsAbleToDeckAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,CUNGUI.RemoveOperationReason)
end
if c:IsLocation(LOCATION_EXTRA) then
local g2 = tg:Filter(OrigIsAbleToExtraAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,CUNGUI.RemoveOperationReason)
end
if c:IsLocation(LOCATION_HAND) then
local g2 = tg:Filter(OrigIsAbleToHandAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoHand(g2,nil,CUNGUI.RemoveOperationReason)
end
if c:IsLocation(LOCATION_GRAVE) then
local g2 = tg:Filter(OrigIsAbleToGraveAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoGrave(g2,CUNGUI.RemoveOperationReason)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
local g2 = tg:Filter(Card.IsCanBeXyzMaterial,nil,oc)
g2 = tg:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
Duel.Overlay(oc,g2)
end
end
OrigRemove = Duel.Remove
Duel.Remove = function(tg,pos,reason)
if (reason & REASON_COST) == 0 then return OrigRemove(tg,pos,reason) end
if CUNGUI.IsCard(tg) then tg=Group.FromCards(tg) end
CUNGUI.OperationedCards = 0
CUNGUI.RemoveOperationReason = reason
for c in aux.Next(tg) do
CUNGUI.RemoveOperations(c)
end
return CUNGUI.OperationedCards
end
OrigIsAbleToGraveAsCost = Card.IsAbleToGraveAsCost
Card.IsAbleToGraveAsCost = function(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_GRAVE,0)
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_DECK) then
return tg:IsExists(OrigIsAbleToDeckAsCost,1,nil)
end
if c:IsLocation(LOCATION_EXTRA) then
return tg:IsExists(OrigIsAbleToExtraAsCost,1,nil)
end
if c:IsLocation(LOCATION_HAND) then
return tg:IsExists(OrigIsAbleToHandAsCost,1,nil)
end
if c:IsLocation(LOCATION_REMOVED) then
return tg:IsExists(OrigIsAbleToRemoveAsCost,1,nil)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
return tg:IsExists(Card.IsCanBeXyzMaterial,1,nil,oc)
end
return false
end
function CUNGUI.SendtoGraveOperations(c,reason)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_GRAVE,0)
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_DECK) then
local g2 = tg:Filter(OrigIsAbleToDeckAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,reason)
end
if c:IsLocation(LOCATION_EXTRA) then
local g2 = tg:Filter(OrigIsAbleToExtraAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,reason)
end
if c:IsLocation(LOCATION_HAND) then
local g2 = tg:Filter(OrigIsAbleToHandAsCost,nil)
Duel.DisableActionCheck(true)
g2 = g2:Select(tp,1,1,nil)
Duel.DisableActionCheck(false)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoHand(g2,nil,reason)
end
if c:IsLocation(LOCATION_REMOVED) then
local g2 = tg:Filter(OrigIsAbleToRemoveAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigRemove(g2,c:GetPosition(),reason)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
local g2 = tg:Filter(Card.IsCanBeXyzMaterial,nil,oc)
g2 = tg:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
Duel.Overlay(oc,g2)
end
end
OrigSendtoGrave = Duel.SendtoGrave
Duel.SendtoGrave = function(tg,reason)
if (reason & REASON_COST) == 0 then return OrigSendtoGrave(tg,reason) end
if CUNGUI.IsCard(tg) then tg = Group.FromCards(tg) end
CUNGUI.OperationedCards = 0
for c in aux.Next(tg) do
CUNGUI.SendtoGraveOperations(c,reason)
end
return CUNGUI.OperationedCards
end
OrigIsAbleToHandAsCost = Card.IsAbleToHandAsCost
Card.IsAbleToHandAsCost = function(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_HAND,0)
if c:IsLocation(LOCATION_ONFIELD+LOCATION_EXTRA) then return false end
if c:IsLocation(LOCATION_DECK) then
return tg:IsExists(OrigIsAbleToDeckAsCost,1,nil)
end
if c:IsLocation(LOCATION_GRAVE) then
return tg:IsExists(OrigIsAbleToGraveAsCost,1,nil)
end
if c:IsLocation(LOCATION_REMOVED) then
return tg:IsExists(OrigIsAbleToRemoveAsCost,1,nil)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
return tg:IsExists(Card.IsCanBeXyzMaterial,1,nil,oc)
end
return false
end
function CUNGUI.SendtoHandOperations(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_HAND,0)
if c:IsLocation(LOCATION_ONFIELD+LOCATION_EXTRA) then return false end
if c:IsLocation(LOCATION_DECK) then
local g2 = tg:Filter(OrigIsAbleToDeckAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,CUNGUI.SendtoHandOperationReason)
end
if c:IsLocation(LOCATION_EXTRA) then
local g2 = tg:Filter(OrigIsAbleToExtraAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoDeck(g2,nil,2,CUNGUI.SendtoHandOperationReason)
end
if c:IsLocation(LOCATION_GRAVE) then
local g2 = tg:Filter(OrigIsAbleToGraveAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigSendtoGrave(g2,CUNGUI.RemoveOperationReason)
end
if c:IsLocation(LOCATION_REMOVED) then
local g2 = tg:Filter(OrigIsAbleToRemoveAsCost,nil)
g2 = g2:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
return OrigRemove(g2,c:GetPosition(),CUNGUI.SendtoHandOperationReason)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
local g2 = tg:Filter(Card.IsCanBeXyzMaterial,nil,oc)
g2 = tg:Select(tp,1,1,nil)
if not g2 then
return 0
end
CUNGUI.OperationedCards = CUNGUI.OperationedCards + 1
Duel.Overlay(oc,g2)
end
end
OrigSendtoHand = Duel.SendtoHand
Duel.SendtoHand = function(tg,tp,reason)
if (reason & REASON_COST) == 0 then return OrigSendtoHand(tg,tp,reason) end
if CUNGUI.IsCard(tg) then tg = Group.FromCards(tg) end
CUNGUI.SendtoHandOperationReason = reason
CUNGUI.OperationedCards = 0
for c in aux.Next(tg) do
CUNGUI.SendtoHandOperations(c)
end
return CUNGUI.OperationedCards
end
function CUNGUI.CheckRemoveOverlayCardFilter(c,tp,loc)
local g=Duel.GetMatchingGroup(Card.IsCanBeXyzMaterial,tp,loc,0,nil,c)
Group.Merge(g,CUNGUI.DuelRemoveOverlayCardTargets)
return #g>0
end
OrigCheckRemoveOverlayCard = Duel.CheckRemoveOverlayCard
Duel.CheckRemoveOverlayCard = function(c,tp,count,reason)
if (reason & REASON_COST) == 0 then return OrigCheckRemoveOverlayCard(c,tp,count,reason) end
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
CUNGUI.DuelRemoveOverlayCardTargets = Group.CreateGroup()
local tg = Duel.GetMatchingGroup(CUNGUI.CheckRemoveOverlayCardFilter,tp,loc,0,nil,tp,loc)
return #tg>0 and #CUNGUI.DuelRemoveOverlayCardTargets>=#tg
end
function CUNGUI.DuelRemoveOverlayCardFilter2(c,tc)
return tc:IsCanBeXyzMaterial(c)
end
OrigDuelRemoveOverlayCard = Duel.RemoveOverlayCard
Duel.RemoveOverlayCard = function(tp,s,o,min,max,reason)
if (reason & REASON_COST) == 0 then return OrigDuelRemoveOverlayCard(tp,s,o,min,max,reason) end
CUNGUI.DuelRemoveOverlayCardTargets = Group.CreateGroup()
local tg = Duel.GetMatchingGroup(CUNGUI.CheckRemoveOverlayCardFilter,tp,s,o,nil,tp,LOCATION_GRAVE)
local selected = 0
while #CUNGUI.DuelRemoveOverlayCardTargets > 0
and (selected < min or (selected < max and Duel.SelectYesNo(tp,aux.Stringid(71867500,0)))) do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tc = CUNGUI.DuelRemoveOverlayCardTargets:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(HINTMSG_TOZONE))
local oc = Duel.SelectMatchingCard(tp,CUNGUI.DuelRemoveOverlayCardFilter2,tp,s,o,1,1,nil,tc)
Duel.Overlay(oc,tc)
CUNGUI.DuelRemoveOverlayCardTargets:RemoveCard(tc)
end
end
OrigCardRemoveOverlayCard = Card.RemoveOverlayCard
Card.RemoveOverlayCard = function(c,tp,min,max,reason)
if (reason & REASON_COST) == 0 then return OrigCardRemoveOverlayCard(c,tp,min,max,reason) end
local loc = LOCATION_GRAVE
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_TO_GRAVE_REDIRECT) then loc = LOCATION_REMOVED end
local tg = Duel.GetMatchingGroup(Card.IsCanBeXyzMaterial,tp,loc,0,nil,c)
local selected = 0
while #tg > 0
and (selected < min or (selected < max and Duel.SelectYesNo(tp,aux.Stringid(71867500,0)))) do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local tc = tg:Select(tp,1,1,nil)
Duel.Overlay(c,tc)
CUNGUI.DuelRemoveOverlayCardTargets:RemoveCard(tc)
end
end
OrigIsAbleToExtraAsCost = Card.IsAbleToExtraAsCost
Card.IsAbleToExtraAsCost = function(c)
local tp = c:GetControler()
local tg = Duel.GetFieldGroup(tp,LOCATION_EXTRA,0)
tg = tg:Filter(Card.IsType,nil,TYPE_PENDULUM)
if c:IsLocation(LOCATION_ONFIELD) then return false end
if c:IsLocation(LOCATION_DECK) then
return tg:IsExists(OrigIsAbleToDeckAsCost,1,nil)
end
if c:IsLocation(LOCATION_HAND) then
return tg:IsExists(OrigIsAbleToHandAsCost,1,nil)
end
if c:IsLocation(LOCATION_GRAVE) then
return tg:IsExists(OrigIsAbleToGraveAsCost,1,nil)
end
if c:IsLocation(LOCATION_REMOVED) then
return tg:IsExists(OrigIsAbleToRemoveAsCost,1,nil)
end
if c:IsLocation(LOCATION_OVERLAY) then
local oc = c:GetOverlayTarget()
return tg:IsExists(Card.IsCanBeXyzMaterial,1,nil,oc)
end
return false
end
function CUNGUI.SendtoExtraPFilter(c)
return c:IsType(TYPE_PENDULUM) and c:IsFaceup()
end
OrigSendtoExtra = Duel.SendtoExtraP
Duel.SendtoExtraP = function(targets,player,reason)
if not (reason & REASON_COST)>0 then return OrigSendtoExtra(targets,player,reason) end
if CUNGUI.IsCard(targets) then targets = Group.FromCards(targets) end
local opCards = 0
local og = Group.CreateGroup()
for tc in aux.Next(targets) do
local tp = tc:GetControler()
local g = Duel.SelectMatchingCard(tp,CUNGUI.SendtoExtraPFilter,player,LOCATION_EXTRA,0,1,1,og)
if g and #g > 0 then
og:Merge(g)
if tc:IsLocation(LOCATION_DECK) then opCards = opCards + OrigSendtoDeck(g,nil,2,reason)
elseif tc:IsLocation(LOCATION_OVERLAY) then opCards = opCards + Duel.Overlay(tc:GetOverlayTarget(),g)
elseif tc:IsLocation(LOCATION_GRAVE) then opCards = opCards + OrigSendtoGrave(g,reason)
elseif tc:IsLocation(LOCATION_REMOVED) then opCards = opCards + OrigRemove(g,g:GetFirst():GetPosition(),reason)
elseif tc:IsLocation(LOCATION_HAND) then opCards = opCards + OrigSendtoHand(g,nil,reason)
end
end
end
return opCards
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(1,1,REASON_RULE)
--Duel.DisableActionCheck(true)
e:Reset()
end
--村规决斗:双生视界
--效果处理时,可以支付1000点基本分。
--那个效果处理完成后,再处理1次效果。
--细则:
--可以对任何效果发动,但处理后不一定有意义。
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 runDouble = false
if Duel.CheckLPCost(tp,1000) and Duel.SelectYesNo(tp,aux.Stringid(57496978,0)) then
Duel.PayLPCost(tp,1000)
runDouble = true
end
local result = CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
if runDouble then
Duel.BreakEffect()
result = CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
end
return result
end
--村规决斗:时点教学
--所有场合类效果变为时类效果。
--所有必发效果变为选发效果。
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_F) > 0 then
typ = typ - EFFECT_TYPE_QUICK_F
typ = typ | EFFECT_TYPE_QUICK_O
end
if (typ & EFFECT_TYPE_TRIGGER_F) > 0 then
typ = typ - EFFECT_TYPE_TRIGGER_F
typ = typ | EFFECT_TYPE_TRIGGER_O
end
e:SetType(typ)
local p = e:GetProperty()
if p and (p & EFFECT_FLAG_DELAY)>0 then
p = p - EFFECT_FLAG_DELAY
e:SetProperty(p)
end
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)
end
function CUNGUI.GetRandomNumber()
local g=Duel.GetMatchingGroup(nil,0,LOCATION_DECK+LOCATION_EXTRA,LOCATION_DECK+LOCATION_EXTRA,nil)
local offset = Duel.TossDice(0,1)
while offset == 6 do
offset = Duel.TossDice(0,1)
end
if not g or #g==0 then return offset end
return ((g:RandomSelect(0,1):GetFirst():GetCode() + offset) % 5) + 1
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
local cards = {15693423,27204311,14558127,59438930,97268402}
local add = Duel.CreateToken(tp,cards[CUNGUI.GetRandomNumber()])
if Duel.SendtoHand(add,nil,REASON_RULE)<1 then return end
local e1=Effect.CreateEffect(add)
e1:SetDescription(aux.Stringid(51196805,1))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabelObject(add)
e1:SetOperation(CUNGUI.rmop)
Duel.RegisterEffect(e1,tp)
add:RegisterFlagEffect(23456789,RESET_EVENT+RESETS_STANDARD,0,1)
end
function CUNGUI.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(23456789)>0 then
Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT)
end
end
--所有起动效果变为2速。
--游戏开始时,后攻者抽2张卡。
--每个回合开始时,非回合玩家将【灰流丽】【效果遮蒙者】【原始生命态尼比鲁】【增殖的G】【幽鬼兔】中的随机1张加入手卡。回合结束时,那张卡里侧表示除外。
CUNGUI = {}
OrigRegister = Card.RegisterEffect
Card.RegisterEffect = function(c,e,forced)
local typ = e:GetType()
if typ and (typ & EFFECT_TYPE_IGNITION)>0 then
e:SetType(EFFECT_TYPE_QUICK_O)
e:SetCode(EVENT_FREE_CHAIN)
local cat = e:GetCategory()
if cat and (cat & (CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_NEGATE))>0 then
local prop = e:GetProperty()
if not prop then prop = 0 end
prop = prop | (EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DAMAGE_STEP)
e:SetProperty(prop)
end
end
return OrigRegister(c,e,forced)
end
function Auxiliary.PreloadUds()
-- 2 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)
Auxiliary.PreloadUds2()
end
function Auxiliary.PreloadUds2()
--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
function CUNGUI.GetRandomNumber()
local g=Duel.GetMatchingGroup(nil,0,LOCATION_DECK+LOCATION_EXTRA,LOCATION_DECK+LOCATION_EXTRA,nil)
local offset = Duel.TossDice(0,1)
while offset == 6 do
offset = Duel.TossDice(0,1)
end
if not g or #g==0 then return offset end
return ((g:RandomSelect(0,1):GetFirst():GetCode() + offset) % 5) + 1
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
tp = 1-Duel.GetTurnPlayer()
local g=Group.CreateGroup()
local cards = {23434538,27204311,14558127,59438930,97268402}
local add = Duel.CreateToken(tp,cards[CUNGUI.GetRandomNumber()])
if Duel.SendtoHand(add,nil,REASON_RULE)<1 then return end
local e1=Effect.CreateEffect(add)
e1:SetDescription(aux.Stringid(51196805,1))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabelObject(add)
e1:SetOperation(CUNGUI.rmop)
Duel.RegisterEffect(e1,tp)
add:RegisterFlagEffect(23456789,RESET_EVENT+RESETS_STANDARD,0,1)
end
function CUNGUI.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(23456789)>0 then
Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT)
e:Reset()
end
end
--村规决斗:十万生肖
--所有额外卡组的怪兽(不包括从场上表侧表示送去额外卡组的灵摆怪兽)得到以下效果:
--(仅非XYZ怪兽)这张卡当作XYZ怪兽使用,阶级相当于原本等级,或LINK数*2。
--(所有卡)这张卡也能在任何怪兽上面重叠来XYZ召唤。以这个方法进行的XYZ召唤1回合只能进行最多1次。
--(所有卡)这张卡也能在种族和这张卡的原本种族相同的怪兽上面重叠来XYZ召唤。
--细则:
--原本是连接怪兽,则不能在非连接区域/非额外区域进行XYZ召唤。
--本来是连接怪兽的怪兽在场时,仍有连接区。
OrigGetType = Card.GetType
Card.GetType = function(c)
local typ = OrigGetType(c)
if OrigIsType(c,TYPE_LINK+TYPE_SYNCHRO+TYPE_FUSION) then
typ = typ | TYPE_XYZ
end
return typ
end
OrigIsType = Card.IsType
Card.IsType = function(c,typ)
if (typ & TYPE_XYZ) == 0 then return OrigIsType(c,typ) end
if OrigIsType(c,TYPE_XYZ+TYPE_LINK+TYPE_SYNCHRO+TYPE_FUSION) then return true end
return false
end
OrigGetRank = Card.GetRank
Card.GetRank = function(c)
if not c:IsType(TYPE_XYZ) then return OrigGetRank(c) end
local lv = 0
if c:IsType(TYPE_XYZ) then
lv = c:GetOriginalRank()
else
lv = c:GetOriginalLevel()
end
return math.ceil(lv / 2)
end
OrigIsRank = Card.IsRank
Card.IsRank = function(c,...)
local ranks = {...}
if not c:IsType(TYPE_XYZ) then return OrigIsRank(c,...) end
local lv = 0
if c:IsType(TYPE_XYZ) then
lv = c:GetOriginalRank()
else
lv = c:GetOriginalLevel()
end
for _,l in ipair(ranks) do
if lv == l then return true end
end
return false
end
OrigIsRankAbove = Card.IsRankAbove
Card.IsRankAbove = function(c,rank)
if not c:IsType(TYPE_LINK) then return OrigIsRankAbove(c,rank) end
return c:GetRank() >= rank
end
OrigIsRankBelow = Card.IsRankBelow
Card.IsRankBelow = function(c,rank)
if not c:IsType(TYPE_XYZ) then return OrigIsRankBelow(c,rank) end
return c:GetLink() <= rank
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_EXTRA,LOCATION_EXTRA,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return end
CUNGUI.RegisteredMonsters:AddCard(c)
if not c:IsType(TYPE_XYZ) then
--Non-link monster
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_ADD_TYPE)
e3:SetRange(LOCATION_MZONE+LOCATION_EXTRA)
e3:SetValue(TYPE_XYZ)
c:RegisterEffect(e3)
end
if not c:IsType(TYPE_EFFECT) then
--Normal monster
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e4:SetCode(EFFECT_ADD_TYPE)
e4:SetRange(LOCATION_MZONE+LOCATION_EXTRA)
e4:SetValue(TYPE_EFFECT)
c:RegisterEffect(e4)
end
aux.AddXyzProcedure(c,nil,4,5,CUNGUI.ovfilter,aux.Stringid(18678554,0),5,CUNGUI.xyzop)
--Link summon
aux.AddXyzProcedure(c,nil,2)
end
function CUNGUI.AddXyzProcedure(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(18678554,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,87654321+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(CUNGUI.XyzCondition)
e1:SetTarget(CUNGUI.XyzTarget)
e1:SetOperation(CUNGUI.XyzOperation)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCondition(CUNGUI.XyzCondition)
e2:SetTarget(CUNGUI.XyzTarget)
e2:SetCountLimit(99)
c:RegisterEffect(e2)
end
function CUNGUI.XyzCondition2(e,c,og,min,max)
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
return Duel.IsExistingMatchingCard(CUNGUI.XyzMaterial2,c:GetControler(),LOCATION_MZONE,0,1,nil,c)
end
function CUNGUI.XyzCondition(e,c,og,min,max)
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
return Duel.IsExistingMatchingCard(CUNGUI.XyzMaterial,c:GetControler(),LOCATION_MZONE,0,1,nil,c)
end
function CUNGUI.XyzMaterial(c,cc)
return c:IsFaceup() and c:IsCanBeXyzMaterial(cc)
end
function CUNGUI.XyzMaterial2(c,cc)
return c:IsFaceup() and c:IsRace(cc:GetOriginalRace()) and c:IsCanBeXyzMaterial(cc)
end
function CUNGUI.XyzTarget(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if chk==0 then return Duel.GetFlagEffect(tp,87654321)==0 end
Duel.RegisterFlagEffect(tp,87654321,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,CUNGUI.XyzMaterial,tp,LOCATION_MZONE,0,1,1,nil,c)
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else
return false
end
end
function CUNGUI.XyzTarget2(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if chk==0 then return Duel.GetFlagEffect(tp,87654321)==0 end
Duel.RegisterFlagEffect(tp,87654321,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,CUNGUI.XyzMaterial2,tp,LOCATION_MZONE,0,1,1,nil,c)
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else
return false
end
end
function CUNGUI.XyzOperation(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local sg=Group.CreateGroup()
local gg=Group.CreateGroup()
for tc in aux.Next(og) do
local sg1=tc:GetOverlayGroup()
sg1 = sg1:Filter(Card.IsCanBeXyzMaterial,nil,c)
local sg2 = tc:GetOverlayGroup()
sg2:Remove(Card.IsCanBeXyzMaterial,nil,c)
Duel.SendtoGrave(sg2,REASON_RULE)
sg:Merge(sg1)
gg:Merge(sg2)
end
Duel.SendtoGrave(gg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
Duel.Overlay(c,sg)
end
--村规决斗:正大光明
--双方始终公开手卡决斗。
--决斗开始时,双方互相确认对方的额外卡组和卡组。
--后攻多抽1张。
function Inititialize()
Duel.Draw(1,1,REASON_RULE)
Duel.ConfirmCards(0,Duel.GetFieldGroup(0,0,LOCATION_EXTRA))
Duel.ConfirmCards(1,Duel.GetFieldGroup(1,0,LOCATION_EXTRA))
Duel.ConfirmCards(0,Duel.GetFieldGroup(0,0,LOCATION_DECK))
Duel.ConfirmCards(1,Duel.GetFieldGroup(1,0,LOCATION_DECK))
Duel.ShuffleDeck(0)
Duel.ShuffleDeck(1)
Duel.ShuffleExtra(0)
Duel.ShuffleExtra(1)
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_PUBLIC)
e2:SetTargetRange(LOCATION_HAND,LOCATION_HAND)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
Duel.RegisterEffect(e2,0)
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)
Inititialize()
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:原谅之神
--所有怪兽得到以下效果:
--同类型的效果1回合只能使用1次。
--结束阶段发动。这张卡的控制权移给对方。
--细则:
--由于回合玩家有优先权,所以回合玩家在结束阶段优先发动这个效果。
--(正常来说可以有1次优先权让渡,然而貌似ygopro没有实现?)
--可以被无效化。
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)
--ntr
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(9780364,1))
e4:SetCategory(CATEGORY_CONTROL)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1,98765432)
e4:SetCondition(CUNGUI.ctcon)
e4:SetTarget(CUNGUI.cttg2)
e4:SetOperation(CUNGUI.ctop2)
c:RegisterEffect(e4)
end
function CUNGUI.cttg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function CUNGUI.ctop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.GetControl(c,1-tp)
end
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)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
c:RegisterEffect(e1)
end
function CUNGUI.cttg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function CUNGUI.ctop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.GetControl(c,1-tp)
end
end
\ No newline at end of file
--村规决斗:昨日方舟
--所有怪兽得到以下效果:
--(仅通常怪兽)这张卡也当作效果怪兽使用。
--这个类型的效果1回合能使用最多3次。
--自己主要阶段才能发动。宣言1个种族,从自己卡组上面把5张卡翻开。
--可以从那之中选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_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)
if c:IsType(TYPE_NORMAL) then
--Normal monster
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_ADD_TYPE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(TYPE_EFFECT)
c:RegisterEffect(e1)
end
--spsummon2
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(41546,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(3,98765432)
e2:SetTarget(CUNGUI.sptg2)
e2:SetOperation(CUNGUI.spop2)
c:RegisterEffect(e2)
end
function CUNGUI.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4 end
end
function CUNGUI.spfilter(c,e,tp,rc)
return c:IsRace(rc) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function CUNGUI.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<=4 then return end
local rc=Duel.AnnounceRace(tp,1,RACE_ALL)
Duel.ConfirmDecktop(tp,5)
local g=Duel.GetDecktopGroup(tp,5)
local ct=g:GetCount()
if ct>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and g:FilterCount(CUNGUI.spfilter,nil,e,tp,rc)>0
and Duel.SelectYesNo(tp,aux.Stringid(48519867,2)) then
Duel.DisableShuffleCheck()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:FilterSelect(tp,CUNGUI.spfilter,1,1,nil,e,tp,rc)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
ct=g:GetCount()-sg:GetCount()
end
if ct>0 then
Duel.SortDecktop(tp,tp,ct)
for i=1,ct do
local mg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mg:GetFirst(),1)
end
end
end
--村规决斗:公主链接
--所有额外卡组的怪兽(不包括从场上表侧表示送去额外卡组的灵摆怪兽)得到以下效果:
--(仅非连接怪兽)这张卡当作连接怪兽使用,连接数相当于等级或阶级/2(向上取整)。
--这张卡能以【怪兽2只以上】为条件作连接召唤。
--细则:
--原本不是连接怪兽,则可以在主要区域进行连接召唤。
--本来不是连接怪兽的怪兽在场时,并没有连接区。
OrigGetType = Card.GetType
Card.GetType = function(c)
local typ = OrigGetType(c)
if OrigIsType(c,TYPE_XYZ+TYPE_SYNCHRO+TYPE_FUSION) then
typ = typ | TYPE_LINK
end
return typ
end
OrigIsType = Card.IsType
Card.IsType = function(c,typ)
if (typ & TYPE_LINK) == 0 then return OrigIsType(c,typ) end
if OrigIsType(c,TYPE_XYZ+TYPE_LINK+TYPE_SYNCHRO+TYPE_FUSION) then return true end
return false
end
OrigGetLink = Card.GetLink
Card.GetLink = function(c)
if OrigIsType(TYPE_LINK) then return OrigGetLink(c) end
local lv = 0
if c:IsType(TYPE_XYZ) then
lv = c:GetOriginalRank()
else
lv = c:GetOriginalLevel()
end
return math.ceil(lv / 2)
end
OrigGetLinkMarker = Card.GetLinkMarker
Card.GetLinkMarker = function(c)
if OrigIsType(TYPE_LINK) then return OrigGetLinkMarker(c) end
local lv = 0
if c:IsType(TYPE_XYZ) then
lv = c:GetOriginalRank()
else
lv = c:GetOriginalLevel()
end
return math.ceil(lv / 2)
end
OrigIsLink = Card.IsLink
Card.IsLink = function(c,...)
local links = {...}
if not c:IsType(TYPE_LINK) then return OrigIsLink(c,...) end
local lv = 0
if c:IsType(TYPE_XYZ) then
lv = c:GetOriginalRank()
else
lv = c:GetOriginalLevel()
end
for _,l in ipair(links) do
if lv == l then return true end
end
return false
end
OrigIsLinkAbove = Card.IsLinkAbove
Card.IsLinkAbove = function(c,link)
if not c:IsType(TYPE_LINK) then return OrigIsLinkAbove(c,link) end
return c:GetLink() >= link
end
OrigIsLinkBelow = Card.IsLinkBelow
Card.IsLinkBelow = function(c,link)
if not c:IsType(TYPE_LINK) then return OrigIsLinkBelow(c,link) end
return c:GetLink() <= link
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_EXTRA,LOCATION_EXTRA,nil,TYPE_MONSTER)
g:ForEach(CUNGUI.RegisterMonsterSpecialEffects)
end
function CUNGUI.RegisterMonsterSpecialEffects(c)
if CUNGUI.RegisteredMonsters:IsContains(c) then return end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return end
CUNGUI.RegisteredMonsters:AddCard(c)
if not c:IsType(TYPE_LINK) then
--Non-link monster
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_ADD_TYPE)
e3:SetRange(LOCATION_MZONE+LOCATION_EXTRA)
e3:SetValue(TYPE_LINK)
c:RegisterEffect(e3)
end
if not c:IsType(TYPE_EFFECT) then
--Normal monster
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e4:SetCode(EFFECT_ADD_TYPE)
e4:SetRange(LOCATION_MZONE+LOCATION_EXTRA)
e4:SetValue(TYPE_EFFECT)
c:RegisterEffect(e4)
end
--Link summon
aux.AddLinkProcedure(c,nil,2)
end
\ No newline at end of file
--村规决斗:神之旋风
--效果处理时,如果发动效果的卡与发动时相比已经发生了位移
--那个效果不处理。
local OrigRegister = Card.RegisterEffect
local OrigClone = Effect.Clone
CUNGUI = {}
CUNGUI.EffectSaver={}
CUNGUI.TargetSaver={}
CUNGUI.CostSaver={}
function Auxiliary.PreloadUds()
Card.RegisterEffect = function(c,e,b)
local typ = e:GetType()
if (typ & 0x7d0)>0 and e:GetOperation()~=nil then
CUNGUI.CostSaver[e] = e:GetCost()
CUNGUI.TargetSaver[e] = e:GetTarget()
CUNGUI.EffectSaver[e] = e:GetOperation()
e:SetCost(CUNGUI.Cost)
e:SetTarget(CUNGUI.Target)
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
if CUNGUI.CostSaver[e] then ce:SetCost(CUNGUI.CostSaver[e]) end
if CUNGUI.TargetSaver[e] then ce:SetTarget(CUNGUI.TargetSaver[e]) end
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.Cost(e,tp,eg,ep,ev,re,r,rp,chk)
if not CUNGUI.CostSaver[e] then return true end
local result = CUNGUI.CostSaver[e](e,tp,eg,ep,ev,re,r,rp,chk)
if not chk==0 then e:GetHandler():CreateEffectRelation(e) end
return result
end
function CUNGUI.Target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if not CUNGUI.TargetSaver[e] then
CUNGUI.TargetSaver[e] = function()
if chkc then return false end
return true
end
end
if chkc then return CUNGUI.TargetSaver[e](e,tp,eg,ep,ev,re,r,rp,chk,chkc) end
if chk==0 then return CUNGUI.TargetSaver[e](e,tp,eg,ep,ev,re,r,rp,chk,chkc) end
e:GetHandler():CreateEffectRelation(e)
return CUNGUI.TargetSaver[e](e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function CUNGUI.Operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return nil end
local result = CUNGUI.EffectSaver[e](e,tp,eg,ep,ev,re,r,rp)
return result
end
--村规决斗:虹之生命
--双方受到的伤害变为回复。
--基本分在16000以上的玩家的基本分变为0。
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)
if Duel.GetLP(0)>= 16000 then Duel.SetLP(0,0) end
if Duel.GetLP(1)>= 16000 then Duel.SetLP(1,0) end
e:Reset()
end)
Duel.RegisterEffect(e1,0)
--damage conversion
e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_REVERSE_DAMAGE)
e1:SetTargetRange(1,1)
e1:SetValue(1)
Duel.RegisterEffect(e1,0)
end
\ No newline at end of file
--村规决斗:87326098
--所有上场的怪兽消失并变成同表示形式的【青眼白龙】。
CUNGUI = {}
function Inititialize()
local g = Duel.GetMatchingGroup(CUNGUI.gfilter,0,LOCATION_MZONE,LOCATION_MZONE,nil)
for tc in aux.Next(g) do
local pos = tc:GetPosition()
local tp = tc:GetControler()
Duel.Exile(tc,REASON_RULE)
local c = Duel.CreateToken(0,89631139)
Duel.MoveToField(c,tp,tp,LOCATION_MZONE,pos,true)
end
end
function CUNGUI.gfilter(c)
return not c:IsCode(89631139)
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)
Inititialize()
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:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAINING)
e1:SetOperation(CUNGUI.operation)
Duel.RegisterEffect(e1,0)
e:Reset()
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler():GetCode()
tp = re:GetHandler():GetControler()
local g = Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_HAND+LOCATION_DECK,0,nil,rc)
if not g or #g < 1 then return end
Duel.Destroy(g,REASON_RULE)
end
\ No newline at end of file
CUNGUI = {}
Card.EnableReviveLimit = function(card) end
Card.SetUniqueOnField = function(c,s,o,code,loc) 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:SetCountLimit(1)
e1:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnCount() > 1 then
local tp = Duel.GetTurnPlayer()
local card = Duel.CreateToken(tp,83764718)
if Duel.SendtoHand(card,nil,REASON_RULE)<1 then return end
local e1=Effect.CreateEffect(card)
e1:SetDescription(aux.Stringid(51196805,1))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabelObject(card)
e1:SetOperation(CUNGUI.rmop)
Duel.RegisterEffect(e1,tp)
end
end
function CUNGUI.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT)
e:Reset()
end
--村规决斗:凤翼天翔
--所有怪兽得到以下效果:
--自己·对方回合才能发动。对方选发动这个效果的玩家的场上1张卡,自己选场上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: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.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_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)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(1157683,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,98765432)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e2:SetTarget(CUNGUI.destg)
e2:SetOperation(CUNGUI.desop)
c:RegisterEffect(e2)
end
function CUNGUI.desfilter1(c)
return Duel.IsExistingMatchingCard(nil,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c)
end
function CUNGUI.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(CUNGUI.desfilter1,tp,LOCATION_ONFIELD,0,1,nil) end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0)
end
function CUNGUI.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectMatchingCard(1-tp,CUNGUI.desfilter1,tp,LOCATION_ONFIELD,0,1,1,nil)
if #g1==0 then return end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_DESTROY)
local g2=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1)
g1:Merge(g2)
Duel.HintSelection(g1)
Duel.Destroy(g1,REASON_EFFECT)
if Duel.SelectYesNo(1-tp,aux.Stringid(63166095,0)) then
Duel.Draw(1-tp,1,REASON_RULE)
end
end
\ No newline at end of file
--村规决斗:燃烧抽卡
--开局时,后攻者基本分增加4000点。
--所有怪兽得到以下效果:
--自己的手卡是0的场合,支付1000点基本分才能发动。自己从卡组抽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)
if not CUNGUI.INIT then
CUNGUI.INIT = true
Duel.SetLP(1,Duel.GetLP(1) + 4000)
end
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)
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(365213,1))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(CUNGUI.drcon)
e1:SetCost(CUNGUI.drcost)
e1:SetTarget(CUNGUI.drtg)
e1:SetOperation(CUNGUI.drop)
c:RegisterEffect(e1)
end
function CUNGUI.drcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0
end
function CUNGUI.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function CUNGUI.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function CUNGUI.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_SKIP_DP)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN)
Duel.RegisterEffect(e1,p)
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