Skip to content

Commit

Permalink
a few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Geronimoo committed Nov 7, 2016
1 parent 0d36c52 commit 9b28272
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/main/java/be/aga/dominionSimulator/DomPlayer.java
Expand Up @@ -989,13 +989,13 @@ public void buy(DomCard aCard) {
}
}
addDebt(aCard.getCost(getCurrentGame()).getDebt());
if (debt > 0) {
payOffDebt();
}

if (getTrashingTokenOn() == aCard.isFromPile())
maybeTrashACardFromHand();
handleSpecialBuyEffects(aCard);
if (debt > 0) {
payOffDebt();
}
if (aCard.hasCardType(DomCardType.Action) && getCurrentGame().getBoard().isLandmarkActive(DomCardName.Colonnade) && !getCardsFromPlay(aCard.getName()).isEmpty()) {
int theVP = getCurrentGame().getBoard().removeVPFrom(DomCardName.Colonnade, 2);
if (theVP > 0) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/be/aga/dominionSimulator/cards/BishopCard.java
Expand Up @@ -43,6 +43,8 @@ private DomCard findCardToTrash() {
theCardToTrash=theProvinces.get(0);
}
}
if (!owner.getCardsFromHand(DomCardName.Market_Square).isEmpty() && !owner.getCardsFromHand(DomCardName.Gold).isEmpty())
theCardToTrash=owner.getCardsFromHand(DomCardName.Gold).get(0);
return theCardToTrash;
}

