theonepharaoh
2016-05-16T10:50:37Z
this is my first now second card script and I'm having a huge problem with this effect

"Negate the effects of all monsters on the field with ATK lower than this card's.

During each player's Standby Phase: All face-up monsters on the field lose 500 ATK. When another monster(s) on the field loses ATK: This card gains 300 ATK for each of these monsters."

I used D-hero plasma's effect as a base for the first effect and I got the "get ATK" condition from Scarlight Red Dragon Archfiend but that condition can't seem to work.

I haven't started on the second effect yet.
any help or hints is appreciated.
thanks in advance.

	--disable
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DISABLE)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetRange(LOCATION_MZONE)
	e1:SetTargetRange(0,LOCATION_MZONE)
	e1:SetTarget(cxxxxxxx.distg)
	e1:SetOperation(cxxxxxxx.disop)
	c:RegisterEffect(e1)
end

function cxxxxxxx.filter(c,atk)
	return c:IsFaceup() and c:IsAttackBelow(atk)
		and c:IsType(TYPE_EFFECT)
end
function cxxxxxxx.distg(e,tp,eg,ep,ev,re,r,rp,chk)
	local c=e:GetHandler()
	if chk==0 then return Duel.IsExistingMatchingCard(cxxxxxxx.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c:GetAttack()) end
	local g=Duel.GetMatchingGroup(cxxxxxxx.filter,tp,LOCATION_MZONE,LOCATION_MZONE,c,c:GetAttack())
	Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,g:GetCount(),0,0)

end
function cxxxxxxx.disop(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
	local g=Duel.GetMatchingGroup(cxxxxxxx.filter,tp,LOCATION_MZONE,LOCATION_MZONE,c,c:GetAttack())
	local ct=Duel.DISABLE(g,REASON_EFFECT)
	if ct>0 then
		Duel.BreakEffect()
	end
end