mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'mutate_was_cast' into 'master'
Handle mutate and wasCast interaction See merge request core-developers/forge!5044
This commit is contained in:
@@ -705,17 +705,20 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
|
||||
if (zoneFrom == null) {
|
||||
c.setCastFrom(null);
|
||||
c.setCastSA(null);
|
||||
} else if (zoneTo.is(ZoneType.Stack)) {
|
||||
c.setCastFrom(zoneFrom.getZoneType());
|
||||
if (zoneTo.is(ZoneType.Stack)) {
|
||||
// zoneFrom maybe null if the spell is cast from "Ouside the game", ex. ability of Garth One-Eye
|
||||
if (zoneFrom == null) {
|
||||
c.setCastFrom(null);
|
||||
} else {
|
||||
c.setCastFrom(zoneFrom.getZoneType());
|
||||
}
|
||||
if (cause != null && cause.isSpell() && c.equals(cause.getHostCard()) && !c.isCopiedSpell()) {
|
||||
c.setCastSA(cause);
|
||||
} else {
|
||||
c.setCastSA(null);
|
||||
}
|
||||
} else if (!(zoneTo.is(ZoneType.Battlefield) && zoneFrom.is(ZoneType.Stack))) {
|
||||
} else if (zoneFrom == null || !(zoneFrom.is(ZoneType.Stack) &&
|
||||
(zoneTo.is(ZoneType.Battlefield) || zoneTo.is(ZoneType.Merged)))) {
|
||||
c.setCastFrom(null);
|
||||
c.setCastSA(null);
|
||||
}
|
||||
|
||||
@@ -6036,6 +6036,19 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
public void setCastFrom(final ZoneType castFrom0) {
|
||||
castFrom = castFrom0;
|
||||
}
|
||||
public boolean wasCast() {
|
||||
if (hasMergedCard()) {
|
||||
boolean wasCast = false;
|
||||
for (Card c : getMergedCards()) {
|
||||
if (null != c.getCastFrom()) {
|
||||
wasCast = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return wasCast;
|
||||
}
|
||||
return getCastFrom() != null;
|
||||
}
|
||||
|
||||
public SpellAbility getCastSA() {
|
||||
return castSA;
|
||||
|
||||
@@ -1690,16 +1690,15 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("wasCast")) {
|
||||
if (null == card.getCastFrom()) {
|
||||
if (!card.wasCast()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("wasNotCast")) {
|
||||
if (null != card.getCastFrom()) {
|
||||
if (card.wasCast()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("wasCastFrom")) {
|
||||
// How are we getting in here with a comma?
|
||||
final String strZone = property.split(",")[0].substring(11);
|
||||
final String strZone = property.substring(11);
|
||||
final ZoneType realZone = ZoneType.smartValueOf(strZone);
|
||||
if (realZone != card.getCastFrom()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user