mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Cloak Effect
This commit is contained in:
@@ -53,6 +53,7 @@ public enum ApiType {
|
|||||||
Clash (ClashEffect.class),
|
Clash (ClashEffect.class),
|
||||||
ClassLevelUp (ClassLevelUpEffect.class),
|
ClassLevelUp (ClassLevelUpEffect.class),
|
||||||
Cleanup (CleanUpEffect.class),
|
Cleanup (CleanUpEffect.class),
|
||||||
|
Cloak (CloakEffect.class),
|
||||||
Clone (CloneEffect.class),
|
Clone (CloneEffect.class),
|
||||||
CompanionChoose (ChooseCompanionEffect.class),
|
CompanionChoose (ChooseCompanionEffect.class),
|
||||||
Connive (ConniveEffect.class),
|
Connive (ConniveEffect.class),
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import forge.game.Game;
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
|
import forge.game.ability.AbilityUtils;
|
||||||
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CardCollectionView;
|
||||||
|
import forge.game.card.CardLists;
|
||||||
|
import forge.game.card.CardZoneTable;
|
||||||
|
import forge.game.player.Player;
|
||||||
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.util.Localizer;
|
||||||
|
|
||||||
|
public class CloakEffect extends SpellAbilityEffect {
|
||||||
|
@Override
|
||||||
|
public void resolve(SpellAbility sa) {
|
||||||
|
final Card source = sa.getHostCard();
|
||||||
|
final Player activator = sa.getActivatingPlayer();
|
||||||
|
final Game game = source.getGame();
|
||||||
|
final int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(source,
|
||||||
|
sa.getParam("Amount"), sa) : 1;
|
||||||
|
|
||||||
|
for (final Player p : getTargetPlayers(sa, "DefinedPlayer")) {
|
||||||
|
CardCollection tgtCards;
|
||||||
|
if (sa.hasParam("Choices") || sa.hasParam("ChoiceZone")) {
|
||||||
|
ZoneType choiceZone = ZoneType.Hand;
|
||||||
|
if (sa.hasParam("ChoiceZone")) {
|
||||||
|
choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone"));
|
||||||
|
}
|
||||||
|
CardCollectionView choices = game.getCardsIn(choiceZone);
|
||||||
|
if (sa.hasParam("Choices")) {
|
||||||
|
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, source, sa);
|
||||||
|
}
|
||||||
|
if (choices.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseCards") + " ";
|
||||||
|
|
||||||
|
tgtCards = new CardCollection(activator.getController().chooseCardsForEffect(choices, sa, title, amount, amount, false, null));
|
||||||
|
} else {
|
||||||
|
tgtCards = getTargetCards(sa);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sa.hasParam("Shuffle")) {
|
||||||
|
CardLists.shuffle(tgtCards);
|
||||||
|
}
|
||||||
|
|
||||||
|
CardZoneTable triggerList = new CardZoneTable();
|
||||||
|
|
||||||
|
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
|
||||||
|
moveParams.put(AbilityKey.LastStateBattlefield, triggerList.getLastStateBattlefield());
|
||||||
|
moveParams.put(AbilityKey.LastStateGraveyard, triggerList.getLastStateGraveyard());
|
||||||
|
moveParams.put(AbilityKey.InternalTriggerTable, triggerList);
|
||||||
|
for (Card c : tgtCards) {
|
||||||
|
Card rem = c.cloak(p, sa, moveParams);
|
||||||
|
if (rem != null && sa.hasParam("RememberCloaked") && rem.isCloaked()) {
|
||||||
|
source.addRemembered(rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
triggerList.triggerChangesZoneAll(game, sa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Name:Vannifar, Evolved Enigma
|
||||||
|
ManaCost:2 G U
|
||||||
|
Types:Legendary Creature Elf Ooze Wizard
|
||||||
|
PT:3/4
|
||||||
|
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | Execute$ TrigCharm | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of combat on your turn, ABILITY
|
||||||
|
SVar:TrigCharm:DB$ Charm | Choices$ DBCloak,DBPutCounters | CharmNum$ 1
|
||||||
|
SVar:DBCloak:DB$ Cloak | Choices$ Card.YouCtrl | SpellDescription$ Cloak a card from your hand.
|
||||||
|
SVar:DBPutCounters:DB$ PutCounterAll | ValidCards$ Creature.Colorless+YouCtrl | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on each colorless creature you control.
|
||||||
|
Oracle:At the beginning of combat on your turn, choose one —\n• Cloak a card from your hand. (Put it onto the battlefield face down as a 2/2 creature with ward {2}. Turn it face up any time for its mana cost if it’s a creature card.)\n• Put a +1/+1 counter on each colorless creature you control.
|
||||||
|
|
||||||
Reference in New Issue
Block a user