mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
Blocker and Critical level bugfixes throughout the project (#4648)
* fixed https://sonarcloud.io/project/issues?id=org.xmage%3Amage-root&issues=AWIlv32RgrzAwlaaQ7rP&open=AWIlv32RgrzAwlaaQ7rP * ensure closing of scanner if it was opened * Refactored method in EmpyrialArchAngel to not always return same value. * Refactored method in FalkenrathAristocrat to not always return same value. * Refactored method in GilderBairn to not always return the same value. * fixed left open resources, ensured quiet closing of the streams * Refactored method in IceCave to not always return same value. * Refactored method in KjeldoranRoyalGuard to not always return same value. * Refactored method in LegionsInitiative to not always return same value. * Refactored method in NaturesWill to not always return same value. * added quiet closing method in new streamutils class, used to clean up the connectdialog * Fix small typo * added quiet closing to saveobjectutil * closed resources in savegame method of gamecontroller * properly close resources in loadGame method of GameReplay class * further proper resource closing in ServerMessagesUtil * fixed unclosed resources in copy method in mage framework Copier * closed unclosed resources in copyCompressed method in Copier * ensure closing of filewriter in manasymbols * ensure proper closing of Stream in arcane UI * ensure closing of datagram socket in arcane Util * ensure resource closing in deckimport from clipboard * ensure closing of plugin classloader * ensured closing of zipinputstream resource * ensure closing of fileoutputstream in ScryfallSymbolsSource * ensure closing resources after finishing/canceling download of pictures * remove commented code * move locks to try block to ensure unlocking along all execution paths * remove dangerous instance of double-checked locking * removed dangerous instance of double checked locking in settingsmanager * Removed dangerous instance of double-checked locking in ThemePluginImpl * close resource which did not happen certainly * close another stream * ensure closing of inputstream
This commit is contained in:
parent
ec77cecbf6
commit
5ac975c52e
31 changed files with 288 additions and 276 deletions
|
|
@ -91,7 +91,6 @@ class EmpyrialArchangelEffect extends ReplacementEffectImpl {
|
|||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class FalkenrathAristocratEffect extends OneShotEffect {
|
|||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
if (sacrificedCreature.hasSubtype(SubType.HUMAN, game) && sourceCreature != null) {
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,12 +95,11 @@ class GilderBairnEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
for (Counter counter : target.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName(), counter.getCount());
|
||||
target.addCounters(newCounter, source, game);
|
||||
if (target != null) {
|
||||
for (Counter counter : target.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName(), counter.getCount());
|
||||
target.addCounters(newCounter, source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class IceCaveEffect extends OneShotEffect {
|
|||
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays" + cost.getText() + " to counter " + spell.getIdName() + '.');
|
||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ class KjeldoranRoyalGuardEffect extends ReplacementEffectImpl {
|
|||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ class LegionsInitiativeExileEffect extends OneShotEffect {
|
|||
//create delayed triggered ability
|
||||
AtTheBeginOfCombatDelayedTriggeredAbility delayedAbility = new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect());
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,19 +84,16 @@ class NaturesWillEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Set<UUID> damagedPlayers = (HashSet<UUID>) this.getValue("damagedPlayers");
|
||||
if (damagedPlayers == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game);
|
||||
for (Permanent land : lands) {
|
||||
if (damagedPlayers.contains(land.getControllerId())) {
|
||||
land.tap(game);
|
||||
} else if (land.getControllerId().equals(source.getControllerId())) {
|
||||
land.untap(game);
|
||||
if (damagedPlayers != null) {
|
||||
List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game);
|
||||
for (Permanent land : lands) {
|
||||
if (damagedPlayers.contains(land.getControllerId())) {
|
||||
land.tap(game);
|
||||
} else if (land.getControllerId().equals(source.getControllerId())) {
|
||||
land.untap(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue