mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added the function removeAll to CardList to remove all instances of a card from it (I was shocked that we didn't have this, or am I missing something?).
- Fixed some possible bugs of assigning blockers twice in ComputerUtil_Block2.
This commit is contained in:
@@ -575,6 +575,17 @@ public class CardList implements Iterable<Card> {
|
|||||||
list.remove(c);
|
list.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>removeAll.</p>
|
||||||
|
*
|
||||||
|
* @param c a {@link forge.Card} object.
|
||||||
|
*/
|
||||||
|
public void removeAll(Card c) {
|
||||||
|
ArrayList<Card> cList = new ArrayList<Card>();
|
||||||
|
cList.add(c);
|
||||||
|
list.removeAll(cList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>clear.</p>
|
* <p>clear.</p>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ public class ComputerUtil_Block2 {
|
|||||||
&& CardFactoryUtil.evaluateCreature(blocker) + getDiff() < CardFactoryUtil.evaluateCreature(attacker)
|
&& CardFactoryUtil.evaluateCreature(blocker) + getDiff() < CardFactoryUtil.evaluateCreature(attacker)
|
||||||
&& CombatUtil.canBlock(attacker, blocker, combat)) {
|
&& CombatUtil.canBlock(attacker, blocker, combat)) {
|
||||||
combat.addBlocker(attacker, blocker);
|
combat.addBlocker(attacker, blocker);
|
||||||
getBlockersLeft().remove(blocker);
|
getBlockersLeft().removeAll(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -630,7 +630,7 @@ public class ComputerUtil_Block2 {
|
|||||||
for (Card blocker : blockers) {
|
for (Card blocker : blockers) {
|
||||||
if (CombatUtil.canBlock(attacker, blocker, combat)) {
|
if (CombatUtil.canBlock(attacker, blocker, combat)) {
|
||||||
combat.addBlocker(attacker, blocker);
|
combat.addBlocker(attacker, blocker);
|
||||||
getBlockersLeft().remove(blocker);
|
getBlockersLeft().removeAll(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user