magefree / magefree/mage

Dev: waitStackResolved version of castSpell

Open
#9,412 2 comments 0 reactions 0 assignees View on GitHub
Developers Discussion
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Currently, `castSpell()` has a version which takes in a boolean `waitStackResolved`. Based on the name and the doctoring, you would expect that the game would wait for the stack to resolve before applying the next command:
https://github.com/magefree/mage/blob/ac13be90cfdad428f7da28d984b2919c3c1983e7/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java#L1580-L1585

However, as written, this is not true. What currently happens is that the controller of the spells waits for the spell waits for the stack to resolve. Therefore, as written, code like the following will not work:
```Java
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion", true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion");
```

`playerA` will wait for the stack to finish, but `playerB` will not. This code will attacked to case Lightning Bolt targeting the Lion while the Lion is still on the stack.

Given the original intention of the code (@the-red-lily am I correct in assuming that this is what you were going for?), it looks like it meant for all players to wait for the stack to finish before playing the next command. I would like to change it to that behaviour.

Is there a good reason to keep the current behaviour (but change the documentation and naming to make the behaviour more clear)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java at the castSpell overload around lines 1580-1585. Trace how waitStackResolved is handled for each player, then verify the Silvercoat Lion and Lightning Bolt scenario so completion means the documented stack-waiting behavior is consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.