added method to get stack item based on event

master
melvin 2011-08-10 11:16:54 +08:00
parent a1cfc8f2ce
commit a18fe6b0b5
1 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import magic.model.MagicCopyMap;
import magic.model.MagicPlayer;
import magic.model.MagicSource;
import magic.model.event.MagicActivation;
import magic.model.event.MagicEvent;
public class MagicStack extends LinkedList<MagicItemOnStack> {
@ -28,6 +29,15 @@ public class MagicStack extends LinkedList<MagicItemOnStack> {
}
}
public MagicItemOnStack get(final MagicEvent event) {
for (final MagicItemOnStack item : this) {
if (item.getEvent() == event) {
return item;
}
}
return null;
}
private void addCount(final MagicItemOnStack itemOnStack) {
final int index=itemOnStack.getController().getIndex();
counts[index]++;