name: Amazoness
card_text: Pendulum Scale = 1
  [ Pendulum Effect ]
  "Amazoness" monsters you control gain ATK equal to their own Level x 100. When an attack is declared involving your "Amazoness" monster: You can target 1 Spell/Trap on the field; destroy it. You can only use this effect of "Amazoness Golden Whip Master" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  If this card in the Monster Zone is destroyed by battle or card effect: You can place this card in your Pendulum Zone. If an "Amazoness" monster(s) is Special Summoned to your field, while this card is in your GY (except during the Damage Step): You can place this card in your Pendulum Zone. You can only use each effect of "Amazoness Golden Whip Master" once per turn.
external_ids: local SETCARD_ID_0 = 0x4 --Amazoness
  
lua: local SETCARD_ID_0 = 0x4 --Amazoness
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--atk up
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_PZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.descon)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  	--pendulum
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetCondition(s.pencon)
  	e3:SetTarget(s.pentg)
  	e3:SetOperation(s.penop)
  	c:RegisterEffect(e3)
  	--pendulem
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_LEAVE_GRAVE)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetRange(LOCATION_GRAVE)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(1, id + 2)
  	e4:SetCondition(s.pencon2)
  	e4:SetTarget(s.pentg2)
  	e4:SetOperation(s.penop)
  	c:RegisterEffect(e4)
  end
  function s.atkval(e, c)
  	return c:GetLevel() * 100
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetBattleMonster(tp)
  	return tc and tc:IsSetCard(SETCARD_ID_0) and tc:IsFaceup()
  end
  function s.desfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.pencon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
  end
  function s.pentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  end
  function s.penop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.CheckLocation(tp, LOCATION_PZONE, 0) and not Duel.CheckLocation(tp, LOCATION_PZONE, 1) then
  		return
  	end
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.MoveToField(c, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  function s.penfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp)
  end
  function s.pencon2(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.penfilter, 1, nil, tp) and not eg:IsContains(e:GetHandler())
  end
  function s.pentg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  
  
source_text: Amazoness
  Pendulum Scale = 1
  [ Pendulum Effect ]
  "Amazoness" monsters you control gain ATK equal to their own Level x 100. When an attack is declared involving your "Amazoness" monster: You can target 1 Spell/Trap on the field; destroy it. You can only use this effect of "Amazoness Golden Whip Master" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  If this card in the Monster Zone is destroyed by battle or card effect: You can place this card in your Pendulum Zone. If an "Amazoness" monster(s) is Special Summoned to your field, while this card is in your GY (except during the Damage Step): You can place this card in your Pendulum Zone. You can only use each effect of "Amazoness Golden Whip Master" once per turn.
target_text: -- Amazoness
  local SETCARD_ID_0 = 0x4 --Amazoness
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--atk up
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_PZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.descon)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  	--pendulum
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetCondition(s.pencon)
  	e3:SetTarget(s.pentg)
  	e3:SetOperation(s.penop)
  	c:RegisterEffect(e3)
  	--pendulem
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_LEAVE_GRAVE)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetRange(LOCATION_GRAVE)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(1, id + 2)
  	e4:SetCondition(s.pencon2)
  	e4:SetTarget(s.pentg2)
  	e4:SetOperation(s.penop)
  	c:RegisterEffect(e4)
  end
  function s.atkval(e, c)
  	return c:GetLevel() * 100
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetBattleMonster(tp)
  	return tc and tc:IsSetCard(SETCARD_ID_0) and tc:IsFaceup()
  end
  function s.desfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and s.desfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.pencon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
  end
  function s.pentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  end
  function s.penop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.CheckLocation(tp, LOCATION_PZONE, 0) and not Duel.CheckLocation(tp, LOCATION_PZONE, 1) then
  		return
  	end
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.MoveToField(c, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  	end
  end
  function s.penfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp)
  end
  function s.pencon2(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.penfilter, 1, nil, tp) and not eg:IsContains(e:GetHandler())
  end
  function s.pentg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  
  