name: Amazoness
card_text: When this card is activated: You can take 1 "Amazoness" monster from your Deck, and either add it to your hand or (if it is a Pendulum Monster) place it in your Pendulum Zone. When you take battle damage while you control an "Amazoness" Monster Card: You can gain LP equal to the damage you took. You can only use this effect of "Amazoness Hot Spring" 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)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--recover
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_RECOVER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.rccon)
  	e2:SetTarget(s.rctg)
  	e2:SetOperation(s.rcop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c, tp, pcon)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or c:IsType(TYPE_PENDULUM) and pcon)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local pcon = Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, tp, pcon)
  	if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  		local sc = g:Select(tp, 1, 1, nil):GetFirst()
  		if sc then
  			local b1 = sc:IsAbleToHand()
  			local b2 = sc:IsType(TYPE_PENDULUM) and pcon
  			local s = 0
  			if b1 and not b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 1))
  			end
  			if not b1 and b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  			end
  			if b1 and b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  			end
  			if s == 0 then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			end
  			if s == 1 then
  				Duel.MoveToField(sc, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  			end
  		end
  	end
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and c:GetOriginalType() & TYPE_MONSTER ~= 0
  end
  function s.rccon(e, tp, eg, ep, ev, re, r, rp)
  	return ep == tp and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.rctg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, tp, ev)
  end
  function s.rcop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Recover(tp, ev, REASON_EFFECT)
  end
  
  
source_text: Amazoness
  When this card is activated: You can take 1 "Amazoness" monster from your Deck, and either add it to your hand or (if it is a Pendulum Monster) place it in your Pendulum Zone. When you take battle damage while you control an "Amazoness" Monster Card: You can gain LP equal to the damage you took. You can only use this effect of "Amazoness Hot Spring" once per turn.
target_text: -- Amazoness
  local SETCARD_ID_0 = 0x4 --Amazoness
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--recover
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_RECOVER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.rccon)
  	e2:SetTarget(s.rctg)
  	e2:SetOperation(s.rcop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c, tp, pcon)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or c:IsType(TYPE_PENDULUM) and pcon)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local pcon = Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, tp, pcon)
  	if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  		local sc = g:Select(tp, 1, 1, nil):GetFirst()
  		if sc then
  			local b1 = sc:IsAbleToHand()
  			local b2 = sc:IsType(TYPE_PENDULUM) and pcon
  			local s = 0
  			if b1 and not b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 1))
  			end
  			if not b1 and b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  			end
  			if b1 and b2 then
  				s = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  			end
  			if s == 0 then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			end
  			if s == 1 then
  				Duel.MoveToField(sc, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
  			end
  		end
  	end
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and c:GetOriginalType() & TYPE_MONSTER ~= 0
  end
  function s.rccon(e, tp, eg, ep, ev, re, r, rp)
  	return ep == tp and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.rctg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_RECOVER, nil, 0, tp, ev)
  end
  function s.rcop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Recover(tp, ev, REASON_EFFECT)
  end
  
  