name: Aromalilith
card_text: 1 "Aroma" monster + 1 Plant monster
  While your LP are higher than your opponent's, Plant monsters you control cannot be destroyed by your opponent's card effects. Once per turn: You can pay 2000 LP; banish cards on the field equal to the number of "Humid Winds", "Dried Winds", and "Blessed Winds" you control. Once per turn, if you gain LP, even during the Damage Step: You can make all Plant monsters you currently control gain ATK equal to the LP gained, until the end of this turn.
external_ids: local CARD_ID_0 = 92266279 --Humid Winds
  local CARD_ID_1 = 15177750 --Blessed Winds
  local CARD_ID_2 = 28265983 --Dried Winds
  local SETCARD_ID_0 = 0xc9 --Aroma
  
lua: local CARD_ID_0 = 92266279 --Humid Winds
  local CARD_ID_1 = 15177750 --Blessed Winds
  local CARD_ID_2 = 28265983 --Dried Winds
  local SETCARD_ID_0 = 0xc9 --Aroma
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--material
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(Card.IsRace, RACE_PLANT), true)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetCondition(s.indcon)
  	e1:SetTarget(s.indtg)
  	e1:SetValue(aux.indoval)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.rmcost)
  	e2:SetTarget(s.rmtg)
  	e2:SetOperation(s.rmop)
  	c:RegisterEffect(e2)
  	--atk & def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_RECOVER)
  	e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL + EFFECT_FLAG_DELAY)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.adcon)
  	e3:SetOperation(s.adop)
  	c:RegisterEffect(e3)
  end
  function s.indcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetLP(tp) > Duel.GetLP(1 - tp)
  end
  function s.indtg(e, c)
  	return e:GetHandler() == c or c:IsRace(RACE_PLANT)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 2000)
  	end
  	Duel.PayLPCost(tp, 2000)
  end
  function s.rmfilter(c)
  	return c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2) and c:IsFaceup()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_ONFIELD, 0, nil):GetCount()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, ct, 0, LOCATION_ONFIELD)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_ONFIELD, 0, nil):GetCount()
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	if g:GetCount() >= ct then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local sg = g:Select(tp, ct, ct, nil)
  		Duel.HintSelection(sg)
  		Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep == tp and e:GetHandler():IsFaceup()
  end
  function s.adfilter(c)
  	return c:IsRace(RACE_PLANT) and c:IsFaceup()
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.adfilter, tp, LOCATION_MZONE, 0, nil)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local tc = g:GetFirst()
  		while tc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(ev)
  			tc:RegisterEffect(e1)
  			tc = g:GetNext()
  		end
  	end
  end
  
  
source_text: Aromalilith
  1 "Aroma" monster + 1 Plant monster
  While your LP are higher than your opponent's, Plant monsters you control cannot be destroyed by your opponent's card effects. Once per turn: You can pay 2000 LP; banish cards on the field equal to the number of "Humid Winds", "Dried Winds", and "Blessed Winds" you control. Once per turn, if you gain LP, even during the Damage Step: You can make all Plant monsters you currently control gain ATK equal to the LP gained, until the end of this turn.
target_text: -- Aromalilith
  local CARD_ID_0 = 92266279 --Humid Winds
  local CARD_ID_1 = 15177750 --Blessed Winds
  local CARD_ID_2 = 28265983 --Dried Winds
  local SETCARD_ID_0 = 0xc9 --Aroma
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--material
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(Card.IsRace, RACE_PLANT), true)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetCondition(s.indcon)
  	e1:SetTarget(s.indtg)
  	e1:SetValue(aux.indoval)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.rmcost)
  	e2:SetTarget(s.rmtg)
  	e2:SetOperation(s.rmop)
  	c:RegisterEffect(e2)
  	--atk & def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_RECOVER)
  	e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL + EFFECT_FLAG_DELAY)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.adcon)
  	e3:SetOperation(s.adop)
  	c:RegisterEffect(e3)
  end
  function s.indcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetLP(tp) > Duel.GetLP(1 - tp)
  end
  function s.indtg(e, c)
  	return e:GetHandler() == c or c:IsRace(RACE_PLANT)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 2000)
  	end
  	Duel.PayLPCost(tp, 2000)
  end
  function s.rmfilter(c)
  	return c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2) and c:IsFaceup()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_ONFIELD, 0, nil):GetCount()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, ct, 0, LOCATION_ONFIELD)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_ONFIELD, 0, nil):GetCount()
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	if g:GetCount() >= ct then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local sg = g:Select(tp, ct, ct, nil)
  		Duel.HintSelection(sg)
  		Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep == tp and e:GetHandler():IsFaceup()
  end
  function s.adfilter(c)
  	return c:IsRace(RACE_PLANT) and c:IsFaceup()
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.adfilter, tp, LOCATION_MZONE, 0, nil)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local tc = g:GetFirst()
  		while tc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(ev)
  			tc:RegisterEffect(e1)
  			tc = g:GetNext()
  		end
  	end
  end
  
  