mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Rule 800.4: When a player leaves a multiplayer game, removing objects associated with that Player from the game.
This commit is contained in:
@@ -573,6 +573,23 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerLost(Player p) {
|
public void onPlayerLost(Player p) {
|
||||||
|
// Rule 800.4 Losing a Multiplayer game
|
||||||
|
CardCollectionView cards = this.getCardsInGame();
|
||||||
|
|
||||||
|
for(Card c : cards) {
|
||||||
|
if (c.getOwner().equals(p)) {
|
||||||
|
c.ceaseToExist();
|
||||||
|
} else {
|
||||||
|
c.removeTempController(p);
|
||||||
|
if (c.getController().equals(p)) {
|
||||||
|
this.getAction().exile(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove leftover items from
|
||||||
|
this.getStack().removeInstancesControlledBy(p);
|
||||||
|
|
||||||
ingamePlayers.remove(p);
|
ingamePlayers.remove(p);
|
||||||
|
|
||||||
final Map<String, Object> runParams = new TreeMap<String, Object>();
|
final Map<String, Object> runParams = new TreeMap<String, Object>();
|
||||||
|
|||||||
@@ -2201,6 +2201,15 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void removeTempController(final Player player) {
|
||||||
|
// Remove each key that yields this player
|
||||||
|
for(Entry<Long,Player> kv : tempControllers.entrySet()) {
|
||||||
|
if (kv.getValue().equals(player)) {
|
||||||
|
tempControllers.remove(kv.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final void clearTempControllers() {
|
public final void clearTempControllers() {
|
||||||
if (tempControllers.isEmpty()) { return; }
|
if (tempControllers.isEmpty()) { return; }
|
||||||
tempControllers.clear();
|
tempControllers.clear();
|
||||||
@@ -3436,9 +3445,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
// Just remove it's zone, so we don't run through the exile stuff
|
// Just remove it's zone, so we don't run through the exile stuff
|
||||||
// This allows auras on phased out tokens to just phase out permanently
|
// This allows auras on phased out tokens to just phase out permanently
|
||||||
getGame().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
this.ceaseToExist();
|
||||||
getZone().remove(this);
|
|
||||||
getGame().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!phasedOut) {
|
if (!phasedOut) {
|
||||||
@@ -6710,4 +6717,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
this.changedCardColors.put(entry.getKey(), entry.getValue());
|
this.changedCardColors.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ceaseToExist() {
|
||||||
|
getGame().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
||||||
|
getZone().remove(this);
|
||||||
|
getGame().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -719,6 +719,14 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void removeInstancesControlledBy(final Player p) {
|
||||||
|
for (SpellAbilityStackInstance si : stack) {
|
||||||
|
if (si.getActivatingPlayer().equals(p)) {
|
||||||
|
remove(si);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void fizzleTriggersOnStackTargeting(Card c, TriggerType t) {
|
public void fizzleTriggersOnStackTargeting(Card c, TriggerType t) {
|
||||||
for (SpellAbilityStackInstance si : stack) {
|
for (SpellAbilityStackInstance si : stack) {
|
||||||
SpellAbility sa = si.getSpellAbility(false);
|
SpellAbility sa = si.getSpellAbility(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user