forked from External/mage
[CLU] Implement Undercover Butler (#11699)
Co-authored-by: Matthew Wilson <matthew_w@vaadin.com>
This commit is contained in:
parent
340156a84b
commit
2fb12226f2
2 changed files with 85 additions and 0 deletions
84
Mage.Sets/src/mage/cards/u/UndercoverButler.java
Normal file
84
Mage.Sets/src/mage/cards/u/UndercoverButler.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.other.PlayerWithTheMostLifePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* Undercover Butler {2}{U/B}
|
||||
* Creature - Human Rogue 2/3
|
||||
* Whenever Undercover Butler attacks the player with the most life or tied for most life, it can't be blocked this turn.
|
||||
*
|
||||
* @author DominionSpy
|
||||
*/
|
||||
public final class UndercoverButler extends CardImpl {
|
||||
|
||||
public UndercoverButler(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U/B}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ROGUE);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever Undercover Butler attacks the player with the most life or tied for most life, it can't be blocked this turn.
|
||||
this.addAbility(new UndercoverButlerAbility().withRuleTextReplacement(true));
|
||||
}
|
||||
|
||||
private UndercoverButler(final UndercoverButler card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UndercoverButler copy() {
|
||||
return new UndercoverButler(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UndercoverButlerAbility extends TriggeredAbilityImpl {
|
||||
|
||||
UndercoverButlerAbility() {
|
||||
super(Zone.BATTLEFIELD, new CantBeBlockedSourceEffect(Duration.EndOfTurn), false);
|
||||
setTriggerPhrase("Whenever {this} attacks the player with the most life or tied for the most life, ");
|
||||
}
|
||||
|
||||
private UndercoverButlerAbility(final UndercoverButlerAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UndercoverButlerAbility copy() {
|
||||
return new UndercoverButlerAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(getSourceId());
|
||||
if (defenderId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player attackedPlayer = game.getPlayer(defenderId);
|
||||
return PlayerWithTheMostLifePredicate.instance.apply(
|
||||
new ObjectSourcePlayer<>(attackedPlayer, getControllerId(), null),
|
||||
game
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,5 +29,6 @@ public final class RavnicaClueEdition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Library", 18, Rarity.UNCOMMON, mage.cards.l.Library.class));
|
||||
cards.add(new SetCardInfo("Senator Peacock", 2, Rarity.RARE, mage.cards.s.SenatorPeacock.class));
|
||||
cards.add(new SetCardInfo("Steam Vents", 280, Rarity.RARE, mage.cards.s.SteamVents.class));
|
||||
cards.add(new SetCardInfo("Undercover Butler", 49, Rarity.UNCOMMON, mage.cards.u.UndercoverButler.class));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue