Commit 572aba05 authored by Nemo Ma's avatar Nemo Ma

fix tama cards

parent d648d13c
......@@ -46,7 +46,7 @@ function cm.filter(c,ft)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft1<-1 then return false end
if ft1<-1 then return end
local ft=ft1
if ft1<=1 then
ft1=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
......@@ -57,9 +57,9 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft1=1 end
local i=1
local sg=Group.CreateGroup()
while i<=ft1 do
while i<=ft1 and Duel.GetMatchingGroupCount(cm.filter,tp,LOCATION_ONFIELD,0,sg,ft) do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_ONFIELD,0,1,1,nil,ft)
local g1=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_ONFIELD,0,1,1,sg,ft)
if g1:GetFirst():IsLocation(LOCATION_ONFIELD) then
ft=ft-1
end
......
......@@ -33,9 +33,9 @@ function cm.filter2(c)
return c:IsSetCard(0x356) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanDiscardDeck(tp,3) then return end
Duel.ConfirmDecktop(tp,3)
local g=Duel.GetDecktopGroup(tp,3)
if not Duel.IsPlayerCanDiscardDeck(tp,5) then return end
Duel.ConfirmDecktop(tp,5)
local g=Duel.GetDecktopGroup(tp,5)
local sg=g:Filter(cm.filter,nil)
if sg:GetCount()<=0 then return end
Duel.DisableShuffleCheck()
......@@ -43,17 +43,17 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local sg1=Duel.GetOperatedGroup()
local sg2=sg1:Clone()
if sg1:GetCount()>0 then
if sg1:GetSum(tama.tamas_getElementCount,13254033)>0 and Duel.IsPlayerCanDiscardDeck(tp,2) then
if sg1:GetSum(tama.tamas_getElementCount,13254033)>0 and Duel.IsPlayerCanDiscardDeck(tp,3) then
Duel.BreakEffect()
Duel.ShuffleDeck(tp)
Duel.DiscardDeck(tp,2,REASON_EFFECT)
Duel.DiscardDeck(tp,3,REASON_EFFECT)
sg2:Merge(Duel.GetOperatedGroup())
end
if sg1:GetSum(tama.tamas_getElementCount,13254031)>0 and Duel.IsPlayerCanDraw(tp,1) then
if sg1:GetSum(tama.tamas_getElementCount,13254031)>0 and Duel.IsPlayerCanDraw(tp,2) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
Duel.Draw(tp,2,REASON_EFFECT)
Duel.ShuffleHand(tp)
Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT+REASON_DISCARD)
Duel.DiscardHand(tp,aux.TRUE,2,2,REASON_EFFECT+REASON_DISCARD)
sg2:Merge(Duel.GetOperatedGroup())
end
if sg1:GetSum(tama.tamas_getElementCount,13254036)>0 and sg2:IsExists(cm.filter2,1,nil) then
......
......@@ -31,7 +31,6 @@ function cm.initial_effect(c)
e3:SetType(EFFECT_TYPE_ACTIVATE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetCost(cm.cost2)
e3:SetTarget(cm.target2)
e3:SetOperation(cm.operation2)
c:RegisterEffect(e3)
......
......@@ -31,10 +31,10 @@ function cm.initial_effect(c)
end
function cm.tdfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() and Duel.IsExistingMatchingCard(cm.thfilter,tp,0,LOCATION_DECK,1,nil,c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c)
end
function cm.thfilter(c,tc)
return c:IsSetCard(0x3356) and c:IsType(TYPE_MONSTER) and tama.tamas_checkElementsEmpty(tama.tamas_getElements(c)) and tama.tamas_checkCardElementsGreater(tc,c) and c:IsAbleToHand()
return c:IsSetCard(0x3356) and c:IsType(TYPE_MONSTER) and not tama.tamas_checkElementsEmpty(tama.tamas_getElements(c)) and tama.tamas_checkCardElementsGreater(tc,c) and c:IsAbleToHand()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end
......@@ -53,7 +53,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
if Duel.SelectYesNo(aux.Stringid(m,2)) then
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.BreakEffect()
Duel.Summon(tp,g:GetFirst(),true,nil)
end
......
......@@ -49,14 +49,14 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 or t3 end
local op=0
if t1 or t2 or t3 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
if t3 then m[ct]=aux.Stringid(m,4) n[ct]=3 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
if t3 then m1[ct]=aux.Stringid(m,4) n1[ct]=3 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -128,8 +128,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
......@@ -155,7 +155,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.spfilter(c,e,tp)
return c:IsSetCard(0x351) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -72,13 +72,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -147,8 +147,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -167,7 +167,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -115,13 +115,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -190,8 +190,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -210,7 +210,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.bgmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(11,0,aux.Stringid(m,7))
......
......@@ -97,13 +97,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -172,8 +172,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -192,7 +192,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.tgfilter(c,tp)
return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsSetCard(0x351)
......
......@@ -77,14 +77,14 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 or t3 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
if t3 then m[ct]=aux.Stringid(m,4) n[ct]=3 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
if t3 then m1[ct]=aux.Stringid(m,4) n1[ct]=3 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -153,8 +153,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
elseif e:GetLabel()==3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,cm.eqfilter,tp,LOCATION_EXTRA,0,1,1,nil,c)
......@@ -186,7 +186,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.tdfilter(c,ec,tp)
return c:IsSetCard(0x352) and c:IsType(TYPE_MONSTER) and c:IsFaceup() and ((c:CheckEquipTarget(ec) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) or c:IsAbleToExtra())
......
......@@ -81,13 +81,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -156,8 +156,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -176,7 +176,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.tdfilter(c,ec,tp)
return c:IsSetCard(0x352) and c:IsType(TYPE_MONSTER) and c:IsFaceup() and ((c:CheckEquipTarget(ec) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) or c:IsAbleToExtra())
......
......@@ -45,7 +45,7 @@ function cm.aclimit(e,re,tp)
end
function cm.actcon(e)
local f=tama.cosmicFighters_equipGetFormation(e:GetHandler())
return f and f:IsContains(Duel.GetAttacker()) or f:IsContains(Duel.GetAttackTarget())
return f and ((Duel.GetAttacker() and f:IsContains(Duel.GetAttacker())) or (Duel.GetAttackTarget() and f:IsContains(Duel.GetAttackTarget())))
end
function cm.target(e,c)
local f=tama.cosmicFighters_equipGetFormation(e:GetHandler())
......
......@@ -29,7 +29,7 @@ function cm.initial_effect(c)
e3:SetCode(EVENT_BATTLE_DESTROYING)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetCondition(cm.cacon)
e3:SetTarget(cm.catg)
e3:SetOperation(cm.caop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
......
......@@ -54,7 +54,7 @@ function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return
if chk==0 then
local f=tama.cosmicFighters_equipGetFormation(e:GetHandler())
return f and tama.tamas_groupHasGroupCard(eg,f)
end
......@@ -106,7 +106,7 @@ function cm.aclimit(e,re,tp)
end
function cm.actcon(e)
local f=tama.cosmicFighters_equipGetFormation(e:GetHandler())
return f and f:IsContains(Duel.GetAttacker()) or f:IsContains(Duel.GetAttackTarget())
return f and ((Duel.GetAttacker() and f:IsContains(Duel.GetAttacker())) or (Duel.GetAttackTarget() and f:IsContains(Duel.GetAttackTarget())))
end
function cm.target(e,c)
local f=tama.cosmicFighters_equipGetFormation(e:GetHandler())
......
......@@ -64,13 +64,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -140,8 +140,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -157,7 +157,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.upcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
......
......@@ -65,13 +65,13 @@ function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return t1 or t2 end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
e:SetLabel(op)
if op==1 then
......@@ -141,8 +141,8 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
e6:SetCondition(cm.tokendes)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
c:SetCardTarget(token)
Duel.SpecialSummonComplete()
end
end
function cm.tokenatk(e,c)
......@@ -158,7 +158,7 @@ function cm.tokenatt(e,c)
return e:GetOwner():GetAttribute()
end
function cm.tokendes(e)
return not e:GetOwner():IsHasCardTarget(e:GetHandler())
return not e:GetOwner():GetCardTarget():IsContains(e:GetHandler())
end
function cm.upcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
......
--超时空战斗机-银银河战机
local m=13254027
local m=13257327
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
......@@ -207,13 +207,13 @@ function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
if not (t1 or t2) then return end
local op=0
if t1 or t2 then
local m={}
local n={}
local m1={}
local n1={}
local ct=1
if t1 then m[ct]=aux.Stringid(m,2) n[ct]=1 ct=ct+1 end
if t2 then m[ct]=aux.Stringid(m,3) n[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m))
op=n[sp+1]
if t1 then m1[ct]=aux.Stringid(m,2) n1[ct]=1 ct=ct+1 end
if t2 then m1[ct]=aux.Stringid(m,3) n1[ct]=2 ct=ct+1 end
local sp=Duel.SelectOption(tp,table.unpack(m1))
op=n1[sp+1]
end
if op==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
......
--超时空战斗机-火石战机
local m=13257328
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,3))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetTarget(cm.eqtg)
e1:SetOperation(cm.eqop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--Power Capsule
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCondition(cm.pccon)
e3:SetTarget(cm.pctg)
e3:SetOperation(cm.pcop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,4))
e4:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetTarget(cm.destg)
e4:SetOperation(cm.desop)
c:RegisterEffect(e4)
local e11=Effect.CreateEffect(c)
e11:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e11:SetCode(EVENT_SUMMON_SUCCESS)
e11:SetOperation(cm.bgmop)
c:RegisterEffect(e11)
eflist={"power_capsule",e3}
cm[c]=eflist
end
function cm.feqfilter(c,ec)
return c:IsCode(13257319) and c:CheckEquipTarget(ec)
end
function cm.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(cm.feqfilter,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_EXTRA)
end
function cm.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,cm.feqfilter,tp,LOCATION_EXTRA,0,1,1,nil,c)
local tc=g:GetFirst()
if tc then
Duel.Equip(tp,tc,c)
end
end
function cm.desfilter(c)
return c:IsFaceup() and c:GetEquipGroup():IsExists(Card.IsCode,1,nil,13257319)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.desfilter,tp,0,LOCATION_MZONE,1,nil) and Duel.IsPlayerCanDraw(tp,1) end
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,g:GetCount())
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil)
local ct=Duel.Destroy(g,REASON_EFFECT)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(tp,ct,REASON_EFFECT)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
end
function cm.pcfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function cm.pccon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.pcfilter,1,nil,1-tp)
end
function cm.eqfilter(c,ec)
return c:IsSetCard(0x352) and c:IsType(TYPE_MONSTER) and c:CheckEquipTarget(ec)
end
function cm.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(cm.eqfilter,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end
e:SetCategory(CATEGORY_EQUIP)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_EXTRA)
end
function cm.pcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,cm.eqfilter,tp,LOCATION_EXTRA,0,1,1,nil,c)
local tc=g:GetFirst()
if tc then
Duel.Equip(tp,tc,c)
end
end
function cm.bgmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(11,0,aux.Stringid(m,7))
end
--超时空能量胶囊
local m=13254029
local m=13257329
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
......@@ -38,7 +38,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if tc:IsRelateToEffect(e) then
Duel.Hint(12,0,aux.Stringid(m,7))
local tep=tc:GetControler()
local PCe=tama.tamas_getTargetTable(c,"power_capsule")
local PCe=tama.tamas_getTargetTable(tc,"power_capsule")
if PCe then
local cost=PCe:GetCost()
local target=PCe:GetTarget()
......
--超时空破坏胶囊
local m=13254030
local m=13257330
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
......
--超时空修复胶囊
local m=13254031
local m=13257331
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
......
--超时空填充胶囊
local m=13254032
local m=13257332
local cm=_G["c"..m]
xpcall(function() require("expansions/script/tama") end,function() require("script/tama") end)
function cm.initial_effect(c)
......
......@@ -14,7 +14,6 @@ function c9981016.initial_effect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,9981016)
e2:SetCost(c9981016.cost)
e2:SetTarget(c9981016.sptg)
e2:SetOperation(c9981016.spop)
......@@ -26,7 +25,7 @@ function c9981016.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetCountLimit(1,1142881)
e3:SetCountLimit(1,9981016)
e3:SetTarget(c9981016.sptg2)
e3:SetOperation(c9981016.spop2)
c:RegisterEffect(e3)
......
......@@ -60,7 +60,7 @@ function tama.cosmicFighters_optionFilter(c)
end
function tama.cosmicFighters_getOptions(c)
local og=c:GetCardTarget()
local g=og:Filter(tama.optionFilter,nil)
local g=og:Filter(tama.cosmicFighters_optionFilter,nil)
return g
end
function tama.cosmicFighters_getFormation(c)
......@@ -223,19 +223,23 @@ end
function tama.tamas_increaseElements(codes,add)
local toAdd=tama.DeepCopy(codes)
if #toAdd>0 then
if not tama.tamas_checkContainElements(toAdd,add) then
local i=1
while add[i] do
if not tama.tamas_checkElementsHasElement(toAdd,add[i]) then
table.insert(toAdd,{add[i][1],0})
end
end
end
local i=1
while toAdd[i] do
local j=1
local h=true
while add[j] do
if toAdd[i][1]==add[j][1] then
toAdd[i][2]=toAdd[i][2]+add[j][2]
end
j=j+1
end
if not h then
table.insert(toAdd,add[j])
end
i=i+1
end
else
......@@ -307,6 +311,7 @@ function tama.tamas_checkContainElements(codes,check)
end
return contain
end
--some elements are equal or lower than 0
function tama.tamas_checkElementsEmpty(codes)
local i=1
local empty=true
......@@ -318,6 +323,18 @@ function tama.tamas_checkElementsEmpty(codes)
end
return empty
end
--some elements are lower than 0
function tama.tamas_checkElementsLowerEmpty(codes)
local i=1
local empty=true
while codes[i] do
if codes[i][2]>=0 then
empty=false
end
i=i+1
end
return empty
end
function tama.tamas_checkGroupElementsForLess(g,codes)
local sg=Group.CreateGroup()
local tc=g:GetFirst()
......@@ -657,7 +674,7 @@ function tama.tamas_checkElementsGreater(codes,subCodes,targetCodes)
elements=tama.tamas_increaseElements(elements,{subCodes[i]})
end
elements=tama.tamas_decreaseElements(elements,targetCodes)
if tama.tamas_checkContainElements(elements,targetCodes) and not tama.tamas_checkElementsEmpty(elements) then
if tama.tamas_checkContainElements(elements,targetCodes) and not tama.tamas_checkElementsLowerEmpty(elements) then
greater=true
end
until (not subCodes[i] or greater)
......
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