Commit a5364154 authored by mercury233's avatar mercury233 Committed by DailyShana

fix Painful Escape (#557)

parent 886e99f5
...@@ -15,35 +15,31 @@ function c20513882.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -15,35 +15,31 @@ function c20513882.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100) e:SetLabel(100)
if chk==0 then return true end if chk==0 then return true end
end end
function c20513882.cfilter(c,e,tp) function c20513882.cfilter(c,tp)
local lv=c:GetLevel() return c:GetOriginalLevel()>0
return lv>0 and Duel.IsExistingMatchingCard(c20513882.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,c:GetLevel(),c:GetRace(),c:GetAttribute(),c:GetCode()) and Duel.IsExistingMatchingCard(c20513882.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,c)
end end
function c20513882.thfilter(c,lv,race,att,code) function c20513882.thfilter(c,tc)
return c:GetLevel()==lv and c:IsRace(race) and c:IsAttribute(att) and not c:IsCode(code) and c:IsAbleToHand() return c:GetOriginalLevel()==tc:GetOriginalLevel()
and c:GetOriginalRace()==tc:GetOriginalRace()
and c:GetOriginalAttribute()==tc:GetOriginalAttribute()
and c:GetOriginalCode()~=tc:GetOriginalCode() and c:IsAbleToHand()
end end
function c20513882.target(e,tp,eg,ep,ev,re,r,rp,chk) function c20513882.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
if e:GetLabel()~=100 then return false end if e:GetLabel()~=100 then return false end
e:SetLabel(0) e:SetLabel(0)
return Duel.CheckReleaseGroup(tp,c20513882.cfilter,1,nil,e,tp) return Duel.CheckReleaseGroup(tp,c20513882.cfilter,1,nil,tp)
end end
local g=Duel.SelectReleaseGroup(tp,c20513882.cfilter,1,1,nil,e,tp) local g=Duel.SelectReleaseGroup(tp,c20513882.cfilter,1,1,nil,tp)
local rc=g:GetFirst() Duel.SetTargetCard(g)
local label=bit.lshift(rc:GetRace(),16) Duel.Release(g,REASON_COST)
label=label+bit.lshift(rc:GetLevel(),8)
label=label+rc:GetAttribute()
e:SetLabel(label)
e:SetValue(rc:GetCode())
Duel.Release(rc,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end end
function c20513882.activate(e,tp,eg,ep,ev,re,r,rp) function c20513882.activate(e,tp,eg,ep,ev,re,r,rp)
local att=bit.band(e:GetLabel(),0xff) local tc=Duel.GetFirstTarget()
local lv=bit.band(bit.rshift(e:GetLabel(),8),0xff)
local race=bit.rshift(e:GetLabel(),16)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c20513882.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,lv,race,att,e:GetValue()) local g=Duel.SelectMatchingCard(tp,c20513882.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc)
if g:GetCount()>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then if g:GetCount()>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
......
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