YGOPRO Forum

Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
fretman5000  
#1 Posted : Sunday, March 19, 2017 8:28:43 PM(UTC)
fretman5000

Rank: Newbie

Joined: 3/19/2017(UTC)
Posts: 8

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
How would the above be structured?

I am assuming this would use a condition, so something like this:






and then the target would just be set to battle target, operation would just be to do X (since condition function is resolved to True or False before touching target or operation functions).

I'm just having issues thinking of the logic involved in order to capture all attributes of monsters on your side of the field, and then compare those to the battle target's attribute.

Any ideas? Any input would be stellar. I have 4 or 5 custom cards with this type of condition, and it's driving me insane that I can't figure this out :)

Thanks!

Valossa  
#2 Posted : Sunday, March 19, 2017 8:54:25 PM(UTC)
Valossa

Rank: Advanced Member

Joined: 2/19/2015(UTC)
Posts: 501

Thanks: 38 times
Was thanked: 7 time(s) in 7 post(s)
I have a monster that gain double atk when battle with monster that have same atribute, and cannot be destroyed by battle or effects with the same
thanks 1 user thanked Valossa for this useful post.
fretman5000  
#3 Posted : Sunday, March 19, 2017 9:00:05 PM(UTC)
fretman5000

Rank: Newbie

Joined: 3/19/2017(UTC)
Posts: 8

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Quote:
I have a monster that gain double atk when battle with monster that have same atribute, and cannot be destroyed by battle or effects with the same


So this would be more manageable, as you could just compare c:GetAttribute()==tc:GetAttribute() in your filter statement.

However, what I'm after is comparing ALL attributes of monsters you control to that battle target's attribute.

Thanks for the post, though. Nice to know there are other folks out there trying to code this stuff too :)

Edited by user Sunday, March 19, 2017 9:00:45 PM(UTC)  | Reason: Not specified

SotheY  
#4 Posted : Monday, March 20, 2017 2:44:55 PM(UTC)
SotheY

Rank: Advanced Member

Joined: 3/18/2016(UTC)
Posts: 275

Thanks: 26 times
Was thanked: 16 time(s) in 16 post(s)
What if you add a function like:

function c30888983.cfilter(c,att)
return c:IsFaceup() and c:IsAttribute(att)
end
function c30888983.filter(c)
return Duel.IsExistingMatchingCard(c30888983.cfilter,0,LOCATION_MZONE,0,1,nil,c:GetAttribute())
end
function c30888983.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c30888983.filter,1,nil)
end

(Got that form "The Selection" which checks for same Type)
fretman5000  
#5 Posted : Tuesday, March 21, 2017 12:46:24 AM(UTC)
fretman5000

Rank: Newbie

Joined: 3/19/2017(UTC)
Posts: 8

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Quote:
What if you add a function like:

function c30888983.cfilter(c,att)
return c:IsFaceup() and c:IsAttribute(att)
end
function c30888983.filter(c)
return Duel.IsExistingMatchingCard(c30888983.cfilter,0,LOCATION_MZONE,0,1,nil,c:GetAttribute())
end
function c30888983.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c30888983.filter,1,nil)
end

(Got that form "The Selection" which checks for same Type)


Thanks for the suggestion! The only problem here is that the filter is applied to eg (event group).
In my use case, since this would be triggered by EVENT_BATTLE_START, it is my understanding the event group members would contain the attacking card and the attack target (and therefor monsters on my side of the field would not be included). I still need to find a way to filter all monsters on my side of the field, then compare that with the attack target.

I'm thinking Duel.IsExistingMAtchingCard() would be perfect for this, sending my LOCATION_MZONE as a parameter. However, it doesn't quite seem to work...

Here's what I have so far:



When I comment out this line:
and Duel.IsExistingMatchingCard(c1.destroyfilter,tp,LOCATION_MZONE,0,1,nil,tc:GetAttribute())

the battle target is always destroyed. But when I put it back in, the battle target is never destroyed, regardless of what attribute it is vs. monsters I control.

it's gotta be something with that line...just not sure what at this point.

Edited by user Tuesday, March 21, 2017 12:48:17 AM(UTC)  | Reason: Not specified

fretman5000  
#6 Posted : Tuesday, March 21, 2017 12:50:43 AM(UTC)
fretman5000

Rank: Newbie

Joined: 3/19/2017(UTC)
Posts: 8

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
NEVERMIND...I had an L somewhere instead of a semicolon...:wall Edited the code and slapped myself right in the face for a stupid mistake.

On the bright side, here's code for comparing attributes of all monsters you control to an attack target! :lol
Valossa  
#7 Posted : Tuesday, March 21, 2017 12:31:49 PM(UTC)
Valossa

Rank: Advanced Member

Joined: 2/19/2015(UTC)
Posts: 501

Thanks: 38 times
Was thanked: 7 time(s) in 7 post(s)
my gift to you my Necro Doll Annalilith
effect:

You can Special Summon this card from your hand or Graveyard by paying 2000 LP. This card cannot be destroyed by battle or card effects with monsters that not have the same attribute as this card. When this card battle with a monster that not have the same attribute as this card gain the double of the attacking monsters.

Code:

--Necro Doll - Annalilith
function c494476151.initial_effect(c)
--atkcondition
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(494476151,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e1:SetCondition(c494476151.atkcon)
e1:SetOperation(c494476151.atkop)
c:RegisterEffect(e1)
--special summon
        local e2=Effect.CreateEffect(c)
    e2:SetType(EFFECT_TYPE_FIELD)
    e2:SetCode(EFFECT_SPSUMMON_PROC)
    e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
    e2:SetRange(LOCATION_HAND+LOCATION_GRAVE)
    e2:SetCondition(c494476151.spcon)
    e2:SetOperation(c494476151.spop)
    c:RegisterEffect(e2)
--cannot be destoyed by battle with different attribute
local e3=Effect.CreateEffect(c)
    e3:SetType(EFFECT_TYPE_SINGLE)
    e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
    e3:SetValue(c494476151.indes)
    c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e4)
end

function c494476151.spcon(e,c)
    if c==nil then return true end
    return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
        Duel.CheckLPCost(c:GetControler(),2000)
end

function c494476151.spop(e,tp,eg,ep,ev,re,r,rp,c)
    Duel.PayLPCost(tp,2000)
end

function c494476151.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return bc and bc:GetAttribute()~=c:GetAttribute()
end

function c494476151.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
if c:IsRelateToBattle() and c:IsFaceup() and bc:IsRelateToBattle() and bc:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(bc:GetAttack()*2)
c:RegisterEffect(e1)
end
end

function c494476151.indes(e,c)
local bc=c:GetBattleTarget()
return bc and bc:GetAttribute()~=c:GetAttribute()
end

Edited by user Tuesday, March 21, 2017 12:34:11 PM(UTC)  | Reason: Not specified

Valossa  
#8 Posted : Tuesday, March 21, 2017 12:36:06 PM(UTC)
Valossa

Rank: Advanced Member

Joined: 2/19/2015(UTC)
Posts: 501

Thanks: 38 times
Was thanked: 7 time(s) in 7 post(s)
this card dont have your ATK reduced to 0 in the end of the turn its comulative
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error