name: Fortune
card_text: This card's ATK and DEF are equal to its Level x 400. During each of your Standby Phases, increase the Level of this card by 1 (max 12). When the Level of this card increases, inflict 400 damage to your opponent.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_SET_ATTACK)
  	e1:SetValue(s.value)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_DEFENSE)
  	c:RegisterEffect(e2)
  	--level up
  	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:SetCountLimit(1)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetCondition(s.lvcon)
  	e3:SetOperation(s.lvop)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EVENT_LEVEL_UP)
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  end
  function s.value(e, c)
  	return c:GetLevel() * 400
  end
  function s.lvcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsLevelAbove(12) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_LEVEL)
  	e1:SetValue(1)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(400)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 400)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Fortune
  This card's ATK and DEF are equal to its Level x 400. During each of your Standby Phases, increase the Level of this card by 1 (max 12). When the Level of this card increases, inflict 400 damage to your opponent.
target_text: -- Fortune
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_SET_ATTACK)
  	e1:SetValue(s.value)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_DEFENSE)
  	c:RegisterEffect(e2)
  	--level up
  	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:SetCountLimit(1)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetCondition(s.lvcon)
  	e3:SetOperation(s.lvop)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetCode(EVENT_LEVEL_UP)
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  end
  function s.value(e, c)
  	return c:GetLevel() * 400
  end
  function s.lvcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsLevelAbove(12) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_LEVEL)
  	e1:SetValue(1)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(400)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 400)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  