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) {
|
if (zoneTo.is(ZoneType.Stack)) {
|
||||||
c.setCastFrom(null);
|
// zoneFrom maybe null if the spell is cast from "Ouside the game", ex. ability of Garth One-Eye
|
||||||
c.setCastSA(null);
|
if (zoneFrom == null) {
|
||||||
} else if (zoneTo.is(ZoneType.Stack)) {
|
c.setCastFrom(null);
|
||||||
c.setCastFrom(zoneFrom.getZoneType());
|
} else {
|
||||||
|
c.setCastFrom(zoneFrom.getZoneType());
|
||||||
|
}
|
||||||
if (cause != null && cause.isSpell() && c.equals(cause.getHostCard()) && !c.isCopiedSpell()) {
|
if (cause != null && cause.isSpell() && c.equals(cause.getHostCard()) && !c.isCopiedSpell()) {
|
||||||
c.setCastSA(cause);
|
c.setCastSA(cause);
|
||||||
} else {
|
} else {
|
||||||
c.setCastSA(null);
|
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.setCastFrom(null);
|
||||||
c.setCastSA(null);
|
c.setCastSA(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6036,6 +6036,19 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
public void setCastFrom(final ZoneType castFrom0) {
|
public void setCastFrom(final ZoneType castFrom0) {
|
||||||
castFrom = 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() {
|
public SpellAbility getCastSA() {
|
||||||
return castSA;
|
return castSA;
|
||||||
|
|||||||
@@ -1690,16 +1690,15 @@ public class CardProperty {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.equals("wasCast")) {
|
} else if (property.equals("wasCast")) {
|
||||||
if (null == card.getCastFrom()) {
|
if (!card.wasCast()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.equals("wasNotCast")) {
|
} else if (property.equals("wasNotCast")) {
|
||||||
if (null != card.getCastFrom()) {
|
if (card.wasCast()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.startsWith("wasCastFrom")) {
|
} else if (property.startsWith("wasCastFrom")) {
|
||||||
// How are we getting in here with a comma?
|
final String strZone = property.substring(11);
|
||||||
final String strZone = property.split(",")[0].substring(11);
|
|
||||||
final ZoneType realZone = ZoneType.smartValueOf(strZone);
|
final ZoneType realZone = ZoneType.smartValueOf(strZone);
|
||||||
if (realZone != card.getCastFrom()) {
|
if (realZone != card.getCastFrom()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user