mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
a couple of fields moved to base class
This commit is contained in:
@@ -407,16 +407,6 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the id.
|
|
||||||
*
|
|
||||||
* @param id0
|
|
||||||
* the id to set
|
|
||||||
*/
|
|
||||||
public void setId(final int id0) {
|
|
||||||
this.id = id0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Ability triggeredSA;
|
private Ability triggeredSA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import forge.card.mana.Mana;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
|
import forge.control.input.InputAutoPassPriority;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
@@ -30,16 +31,19 @@ public abstract class PlayerController {
|
|||||||
protected final GameState game;
|
protected final GameState game;
|
||||||
|
|
||||||
private PhaseType autoPassUntil = null;
|
private PhaseType autoPassUntil = null;
|
||||||
|
private final Input autoPassPriorityInput;
|
||||||
|
protected final Player player;
|
||||||
|
|
||||||
public PlayerController(GameState game0) {
|
public PlayerController(GameState game0, Player p) {
|
||||||
game = game0;
|
game = game0;
|
||||||
|
player = p;
|
||||||
|
autoPassPriorityInput = new InputAutoPassPriority(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Input getDefaultInput();
|
public abstract Input getDefaultInput();
|
||||||
public abstract Input getBlockInput();
|
public abstract Input getBlockInput();
|
||||||
public abstract Input getCleanupInput();
|
public abstract Input getCleanupInput();
|
||||||
public abstract Input getAutoPassPriorityInput();
|
public final Input getAutoPassPriorityInput() { return autoPassPriorityInput; }
|
||||||
|
|
||||||
public abstract boolean shouldAlwaysAcceptTrigger(Integer trigger);
|
public abstract boolean shouldAlwaysAcceptTrigger(Integer trigger);
|
||||||
public abstract boolean shouldAlwaysDeclineTrigger(Integer trigger);
|
public abstract boolean shouldAlwaysDeclineTrigger(Integer trigger);
|
||||||
@@ -93,7 +97,7 @@ public abstract class PlayerController {
|
|||||||
/**
|
/**
|
||||||
* @return the player
|
* @return the player
|
||||||
*/
|
*/
|
||||||
protected abstract Player getPlayer();
|
protected final Player getPlayer(){ return player; }
|
||||||
|
|
||||||
|
|
||||||
public abstract Deck sideboard(final Deck deck, GameType gameType);
|
public abstract Deck sideboard(final Deck deck, GameType gameType);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import forge.card.spellability.Spell;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.control.input.InputAutoPassPriority;
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
@@ -44,10 +43,9 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
private Input defaultInput;
|
private Input defaultInput;
|
||||||
private Input blockInput;
|
private Input blockInput;
|
||||||
private Input cleanupInput;
|
private Input cleanupInput;
|
||||||
private Input autoPassPriorityInput;
|
|
||||||
|
|
||||||
private final AiController brains;
|
private final AiController brains;
|
||||||
private final Player player;
|
|
||||||
|
|
||||||
|
|
||||||
public final Input getDefaultInput() {
|
public final Input getDefaultInput() {
|
||||||
@@ -55,15 +53,13 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlayerControllerAi(GameState game, Player p) {
|
public PlayerControllerAi(GameState game, Player p) {
|
||||||
super(game);
|
super(game, p);
|
||||||
player = p;
|
|
||||||
|
|
||||||
brains = new AiController(p, game);
|
brains = new AiController(p, game);
|
||||||
|
|
||||||
defaultInput = new AiInputCommon(brains);
|
defaultInput = new AiInputCommon(brains);
|
||||||
blockInput = new AiInputBlock(getPlayer());
|
blockInput = new AiInputBlock(getPlayer());
|
||||||
cleanupInput = getDefaultInput();
|
cleanupInput = getDefaultInput();
|
||||||
autoPassPriorityInput = new InputAutoPassPriority(getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,10 +80,6 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
return blockInput;
|
return blockInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Input getAutoPassPriorityInput() {
|
|
||||||
return autoPassPriorityInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cleanupInput
|
* @return the cleanupInput
|
||||||
@@ -139,11 +131,6 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Deck sideboard(Deck deck, GameType gameType) {
|
public Deck sideboard(Deck deck, GameType gameType) {
|
||||||
// AI does not know how to sideboard
|
// AI does not know how to sideboard
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.card.spellability.TargetSelection;
|
import forge.card.spellability.TargetSelection;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.control.input.InputAutoPassPriority;
|
|
||||||
import forge.control.input.InputBlock;
|
import forge.control.input.InputBlock;
|
||||||
import forge.control.input.InputCleanup;
|
import forge.control.input.InputCleanup;
|
||||||
import forge.control.input.InputPassPriority;
|
import forge.control.input.InputPassPriority;
|
||||||
@@ -50,21 +49,16 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
private final Input defaultInput;
|
private final Input defaultInput;
|
||||||
private final Input blockInput;
|
private final Input blockInput;
|
||||||
private final Input cleanupInput;
|
private final Input cleanupInput;
|
||||||
private final Input autoPassPriorityInput;
|
|
||||||
private final Player player;
|
|
||||||
|
|
||||||
public final Input getDefaultInput() {
|
public final Input getDefaultInput() {
|
||||||
return defaultInput;
|
return defaultInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerControllerHuman(GameState game0, Player p) {
|
public PlayerControllerHuman(GameState game0, Player p) {
|
||||||
super(game0);
|
super(game0, p);
|
||||||
player = p;
|
|
||||||
|
|
||||||
defaultInput = new InputPassPriority(player);
|
defaultInput = new InputPassPriority(player);
|
||||||
blockInput = new InputBlock(getPlayer(), game0);
|
blockInput = new InputBlock(getPlayer(), game0);
|
||||||
cleanupInput = new InputCleanup(getPlayer());
|
cleanupInput = new InputCleanup(getPlayer());
|
||||||
autoPassPriorityInput = new InputAutoPassPriority(getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,11 +84,6 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
return blockInput;
|
return blockInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Input getAutoPassPriorityInput() {
|
|
||||||
return autoPassPriorityInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cleanupInput
|
* @return the cleanupInput
|
||||||
*/
|
*/
|
||||||
@@ -138,14 +127,6 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
HumanPlay.playSaWithoutPayingManaCost(player, copySA);
|
HumanPlay.playSaWithoutPayingManaCost(player, copySA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the player
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.game.player.PlayerController#sideboard(forge.deck.Deck)
|
* @see forge.game.player.PlayerController#sideboard(forge.deck.Deck)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user