Skip to content

Commit

Permalink
refactor: removed outdated code
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Nov 30, 2024
1 parent fdbc5d6 commit 52ebba4
Show file tree
Hide file tree
Showing 31 changed files with 56 additions and 66 deletions.
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/c/ChainerNightmareAdept.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class ChainerNightmareAdeptWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
if (event.getAdditionalReference() == null) {
if (event.getApprovingObject() == null) {
return;
}
morMap.computeIfAbsent(event.getAdditionalReference().getApprovingMageObjectReference(), m -> new HashMap<>())
morMap.computeIfAbsent(event.getApprovingObject().getApprovingMageObjectReference(), m -> new HashMap<>())
.compute(event.getPlayerId(), (u, i) -> i == null ? 0 : Integer.sum(i, -1));
}
}
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/c/ChandraHopesBeacon.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ class ChandraHopesBeaconWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST
|| event.getAdditionalReference() == null) {
|| event.getApprovingObject() == null) {
return;
}
MageObjectReference mor = event.getAdditionalReference().getApprovingMageObjectReference();
MageObjectReference mor = event.getApprovingObject().getApprovingMageObjectReference();
Spell spell = game.getSpell(event.getTargetId());
if (mor == null || spell == null) {
return;
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/c/ChissGoriaForgeTyrant.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ class ChissGoriaForgeTyrantWatcher extends Watcher {

@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getAdditionalReference() == null) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getApprovingObject() == null) {
return;
}
MageObjectReference mor = event.getAdditionalReference().getApprovingMageObjectReference();
MageObjectReference mor = event.getApprovingObject().getApprovingMageObjectReference();
Spell spell = game.getSpell(event.getTargetId());
if (mor == null || spell == null) {
return;
Expand Down
8 changes: 4 additions & 4 deletions Mage.Sets/src/mage/cards/c/CoramTheUndertaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ public void watch(GameEvent event, Game game) {
cardsAllowedToBePlayedOrCast.add(new MageObjectReference(mainCard, game));
return;
}
if (event.getAdditionalReference() == null
|| !MageIdentifier.CoramTheUndertakerWatcher.equals(event.getAdditionalReference().getApprovingAbility().getIdentifier())) {
if (event.getApprovingObject() == null
|| !MageIdentifier.CoramTheUndertakerWatcher.equals(event.getApprovingObject().getApprovingAbility().getIdentifier())) {
return;
}
if (event.getType() == GameEvent.EventType.LAND_PLAYED) {
landPlayedForSource.add(event.getAdditionalReference().getApprovingMageObjectReference());
landPlayedForSource.add(event.getApprovingObject().getApprovingMageObjectReference());
}
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
spellCastForSource.add(event.getAdditionalReference().getApprovingMageObjectReference());
spellCastForSource.add(event.getApprovingObject().getApprovingMageObjectReference());
}
}

Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/c/CourtOfLocthwain.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void watch(GameEvent event, Game game) {
&& event.getPlayerId() != null) {
decrementCastAvailable(
event.getPlayerId(),
event.getAdditionalReference().getApprovingMageObjectReference()
event.getApprovingObject().getApprovingMageObjectReference()
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/e/EvelynTheCovetous.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ class EvelynTheCovetousWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if ((event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED)
&& event.getAdditionalReference() != null) {
&& event.getApprovingObject() != null) {
usedMap.computeIfAbsent(
event.getAdditionalReference()
event.getApprovingObject()
.getApprovingMageObjectReference(),
x -> new HashSet<>()
).add(event.getPlayerId());
Expand Down
5 changes: 2 additions & 3 deletions Mage.Sets/src/mage/cards/f/Flameskull.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package mage.cards.f;

import mage.MageInt;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
Expand Down Expand Up @@ -132,10 +131,10 @@ class FlameskullWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST
|| event.getAdditionalReference() == null) {
|| event.getApprovingObject() == null) {
return;
}
MageObjectReference mor = event.getAdditionalReference().getApprovingMageObjectReference();
MageObjectReference mor = event.getApprovingObject().getApprovingMageObjectReference();
Spell spell = game.getSpell(event.getTargetId());
if (mor == null || spell == null) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/g/GaleaKindlerOfHope.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public boolean checkTrigger(GameEvent event, Game game) {
if (!isControlledBy(event.getPlayerId())
|| event.getZone() != Zone.LIBRARY
|| !event
.getAdditionalReference()
.getApprovingObject()
.getApprovingMageObjectReference()
.refersTo(this.getSourceObject(game), game)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/g/GlimpseTheCosmos.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public GlimpseTheCosmosWatcher() {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL
&& event.hasApprovingIdentifier(MageIdentifier.GlimpseTheCosmosWatcher)) {
Ability approvingAbility = event.getAdditionalReference().getApprovingAbility();
Ability approvingAbility = event.getApprovingObject().getApprovingAbility();
if (approvingAbility != null
&& approvingAbility.getSourceId().equals(event.getSourceId())) {
sourceCards.add(game.getCard(event.getSourceId()));
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/h/HaukensInsight.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public HaukensInsightWatcher() {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED) {
if (event.hasApprovingIdentifier(MageIdentifier.HaukensInsightWatcher)) {
usedFrom.add(event.getAdditionalReference().getApprovingMageObjectReference());
usedFrom.add(event.getApprovingObject().getApprovingMageObjectReference());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/h/HedonistsTrove.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ class HedonistsTroveWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST
|| event.getAdditionalReference() == null) {
|| event.getApprovingObject() == null) {
return;
}
playerMap
.computeIfAbsent(event.getPlayerId(), x -> new HashSet<>())
.add(event.getAdditionalReference().getApprovingMageObjectReference());
.add(event.getApprovingObject().getApprovingMageObjectReference());
playerMap.get(event.getPlayerId()).removeIf(Objects::isNull);
}

Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/i/IanMalcolmChaotician.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST &&
event.hasApprovingIdentifier(MageIdentifier.IanMalcolmChaoticianWatcher)) {
usedMap.computeIfAbsent(
event.getAdditionalReference()
event.getApprovingObject()
.getApprovingMageObjectReference(),
x -> new HashSet<>()
).add(event.getPlayerId());
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/i/IdolOfEndurance.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ class IdolOfEnduranceWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
if (event.getAdditionalReference() == null) {
if (event.getApprovingObject() == null) {
return;
}
morMap.computeIfAbsent(event.getAdditionalReference().getApprovingMageObjectReference(), m -> new HashMap<>())
morMap.computeIfAbsent(event.getApprovingObject().getApprovingMageObjectReference(), m -> new HashMap<>())
.compute(event.getPlayerId(), (u, i) -> i == null ? 0 : Integer.sum(i, -1));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/k/KaghaShadowArchdruid.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class KaghaShadowArchdruidWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if ((GameEvent.EventType.SPELL_CAST.equals(event.getType()) || GameEvent.EventType.LAND_PLAYED.equals(event.getType()))
&& event.hasApprovingIdentifier(MageIdentifier.KaghaShadowArchdruidWatcher)) {
usedFrom.add(event.getAdditionalReference().getApprovingMageObjectReference());
usedFrom.add(event.getApprovingObject().getApprovingMageObjectReference());
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/k/KessDissidentMage.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ public void watch(GameEvent event, Game game) {
&& event.hasApprovingIdentifier(MageIdentifier.KessDissidentMageWatcher)) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (spell != null) {
allowingObjects.add(event.getAdditionalReference().getApprovingMageObjectReference());
allowingObjects.add(event.getApprovingObject().getApprovingMageObjectReference());
castSpells.put(new MageObjectReference(spell.getMainCard().getId(), game),
event.getAdditionalReference().getApprovingAbility().getSourceId());
event.getApprovingObject().getApprovingAbility().getSourceId());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/k/KotoseTheSilentSpider.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ public void watch(GameEvent event, Game game) {
morMap.values().removeIf(Set::isEmpty);
return;
}
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getAdditionalReference() == null) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getApprovingObject() == null) {
return;
}
Spell spell = game.getSpell(event.getTargetId());
if (spell == null) {
return;
}
morMap.getOrDefault(
event.getAdditionalReference().getApprovingMageObjectReference(), Collections.emptySet()
event.getApprovingObject().getApprovingMageObjectReference(), Collections.emptySet()
).removeIf(set -> set
.stream()
.anyMatch(mor -> mor.getSourceId().equals(spell.getMainCard().getId())
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/l/LobeliaDefenderOfBagEnd.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ class LobeliaDefenderOfBagEndWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.PLAY_LAND) {
if (event.getAdditionalReference() == null) {
if (event.getApprovingObject() == null) {
return;
}
morMap.computeIfAbsent(event.getAdditionalReference().getApprovingMageObjectReference(), m -> new HashMap<>())
morMap.computeIfAbsent(event.getApprovingObject().getApprovingMageObjectReference(), m -> new HashMap<>())
.compute(event.getPlayerId(), (u, i) -> i == null ? 0 : Integer.sum(i, -1));
}
}
Expand Down
6 changes: 3 additions & 3 deletions Mage.Sets/src/mage/cards/m/MaestrosAscendancy.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ class MaestrosAscendancyWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST
&& event.hasApprovingIdentifier(MageIdentifier.MaestrosAscendencyAlternateCast)
&& event.getAdditionalReference() != null) {
&& event.getApprovingObject() != null) {
playerMap.computeIfAbsent(
event.getAdditionalReference()
event.getApprovingObject()
.getApprovingMageObjectReference(),
x -> new HashSet<>()
).add(event.getPlayerId());
spellMap.computeIfAbsent(
event.getAdditionalReference()
event.getApprovingObject()
.getApprovingMageObjectReference(),
x -> new HashSet<>()
).add(new MageObjectReference(event.getTargetId(), game));
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/m/MarchOfRecklessJoy.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public MarchOfRecklessJoyWatcher() {

@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getAdditionalReference() == null) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getApprovingObject() == null) {
return;
}
morMap.compute(event
.getAdditionalReference()
.getApprovingObject()
.getApprovingMageObjectReference(),
CardUtil::setOrIncrementValue
);
Expand Down
8 changes: 4 additions & 4 deletions Mage.Sets/src/mage/cards/m/MuldrothaTheGravetide.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ public void watch(GameEvent event, Game game) {

private void addPermanentTypes(GameEvent event, Card mageObject, Game game) {
if (mageObject != null
&& event.getAdditionalReference() != null
&& MageIdentifier.MuldrothaTheGravetideWatcher.equals(event.getAdditionalReference().getApprovingAbility().getIdentifier())) {
&& event.getApprovingObject() != null
&& MageIdentifier.MuldrothaTheGravetideWatcher.equals(event.getApprovingObject().getApprovingAbility().getIdentifier())) {
UUID playerId = null;
if (mageObject instanceof Spell) {
playerId = ((Spell) mageObject).getControllerId();
} else if (mageObject instanceof Permanent) {
playerId = ((Permanent) mageObject).getControllerId();
}
if (playerId != null) {
Set<CardType> permanentTypes = sourcePlayedPermanentTypes.get(event.getAdditionalReference().getApprovingMageObjectReference());
Set<CardType> permanentTypes = sourcePlayedPermanentTypes.get(event.getApprovingObject().getApprovingMageObjectReference());
if (permanentTypes == null) {
permanentTypes = EnumSet.noneOf(CardType.class);
sourcePlayedPermanentTypes.put(event.getAdditionalReference().getApprovingMageObjectReference(), permanentTypes);
sourcePlayedPermanentTypes.put(event.getApprovingObject().getApprovingMageObjectReference(), permanentTypes);
}
Set<CardType> typesNotCast = EnumSet.noneOf(CardType.class);
for (CardType cardType : mageObject.getCardType(game)) {
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/n/NashiMoonSagesScion.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ public void watch(GameEvent event, Game game) {
morMap.values().removeIf(Set::isEmpty);
return;
}
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getAdditionalReference() == null) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getApprovingObject() == null) {
return;
}
Spell spell = game.getSpell(event.getTargetId());
if (spell == null) {
return;
}
morMap.getOrDefault(
event.getAdditionalReference().getApprovingMageObjectReference(), Collections.emptySet()
event.getApprovingObject().getApprovingMageObjectReference(), Collections.emptySet()
).removeIf(set -> set
.stream()
.anyMatch(mor -> mor.getSourceId().equals(spell.getMainCard().getId())
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/o/OneWithTheMultiverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public OneWithTheMultiverseWatcher() {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST
&& event.hasApprovingIdentifier(MageIdentifier.OneWithTheMultiverseWatcher)) {
usedFrom.add(event.getAdditionalReference().getApprovingMageObjectReference());
usedFrom.add(event.getApprovingObject().getApprovingMageObjectReference());
}
}

Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/r/RadiantScrollwielder.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ class RadiantScrollwielderWatcher extends Watcher {

@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getAdditionalReference() == null) {
if (event.getType() != GameEvent.EventType.SPELL_CAST || event.getApprovingObject() == null) {
return;
}
morMap.put(
new MageObjectReference(event.getSourceId(), game),
event.getAdditionalReference().getApprovingMageObjectReference()
event.getApprovingObject().getApprovingMageObjectReference()
);
}

Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/s/SerpentsSoulJar.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ class SerpentsSoulJarWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
if (event.getAdditionalReference() == null) {
if (event.getApprovingObject() == null) {
return;
}
morMap.computeIfAbsent(event.getAdditionalReference().getApprovingMageObjectReference(), m -> new HashMap<>())
morMap.computeIfAbsent(event.getApprovingObject().getApprovingMageObjectReference(), m -> new HashMap<>())
.compute(event.getPlayerId(), (u, i) -> i == null ? 0 : Integer.sum(i, -1));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/s/SerraParagon.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void watch(GameEvent event, Game game) {
|| event.getType() == GameEvent.EventType.LAND_PLAYED)
&& event.hasApprovingIdentifier(MageIdentifier.SerraParagonWatcher)) {
map.computeIfAbsent(
event.getAdditionalReference()
event.getApprovingObject()
.getApprovingMageObjectReference(),
x -> new HashSet<>()
).add(event.getPlayerId());
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/u/UnluckyWitness.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ class UnluckyWitnessWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST
|| event.getAdditionalReference() == null) {
|| event.getApprovingObject() == null) {
return;
}
MageObjectReference mor = event.getAdditionalReference().getApprovingMageObjectReference();
MageObjectReference mor = event.getApprovingObject().getApprovingMageObjectReference();
Spell spell = game.getSpell(event.getTargetId());
if (mor == null || spell == null) {
return;
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/w/WhispersteelDagger.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ class WhispersteelDaggerWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
if (event.getAdditionalReference() == null) {
if (event.getApprovingObject() == null) {
return;
}
morMap.computeIfAbsent(event.getAdditionalReference().getApprovingMageObjectReference(), m -> new HashMap<>())
morMap.computeIfAbsent(event.getApprovingObject().getApprovingMageObjectReference(), m -> new HashMap<>())
.computeIfAbsent(game.getOwnerId(event.getSourceId()), m -> new HashMap<>())
.compute(event.getPlayerId(), (u, i) -> i == null ? 0 : Integer.sum(i, -1));
return;
Expand Down
Loading

0 comments on commit 52ebba4

Please sign in to comment.