mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
[AFC] Fixed Belt of Giant Strength cost reduction (fixes #8347)
This commit is contained in:
parent
4094580a6c
commit
b63623b40f
2 changed files with 23 additions and 6 deletions
|
@ -51,10 +51,28 @@ enum BeltOfGiantStrengthAdjuster implements CostAdjuster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
Permanent permanent = game.getPermanent(ability.getFirstTarget());
|
if (game.inCheckPlayableState()) {
|
||||||
if (permanent == null) {
|
int maxPower = 0;
|
||||||
return;
|
for (UUID permId : CardUtil.getAllPossibleTargets(ability, game)) {
|
||||||
|
Permanent permanent = game.getPermanent(permId);
|
||||||
|
if (permanent != null) {
|
||||||
|
int power = permanent.getPower().getValue();
|
||||||
|
if (power > maxPower) {
|
||||||
|
maxPower = power;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxPower > 0) {
|
||||||
|
CardUtil.reduceCost(ability, maxPower);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Permanent permanent = game.getPermanent(ability.getFirstTarget());
|
||||||
|
if (permanent != null) {
|
||||||
|
int power = permanent.getPower().getValue();
|
||||||
|
if (power > 0) {
|
||||||
|
CardUtil.reduceCost(ability, power);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CardUtil.reduceCost(ability, Integer.max(permanent.getPower().getValue(), 0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ public class BeltOfGiantStrengthTest extends CardTestPlayerBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore // currently failing, need to fix
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithoutManaAvailable() {
|
public void testWithoutManaAvailable() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, belt);
|
addCard(Zone.BATTLEFIELD, playerA, belt);
|
||||||
|
|
Loading…
Reference in a new issue