mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
consolidating Doubling Season code (part 1/2)
This commit is contained in:
@@ -572,4 +572,11 @@ public class AllZoneUtil {
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
public static int getDoublingSeasonMagnitude(Player player) {
|
||||
int multiplier = 1;
|
||||
int doublingSeasons = getPlayerCardsInPlay(player, "Doubling Season").size();
|
||||
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -327,10 +327,7 @@ public class Card extends MyObservable {
|
||||
}
|
||||
|
||||
public void addCounter(Counters counterName, int n) {
|
||||
int multiplier = 1;
|
||||
int doublingSeasons = AllZoneUtil.getPlayerCardsInPlay(this.getController(), "Doubling Season").size();
|
||||
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
|
||||
|
||||
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(this.getController());
|
||||
if(counters.containsKey(counterName)) {
|
||||
Integer aux = counters.get(counterName) + (multiplier * n);
|
||||
counters.put(counterName, aux);
|
||||
|
||||
@@ -10214,13 +10214,13 @@ public class CardFactory implements NewConstants {
|
||||
}
|
||||
public boolean canPlayAI()
|
||||
{
|
||||
int m = (int)Math.pow(2, AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer, "Doubling Season").size());
|
||||
int m = AllZoneUtil.getDoublingSeasonMagnitude(AllZone.ComputerPlayer);
|
||||
int n = Math.max(1, Math.min((100-getSourceCard().getCounters(Counters.TOWER))/m,
|
||||
ComputerUtil.getAvailableMana().size())) ;
|
||||
setManaCost(n + "");
|
||||
return !(new CardList(AllZone.Computer_Hand.getCards()).containsName("Doubling Season") && n>=5 )
|
||||
&& m*n >= Math.min(20, 100 - getSourceCard().getCounters(Counters.TOWER));
|
||||
//Persuming if AI cast the Pinnacle, it has green mana
|
||||
//Presuming if AI cast the Pinnacle, it has green mana
|
||||
}
|
||||
};
|
||||
ability.setBeforePayMana(new Input()
|
||||
|
||||
@@ -544,15 +544,12 @@ public class CardFactory_Creatures {
|
||||
&& getTargetCard().getController().equals(card.getController())
|
||||
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
|
||||
|
||||
int multiplier = 1;
|
||||
int doublingSeasons = AllZoneUtil.getPlayerCardsInPlay(card.getController(), "Doubling Season").size();
|
||||
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
|
||||
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
||||
Card[] crds = new Card[multiplier];
|
||||
|
||||
for (int i=0;i<multiplier;i++)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Card copy;
|
||||
if(!getTargetCard().isToken()) {
|
||||
//CardFactory cf = new CardFactory("cards.txt");
|
||||
@@ -10070,9 +10067,7 @@ public class CardFactory_Creatures {
|
||||
}
|
||||
});
|
||||
|
||||
int multiplier = 1;
|
||||
int doublingSeasons = AllZoneUtil.getPlayerCardsInPlay(card.getController(), "Doubling Season").size();
|
||||
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
|
||||
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
||||
|
||||
for(int i = 0; i < allTokens.size(); i++) {
|
||||
Card c = allTokens.get(i);
|
||||
|
||||
@@ -4284,11 +4284,8 @@ public class CardFactory_Sorceries {
|
||||
if(AllZone.GameAction.isCardInPlay(getTargetCard())
|
||||
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
CardList DoublingSeasons = new CardList(play.getCards());
|
||||
DoublingSeasons = DoublingSeasons.getName("Doubling Season");
|
||||
PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
|
||||
double Count = DoublingSeasons.size();
|
||||
Count = Math.pow(2,Count);
|
||||
double Count = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
||||
for(int i = 0; i < Count; i++) {
|
||||
if(i + 1== Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
|
||||
Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard());
|
||||
@@ -4354,11 +4351,8 @@ public class CardFactory_Sorceries {
|
||||
if(AllZone.GameAction.isCardInPlay(getTargetCard())
|
||||
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
CardList DoublingSeasons = new CardList(play.getCards());
|
||||
DoublingSeasons = DoublingSeasons.getName("Doubling Season");
|
||||
PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
|
||||
int Count = DoublingSeasons.size();
|
||||
Count = 5 * (int)Math.pow(2,Count);
|
||||
PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
|
||||
int Count = 5 * AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
||||
for(int i = 0; i < Count; i++) {
|
||||
if(i + 1 == Count) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
|
||||
Card Copy = AllZone.CardFactory.copyCardintoNew(getTargetCard());
|
||||
|
||||
Reference in New Issue
Block a user