name: Pumpking
card_text: If "Castle of Dark Illusions" is face-up on the field, increase the ATK and DEF of this card by 100 points. As long as this "Castle of Dark Illusions" remains face-up on the field, the ATK and DEF of this card continues to increase by 100 points during each of your Standby Phases. This effect continues until your 4th turn after the card is activated.
external_ids: local CARD_ID_0 = 62121 --Castle of Dark Illusions
  
lua: local CARD_ID_0 = 62121 --Castle of Dark Illusions
  local s, id, o = GetID()
  function s.initial_effect(c)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.adval)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.atkcon)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.adval(e, c)
  	if Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil) then
  		return 100 + c:GetFlagEffect(id) * 100
  	else
  		return c:GetFlagEffect(id) * 100
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and e:GetHandler():GetFlagEffect(id) < 4 and Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or not Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil) then
  		return
  	end
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 1)
  end
  
  
source_text: Pumpking
  If "Castle of Dark Illusions" is face-up on the field, increase the ATK and DEF of this card by 100 points. As long as this "Castle of Dark Illusions" remains face-up on the field, the ATK and DEF of this card continues to increase by 100 points during each of your Standby Phases. This effect continues until your 4th turn after the card is activated.
target_text: -- Pumpking
  local CARD_ID_0 = 62121 --Castle of Dark Illusions
  local s, id, o = GetID()
  function s.initial_effect(c)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.adval)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.atkcon)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.adval(e, c)
  	if Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil) then
  		return 100 + c:GetFlagEffect(id) * 100
  	else
  		return c:GetFlagEffect(id) * 100
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and e:GetHandler():GetFlagEffect(id) < 4 and Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or not Duel.IsExistingMatchingCard(s.filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil) then
  		return
  	end
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 1)
  end
  
  