Skip to content

Commit

Permalink
Adventure hotfixes (#4477)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jjayers99 authored Jan 4, 2024
1 parent 1e135e8 commit 390efec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public boolean checkIfTargetLocation(PointOfInterest locationToCheck) {

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));
Expand Down
16 changes: 16 additions & 0 deletions forge-gui-mobile/src/forge/adventure/data/EnemyData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
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
Expand Down Expand Up @@ -90,4 +92,18 @@ public String getName(){
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();
}
}

0 comments on commit 390efec

Please sign in to comment.