Adventure hotfixes (#4477)

Hotfix for quest "What's Yours Is Mine", players were not receiving credit for defeating pirate captain
Replacing missing deck file for apprentice red wizard
This commit is contained in:
TabletopGeneral
2024-01-04 13:08:46 -05:00
committed by GitHub
parent 1e135e8d3b
commit 390efeca57
3 changed files with 17 additions and 1 deletions

View File

@@ -178,7 +178,7 @@ public class AdventureQuestStage implements Serializable {
public boolean checkIfTargetEnemy(EnemySprite enemy) {
if (targetEnemyData != null) {
return enemy.getData() == targetEnemyData;
return (enemy.getData().match(targetEnemyData));
}
else if (targetSprite == null) {
ArrayList<String> candidateTags = new ArrayList<>(Arrays.asList(enemy.getData().questTags));

View File

@@ -5,6 +5,8 @@ import forge.deck.Deck;
import forge.util.Aggregates;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Data class that will be used to read Json configuration files
@@ -90,4 +92,18 @@ public class EnemyData implements Serializable {
return name;
return "(Unnamed Enemy)";
}
public boolean match(EnemyData other) {
//equals() does not cover cases where data is updated to override speed, displayname, etc
if (this.equals(other))
return true;
if (!this.name.equals(other.name))
return false;
if (questTags.length != other.questTags.length)
return false;
ArrayList<String> myQuestTags = new ArrayList<>(Arrays.asList(questTags));
ArrayList<String> otherQuestTags = new ArrayList<>(Arrays.asList(other.questTags));
myQuestTags.removeAll(otherQuestTags);
return myQuestTags.isEmpty();
}
}