This commit is contained in:
tool4EvEr
2022-11-01 14:37:51 +01:00
parent 5db8a2c564
commit d954f9dcb3
22 changed files with 32 additions and 64 deletions

View File

@@ -4,8 +4,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.ai.AiCardMemory;
import forge.ai.ComputerUtilAbility;
@@ -82,7 +80,7 @@ public class ChooseTypeAi extends SpellAbilityAi {
if (maxX > 1) {
CardCollection cre = CardLists.filter(aiPlayer.getCardsIn(ZoneType.Battlefield),
Predicates.and(CardPredicates.isType(chosenType), CardPredicates.Presets.UNTAPPED));
CardPredicates.isType(chosenType), CardPredicates.Presets.UNTAPPED);
if (!cre.isEmpty()) {
for (Card c: cre) {
avgPower += c.getNetPower();

View File

@@ -302,8 +302,8 @@ public class CountersPutAi extends CountersAi {
}
CardCollection oppCreats = CardLists.filter(ai.getOpponents().getCreaturesInPlay(),
Predicates.and(Predicates.not(CardPredicates.hasCounter(CounterType.getType(type))),
CardPredicates.isTargetableBy(sa)));
Predicates.not(CardPredicates.hasCounter(CounterType.getType(type))),
CardPredicates.isTargetableBy(sa));
if (!oppCreats.isEmpty()) {
Card bestCreat = ComputerUtilCard.getBestCreatureAI(oppCreats);

View File

@@ -373,13 +373,8 @@ public class UntapAi extends SpellAbilityAi {
reduced.decreaseShard(ManaCostShard.GENERIC, untappingCards.size());
if (ComputerUtilMana.canPayManaCost(reduced, ab, ai, false)) {
CardCollection manaLandsTapped = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield),
Predicates.and(Presets.LANDS_PRODUCING_MANA, Presets.TAPPED));
manaLandsTapped = CardLists.filter(manaLandsTapped, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return card.isValid(sa.getParam("ValidTgts"), ai, source, null);
}
});
Presets.LANDS_PRODUCING_MANA, Presets.TAPPED);
manaLandsTapped = CardLists.getValidCards(manaLandsTapped, sa.getParam("ValidTgts"), ai, source, null);
if (!manaLandsTapped.isEmpty()) {
// already have a tapped land, so agree to proceed with untapping it
@@ -388,13 +383,8 @@ public class UntapAi extends SpellAbilityAi {
// pool one additional mana by tapping a land to try to ramp to something
CardCollection manaLands = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield),
Predicates.and(Presets.LANDS_PRODUCING_MANA, Presets.UNTAPPED));
manaLands = CardLists.filter(manaLands, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return card.isValid(sa.getParam("ValidTgts"), ai, source, null);
}
});
Presets.LANDS_PRODUCING_MANA, Presets.UNTAPPED);
manaLands = CardLists.getValidCards(manaLands, sa.getParam("ValidTgts"), ai, source, null);
if (manaLands.isEmpty()) {
// nothing to untap

View File

@@ -41,20 +41,17 @@ public enum PlanarDice {
trigRes = Chaos;
}
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(roller);
runParams.put(AbilityKey.Result, trigRes);
roller.getGame().getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams,false);
// Also run normal RolledDie and RolledDieOnce triggers
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
runParams = AbilityKey.mapFromPlayer(roller);
runParams.put(AbilityKey.Sides, 6);
runParams.put(AbilityKey.Result, 0);
roller.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDie, runParams, false);
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
runParams = AbilityKey.mapFromPlayer(roller);
runParams.put(AbilityKey.Sides, 6);
runParams.put(AbilityKey.Result, Arrays.asList(0));
roller.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDieOnce, runParams, false);

View File

@@ -4,7 +4,6 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import forge.game.Game;
import forge.game.GameActionUtil;
@@ -164,7 +163,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
}
}
Map<AbilityKey, Object> moveParams = Maps.newEnumMap(AbilityKey.class);
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, lastStateBattlefield);
moveParams.put(AbilityKey.LastStateGraveyard, lastStateGraveyard);

