mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Fixed #5578
This commit is contained in:
parent
faf9b96a54
commit
1092552425
1 changed files with 13 additions and 3 deletions
|
@ -65,7 +65,11 @@ class ThousandYearStormEffect extends OneShotEffect {
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
ThousandYearWatcher watcher = game.getState().getWatcher(ThousandYearWatcher.class);
|
ThousandYearWatcher watcher = game.getState().getWatcher(ThousandYearWatcher.class);
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
int numberOfCopies = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) - 1;
|
// recall only the spells cast before it
|
||||||
|
int numberOfCopies = 0;
|
||||||
|
if (game.getState().getValue(spell.getId().toString()) != null) {
|
||||||
|
numberOfCopies = (int) game.getState().getValue(spell.getId().toString()) - 1;
|
||||||
|
}
|
||||||
if (numberOfCopies > 0) {
|
if (numberOfCopies > 0) {
|
||||||
for (int i = 0; i < numberOfCopies; i++) {
|
for (int i = 0; i < numberOfCopies; i++) {
|
||||||
spell.createCopyOnStack(game, source, source.getControllerId(), true);
|
spell.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||||
|
@ -95,13 +99,19 @@ class ThousandYearWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
||||||
|
&& !game.getStack().contains(game.getSpell(sourceId))) {
|
||||||
Spell spell = game.getSpellOrLKIStack(event.getTargetId());
|
Spell spell = game.getSpellOrLKIStack(event.getTargetId());
|
||||||
if (spell != null && spell.isInstantOrSorcery()) {
|
if (spell != null
|
||||||
|
&& spell.isInstantOrSorcery()) {
|
||||||
UUID playerId = event.getPlayerId();
|
UUID playerId = event.getPlayerId();
|
||||||
if (playerId != null) {
|
if (playerId != null) {
|
||||||
amountOfInstantSorcerySpellsCastOnCurrentTurn.putIfAbsent(playerId, 0);
|
amountOfInstantSorcerySpellsCastOnCurrentTurn.putIfAbsent(playerId, 0);
|
||||||
amountOfInstantSorcerySpellsCastOnCurrentTurn.compute(playerId, (k, a) -> a + 1);
|
amountOfInstantSorcerySpellsCastOnCurrentTurn.compute(playerId, (k, a) -> a + 1);
|
||||||
|
|
||||||
|
// remember only the spells cast before it
|
||||||
|
game.getState().setValue(spell.getId().toString(), amountOfInstantSorcerySpellsCastOnCurrentTurn.get(playerId));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue