mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Merge pull request #382 from Northmoc/nccParty
NCC: Life of the Party and support
This commit is contained in:
@@ -33,7 +33,6 @@ import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollectionView;
|
||||
|
||||
public class CopyPermanentEffect extends TokenEffectBase {
|
||||
|
||||
@@ -105,24 +104,37 @@ public class CopyPermanentEffect extends TokenEffectBase {
|
||||
final Card host = sa.getHostCard();
|
||||
final Player activator = sa.getActivatingPlayer();
|
||||
final Game game = host.getGame();
|
||||
boolean useZoneTable = true;
|
||||
CardZoneTable triggerList = sa.getChangeZoneTable();
|
||||
if (triggerList == null) {
|
||||
triggerList = new CardZoneTable();
|
||||
useZoneTable = false;
|
||||
}
|
||||
if (sa.hasParam("ChangeZoneTable")) {
|
||||
sa.setChangeZoneTable(triggerList);
|
||||
useZoneTable = true;
|
||||
}
|
||||
|
||||
if (sa.hasParam("Optional") && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblCopyPermanentConfirm"))) {
|
||||
MutableBoolean combatChanged = new MutableBoolean(false);
|
||||
TokenCreateTable tokenTable = new TokenCreateTable();
|
||||
|
||||
if (sa.hasParam("Optional") && !activator.getController().confirmAction(sa, null,
|
||||
Localizer.getInstance().getMessage("lblCopyPermanentConfirm"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int numCopies = sa.hasParam("NumCopies") ? AbilityUtils.calculateAmount(host, sa.getParam("NumCopies"), sa) : 1;
|
||||
final int numCopies = sa.hasParam("NumCopies") ? AbilityUtils.calculateAmount(host,
|
||||
sa.getParam("NumCopies"), sa) : 1;
|
||||
|
||||
Player controller = null;
|
||||
List<Player> controllers = Lists.newArrayList();
|
||||
if (sa.hasParam("Controller")) {
|
||||
final FCollectionView<Player> defined = AbilityUtils.getDefinedPlayers(host, sa.getParam("Controller"), sa);
|
||||
if (!defined.isEmpty()) {
|
||||
controller = defined.getFirst();
|
||||
controllers = AbilityUtils.getDefinedPlayers(host, sa.getParam("Controller"), sa);
|
||||
}
|
||||
}
|
||||
if (controller == null) {
|
||||
controller = activator;
|
||||
if (controllers.isEmpty()) {
|
||||
controllers.add(activator);
|
||||
}
|
||||
|
||||
for (final Player controller : controllers) {
|
||||
List<Card> tgtCards = Lists.newArrayList();
|
||||
|
||||
if (sa.hasParam("ValidSupportedCopy")) {
|
||||
@@ -211,20 +223,6 @@ public class CopyPermanentEffect extends TokenEffectBase {
|
||||
tgtCards = getDefinedCardsOrTargeted(sa);
|
||||
}
|
||||
|
||||
boolean useZoneTable = true;
|
||||
CardZoneTable triggerList = sa.getChangeZoneTable();
|
||||
if (triggerList == null) {
|
||||
triggerList = new CardZoneTable();
|
||||
useZoneTable = false;
|
||||
}
|
||||
if (sa.hasParam("ChangeZoneTable")) {
|
||||
sa.setChangeZoneTable(triggerList);
|
||||
useZoneTable = true;
|
||||
}
|
||||
|
||||
MutableBoolean combatChanged = new MutableBoolean(false);
|
||||
TokenCreateTable tokenTable = new TokenCreateTable();
|
||||
|
||||
for (final Card c : tgtCards) {
|
||||
// if it only targets player, it already got all needed cards from defined
|
||||
if (sa.usesTargeting() && !sa.getTargetRestrictions().canTgtPlayer() && !c.canBeTargetedBy(sa)) {
|
||||
@@ -240,6 +238,7 @@ public class CopyPermanentEffect extends TokenEffectBase {
|
||||
tokenTable.put(controller, getProtoType(sa, c, controller), numCopies);
|
||||
}
|
||||
} // end foreach Card
|
||||
}
|
||||
|
||||
makeTokenTable(tokenTable, true, triggerList, combatChanged, sa);
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ public class GoadEffect extends SpellAbilityEffect {
|
||||
final boolean remember = sa.hasParam("RememberGoaded");
|
||||
|
||||
for (final Card tgtC : getDefinedCardsOrTargeted(sa)) {
|
||||
// only pump things in PumpZone
|
||||
// only goad things on the battlefield
|
||||
if (!game.getCardsIn(ZoneType.Battlefield).contains(tgtC)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if pump is a target, make sure we can still target now
|
||||
// make sure we can still target now if using targeting
|
||||
if (sa.usesTargeting() && !sa.getTargetRestrictions().canTgtPlayer() && !tgtC.canBeTargetedBy(sa)) {
|
||||
continue;
|
||||
}
|
||||
@@ -31,6 +31,8 @@ public class GoadEffect extends SpellAbilityEffect {
|
||||
// 701.38d is handled by getGoaded
|
||||
tgtC.addGoad(timestamp, player);
|
||||
|
||||
// currently, only Life of the Party uses Duration$ – Duration$ Permanent
|
||||
if (!sa.hasParam("Duration")) {
|
||||
final GameCommand untilEOT = new GameCommand() {
|
||||
private static final long serialVersionUID = -1731759226844770852L;
|
||||
|
||||
@@ -41,6 +43,7 @@ public class GoadEffect extends SpellAbilityEffect {
|
||||
};
|
||||
|
||||
game.getCleanup().addUntil(player, untilEOT);
|
||||
}
|
||||
|
||||
if (remember && tgtC.isGoaded()) {
|
||||
sa.getHostCard().addRemembered(tgtC);
|
||||
|
||||
@@ -535,7 +535,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return currentStateName;
|
||||
}
|
||||
|
||||
// use by CopyPermament
|
||||
// use by CopyPermanent
|
||||
public void setStates(Map<CardStateName, CardState> map) {
|
||||
states.clear();
|
||||
states.putAll(map);
|
||||
|
||||
17
forge-gui/res/cardsfolder/upcoming/life_of_the_party.txt
Normal file
17
forge-gui/res/cardsfolder/upcoming/life_of_the_party.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
Name:Life of the Party
|
||||
ManaCost:3 R
|
||||
Types:Creature Elemental
|
||||
PT:0/1
|
||||
K:First Strike
|
||||
K:Trample
|
||||
K:Haste
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks, it gets +X/+0 until end of turn, where X is the number of creatures you control.
|
||||
SVar:TrigPump:DB$ Pump | NumAtt$ X
|
||||
SVar:X:Count$Valid Creature.YouCtrl
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+nonToken | Execute$ TrigCopyPermanent | TriggerDescription$ When CARDNAME enters the battlefield, if it's not a token, each opponent creates a token that's a copy of it. The tokens are goaded for the rest of the game. (They attack each combat if able and attack a player other than you if able.)
|
||||
SVar:TrigCopyPermanent:DB$ CopyPermanent | Defined$ TriggeredCard | Controller$ Opponent | RememberTokens$ True | SubAbility$ DBGoad
|
||||
SVar:DBGoad:DB$ Goad | Defined$ Remembered | Duration$ Permanent | SubAbility$ DBCleanup
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:NeedsToPlayVar:X GE3
|
||||
SVar:HasAttackEffect:TRUE
|
||||
Oracle:First strike, trample, haste\nWhenever Life of the Party attacks, it gets +X/+0 until end of turn, where X is the number of creatures you control.\nWhen Life of the Party enters the battlefield, if it's not a token, each opponent creates a token that's a copy of it. The tokens are goaded for the rest of the game. (They attack each combat if able and attack a player other than you if able.)
|
||||
Reference in New Issue
Block a user