File | Line |
---|
net\sf\magicproject\modifier\ObjectAbilityModifier.java | 82 |
net\sf\magicproject\modifier\ObjectPropertyModifier.java | 83 |
StackManager.postRefreshRegisters(to, index);
return next;
}
return super.removeObject(objectName, objectTest);
}
@Override
public int paintObject(Graphics g, int startX, int startY) {
if (main) {
if (startX + 13 > CardFactory.cardWidth) {
return paintObject(g, 3, startY - 16);
}
g.drawImage(objectPicture, startX, startY, 13, 15, null);
return super.paintObject(g, startX + 3, startY);
}
return super.paintObject(g, startX, startY);
}
@Override
public int getNbObjects(String objectName, Test objectTest) {
if (main && objectName.equals(name) && objectTest.test(ability, to)) {
if (next == null) {
return 1;
}
return 1 + next.getNbObjects(objectName, objectTest);
}
return super.getNbObjects(objectName, objectTest);
}
/**
* Picture representing this object
*/
private Image objectPicture;
/**
* is this object modifier is the main modifier
*/
private boolean main;
} |
File | Line |
---|
net\sf\magicproject\expression\HighestAmong.java | 50 |
net\sf\magicproject\expression\LowestAmong.java | 50 |
public LowestAmong(InputStream inputFile) throws IOException {
super();
restrictionZone = inputFile.read() - 1;
test = TestFactory.readNextTest(inputFile);
expr = ExpressionFactory.readNextExpression(inputFile);
}
@Override
public int getValue(Ability ability, Targetable tested,
ContextEventListener context) {
final List<Targetable> validTargets = new ArrayList<Targetable>();
if (restrictionZone != -1) {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
} else {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
}
int lowest = 0; |
File | Line |
---|
net\sf\magicproject\action\AssignDamageSourceDest.java | 84 |
net\sf\magicproject\action\AssignDamageTarget.java | 86 |
final MCard source = StackManager.getRealSource(ability.getCard());
if (!target.isCard() || checkTimeStamp(context, (MCard) target)
&& ((MCard) target).getIdZone() == IdZones.PLAY) {
if (!AssignedDamage.tryAction(source, target, value, type)) {
// this action has been replaced
return false;
}
if (value > 0) {
AssignedDamage.dispatchEvent(source, target, value, type);
}
}
return true;
}
@Override
public String toString(Ability ability) {
try {
if (valueExpr.getValue(ability, null, null) == IdConst.ALL) {
return LanguageManagerMDB.getString("destroy-target");
}
return "" + valueExpr.getValue(ability, null, null) + " "
+ LanguageManagerMDB.getString("damage-target");
} catch (Exception e) {
return "?" + " " + LanguageManagerMDB.getString("damage-target");
}
}
/**
* The complex expression to use for the right value. Is null if the IdToken
* number is not a complex expression.
*/
private Expression valueExpr = null; |
File | Line |
---|
net\sf\magicproject\action\InputColor.java | 94 |
net\sf\magicproject\action\InputProperty.java | 86 |
this, text, properties));
} else {
Log.debug("Waiting for opponent's answer");
}
return false;
}
@Override
public final int getMessagingActionId() {
return IdMessages.COLOR_ANSWER;
}
@Override
protected void setAnswer(int optionAnswer, int indexAnswer,
ContextEventListener context, Ability ability,
ActionContextWrapper actionContext) {
if (optionAnswer == JOptionPane.NO_OPTION) {
((IntValue) registerModifier.valueExpr).value = 0;
} else {
((IntValue) registerModifier.valueExpr).value = indexAnswer;
}
if (actionContext != null) {
actionContext.actionContext = new Int(
((IntValue) registerModifier.valueExpr).value);
}
if (registerModifier.play(context, ability)) {
StackManager.resolveStack();
}
}
@Override
public String toString(Ability ability) {
return LanguageManagerMDB.getString("choosezone.action"); |
File | Line |
---|
net\sf\magicproject\stack\TargetHelper.java | 152 |
net\sf\magicproject\stack\TargetHelper.java | 191 |
if (choiceMode == IdTargets.ALL) {
return true;
}
if (restrictionZone != -1) {
if (StackManager.PLAYERS[0].zoneManager.getContainer(restrictionZone)
.countAllCardsOf(test, ability, hopCounter, canBePreempted) >= hopCounter) {
return true;
}
if (StackManager.PLAYERS[1].zoneManager.getContainer(restrictionZone)
.countAllCardsOf(test, ability, hopCounter, canBePreempted) >= hopCounter) {
return true;
}
} else {
if (StackManager.PLAYERS[0].zoneManager.countAllCardsOf(test, ability,
hopCounter, canBePreempted) >= hopCounter) {
return true;
}
if (StackManager.PLAYERS[1].zoneManager.countAllCardsOf(test, ability,
hopCounter, canBePreempted) >= hopCounter) {
return true;
}
}
// no valid card
return false; |
File | Line |
---|
net\sf\magicproject\xml\action\Givemana.java | 92 |
net\sf\magicproject\xml\action\Paymana.java | 84 |
String braAttr = node.getAttribute("value");
if (braAttr != null) {
MToolKit.writeInt16(out, IdTokens.MANA_POOL); // registe mode
XmlTools.writeTestOn(out, node.getAttribute("card"));
} else {
MToolKit.writeInt16(out, 0); // dummy mode
for (int i = 0; i < IdCommonToken.COLOR_NAMES.length; i++) {
if (node.getAttribute(IdCommonToken.COLOR_NAMES[i]) == null
&& node.get(IdCommonToken.COLOR_NAMES[i]) == null) {
// no such mana to pay for this color, so 0
out.write(IdOperations.INT_VALUE);
MToolKit.writeInt16(out, 0);
} else {
XmlTools.writeAttrOptions(node, IdCommonToken.COLOR_NAMES[i], out);
}
}
}
}
return 1;
}
} |
File | Line |
---|
net\sf\magicproject\tools\Picture.java | 162 |
net\sf\magicproject\tools\Picture.java | 197 |
+ FileUtils.byteCountToDisplaySize(contentLength) + ")");
// Step 2: read and write until done
byte[] buf = new byte[2048];
int currentLength = 0;
boolean succeed = false;
for (int bufferLen = in.read(buf); bufferLen >= 0; bufferLen = in
.read(buf)) {
if (!succeed) {
toDownload.getParentFile().mkdirs();
out = new BufferedOutputStream(new FileOutputStream(localFile));
succeed = true;
}
currentLength += bufferLen;
if (out != null) {
out.write(buf, 0, bufferLen);
}
if (listener != null) {
listener.updateProgress(contentLength, currentLength);
}
}
// Step 3: close streams
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
in = null;
out = null;
return;
} catch (IOException e1) { |
File | Line |
---|
net\sf\magicproject\action\TargetRandomNoEvent.java | 106 |
net\sf\magicproject\expression\HighestAmong.java | 60 |
final List<Targetable> validTargets = new ArrayList<Targetable>();
if (restrictionZone != -1) {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
} else {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
} |
File | Line |
---|
net\sf\magicproject\action\Face.java | 116 |
net\sf\magicproject\action\Tap.java | 82 |
.warn("In TAP action, target list contains non 'Card' object. Ignored");
}
}
}
public void simulate(ActionContextWrapper actionContext,
ContextEventListener context, Ability ability) {
final BooleanArray bContext = new BooleanArray(StackManager.getInstance()
.getTargetedList().size());
actionContext.actionContext = bContext;
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isCard()) {
final MCard card = (MCard) StackManager.getInstance().getTargetedList()
.get(i);
if (card.tapped && !tap || !card.tapped && tap) { |
File | Line |
---|
net\sf\magicproject\expression\Counter.java | 119 |
net\sf\magicproject\test\Has.java | 59 |
}
@Override
public void extractTriggeredEvents(List<MEventListener> res, MCard source,
Test globalTest) {
if (test != null) {
test.extractTriggeredEvents(res, source, globalTest);
if (restrictionZone != -1) {
res.add(new MovedCard(IdZones.PLAY, new InZone(restrictionZone,
TestOn.TESTED), globalTest, source));
res.add(new MovedCard(IdZones.PLAY, True.getInstance(), And.append(
new InZone(restrictionZone, TestOn.TESTED), globalTest), source));
}
}
} |
File | Line |
---|
net\sf\magicproject\chart\datasets\BarDataset.java | 26 |
net\sf\magicproject\chart\datasets\CategoryDataset.java | 26 |
public CategoryDataset(IDataProvider provider, ChartFilter filter) {
super();
this.provider = provider;
this.filter = filter;
this.workingKeys = new ArrayList<IChartKey>();
}
/**
* Add cards to all datasets.
*
* @param cardModel
* the card to add.
* @param amount
* the amount of card to add.
*/
public void addCard(final CardModel cardModel, final int amount) {
for (IChartKey key : provider.getKeys(cardModel, filter)) {
if (workingKeys.contains(key)) {
try {
setValue(key,
new Integer(getValue("My Key", key).intValue() + amount));
} catch (Exception e) {
e.printStackTrace();
}
} else { |
File | Line |
---|
net\sf\magicproject\event\ModifiedRegister.java | 174 |
net\sf\magicproject\event\ModifiedRegister.java | 230 |
if (pSource == SystemCard.instance
&& StackManager.getInstance().getAbilityContext() != null
&& StackManager.triggered.getAbilityContext() instanceof MContextCardCardIntInt
&& ((MContextCardCardIntInt) StackManager.triggered.getAbilityContext())
.getCard2() != null) {
source = ((MContextCardCardIntInt) StackManager.triggered
.getAbilityContext()).getCard2();
}
final int context2 = StackManager.getInstance().getAbilityContext() != null
&& StackManager.triggered.getAbilityContext() instanceof MContextCardCardIntInt ? ((MContextCardCardIntInt) StackManager.triggered
.getAbilityContext()).getValue2()
: 0; |
File | Line |
---|
net\sf\magicproject\action\AddObject.java | 89 |
net\sf\magicproject\action\RemoveObject.java | 90 |
objectName.replaceAll("/", "")).replaceAll("%n", "" + times);
}
@Override
public String toHtmlString(Ability ability, ContextEventListener context) {
if (actionName != null) {
if (actionName.charAt(0) == '%') {
return "";
}
if (actionName.charAt(0) == '@') {
final String picture = ActionFactory.PICTURES.get(actionName);
if (picture != null) {
return toHtmlString(ability, picture);
}
} else {
return LanguageManagerMDB.getString(actionName);
}
}
return LanguageManagerMDB.getString("removeobject-1", objectName |
File | Line |
---|
net\sf\magicproject\action\ZoneVisibility.java | 177 |
net\sf\magicproject\action\ZoneVisibility.java | 218 |
public boolean replay(ActionContextWrapper actionContext,
ContextEventListener context, Ability ability) {
ObjectArray<Visibility> contextN = (ObjectArray<Visibility>) actionContext.actionContext;
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isPlayer()) {
final Player player = (Player) StackManager.getInstance()
.getTargetedList().get(i);
player.zoneManager.getContainer(idZone).setVisibility(
contextN.getObject(i * 2 + 1)); |
File | Line |
---|
net\sf\magicproject\action\objectmap\ObjectMapRemove.java | 59 |
net\sf\magicproject\action\objectmap\ObjectMapSave.java | 65 |
testOn.getTargetable(ability, null));
return true;
}
@Override
public String toString(Ability ability) {
return "";
}
public void simulate(ActionContextWrapper actionContext,
ContextEventListener context, Ability ability) {
final Wrapper<Targetable> mapContext = new Wrapper<Targetable>();
actionContext.actionContext = mapContext;
mapContext.setObject(ability.getTargetable().getPrivateNamedObject(
objectName));
play(context, ability);
}
public void rollback(ActionContextWrapper actionContext,
ContextEventListener context, Ability ability) {
final Targetable oldTargetable = ((Wrapper<Targetable>) actionContext.actionContext)
.getObject();
if (oldTargetable == null) { |
File | Line |
---|
net\sf\magicproject\action\Face.java | 97 |
net\sf\magicproject\action\Tap.java | 68 |
}
public void rollback(ActionContextWrapper actionContext,
ContextEventListener context, Ability ability) {
final BooleanArray bContext = (BooleanArray) actionContext.actionContext;
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isCard()) {
final MCard card = (MCard) StackManager.getInstance().getTargetedList()
.get(i);
if (bContext.getBoolean(i)) {
card.tap(!tap); |
File | Line |
---|
net\sf\magicproject\action\ZoneVisibility.java | 129 |
net\sf\magicproject\action\ZoneVisibility.java | 144 |
case opponent:
// set the visibility of card for opponent
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isPlayer()) {
final Player player = (Player) StackManager.getInstance()
.getTargetedList().get(i);
Visibility visibility = player.zoneManager.getContainer(idZone).visibility;
contextN.setObject(i, visibility);
contextN.setObject(2 * i + 1, visible ? visibility.increaseFor(player |
File | Line |
---|
net\sf\magicproject\action\ZoneVisibility.java | 129 |
net\sf\magicproject\action\ZoneVisibility.java | 159 |
default:
// set the visibility of card for you
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isPlayer()) {
final Player player = (Player) StackManager.getInstance()
.getTargetedList().get(i);
Visibility visibility = player.zoneManager.getContainer(idZone).visibility;
contextN.setObject(i, visibility);
contextN.setObject(2 * i + 1, visible ? visibility
.increaseFor(StackManager.getSpellController()) : visibility |
File | Line |
---|
net\sf\magicproject\action\objectmap\ObjectMap.java | 50 |
net\sf\magicproject\action\targetlist\TargetList.java | 57 |
listIndex = ExpressionFactory.readNextExpression(inputFile);
}
@Override
public final Actiontype getIdAction() {
return Actiontype.TARGET_LIST;
}
public abstract boolean play(ContextEventListener context, Ability ability);
@Override
public abstract String toString(Ability ability);
@Override
public final String toHtmlString(Ability ability, int times,
ContextEventListener context) {
if (actionName != null && actionName.charAt(0) != '%'
&& actionName.charAt(0) != '@' && actionName.indexOf("%n") != -1) {
return super.toHtmlString(ability, times, context);
}
return "";
} |
File | Line |
---|
net\sf\magicproject\action\TargetAllNoEvent.java | 97 |
net\sf\magicproject\action\TargetAllNoEvent.java | 127 |
if (restrictionZone != -1) {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
} else {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
}
break; |
File | Line |
---|
net\sf\magicproject\action\TargetAllNoEvent.java | 97 |
net\sf\magicproject\action\TargetRandomNoEvent.java | 107 |
if (restrictionZone != -1) {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.getContainer(restrictionZone).checkAllCardsOf(test, validTargets,
ability);
} else {
StackManager.PLAYERS[StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
StackManager.PLAYERS[1 - StackManager.idCurrentPlayer].zoneManager
.checkAllCardsOf(test, validTargets, ability);
} |
File | Line |
---|
net\sf\magicproject\action\AddObject.java | 89 |
net\sf\magicproject\action\MoveObject.java | 94 |
to.toString() }).replaceAll("%n", "" + times);
}
@Override
public String toHtmlString(Ability ability, ContextEventListener context) {
if (actionName != null) {
if (actionName.charAt(0) == '%') {
return "";
}
if (actionName.charAt(0) == '@') {
final String picture = ActionFactory.PICTURES.get(actionName);
if (picture != null) {
return toHtmlString(ability, picture);
}
} else {
return LanguageManagerMDB.getString(actionName);
}
}
return LanguageManagerMDB.getString("moveobject-1", new String[] { |
File | Line |
---|
net\sf\magicproject\xml\tbs\Replacementability.java | 86 |
net\sf\magicproject\xml\tbs\Systemability.java | 63 |
node.addAttribute(new XmlParser.Attribute("zone", "play"));
Iterator<?> it = node.iterator();
XmlTools.defaultOnMeTag = false;
while (it.hasNext()) {
Object obj = it.next();
if (obj instanceof XmlParser.Node) {
XmlParser.Node child = (XmlParser.Node) obj;
if ("text".equals(child.getTag())) {
System.out.println("text element in ability is not yet implement");
} else {
XmlEvent.getEvent(child.getTag()).buildMdb(child, out);
break;
}
}
} |
File | Line |
---|
net\sf\magicproject\action\ZoneVisibility.java | 82 |
net\sf\magicproject\action\ZoneVisibility.java | 94 |
} else if (idFor == VisibilityChange.opponent) {
// set the visibility of card for opponent
for (int i = StackManager.getInstance().getTargetedList().size(); i-- > 0;) {
if (StackManager.getInstance().getTargetedList().get(i).isPlayer()) {
final Player player = (Player) StackManager.getInstance()
.getTargetedList().get(i);
Visibility visibility = player.zoneManager.getContainer(idZone).visibility;
player.zoneManager.getContainer(idZone).setVisibility(
visible ? visibility.increaseFor(player.getOpponent()) |