name: Yaminabe
card_text: At the start of your Battle Phase: You can target 1 face-up monster you control; this turn, your opponent chooses the attack target(s) for that monster, also if that monster you control battles an opponent's monster, it gains ATK equal to its original ATK during damage calculation only. You can only use this effect of "Yaminabe Party" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--attack select
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_PHASE + PHASE_BATTLE_START)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.atkcon1)
  	e2:SetTarget(s.atktg1)
  	e2:SetOperation(s.atkop1)
  	c:RegisterEffect(e2)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.atktg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.atkop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		if tc:GetFlagEffect(id) == 0 then
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_FIELD)
  			e1:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
  			e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  			e1:SetTargetRange(1, 0)
  			e1:SetCondition(s.effcon)
  			e1:SetLabelObject(tc)
  			e1:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e1, tp)
  			local e2 = Effect.CreateEffect(e:GetHandler())
  			e2:SetType(EFFECT_TYPE_FIELD)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetTargetRange(LOCATION_MZONE, 0)
  			e2:SetCondition(s.atkcon2)
  			e2:SetTarget(s.atktg)
  			e2:SetValue(s.atkval)
  			e2:SetLabelObject(tc)
  			e2:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e2, tp)
  		end
  	end
  end
  function s.effcon(e)
  	local tc = e:GetLabelObject()
  	return tc:GetFlagEffect(id) ~= 0 and Duel.GetAttacker() == tc
  end
  function s.atkcon2(e)
  	local tc = e:GetLabelObject()
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and tc:GetFlagEffect(id) ~= 0 and Duel.GetAttacker() == tc and Duel.GetAttackTarget() ~= nil
  end
  function s.atktg(e, c)
  	return c == Duel.GetAttacker()
  end
  function s.atkval(e, c)
  	return c:GetBaseAttack()
  end
  
  
source_text: Yaminabe
  At the start of your Battle Phase: You can target 1 face-up monster you control; this turn, your opponent chooses the attack target(s) for that monster, also if that monster you control battles an opponent's monster, it gains ATK equal to its original ATK during damage calculation only. You can only use this effect of "Yaminabe Party" once per turn.
target_text: -- Yaminabe
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--attack select
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_PHASE + PHASE_BATTLE_START)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.atkcon1)
  	e2:SetTarget(s.atktg1)
  	e2:SetOperation(s.atkop1)
  	c:RegisterEffect(e2)
  end
  function s.atkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.atktg1(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.atkop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		if tc:GetFlagEffect(id) == 0 then
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_FIELD)
  			e1:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
  			e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  			e1:SetTargetRange(1, 0)
  			e1:SetCondition(s.effcon)
  			e1:SetLabelObject(tc)
  			e1:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e1, tp)
  			local e2 = Effect.CreateEffect(e:GetHandler())
  			e2:SetType(EFFECT_TYPE_FIELD)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetTargetRange(LOCATION_MZONE, 0)
  			e2:SetCondition(s.atkcon2)
  			e2:SetTarget(s.atktg)
  			e2:SetValue(s.atkval)
  			e2:SetLabelObject(tc)
  			e2:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e2, tp)
  		end
  	end
  end
  function s.effcon(e)
  	local tc = e:GetLabelObject()
  	return tc:GetFlagEffect(id) ~= 0 and Duel.GetAttacker() == tc
  end
  function s.atkcon2(e)
  	local tc = e:GetLabelObject()
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and tc:GetFlagEffect(id) ~= 0 and Duel.GetAttacker() == tc and Duel.GetAttackTarget() ~= nil
  end
  function s.atktg(e, c)
  	return c == Duel.GetAttacker()
  end
  function s.atkval(e, c)
  	return c:GetBaseAttack()
  end
  
  