mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Tinybones, Trinket Thief
This commit is contained in:
parent
9e8a5131ae
commit
d74c2c8355
3 changed files with 130 additions and 1 deletions
128
Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java
Normal file
128
Mage.Sets/src/mage/cards/t/TinybonesTrinketThief.java
Normal file
|
@ -0,0 +1,128 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TinybonesTrinketThief extends CardImpl {
|
||||
|
||||
public TinybonesTrinketThief(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.SKELETON);
|
||||
this.subtype.add(SubType.ROGUE);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// At the beginning of each end step, if an opponent discarded a card this turn, you draw a card and you lose 1 life.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfEndStepTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1),
|
||||
TargetController.EACH_PLAYER, false
|
||||
), TinybonesTrinketThiefCondition.instance, "At the beginning of each end step, " +
|
||||
"if an opponent discarded a card this turn, you draw a card and you lose 1 life."
|
||||
);
|
||||
ability.addEffect(new LoseLifeSourceControllerEffect(1));
|
||||
this.addAbility(ability, new TinybonesTrinketThiefWatcher());
|
||||
|
||||
// {4}{B}{B}: Each opponent with no cards in hand loses 10 life.
|
||||
this.addAbility(new SimpleActivatedAbility(new TinybonesTrinketThiefEffect(), new ManaCostsImpl("{4}{B}{B}")));
|
||||
}
|
||||
|
||||
private TinybonesTrinketThief(final TinybonesTrinketThief card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TinybonesTrinketThief copy() {
|
||||
return new TinybonesTrinketThief(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum TinybonesTrinketThiefCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
TinybonesTrinketThiefWatcher watcher = game.getState().getWatcher(TinybonesTrinketThiefWatcher.class);
|
||||
return watcher != null && watcher.checkPlayer(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
class TinybonesTrinketThiefWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> playerSet = new HashSet<>();
|
||||
|
||||
TinybonesTrinketThiefWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
||||
playerSet.addAll(game.getOpponents(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
playerSet.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
boolean checkPlayer(UUID playerId) {
|
||||
return playerSet.contains(playerId);
|
||||
}
|
||||
}
|
||||
|
||||
class TinybonesTrinketThiefEffect extends OneShotEffect {
|
||||
|
||||
TinybonesTrinketThiefEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each opponent with no cards in hand loses 10 life";
|
||||
}
|
||||
|
||||
private TinybonesTrinketThiefEffect(final TinybonesTrinketThiefEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TinybonesTrinketThiefEffect copy() {
|
||||
return new TinybonesTrinketThiefEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && player.getHand().isEmpty()) {
|
||||
player.loseLife(10, game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// tiny bones comin out my
|
||||
// tiny bones comin out my mouth
|
|
@ -426,6 +426,7 @@ public final class Jumpstart extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Thundering Spineback", 437, Rarity.UNCOMMON, mage.cards.t.ThunderingSpineback.class));
|
||||
cards.add(new SetCardInfo("Tibalt's Rager", 366, Rarity.UNCOMMON, mage.cards.t.TibaltsRager.class));
|
||||
cards.add(new SetCardInfo("Time to Feed", 438, Rarity.COMMON, mage.cards.t.TimeToFeed.class));
|
||||
cards.add(new SetCardInfo("Tinybones, Trinket Thief", 17, Rarity.MYTHIC, mage.cards.t.TinybonesTrinketThief.class));
|
||||
cards.add(new SetCardInfo("Tithebearer Giant", 284, Rarity.COMMON, mage.cards.t.TithebearerGiant.class));
|
||||
cards.add(new SetCardInfo("Torch Fiend", 367, Rarity.COMMON, mage.cards.t.TorchFiend.class));
|
||||
cards.add(new SetCardInfo("Towering Titan", 31, Rarity.MYTHIC, mage.cards.t.ToweringTitan.class));
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
|
|||
|
||||
private DynamicValue amount;
|
||||
|
||||
public LoseLifeOpponentsEffect(int amount) {
|
||||
publicLoseLifeOpponentsEffect(int amount) {
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue