Reworking goad effects (ready for review) (#8034)

* changing goad to designation, refactored goad effects to be continuous

* [AFC] Implemented Vengeful Ancestor

* reworked effects which goad an attached creature

* updated goading implementation

* updated combat with new goad logic

* some more changes, added a test

* another fix

* update to test, still fails

* added more failing tests

* more failing tests

* added additional goad check

* small fix to two tests (still failing

* added a regular combat test (passes and fails randomly)

* fixed bug in computer player random selection

* some changes to how TargetDefender is handled

* removed unnecessary class

* more combat fixes, tests pass now

* removed tests which no longer work due to combat changes

* small merge fix

* [NEC] Implemented Komainu Battle Armor

* [NEC] Implemented Kaima, the Fractured Calm

* [NEC] added all variants
This commit is contained in:
Evan Kranzler 2022-02-15 09:18:21 -05:00 committed by GitHub
parent 5725873aeb
commit 4591ac07cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 812 additions and 438 deletions

View file

@ -72,6 +72,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
protected boolean manifested = false;
protected boolean morphed = false;
protected int classLevel = 1;
protected final Set<UUID> goadingPlayers = new HashSet<>();
protected UUID originalControllerId;
protected UUID controllerId;
protected UUID beforeResetControllerId;
@ -165,6 +166,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.monstrous = permanent.monstrous;
this.renowned = permanent.renowned;
this.classLevel = permanent.classLevel;
this.goadingPlayers.addAll(permanent.goadingPlayers);
this.pairedPermanent = permanent.pairedPermanent;
this.bandedCards.addAll(permanent.bandedCards);
this.timesLoyaltyUsed = permanent.timesLoyaltyUsed;
@ -209,6 +211,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.minBlockedBy = 1;
this.maxBlockedBy = 0;
this.copy = false;
this.goadingPlayers.clear();
}
@Override
@ -1345,14 +1348,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
//20101001 - 508.1c
if (defenderId == null) {
boolean oneCanBeAttacked = false;
for (UUID defenderToCheckId : game.getCombat().getDefenders()) {
if (canAttackCheckRestrictionEffects(defenderToCheckId, game)) {
oneCanBeAttacked = true;
break;
}
}
if (!oneCanBeAttacked) {
if (game.getCombat()
.getDefenders()
.stream()
.noneMatch(defenderToCheckId -> canAttackCheckRestrictionEffects(defenderToCheckId, game))) {
return false;
}
} else if (!canAttackCheckRestrictionEffects(defenderId, game)) {
@ -1582,6 +1581,16 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return false;
}
@Override
public void addGoadingPlayer(UUID playerId) {
this.goadingPlayers.add(playerId);
}
@Override
public Set<UUID> getGoadingPlayers() {
return goadingPlayers;
}
@Override
public void setPairedCard(MageObjectReference pairedCard) {
this.pairedPermanent = pairedCard;