mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Merge pull request #3862 from theelk801/master
Implemented Path of Ancestry, fixed several bugs
This commit is contained in:
commit
69ba26ddc0
10 changed files with 388 additions and 195 deletions
|
@ -27,8 +27,9 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
|
@ -37,19 +38,14 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.UntapAllControllerEffect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +66,7 @@ public class CurseOfBounty extends CardImpl {
|
|||
|
||||
// Whenever enchanted player is attacked, untap all nonland permanents you control.
|
||||
// Each opponent attacking that player untaps all nonland permanents he or she controls.
|
||||
this.addAbility(new CurseOfBountyTriggeredAbility());
|
||||
this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfBountyEffect()));
|
||||
}
|
||||
|
||||
public CurseOfBounty(final CurseOfBounty card) {
|
||||
|
@ -83,52 +79,49 @@ public class CurseOfBounty extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfBountyTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class CurseOfBountyEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfBountyTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new UntapAllControllerEffect(new FilterNonlandPermanent()), false);
|
||||
CurseOfBountyEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "untap all nonland permanents you control. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
public CurseOfBountyTriggeredAbility(final CurseOfBountyTriggeredAbility ability) {
|
||||
super(ability);
|
||||
CurseOfBountyEffect(final CurseOfBountyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARED_ATTACKERS;
|
||||
public CurseOfBountyEffect copy() {
|
||||
return new CurseOfBountyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null
|
||||
&& enchantment.getAttachedTo() != null
|
||||
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
|
||||
if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(), game)) {
|
||||
Effect effect = new UntapAllNonlandsTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
|
||||
this.addEffect(effect);
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
Set<UUID> players = new HashSet();
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||
if (defender.equals(enchantedPlayer.getId())
|
||||
&& game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
|
||||
players.add(game.getPermanent(attacker).getControllerId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
players.add(source.getControllerId());
|
||||
for (UUID player : players) {
|
||||
game.getPlayer(player);
|
||||
Effect effect = new UntapAllNonlandsTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(player));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, untap all nonland permanents you control. "
|
||||
+ "Each opponent attacking that player untaps all nonland permanents he or she controls.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfBountyTriggeredAbility copy() {
|
||||
return new CurseOfBountyTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UntapAllNonlandsTargetEffect extends OneShotEffect {
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -39,11 +42,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.ZombieToken;
|
||||
import mage.players.Player;
|
||||
|
@ -67,7 +66,7 @@ public class CurseOfDisturbance extends CardImpl {
|
|||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same.
|
||||
this.addAbility(new CurseOfDisturbanceTriggeredAbility());
|
||||
this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfDisturbanceEffect()));
|
||||
}
|
||||
|
||||
public CurseOfDisturbance(final CurseOfDisturbance card) {
|
||||
|
@ -80,50 +79,48 @@ public class CurseOfDisturbance extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfDisturbanceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class CurseOfDisturbanceEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfDisturbanceTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken()), false);
|
||||
CurseOfDisturbanceEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "create a 2/2 black Zombie creature token. "
|
||||
+ "Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
public CurseOfDisturbanceTriggeredAbility(final CurseOfDisturbanceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
CurseOfDisturbanceEffect(final CurseOfDisturbanceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARED_ATTACKERS;
|
||||
public CurseOfDisturbanceEffect copy() {
|
||||
return new CurseOfDisturbanceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null
|
||||
&& enchantment.getAttachedTo() != null
|
||||
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
|
||||
if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(), game)) {
|
||||
Effect effect = new CreateTokenTargetEffect(new ZombieToken());
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
|
||||
this.addEffect(effect);
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
Set<UUID> players = new HashSet();
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||
if (defender.equals(enchantedPlayer.getId())
|
||||
&& game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
|
||||
players.add(game.getPermanent(attacker).getControllerId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
players.add(source.getControllerId());
|
||||
for (UUID player : players) {
|
||||
game.getPlayer(player);
|
||||
Effect effect = new CreateTokenTargetEffect(new ZombieToken());
|
||||
effect.setTargetPointer(new FixedTarget(player));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfDisturbanceTriggeredAbility copy() {
|
||||
return new CurseOfDisturbanceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -39,11 +42,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.GoldToken;
|
||||
import mage.players.Player;
|
||||
|
@ -68,7 +67,7 @@ public class CurseOfOpulence extends CardImpl {
|
|||
|
||||
// Whenever enchanted player is attacked, create a colorless artifact token named Gold.
|
||||
// It has "sacrifice this artifact: Add one mana of any color to your mana pool." Each opponent attacking that player does the same.
|
||||
this.addAbility(new CurseOfOpulenceTriggeredAbility());
|
||||
this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfOpulenceEffect()));
|
||||
}
|
||||
|
||||
public CurseOfOpulence(final CurseOfOpulence card) {
|
||||
|
@ -81,51 +80,49 @@ public class CurseOfOpulence extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfOpulenceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class CurseOfOpulenceEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfOpulenceTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new GoldToken()), false);
|
||||
CurseOfOpulenceEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "create a colorless artifact token named Gold. It has "
|
||||
+ "\"sacrifice this artifact: Add one mana of any color to your mana pool.\" "
|
||||
+ "Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
public CurseOfOpulenceTriggeredAbility(final CurseOfOpulenceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
CurseOfOpulenceEffect(final CurseOfOpulenceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARED_ATTACKERS;
|
||||
public CurseOfOpulenceEffect copy() {
|
||||
return new CurseOfOpulenceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null
|
||||
&& enchantment.getAttachedTo() != null
|
||||
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
|
||||
if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(), game)) {
|
||||
Effect effect = new CreateTokenTargetEffect(new GoldToken());
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
|
||||
this.addEffect(effect);
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
Set<UUID> players = new HashSet();
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||
if (defender.equals(enchantedPlayer.getId())
|
||||
&& game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
|
||||
players.add(game.getPermanent(attacker).getControllerId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
players.add(source.getControllerId());
|
||||
for (UUID player : players) {
|
||||
game.getPlayer(player);
|
||||
Effect effect = new CreateTokenTargetEffect(new GoldToken());
|
||||
effect.setTargetPointer(new FixedTarget(player));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, create a colorless artifact token named Gold. "
|
||||
+ "It has \"sacrifice this artifact: Add one mana of any color to your mana pool.\" Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfOpulenceTriggeredAbility copy() {
|
||||
return new CurseOfOpulenceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -39,11 +42,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -66,7 +65,7 @@ public class CurseOfVerbosity extends CardImpl {
|
|||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same.
|
||||
this.addAbility(new CurseOfVerbosityTriggeredAbility());
|
||||
this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfVerbosityEffect()));
|
||||
}
|
||||
|
||||
public CurseOfVerbosity(final CurseOfVerbosity card) {
|
||||
|
@ -79,50 +78,47 @@ public class CurseOfVerbosity extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfVerbosityTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class CurseOfVerbosityEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfVerbosityTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false);
|
||||
CurseOfVerbosityEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "draw a card. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
public CurseOfVerbosityTriggeredAbility(final CurseOfVerbosityTriggeredAbility ability) {
|
||||
super(ability);
|
||||
CurseOfVerbosityEffect(final CurseOfVerbosityEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARED_ATTACKERS;
|
||||
public CurseOfVerbosityEffect copy() {
|
||||
return new CurseOfVerbosityEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null
|
||||
&& enchantment.getAttachedTo() != null
|
||||
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
|
||||
if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(), game)) {
|
||||
Effect effect = new DrawCardTargetEffect(1);
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
|
||||
this.addEffect(effect);
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
Set<UUID> players = new HashSet();
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||
if (defender.equals(enchantedPlayer.getId())
|
||||
&& game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
|
||||
players.add(game.getPermanent(attacker).getControllerId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
players.add(source.getControllerId());
|
||||
for (UUID player : players) {
|
||||
game.getPlayer(player);
|
||||
Effect effect = new DrawCardTargetEffect(1);
|
||||
effect.setTargetPointer(new FixedTarget(player));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfVerbosityTriggeredAbility copy() {
|
||||
return new CurseOfVerbosityTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
|
@ -36,17 +37,15 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.GainLifeTargetEffect;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +65,7 @@ public class CurseOfVitality extends CardImpl {
|
|||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same.
|
||||
this.addAbility(new CurseOfVitalityTriggeredAbility());
|
||||
this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfVitalityEffect()));
|
||||
}
|
||||
|
||||
public CurseOfVitality(final CurseOfVitality card) {
|
||||
|
@ -79,50 +78,47 @@ public class CurseOfVitality extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfVitalityTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class CurseOfVitalityEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfVitalityTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainLifeEffect(2), false);
|
||||
CurseOfVitalityEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "gain 2 life. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
public CurseOfVitalityTriggeredAbility(final CurseOfVitalityTriggeredAbility ability) {
|
||||
super(ability);
|
||||
CurseOfVitalityEffect(final CurseOfVitalityEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARED_ATTACKERS;
|
||||
public CurseOfVitalityEffect copy() {
|
||||
return new CurseOfVitalityEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null
|
||||
&& enchantment.getAttachedTo() != null
|
||||
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
|
||||
if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(), game)) {
|
||||
Effect effect = new GainLifeTargetEffect(2);
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
|
||||
this.addEffect(effect);
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
Set<UUID> players = new HashSet();
|
||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||
if (defender.equals(enchantedPlayer.getId())
|
||||
&& game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
|
||||
players.add(game.getPermanent(attacker).getControllerId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
players.add(source.getControllerId());
|
||||
for (UUID player : players) {
|
||||
game.getPlayer(player);
|
||||
Effect effect = new GainLifeTargetEffect(2);
|
||||
effect.setTargetPointer(new FixedTarget(player));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfVitalityTriggeredAbility copy() {
|
||||
return new CurseOfVitalityTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
128
Mage.Sets/src/mage/cards/p/PathOfAncestry.java
Normal file
128
Mage.Sets/src/mage/cards/p/PathOfAncestry.java
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.abilities.mana.CommanderColorIdentityManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SubTypeSet;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class PathOfAncestry extends CardImpl {
|
||||
|
||||
public PathOfAncestry(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
||||
// Path of Ancestry enters the battlefield tapped.
|
||||
this.addAbility(new EntersBattlefieldTappedAbility());
|
||||
|
||||
// T: Add to your mana pool one mana of any color in your commander's color identity.
|
||||
Ability ability = new CommanderColorIdentityManaAbility();
|
||||
this.addAbility(ability);
|
||||
|
||||
// When that mana is spent to cast a creature spell that shares a creature type with your commander, scry 1.
|
||||
Effect effect = new ScryEffect(1);
|
||||
this.addAbility(new PathOfAncestryTriggeredAbility(ability.getOriginalId(), effect));
|
||||
}
|
||||
|
||||
public PathOfAncestry(final PathOfAncestry card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathOfAncestry copy() {
|
||||
return new PathOfAncestry(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
String abilityOriginalId;
|
||||
|
||||
public PathOfAncestryTriggeredAbility(UUID abilityOriginalId, Effect effect) {
|
||||
super(Zone.ALL, effect, true);
|
||||
this.abilityOriginalId = abilityOriginalId.toString();
|
||||
}
|
||||
|
||||
public PathOfAncestryTriggeredAbility(final PathOfAncestryTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.abilityOriginalId = ability.abilityOriginalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathOfAncestryTriggeredAbility copy() {
|
||||
return new PathOfAncestryTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.MANA_PAID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getData().equals(abilityOriginalId)) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.isCreature()) {
|
||||
Iterator<SubType> spellSubs = spell.getSubtype(game).iterator();
|
||||
while (spellSubs.hasNext()) {
|
||||
SubType sType = spellSubs.next();
|
||||
if (sType.getSubTypeSet() == SubTypeSet.CreatureType) {
|
||||
for (UUID cmdr : game.getPlayer(spell.getControllerId()).getCommandersIds()) {
|
||||
if (game.getObject(cmdr).getSubtype(game).contains(sType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When that mana is used to cast a creature spell that shares a creature type with your commander, " + super.getRule();
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,8 +48,10 @@ import mage.constants.Zone;
|
|||
*/
|
||||
public class SiegeBehemoth extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each creature you control");
|
||||
|
||||
public SiegeBehemoth(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
|
||||
this.subtype.add("Beast");
|
||||
|
||||
this.power = new MageInt(7);
|
||||
|
@ -61,7 +64,7 @@ public class SiegeBehemoth extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new ConditionalContinuousEffect(
|
||||
new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||
new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.WhileOnBattlefield, filter),
|
||||
SourceAttackingCondition.instance,
|
||||
"As long as {this} is attacking, for each creature you control, you may have that creature assign its combat damage as though it weren't blocked"
|
||||
)));
|
||||
|
|
|
@ -29,6 +29,7 @@ package mage.cards.w;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
|
||||
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -40,6 +41,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -57,7 +59,8 @@ public class WitherscaleWurm extends CardImpl {
|
|||
// Whenever Witherscale Wurm blocks or becomes blocked by a creature, that creature gains wither until end of turn.
|
||||
Effect effect = new GainAbilityTargetEffect(WitherAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setText("that creature gains wither until end of turn");
|
||||
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, false));
|
||||
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(effect, new FilterCreaturePermanent("a creature"), false, null, true);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever Witherscale Wurm deals damage to an opponent, remove all -1/-1 counters from it.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new RemoveAllCountersSourceEffect(CounterType.M1M1), false));
|
||||
|
|
|
@ -81,6 +81,7 @@ public class Commander2017 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mirror of the Forebears", 54, Rarity.UNCOMMON, mage.cards.m.MirrorOfTheForebears.class));
|
||||
cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class));
|
||||
cards.add(new SetCardInfo("O-Kagachi, Vengeful Kami", 45, Rarity.MYTHIC, mage.cards.o.OKagachiVengefulKami.class));
|
||||
cards.add(new SetCardInfo("Path of Ancestry", 56, Rarity.COMMON, mage.cards.p.PathOfAncestry.class));
|
||||
cards.add(new SetCardInfo("Patron of the Vein", 20, Rarity.RARE, mage.cards.p.PatronOfTheVein.class));
|
||||
cards.add(new SetCardInfo("Qasali Slingers", 33, Rarity.RARE, mage.cards.q.QasaliSlingers.class));
|
||||
cards.add(new SetCardInfo("Ramos, Dragon Engine", 55, Rarity.MYTHIC, mage.cards.r.RamosDragonEngine.class));
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EnchantedPlayerAttackedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
protected Effect effect;
|
||||
|
||||
public EnchantedPlayerAttackedTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect, false);
|
||||
}
|
||||
|
||||
public EnchantedPlayerAttackedTriggeredAbility(final EnchantedPlayerAttackedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller != null && enchantment != null) {
|
||||
return game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted player is attacked, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantedPlayerAttackedTriggeredAbility copy() {
|
||||
return new EnchantedPlayerAttackedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue