Commit b4891152 authored by Nemo Ma's avatar Nemo Ma Committed by GitHub

Merge pull request #3 from Sonic714/master

fix yume field self to deck
parents 93b590d7 479ce402
...@@ -164,7 +164,7 @@ function yume.AddYumeFieldGlobal(c,id,ft) ...@@ -164,7 +164,7 @@ function yume.AddYumeFieldGlobal(c,id,ft)
esd2:SetRange(LOCATION_FZONE) esd2:SetRange(LOCATION_FZONE)
esd2:SetOperation(yume.SelfToDeckOp) esd2:SetOperation(yume.SelfToDeckOp)
c:RegisterEffect(esd2) c:RegisterEffect(esd2)
--field activation --activate field
local efa=Effect.CreateEffect(c) local efa=Effect.CreateEffect(c)
efa:SetDescription(aux.Stringid(71400001,2)) efa:SetDescription(aux.Stringid(71400001,2))
efa:SetCategory(EFFECT_TYPE_ACTIVATE) efa:SetCategory(EFFECT_TYPE_ACTIVATE)
...@@ -172,8 +172,8 @@ function yume.AddYumeFieldGlobal(c,id,ft) ...@@ -172,8 +172,8 @@ function yume.AddYumeFieldGlobal(c,id,ft)
efa:SetCode(EVENT_LEAVE_FIELD) efa:SetCode(EVENT_LEAVE_FIELD)
efa:SetRange(LOCATION_FZONE) efa:SetRange(LOCATION_FZONE)
efa:SetProperty(EFFECT_FLAG_DAMAGE_STEP) efa:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
efa:SetCondition(yume.FieldActivationCon) efa:SetCondition(yume.ActivateFieldCon)
efa:SetOperation(yume.FieldActivationOp) efa:SetOperation(yume.ActivateFieldOp)
c:RegisterEffect(efa) c:RegisterEffect(efa)
end end
--[[--old Against Yume --[[--old Against Yume
...@@ -226,28 +226,28 @@ end ...@@ -226,28 +226,28 @@ end
--Self To Deck --Self To Deck
function yume.SelfToDeckOp(e,tp,eg,ep,ev,re,r,rp) function yume.SelfToDeckOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not re:GetHandler():IsSetCard(0x714) and c:GetFlagEffect(1)>0 then if not re:GetHandler():IsSetCard(0x714) and rp==tp and c:GetFlagEffect(1)>0 then
Duel.SendtoDeck(c,nil,2,REASON_EFFECT) Duel.SendtoDeck(c,nil,2,REASON_EFFECT)
end end
end end
--Field Activation --Field Activation
function yume.YumeFieldCheck(tp,num,ft,loc) function yume.YumeFieldCheck(tp,id,ft,loc)
ft=ft or 0 ft=ft or 0
num=num or 0 id=id or 0
loc=loc or LOCATION_DECK loc=loc or LOCATION_DECK
return Duel.IsExistingMatchingCard(yume.FieldActivationFilter,tp,loc,0,1,nil,tp,num,ft) return Duel.IsExistingMatchingCard(yume.ActivateFieldFilter,tp,loc,0,1,nil,tp,id,ft)
end end
function yume.YumeFieldCheckTarget(num,ft,loc) function yume.YumeFieldCheckTarget(id,ft,loc)
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return yume.YumeFieldCheck(tp,num,ft,loc) end if chk==0 then return yume.YumeFieldCheck(tp,id,ft,loc) end
end end
end end
function yume.FieldActivation(tp,num,ft,loc) function yume.FieldActivation(tp,id,ft,loc)
ft=ft or 0 ft=ft or 0
num=num or 0 id=id or 0
loc=loc or LOCATION_DECK loc=loc or LOCATION_DECK
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(71400001,3)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(71400001,3))
local tc=Duel.SelectMatchingCard(tp,yume.FieldActivationFilter,tp,loc,0,1,1,nil,tp,num,ft):GetFirst() local tc=Duel.SelectMatchingCard(tp,yume.ActivateFieldFilter,tp,loc,0,1,1,nil,tp,id,ft):GetFirst()
if tc then if tc then
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0) local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then if fc then
...@@ -260,28 +260,27 @@ function yume.FieldActivation(tp,num,ft,loc) ...@@ -260,28 +260,27 @@ function yume.FieldActivation(tp,num,ft,loc)
local tep=tc:GetControler() local tep=tc:GetControler()
local cost=te:GetCost() local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
local id=yume.temp_card_field[tc].id or 0
Duel.RaiseEvent(tc,4179255,te,0,tp,tp,Duel.GetCurrentChain()) Duel.RaiseEvent(tc,4179255,te,0,tp,tp,Duel.GetCurrentChain())
return tc return tc
end end
end end
function yume.FieldActivationFilter(c,tp,num,ft) function yume.ActivateFieldFilter(c,tp,id,ft)
local flag=c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp,true,true) and not c:IsCode(num) local flag=c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp,true,true) and not c:IsCode(id)
if ft==0 then return flag and c:IsSetCard(0x3714) if ft==0 then return flag and c:IsSetCard(0x3714)
elseif ft==1 then return flag and c:IsSetCard(0xb714) elseif ft==1 then return flag and c:IsSetCard(0xb714)
elseif ft==2 then return flag and c:IsSetCard(0x7714) elseif ft==2 then return flag and c:IsSetCard(0x7714)
end end
end end
function yume.FieldActivationCon(e,tp,eg,ep,ev,re,r,rp) function yume.ActivateFieldCon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and not c:IsLocation(LOCATION_DECK) return c:IsReason(REASON_EFFECT) and not c:IsLocation(LOCATION_DECK)
and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousPosition(POS_FACEUP)
end end
function yume.FieldActivationOp(e,tp,eg,ep,ev,re,r,rp) function yume.ActivateFieldOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local num=yume.temp_card_field[c].id local id=yume.temp_card_field[c].id
local ft=yume.temp_card_field[c].ft local ft=yume.temp_card_field[c].ft
yume.FieldActivation(tp,num,ft,LOCATION_DECK+LOCATION_HAND) yume.FieldActivation(tp,id,ft,LOCATION_DECK+LOCATION_HAND)
end end
--uniquify the same name --uniquify the same name
function yume.UniquifyCardName(g) function yume.UniquifyCardName(g)
......
...@@ -49,6 +49,7 @@ function c71400020.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,6 +49,7 @@ function c71400020.operation(e,tp,eg,ep,ev,re,r,rp)
end end
local flag=Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) local flag=Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
local te=tc:GetActivateEffect() local te=tc:GetActivateEffect()
te:UseCountLimit(tp,1,true)
local tep=tc:GetControler() local tep=tc:GetControler()
local cost=te:GetCost() local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
......
...@@ -61,7 +61,7 @@ function c71400038.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -61,7 +61,7 @@ function c71400038.activate(e,tp,eg,ep,ev,re,r,rp)
local e4a=e1:Clone() local e4a=e1:Clone()
e4a:SetCode(EFFECT_CANNOT_DISEFFECT) e4a:SetCode(EFFECT_CANNOT_DISEFFECT)
Duel.RegisterEffect(e4a,tp) Duel.RegisterEffect(e4a,tp)
yume.RustFlag=true; Duel.RegisterFlagEffect(tp,71400038,0,0,0)
end end
function c71400038.con1(e,tp,eg,ep,ev,re,r,rp) function c71400038.con1(e,tp,eg,ep,ev,re,r,rp)
return ep==tp return ep==tp
......
...@@ -77,7 +77,7 @@ function c71400043.op1(e,tp,eg,ep,ev,re,r,rp) ...@@ -77,7 +77,7 @@ function c71400043.op1(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c71400043.con2(e,tp,eg,ep,ev,re,r,rp) function c71400043.con2(e,tp,eg,ep,ev,re,r,rp)
return not (yume.RustFlag or e:GetHandler():IsStatus(STATUS_SPSUMMON_TURN)) return not (Duel.GetFlagEffect(tp,71400038)>0 or e:GetHandler():IsStatus(STATUS_SPSUMMON_TURN))
end end
function c71400043.tg2(e,tp,eg,ep,ev,re,r,rp,chk) function c71400043.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
...@@ -94,7 +94,7 @@ function c71400043.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -94,7 +94,7 @@ function c71400043.op2(e,tp,eg,ep,ev,re,r,rp)
yume.FieldActivation(tp,num,2,LOCATION_GRAVE+LOCATION_DECK) yume.FieldActivation(tp,num,2,LOCATION_GRAVE+LOCATION_DECK)
end end
function c71400043.con3(e,tp,eg,ep,ev,re,r,rp) function c71400043.con3(e,tp,eg,ep,ev,re,r,rp)
return yume.RustFlag return Duel.GetFlagEffect(tp,71400038)>0
end end
function c71400043.filter3(c,tp) function c71400043.filter3(c,tp)
return c:IsAbleToRemove(tp,POS_FACEDOWN) and not(c:IsLocation(LOCATION_FZONE) and c:IsType(TYPE_FIELD) and c:IsSetCard(0x3714) and c:IsFaceup() and c:IsControler(tp)) return c:IsAbleToRemove(tp,POS_FACEDOWN) and not(c:IsLocation(LOCATION_FZONE) and c:IsType(TYPE_FIELD) and c:IsSetCard(0x3714) and c:IsFaceup() and c:IsControler(tp))
......
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