Little fixes

This commit is contained in:
Oleg Agafonov 2020-01-09 08:52:25 +04:00
parent b011ddf942
commit ab1475d7e0
4 changed files with 10 additions and 11 deletions

View file

@ -329,7 +329,6 @@ public class User {
private void reconnect() { private void reconnect() {
logger.trace(userName + " started reconnect"); logger.trace(userName + " started reconnect");
//lastActivity = new Date(); // ??? comment to test can't reconnect to game on disconnect
for (Entry<UUID, Table> entry : tables.entrySet()) { for (Entry<UUID, Table> entry : tables.entrySet()) {
ccJoinedTable(entry.getValue().getRoomId(), entry.getValue().getId(), entry.getValue().isTournament()); ccJoinedTable(entry.getValue().getRoomId(), entry.getValue().getId(), entry.getValue().isTournament());
} }

View file

@ -110,7 +110,7 @@ class OathOfMagesEffect extends OneShotEffect {
if (sourceObject == null || firstPlayer == null) { if (sourceObject == null || firstPlayer == null) {
return false; return false;
} }
if (firstPlayer.chooseUse(outcome, "Deal one damage to " + secondPlayer.getLogName() + "?", source, game)) { if (firstPlayer.chooseUse(Outcome.Benefit, "Deal one damage to " + secondPlayer.getLogName() + "?", source, game)) {
secondPlayer.damage(1, source.getSourceId(), game, false, true); secondPlayer.damage(1, source.getSourceId(), game, false, true);
} }
return true; return true;

View file

@ -1,11 +1,11 @@
package mage; package mage;
import mage.util.CardUtil;
import mage.util.Copyable;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import mage.util.Copyable;
public class MageInt implements Serializable, Copyable<MageInt> { public class MageInt implements Serializable, Copyable<MageInt> {
public static final MageInt EmptyMageInt = new MageInt(Integer.MIN_VALUE, "") { public static final MageInt EmptyMageInt = new MageInt(Integer.MIN_VALUE, "") {
@ -80,7 +80,7 @@ public class MageInt implements Serializable, Copyable<MageInt> {
} }
public void boostValue(int amount) { public void boostValue(int amount) {
this.boostedValue += amount; this.boostedValue = CardUtil.addWithOverflowCheck(this.boostedValue, amount);
} }
public void resetToBaseValue() { public void resetToBaseValue() {

View file

@ -1,6 +1,5 @@
package mage.game.permanent; package mage.game.permanent;
import java.util.*;
import mage.MageObject; import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.ObjectColor; import mage.ObjectColor;
@ -38,6 +37,8 @@ import mage.util.GameLog;
import mage.util.ThreadLocalStringBuilder; import mage.util.ThreadLocalStringBuilder;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.util.*;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -757,7 +758,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.attachedTo = attachToObjectId; this.attachedTo = attachToObjectId;
this.attachedToZoneChangeCounter = game.getState().getZoneChangeCounter(attachToObjectId); this.attachedToZoneChangeCounter = game.getState().getZoneChangeCounter(attachToObjectId);
for (Ability ability : this.getAbilities()) { for (Ability ability : this.getAbilities()) {
for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext();) { for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext(); ) {
ContinuousEffect effect = (ContinuousEffect) ite.next(); ContinuousEffect effect = (ContinuousEffect) ite.next();
game.getContinuousEffects().setOrder(effect); game.getContinuousEffects().setOrder(effect);
// It's important to update the timestamp of the copied effect in ContinuousEffects because it does the action // It's important to update the timestamp of the copied effect in ContinuousEffects because it does the action
@ -952,7 +953,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
addCounters(CounterType.M1M1.createInstance(actualDamage), damageSourceAbility, game); addCounters(CounterType.M1M1.createInstance(actualDamage), damageSourceAbility, game);
} }
} else { } else {
// this.damage += actualDamage;
this.damage = CardUtil.addWithOverflowCheck(this.damage, actualDamage); this.damage = CardUtil.addWithOverflowCheck(this.damage, actualDamage);
} }
game.fireEvent(new DamagedCreatureEvent(objectId, sourceId, controllerId, actualDamage, combat)); game.fireEvent(new DamagedCreatureEvent(objectId, sourceId, controllerId, actualDamage, combat));