mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 12:52:06 -08:00
[ZNR] Implemented Kargan Intimidator
This commit is contained in:
parent
ed65b8dea8
commit
f1cd9ca881
3 changed files with 139 additions and 0 deletions
109
Mage.Sets/src/mage/cards/k/KarganIntimidator.java
Normal file
109
Mage.Sets/src/mage/cards/k/KarganIntimidator.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
package mage.cards.k;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class KarganIntimidator extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.WARRIOR, "Warrior");
|
||||
|
||||
public KarganIntimidator(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Cowards can't block Warriors.
|
||||
this.addAbility(new SimpleStaticAbility(new KarganIntimidatorEffect()));
|
||||
|
||||
// {1}: Choose one that hasn't been chosen this turn —
|
||||
// • Kargan Intimidator gets +1/+1 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new BoostSourceEffect(1, 1, Duration.EndOfTurn), new GenericManaCost(1)
|
||||
);
|
||||
ability.getModes().setEachModeOnlyOnce(true);
|
||||
ability.getModes().setResetEachTurn(true);
|
||||
|
||||
// • Target creature becomes a Coward until end of turn.
|
||||
Mode mode = new Mode(new BecomesCreatureTypeTargetEffect(
|
||||
Duration.EndOfTurn, SubType.COWARD
|
||||
).setText("Target creature becomes a Coward until end of turn"));
|
||||
mode.addTarget(new TargetCreaturePermanent());
|
||||
ability.addMode(mode);
|
||||
|
||||
// • Target Warrior gains trample until end of turn.
|
||||
mode = new Mode(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
|
||||
mode.addTarget(new TargetPermanent(filter));
|
||||
ability.addMode(mode);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private KarganIntimidator(final KarganIntimidator card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KarganIntimidator copy() {
|
||||
return new KarganIntimidator(this);
|
||||
}
|
||||
}
|
||||
|
||||
class KarganIntimidatorEffect extends RestrictionEffect {
|
||||
|
||||
KarganIntimidatorEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Cowards can't block Warriors";
|
||||
}
|
||||
|
||||
KarganIntimidatorEffect(final KarganIntimidatorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
return sourcePermanent != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
if (attacker != null && blocker != null) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && attacker.hasSubtype(SubType.WARRIOR, game)) {
|
||||
return !blocker.hasSubtype(SubType.COWARD, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KarganIntimidatorEffect copy() {
|
||||
return new KarganIntimidatorEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -178,6 +178,7 @@ public final class ZendikarRising extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Kabira Outrider", 18, Rarity.COMMON, mage.cards.k.KabiraOutrider.class));
|
||||
cards.add(new SetCardInfo("Kabira Plateau", 19, Rarity.UNCOMMON, mage.cards.k.KabiraPlateau.class));
|
||||
cards.add(new SetCardInfo("Kabira Takedown", 19, Rarity.UNCOMMON, mage.cards.k.KabiraTakedown.class));
|
||||
cards.add(new SetCardInfo("Kargan Intimidator", 145, Rarity.RARE, mage.cards.k.KarganIntimidator.class));
|
||||
cards.add(new SetCardInfo("Kaza, Roil Chaser", 225, Rarity.RARE, mage.cards.k.KazaRoilChaser.class));
|
||||
cards.add(new SetCardInfo("Kazandu Nectarpot", 190, Rarity.COMMON, mage.cards.k.KazanduNectarpot.class));
|
||||
cards.add(new SetCardInfo("Kazuul's Cliffs", 146, Rarity.UNCOMMON, mage.cards.k.KazuulsCliffs.class));
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
private boolean isRandom = false;
|
||||
private String chooseText = null;
|
||||
private boolean allWhenKicked = false;
|
||||
private boolean resetEachTurn = false;
|
||||
private int turnNum = 0;
|
||||
|
||||
public Modes() {
|
||||
this.currentMode = new Mode();
|
||||
|
|
@ -71,6 +73,9 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
|
||||
this.isRandom = modes.isRandom;
|
||||
this.chooseText = modes.chooseText;
|
||||
this.allWhenKicked = modes.allWhenKicked;
|
||||
this.resetEachTurn = modes.resetEachTurn;
|
||||
this.turnNum = modes.turnNum;
|
||||
if (modes.getSelectedModes().isEmpty()) {
|
||||
this.currentMode = values().iterator().next();
|
||||
} else {
|
||||
|
|
@ -217,6 +222,12 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
}
|
||||
|
||||
public boolean choose(Game game, Ability source) {
|
||||
if (this.isResetEachTurn()) {
|
||||
if (this.turnNum != game.getTurnNum()) {
|
||||
this.clearAlreadySelectedModes(source, game);
|
||||
this.turnNum = game.getTurnNum();
|
||||
}
|
||||
}
|
||||
if (this.allWhenKicked && KickedCondition.instance.apply(game, source)) {
|
||||
this.setMinModes(0);
|
||||
this.setMaxModes(3);
|
||||
|
|
@ -332,6 +343,13 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
}
|
||||
}
|
||||
|
||||
private void clearAlreadySelectedModes(Ability source, Game game) {
|
||||
for (UUID modeId : getSelectedModes()) {
|
||||
String key = getKey(source, game, modeId);
|
||||
game.getState().setValue(key, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a mode as selected. If the mode is already selected, it copies the
|
||||
* mode and adds it to the duplicate modes
|
||||
|
|
@ -436,6 +454,9 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
if (isEachModeOnlyOnce()) {
|
||||
sb.append(" that hasn't been chosen");
|
||||
}
|
||||
if (isResetEachTurn()) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
|
||||
if (isEachModeMoreThanOnce()) {
|
||||
sb.append(". You may choose the same mode more than once.");
|
||||
|
|
@ -489,6 +510,14 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
this.allWhenKicked = allWhenKicked;
|
||||
}
|
||||
|
||||
public boolean isResetEachTurn() {
|
||||
return resetEachTurn;
|
||||
}
|
||||
|
||||
public void setResetEachTurn(boolean resetEachTurn) {
|
||||
this.resetEachTurn = resetEachTurn;
|
||||
}
|
||||
|
||||
public void setChooseText(String chooseText) {
|
||||
this.chooseText = chooseText;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue