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

@ -976,24 +976,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
if (target.getOriginalTarget() instanceof TargetDefender) {
// TODO: Improve, now planeswalker is always chosen if it exits
List<Permanent> targets;
targets = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_PLANESWALKER, randomOpponentId, game);
if (targets != null && !targets.isEmpty()) {
for (Permanent planeswalker : targets) {
if (target.canTarget(abilityControllerId, planeswalker.getId(), source, game)) {
target.addTarget(planeswalker.getId(), source, game);
}
if (target.isChosen()) {
return true;
}
}
}
if (!target.isChosen()) {
if (target.canTarget(abilityControllerId, randomOpponentId, source, game)) {
target.addTarget(randomOpponentId, source, game);
}
}
UUID randomDefender = RandomUtil.randomFromCollection(possibleTargets);
target.addTarget(randomDefender, source, game);
return target.isChosen();
}
@ -2997,21 +2981,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
* @return
*/
private UUID getRandomOpponent(UUID abilityControllerId, Game game) {
UUID randomOpponentId = null;
Set<UUID> opponents = game.getOpponents(abilityControllerId);
if (opponents.size() > 1) {
int rand = RandomUtil.nextInt(opponents.size());
int count = 0;
for (UUID currentId : opponents) {
if (count == rand) {
randomOpponentId = currentId;
break;
}
}
} else if (opponents.size() == 1) {
randomOpponentId = game.getOpponents(abilityControllerId).iterator().next();
}
return randomOpponentId;
return RandomUtil.randomFromCollection(game.getOpponents(abilityControllerId));
}
@Override