Merge pull request #2909 from jjayers99/master

Adventure updates
This commit is contained in:
Anthony Calosa
2023-04-14 03:06:39 +08:00
committed by GitHub
15 changed files with 157 additions and 92 deletions

View File

@@ -169,7 +169,6 @@ public class QuestStageEdit extends FormPanel {
switch(objectiveType.getSelectedItem().toString()){
case "Arena":
arenaLabel.setVisible(true);
nyi.setVisible(true);
poiPane.setVisible(true);
anyPOI.setVisible(true);
here.setVisible(true);

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
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;

View File

@@ -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 String stageID;
public void initialize(){
if (stageID == null || stageID.isEmpty()){
stageID = UUID.randomUUID().toString();
}
}
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;
}
}

View File

@@ -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

View File

@@ -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);

View File

@@ -84,9 +84,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 +263,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 +293,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)){
s.setTargetSprite(sprite);
}
}

View File

@@ -178,16 +178,6 @@
&quot;rounds&quot;:3,
&quot;entryFee&quot;:100,
&quot;rewards&quot;: [[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;green&quot;]
}
],[
{
&quot;type&quot;: &quot;gold&quot;,
&quot;probability&quot;: 1,
@@ -199,6 +189,16 @@
&quot;count&quot;: 1,
&quot;itemNames&quot;: [&quot;Dungeon Map&quot;,&quot;Mad Staff&quot;,&quot;Gold Boots&quot;,&quot;Disrupting Scepter&quot;]
}
],[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Rare&quot;,&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;green&quot;]
}
]
]
}</property>

View File

@@ -154,16 +154,6 @@
&quot;rounds&quot;:3,
&quot;entryFee&quot;:100,
&quot;rewards&quot;: [[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;blue&quot;]
}
],[
{
&quot;type&quot;: &quot;gold&quot;,
&quot;probability&quot;: 1,
@@ -175,6 +165,16 @@
&quot;count&quot;: 1,
&quot;itemNames&quot;: [&quot;Mithril Armor&quot;,&quot;Mithril Shield&quot;,&quot;Mithril Boots&quot;,&quot;Dagger&quot;]
}
],[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Rare&quot;,&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;blue&quot;]
}
]
]
}</property>

View File

@@ -160,16 +160,6 @@
&quot;rounds&quot;:3,
&quot;entryFee&quot;:100,
&quot;rewards&quot;: [[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;red&quot;]
}
],[
{
&quot;type&quot;: &quot;gold&quot;,
&quot;probability&quot;: 1,
@@ -181,6 +171,16 @@
&quot;count&quot;: 1,
&quot;itemNames&quot;: [&quot;Aladdin's Ring&quot;,&quot;Axt&quot;,&quot;Ring of Immortals&quot;,&quot;Jandor's Ring&quot;]
}
],[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Rare&quot;,&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;red&quot;]
}
]
]
}</property>

View File

@@ -153,16 +153,6 @@
&quot;rounds&quot;:3,
&quot;entryFee&quot;:100,
&quot;rewards&quot;: [[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;white&quot;]
}
],[
{
&quot;type&quot;: &quot;gold&quot;,
&quot;probability&quot;: 1,
@@ -175,6 +165,17 @@
&quot;count&quot;: 1,
&quot;itemNames&quot;: [&quot;Gold Armor&quot;,&quot;Gold Shield&quot;,&quot;Gold Boots&quot;,&quot;Bronze Sword&quot;]
}
],
[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Rare&quot;,&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;white&quot;]
}
]
]
}</property>

View File