View File

@@ -1074,8 +1074,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
//some kind of reset here?
}
}
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, decider);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(decider);
runParams.put(AbilityKey.Target, Lists.newArrayList(player));
decider.getGame().getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false);
}

View File

@@ -48,12 +48,10 @@ public class ClashEffect extends SpellAbilityEffect {
}
// Run triggers
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, player);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(player);
runParams.put(AbilityKey.Won, player.equals(winner) ? "True" : "False");
source.getGame().getTriggerHandler().runTrigger(TriggerType.Clashed, runParams, false);
final Map<AbilityKey, Object> runParams2 = AbilityKey.newMap();
runParams2.put(AbilityKey.Player, opponent);
final Map<AbilityKey, Object> runParams2 = AbilityKey.mapFromPlayer(opponent);
runParams2.put(AbilityKey.Won, opponent.equals(winner) ? "True" : "False");
source.getGame().getTriggerHandler().runTrigger(TriggerType.Clashed, runParams2, false);
}

View File

@@ -293,8 +293,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
caller.getGame().getAction().notifyOfValue(sa, caller, wonFlip ? Localizer.getInstance().getMessage("lblWin") : Localizer.getInstance().getMessage("lblLose"), null);
// Run triggers
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, caller);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(caller);
runParams.put(AbilityKey.Result, wonFlip);
caller.getGame().getTriggerHandler().runTrigger(TriggerType.FlippedCoin, runParams, false);
} while (sa.hasParam("FlipUntilYouLose") && wonFlip);

View File

@@ -130,8 +130,7 @@ public class MakeCardEffect extends SpellAbilityEffect {
counterTable.replaceCounterEffect(game, sa, true);
if (sa.hasParam("Conjure")) {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, player);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(player);
runParams.put(AbilityKey.Cards, madeCards);
runParams.put(AbilityKey.Cause, sa); //-- currently not needed
game.getTriggerHandler().runTrigger(TriggerType.ConjureAll, runParams, false);

View File

@@ -109,15 +109,13 @@ public class RollDiceEffect extends SpellAbilityEffect {
// Run triggers
for (Integer roll : rolls) {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, player);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(player);
runParams.put(AbilityKey.Sides, sides);
runParams.put(AbilityKey.Modifier, modifier);
runParams.put(AbilityKey.Result, roll);
player.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDie, runParams, false);
}
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, player);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(player);
runParams.put(AbilityKey.Sides, sides);
runParams.put(AbilityKey.Result, rolls);
player.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDieOnce, runParams, false);

View File

@@ -20,8 +20,7 @@ public class RunChaosEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
Map<AbilityKey, Object> map = AbilityKey.newMap();
map.put(AbilityKey.Player, sa.getActivatingPlayer());
Map<AbilityKey, Object> map = AbilityKey.mapFromPlayer(sa.getActivatingPlayer());
map.put(AbilityKey.Result, PlanarDice.Chaos);
List<SpellAbility> validSA = Lists.newArrayList();

View File

@@ -9,7 +9,6 @@ import org.apache.commons.lang3.mutable.MutableBoolean;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
@@ -108,7 +107,7 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
CardCollectionView lastStateBattlefield = game.copyLastStateBattlefield();
CardCollectionView lastStateGraveyard = game.copyLastStateGraveyard();
Map<AbilityKey, Object> moveParams = Maps.newEnumMap(AbilityKey.class);
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, lastStateBattlefield);
moveParams.put(AbilityKey.LastStateGraveyard, lastStateGraveyard);

View File

@@ -119,7 +119,7 @@ public class CardFactoryUtil {
CardCollectionView lastStateBattlefield = game.copyLastStateBattlefield();
CardCollectionView lastStateGraveyard = game.copyLastStateGraveyard();
Map<AbilityKey, Object> moveParams = Maps.newEnumMap(AbilityKey.class);
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, lastStateBattlefield);
moveParams.put(AbilityKey.LastStateGraveyard, lastStateGraveyard);

