net.sf.magicproject.test
Class Test

java.lang.Object
  extended by net.sf.magicproject.test.Test
Direct Known Subclasses:
AbilityIs, AbilitySource, ActionSource, ContextTest, DeckCounter, False, Has, ReplaceTested, TestBoolean, TestExpr, TestObject, True

public abstract class Test
extends java.lang.Object

Since:
0.54
Author:
Fabrice Daugan

Method Summary
 void extractTriggeredEvents(java.util.List<MEventListener> res, MCard source, Test globalTest)
          Add to the specified list, the events modifying the result of this test.
 Test getConstraintTest(java.util.Map<java.lang.String,Expression> values)
          Return this test where values depending on values of this action have been replaced.
 Player getOptimizedController(Ability ability, ContextEventListener context)
          Return the controller making true this test.
abstract  boolean test(Ability ability, Targetable tested)
          Indicates if the specified card matches with the test to do
 boolean testPreemption(Ability ability, Targetable tested)
          Indicates if the specified card matches with the test to do.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConstraintTest

public Test getConstraintTest(java.util.Map<java.lang.String,Expression> values)
Return this test where values depending on values of this action have been replaced.

Parameters:
values - are referencable values.
Returns:
a parsed test.
Since:
0.85

test

public abstract boolean test(Ability ability,
                             Targetable tested)
Indicates if the specified card matches with the test to do

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
tested - the tested card
Returns:
true if the specified card matches with the test to do

extractTriggeredEvents

public void extractTriggeredEvents(java.util.List<MEventListener> res,
                                   MCard source,
                                   Test globalTest)
Add to the specified list, the events modifying the result of this test.

Parameters:
res - is the list of events to fill
source - is the card source of event
globalTest - the optional global test to include in the event test.

getOptimizedController

public Player getOptimizedController(Ability ability,
                                     ContextEventListener context)
Return the controller making true this test. If several players or no player can make this test true, the null value is returned.

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
context - is the context of current ability
Returns:
the controller making true this test. If several player or no player can make this test true, the null value is returned.

testPreemption

public boolean testPreemption(Ability ability,
                              Targetable tested)
Indicates if the specified card matches with the test to do.

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
tested - the tested card
Returns:
true if the specified card matches with the test to do


Copyright © 2003-2007 Magic-Project. All Rights Reserved.