mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -08:00
Improved player quits / leaves mage handling for tournaments (not perfect yet, will more improve it).
This commit is contained in:
parent
0d1e45fff6
commit
85b8edf630
12 changed files with 155 additions and 34 deletions
|
|
@ -23,36 +23,36 @@ import mage.game.Game;
|
|||
*/
|
||||
public class ConditionalActivatedAbility extends ActivatedAbilityImpl<ConditionalActivatedAbility> {
|
||||
|
||||
private Condition condition;
|
||||
private String staticText = "";
|
||||
private Condition condition;
|
||||
private String ruleText = "";
|
||||
|
||||
private static final Effects emptyEffects = new Effects();
|
||||
private static final Effects emptyEffects = new Effects();
|
||||
|
||||
public ConditionalActivatedAbility(Zone zone, Effect effect, ManaCosts cost, Condition condition, String rule) {
|
||||
public ConditionalActivatedAbility(Zone zone, Effect effect, ManaCosts cost, Condition condition, String rule) {
|
||||
super(zone, effect, cost);
|
||||
this.condition = condition;
|
||||
this.staticText = rule;
|
||||
this.ruleText = rule;
|
||||
}
|
||||
|
||||
public ConditionalActivatedAbility(Zone zone, Effect effect, Costs costs, Condition condition, String rule) {
|
||||
super(zone, effect, costs);
|
||||
this.condition = condition;
|
||||
this.staticText = rule;
|
||||
this.condition = condition;
|
||||
this.ruleText = rule;
|
||||
}
|
||||
|
||||
public ConditionalActivatedAbility(Zone zone, Effect effect, Cost cost, Condition condition, String rule) {
|
||||
super(zone, effect, cost);
|
||||
this.condition = condition;
|
||||
this.staticText = rule;
|
||||
this.condition = condition;
|
||||
this.ruleText = rule;
|
||||
}
|
||||
|
||||
public ConditionalActivatedAbility(ConditionalActivatedAbility ability) {
|
||||
public ConditionalActivatedAbility(final ConditionalActivatedAbility ability) {
|
||||
super(ability);
|
||||
this.condition = ability.condition;
|
||||
this.staticText = ability.staticText;
|
||||
this.condition = ability.condition;
|
||||
this.ruleText = ability.ruleText;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public Effects getEffects(Game game, EffectType effectType) {
|
||||
if (!condition.apply(game, this)) {
|
||||
return emptyEffects;
|
||||
|
|
@ -60,8 +60,8 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl<Conditiona
|
|||
return super.getEffects(game, effectType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canActivate(UUID playerId, Game game) {
|
||||
@Override
|
||||
public boolean canActivate(UUID playerId, Game game) {
|
||||
if (!condition.apply(game, this)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -73,8 +73,8 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl<Conditiona
|
|||
return new ConditionalActivatedAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String getRule() {
|
||||
return staticText;
|
||||
return ruleText;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class TournamentPlayer {
|
|||
protected Deck deck;
|
||||
protected String results = "";
|
||||
protected boolean eliminated = false;
|
||||
protected boolean quit = false;
|
||||
protected boolean doneConstructing;
|
||||
protected boolean joined = false;
|
||||
|
||||
|
|
@ -149,5 +150,18 @@ public class TournamentPlayer {
|
|||
public void setStateInfo(String stateInfo) {
|
||||
this.stateInfo = stateInfo;
|
||||
}
|
||||
|
||||
public boolean hasQuit() {
|
||||
return quit;
|
||||
}
|
||||
|
||||
public void setQuit(String info) {
|
||||
setEliminated();
|
||||
this.setState(TournamentPlayerState.CANCELED);
|
||||
this.setStateInfo(info);
|
||||
this.quit = true;
|
||||
this.doneConstructing = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue