mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
CounterMoveEffect: update Last State source and target
This commit is contained in:
@@ -137,12 +137,16 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
} else {
|
} else {
|
||||||
cnum = AbilityUtils.calculateAmount(host, counterNum, sa);
|
cnum = AbilityUtils.calculateAmount(host, counterNum, sa);
|
||||||
}
|
}
|
||||||
src.subtractCounter(cType, cnum);
|
if(cnum > 0) {
|
||||||
csum += cnum;
|
src.subtractCounter(cType, cnum);
|
||||||
|
game.updateLastStateForCard(src);
|
||||||
|
csum += cnum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csum > 0) {
|
if (csum > 0) {
|
||||||
dest.addCounter(cType, csum, host, true);
|
dest.addCounter(cType, csum, host, true);
|
||||||
|
game.updateLastStateForCard(dest);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (sa.hasParam("ValidDefined")) {
|
} else if (sa.hasParam("ValidDefined")) {
|
||||||
@@ -170,6 +174,8 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
tgtCards, sa, sb.toString(), 0, tgtCards.size(), true);
|
tgtCards, sa, sb.toString(), 0, tgtCards.size(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean updateSource = false;
|
||||||
|
|
||||||
for (final Card dest : tgtCards) {
|
for (final Card dest : tgtCards) {
|
||||||
// rule 121.5: If the first and second objects are the same object, nothing happens
|
// rule 121.5: If the first and second objects are the same object, nothing happens
|
||||||
if (source.equals(dest)) {
|
if (source.equals(dest)) {
|
||||||
@@ -193,8 +199,16 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
sb.append("Put how many ").append(cType.getName()).append(" counters on ").append(dest).append("?");
|
sb.append("Put how many ").append(cType.getName()).append(" counters on ").append(dest).append("?");
|
||||||
int cnum = player.getController().chooseNumber(sa, sb.toString(), 0, source.getCounters(cType), params);
|
int cnum = player.getController().chooseNumber(sa, sb.toString(), 0, source.getCounters(cType), params);
|
||||||
|
|
||||||
source.subtractCounter(cType, cnum);
|
if (cnum > 0) {
|
||||||
dest.addCounter(cType, cnum, host, true);
|
source.subtractCounter(cType, cnum);
|
||||||
|
dest.addCounter(cType, cnum, host, true);
|
||||||
|
game.updateLastStateForCard(dest);
|
||||||
|
updateSource = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateSource) {
|
||||||
|
// update source
|
||||||
|
game.updateLastStateForCard(source);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -249,6 +263,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
if (source.getCounters(cType) >= cntToMove) {
|
if (source.getCounters(cType) >= cntToMove) {
|
||||||
source.subtractCounter(cType, cntToMove);
|
source.subtractCounter(cType, cntToMove);
|
||||||
dest.addCounter(cType, cntToMove, host, true);
|
dest.addCounter(cType, cntToMove, host, true);
|
||||||
|
game.updateLastStateForCard(dest);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// any counterType currently only Leech Bonder
|
// any counterType currently only Leech Bonder
|
||||||
@@ -280,11 +295,16 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
int chosenAmount = pc.chooseNumber(
|
int chosenAmount = pc.chooseNumber(
|
||||||
sa, sb.toString(), 0, Math.min(tgtCounters.get(chosenType), cntToMove), params);
|
sa, sb.toString(), 0, Math.min(tgtCounters.get(chosenType), cntToMove), params);
|
||||||
|
|
||||||
dest.addCounter(chosenType, chosenAmount, host, true);
|
if (chosenAmount > 0) {
|
||||||
source.subtractCounter(chosenType, chosenAmount);
|
dest.addCounter(chosenType, chosenAmount, host, true);
|
||||||
cntToMove -= chosenAmount;
|
source.subtractCounter(chosenType, chosenAmount);
|
||||||
|
game.updateLastStateForCard(dest);
|
||||||
|
cntToMove -= chosenAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// update source
|
||||||
|
game.updateLastStateForCard(source);
|
||||||
} // moveCounterResolve
|
} // moveCounterResolve
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user