mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- ORI: Added Kytheon, Hero of Akros
This commit is contained in:
@@ -268,6 +268,7 @@ public class GameAction {
|
||||
c.setTapped(false); //untap card after it leaves the battlefield if needed
|
||||
game.fireEvent(new GameEventCardTapped(c, false));
|
||||
}
|
||||
c.setMustAttackEntity(null);
|
||||
}
|
||||
|
||||
// Need to apply any static effects to produce correct triggers
|
||||
|
||||
@@ -35,6 +35,10 @@ public class MustAttackEffect extends SpellAbilityEffect {
|
||||
sb.append("Creatures ").append(player).append(" controls attack ");
|
||||
sb.append(defender).append(" during his or her next turn.");
|
||||
}
|
||||
for (final Card c : getTargetCards(sa)) {
|
||||
sb.append(c).append(" must attack ");
|
||||
sb.append(defender).append(" during its controller's next turn if able.");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -43,22 +47,27 @@ public class MustAttackEffect extends SpellAbilityEffect {
|
||||
public void resolve(SpellAbility sa) {
|
||||
final List<Player> tgtPlayers = getTargetPlayers(sa);
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
final String defender = sa.getParam("Defender");
|
||||
final GameEntity entity;
|
||||
if (defender.equals("Self")) {
|
||||
entity = sa.getHostCard();
|
||||
} else if (defender.equals("You")) {
|
||||
entity = sa.getActivatingPlayer();
|
||||
} else {
|
||||
throw new RuntimeException("Illegal defender " + defender + " for MustAttackEffect in card " + sa.getHostCard());
|
||||
}
|
||||
// System.out.println("Setting mustAttackEntity to: "+entity);
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final String defender = sa.getParam("Defender");
|
||||
final GameEntity entity;
|
||||
if (defender.equals("Self")) {
|
||||
entity = sa.getHostCard();
|
||||
} else if (defender.equals("You")) {
|
||||
entity = sa.getActivatingPlayer();
|
||||
} else {
|
||||
throw new RuntimeException("Illegal defender " + defender + " for MustAttackEffect in card " + sa.getHostCard());
|
||||
}
|
||||
// System.out.println("Setting mustAttackEntity to: "+entity);
|
||||
p.setMustAttackEntity(entity);
|
||||
}
|
||||
}
|
||||
for (final Card c : getTargetCards(sa)) {
|
||||
if ((tgt == null) || c.canBeTargetedBy(sa)) {
|
||||
c.setMustAttackEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
} // mustAttackResolve()
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
// if this card is an Aura, what Entity is it enchanting?
|
||||
private GameEntity enchanting = null;
|
||||
private GameEntity mustAttackEntity = null;
|
||||
|
||||
private final Map<Player, CardPlayOption> mayPlay = Maps.newTreeMap();
|
||||
|
||||
@@ -881,6 +882,18 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
mustBlockCards = view.clearCards(mustBlockCards, TrackableProperty.MustBlockCards);
|
||||
}
|
||||
|
||||
public final void setMustAttackEntity(final GameEntity e) {
|
||||
mustAttackEntity = e;
|
||||
}
|
||||
public final GameEntity getMustAttackEntity() {
|
||||
return mustAttackEntity;
|
||||
}
|
||||
public final void clearMustAttackEntity(final Player playerturn) {
|
||||
if (this.getController().equals(playerturn)) {
|
||||
mustAttackEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
public final CardCollectionView getClones() {
|
||||
return CardCollection.getView(clones);
|
||||
}
|
||||
@@ -4931,6 +4944,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (property.equals("attackingYou")) return combat.isAttacking(this, sourceController);
|
||||
} else if (property.startsWith("notattacking")) {
|
||||
return null == combat || !combat.isAttacking(this);
|
||||
} else if (property.equals("attackedThisCombat")) {
|
||||
if (null == combat || !this.getDamageHistory().getCreatureAttackedThisCombat()) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("attackedBySourceThisCombat")) {
|
||||
if (null == combat) return false;
|
||||
final GameEntity defender = combat.getDefenderByAttacker(source);
|
||||
@@ -6320,6 +6337,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
getDamageHistory().newTurn();
|
||||
setRegeneratedThisTurn(0);
|
||||
setBecameTargetThisTurn(false);
|
||||
clearMustAttackEntity(turn);
|
||||
clearMustBlockCards();
|
||||
getDamageHistory().setCreatureAttackedLastTurnOf(turn, getDamageHistory().getCreatureAttackedThisTurn());
|
||||
getDamageHistory().setCreatureAttackedThisTurn(false);
|
||||
|
||||
@@ -45,6 +45,10 @@ public class AttackRequirement {
|
||||
nAttackAnything++;
|
||||
}
|
||||
}
|
||||
final GameEntity mustAttack3 = attacker.getMustAttackEntity();
|
||||
if (mustAttack3 != null) {
|
||||
defenderSpecific.add(mustAttack3);
|
||||
}
|
||||
|
||||
final Game game = attacker.getGame();
|
||||
for (final GameEntity defender : possibleDefenders) {
|
||||
|
||||
Reference in New Issue
Block a user