Implement Predatory Focus

This commit is contained in:
Noah Gleason 2018-07-09 22:21:40 -04:00
parent 6dce0c26f3
commit 9108104fe5
No known key found for this signature in database
GPG key ID: EC030EC6B0650A40
4 changed files with 92 additions and 5 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.p;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffect;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author noahg
*/
public final class PredatoryFocus extends CardImpl {
public PredatoryFocus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}{G}");
// You may have creatures you control assign their combat damage this turn as though they weren't blocked.
this.getSpellAbility().addEffect(new PredatoryFocusEffect());
}
public PredatoryFocus(final PredatoryFocus card) {
super(card);
}
@Override
public PredatoryFocus copy() {
return new PredatoryFocus(this);
}
}
class PredatoryFocusEffect extends AsThoughEffectImpl {
private boolean choseUse;
public PredatoryFocusEffect() {
super(AsThoughEffectType.DAMAGE_NOT_BLOCKED, Duration.EndOfTurn, Outcome.Damage);
this.staticText = "You may have creatures you control assign their combat damage this turn as though they weren't blocked.";
}
public PredatoryFocusEffect(PredatoryFocusEffect effect) {
super(effect);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Player controller = game.getPlayer(source.getControllerId());
String sourceName = source.getSourceObject(game).getLogName();
choseUse = controller.chooseUse(Outcome.Damage, "Have creatures you control deal combat damage this turn" +
" as though they weren't blocked?", source, game);
game.informPlayers(choseUse ? controller.getName()+" chose to use "+sourceName+"'s effect" :
controller.getName()+" chose not to use "+sourceName+"'s effect.");
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return choseUse && affectedControllerId.equals(source.getControllerId());
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public PredatoryFocusEffect copy() {
return new PredatoryFocusEffect(this);
}
}

View file

@ -130,6 +130,7 @@ public final class Guildpact extends ExpansionSet {
cards.add(new SetCardInfo("Pillory of the Sleepless", 125, Rarity.COMMON, mage.cards.p.PilloryOfTheSleepless.class));
cards.add(new SetCardInfo("Plagued Rusalka", 56, Rarity.UNCOMMON, mage.cards.p.PlaguedRusalka.class));
cards.add(new SetCardInfo("Poisonbelly Ogre", 57, Rarity.COMMON, mage.cards.p.PoisonbellyOgre.class));
cards.add(new SetCardInfo("Predatory Focus", 92, Rarity.UNCOMMON, mage.cards.p.PredatoryFocus.class));
cards.add(new SetCardInfo("Primeval Light", 93, Rarity.UNCOMMON, mage.cards.p.PrimevalLight.class));
cards.add(new SetCardInfo("Pyromatics", 72, Rarity.COMMON, mage.cards.p.Pyromatics.class));
cards.add(new SetCardInfo("Quicken", 31, Rarity.RARE, mage.cards.q.Quicken.class));

View file

@ -18,6 +18,7 @@ public enum AsThoughEffectType {
BLOCK_SWAMPWALK,
BLOCK_MOUNTAINWALK,
BLOCK_FORESTWALK,
DAMAGE_NOT_BLOCKED,
BE_BLOCKED,
PLAY_FROM_NOT_OWN_HAND_ZONE,
CAST_AS_INSTANT,

View file

@ -12,6 +12,7 @@ import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.AsThoughEffectType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
@ -124,11 +125,14 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
return;
} else {
Player player = game.getPlayer(defenderAssignsCombatDamage(game) ? defendingPlayerId : attacker.getControllerId());
if (attacker.getAbilities().containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId())) { // for handling creatures like Thorn Elemental
if (player.chooseUse(Outcome.Damage, "Do you wish to assign damage for " + attacker.getLogName() + " as though it weren't blocked?", null, game)) {
blocked = false;
unblockedDamage(first, game);
}
if ((attacker.getAbilities().containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId()) &&
player.chooseUse(Outcome.Damage, "Do you wish to assign damage for "
+ attacker.getLogName() + " as though it weren't blocked?", null, game)) ||
game.getContinuousEffects().asThough(attacker.getId(), AsThoughEffectType.DAMAGE_NOT_BLOCKED
, null, attacker.getControllerId(), game) != null) {
// for handling creatures like Thorn Elemental
blocked = false;
unblockedDamage(first, game);
}
if (blockers.size() == 1) {
singleBlockerDamage(player, first, game);