Commit 4ebf16b8 authored by Huangnan's avatar Huangnan

fix

parent cfef0aad
Pipeline #23803 passed with stages
in 26 minutes and 44 seconds
--库函数
BiAn={}
------------------------------------------------------public--------------------------------------------------
public=public or {}
--------------------返回自己场上的属性种类数
function public.getattcount(e,c)
local tp=e:GetHandlerPlayer()
local att=0
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
att=bit.bor(att,tc:GetAttribute())
tc=g:GetNext()
end
local ct=0
while att~=0 do
if bit.band(att,0x1)~=0 then ct=ct+1 end
att=bit.rshift(att,1)
end
return ct
end
--------------------召唤词--------------------------
function public.dialog(c,m,first,last)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(public.txtop)
e1:SetLabel(first,last)
c:RegisterEffect(e1)
return e1
end
function public.txtop(e,tp,eg,ep,ev,re,r,rp)
local first,last=e:GetLabel()
while first>last do
Duel.Hint(24,0,aux.Stringid(m,first))
first=first+1
end
end
-------------------------------------------------------alice--------------------------------------------------
alice={}
alice.loaded_metatable_list={}
function alice.load_metatable(code)
local m1=_G["c"..code]
if m1 then return m1 end
local m2=alice.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
alice.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
--爱丽丝融合怪兽特招效果
function alice.tgsp(c,m)
--SpecialSummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,1))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,m)
e1:SetCondition(alice.spcon)
e1:SetTarget(alice.sptg)
e1:SetOperation(alice.spop)
c:RegisterEffect(e1)
return e1
end
--SpecialSummon
function alice.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function alice.spfilter(c,e,tp)
local code=10050001
if e:GetHandler():IsCode(10050071) then
code=10050005
end
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsCode(code) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
end
function alice.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(alice.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function alice.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 tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(alice.spfilter),tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp)
if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end
end
--爱丽丝检索融合效果
function alice.getfusion(c,m)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCountLimit(1,m)
e2:SetTarget(alice.thtg)
e2:SetOperation(alice.thop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
return e2
end
--SearchCard
function alice.thfilter(c)
return c:IsCode(10050021) and c:IsAbleToHand()
end
function alice.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(alice.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function alice.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstMatchingCard(alice.thfilter,tp,LOCATION_DECK,0,nil)
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--------------------------------------------------少女前线-------------------------------------------------------------
--Grils frontline
frontline={}
frontline.loaded_metatable_list={}
function frontline.load_metatable(code)
local m1=_G["c"..code]
if m1 then return m1 end
local m2=frontline.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
frontline.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
function frontline.equip(c,m)
--equip
local e2=Effect.CreateEffect(c,m)
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(frontline.eqtg)
e2:SetOperation(frontline.eqop)
c:RegisterEffect(e2)
return e2
end
--Equip
function frontline.filter(c)
return c:IsFaceup() and c:IsSetCard(0x251) and c:IsType(TYPE_MONSTER)
end
function frontline.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and frontline.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(frontline.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,frontline.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
end
function frontline.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
--迷镜魇 征服
Duel.LoadScript("c47350500.lua")
local s,id=GetID()
function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc,tp,0) end
if chk==0 then
return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil,tp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil,tp,0)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(frontline.eqlimit)
c:RegisterEffect(e1)
end
function frontline.eqlimit(e,c)
return c:IsSetCard(0x251)
end
-------------------------------------------------------------塔罗-------------------------------------------------
tarot={}
tarot.loaded_metatable_list={}
tarot.beiao=10060001
function tarot.load_metatable(code)
local m1=_G["c"..code]
if m1 then return m1 end
local m2=tarot.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
tarot.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
--special summon
function tarot.sp(c,m)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(tarot.beiao,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m)
e1:SetCondition(tarot.spcon1)
e1:SetOperation(tarot.spop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(tarot.beiao,2))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,m)
e2:SetCondition(tarot.spcon2)
c:RegisterEffect(e2)
return e1,e2
end
--SpecialSummon
function tarot.rfilter(c,tp)
return Duel.GetMZoneCount(tp,c)>0
end
function tarot.spcon1(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.CheckReleaseGroup(tp,tarot.rfilter,1,nil,tp)
end
function tarot.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectReleaseGroup(tp,tarot.rfilter,1,1,nil,tp)
Duel.Release(g,REASON_COST)
end
function tarot.cfilter(c)
return c:IsFaceup() and c:IsCode(tarot.beiao)
end
function tarot.spcon2(e)
local ft=Duel.GetLocationCount(e:GetHandlerPlayer(),LOCATION_MZONE)
return Duel.IsExistingMatchingCard(tarot.cfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) and ft>0
end
-------------------------------------------------------------刹娜-------------------------------------------------
chana={}
chana.loaded_metatable_list={}
function chana.load_metatable(code)
local m1=_G["c"..code]
if m1 then return m1 end
local m2=chana.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
chana.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
--copy effect
function chana.effect0(c,m)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,m)
e1:SetOperation(chana.copyop)
return e1
end
function chana.copyop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
if tc and c:IsRelateToEffect(e) and c:IsFaceup() then
--ATTRIBUTE
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e0:SetValue(tc:GetAttribute())
e0:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
c:RegisterEffect(e0)
--effect
local code=tc:GetOriginalCodeRule()
local cid=0
local e1=Effect.CreateEffect(c)
if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e)
and Duel.MoveToField(tc,tp,tc:GetOwner(),LOCATION_SZONE,POS_FACEDOWN,true) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(code)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
c:RegisterEffect(e1)
if not tc:IsType(TYPE_TRAPMONSTER) then
cid=c:CopyEffect(code,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,1)
end
local e2=Effect.CreateEffect(c)
--e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END+RESET_OPPO_TURN)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e2:SetLabelObject(e1)
e2:SetLabel(cid)
e2:SetOperation(chana.rstop)
c:RegisterEffect(e2)
end
end
function chana.rstop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local cid=e:GetLabel()
if cid~=0 then
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
end
local e1=e:GetLabelObject()
e1:Reset()
Duel.HintSelection(Group.FromCards(c))
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
--light,to deck
function chana.light(c,m)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e2:SetCondition(chana.tdcon)
e2:SetTarget(chana.tdtg)
e2:SetOperation(chana.tdop)
c:RegisterEffect(e2)
return e2
end
function chana.tdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsAttribute(ATTRIBUTE_LIGHT) and not c:IsAttack(c:GetBaseAttack())
end
function chana.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_ONFIELD)
end
function chana.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPPO)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsFaceup() then
local atk=c:GetBaseAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
end
--dark,draw
function chana.dark(c,m)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,2))
e3:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e3:SetCondition(chana.drcon)
e3:SetTarget(chana.drtg)
e3:SetOperation(chana.drop)
c:RegisterEffect(e3)
return e3
end
function chana.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttribute(ATTRIBUTE_DARK) and Duel.GetTurnPlayer()~=tp
end
function chana.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(1-tp,1) end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,1)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,1-tp,2)
end
function chana.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)==1 then
Duel.ShuffleHand(p)
Duel.BreakEffect()
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_HAND,nil)
if g:GetCount()>=2 then
local sg=g:RandomSelect(tp,2)
Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)
end
end
end
--water,remove then draw
function chana.water0(c,m)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,3))
e4:SetCategory(CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetRange(LOCATION_MZONE)
e4:SetHintTiming(TIMING_END_PHASE)
e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e4:SetCost(chana.rmcost)
e4:SetTarget(chana.rmtg)
return e4
end
function chana.rmcostfilter(c)
return c:IsAbleToRemoveAsCost()
end
function chana.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.rmcostfilter,tp,LOCATION_ONFIELD,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.rmcostfilter,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.Remove(g,POS_FACEDOWN,REASON_COST)
end
function chana.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
--fire,Destroy
function chana.fire0(c,m)
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,4))
e5:SetCategory(CATEGORY_DESTROY)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e5:SetRange(LOCATION_MZONE)
e5:SetTarget(chana.destg)
return e5
end
function chana.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroupCount(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
------------------------------------------未来念灵-------------------------------------
future=future or {}
----------------------------------
function future.summon(c,m)
--summon self
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetCountLimit(1,m)
e1:SetCost(future.summoncost)
e1:SetTarget(future.summontg)
e1:SetOperation(future.summonop)
return e1
end
function future.summoncost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
end
function future.summontg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chk==0 then return c:IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,c,1,0,0)
end
function future.summonop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsLocation(LOCATION_HAND) and c:IsSummonable(true,nil) then
Duel.Summon(tp,c,true,nil)
end
end
-------------------------------------不用解放作召唤------------------------------------
function future.lv4(c,m)
--summon & set with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(future.ntcon)
e1:SetOperation(future.ntop)
c:RegisterEffect(e1)
end
function future.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and c:IsLevelAbove(5) and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function future.ntop(e,tp,eg,ep,ev,re,r,rp,c)
--change base attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c:GetBaseAttack()/2)
e1:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_TRAP)
tc:RegisterEffect(e1)
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tc:GetOwner(),nil,0)
end
end
function s.filter(c,tp)
local r=LOCATION_REASON_TOFIELD
if not c:IsControler(c:GetOwner()) then r=LOCATION_REASON_CONTROL end
return c:IsFaceup() and Duel.GetLocationCount(c:GetOwner(),LOCATION_SZONE,tp,r)>0 and not c:IsSummonType(SUMMON_TYPE_NORMAL)
end
function s.initial_effect(c)
LIM.lim_eff(c,id)
local e1=LIM.eff2(c,id)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(s.tg)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
e2:SetValue(c:GetBaseDefense()/2)
e2:SetCode(EVENT_REMOVE)
c:RegisterEffect(e2)
--lv
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CHANGE_LEVEL)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(4)
e3:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e3)
end
---------------------------------上级召唤获得效果-----------------------
function future.effect(c,m)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,m+1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE)
end)
return e1
end
-----------------------------------------black order-------------------------------------------------
bo=bo or {}
function bo.base(c,m)
c:EnableCounterPermit(0x50a)
--act limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_TRIGGER)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(bo.base_condition)
e3:SetValue(1)
c:RegisterEffect(e3)
return e3
end
function bo.base_condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x50a)>0
end
function bo.base_cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
local pro=0
if e:GetProperty() then pro=e:GetProperty() end
e:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
c:AddCounter(0x50a,1)
e:SetProperty(pro)
end
------------------------------------------------------伴生双子------------------------------------------
twins=twins or {}
--to deck
function twins.todeck(c,m)
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(m,1))
e6:SetCategory(CATEGORY_TODECK)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_LEAVE_FIELD)
--e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(twins.tdcon)
e6:SetTarget(twins.tdtg)
e6:SetOperation(twins.tdop)
c:RegisterEffect(e6)
end
function twins.cfilter(c)
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsSetCard(0x280) and c:IsType(TYPE_MONSTER)
end
function twins.tdcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(twins.cfilter,1,nil)
end
function twins.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local m=c:GetOriginalCode()
if chk==0 then return c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
end
function twins.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
if Duel.IsExistingMatchingCard(twins.cosfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(96000051,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(twins.cosfilter),tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
else
Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
end
function twins.cosfilter(c)
return c:IsCode(96000051) and c:IsAbleToDeck()
end
--sump limit
function twins.sump(c,count)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetTargetRange(1,0)
e1:SetLabel(twins.getsummoncount(tp),count-1)
e1:SetTarget(twins.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_LEFT_SPSUMMON_COUNT)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,0)
e3:SetLabel(twins.getsummoncount(tp),count-1)
e3:SetValue(twins.countval)
e3:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e3,tp)
end
function twins.getsummoncount(tp)
return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)+Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)
end
function twins.splimit(e,c,sump,sumtype,sumpos,targetp,se)
local sumpcount,count=e:GetLabel()
return twins.getsummoncount(sump)>sumpcount+count
end
function twins.countval(e,re,tp)
if twins.getsummoncount(tp)>sumpcount+count then return 0 else return cm.getsummoncount(sump)-e:GetLabel()+count end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment