match color identity for random deck in chaos mode

- update colorid selector if chaos mode is chosen
This commit is contained in:
Anthony Calosa
2022-08-10 12:32:15 +08:00
parent 6762756f83
commit e5a2d6a054
2 changed files with 17 additions and 20 deletions

View File

@@ -129,21 +129,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
avatarIndex = avatar;
isFemale = !male;
if (fantasyMode){ //Set a random ColorID in fantasy mode.
switch (MyRandom.getRandom().nextInt(5))
{
case 0:colorIdentity=ColorSet.fromMask(MagicColor.WHITE);
case 1:colorIdentity=ColorSet.fromMask(MagicColor.BLUE);
case 2:colorIdentity=ColorSet.fromMask(MagicColor.BLACK);
case 3:colorIdentity=ColorSet.fromMask(MagicColor.RED);
case 4:colorIdentity=ColorSet.fromMask(MagicColor.GREEN);
case 5:colorIdentity=ColorSet.fromMask(MagicColor.COLORLESS);
}
}
else
{
setColorIdentity(DeckProxy.getColorIdentity(deck));
}
setColorIdentity(DeckProxy.getColorIdentity(deck));
life = maxLife = difficultyData.startingLife;
@@ -156,8 +142,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
if(slot>=0&&slot<NUMBER_OF_DECKS) {
selectedDeckIndex = slot;
deck = decks[selectedDeckIndex];
if (!fantasyMode)
setColorIdentity(DeckProxy.getColorIdentity(deck));
setColorIdentity(DeckProxy.getColorIdentity(deck));
}
}
public void updateDifficulty(DifficultyData diff) {

View File

@@ -2,7 +2,9 @@ package forge.adventure.scene;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import forge.Forge;
@@ -34,6 +36,7 @@ public class NewGameScene extends UIScene {
private Selector gender;
private Selector mode;
private Selector difficulty;
private Array<String> stringList, random;
public NewGameScene() {
super(Forge.isLandscapeMode() ? "ui/new_game.json" : "ui/new_game_portrait.json");
@@ -83,12 +86,21 @@ public class NewGameScene extends UIScene {
colorIds = new ColorSet[colorSet.length];
for(int i = 0; i< colorIds.length; i++)
colorIds[i]= ColorSet.fromNames(colorSet[i].toCharArray());
Array<String> stringList = new Array<>(colorIds.length);
stringList = new Array<>(colorIds.length);
for (String idName : colorIdNames)
stringList.add(UIActor.localize(idName));
colorId.setTextList(stringList);
random = new Array<>();
random.add(Forge.getLocalizer().getMessage("lblRandomDeck"));
mode.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
if (mode.getCurrentIndex() == 2)
colorId.setTextList(random);
else
colorId.setTextList(stringList);
}
});
race = ui.findActor("race");
race.addListener(event -> NewGameScene.this.updateAvatar());
race.setTextList(HeroListData.getRaces());