Merge branch 'van_maa' into 'master'

Vanguard: Maelstrom Archangel Avatar

See merge request core-developers/forge!6033
This commit is contained in:
Michael Kamensky
2022-01-12 19:23:59 +00:00
8 changed files with 77 additions and 20 deletions

View File

@@ -1,13 +1,12 @@
package forge.game.ability.effects; package forge.game.ability.effects;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.StaticData; import forge.StaticData;
import forge.card.CardFacePredicates; import forge.card.CardFacePredicates;
import forge.card.CardRules; import forge.card.CardRules;
@@ -147,15 +146,25 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
Predicate<ICardFace> cpp = Predicates.alwaysTrue(); Predicate<ICardFace> cpp = Predicates.alwaysTrue();
if (sa.hasParam("ValidCards")) { if (sa.hasParam("ValidCards")) {
//Calculating/replacing this must happen before running valid in CardFacePredicates //Calculating/replacing this must happen before running valid in CardFacePredicates
if (valid.contains("ManaCost=")) {
if (valid.contains("ManaCost=Equipped")) { if (valid.contains("ManaCost=Equipped")) {
String s = host.getEquipping().getManaCost().getShortString(); String s = host.getEquipping().getManaCost().getShortString();
valid = valid.replace("=Equipped", s); valid = valid.replace("=Equipped", s);
} else if (valid.contains("ManaCost=Imprinted")) {
String s = host.getImprintedCards().getFirst().getManaCost().getShortString();
valid = valid.replace("=Imprinted", s);
}
} }
cpp = CardFacePredicates.valid(valid); cpp = CardFacePredicates.valid(valid);
} }
if (randomChoice) {
final Iterable<ICardFace> cardsFromDb = StaticData.instance().getCommonCards().getAllFaces();
final List<ICardFace> cards = Lists.newArrayList(Iterables.filter(cardsFromDb, cpp));
chosen = Aggregates.random(cards).getName();
} else {
chosen = p.getController().chooseCardName(sa, cpp, valid, message); chosen = p.getController().chooseCardName(sa, cpp, valid, message);
} }
}
host.setNamedCard(chosen); host.setNamedCard(chosen);
if (!randomChoice) { if (!randomChoice) {

View File

@@ -37,6 +37,9 @@ public class MakeCardEffect extends SpellAbilityEffect {
if (!name.equals("")) { if (!name.equals("")) {
while (amount > 0) { while (amount > 0) {
Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name), player); Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name), player);
if (sa.hasParam("IsToken")) {
card.setToken(true);
}
if (!sa.hasParam("NotToken")) { if (!sa.hasParam("NotToken")) {
card.setTokenCard(true); card.setTokenCard(true);
} }

View File

@@ -161,6 +161,8 @@ public class PlayEffect extends SpellAbilityEffect {
Card gameCard = game.getCardState(c, null); Card gameCard = game.getCardState(c, null);
if (c.equalsWithTimestamp(gameCard)) { if (c.equalsWithTimestamp(gameCard)) {
tgtCards.add(gameCard); tgtCards.add(gameCard);
} else if (sa.hasParam("ZoneRegardless")) {
tgtCards.add(c);
} }
} }
} }

View File

@@ -332,6 +332,11 @@ public class PumpEffect extends SpellAbilityEffect {
} }
} }
} }
if (sa.hasParam("ClearNotedCardsFor")) {
for (Player p : tgtPlayers) {
p.clearNotesForName(sa.getParam("ClearNotedCardsFor"));
}
}
if (sa.hasParam("NoteNumber")) { if (sa.hasParam("NoteNumber")) {
int num = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NoteNumber"), sa); int num = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NoteNumber"), sa);

View File

