Token's zone change counter (ZCC) improves:

* Now token's zcc uses same logic as card's zcc: enters to battlefield with +1 zcc instead +0 zcc
* It can improve support of copied spells that store zcc related data (bug example: lost kicked status for copied spell/token);
* Kicker abilities - improved support with copied creature spells (example: Verazol, the Split Current, #7431, #7433);
* Refactor: simplified kicker code;
This commit is contained in:
Oleg Agafonov 2021-02-04 19:15:54 +04:00
parent 3eb57eade9
commit f38639e1db
24 changed files with 262 additions and 177 deletions

View file

@ -8,9 +8,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class AttachEffect extends OneShotEffect {
@ -37,10 +37,10 @@ public class AttachEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
// if it activating on the stack then allow +1 zcc
int zcc = game.getState().getZoneChangeCounter(sourcePermanent.getId());
if (zcc == source.getSourceObjectZoneChangeCounter()
|| zcc == source.getSourceObjectZoneChangeCounter() + 1
|| zcc == source.getSourceObjectZoneChangeCounter() + 2) {
if (zcc == CardUtil.getActualSourceObjectZoneChangeCounter(game, source)
|| zcc == CardUtil.getActualSourceObjectZoneChangeCounter(game, source) + 1) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
return permanent.addAttachment(source.getSourceId(), source, game);