mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Initiative abilities - added card hint with initiative info to all related cards (closes #11424);
tests: added verify test for miss initiative card hint; gui: fixed wrong max amount of card hint windows;
This commit is contained in:
parent
77eb3b35b8
commit
6e99a3653a
29 changed files with 92 additions and 22 deletions
|
|
@ -0,0 +1,37 @@
|
|||
package mage.abilities.hint.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.HaveInitiativeCondition;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public enum InitiativeHint implements Hint {
|
||||
|
||||
instance;
|
||||
private static final ConditionHint hint = new ConditionHint(HaveInitiativeCondition.instance, "You have the Initiative");
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
String res = hint.getText(game, ability);
|
||||
if (game.getInitiativeId() == null) {
|
||||
// no initiative
|
||||
return res + " (no Initiative in the game)";
|
||||
} else {
|
||||
// player
|
||||
return res + Optional.ofNullable(game.getPlayer(game.getInitiativeId()))
|
||||
.map(p -> " (current owner: " + p.getName() + ")")
|
||||
.orElse("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hint copy() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue