It is currently 24 Apr 2024, 10:48
   
Text Size

Does the COLOUR_X constant work somehow?

Moderator: CCGHQ Admins

Does the COLOUR_X constant work somehow?

Postby thefiremind » 16 Feb 2013, 00:19

I was trying to code Frontline Medic, happy to see that there's a constant called COLOUR_X. I thought it was a "virtual" color given to cards that have {X} in their mana costs. So I made this target definition:
Code: Select all
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_STACK )
    filter:SetStackObjectType( STACK_OBJECT_CARD )
    filter:AddColour( COLOUR_X )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
...and tested it against the AI casting Green Sun's Zenith, but no way, I couldn't activate the ability.

Am I missing something, or COLOUR_X doesn't work at all? :?

Just in case someone has the same big idea as I had, the following code doesn't work either:
Code: Select all
    <TARGET_DEFINITION id="0">
    MTG():ClearFilterMarkedObjectsInZone( ZONE_STACK )
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_STACK )
    filter:SetStackObjectType( STACK_OBJECT_CARD )
    local filter_count = filter:EvaluateObjects()
    for i=0,filter_count-1 do
        local candidate = filter:GetNthEvaluatedObject(i)
       local chest = candidate:GetDataChest()
        if chest ~= nil and chest:Get_Int( COMPARTMENT_ID_X ) &gt; 0 then
           candidate:MarkForFilter()
        end
    end
    filter:SetMarkedObjectsOnly()
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
Apart from being sub-optimal if it worked (it would allow to counter only spells where {X} is greater than 0, but I could live with it), it doesn't work at all, and if I remember well it's not the first time that I try to mark objects on the stack: I think it's something that the game can't do, no matter what.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Does the COLOUR_X constant work somehow?

Postby RiiakShiNal » 16 Feb 2013, 02:08

It would not surprise me if COLOUR_X does not work at all, much like COLOUR_COLOURLESS doesn't work and we have to test for each colour to make sure a card is or is not colourless.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 10 guests


Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 10 guests

Login Form