mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Fixed BlockedCreatureCount handling.
This commit is contained in:
parent
48be09ad52
commit
b41c4822e9
6 changed files with 27 additions and 26 deletions
|
|
@ -38,27 +38,37 @@ import mage.game.combat.CombatGroup;
|
|||
* @author Markedagain
|
||||
*/
|
||||
public class BlockedCreatureCount implements DynamicValue {
|
||||
|
||||
private String message;
|
||||
boolean beyondTheFirst;
|
||||
|
||||
public BlockedCreatureCount() {
|
||||
this("each creature blocking it");
|
||||
}
|
||||
|
||||
public BlockedCreatureCount(String message) {
|
||||
this(message, false);
|
||||
}
|
||||
|
||||
public BlockedCreatureCount(String message, boolean beyondTheFist) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) {
|
||||
super();
|
||||
this.message = dynamicValue.message;
|
||||
this.beyondTheFirst = dynamicValue.beyondTheFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers) : 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
if (beyondTheFirst) {
|
||||
blockers = blockers > 0 ? blockers - 1 : 0;
|
||||
}
|
||||
return blockers;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue