Commit 9c2b5973 authored by mercury233's avatar mercury233

add scripts

parent 036bba93
--リトマスの死の剣士
--Lithmus Doom Swordsman
function c100227013.initial_effect(c)
c:EnableReviveLimit()
--trap immunity
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c100227013.efilter)
c:RegisterEffect(e1)
--battle indestructable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
c:RegisterEffect(e2)
--ATK/DEF gain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(c100227013.atkcon)
e3:SetValue(3000)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e4)
--set
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(100227013,0))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_DESTROYED)
e5:SetCondition(c100227013.setcon)
e5:SetTarget(c100227013.settg)
e5:SetOperation(c100227013.setop)
c:RegisterEffect(e5)
end
function c100227013.efilter(e,te)
return te:IsActiveType(TYPE_TRAP)
end
function c100227013.filter(c)
return c:IsFaceup() and c:IsType(TYPE_TRAP)
end
function c100227013.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c100227013.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
function c100227013.setcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return rp==1-tp and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE)
and c:IsSummonType(SUMMON_TYPE_RITUAL)
end
function c100227013.setfilter(c)
return c:IsType(TYPE_TRAP) and c:IsSSetable()
end
function c100227013.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c100227013.setfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100227013.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectTarget(tp,c100227013.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
end
function c100227013.setop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsSSetable() then
Duel.SSet(tp,tc)
Duel.ConfirmCards(1-tp,tc)
end
end
--リトマスの死儀式
-- Litmus Doom Ritual
function c100227014.initial_effect(c)
aux.AddRitualProcGreaterCode(c,100227013)
--to deck
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_GRAVE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,100227014)
e1:SetTarget(c100227014.tdtg)
e1:SetOperation(c100227014.tdop)
c:RegisterEffect(e1)
end
function c100227014.tdfilter(c)
return c:IsCode(100227013) and c:IsAbleToDeck()
end
function c100227014.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100227014.tdfilter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return e:GetHandler():IsAbleToDeck()
and Duel.IsExistingTarget(c100227014.tdfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100227014.tdfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,e:GetHandler())
g:AddCard(e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100227014.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
local g=Group.FromCards(c,tc)
if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)==0 then return end
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
--時械神ミチオン
--Michion, the Timelord
--Scripted by ahtelel
function c100227021.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227021,0))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(c100227021.spcon)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetValue(1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
--damage val
local e5=e3:Clone()
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--lp
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_PHASE+PHASE_BATTLE)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(c100227021.lpcon)
e6:SetOperation(c100227021.lpop)
c:RegisterEffect(e6)
--to deck
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(100227021,1))
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_STANDBY)
e7:SetCountLimit(1)
e7:SetRange(LOCATION_MZONE)
e7:SetCondition(c100227021.tdcon)
e7:SetTarget(c100227021.tdtg)
e7:SetOperation(c100227021.tdop)
c:RegisterEffect(e7)
end
function c100227021.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c100227021.lpcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetBattledGroupCount()>0 or e:GetHandler():GetAttackedCount()>0
end
function c100227021.lpop(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(1-tp,math.ceil(Duel.GetLP(1-tp)/2))
end
function c100227021.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c100227021.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function c100227021.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end
--時械神ハイロン
--Hairon, the Timelord
--Scripted by ahtelel
function c100227022.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227022,0))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(c100227022.spcon)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetValue(1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
--damage val
local e5=e3:Clone()
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--LP
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_DAMAGE)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_PHASE+PHASE_BATTLE)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(c100227022.damcon)
e6:SetTarget(c100227022.damtg)
e6:SetOperation(c100227022.damop)
c:RegisterEffect(e6)
--to deck
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(100227022,1))
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_STANDBY)
e7:SetCountLimit(1)
e7:SetRange(LOCATION_MZONE)
e7:SetCondition(c100227022.tdcon)
e7:SetTarget(c100227022.tdtg)
e7:SetOperation(c100227022.tdop)
c:RegisterEffect(e7)
end
function c100227022.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c100227022.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetBattledGroupCount()>0 or e:GetHandler():GetAttackedCount()>0
end
function c100227022.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
local dam=0
if Duel.GetLP(tp)<Duel.GetLP(1-tp) then dam=Duel.GetLP(p)-Duel.GetLP(1-p) end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
end
function c100227022.damop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local val=Duel.GetLP(p)-Duel.GetLP(1-p)
if val>0 then
Duel.Damage(p,val,REASON_EFFECT)
end
end
function c100227022.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c100227022.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function c100227022.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end
--時械神ラフィオン
--Raphion, the Timelord
--Scripted by ahtelel
function c100227023.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227023,0))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(c100227023.spcon)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetValue(1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
--damage val
local e5=e3:Clone()
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--LP
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_DAMAGE)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_PHASE+PHASE_BATTLE)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(c100227023.damcon)
e6:SetTarget(c100227023.damtg)
e6:SetOperation(c100227023.damop)
c:RegisterEffect(e6)
--to deck
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(100227023,1))
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_STANDBY)
e7:SetCountLimit(1)
e7:SetRange(LOCATION_MZONE)
e7:SetCondition(c100227023.tdcon)
e7:SetTarget(c100227023.tdtg)
e7:SetOperation(c100227023.tdop)
c:RegisterEffect(e7)
end
function c100227023.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c100227023.damfilter(c,e)
return c:IsFaceup() and e:GetHandler():GetBattledGroup():IsContains(c)
end
function c100227023.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetBattledGroupCount()>0 or e:GetHandler():GetAttackedCount()>0
end
function c100227023.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c100227023.damop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,c100227023.damfilter,tp,0,LOCATION_MZONE,1,1,nil,e)
local tc=g:GetFirst()
if tc and c:IsRelateToEffect(e) then
local atk=tc:GetAttack()
Duel.Damage(1-tp,atk,REASON_EFFECT)
end
end
function c100227023.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c100227023.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function c100227023.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end
--時械神ガブリオン
--Gabrion, the Timelord
--Scripted by ahtelel
function c100227024.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227024,0))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(c100227024.spcon)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetValue(1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
--damage val
local e5=e3:Clone()
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--to deck
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(100227024,1))
e6:SetCategory(CATEGORY_TODECK)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_PHASE+PHASE_BATTLE)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(c100227024.tdcon)
e6:SetTarget(c100227024.tdtg)
e6:SetOperation(c100227024.tdop)
c:RegisterEffect(e6)
--to deck
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(100227024,1))
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_STANDBY)
e7:SetCountLimit(1)
e7:SetRange(LOCATION_MZONE)
e7:SetCondition(c100227024.rtdcon)
e7:SetTarget(c100227024.rtdtg)
e7:SetOperation(c100227024.rtdop)
c:RegisterEffect(e7)
end
function c100227024.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c100227024.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetBattledGroupCount()>0 or e:GetHandler():GetAttackedCount()>0
end
function c100227024.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,g:GetCount())
end
function c100227024.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil)
if g:GetCount()>0 then
local ct=Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(1-tp,ct,REASON_EFFECT)
end
end
end
function c100227024.rtdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c100227024.rtdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function c100227024.rtdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end
end
--虚無械アイン
--Emptiness
--Scripted by Eerie Code
function c100227027.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--insd via destroy replace (workaround)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_SZONE)
e2:SetTarget(c100227027.reptg)
c:RegisterEffect(e2)
--draw
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100227027,0))
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetCost(c100227027.drcost)
e3:SetTarget(c100227027.drtg)
e3:SetOperation(c100227027.drop)
c:RegisterEffect(e3)
--to deck
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100227027,0))
e4:SetCategory(CATEGORY_TODECK)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_SZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCondition(c100227027.tdcon)
e4:SetCost(c100227027.cost)
e4:SetTarget(c100227027.tdtg)
e4:SetOperation(c100227027.tdop)
c:RegisterEffect(e4)
end
function c100227027.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return e:GetHandler():IsReason(REASON_EFFECT) and c:GetReasonPlayer()~=tp and e:GetHandler():GetFlagEffect(100227027)==0 end
c:RegisterFlagEffect(100227027,RESET_EVENT+0x1fe0000,0,1)
return true
end
function c100227027.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(100227027)==0 end
c:RegisterFlagEffect(100227027,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c100227027.drfilter(c)
return c:GetLevel()==10 and c:IsDiscardable()
end
function c100227027.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100227027.drfilter,tp,LOCATION_HAND,0,1,nil)
and c100227027.cost(e,tp,eg,ep,ev,re,r,rp,0) end
Duel.DiscardHand(tp,c100227027.drfilter,1,1,REASON_COST+REASON_DISCARD)
c100227027.cost(e,tp,eg,ep,ev,re,r,rp,1)
end
function c100227027.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100227027.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c100227027.tdcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(nil,tp,LOCATION_SZONE,0,1,e:GetHandler())
end
function c100227027.tdfilter(c)
return c:IsSetCard(0x4a) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function c100227027.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100227027.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100227027.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100227027.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c100227027.setfilter(c)
return c:IsCode(100227028) and c:IsSSetable()
end
function c100227027.tdop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)~=0
and tc:IsLocation(LOCATION_DECK) then
local g=Duel.GetMatchingGroup(c100227027.setfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(100227027,2)) then
local sc=g:Select(tp,1,1,nil):GetFirst()
Duel.SSet(tp,sc)
Duel.ConfirmCards(1-tp,sc)
end
end
end
--無限械アイン・ソフ
--Endless Emptiness
--Scripted by Eerie Code
function c100227028.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c100227028.actcost)
e1:SetTarget(c100227028.acttg)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_SZONE)
e2:SetTarget(c100227028.reptg)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100227028,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c100227028.spcon)
e3:SetCost(c100227028.cost)
e3:SetTarget(c100227028.sptg)
e3:SetOperation(c100227028.spop)
c:RegisterEffect(e3)
--to deck
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100227028,1))
e4:SetCategory(CATEGORY_TODECK)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_SZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCondition(c100227028.tdcon)
e4:SetCost(c100227028.cost)
e4:SetTarget(c100227028.tdtg)
e4:SetOperation(c100227028.tdop)
c:RegisterEffect(e4)
end
function c100227028.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return e:GetHandler():IsReason(REASON_EFFECT) and c:GetReasonPlayer()~=tp and e:GetHandler():GetFlagEffect(100227028)==0 end
c:RegisterFlagEffect(100227028,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
return true
end
function c100227028.acfilter(c)
return c:IsFaceup() and c:IsCode(100227027) and c:IsAbleToGraveAsCost()
end
function c100227028.actcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100227028.acfilter,tp,LOCATION_SZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c100227028.acfilter,tp,LOCATION_SZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c100227028.acttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return c100227028.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end
if chk==0 then return true end
local b1=c100227028.spcon(e,tp,eg,ep,ev,re,r,rp)
and c100227028.cost(e,tp,eg,ep,ev,re,r,rp,0)
and c100227028.sptg(e,tp,eg,ep,ev,re,r,rp,0)
local b2=c100227028.tdcon(e,tp,eg,ep,ev,re,r,rp)
and c100227028.cost(e,tp,eg,ep,ev,re,r,rp,0)
and c100227028.tdtg(e,tp,eg,ep,ev,re,r,rp,0)
if (b1 or b2) and Duel.SelectYesNo(tp,94) then
local op=0
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(100227028,0),aux.Stringid(100227028,1))
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(100227028,0))
else
op=Duel.SelectOption(tp,aux.Stringid(100227028,1))+1
end
if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
e:SetProperty(0)
e:SetOperation(c100227028.spop)
c100227028.cost(e,tp,eg,ep,ev,re,r,rp,1)
c100227028.sptg(e,tp,eg,ep,ev,re,r,rp,1)
else
e:SetCategory(CATEGORY_TODECK)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetOperation(c100227028.tdop)
c100227028.cost(e,tp,eg,ep,ev,re,r,rp,1)
c100227028.tdtg(e,tp,eg,ep,ev,re,r,rp,1)
end
end
end
function c100227028.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(100227028)==0 end
c:RegisterFlagEffect(100227028,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c100227028.spcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function c100227028.spfilter(c,e,tp)
return c:IsSetCard(0x4a) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100227028.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100227028.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c100227028.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100227028.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c100227028.tdcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(nil,tp,LOCATION_SZONE,0,1,e:GetHandler())
end
function c100227028.tdfilter(c)
return c:IsSetCard(0x4a) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function c100227028.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100227028.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100227028.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100227028.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c100227028.setfilter(c)
return c:IsCode(100227029) and c:IsSSetable()
end
function c100227028.tdop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)~=0
and tc:IsLocation(LOCATION_DECK) then
local g=Duel.GetMatchingGroup(c100227028.setfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(100227028,2)) then
local sc=g:Select(tp,1,1,nil):GetFirst()
Duel.SSet(tp,sc)
Duel.ConfirmCards(1-tp,sc)
end
end
end
--無限光アイン・ソフ・オウル
--Infinite Light
--Scripted by Eerie Code
function c100227029.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c100227029.actcost)
e1:SetTarget(c100227029.acttg)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_SZONE)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--untarget
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x4a))
e3:SetValue(1)
c:RegisterEffect(e3)
--cannot to deck
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_TO_DECK)
e4:SetRange(LOCATION_SZONE)
e4:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x4a))
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(100227029,0))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetRange(LOCATION_SZONE)
e5:SetCondition(c100227029.spcon)
e5:SetCost(c100227029.spcost)
e5:SetTarget(c100227029.sptg)
e5:SetOperation(c100227029.spop)
c:RegisterEffect(e5)
end
function c100227029.acfilter(c)
return c:IsFaceup() and c:IsCode(100227028) and c:IsAbleToGraveAsCost()
end
function c100227029.actcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100227029.acfilter,tp,LOCATION_SZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c100227029.acfilter,tp,LOCATION_SZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c100227029.acttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if c100227029.spcon(e,tp,eg,ep,ev,re,r,rp)
and c100227029.spcost(e,tp,eg,ep,ev,re,r,rp,0)
and c100227029.sptg(e,tp,eg,ep,ev,re,r,rp,0)
and Duel.SelectYesNo(tp,94) then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
e:SetOperation(c100227029.spop)
c100227029.spcost(e,tp,eg,ep,ev,re,r,rp,1)
c100227029.sptg(e,tp,eg,ep,ev,re,r,rp,1)
end
end
function c100227029.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
end
function c100227029.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(100227029)==0 end
c:RegisterFlagEffect(100227029,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c100227029.spfilter(c,e,tp)
return c:IsSetCard(0x4a) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c100227029.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100227029.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
function c100227029.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft==0 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local g1=Duel.GetMatchingGroup(c100227029.spfilter,tp,LOCATION_HAND,0,nil)
local g2=Duel.GetMatchingGroup(c100227029.spfilter,tp,LOCATION_DECK,0,nil)
local g3=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100227029.spfilter) ,tp,LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
if g1:GetCount()>0 and ((g2:GetCount()==0 and g3:GetCount()==0) or Duel.SelectYesNo(tp,aux.Stringid(100227029,1))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=g1:Select(tp,1,1,nil)
sg:Merge(sg1)
g2:Remove(Card.IsCode,nil,sg1:GetFirst():GetCode())
g3:Remove(Card.IsCode,nil,sg1:GetFirst():GetCode())
ft=ft-1
end
if g2:GetCount()>0 and ft>0 and ((sg:GetCount()==0 and g3:GetCount()==0) or Duel.SelectYesNo(tp,aux.Stringid(100227029,2))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg2=g2:Select(tp,1,1,nil)
sg:Merge(sg2)
g3:Remove(Card.IsCode,nil,sg2:GetFirst():GetCode())
ft=ft-1
end
if g3:GetCount()>0 and ft>0 and (sg:GetCount()==0 or Duel.SelectYesNo(tp,aux.Stringid(100227029,3))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg3=g3:Select(tp,1,1,nil)
sg:Merge(sg3)
end
Duel.SpecialSummon(rg,0,tp,tp,true,false,POS_FACEUP)
end
--アイアンドロー
--Iron Draw
--Script by mercury233
function c100227034.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_SPSUMMON_COUNT)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,100227034)
e1:SetCondition(c100227034.condition)
e1:SetTarget(c100227034.target)
e1:SetOperation(c100227034.activate)
c:RegisterEffect(e1)
end
function c100227034.filter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsRace(RACE_MACHINE)
end
function c100227034.condition(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,nil)
return g:GetCount()==2 and g:FilterCount(c100227034.filter,nil)==2
end
function c100227034.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c100227034.activate(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_COUNT_LIMIT)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
--地翔星ハヤテ
-- Hayate the Earth Star
function c100227036.initial_effect(c)
--summon with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100227036,0))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c100227036.ntcon)
e1:SetValue(1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227036,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(c100227036.sptg)
e2:SetOperation(c100227036.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--negate attack
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100227036,2))
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_BE_BATTLE_TARGET)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(c100227036.condition)
e4:SetOperation(c100227036.operation)
c:RegisterEffect(e4)
end
function c100227036.cfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c100227036.ntcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and ((Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0)
or Duel.IsExistingMatchingCard(c100227036.cfilter,tp,LOCATION_MZONE,0,1,nil))
end
function c100227036.filter1(c,e,tp)
return c:IsRace(RACE_WARRIOR) and c:IsLevel(5) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100227036.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100227036.filter1,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c100227036.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100227036.filter1,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c100227036.condition(e,tp,eg,ep,ev,re,r,rp)
local d=Duel.GetAttackTarget()
return d and d:IsControler(tp) and d:IsFaceup() and d:IsRace(RACE_WARRIOR)
end
function c100227036.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() and c:IsAttackAbove(500) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
if not c:IsHasEffect(EFFECT_REVERSE_UPDATE) then
Duel.NegateAttack()
end
end
end
--天昇星テンマ
-- Tenma the Sky Star
function c100227037.initial_effect(c)
--summon with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100227037,1))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c100227037.ntcon)
e1:SetValue(1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227037,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(c100227037.sptg)
e2:SetOperation(c100227037.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--disable
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100227037,1))
e4:SetCategory(CATEGORY_NEGATE)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(c100227037.discon)
e4:SetTarget(c100227037.distg)
e4:SetOperation(c100227037.disop)
c:RegisterEffect(e4)
end
function c100227037.cfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_EARTH)
end
function c100227037.ntcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and ((Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0)
or Duel.IsExistingMatchingCard(c100227037.cfilter,tp,LOCATION_MZONE,0,1,nil))
end
function c100227037.filter1(c,e,tp)
return c:IsRace(RACE_WARRIOR) and c:IsLevel(5) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100227037.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100227037.filter1,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c100227037.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100227037.filter1,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c100227037.filter2(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsRACE(RACE_WARRIOR)
end
function c100227037.discon(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return rp==1-tp and g and g:IsExists(c100227037.filter2,1,nil,tp) and Duel.IsChainNegatable(ev)
end
function c100227037.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAttackAbove(500) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c100227037.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() and c:IsAttackAbove(500) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
if not c:IsHasEffect(EFFECT_REVERSE_UPDATE) then
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
end
end
--天融星カイキ
--Kaiki the sky star
function c100227038.initial_effect(c)
--Fusion Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100227038,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,100227038)
e1:SetCondition(c100227038.fuscon)
e1:SetCost(c100227038.fuscost)
e1:SetTarget(c100227038.fustg)
e1:SetOperation(c100227038.fusop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227038,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,100227038+100)
e2:SetCondition(c100227038.spcon)
e2:SetTarget(c100227038.sptg)
e2:SetOperation(c100227038.spop)
c:RegisterEffect(e2)
end
function c100227038.fuscon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL
end
function c100227038.fuscost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,500) end
Duel.PayLPCost(tp,500)
end
function c100227038.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function c100227038.filter2(c,e,tp,m,f)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_WARRIOR) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,tp)
end
function c100227038.fustg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetFusionMaterial(tp)
local res=Duel.IsExistingMatchingCard(c100227038.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c100227038.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100227038.fusop(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetFusionMaterial(tp):Filter(c100227038.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c100227038.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c100227038.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,tp)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,tp)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c100227038.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR)and c:IsLevelAbove(5) and c:GetAttack()~=c:GetBaseAttack()
end
function c100227038.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0
and Duel.IsExistingMatchingCard(c100227038.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c100227038.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c100227038.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--覇勝星イダテン
--Idaten, the Star of Supreme Victory
function c100227039.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,c100227039.matfilter,2,false)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100227039,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,100227039)
e1:SetCondition(c100227039.thcon)
e1:SetTarget(c100227039.thtg)
e1:SetOperation(c100227039.thop)
c:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227039,1))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c100227039.atkcost1)
e2:SetOperation(c100227039.atkop1)
c:RegisterEffect(e2)
--atkdown
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100227039,2))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e3:SetCondition(c100227039.atkcon)
e3:SetOperation(c100227039.atkop)
c:RegisterEffect(e3)
end
function c100227039.matfilter(c)
return c:IsLevelAbove(5) and c:IsRace(RACE_WARRIOR)
end
function c100227039.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c100227039.thfilter(c)
return c:IsLevelAbove(5) and c:IsRace(RACE_WARRIOR) and c:IsAbleToHand()
end
function c100227039.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100227039.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100227039.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100227039.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c100227039.atkcost1(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
local ct=Duel.DiscardHand(tp,Card.IsDiscardable,1,60,REASON_COST+REASON_DISCARD)
e:SetLabel(ct)
end
function c100227039.atkop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local atk=e:GetLabel()*200
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+0x1ff0000)
e2:SetValue(atk)
c:RegisterEffect(e2)
end
end
function c100227039.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return bc and bc:IsLevelBelow(c:GetLevel()) and bc:IsControler(1-tp)
end
function c100227039.atkop(e,tp,eg,ep,ev,re,r,rp)
local bc=e:GetHandler():GetBattleTarget()
if bc and bc:IsFaceup() and bc:IsRelateToBattle() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL)
e1:SetValue(0)
bc:RegisterEffect(e1)
end
end
--覇道星シュラ
--Shura the Combat Star
function c100227040.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,100227039,c100227040.ffilter,1,true,true)
--atk to 0
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100227040,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c100227040.atkcon)
e1:SetTarget(c100227040.atktg)
e1:SetOperation(c100227040.atkop)
c:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227040,1))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c100227040.atkcon2)
e2:SetOperation(c100227040.atkop2)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100227040,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c100227040.spcon)
e3:SetTarget(c100227040.sptg)
e3:SetOperation(c100227040.spop)
c:RegisterEffect(e3)
end
function c100227040.ffilter(c)
return c:IsRace(RACE_WARRIOR) and c:IsLevelAbove(5)
end
function c100227040.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE
and (Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated())
end
function c100227040.atkfilter(c)
return c:IsFaceup() and c:GetAttack()>0
end
function c100227040.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100227040.atkfilter,tp,0,LOCATION_MZONE,1,nil) end
end
function c100227040.atkop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
function c100227040.atkcon2(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
return d and a:GetControler()~=d:GetControler()
end
function c100227040.atkop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
if a:IsFaceup() and a:IsRelateToBattle() and d:IsFaceup() and d:IsRelateToBattle() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(a:GetLevel()*200)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL)
a:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(d:GetLevel()*200)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL)
d:RegisterEffect(e2)
end
end
function c100227040.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and rp==1-tp and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE)
end
function c100227040.spfilter(c,e,tp)
return cc:IsCode(100227039) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)
end
function c100227040.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCountFromEx(tp)>0
and Duel.IsExistingMatchingCard(c100227040.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100227040.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100227040.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
end
end
--ヴァレルガード・ドラゴン
--Borrelguard Dragon
function c100227044.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),3)
c:EnableReviveLimit()
--cannot be destroyed
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100227044,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c100227044.spcost)
e2:SetTarget(c100227044.sptg)
e2:SetOperation(c100227044.spop)
c:RegisterEffect(e2)
--position
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100227044,1))
e3:SetCategory(CATEGORY_POSITION)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetHintTiming(0,0x1e0)
e3:SetTarget(c100227044.postg)
e3:SetOperation(c100227044.posop)
c:RegisterEffect(e3)
end
function c100227044.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_SZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_SZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c100227044.spfilter(c,e,tp,tid)
return c:GetTurnID()==tid and bit.band(c:GetReason(),REASON_DESTROY)~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100227044.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tid=Duel.GetTurnCount()
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c100227044.spfilter(chkc,e,tp,tid) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c100227044.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp,tid) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c100227044.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp,tid)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c100227044.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2,true)
Duel.SpecialSummonComplete()
end
end
function c100227044.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsDefensePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefensePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,Card.IsDefensePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
Duel.SetChainLimit(c100227044.chlimit)
end
function c100227044.chlimit(e,ep,tp)
return tp==ep
end
function c100227044.posop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_ATTACK)
end
end
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