mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
add a verify check
This commit is contained in:
parent
d89ec5ba9d
commit
e7de47a656
1 changed files with 35 additions and 3 deletions
|
|
@ -4,9 +4,7 @@ import com.google.common.base.CharMatcher;
|
|||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.AbilityImpl;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.common.*;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
|
@ -36,6 +34,7 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.game.command.Dungeon;
|
||||
import mage.game.command.Plane;
|
||||
import mage.game.draft.DraftCube;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
|
|
@ -63,6 +62,7 @@ import java.util.*;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
|
@ -1718,6 +1718,10 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
}
|
||||
|
||||
if (obj1 instanceof Ability) {
|
||||
checkAbility(originalCard, (Ability) obj1, msg);
|
||||
}
|
||||
|
||||
//System.out.println(msg);
|
||||
Class class1 = obj1.getClass();
|
||||
Class class2 = obj2.getClass();
|
||||
|
|
@ -1852,6 +1856,34 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
}
|
||||
|
||||
// One (fake) event per batch event type
|
||||
private static final Set<GameEvent> fakeBatchEvents;
|
||||
|
||||
static {
|
||||
fakeBatchEvents = Stream
|
||||
.of(GameEvent.EventType.values())
|
||||
.filter(GameEvent.EventType::isBatch)
|
||||
.map(eventType -> new GameEvent(eventType, null, null, null))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform checks on abilities
|
||||
*/
|
||||
private void checkAbility(Card originalCard, Ability ability, String msg) {
|
||||
if (ability instanceof TriggeredAbility) {
|
||||
// Checks that non-batched triggered ability don't accept batch events.
|
||||
if (!(ability instanceof BatchTriggeredAbility)) {
|
||||
for (GameEvent event : fakeBatchEvents) {
|
||||
if (((TriggeredAbility) ability).checkEventType(event, null)) {
|
||||
fail(originalCard, "checkAbility", "unexpected non-BatchTriggeredAbility accepting "
|
||||
+ event.getType() + " " + msg + "<" + ability.getClass() + ">");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSubtypes(Card card, MtgJsonCard ref) {
|
||||
if (skipListHaveName(SKIP_LIST_SUBTYPE, card.getExpansionSetCode(), card.getName())) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue