Fix triggered Monster Tide spawn; fix Tower dungeon handoff (#2397)

* Abyss: Fix monster tide trigger; fix dungeon handoff

* back out unrelated changes
This commit is contained in:
longfruit 2023-10-14 09:08:49 -07:00 committed by GitHub
parent d32a75e980
commit fd75ba7b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 11 deletions

View File

@ -131,7 +131,9 @@ public final class DungeonSystem extends BaseGameSystem {
dungeonId);
if (player.getWorld().transferPlayerToScene(player, data.getSceneId(), data)) {
dungeonSettleListeners.forEach(player.getScene()::addDungeonSettleObserver);
var scene = player.getScene();
scene.setDungeonManager(new DungeonManager(scene, data));
dungeonSettleListeners.forEach(scene::addDungeonSettleObserver);
}
return true;
}

View File

@ -774,9 +774,9 @@ public class SceneScriptManager {
}
public void startMonsterTideInGroup(
SceneGroup group, Integer[] ordersConfigId, int tideCount, int sceneLimit) {
String source, SceneGroup group, Integer[] ordersConfigId, int tideCount, int sceneLimit) {
this.scriptMonsterTideService =
new ScriptMonsterTideService(this, group, tideCount, sceneLimit, ordersConfigId);
new ScriptMonsterTideService(this, source, group, tideCount, sceneLimit, ordersConfigId);
}
public void unloadCurrentMonsterTide() {

View File

@ -310,14 +310,14 @@ public class ScriptLib {
// TODO: AttachGalleryAbilityGroup
// TODO: AttachGalleryTeamAbilityGroup
public int AutoMonsterTide(int challengeIndex, int groupId, Integer[] ordersConfigId, int tideCount, int sceneLimit, int param6) {
logger.debug("[LUA] Call AutoMonsterTide with {},{},{},{},{},{}", challengeIndex, groupId, ordersConfigId, tideCount, sceneLimit, param6);
public int AutoMonsterTide(int sourceId, int groupId, Integer[] ordersConfigId, int tideCount, int sceneLimit, int param6) {
logger.debug("[LUA] Call AutoMonsterTide with {},{},{},{},{},{}", sourceId, groupId, ordersConfigId, tideCount, sceneLimit, param6);
// Some fields are guessed
SceneGroup group = getSceneScriptManager().getGroupById(groupId);
if (group == null || group.monsters == null) {
return 1;
}
this.getSceneScriptManager().startMonsterTideInGroup(group, ordersConfigId, tideCount, sceneLimit);
this.getSceneScriptManager().startMonsterTideInGroup(Integer.toString(sourceId), group, ordersConfigId, tideCount, sceneLimit);
return 0;
}

View File

@ -20,9 +20,11 @@ public final class ScriptMonsterTideService {
private final List<Integer> monsterConfigIds;
private final OnMonsterCreated onMonsterCreated = new OnMonsterCreated();
private final OnMonsterDead onMonsterDead = new OnMonsterDead();
private final String source;
public ScriptMonsterTideService(
SceneScriptManager sceneScriptManager,
String source,
SceneGroup group,
int tideCount,
int monsterSceneLimit,
@ -35,6 +37,7 @@ public final class ScriptMonsterTideService {
this.monsterAlive = new AtomicInteger(0);
this.monsterConfigOrders = new ConcurrentLinkedQueue<>(List.of(ordersConfigId));
this.monsterConfigIds = List.of(ordersConfigId);
this.source = source;
this.sceneScriptManager
.getScriptMonsterSpawnService()
@ -83,11 +86,10 @@ public final class ScriptMonsterTideService {
sceneScriptManager.createMonster(
currentGroup.id, currentGroup.block_id, getNextMonster()));
}
// spawn the last turn of monsters
// fix the 5-2
sceneScriptManager.callEvent(
new ScriptArgs(
currentGroup.id, EventType.EVENT_MONSTER_TIDE_DIE, monsterKillCount.get()));
// call registered events that may spawn in more monsters
var scriptArgs = new ScriptArgs(currentGroup.id, EventType.EVENT_MONSTER_TIDE_DIE, monsterKillCount.get());
scriptArgs.setEventSource(source);
sceneScriptManager.callEvent(scriptArgs);
}
}