name: Kaminote
card_text: Activate only if there is at least 1 face-up "Chu-Ske the Mouse Fighter", "Monk Fighter", or "Master Monk" on your side of the field. Destroy the monster(s) that battle with these monsters on your side of the field this turn, at the end of each Damage Step.
external_ids: local CARD_ID_0 = 3810071 --Monk Fighter
  local CARD_ID_1 = 8508055 --Chu-Ske the Mouse Fighter
  local CARD_ID_2 = 49814180 --Master Monk
  
lua: local CARD_ID_0 = 3810071 --Monk Fighter
  local CARD_ID_1 = 8508055 --Chu-Ske the Mouse Fighter
  local CARD_ID_2 = 49814180 --Master Monk
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_0, CARD_ID_2)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	--destroy
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at then
  		return
  	end
  	local g = Group.CreateGroup()
  	if s.cfilter(a) and at:IsLocation(LOCATION_MZONE) then
  		g:AddCard(at)
  	end
  	if s.cfilter(at) and a:IsLocation(LOCATION_MZONE) then
  		g:AddCard(a)
  	end
  	if g:GetCount() > 0 then
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Kaminote
  Activate only if there is at least 1 face-up "Chu-Ske the Mouse Fighter", "Monk Fighter", or "Master Monk" on your side of the field. Destroy the monster(s) that battle with these monsters on your side of the field this turn, at the end of each Damage Step.
target_text: -- Kaminote
  local CARD_ID_0 = 3810071 --Monk Fighter
  local CARD_ID_1 = 8508055 --Chu-Ske the Mouse Fighter
  local CARD_ID_2 = 49814180 --Master Monk
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_0, CARD_ID_2)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	--destroy
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_2)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at then
  		return
  	end
  	local g = Group.CreateGroup()
  	if s.cfilter(a) and at:IsLocation(LOCATION_MZONE) then
  		g:AddCard(at)
  	end
  	if s.cfilter(at) and a:IsLocation(LOCATION_MZONE) then
  		g:AddCard(a)
  	end
  	if g:GetCount() > 0 then
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  