Commit 8ef7e21a authored by nanahira's avatar nanahira

pre

parent ffdb7a8d
......@@ -24,7 +24,7 @@ function c100223001.initial_effect(c)
e2:SetCode(EVENT_PAY_LPCOST)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c100223001.tgcon)
e2:SetCost(c100223001.cost)
e2:SetCost(c100223001.tgcost)
e2:SetTarget(c100223001.tgtg)
e2:SetOperation(c100223001.tgop)
c:RegisterEffect(e2)
......@@ -36,7 +36,7 @@ function c100223001.initial_effect(c)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(c100223001.cost)
e3:SetCost(c100223001.dccost)
e3:SetTarget(c100223001.dctg)
e3:SetOperation(c100223001.dcop)
c:RegisterEffect(e3)
......@@ -54,7 +54,7 @@ end
function c100223001.tgcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp
end
function c100223001.cost(e,tp,eg,ep,ev,re,r,rp,chk)
function c100223001.tgcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(100223001)==0 end
c:RegisterFlagEffect(100223001,RESET_CHAIN,0,1)
......@@ -73,9 +73,14 @@ function c100223001.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function c100223001.dccost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(100223101)==0 end
c:RegisterFlagEffect(100223101,RESET_CHAIN,0,1)
end
function c100223001.cfilter(c,e,tp)
return bit.band(c:GetPreviousRaceOnField(),RACE_FIEND)~=0 and c:IsType(TYPE_MONSTER)
and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp)
return (c:IsRace(RACE_FIEND) or bit.band(c:GetPreviousRaceOnField(),RACE_FIEND)~=0)
and c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp)
and (c:IsAbleToHand() or c:IsAbleToDeck() or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function c100223001.dctg(e,tp,eg,ep,ev,re,r,rp,chk)
......
--水精鱗-サラキアビス
--Mermail Abyssaraki
--Script by nekrozar
function c100223046.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_AQUA+RACE_FISH+RACE_SEASERPENT),2,2)
c:EnableReviveLimit()
--atk/def
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(c100223046.indtg)
e1:SetValue(500)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100223046,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,100223046)
e3:SetHintTiming(0,TIMING_END_PHASE)
e3:SetCondition(c100223046.thcon)
e3:SetCost(c100223046.thcost)
e3:SetTarget(c100223046.thtg)
e3:SetOperation(c100223046.thop)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100223046,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_DESTROYED)
e4:SetCountLimit(1,100223146)
e4:SetCondition(c100223046.spcon)
e4:SetCost(c100223046.spcost)
e4:SetTarget(c100223046.sptg)
e4:SetOperation(c100223046.spop)
c:RegisterEffect(e4)
end
function c100223046.indtg(e,c)
return e:GetHandler():GetLinkedGroup():IsContains(c)
end
function c100223046.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c100223046.thcost(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)
end
function c100223046.thfilter(c)
return c:IsSetCard(0x74) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c100223046.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100223046.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100223046.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100223046.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 c100223046.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return rp~=tp and c:GetPreviousControler()==tp
and (c:IsReason(REASON_EFFECT) or (c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp)))
end
function c100223046.spcfilter(c)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToGraveAsCost()
end
function c100223046.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100223046.spcfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c100223046.spcfilter,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c100223046.spfilter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c100223046.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100223046.spfilter(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c100223046.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c100223046.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c100223046.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
--ミレニアム・アイズ・イリュージョニスト
--Millennium-Eyes Illusionist
function c100407001.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407001,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,100407001)
e1:SetCost(c100407001.eqcost)
e1:SetTarget(c100407001.eqtg)
e1:SetOperation(c100407001.eqop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100407001,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,100407001+100)
e2:SetCondition(c100407001.thcon)
e2:SetTarget(c100407001.thtg)
e2:SetOperation(c100407001.thop)
c:RegisterEffect(e2)
end
function c100407001.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function c100407001.filter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToChangeControler()
end
function c100407001.eqfilter(c)
local m=_G["c"..c:GetCode()]
return c:IsFaceup() and ((c:IsSetCard(0x20a) and c:IsType(TYPE_FUSION)) or c:IsCode(64631466,63519819)) and m.CanEquipMonster(c)
end
function c100407001.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c100407001.filter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c100407001.filter,tp,0,LOCATION_MZONE,1,nil)
and Duel.IsExistingMatchingCard(c100407001.eqfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c100407001.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c100407001.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc1=Duel.GetFirstTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,c100407001.eqfilter,tp,LOCATION_MZONE,0,1,1,nil)
local tc2=g:GetFirst()
if not tc2 then return end
local m=_G["c"..tc2:GetCode()]
if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc1:IsControler(1-tp) then
m.EquipMonster(tc2,tp,tc1)
end
end
function c100407001.thfilter(c,e)
return (c:IsSetCard(0x20a) and c:IsType(TYPE_FUSION)) or c:IsCode(64631466,63519819)
end
function c100407001.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100407001.thfilter,1,nil)
end
function c100407001.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c100407001.thop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
end
end
--幻想魔術師・ノー・フェイス
--Magical Illusionist Faceless Mage
--Scripted by Eerie Code
function c100407002.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,100407002)
e1:SetCondition(c100407002.spcon1)
e1:SetTarget(c100407002.sptg1)
e1:SetOperation(c100407002.spop1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,100407002+100)
e2:SetCondition(c100407002.spcon2)
e2:SetTarget(c100407002.sptg2)
e2:SetOperation(c100407002.spop2)
c:RegisterEffect(e2)
end
function c100407002.cfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT)
and ((c:IsPreviousSetCard(0x20a) and bit.band(c:GetPreviousTypeOnField(),TYPE_FUSION)~=0)
or (c:GetPreviousCodeOnField()==64631466 or c:GetPreviousCodeOnField()==63519819))
and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
end
function c100407002.spcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100407002.cfilter,1,nil,tp)
end
function c100407002.sptg1(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 c100407002.spop1(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
function c100407002.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c100407002.filter(c,e,tp)
return ((c:IsSetCard(0x20a) and c:IsType(TYPE_FUSION)) or c:IsCode(64631466,63519819))
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100407002.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100407002.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c100407002.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c100407002.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c100407002.spop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--ミレニアム・アイズ・サクリファイス
--Millennium-Eyes Restrict
function c100407003.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,64631466,aux.FilterBoolFunction(Card.IsFusionType,TYPE_EFFECT),1,true,true)
--Equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407003,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1)
e1:SetCondition(c100407003.eqcon)
e1:SetTarget(c100407003.eqtg)
e1:SetOperation(c100407003.eqop)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(c100407003.atkval)
c:RegisterEffect(e2)
--def
local e3=e2:Clone()
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(c100407003.defval)
c:RegisterEffect(e3)
--disable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_DISABLE)
e4:SetRange(LOCATION_MZONE)
e4:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e4:SetTarget(c100407003.distg)
c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_CHAIN_SOLVING)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(c100407003.discon)
e6:SetOperation(c100407003.disop)
c:RegisterEffect(e6)
--atk limit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CANNOT_ATTACK)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e5:SetTarget(c100407003.distg)
c:RegisterEffect(e5)
end
function c100407003.CanEquipMonster(c)
return true
end
function c100407003.eqcon(e,tp,eg,ep,ev,re,r,rp,chk)
return ep~=tp and re:IsActiveType(TYPE_MONSTER)
end
function c100407003.eqfilter(c)
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsType(TYPE_EFFECT) and c:IsAbleToChangeControler()
end
function c100407003.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE+LOCATION_GRAVE) and chkc:IsControler(1-tp) and c100407003.eqfilter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c100407003.eqfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c100407003.eqfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c100407003.eqlimit(e,c)
return e:GetOwner()==c
end
function c100407003.EquipMonster(c,tp,tc)
if not Duel.Equip(tp,tc,c,false) then return end
--Add Equip limit
tc:RegisterFlagEffect(100407003,RESET_EVENT+0x1fe0000,0,0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c100407003.eqlimit)
tc:RegisterEffect(e1)
end
function c100407003.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) and tc:IsControler(1-tp) then
if c:IsFaceup() and c:IsRelateToEffect(e) then
c100407003.EquipMonster(c,tp,tc)
else Duel.SendtoGrave(tc,REASON_EFFECT) end
end
end
function c100407003.atkval(e,c)
local atk=0
local g=c:GetEquipGroup()
local tc=g:GetFirst()
while tc do
if tc:GetFlagEffect(100407003)~=0 and tc:IsFaceup() and tc:GetAttack()>=0 then
atk=atk+tc:GetAttack()
end
tc=g:GetNext()
end
return atk
end
function c100407003.defval(e,c)
local atk=0
local g=c:GetEquipGroup()
local tc=g:GetFirst()
while tc do
if tc:GetFlagEffect(100407003)~=0 and tc:IsFaceup() and tc:GetDefense()>=0 then
atk=atk+tc:GetDefense()
end
tc=g:GetNext()
end
return atk
end
function c100407003.disfilter(c)
return c:IsFaceup() and c:GetFlagEffect(100407003)~=0
end
function c100407003.distg(e,c)
if not c:IsFaceup() then return false end
local g=e:GetHandler():GetEquipGroup():Filter(c100407003.disfilter,nil)
local code=c:GetCode()
local code2=c:GetFlagEffectLabel(100407103)
if code2 then code=code2 end
local res=g:IsExists(Card.IsCode,1,nil,code)
if res and code2==nil and code~=c:GetOriginalCode() then
c:RegisterFlagEffect(100407103,RESET_EVENT+0x1fe0000,0,0,code)
end
return res
end
function c100407003.discon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetHandler():GetEquipGroup():Filter(c100407003.disfilter,nil)
return re:IsActiveType(TYPE_MONSTER) and g:IsExists(Card.IsCode,1,nil,re:GetHandler():GetCode())
end
function c100407003.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
--サクリファイス・フュージョン
--Relinquished Fusion
function c100407004.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c100407004.target)
e1:SetOperation(c100407004.activate)
c:RegisterEffect(e1)
--equip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100407004,0))
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(c100407004.eqcost)
e2:SetTarget(c100407004.eqtg)
e2:SetOperation(c100407004.eqop)
c:RegisterEffect(e2)
end
function c100407004.filter0(c)
return c:IsAbleToRemove()
end
function c100407004.filter1(c,e)
return c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c100407004.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) and (c:IsSetCard(0x20a) or c:IsCode(63519819))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c100407004.filter3(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove()
end
function c100407004.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c100407004.filter0,nil)
local mg2=Duel.GetMatchingGroup(c100407004.filter3,tp,LOCATION_MZONE+LOCATION_HAND+LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
local res=Duel.IsExistingMatchingCard(c100407004.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c100407004.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100407004.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c100407004.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c100407004.filter3,tp,LOCATION_MZONE+LOCATION_HAND+LOCATION_GRAVE,0,nil)
mg1:Merge(mg2)
local sg1=Duel.GetMatchingGroup(c100407004.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c100407004.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
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,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,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,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c100407004.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function c100407004.filter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToChangeControler()
end
function c100407004.eqfilter(c)
local m=_G["c"..c:GetCode()]
return c:IsFaceup() and (c:IsSetCard(0x20a) or c:IsCode(64631466,63519819)) and m.CanEquipMonster(c)
end
function c100407004.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c100407004.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100407004.filter,tp,0,LOCATION_MZONE,1,nil)
and Duel.IsExistingMatchingCard(c100407004.eqfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c100407004.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c100407004.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc1=Duel.GetFirstTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,c100407004.eqfilter,tp,LOCATION_MZONE,0,1,1,nil)
if g:GetCount()>0 then
local tc2=g:GetFirst()
local m=_G["c"..tc2:GetCode()]
if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc1:IsControler(1-tp) and tc2 then
m.EquipMonster(tc2,tp,tc1)
end
end
end
--寄生虫パラノイド
--Parasite Paranoid
--Scripted by Eerie Code
function c100407007.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407007,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,100407007)
e1:SetTarget(c100407007.eqtg)
e1:SetOperation(c100407007.eqop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100407007,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c100407007.spcon)
e2:SetTarget(c100407007.sptg)
e2:SetOperation(c100407007.spop)
c:RegisterEffect(e2)
end
function c100407007.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c100407007.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c100407007.eqlimit)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
--race
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_CHANGE_RACE)
e2:SetValue(RACE_INSECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
--cannot attack
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e3:SetValue(c100407007.atlimit)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3)
--disable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_SZONE)
e4:SetLabelObject(tc)
e4:SetCondition(c100407007.discon)
e4:SetOperation(c100407007.disop)
e4:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e4)
end
function c100407007.eqlimit(e,c)
return c==e:GetLabelObject()
end
function c100407007.atlimit(e,c)
return c:IsRace(RACE_INSECT)
end
function c100407007.disfilter(c)
return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_INSECT)
end
function c100407007.discon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
local rc=re:GetHandler()
if not tc or rc~=tc then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return g and g:IsExists(c100407007.disfilter,1,nil) and Duel.IsChainNegatable(ev)
end
function c100407007.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
function c100407007.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_SZONE)
end
function c100407007.spfilter(c,e,tp)
return c:IsRace(RACE_INSECT) and c:IsLevelAbove(7) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c100407007.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100407007.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c100407007.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,c100407007.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
end
end
--究極変異態・インセクト女王
--Ultimately Mutated Insect Queen
--Scripted by Eerie Code
function c100407008.initial_effect(c)
c:EnableUnsummonable()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c100407008.splimit)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetCondition(c100407008.indcon)
e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_INSECT))
e2:SetValue(c100407008.indval)
c:RegisterEffect(e2)
--cannot be target
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetCondition(c100407008.indcon)
e3:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_INSECT))
e3:SetValue(aux.tgoval)
c:RegisterEffect(e3)
--chain attack
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100407008,0))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DAMAGE_STEP_END)
e4:SetCondition(c100407008.atcon)
e4:SetCost(c100407008.atcost)
e4:SetOperation(c100407008.atop)
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(91512835,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e5:SetRange(LOCATION_MZONE)
e5:SetCode(EVENT_PHASE+PHASE_END)
e5:SetCountLimit(1)
e5:SetTarget(c100407008.sptg)
e5:SetOperation(c100407008.spop)
c:RegisterEffect(e5)
end
function c100407008.splimit(e,se,sp,st)
return se:IsHasType(EFFECT_TYPE_ACTIONS)
end
function c100407008.indfilter(c)
return c:IsFaceup() and c:IsRace(RACE_INSECT)
end
function c100407008.indcon(e)
return Duel.IsExistingMatchingCard(c100407008.indfilter,e:GetHandlerPlayer(),LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler())
end
function c100407008.indval(e,re,rp)
return rp~=e:GetHandlerPlayer()
end
function c100407008.atcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return Duel.GetAttacker()==c and c:IsChainAttackable(0,true)
end
function c100407008.atcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,e:GetHandler()) end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,e:GetHandler())
Duel.Release(g,REASON_COST)
end
function c100407008.atop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToBattle() then return end
Duel.ChainAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE+PHASE_DAMAGE_CAL)
c:RegisterEffect(e1)
end
function c100407008.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,91512836,0,0x4011,100,100,1,RACE_INSECT,ATTRIBUTE_EARTH) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c100407008.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,91512836,0,0x4011,100,100,1,RACE_INSECT,ATTRIBUTE_EARTH) then return end
local token=Duel.CreateToken(tp,91512836)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
--超進化の繭
--Super Cocoon of Evolution
--Scripted by Eerie Code
function c100407009.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c100407009.target)
e1:SetOperation(c100407009.activate)
c:RegisterEffect(e1)
--shuffle and draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1,100407009)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100407009.tdtg)
e2:SetOperation(c100407009.tdop)
c:RegisterEffect(e2)
end
function c100407009.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_INSECT) and c:IsReleasableByEffect()
and c:GetEquipCount()>0
end
function c100407009.filter(c,e,tp)
return c:IsRace(RACE_INSECT) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c100407009.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local loc=LOCATION_MZONE
if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then loc=0 end
return Duel.IsExistingMatchingCard(c100407009.cfilter,tp,LOCATION_MZONE,loc,1,nil)
and Duel.IsExistingMatchingCard(c100407009.filter,tp,LOCATION_DECK,0,1,nil,e,tp)
end
Duel.SetOperationInfo(0,CATEGORY_RELEASE,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c100407009.activate(e,tp,eg,ep,ev,re,r,rp)
local loc=LOCATION_MZONE
if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then loc=0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,c100407009.cfilter,tp,LOCATION_MZONE,loc,1,1,nil)
if g:GetCount()>0 and Duel.Release(g,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,c100407009.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if sg:GetCount()>0 then
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)
end
end
end
function c100407009.tdfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAbleToDeck()
end
function c100407009.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c100407009.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100407009.tdfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.IsPlayerCanDraw(tp,1) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100407009.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100407009.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
Duel.SendtoDeck(tc,nil,0,REASON_EFFECT)
if tc:IsLocation(LOCATION_DECK) then Duel.ShuffleDeck(tp) end
if tc:IsLocation(LOCATION_DECK+LOCATION_EXTRA) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
--蝕みの鱗粉
--Corrosive Scales
--Script by nekrozar
function c100407010.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCost(c100407010.cost)
e1:SetTarget(c100407010.target)
e1:SetOperation(c100407010.activate)
c:RegisterEffect(e1)
end
function c100407010.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_REMAIN_FIELD)
e1:SetProperty(EFFECT_FLAG_OATH)
e1:SetReset(RESET_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_DISABLED)
e2:SetOperation(c100407010.tgop)
e2:SetLabel(cid)
e2:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e2,tp)
end
function c100407010.tgop(e,tp,eg,ep,ev,re,r,rp)
local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
if cid~=e:GetLabel() then return end
e:GetOwner():CancelToGrave(false)
end
function c100407010.filter(c)
return c:IsFaceup() and c:IsRace(RACE_INSECT)
end
function c100407010.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c100407010.filter(chkc) end
if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE)
and Duel.IsExistingTarget(c100407010.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c100407010.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c100407010.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
if not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
c:CancelToGrave()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(c100407010.eqlimit)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetCondition(c100407010.atkcon1)
e2:SetValue(c100407010.atktg)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetCondition(c100407010.ctcon1)
e3:SetOperation(c100407010.ctop)
c:RegisterEffect(e2)
local e4=e3:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetCode(EVENT_CHAINING)
e5:SetRange(LOCATION_SZONE)
e5:SetOperation(aux.chainreg)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_CHAIN_SOLVED)
e6:SetRange(LOCATION_SZONE)
e6:SetCondition(c100407010.ctcon2)
e6:SetOperation(c100407010.ctop)
c:RegisterEffect(e6)
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_UPDATE_ATTACK)
e7:SetRange(LOCATION_SZONE)
e7:SetTargetRange(0,LOCATION_MZONE)
e7:SetCondition(c100407010.atkcon2)
e7:SetValue(c100407010.atkval)
c:RegisterEffect(e7)
local e8=e7:Clone()
e8:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e8)
else
c:CancelToGrave(false)
end
end
function c100407010.eqlimit(e,c)
return c:IsRace(RACE_INSECT) or e:GetHandler():GetEquipTarget()==c
end
function c100407010.atkcon1(e)
local ec=e:GetHandler():GetEquipTarget()
return ec and ec:GetControler()==e:GetHandlerPlayer()
end
function c100407010.atktg(e,c)
return c~=e:GetHandler():GetEquipTarget()
end
function c100407010.cfilter(c,tp)
return c:GetSummonPlayer()==tp
end
function c100407010.ctcon1(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and eg:IsExists(c100407010.cfilter,1,nil,1-tp)
end
function c100407010.ctop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,100407010)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
tc:AddCounter(0x1045,1)
tc=g:GetNext()
end
end
function c100407010.ctcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and ep~=tp and e:GetHandler():GetFlagEffect(1)>0
end
function c100407010.atkcon2(e)
return e:GetHandler():GetEquipTarget()
end
function c100407010.atkval(e,c)
return c:GetCounter(0x1045)*-100
end
--BM-4 ボムスパイダー
--BM-4 Bomb Spider
--Scripted by Eerie Code
function c100407014.initial_effect(c)
--Destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407014,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c100407014.destg)
e1:SetOperation(c100407014.desop)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100407014,1))
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,100407014)
e2:SetCondition(c100407014.damcon1)
e2:SetTarget(c100407014.damtg)
e2:SetOperation(c100407014.damop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c100407014.damcon2)
c:RegisterEffect(e3)
end
function c100407014.desfilter(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_DARK)
end
function c100407014.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c100407014.desfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c100407014.desfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,1,nil)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0)
end
function c100407014.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 then
Duel.Destroy(tg,REASON_EFFECT)
end
end
function c100407014.damcon1(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local bc=tc:GetBattleTarget()
return tc:GetPreviousControler()~=tp and tc:IsLocation(LOCATION_GRAVE)
and bc:IsControler(tp) and bc:GetOriginalAttribute()==ATTRIBUTE_DARK and bc:GetOriginalRace()==RACE_MACHINE
end
function c100407014.damfilter1(c,tp)
return c:IsReason(REASON_EFFECT) and c:IsReason(REASON_DESTROY) and c:IsLocation(LOCATION_GRAVE) and c:GetPreviousControler()~=tp
end
function c100407014.damcon2(e,tp,eg,ep,ev,re,r,rp)
if not re then return false end
local rc=re:GetHandler()
return rc:IsControler(tp) and rc:GetOriginalAttribute()==ATTRIBUTE_DARK
and rc:GetOriginalRace()==RACE_MACHINE
and eg:IsExists(c100407014.damfilter1,1,nil,tp)
end
function c100407014.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
function c100407014.damfilter2(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsReason(REASON_DESTROY) and c:IsLocation(LOCATION_GRAVE) and c:GetPreviousControler()~=tp
end
function c100407014.damop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c100407014.damfilter2,nil,tp)
if g:GetCount()>0 then
if g:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
g=g:Select(tp,1,1,nil)
end
Duel.Damage(1-tp,math.ceil(g:GetFirst():GetBaseAttack()/2),REASON_EFFECT)
end
end
-- デスペラード・リボルバー・ドラゴン
--Desperado Barrel Dragon
function c100407015.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407015,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_DESTROYED)
e1:SetCondition(c100407015.condition)
e1:SetTarget(c100407015.target)
e1:SetOperation(c100407015.operation)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100407015,1))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_COIN+CATEGORY_DRAW)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c100407015.descon)
e2:SetCost(c100407015.descost)
e2:SetTarget(c100407015.destg)
e2:SetOperation(c100407015.desop)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100407015,2))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetTarget(c100407015.thtg)
e3:SetOperation(c100407015.thop)
c:RegisterEffect(e3)
end
c100407015.toss_coin=true
function c100407015.filter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and bit.band(c:GetPreviousRaceOnField(),RACE_MACHINE)~=0
and bit.band(c:GetPreviousAttributeOnField(),ATTRIBUTE_DARK)~=0 and c:GetPreviousControler()==tp
and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
end
function c100407015.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100407015.filter,1,nil,tp)
end
function c100407015.target(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 c100407015.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function c100407015.descon(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE)
end
function c100407015.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function c100407015.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,3)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100407015.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()==0 then return end
local c1,c2,c3=Duel.TossCoin(tp,3)
local ct=c1+c2+c3
if ct==0 then return end
if ct>g:GetCount() then ct=g:GetCount() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=g:Select(tp,1,ct,nil)
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
if c1+c2+c3==3 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function c100407015.thfilter(c)
return c.toss_coin and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(7) and c:IsAbleToHand()
end
function c100407015.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407015.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100407015.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100407015.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
--銃砲撃
--Gun Cannon Shot
--Script by nekrozar
function c100407017.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--coin
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c100407017.regcon)
e2:SetOperation(c100407017.regop)
c:RegisterEffect(e2)
--coin result
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100407017,0))
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_CHAINING)
e3:SetRange(LOCATION_GRAVE)
e3:SetCondition(c100407017.coincon1)
e3:SetCost(aux.bfgcost)
e3:SetOperation(c100407017.coinop1)
c:RegisterEffect(e3)
end
function c100407017.regcon(e,tp,eg,ep,ev,re,r,rp)
local ex=Duel.GetOperationInfo(ev,CATEGORY_COIN)
return ex
end
function c100407017.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TOSS_COIN)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(c100407017.effcon)
e1:SetOperation(c100407017.effop)
e1:SetLabelObject(re)
e1:SetReset(RESET_EVENT+0x1fc0000+RESET_CHAIN)
c:RegisterEffect(e1)
end
function c100407017.effcon(e,tp,eg,ep,ev,re,r,rp)
return re==e:GetLabelObject()
end
function c100407017.effop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,100407017)
local ct=0
local res={Duel.GetCoinResult()}
for i=1,ev do
if res[i]==1 then
ct=ct+1
end
end
if ct>0 then
Duel.Damage(1-tp,500,REASON_EFFECT)
end
if ct>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end
end
if ct>2 then
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if hg:GetCount()>0 then
Duel.ConfirmCards(tp,hg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local sg=hg:Select(tp,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_DISCARD)
Duel.ShuffleHand(1-tp)
end
end
end
function c100407017.coincon1(e,tp,eg,ep,ev,re,r,rp)
local ex,eg,et,cp,ct=Duel.GetOperationInfo(ev,CATEGORY_COIN)
if ex and ct>1 then
e:SetLabelObject(re)
return true
else return false end
end
function c100407017.coinop1(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TOSS_COIN_NEGATE)
e1:SetCountLimit(1)
e1:SetCondition(c100407017.coincon2)
e1:SetOperation(c100407017.coinop2)
e1:SetLabelObject(e:GetLabelObject())
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
end
function c100407017.coincon2(e,tp,eg,ep,ev,re,r,rp)
return re==e:GetLabelObject()
end
function c100407017.coinop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,100407017)
local res={Duel.GetCoinResult()}
local ct=ev
for i=1,ct do
res[i]=1
end
Duel.SetCoinResult(table.unpack(res))
end
--アームド・ドラゴン・カタパルトキャノン
--Armed Dragon Catapult Cannon
--Scripted by Eerie Code
function c100407021.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode2(c,84243274,73879377,true,true)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c100407021.splimit)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c100407021.spcon)
e2:SetOperation(c100407021.spop)
c:RegisterEffect(e2)
--cannot activate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,1)
e3:SetValue(c100407021.aclimit)
c:RegisterEffect(e3)
--remove
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100407021,0))
e4:SetCategory(CATEGORY_REMOVE)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetHintTiming(0,0x1e0)
e4:SetCondition(c100407021.rmcon)
e4:SetCost(c100407021.rmcost)
e4:SetTarget(c100407021.rmtg)
e4:SetOperation(c100407021.rmop)
c:RegisterEffect(e4)
if not c100407021.global_flag then
c100407021.global_flag=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c100407021.regop)
Duel.RegisterEffect(ge1,0)
end
end
function c100407021.regop(e,tp,eg,ep,ev,re,r,rp)
for tc in aux.Next(eg) do
if tc:IsCode(84243274) then
Duel.RegisterFlagEffect(tc:GetSummonPlayer(),100407021,0,0,0)
elseif tc:IsCode(73879377) then
Duel.RegisterFlagEffect(tc:GetSummonPlayer(),100407021+100,0,0,0)
end
end
end
function c100407021.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function c100407021.cfilter(c)
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsFusionCode(84243274,73879377) and c:IsAbleToRemoveAsCost()
end
function c100407021.fcheck(c,sg,g,code,...)
if not c:IsFusionCode(code) then return false end
if ... then
g:AddCard(c)
local res=sg:IsExists(c100407021.fcheck,1,g,sg,g,...)
g:RemoveCard(c)
return res
else return true end
end
function c100407021.fselect(c,tp,mg,sg,...)
sg:AddCard(c)
local res=false
if sg:GetCount()<2 then
res=mg:IsExists(c100407021.fselect,1,sg,tp,mg,sg,...)
elseif Duel.GetLocationCountFromEx(tp,tp,sg)>0 then
local g=Group.CreateGroup()
res=sg:IsExists(c100407021.fcheck,1,nil,sg,g,...)
end
sg:RemoveCard(c)
return res
end
function c100407021.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(c100407021.cfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
return Duel.GetFlagEffect(tp,100407021)>0 and Duel.GetFlagEffect(tp,100407021+100)>0
and mg:IsExists(c100407021.fselect,1,nil,tp,mg,sg,84243274,73879377)
end
function c100407021.spop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(c100407021.cfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil)
local sg=Group.CreateGroup()
while sg:GetCount()<2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=mg:FilterSelect(tp,c100407021.fselect,1,1,sg,tp,mg,sg,84243274,73879377)
sg:Merge(g)
end
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c100407021.acfilter(c,code)
return c:IsFaceup() and c:IsCode(code)
end
function c100407021.aclimit(e,re,tp)
return Duel.IsExistingMatchingCard(c100407021.acfilter,e:GetHandlerPlayer(),LOCATION_REMOVED,LOCATION_REMOVED,1,nil,re:GetHandler():GetCode())
and not re:GetHandler():IsImmuneToEffect(e)
end
function c100407021.rmcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c100407021.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c100407021.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end
function c100407021.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
--おジャマ改造
--Ojamadification
--Scripted by Eerie Code
function c100407022.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c100407022.cost)
e1:SetTarget(c100407022.target)
e1:SetOperation(c100407022.activate)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100407022.drtg)
e2:SetOperation(c100407022.drop)
c:RegisterEffect(e2)
end
function c100407022.ffilter(c,e,tp)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT)
and c.material and Duel.IsExistingMatchingCard(c100407022.cfilter,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE,0,1,nil,c,e,tp)
end
function c100407022.cfilter(c,fc,e,tp)
if c:IsSetCard(0xf) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() then
if e and tp then
return Duel.IsExistingMatchingCard(c100407022.filter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK,0,1,c,fc,e,tp)
else return true end
else return false end
end
function c100407022.filter(c,fc,e,tp)
return c:IsCode(table.unpack(fc.material)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100407022.cfilter2(c,g,mg,ft,rm)
if not rm and ft==0 and not c:IsLocation(LOCATION_MZONE) then return false end
local g2=g:Clone()
g2:AddCard(c)
local mg2=mg:Clone()
mg2:Sub(g2)
return mg2:GetClassCount(Card.GetCode)>=g2:GetCount()
end
function c100407022.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407022.ffilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local rc=Duel.SelectMatchingCard(tp,c100407022.ffilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
Duel.ConfirmCards(1-tp,rc)
e:SetLabelObject(rc)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100407022.filter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK,0,nil,rc,e,tp)
local rg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100407022.cfilter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE,0,nil)
local g=Group.CreateGroup()
local rm=(ft>0)
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sc=rg:FilterSelect(tp,c100407022.cfilter2,1,1,nil,g,mg,ft,rm):GetFirst()
g:AddCard(sc)
rg:RemoveCard(sc)
mg:RemoveCard(sc)
if not sc:IsLocation(LOCATION_MZONE) then ft=ft-1 end
until g:GetCount()==5 or rg:GetCount()==0 or mg:GetClassCount(Card.GetCode)==g:GetCount()
or (ft==0 and not rg:IsExists(Card.IsLocation,1,nil,LOCATION_MZONE))
or not Duel.SelectYesNo(tp,aux.Stringid(100407022,0))
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(Duel.GetOperatedGroup():GetCount())
end
function c100407022.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,e:GetLabel(),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE)
end
function c100407022.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local ct=e:GetLabel()
if ft<ct then return end
local rc=e:GetLabelObject()
local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100407022.filter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_DECK,0,nil,rc,e,tp)
if mg:GetClassCount(Card.GetCode)<ct then return end
local g=Group.CreateGroup()
while ct>0 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=mg:Select(tp,1,1,nil)
g:AddCard(sg:GetFirst())
mg:Remove(Card.IsCode,nil,sg:GetFirst():GetCode())
ct=ct-1
end
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
function c100407022.tdfilter(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER)
and c:IsSetCard(0xf) and c:IsAbleToDeck()
end
function c100407022.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c100407022.tdfilter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(c100407022.tdfilter,tp,LOCATION_REMOVED,0,3,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100407022.tdfilter,tp,LOCATION_REMOVED,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100407022.drop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()<=0 then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
--おジャマッチング
--Ojamatching
--Scripted by Eerie Code
function c100407023.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c100407023.cost)
e1:SetTarget(c100407023.target)
e1:SetOperation(c100407023.activate)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100407023.drtg)
e2:SetOperation(c100407023.drop)
c:RegisterEffect(e2)
end
function c100407023.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function c100407023.cfilter(c,tp)
return c:IsSetCard(0xf) and (c:IsFaceup() or not c:IsOnField()) and c:IsAbleToGraveAsCost()
and Duel.IsExistingMatchingCard(c100407023.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,c,c:GetCode())
and Duel.IsExistingMatchingCard(c100407023.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,c)
end
function c100407023.filter1(c,cd)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xf) and not c:IsCode(cd) and c:IsAbleToHand()
end
function c100407023.filter2(c)
return c:IsType(TYPE_MONSTER) and (c:IsCode(59464593,980973,46384672,73879377,65192027,89189982) or c:IsSetCard(0x20f)) and c:IsAbleToHand()
end
function c100407023.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if e:GetLabel()~=1 then return false end
e:SetLabel(0)
return Duel.IsExistingMatchingCard(c100407023.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler(),tp)
end
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c100407023.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,e:GetHandler(),tp)
e:SetLabelObject(g:GetFirst())
Duel.SendtoGrave(g,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c100407023.activate(e,tp,eg,ep,ev,re,r,rp)
local sc=e:GetLabelObject()
local g1=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100407023.filter1),tp,LOCATION_DECK+LOCATION_GRAVE,0,sc,sc:GetCode())
local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100407023.filter2),tp,LOCATION_DECK+LOCATION_GRAVE,0,sc)
if g1:GetCount()==0 or g2:GetCount()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=g1:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local gg=g2:Select(tp,1,1,nil)
g:Merge(gg)
if g:GetCount()==2 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
Duel.ConfirmCards(1-tp,g)
local og=Duel.GetOperatedGroup():Filter(Card.IsSummonable,nil,true,nil)
if og:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(100407023,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local sg=og:Select(tp,1,1,nil):GetFirst()
Duel.Summon(tp,sg,true,nil)
end
end
end
function c100407023.tdfilter(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0xf) and c:IsAbleToDeck()
end
function c100407023.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c100407023.tdfilter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(c100407023.tdfilter,tp,LOCATION_REMOVED,0,3,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100407023.tdfilter,tp,LOCATION_REMOVED,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c100407023.drop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()<=0 then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
--古代の機械素体
--Ancient Gearframe
--Scripted by Eerie Code
function c100407030.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407030,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,100407030)
e1:SetCost(c100407030.thcost)
e1:SetTarget(c100407030.thtg)
e1:SetOperation(c100407030.thop)
c:RegisterEffect(e1)
--actlimit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(0,1)
e2:SetValue(c100407030.aclimit)
e2:SetCondition(c100407030.actcon)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(51205763,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c100407030.spcon)
e3:SetTarget(c100407030.sptg)
e3:SetOperation(c100407030.spop)
c:RegisterEffect(e3)
end
function c100407030.thcost(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)
end
function c100407030.thfilter(c)
return (c:IsCode(83104731) or (c:IsType(TYPE_SPELL+TYPE_TRAP) and aux.IsCodeListed(c,83104731))) and c:IsAbleToHand()
end
function c100407030.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407030.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100407030.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100407030.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 c100407030.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function c100407030.actcon(e)
return Duel.GetAttacker()==e:GetHandler()
end
function c100407030.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousPosition(POS_FACEUP) and c:GetLocation()~=LOCATION_DECK
and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp
end
function c100407030.spfilter(c,e,tp)
return c:IsCode(83104731,95735217) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c100407030.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c100407030.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c100407030.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),3)
if ft<1 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100407030.spfilter,tp,LOCATION_HAND,0,1,ft,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
end
end
--古代の機械超巨人
--Megaton Ancient Gear Golem
--Scripted by Eerie Code
function c100407031.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x7),3,true)
--multi attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c100407031.condition)
e1:SetOperation(c100407031.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_MATERIAL_CHECK)
e2:SetValue(c100407031.valcheck)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--actlimit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,1)
e3:SetValue(c100407031.aclimit)
e3:SetCondition(c100407031.actcon)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100407031,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e4:SetCondition(c100407031.spcon)
e4:SetTarget(c100407031.sptg)
e4:SetOperation(c100407031.spop)
c:RegisterEffect(e4)
end
function c100407031.valcheck(e,c)
e:GetLabelObject():SetLabel(c:GetMaterial():FilterCount(Card.IsCode,nil,83104731,95735217))
end
function c100407031.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c100407031.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabel()
if ct>=2 then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100407031,1))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetValue(ct-1)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
end
end
function c100407031.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function c100407031.actcon(e)
return Duel.GetAttacker()==e:GetHandler()
end
function c100407031.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_FUSION) and c:GetReasonPlayer()~=tp
and c:IsReason(REASON_EFFECT) and c:IsPreviousPosition(POS_FACEUP)
end
function c100407031.spfilter(c,e,tp)
return c:IsCode(12652643) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c100407031.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCountFromEx(tp)>0
and Duel.IsExistingMatchingCard(c100407031.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100407031.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,c100407031.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
end
end
--古代の機械融合
--Ancient Gear Fusion
--Scripted by Eerie Code
function c100407032.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c100407032.target)
e1:SetOperation(c100407032.activate)
c:RegisterEffect(e1)
end
c100407032.card_code_list={83104731}
function c100407032.fcheck(tp,sg,fc,mg)
if sg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then
return sg:IsExists(c100407032.filterchk,1,nil) end
return true
end
function c100407032.filterchk(c)
return c:IsFaceup() and c:IsCode(83104731,95735217) and c:IsOnField()
end
function c100407032.filter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave()
end
function c100407032.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function c100407032.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x7) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c100407032.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg=Duel.GetFusionMaterial(tp)
local mg2=Duel.GetMatchingGroup(c100407032.filter0,tp,LOCATION_DECK,0,nil)
if mg2:GetCount()>0 then
mg:Merge(mg2)
aux.FCheckAdditional=c100407032.fcheck
end
local res=Duel.IsExistingMatchingCard(c100407032.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg,nil,chkf)
aux.FCheckAdditional=nil
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c100407032.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
end
function c100407032.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c100407032.filter1,nil,e)
local mg2=Duel.GetMatchingGroup(c100407032.filter0,tp,LOCATION_DECK,0,nil)
if mg2:GetCount()>0 then
mg1:Merge(mg2)
aux.FCheckAdditional=c100407032.fcheck
end
local sg1=Duel.GetMatchingGroup(c100407032.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
aux.FCheckAdditional=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(c100407032.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
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 not tc then return end
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
aux.FCheckAdditional=c100407032.fcheck
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
aux.FCheckAdditional=nil
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,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
--究極宝玉神 レインボー・オーバー・ドラゴン
--Ultimate Crystal God Rainbow Over Dragon
--Scripted by Eerie Code
function c100407037.initial_effect(c)
--fusion summon
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x1034),7,true)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.fuslimit)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c100407037.hspcon)
e2:SetOperation(c100407037.hspop)
c:RegisterEffect(e2)
--atk up
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetDescription(aux.Stringid(100407037,0))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCost(c100407037.atkcost)
e3:SetOperation(c100407037.atkop)
c:RegisterEffect(e3)
--to deck
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(100407037,1))
e4:SetCategory(CATEGORY_TODECK)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c100407037.tdcon)
e4:SetCost(c100407037.tdcost)
e4:SetTarget(c100407037.tdtg)
e4:SetOperation(c100407037.tdop)
c:RegisterEffect(e4)
end
function c100407037.hspfilter(c,tp,sc)
return c:IsSetCard(0x2034) and c:GetLevel()==10 and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,sc,c)>0
end
function c100407037.hspcon(e,c)
if c==nil then return true end
return Duel.CheckReleaseGroup(c:GetControler(),c100407037.hspfilter,1,nil,c:GetControler(),c)
end
function c100407037.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.SelectReleaseGroup(tp,c100407037.hspfilter,1,1,nil,tp,c)
Duel.Release(g,REASON_COST)
end
function c100407037.cfilter(c)
return c:IsSetCard(0x1034) and c:GetAttack()>0 and c:IsAbleToRemoveAsCost()
end
function c100407037.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407037.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c100407037.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(g:GetFirst():GetAttack())
end
function c100407037.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(e:GetLabel())
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c100407037.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c100407037.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c100407037.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function c100407037.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
--虹の架け橋
--Rainbow Bridge
--Scripted by Eerie Code
function c100407038.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c100407038.target)
e1:SetOperation(c100407038.activate)
c:RegisterEffect(e1)
end
function c100407038.filter(c)
return c:IsSetCard(0x34) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c100407038.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407038.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100407038.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100407038.filter,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
--宝玉の絆
--Crystal Bonds
--Script by nekrozar
function c100407039.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,100407039+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c100407039.target)
e1:SetOperation(c100407039.activate)
c:RegisterEffect(e1)
end
function c100407039.thfilter(c,tp)
return c:IsSetCard(0x1034) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
and Duel.IsExistingMatchingCard(c100407039.plfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode())
end
function c100407039.plfilter(c,code)
return c:IsSetCard(0x1034) and c:IsType(TYPE_MONSTER) and not c:IsCode(code) and not c:IsForbidden()
end
function c100407039.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=0
if e:GetHandler():IsLocation(LOCATION_HAND) then ft=1 end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft
and Duel.IsExistingMatchingCard(c100407039.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c100407039.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g1=Duel.SelectMatchingCard(tp,c100407039.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if g1:GetCount()>0 Duel.SendtoHand(g1,nil,REASON_EFFECT)~=0 and g1:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g1)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g2=Duel.SelectMatchingCard(tp,c100407039.plfilter,tp,LOCATION_DECK,0,1,1,nil,g1:GetFirst():GetCode())
local tc=g2:GetFirst()
if tc then
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
e1:SetReset(RESET_EVENT+0x1fc0000)
tc:RegisterEffect(e1)
Duel.RaiseEvent(tc,EVENT_CUSTOM+47408488,e,0,tp,0,0)
end
end
end
--究極宝玉陣
--Ultimate Crystal Formation
--Scripted by Eerie Code
function c100407040.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c100407040.condition)
e1:SetCost(c100407040.cost)
e1:SetTarget(c100407040.target)
e1:SetOperation(c100407040.activate)
c:RegisterEffect(e1)
--place
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c100407040.plcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100407040.pltg)
e2:SetOperation(c100407040.plop)
c:RegisterEffect(e2)
end
function c100407040.confilter(c,tp)
return c:IsPreviousSetCard(0x1034) and c:GetPreviousControler()==tp
end
function c100407040.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100407040.confilter,1,nil,tp)
end
function c100407040.cfilter(c)
return c:IsSetCard(0x1034) and (c:IsFaceup() or not c:IsLocation(LOCATION_ONFIELD)) and c:IsAbleToGraveAsCost()
end
function c100407040.exfilter(c,tp)
return Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c))>0
end
function c100407040.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c100407040.cfilter,tp,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_DECK,0,nil)
if chk==0 then return g:GetClassCount(Card.GetCode)>=7
and (Duel.GetLocationCountFromEx(tp)>0 or g:IsExists(c100407040.exfilter,1,nil,tp)) end
local rg=Group.CreateGroup()
local ft=Duel.GetLocationCountFromEx(tp)
for i=1,7 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=nil
if ft<1 then
tc=g:FilterSelect(tp,c100407040.exfilter,1,1,nil,tp):GetFirst()
ft=1
else
tc=g:Select(tp,1,1,nil):GetFirst()
end
if tc then
rg:AddCard(tc)
g:Remove(Card.IsCode,nil,tc:GetCode())
end
end
Duel.SendtoGrave(rg,REASON_COST)
end
function c100407040.filter(c,e,tp)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x2034) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)
end
function c100407040.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100407040.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100407040.activate(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,c100407040.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
function c100407040.plcfilter(c,tp)
return c:IsPreviousSetCard(0x2034) and c:GetPreviousControler()==tp
and c:IsPreviousPosition(POS_FACEUP) and c:GetReasonPlayer()~=tp
and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
end
function c100407040.plcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c100407040.plcfilter,1,nil,tp)
end
function c100407040.plfilter(c)
return c:IsSetCard(0x1034) and c:IsType(TYPE_MONSTER) and not c:IsForbidden()
end
function c100407040.pltg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c100407040.plfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
end
function c100407040.plop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE)
if ft<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,c100407040.plfilter,tp,LOCATION_GRAVE,0,1,ft,nil)
if g:GetCount()>0 then
local tc=g:GetFirst()
while tc do
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fc0000)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
Duel.RaiseEvent(g,EVENT_CUSTOM+47408488,e,0,tp,0,0)
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