Commit 953be8ae authored by mercury233's avatar mercury233 Committed by GitHub

add Auxiliary.tkfcon, fix Mecha Phantom Beast monsters and other (#2524)

parent c803d1c5
......@@ -14,7 +14,7 @@ function c15335853.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c15335853.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -47,9 +47,6 @@ function c15335853.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c15335853.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c15335853.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsType,1,nil,TYPE_TOKEN) end
local g=Duel.SelectReleaseGroup(tp,Card.IsType,1,1,nil,TYPE_TOKEN)
......
......@@ -14,7 +14,7 @@ function c16943770.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c16943770.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -36,9 +36,6 @@ function c16943770.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c16943770.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c16943770.cfilter(c)
return c:IsSetCard(0x101b) and not c:IsCode(16943770) and c:IsAbleToRemoveAsCost()
end
......
......@@ -81,7 +81,8 @@ function c17228908.tkop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c17228908.tgcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),0,LOCATION_ONFIELD,1,nil,TYPE_TOKEN)
local tp=e:GetHandlerPlayer()
return aux.tkfcon(e,1-tp)
end
function c17228908.tglimit(e,c)
return not c:IsType(TYPE_TOKEN)
......
......@@ -11,7 +11,7 @@ function c1942635.initial_effect(c)
e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetCondition(c1942635.atkcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(c1942635.atkval)
c:RegisterEffect(e2)
--draw
......@@ -27,9 +27,6 @@ function c1942635.initial_effect(c)
e3:SetOperation(c1942635.drop)
c:RegisterEffect(e3)
end
function c1942635.atkcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c1942635.atkval(e,c)
return c:IsFaceup() and c:IsSetCard(0x134) and c:IsType(TYPE_EFFECT)
end
......
......@@ -14,7 +14,7 @@ function c20368763.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c20368763.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -49,9 +49,6 @@ function c20368763.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c20368763.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c20368763.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:IsReason(REASON_COST)
end
......
......@@ -9,7 +9,7 @@ function c22110647.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c22110647.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -39,9 +39,6 @@ function c22110647.initial_effect(c)
e5:SetOperation(c22110647.desop)
c:RegisterEffect(e5)
end
function c22110647.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c22110647.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
......@@ -27,9 +27,10 @@ function c2819435.initial_effect(c)
e6:SetDescription(aux.Stringid(2819435,1))
e6:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_ACTIVATE_CONDITION)
e6:SetCode(EVENT_CHAINING)
e6:SetRange(LOCATION_FZONE)
e6:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e6:SetCondition(c2819435.spcon)
e6:SetCost(c2819435.cost)
e6:SetTarget(c2819435.sptg)
......@@ -81,14 +82,11 @@ function c2819435.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c2819435.spcon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
return rp==1-tp and not aux.tkfcon(e,tp)
end
function c2819435.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,2819436,0xfa,TYPES_TOKEN_MONSTER,2000,2000,6,RACE_WYRM,ATTRIBUTE_WATER)
and e:GetHandler():GetFlagEffect(2819435)==0
and not Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_ONFIELD,0,1,nil,TYPE_TOKEN) end
e:GetHandler():RegisterFlagEffect(2819435,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
and Duel.IsPlayerCanSpecialSummonMonster(tp,2819436,0xfa,TYPES_TOKEN_MONSTER,2000,2000,6,RACE_WYRM,ATTRIBUTE_WATER) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
......
......@@ -14,7 +14,7 @@ function c30811116.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c30811116.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -47,9 +47,6 @@ function c30811116.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c30811116.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c30811116.spcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
......
......@@ -6,7 +6,7 @@ function c31480215.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetCondition(c31480215.indcon)
e1:SetCondition(aux.tkfcon)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
......@@ -33,9 +33,6 @@ function c31480215.initial_effect(c)
e4:SetOperation(c31480215.lvop)
c:RegisterEffect(e4)
end
function c31480215.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c31480215.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO
and e:GetHandler():GetReasonCard():IsRace(RACE_MACHINE)
......
......@@ -14,7 +14,7 @@ function c31533704.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c31533704.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -48,9 +48,6 @@ function c31533704.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c31533704.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c31533704.spfilter(c,tp)
return c:IsControler(tp) and c:IsType(TYPE_TOKEN)
end
......
......@@ -17,7 +17,7 @@ function c41329458.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c41329458.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -35,9 +35,6 @@ function c41329458.initial_effect(c)
e4:SetOperation(c41329458.spop2)
c:RegisterEffect(e4)
end
function c41329458.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c41329458.rfilter(c,tp)
return c:IsSetCard(0x101b) and (c:IsControler(tp) or c:IsFaceup())
end
......
......@@ -14,7 +14,7 @@ function c44026393.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c44026393.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -35,9 +35,6 @@ function c44026393.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c44026393.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c44026393.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
......
......@@ -14,7 +14,7 @@ function c4417407.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c4417407.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -48,9 +48,6 @@ function c4417407.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c4417407.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c4417407.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
......
......@@ -14,7 +14,7 @@ function c66200210.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c66200210.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -46,9 +46,6 @@ function c66200210.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c66200210.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c66200210.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0)
......
......@@ -6,7 +6,7 @@ function c67489919.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetCondition(c67489919.indcon)
e1:SetCondition(aux.tkfcon)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
......@@ -38,9 +38,6 @@ function c67489919.initial_effect(c)
e6:SetValue(LOCATION_MZONE+LOCATION_HAND)
c:RegisterEffect(e6)
end
function c67489919.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c67489919.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0
......
......@@ -14,7 +14,7 @@ function c67922702.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c67922702.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -47,9 +47,6 @@ function c67922702.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c67922702.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c67922702.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
......
......@@ -6,7 +6,7 @@ function c72291078.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetCondition(c72291078.indcon)
e1:SetCondition(aux.tkfcon)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
......@@ -34,9 +34,6 @@ function c72291078.initial_effect(c)
e4:SetOperation(c72291078.spop)
c:RegisterEffect(e4)
end
function c72291078.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c72291078.filter(c)
return c:IsSetCard(0x101b) and c:IsSummonable(true,nil)
end
......
......@@ -14,7 +14,7 @@ function c76902476.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c76902476.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -35,9 +35,6 @@ function c76902476.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c76902476.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c76902476.indtg(e,c)
return c:IsCode(31533705)
end
......
......@@ -56,7 +56,7 @@ function c89907227.tkop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c89907227.tkcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and not Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
return Duel.IsTurnPlayer(1-tp) and not aux.tkfcon(e,tp)
end
function c89907227.tkop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
......
......@@ -14,7 +14,7 @@ function c94973028.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c94973028.indcon)
e2:SetCondition(aux.tkfcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -47,9 +47,6 @@ function c94973028.lvval(e,c)
local tp=c:GetControler()
return Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,31533705):GetSum(Card.GetLevel)
end
function c94973028.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c94973028.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x101b)
end
......
......@@ -729,6 +729,11 @@ function Auxiliary.MaterialReasonCardReg(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
c:GetReasonCard():CreateEffectRelation(te)
end
--the player tp has token on the field
function Auxiliary.tkfcon(e,tp)
if tp==nil and e~=nil then tp=e:GetHandlerPlayer() end
return Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_ONFIELD,0,1,nil,TYPE_TOKEN)
end
--effects inflicting damage to tp
function Auxiliary.damcon1(e,tp,eg,ep,ev,re,r,rp)
local e1=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)
......
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