mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
fixed crash at end of quest match
This commit is contained in:
@@ -88,8 +88,6 @@ public final class AllZone {
|
|||||||
*/
|
*/
|
||||||
public static CardFactoryInterface getCardFactory() {
|
public static CardFactoryInterface getCardFactory() {
|
||||||
if (AllZone.cardFactory == null) {
|
if (AllZone.cardFactory == null) {
|
||||||
// setCardFactory(new
|
|
||||||
// LazyCardFactory(ForgeProps.getFile(CARDSFOLDER)));
|
|
||||||
AllZone.setCardFactory(new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)));
|
AllZone.setCardFactory(new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)));
|
||||||
}
|
}
|
||||||
return AllZone.cardFactory;
|
return AllZone.cardFactory;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import forge.quest.QuestEventChallenge;
|
|||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
import forge.quest.QuestEvent;
|
import forge.quest.QuestEvent;
|
||||||
import forge.quest.bazaar.QuestItemType;
|
import forge.quest.bazaar.QuestItemType;
|
||||||
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
import forge.quest.io.ReadPriceList;
|
import forge.quest.io.ReadPriceList;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
@@ -347,13 +348,13 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
|
|
||||||
// final PlayerStatistics aiRating = game.getStatistics(computer.getName());
|
// final PlayerStatistics aiRating = game.getStatistics(computer.getName());
|
||||||
PlayerStatistics humanRating = null;
|
PlayerStatistics humanRating = null;
|
||||||
for(Entry<LobbyPlayer, PlayerStatistics> aiRating : game ) {
|
for(Entry<LobbyPlayer, PlayerStatistics> kvRating : game ) {
|
||||||
if( aiRating.getValue().equals(localHuman)) {
|
if( kvRating.getKey().equals(localHuman)) {
|
||||||
humanRating = aiRating.getValue();
|
humanRating = kvRating.getValue();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerOutcome outcome = aiRating.getValue().getOutcome();
|
final PlayerOutcome outcome = kvRating.getValue().getOutcome();
|
||||||
final GameLossReason whyAiLost = outcome.lossState;
|
final GameLossReason whyAiLost = outcome.lossState;
|
||||||
final int altReward = this.getCreditsRewardForAltWin(whyAiLost);
|
final int altReward = this.getCreditsRewardForAltWin(whyAiLost);
|
||||||
|
|
||||||
@@ -907,17 +908,18 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
|
private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
|
||||||
|
QuestPreferences qp = Singletons.getModel().getQuestPreferences();
|
||||||
if ( null == whyAiLost) // Felidar, Helix Pinnacle, etc.
|
if ( null == whyAiLost) // Felidar, Helix Pinnacle, etc.
|
||||||
return Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.REWARDS_UNDEFEATED);
|
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED);
|
||||||
switch (whyAiLost) {
|
switch (whyAiLost) {
|
||||||
case LifeReachedZero:
|
case LifeReachedZero:
|
||||||
return 0; // nothing special here, ordinary kill
|
return 0; // nothing special here, ordinary kill
|
||||||
case Milled:
|
case Milled:
|
||||||
return Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.REWARDS_MILLED);
|
return qp.getPreferenceInt(QPref.REWARDS_MILLED);
|
||||||
case Poisoned:
|
case Poisoned:
|
||||||
return Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.REWARDS_POISON);
|
return qp.getPreferenceInt(QPref.REWARDS_POISON);
|
||||||
case SpellEffect: // Door to Nothingness, etc.
|
case SpellEffect: // Door to Nothingness, etc.
|
||||||
return Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.REWARDS_UNDEFEATED);
|
return qp.getPreferenceInt(QPref.REWARDS_UNDEFEATED);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user