Commit 2083ffbd authored by wind2009's avatar wind2009

Update rule

parent 76fc9a3c
Pipeline #41016 failed with stages
in 10 minutes and 51 seconds
OldSchool={}
--EVENT ExtraFusion
-- function Auxiliary.Load_EVENT_ExtraFusion()
-- -- elemental hero
-- local e011=Effect.GlobalEffect()
-- e011:SetType(EFFECT_TYPE_FIELD)
-- e011:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e011:SetCode(EFFECT_SPSUMMON_PROC)
-- e011:SetRange(LOCATION_EXTRA)
-- e011:SetCondition(Auxiliary.FireEH_Condition)
-- e011:SetOperation(Auxiliary.FireEH_Operation)
-- local e012=Effect.GlobalEffect()
-- e012:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e012:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e012:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e012:SetTarget(Auxiliary.IsFireEH)
-- e012:SetLabelObject(e011)
-- Duel.RegisterEffect(e012,0)
-- end
-- function Auxiliary.IsFireEH(e,c)
-- return c:IsCode(1945387)
-- end
-- function Auxiliary.FireEH_spfilter1(c,tp,fc)
-- return c:IsFusionSetCard(0x3008) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsControler(tp))
-- and c:IsCanBeFusionMaterial(fc) and Duel.IsExistingMatchingCard(Auxiliary.FireEH_spfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,tp,fc,c)
-- end
-- function Auxiliary.FireEH_spfilter2(c,tp,fc,mc)
-- local g=Group.FromCards(c,mc)
-- return c:IsFusionAttribute(ATTRIBUTE_FIRE) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsControler(tp))
-- and c:IsCanBeFusionMaterial(fc) and Duel.GetLocationCountFromEx(tp,tp,g)>0
-- end
-- function Auxiliary.FireEH_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- return Duel.IsExistingMatchingCard(Auxiliary.FireEH_spfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,c)
-- end
-- function Auxiliary.FireEH_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g1=Duel.GetMatchingGroup(Auxiliary.FireEH_spfilter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
-- local sg=g1:Select(tp,1,1,nil)
-- local g2=Duel.GetMatchingGroup(Auxiliary.FireEH_spfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,sg:GetFirst(),tp,c,sg:GetFirst())
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
-- local c2=g2:Select(tp,1,1,sg:GetFirst())
-- sg:Merge(c2)
-- Duel.SendtoGrave(sg,REASON_COST)
-- c:CompleteProcedure()
-- end
--EVENT Metamorphosis
-- function Auxiliary.Load_EVENT_Metamorphosis()
-- local e1=Effect.GlobalEffect()
-- e1:SetDescription(1127)
-- e1:SetType(EFFECT_TYPE_IGNITION)
-- e1:SetCountLimit(1,46411259+EFFECT_COUNT_CODE_OATH)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetRange(LOCATION_MZONE)
-- e1:SetCost(Auxiliary.EVENT_Metamorphosis_Cost)
-- e1:SetTarget(Auxiliary.EVENT_Metamorphosis_Target)
-- e1:SetOperation(Auxiliary.EVENT_Metamorphosis_Operation)
-- e1:SetLabel(0)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
-- e2:SetTarget(Auxiliary.EVENT_Metamorphosis_MonsterCheck)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- return
-- end
-- function Auxiliary.EVENT_Metamorphosis_MonsterCheck(e,c)
-- return c:IsType(TYPE_MONSTER)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Cost(e,tp,eg,ep,ev,re,r,rp,chk)
-- e:SetLabel(100)
-- if chk==0 then return true end
-- end
-- function Auxiliary.EVENT_Metamorphosis_Costfilter(c,e,tp)
-- return Duel.IsExistingMatchingCard(Auxiliary.EVENT_Metamorphosis_spfilter,tp,LOCATION_DECK,0,1,nil,c,e,tp)
-- end
-- function Auxiliary.EVENT_Metamorphosis_spfilter(c,tc,e,tp)
-- return c:GetOriginalAttribute()==tc:GetOriginalAttribute() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Target(e,tp,eg,ep,ev,re,r,rp,chk)
-- if chk==0 then
-- if e:GetLabel()~=100 then return false end
-- e:SetLabel(0)
-- return Duel.CheckReleaseGroup(tp,Auxiliary.EVENT_Metamorphosis_Costfilter,1,nil,e,tp)
-- end
-- e:SetLabel(0)
-- local g=Duel.SelectReleaseGroup(tp,Auxiliary.EVENT_Metamorphosis_Costfilter,1,1,nil,e,tp)
-- Duel.Release(g,REASON_COST)
-- Duel.SetTargetCard(g)
-- Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
-- Duel.SetChainLimit(aux.FALSE)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Operation(e,tp,eg,ep,ev,re,r,rp)
-- if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
-- local c=e:GetHandler()
-- local tc=Duel.GetFirstTarget()
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
-- local cg=Duel.GetMatchingGroup(Auxiliary.EVENT_Metamorphosis_spfilter,tp,LOCATION_DECK,0,nil,tc,e,tp)
-- if cg:GetCount()>0 then
-- local tg=cg:RandomSelect(1-tp,1)
-- Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)
-- end
-- end
-- --EVENT_XYYZ_Impact
-- function Auxiliary.Load_EVENT_XYYZ_Impact()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_FIELD)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetCode(EFFECT_SPSUMMON_PROC)
-- e1:SetRange(LOCATION_EXTRA)
-- e1:SetCondition(Auxiliary.XY_Condition)
-- e1:SetOperation(Auxiliary.XY_Operation)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e2:SetTarget(Auxiliary.IsXYMoster)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- local e3=Effect.GlobalEffect()
-- e3:SetType(EFFECT_TYPE_FIELD)
-- e3:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e3:SetCode(EFFECT_SPSUMMON_PROC)
-- e3:SetRange(LOCATION_EXTRA)
-- e3:SetCondition(Auxiliary.XYYZ_Condition)
-- e3:SetOperation(Auxiliary.XYYZ_Operation)
-- local e4=Effect.GlobalEffect()
-- e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e4:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e4:SetTarget(Auxiliary.IsXYYZMoster)
-- e4:SetLabelObject(e3)
-- Duel.RegisterEffect(e4,0)
-- end
-- function Auxiliary.IsXYMoster(e,c)
-- return c:IsCode(2111707) or c:IsCode(99724761) or c:IsCode(25119460)
-- end
-- function Auxiliary.IsXYYZMoster(e,c)
-- return c:IsCode(91998119)
-- end
-- function Auxiliary.XY_ffilter(c,fc,sub,mg,sg)
-- return not c:IsType(TYPE_TOKEN) and
-- (not sg or not sg:IsExists(Card.IsFusionAttribute,2,c,c:GetFusionAttribute()))
-- end
-- function Auxiliary.XY_spfilter1(c,tp,fc)
-- return not c:IsType(TYPE_TOKEN) and Duel.IsPlayerCanRelease(tp,c)
-- and c:IsCanBeFusionMaterial(fc) and Duel.IsExistingMatchingCard(Auxiliary.XY_spfilter2,tp,LOCATION_MZONE,0,1,c,tp,fc,c)
-- end
-- function Auxiliary.XY_spfilter2(c,tp,fc,mc)
-- local g=Group.FromCards(c,mc)
-- return not c:IsType(TYPE_TOKEN) and Duel.IsPlayerCanRelease(tp,c)
-- and c:IsCanBeFusionMaterial(fc) and c:IsFusionAttribute(mc:GetFusionAttribute()) and Duel.GetLocationCountFromEx(tp,tp,g)>0
-- end
-- function Auxiliary.XY_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- return Duel.IsExistingMatchingCard(Auxiliary.XY_spfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,c)
-- end
-- function Auxiliary.XY_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
-- local g1=Duel.SelectMatchingCard(tp,Auxiliary.XY_spfilter1,tp,LOCATION_MZONE,0,1,1,nil,tp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
-- local g2=Duel.SelectMatchingCard(tp,Auxiliary.XY_spfilter2,tp,LOCATION_MZONE,0,1,1,g1:GetFirst(),tp,c,g1:GetFirst())
-- g1:Merge(g2)
-- Duel.Release(g1,REASON_COST)
-- end
-- function Auxiliary.XYYZ_spcostfilter(c)
-- return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_FUSION)
-- end
-- function Auxiliary.XYYZ_spcost_selector(c,tp,g,sg,i)
-- sg:AddCard(c)
-- g:RemoveCard(c)
-- local flag=false
-- if i<2 then
-- flag=g:IsExists(Auxiliary.XYYZ_spcostfilter,1,nil,tp,g,sg,i+1)
-- else
-- flag=sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_LIGHT)>0
-- and sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_LIGHT)>0
-- end
-- sg:RemoveCard(c)
-- g:AddCard(c)
-- return flag
-- end
-- function Auxiliary.XYYZ_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- if Duel.GetLocationCountFromEx(tp)<=0 then return false end
-- local g=Duel.GetMatchingGroup(Auxiliary.XYYZ_spcostfilter,tp,LOCATION_GRAVE,0,nil)
-- local sg=Group.CreateGroup()
-- return g:IsExists(Auxiliary.XYYZ_spcost_selector,1,nil,tp,g,sg,1)
-- end
-- function Auxiliary.XYYZ_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g=Duel.GetMatchingGroup(Auxiliary.XYYZ_spcostfilter,tp,LOCATION_GRAVE,0,nil)
-- local sg=Group.CreateGroup()
-- for i=1,2 do
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g1=g:FilterSelect(tp,Auxiliary.XYYZ_spcost_selector,1,1,nil,tp,g,sg,i)
-- sg:Merge(g1)
-- g:Sub(g1)
-- end
-- Duel.Remove(sg,POS_FACEUP,REASON_COST)
-- end
-- function Auxiliary.XY_matfilter(c)
-- return c:IsAbleToRemoveAsCost() and not c:IsType(TYPE_TOKEN)
-- end
-- function Auxiliary.XY_att_filter1(c,tp)
-- return Duel.IsExistingMatchingCard(Auxiliary.XY_att_filter2,tp,0,LOCATION_MZONE,1,c,c:GetAttribute())
-- end
-- function Auxiliary.XY_att_filter2(c,att)
-- return c:IsAttribute(att) and not c:IsType(TYPE_TOKEN)
-- end
-- function Auxiliary.XY_spfilter1(c,tp,g)
-- return g:IsExists(Auxiliary.XY_spfilter2,1,c,tp,c)
-- end
-- function Auxiliary.XY_spfilter2(c,tp,mc)
-- return (c:IsFusionCode(62651957) and mc:IsFusionCode(64500000)
-- or c:IsFusionCode(64500000) and mc:IsFusionCode(62651957))
-- and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c,mc))>0
-- end
-- function Auxiliary.XY_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- local g=Duel.GetMatchingGroup(Auxiliary.XY_matfilter,tp,LOCATION_ONFIELD,0,nil)
-- return g:IsExists(c99724761.spfilter1,1,nil,tp,g)
-- end
-- function Auxiliary.XY_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g=Duel.GetMatchingGroup(c99724761.matfilter,tp,LOCATION_ONFIELD,0,nil)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g1=g:FilterSelect(tp,c99724761.spfilter1,1,1,nil,tp,g)
-- local mc=g1:GetFirst()
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g2=g:FilterSelect(tp,c99724761.spfilter2,1,1,mc,tp,mc)
-- g1:Merge(g2)
-- Duel.Remove(g1,POS_FACEUP,REASON_COST)
-- end
-- --EVENT Grandpa's Cards
-- function Auxiliary.Load_EVENT_Grandpas_Cards()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
-- e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
-- e1:SetCode(EVENT_BATTLED)
-- e1:SetTarget(Auxiliary.EVENT_Grandpas_Cards_Target)
-- e1:SetOperation(Auxiliary.EVENT_Grandpas_Cards_Operation)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
-- e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Target(e,tp,eg,ep,ev,re,r,rp)
-- local c=e:GetHandler()
-- if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
-- local bc=c:GetBattleTarget()
-- return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) and not bc:IsType(TYPE_TOKEN)
-- and bc:GetLeaveFieldDest()==0 and bit.band(bc:GetBattlePosition(),POS_FACEUP_ATTACK)~=0
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Operation(e,tp,eg,ep,ev,re,r,rp)
-- local c=e:GetHandler()
-- local bc=c:GetBattleTarget()
-- if Duel.SelectYesNo(c.GetOwner(c),94) then
-- if bc:IsRelateToBattle() then
-- local e1=Effect.CreateEffect(c)
-- e1:SetCode(EFFECT_SEND_REPLACE)
-- e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
-- e1:SetTarget(Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Target)
-- e1:SetOperation(Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Operation)
-- e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_DAMAGE)
-- bc:RegisterEffect(e1)
-- end
-- -- local code=e:GetHandler():GetCode()
-- Exodia_announce_filter={0x40,OPCODE_ISSETCARD,0,OPCODE_ISCODE,OPCODE_NOT,OPCODE_AND}
-- local ac=Duel.AnnounceCardFilter(c.GetOwner(c),table.unpack(Exodia_announce_filter))
-- local Yugi_Card=Duel.CreateToken(c.GetOwner(c),ac)
-- Duel.SendtoHand(Yugi_Card,c.GetOwner(c),0,REASON_RULE)
-- end
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Target(e,tp,eg,ep,ev,re,r,rp,chk)
-- local c=e:GetHandler()
-- if chk==0 then return c:GetDestination()==LOCATION_GRAVE and c:IsReason(REASON_BATTLE) end
-- return true
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Operation(e,tp,eg,ep,ev,re,r,rp)
-- Duel.SendtoHand(e:GetHandler(),nil,2,REASON_RULE)
-- end
--Shadoll Event
-- function Auxiliary.Load_Shadow_Rule()
-- local e1=Effect.GlobalEffect()
-- e1:SetDescription(1166)
-- e1:SetType(EFFECT_TYPE_FIELD)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetCode(EFFECT_SPSUMMON_PROC)
-- e1:SetRange(LOCATION_EXTRA)
-- e1:SetCondition(Auxiliary.LinkCondition(nil,2,2,nil))
-- e1:SetTarget(Auxiliary.LinkTarget(nil,2,2,nil))
-- e1:SetOperation(Auxiliary.LinkOperation(nil,2,2,nil))
-- e1:SetValue(SUMMON_TYPE_LINK)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e2:SetTarget(Auxiliary.IsConstruct)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- return
-- end
-- function Auxiliary.IsConstruct(e,c)
-- return c:IsCode(86938484)
-- end
--DestinyDraw Rule
-- function Auxiliary.Load_Skill_DestinyDraw_Rule()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
-- e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
-- e1:SetTargetRange(1,1)
-- e1:SetCode(PHASE_DRAW+EVENT_PHASE_START)
-- e1:SetCondition(Auxiliary.Skill_DestinyDraw_Condition)
-- e1:SetOperation(Auxiliary.Skill_DestinyDraw_Operation)
-- Duel.RegisterEffect(e1,0)
-- end
-- function Auxiliary.Skill_DestinyDraw_SearchFilter(c)
-- return c:IsAbleToHand()
-- end
-- function Auxiliary.Skill_DestinyDraw_Condition(e,tp,eg,ep,ev,re,r,rp)
-- local tp=Duel.GetTurnPlayer()
-- return (Duel.GetLP(1-tp))-(Duel.GetLP(tp))>2999
-- and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4
-- and Duel.GetDrawCount(tp)>0
-- and Duel.IsExistingMatchingCard(Auxiliary.Skill_DestinyDraw_SearchFilter,tp,LOCATION_DECK,0,1,nil)
-- end
-- function Auxiliary.Skill_DestinyDraw_Operation(e,tp,eg,ep,ev,re,r,rp)
-- local tp=Duel.GetTurnPlayer()
-- local dt=Duel.GetDrawCount(tp)
-- if dt~=0 then
-- _replace_count=0
-- _replace_max=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)
-- Duel.ConfirmDecktop(tp,5)
-- local g=Duel.GetDecktopGroup(tp,5)
-- if g:GetCount()>0 then
-- Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND)
-- local sg=g:Select(tp,1,1,nil)
-- if sg:GetFirst():IsAbleToHand() then
-- Duel.SendtoHand(sg,nil,REASON_EFFECT)
-- Duel.ConfirmCards(1-tp,sg)
-- Duel.ShuffleHand(tp)
-- else
-- Duel.SendtoGrave(sg,REASON_RULE)
-- end
-- Duel.ShuffleDeck(tp)
-- end
-- end
-- end
return OldSchool
\ No newline at end of file
ChickenGame={}
--Chicken_Game_Rule
function ChickenGame.Load_Chicken_Game_Rule()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(1,1)
e1:SetCountLimit(1)
e1:SetCode(EVENT_PHASE_START+PHASE_STANDBY)
e1:SetOperation(ChickenGame.Chicken_Game_Operation)
Duel.RegisterEffect(e1,0)
end
function ChickenGame.Chicken_Game_Operation(e,p,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EFFECT)
local hintlist=(Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0) and {aux.Stringid(64306248,0),aux.Stringid(42541548,0)} or {aux.Stringid(64306248,0)}
local op=Duel.SelectOption(tp,table.unpack(hintlist))
-- heal
if op==0 then
Duel.Recover(tp,1000,REASON_EFFECT)
-- sendback and draw
else
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoDeck(g,nil,1,REASON_EFFECT)>0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
end
return ChickenGame
\ No newline at end of file
DrawSense={}
--Skill_DrawSense_Rule
function DrawSense.Load_Skill_DrawSense_Rule()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
--e1:SetCode(PHASE_DRAW+EVENT_PHASE_START)
e1:SetCode(EVENT_PREDRAW)
e1:SetCondition(DrawSense.Skill_DrawSense_Condition)
e1:SetOperation(DrawSense.Skill_DrawSense_Operation)
Duel.RegisterEffect(e1,0)
end
function DrawSense.Skill_DrawSense_Condition(e,p,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
return (Duel.GetLP(1-tp))-(Duel.GetLP(tp))>2499
and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1
and Duel.GetDrawCount(tp)>0
and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
--and Duel.IsExistingMatchingCard(Auxiliary.Skill_DestinyDraw_SearchFilter,tp,LOCATION_DECK,0,1,nil)
end
function DrawSense.Skill_DrawSense_Operation(e,p,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
local _replace_count=0
local _replace_max=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)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local SenseType=(Duel.AnnounceType(tp))
if (SenseType==0 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_MONSTER)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_MONSTER)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
elseif (SenseType==1 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_SPELL)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_SPELL)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
elseif (SenseType==2 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_TRAP)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_TRAP)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
else
Duel.ShuffleDeck(tp)
--Duel.Draw(tp,1,REASON_RULE)
end
end
end
return DrawSense
\ No newline at end of file
......@@ -6,11 +6,11 @@ local extra={[0]={},[1]={}}
local main_nonadv={[0]={},[1]={}}
main_monster={[0]={},[1]={}}
main_spell={[0]={},[1]={}}
main_trap={[0]={},[1]={}}
local main_monster={[0]={},[1]={}}
local main_spell={[0]={},[1]={}}
local main_trap={[0]={},[1]={}}
main_plain={[0]={},[1]={}}
local main_plain={[0]={},[1]={}}
local main_adv={[0]={},[1]={}}
local main_new={[0]={},[1]={}}
......@@ -27,7 +27,9 @@ local xyz_adv={[0]={},[1]={}}
local extra_fixed={62709239,95169481}
local combo_pack=require("./2pick/combo")
local Deepthink=require("./2pick/deepthink")
local Deepthink=require("./2pick/SkillDeepThink")
--local DrawSense=require("./2pick/SkillDrawSense")
--local ChickenGame=require("./2pick/SkillChickenGame")
--local ActionDuel=require("./2pick/actionduel")
function Auxiliary.SplitData(inputstr)
......@@ -297,10 +299,53 @@ function Auxiliary.StartPick(e)
]]--
-- 50% chance reverse pick
local playerReversePick=Duel.TossCoin(p,1)
local picktype=Duel.TossDice(0,1)
if playerReversePick~=0 then
if picktype==1 then
-- main deck
Auxiliary.MainDeckPick()
-- combo pick
Auxiliary.ComboDeckPick()
-- extra deck pick
Auxiliary.ExtraDeckPick()
elseif picktype==2 then
-- main deck
Auxiliary.MainDeckPick()
-- extra deck pick
Auxiliary.ExtraDeckPick()
-- combo pick
Auxiliary.ComboDeckPick()
elseif picktype==3 then
-- extra deck pick
Auxiliary.ExtraDeckPick()
-- main deck
Auxiliary.MainDeckPick()
-- combo pick
Auxiliary.ComboDeckPick()
elseif picktype==4 then
-- extra deck pick
Auxiliary.ExtraDeckPick()
-- combo pick
Auxiliary.ComboDeckPick()
-- main deck
Auxiliary.MainDeckPick()
elseif picktype==5 then
-- combo pick
Auxiliary.ComboDeckPick()
-- main deck
Auxiliary.MainDeckPick()
-- extra deck pick
Auxiliary.ExtraDeckPick()
else
-- combo pick
Auxiliary.ComboDeckPick()
-- extra deck pick
Auxiliary.ExtraDeckPick()
-- main deck
Auxiliary.MainDeckPick()
end
--[[
for i=1,5 do
local lists={[1]=main_monster,[3]=main_spell,[4]=main_trap}
local lists_count={[1]=4,[3]=2,[4]=2}
......@@ -314,6 +359,7 @@ function Auxiliary.StartPick(e)
Auxiliary.ArbitraryPick(p,4,lists,lists_count)
end
end
-- combo pick
for t=2,0,-1 do
local reroll=t>0
......@@ -327,7 +373,7 @@ function Auxiliary.StartPick(e)
break
end
end
-- extra pick
for tp,list in pairs(extra_sp) do
if tp~=TYPE_FUSION then
for p=0,1 do
......@@ -354,14 +400,64 @@ function Auxiliary.StartPick(e)
counts={[1]=6}
Auxiliary.ArbitraryPick(p,4,lists,counts,false,false,extra_fixed)
end
else
-- extra pick
]]--
-- XXYYZZ Additional Picks
--[[
xyz_list={91998119,91998120,91998121}
for p=0,1 do
if Duel.IsPlayerNeedToPickDeck(p) then
local ng=Group.CreateGroup()
local card1=Duel.CreateToken(p,2111707)
local card2=Duel.CreateToken(p,25119460)
local card3=Duel.CreateToken(p,99724761)
local card4=Duel.CreateToken(p,xyz_list[math.random(#xyz_list)])
ng:AddCard(card1)
ng:AddCard(card2)
ng:AddCard(card3)
ng:AddCard(card4)
Duel.SendtoDeck(ng,nil,0,REASON_RULE)
end
end
]]--
Auxiliary.SaveDeck()
--ActionDuel.Load_Action_Duel()
for p=0,1 do
if Duel.IsPlayerNeedToPickDeck(p) then
Duel.ShuffleDeck(p)
Duel.ResetTimeLimit(p)
end
end
for p=0,1 do
Duel.Draw(p,Duel.GetStartCount(p),REASON_RULE)
end
e:Reset()
end
function Auxiliary.MainDeckPick()
for i=1,5 do
local lists={[1]=main_monster,[3]=main_spell,[4]=main_trap}
local lists_count={[1]=4,[3]=2,[4]=2}
if i==1 or i==2 then
lists[1]=main_plain
lists_count[1]=2
lists[2]=main_adv
lists_count[2]=2
end
for p=0,1 do
Auxiliary.ArbitraryPick(p,4,lists,lists_count)
end
end
end
function Auxiliary.ExtraDeckPick()
for tp,list in pairs(extra_sp) do
if tp~=TYPE_FUSION then
for p=0,1 do
lists ={[1]=list}
counts={[1]=8}
lv_diff=false
local lists ={[1]=list}
local counts={[1]=8}
local lv_diff=false
if tp==TYPE_XYZ then
lists[1]=xyz_plain
counts[1]=6
......@@ -378,11 +474,12 @@ function Auxiliary.StartPick(e)
end
end
for p=0,1 do
lists ={[1]=extra}
counts={[1]=6}
local lists={[1]=extra}
local counts={[1]=6}
Auxiliary.ArbitraryPick(p,4,lists,counts,false,false,extra_fixed)
end
-- combo pick
end
function Auxiliary.ComboDeckPick()
for t=2,0,-1 do
local reroll=t>0
if Auxiliary.SinglePick(0,main,0,nil,nil,false,false,nil,combo_pack.pack,reroll) then
......@@ -395,107 +492,6 @@ function Auxiliary.StartPick(e)
break
end
end
-- main deck
for i=1,5 do
local lists={[1]=main_monster,[3]=main_spell,[4]=main_trap}
local lists_count={[1]=4,[3]=2,[4]=2}
if i==1 or i==2 then
lists[1]=main_plain
lists_count[1]=2
lists[2]=main_adv
lists_count[2]=2
end
for p=0,1 do
Auxiliary.ArbitraryPick(p,4,lists,lists_count)
end
end
end
-- for i=1,5 do
-- local lists={[1]=main_monster,[3]=main_spell,[4]=main_trap}
-- local lists_count={[1]=4,[3]=2,[4]=2}
-- if i==1 or i==2 then
-- lists[1]=main_plain
-- lists_count[1]=2
-- lists[2]=main_adv
-- lists_count[2]=2
-- end
-- for p=0,1 do
-- Auxiliary.ArbitraryPick(p,4,lists,lists_count)
-- end
-- end
-- -- combo pick
-- for t=2,0,-1 do
-- local reroll=t>0
-- if Auxiliary.SinglePick(0,main,0,nil,nil,false,false,nil,combo_pack.pack,reroll) then
-- break
-- end
-- end
-- for t=1,0,-1 do
-- local reroll=t>0
-- if Auxiliary.SinglePick(1,main,0,nil,nil,false,false,nil,combo_pack.pack,reroll) then
-- break
-- end
-- end
-- for tp,list in pairs(extra_sp) do
-- if tp~=TYPE_FUSION then
-- for p=0,1 do
-- lists ={[1]=list}
-- counts={[1]=8}
-- lv_diff=false
-- if tp==TYPE_XYZ then
-- lists[1]=xyz_plain
-- counts[1]=6
-- lists[2]=xyz_adv
-- counts[2]=2
-- elseif tp==TYPE_SYNCHRO then
-- counts[1]=4
-- lists[2]=list
-- counts[2]=4
-- lv_diff=true
-- end
-- Auxiliary.ArbitraryPick(p,4,lists,counts,false,lv_diff)
-- end
-- end
-- end
-- for p=0,1 do
-- lists ={[1]=extra}
-- counts={[1]=6}
-- Auxiliary.ArbitraryPick(p,4,lists,counts,false,false,extra_fixed)
-- end
-- -- XXYYZZ Additional Picks
-- xyz_list={91998119,91998120,91998121}
-- for p=0,1 do
-- if Duel.IsPlayerNeedToPickDeck(p) then
-- local ng=Group.CreateGroup()
-- local card1=Duel.CreateToken(p,2111707)
-- local card2=Duel.CreateToken(p,25119460)
-- local card3=Duel.CreateToken(p,99724761)
-- local card4=Duel.CreateToken(p,xyz_list[math.random(#xyz_list)])
-- ng:AddCard(card1)
-- ng:AddCard(card2)
-- ng:AddCard(card3)
-- ng:AddCard(card4)
-- Duel.SendtoDeck(ng,nil,0,REASON_RULE)
-- end
-- end
Auxiliary.SaveDeck()
--ActionDuel.Load_Action_Duel()
for p=0,1 do
if Duel.IsPlayerNeedToPickDeck(p) then
Duel.ShuffleDeck(p)
Duel.ResetTimeLimit(p)
end
end
for p=0,1 do
Duel.Draw(p,Duel.GetStartCount(p),REASON_RULE)
end
e:Reset()
end
function Auxiliary.Load2PickRule()
......@@ -512,522 +508,8 @@ function Auxiliary.Load2PickRule()
Deepthink.Load_Skill_Deepthink_Rule()
--Skill DrawSense Specials
--Auxiliary.Load_Skill_DrawSense_Rule()
--DrawSense.Load_Skill_DrawSense_Rule()
--Chicken_Game_Rule
--Auxiliary.Load_Chicken_Game_Rule()
end
--Skill_DrawSense_Rule
function Auxiliary.Load_Skill_DrawSense_Rule()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
--e1:SetCode(PHASE_DRAW+EVENT_PHASE_START)
e1:SetCode(EVENT_PREDRAW)
e1:SetCondition(Auxiliary.Skill_DrawSense_Condition)
e1:SetOperation(Auxiliary.Skill_DrawSense_Operation)
Duel.RegisterEffect(e1,0)
end
function Auxiliary.Skill_DrawSense_Condition(e,tp,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
return (Duel.GetLP(1-tp))-(Duel.GetLP(tp))>2499
and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1
and Duel.GetDrawCount(tp)>0
and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
--and Duel.IsExistingMatchingCard(Auxiliary.Skill_DestinyDraw_SearchFilter,tp,LOCATION_DECK,0,1,nil)
end
function Auxiliary.Skill_DrawSense_Operation(e,tp,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
_replace_count=0
_replace_max=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)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local SenseType=(Duel.AnnounceType(tp))
if (SenseType==0 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_MONSTER)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_MONSTER)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
elseif (SenseType==1 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_SPELL)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_SPELL)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
elseif (SenseType==2 and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_DECK,0,1,nil,TYPE_TRAP)) then
g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_DECK,0,nil,TYPE_TRAP)
local SenseCard=g:RandomSelect(tp,1)
local tc=SenseCard:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
end
--Duel.Draw(tp,1,REASON_RULE)
else
Duel.ShuffleDeck(tp)
--Duel.Draw(tp,1,REASON_RULE)
end
end
--ChickenGame.Load_Chicken_Game_Rule()
end
--Chicken_Game_Rule
function Auxiliary.Load_Chicken_Game_Rule()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(1,1)
e1:SetCountLimit(1)
e1:SetCode(EVENT_PHASE_START+PHASE_STANDBY)
e1:SetOperation(Auxiliary.Chicken_Game_Operation)
Duel.RegisterEffect(e1,0)
end
function Auxiliary.Chicken_Game_Operation(e,tp,eg,ep,ev,re,r,rp)
local tp=Duel.GetTurnPlayer()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EFFECT)
local hintlist=(Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0) and {aux.Stringid(64306248,0),aux.Stringid(42541548,0)} or {aux.Stringid(64306248,0)}
local op=Duel.SelectOption(tp,table.unpack(hintlist))
-- heal
if op==0 then
Duel.Recover(tp,1000,REASON_EFFECT)
-- sendback and draw
else
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoDeck(g,nil,1,REASON_EFFECT)>0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
end
--EVENT ExtraFusion
-- function Auxiliary.Load_EVENT_ExtraFusion()
-- -- elemental hero
-- local e011=Effect.GlobalEffect()
-- e011:SetType(EFFECT_TYPE_FIELD)
-- e011:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e011:SetCode(EFFECT_SPSUMMON_PROC)
-- e011:SetRange(LOCATION_EXTRA)
-- e011:SetCondition(Auxiliary.FireEH_Condition)
-- e011:SetOperation(Auxiliary.FireEH_Operation)
-- local e012=Effect.GlobalEffect()
-- e012:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e012:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e012:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e012:SetTarget(Auxiliary.IsFireEH)
-- e012:SetLabelObject(e011)
-- Duel.RegisterEffect(e012,0)
-- end
-- function Auxiliary.IsFireEH(e,c)
-- return c:IsCode(1945387)
-- end
-- function Auxiliary.FireEH_spfilter1(c,tp,fc)
-- return c:IsFusionSetCard(0x3008) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsControler(tp))
-- and c:IsCanBeFusionMaterial(fc) and Duel.IsExistingMatchingCard(Auxiliary.FireEH_spfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,tp,fc,c)
-- end
-- function Auxiliary.FireEH_spfilter2(c,tp,fc,mc)
-- local g=Group.FromCards(c,mc)
-- return c:IsFusionAttribute(ATTRIBUTE_FIRE) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsControler(tp))
-- and c:IsCanBeFusionMaterial(fc) and Duel.GetLocationCountFromEx(tp,tp,g)>0
-- end
-- function Auxiliary.FireEH_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- return Duel.IsExistingMatchingCard(Auxiliary.FireEH_spfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,c)
-- end
-- function Auxiliary.FireEH_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g1=Duel.GetMatchingGroup(Auxiliary.FireEH_spfilter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
-- local sg=g1:Select(tp,1,1,nil)
-- local g2=Duel.GetMatchingGroup(Auxiliary.FireEH_spfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,sg:GetFirst(),tp,c,sg:GetFirst())
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
-- local c2=g2:Select(tp,1,1,sg:GetFirst())
-- sg:Merge(c2)
-- Duel.SendtoGrave(sg,REASON_COST)
-- c:CompleteProcedure()
-- end
--EVENT Metamorphosis
-- function Auxiliary.Load_EVENT_Metamorphosis()
-- local e1=Effect.GlobalEffect()
-- e1:SetDescription(1127)
-- e1:SetType(EFFECT_TYPE_IGNITION)
-- e1:SetCountLimit(1,46411259+EFFECT_COUNT_CODE_OATH)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetRange(LOCATION_MZONE)
-- e1:SetCost(Auxiliary.EVENT_Metamorphosis_Cost)
-- e1:SetTarget(Auxiliary.EVENT_Metamorphosis_Target)
-- e1:SetOperation(Auxiliary.EVENT_Metamorphosis_Operation)
-- e1:SetLabel(0)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
-- e2:SetTarget(Auxiliary.EVENT_Metamorphosis_MonsterCheck)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- return
-- end
-- function Auxiliary.EVENT_Metamorphosis_MonsterCheck(e,c)
-- return c:IsType(TYPE_MONSTER)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Cost(e,tp,eg,ep,ev,re,r,rp,chk)
-- e:SetLabel(100)
-- if chk==0 then return true end
-- end
-- function Auxiliary.EVENT_Metamorphosis_Costfilter(c,e,tp)
-- return Duel.IsExistingMatchingCard(Auxiliary.EVENT_Metamorphosis_spfilter,tp,LOCATION_DECK,0,1,nil,c,e,tp)
-- end
-- function Auxiliary.EVENT_Metamorphosis_spfilter(c,tc,e,tp)
-- return c:GetOriginalAttribute()==tc:GetOriginalAttribute() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Target(e,tp,eg,ep,ev,re,r,rp,chk)
-- if chk==0 then
-- if e:GetLabel()~=100 then return false end
-- e:SetLabel(0)
-- return Duel.CheckReleaseGroup(tp,Auxiliary.EVENT_Metamorphosis_Costfilter,1,nil,e,tp)
-- end
-- e:SetLabel(0)
-- local g=Duel.SelectReleaseGroup(tp,Auxiliary.EVENT_Metamorphosis_Costfilter,1,1,nil,e,tp)
-- Duel.Release(g,REASON_COST)
-- Duel.SetTargetCard(g)
-- Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
-- Duel.SetChainLimit(aux.FALSE)
-- end
-- function Auxiliary.EVENT_Metamorphosis_Operation(e,tp,eg,ep,ev,re,r,rp)
-- if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
-- local c=e:GetHandler()
-- local tc=Duel.GetFirstTarget()
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
-- local cg=Duel.GetMatchingGroup(Auxiliary.EVENT_Metamorphosis_spfilter,tp,LOCATION_DECK,0,nil,tc,e,tp)
-- if cg:GetCount()>0 then
-- local tg=cg:RandomSelect(1-tp,1)
-- Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)
-- end
-- end
-- --EVENT_XYYZ_Impact
-- function Auxiliary.Load_EVENT_XYYZ_Impact()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_FIELD)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetCode(EFFECT_SPSUMMON_PROC)
-- e1:SetRange(LOCATION_EXTRA)
-- e1:SetCondition(Auxiliary.XY_Condition)
-- e1:SetOperation(Auxiliary.XY_Operation)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e2:SetTarget(Auxiliary.IsXYMoster)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- local e3=Effect.GlobalEffect()
-- e3:SetType(EFFECT_TYPE_FIELD)
-- e3:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e3:SetCode(EFFECT_SPSUMMON_PROC)
-- e3:SetRange(LOCATION_EXTRA)
-- e3:SetCondition(Auxiliary.XYYZ_Condition)
-- e3:SetOperation(Auxiliary.XYYZ_Operation)
-- local e4=Effect.GlobalEffect()
-- e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e4:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e4:SetTarget(Auxiliary.IsXYYZMoster)
-- e4:SetLabelObject(e3)
-- Duel.RegisterEffect(e4,0)
-- end
-- function Auxiliary.IsXYMoster(e,c)
-- return c:IsCode(2111707) or c:IsCode(99724761) or c:IsCode(25119460)
-- end
-- function Auxiliary.IsXYYZMoster(e,c)
-- return c:IsCode(91998119)
-- end
-- function Auxiliary.XY_ffilter(c,fc,sub,mg,sg)
-- return not c:IsType(TYPE_TOKEN) and
-- (not sg or not sg:IsExists(Card.IsFusionAttribute,2,c,c:GetFusionAttribute()))
-- end
-- function Auxiliary.XY_spfilter1(c,tp,fc)
-- return not c:IsType(TYPE_TOKEN) and Duel.IsPlayerCanRelease(tp,c)
-- and c:IsCanBeFusionMaterial(fc) and Duel.IsExistingMatchingCard(Auxiliary.XY_spfilter2,tp,LOCATION_MZONE,0,1,c,tp,fc,c)
-- end
-- function Auxiliary.XY_spfilter2(c,tp,fc,mc)
-- local g=Group.FromCards(c,mc)
-- return not c:IsType(TYPE_TOKEN) and Duel.IsPlayerCanRelease(tp,c)
-- and c:IsCanBeFusionMaterial(fc) and c:IsFusionAttribute(mc:GetFusionAttribute()) and Duel.GetLocationCountFromEx(tp,tp,g)>0
-- end
-- function Auxiliary.XY_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- return Duel.IsExistingMatchingCard(Auxiliary.XY_spfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,c)
-- end
-- function Auxiliary.XY_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
-- local g1=Duel.SelectMatchingCard(tp,Auxiliary.XY_spfilter1,tp,LOCATION_MZONE,0,1,1,nil,tp,c)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
-- local g2=Duel.SelectMatchingCard(tp,Auxiliary.XY_spfilter2,tp,LOCATION_MZONE,0,1,1,g1:GetFirst(),tp,c,g1:GetFirst())
-- g1:Merge(g2)
-- Duel.Release(g1,REASON_COST)
-- end
-- function Auxiliary.XYYZ_spcostfilter(c)
-- return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_FUSION)
-- end
-- function Auxiliary.XYYZ_spcost_selector(c,tp,g,sg,i)
-- sg:AddCard(c)
-- g:RemoveCard(c)
-- local flag=false
-- if i<2 then
-- flag=g:IsExists(Auxiliary.XYYZ_spcostfilter,1,nil,tp,g,sg,i+1)
-- else
-- flag=sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_LIGHT)>0
-- and sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_LIGHT)>0
-- end
-- sg:RemoveCard(c)
-- g:AddCard(c)
-- return flag
-- end
-- function Auxiliary.XYYZ_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- if Duel.GetLocationCountFromEx(tp)<=0 then return false end
-- local g=Duel.GetMatchingGroup(Auxiliary.XYYZ_spcostfilter,tp,LOCATION_GRAVE,0,nil)
-- local sg=Group.CreateGroup()
-- return g:IsExists(Auxiliary.XYYZ_spcost_selector,1,nil,tp,g,sg,1)
-- end
-- function Auxiliary.XYYZ_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g=Duel.GetMatchingGroup(Auxiliary.XYYZ_spcostfilter,tp,LOCATION_GRAVE,0,nil)
-- local sg=Group.CreateGroup()
-- for i=1,2 do
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g1=g:FilterSelect(tp,Auxiliary.XYYZ_spcost_selector,1,1,nil,tp,g,sg,i)
-- sg:Merge(g1)
-- g:Sub(g1)
-- end
-- Duel.Remove(sg,POS_FACEUP,REASON_COST)
-- end
-- function Auxiliary.XY_matfilter(c)
-- return c:IsAbleToRemoveAsCost() and not c:IsType(TYPE_TOKEN)
-- end
-- function Auxiliary.XY_att_filter1(c,tp)
-- return Duel.IsExistingMatchingCard(Auxiliary.XY_att_filter2,tp,0,LOCATION_MZONE,1,c,c:GetAttribute())
-- end
-- function Auxiliary.XY_att_filter2(c,att)
-- return c:IsAttribute(att) and not c:IsType(TYPE_TOKEN)
-- end
-- function Auxiliary.XY_spfilter1(c,tp,g)
-- return g:IsExists(Auxiliary.XY_spfilter2,1,c,tp,c)
-- end
-- function Auxiliary.XY_spfilter2(c,tp,mc)
-- return (c:IsFusionCode(62651957) and mc:IsFusionCode(64500000)
-- or c:IsFusionCode(64500000) and mc:IsFusionCode(62651957))
-- and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c,mc))>0
-- end
-- function Auxiliary.XY_Condition(e,c)
-- if c==nil then return true end
-- local tp=c:GetControler()
-- local g=Duel.GetMatchingGroup(Auxiliary.XY_matfilter,tp,LOCATION_ONFIELD,0,nil)
-- return g:IsExists(c99724761.spfilter1,1,nil,tp,g)
-- end
-- function Auxiliary.XY_Operation(e,tp,eg,ep,ev,re,r,rp,c)
-- local g=Duel.GetMatchingGroup(c99724761.matfilter,tp,LOCATION_ONFIELD,0,nil)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g1=g:FilterSelect(tp,c99724761.spfilter1,1,1,nil,tp,g)
-- local mc=g1:GetFirst()
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
-- local g2=g:FilterSelect(tp,c99724761.spfilter2,1,1,mc,tp,mc)
-- g1:Merge(g2)
-- Duel.Remove(g1,POS_FACEUP,REASON_COST)
-- end
-- --EVENT Grandpa's Cards
-- function Auxiliary.Load_EVENT_Grandpas_Cards()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
-- e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
-- e1:SetCode(EVENT_BATTLED)
-- e1:SetTarget(Auxiliary.EVENT_Grandpas_Cards_Target)
-- e1:SetOperation(Auxiliary.EVENT_Grandpas_Cards_Operation)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
-- e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Target(e,tp,eg,ep,ev,re,r,rp)
-- local c=e:GetHandler()
-- if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
-- local bc=c:GetBattleTarget()
-- return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) and not bc:IsType(TYPE_TOKEN)
-- and bc:GetLeaveFieldDest()==0 and bit.band(bc:GetBattlePosition(),POS_FACEUP_ATTACK)~=0
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Operation(e,tp,eg,ep,ev,re,r,rp)
-- local c=e:GetHandler()
-- local bc=c:GetBattleTarget()
-- if Duel.SelectYesNo(c.GetOwner(c),94) then
-- if bc:IsRelateToBattle() then
-- local e1=Effect.CreateEffect(c)
-- e1:SetCode(EFFECT_SEND_REPLACE)
-- e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
-- e1:SetTarget(Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Target)
-- e1:SetOperation(Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Operation)
-- e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_DAMAGE)
-- bc:RegisterEffect(e1)
-- end
-- -- local code=e:GetHandler():GetCode()
-- Exodia_announce_filter={0x40,OPCODE_ISSETCARD,0,OPCODE_ISCODE,OPCODE_NOT,OPCODE_AND}
-- local ac=Duel.AnnounceCardFilter(c.GetOwner(c),table.unpack(Exodia_announce_filter))
-- local Yugi_Card=Duel.CreateToken(c.GetOwner(c),ac)
-- Duel.SendtoHand(Yugi_Card,c.GetOwner(c),0,REASON_RULE)
-- end
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Target(e,tp,eg,ep,ev,re,r,rp,chk)
-- local c=e:GetHandler()
-- if chk==0 then return c:GetDestination()==LOCATION_GRAVE and c:IsReason(REASON_BATTLE) end
-- return true
-- end
-- function Auxiliary.EVENT_Grandpas_Cards_Return_Hand_Operation(e,tp,eg,ep,ev,re,r,rp)
-- Duel.SendtoHand(e:GetHandler(),nil,2,REASON_RULE)
-- end
--Shadoll Event
-- function Auxiliary.Load_Shadow_Rule()
-- local e1=Effect.GlobalEffect()
-- e1:SetDescription(1166)
-- e1:SetType(EFFECT_TYPE_FIELD)
-- e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetCode(EFFECT_SPSUMMON_PROC)
-- e1:SetRange(LOCATION_EXTRA)
-- e1:SetCondition(Auxiliary.LinkCondition(nil,2,2,nil))
-- e1:SetTarget(Auxiliary.LinkTarget(nil,2,2,nil))
-- e1:SetOperation(Auxiliary.LinkOperation(nil,2,2,nil))
-- e1:SetValue(SUMMON_TYPE_LINK)
-- local e2=Effect.GlobalEffect()
-- e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
-- e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e2:SetTargetRange(LOCATION_EXTRA,LOCATION_EXTRA)
-- e2:SetTarget(Auxiliary.IsConstruct)
-- e2:SetLabelObject(e1)
-- Duel.RegisterEffect(e2,0)
-- return
-- end
-- function Auxiliary.IsConstruct(e,c)
-- return c:IsCode(86938484)
-- end
--DestinyDraw Rule
-- function Auxiliary.Load_Skill_DestinyDraw_Rule()
-- local e1=Effect.GlobalEffect()
-- e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
-- e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
-- e1:SetTargetRange(1,1)
-- e1:SetCode(PHASE_DRAW+EVENT_PHASE_START)
-- e1:SetCondition(Auxiliary.Skill_DestinyDraw_Condition)
-- e1:SetOperation(Auxiliary.Skill_DestinyDraw_Operation)
-- Duel.RegisterEffect(e1,0)
-- end
-- function Auxiliary.Skill_DestinyDraw_SearchFilter(c)
-- return c:IsAbleToHand()
-- end
-- function Auxiliary.Skill_DestinyDraw_Condition(e,tp,eg,ep,ev,re,r,rp)
-- local tp=Duel.GetTurnPlayer()
-- return (Duel.GetLP(1-tp))-(Duel.GetLP(tp))>2999
-- and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4
-- and Duel.GetDrawCount(tp)>0
-- and Duel.IsExistingMatchingCard(Auxiliary.Skill_DestinyDraw_SearchFilter,tp,LOCATION_DECK,0,1,nil)
-- end
-- function Auxiliary.Skill_DestinyDraw_Operation(e,tp,eg,ep,ev,re,r,rp)
-- local tp=Duel.GetTurnPlayer()
-- local dt=Duel.GetDrawCount(tp)
-- if dt~=0 then
-- _replace_count=0
-- _replace_max=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)
-- Duel.ConfirmDecktop(tp,5)
-- local g=Duel.GetDecktopGroup(tp,5)
-- if g:GetCount()>0 then
-- Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND)
-- local sg=g:Select(tp,1,1,nil)
-- if sg:GetFirst():IsAbleToHand() then
-- Duel.SendtoHand(sg,nil,REASON_EFFECT)
-- Duel.ConfirmCards(1-tp,sg)
-- Duel.ShuffleHand(tp)
-- else
-- Duel.SendtoGrave(sg,REASON_RULE)
-- end
-- Duel.ShuffleDeck(tp)
-- end
-- end
-- end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment