Commit 45af8f52 authored by Tachibana's avatar Tachibana

ybb

parent 85612dcf
Pipeline #11166 passed with stages
in 35 minutes and 5 seconds
No preview for this file type
--神赐之门的圆桌骑士-亚瑟
local m=33500901
local cm=_G["c"..m]
function cm.initial_effect(c)
c:EnableReviveLimit()
--xyz summon
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetRange(LOCATION_EXTRA)
e0:SetCondition(function(e,c,og,min,max)
if c==nil then return true end
local tp=c:GetControler()
local zone=Duel.GetFieldGroup(tp,LOCATION_MZONE+LOCATION_HAND,0)
return Duel.CheckXyzMaterial(c,cm.xyzfilter,2,2,2,zone)
end)
e0:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
if og and not min then
return true
end
local zone=Duel.GetFieldGroup(tp,LOCATION_MZONE+LOCATION_HAND,0)
local g=Duel.SelectXyzMaterial(tp,c,cm.xyzfilter,2,2,2,zone)
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end)
e0:SetOperation(function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
local sg=Group.CreateGroup()
local tc=mg:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=mg:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end)
e0:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e0)
--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(cm.atkval)
c:RegisterEffect(e1)
--flip
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e4:SetCountLimit(1,m)
e4:SetTarget(cm.target)
e4:SetOperation(cm.operation2)
e4:SetCode(EVENT_FLIP)
c:RegisterEffect(e4)
end
function cm.xyzfilter(c)
return (c:IsFaceup() or not c:IsLocation(LOCATION_MZONE))
and (c:IsSetCard(0x980) or not c:IsLocation(LOCATION_HAND))
end
function cm.atkfilter(c)
return c:IsSetCard(0x980) and c:IsFaceup()
end
function cm.atkval(e,c)
local g=Duel.GetMatchingGroup(cm.atkfilter,c:GetControler(),LOCATION_MZONE,0,nil)
return g:GetCount()*1350
end
--e4
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,0,1,0,0)
end
function cm.operation2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
local tc=tg:GetFirst()
Duel.SendtoGrave(tc,REASON_EFFECT)
if tc:IsSetCard(0x980) then
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetValue(cm.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function cm.aclimit(e,re,tp)
return re:GetActivateLocation()==LOCATION_HAND
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