mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge conflicts
This commit is contained in:
@@ -44,17 +44,29 @@ public class DialogActor extends CharacterSprite {
|
||||
}
|
||||
};
|
||||
dialog.addQuestAcceptedListener(listen);
|
||||
|
||||
ChangeListener finished = new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent changeEvent, Actor actor) {
|
||||
removeFromMap();
|
||||
}
|
||||
};
|
||||
dialog.addDialogCompleteListener(finished);
|
||||
}
|
||||
|
||||
public void acceptQuest(){
|
||||
Current.player().addQuest(questData);
|
||||
}
|
||||
|
||||
public void removeFromMap() { dialog = null; }
|
||||
|
||||
@Override
|
||||
public void onPlayerCollide() {
|
||||
stage.resetPosition();
|
||||
stage.showDialog();
|
||||
dialog.activate();
|
||||
if (dialog != null) {
|
||||
stage.resetPosition();
|
||||
stage.showDialog();
|
||||
dialog.activate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,6 @@ import forge.util.MyRandom;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,7 @@ public class EnemySprite extends CharacterSprite {
|
||||
public float threatRange = 0.0f;
|
||||
public float fleeRange = 0.0f;
|
||||
public boolean ignoreDungeonEffect = false;
|
||||
public UUID questStageID;
|
||||
public String questStageID;
|
||||
|
||||
public EnemySprite(EnemyData enemyData) {
|
||||
this(0,enemyData);
|
||||
|
||||
@@ -175,6 +175,8 @@ public class AdventureQuestData implements Serializable {
|
||||
public void initializeStage(AdventureQuestStage stage){
|
||||
if (stage == null || stage.objective == null) return;
|
||||
|
||||
stage.initialize();
|
||||
|
||||
switch (stage.objective){
|
||||
case Clear:
|
||||
stage.setTargetPOI(poiTokens);
|
||||
@@ -311,7 +313,7 @@ public class AdventureQuestData implements Serializable {
|
||||
EnemyData toUse = generateTargetEnemyData(stage);
|
||||
toUse.lifetime = stage.count1;
|
||||
EnemySprite toReturn = new EnemySprite(toUse);
|
||||
toReturn.questStageID = stage.questStageID;
|
||||
toReturn.questStageID = stage.stageID.toString();
|
||||
return toReturn;
|
||||
}
|
||||
return null;
|
||||
@@ -394,6 +396,34 @@ public class AdventureQuestData implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateArenaComplete(boolean winner){
|
||||
for (AdventureQuestStage stage: stages) {
|
||||
if(failed)
|
||||
break;
|
||||
stage.updateArenaComplete(winner);
|
||||
failed = failed || stage.getStatus() == AdventureQuestController.QuestStatus.Failed;
|
||||
}
|
||||
if (!failed)
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
public void updateStatus(){
|
||||
for (AdventureQuestStage stage: stages) {
|
||||
switch (stage.getStatus()) {
|
||||
case Complete:
|
||||
continue;
|
||||
case Failed:
|
||||
failed = true;
|
||||
break;
|
||||
case None:
|
||||
case Inactive:
|
||||
case Active:
|
||||
return;
|
||||
}
|
||||
}
|
||||
completed = true;
|
||||
}
|
||||
|
||||
public DialogData getPrologue() {
|
||||
if (!prologueDisplayed) {
|
||||
prologueDisplayed = true;
|
||||
|
||||
@@ -11,6 +11,9 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AdventureQuestStage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 12042023L;
|
||||
|
||||
public int id;
|
||||
private AdventureQuestController.QuestStatus status = AdventureQuestController.QuestStatus.Inactive;
|
||||
public String name = "";
|
||||
@@ -45,7 +48,13 @@ public class AdventureQuestStage implements Serializable {
|
||||
public String POIToken; //If defined, ignore tags input and use the target POI from a different stage's objective instead.
|
||||
private transient boolean inTargetLocation = false;
|
||||
|
||||
public UUID questStageID = UUID.randomUUID();
|
||||
public UUID stageID;
|
||||
|
||||
public void initialize(){
|
||||
if (stageID == null){
|
||||
stageID = UUID.randomUUID();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkPrerequisites() {
|
||||
//Todo - implement
|
||||
@@ -287,7 +296,20 @@ public class AdventureQuestStage implements Serializable {
|
||||
return status;
|
||||
}
|
||||
|
||||
public AdventureQuestStage(){}
|
||||
public void updateArenaComplete(boolean winner){
|
||||
if (this.objective == AdventureQuestController.ObjectiveTypes.Arena)
|
||||
{
|
||||
if (inTargetLocation){
|
||||
if (winner){
|
||||
status = AdventureQuestController.QuestStatus.Complete;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AdventureQuestStage(){
|
||||
|
||||
}
|
||||
public AdventureQuestStage(AdventureQuestStage other){
|
||||
this.status = other.status;
|
||||
this.prologueDisplayed = other.prologueDisplayed;
|
||||
@@ -320,6 +342,7 @@ public class AdventureQuestStage implements Serializable {
|
||||
this.POITags = other.POITags;
|
||||
this.targetEnemyData = other.targetEnemyData;
|
||||
this.deliveryItem = other.deliveryItem;
|
||||
this.questStageID = other.questStageID;
|
||||
// if (this.stageID == null)
|
||||
// this.stageID = other.stageID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.*;
|
||||
* Class that represents the player (not the player sprite)
|
||||
*/
|
||||
public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
public static final int NUMBER_OF_DECKS=10;
|
||||
public static final int NUMBER_OF_DECKS = 10;
|
||||
// Player profile data.
|
||||
private String name;
|
||||
private int heroRace;
|
||||
@@ -44,53 +44,57 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
// Game data.
|
||||
private float worldPosX;
|
||||
private float worldPosY;
|
||||
private int gold = 0;
|
||||
private int maxLife= 20;
|
||||
private int life = 20;
|
||||
private int gold = 0;
|
||||
private int maxLife = 20;
|
||||
private int life = 20;
|
||||
private int shards = 0;
|
||||
private EffectData blessing; //Blessing to apply for next battle.
|
||||
private final PlayerStatistic statistic = new PlayerStatistic();
|
||||
private final PlayerStatistic statistic = new PlayerStatistic();
|
||||
private final Map<String, Byte> questFlags = new HashMap<>();
|
||||
|
||||
private final Array<String> inventoryItems=new Array<>();
|
||||
private final HashMap<String,String> equippedItems=new HashMap<>();
|
||||
private List<AdventureQuestData> quests= new ArrayList<>();
|
||||
private final Array<String> inventoryItems = new Array<>();
|
||||
private final HashMap<String, String> equippedItems = new HashMap<>();
|
||||
private final List<AdventureQuestData> quests = new ArrayList<>();
|
||||
|
||||
// Fantasy/Chaos mode settings.
|
||||
private boolean fantasyMode = false;
|
||||
private boolean fantasyMode = false;
|
||||
private boolean announceFantasy = false;
|
||||
private boolean usingCustomDeck = false;
|
||||
private boolean announceCustom = false;
|
||||
|
||||
// Signals
|
||||
final SignalList onLifeTotalChangeList = new SignalList();
|
||||
final SignalList onShardsChangeList = new SignalList();
|
||||
final SignalList onGoldChangeList = new SignalList();
|
||||
final SignalList onPlayerChangeList = new SignalList();
|
||||
final SignalList onEquipmentChange = new SignalList();
|
||||
final SignalList onBlessing = new SignalList();
|
||||
final SignalList onShardsChangeList = new SignalList();
|
||||
final SignalList onGoldChangeList = new SignalList();
|
||||
final SignalList onPlayerChangeList = new SignalList();
|
||||
final SignalList onEquipmentChange = new SignalList();
|
||||
final SignalList onBlessing = new SignalList();
|
||||
|
||||
public AdventurePlayer() { clear(); }
|
||||
public AdventurePlayer() {
|
||||
clear();
|
||||
}
|
||||
|
||||
public PlayerStatistic getStatistic(){ return statistic; }
|
||||
public PlayerStatistic getStatistic() {
|
||||
return statistic;
|
||||
}
|
||||
|
||||
private void clearDecks() {
|
||||
for(int i=0; i < NUMBER_OF_DECKS; i++) decks[i] = new Deck(Forge.getLocalizer().getMessage("lblEmptyDeck"));
|
||||
deck = decks[0];
|
||||
for (int i = 0; i < NUMBER_OF_DECKS; i++) decks[i] = new Deck("Empty Deck");
|
||||
deck = decks[0];
|
||||
selectedDeckIndex = 0;
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
//Ensure sensitive gameplay data is properly reset between games.
|
||||
//Reset all properties HERE.
|
||||
fantasyMode = false;
|
||||
announceFantasy = false;
|
||||
usingCustomDeck = false;
|
||||
blessing = null;
|
||||
gold = 0;
|
||||
maxLife = 20;
|
||||
life = 20;
|
||||
shards = 0;
|
||||
fantasyMode = false;
|
||||
announceFantasy = false;
|
||||
usingCustomDeck = false;
|
||||
blessing = null;
|
||||
gold = 0;
|
||||
maxLife = 20;
|
||||
life = 20;
|
||||
shards = 0;
|
||||
clearDecks();
|
||||
inventoryItems.clear();
|
||||
equippedItems.clear();
|
||||
@@ -106,33 +110,33 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
return WorldSave.getCurrentSave().getPlayer();
|
||||
}
|
||||
|
||||
private final CardPool cards=new CardPool();
|
||||
private final ItemPool<InventoryItem> newCards=new ItemPool<>(InventoryItem.class);
|
||||
private final CardPool cards = new CardPool();
|
||||
private final ItemPool<InventoryItem> newCards = new ItemPool<>(InventoryItem.class);
|
||||
|
||||
public void create(String n, Deck startingDeck, boolean male, int race, int avatar, boolean isFantasy, boolean isUsingCustomDeck, DifficultyData difficultyData) {
|
||||
public void create(String n, Deck startingDeck, boolean male, int race, int avatar, boolean isFantasy, boolean isUsingCustomDeck, DifficultyData difficultyData) {
|
||||
clear();
|
||||
announceFantasy = fantasyMode = isFantasy; //Set Chaos mode first.
|
||||
announceCustom = usingCustomDeck = isUsingCustomDeck;
|
||||
|
||||
deck = startingDeck;
|
||||
deck = startingDeck;
|
||||
decks[0] = deck;
|
||||
|
||||
cards.addAllFlat(deck.getAllCardsInASinglePool().toFlatList());
|
||||
|
||||
this.difficultyData.startingLife = difficultyData.startingLife;
|
||||
this.difficultyData.staringMoney = difficultyData.staringMoney;
|
||||
this.difficultyData.startingLife = difficultyData.startingLife;
|
||||
this.difficultyData.staringMoney = difficultyData.staringMoney;
|
||||
this.difficultyData.startingDifficulty = difficultyData.startingDifficulty;
|
||||
this.difficultyData.name = difficultyData.name;
|
||||
this.difficultyData.spawnRank = difficultyData.spawnRank;
|
||||
this.difficultyData.enemyLifeFactor = difficultyData.enemyLifeFactor;
|
||||
this.difficultyData.sellFactor = difficultyData.sellFactor;
|
||||
this.difficultyData.shardSellRatio = difficultyData.shardSellRatio;
|
||||
this.difficultyData.name = difficultyData.name;
|
||||
this.difficultyData.spawnRank = difficultyData.spawnRank;
|
||||
this.difficultyData.enemyLifeFactor = difficultyData.enemyLifeFactor;
|
||||
this.difficultyData.sellFactor = difficultyData.sellFactor;
|
||||
this.difficultyData.shardSellRatio = difficultyData.shardSellRatio;
|
||||
|
||||
gold = difficultyData.staringMoney;
|
||||
name = n;
|
||||
heroRace = race;
|
||||
gold = difficultyData.staringMoney;
|
||||
name = n;
|
||||
heroRace = race;
|
||||
avatarIndex = avatar;
|
||||
isFemale = !male;
|
||||
isFemale = !male;
|
||||
|
||||
setColorIdentity(DeckProxy.getColorIdentity(deck));
|
||||
|
||||
@@ -146,12 +150,13 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
public void setSelectedDeckSlot(int slot) {
|
||||
if(slot>=0&&slot<NUMBER_OF_DECKS) {
|
||||
if (slot >= 0 && slot < NUMBER_OF_DECKS) {
|
||||
selectedDeckIndex = slot;
|
||||
deck = decks[selectedDeckIndex];
|
||||
setColorIdentity(DeckProxy.getColorIdentity(deck));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDifficulty(DifficultyData diff) {
|
||||
maxLife = diff.startingLife;
|
||||
this.difficultyData.startingShards = diff.startingShards;
|
||||
@@ -167,28 +172,71 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
//Getters
|
||||
public int getSelectedDeckIndex() { return selectedDeckIndex; }
|
||||
public Deck getSelectedDeck() { return deck; }
|
||||
public Array<String> getItems() { return inventoryItems; }
|
||||
public Deck getDeck(int index) { return decks[index]; }
|
||||
public CardPool getCards() { return cards; }
|
||||
public String getName() { return name; }
|
||||
public float getWorldPosX() { return worldPosX; }
|
||||
public float getWorldPosY() { return worldPosY; }
|
||||
public int getGold() { return gold; }
|
||||
public int getLife() { return life; }
|
||||
public int getMaxLife() { return maxLife; }
|
||||
public int getShards() { return shards; }
|
||||
public @Null EffectData getBlessing() { return blessing; }
|
||||
public int getSelectedDeckIndex() {
|
||||
return selectedDeckIndex;
|
||||
}
|
||||
|
||||
public Collection<String> getEquippedItems() { return equippedItems.values(); }
|
||||
public ItemPool<InventoryItem> getNewCards() { return newCards; }
|
||||
public Deck getSelectedDeck() {
|
||||
return deck;
|
||||
}
|
||||
|
||||
public ColorSet getColorIdentity(){
|
||||
public Array<String> getItems() {
|
||||
return inventoryItems;
|
||||
}
|
||||
|
||||
public Deck getDeck(int index) {
|
||||
return decks[index];
|
||||
}
|
||||
|
||||
public CardPool getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public float getWorldPosX() {
|
||||
return worldPosX;
|
||||
}
|
||||
|
||||
public float getWorldPosY() {
|
||||
return worldPosY;
|
||||
}
|
||||
|
||||
public int getGold() {
|
||||
return gold;
|
||||
}
|
||||
|
||||
public int getLife() {
|
||||
return life;
|
||||
}
|
||||
|
||||
public int getMaxLife() {
|
||||
return maxLife;
|
||||
}
|
||||
|
||||
public int getShards() {
|
||||
return shards;
|
||||
}
|
||||
|
||||
public @Null EffectData getBlessing() {
|
||||
return blessing;
|
||||
}
|
||||
|
||||
public Collection<String> getEquippedItems() {
|
||||
return equippedItems.values();
|
||||
}
|
||||
|
||||
public ItemPool<InventoryItem> getNewCards() {
|
||||
return newCards;
|
||||
}
|
||||
|
||||
public ColorSet getColorIdentity() {
|
||||
return colorIdentity;
|
||||
}
|
||||
|
||||
public String getColorIdentityLong(){
|
||||
public String getColorIdentityLong() {
|
||||
return colorIdentity.toString();
|
||||
}
|
||||
|
||||
@@ -197,62 +245,61 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
public void setWorldPosX(float worldPosX) {
|
||||
this.worldPosX = worldPosX;
|
||||
}
|
||||
|
||||
public void setWorldPosY(float worldPosY) {
|
||||
this.worldPosY = worldPosY;
|
||||
}
|
||||
|
||||
public void setColorIdentity(String C){
|
||||
colorIdentity= ColorSet.fromNames(C.toCharArray());
|
||||
public void setColorIdentity(String C) {
|
||||
colorIdentity = ColorSet.fromNames(C.toCharArray());
|
||||
}
|
||||
|
||||
public void setColorIdentity(ColorSet set){
|
||||
public void setColorIdentity(ColorSet set) {
|
||||
this.colorIdentity = set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void load(SaveFileData data) {
|
||||
clear(); //Reset player data.
|
||||
this.statistic.load(data.readSubData("statistic"));
|
||||
this.difficultyData.startingLife=data.readInt("startingLife");
|
||||
this.difficultyData.staringMoney=data.readInt("staringMoney");
|
||||
this.difficultyData.startingDifficulty=data.readBool("startingDifficulty");
|
||||
this.difficultyData.name=data.readString("difficultyName");
|
||||
this.difficultyData.enemyLifeFactor=data.readFloat("enemyLifeFactor");
|
||||
this.difficultyData.sellFactor=data.readFloat("sellFactor");
|
||||
if(this.difficultyData.sellFactor==0)
|
||||
this.difficultyData.sellFactor=0.2f;
|
||||
this.difficultyData.startingLife = data.readInt("startingLife");
|
||||
this.difficultyData.staringMoney = data.readInt("staringMoney");
|
||||
this.difficultyData.startingDifficulty = data.readBool("startingDifficulty");
|
||||
this.difficultyData.name = data.readString("difficultyName");
|
||||
this.difficultyData.enemyLifeFactor = data.readFloat("enemyLifeFactor");
|
||||
this.difficultyData.sellFactor = data.readFloat("sellFactor");
|
||||
if (this.difficultyData.sellFactor == 0)
|
||||
this.difficultyData.sellFactor = 0.2f;
|
||||
|
||||
this.difficultyData.shardSellRatio=data.readFloat("sellFactor");
|
||||
if(this.difficultyData.shardSellRatio==0)
|
||||
this.difficultyData.shardSellRatio=0.8f;
|
||||
this.difficultyData.shardSellRatio = data.readFloat("sellFactor");
|
||||
if (this.difficultyData.shardSellRatio == 0)
|
||||
this.difficultyData.shardSellRatio = 0.8f;
|
||||
|
||||
name = data.readString("name");
|
||||
heroRace = data.readInt("heroRace");
|
||||
name = data.readString("name");
|
||||
heroRace = data.readInt("heroRace");
|
||||
avatarIndex = data.readInt("avatarIndex");
|
||||
isFemale = data.readBool("isFemale");
|
||||
if(data.containsKey("colorIdentity"))
|
||||
isFemale = data.readBool("isFemale");
|
||||
if (data.containsKey("colorIdentity"))
|
||||
setColorIdentity(data.readString("colorIdentity"));
|
||||
else
|
||||
colorIdentity = ColorSet.ALL_COLORS;
|
||||
|
||||
gold = data.readInt("gold");
|
||||
maxLife = data.readInt("maxLife");
|
||||
life = data.readInt("life");
|
||||
shards = data.containsKey("shards")?data.readInt("shards"):0;
|
||||
worldPosX = data.readFloat("worldPosX");
|
||||
worldPosY = data.readFloat("worldPosY");
|
||||
gold = data.readInt("gold");
|
||||
maxLife = data.readInt("maxLife");
|
||||
life = data.readInt("life");
|
||||
shards = data.containsKey("shards") ? data.readInt("shards") : 0;
|
||||
worldPosX = data.readFloat("worldPosX");
|
||||
worldPosY = data.readFloat("worldPosY");
|
||||
|
||||
if(data.containsKey("blessing")) blessing = (EffectData)data.readObject("blessing");
|
||||
if (data.containsKey("blessing")) blessing = (EffectData) data.readObject("blessing");
|
||||
|
||||
if(data.containsKey("inventory")) {
|
||||
String[] inv=(String[])data.readObject("inventory");
|
||||
if (data.containsKey("inventory")) {
|
||||
String[] inv = (String[]) data.readObject("inventory");
|
||||
//Prevent items with wrong names from getting through. Hell breaks loose if it causes null pointers.
|
||||
//This only needs to be done on load.
|
||||
for(String i : inv){
|
||||
if(ItemData.getItem(i) != null) inventoryItems.add(i);
|
||||
for (String i : inv) {
|
||||
if (ItemData.getItem(i) != null) inventoryItems.add(i);
|
||||
else {
|
||||
System.err.printf("Cannot find item name %s\n", i);
|
||||
//Allow official© permission for the player to get a refund. We will allow it this time.
|
||||
@@ -261,15 +308,15 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.containsKey("equippedSlots") && data.containsKey("equippedItems")) {
|
||||
String[] slots=(String[])data.readObject("equippedSlots");
|
||||
String[] items=(String[])data.readObject("equippedItems");
|
||||
if (data.containsKey("equippedSlots") && data.containsKey("equippedItems")) {
|
||||
String[] slots = (String[]) data.readObject("equippedSlots");
|
||||
String[] items = (String[]) data.readObject("equippedItems");
|
||||
|
||||
assert(slots.length==items.length);
|
||||
assert (slots.length == items.length);
|
||||
//Like above, prevent items with wrong names. If it triggered in inventory it'll trigger here as well.
|
||||
for(int i=0;i<slots.length;i++) {
|
||||
if(ItemData.getItem(items[i]) != null)
|
||||
equippedItems.put(slots[i],items[i]);
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
if (ItemData.getItem(items[i]) != null)
|
||||
equippedItems.put(slots[i], items[i]);
|
||||
else {
|
||||
System.err.printf("Cannot find equip name %s\n", items[i]);
|
||||
}
|
||||
@@ -277,19 +324,19 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
deck = new Deck(data.readString("deckName"));
|
||||
deck.getMain().addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("deckCards"))));
|
||||
if(data.containsKey("sideBoardCards"))
|
||||
deck.getOrCreate(DeckSection.Sideboard).addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("sideBoardCards"))));
|
||||
deck.getMain().addAll(CardPool.fromCardList(Lists.newArrayList((String[]) data.readObject("deckCards"))));
|
||||
if (data.containsKey("sideBoardCards"))
|
||||
deck.getOrCreate(DeckSection.Sideboard).addAll(CardPool.fromCardList(Lists.newArrayList((String[]) data.readObject("sideBoardCards"))));
|
||||
|
||||
if(data.containsKey("questFlagsKey") && data.containsKey("questFlagsValue")){
|
||||
if (data.containsKey("questFlagsKey") && data.containsKey("questFlagsValue")) {
|
||||
String[] keys = (String[]) data.readObject("questFlagsKey");
|
||||
Byte[] values = (Byte[]) data.readObject("questFlagsValue");
|
||||
assert( keys.length == values.length );
|
||||
for( int i = 0; i < keys.length; i++){
|
||||
assert (keys.length == values.length);
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
questFlags.put(keys[i], values[i]);
|
||||
}
|
||||
}
|
||||
if(data.containsKey("quests")){
|
||||
if (data.containsKey("quests")) {
|
||||
quests.clear();
|
||||
Object[] q = (Object[]) data.readObject("quests");
|
||||
if (q != null) {
|
||||
@@ -298,24 +345,24 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<NUMBER_OF_DECKS;i++) {
|
||||
if(!data.containsKey("deck_name_" + i)) {
|
||||
if(i==0) decks[i] = deck;
|
||||
else decks[i] = new Deck(Forge.getLocalizer().getMessage("lblEmptyDeck"));
|
||||
for (int i = 0; i < NUMBER_OF_DECKS; i++) {
|
||||
if (!data.containsKey("deck_name_" + i)) {
|
||||
if (i == 0) decks[i] = deck;
|
||||
else decks[i] = new Deck("Empty Deck");
|
||||
continue;
|
||||
}
|
||||
decks[i] = new Deck(data.readString("deck_name_"+i));
|
||||
decks[i].getMain().addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("deck_"+i))));
|
||||
if(data.containsKey("sideBoardCards_"+i))
|
||||
decks[i].getOrCreate(DeckSection.Sideboard).addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("sideBoardCards_"+i))));
|
||||
decks[i] = new Deck(data.readString("deck_name_" + i));
|
||||
decks[i].getMain().addAll(CardPool.fromCardList(Lists.newArrayList((String[]) data.readObject("deck_" + i))));
|
||||
if (data.containsKey("sideBoardCards_" + i))
|
||||
decks[i].getOrCreate(DeckSection.Sideboard).addAll(CardPool.fromCardList(Lists.newArrayList((String[]) data.readObject("sideBoardCards_" + i))));
|
||||
}
|
||||
setSelectedDeckSlot(data.readInt("selectedDeckIndex"));
|
||||
cards.addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("cards"))));
|
||||
cards.addAll(CardPool.fromCardList(Lists.newArrayList((String[]) data.readObject("cards"))));
|
||||
|
||||
fantasyMode = data.containsKey("fantasyMode") ? data.readBool("fantasyMode") : false;
|
||||
announceFantasy = data.containsKey("announceFantasy") ? data.readBool("announceFantasy") : false;
|
||||
usingCustomDeck = data.containsKey("usingCustomDeck") ? data.readBool("usingCustomDeck") : false;
|
||||
announceCustom = data.containsKey("announceCustom") ? data.readBool("announceCustom") : false;
|
||||
fantasyMode = data.containsKey("fantasyMode") && data.readBool("fantasyMode");
|
||||
announceFantasy = data.containsKey("announceFantasy") && data.readBool("announceFantasy");
|
||||
usingCustomDeck = data.containsKey("usingCustomDeck") && data.readBool("usingCustomDeck");
|
||||
announceCustom = data.containsKey("announceCustom") && data.readBool("announceCustom");
|
||||
|
||||
onLifeTotalChangeList.emit();
|
||||
onShardsChangeList.emit();
|
||||
@@ -325,53 +372,53 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data= new SaveFileData();
|
||||
SaveFileData data = new SaveFileData();
|
||||
|
||||
data.store("statistic",this.statistic.save());
|
||||
data.store("startingLife",this.difficultyData.startingLife);
|
||||
data.store("staringMoney",this.difficultyData.staringMoney);
|
||||
data.store("startingDifficulty",this.difficultyData.startingDifficulty);
|
||||
data.store("difficultyName",this.difficultyData.name);
|
||||
data.store("enemyLifeFactor",this.difficultyData.enemyLifeFactor);
|
||||
data.store("sellFactor",this.difficultyData.sellFactor);
|
||||
data.store("statistic", this.statistic.save());
|
||||
data.store("startingLife", this.difficultyData.startingLife);
|
||||
data.store("staringMoney", this.difficultyData.staringMoney);
|
||||
data.store("startingDifficulty", this.difficultyData.startingDifficulty);
|
||||
data.store("difficultyName", this.difficultyData.name);
|
||||
data.store("enemyLifeFactor", this.difficultyData.enemyLifeFactor);
|
||||
data.store("sellFactor", this.difficultyData.sellFactor);
|
||||
data.store("shardSellRatio", this.difficultyData.shardSellRatio);
|
||||
|
||||
data.store("name",name);
|
||||
data.store("heroRace",heroRace);
|
||||
data.store("avatarIndex",avatarIndex);
|
||||
data.store("isFemale",isFemale);
|
||||
data.store("name", name);
|
||||
data.store("heroRace", heroRace);
|
||||
data.store("avatarIndex", avatarIndex);
|
||||
data.store("isFemale", isFemale);
|
||||
data.store("colorIdentity", colorIdentity.getColor());
|
||||
|
||||
data.store("fantasyMode",fantasyMode);
|
||||
data.store("announceFantasy",announceFantasy);
|
||||
data.store("fantasyMode", fantasyMode);
|
||||
data.store("announceFantasy", announceFantasy);
|
||||
data.store("usingCustomDeck", usingCustomDeck);
|
||||
data.store("announceCustom", announceCustom);
|
||||
|
||||
data.store("worldPosX",worldPosX);
|
||||
data.store("worldPosY",worldPosY);
|
||||
data.store("gold",gold);
|
||||
data.store("life",life);
|
||||
data.store("maxLife",maxLife);
|
||||
data.store("shards",shards);
|
||||
data.store("deckName",deck.getName());
|
||||
data.store("worldPosX", worldPosX);
|
||||
data.store("worldPosY", worldPosY);
|
||||
data.store("gold", gold);
|
||||
data.store("life", life);
|
||||
data.store("maxLife", maxLife);
|
||||
data.store("shards", shards);
|
||||
data.store("deckName", deck.getName());
|
||||
|
||||
data.storeObject("inventory",inventoryItems.toArray(String.class));
|
||||
data.storeObject("inventory", inventoryItems.toArray(String.class));
|
||||
|
||||
ArrayList<String> slots=new ArrayList<>();
|
||||
ArrayList<String> items=new ArrayList<>();
|
||||
for (Map.Entry<String,String> entry : equippedItems.entrySet()) {
|
||||
ArrayList<String> slots = new ArrayList<>();
|
||||
ArrayList<String> items = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : equippedItems.entrySet()) {
|
||||
slots.add(entry.getKey());
|
||||
items.add(entry.getValue());
|
||||
}
|
||||
data.storeObject("equippedSlots",slots.toArray(new String[0]));
|
||||
data.storeObject("equippedItems",items.toArray(new String[0]));
|
||||
data.storeObject("equippedSlots", slots.toArray(new String[0]));
|
||||
data.storeObject("equippedItems", items.toArray(new String[0]));
|
||||
|
||||
data.storeObject("blessing", blessing);
|
||||
|
||||
//Save quest flags.
|
||||
ArrayList<String> questFlagsKey = new ArrayList<>();
|
||||
ArrayList<Byte> questFlagsValue = new ArrayList<>();
|
||||
for(Map.Entry<String, Byte> entry : questFlags.entrySet()){
|
||||
ArrayList<Byte> questFlagsValue = new ArrayList<>();
|
||||
for (Map.Entry<String, Byte> entry : questFlags.entrySet()) {
|
||||
questFlagsKey.add(entry.getKey());
|
||||
questFlagsValue.add(entry.getValue());
|
||||
}
|
||||
@@ -379,17 +426,17 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
data.storeObject("questFlagsValue", questFlagsValue.toArray(new Byte[0]));
|
||||
data.storeObject("quests", quests.toArray());
|
||||
|
||||
data.storeObject("deckCards",deck.getMain().toCardList("\n").split("\n"));
|
||||
if(deck.get(DeckSection.Sideboard)!=null)
|
||||
data.storeObject("sideBoardCards",deck.get(DeckSection.Sideboard).toCardList("\n").split("\n"));
|
||||
for(int i=0;i<NUMBER_OF_DECKS;i++) {
|
||||
data.store("deck_name_"+i,decks[i].getName());
|
||||
data.storeObject("deck_"+i,decks[i].getMain().toCardList("\n").split("\n"));
|
||||
if(decks[i].get(DeckSection.Sideboard)!=null)
|
||||
data.storeObject("sideBoardCards_"+i,decks[i].get(DeckSection.Sideboard).toCardList("\n").split("\n"));
|
||||
data.storeObject("deckCards", deck.getMain().toCardList("\n").split("\n"));
|
||||
if (deck.get(DeckSection.Sideboard) != null)
|
||||
data.storeObject("sideBoardCards", deck.get(DeckSection.Sideboard).toCardList("\n").split("\n"));
|
||||
for (int i = 0; i < NUMBER_OF_DECKS; i++) {
|
||||
data.store("deck_name_" + i, decks[i].getName());
|
||||
data.storeObject("deck_" + i, decks[i].getMain().toCardList("\n").split("\n"));
|
||||
if (decks[i].get(DeckSection.Sideboard) != null)
|
||||
data.storeObject("sideBoardCards_" + i, decks[i].get(DeckSection.Sideboard).toCardList("\n").split("\n"));
|
||||
}
|
||||
data.store("selectedDeckIndex",selectedDeckIndex);
|
||||
data.storeObject("cards",cards.toCardList("\n").split("\n"));
|
||||
data.store("selectedDeckIndex", selectedDeckIndex);
|
||||
data.storeObject("cards", cards.toCardList("\n").split("\n"));
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -421,7 +468,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
addGold(reward.getCount());
|
||||
break;
|
||||
case Item:
|
||||
if(reward.getItem()!=null)
|
||||
if (reward.getItem() != null)
|
||||
inventoryItems.add(reward.getItem().name);
|
||||
break;
|
||||
case Life:
|
||||
@@ -434,29 +481,31 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
private void addGold(int goldCount) {
|
||||
gold+=goldCount;
|
||||
gold += goldCount;
|
||||
onGoldChangeList.emit();
|
||||
}
|
||||
public void onShardsChange(Runnable o) {
|
||||
|
||||
public void onShardsChange(Runnable o) {
|
||||
onShardsChangeList.add(o);
|
||||
o.run();
|
||||
}
|
||||
|
||||
public void onLifeChange(Runnable o) {
|
||||
public void onLifeChange(Runnable o) {
|
||||
onLifeTotalChangeList.add(o);
|
||||
o.run();
|
||||
}
|
||||
public void onPlayerChanged(Runnable o) {
|
||||
|
||||
public void onPlayerChanged(Runnable o) {
|
||||
onPlayerChangeList.add(o);
|
||||
o.run();
|
||||
}
|
||||
|
||||
public void onEquipmentChanged(Runnable o) {
|
||||
public void onEquipmentChanged(Runnable o) {
|
||||
onEquipmentChange.add(o);
|
||||
o.run();
|
||||
}
|
||||
|
||||
public void onGoldChange(Runnable o) {
|
||||
public void onGoldChange(Runnable o) {
|
||||
onGoldChangeList.add(o);
|
||||
o.run();
|
||||
}
|
||||
@@ -490,46 +539,55 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
public int falseLifeCost() {
|
||||
int ret = 200 + (int)(50 * getStatistic().winLossRatio());
|
||||
return ret < 0?250:ret;
|
||||
int ret = 200 + (int) (50 * getStatistic().winLossRatio());
|
||||
return ret < 0 ? 250 : ret;
|
||||
}
|
||||
|
||||
public void heal(int amount) {
|
||||
life = Math.min(life + amount, maxLife);
|
||||
onLifeTotalChangeList.emit();
|
||||
}
|
||||
|
||||
public void heal(float percent) {
|
||||
life = Math.min(life + (int)(maxLife*percent), maxLife);
|
||||
life = Math.min(life + (int) (maxLife * percent), maxLife);
|
||||
onLifeTotalChangeList.emit();
|
||||
}
|
||||
|
||||
public boolean defeated() {
|
||||
gold= (int) (gold-(gold*difficultyData.goldLoss));
|
||||
int newLife=(int)(life-(maxLife*difficultyData.lifeLoss));
|
||||
life=Math.max(1,newLife);
|
||||
gold = (int) (gold - (gold * difficultyData.goldLoss));
|
||||
int newLife = (int) (life - (maxLife * difficultyData.lifeLoss));
|
||||
life = Math.max(1, newLife);
|
||||
onLifeTotalChangeList.emit();
|
||||
onGoldChangeList.emit();
|
||||
return newLife < 1;
|
||||
//If true, the player would have had 0 or less, and thus is actually "defeated" if the caller cares about it
|
||||
}
|
||||
|
||||
public void win() {
|
||||
Current.player().addShards(1);
|
||||
}
|
||||
|
||||
public void addMaxLife(int count) {
|
||||
maxLife += count;
|
||||
life += count;
|
||||
life += count;
|
||||
onLifeTotalChangeList.emit();
|
||||
}
|
||||
|
||||
public void giveGold(int price) {
|
||||
takeGold(-price);
|
||||
}
|
||||
|
||||
public void takeGold(int price) {
|
||||
gold -= price;
|
||||
onGoldChangeList.emit();
|
||||
//play sfx
|
||||
SoundSystem.instance.play(SoundEffectType.CoinsDrop, false);
|
||||
}
|
||||
|
||||
public void addShards(int number) {
|
||||
takeShards(-number);
|
||||
}
|
||||
|
||||
public void takeShards(int number) {
|
||||
shards -= number;
|
||||
onShardsChangeList.emit();
|
||||
@@ -542,7 +600,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
onShardsChangeList.emit();
|
||||
}
|
||||
|
||||
public void addBlessing(EffectData bless){
|
||||
public void addBlessing(EffectData bless) {
|
||||
blessing = bless;
|
||||
onBlessing.emit();
|
||||
}
|
||||
@@ -552,53 +610,76 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
onBlessing.emit();
|
||||
}
|
||||
|
||||
public boolean hasBlessing(String name){ //Checks for a named blessing.
|
||||
public boolean hasBlessing(String name) { //Checks for a named blessing.
|
||||
//It is not necessary to name all blessings, only the ones you'd want to check for.
|
||||
if(blessing == null) return false;
|
||||
if(blessing.name.equals(name)) return true;
|
||||
return false;
|
||||
if (blessing == null) return false;
|
||||
return blessing.name.equals(name);
|
||||
}
|
||||
|
||||
public boolean isFantasyMode(){
|
||||
public boolean isFantasyMode() {
|
||||
return fantasyMode;
|
||||
}
|
||||
public boolean isUsingCustomDeck(){
|
||||
|
||||
public boolean isUsingCustomDeck() {
|
||||
return usingCustomDeck;
|
||||
}
|
||||
|
||||
public boolean hasAnnounceFantasy(){
|
||||
public boolean hasAnnounceFantasy() {
|
||||
return announceFantasy;
|
||||
}
|
||||
|
||||
public void clearAnnounceFantasy(){
|
||||
public void clearAnnounceFantasy() {
|
||||
announceFantasy = false;
|
||||
}
|
||||
public boolean hasAnnounceCustom(){
|
||||
|
||||
public boolean hasAnnounceCustom() {
|
||||
return announceCustom;
|
||||
}
|
||||
public void clearAnnounceCustom(){
|
||||
|
||||
public void clearAnnounceCustom() {
|
||||
announceCustom = false;
|
||||
}
|
||||
|
||||
public boolean hasColorView() {
|
||||
for(String name:equippedItems.values()) {
|
||||
ItemData data=ItemData.getItem(name);
|
||||
if(data != null && data.effect.colorView) return true;
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && data.effect != null && data.effect.colorView) return true;
|
||||
}
|
||||
if(blessing != null) {
|
||||
if(blessing.colorView) return true;
|
||||
if (blessing != null) {
|
||||
return blessing.colorView;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemData getEquippedAbility1() {
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && "Ability1".equalsIgnoreCase(data.equipmentSlot)) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemData getEquippedAbility2() {
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && "Ability2".equalsIgnoreCase(data.equipmentSlot)) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int bonusDeckCards() {
|
||||
int result = 0;
|
||||
for(String name:equippedItems.values()) {
|
||||
ItemData data=ItemData.getItem(name);
|
||||
if(data != null && data.effect.cardRewardBonus > 0) result += data.effect.cardRewardBonus;
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && data.effect != null && data.effect.cardRewardBonus > 0)
|
||||
result += data.effect.cardRewardBonus;
|
||||
}
|
||||
if(blessing != null) {
|
||||
if(blessing.cardRewardBonus > 0) result += blessing.cardRewardBonus;
|
||||
if (blessing != null) {
|
||||
if (blessing.cardRewardBonus > 0) result += blessing.cardRewardBonus;
|
||||
}
|
||||
return Math.min(result, 3);
|
||||
}
|
||||
@@ -607,50 +688,52 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
return difficultyData;
|
||||
}
|
||||
|
||||
public void renameDeck( String text) {
|
||||
deck = (Deck)deck.copyTo(text);
|
||||
decks[selectedDeckIndex]=deck;
|
||||
public void renameDeck(String text) {
|
||||
deck = (Deck) deck.copyTo(text);
|
||||
decks[selectedDeckIndex] = deck;
|
||||
}
|
||||
|
||||
public int cardSellPrice(PaperCard card) {
|
||||
return (int)(CardUtil.getCardPrice(card)*difficultyData.sellFactor);
|
||||
return (int) (CardUtil.getCardPrice(card) * difficultyData.sellFactor);
|
||||
}
|
||||
|
||||
public void sellCard(PaperCard card, Integer result) {
|
||||
float price = CardUtil.getCardPrice(card) * result;
|
||||
price *= difficultyData.sellFactor;
|
||||
cards.remove(card, result);
|
||||
addGold((int)price);
|
||||
addGold((int) price);
|
||||
}
|
||||
|
||||
public void removeItem(String name) {
|
||||
if(name == null || name.equals("")) return;
|
||||
inventoryItems.removeValue(name,false);
|
||||
if(equippedItems.values().contains(name) && !inventoryItems.contains(name,false)) {
|
||||
if (name == null || name.equals("")) return;
|
||||
inventoryItems.removeValue(name, false);
|
||||
if (equippedItems.values().contains(name) && !inventoryItems.contains(name, false)) {
|
||||
equippedItems.values().remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void equip(ItemData item) {
|
||||
if(equippedItems.get(item.equipmentSlot) != null && equippedItems.get(item.equipmentSlot).equals(item.name)) {
|
||||
if (equippedItems.get(item.equipmentSlot) != null && equippedItems.get(item.equipmentSlot).equals(item.name)) {
|
||||
equippedItems.remove(item.equipmentSlot);
|
||||
} else {
|
||||
equippedItems.put(item.equipmentSlot,item.name);
|
||||
equippedItems.put(item.equipmentSlot, item.name);
|
||||
}
|
||||
onEquipmentChange.emit();
|
||||
}
|
||||
|
||||
public String itemInSlot(String key) { return equippedItems.get(key); }
|
||||
public String itemInSlot(String key) {
|
||||
return equippedItems.get(key);
|
||||
}
|
||||
|
||||
public float equipmentSpeed() {
|
||||
float factor=1.0f;
|
||||
for(String name:equippedItems.values()) {
|
||||
ItemData data=ItemData.getItem(name);
|
||||
if(data != null && data.effect.moveSpeed > 0.0) //Avoid negative speeds. It would be silly.
|
||||
factor*=data.effect.moveSpeed;
|
||||
float factor = 1.0f;
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && data.effect != null && data.effect.moveSpeed > 0.0) //Avoid negative speeds. It would be silly.
|
||||
factor *= data.effect.moveSpeed;
|
||||
}
|
||||
if(blessing != null) { //If a blessing gives speed, take it into account.
|
||||
if(blessing.moveSpeed > 0.0)
|
||||
if (blessing != null) { //If a blessing gives speed, take it into account.
|
||||
if (blessing.moveSpeed > 0.0)
|
||||
factor *= blessing.moveSpeed;
|
||||
}
|
||||
return factor;
|
||||
@@ -658,19 +741,20 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
|
||||
public float goldModifier(boolean sale) {
|
||||
float factor = 1.0f;
|
||||
for(String name:equippedItems.values()) {
|
||||
ItemData data=ItemData.getItem(name);
|
||||
if(data != null && data.effect.goldModifier > 0.0) //Avoid negative modifiers.
|
||||
for (String name : equippedItems.values()) {
|
||||
ItemData data = ItemData.getItem(name);
|
||||
if (data != null && data.effect != null && data.effect.goldModifier > 0.0) //Avoid negative modifiers.
|
||||
factor *= data.effect.goldModifier;
|
||||
}
|
||||
if(blessing != null) { //If a blessing gives speed, take it into account.
|
||||
if(blessing.goldModifier > 0.0)
|
||||
if (blessing != null) { //If a blessing gives speed, take it into account.
|
||||
if (blessing.goldModifier > 0.0)
|
||||
factor *= blessing.goldModifier;
|
||||
}
|
||||
if(sale) return Math.max(1.0f + (1.0f - factor), 2.5f);
|
||||
if (sale) return Math.max(1.0f + (1.0f - factor), 2.5f);
|
||||
return Math.max(factor, 0.25f);
|
||||
}
|
||||
public float goldModifier(){
|
||||
|
||||
public float goldModifier() {
|
||||
return goldModifier(false);
|
||||
}
|
||||
|
||||
@@ -679,8 +763,8 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
public boolean addItem(String name) {
|
||||
ItemData item=ItemData.getItem(name);
|
||||
if(item==null)
|
||||
ItemData item = ItemData.getItem(name);
|
||||
if (item == null)
|
||||
return false;
|
||||
inventoryItems.add(name);
|
||||
return true;
|
||||
@@ -688,45 +772,48 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
|
||||
|
||||
// Quest functions.
|
||||
public void setQuestFlag(String key, int value){
|
||||
public void setQuestFlag(String key, int value) {
|
||||
questFlags.put(key, (byte) value);
|
||||
}
|
||||
public void advanceQuestFlag(String key){
|
||||
if(questFlags.get(key) != null){
|
||||
|
||||
public void advanceQuestFlag(String key) {
|
||||
if (questFlags.get(key) != null) {
|
||||
questFlags.put(key, (byte) (questFlags.get(key) + 1));
|
||||
} else {
|
||||
questFlags.put(key, (byte) 1);
|
||||
}
|
||||
}
|
||||
public boolean checkQuestFlag(String key){
|
||||
|
||||
public boolean checkQuestFlag(String key) {
|
||||
return questFlags.get(key) != null;
|
||||
}
|
||||
public int getQuestFlag(String key){
|
||||
|
||||
public int getQuestFlag(String key) {
|
||||
return (int) questFlags.getOrDefault(key, (byte) 0);
|
||||
}
|
||||
public void resetQuestFlags(){
|
||||
|
||||
public void resetQuestFlags() {
|
||||
questFlags.clear();
|
||||
}
|
||||
|
||||
public void addQuest(String questID){
|
||||
public void addQuest(String questID) {
|
||||
int id = Integer.parseInt(questID);
|
||||
addQuest(id);
|
||||
}
|
||||
|
||||
public void addQuest(int questID){
|
||||
public void addQuest(int questID) {
|
||||
AdventureQuestData toAdd = AdventureQuestController.instance().generateQuest(questID);
|
||||
|
||||
if (toAdd != null){
|
||||
if (toAdd != null) {
|
||||
addQuest(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public void addQuest(AdventureQuestData q){
|
||||
public void addQuest(AdventureQuestData q) {
|
||||
//TODO: add a config flag for this
|
||||
boolean autoTrack = true;
|
||||
for (AdventureQuestData existing : quests){
|
||||
if (autoTrack && existing.isTracked)
|
||||
{
|
||||
for (AdventureQuestData existing : quests) {
|
||||
if (autoTrack && existing.isTracked) {
|
||||
autoTrack = false;
|
||||
break;
|
||||
}
|
||||
@@ -739,23 +826,21 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
return quests;
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
return deckNumber;
|
||||
}
|
||||
|
||||
public void removeQuest(AdventureQuestData quest) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import forge.adventure.data.EnemyData;
|
||||
import forge.adventure.data.WorldData;
|
||||
import forge.adventure.stage.GameHUD;
|
||||
import forge.adventure.stage.IAfterMatch;
|
||||
import forge.adventure.stage.MapStage;
|
||||
import forge.adventure.stage.WorldStage;
|
||||
import forge.adventure.util.*;
|
||||
import forge.gui.FThreads;
|
||||
@@ -116,6 +117,8 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
||||
doneButton.layout();
|
||||
startButton.setDisabled(true);
|
||||
arenaStarted = false;
|
||||
AdventureQuestController.instance().updateArenaComplete(false);
|
||||
AdventureQuestController.instance().showQuestDialogs(MapStage.getInstance());
|
||||
}
|
||||
|
||||
private void startDialog() {
|
||||
@@ -193,6 +196,8 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
||||
startButton.setDisabled(true);
|
||||
doneButton.setText("[%80]" + Forge.getLocalizer().getMessage("lblDone"));
|
||||
doneButton.layout();
|
||||
AdventureQuestController.instance().updateArenaComplete(true);
|
||||
AdventureQuestController.instance().showQuestDialogs(MapStage.getInstance());
|
||||
}
|
||||
if (!Forge.isLandscapeMode())
|
||||
drawArena();//update
|
||||
|
||||
@@ -39,11 +39,11 @@ public class InventoryScene extends UIScene {
|
||||
public InventoryScene() {
|
||||
super(Forge.isLandscapeMode() ? "ui/inventory.json" : "ui/inventory_portrait.json");
|
||||
equipOverlay = Forge.getAssets().getTexture(Config.instance().getFile(Paths.ITEMS_EQUIP));
|
||||
ui.onButtonPress("return", () -> done());
|
||||
ui.onButtonPress("return", this::done);
|
||||
leave = ui.findActor("return");
|
||||
ui.onButtonPress("delete", () -> showConfirm());
|
||||
ui.onButtonPress("equip", () -> equip());
|
||||
ui.onButtonPress("use", () -> use());
|
||||
ui.onButtonPress("delete", this::showConfirm);
|
||||
ui.onButtonPress("equip", this::equip);
|
||||
ui.onButtonPress("use", this::use);
|
||||
equipButton = ui.findActor("equip");
|
||||
useButton = ui.findActor("use");
|
||||
useButton.setDisabled(true);
|
||||
@@ -299,7 +299,6 @@ public class InventoryScene extends UIScene {
|
||||
}
|
||||
|
||||
public Button createInventorySlot() {
|
||||
ImageButton button = new ImageButton(Controls.getSkin(), "item_frame");
|
||||
return button;
|
||||
return new ImageButton(Controls.getSkin(), "item_frame");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
@@ -32,7 +31,7 @@ public class MapViewScene extends UIScene {
|
||||
super(Forge.isLandscapeMode() ? "ui/map.json" : "ui/map_portrait.json");
|
||||
|
||||
|
||||
ui.onButtonPress("done", () -> done());
|
||||
ui.onButtonPress("done", this::done);
|
||||
|
||||
scroll = ui.findActor("map");
|
||||
Group table=new Group();
|
||||
@@ -78,13 +77,4 @@ public class MapViewScene extends UIScene {
|
||||
super.enter();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode) {
|
||||
if (keycode == Input.Keys.ESCAPE || keycode == Input.Keys.BACK || keycode == Input.Keys.BUTTON_B) {
|
||||
done();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ import com.github.tommyettinger.textra.TextraButton;
|
||||
import com.github.tommyettinger.textra.TextraLabel;
|
||||
import com.github.tommyettinger.textra.TypingLabel;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.ItemData;
|
||||
import forge.adventure.player.AdventurePlayer;
|
||||
import forge.adventure.scene.*;
|
||||
import forge.adventure.util.*;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.FThreads;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.model.FModel;
|
||||
@@ -51,16 +51,15 @@ public class GameHUD extends Stage {
|
||||
private final Touchpad touchpad;
|
||||
private final Console console;
|
||||
float TOUCHPAD_SCALE = 70f, referenceX;
|
||||
boolean isHiding = false, isShowing = false;
|
||||
float opacity = 1f;
|
||||
private boolean debugMap, updatelife;
|
||||
|
||||
private final Dialog dialog;
|
||||
private boolean dialogOnlyInput;
|
||||
private final Array<TextraButton> dialogButtonMap = new Array<>();
|
||||
private final Array<TextraButton> abilityButtonMap = new Array<>();
|
||||
private final Array<String> questKeys = new Array<>();
|
||||
private String lifepointsTextColor = "";
|
||||
private TextraButton selectedKey;
|
||||
private final ScrollPane scrollPane;
|
||||
|
||||
private GameHUD(GameStage gameStage) {
|
||||
@@ -80,7 +79,7 @@ public class GameHUD extends Stage {
|
||||
avatarborder = ui.findActor("avatarborder");
|
||||
deckActor = ui.findActor("deck");
|
||||
openMapActor = ui.findActor("openmap");
|
||||
ui.onButtonPress("openmap", () -> GameHUD.this.openMap());
|
||||
ui.onButtonPress("openmap", this::openMap);
|
||||
menuActor = ui.findActor("menu");
|
||||
referenceX = menuActor.getX();
|
||||
logbookActor = ui.findActor("logbook");
|
||||
@@ -113,11 +112,11 @@ public class GameHUD extends Stage {
|
||||
ui.addActor(touchpad);
|
||||
|
||||
avatar = ui.findActor("avatar");
|
||||
ui.onButtonPress("menu", () -> menu());
|
||||
ui.onButtonPress("inventory", () -> openInventory());
|
||||
ui.onButtonPress("logbook", () -> logbook());
|
||||
ui.onButtonPress("deck", () -> openDeck());
|
||||
ui.onButtonPress("exittoworldmap", () -> exitToWorldMap());
|
||||
ui.onButtonPress("menu", this::menu);
|
||||
ui.onButtonPress("inventory", this::openInventory);
|
||||
ui.onButtonPress("logbook", this::logbook);
|
||||
ui.onButtonPress("deck", this::openDeck);
|
||||
ui.onButtonPress("exittoworldmap", this::exitToWorldMap);
|
||||
lifePoints = ui.findActor("lifePoints");
|
||||
shards = ui.findActor("shards");
|
||||
money = ui.findActor("money");
|
||||
@@ -131,6 +130,7 @@ public class GameHUD extends Stage {
|
||||
addActor(scrollPane);
|
||||
AdventurePlayer.current().onLifeChange(() -> lifePoints.setText("[%95][+Life]" + lifepointsTextColor + " " + AdventurePlayer.current().getLife() + "/" + AdventurePlayer.current().getMaxLife()));
|
||||
AdventurePlayer.current().onShardsChange(() -> shards.setText("[%95][+Shards] " + AdventurePlayer.current().getShards()));
|
||||
AdventurePlayer.current().onEquipmentChanged(this::updateAbility);
|
||||
|
||||
WorldSave.getCurrentSave().getPlayer().onGoldChange(() -> money.setText("[%95][+Gold] " + String.valueOf(AdventurePlayer.current().getGold())));
|
||||
addActor(ui);
|
||||
@@ -144,7 +144,7 @@ public class GameHUD extends Stage {
|
||||
avatarborder.addListener(new ConsoleToggleListener());
|
||||
gamehud.addListener(new ConsoleToggleListener());
|
||||
}
|
||||
WorldSave.getCurrentSave().onLoad(() -> GameHUD.this.enter());
|
||||
WorldSave.getCurrentSave().onLoad(this::enter);
|
||||
eventTouchDown = new InputEvent();
|
||||
eventTouchDown.setPointer(-1);
|
||||
eventTouchDown.setType(InputEvent.Type.touchDown);
|
||||
@@ -158,6 +158,8 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
|
||||
private void logbook() {
|
||||
if (console.isVisible())
|
||||
console.toggle();
|
||||
Forge.switchScene(QuestLogScene.instance(Forge.getCurrentScene()));
|
||||
}
|
||||
|
||||
@@ -230,7 +232,6 @@ public class GameHUD extends Stage {
|
||||
touchpad.setBounds(touch.x - TOUCHPAD_SCALE / 2, touch.y - TOUCHPAD_SCALE / 2, TOUCHPAD_SCALE, TOUCHPAD_SCALE);
|
||||
touchpad.setVisible(true);
|
||||
touchpad.setResetOnTouchUp(true);
|
||||
hideButtons();
|
||||
return super.touchDown(screenX, screenY, pointer, button);
|
||||
}
|
||||
}
|
||||
@@ -333,6 +334,41 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
}
|
||||
|
||||
void updateAbility() {
|
||||
for (TextraButton button : abilityButtonMap) {
|
||||
button.remove();
|
||||
}
|
||||
abilityButtonMap.clear();
|
||||
setAbilityButton(AdventurePlayer.current().getEquippedAbility1());
|
||||
setAbilityButton(AdventurePlayer.current().getEquippedAbility2());
|
||||
float x = Forge.isLandscapeMode() ? 426f : 216f;
|
||||
float y = 10f;
|
||||
float w = 45f;
|
||||
float h = 35f;
|
||||
for (TextraButton button : abilityButtonMap) {
|
||||
button.getColor().a = opacity;
|
||||
button.setSize(w, h);
|
||||
button.setPosition(x, y);
|
||||
y += h + 10f;
|
||||
addActor(button);
|
||||
}
|
||||
}
|
||||
|
||||
void setAbilityButton(ItemData data) {
|
||||
if (data != null) {
|
||||
TextraButton button = Controls.newTextButton("[%120][+" + data.iconName + "][+Shards]" + data.shardsNeeded, () -> {
|
||||
boolean isInPoi = MapStage.getInstance().isInMap();
|
||||
if (!(isInPoi && data.usableInPoi || !isInPoi && data.usableOnWorldMap))
|
||||
return;
|
||||
if (data.shardsNeeded > Current.player().getShards())
|
||||
return;
|
||||
Current.player().addShards(-data.shardsNeeded);
|
||||
ConsoleCommandInterpreter.getInstance().command(data.commandOnUse);
|
||||
});
|
||||
abilityButtonMap.add(button);
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<FileHandle, Music> audio = null;
|
||||
|
||||
public void playAudio() {
|
||||
@@ -368,12 +404,12 @@ public class GameHUD extends Stage {
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
if (fade < targetfade) {
|
||||
fade += (delta/2);
|
||||
fade += (delta / 2);
|
||||
if (fade > targetfade)
|
||||
fade = targetfade;
|
||||
fadeAudio(fade);
|
||||
} else if (fade > targetfade) {
|
||||
fade -= (delta/2);
|
||||
fade -= (delta / 2);
|
||||
if (fade < targetfade)
|
||||
fade = targetfade;
|
||||
fadeAudio(fade);
|
||||
@@ -436,15 +472,21 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
|
||||
private void openDeck() {
|
||||
if (console.isVisible())
|
||||
console.toggle();
|
||||
Forge.switchScene(DeckSelectScene.instance());
|
||||
}
|
||||
|
||||
private void openInventory() {
|
||||
if (console.isVisible())
|
||||
console.toggle();
|
||||
WorldSave.getCurrentSave().header.createPreview();
|
||||
Forge.switchScene(InventoryScene.instance());
|
||||
}
|
||||
|
||||
private void exitToWorldMap() {
|
||||
if (console.isVisible())
|
||||
console.toggle();
|
||||
if (!GameScene.instance().isNotInWorldMap()) //prevent showing this dialog to WorldMap
|
||||
return;
|
||||
dialog.getButtonTable().clear();
|
||||
@@ -471,6 +513,8 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
|
||||
private void menu() {
|
||||
if (console.isVisible())
|
||||
console.toggle();
|
||||
gameStage.openMenu();
|
||||
}
|
||||
|
||||
@@ -479,6 +523,11 @@ public class GameHUD extends Stage {
|
||||
actor.setVisible(visible);
|
||||
}
|
||||
|
||||
private void setDisabled(Actor actor, boolean enable) {
|
||||
if (actor != null && actor instanceof Button)
|
||||
((Button) actor).setDisabled(enable);
|
||||
}
|
||||
|
||||
private void setAlpha(Actor actor, boolean visible) {
|
||||
if (actor != null) {
|
||||
if (visible)
|
||||
@@ -498,7 +547,7 @@ public class GameHUD extends Stage {
|
||||
setVisibility(shards, visible);
|
||||
setVisibility(money, visible);
|
||||
setVisibility(blank, visible);
|
||||
setVisibility(exitToWorldMapActor, GameScene.instance().isNotInWorldMap());
|
||||
setDisabled(exitToWorldMapActor, !GameScene.instance().isNotInWorldMap());
|
||||
setAlpha(avatarborder, visible);
|
||||
setAlpha(avatar, visible);
|
||||
setAlpha(deckActor, visible);
|
||||
@@ -506,6 +555,9 @@ public class GameHUD extends Stage {
|
||||
setAlpha(logbookActor, visible);
|
||||
setAlpha(inventoryActor, visible);
|
||||
setAlpha(exitToWorldMapActor, visible);
|
||||
for (TextraButton button : abilityButtonMap) {
|
||||
setAlpha(button, visible);
|
||||
}
|
||||
opacity = visible ? 1f : 0.4f;
|
||||
}
|
||||
|
||||
@@ -528,11 +580,6 @@ public class GameHUD extends Stage {
|
||||
if (keycode == Input.Keys.BACK) {
|
||||
if (console.isVisible()) {
|
||||
console.toggle();
|
||||
} else {
|
||||
if (menuActor.isVisible())
|
||||
hideButtons();
|
||||
else
|
||||
showButtons();
|
||||
}
|
||||
}
|
||||
if (console.isVisible())
|
||||
@@ -571,38 +618,6 @@ public class GameHUD extends Stage {
|
||||
}, 0.10f);
|
||||
}
|
||||
|
||||
private void hideButtons() {
|
||||
if (isShowing)
|
||||
return;
|
||||
if (isHiding)
|
||||
return;
|
||||
isHiding = true;
|
||||
deckActor.addAction(Actions.sequence(Actions.fadeOut(0.10f), Actions.hide(), Actions.moveTo(deckActor.getX() + deckActor.getWidth(), deckActor.getY())));
|
||||
inventoryActor.addAction(Actions.sequence(Actions.fadeOut(0.15f), Actions.hide(), Actions.moveTo(inventoryActor.getX() + inventoryActor.getWidth(), inventoryActor.getY())));
|
||||
logbookActor.addAction(Actions.sequence(Actions.fadeOut(0.20f), Actions.hide(), Actions.moveTo(logbookActor.getX() + logbookActor.getWidth(), logbookActor.getY())));
|
||||
menuActor.addAction(Actions.sequence(Actions.fadeOut(0.25f), Actions.hide(), Actions.moveTo(menuActor.getX() + menuActor.getWidth(), menuActor.getY())));
|
||||
if (GameScene.instance().isNotInWorldMap())
|
||||
exitToWorldMapActor.addAction(Actions.sequence(Actions.fadeOut(0.2f), Actions.hide(), Actions.moveTo(exitToWorldMapActor.getX() + exitToWorldMapActor.getWidth(), exitToWorldMapActor.getY())));
|
||||
FThreads.delayInEDT(300, () -> isHiding = false);
|
||||
}
|
||||
|
||||
private void showButtons() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (isHiding)
|
||||
return;
|
||||
if (isShowing)
|
||||
return;
|
||||
isShowing = true;
|
||||
menuActor.addAction(Actions.sequence(Actions.delay(0.1f), Actions.parallel(Actions.show(), Actions.alpha(opacity, 0.1f), Actions.moveTo(referenceX, menuActor.getY(), 0.25f))));
|
||||
logbookActor.addAction(Actions.sequence(Actions.delay(0.15f), Actions.parallel(Actions.show(), Actions.alpha(opacity, 0.1f), Actions.moveTo(referenceX, logbookActor.getY(), 0.25f))));
|
||||
inventoryActor.addAction(Actions.sequence(Actions.delay(0.2f), Actions.parallel(Actions.show(), Actions.alpha(opacity, 0.1f), Actions.moveTo(referenceX, inventoryActor.getY(), 0.25f))));
|
||||
deckActor.addAction(Actions.sequence(Actions.delay(0.25f), Actions.parallel(Actions.show(), Actions.alpha(opacity, 0.1f), Actions.moveTo(referenceX, deckActor.getY(), 0.25f))));
|
||||
if (GameScene.instance().isNotInWorldMap())
|
||||
exitToWorldMapActor.addAction(Actions.sequence(Actions.delay(0.25f), Actions.parallel(Actions.show(), Actions.alpha(opacity, 0.1f), Actions.moveTo(referenceX, exitToWorldMapActor.getY(), 0.25f))));
|
||||
FThreads.delayInEDT(300, () -> isShowing = false);
|
||||
}
|
||||
|
||||
public void setDebug(boolean b) {
|
||||
debugMap = b;
|
||||
}
|
||||
@@ -626,13 +641,12 @@ public class GameHUD extends Stage {
|
||||
public boolean act(float v) {
|
||||
if (exitDungeon) {
|
||||
MapStage.getInstance().exitDungeon();
|
||||
exitToWorldMapActor.setVisible(false);
|
||||
setDisabled(exitToWorldMapActor, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
dialogOnlyInput = false;
|
||||
selectedKey = null;
|
||||
}
|
||||
|
||||
private void selectNextDialogButton() {
|
||||
@@ -677,18 +691,9 @@ public class GameHUD extends Stage {
|
||||
|
||||
@Override
|
||||
public boolean longPress(Actor actor, float x, float y) {
|
||||
hideButtons();
|
||||
console.toggle();
|
||||
return super.longPress(actor, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tap(InputEvent event, float x, float y, int count, int button) {
|
||||
super.tap(event, x, y, count, button);
|
||||
//show menu buttons if double tapping the avatar, for android devices without visible navigation buttons
|
||||
if (count > 1)
|
||||
showButtons();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateMusic() {
|
||||
|
||||
@@ -361,7 +361,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
|
||||
List<String> names = (List<String>) data.readObject("names");
|
||||
List<Float> x = (List<Float>) data.readObject("x");
|
||||
List<Float> y = (List<Float>) data.readObject("y");
|
||||
List<UUID> questStageIDs = (List<UUID>) data.readObject("questStageIDs");
|
||||
List<String> questStageIDs = (List<String>) data.readObject("questStageIDs");
|
||||
for (int i = 0; i < timeouts.size(); i++) {
|
||||
EnemySprite sprite = new EnemySprite(WorldData.getEnemy(names.get(i)));
|
||||
sprite.setX(x.get(i));
|
||||
@@ -393,7 +393,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
|
||||
List<String> names = new ArrayList<>();
|
||||
List<Float> x = new ArrayList<>();
|
||||
List<Float> y = new ArrayList<>();
|
||||
List<UUID> questStageIDs = new ArrayList<>();
|
||||
List<String> questStageIDs = new ArrayList<>();
|
||||
for (Pair<Float, EnemySprite> enemy : enemies) {
|
||||
timeouts.add(enemy.getKey());
|
||||
names.add(enemy.getValue().getData().name);
|
||||
|
||||
@@ -17,7 +17,6 @@ import forge.util.Aggregates;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class AdventureQuestController implements Serializable {
|
||||
|
||||
@@ -84,9 +83,9 @@ public class AdventureQuestController implements Serializable {
|
||||
questStage.epilogueDisplayed = true;
|
||||
dialogQueue.add(questStage.epilogue);
|
||||
}
|
||||
// if (questStage.getStatus() != QuestStatus.Complete){
|
||||
// break;
|
||||
// }
|
||||
if (questStage.getStatus() != QuestStatus.Complete){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.failed){
|
||||
@@ -263,6 +262,12 @@ public class AdventureQuestController implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateArenaComplete(boolean winner){
|
||||
for(AdventureQuestData currentQuest: Current.player().getQuests()) {
|
||||
currentQuest.updateArenaComplete(winner);
|
||||
}
|
||||
}
|
||||
|
||||
public AdventureQuestData generateQuest(int id){
|
||||
AdventureQuestData generated = null;
|
||||
for (AdventureQuestData template: allQuests) {
|
||||
@@ -287,7 +292,7 @@ public class AdventureQuestController implements Serializable {
|
||||
public void rematchQuestSprite(EnemySprite sprite){
|
||||
for (AdventureQuestData q : Current.player().getQuests()){
|
||||
for (AdventureQuestStage s : q.stages){
|
||||
if (sprite.questStageID != null && sprite.questStageID.equals(s.questStageID)){
|
||||
if (sprite.questStageID != null && sprite.questStageID.equals(s.stageID.toString())){
|
||||
s.setTargetSprite(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user