This commit is contained in:
tool4ever
2022-12-28 08:15:17 +01:00
committed by GitHub
parent a886305410
commit b51c6a3f1b
14 changed files with 35 additions and 50 deletions

View File

@@ -76,22 +76,23 @@ public class GameCopier {
for (RegisteredPlayer p : origPlayers) {
newPlayers.add(clonePlayer(p));
}
GameRules currentRules = origGame.getRules();
Match newMatch = new Match(currentRules, newPlayers, origGame.getView().getTitle());
Game newGame = new Game(newPlayers, currentRules, newMatch);
for (int i = 0; i < origGame.getPlayers().size(); i++) {
Player origPlayer = origGame.getPlayers().get(i);
Player newPlayer = newGame.getPlayers().get(i);
newPlayer.setLife(origPlayer.getLife(), null);
newPlayer.setDamageReceivedThisTurn(origPlayer.getDamageReceivedThisTurn());
newPlayer.setActivateLoyaltyAbilityThisTurn(origPlayer.getActivateLoyaltyAbilityThisTurn());
for (int j = 0; j < origPlayer.getSpellsCastThisTurn(); j++)
newPlayer.addSpellCastThisTurn();
newPlayer.setLandsPlayedThisTurn(origPlayer.getLandsPlayedThisTurn());
newPlayer.setCounters(Maps.newHashMap(origPlayer.getCounters()));
newPlayer.setLifeLostLastTurn(origPlayer.getLifeLostLastTurn());
newPlayer.setLifeLostThisTurn(origPlayer.getLifeLostThisTurn());
newPlayer.setLifeGainedThisTurn(origPlayer.getLifeGainedThisTurn());
newPlayer.setLifeStartedThisTurnWith(origPlayer.getLifeStartedThisTurnWith());
newPlayer.setDamageReceivedThisTurn(origPlayer.getDamageReceivedThisTurn());
newPlayer.setActivateLoyaltyAbilityThisTurn(origPlayer.getActivateLoyaltyAbilityThisTurn());
newPlayer.setLandsPlayedThisTurn(origPlayer.getLandsPlayedThisTurn());
newPlayer.setCounters(Maps.newHashMap(origPlayer.getCounters()));
newPlayer.setBlessing(origPlayer.hasBlessing());
newPlayer.setRevolt(origPlayer.hasRevolt());
newPlayer.setLibrarySearched(origPlayer.getLibrarySearched());

View File

@@ -3,8 +3,6 @@ package forge.game.ability.effects;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Lists;
import forge.game.Game;
@@ -14,6 +12,7 @@ import forge.game.card.Card;
import forge.game.event.GameEventCombatChanged;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.TriggerType;
import forge.util.Lang;
public class BecomesBlockedEffect extends SpellAbilityEffect {
@@ -21,9 +20,7 @@ public class BecomesBlockedEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final List<Card> tgtCards = getTargetCards(sa);
sb.append(StringUtils.join(tgtCards, ", "));
sb.append(Lang.joinHomogenous(getTargetCards(sa)));
sb.append(" becomes blocked.");
return sb.toString();

View File

@@ -1,10 +1,7 @@
package forge.game.ability.effects;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Maps;
import forge.game.Game;
@@ -19,6 +16,7 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.util.CardTranslation;
import forge.util.Lang;
import forge.util.Localizer;
import forge.util.collect.FCollection;
@@ -28,10 +26,9 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final List<Card> tgtCards = getTargetCards(sa);
// should update when adding effects for defined blocker
sb.append("Reselect the defender of ");
sb.append(StringUtils.join(tgtCards, ", "));
sb.append(Lang.joinHomogenous(getTargetCards(sa)));
return sb.toString();
}

View File

@@ -68,7 +68,6 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
if (origin.contains(ZoneType.Library) && sa.hasParam("Search") && !sa.getActivatingPlayer().canSearchLibraryWith(sa, p)) {
cards.removeAll(p.getCardsIn(ZoneType.Library));
}
}
if (origin.contains(ZoneType.Library) && sa.hasParam("Search")) {
// Search library using changezoneall effect need a param "Search"

View File

@@ -20,7 +20,7 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
@Override
protected String getStackDescription(SpellAbility sa) {
List<Player> tgtPlayers = getTargetPlayers(sa);
return TextUtil.concatWithSpace(sa.getActivatingPlayer().toString(),"controls", Lang.joinHomogenous(tgtPlayers),"during their next turn");
return TextUtil.concatWithSpace(sa.getActivatingPlayer().toString(), "controls", Lang.joinHomogenous(tgtPlayers), "during their next turn");
}
@SuppressWarnings("serial")

View File

@@ -28,8 +28,9 @@ public class CountersPutOrRemoveEffect extends SpellAbilityEffect {
@Override
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final Player pl = !sa.hasParam("DefinedPlayer") ? sa.getActivatingPlayer() :
AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("DefinedPlayer"), sa).getFirst();
final Player pl = sa.hasParam("DefinedPlayer") ?
AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("DefinedPlayer"), sa).getFirst()
: sa.getActivatingPlayer();
sb.append(pl.getName());
if (sa.hasParam("CounterType")) {

View File

@@ -18,6 +18,7 @@ import forge.game.player.PlayerController;
import forge.game.spellability.SpellAbility;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.Localizer;
public class CountersRemoveEffect extends SpellAbilityEffect {
@@ -53,13 +54,9 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
}
sb.append(" from");
for (final Card c : getTargetCards(sa)) {
sb.append(" ").append(c);
}
sb.append(Lang.joinHomogenous(getTargetCards(sa)));
for (final Player tgtPlayer : getTargetPlayers(sa)) {
sb.append(" ").append(tgtPlayer);
}
sb.append(Lang.joinHomogenous(getTargetPlayers(sa)));
sb.append(".");

View File

@@ -9,6 +9,7 @@ import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.collect.FCollectionView;
public class DamageEachEffect extends DamageBaseEffect {
@@ -38,9 +39,7 @@ public class DamageEachEffect extends DamageBaseEffect {
sb.append(sa.getParam("StackDescription"));
} else {
sb.append("Each ").append(desc).append(" deals ").append(dmg).append(" to ");
for (final Player p : getTargetPlayers(sa)) {
sb.append(p);
}
Lang.joinHomogenous(getTargetPlayers(sa));
if (sa.hasParam("DefinedCards")) {
if (sa.getParam("DefinedCards").equals("Self")) {
sb.append(" itself");

View File

@@ -1,9 +1,5 @@
package forge.game.ability.effects;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect;
@@ -12,6 +8,7 @@ import forge.game.card.CardCollection;
import forge.game.combat.Combat;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.util.Lang;
public class RemoveFromCombatEffect extends SpellAbilityEffect {
@@ -19,10 +16,8 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final List<Card> tgtCards = getTargetCards(sa);
sb.append("Remove ");
sb.append(StringUtils.join(tgtCards, ", "));
sb.append(Lang.joinHomogenous(getTargetCards(sa)));
sb.append(" from combat.");
return sb.toString();

View File

@@ -563,6 +563,11 @@ public final class StaticAbilityContinuous {
p.setMaxHandSize(max);
}
}
if (params.containsKey("RaiseMaxHandSize")) {
String rmhs = params.get("RaiseMaxHandSize");
int rmax = AbilityUtils.calculateAmount(hostCard, rmhs, stAb);
p.setMaxHandSize(p.getMaxHandSize() + rmax);
}
if (params.containsKey("AdjustLandPlays")) {
String mhs = params.get("AdjustLandPlays");
@@ -573,6 +578,7 @@ public final class StaticAbilityContinuous {
p.addMaxLandPlays(se.getTimestamp(), add);
}
}
if (params.containsKey("ControlOpponentsSearchingLibrary")) {
Player cntl = Iterables.getFirst(AbilityUtils.getDefinedPlayers(hostCard, params.get("ControlOpponentsSearchingLibrary"), stAb), null);
p.addControlledWhileSearching(se.getTimestamp(), cntl);
@@ -592,12 +598,6 @@ public final class StaticAbilityContinuous {
p.addAdditionalOptionalVote(se.getTimestamp(), add);
}
if (params.containsKey("RaiseMaxHandSize")) {
String rmhs = params.get("RaiseMaxHandSize");
int rmax = AbilityUtils.calculateAmount(hostCard, rmhs, stAb);
p.setMaxHandSize(p.getMaxHandSize() + rmax);
}
if (params.containsKey("ManaConversion")) {
AbilityUtils.applyManaColorConversion(p.getManaPool(), params);
}

View File

@@ -5,8 +5,6 @@ K:Enchant creature
A:SP$ Attach | Cost$ 3 W W W | ValidTgts$ Creature | AILogic$ Pump
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 3 | AddToughness$ 3 | Description$ Enchanted creature gets +3/+3.
T:Mode$ DamageDone | ValidSource$ Card.AttachedBy | ValidTarget$ Player | Execute$ TrigSetLife | CombatDamage$ True | TriggerDescription$ Whenever enchanted creature deals combat damage to a player, double its controller's life total.
SVar:TrigSetLife:DB$ Pump | RememberObjects$ TriggeredSourceController | SubAbility$ DBSet
SVar:DBSet:DB$ SetLife | Defined$ Remembered | LifeAmount$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:PlayerCountRemembered$LifeTotal/Twice
SVar:TrigSetLife:DB$ SetLife | Defined$ TriggeredSourceController | LifeAmount$ X
SVar:X:PlayerCountDefinedTriggeredSourceController$LifeTotal/Twice
Oracle:Enchant creature\nEnchanted creature gets +3/+3.\nWhenever enchanted creature deals combat damage to a player, double its controller's life total.

View File

@@ -3,6 +3,6 @@ ManaCost:1 W U
Types:Creature Vedalken Wizard
PT:1/3
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, exile target nonland permanent an opponent controls and all other nonland permanents that player controls with the same name as that permanent until CARDNAME leaves the battlefield.
SVar:TrigExile:DB$ ChangeZone | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Permanent.nonLand+OppCtrl | TgtPrompt$ Select target nonland permanent an opponent controls | SubAbility$ DBChangeZoneAll | Duration$ UntilHostLeavesPlay
SVar:DBChangeZoneAll:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ Permanent.nonLand+NotDefinedTargeted+sharesNameWith Targeted+ControlledBy TargetedOrController | Duration$ UntilHostLeavesPlay
SVar:TrigExile:DB$ Pump | ValidTgts$ Permanent.nonLand+OppCtrl | TgtPrompt$ Select target nonland permanent an opponent controls | SubAbility$ DBChangeZoneAll
SVar:DBChangeZoneAll:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ TargetedCard.Self,Permanent.nonLand+NotDefinedTargeted+sharesNameWith Targeted+ControlledBy TargetedController | Duration$ UntilHostLeavesPlay
Oracle:When Deputy of Detention enters the battlefield, exile target nonland permanent an opponent controls and all other nonland permanents that player controls with the same name as that permanent until Deputy of Detention leaves the battlefield.

View File

@@ -3,6 +3,6 @@ ManaCost:1 B B
Types:Sorcery
A:SP$ Charm | Choices$ DBDraw,DBDebuff
SVar:DBDraw:DB$ Draw | NumCards$ 2 | SubAbility$ DBLoseLife | SpellDescription$ You draw two cards and you lose 2 life.
SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ 1
SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ 2
SVar:DBDebuff:DB$ PumpAll | ValidCards$ Creature.OppCtrl | NumAtt$ -1 | NumDef$ -1 | IsCurse$ True | SpellDescription$ Creatures your opponents control get -1/-1 until end of turn.
Oracle:Choose one —\n• You draw two cards and you lose 2 life.\n• Creatures your opponents control get -1/-1 until end of turn.

View File

@@ -1,6 +1,7 @@
Name:Legions to Ashes
ManaCost:1 W B
Types:Sorcery
A:SP$ ChangeZoneAll | TgtPrompt$ Select target nonland permanent an opponent controls | ValidTgts$ Permanent.nonLand+OppCtrl | ChangeType$ TargetedCard.Self,Creature.NotDefinedTargeted+token+sharesNameWith Targeted | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile target nonland permanent an opponent controls and all tokens that player controls with the same name as that permanent.
A:SP$ Pump | ValidTgts$ Permanent.nonland | TgtPrompt$ Select target nonland permanent an opponent controls | SubAbility$ ExileAll | SpellDescription$ Exile target nonland permanent an opponent controls and all tokens that player controls with the same name as that permanent.
SVar:ExileAll:DB$ ChangeZoneAll | ChangeType$ TargetedCard.Self,Card.NotDefinedTargeted+token+sharesNameWith Targeted+ControlledBy TargetedController | Origin$ Battlefield | Destination$ Exile
AI:RemoveDeck:Random
Oracle:Exile target nonland permanent an opponent controls and all tokens that player controls with the same name as that permanent.