name: Mound
card_text: Level 10 or higher monsters on the field cannot be targeted or destroyed by card effects. If a Level 10 or higher monster destroys a monster by battle and sends it to the GY: The player who controlled the destroyed monster takes 1000 damage. When this card on the field is destroyed by card effect and sent to the GY: You can add 1 DIVINE monster from your Deck to your hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.target)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_BATTLE_DESTROYED)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCondition(s.damcon)
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetCondition(s.thcon)
  	e5:SetTarget(s.thtg)
  	e5:SetOperation(s.thop)
  	c:RegisterEffect(e5)
  end
  function s.target(e, c)
  	return c:IsLevelAbove(10)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local des = eg:GetFirst()
  	local rc = des:GetReasonCard()
  	return des:IsLocation(LOCATION_GRAVE) and des:IsType(TYPE_MONSTER) and rc:IsRelateToBattle() and rc:IsLevelAbove(10)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local damp = eg:GetFirst():GetPreviousControler()
  	Duel.SetTargetPlayer(damp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, damp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, v = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, v, REASON_EFFECT)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, 0x41) == 0x41 and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.filter(c)
  	return c:IsAttribute(ATTRIBUTE_DIVINE) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Mound
  Level 10 or higher monsters on the field cannot be targeted or destroyed by card effects. If a Level 10 or higher monster destroys a monster by battle and sends it to the GY: The player who controlled the destroyed monster takes 1000 damage. When this card on the field is destroyed by card effect and sent to the GY: You can add 1 DIVINE monster from your Deck to your hand.
target_text: -- Mound
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.target)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_BATTLE_DESTROYED)
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCondition(s.damcon)
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetCondition(s.thcon)
  	e5:SetTarget(s.thtg)
  	e5:SetOperation(s.thop)
  	c:RegisterEffect(e5)
  end
  function s.target(e, c)
  	return c:IsLevelAbove(10)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local des = eg:GetFirst()
  	local rc = des:GetReasonCard()
  	return des:IsLocation(LOCATION_GRAVE) and des:IsType(TYPE_MONSTER) and rc:IsRelateToBattle() and rc:IsLevelAbove(10)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local damp = eg:GetFirst():GetPreviousControler()
  	Duel.SetTargetPlayer(damp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, damp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, v = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, v, REASON_EFFECT)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, 0x41) == 0x41 and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.filter(c)
  	return c:IsAttribute(ATTRIBUTE_DIVINE) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  