[GNT] implemented Goblin Goliath, GNT set now fully implemented

This commit is contained in:
Oleg Agafonov 2018-11-13 03:20:20 +04:00
parent 2c89ec92d3
commit 2ebe05c85e
3 changed files with 154 additions and 3 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.OpponentsCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.GoblinToken;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class GoblinGoliath extends CardImpl {
public GoblinGoliath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.MUTANT);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
// When Goblin Goliath enters the battlefield, create a number of 1/1 red Goblin creature tokens equal to the number of opponents you have.
Effect effect = new CreateTokenEffect(new GoblinToken(), new OpponentsCount());
effect.setText("create a number of 1/1 red Goblin creature tokens equal to the number of opponents you have");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// {3}{R}, {T}: If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoblinGoliathDamageEffect(), new ManaCostsImpl("{3}{R}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public GoblinGoliath(final GoblinGoliath card) {
super(card);
}
@Override
public GoblinGoliath copy() {
return new GoblinGoliath(this);
}
}
class GoblinGoliathDamageEffect extends ReplacementEffectImpl {
public GoblinGoliathDamageEffect() {
super(Duration.EndOfTurn, Outcome.Damage);
staticText = "If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.";
}
public GoblinGoliathDamageEffect(final GoblinGoliathDamageEffect effect) {
super(effect);
}
@Override
public GoblinGoliathDamageEffect copy() {
return new GoblinGoliathDamageEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
UUID sourceControllerID = source.getControllerId();
UUID damageControllerID = game.getControllerId(event.getSourceId());
UUID damageTargetID = event.getTargetId();
if (sourceControllerID != null && damageControllerID != null && damageTargetID != null) {
// our damage
if (damageControllerID.equals(sourceControllerID)) {
// to opponent only
if (game.getOpponents(sourceControllerID).contains(damageTargetID)) {
return true;
}
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()));
return false;
}
}

View file

@ -1,4 +1,3 @@
package mage.sets;
import mage.cards.ExpansionSet;
@ -43,7 +42,7 @@ public final class GameNight extends ExpansionSet {
cards.add(new SetCardInfo("Forest", 67, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Forest", 68, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ghalta, Primal Hunger", 44, Rarity.RARE, mage.cards.g.GhaltaPrimalHunger.class));
// TODO: cards.add(new SetCardInfo("Goblin Goliath", 4, Rarity.MYTHIC, mage.cards.g.GoblinGoliath.class));
cards.add(new SetCardInfo("Goblin Goliath", 4, Rarity.MYTHIC, mage.cards.g.GoblinGoliath.class));
cards.add(new SetCardInfo("Gruesome Fate", 30, Rarity.COMMON, mage.cards.g.GruesomeFate.class));
cards.add(new SetCardInfo("Howling Golem", 53, Rarity.UNCOMMON, mage.cards.h.HowlingGolem.class));
cards.add(new SetCardInfo("Hydrolash", 22, Rarity.UNCOMMON, mage.cards.h.Hydrolash.class));
@ -89,4 +88,4 @@ public final class GameNight extends ExpansionSet {
cards.add(new SetCardInfo("Zahid, Djinn of the Lamp", 26, Rarity.RARE, mage.cards.z.ZahidDjinnOfTheLamp.class));
cards.add(new SetCardInfo("Zulaport Cutthroat", 36, Rarity.UNCOMMON, mage.cards.z.ZulaportCutthroat.class));
}
}
}

View file

@ -0,0 +1,47 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class GoblinGoliathTest extends CardTestPlayerBase {
@Test
public void test_DoubleDamage() {
// test double damage on creature (no), on yourself (no) and on opponent (yes) by bold damage
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 20);
// {3}{R}, {T}: If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.
addCard(Zone.BATTLEFIELD, playerA, "Goblin Goliath");
addCard(Zone.HAND, playerA, "Lightning Bolt", 4); // 3 damage
addCard(Zone.BATTLEFIELD, playerB, "Barktooth Warbeard"); // 6/5
// normal damage without ability
castSpell(1, PhaseStep.UPKEEP, playerA, "Lightning Bolt", playerB);
checkLife("normal damage to opponent", 1, PhaseStep.PRECOMBAT_MAIN, playerB, 20 - 3);
// activate double damage
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{R}");
// cast bolt to player (2x damage)
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", playerB);
checkLife("double damage to opponent", 1, PhaseStep.END_COMBAT, playerB, 20 - 3 - 3 * 2);
// cast bolt to creature (1x damage)
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", "Barktooth Warbeard");
checkPermanentCount("normal damage to creature", 1, PhaseStep.END_COMBAT, playerB, "Barktooth Warbeard", 1);
// cast bolt to yourself (1x damage)
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", playerA);
checkLife("normal damage to yourself", 1, PhaseStep.END_COMBAT, playerA, 20 - 3);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, "Lightning Bolt", 4);
assertLife(playerA, 20 - 3);
assertLife(playerB, 20 - 3 - 3 * 2);
assertGraveyardCount(playerB, "Barktooth Warbeard", 0);
}
}