name: Fossil
card_text: 1 Rock monster in your GY + 1 Level 7 or higher monster
  Must first be Special Summoned with "Fossil Fusion". While you control this Fusion Summoned card, all monsters your opponent controls lose ATK equal to their original DEF. This card can make up to 3 attacks on monsters during each Battle Phase. When this card destroys an opponent's monster by battle: You can inflict 1000 damage to your opponent.
external_ids: local CARD_ID_0 = 59419719 --Fossil Fusion
  
lua: local CARD_ID_0 = 59419719 --Fossil Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--fusion summon
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, s.matfilter, aux.FilterBoolFunction(Card.IsLevelAbove, 7), true)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.FossilFusionLimit)
  	c:RegisterEffect(e1)
  	--extra attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_EXTRA_ATTACK_MONSTER)
  	e2:SetValue(2)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EVENT_BATTLE_DESTROYING)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCondition(aux.bdocon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	c:RegisterEffect(e3)
  	--atkdown
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(0, LOCATION_MZONE)
  	e4:SetCondition(s.atkcon)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  end
  function s.matfilter(c, fc)
  	return c:IsRace(RACE_ROCK) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(fc:GetControler())
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.atkcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.atkval(e, c)
  	local val = math.max(c:GetBaseDefense(), 0)
  	return val * -1
  end
  
  
source_text: Fossil
  1 Rock monster in your GY + 1 Level 7 or higher monster
  Must first be Special Summoned with "Fossil Fusion". While you control this Fusion Summoned card, all monsters your opponent controls lose ATK equal to their original DEF. This card can make up to 3 attacks on monsters during each Battle Phase. When this card destroys an opponent's monster by battle: You can inflict 1000 damage to your opponent.
target_text: -- Fossil
  local CARD_ID_0 = 59419719 --Fossil Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--fusion summon
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, s.matfilter, aux.FilterBoolFunction(Card.IsLevelAbove, 7), true)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.FossilFusionLimit)
  	c:RegisterEffect(e1)
  	--extra attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_EXTRA_ATTACK_MONSTER)
  	e2:SetValue(2)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EVENT_BATTLE_DESTROYING)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCondition(aux.bdocon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	c:RegisterEffect(e3)
  	--atkdown
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(0, LOCATION_MZONE)
  	e4:SetCondition(s.atkcon)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  end
  function s.matfilter(c, fc)
  	return c:IsRace(RACE_ROCK) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(fc:GetControler())
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.atkcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.atkval(e, c)
  	local val = math.max(c:GetBaseDefense(), 0)
  	return val * -1
  end
  
  