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); dungeonId);
if (player.getWorld().transferPlayerToScene(player, data.getSceneId(), data)) { 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; return true;
} }

View File

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

View File

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

View File

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