mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
[TDM] Implement Karakyk Guardian
This commit is contained in:
parent
4062f6d85a
commit
caf5984b62
2 changed files with 111 additions and 0 deletions
110
Mage.Sets/src/mage/cards/k/KarakykGuardian.java
Normal file
110
Mage.Sets/src/mage/cards/k/KarakykGuardian.java
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
package mage.cards.k;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.keyword.HexproofAbility;
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class KarakykGuardian extends CardImpl {
|
||||||
|
|
||||||
|
public KarakykGuardian(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.DRAGON);
|
||||||
|
this.power = new MageInt(6);
|
||||||
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Vigilance
|
||||||
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
|
// Trample
|
||||||
|
this.addAbility(TrampleAbility.getInstance());
|
||||||
|
|
||||||
|
// This creature has hexproof if it hasn't dealt damage yet.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||||
|
new GainAbilitySourceEffect(HexproofAbility.getInstance()),
|
||||||
|
KarakykGuardianCondition.instance, "{this} has hexproof if it hasn't dealt damage yet"
|
||||||
|
)), new KarakykGuardianWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private KarakykGuardian(final KarakykGuardian card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KarakykGuardian copy() {
|
||||||
|
return new KarakykGuardian(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum KarakykGuardianCondition implements Condition {
|
||||||
|
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
KarakykGuardianWatcher watcher = game.getState().getWatcher(KarakykGuardianWatcher.class);
|
||||||
|
return permanent != null && !watcher.getDamagers().contains(new MageObjectReference(permanent, game));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{this} hasn't dealt damage yet";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class KarakykGuardianWatcher extends Watcher {
|
||||||
|
|
||||||
|
private final Set<MageObjectReference> damagers = new HashSet<>();
|
||||||
|
|
||||||
|
public KarakykGuardianWatcher() {
|
||||||
|
super(WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
switch (event.getType()) {
|
||||||
|
case DAMAGED_PERMANENT:
|
||||||
|
case DAMAGED_PLAYER:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
damagers.add(new MageObjectReference(permanent, game));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<MageObjectReference> getDamagers() {
|
||||||
|
return damagers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -114,6 +114,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Jeskai Monument", 244, Rarity.UNCOMMON, mage.cards.j.JeskaiMonument.class));
|
cards.add(new SetCardInfo("Jeskai Monument", 244, Rarity.UNCOMMON, mage.cards.j.JeskaiMonument.class));
|
||||||
cards.add(new SetCardInfo("Jeskai Shrinekeeper", 197, Rarity.UNCOMMON, mage.cards.j.JeskaiShrinekeeper.class));
|
cards.add(new SetCardInfo("Jeskai Shrinekeeper", 197, Rarity.UNCOMMON, mage.cards.j.JeskaiShrinekeeper.class));
|
||||||
cards.add(new SetCardInfo("Jungle Hollow", 258, Rarity.COMMON, mage.cards.j.JungleHollow.class));
|
cards.add(new SetCardInfo("Jungle Hollow", 258, Rarity.COMMON, mage.cards.j.JungleHollow.class));
|
||||||
|
cards.add(new SetCardInfo("Karakyk Guardian", 198, Rarity.UNCOMMON, mage.cards.k.KarakykGuardian.class));
|
||||||
cards.add(new SetCardInfo("Kheru Goldkeeper", 199, Rarity.UNCOMMON, mage.cards.k.KheruGoldkeeper.class));
|
cards.add(new SetCardInfo("Kheru Goldkeeper", 199, Rarity.UNCOMMON, mage.cards.k.KheruGoldkeeper.class));
|
||||||
cards.add(new SetCardInfo("Kin-Tree Nurturer", 83, Rarity.COMMON, mage.cards.k.KinTreeNurturer.class));
|
cards.add(new SetCardInfo("Kin-Tree Nurturer", 83, Rarity.COMMON, mage.cards.k.KinTreeNurturer.class));
|
||||||
cards.add(new SetCardInfo("Kin-Tree Severance", 200, Rarity.UNCOMMON, mage.cards.k.KinTreeSeverance.class));
|
cards.add(new SetCardInfo("Kin-Tree Severance", 200, Rarity.UNCOMMON, mage.cards.k.KinTreeSeverance.class));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue