It is currently 13 Nov 2019, 15:21
   
Text Size

Does the COLOUR_X constant work somehow?

Moderators: Xander9009, 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: 717 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.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2130
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 473 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 5 guests


Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests (based on users active over the past 10 minutes)
Most users ever online was 427 on 11 Nov 2019, 13:00

Users browsing this forum: No registered users and 5 guests

Login Form