mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-22 11:54:39 +01:00
Fix battle in front of glowy stag god (#2188)
* Fix battle in front of glowy stag god * Don't do a rollback when starting a quest. We're better than that.
This commit is contained in:
@@ -51,10 +51,12 @@ public class GameQuest {
|
||||
this.state = QuestState.QUEST_STATE_UNSTARTED;
|
||||
this.triggerData = new HashMap<>();
|
||||
this.triggers = new HashMap<>();
|
||||
this.finishProgressList = new int[questData.getFinishCond().size()];
|
||||
this.failProgressList = new int[questData.getFailCond().size()];
|
||||
this.finishTime = 0;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
this.clearProgress(false);
|
||||
this.acceptTime = Utils.getCurrentSeconds();
|
||||
this.startTime = this.acceptTime;
|
||||
this.startGameDay = getOwner().getWorld().getTotalGameTimeDays();
|
||||
@@ -153,17 +155,30 @@ public class GameQuest {
|
||||
// TODO improve
|
||||
var oldState = state;
|
||||
if (questData.getFinishCond() != null && questData.getFinishCond().size() != 0) {
|
||||
for(var condition : questData.getFinishCond()) {
|
||||
if(condition.getType() == QuestContent.QUEST_CONTENT_LUA_NOTIFY) {
|
||||
this.getOwner().getPlayerProgress().resetCurrentProgress(condition.getParamStr());
|
||||
}
|
||||
}
|
||||
this.finishProgressList = new int[questData.getFinishCond().size()];
|
||||
}
|
||||
|
||||
if (questData.getFailCond() != null && questData.getFailCond().size() != 0) {
|
||||
for(var condition : questData.getFailCond()) {
|
||||
if(condition.getType() == QuestContent.QUEST_CONTENT_LUA_NOTIFY) {
|
||||
this.getOwner().getPlayerProgress().resetCurrentProgress(condition.getParamStr());
|
||||
}
|
||||
}
|
||||
this.failProgressList = new int[questData.getFailCond().size()];
|
||||
}
|
||||
|
||||
this.getOwner().getPlayerProgress().resetCurrentProgress(String.valueOf(this.subQuestId));
|
||||
|
||||
setState(QuestState.QUEST_STATE_UNSTARTED);
|
||||
finishTime = 0;
|
||||
acceptTime = 0;
|
||||
startTime = 0;
|
||||
this.getOwner().getPlayerProgress().resetCurrentProgress(this.subQuestId);
|
||||
|
||||
if (oldState == QuestState.QUEST_STATE_UNSTARTED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ContentAddQuestProgress extends BaseContent {
|
||||
public boolean execute(
|
||||
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
val progressId = condition.getParam()[0];
|
||||
val currentCount = quest.getOwner().getPlayerProgress().getCurrentProgress(progressId);
|
||||
val currentCount = quest.getOwner().getPlayerProgress().getCurrentProgress(String.valueOf(progressId));
|
||||
|
||||
// if the condition count is 0 I think it is safe to assume that the
|
||||
// condition count from EXEC only needs to be 1
|
||||
|
||||
@@ -12,6 +12,6 @@ public class ContentLuaNotify extends BaseContent {
|
||||
@Override
|
||||
public boolean execute(
|
||||
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
return condition.getParamStr().equals(paramStr);
|
||||
return condition.getParamStr().equals(paramStr) && condition.getCount() <= quest.getOwner().getPlayerProgress().getCurrentProgress(paramStr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user