View File

@@ -678,7 +678,7 @@ public class Combat {
// Run Unblocked Trigger
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Attacker, attacker);
runParams.put(AbilityKey.Defender,getDefenderByAttacker(attacker));
runParams.put(AbilityKey.Defender, getDefenderByAttacker(attacker));
runParams.put(AbilityKey.DefendingPlayer, getDefenderPlayerByAttacker(attacker));
game.getTriggerHandler().runTrigger(TriggerType.AttackerUnblocked, runParams, false);
}

View File

@@ -236,8 +236,7 @@ public class CostDiscard extends CostPartWithList {
super.handleChangeZoneTrigger(payer, ability, targetCards);
if (!targetCards.isEmpty()) {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, payer);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(payer);
runParams.put(AbilityKey.Cards, new CardCollection(targetCards));
runParams.put(AbilityKey.Cause, ability);
runParams.put(AbilityKey.FirstTime, firstTime);

View File

@@ -397,8 +397,7 @@ public class PhaseHandler implements java.io.Serializable {
table.triggerChangesZoneAll(game, null);
if (!discarded.isEmpty()) {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, playerTurn);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(playerTurn);
runParams.put(AbilityKey.Cards, discarded);
runParams.put(AbilityKey.Cause, null);
runParams.put(AbilityKey.FirstTime, firstDiscarded);
@@ -440,9 +439,8 @@ public class PhaseHandler implements java.io.Serializable {
if (!skipped) {
// Run triggers if phase isn't being skipped
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(playerTurn);
runParams.put(AbilityKey.Phase, phase.nameForScripts);
runParams.put(AbilityKey.Player, playerTurn);
game.getTriggerHandler().runTrigger(TriggerType.Phase, runParams, false);
}
@@ -519,8 +517,7 @@ public class PhaseHandler implements java.io.Serializable {
game.getCleanup().executeUntil(playerTurn);
// "Trigger" for begin turn to get around a phase skipping
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, playerTurn);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(playerTurn);
game.getTriggerHandler().runTrigger(TriggerType.TurnBegin, runParams, false);
}
planarDiceRolledthisTurn = 0;

View File

@@ -1,5 +1,5 @@
Name:Echo Chamber
ManaCost:4
Types:Artifact
A:AB$ CopyPermanent | Cost$ 4 T | ValidTgts$ Creature | TargetingPlayer$ Player.Opponent | TargetingPlayerControls$ True | TgtPrompt$ Select target creature you control | PumpKeywords$ Haste | AtEOT$ Exile | SorcerySpeed$ True | SpellDescription$ An opponent chooses target creature they control. Create a token that's a copy of that creature. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate only as a sorcery.
A:AB$ CopyPermanent | Cost$ 4 T | ValidTgts$ Creature | TargetingPlayer$ Player.Opponent | TargetingPlayerControls$ True | TgtPrompt$ Select target creature you control | PumpKeywords$ Haste | PumpDuration$ EOT | AtEOT$ Exile | SorcerySpeed$ True | SpellDescription$ An opponent chooses target creature they control. Create a token that's a copy of that creature. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate only as a sorcery.
Oracle:{4}, {T}: An opponent chooses target creature they control. Create a token that's a copy of that creature. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate only as a sorcery.

View File

@@ -2,8 +2,7 @@ Name:Elvish Reclaimer
ManaCost:G
Types:Creature Elf Warrior
PT:1/2
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE3 | Description$ CARDNAME gets +2/+2 as long as there are three or more land cards in your graveyard.
SVar:X:Count$TypeInYourYard.Land
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Land.YouOwn | PresentZone$ Graveyard | Description$ CARDNAME gets +2/+2 as long as there are three or more land cards in your graveyard.
A:AB$ ChangeZone | Cost$ 2 T Sac<1/Land> | Origin$ Library | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | Tapped$ True | SpellDescription$ Search your library for a land card, put it onto the battlefield tapped, then shuffle.
AI:RemoveDeck:Random
Oracle:Elvish Reclaimer gets +2/+2 as long as there are three or more land cards in your graveyard.\n{2}, {T}, Sacrifice a land: Search your library for a land card, put it onto the battlefield tapped, then shuffle.

View File

@@ -3,7 +3,7 @@ ManaCost:1 W
Types:Sorcery
A:SP$ Effect | Cost$ 1 W | ReplacementEffects$ FDRep | StaticAbilities$ FDManaConvertion | SubAbility$ DBDraw | SpellDescription$ Until end of turn, spells and abilities you control that would add colored mana instead add that much white mana. Until end of turn, you may spend white mana as though it were mana of any color. Draw a card.
SVar:DBDraw:DB$ Draw | NumCards$ 1
SVar:FDRep:Event$ ProduceMana | ActiveZones$ Command | ValidCard$ Card.YouCtrl | ReplaceWith$ ProduceW | Description$ Spells and abilities you control that would add colored mana add that much white mana instead.
SVar:FDRep:Event$ ProduceMana | ActiveZones$ Command | ValidAbility$ SpellAbility.YouCtrl | ReplaceWith$ ProduceW | Description$ Spells and abilities you control that would add colored mana add that much white mana instead.
SVar:ProduceW:DB$ ReplaceMana | ReplaceColor$ W
SVar:FDManaConvertion:Mode$ Continuous | EffectZone$ Command | Affected$ You | ManaConversion$ W->AnyColor | Description$ You may spend white mana as though it were mana of any color.
AI:RemoveDeck:All

View File

@@ -3,6 +3,5 @@ ManaCost:3 G G
Types:Creature Ape
PT:4/4
K:Trample
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 4 | CheckSVar$ X | SVarCompare$ EQ0 | Description$ CARDNAME gets +4/+4 as long as there are no cards in your graveyard.
SVar:X:Count$InYourYard
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 4 | IsPresent$ Card.YouOwn | PresentZone$ Graveyard | PresentCompare$ EQ0 | Description$ CARDNAME gets +4/+4 as long as there are no cards in your graveyard.
Oracle:Trample\nGorilla Titan gets +4/+4 as long as there are no cards in your graveyard.

View File

@@ -3,6 +3,5 @@ ManaCost:4 G G
Types:Creature Beast
PT:5/5
K:Trample
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 3 | AddToughness$ 3 | CheckSVar$ X | SVarCompare$ GE1 | Description$ CARDNAME gets +3/+3 as long as there is a land card in your graveyard.
SVar:X:Count$TypeInYourYard.Land
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 3 | AddToughness$ 3 | IsPresent$ Land.YouOwn | PresentZone$ Graveyard | Description$ CARDNAME gets +3/+3 as long as there is a land card in your graveyard.
Oracle:Trample\nMurasa Behemoth gets +3/+3 as long as there is a land card in your graveyard.

View File

@@ -3,7 +3,7 @@ ManaCost:2 U B R
Types:Legendary Creature Human Artificer
PT:5/4
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigCopy | TriggerDescription$ At the beginning of combat on your turn, create a token that's a copy of target noncreature artifact you control, except its name is Mishra's Warform and it's a 4/4 Construct artifact creature in addition to its other types. It gains haste until end of turn. Sacrifice it at the beginning of the next end step.
SVar:TrigCopy:DB$ CopyPermanent | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select target noncreature artifact you control | AddTypes$ Creature & Construct | PumpKeywords$ Haste | AtEOT$ Sacrifice | NewName$ Mishra's Warform | SetPower$ 4 | SetToughness$ 4
SVar:TrigCopy:DB$ CopyPermanent | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select target noncreature artifact you control | AddTypes$ Creature & Construct | PumpKeywords$ Haste | PumpDuration$ EOT | AtEOT$ Sacrifice | NewName$ Mishra's Warform | SetPower$ 4 | SetToughness$ 4
DeckHints:Type$Artifact
DeckHas:Type$Construct & Ability$Sacrifice|Token
SVar:PlayMain1:TRUE