@@ -82,16 +82,6 @@
&quot;rounds&quot;:3,
&quot;entryFee&quot;:100,
&quot;rewards&quot;: [[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;black&quot;]
}
],[
{
&quot;type&quot;: &quot;gold&quot;,
&quot;probability&quot;: 1,
@@ -103,6 +93,17 @@
&quot;count&quot;: 1,
&quot;itemNames&quot;: [&quot;Death Ring&quot;,&quot;Dark Armor&quot;,&quot;Dark Shield&quot;,&quot;Dark Boots&quot;]
}
],
[
{
&quot;type&quot;: &quot;card&quot;,
&quot;probability&quot;: 1,
&quot;count&quot;:2,
&quot;rarity&quot;: [
&quot;Rare&quot;,&quot;Mythic Rare&quot;
],
&quot;colors&quot;: [&quot;black&quot;]
}
]
]
}</property>

View File

@@ -261,9 +261,7 @@
"radiusFactor": 0.8,
"questTags": [
"Cave",
"Hostile",
"BiomeBlack",
"Sidequest"
"BiomeBlack"
]
},
{
@@ -395,10 +393,8 @@
"map": "maps/map/cave_2.tmx",
"radiusFactor": 0.8,
"questTags": [
"Hostile",
"Cave",
"BiomeColorless",
"Sidequest"
"BiomeColorless"
]
},
{
@@ -591,9 +587,7 @@
"radiusFactor": 0.8,
"questTags": [
"Cave",
"Hostile",
"BiomeGreen",
"Sidequest"
"BiomeGreen"
]
},
{
@@ -710,10 +704,8 @@
"map": "maps/map/cave_2.tmx",
"radiusFactor": 0.8,
"questTags": [
"Hostile",
"Cave",
"BiomeBlue",
"Sidequest"
"BiomeBlue"
]
},
{
@@ -800,10 +792,8 @@
"map": "maps/map/cave_2.tmx",
"radiusFactor": 0.8,
"questTags": [
"Hostile",
"Cave",
"BiomeRed",
"Sidequest"
"BiomeRed"
]
},
{
@@ -1040,10 +1030,8 @@
"map": "maps/map/cave_2.tmx",
"radiusFactor": 0.8,
"questTags": [
"Hostile",
"Cave",
"BiomeWhite",
"Sidequest"
"BiomeWhite"
]
},
{

View File

@@ -2167,9 +2167,11 @@
},
{
"name": "You decide that the invasive thoughts, if you can call them that, are unwelcomed, and you take a step back.",
"text": "The thoughts urgently follow you for a moment. '{COLOR=red}KKKKiiiiill...{ENDCOLOR}' But as you take another step back, the words vanish from your mind."
"text": "The thoughts urgently follow you for a moment. '{COLOR=red}KKKKiiiiill...{ENDCOLOR}' But as you take another step back, the words vanish from your mind.",
"options": [
{"name": "With no delay at all, you walk away. Far away. (Decline Quest)"}
{
"name": "With no delay at all, you walk away. Far away. (Decline Quest)"
}
]
}
]
@@ -3690,7 +3692,7 @@
]
},
{
"name": "\"A fight with a dragon? No thanks. I'll be leaving now.\" (Decline Quest)",
"name": "\"A fight with a dragon? No thanks. I'll be leaving now.\" (Decline Quest)"
}
]
},
@@ -4470,9 +4472,11 @@
},
{
"name": "A short note is written in red ink.",
"text": "\"{COLOR=red}Have fangs, will travel{ENDCOLOR}\"."
"text": "\"{COLOR=red}Have fangs, will travel{ENDCOLOR}\".",
"options": [
{"name": "You suddenly realize that isn't ink, and step away. (Decline Quest)"}
{
"name": "You suddenly realize that isn't ink, and step away. (Decline Quest)"
}
]
}
]
@@ -4741,7 +4745,6 @@
"options": [
{
"action": [
{
"grantRewards": [
{
@@ -4855,7 +4858,6 @@
"failureDialog": {},
"POIToken": ""
}
]
},
{
@@ -4969,7 +4971,6 @@
{
"name": "You don't especially feel like volunteering to take on a $(enemy_1) today. (Decline Quest)"
}
]
},
{