Expand All @@ -66,7 +68,7 @@ private void handleOpponents() {
@Override
public boolean wantsToBePlayed() {
if (owner.getTotalMoneyInDeck()<7 && owner.countAllCards()<5)
//little fix to prevent NGN - The Golden deck from trashing itself to death
//little fix to prevent The Golden deck from trashing itself to death
return false;
return super.wantsToBePlayed();
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/be/aga/dominionSimulator/cards/NecropolisCard.java
Expand Up @@ -3,6 +3,7 @@
import be.aga.dominionSimulator.DomCard;
import be.aga.dominionSimulator.enums.DomCardName;
import be.aga.dominionSimulator.enums.DomCardType;
import be.aga.dominionSimulator.enums.DomPlayStrategy;

public class NecropolisCard extends DomCard {
public NecropolisCard() {
Expand All @@ -19,4 +20,18 @@ public int getDiscardPriority(int aActionsLeft) {
return 18;
return 14;
}

@Override
public int getTrashPriority() {
if (owner.getPlayStrategyFor(this)==DomPlayStrategy.trashWhenObsolete)
return DomCardName.Copper.getTrashPriority()-1;
return super.getTrashPriority();
}

@Override
public int getPlayPriority() {
if (owner.getPlayStrategyFor(this)==DomPlayStrategy.trashWhenObsolete && !owner.getCardsFromHand(DomCardType.Trasher).isEmpty())
return 50;
return super.getPlayPriority();
}
}
Expand Up @@ -34,7 +34,7 @@ public int getTrashPriority() {
public int getDiscardPriority( int aActionsLeft ) {
if (owner!=null) {
if (owner.getCurrentGame().countInSupply( DomCardName.Curse )==0)
return 0;
return 1;
}
return super.getDiscardPriority( aActionsLeft );
}
Expand Down
Expand Up @@ -85,7 +85,7 @@ private boolean playForTrash() {
}
Collections.sort(cardsInHand,SORT_FOR_TRASHING);
if (owner.getPlayStrategyFor(this)==DomPlayStrategy.modestTrashing) {
if (cardsInHand.get(0).getTrashPriority()<DomCardName.Copper.getTrashPriority() && cardsInHand.get(1).getTrashPriority()<DomCardName.Copper.getTrashPriority()) {
if (cardsInHand.get(0).getTrashPriority()<DomCardName.Copper.getTrashPriority() && cardsInHand.get(1).getTrashPriority()<=DomCardName.Copper.getTrashPriority()) {
owner.trash(owner.removeCardFromHand( cardsInHand.get(0)));
owner.trash(owner.removeCardFromHand( cardsInHand.get(0)));
return true;
Expand Down
Expand Up @@ -45,6 +45,8 @@ public void play() {
private boolean isHandTooStrongToDiscard(DomPlayer aPlayer) {
if (!aPlayer.isGoingToBuyTopCardInBuyRules(aPlayer.getTotalPotentialCurrency()))
return false;
if (aPlayer.getCardsInHand().size()<2)
return false;
Collections.sort(aPlayer.getCardsInHand(),SORT_FOR_DISCARDING);
ArrayList<DomCard> theRemovedCards = new ArrayList<DomCard>();
theRemovedCards.add(aPlayer.getCardsInHand().remove(0));
Expand Down
Expand Up @@ -48,7 +48,7 @@ public void doWhenCalled() {

for (DomCard theCard : owner.getCardsInHand()) {
DomCardName theDesiredCard = owner.getDesiredCard(theCard.getName().getCost(owner.getCurrentGame()).add(new DomCost(1,0 ) ), false);
if (theDesiredCard!=null && theDesiredCard.getTrashPriority(owner)>=theCard.getTrashPriority()) {
if (theDesiredCard!=null && theDesiredCard.getTrashPriority(owner)>theCard.getTrashPriority()) {
owner.trash( owner.removeCardFromHand( theCard ) );
owner.gainInHand(theDesiredCard);
return;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/be/aga/dominionSimulator/enums/DomCardName.java
Expand Up @@ -60,7 +60,7 @@ public enum DomCardName {
Bishop (4, 0, 0, 0, 22, 25, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal, DomCardType.Trasher, DomCardType.TrashForBenefit}),
Black_Market (3, 0, 2, 0, 32, 20, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal}),
Bonfire (3, 0, 0, 0, 0, 0, new DomCardType[]{DomCardType.Event}),
Border_Village (6, 0, 0, 0, 5, 19, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Cycler, DomCardType.Village}),
Border_Village (6, 0, 0, 0, 5, 22, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Cycler, DomCardType.Village}),
Borrow (0, 0, 0, 0, 0, 0, new DomCardType[]{DomCardType.Event}),
Bridge (4, 0, 2, 0, 25, 25, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal}),
Bridge_Troll (5, 0, 1, 0, 25, 25, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal, DomCardType.Attack, DomCardType.Duration}),
Expand Down Expand Up @@ -228,7 +228,7 @@ public enum DomCardName {
Militia (4, 0, 2, 0, 30, 25, new DomCardType[]{DomCardType.Action, DomCardType.Attack, DomCardType.Kingdom, DomCardType.Terminal}),
Mill (4, 0, 0, 1, 5, 16, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Victory, DomCardType.Cycler}),
Mine (5, 0, 0, 0, 24, 22, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal}),
Minion (5, 0, 2, 0, 16, 40, new DomCardType[]{DomCardType.Action, DomCardType.Attack, DomCardType.Kingdom}),
Minion (5, 0, 2, 0, 17, 40, new DomCardType[]{DomCardType.Action, DomCardType.Attack, DomCardType.Kingdom}),
Mining_Village (4, 0, 0, 0, 9, 22, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Village, DomCardType.Cycler}),
Mint (5, 0, 0, 0, 40, 19, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal}),
Miser (4, 0, 0, 0, 23, 21, new DomCardType[]{DomCardType.Action, DomCardType.Kingdom, DomCardType.Terminal}),
Expand Down Expand Up @@ -1286,6 +1286,10 @@ public Object[] getPlayStrategies() {
theStrategies.add(DomPlayStrategy.ApothecaryNativeVillage);
break;

case Necropolis:
theStrategies.add(DomPlayStrategy.trashWhenObsolete);
break;

case Peddler:
theStrategies.add(DomPlayStrategy.combo);
break;
Expand Down

0 comments on commit 9b28272

Please sign in to comment.