Commit 831b515c authored by CubeRuler's avatar CubeRuler

fix

parent f2cac058
......@@ -73,16 +73,17 @@ function cm.sumlimit(e,c,sump,sumtype,sumpos,targetp)
return bit.band(sumpos,POS_FACEDOWN)>0
end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
if not ev then return end
if not ev or ep==1-tp then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetReset(RESET_EVENT+RESET_PHASE+PHASE_DRAW)
e1:SetCountLimit(1)
e1:SetOperation(cm.retop)
Duel.RegisterEffect(e1,tp)
end
function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsLocation(LOCATION_FZONE) then return end
Duel.Recover(tp,1000,REASON_EFFECT)
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -64,7 +64,7 @@ function cm.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
end
function cm.drcon(e,tp,eg,ep,ev,re,r,rp)
return rp~=tp
return rp==1-tp and c:IsPreviousPosition(POS_DEFENSE)
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
......
......@@ -17,6 +17,7 @@ function cm.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(cm.con)
e3:SetTarget(cm.settg)
e3:SetOperation(cm.setop)
c:RegisterEffect(e3)
......@@ -24,6 +25,9 @@ function cm.initial_effect(c)
e2:SetCode(EVENT_REMOVE)
c:RegisterEffect(e2)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and c:IsPreviousPosition(POS_DEFENSE)
end
function cm.setcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(cm.setfilter1,tp,LOCATION_MZONE,0,1,nil)
end
......@@ -46,7 +50,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:Select(tp,1,3,nil)
Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
local cc=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_REMOVED)
local cc=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_REMOVED)*300
local g=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_DECK,0,nil)
if Duel.Recover(tp,cc,REASON_EFFECT)~=0 and g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.BreakEffect()
......
......@@ -7,30 +7,66 @@ function cm.initial_effect(c)
.e("SetCategory",CATEGORY_RECOVER)
.e("SetType",EFFECT_TYPE_ACTIVATE)
.e("SetCode",EVENT_FREE_CHAIN)
.e("SetCountLimit",1,m+EFFECT_COUNT_CODE_OATH)
.e("SetCost",function(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(function(c) return not c:IsType(TYPE_LINK) end,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g = Duel.SelectMatchingCard(tp,function(c) return not c:IsType(TYPE_LINK) end,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) end)
if chk==0 then return Duel.IsExistingMatchingCard(function(c) return not c:IsType(TYPE_LINK) end,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g = Duel.SelectMatchingCard(tp,function(c) return not c:IsType(TYPE_LINK) and c:IsPosition(POS_DEFENSE) end,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.ChangePosition(g,POS_FACEUP_ATTACK) end)
.e("SetTarget",function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetOverlayCount(tp,1,0)>0 end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(Duel.GetOverlayCount(tp,1,0)*500)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,Duel.GetOverlayCount(tp,1,0)*500)
if Duel.IsExistingMatchingCard(cm.mfilter,LOCATION_MZONE,0,1,nil) then
if Duel.IsExistingMatchingCard(cm.mfilter,tp,LOCATION_MZONE,0,1,nil) then
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_RECOVER)
end end)
.e("SetOperation",function(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
if Duel.IsExistingMatchingCard(cm.mfilter,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(cm.gfilter,LOCATION_GRAVE,0,1,nil) then
if Duel.IsExistingMatchingCard(cm.mfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(cm.gfilter,tp,LOCATION_GRAVE,0,1,nil) then
if Duel.SelectEffectYesNo(tp,e:GetHandler(),aux.Stringid(m,1)) then
local g = Duel.SelectMatchingCard(tp,cm.gfilter,LOCATION_GRAVE,0,1,1,nil)
local g = Duel.SelectMatchingCard(tp,cm.gfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SendtoHand(g,tp,REASON_EFFECT)
Duel.ConfirmCards(g,tp-1)
end
end end)
.Return()).c("RegisterEffect",iFunc(c)
.e("SetDescription",aux.Stringid(m,1))
.e("SetCategory",CATEGORY_TODECK+CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON)
.e("SetType",EFFECT_TYPE_IGNITION)
.e("SetProperty",EFFECT_FLAG_CARD_TARGET)
.e("SetRange",LOCATION_GRAVE)
.e("SetTarget",function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsFaceup() and cm.nomatfilter(chkc,e) end
if chk==0 then return Duel.IsExistingTarget(cm.nomatfilter,tp,LOCATION_MZONE,0,1,nil,e) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.nomatfilter,tp,LOCATION_MZONE,0,1,1,nil,e)
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end)
.e("SetOperation",function(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.GetFirstTarget()
if g then
if Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) and Duel.SendtoDeck(g,nil,2,REASON_EFFECT) then
Duel.BreakEffect()
Duel.ShuffleDeck(tp)
local ct = Duel.Draw(tp,1,REASON_EFFECT)
if ct==0 then return end
local dc=Duel.GetOperatedGroup():GetFirst()
Duel.ConfirmCards(1-tp,dc)
if dc:IsSetCard(0x3fac) and dc:IsType(TYPE_MONSTER) and dc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
if Duel.SelectEffectYesNo(tp,e:GetHandler(),aux.Stringid(m,2))then
Duel.BreakEffect()
Duel.SpecialSummon(dc,0,tp,tp,false,false,POS_FACEUP)
Duel.Draw(tp,1,REASON_EFFECT)
end
end
Duel.ShuffleHand(tp)
end
end end)
.Return())
end
function cm.mfilter(c)
......@@ -39,6 +75,9 @@ end
function cm.gfilter(c)
return c:IsSetCard(0x3fac) and c:IsAbleToHand()
end
function cm.nomatfilter(c,e)
return c:GetOverlayCount()==0 and c:IsType(TYPE_MONSTER) and c:IsType(TYPE_XYZ) and c:IsSetCard(0x3fac) and c:IsAbleToDeck() and e:GetHandler():IsAbleToDeck()
end
function iFunc(c,x)
local __this = (aux.GetValueType(c) == "Card" and {(x == nil and {Effect.CreateEffect(c)} or {x})[1]} or {x})[1]
local fe = function(name,...) if name =="RegisterEffect" then c:RegisterEffect(__this:Clone()) else (type(__this[name])=="function" and {__this[name]} or {""})[1](__this,...) end return iFunc(c,__this) 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