mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
changed Myr Battlesphere using Hellrider, plus some other fixes
This commit is contained in:
parent
8919d8a9d5
commit
b5e49fb575
3 changed files with 77 additions and 54 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -43,10 +44,7 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.target.common.TargetOpponentOrPlaneswalker;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -61,11 +59,11 @@ public class AetherCharge extends CardImpl {
|
|||
}
|
||||
|
||||
public AetherCharge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
|
||||
|
||||
// Whenever a Beast enters the battlefield under your control, you may have it deal 4 damage to target opponent.
|
||||
Ability ability = new AetherChargeTriggeredAbility();
|
||||
ability.addTarget(new TargetOpponent());
|
||||
ability.addTarget(new TargetOpponentOrPlaneswalker());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +106,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a Beast enters the battlefield under your control, you may have it deal 4 damage to target opponent.";
|
||||
return "Whenever a Beast enters the battlefield under your control, you may have it deal 4 damage to target opponent or planeswalker.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -121,7 +119,7 @@ class AetherChargeEffect extends OneShotEffect {
|
|||
|
||||
public AetherChargeEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "you may have it deal 4 damage to target opponent";
|
||||
staticText = "you may have it deal 4 damage to target opponent or planeswalker";
|
||||
}
|
||||
|
||||
public AetherChargeEffect(final AetherChargeEffect effect) {
|
||||
|
|
@ -141,12 +139,7 @@ class AetherChargeEffect extends OneShotEffect {
|
|||
creature = (Permanent) game.getLastKnownInformation(creatureId, Zone.BATTLEFIELD);
|
||||
}
|
||||
if (creature != null) {
|
||||
UUID target = source.getTargets().getFirstTarget();
|
||||
Player opponent = game.getPlayer(target);
|
||||
if (opponent != null) {
|
||||
opponent.damage(4, creature.getId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), 4, creature.getId(), game, false, true) > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl imple
|
|||
|
||||
public GhostsOfTheInnocentPreventDamageEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Damage);
|
||||
staticText = "If a source would deal damage to a creature or player, it deals half that damage, rounded down, to that creature or player instead";
|
||||
staticText = "If a source would deal damage to a permanent or player, it deals half that damage, rounded down, to that permanent or player instead";
|
||||
}
|
||||
|
||||
public GhostsOfTheInnocentPreventDamageEffect(final GhostsOfTheInnocentPreventDamageEffect effect) {
|
||||
|
|
@ -90,7 +90,8 @@ class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl imple
|
|||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DAMAGE_CREATURE
|
||||
|| event.getType() == EventType.DAMAGE_PLAYER;
|
||||
|| event.getType() == EventType.DAMAGE_PLAYER
|
||||
|| event.getType() == EventType.DAMAGE_PLANESWALKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
|
|
@ -44,16 +44,18 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.MyrToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.watchers.common.CreatureAttackedWhichPlayerWatcher;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -72,7 +74,7 @@ public class MyrBattlesphere extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MyrToken(), 4), false));
|
||||
|
||||
// Whenever Myr Battlesphere attacks, you may tap X untapped Myr you control. If you do, Myr Battlesphere gets +X/+0 until end of turn and deals X damage to defending player.
|
||||
this.addAbility(new AttacksTriggeredAbility(new MyrBattlesphereEffect(), true), new CreatureAttackedWhichPlayerWatcher());
|
||||
this.addAbility(new MyrBattlesphereTriggeredAbility());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -87,6 +89,43 @@ public class MyrBattlesphere extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
class MyrBattlesphereTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public MyrBattlesphereTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new MyrBattlesphereEffect(), true);
|
||||
}
|
||||
|
||||
public MyrBattlesphereTriggeredAbility(final MyrBattlesphereTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyrBattlesphereTriggeredAbility copy() {
|
||||
return new MyrBattlesphereTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent source = game.getPermanent(event.getSourceId());
|
||||
if (source != null && source.getControllerId().equals(controllerId)) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(event.getSourceId());
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defenderId));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks, you may tap X untapped Myr you control. If you do, {this} gets +X/+0 until end of turn and deals X damage to the player or planeswalker it’s attacking.";
|
||||
}
|
||||
}
|
||||
|
||||
class MyrBattlesphereEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Myr you control");
|
||||
|
|
@ -98,7 +137,7 @@ class MyrBattlesphereEffect extends OneShotEffect {
|
|||
|
||||
public MyrBattlesphereEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "tap X untapped Myr you control. If you do, {source} gets +X/+0 until end of turn and deals X damage to defending player";
|
||||
staticText = "you may tap X untapped Myr you control. If you do, {this} gets +X/+0 until end of turn and deals X damage to the player or planeswalker it’s attacking.";
|
||||
}
|
||||
|
||||
public MyrBattlesphereEffect(final MyrBattlesphereEffect effect) {
|
||||
|
|
@ -109,46 +148,36 @@ class MyrBattlesphereEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
CreatureAttackedWhichPlayerWatcher watcher = (CreatureAttackedWhichPlayerWatcher) game.getState().getWatchers().get(CreatureAttackedWhichPlayerWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
// even if the Myr Battlesphere is off the battlefield, it still does damage to the defender
|
||||
Permanent myr = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
UUID defenderId = watcher.getPlayerAttackedThisTurnByCreature(myr.getId());
|
||||
Player defender = game.getPlayer(defenderId);
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
while (true && controller.canRespond()) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getControllerId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Myr tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
Permanent myr = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
while (true && controller.canRespond()) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getControllerId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Myr tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(" taps ").append(tappedAmount).append(" Myrs").toString());
|
||||
// boost effect
|
||||
game.addEffect(new BoostSourceEffect(tappedAmount, 0, Duration.EndOfTurn), source);
|
||||
// damage to defender
|
||||
if (defender != null) {
|
||||
defender.damage(tappedAmount, myr.getId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(" taps ").append(tappedAmount).append(" Myrs").toString());
|
||||
// boost effect
|
||||
game.addEffect(new BoostSourceEffect(tappedAmount, 0, Duration.EndOfTurn), source);
|
||||
// damage to defender
|
||||
return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), tappedAmount, myr.getId(), game, false, true) > 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue