Better fix for manapool payment

This commit is contained in:
tool4EvEr
2021-06-04 20:25:05 +02:00
parent a3646e83c8
commit ba9b4617f7
2 changed files with 12 additions and 6 deletions

View File

@@ -25,7 +25,10 @@ import com.google.common.base.Function;
import forge.game.player.PlayerView;
import forge.game.zone.ZoneType;
import forge.gamemodes.match.input.Input;
import forge.gamemodes.match.input.InputPayMana;
import forge.gui.framework.ICDoc;
import forge.player.PlayerControllerHuman;
import forge.screens.match.CMatchUI;
import forge.screens.match.ZoneAction;
import forge.screens.match.views.VField;
@@ -69,10 +72,14 @@ public class CField implements ICDoc {
final Function<Byte, Boolean> manaAction = new Function<Byte, Boolean>() {
@Override public final Boolean apply(final Byte colorCode) {
if (player.getHasPriority()) {
final int oldMana = player.getMana(colorCode);
matchUI.getGameController().useMana(colorCode.byteValue());
return Boolean.valueOf(oldMana != player.getMana(colorCode));
if (matchUI.getGameController() instanceof PlayerControllerHuman) {
final PlayerControllerHuman controller = (PlayerControllerHuman) matchUI.getGameController();
final Input ipm = controller.getInputQueue().getInput();
if (ipm instanceof InputPayMana && ipm.getOwner().equals(player)) {
final int oldMana = player.getMana(colorCode);
controller.useMana(colorCode.byteValue());
return Boolean.valueOf(oldMana != player.getMana(colorCode));
}
}
return Boolean.FALSE;
}

View File

@@ -2170,8 +2170,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
public IDevModeCheats cheat() {
if (cheats == null) {
cheats = new DevModeCheats();
// TODO: In Network game, inform other players that this player is
// cheating
// TODO: In Network game, inform other players that this player is cheating
}
return cheats;
}