mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Decouple MustAttackEntity from MustAttackEntityThisTurn for Alluring Siren.
This commit is contained in:
@@ -542,11 +542,16 @@ public class AiAttackController {
|
|||||||
}
|
}
|
||||||
Player prefDefender = (Player) (defs.contains(this.defendingOpponent) ? this.defendingOpponent : defs.get(0));
|
Player prefDefender = (Player) (defs.contains(this.defendingOpponent) ? this.defendingOpponent : defs.get(0));
|
||||||
|
|
||||||
final GameEntity entity = ai.getMustAttackEntity();
|
// Attempt to see if there's a defined entity that must be attacked strictly this turn...
|
||||||
|
GameEntity entity = ai.getMustAttackEntityThisTurn();
|
||||||
|
if (entity == null) {
|
||||||
|
// ...or during the attacking creature controller's turn
|
||||||
|
entity = ai.getMustAttackEntity();
|
||||||
|
}
|
||||||
if (null != entity) {
|
if (null != entity) {
|
||||||
int n = defs.indexOf(entity);
|
int n = defs.indexOf(entity);
|
||||||
if (-1 == n) {
|
if (-1 == n) {
|
||||||
System.out.println("getMustAttackEntity() returned something not in defenders.");
|
System.out.println("getMustAttackEntity() or getMustAttackEntityThisTurn() returned something not in defenders.");
|
||||||
return prefDefender;
|
return prefDefender;
|
||||||
} else {
|
} else {
|
||||||
return entity;
|
return entity;
|
||||||
@@ -649,7 +654,7 @@ public class AiAttackController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mustAttack || attacker.getController().getMustAttackEntity() != null) {
|
if (mustAttack || attacker.getController().getMustAttackEntity() != null || attacker.getController().getMustAttackEntityThisTurn() != null) {
|
||||||
combat.addAttacker(attacker, defender);
|
combat.addAttacker(attacker, defender);
|
||||||
attackersLeft.remove(attacker);
|
attackersLeft.remove(attacker);
|
||||||
numForcedAttackers++;
|
numForcedAttackers++;
|
||||||
|
|||||||
@@ -61,14 +61,21 @@ public class MustAttackEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
for (final Player p : tgtPlayers) {
|
for (final Player p : tgtPlayers) {
|
||||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||||
p.setMustAttackEntity(entity);
|
if (thisTurn) {
|
||||||
p.setMustAttackEntityThisTurn(thisTurn);
|
p.setMustAttackEntityThisTurn(entity);
|
||||||
|
} else {
|
||||||
|
p.setMustAttackEntity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final Card c : getTargetCards(sa)) {
|
for (final Card c : getTargetCards(sa)) {
|
||||||
if ((tgt == null) || c.canBeTargetedBy(sa)) {
|
if ((tgt == null) || c.canBeTargetedBy(sa)) {
|
||||||
c.setMustAttackEntity(entity);
|
if (thisTurn) {
|
||||||
c.setMustAttackEntityThisTurn(thisTurn);
|
c.setMustAttackEntityThisTurn(entity);
|
||||||
|
} else {
|
||||||
|
c.setMustAttackEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
private GameEntity enchanting = null;
|
private GameEntity enchanting = null;
|
||||||
|
|
||||||
private GameEntity mustAttackEntity = null;
|
private GameEntity mustAttackEntity = null;
|
||||||
private boolean mustAttackEntityThisTurn = false;
|
private GameEntity mustAttackEntityThisTurn = null;
|
||||||
|
|
||||||
private final Map<StaticAbility, CardPlayOption> mayPlay = Maps.newTreeMap();
|
private final Map<StaticAbility, CardPlayOption> mayPlay = Maps.newTreeMap();
|
||||||
private int mayPlayTurn = 0;
|
private int mayPlayTurn = 0;
|
||||||
@@ -950,13 +950,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return mustAttackEntity;
|
return mustAttackEntity;
|
||||||
}
|
}
|
||||||
public final void clearMustAttackEntity(final Player playerturn) {
|
public final void clearMustAttackEntity(final Player playerturn) {
|
||||||
if (getController().equals(playerturn) || mustAttackEntityThisTurn) {
|
if (getController().equals(playerturn)) {
|
||||||
mustAttackEntity = null;
|
mustAttackEntity = null;
|
||||||
mustAttackEntityThisTurn = false;
|
|
||||||
}
|
}
|
||||||
|
mustAttackEntityThisTurn = null;
|
||||||
}
|
}
|
||||||
public final boolean getMustAttackEntityThisTurn() { return mustAttackEntityThisTurn; }
|
public final GameEntity getMustAttackEntityThisTurn() { return mustAttackEntityThisTurn; }
|
||||||
public final void setMustAttackEntityThisTurn(boolean thisTurnOnly) { mustAttackEntityThisTurn = thisTurnOnly; }
|
public final void setMustAttackEntityThisTurn(GameEntity entThisTurn) { mustAttackEntityThisTurn = entThisTurn; }
|
||||||
|
|
||||||
public final CardCollectionView getClones() {
|
public final CardCollectionView getClones() {
|
||||||
return CardCollection.getView(clones);
|
return CardCollection.getView(clones);
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public class AttackRequirement {
|
|||||||
if (mustAttack != null) {
|
if (mustAttack != null) {
|
||||||
defenderSpecific.add(mustAttack);
|
defenderSpecific.add(mustAttack);
|
||||||
}
|
}
|
||||||
|
final GameEntity mustAttackThisTurn = attacker.getController().getMustAttackEntityThisTurn();
|
||||||
|
if (mustAttackThisTurn != null) {
|
||||||
|
defenderSpecific.add(mustAttackThisTurn);
|
||||||
|
}
|
||||||
|
|
||||||
int nAttackAnything = 0;
|
int nAttackAnything = 0;
|
||||||
|
|
||||||
@@ -54,6 +58,10 @@ public class AttackRequirement {
|
|||||||
if (mustAttack3 != null) {
|
if (mustAttack3 != null) {
|
||||||
defenderSpecific.add(mustAttack3);
|
defenderSpecific.add(mustAttack3);
|
||||||
}
|
}
|
||||||
|
final GameEntity mustAttackThisTurn3 = attacker.getMustAttackEntityThisTurn();
|
||||||
|
if (mustAttackThisTurn3 != null) {
|
||||||
|
defenderSpecific.add(mustAttackThisTurn3);
|
||||||
|
}
|
||||||
|
|
||||||
final Game game = attacker.getGame();
|
final Game game = attacker.getGame();
|
||||||
for (final GameEntity defender : possibleDefenders) {
|
for (final GameEntity defender : possibleDefenders) {
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
private Map<Long, KeywordsChange> changedKeywords = new ConcurrentSkipListMap<Long, KeywordsChange>();
|
private Map<Long, KeywordsChange> changedKeywords = new ConcurrentSkipListMap<Long, KeywordsChange>();
|
||||||
private ManaPool manaPool = new ManaPool(this);
|
private ManaPool manaPool = new ManaPool(this);
|
||||||
private GameEntity mustAttackEntity = null;
|
private GameEntity mustAttackEntity = null;
|
||||||
private boolean mustAttackEntityThisTurn = false;
|
private GameEntity mustAttackEntityThisTurn = null;
|
||||||
private boolean attackedWithCreatureThisTurn = false;
|
private boolean attackedWithCreatureThisTurn = false;
|
||||||
private boolean activateLoyaltyAbilityThisTurn = false;
|
private boolean activateLoyaltyAbilityThisTurn = false;
|
||||||
private boolean tappedLandForManaThisTurn = false;
|
private boolean tappedLandForManaThisTurn = false;
|
||||||
@@ -2191,8 +2191,8 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
public final void setMustAttackEntity(final GameEntity o) {
|
public final void setMustAttackEntity(final GameEntity o) {
|
||||||
mustAttackEntity = o;
|
mustAttackEntity = o;
|
||||||
}
|
}
|
||||||
public final boolean getMustAttackEntityThisTurn() { return mustAttackEntityThisTurn; }
|
public final GameEntity getMustAttackEntityThisTurn() { return mustAttackEntityThisTurn; }
|
||||||
public final void setMustAttackEntityThisTurn(boolean thisTurnOnly) { mustAttackEntityThisTurn = thisTurnOnly; }
|
public final void setMustAttackEntityThisTurn(GameEntity entThisTurn) { mustAttackEntityThisTurn = entThisTurn; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Player o) {
|
public int compareTo(Player o) {
|
||||||
|
|||||||
Reference in New Issue
Block a user