name: Trust
card_text: This card cannot be used as a Synchro Material Monster, except for the Synchro Summon of a Level 7 or higher Synchro Monster. Once per turn, that Synchro Monster cannot be destroyed by battle. Each time this effect is applied, that Synchro Monster loses 400 ATK and DEF at the end of the Damage Step.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetValue(s.synlimit)
  	c:RegisterEffect(e1)
  	--be material
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_EVENT_PLAYER)
  	e2:SetCondition(s.ccon)
  	e2:SetOperation(s.cop)
  	c:RegisterEffect(e2)
  end
  function s.synlimit(e, c)
  	if not c then
  		return false
  	end
  	return c:IsLevelBelow(6)
  end
  function s.ccon(e, tp, eg, ep, ev, re, r, rp)
  	return r == REASON_SYNCHRO
  end
  function s.cop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = c:GetReasonCard()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
  	e1:SetCountLimit(1)
  	e1:SetValue(s.valcon)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	rc:RegisterEffect(e1, true)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(s.adcon)
  	e2:SetOperation(s.adop)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	rc:RegisterEffect(e2, true)
  end
  function s.valcon(e, re, r, rp)
  	if bit.band(r, REASON_BATTLE) ~= 0 then
  		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE, 0, 1)
  		return true
  	else
  		return false
  	end
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(e:GetOwner())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(-400)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  end
  
  
source_text: Trust
  This card cannot be used as a Synchro Material Monster, except for the Synchro Summon of a Level 7 or higher Synchro Monster. Once per turn, that Synchro Monster cannot be destroyed by battle. Each time this effect is applied, that Synchro Monster loses 400 ATK and DEF at the end of the Damage Step.
target_text: -- Trust
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetValue(s.synlimit)
  	c:RegisterEffect(e1)
  	--be material
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_EVENT_PLAYER)
  	e2:SetCondition(s.ccon)
  	e2:SetOperation(s.cop)
  	c:RegisterEffect(e2)
  end
  function s.synlimit(e, c)
  	if not c then
  		return false
  	end
  	return c:IsLevelBelow(6)
  end
  function s.ccon(e, tp, eg, ep, ev, re, r, rp)
  	return r == REASON_SYNCHRO
  end
  function s.cop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = c:GetReasonCard()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
  	e1:SetCountLimit(1)
  	e1:SetValue(s.valcon)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	rc:RegisterEffect(e1, true)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(s.adcon)
  	e2:SetOperation(s.adop)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	rc:RegisterEffect(e2, true)
  end
  function s.valcon(e, re, r, rp)
  	if bit.band(r, REASON_BATTLE) ~= 0 then
  		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE, 0, 1)
  		return true
  	else
  		return false
  	end
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(e:GetOwner())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(-400)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  end
  
  