mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
*Fixed and expanded LKI code.
This commit is contained in:
@@ -662,4 +662,19 @@ public final class CardUtil {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getLKICopy.
|
||||||
|
* @param c a Card.
|
||||||
|
* @return a copy of C with LastKnownInfo stuff retained.
|
||||||
|
*/
|
||||||
|
public static Card getLKICopy(final Card c) {
|
||||||
|
Card res = AllZone.getCardFactory().copyCard(c);
|
||||||
|
res.setControllerObjects(c.getControllerObjects());
|
||||||
|
res.addTempAttackBoost(c.getTempAttackBoost());
|
||||||
|
res.addTempDefenseBoost(c.getTempDefenseBoost());
|
||||||
|
res.setCounters(c.getCounters());
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
} //end class CardUtil
|
} //end class CardUtil
|
||||||
|
|||||||
@@ -71,15 +71,14 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Card copied = null;
|
Card copied = null;
|
||||||
|
Card lastKnownInfo = null;
|
||||||
|
|
||||||
// Don't copy Tokens, Cards staying in same zone, or cards entering Battlefield
|
// Don't copy Tokens, Cards staying in same zone, or cards entering Battlefield
|
||||||
if (c.isToken() || suppress || zone.is(Constant.Zone.Battlefield))
|
if (c.isToken() || suppress || zone.is(Constant.Zone.Battlefield))
|
||||||
copied = c;
|
lastKnownInfo = copied = c;
|
||||||
else {
|
else {
|
||||||
copied = AllZone.getCardFactory().copyCard(c);
|
copied = AllZone.getCardFactory().copyCard(c);
|
||||||
copied.setControllerObjects(c.getControllerObjects());
|
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||||
copied.addTempAttackBoost(c.getTempAttackBoost());
|
|
||||||
copied.addTempDefenseBoost(c.getTempDefenseBoost());
|
|
||||||
|
|
||||||
// todo: improve choices here
|
// todo: improve choices here
|
||||||
// Certain attributes need to be copied from Hand->Stack and Stack->Battlefield
|
// Certain attributes need to be copied from Hand->Stack and Stack->Battlefield
|
||||||
@@ -91,7 +90,7 @@ public class GameAction {
|
|||||||
// This is the fix for Isochron Scepter and friends, we need to test other situations
|
// This is the fix for Isochron Scepter and friends, we need to test other situations
|
||||||
// To make sure it doesn't break anything serious
|
// To make sure it doesn't break anything serious
|
||||||
for (Trigger trigger : c.getTriggers())
|
for (Trigger trigger : c.getTriggers())
|
||||||
trigger.setHostCard(copied);
|
trigger.setHostCard(lastKnownInfo);
|
||||||
|
|
||||||
if (suppress)
|
if (suppress)
|
||||||
AllZone.getTriggerHandler().suppressMode("ChangesZone");
|
AllZone.getTriggerHandler().suppressMode("ChangesZone");
|
||||||
@@ -103,7 +102,7 @@ public class GameAction {
|
|||||||
zone.remove(copied);
|
zone.remove(copied);
|
||||||
|
|
||||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||||
runParams.put("Card", copied);
|
runParams.put("Card", lastKnownInfo);
|
||||||
if (prev != null) {
|
if (prev != null) {
|
||||||
runParams.put("Origin", prev.getZoneName());
|
runParams.put("Origin", prev.getZoneName());
|
||||||
} else {
|
} else {
|
||||||
@@ -123,10 +122,10 @@ public class GameAction {
|
|||||||
prev.remove(c);
|
prev.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (!(c.isToken() || suppress || zone.is(Constant.Zone.Battlefield)) && !zone.is(Constant.Zone.Battlefield))
|
if (!(c.isToken() || suppress || zone.is(Constant.Zone.Battlefield)) && !zone.is(Constant.Zone.Battlefield))
|
||||||
copied = AllZone.getCardFactory().copyCard(copied);
|
copied = AllZone.getCardFactory().copyCard(copied);
|
||||||
|
*/
|
||||||
//remove all counters from the card if destination is not the battlefield
|
//remove all counters from the card if destination is not the battlefield
|
||||||
if (!zone.is(Constant.Zone.Battlefield))
|
if (!zone.is(Constant.Zone.Battlefield))
|
||||||
copied.clearCounters();
|
copied.clearCounters();
|
||||||
|
|||||||
Reference in New Issue
Block a user