Correct the update of POIChanges for bought cards from shops

This commit is contained in:
George
2023-01-06 11:33:09 +02:00
parent 359a97462e
commit 0032d35be0
8 changed files with 488 additions and 146 deletions

View File

@@ -84,7 +84,7 @@ public class EnemyEdit extends FormPanel {
currentData.speed= ((Double) speed.getValue()).floatValue();
currentData.spawnRate=((Double) spawnRate.getValue()).floatValue();
currentData.difficulty=((Double) difficulty.getValue()).floatValue();
currentData.deck= deck.getEdit().getText();
currentData.deck= deck.getEdit().getText().split(",");
currentData.rewards= rewards.getRewards();
preview.setSpritePath(currentData.sprite);
}
@@ -113,7 +113,7 @@ public class EnemyEdit extends FormPanel {
equipment.setText(String.join(",",currentData.equipment));
else
equipment.setText("");
deck.getEdit().setText(currentData.deck);
deck.getEdit().setText(String.join(",",currentData.deck));
speed.setValue(new Float(currentData.speed).doubleValue());
spawnRate.setValue(new Float(currentData.spawnRate).doubleValue());
difficulty.setValue(new Float(currentData.difficulty).doubleValue());

View File

@@ -1,6 +1,6 @@
package forge.adventure.data;
import forge.adventure.util.CardUtil;
import forge.adventure.util.*;
import forge.deck.Deck;
/**
@@ -11,7 +11,7 @@ import forge.deck.Deck;
public class EnemyData {
public String name;
public String sprite;
public String deck;
public String[] deck;
public boolean copyPlayerDeck = false;
public String ai;
public boolean boss = false;
@@ -54,6 +54,6 @@ public class EnemyData {
}
public Deck generateDeck(boolean isFantasyMode, boolean useGeneticAI) {
return CardUtil.getDeck(deck, true, isFantasyMode, colors, life > 13, life > 16 && useGeneticAI);
return CardUtil.getDeck(deck[Current.player().getEnemyDeckNumber(this.name, deck.length)], true, isFantasyMode, colors, life > 13, life > 16 && useGeneticAI);
}
}

View File

@@ -691,4 +691,23 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
questFlags.clear();
}
public int getEnemyDeckNumber(String enemyName, int maxDecks){
int deckNumber = 0;
if (statistic.getWinLossRecord().get(enemyName)!=null)
{
int playerWins = statistic.getWinLossRecord().get(enemyName).getKey();
int enemyWins = statistic.getWinLossRecord().get(enemyName).getValue();
if (playerWins > enemyWins){
int deckNumberAfterAlgorithmOutput = (int)((playerWins-enemyWins) * (difficultyData.enemyLifeFactor / 3));
if (deckNumberAfterAlgorithmOutput < maxDecks){
deckNumber = deckNumberAfterAlgorithmOutput;
}
else {
deckNumber = maxDecks-1;
}
}
}
return deckNumber;
}
}

View File

@@ -0,0 +1,9 @@
{
"name":"Red bad",
"template":
{
"count":70,
"colors":["Red"],
"rares":0.3
}
}

View File

@@ -0,0 +1,9 @@
{
"name":"Red bad",
"template":
{
"count":60,
"colors":["Red"],
"rares":0.5
}
}

View File

@@ -0,0 +1,9 @@
{
"name":"Red bad",
"template":
{
"count":60,
"colors":["Red"],
"rares":0.8
}
}

View File

@@ -0,0 +1,9 @@
{
"name":"Red bad",
"template":
{
"count":50,
"colors":["Red"],
"rares":1
}
}

File diff suppressed because it is too large Load Diff