@@ -70,6 +70,9 @@ public class RevealEffect extends SpellAbilityEffect {
if (valid.isEmpty()) if (valid.isEmpty())
continue; continue;
if (sa.hasParam("RevealAll")) { //for when cards to reveal are not in hand
revealed.addAll(valid);
} else {
if (cnt > valid.size()) if (cnt > valid.size())
cnt = valid.size(); cnt = valid.size();
@@ -83,8 +86,14 @@ public class RevealEffect extends SpellAbilityEffect {
revealed.addAll(p.getController().chooseCardsToRevealFromHand(min, cnt, valid)); revealed.addAll(p.getController().chooseCardsToRevealFromHand(min, cnt, valid));
} }
}
if (sa.hasParam("RevealToAll")) {
game.getAction().reveal(revealed, p, false,
sa.getParamOrDefault("RevealTitle", ""));
} else {
game.getAction().reveal(revealed, p); game.getAction().reveal(revealed, p);
}
for (final Card c : revealed) { for (final Card c : revealed) {
game.getTriggerHandler().runTrigger(TriggerType.Revealed, AbilityKey.mapFromCard(c), false); game.getTriggerHandler().runTrigger(TriggerType.Revealed, AbilityKey.mapFromCard(c), false);
if (sa.hasParam("RememberRevealed")) { if (sa.hasParam("RememberRevealed")) {

View File

@@ -1554,6 +1554,11 @@ public class Player extends GameEntity implements Comparable<Player> {
} }
return notes.get(notedFor); return notes.get(notedFor);
} }
public void clearNotesForName(String notedFor) {
if (notes.containsKey(notedFor)) {
notes.get(notedFor).clear();
}
}
public void noteNumberForName(String notedFor, int noted) { public void noteNumberForName(String notedFor, int noted) {
notedNum.put(notedFor, noted); notedNum.put(notedFor, noted);

View File

@@ -0,0 +1,22 @@
Name:Maelstrom Archangel Avatar
ManaCost:no cost
Types:Vanguard
HandLifeModifier:+0/+5
T:Mode$ DamageDone | ValidSource$ Creature.YouCtrl | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigNote | Static$ True
SVar:TrigNote:DB$ Pump | NoteCards$ TriggeredSource | NoteCardsFor$ MaelstromArchangelAvatar | SubAbility$ DBHit
SVar:DBHit:DB$ StoreSVar | SVar$ Hits | Type$ CountSVar | Expression$ Hits/Plus.1
T:Mode$ Phase | Phase$ Cleanup | Execute$ TrigReset | Static$ True
SVar:TrigReset:DB$ Pump | ClearNotedCardsFor$ MaelstromArchangelAvatar | SubAbility$ DBReset
SVar:DBReset:DB$ StoreSVar | SVar$ Hits | Type$ Number | Expression$ 0
SVar:Hits:Number$0
T:Mode$ Phase | Phase$ EndCombat | CheckSVar$ Hits | SVarCompare$ GE1 | ValidPlayer$ Player | TriggerZones$ Command | Execute$ TrigRepeatEach | TriggerDescription$ At end of combat, for each creature you controlled at the time it dealt combat damage to a player this turn, copy a random card with the same mana cost as that creature. You may pay {3}. If you do, choose one of those copies. If a copy of a permanent card is chosen, you may create a token that's a copy of that card. If a copy of an instant or sorcery card is chosen, you may cast the copy without paying its mana cost.
SVar:TrigRepeatEach:DB$ RepeatEach | UseImprinted$ True | RepeatCards$ Card.NotedForMaelstromArchangelAvatar | Zone$ Battlefield,Graveyard,Exile,Library,Hand | RepeatSubAbility$ DBCopyRandom | SubAbility$ DBReveal
SVar:DBCopyRandom:DB$ NameCard | Defined$ You | AtRandom$ True | ValidCards$ Card.ManaCost=Imprinted | SubAbility$ DBMake
SVar:DBMake:DB$ MakeCard | Name$ ChosenName | Zone$ None | RememberMade$ True | SubAbility$ DBClearNamed
SVar:DBClearNamed:DB$ Cleanup | ClearNamedCard$ True
SVar:DBReveal:DB$ Reveal | Defined$ You | RevealAll$ True | RevealDefined$ Remembered | RevealToAll$ True | RevealTitle$ OVERRIDE Cards created by Maelstrom Archangel Avatar | SubAbility$ DBChoose
SVar:DBChoose:DB$ ChooseCard | UnlessCost$ 3 | UnlessPayer$ You | UnlessSwitched$ True | Choices$ Card.IsRemembered | ChoiceZone$ None | SubAbility$ DBCopyPerm | SpellDescription$ You may pay {3}. If you do, choose one of those copies. If a copy of a permanent card is chosen, you may create a token that's a copy of that card. If a copy of an instant or sorcery card is chosen, you may cast the copy without paying its mana cost.
SVar:DBCopyPerm:DB$ CopyPermanent | Optional$ True | Defined$ ChosenCard | ConditionDefined$ ChosenCard | ConditionPresent$ Permanent | ConditionCompare$ GE1 | SubAbility$ DBCastSp
SVar:DBCastSp:DB$ Play | Defined$ ChosenCard | ZoneRegardless$ True | Optional$ True | WithoutManaCost$ True | ValidSA$ Spell | ConditionDefined$ ChosenCard | ConditionPresent$ Permanent | ConditionCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True | ClearRemembered$ True
Oracle:Hand +0, life +5\nAt end of combat, for each creature you controlled at the time it dealt combat damage to a player this turn, copy a random card with the same mana cost as that creature. You may pay {3}. If you do, choose one of those copies. If a copy of a permanent card is chosen, you may create a token that's a copy of that card. If a copy of an instant or sorcery card is chosen, you may cast the copy without paying its mana cost.

View File

@@ -903,6 +903,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
protected void reveal(final CardCollectionView cards, final ZoneType zone, final PlayerView owner, String message) { protected void reveal(final CardCollectionView cards, final ZoneType zone, final PlayerView owner, String message) {
if (StringUtils.isBlank(message)) { if (StringUtils.isBlank(message)) {
message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase()); message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
} else if (message.startsWith("OVERRIDE")) {
message = message.substring(9);
} else { } else {
message += " " + localizer.getMessage("lblPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase()); message += " " + localizer.getMessage("lblPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
} }