Commit 44d32c7a authored by nekrozar's avatar nekrozar Committed by DailyShana

fix Spirit of the Pot of Greed (#445)

parent ef4f719e
--強欲な壺の精霊
function c4896788.initial_effect(c)
--activate
--draw
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCondition(c4896788.drcon)
e1:SetOperation(c4896788.drop)
e1:SetOperation(aux.chainreg)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c4896788.drcon)
e2:SetTarget(c4896788.drtg)
e2:SetOperation(c4896788.drop)
c:RegisterEffect(e2)
end
function c4896788.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttackPos()
return e:GetHandler():IsAttackPos() and e:GetHandler():GetFlagEffect(1)>0
and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(55144522)
end
function c4896788.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(rp,1) end
Duel.SetTargetPlayer(rp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,rp,1)
end
function c4896788.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeTargetParam(ev,3)
if not e:GetHandler():IsAttackPos() or not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
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