mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Variable loyality payment - Fixed a bug that the -X payment of loyality counters was added insted subtracted. Prevented the possibility to announce x loyality counter payment, if already one planeswalker ability was used this turn.
This commit is contained in:
parent
5624e1edfb
commit
6c924edd7a
3 changed files with 17 additions and 9 deletions
|
@ -120,11 +120,12 @@ class AshiokNightmareWeaverExileEffect extends OneShotEffect<AshiokNightmareWeav
|
|||
public boolean apply(Game game, Ability source) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (opponent != null) {
|
||||
Player controller = game.getPlayer(source.getSourceId());
|
||||
if (opponent != null && controller != null) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Card card = opponent.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);
|
||||
controller.moveCardToExileWithInfo(card, exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game, Zone.HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +171,7 @@ class AshiokNightmareWeaverPutIntoPlayEffect extends OneShotEffect<AshiokNightma
|
|||
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null && card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), player.getId())) {
|
||||
if (card != null && player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId())) {
|
||||
ContinuousEffectImpl effect = new AshiokNightmareWeaverAddTypeEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -42,12 +42,14 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class PayLoyaltyCost extends CostImpl<PayLoyaltyCost> {
|
||||
|
||||
private int amount;
|
||||
private final int amount;
|
||||
|
||||
public PayLoyaltyCost(int amount) {
|
||||
this.amount = amount;
|
||||
this.text = Integer.toString(amount);
|
||||
if (amount >= 0) this.text = "+" + this.text;
|
||||
if (amount >= 0) {
|
||||
this.text = "+" + this.text;
|
||||
}
|
||||
}
|
||||
|
||||
public PayLoyaltyCost(PayLoyaltyCost cost) {
|
||||
|
@ -58,9 +60,7 @@ public class PayLoyaltyCost extends CostImpl<PayLoyaltyCost> {
|
|||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
Permanent planeswalker = game.getPermanent(sourceId);
|
||||
if (planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && !planeswalker.isLoyaltyUsed())
|
||||
return true;
|
||||
return false;
|
||||
return planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && !planeswalker.isLoyaltyUsed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.VariableCostImpl;
|
||||
|
@ -55,9 +56,15 @@ public class PayVariableLoyaltyCost extends VariableCostImpl<PayVariableLoyaltyC
|
|||
return new PayVariableLoyaltyCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
Permanent planeswalker = game.getPermanent(sourceId);
|
||||
return planeswalker!= null && !planeswalker.isLoyaltyUsed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cost getFixedCostsFromAnnouncedValue(int xValue) {
|
||||
return new PayLoyaltyCost(xValue);
|
||||
return new PayLoyaltyCost(-xValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue