name: Berserk
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned with "A Deal with Dark Ruler" and cannot be Special Summoned by other ways. This card can attack all monsters your opponent controls once each. During each of your End Phases, this card loses 500 ATK.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.FALSE)
  	c:RegisterEffect(e1)
  	--attack all
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_ALL)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--cost
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.atkcon)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer()
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(-500)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  end
  
  
source_text: Berserk
  Cannot be Normal Summoned/Set. Must be Special Summoned with "A Deal with Dark Ruler" and cannot be Special Summoned by other ways. This card can attack all monsters your opponent controls once each. During each of your End Phases, this card loses 500 ATK.
target_text: -- Berserk
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon limit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.FALSE)
  	c:RegisterEffect(e1)
  	--attack all
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_ALL)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--cost
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.atkcon)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer()
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(-500)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  end
  
  