mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 21:42:07 -08:00
* Thraximundar - Fixed that the second ability to sacrifice a creature didn't trigger.
This commit is contained in:
parent
3592c3b06a
commit
d36a968579
19 changed files with 44 additions and 21 deletions
|
|
@ -47,7 +47,7 @@ public class DefendingPlayerControlsCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defendingPlayer = game.getCombat().getDefendingPlayer(source.getSourceId());
|
||||
UUID defendingPlayer = game.getCombat().getDefenderId(source.getSourceId());
|
||||
return defendingPlayer != null && game.getBattlefield().countAll(filter, defendingPlayer, game) > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class AnnihilatorEffect extends OneShotEffect<AnnihilatorEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defenderId = game.getCombat().getDefendingPlayer(source.getSourceId());
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
Player player = game.getPlayer(defenderId);
|
||||
|
||||
//Defender may be a planeswalker.
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class ReturnAttackerToHandTargetCost extends CostImpl<ReturnAttackerToHandTarget
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
defendingPlayerId = game.getCombat().getDefendingPlayer(permanent.getId());
|
||||
defendingPlayerId = game.getCombat().getDefenderId(permanent.getId());
|
||||
paid |= permanent.moveToZone(Zone.HAND, sourceId, game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,7 +526,12 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
return false;
|
||||
}
|
||||
|
||||
public UUID getDefendingPlayer(UUID attackerId) {
|
||||
/**
|
||||
*
|
||||
* @param attackerId
|
||||
* @return uuid of defending player or planeswalker
|
||||
*/
|
||||
public UUID getDefenderId(UUID attackerId) {
|
||||
UUID defenderId = null;
|
||||
for (CombatGroup group : groups) {
|
||||
if (group.getAttackers().contains(attackerId)) {
|
||||
|
|
@ -537,6 +542,25 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
return defenderId;
|
||||
}
|
||||
|
||||
public UUID getDefendingPlayerId(UUID attackerId, Game game) {
|
||||
UUID defenderId = null;
|
||||
for (CombatGroup group : groups) {
|
||||
if (group.getAttackers().contains(attackerId)) {
|
||||
defenderId = group.getDefenderId();
|
||||
if (group.defenderIsPlaneswalker) {
|
||||
Permanent permanent = game.getPermanent(defenderId);
|
||||
if (permanent != null) {
|
||||
defenderId = permanent.getControllerId();
|
||||
} else {
|
||||
defenderId = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return defenderId;
|
||||
}
|
||||
|
||||
public Set<UUID> getPlayerDefenders(Game game) {
|
||||
Set<UUID> playerDefenders = new HashSet<UUID>();
|
||||
for (CombatGroup group : groups) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue