Stuck with C19 Aeon Engine
by BetaSteward
Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins
Stuck with C19 Aeon Engine
by azra1l » 20 Nov 2019, 01:54
So i am working on this card, and i am stuck with this issue:
when the card is played it comes into play tapped, everything fine.
upon same players next turn, and right on the upkeep step, the card get's exiled and it's effect applied.
after that turn ends, turn order is reversed, so the card actually works,
i just need to figure out how to have it apply it's effect only when i tap it.
i guess the effect triggers because the card is already tapped when my turn begins...
but i checked other cards with similiar effect mechanisms and couldn't find anything off
my code additions / changes:
AeonEngine.java
Should i just commit and hope someone else will fix this up?
I also hope my changes to the turn mechanism won't break anything else :S
Anyways, thanks in advance.
when the card is played it comes into play tapped, everything fine.
upon same players next turn, and right on the upkeep step, the card get's exiled and it's effect applied.
after that turn ends, turn order is reversed, so the card actually works,
i just need to figure out how to have it apply it's effect only when i tap it.
i guess the effect triggers because the card is already tapped when my turn begins...
but i checked other cards with similiar effect mechanisms and couldn't find anything off
my code additions / changes:
AeonEngine.java
- Code: Select all
public final class AeonEngine extends CardImpl {
public AeonEngine(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
// Aeon Engine enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// {T}, Exile Aeon Engine: Reverse the game’s turn order. (For example, if play had proceeded clockwise around the table, it now goes counterclockwise.)
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AeonEngineEffect(), new TapSourceCost());
ability.addCost(new ExileSourceCost());
this.addAbility(ability);
}
public AeonEngine(final AeonEngine card) {
super(card);
}
@Override
public AeonEngine copy() {
return new AeonEngine(this);
}
}
class AeonEngineEffect extends OneShotEffect {
public AeonEngineEffect() {
super(Outcome.Neutral);
this.staticText = "Reverse the game’s turn order.";
}
public AeonEngineEffect(final AeonEngineEffect effect) {
super(effect);
}
@Override
public AeonEngineEffect copy() {
return new AeonEngineEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
TurnOrder turnOrder = game.getTurnOrder();
if (turnOrder == TurnOrder.CLOCKWISE) {
game.setTurnOrder(TurnOrder.COUNTER_CLOCKWISE);
}else {
game.setTurnOrder(TurnOrder.CLOCKWISE);
}
TurnOrder turnOrderAfter = game.getTurnOrder();
return turnOrderAfter != turnOrder;
}
}
- Code: Select all
...
public Player getNext(Game game) {
UUID start = this.get();
if (start == null) {
return null;
}
Player player;
TurnOrder turnOrder = game.getTurnOrder();
while (true) {
//Implementation of Aeon Engine
if (turnOrder == TurnOrder.CLOCKWISE) {
player = game.getPlayer(super.getNext());
} else {
player = game.getPlayer(super.getPrevious());
}
//player = game.getPlayer(super.getNext());
if (!player.hasLeft() && !player.hasLost()) {
break;
}
if (!player.hasReachedNextTurnAfterLeaving()) {
player.setReachedNextTurnAfterLeaving(true);
}
if (player.getId().equals(start)) {
return null;
}
}
return player;
}
public Player getPrevious(Game game) {
UUID start = this.get();
if (start == null) {
return null;
}
Player player;
TurnOrder turnOrder = game.getTurnOrder();
while (true) {
//Implementation of Aeon Engine
if (turnOrder == TurnOrder.CLOCKWISE) {
player = game.getPlayer(super.getPrevious());
} else {
player = game.getPlayer(super.getNext());
}
//player = game.getPlayer(super.getPrevious());
if (!player.hasLeft() && !player.hasLost()) {
break;
}
if (!player.hasReachedNextTurnAfterLeaving()) {
player.setReachedNextTurnAfterLeaving(true);
}
if (player.getId().equals(start)) {
return null;
}
}
return player;
}
...
- Code: Select all
...
//Implementation of Aeon Engine
private TurnOrder turnOrder;
...
//Implementation of Aeon Engine
@Override
public TurnOrder getTurnOrder() {
return this.turnOrder;
}
@Override
public void setTurnOrder(TurnOrder turnOrder) {
this.turnOrder = turnOrder;
}
...
- Code: Select all
...
//Implementation of Aeon Engine
TurnOrder getTurnOrder();
void setTurnOrder(TurnOrder turnOrder);
...
- Code: Select all
public enum TurnOrder {
CLOCKWISE("clockwise"),
COUNTER_CLOCKWISE("counter-clockwise");
private final String text;
TurnOrder(String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
public static TurnOrder fromString(String value) {
for (TurnOrder ct : TurnOrder.values()) {
if (ct.toString().equals(value)) {
return ct;
}
}
throw new IllegalArgumentException("Can't find turnorder enum value: " + value);
}
}
Should i just commit and hope someone else will fix this up?
I also hope my changes to the turn mechanism won't break anything else :S
Anyways, thanks in advance.
- azra1l
- Posts: 5
- Joined: 30 Oct 2019, 21:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Stuck with C19 Aeon Engine
by JayDi » 21 Nov 2019, 11:20
Commented in github -- use it for instead forum.
-
JayDi - Posts: 324
- Joined: 23 Nov 2017, 15:41
- Location: Russia
- Has thanked: 0 time
- Been thanked: 48 times
Re: Stuck with C19 Aeon Engine
by MrSandman » 21 Nov 2019, 12:43
That's an interesting question. I have a same problem. If you found solution, tell me
- MrSandman
- Posts: 4
- Joined: 21 Nov 2019, 12:14
- Has thanked: 0 time
- Been thanked: 0 time
Re: Stuck with C19 Aeon Engine
by azra1l » 26 Nov 2019, 06:11
my initial problem was, storing changeable aspects about the game need to be stored in GameState, not Game.MrSandman wrote:That's an interesting question. I have a same problem. If you found solution, tell me
- azra1l
- Posts: 5
- Joined: 30 Oct 2019, 21:00
- Has thanked: 0 time
- Been thanked: 0 time
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 10 guests