W16 fix. Eldrazi Obligator fix and test

This commit is contained in:
drmDev 2016-04-15 12:24:04 -04:00
parent 162ac957c6
commit 5ab54142de
6 changed files with 64 additions and 16 deletions

View file

@ -1,7 +1,6 @@
package mage.client.util.sets;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
@ -47,7 +46,7 @@ public class ConstructedFormats {
public static List<String> getSetsByFormat(final String format) {
if(!format.equals(ALL)) {
return underlyingSetCodesPerFormat.get(format);
return underlyingSetCodesPerFormat.get(format);
}
return all;
@ -65,7 +64,7 @@ public class ConstructedFormats {
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
expansionInfo.put(set.getName(), set);
formats.add(set.getName());
if (set.getType().equals(SetType.CORE) || set.getType().equals(SetType.EXPANSION)) {
if (set.getType().equals(SetType.CORE) || set.getType().equals(SetType.EXPANSION) || set.getType().equals(SetType.SUPPLEMENTAL_STANDARD_LEGAL)) {
if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) {
if(underlyingSetCodesPerFormat.get(STANDARD) == null) {
underlyingSetCodesPerFormat.put(STANDARD, new ArrayList<String>());

View file

@ -29,14 +29,14 @@
package mage.deck;
import java.util.ArrayList;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import java.util.Collections;
import java.util.Comparator;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.constants.SetType;
/**
@ -58,7 +58,7 @@ public class Standard extends Constructed {
int blocksAdded = 0;
for (Iterator<ExpansionSet> iter = sets.iterator(); iter.hasNext() && blocksAdded < 3; ) {
ExpansionSet set = iter.next();
if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION) { // Still adding core sets because of Magic Origins
if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION || set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) { // Still adding core sets because of Magic Origins
setCodes.add(set.getCode());
if (set.getReleaseDate().before(current.getTime()) // This stops spoiled sets from counting as "new" blocks
&& set.getParentSet() == null

View file

@ -44,7 +44,7 @@ public class WelcomeDeck2016 extends ExpansionSet {
}
private WelcomeDeck2016() {
super("Welcome Deck 2016", "W16", "mage.sets.welcomedeck2016", new GregorianCalendar(2016, 3, 8).getTime(), SetType.SUPPLEMENTAL);
super("Welcome Deck 2016", "W16", "mage.sets.welcomedeck2016", new GregorianCalendar(2016, 3, 8).getTime(), SetType.SUPPLEMENTAL_STANDARD_LEGAL);
this.hasBasicLands = false;
this.hasBoosters = false;
}

View file

@ -65,15 +65,18 @@ public class EldraziObligator extends CardImpl {
// Haste
this.addAbility(HasteAbility.getInstance());
DoIfCostPaid costPaidEffect = new DoIfCostPaid(new GainControlTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{C}"));
Effect untapEffect = new UntapTargetEffect();
untapEffect.setText("Untap that creature");
Effect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
hasteEffect.setText("It gains haste until end of turn");
costPaidEffect.addEffect(untapEffect);
costPaidEffect.addEffect(hasteEffect);
// When you cast Eldrazi Obligator, you may pay {1}{C}. If you do, gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn.
Ability ability = new CastSourceTriggeredAbility(new DoIfCostPaid(new GainControlTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{C}")));
Effect effect = new UntapTargetEffect();
effect.setText("Untap that creature");
ability.addEffect(effect);
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setText("It gains haste until end of turn");
ability.addEffect(effect);
Ability ability = new CastSourceTriggeredAbility(costPaidEffect);
Target target = new TargetCreaturePermanent(new FilterCreaturePermanent());
ability.addTarget(target);
this.addAbility(ability);

View file

@ -0,0 +1,45 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.single.ogw;
import mage.abilities.keyword.HasteAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class EldraziObligatorTest extends CardTestPlayerBase {
/*
* Reported bug: Eldrazi Obligator is untapping targetted creature when cost is not paid
*/
@Test
public void targetCreatureDoNotPayAdditionalCost() {
addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable"); // 2/1
//When you cast Eldrazi Obligator, you may pay {1}{C}. If you do, gain control of target creature until end of turn,
//untap that creature, and it gains haste until end of turn.
addCard(Zone.HAND, playerB, "Eldrazi Obligator"); // 3/1 w/haste
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
attack(1, playerA, "Bronze Sable"); // tap dat sable
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Eldrazi Obligator");
setChoice(playerB, "No");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Bronze Sable", 1);
assertPermanentCount(playerB, "Eldrazi Obligator", 1);
assertAbility(playerA, "Bronze Sable", HasteAbility.getInstance(), false); // should not gain haste or untap
assertTapped("Bronze Sable", true);
}
}

View file

@ -9,6 +9,7 @@ public enum SetType {
CORE("Core"),
MAGIC_ONLINE("Magic Online"),
SUPPLEMENTAL("Supplemental"),
SUPPLEMENTAL_STANDARD_LEGAL("Standard Legal Supplemental"),
PROMOTIONAL("Promotional"),
JOKESET("Joke Set");