name: Appliancer
card_text: 1 "Appliancer" monster
  Cannot be used as Link Material the turn it is Link Summoned. Neither player takes any battle damage from attacks involving this card. Once per turn, after damage calculation, if this co-linked card battles an opponent's monster: You can banish that opponent's monster. Once per turn, after damage calculation, if this monster that is not co-linked battles an opponent's monster: You can destroy that opponent's monster, and if you do, inflict damage to your opponent equal to its original ATK.
external_ids: local SETCARD_ID_0 = 0x14b --Appliancer
  
lua: local SETCARD_ID_0 = 0x14b --Appliancer
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 1, 1)
  	--cannot link material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  	e1:SetValue(s.lmlimit)
  	c:RegisterEffect(e1)
  	--damage val
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_NO_BATTLE_DAMAGE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_BATTLED)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCondition(s.rmcon)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  	--destroy
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_BATTLED)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1)
  	e5:SetCondition(s.descon)
  	e5:SetTarget(s.destg)
  	e5:SetOperation(s.desop)
  	c:RegisterEffect(e5)
  end
  function s.lmlimit(e)
  	local c = e:GetHandler()
  	return c:IsStatus(STATUS_SPSUMMON_TURN) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return c:GetMutualLinkedGroupCount() > 0 and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return false
  	end
  	if chk == 0 then
  		return bc:IsAbleToRemove()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, bc, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return
  	end
  	if bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		Duel.Remove(bc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return c:GetMutualLinkedGroupCount() == 0 and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return false
  	end
  	if chk == 0 then
  		return true
  	end
  	local dam = bc:GetTextAttack()
  	if dam < 0 then
  		dam = 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return
  	end
  	if bc:IsRelateToBattle() and bc:IsControler(1 - tp) and Duel.Destroy(bc, REASON_EFFECT) ~= 0 then
  		local dam = bc:GetTextAttack()
  		if dam < 0 then
  			dam = 0
  		end
  		Duel.Damage(1 - tp, dam, REASON_EFFECT)
  	end
  end
  
  
source_text: Appliancer
  1 "Appliancer" monster
  Cannot be used as Link Material the turn it is Link Summoned. Neither player takes any battle damage from attacks involving this card. Once per turn, after damage calculation, if this co-linked card battles an opponent's monster: You can banish that opponent's monster. Once per turn, after damage calculation, if this monster that is not co-linked battles an opponent's monster: You can destroy that opponent's monster, and if you do, inflict damage to your opponent equal to its original ATK.
target_text: -- Appliancer
  local SETCARD_ID_0 = 0x14b --Appliancer
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 1, 1)
  	--cannot link material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
  	e1:SetValue(s.lmlimit)
  	c:RegisterEffect(e1)
  	--damage val
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_NO_BATTLE_DAMAGE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_BATTLED)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCondition(s.rmcon)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  	--destroy
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_BATTLED)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1)
  	e5:SetCondition(s.descon)
  	e5:SetTarget(s.destg)
  	e5:SetOperation(s.desop)
  	c:RegisterEffect(e5)
  end
  function s.lmlimit(e)
  	local c = e:GetHandler()
  	return c:IsStatus(STATUS_SPSUMMON_TURN) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return c:GetMutualLinkedGroupCount() > 0 and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return false
  	end
  	if chk == 0 then
  		return bc:IsAbleToRemove()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, bc, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return
  	end
  	if bc:IsRelateToBattle() and bc:IsControler(1 - tp) then
  		Duel.Remove(bc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if not bc then
  		return false
  	end
  	e:SetLabelObject(bc)
  	return c:GetMutualLinkedGroupCount() == 0 and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsControler(1 - tp) and bc:IsRelateToBattle()
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return false
  	end
  	if chk == 0 then
  		return true
  	end
  	local dam = bc:GetTextAttack()
  	if dam < 0 then
  		dam = 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local bc = e:GetLabelObject()
  	if not bc then
  		return
  	end
  	if bc:IsRelateToBattle() and bc:IsControler(1 - tp) and Duel.Destroy(bc, REASON_EFFECT) ~= 0 then
  		local dam = bc:GetTextAttack()
  		if dam < 0 then
  			dam = 0
  		end
  		Duel.Damage(1 - tp, dam, REASON_EFFECT)
  	end
  end
  
  