mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Fixed Rebound for multi keywords. Added Player.#getSideboard method
This commit is contained in:
parent
8be7dff310
commit
309ebc7ee3
3 changed files with 24 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ import mage.abilities.DelayedTriggeredAbility;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.condition.common.MyTurnCondition;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -105,7 +106,16 @@ public class ReboundAbility extends TriggeredAbilityImpl<ReboundAbility> {
|
|||
if (event.getType() == EventType.SPELL_CAST && this.installReboundEffect) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.getSourceId().equals(this.getSourceId())) {
|
||||
spell.getSpellAbility().addEffect(new ReboundEffect());
|
||||
Effect reboundEffect = new ReboundEffect();
|
||||
boolean found = false;
|
||||
for (Effect effect : spell.getSpellAbility().getEffects())
|
||||
if (effect instanceof ReboundEffect) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (!found) {
|
||||
spell.getSpellAbility().addEffect(reboundEffect);
|
||||
}
|
||||
this.installReboundEffect = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
public String getName();
|
||||
public RangeOfInfluence getRange();
|
||||
public Library getLibrary();
|
||||
public Cards getSideboard();
|
||||
public Cards getGraveyard();
|
||||
public Abilities<Ability> getAbilities();
|
||||
public void addAbility(Ability ability);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
protected boolean wins;
|
||||
protected boolean loses;
|
||||
protected Library library;
|
||||
protected Cards sideboard;
|
||||
protected Cards hand;
|
||||
protected Cards graveyard;
|
||||
protected Abilities<Ability> abilities;
|
||||
|
|
@ -134,6 +135,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
counters = new Counters();
|
||||
manaPool = new ManaPool();
|
||||
library = new Library(playerId);
|
||||
sideboard = new CardsImpl(Zone.OUTSIDE);
|
||||
}
|
||||
|
||||
protected PlayerImpl(UUID id) {
|
||||
|
|
@ -149,6 +151,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.wins = player.wins;
|
||||
this.loses = player.loses;
|
||||
this.library = player.library.copy();
|
||||
this.sideboard = player.sideboard.copy();
|
||||
this.hand = player.hand.copy();
|
||||
this.graveyard = player.graveyard.copy();
|
||||
this.abilities = player.abilities.copy();
|
||||
|
|
@ -176,6 +179,10 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
public void useDeck(Deck deck, Game game) {
|
||||
library.clear();
|
||||
library.addAll(deck.getCards(), game);
|
||||
sideboard.clear();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
sideboard.add(card);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -796,6 +803,11 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
return library;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cards getSideboard() {
|
||||
return sideboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLife() {
|
||||
return life;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue