Research: multiple calls of game cycle must not cause side effects (processActions/applyEffects)
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 940
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 160
Description
Code example to find such use cases -- use duplicated code in `processAction` and look at results on failed tests.
``` java
@Override
public void processAction() {
state.handleSimultaneousEvent(this);
resetShortLivingLKI();
applyEffects();
state.getTriggers().checkStateTriggers(this);
int count = state.getContinuousEffects().getTotalEffectsCount();
Game oldGame = this.copy();
state.handleSimultaneousEvent(this);
resetShortLivingLKI();
applyEffects();
state.getTriggers().checkStateTriggers(this);
if (count != state.getContinuousEffects().getTotalEffectsCount()) {
throw new IllegalArgumentException("wtf " + count + " <> " + state.getContinuousEffects().getTotalEffectsCount());
}
}
```
Problem example with duplicated `CopyEffect` from `CryptoplasmTest.testDamageLifelink`:

There are ~30 failing tests with it. Need research -- is it critical or not. Maybe it's by design, maybe some discard/cleanup code is buggy.
There are known bugs with bad cards that can spam game state with outdated effects/triggers -- but it related to activate/resolve, not continuous effects.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with processAction and applyEffects, reproduce the duplicated-call behavior using the CryptoplasmTest.testDamageLifelink example, and review the reported failing tests. Trace repeated state handling, triggers, and continuous effects; done means recording whether the side effects are expected or identifying the cleanup or duplication behavior needing a follow-up fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100