mirror of
https://github.com/Relintai/mtg-forge-ios.git
synced 2025-02-23 12:34:19 +01:00
basic Explore Effect
git-svn-id: http://svn.slightlymagic.net/forge/trunk@35721 269b9781-a132-4a9b-9d4e-f004f1b56b58
This commit is contained in:
parent
5991c8f51c
commit
3518dba4de
@ -72,6 +72,7 @@ public enum SpellApiToAi {
|
|||||||
.put(ApiType.ExchangeControlVariant, CannotPlayAi.class)
|
.put(ApiType.ExchangeControlVariant, CannotPlayAi.class)
|
||||||
.put(ApiType.ExchangePower, PowerExchangeAi.class)
|
.put(ApiType.ExchangePower, PowerExchangeAi.class)
|
||||||
.put(ApiType.ExchangeZone, ZoneExchangeAi.class)
|
.put(ApiType.ExchangeZone, ZoneExchangeAi.class)
|
||||||
|
.put(ApiType.Explore, AlwaysPlayAi.class)
|
||||||
.put(ApiType.Fight, FightAi.class)
|
.put(ApiType.Fight, FightAi.class)
|
||||||
.put(ApiType.FlipACoin, FlipACoinAi.class)
|
.put(ApiType.FlipACoin, FlipACoinAi.class)
|
||||||
.put(ApiType.Fog, FogAi.class)
|
.put(ApiType.Fog, FogAi.class)
|
||||||
|
@ -69,6 +69,7 @@ public enum ApiType {
|
|||||||
ExchangeControlVariant (ControlExchangeVariantEffect.class),
|
ExchangeControlVariant (ControlExchangeVariantEffect.class),
|
||||||
ExchangePower (PowerExchangeEffect.class),
|
ExchangePower (PowerExchangeEffect.class),
|
||||||
ExchangeZone (ZoneExchangeEffect.class),
|
ExchangeZone (ZoneExchangeEffect.class),
|
||||||
|
Explore (ExploreEffect.class),
|
||||||
Fight (FightEffect.class),
|
Fight (FightEffect.class),
|
||||||
FlipACoin (FlipCoinEffect.class),
|
FlipACoin (FlipCoinEffect.class),
|
||||||
Fog (FogEffect.class),
|
Fog (FogEffect.class),
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import forge.game.Game;
|
||||||
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CounterType;
|
||||||
|
import forge.game.player.Player;
|
||||||
|
import forge.game.player.PlayerController;
|
||||||
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.game.trigger.TriggerType;
|
||||||
|
import forge.game.zone.ZoneType;
|
||||||
|
|
||||||
|
public class ExploreEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.game.ability.SpellAbilityEffect#getStackDescription(forge.game.spellability.SpellAbility)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String getStackDescription(SpellAbility sa) {
|
||||||
|
final Card host = sa.getHostCard();
|
||||||
|
return host.getName() + " explores.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.game.ability.SpellAbilityEffect#resolve(forge.game.spellability.SpellAbility)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resolve(SpellAbility sa) {
|
||||||
|
// check if only the activating player counts
|
||||||
|
final Card card = sa.getHostCard();
|
||||||
|
final Player pl = sa.getActivatingPlayer();
|
||||||
|
final PlayerController pc = pl.getController();
|
||||||
|
final Game game = pl.getGame();
|
||||||
|
List<Card> tgt = getTargetCards(sa);
|
||||||
|
|
||||||
|
for (final Card c : tgt) {
|
||||||
|
// revealed land card
|
||||||
|
boolean revealedLand = false;
|
||||||
|
CardCollection top = pl.getTopXCardsFromLibrary(1);
|
||||||
|
if (!top.isEmpty()) {
|
||||||
|
pl.getController().reveal(top, ZoneType.Library, pl, "Revealed for Explore");
|
||||||
|
final Card r = top.getFirst();
|
||||||
|
if (r.isLand()) {
|
||||||
|
game.getAction().moveTo(ZoneType.Hand, r, sa);
|
||||||
|
revealedLand = true;
|
||||||
|
} else {
|
||||||
|
// TODO find better way to choose optional send away
|
||||||
|
final Card choosen = pc.chooseSingleCardForZoneChange(
|
||||||
|
ZoneType.Graveyard, Lists.newArrayList(ZoneType.Library), sa, top, null,
|
||||||
|
"send to graveyard?", true, pl);
|
||||||
|
if (choosen != null) {
|
||||||
|
game.getAction().moveTo(ZoneType.Graveyard, choosen, sa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (revealedLand) {
|
||||||
|
// TODO need to check if card didn't blick while that was happening,
|
||||||
|
// probably need strictlySelf in the Defined
|
||||||
|
if (game.getZoneOf(c).is(ZoneType.Battlefield)) {
|
||||||
|
c.addCounter(CounterType.P1P1, 1, card, true);
|
||||||
|
final Map<String, Object> runParams = Maps.newHashMap();
|
||||||
|
runParams.put("Card", c);
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.Explores, runParams, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -51,7 +51,7 @@ public class TriggerExplores extends Trigger {
|
|||||||
@Override
|
@Override
|
||||||
public final boolean performTest(final Map<String, Object> runParams2) {
|
public final boolean performTest(final Map<String, Object> runParams2) {
|
||||||
if (this.mapParams.containsKey("ValidCard")) {
|
if (this.mapParams.containsKey("ValidCard")) {
|
||||||
if (!matchesValid(runParams2.get("Explorer"), this.mapParams.get("ValidCard").split(","),
|
if (!matchesValid(runParams2.get("Card"), this.mapParams.get("ValidCard").split(","),
|
||||||
this.getHostCard())) {
|
this.getHostCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ public class TriggerExplores extends Trigger {
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||||
sa.setTriggeringObject("Explorer", this.getRunParams().get("Explorer"));
|
sa.setTriggeringObject("Explorer", this.getRunParams().get("Card"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user