It is currently 24 Apr 2024, 12:25
   
Text Size

DomainValue()

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

DomainValue()

Postby LokiX » 27 Mar 2015, 17:10

Hi,
I'm trying to implement Allied Strategies, however that card needs the domain count of the target player not of the controller, XMage DomainValue() currently doesn't support this, and so I thought of adding another method 'calculate' to the existing DomainValue class which would be something like this

Code: Select all
public int calculate(Game game, Player target, Effect effect)
But I'm not sure that's the right approach. Should I do it like I described it, or should I create a class TargetDomainValue that would calculate the the domain value of the target and if so, should I just extend DomainValue class and Override the calculate method?

Or do you guys have any other suggestion that I might be missing?
LokiX
 
Posts: 4
Joined: 03 Jun 2012, 22:17
Has thanked: 1 time
Been thanked: 0 time

Re: DomainValue()

Postby LevelX » 28 Mar 2015, 08:44

A new calculate method is no good idea. It wouldn't be compatible with the existing classes that use DynamicValues.

I would simply add a new boolean parameter to the DomainValue() class.

So the constructors would look like this.

Code: Select all
    public DomainValue() {
        this(1);
    }

    public DomainValue(boolean countTargetPlayer){
        this(1, countTargetPlayer);
    }

    public DomainValue(Integer amount){
        this(amount, false);
    }

    public DomainValue(Integer amount, boolean countTargetPlayer){
        this.amount = amount;
    }
And than add the other needed logic to support the parameter in the class.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: DomainValue()

Postby LokiX » 28 Mar 2015, 18:52

Thanks, LevelX.
I had to modify it a bit for it to work but I think I got the general idea.

Will make a PR in a bit.

Thanks, again.
LokiX
 
Posts: 4
Joined: 03 Jun 2012, 22:17
Has thanked: 1 time
Been thanked: 0 time


Return to Developers 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 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 5 guests

Login Form