1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-09 01:01:06 -09:00

[KHM] Implemented Varragoth, Bloodsky Sire ()

* [KHM] Implemented Boast mechanic

* BoastAbility - Added author tag

* [KHM] Implemented Varragoth, Bloodsky Sire

* [KHM] Fixup BoastAbility and added BoastHint

* [KHM] BoastAbility - Call super instead of copying code
This commit is contained in:
Daniel Bomar 2021-01-08 07:04:47 -06:00 committed by GitHub
parent 9f47369957
commit 0f4d90b871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 190 additions and 0 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/abilities
condition/common
hint/common
keyword

View file

@ -0,0 +1,87 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.keyword.BoastAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.SearchEffect;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author weirddan455
*/
public final class VarragothBloodskySire extends CardImpl {
public VarragothBloodskySire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DEMON);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// Boast -- {1}{B}:Target player searches their library for a card, then shuffles their library and puts that card on top of it.
Ability ability = new BoastAbility(new VarragothBloodskySireEffect(), new ManaCostsImpl("{1}{B}"));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
private VarragothBloodskySire(final VarragothBloodskySire card) {
super(card);
}
@Override
public VarragothBloodskySire copy() {
return new VarragothBloodskySire(this);
}
}
class VarragothBloodskySireEffect extends SearchEffect {
public VarragothBloodskySireEffect() {
super(new TargetCardInLibrary(), Outcome.DrawCard);
this.staticText = "Target player searches their library for a card, then shuffles their library and puts that card on top of it";
}
private VarragothBloodskySireEffect(final VarragothBloodskySireEffect effect) {
super(effect);
}
@Override
public VarragothBloodskySireEffect copy() {
return new VarragothBloodskySireEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
if (player.searchLibrary(target, source, game)) {
Cards foundCards = new CardsImpl(target.getTargets());
player.shuffleLibrary(source, game);
player.putCardsOnTopOfLibrary(foundCards, game, source, false);
return true;
}
player.shuffleLibrary(source, game);
}
return false;
}
}

View file

@ -73,6 +73,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Thornmantle Striker", 387, Rarity.UNCOMMON, mage.cards.t.ThornmantleStriker.class));
cards.add(new SetCardInfo("Toski, Bearer of Secrets", 197, Rarity.RARE, mage.cards.t.ToskiBearerOfSecrets.class));
cards.add(new SetCardInfo("Valkyrie Harbinger", 374, Rarity.RARE, mage.cards.v.ValkyrieHarbinger.class));
cards.add(new SetCardInfo("Varragoth, Bloodsky Sire", 115, Rarity.RARE, mage.cards.v.VarragothBloodskySire.class));
cards.add(new SetCardInfo("Volatile Fjord", 273, Rarity.COMMON, mage.cards.v.VolatileFjord.class));
cards.add(new SetCardInfo("Warchanter Skald", 381, Rarity.UNCOMMON, mage.cards.w.WarchanterSkald.class));
cards.add(new SetCardInfo("Woodland Chasm", 274, Rarity.COMMON, mage.cards.w.WoodlandChasm.class));

View file

@ -0,0 +1,29 @@
package mage.abilities.condition.common;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.keyword.BoastAbility;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author weirddan455
*/
public enum BoastCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanentOrLKIBattlefield(source.getSourceId());
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
if (source instanceof BoastAbility && creature != null && watcher != null) {
BoastAbility ability = (BoastAbility) source;
return ability.hasMoreActivationsThisTurn(game) &&
watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(creature, game));
}
return false;
}
}

View file

@ -0,0 +1,28 @@
package mage.abilities.hint.common;
import mage.abilities.Ability;
import mage.abilities.condition.common.BoastCondition;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.game.Game;
/**
*
* @author weirddan455
*/
public enum BoastHint implements Hint {
instance;
private static final ConditionHint hint = new ConditionHint(BoastCondition.instance,
"Can activate Boast ability", null,
"Can't activate Boast ability", null, true);
@Override
public String getText(Game game, Ability ability) {
return hint.getText(game, ability);
}
@Override
public Hint copy() {
return instance;
}
}

View file

@ -0,0 +1,45 @@
package mage.abilities.keyword;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.condition.common.BoastCondition;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect;
import mage.abilities.hint.common.BoastHint;
import mage.constants.Zone;
import mage.game.Game;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author weirddan455
*/
public class BoastAbility extends ActivatedAbilityImpl {
public BoastAbility(Effect effect, ManaCosts cost) {
super(Zone.BATTLEFIELD, effect, cost);
this.maxActivationsPerTurn = 1;
this.addWatcher(new AttackedThisTurnWatcher());
this.condition = BoastCondition.instance;
this.addHint(BoastHint.instance);
}
public BoastAbility(BoastAbility ability) {
super(ability);
}
@Override
public BoastAbility copy() {
return new BoastAbility(this);
}
// Needed to make this public for BoastHint to work correctly (called by BoastCondition)
@Override
public boolean hasMoreActivationsThisTurn(Game game) {
return super.hasMoreActivationsThisTurn(game);
}
@Override
public String getRule() {
return "Boast &mdash; " + super.getRule() + " <i>(Activate this ability only if this creature attacked this turn and only once each turn.)</i>";
}
}