Fix wasCastByYou (#2788)

Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
tool4ever
2023-03-31 07:19:06 +02:00
committed by GitHub
parent 2e87cc8fb4
commit 14a36454c7
4 changed files with 7 additions and 10 deletions

View File

@@ -33,10 +33,10 @@ public class CountersProliferateEffect extends SpellAbilityEffect {
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
int num = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("Amount"), sa) : 1;
final Player p = sa.getActivatingPlayer(); final Player p = sa.getActivatingPlayer();
final Card host = sa.getHostCard(); final Card host = sa.getHostCard();
final Game game = host.getGame(); final Game game = host.getGame();
int num = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(host, sa.getParam("Amount"), sa) : 1;
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(p); final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(p);
repParams.put(AbilityKey.Source, sa); repParams.put(AbilityKey.Source, sa);

View File

@@ -6955,8 +6955,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
etbCounters.clear(); etbCounters.clear();
} }
public final Set<Table.Cell<Player, CounterType, Integer>> getEtbCounters() { public final Table<Player, CounterType, Integer> getEtbCounters() {
return etbCounters.cellSet(); return etbCounters;
} }
public final void putEtbCounters(GameEntityCounterTable table) { public final void putEtbCounters(GameEntityCounterTable table) {

View File

@@ -1873,7 +1873,7 @@ public class CardProperty {
} }
final ZoneType realZone = ZoneType.smartValueOf(strZone); final ZoneType realZone = ZoneType.smartValueOf(strZone);
if (card.getCastFrom() == null || (zoneOwner != null && !card.getCastFrom().getPlayer().equals(zoneOwner)) if (card.getCastFrom() == null || (zoneOwner != null && !card.getCastFrom().getPlayer().equals(zoneOwner))
|| (byYou && !controller.equals(card.getCastSA().getActivatingPlayer())) || (byYou && !sourceController.equals(card.getCastSA().getActivatingPlayer()))
|| realZone != card.getCastFrom().getZoneType()) { || realZone != card.getCastFrom().getZoneType()) {
return false; return false;
} }
@@ -1894,7 +1894,7 @@ public class CardProperty {
} }
final ZoneType realZone = ZoneType.smartValueOf(strZone); final ZoneType realZone = ZoneType.smartValueOf(strZone);
if (card.getCastFrom() != null && (zoneOwner == null || card.getCastFrom().getPlayer().equals(zoneOwner)) if (card.getCastFrom() != null && (zoneOwner == null || card.getCastFrom().getPlayer().equals(zoneOwner))
&& (!byYou || controller.equals(card.getCastSA().getActivatingPlayer())) && (!byYou || sourceController.equals(card.getCastSA().getActivatingPlayer()))
&& realZone == card.getCastFrom().getZoneType()) { && realZone == card.getCastFrom().getZoneType()) {
return false; return false;
} }
@@ -1902,7 +1902,7 @@ public class CardProperty {
if (!card.wasCast()) { if (!card.wasCast()) {
return false; return false;
} }
if (property.contains("ByYou") && !controller.equals(card.getCastSA().getActivatingPlayer())) { if (property.contains("ByYou") && !sourceController.equals(card.getCastSA().getActivatingPlayer())) {
return false; return false;
} }
} else if (property.equals("wasNotCast")) { } else if (property.equals("wasNotCast")) {

View File

@@ -25,7 +25,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.collect.Table;
import forge.ImageKeys; import forge.ImageKeys;
import forge.card.CardStateName; import forge.card.CardStateName;
@@ -283,9 +282,7 @@ public final class CardUtil {
newCopy.setChosenNumber(in.getChosenNumber()); newCopy.setChosenNumber(in.getChosenNumber());
} }
for (Table.Cell<Player, CounterType, Integer> cl : in.getEtbCounters()) { newCopy.getEtbCounters().putAll(in.getEtbCounters());
newCopy.addEtbCounter(cl.getColumnKey(), cl.getValue(), cl.getRowKey());
}
newCopy.setUnearthed(in.isUnearthed()); newCopy.setUnearthed(in.isUnearthed());