Commit d934e0fa authored by nanahira's avatar nanahira

prescripts

parent 73283341
--F.A. Whip Crosser
--Scripted by Eerie Code
function c101002086.initial_effect(c)
--atk up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c101002086.atkval)
c:RegisterEffect(e1)
--activate cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(0,1)
e2:SetCost(c101002086.costchk)
e2:SetTarget(c101002086.costtg)
e2:SetOperation(c101002086.costop)
c:RegisterEffect(e2)
--accumulate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(0x10000000+101002086)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(0,1)
c:RegisterEffect(e3)
--lv up
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetCode(EVENT_CHAINING)
e0:SetRange(LOCATION_MZONE)
e0:SetOperation(aux.chainreg)
c:RegisterEffect(e0)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(101002086,0))
e4:SetCategory(CATEGORY_LVCHANGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c101002086.lvcon)
e4:SetOperation(c101002086.lvop)
c:RegisterEffect(e4)
--discard limit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(0,1)
e5:SetCode(EFFECT_CANNOT_DISCARD_HAND)
e5:SetCondition(c101002086.excon)
e5:SetValue(1)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EFFECT_CANNOT_TO_GRAVE)
e6:SetTargetRange(0,LOCATION_HAND)
c:RegisterEffect(e6)
end
function c101002086.atkval(e,c)
return c:GetLevel()*300
end
function c101002086.lvcon(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and re:GetHandler():IsSetCard(0x107) and e:GetHandler():GetFlagEffect(1)>0
end
function c101002086.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(1)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
end
function c101002086.costchk(e,te_or_c,tp)
local ct=Duel.GetFlagEffect(tp,101002086)
return Duel.CheckLPCost(tp,ct*300)
end
function c101002086.costtg(e,te,tp)
if not te:IsActiveType(TYPE_MONSTER) then return false end
local tc=te:GetHandler()
local lv=e:GetHandler():GetLevel()
if tc:GetRank()>0 then
return tc:GetOriginalRank()<lv
elseif tc:GetLevel()>0 then
return tc:GetOriginalLevel()<lv
else return false end
end
function c101002086.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.PayLPCost(tp,300)
end
function c101002086.excon(e)
return e:GetHandler():IsLevelAbove(7)
end
--F.A. Turbo Charger
--Scripted by Eerie Code
function c101002087.initial_effect(c)
--atk up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c101002087.atkval)
c:RegisterEffect(e1)
--untargetable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetTarget(c101002087.atglimit)
e2:SetValue(c101002087.atlimit)
c:RegisterEffect(e2)
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,LOCATION_MZONE)
e3:SetTarget(c101002087.tglimit)
e3:SetValue(c101002087.tgval)
c:RegisterEffect(e3)
--lv up
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetCode(EVENT_CHAINING)
e0:SetRange(LOCATION_MZONE)
e0:SetOperation(aux.chainreg)
c:RegisterEffect(e0)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(101002087,0))
e4:SetCategory(CATEGORY_LVCHANGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c101002087.lvcon)
e4:SetOperation(c101002087.lvop)
c:RegisterEffect(e4)
--actlimit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetCode(EFFECT_CANNOT_ACTIVATE)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(0,1)
e5:SetValue(c101002087.aclimit)
e5:SetCondition(c101002087.actcon)
c:RegisterEffect(e5)
end
function c101002087.atkval(e,c)
return c:GetLevel()*300
end
function c101002087.atglimit(e,c)
local lv=e:GetHandler():GetLevel()
if c:GetRank()>0 then
return c:GetOriginalRank()<lv
elseif c:GetLevel()>0 then
return c:GetOriginalLevel()<lv
else return false end
end
function c101002087.atlimit(e,c)
return c~=e:GetHandler()
end
function c101002087.tgval(e,re,rp)
if not aux.tgoval(e,re,rp) then return end
local c=re:GetHandler()
local lv=e:GetHandler():GetLevel()
if c:GetRank()>0 then
return c:GetOriginalRank()<lv
elseif c:GetLevel()>0 then
return c:GetOriginalLevel()<lv
else return false end
end
function c101002087.lvcon(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and re:GetHandler():IsSetCard(0x107) and e:GetHandler():GetFlagEffect(1)>0
end
function c101002087.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(1)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
end
function c101002087.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsImmuneToEffect(e)
end
function c101002087.actcon(e)
if not e:GetHandler():IsLevelAbove(7) then return false end
local a=Duel.GetAttacker()
local d=a:GetBattleTarget()
if a:IsControler(1-tp) then a,d=d,a end
return a and a:IsSetCard(0x107)
end
--F.A. Off-Road Grand Prix
--Scripted by Eerie Code
function c101002088.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--lv up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_LEVEL)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x107))
e2:SetValue(2)
e2:SetCondition(c101002088.lvcon)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(101002088,0))
e3:SetCategory(CATEGORY_HANDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_BATTLE_DESTROYED)
e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1,101002088)
e3:SetCondition(c101002088.descon)
e3:SetTarget(c101002088.destarg)
e3:SetOperation(c101002088.desop)
c:RegisterEffect(e3)
--to hand
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(101002088,1))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCountLimit(1,101002088+100)
e4:SetCondition(c101002088.thcon2)
e4:SetTarget(c101002088.thtg2)
e4:SetOperation(c101002088.thop2)
c:RegisterEffect(e4)
end
function c101002088.lvcon(e)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function c101002088.cfilter(c,tp)
return c:GetPreviousControler()==tp and c:IsPreviousSetCard(0x107)
end
function c101002088.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c101002088.cfilter,1,nil,tp)
end
function c101002088.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end
Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1)
end
function c101002088.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND,nil)
if g:GetCount()==0 then return end
local sg=g:RandomSelect(1-tp,1)
Duel.SendtoGrave(sg,REASON_DISCARD+REASON_EFFECT)
end
function c101002088.thcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
end
function c101002088.thfilter2(c)
return c:IsSetCard(0x107) and not c:IsCode(101002088) and c:IsAbleToHand()
end
function c101002088.thtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c101002088.thfilter2,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c101002088.thop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c101002088.thfilter2,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
--F.A. Pit Stop
--Scripted by Eerie Code
function c101002089.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_LVCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,101002089)
e1:SetTarget(c101002089.target)
e1:SetOperation(c101002089.activate)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,101002089+100)
e2:SetCondition(aux.exccon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c101002089.sptg)
e2:SetOperation(c101002089.spop)
c:RegisterEffect(e2)
end
function c101002089.filter(c)
return c:IsFaceup() and c:IsSetCard(0x107) and c:IsLevelAbove(3)
end
function c101002089.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c101002089.filter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(c101002089.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SelectTarget(tp,c101002089.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetTargetPlayer(tp)
local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,101002089)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct+1)
end
function c101002089.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local d=Duel.GetMatchingGroupCount(Card.IsCode,p,LOCATION_GRAVE,0,nil,101002089)+1
if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLevelAbove(3) and not tc:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(-2)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
Duel.Draw(p,d,REASON_EFFECT)
end
end
function c101002089.spfilter(c,e,tp)
return c:IsSetCard(0x107) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c101002089.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c101002089.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c101002089.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c101002089.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c101002089.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)
end
end
......@@ -42,7 +42,6 @@ function c101003022.initial_effect(c)
e4:SetOperation(c101003022.spop)
c:RegisterEffect(e4)
end
c101003022.spell_counter_permit=99
function c101003022.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
end
......@@ -62,7 +61,7 @@ end
function c101003022.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e)
if c:IsRelateToEffect(e)
and Duel.Destroy(c,REASON_EFFECT)~=0
and tc:IsFaceup() and tc:IsRelateToEffect(e) then
tc:AddCounter(0x1,1)
......
......@@ -48,16 +48,16 @@ function c101003023.initial_effect(c)
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5)
end
c101003023.spell_counter_permit=99
function c101003023.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
end
function c101003023.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsOnField() and chkc~=c and chkc:IsType(TYPE_SPELL+TYPE_TRAP) end
if chk==0 then return c:IsDestructable() and Duel.IsExistingTarget(Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,TYPE_SPELL+TYPE_TRAP) end
if chk==0 then return c:IsDestructable()
and Duel.IsExistingTarget(Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c,TYPE_SPELL+TYPE_TRAP) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,TYPE_SPELL+TYPE_TRAP)
local g=Duel.SelectTarget(tp,Card.IsType,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c,TYPE_SPELL+TYPE_TRAP)
g:AddCard(c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
......@@ -74,8 +74,11 @@ function c101003023.acop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x1,1)
end
end
function c101003023.cfilter(c,tp)
return c:GetSummonPlayer()==tp
end
function c101003023.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp)
return eg:IsExists(c101003023.cfilter,1,nil,1-tp)
end
function c101003023.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x1,3,REASON_COST) end
......@@ -83,8 +86,8 @@ function c101003023.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c101003023.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local g=eg:Filter(Card.IsControler,nil,1-tp):Filter(Card.IsAbleToHand,nil)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
local g=eg:Filter(c101003023.cfilter,1,nil,1-tp):Filter(Card.IsAbleToHand,nil)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and g:GetCount()>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
......
......@@ -53,7 +53,6 @@ function c101003027.initial_effect(c)
e5:SetOperation(c101003027.rmop)
c:RegisterEffect(e5)
end
c101003027.spell_counter_permit=99
function c101003027.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
end
......
......@@ -35,7 +35,6 @@ function c101003073.initial_effect(c)
e4:SetOperation(c101003073.thop)
c:RegisterEffect(e4)
end
c101003073.spell_counter_permit=99
function c101003073.acop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_PLAYER)
local c=e:GetHandler()
......
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