Commit 5435633b authored by nanahira's avatar nanahira

finishscript

parent 5d8f015a
No preview for this file type
......@@ -9,6 +9,7 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_HAND)
e1:SetCost(cm.cost)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
......@@ -26,6 +27,15 @@ function cm.effect_operation_3L(c)
c:RegisterEffect(ex1,true)
return ex1
end
function cm.filter(c)
return not c:IsCode(m) and Senya.check_set_3L(c) and c:IsAbleToGraveAsCost()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttacker()
return at:GetControler()~=tp
......@@ -40,10 +50,7 @@ function cm.MergeCard(g,p,loc,seq)
end
end
function cm.GetCrossGroup(p,seq)
local g=Group.CreateGroup()
for i=0,4 do
if i~=seq then cm.MergeCard(g,p,LOCATION_MZONE,seq) end
end
local g=Duel.GetMatchingGroup(function(c) return c:GetSequence()~=seq and c:GetSequence()<5 end,p,LOCATION_MZONE,0,nil)
cm.MergeCard(g,p,LOCATION_SZONE,seq)
cm.MergeCard(g,1-p,LOCATION_MZONE,4-seq)
cm.MergeCard(g,1-p,LOCATION_SZONE,4-seq)
......@@ -60,10 +67,9 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local res={}
local zones={}
local zones={[0]=0,[1]=0}
for p=0,1 do
for seq=0,4 do
zones[p]=0
local g=cm.GetCrossGroup(p,seq)
if g:GetCount()>0 then zones[p]=zones[p] | (0x1 << seq) end
end
......@@ -75,7 +81,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
for p=0,1 do
for seq=0,4 do
local tg=cm.GetCrossGroup(p,seq)
if Duel.CheckLocation(p,LOCATION_MZONE,seq) then g:Merge(tg) do
if Duel.CheckLocation(p,LOCATION_MZONE,seq) then g:Merge(tg) end
end
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
......@@ -86,10 +92,9 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local res={}
local zones={}
local zones={[0]=0,[1]=0}
for p=0,1 do
for seq=0,4 do
zones[p]=0
local g=cm.GetCrossGroup(p,seq)
if g:GetCount()>0 then zones[p]=zones[p] | (0x1 << seq) end
end
......@@ -105,9 +110,10 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
else
return
end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK,zones[sp])>0 then
local z=zones[sp]
if Duel.SpecialSummon(c,0,tp,sp,false,false,POS_FACEUP_ATTACK,z)>0 then
Duel.Hint(HINT_MUSIC,0,m*16+4)
local dg=cm.GetCrossGroup(c:GetControler(),c:GetSequence())
local dg=cm.GetCrossGroup(sp,c:GetSequence())
Duel.BreakEffect()
local ct=Duel.Destroy(dg,REASON_EFFECT)
Duel.Damage(1-tp,ct*500,REASON_EFFECT)
......
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