name: Imprisoned
card_text: Once per turn, during your Standby Phase, you must pay 1000 LP (this is not optional), or this card is destroyed. Once per turn, during your Standby Phase: Target 1 Level 4 or lower Fiend monster on the field; that target gains 1000 ATK until the end of this turn. "Pandemonium" must be on the field and this card must be in your GY to activate and to resolve this effect.
external_ids: local CARD_ID_0 = 94585852 --Pandemonium
  
lua: local CARD_ID_0 = 94585852 --Pandemonium
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--maintain
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.mtcon)
  	e1:SetOperation(s.mtop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.mtcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 1000) or Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		if not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) or not Duel.SelectEffectYesNo(tp, e:GetHandler(), aux.Stringid(94585852, 1)) then
  			Duel.PayLPCost(tp, 1000)
  		end
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and Duel.IsEnvironment(CARD_ID_0)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4) and c:IsRace(RACE_FIEND)
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or not Duel.IsEnvironment(CARD_ID_0) then
  		return
  	end
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(1000)
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Imprisoned
  Once per turn, during your Standby Phase, you must pay 1000 LP (this is not optional), or this card is destroyed. Once per turn, during your Standby Phase: Target 1 Level 4 or lower Fiend monster on the field; that target gains 1000 ATK until the end of this turn. "Pandemonium" must be on the field and this card must be in your GY to activate and to resolve this effect.
target_text: -- Imprisoned
  local CARD_ID_0 = 94585852 --Pandemonium
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--maintain
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.mtcon)
  	e1:SetOperation(s.mtop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.mtcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 1000) or Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		if not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) or not Duel.SelectEffectYesNo(tp, e:GetHandler(), aux.Stringid(94585852, 1)) then
  			Duel.PayLPCost(tp, 1000)
  		end
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp and Duel.IsEnvironment(CARD_ID_0)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4) and c:IsRace(RACE_FIEND)
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	if not e:GetHandler():IsRelateToEffect(e) or not Duel.IsEnvironment(CARD_ID_0) then
  		return
  	end
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(1000)
  		tc:RegisterEffect(e1)
  	end
  end
  
  