Commit f92f7054 authored by Grajade's avatar Grajade

Update c22200005.lua

parent c46ee783
Pipeline #7725 failed with stage
in 7 seconds
--瞳中所示之物
function c22200005.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(22200005,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN+CATEGORY_DAMAGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c22200005.condition)
e1:SetCost(c22200005.cost)
e1:SetTarget(c22200005.target)
e1:SetOperation(c22200005.operation)
c:RegisterEffect(e1)
end
function c22200005.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():GetControler()~=tp
end
function c22200005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c22200005.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c22200005.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK) then return end
local token=Duel.CreateToken(tp,22200999)
if Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then
local a=Duel.GetAttacker()
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,token)
Duel.BreakEffect()
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c22200005.spcon)
e1:SetOperation(c22200005.spop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_PHASE+PHASE_BATTLE)
e2:SetCountLimit(1)
e2:SetOperation(c22200005.desop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
end
function c22200005.cfilter(c,tp)
return c:IsReason(REASON_BATTLE) and c:IsType(TYPE_TOKEN) and c:GetPreviousControler()==tp
end
function c22200005.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c22200005.cfilter,1,nil,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK)
end
function c22200005.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK) then return end
Duel.Hint(HINT_CARD,tp,22200005)
local token=Duel.CreateToken(tp,22200999)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
function c22200005.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,tp,22200005)
local c=e:GetHandler()
local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD):Filter(Card.IsFaceup,nil):Filter(Card.IsType,nil,TYPE_TOKEN)
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)>0 then
local dm=Duel.GetOperatedGroup():GetCount()*500
Duel.Damage(tp,dm,REASON_EFFECT)
end
e:Reset()
--瞳中所示之物
function c22200005.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(22200005,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN+CATEGORY_DAMAGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c22200005.condition)
e1:SetCost(c22200005.cost)
e1:SetTarget(c22200005.target)
e1:SetOperation(c22200005.operation)
c:RegisterEffect(e1)
end
function c22200005.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():GetControler()~=tp
end
function c22200005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c22200005.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK,POS_FACEUP_DEFENSE) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c22200005.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK,POS_FACEUP_DEFENSE) then return end
local token=Duel.CreateToken(tp,22200999)
if Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then
local a=Duel.GetAttacker()
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,token)
Duel.BreakEffect()
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c22200005.spcon)
e1:SetOperation(c22200005.spop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_PHASE+PHASE_BATTLE)
e2:SetCountLimit(1)
e2:SetOperation(c22200005.desop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
end
function c22200005.cfilter(c,tp)
return c:IsReason(REASON_BATTLE) and c:IsType(TYPE_TOKEN) and c:GetPreviousControler()==tp
end
function c22200005.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c22200005.cfilter,1,nil,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK,POS_FACEUP_DEFENSE)
end
function c22200005.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,22200999,0,0x4011,0,0,1,RACE_PSYCHO,ATTRIBUTE_DARK,POS_FACEUP_DEFENSE) then return end
Duel.Hint(HINT_CARD,tp,22200005)
local token=Duel.CreateToken(tp,22200999)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
function c22200005.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,tp,22200005)
local c=e:GetHandler()
local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD):Filter(Card.IsFaceup,nil):Filter(Card.IsType,nil,TYPE_TOKEN)
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)>0 then
local dm=Duel.GetOperatedGroup():GetCount()*500
Duel.Damage(tp,dm,REASON_EFFECT)
end
e:Reset()
end
\ No newline at end of file
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