Merge pull request #5 from magefree/master

Merge
This commit is contained in:
Blinke 2015-12-02 17:28:38 +01:00
commit 37018599e5
3302 changed files with 90348 additions and 10590 deletions

1
.gitignore vendored
View file

@ -18,6 +18,7 @@ Mage.Server.Plugins/Mage.Deck.Limited/target
Mage.Server.Plugins/Mage.Game.CommanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/target/
Mage.Server.Plugins/Mage.Game.FreeForAll/target
Mage.Server.Plugins/Mage.Game.MomirDuel/target
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -0,0 +1,78 @@
1 [C15:77] Open the Vaults
1 [C15:76] Monk Idealist
1 [C15:75] Mesa Enchantress
1 [C15:74] Marshal's Anthem
1 [C15:73] Kor Sanctifiers
1 [C15:281] Command Tower
1 [C15:72] Karmic Justice
1 [C15:283] Evolving Wilds
1 [C15:70] Ghostblade Eidolon
1 [C15:285] Ghost Quarter
1 [C15:121] Doomwake Giant
1 [C15:122] Dreadbringer Lampads
1 [C15:320] Vivid Meadow
1 [C15:125] Fallen Ideal
11 [C15:323] Plains
1 [C15:126] Fate Unraveler
1 [C15:79] Seal of Cleansing
1 [C15:248] Burnished Hart
1 [C15:127] Gild
1 [C15:128] Grave Peril
1 [C15:129] Nighthowler
1 [C15:80] Sigil of the Empty Throne
1 [C15:84] Vow of Duty
1 [C15:81] Silent Sentinel
1 [C15:274] Wayfarer's Bauble
1 [C15:277] Barren Moor
1 [C15:234] Teysa, Envoy of Ghosts
1 [C15:311] Tainted Field
1 [C15:235] Treasury Thrull
1 [C15:114] Ancient Craving
1 [C15:46] Karlov of the Ghost Council
1 [C15:313] Temple of the False God
1 [C15:237] Underworld Coinsmith
1 [C15:116] Black Market
1 [C15:314] Terramorphic Expanse
1 [C15:319] Vivid Marsh
1 [C15:55] Thought Vessel
1 [C15:52] Sandstone Oracle
1 [C15:261] Orzhov Cluestone
1 [C15:140] Vow of Malice
1 [C15:262] Orzhov Signet
1 [C15:19] Deadly Tempest
1 [C15:18] Daxos's Torment
1 [C15:17] Corpse Augur
1 [C15:16] Banshee of the Dread Choir
1 [C15:268] Sol Ring
1 [C15:301] Reliquary Tower
1 [C15:57] Ajani's Chosen
1 [C15:302] Scoured Barrens
1 [C15:303] Secluded Steppe
1 [C15:229] Necromancer's Covenant
1 [C15:22] Thief of Blood
1 [C15:66] Dawn to Dusk
1 [C15:64] Celestial Archon
1 [C15:63] Celestial Ancient
1 [C15:62] Cage of Hands
1 [C15:61] Banishing Light
1 [C15:250] Crystal Chimes
1 [C15:60] Aura of Silence
1 [C15:130] Phyrexian Arena
1 [C15:295] New Benalia
1 [C15:133] Phyrexian Reclamation
1 [C15:298] Orzhov Basilica
13 [C15:331] Swamp
1 [C15:299] Orzhov Guildgate
1 [C15:135] Seal of Doom
1 [C15:257] Lightning Greaves
1 [C15:8] Shielded by Faith
1 [C15:68] Dictate of Heliod
1 [C15:67] Dawnglare Invoker
1 [C15:138] Underworld Connections
1 [C15:7] Righteous Confluence
1 [C15:215] Death Grasp
1 [C15:6] Oreskos Explorer
1 [C15:4] Herald of the Host
1 [C15:3] Grasp of Fate
1 [C15:1] Bastion Protector
SB: 1 [C15:43] Daxos the Returned

View file

@ -0,0 +1,77 @@
1 [C15:33] Bloodspore Thrinax
1 [C15:281] Command Tower
1 [C15:283] Evolving Wilds
1 [C15:120] Diabolic Servitude
1 [C15:286] Golgari Guildgate
1 [C15:39] Skullwinder
1 [C15:287] Golgari Rot Farm
1 [C15:200] Sakura-Tribe Elder
1 [C15:38] Pathbreaker Ibex
1 [C15:123] Eater of Hope
1 [C15:288] Grim Backwoods
1 [C15:201] Satyr Wayfinder
1 [C15:37] Great Oak Guardian
1 [C15:124] Extractor Demon
1 [C15:245] Bonehoard
1 [C15:289] High Market
1 [C15:202] Spider Spawning
1 [C15:35] Centaur Vinecrasher
1 [C15:34] Caller of the Pack
1 [C15:204] Terastodon
1 [C15:206] Tribute to the Wild
1 [C15:207] Verdant Force
1 [C15:208] Viridian Emissary
1 [C15:191] Mulch
1 [C15:192] Mycoloth
1 [C15:196] Overwhelming Stampede
1 [C15:198] Primal Growth
1 [C15:232] Putrefy
1 [C15:112] Altar's Reap
1 [C15:48] Mazirek, Kraul Death Priest
1 [C15:113] Ambition's Cost
1 [C15:312] Tainted Wood
1 [C15:115] Barter in Blood
1 [C15:314] Terramorphic Expanse
1 [C15:117] Blood Bairn
1 [C15:238] Vulturous Zombie
1 [C15:118] Butcher of Malakir
1 [C15:119] Champion of Stray Souls
1 [C15:318] Vivid Grove
1 [C15:319] Vivid Marsh
1 [C15:55] Thought Vessel
1 [C15:183] Eternal Witness
1 [C15:186] Indrik Stomphowler
1 [C15:187] Kessig Cagebreakers
1 [C15:17] Corpse Augur
1 [C15:221] Golgari Charm
1 [C15:16] Banshee of the Dread Choir
1 [C15:222] Grisly Salvage
1 [C15:223] Jarad, Golgari Lich Lord
1 [C15:267] Skullclamp
1 [C15:300] Polluted Mire
1 [C15:224] Korozda Guildmage
1 [C15:268] Sol Ring
1 [C15:226] Lotleth Troll
1 [C15:307] Slippery Karst
1 [C15:22] Thief of Blood
1 [C15:21] Scourge of Nel Toth
1 [C15:20] Dread Summons
1 [C15:292] Jungle Hollow
1 [C15:173] Acidic Slime
1 [C15:131] Phyrexian Plaguelord
1 [C15:132] Phyrexian Rager
1 [C15:253] Eldrazi Monument
1 [C15:210] Viridian Zealot
13 [C15:331] Swamp
1 [C15:211] Wall of Blossoms
1 [C15:255] Golgari Signet
1 [C15:134] Rise from the Grave
1 [C15:212] Wood Elves
1 [C15:179] Cloudthresher
1 [C15:257] Lightning Greaves
1 [C15:136] Sever the Bloodline
1 [C15:137] Shriekmaw
1 [C15:23] Wretched Confluence
1 [C15:139] Victimize
12 [C15:339] Forest
SB: 1 [C15:49] Meren of Clan Nel Toth

View file

@ -0,0 +1,75 @@
1 [C15:31] Warchief Giant
1 [C15:30] Rite of the Raging Storm
1 [C15:281] Command Tower
1 [C15:162] Magmaquake
1 [C15:283] Evolving Wilds
1 [C15:163] Mizzium Mortars
1 [C15:240] Call the Skybreaker
1 [C15:169] Urza's Rage
14 [C15:327] Island
1 [C15:88] Blue Sun's Zenith
1 [C15:87] Blatant Thievery
1 [C15:42] Arjun, the Shifting Flame
1 [C15:85] AEtherize
1 [C15:151] Dragon Mage
1 [C15:153] Faithless Looting
1 [C15:275] Worn Powerstone
1 [C15:110] Thought Reflection
1 [C15:231] Prophetic Bolt
1 [C15:111] Windfall
1 [C15:233] Steam Augury
1 [C15:310] Swiftwater Cliffs
1 [C15:313] Temple of the False God
1 [C15:89] Blustersquall
1 [C15:314] Terramorphic Expanse
1 [C15:316] Vivid Crag
1 [C15:317] Vivid Creek
1 [C15:90] Brainstorm
1 [C15:11] Gigantoplasm
1 [C15:55] Thought Vessel
1 [C15:10] Broodbirth Viper
1 [C15:54] Seal of the Guildpact
1 [C15:98] Mystic Retrieval
1 [C15:96] Lone Revenant
1 [C15:95] Jace's Archivist
1 [C15:94] Fact or Fiction
1 [C15:93] Echoing Truth
1 [C15:141] Act of Aggression
1 [C15:92] Dominate
1 [C15:263] Psychosis Crawler
1 [C15:220] Goblin Electromancer
1 [C15:144] Chain Reaction
1 [C15:145] Charmbreaker Devils
1 [C15:101] Preordain
1 [C15:146] Comet Storm
1 [C15:268] Sol Ring
1 [C15:103] Reins of Power
1 [C15:14] Mystic Confluence
1 [C15:301] Reliquary Tower
1 [C15:302] Rogue's Passage
1 [C15:13] Mirror Match
1 [C15:104] Repeal
1 [C15:12] Illusory Ambusher
1 [C15:149] Desperate Ravings
1 [C15:105] Rite of Replication
1 [C15:227] Melek, Izzet Paragon
1 [C15:106] Sleep
1 [C15:107] Stolen Goods
1 [C15:108] Stroke of Genius
1 [C15:109] Talrand, Sky Summoner
1 [C15:309] Spinerock Knoll
1 [C15:290] Izzet Boilerworks
1 [C15:170] Vandalblast
1 [C15:291] Izzet Guildgate
1 [C15:172] Word of Seizing
1 [C15:29] Mizzix's Mastery
1 [C15:28] Meteor Blast
1 [C15:256] Izzet Signet
1 [C15:9] AEthersnatch
1 [C15:24] Awaken the Sky Tyrant
1 [C15:214] Counterflux
13 [C15:335] Mountain
1 [C15:216] Epic Experiment
1 [C15:217] Etherium-Horn Sorcerer
1 [C15:218] Firemind's Foresight
SB: 1 [C15:50] Mizzix of the Izmagnus

View file

@ -0,0 +1,77 @@
1 [C15:32] Arachnogenesis
1 [C15:281] Command Tower
1 [C15:283] Evolving Wilds
1 [C15:241] Cold-Eyed Selkie
1 [C15:242] Snakeform
1 [C15:39] Skullwinder
1 [C15:243] Wistful Selkie
1 [C15:200] Sakura-Tribe Elder
1 [C15:37] Great Oak Guardian
1 [C15:289] High Market
1 [C15:322] Zoetic Cavern
1 [C15:36] Ezuri's Predation
1 [C15:203] Stingerfling Spider
1 [C15:34] Caller of the Pack
1 [C15:205] Thelonite Hermit
11 [C15:327] Island
1 [C15:209] Viridian Shaman
1 [C15:190] Loaming Shaman
1 [C15:86] Bident of Thassa
1 [C15:193] Noble Quarry
1 [C15:40] Verdant Confluence
1 [C15:194] Ohran Viper
1 [C15:271] Swiftfoot Boots
1 [C15:272] Sword of Vengeance
1 [C15:195] Overrun
1 [C15:197] Patagia Viper
1 [C15:230] Prime Speaker Zegana
1 [C15:199] Rampant Growth
1 [C15:47] Kaseto, Orochi Archmage
1 [C15:236] Trygon Predator
1 [C15:314] Terramorphic Expanse
1 [C15:315] Thornwood Falls
1 [C15:239] Biomantic Mastery
1 [C15:317] Vivid Creek
1 [C15:318] Vivid Grove
1 [C15:91] Day of the Dragons
1 [C15:99] Ninja of the Deep Hours
1 [C15:55] Thought Vessel
1 [C15:10] Broodbirth Viper
1 [C15:97] Mulldrifter
1 [C15:53] Scytheclaw
1 [C15:180] Cobra Trap
1 [C15:181] Desert Twister
1 [C15:182] Elvish Visionary
1 [C15:183] Eternal Witness
1 [C15:260] Orochi Hatchery
1 [C15:184] Experiment One
1 [C15:185] Forgotten Ancient
1 [C15:100] Plaxmanta
1 [C15:265] Simic Keyrune
1 [C15:188] Kodama's Reach
1 [C15:266] Simic Signet
1 [C15:189] Krosan Grip
1 [C15:102] Rapid Hybridization
1 [C15:15] Synthetic Destiny
1 [C15:268] Sol Ring
1 [C15:301] Reliquary Tower
1 [C15:225] Lorescale Coatl
1 [C15:269] Solemn Simulacrum
1 [C15:13] Mirror Match
1 [C15:12] Illusory Ambusher
1 [C15:56] Command Beacon
1 [C15:228] Mystic Snake
1 [C15:305] Simic Growth Chamber
1 [C15:306] Simic Guildgate
1 [C15:293] Llanowar Reborn
1 [C15:294] Mosswort Bridge
1 [C15:174] Arbor Colossus
1 [C15:175] Bane of Progress
1 [C15:296] Novijen, Heart of Progress
1 [C15:176] Beastmaster Ascension
1 [C15:297] Oran-Rief, the Vastwood
1 [C15:177] Caller of the Claw
1 [C15:178] Chameleon Colossus
1 [C15:213] Coiling Oracle
14 [C15:339] Forest
SB: 1 [C15:44] Ezuri, Claw of Progress

View file

@ -0,0 +1,77 @@
1 [C15:31] Warchief Giant
1 [C15:30] Rite of the Raging Storm
1 [C15:280] Boros Guildgate
1 [C15:160] Inferno Titan
1 [C15:281] Command Tower
1 [C15:161] Magma Giant
1 [C15:282] Drifting Meadow
1 [C15:71] Jareth, Leonine Titan
1 [C15:283] Evolving Wilds
1 [C15:284] Forgotten Cave
1 [C15:164] Stinkdrinker Daredevil
1 [C15:165] Stoneshock Giant
1 [C15:166] Sunrise Sovereign
1 [C15:320] Vivid Meadow
1 [C15:167] Taurean Mauler
1 [C15:244] Basalt Monolith
1 [C15:321] Wind-Scarred Crag
1 [C15:168] Thundercloud Shaman
1 [C15:246] Boros Cluestone
11 [C15:323] Plains
1 [C15:247] Boros Signet
1 [C15:78] Orim's Thunder
1 [C15:249] Coldsteel Heart
1 [C15:41] Anya, Merciless Angel
1 [C15:270] Staff of Nin
1 [C15:83] Victory's Herald
1 [C15:150] Disaster Radius
1 [C15:82] Sun Titan
1 [C15:273] Urza's Incubator
1 [C15:152] Earthquake
1 [C15:275] Worn Powerstone
1 [C15:154] Fall of the Hammer
1 [C15:155] Fumiko the Lowblood
1 [C15:276] Ancient Amphitheater
1 [C15:156] Hamletback Goliath
1 [C15:157] Hammerfist Giant
1 [C15:278] Blasted Landscape
1 [C15:158] Hostility
1 [C15:279] Boros Garrison
1 [C15:159] Hunted Dragon
1 [C15:314] Terramorphic Expanse
1 [C15:316] Vivid Crag
1 [C15:55] Thought Vessel
1 [C15:52] Sandstone Oracle
1 [C15:51] Blade of Selves
1 [C15:142] Borderland Behemoth
1 [C15:264] Seer's Sundial
1 [C15:143] Breath of Darigaaz
1 [C15:59] Arbiter of Knollridge
1 [C15:58] Angel of Serenity
1 [C15:268] Sol Ring
1 [C15:147] Curse of the Nightly Hunt
1 [C15:148] Desolation Giant
1 [C15:303] Secluded Steppe
1 [C15:308] Smoldering Crater
1 [C15:65] Crib Swap
1 [C15:171] Warstorm Surge
1 [C15:61] Banishing Light
1 [C15:251] Darksteel Ingot
1 [C15:252] Dreamstone Hedron
1 [C15:254] Fellwar Stone
1 [C15:28] Meteor Blast
1 [C15:27] Magus of the Wheel
1 [C15:26] Fiery Confluence
1 [C15:25] Dream Pillager
1 [C15:257] Lightning Greaves
1 [C15:69] Faith's Fetters
1 [C15:258] Loxodon Warhammer
14 [C15:335] Mountain
1 [C15:67] Dawnglare Invoker
1 [C15:259] Mind Stone
1 [C15:6] Oreskos Explorer
1 [C15:5] Kalemne's Captain
1 [C15:4] Herald of the Host
1 [C15:219] Gisela, Blade of Goldnight
1 [C15:2] Dawnbreak Reclaimer
SB: 1 [C15:45] Kalemne, Disciple of Iroas

View file

@ -0,0 +1,23 @@
NAME:Mormir Basic
3 [BFZ:259] Island
3 [BFZ:261] Swamp
3 [BFZ:250] Plains
3 [BFZ:272] Forest
3 [BFZ:260] Swamp
3 [BFZ:271] Forest
3 [BFZ:270] Forest
3 [BFZ:265] Mountain
2 [BFZ:254] Plains
3 [BFZ:264] Swamp
3 [BFZ:274] Forest
1 [BFZ:252] Plains
3 [BFZ:262] Swamp
3 [BFZ:251] Plains
2 [BFZ:273] Forest
3 [BFZ:258] Island
2 [BFZ:269] Mountain
3 [BFZ:268] Mountain
3 [BFZ:257] Island
3 [BFZ:267] Mountain
3 [BFZ:266] Mountain
2 [BFZ:255] Island

View file

@ -83,7 +83,7 @@ import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.client.cards.BigCard;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.components.MageComponents;
import mage.client.components.MageDesktopManager;
import mage.client.components.MageJDesktop;
@ -165,7 +165,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private static boolean grayMode = false;
private static boolean fullscreenMode = false;
private static final Map<UUID, ChatPanel> chats = new HashMap<>();
private static final Map<UUID, ChatPanelBasic> chats = new HashMap<>();
private static final Map<UUID, GamePanel> games = new HashMap<>();
private static final Map<UUID, DraftPanel> drafts = new HashMap<>();
private static final MageUI ui = new MageUI();
@ -372,8 +372,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private void setWindowTitle() {
setTitle(TITLE_NAME + " Client: "
+ version == null ? "<not available>" : version.toString() + " Server: "
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
+ (version == null ? "<not available>" : version.toString()) + " Server: "
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
}
private void addTooltipContainer() {
@ -1250,11 +1250,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
return ui;
}
public static ChatPanel getChat(UUID chatId) {
public static ChatPanelBasic getChat(UUID chatId) {
return chats.get(chatId);
}
public static void addChat(UUID chatId, ChatPanel chatPanel) {
public static void addChat(UUID chatId, ChatPanelBasic chatPanel) {
chats.put(chatId, chatPanel);
}

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtMessage" max="32767" attributes="0"/>
<Component id="jScrollPaneTxt" pref="193" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jScrollPaneTxt" pref="175" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="txtMessage" min="-2" pref="30" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPaneTxt">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="mage.client.components.ColorPane" name="txtConversation">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="focusCycleRoot" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 2, 2, 2]"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JTextField" name="txtMessage">
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -35,82 +35,65 @@ package mage.client.chat;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import javax.swing.Icon;
import javax.swing.JTextField;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import mage.client.MageFrame;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
import mage.client.util.MageTableRowSorter;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
import mage.remote.MageRemoteException;
import mage.remote.Session;
import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType;
import mage.view.RoomUsersView;
import mage.view.UsersView;
import org.mage.card.arcane.ManaSymbols;
/**
*
* @author BetaSteward_at_googlemail.com, nantuko
*/
public class ChatPanel extends javax.swing.JPanel {
public class ChatPanelBasic extends javax.swing.JPanel {
private UUID chatId;
private Session session;
private final List<String> players = new ArrayList<>();
private final UserTableModel userTableModel;
protected UUID chatId;
protected Session session;
/**
* Chat message color for opponents.
*/
private static final String OPPONENT_COLOR = "#FF7F50";
protected static final String OPPONENT_COLOR = "#FF7F50";
/**
* Chat message color for client player.
*/
private static final String MY_COLOR = "#7FFFD4";
protected static final String MY_COLOR = "#7FFFD4";
/**
* Chat message color for timestamps.
*/
private static final String TIMESTAMP_COLOR = "#CCCC33";
protected static final String TIMESTAMP_COLOR = "#CCCC33";
/**
* Chat message color for messages.
*/
private static final String MESSAGE_COLOR = "White";
protected static final String MESSAGE_COLOR = "White";
/**
* Chat message color for personal infos.
*/
private static final String USER_INFO_COLOR = "Yellow";
protected static final String USER_INFO_COLOR = "Yellow";
/**
* Chat message color for status infos.
*/
private static final String STATUS_COLOR = "#FFCC33";
protected static final String STATUS_COLOR = "#FFCC33";
/**
* Alpha value for transparency (255 = not transparent)
*/
private static final int ALPHA = 80;
public static final int CHAT_ALPHA = 80;
/**
* This will be a chat that will be connected to {this} and will handle
* redirected messages; Mostly used to redirect user messages to another
* window.
*/
private ChatPanel connectedChat;
protected ChatPanelBasic connectedChat;
/**
* Parent chat this chat connected to. Used to send messages using parent
* chat as it is the only one connected to server.
*/
private ChatPanel parentChatRef;
protected ChatPanelBasic parentChatRef;
/**
* Selected extended view mode.
*/
private VIEW_MODE extendedViewMode = VIEW_MODE.NONE;
protected VIEW_MODE extendedViewMode = VIEW_MODE.NONE;
public enum VIEW_MODE {
@ -120,57 +103,31 @@ public class ChatPanel extends javax.swing.JPanel {
* Controls the output start messages as the chat panel is created
*
*/
private ChatType chatType = ChatType.DEFAULT;
private static final int[] defaultColumnsWidth = {20, 100, 100, 80, 80};
protected ChatType chatType = ChatType.DEFAULT;
public enum ChatType {
DEFAULT, GAME, TABLES, TOURNAMENT
}
private boolean startMessageDone = false;
protected boolean startMessageDone = false;
/**
* Creates new form ChatPanel
*/
public ChatPanel() {
this(false);
}
/**
* @param addPlayersTab if true, adds chat/players tabs
*/
/**
*
* Creates new form ChatPanel
*
* @param addPlayersTab
*/
public ChatPanel(boolean addPlayersTab) {
userTableModel = new UserTableModel();
public ChatPanelBasic() {
initComponents();
setBackground(new Color(0, 0, 0, ALPHA));
jTablePlayers.setBackground(new Color(0, 0, 0, ALPHA));
jTablePlayers.setForeground(Color.white);
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setBackground(new Color(0, 0, 0, ALPHA));
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, ALPHA));
}
if (jScrollPanePlayers != null) {
jScrollPanePlayers.setBackground(new Color(0, 0, 0, ALPHA));
jScrollPanePlayers.getViewport().setBackground(new Color(0, 0, 0, ALPHA));
}
if (!addPlayersTab) {
simplifyComponents();
jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
}
}
public void cleanUp() {
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
}
public ChatType getChatType() {
@ -254,7 +211,7 @@ public class ChatPanel extends javax.swing.JPanel {
this.txtConversation.append(text.toString());
}
private String getColoredText(String color, String text) {
protected String getColoredText(String color, String text) {
StringBuilder sb = new StringBuilder();
sb.append("<font color='");
sb.append(color);
@ -268,23 +225,23 @@ public class ChatPanel extends javax.swing.JPanel {
return txtConversation.getText();
}
public ChatPanel getConnectedChat() {
public ChatPanelBasic getConnectedChat() {
return connectedChat;
}
public void setConnectedChat(ChatPanel connectedChat) {
public void setConnectedChat(ChatPanelBasic connectedChat) {
this.connectedChat = connectedChat;
}
public void setParentChat(ChatPanel parentChatRef) {
public void setParentChat(ChatPanelBasic parentChatRef) {
this.parentChatRef = parentChatRef;
}
public ChatPanel getParentChatRef() {
public ChatPanelBasic getParentChatRef() {
return parentChatRef;
}
public void setParentChatRef(ChatPanel parentChatRef) {
public void setParentChatRef(ChatPanelBasic parentChatRef) {
this.parentChatRef = parentChatRef;
}
@ -303,104 +260,14 @@ public class ChatPanel extends javax.swing.JPanel {
case GAME:
case TABLES:
case DEFAULT:
alpha = ALPHA;
alpha = CHAT_ALPHA;
}
this.txtConversation.setExtBackgroundColor(new Color(0, 0, 0, alpha)); // Alpha = 255 not transparent
// this.txtConversation.setBackground(new Color(0, 0, 0, 0));
// this.txtConversation.setForeground(new Color(255, 255, 255));
this.txtConversation.setSelectionColor(Color.LIGHT_GRAY);
this.jScrollPaneTxt.setOpaque(alpha == 255);
this.jScrollPaneTxt.getViewport().setOpaque(!chatType.equals(ChatType.TABLES));
}
public void setSplitDividerLocation(int location) {
if (jSplitPane1 != null) {
jSplitPane1.setDividerLocation(location);
}
}
public int getSplitDividerLocation() {
if (jSplitPane1 == null) {
return 0;
}
return this.jSplitPane1.getDividerLocation();
}
class UserTableModel extends AbstractTableModel {
private final String[] columnNames = new String[]{"Loc", "Players", "Info", "Games", "Connection"};
private UsersView[] players = new UsersView[0];
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
RoomUsersView roomUserInfo = roomUserInfoList.iterator().next();
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
JTableHeader th = jTablePlayers.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
"Games " + roomUserInfo.getNumberActiveGames()
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
th.repaint();
this.fireTableDataChanged();
}
@Override
public int getRowCount() {
return players.length;
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public Object getValueAt(int arg0, int arg1) {
switch (arg1) {
case 0:
return players[arg0].getFlagName();
case 1:
return players[arg0].getUserName();
case 2:
return players[arg0].getInfoState();
case 3:
return players[arg0].getInfoGames();
case 4:
return players[arg0].getInfoPing();
}
return "";
}
@Override
public String getColumnName(int columnIndex) {
String colName = "";
if (columnIndex <= getColumnCount()) {
colName = columnNames[columnIndex];
}
return colName;
}
@Override
public Class getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return Icon.class;
default:
return String.class;
}
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
}
public void clear() {
this.txtConversation.setText("");
}
@ -414,18 +281,10 @@ public class ChatPanel extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPaneTxt = new javax.swing.JScrollPane();
txtConversation = new mage.client.components.ColorPane();
jScrollPanePlayers = new javax.swing.JScrollPane();
jTablePlayers = new javax.swing.JTable();
txtMessage = new javax.swing.JTextField();
jSplitPane1.setBorder(null);
jSplitPane1.setDividerSize(10);
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane1.setResizeWeight(0.25);
jScrollPaneTxt.setBorder(null);
txtConversation.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
@ -435,25 +294,6 @@ public class ChatPanel extends javax.swing.JPanel {
txtConversation.setOpaque(false);
jScrollPaneTxt.setViewportView(txtConversation);
jSplitPane1.setRightComponent(jScrollPaneTxt);
jScrollPanePlayers.setBorder(null);
jTablePlayers.setModel(this.userTableModel);
jTablePlayers.setToolTipText("Connected players");
jTablePlayers.setAutoscrolls(false);
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jTablePlayers.setFocusable(false);
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
jTablePlayers.setOpaque(false);
jTablePlayers.setRequestFocusEnabled(false);
jTablePlayers.setRowSelectionAllowed(false);
jTablePlayers.setUpdateSelectionOnSort(false);
jTablePlayers.setVerifyInputWhenFocusTarget(false);
jScrollPanePlayers.setViewportView(jTablePlayers);
jSplitPane1.setTopComponent(jScrollPanePlayers);
txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtMessageKeyTyped(evt);
@ -464,36 +304,22 @@ public class ChatPanel extends javax.swing.JPanel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(txtMessage)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
private void simplifyComponents() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE));
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)));
jTablePlayers = null;
jScrollPanePlayers = null;
}
private void txtMessageKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyTyped
public void handleKeyTyped(java.awt.event.KeyEvent evt) {
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
if (parentChatRef != null) {
parentChatRef.session.sendChatMessage(parentChatRef.chatId, this.txtMessage.getText());
@ -503,20 +329,14 @@ public class ChatPanel extends javax.swing.JPanel {
this.txtMessage.setText("");
this.txtMessage.repaint();
}
}
private void txtMessageKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyTyped
handleKeyTyped(evt);
}//GEN-LAST:event_txtMessageKeyTyped
public void setRoomUserInfo(List<Collection<RoomUsersView>> view) {
try {
userTableModel.loadData(view.get(0));
} catch (Exception ex) {
this.players.clear();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPanePlayers;
private javax.swing.JScrollPane jScrollPaneTxt;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTable jTablePlayers;
private mage.client.components.ColorPane txtConversation;
private javax.swing.JTextField txtMessage;
// End of variables declaration//GEN-END:variables

View file

@ -0,0 +1,108 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.client.chat;
import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR;
import mage.client.components.ColorPane;
import mage.view.ChatMessage;
import org.mage.card.arcane.ManaSymbols;
/**
*
* @author LevelX2
*/
public class ChatPanelSeparated extends ChatPanelBasic {
private ColorPane systemMessagesPane = null;
/**
* Display message in the chat. Use different colors for timestamp, username
* and message.
*
* @param username message sender
* @param message message itself
* @param time timestamp
* @param messageType
* @param color Preferred color. Not used.
*/
@Override
public void receiveMessage(String username, String message, String time, ChatMessage.MessageType messageType, ChatMessage.MessageColor color) {
switch (messageType) {
case TALK:
case WHISPER:
case USER_INFO:
super.receiveMessage(username, message, time, messageType, color);
return;
}
StringBuilder text = new StringBuilder();
if (time != null) {
text.append(getColoredText(TIMESTAMP_COLOR, time + ": "));
}
String userColor;
String textColor;
String userSeparator = " ";
switch (messageType) {
case STATUS: // a message to all chat user
textColor = STATUS_COLOR;
userColor = STATUS_COLOR;
break;
case USER_INFO: // a personal message
textColor = USER_INFO_COLOR;
userColor = USER_INFO_COLOR;
break;
default:
if (parentChatRef != null) {
userColor = parentChatRef.session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
} else {
userColor = session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
}
textColor = MESSAGE_COLOR;
userSeparator = ": ";
}
if (color.equals(ChatMessage.MessageColor.ORANGE)) {
textColor = "Orange";
}
if (color.equals(ChatMessage.MessageColor.YELLOW)) {
textColor = "Yellow";
}
if (username != null && !username.isEmpty()) {
text.append(getColoredText(userColor, username + userSeparator));
}
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY)));
this.systemMessagesPane.append(text.toString());
}
public ColorPane getSystemMessagesPane() {
return systemMessagesPane;
}
public void setSystemMessagesPane(ColorPane systemMessagesPane) {
this.systemMessagesPane = systemMessagesPane;
}
}

View file

@ -29,7 +29,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
private static final int DIALOG_WIDTH = 440;
private static final int DIALOG_HEIGHT = 260;
private transient static final Logger log = Logger.getLogger(AbilityPicker.class);
private static final Logger log = Logger.getLogger(AbilityPicker.class);
private JList rows;
private List<Object> choices;

View file

@ -27,21 +27,24 @@
*/
package mage.client.deck.generator;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.sets.ConstructedFormats;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.util.TournamentUtil;
/**
* Generates random card pool and builds a deck.
@ -57,6 +60,7 @@ public class DeckGenerator {
/**
* Builds a deck out of the selected block/set/format.
*
* @return a path to the generated deck.
*/
public static String generateDeck() {
@ -70,7 +74,6 @@ public class DeckGenerator {
return PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, null);
}
protected static Deck buildDeck() {
String selectedColors = genDialog.getSelectedColors();
@ -100,6 +103,7 @@ public class DeckGenerator {
/**
* If the user has selected random colors, pick them randomly for the user.
*
* @param selectedColors a string of the colors selected.
* @return a String representation of the new colors chosen.
*/
@ -130,9 +134,10 @@ public class DeckGenerator {
}
/**
* Generates all the cards to use in the deck.
* Adds creatures, non-creatures, lands (including non-basic).
* Fixes the deck, adjusting for size and color of the cards retrieved.
* Generates all the cards to use in the deck. Adds creatures,
* non-creatures, lands (including non-basic). Fixes the deck, adjusting for
* size and color of the cards retrieved.
*
* @param deckSize how big the deck is to generate.
* @param allowedColors which colors are allowed in the deck.
* @param setsToUse which sets to use to retrieve cards for this deck.
@ -148,16 +153,18 @@ public class DeckGenerator {
creatureCriteria.setCodes(sets);
creatureCriteria.notTypes(CardType.LAND);
creatureCriteria.types(CardType.CREATURE);
if (!(genDialog.useArtifacts()))
if (!(genDialog.useArtifacts())) {
creatureCriteria.notTypes(CardType.ARTIFACT);
}
// Non-creatures (sorcery, instant, enchantment, artifact etc.)
final CardCriteria nonCreatureCriteria = new CardCriteria();
nonCreatureCriteria.setCodes(sets);
nonCreatureCriteria.notTypes(CardType.LAND);
nonCreatureCriteria.notTypes(CardType.CREATURE);
if (!(genDialog.useArtifacts()))
if (!(genDialog.useArtifacts())) {
nonCreatureCriteria.notTypes(CardType.ARTIFACT);
}
// Non-basic land
final CardCriteria nonBasicLandCriteria = new CardCriteria();
@ -176,15 +183,18 @@ public class DeckGenerator {
return genPool.getDeck();
}
/**
* Generates all spells for the deck.
* Each card is retrieved from the database and checked against the converted mana cost (CMC) needed for the current card pool.
* If a card's CMC matches the CMC range required by the pool, it is added to the deck.
* This ensures that the majority of cards fit a fixed mana curve for the deck, and it is playable.
* Creatures and non-creatures are retrieved separately to ensure the deck contains a reasonable mix of both.
* Generates all spells for the deck. Each card is retrieved from the
* database and checked against the converted mana cost (CMC) needed for the
* current card pool. If a card's CMC matches the CMC range required by the
* pool, it is added to the deck. This ensures that the majority of cards
* fit a fixed mana curve for the deck, and it is playable. Creatures and
* non-creatures are retrieved separately to ensure the deck contains a
* reasonable mix of both.
*
* @param criteria the criteria to search for in the database.
* @param spellCount the number of spells that match the criteria needed in the deck.
* @param spellCount the number of spells that match the criteria needed in
* the deck.
*/
private static void generateSpells(CardCriteria criteria, int spellCount) {
List<CardInfo> cardPool = CardRepository.instance.findCards(criteria);
@ -211,8 +221,9 @@ public class DeckGenerator {
} else {
if (reservesAdded < (genPool.getDeckSize() / 2)) {
added = genPool.tryAddReserve(card, cardCMC);
if(added)
if (added) {
reservesAdded++;
}
}
}
}
@ -230,11 +241,13 @@ public class DeckGenerator {
}
/**
* Generates all the lands for the deck.
* Generates non-basic if selected by the user and if the deck isn't monocolored.
* Will fetch non-basic lands if required and then fill up the remaining space with basic lands.
* Basic lands are adjusted according to the mana symbols seen in the cards used in this deck.
* Usually the lands will be well balanced relative to the color of cards.
* Generates all the lands for the deck. Generates non-basic if selected by
* the user and if the deck isn't monocolored. Will fetch non-basic lands if
* required and then fill up the remaining space with basic lands. Basic
* lands are adjusted according to the mana symbols seen in the cards used
* in this deck. Usually the lands will be well balanced relative to the
* color of cards.
*
* @param criteria the criteria of the lands to search for in the database.
* @param landsCount the amount of lands required for this deck.
* @param basicLands information about the basic lands from the sets used.
@ -280,47 +293,13 @@ public class DeckGenerator {
/**
* Returns a map of colored mana symbol to basic land cards of that color.
*
* @param setsToUse which sets to retrieve basic lands from.
* @return a map of color to basic lands.
*/
private static Map<String, List<CardInfo>> generateBasicLands(List<String> setsToUse) {
List<String> landSets = new LinkedList<>();
// decide from which sets basic lands are taken from
for (String setCode :setsToUse) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo.hasBasicLands()) {
landSets.add(expansionInfo.getCode());
}
}
// if sets have no basic land, take land from block
if (landSets.isEmpty()) {
for (String setCode :setsToUse) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
landSets.add(blockSet.getCode());
}
}
}
}
// if still no set with lands found, take one by random
if (landSets.isEmpty()) {
// if sets have no basic lands and also it has no parent or parent has no lands get last set with lands
// select a set with basic lands by random
Random generator = new Random();
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
if (basicLandSets.size() > 0) {
landSets.add(basicLandSets.get(generator.nextInt(basicLandSets.size())).getCode());
}
}
if (landSets.isEmpty()) {
throw new IllegalArgumentException("No set with basic land was found");
}
Set<String> landSets = TournamentUtil.getLandSetCodeForDeckSets(setsToUse);
CardCriteria criteria = new CardCriteria();
if (!landSets.isEmpty()) {
@ -329,7 +308,7 @@ public class DeckGenerator {
Map<String, List<CardInfo>> basicLandMap = new HashMap<>();
for(ColoredManaSymbol c: ColoredManaSymbol.values()) {
for (ColoredManaSymbol c : ColoredManaSymbol.values()) {
String landName = DeckGeneratorPool.getBasicLandName(c.toString());
criteria.rarities(Rarity.LAND).name(landName);
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
@ -339,11 +318,14 @@ public class DeckGenerator {
}
/**
* Once any non-basic lands are added, add basic lands until the deck is filled.
* Once any non-basic lands are added, add basic lands until the deck is
* filled.
*
* @param landsNeeded how many remaining lands are needed.
* @param percentage the percentage needed for each color in the final deck.
* @param count how many of each color can be produced by non-basic lands.
* @param basicLands list of information about basic lands from the database.
* @param basicLands list of information about basic lands from the
* database.
*/
private static void addBasicLands(int landsNeeded, Map<String, Double> percentage, Map<String, Integer> count, Map<String, List<CardInfo>> basicLands) {
int colorTotal = 0;
@ -369,8 +351,9 @@ public class DeckGenerator {
int currentCount = count.get(color.toString());
double thisPercentage = 0.0;
// Calculate the percentage of lands so far that produce this color
if (currentCount > 0)
if (currentCount > 0) {
thisPercentage = (currentCount / (double) colorTotal) * 100.0;
}
// Check if the color is the most "needed" (highest percentage) we have seen so far
if (neededPercentage - thisPercentage > minPercentage) {
// Put this color land forward to be added
@ -378,7 +361,7 @@ public class DeckGenerator {
minPercentage = (neededPercentage - thisPercentage);
}
}
if(colorToAdd != null) {
if (colorToAdd != null) {
genPool.addCard(getBasicLand(colorToAdd, basicLands));
count.put(colorToAdd.toString(), count.get(colorToAdd.toString()) + 1);
colorTotal++;
@ -389,8 +372,10 @@ public class DeckGenerator {
/**
* Return a random basic land of the chosen color.
*
* @param color the color the basic land should produce.
* @param basicLands list of information about basic lands from the database.
* @param basicLands list of information about basic lands from the
* database.
* @return a single basic land that produces the color needed.
*/
private static Card getBasicLand(ColoredManaSymbol color, Map<String, List<CardInfo>> basicLands) {
@ -400,5 +385,4 @@ public class DeckGenerator {
return basicLandsInfo.get(random.nextInt(basicLandsInfo.size() - 1)).getMockCard().copy();
}
}

View file

@ -57,7 +57,7 @@ public class AddLandDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(MageDialog.class);
private Deck deck;
private final Set<String> setCodesland = new HashSet<>();
private final Set<String> landSetCodes = new HashSet<>();
private static final int DEFAULT_SEALED_DECK_CARD_NUMBER = 40;
@ -71,27 +71,27 @@ public class AddLandDialog extends MageDialog {
public void showDialog(Deck deck, DeckEditorMode mode) {
this.deck = deck;
SortedSet<String> landSets = new TreeSet<>();
SortedSet<String> landSetNames = new TreeSet<>();
if (!mode.equals(DeckEditorMode.FREE_BUILDING)) {
// decide from which sets basic lands are taken from
for (String setCode : deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null && expansionInfo.hasBasicLands()) {
this.setCodesland.add(expansionInfo.getCode());
landSets.add(expansionInfo.getName());
this.landSetCodes.add(expansionInfo.getCode());
landSetNames.add(expansionInfo.getName());
}
}
// if sets have no basic land, take land from block
if (this.setCodesland.isEmpty()) {
if (this.landSetCodes.isEmpty()) {
for (String setCode : deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null) {
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet : blockSets) {
if (blockSet.hasBasicLands()) {
this.setCodesland.add(blockSet.getCode());
landSets.add(blockSet.getName());
this.landSetCodes.add(blockSet.getCode());
landSetNames.add(blockSet.getName());
}
}
}
@ -99,19 +99,19 @@ public class AddLandDialog extends MageDialog {
}
}
// if still no set with lands found, add list of all available
if (this.setCodesland.isEmpty()) {
if (this.landSetCodes.isEmpty()) {
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
for (ExpansionInfo expansionInfo : basicLandSets) {
landSets.add(expansionInfo.getName());
landSetNames.add(expansionInfo.getName());
}
}
if (landSets.isEmpty()) {
if (landSetNames.isEmpty()) {
throw new IllegalArgumentException("No set with basic land was found");
}
if (landSets.size() > 1) {
landSets.add("<Random lands>");
if (landSetNames.size() > 1) {
landSetNames.add("<Random lands>");
}
cbLandSet.setModel(new DefaultComboBoxModel(landSets.toArray()));
cbLandSet.setModel(new DefaultComboBoxModel(landSetNames.toArray()));
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
this.setVisible(true);
@ -123,7 +123,7 @@ public class AddLandDialog extends MageDialog {
CardCriteria criteria = new CardCriteria();
if (landSetName.equals("<Random lands>")) {
criteria.setCodes(setCodesland.toArray(new String[setCodesland.size()]));
criteria.setCodes(landSetCodes.toArray(new String[landSetCodes.size()]));
} else {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
if (expansionInfo == null) {

View file

@ -36,8 +36,6 @@ package mage.client.dialog;
import java.awt.Point;
import java.beans.PropertyVetoException;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import javax.swing.event.InternalFrameAdapter;
@ -50,6 +48,7 @@ import mage.client.util.gui.GuiDisplayUtil;
import mage.view.CardsView;
import mage.view.ExileView;
import mage.view.SimpleCardsView;
import org.apache.log4j.Logger;
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
/**
@ -58,6 +57,8 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
*/
public class CardInfoWindowDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(CardInfoWindowDialog.class);
public static enum ShowType {
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
@ -123,7 +124,7 @@ public class CardInfoWindowDialog extends MageDialog {
try {
this.setIcon(false);
} catch (PropertyVetoException ex) {
Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
}
} else {

View file

@ -40,7 +40,7 @@ import javax.swing.*;
*/
public class FeedbackDialog extends javax.swing.JDialog {
private static final transient Logger log = Logger.getLogger(PreferencesDialog.class);
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
private String[] feedbackTypes = {"", "Bug or \"something doesn't work\"",
"Feature or \"I need that function\"",

View file

@ -1,30 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.client.dialog;
import java.io.FileNotFoundException;
@ -71,7 +71,9 @@ public class NewTableDialog extends MageDialog {
private static final String LIMITED = "Limited";
/** Creates new form NewTableDialog */
/**
* Creates new form NewTableDialog
*/
public NewTableDialog() {
session = MageFrame.getSession();
lastSessionId = "";
@ -79,13 +81,13 @@ public class NewTableDialog extends MageDialog {
player1Panel.showLevel(false);
this.spnNumWins.setModel(new SpinnerNumberModel(1, 1, 5, 1));
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -361,7 +363,7 @@ public class NewTableDialog extends MageDialog {
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
MatchOptions options = new MatchOptions(this.txtName.getText(), gameType.getName());
options.getPlayerTypes().add("Human");
for (TablePlayerPanel player: players) {
for (TablePlayerPanel player : players) {
options.getPlayerTypes().add(player.getPlayerType());
}
options.setDeckType((String) this.cbDeckType.getSelectedItem());
@ -370,9 +372,9 @@ public class NewTableDialog extends MageDialog {
options.setAttackOption((MultiplayerAttackOption) this.cbAttackOption.getSelectedItem());
options.setSkillLevel((SkillLevel) this.cbSkillLevel.getSelectedItem());
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
options.setWinsNeeded((Integer) this.spnNumWins.getValue());
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
options.setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
options.setPassword(this.txtPassword.getText());
if (!checkMatchOptions(options)) {
return;
@ -391,9 +393,8 @@ public class NewTableDialog extends MageDialog {
this.player1Panel.getPlayerName(),
"Human", 1,
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
this.txtPassword.getText())
) {
for (TablePlayerPanel player: players) {
this.txtPassword.getText())) {
for (TablePlayerPanel player : players) {
if (!player.getPlayerType().equals("Human")) {
if (!player.joinTable(roomId, table.getTableId())) {
// error message must be send by the server
@ -423,7 +424,7 @@ public class NewTableDialog extends MageDialog {
}//GEN-LAST:event_cbGameTypeActionPerformed
private void numPlayersChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_numPlayersChanged
int numPlayers = (Integer)this.spnNumPlayers.getValue() - 1;
int numPlayers = (Integer) this.spnNumPlayers.getValue() - 1;
createPlayers(numPlayers);
}//GEN-LAST:event_numPlayersChanged
@ -432,9 +433,10 @@ public class NewTableDialog extends MageDialog {
}//GEN-LAST:event_spnNumWinsnumPlayersChanged
/**
* Checks about not valid game option combinations and shows an error message
*
* @return
* Checks about not valid game option combinations and shows an error
* message
*
* @return
*/
private boolean checkMatchOptions(MatchOptions options) {
switch (options.getDeckType()) {
@ -451,11 +453,17 @@ public class NewTableDialog extends MageDialog {
return false;
}
break;
case "Variant Magic - Momir Basic":
if (!options.getGameType().startsWith("Momir Basic")) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Momir Basic needs also a Momir Basic game type", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
break;
}
switch (options.getGameType()) {
case "Commander Two Player Duel":
case "Commander Free For All":
if (!options.getDeckType().equals("Variant Magic - Commander") && !options.getDeckType().equals("Variant Magic - Duel Commander") ) {
if (!options.getDeckType().equals("Variant Magic - Commander") && !options.getDeckType().equals("Variant Magic - Duel Commander")) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Commander needs also a Commander game type", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
@ -466,16 +474,16 @@ public class NewTableDialog extends MageDialog {
return false;
}
break;
}
}
return true;
}
private void setGameOptions() {
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
int oldValue = (Integer) this.spnNumPlayers.getValue();
this.spnNumPlayers.setModel(new SpinnerNumberModel(gameType.getMinPlayers(), gameType.getMinPlayers(), gameType.getMaxPlayers(), 1));
this.spnNumPlayers.setEnabled(gameType.getMinPlayers() != gameType.getMaxPlayers());
if (oldValue >= gameType.getMinPlayers() && oldValue <= gameType.getMaxPlayers()){
if (oldValue >= gameType.getMinPlayers() && oldValue <= gameType.getMaxPlayers()) {
this.spnNumPlayers.setValue(oldValue);
}
this.cbAttackOption.setEnabled(gameType.isUseAttackOption());
@ -495,17 +503,16 @@ public class NewTableDialog extends MageDialog {
playerPanel.init(players.size() + 2, playerType);
players.add(playerPanel);
playerPanel.addPlayerTypeEventListener(
new Listener<Event> () {
@Override
public void event(Event event) {
drawPlayers();
new Listener<Event>() {
@Override
public void event(Event event) {
drawPlayers();
}
}
}
);
}
}
// remove player panels no longer needed
} // remove player panels no longer needed
else if (numPlayers < players.size()) {
while (players.size() != numPlayers) {
players.remove(players.size() - 1);
@ -516,7 +523,7 @@ public class NewTableDialog extends MageDialog {
private void drawPlayers() {
this.pnlOtherPlayers.removeAll();
for (TablePlayerPanel panel: players) {
for (TablePlayerPanel panel : players) {
this.pnlOtherPlayers.add(panel);
}
this.pack();
@ -531,7 +538,7 @@ public class NewTableDialog extends MageDialog {
}
public void showDialog(UUID roomId) {
this.roomId = roomId;
this.roomId = roomId;
if (!lastSessionId.equals(MageFrame.getSession().getSessionId())) {
lastSessionId = session.getSessionId();
this.player1Panel.setPlayerName(session.getUserName());
@ -543,8 +550,8 @@ public class NewTableDialog extends MageDialog {
cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values()));
cbSkillLevel.setModel(new DefaultComboBoxModel(SkillLevel.values()));
// Update the existing player panels (neccessary if server was changes = new session)
int i=2;
for (TablePlayerPanel tablePlayerPanel :players) {
int i = 2;
for (TablePlayerPanel tablePlayerPanel : players) {
tablePlayerPanel.init(i++, tablePlayerPanel.getPlayerType());
}
setGameSettingsFromPrefs();
@ -565,7 +572,7 @@ public class NewTableDialog extends MageDialog {
private void selectLimitedByDefault() {
for (int i = 0; i < cbDeckType.getItemCount(); i++) {
String name = (String)cbDeckType.getItemAt(i);
String name = (String) cbDeckType.getItemAt(i);
if (name.equals(LIMITED)) {
cbDeckType.setSelectedIndex(i);
break;
@ -574,9 +581,9 @@ public class NewTableDialog extends MageDialog {
}
/**
* set the table settings from java prefs
* set the table settings from java prefs
*/
private void setGameSettingsFromPrefs () {
private void setGameSettingsFromPrefs() {
txtName.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NAME, "Game"));
txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD, ""));
@ -585,7 +592,6 @@ public class NewTableDialog extends MageDialog {
prefPlayerTypes.addAll(Arrays.asList(playerTypes.split(",")));
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
String gameTypeName = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, "Two Player Duel");
for (GameTypeView gtv : session.getGameTypes()) {
if (gtv.getName().equals(gameTypeName)) {
@ -594,7 +600,7 @@ public class NewTableDialog extends MageDialog {
}
}
int timeLimit = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, "1500"));
for (MatchTimeLimit mtl :MatchTimeLimit.values()) {
for (MatchTimeLimit mtl : MatchTimeLimit.values()) {
if (mtl.getTimeLimit() == timeLimit) {
this.cbTimeLimit.setSelectedItem(mtl);
break;
@ -608,32 +614,32 @@ public class NewTableDialog extends MageDialog {
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
for (RangeOfInfluence roi :RangeOfInfluence.values()) {
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
if (roi.getRange() == range) {
this.cbRange.setSelectedItem(roi);
break;
}
}
String attackOption = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION, "Attack Multiple Players");
for (MultiplayerAttackOption mao :MultiplayerAttackOption.values()) {
for (MultiplayerAttackOption mao : MultiplayerAttackOption.values()) {
if (mao.toString().equals(attackOption)) {
this.cbAttackOption.setSelectedItem(mao);
break;
}
}
String skillLevelDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, "Casual");
for (SkillLevel skillLevel :SkillLevel.values()) {
for (SkillLevel skillLevel : SkillLevel.values()) {
if (skillLevel.toString().equals(skillLevelDefault)) {
this.cbSkillLevel.setSelectedItem(skillLevel);
break;
}
}
}
}
/**
* Save the settings to java prefs to reload it next time the dialog will be created
* Save the settings to java prefs to reload it next time the dialog will be
* created
*
* @param options
* @param deckFile
@ -645,7 +651,7 @@ public class NewTableDialog extends MageDialog {
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, Integer.toString(options.getPriorityTime()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, options.getGameType());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, Integer.toString(options.getWinsNeeded()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, options.isRollbackTurnsAllowed() ? "Yes": "No");
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, options.isRollbackTurnsAllowed() ? "Yes" : "No");
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, Integer.toString(options.getFreeMulligans()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile);
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, spnNumPlayers.getValue().toString());
@ -655,7 +661,7 @@ public class NewTableDialog extends MageDialog {
StringBuilder playerTypesString = new StringBuilder();
ListIterator iterator = players.listIterator();
while (iterator.hasNext()) {
if (playerTypesString.length()>0) {
if (playerTypesString.length() > 0) {
playerTypesString.append(",");
}
TablePlayerPanel tpp = (TablePlayerPanel) iterator.next();

View file

@ -78,7 +78,7 @@ import org.apache.log4j.Logger;
*/
public class PreferencesDialog extends javax.swing.JDialog {
private static final transient Logger log = Logger.getLogger(PreferencesDialog.class);
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
public static final String KEY_SHOW_TOOLTIPS_ANY_ZONE = "showTooltipsInAnyZone";
@ -270,7 +270,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private static final Border GREEN_BORDER = BorderFactory.createLineBorder(Color.GREEN, 3);
private static final Border BLACK_BORDER = BorderFactory.createLineBorder(Color.BLACK, 3);
private static int selectedAvatarId = DEFAULT_AVATAR_ID;
private static int selectedAvatarId;
private final JFileChooser fc = new JFileChooser();
@ -2723,6 +2723,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
public static UserData getUserData() {
if (selectedAvatarId == 0) {
getSelectedAvatar();
}
return new UserData(UserGroup.PLAYER,
PreferencesDialog.selectedAvatarId,
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true"),

View file

@ -28,13 +28,13 @@
<Component id="btnMoveDown" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnMoveUp" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="326" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="btnStart" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="jSplitPane1" alignment="0" pref="644" max="32767" attributes="0"/>
<Component id="jSplitPane1" alignment="0" pref="500" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -91,9 +91,10 @@
</Component>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="dividerLocation" type="int" value="320"/>
<Property name="dividerLocation" type="int" value="300"/>
<Property name="dividerSize" type="int" value="3"/>
<Property name="resizeWeight" type="double" value="1.0"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
@ -122,10 +123,7 @@
</Component>
</SubComponents>
</Container>
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new mage.client.chat.ChatPanel(false);"/>
</AuxValues>
<Component class="mage.client.chat.ChatPanelBasic" name="chatPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>

View file

@ -41,7 +41,7 @@ import javax.swing.Icon;
import javax.swing.SwingWorker;
import javax.swing.table.AbstractTableModel;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.components.MageComponents;
import mage.client.components.tray.MageTray;
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_ORDER;
@ -86,7 +86,7 @@ public class TableWaitingDialog extends MageDialog {
this.setSize(prefWidth, prefHeight);
}
chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
chatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
tableSeats.createDefaultColumnsFromModel();
TableUtil.setColumnWidthAndOrder(tableSeats, defaultColumnsWidth, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
@ -183,7 +183,7 @@ public class TableWaitingDialog extends MageDialog {
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
tableSeats = new javax.swing.JTable();
chatPanel = new mage.client.chat.ChatPanel(false);
chatPanel = new mage.client.chat.ChatPanelBasic();
setResizable(true);
setTitle("Waiting for players");
@ -219,9 +219,10 @@ public class TableWaitingDialog extends MageDialog {
}
});
jSplitPane1.setDividerLocation(320);
jSplitPane1.setDividerLocation(300);
jSplitPane1.setDividerSize(3);
jSplitPane1.setResizeWeight(1.0);
jSplitPane1.setToolTipText("");
tableSeats.setModel(tableWaitModel);
tableSeats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
@ -239,12 +240,12 @@ public class TableWaitingDialog extends MageDialog {
.addComponent(btnMoveDown)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnMoveUp)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 326, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel)
.addContainerGap())
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 644, Short.MAX_VALUE)
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -308,7 +309,7 @@ public class TableWaitingDialog extends MageDialog {
private javax.swing.JButton btnMoveDown;
private javax.swing.JButton btnMoveUp;
private javax.swing.JButton btnStart;
private mage.client.chat.ChatPanel chatPanel;
private mage.client.chat.ChatPanelBasic chatPanel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTable tableSeats;

View file

@ -53,8 +53,6 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
@ -82,6 +80,7 @@ import mage.view.DraftPickView;
import mage.view.DraftView;
import mage.view.SimpleCardView;
import mage.view.SimpleCardsView;
import org.apache.log4j.Logger;
/**
*
@ -89,6 +88,8 @@ import mage.view.SimpleCardsView;
*/
public class DraftPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(DraftPanel.class);
private UUID draftId;
private Session session;
private Timer countdown;
@ -185,7 +186,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException ex) {
Logger.getLogger(DraftPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
} else {
logFilename = null;
@ -523,7 +524,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), data.getBytes(), StandardOpenOption.APPEND);
} catch (IOException ex) {
Logger.getLogger(DraftPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
}

View file

@ -42,7 +42,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.components.MageTextArea;
import mage.client.dialog.MageDialog;
import mage.client.util.audio.AudioManager;
@ -71,7 +71,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
private Session session;
private FeedbackMode mode;
private MageDialog connectedDialog;
private ChatPanel connectedChatPanel;
private ChatPanelBasic connectedChatPanel;
private int lastMessageId;
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
@ -323,7 +323,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
return this.mode;
}
public void setConnectedChatPanel(ChatPanel chatPanel) {
public void setConnectedChatPanel(ChatPanelBasic chatPanel) {
this.connectedChatPanel = chatPanel;
}

View file

@ -82,7 +82,7 @@ import mage.cards.action.ActionCallback;
import mage.choices.Choice;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.combat.CombatManager;
import mage.client.components.HoverButton;
import mage.client.components.MageComponents;
@ -1204,12 +1204,12 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipForward = new javax.swing.JButton();
btnPreviousPlay = new javax.swing.JButton();
pnlBattlefield = new javax.swing.JPanel();
gameChatPanel = new mage.client.chat.ChatPanel();
gameChatPanel.useExtendedView(ChatPanel.VIEW_MODE.GAME);
userChatPanel = new mage.client.chat.ChatPanel();
gameChatPanel = new mage.client.chat.ChatPanelBasic();
gameChatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.GAME);
userChatPanel = new mage.client.chat.ChatPanelBasic();
userChatPanel.setParentChat(gameChatPanel);
userChatPanel.useExtendedView(ChatPanel.VIEW_MODE.CHAT);
userChatPanel.setChatType(ChatPanel.ChatType.GAME);
userChatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.CHAT);
userChatPanel.setChatType(ChatPanelBasic.ChatType.GAME);
gameChatPanel.setConnectedChat(userChatPanel);
gameChatPanel.disableInput();
gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
@ -2125,9 +2125,9 @@ public final class GamePanel extends javax.swing.JPanel {
private javax.swing.JButton btnStopWatching;
private mage.client.chat.ChatPanel gameChatPanel;
private mage.client.chat.ChatPanelBasic gameChatPanel;
private mage.client.game.FeedbackPanel feedbackPanel;
private mage.client.chat.ChatPanel userChatPanel;
private mage.client.chat.ChatPanelBasic userChatPanel;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JSplitPane jSplitPane0;

View file

@ -108,6 +108,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
private int avatarId = -1;
private String flagName;
private String basicTooltipText;
private PriorityTimer timer;
@ -159,25 +160,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
public void update(PlayerView player) {
this.player = player;
if (flagName == null) { // do only once
avatar.setText(this.player.getName());
if (!player.getUserData().getFlagName().equals(flagName)) {
flagName = player.getUserData().getFlagName();
this.avatar.setTopTextImage(CountryUtil.getCountryFlagIcon(flagName).getImage());
}
// TODO: Add the wins to the tooltiptext of the avatar
String countryname = CountryUtil.getCountryName(flagName);
if (countryname == null) {
countryname = "Unknown";
}
String tooltip = "<HTML>Name: " + player.getName() + "<br/>Country: " + countryname;
avatar.setToolTipText(tooltip);
avatar.repaint();
// used if avatar image can't be used
this.btnPlayer.setText(player.getName());
this.btnPlayer.setToolTipText(tooltip);
}
updateAvatar();
int playerLife = player.getLife();
if (playerLife > 99) {
Font font = lifeLabel.getFont();
@ -287,6 +270,39 @@ public class PlayerPanelExt extends javax.swing.JPanel {
update(player.getManaPool());
}
/**
* Updates the avatar image and tooltip text
*/
private void updateAvatar() {
if (flagName == null) { // do only once
avatar.setText(this.player.getName());
if (!player.getUserData().getFlagName().equals(flagName)) {
flagName = player.getUserData().getFlagName();
this.avatar.setTopTextImage(CountryUtil.getCountryFlagIcon(flagName).getImage());
}
// TODO: Add the wins to the tooltiptext of the avatar
String countryname = CountryUtil.getCountryName(flagName);
if (countryname == null) {
countryname = "Unknown";
}
basicTooltipText = "<HTML>Name: " + player.getName()
+ "<br/>Country: " + countryname
+ "<br/>Deck hash code: " + player.getDeckHashCode()
+ "<br/>Wins: " + player.getWins() + " of " + player.getWinsNeeded() + " (to win the match)";
}
// Extend tooltip
StringBuilder tooltipText = new StringBuilder(basicTooltipText);
if (player.getExperience() > 0) {
tooltipText.append("<br/>Experience counters: ").append(player.getExperience());
}
avatar.setToolTipText(tooltipText.toString());
avatar.repaint();
// used if avatar image can't be used
this.btnPlayer.setText(player.getName());
this.btnPlayer.setToolTipText(tooltipText.toString());
}
private String getPriorityTimeLeftString(PlayerView player) {
int priorityTimeLeft = player.getPriorityTimeLeft();
return getPriorityTimeLeftString(priorityTimeLeft);
@ -802,7 +818,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) {
DialogManager.getManager(gameId).showEmblemsDialog(CardsViewUtil.convertCommandObject(player.getCommadObjectList()), bigCard, gameId);
DialogManager.getManager(gameId).showEmblemsDialog(CardsViewUtil.convertCommandObject(player.getCommandObjectList()), bigCard, gameId);
}
private void btnExileZoneActionPerformed(java.awt.event.ActionEvent evt) {

View file

@ -58,7 +58,6 @@ public class Plugins implements MagePlugins {
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY).toURI());
this.cardPlugin = new CardPluginImpl();
this.counterPlugin = pm.getPlugin(CounterPlugin.class);
//this.themePlugin = pm.getPlugin(ThemePlugin.class);
this.themePlugin = new ThemePluginImpl();
logger.info("Done.");
}

View file

@ -33,9 +33,7 @@ import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import mage.cards.decks.Deck;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import static mage.client.chat.ChatPanel.ChatType.TABLES;
import static mage.client.chat.ChatPanel.ChatType.TOURNAMENT;
import mage.client.chat.ChatPanelBasic;
import mage.client.constants.Constants.DeckEditorMode;
import mage.client.draft.DraftPanel;
import mage.client.game.GamePanel;
@ -116,9 +114,9 @@ public class CallbackClientImpl implements CallbackClient {
break;
case "chatMessage": {
ChatMessage message = (ChatMessage) callback.getData();
ChatPanel panel = MageFrame.getChat(callback.getObjectId());
ChatPanelBasic panel = MageFrame.getChat(callback.getObjectId());
if (panel != null) {
// play the to the message connected sound
// play the sound related to the message
if (message.getSoundToPlay() != null) {
switch (message.getSoundToPlay()) {
case PlayerLeft:
@ -383,9 +381,9 @@ public class CallbackClientImpl implements CallbackClient {
});
}
private void createChatStartMessage(ChatPanel chatPanel) {
private void createChatStartMessage(ChatPanelBasic chatPanel) {
chatPanel.setStartMessageDone(true);
ChatPanel usedPanel = chatPanel;
ChatPanelBasic usedPanel = chatPanel;
if (chatPanel.getConnectedChat() != null) {
usedPanel = chatPanel.getConnectedChat();
}

View file

@ -16,16 +16,14 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtMessage" alignment="0" pref="203" max="32767" attributes="0"/>
<Component id="jSplitPane1" alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="jSplitPane1" alignment="0" pref="350" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jSplitPane1" pref="288" max="32767" attributes="0"/>
<Component id="jSplitPane1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="txtMessage" min="-2" pref="30" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -43,39 +41,6 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPaneTxt">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="mage.client.components.ColorPane" name="txtConversation">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="focusCycleRoot" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 2, 2, 2]"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPanePlayers">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
@ -119,12 +84,16 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JTabbedPane" name="jTabbedPaneText">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JTextField" name="txtMessage">
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -0,0 +1,278 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
* ChatPanel.java
*
* Created on 15-Dec-2009, 11:04:31 PM
*/
package mage.client.table;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import mage.client.chat.ChatPanelBasic;
import static mage.client.chat.ChatPanelBasic.CHAT_ALPHA;
import mage.client.chat.ChatPanelSeparated;
import mage.client.components.ColorPane;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
import mage.client.util.MageTableRowSorter;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
import mage.remote.MageRemoteException;
import mage.view.RoomUsersView;
import mage.view.UsersView;
/**
*
* @author BetaSteward_at_googlemail.com, nantuko
*/
public class PlayersChatPanel extends javax.swing.JPanel {
private final List<String> players = new ArrayList<>();
private final UserTableModel userTableModel;
private final ChatPanelSeparated userChatPanel;
private final ColorPane systemMessagesPane;
private static final int[] defaultColumnsWidth = {20, 100, 100, 80, 80};
/*
* Creates new form ChatPanel
*
*/
public PlayersChatPanel() {
userTableModel = new UserTableModel(); // needs to be set before initComponents();
initComponents();
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jTablePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jTablePlayers.setForeground(Color.white);
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
systemMessagesPane = new ColorPane();
userChatPanel = new ChatPanelSeparated();
userChatPanel.setSystemMessagesPane(systemMessagesPane);
if (jTabbedPaneText != null) {
jTabbedPaneText.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
if (userChatPanel != null) {
userChatPanel.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jTabbedPaneText.addTab("Talk", userChatPanel);
}
if (systemMessagesPane != null) {
systemMessagesPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
systemMessagesPane.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
systemMessagesPane.setFocusCycleRoot(false);
systemMessagesPane.setMargin(new java.awt.Insets(2, 2, 2, 2));
systemMessagesPane.setOpaque(false);
systemMessagesPane.setExtBackgroundColor(new Color(0, 0, 0, CHAT_ALPHA)); // Alpha = 255 not transparent
systemMessagesPane.setSelectionColor(Color.LIGHT_GRAY);
jTabbedPaneText.addTab("System", systemMessagesPane);
}
}
if (jScrollPanePlayers != null) {
jScrollPanePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jScrollPanePlayers.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
}
}
public ChatPanelBasic getUserChatPanel() {
return userChatPanel;
}
public void cleanUp() {
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
userChatPanel.cleanUp();
}
public void setSplitDividerLocation(int location) {
if (jSplitPane1 != null) {
jSplitPane1.setDividerLocation(location);
}
}
public int getSplitDividerLocation() {
if (jSplitPane1 == null) {
return 0;
}
return this.jSplitPane1.getDividerLocation();
}
class UserTableModel extends AbstractTableModel {
private final String[] columnNames = new String[]{"Loc", "Players", "Info", "Games", "Connection"};
private UsersView[] players = new UsersView[0];
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
RoomUsersView roomUserInfo = roomUserInfoList.iterator().next();
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
JTableHeader th = jTablePlayers.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
"Games " + roomUserInfo.getNumberActiveGames()
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
th.repaint();
this.fireTableDataChanged();
}
@Override
public int getRowCount() {
return players.length;
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public Object getValueAt(int arg0, int arg1) {
switch (arg1) {
case 0:
return players[arg0].getFlagName();
case 1:
return players[arg0].getUserName();
case 2:
return players[arg0].getInfoState();
case 3:
return players[arg0].getInfoGames();
case 4:
return players[arg0].getInfoPing();
}
return "";
}
@Override
public String getColumnName(int columnIndex) {
String colName = "";
if (columnIndex <= getColumnCount()) {
colName = columnNames[columnIndex];
}
return colName;
}
@Override
public Class getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return Icon.class;
default:
return String.class;
}
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPanePlayers = new javax.swing.JScrollPane();
jTablePlayers = new javax.swing.JTable();
jTabbedPaneText = new javax.swing.JTabbedPane();
jSplitPane1.setBorder(null);
jSplitPane1.setDividerSize(10);
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane1.setResizeWeight(0.25);
jScrollPanePlayers.setBorder(null);
jTablePlayers.setModel(this.userTableModel);
jTablePlayers.setToolTipText("Connected players");
jTablePlayers.setAutoscrolls(false);
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jTablePlayers.setFocusable(false);
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
jTablePlayers.setOpaque(false);
jTablePlayers.setRequestFocusEnabled(false);
jTablePlayers.setRowSelectionAllowed(false);
jTablePlayers.setUpdateSelectionOnSort(false);
jTablePlayers.setVerifyInputWhenFocusTarget(false);
jScrollPanePlayers.setViewportView(jTablePlayers);
jSplitPane1.setTopComponent(jScrollPanePlayers);
jSplitPane1.setRightComponent(jTabbedPaneText);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jSplitPane1)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
public void setRoomUserInfo(List<Collection<RoomUsersView>> view) {
try {
userTableModel.loadData(view.get(0));
} catch (Exception ex) {
this.players.clear();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPanePlayers;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTabbedPane jTabbedPaneText;
private javax.swing.JTable jTablePlayers;
// End of variables declaration//GEN-END:variables
}

View file

@ -503,7 +503,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jButton1" min="-2" pref="65" max="-2" attributes="0"/>
<Component id="jButtonNext" min="-2" pref="65" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@ -516,7 +516,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" min="-2" pref="17" max="-2" attributes="0"/>
<Component id="jButtonNext" alignment="3" min="-2" pref="17" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
@ -540,7 +540,7 @@
<Property name="text" type="java.lang.String" value="You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Component class="javax.swing.JButton" name="jButtonNext">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
@ -554,7 +554,7 @@
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonNextActionPerformed"/>
</Events>
</Component>
</SubComponents>
@ -570,21 +570,6 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 43]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new mage.client.chat.ChatPanel(true);"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
@ -595,7 +580,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPane2" alignment="0" pref="798" max="32767" attributes="0"/>
<Component id="jSplitPane2" alignment="0" pref="810" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -679,7 +664,14 @@
</Container>
</SubComponents>
</Container>
<Component class="mage.client.table.PlayersChatPanel" name="chatPanelMain">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
</Form>

View file

@ -69,7 +69,7 @@ import javax.swing.SwingWorker;
import javax.swing.table.AbstractTableModel;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.components.MageComponents;
import mage.client.dialog.JoinTableDialog;
import mage.client.dialog.NewTableDialog;
@ -143,16 +143,16 @@ public class TablesPanel extends javax.swing.JPanel {
tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
chatPanel.setBorder(null);
chatPanel.setChatType(ChatPanel.ChatType.TABLES);
chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
chatPanelMain.getUserChatPanel().setBorder(null);
chatPanelMain.getUserChatPanel().setChatType(ChatPanelBasic.ChatType.TABLES);
filterButtons = new JToggleButton[]{btnStateWaiting, btnStateActive, btnStateFinished,
btnTypeMatch, btnTypeTourneyConstructed, btnTypeTourneyLimited,
btnFormatBlock, btnFormatStandard, btnFormatModern, btnFormatLegacy, btnFormatVintage, btnFormatCommander, btnFormatTinyLeader, btnFormatLimited, btnFormatOther,
btnSkillBeginner, btnSkillCasual, btnSkillSerious};
JComponent[] components = new JComponent[]{chatPanel, jSplitPane1, jScrollPane1, jScrollPane2, topPanel, jPanel3};
JComponent[] components = new JComponent[]{chatPanelMain, jSplitPane1, jScrollPane1, jScrollPane2, topPanel, jPanel3};
for (JComponent component : components) {
component.setOpaque(false);
}
@ -274,7 +274,7 @@ public class TablesPanel extends javax.swing.JPanel {
public void cleanUp() {
saveSettings();
chatPanel.cleanUp();
chatPanelMain.cleanUp();
}
private void saveDividerLocations() {
@ -284,7 +284,7 @@ public class TablesPanel extends javax.swing.JPanel {
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, Integer.toString(chatPanel.getSplitDividerLocation()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, Integer.toString(chatPanelMain.getSplitDividerLocation()));
}
private void restoreSettings() {
@ -333,8 +333,8 @@ public class TablesPanel extends javax.swing.JPanel {
}
}
location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, null);
if (location != null && chatPanel != null) {
chatPanel.setSplitDividerLocation(Integer.parseInt(location));
if (location != null && chatPanelMain != null) {
chatPanelMain.setSplitDividerLocation(Integer.parseInt(location));
}
}
}
@ -376,7 +376,7 @@ public class TablesPanel extends javax.swing.JPanel {
updateTablesTask.execute();
}
if (updatePlayersTask == null || updatePlayersTask.isDone()) {
updatePlayersTask = new UpdatePlayersTask(session, roomId, this.chatPanel);
updatePlayersTask = new UpdatePlayersTask(session, roomId, this.chatPanelMain);
updatePlayersTask.execute();
}
if (this.btnStateFinished.isSelected()) {
@ -426,7 +426,7 @@ public class TablesPanel extends javax.swing.JPanel {
MageFrame.getDesktop().add(joinTableDialog, JLayeredPane.MODAL_LAYER);
}
if (chatRoomId != null) {
this.chatPanel.connect(chatRoomId);
this.chatPanelMain.getUserChatPanel().connect(chatRoomId);
startTasks();
this.setVisible(true);
this.repaint();
@ -461,7 +461,7 @@ public class TablesPanel extends javax.swing.JPanel {
} else {
this.jPanel2.setVisible(true);
this.jLabel2.setText(serverMessages.get(0));
this.jButton1.setVisible(serverMessages.size() > 1);
this.jButtonNext.setVisible(serverMessages.size() > 1);
}
}
@ -473,7 +473,7 @@ public class TablesPanel extends javax.swing.JPanel {
}
}
stopTasks();
this.chatPanel.disconnect();
this.chatPanelMain.getUserChatPanel().disconnect();
Component c = this.getParent();
while (c != null && !(c instanceof TablesPane)) {
@ -484,8 +484,8 @@ public class TablesPanel extends javax.swing.JPanel {
}
}
public ChatPanel getChatPanel() {
return this.chatPanel;
public ChatPanelBasic getChatPanel() {
return chatPanelMain.getUserChatPanel();
}
private void setTableFilter() {
@ -501,7 +501,7 @@ public class TablesPanel extends javax.swing.JPanel {
// type
List<RowFilter<Object, Object>> typeFilterList = new ArrayList<>();
if (btnTypeMatch.isSelected()) {
typeFilterList.add(RowFilter.regexFilter("Two|Commander|Free|Tiny", TableTableModel.COLUMN_GAME_TYPE));
typeFilterList.add(RowFilter.regexFilter("Two|Commander|Free|Tiny|Momir", TableTableModel.COLUMN_GAME_TYPE));
}
if (btnTypeTourneyConstructed.isSelected()) {
typeFilterList.add(RowFilter.regexFilter("Constructed", TableTableModel.COLUMN_GAME_TYPE));
@ -537,7 +537,7 @@ public class TablesPanel extends javax.swing.JPanel {
formatFilterList.add(RowFilter.regexFilter("^Limited", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatOther.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("^Constructed - Pauper|^Constructed - Extended|^Constructed - Historical|^Constructed - Super", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Momir Basic|^Constructed - Pauper|^Constructed - Extended|^Constructed - Historical|^Constructed - Super", TableTableModel.COLUMN_DECK_TYPE));
}
List<RowFilter<Object, Object>> skillFilterList = new ArrayList<>();
@ -628,15 +628,15 @@ public class TablesPanel extends javax.swing.JPanel {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButtonNext = new javax.swing.JButton();
jSplitPane1 = new javax.swing.JSplitPane();
chatPanel = new mage.client.chat.ChatPanel(true);
jPanel3 = new javax.swing.JPanel();
jSplitPane2 = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
tableTables = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
tableCompleted = new javax.swing.JTable();
chatPanelMain = new mage.client.table.PlayersChatPanel();
topPanel.setBackground(java.awt.Color.white);
topPanel.setOpaque(false);
@ -1022,13 +1022,13 @@ public class TablesPanel extends javax.swing.JPanel {
jLabel2.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --");
jButton1.setText("Next");
jButton1.setMaximumSize(new java.awt.Dimension(55, 25));
jButton1.setMinimumSize(new java.awt.Dimension(55, 25));
jButton1.setPreferredSize(new java.awt.Dimension(55, 25));
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButtonNext.setText("Next");
jButtonNext.setMaximumSize(new java.awt.Dimension(55, 25));
jButtonNext.setMinimumSize(new java.awt.Dimension(55, 25));
jButtonNext.setPreferredSize(new java.awt.Dimension(55, 25));
jButtonNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButtonNextActionPerformed(evt);
}
});
@ -1037,7 +1037,7 @@ public class TablesPanel extends javax.swing.JPanel {
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -1048,7 +1048,7 @@ public class TablesPanel extends javax.swing.JPanel {
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
@ -1058,9 +1058,6 @@ public class TablesPanel extends javax.swing.JPanel {
jSplitPane1.setDividerSize(10);
jSplitPane1.setResizeWeight(1.0);
chatPanel.setMinimumSize(new java.awt.Dimension(100, 43));
jSplitPane1.setRightComponent(chatPanel);
jSplitPane2.setBorder(null);
jSplitPane2.setDividerSize(10);
jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
@ -1085,7 +1082,7 @@ public class TablesPanel extends javax.swing.JPanel {
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
.addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 810, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1093,6 +1090,7 @@ public class TablesPanel extends javax.swing.JPanel {
);
jSplitPane1.setLeftComponent(jPanel3);
jSplitPane1.setRightComponent(chatPanelMain);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
@ -1154,7 +1152,7 @@ public class TablesPanel extends javax.swing.JPanel {
newTableDialog.showDialog(roomId);
}//GEN-LAST:event_btnNewTableActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed
synchronized (this) {
if (messages != null && !messages.isEmpty()) {
currentMessage++;
@ -1164,7 +1162,7 @@ public class TablesPanel extends javax.swing.JPanel {
this.jLabel2.setText(messages.get(currentMessage));
}
}
}//GEN-LAST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButtonNextActionPerformed
private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFilterActionPerformed
setTableFilter();
@ -1206,10 +1204,10 @@ public class TablesPanel extends javax.swing.JPanel {
private javax.swing.JToggleButton btnTypeMatch;
private javax.swing.JToggleButton btnTypeTourneyConstructed;
private javax.swing.JToggleButton btnTypeTourneyLimited;
private mage.client.chat.ChatPanel chatPanel;
private mage.client.table.PlayersChatPanel chatPanelMain;
private javax.swing.JToolBar filterBar1;
private javax.swing.JToolBar filterBar2;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButtonNext;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel2;
@ -1413,11 +1411,11 @@ class UpdatePlayersTask extends SwingWorker<Void, Collection<RoomUsersView>> {
private final Session session;
private final UUID roomId;
private final ChatPanel chat;
private final PlayersChatPanel chat;
private static final Logger logger = Logger.getLogger(UpdatePlayersTask.class);
UpdatePlayersTask(Session session, UUID roomId, ChatPanel chat) {
UpdatePlayersTask(Session session, UUID roomId, PlayersChatPanel chat) {
this.session = session;
this.roomId = roomId;
this.chat = chat;

View file

@ -349,10 +349,7 @@
</Container>
</SubComponents>
</Container>
<Component class="mage.client.chat.ChatPanel" name="chatPanel1">
<Properties>
<Property name="startMessageDone" type="boolean" value="true"/>
</Properties>
<Component class="mage.client.chat.ChatPanelBasic" name="chatPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>

View file

@ -49,7 +49,7 @@ import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.table.AbstractTableModel;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
import mage.client.chat.ChatPanelBasic;
import mage.client.dialog.PreferencesDialog;
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH;
@ -105,8 +105,8 @@ public class TournamentPanel extends javax.swing.JPanel {
tableMatches.createDefaultColumnsFromModel();
TableUtil.setColumnWidthAndOrder(tableMatches, defaultColumnsWidthMatches, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
chatPanel1.useExtendedView(ChatPanel.VIEW_MODE.NONE);
chatPanel1.setChatType(ChatPanel.ChatType.TOURNAMENT);
chatPanel1.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
chatPanel1.setChatType(ChatPanelBasic.ChatType.TOURNAMENT);
Action action = new AbstractAction() {
@Override
@ -317,7 +317,7 @@ public class TournamentPanel extends javax.swing.JPanel {
tablePlayers = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
tableMatches = new javax.swing.JTable();
chatPanel1 = new mage.client.chat.ChatPanel();
chatPanel1 = new mage.client.chat.ChatPanelBasic();
setPreferredSize(new java.awt.Dimension(908, 580));
@ -484,8 +484,6 @@ public class TournamentPanel extends javax.swing.JPanel {
jSplitPane1.setBottomComponent(jScrollPane2);
jSplitPane2.setLeftComponent(jSplitPane1);
chatPanel1.setStartMessageDone(true);
jSplitPane2.setRightComponent(chatPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -524,7 +522,7 @@ public class TournamentPanel extends javax.swing.JPanel {
private javax.swing.JPanel actionPanel;
private javax.swing.JButton btnCloseWindow;
private javax.swing.JButton btnQuitTournament;
private mage.client.chat.ChatPanel chatPanel1;
private mage.client.chat.ChatPanelBasic chatPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSplitPane jSplitPane1;

View file

@ -36,7 +36,6 @@
package mage.client.unusedFiles;
import mage.client.cards.BigCard;
import mage.client.unusedFiles.CombatGroup;
import mage.view.CombatGroupView;
import javax.swing.*;
@ -44,9 +43,8 @@ import java.awt.*;
import java.beans.PropertyVetoException;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.client.dialog.MageDialog;
import org.apache.log4j.Logger;
/**
*
@ -54,6 +52,8 @@ import mage.client.dialog.MageDialog;
*/
public class CombatDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(CombatDialog.class);
private UUID gameId;
private BigCard bigCard;
private int lastX = 500;
@ -100,7 +100,7 @@ public class CombatDialog extends MageDialog {
try {
this.setSelected(true);
} catch (PropertyVetoException ex) {
Logger.getLogger(CombatDialog.class.getName()).log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
pack();
this.revalidate();

View file

@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
*/
public class DeckUtil {
private static final transient Logger log = Logger.getLogger(DeckUtil.class);
private static final Logger log = Logger.getLogger(DeckUtil.class);
private DeckUtil() {
}

View file

@ -303,7 +303,7 @@ public class AudioManager {
private static void checkAndPlayClip(MageClip mageClip) {
try {
if (mageClip != null) {
if (mageClip != null && mageClip.getClip() != null) {
boolean playSound = false;
switch (mageClip.getAudioGroup()) {
case GameSounds:

View file

@ -81,6 +81,7 @@ public class CardPluginImpl implements CardPlugin {
@PluginLoaded
public void newPlugin(CardPlugin plugin) {
log.info(plugin.toString() + " has been loaded.");
}
@Override

View file

@ -9,7 +9,7 @@ import org.mage.plugins.card.images.CardDownloadData;
public interface CardImageSource {
String generateURL(CardDownloadData card) throws Exception;
String generateTokenUrl(CardDownloadData card);
String generateTokenUrl(CardDownloadData card) throws Exception;
String getSourceName();
Float getAverageSize();
}

View file

@ -16,6 +16,13 @@ public class MagicCardsImageSource implements CardImageSource {
private static final Map<String, String> setNameTokenReplacement = new HashMap<String, String>() {
{
put("CMA", "commanders-arsenal");
put("ARENA", "arena-league");
put("CP", "champs");
put("UGIN", "ugins-fate");
put("APAC", "asia-pacific-land-program");
put("EURO", "european-land-program");
put("SUS", "super-series");
put("C15", "commander-2015");
put("ORG", "oath-of-the-gatewatch");
put("EXP", "zendikar-expeditions");
@ -157,7 +164,12 @@ public class MagicCardsImageSource implements CardImageSource {
@Override
public String generateTokenUrl(CardDownloadData card) {
String name = card.getName().replaceAll(" ", "-").replace(",", "").toLowerCase();
String name = card.getName();
// add type to name if it's not 0
if (card.getType() > 0) {
name = name + " " + card.getType();
}
name = name.replaceAll(" ", "-").replace(",", "").toLowerCase();
String set = "not-supported-set";
if (setNameTokenReplacement.containsKey(card.getSet())) {
set = setNameTokenReplacement.get(card.getSet());

View file

@ -0,0 +1,324 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.plugins.card.dl.sources;
import org.apache.log4j.Logger;
import org.mage.plugins.card.images.CardDownloadData;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author Quercitron
*/
public class TokensMtgImageSource implements CardImageSource {
private static final Logger logger = Logger.getLogger(TokensMtgImageSource.class);
private static CardImageSource instance = new TokensMtgImageSource();
public static CardImageSource getInstance() {
if (instance == null) {
instance = new TokensMtgImageSource();
}
return instance;
}
@Override
public String getSourceName() {
return "tokens.mtg.onl";
}
@Override
public Float getAverageSize() {
return 26.7f;
}
@Override
public String generateURL(CardDownloadData card) throws Exception {
return null;
}
private static final String[] EMBLEMS = {
"Ajani",
"Chandra",
"Dack",
"Daretti",
"Domri",
"Elspeth",
"Garruk",
"Gideon",
"Jace",
"Kiora",
"Koth",
"Liliana",
"Narset",
"Nixilis",
"Sarkhan",
"Sorin",
"Tamiyo",
"Teferi",
"Venser",
};
private static final Map<String, String> SET_NAMES_REPLACEMENT = new HashMap<String, String>() {
{
put("con", "CFX");
put("fnmp", "FNM");
}
};
@Override
public String generateTokenUrl(CardDownloadData card) throws IOException {
String name = card.getName();
String set = card.getSet();
int type = card.getType();
// handle emblems
if (name.toLowerCase().contains("emblem")) {
for (String emblem : EMBLEMS) {
if (name.toLowerCase().contains(emblem.toLowerCase())){
name = emblem + " Emblem";
break;
}
}
}
// we should replace some set names
if (SET_NAMES_REPLACEMENT.containsKey(set.toLowerCase())) {
set = SET_NAMES_REPLACEMENT.get(set.toLowerCase());
}
// Image URL contains token number
// e.g. http://tokens.mtg.onl/tokens/ORI_010-Thopter.jpg -- token number 010
// We don't know these numbers, but we can take them from a file
// with tokens information that can be downloaded from the site.
List<TokenData> tokensData = getTokensData();
if (tokensData.isEmpty()) {
return null;
}
List<TokenData> matchedTokens = new ArrayList<TokenData>();
for (TokenData token : tokensData) {
if (name.equalsIgnoreCase(token.getName()) && set.equalsIgnoreCase(token.getExpansionSetCode())) {
matchedTokens.add(token);
}
}
if (matchedTokens.isEmpty()) {
logger.info("Could not find data for token " + name + ", set " + set + ".");
return null;
}
TokenData tokenData;
if (type == 0) {
if (matchedTokens.size() > 1) {
logger.info("Multiple images were found for token " + name + ", set " + set + ".");
}
tokenData = matchedTokens.get(0);
} else {
if (type > matchedTokens.size()) {
logger.warn("Not enough images for token with type " + type + ", name " + name + ", set " + set + ".");
return null;
}
tokenData = matchedTokens.get(card.getType() - 1);
}
String url = "http://tokens.mtg.onl/tokens/" + tokenData.getExpansionSetCode().trim() + "_"
+ tokenData.getNumber().trim() + "-" + tokenData.getName().trim()+ ".jpg";
url = url.replace(' ', '-');
return url;
}
private List<TokenData> tokensData;
private final Object tokensDataSync = new Object();
private List<TokenData> getTokensData() throws IOException {
if (tokensData == null) {
synchronized (tokensDataSync) {
if (tokensData == null) {
tokensData = new ArrayList<TokenData>();
// get tokens data from resource file
InputStream inputStream = null;
try {
inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv");
List<TokenData> fileTokensData = parseTokensData(inputStream);
tokensData.addAll(fileTokensData);
} catch (Exception exception) {
logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e) {
logger.error("Input stream close failed:", e);
}
}
}
// description on site may contain new information
// try to add it
try {
URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv");
inputStream = url.openStream();
List<TokenData> siteTokensData = parseTokensData(inputStream);
List<TokenData> newTokensData = new ArrayList<TokenData>();
for (TokenData siteData : siteTokensData) {
boolean isNew = true;
for (TokenData fileData : tokensData) {
if (siteData.getName().equalsIgnoreCase(fileData.getName())
&& siteData.getNumber().equalsIgnoreCase(fileData.getNumber())
&& siteData.getExpansionSetCode().equalsIgnoreCase(fileData.getExpansionSetCode())) {
isNew = false;
break;
}
}
if (isNew) {
newTokensData.add(siteData);
}
}
tokensData.addAll(newTokensData);
} catch (Exception exception) {
logger.warn("Failed to get tokens description from tokens.mtg.onl", exception);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e) {
logger.error("Input stream close failed:", e);
}
}
}
}
}
}
return tokensData;
}
private List<TokenData> parseTokensData(InputStream inputStream) throws IOException {
List<TokenData> tokensData = new ArrayList<TokenData>();
InputStreamReader inputReader = null;
BufferedReader reader = null;
try {
// we have to specify encoding to read special comma
inputReader = new InputStreamReader(inputStream, "Cp1252");
reader = new BufferedReader(inputReader);
reader.readLine(); // skip header
String line = reader.readLine();
// states
// 0 - wait set name
// 1 - wait cards
// 2 - process cards
int state = 0;
String set = null;
while (line != null) {
if (line.trim().isEmpty()) {
if (state == 2) {
state = 0;
}
} else {
if (state == 0) {
set = line.substring(0, 3);
state = 1;
} else {
if (state == 1) {
state = 2;
}
String[] split = line.split(",");
// replace special comma for cards like 'Ashaya the Awoken World'
String name = split[0].replace('', ',');
String number = split[1];
TokenData token = new TokenData(name, number, set);
tokensData.add(token);
}
}
line = reader.readLine();
}
} finally {
if (inputReader != null) {
try {
inputReader.close();
} catch (Exception e) {
logger.error("Input reader close failed:", e);
}
}
if (reader != null) {
try {
reader.close();
} catch (Exception e) {
logger.error("Buffered reader close failed:", e);
}
}
}
return tokensData;
}
final class TokenData {
final private String name;
final private String number;
final private String expansionSetCode;
public TokenData(String name, String number, String expansionSetCode) {
this.name = name;
this.number = number;
this.expansionSetCode = expansionSetCode;
}
public String getName() {
return name;
}
public String getNumber() {
return number;
}
public String getExpansionSetCode() {
return expansionSetCode;
}
}
}

View file

@ -49,17 +49,12 @@ import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.sets.ConstructedFormats;
import mage.remote.Connection;
import static mage.remote.Connection.ProxyType.HTTP;
import static mage.remote.Connection.ProxyType.SOCKS;
import net.java.truevfs.access.TFile;
import net.java.truevfs.access.TFileOutputStream;
import net.java.truevfs.access.TVFS;
import net.java.truevfs.kernel.spec.FsSyncException;
import org.apache.log4j.Logger;
import org.mage.plugins.card.dl.sources.CardImageSource;
import org.mage.plugins.card.dl.sources.MagicCardsImageSource;
import org.mage.plugins.card.dl.sources.MythicspoilerComSource;
import org.mage.plugins.card.dl.sources.WizardCardsImageSource;
import org.mage.plugins.card.dl.sources.*;
import org.mage.plugins.card.properties.SettingsManager;
import org.mage.plugins.card.utils.CardImageUtils;
@ -140,7 +135,16 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
p0.add(jLabel1);
p0.add(Box.createVerticalStrut(5));
ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "magiccards.info", "wizards.com", "mythicspoiler.com" /*, "mtgimage.com (HQ)" , "mtgathering.ru HQ", "mtgathering.ru MQ", "mtgathering.ru LQ"*/});
ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] {
"magiccards.info",
"wizards.com",
"mythicspoiler.com",
"tokens.mtg.onl",
//"mtgimage.com (HQ)",
//"mtgathering.ru HQ",
//"mtgathering.ru MQ",
//"mtgathering.ru LQ",
});
jComboBox1 = new JComboBox();
cardImageSource = MagicCardsImageSource.getInstance();
@ -161,6 +165,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
case 2:
cardImageSource = MythicspoilerComSource.getInstance();
break;
case 3:
cardImageSource = TokensMtgImageSource.getInstance();
break;
}
int count = DownloadPictures.this.cards.size();
float mb = (count * cardImageSource.getAverageSize()) / 1024;
@ -221,7 +228,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
// JOptionPane
Object[] options = { startDownloadButton, closeButton = new JButton("Cancel") };
dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
dlg = new JOptionPane(p0, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[1]);
}
public static boolean checkForNewCards(List<CardInfo> allCards) {
@ -363,23 +370,27 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
while (line != null) {
line = line.trim();
if (line.startsWith("|")) { // new format
String[] params = line.split("\\|");
if (params.length >= 4) {
String[] params = line.split("\\|", -1);
if (params.length >= 5) {
int type = 0;
if (params[4] != null && ! params[4].isEmpty()) {
type = Integer.parseInt(params[4].trim());
}
if (params[1].toLowerCase().equals("generate") && params[2].startsWith("TOK:")) {
String set = params[2].substring(4);
CardDownloadData card = new CardDownloadData(params[3], set, 0, false, 0, "", true);
CardDownloadData card = new CardDownloadData(params[3], set, 0, false, type, "", true);
list.add(card);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM:")) {
String set = params[2].substring(7);
CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, 0, false,0, "", true);
CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, 0, false, type, "", true);
list.add(card);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM-:")) {
String set = params[2].substring(8);
CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, 0, false, 0, "", true);
CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, 0, false, type, "", true);
list.add(card);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM!:")) {
String set = params[2].substring(8);
CardDownloadData card = new CardDownloadData(params[3], set, 0, false, 0, "", true);
CardDownloadData card = new CardDownloadData(params[3], set, 0, false, type, "", true);
list.add(card);
}
} else {

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,6 @@ ddd=gvl
unh=uh
dde=pvc
# Remove setname as soon as the images can be downloaded
ignore.urls=TOK, OGW, C15
ignore.urls=TOK, OGW
# sets ordered by release time (newest goes first)
token.lookup.order=C15,OGW,EXP,DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
token.lookup.order=CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC

View file

@ -0,0 +1,712 @@
Token name, Number, Color, P/T, Promo, Type, Artist, Text
UGL - Unglued (1998-08-11)
Pegasus, 89, W, 1|1, -, Creature - Pegasus, Mark Zug, Flying
Soldier, 90, W, 1|1, -, Creature - Soldier, Daren Bader, -
Zombie, 91, B, 2|2, -, Creature - Zombie, Christopher Rush, -
Goblin, 92, R, 1|1, -, Creature - Goblin, Pete Venters, -
Sheep, 93, G, 1|1, -, Creature - Sheep, Kev Walker, -
Squirrel, 94, G, 1|1, -, Creature - Squirrel, Ron Spencer, -
ATH - Anthologies (1998-11-01)
Pegasus, 89, W, 1|1, -, Creature - Pegasus, Mark Zug, Flying
Goblin, 92, R, 1|1, -, Creature - Goblin, Pete Venters, -
INV - Invasion (2000-10-02)
Bird, T1, U, 1|1, Player Rewards, Creature - Bird, Michael Sutfin, Flying
Elephant, T2, G, 3|3, Player Rewards, Creature - Elephant, Terese Nielsen, -
Saproling, T3, G, 1|1, Player Rewards, Creature - Saproling, Jeff Laubenstein, -
PLS - Planeshift (2001-02-05)
Spirit, T1, W, 1|1, Player Rewards, Creature - Spirit, John Matson, Flying
APC - Apocalypse (2001-06-04)
Goblin Soldier, T1, R W, 1|1, Player Rewards, Creature - Goblin Soldier, Ron Spears, -
ODY - Odyssey (2001-10-01)
Bear, T1, G, 2|2, Player Rewards, Creature - Bear, Heather Hudson, -
Beast, T2, G, 4|4, Player Rewards, Creature - Beast, Larry Elmore, -
Elephant, T3, G, 3|3, Player Rewards, Creature - Elephant, Arnie Swekel, -
Squirrel, T4, G, 1|1, Player Rewards, Creature - Squirrel, Ron Spencer, -
Wurm, T5, G, 6|6, Player Rewards, Creature - Wurm, Alan Pollack, -
Zombie, T6, B, 2|2, Player Rewards, Creature - Zombie, Dana Knutson, -
ONS - Onslaught (2002-10-07)
Bear, T1, G, 2|2, Player Rewards, Creature - Bear, Glen Angus, -
Dragon, T2, R, 5|5, Player Rewards, Creature - Dragon, Glen Angus, Flying
Insect, T3, G, 1|1, Player Rewards, Creature - Insect, Anthony S. Waters, -
Soldier, T4, W, 1|1, Player Rewards, Creature - Soldier, Ron Spencer, -
LGN - Legions (2003-02-03)
Goblin, T1, R, 1|1, Player Rewards, Creature - Goblin, Darrell Riche, -
Sliver, T2, -, 1|1, Player Rewards, Creature - Sliver, Tony Szczudlo, -
SCG - Scourge (2003-05-26)
Angel, T1, W, 4|4, Player Rewards, Creature - Angel, Scott M. Fischer, Flying
8ED - Eighth Edition (2003-07-28)
Rukh, T1, R, 4|4, Player Rewards, Creature - Rukh, Edward P. Beard Jr., Flying
MRD - Mirrodin (2003-10-02)
Demon, T1, B, *|*, Player Rewards, Creature - Demon, Pete Venters, -
Myr, T2, -, 1|1, Player Rewards, Creature - Myr, Wayne England, -
Pentavite, T3, -, 1|1, Player Rewards, Artifact Creature - Pentavite, Greg Staples, -
DST - Darksteel (2004-02-06)
Beast, T1, G, 3|3, Player Rewards, Creature - Beast, Edward P. Beard Jr., -
CHK - Champions of Kamigawa (2004-10-01)
Spirit, T1, -, 1|1, Player Rewards, Creature - Spirit, Hugh Jamieson, -
CSP - Coldsnap (2006-07-21)
Marit Lage, T1, B, 20|20, Pre-Release, Creature - Avatar, Stephan Martiniere, Flying indestructible
10E - Tenth Edition (2007-07-13)
Soldier, 1, W, 1|1, -, Creature - Soldier, Parente, -
Zombie, 2, B, 2|2, -, Creature - Zombie, Carl Critchlow, -
Dragon, 3, R, 5|5, -, Creature - Dragon, Jim Pavelec, Flying
Goblin, 4, R, 1|1, -, Creature - Goblin, Dave Kendall, -
Saproling, 5, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, -
Wasp, 6, -, 1|1, -, Artifact Creature - Insect, Ron Spencer, Flying
LRW - Lorwyn (2007-10-12)
Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total.
Elemental, 2, W, 4|4, -, Creature - Elemental, Anthony S. Waters, Flying
Kithkin Soldier, 3, W, 1|1, -, Creature - Kithkin Soldier, Greg Hildebrandt, -
Merfolk Wizard, 4, U, 1|1, -, Creature - Merfolk Wizard, Mark Poole, -
Goblin Rogue, 5, B, 1|1, -, Creature - Goblin Rogue, Richard Sardinha, -
Elemental Shaman, 6, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, -
Beast, 7, G, 3|3, -, Creature - Beast, John Donahue, -
Elemental, 8, G, 4|4, -, Creature - Elemental, Brandon Kitkouski, -
Elf Warrior, 9, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, -
Wolf, 10, G, 2|2, -, Creature - Wolf, Pete Venters, -
Shapeshifter, 11, -, 1|1, -, Creature - Shapeshifter, Franz Vohwinkel, Changeling
EVG - Duel Decks: Elves vs. Goblins (2007-11-16)
Elemental, T1, G, 7|7, -, Creature - Elemental, Anthony S. Waters, Trample
Elf Warrior, T2, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, -
Goblin, T3, R, 1|1, -, Creature - Goblin, Dave Kendall, -
MOR - Morningtide (2008-02-01)
Giant Warrior, 1, W, 5|5, -, Creature - Giant Warrior, Steve Ellis, -
Faerie Rogue, 2, B, 1|1, -, Creature - Faerie Rogue, Jim Nelson, Flying
Treefolk Shaman, 3, G, 2|5, -, Creature - Treefolk Shaman, Richard Sardinha, -
SHM - Shadowmoor (2008-05-02)
Kithkin Soldier, 1, W, 1|1, -, Creature - Kithkin Soldier, Randy Gallegos, -
Spirit, 2, W, 1|1, -, Creature - Spirit, Jeremy Enecio, Flying
Rat, 3, B, 1|1, -, Creature - Rat, Carl Critchlow, -
Elemental, 4, R, 1|1, -, Creature - Elemental, Cyril Van Der Haegen, Haste
Elf Warrior, 5, G, 1|1, -, Creature - Elf Warrior, William O'Connor, -
Spider, 6, G, 1|2, -, Creature - Spider, Thomas M. Baxa, Reach
Wolf, 7, G, 2|2, -, Creature - Wolf, Lars Grant-West, -
Faerie Rogue, 8, U B, 1|1, -, Creature - Faerie Rogue, E. M. Gist, Flying
Elemental, 9, B R, 5|5, -, Creature - Elemental, Dave Dorman, -
Giant Warrior, 10, R G, 4|4, -, Creature - Giant Warrior, Trevor Hairsine, Haste
Goblin Warrior, 11, R G, 1|1, -, Creature - Goblin Warrior, Dave Allsop, -
Elf Warrior, 12, G W, 1|1, -, Creature - Elf Warrior, Carl Frank, -
EVE - Eventide (2008-07-25)
Goat, 1, W, -, -, Creature - Goat, Terese Nielsen, -
Bird, 2, U, 1|1, -, Creature - Bird, Heather Hudson, Flying
Beast, 3, G, 3|3, -, Creature - Beast, William O'Connor, -
Spirit, 4, W B, 1|1, -, Creature - Spirit, Larry MacDougall, Flying
Elemental, 5, U R, 5|5, -, Creature - Elemental, Randy Gallegos, Flying
Worm, 6, B G, 1|1, -, Creature - Worm, Chuck Lukacs, -
Goblin Soldier, 7, R W, 1|1, -, Creature - Goblin Soldier, Jeff Miracola, -
ALA - Shards of Alara (2008-10-03)
Soldier, 1, W, 1|1, -, Creature - Soldier, Alan Pollack, -
Homunculus, 2, U, -, -, Artifact Creature - Homunculus, Howard Lyon, -
Thopter, 3, U, 1|1, -, Artifact Creature - Thopter, Andrew Murray, Flying
Skeleton, 4, B, 1|1, -, Creature - Skeleton, Thomas M. Baxa, {B}: Regenerate this creature.
Zombie, 5, B, 2|2, -, Creature - Zombie, Dave Kendall, -
Dragon, 6, R, 4|4, -, Creature - Dragon, Vance Kovacs, Flying
Goblin, 7, R, 1|1, -, Creature - Goblin, Brandon Kitkouski, -
Ooze, 8, G, *|*, -, Creature - Ooze, Anthony S. Waters, -
Saproling, 9, G, 1|1, -, Creature - Saproling, Trevor Claxton, -
Beast, 10, R G W, 8|8, -, Creature - Beast, Parente, -
DD2 - Duel Decks: Jace vs. Chandra (2008-11-07)
Elemental Shaman, T1, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, -
CFX - Conflux (2009-02-06)
Angel, 1, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying
Elemental, 2, R, 3|1, -, Creature - Elemental, Vance Kovacs, -
DDC - Duel Decks: Divine vs. Demonic (2009-04-10)
Spirit, T1, W, 1|1, -, Creature - Spirit, Luca Zontini, Flying
Demon, T2, B, *|*, -, Creature - Demon, Pete Venters, Flying
Thrull, T3, B, -, -, Creature - Thrull, Veronique Meignaud, -
ARB - Alara Reborn (2009-04-30)
Bird Soldier, 1, W, 1|1, -, Creature - Bird Soldier, Matt Cavotta, Flying
Lizard, 2, G, 2|2, -, Creature - Lizard, Anthony S. Waters, -
Dragon, 3, R G, 1|1, -, Creature - Dragon, Jaime Jones, Flying devour 2
Zombie Wizard, 4, U B, 1|1, -, Creature - Zombie Wizard, Dave Allsop, -
M10 - Magic 2010 (2009-07-17)
Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total.
Soldier, 2, W, 1|1, -, Creature - Soldier, Parente, -
Zombie, 3, B, 2|2, -, Creature - Zombie, Bud Cook, -
Goblin, 4, R, 1|1, -, Creature - Goblin, Dave Kendall, -
Beast, 5, G, 3|3, -, Creature - Beast, John Donahue, -
Insect, 6, G, 1|1, -, Creature - Insect, Ron Spencer, -
Wolf, 7, G, 2|2, -, Creature - Wolf, Lars Grant-West, -
Gargoyle, 8, -, 3|4, -, Artifact Creature - Gargoyle, Paul Bonner, Flying
ZEN - Zendikar (2009-10-02)
Angel, 1, W, 4|4, -, Creature - Angel, Adi Granov, Flying
Bird, 2, W, 1|1, -, Creature - Bird, Howard Lyon, Flying
Kor Soldier, 3, W, 1|1, -, Creature - Kor Soldier, Daren Bader, -
Illusion, 4, U, 2|2, -, Creature - Illusion, Cyril Van Der Haegen, -
Merfolk, 5, U, 1|1, -, Creature - Merfolk, Warren Mahy, -
Vampire, 6, B, *|*, -, Creature - Vampire, Kekai Kotaki, -
Zombie Giant, 7, B, 5|5, -, Creature - Zombie Giant, Igor Kieryluk, -
Elemental, 8, R, 7|1, -, Creature - Elemental, Anthony Francisco, Trample haste
Beast, 9, G, 4|4, -, Creature - Beast, Steve Prescott, -
Snake, 10, G, 1|1, -, Creature - Snake, Austin Hsu, -
Wolf, 11, G, 2|2, -, Creature - Wolf, Daren Bader, -
DDD - Duel Decks: Garruk vs. Liliana (2009-10-30)
Beast, T1, G, 3|3, -, Creature - Beast, John Donahue, -
Beast, T2, G, 4|4, -, Creature - Beast, Steve Prescott, -
Elephant, T3, G, 3|3, -, Creature - Elephant, Arnie Swekel, -
WWK - Worldwake (2010-02-05)
Soldier Ally, 1, W, 1|1, -, Creature - Soldier Ally, Kekai Kotaki, -
Dragon, 2, R, 5|5, -, Creature - Dragon, Raymond Swanland, Flying
Ogre, 3, R, 3|3, -, Creature - Ogre, Paul Bonner, -
Elephant, 4, G, 3|3, -, Creature - Elephant, Lars Grant-West, -
Plant, 5, G, -, -, Creature - Plant, Daren Bader, -
Construct, 6, -, 6|12, -, Artifact Creature - Construct, Jung Park, Trample
DDE - Duel Decks: Phyrexia vs. the Coalition (2010-03-19)
Hornet, T1, -, 1|1, -, Artifact Creature - Insect, Ron Spencer, Flying haste
Minion, T2, B, *|*, -, Creature - Minion, Dave Kendall, -
Saproling, T3, G, 1|1, -, Creature - Saproling, Warren Mahy, -
ROE - Rise of the Eldrazi (2010-04-23)
Eldrazi Spawn, 1a, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 1b, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 1c, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool.
Elemental, 2, R, *|*, -, Creature - Elemental, Jung Park, -
Hellion, 3, R, 4|4, -, Creature - Hellion, Anthony Francisco, -
Ooze, 4, G, *|*, -, Creature - Ooze, Daniel Ljunggren, -
Tuktuk The Returned, 5, -, 5|5, -, Legendary Artifact Creature - Goblin Golem, Franz Vohwinkel, -
M11 - Magic 2011 (2010-07-16)
Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total.
Bird, 2, W, 3|3, -, Creature - Bird, Paul Bonner, Flying
Zombie, 3, B, 2|2, -, Creature - Zombie, Bud Cook, -
Beast, 4, G, 3|3, -, Creature - Beast, John Donahue, -
Ooze, 5, G, 2|2, -, Creature - Ooze, Raymond Swanland, When this creature dies put two 1/1 green Ooze creature tokens onto the battlefield.
Ooze, 6, G, 1|1, -, Creature - Ooze, Raymond Swanland, -
DDF - Duel Decks: Elspeth vs. Tezzeret (2010-09-03)
Soldier, T1, W, 1|1, -, Creature - Soldier, Parente, -
SOM - Scars of Mirrodin (2010-10-01)
Cat, 1, W, 2|2, -, Creature - Cat, Scott Chou, -
Soldier, 2, W, 1|1, -, Creature - Soldier, Goran Josic, -
Goblin, 3, R, 1|1, -, Creature - Goblin, Goran Josic, -
Insect, 4, G, 1|1, -, Creature - Insect, Adrian Smith, Infect
Wolf, 5, G, 2|2, -, Creature - Wolf, Chris Rahn, -
Golem, 6, -, 3|3, -, Artifact Creature - Golem, Nic Klein, -
Myr, 7, -, 1|1, -, Artifact Creature - Myr, Ryan Pancoast, -
Wurm, 8, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Deathtouch
Wurm, 9, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Lifelink
Poison Counter, -, -, -, -, Emblem, -, -
MBS - Mirrodin Besieged (2011-02-04)
Germ, 1, B, -, -, Creature - Germ, Igor Kieryluk, -
Zombie, 2, B, 2|2, -, Creature - Zombie, Dave Kendall, -
Golem, 3, -, 9|9, -, Artifact Creature - Golem, Svetlin Velinov, -
Horror, 4, -, *|*, -, Artifact Creature - Horror, Scott Chou, -
Thopter, 5, -, 1|1, -, Artifact Creature - Thopter, Volkan Baga, Flying
Poison Counter, -, -, -, -, Emblem, -, -
DDG - Duel Decks: Knights vs. Dragons (2011-04-01)
Goblin, T1, R, 1|1, -, Creature - Goblin, Brandon Kitkouski, -
NPH - New Phyrexia (2011-05-13)
Beast, 1, G, 3|3, -, Creature - Beast, Dave Allsop, -
Goblin, 2, R, 1|1, -, Creature - Goblin, Jaime Jones, -
Golem, 3, -, 3|3, -, Artifact Creature - Golem, Volkan Baga, -
Myr, 4, -, 1|1, -, Artifact Creature - Myr, Matt Stewart, -
Poison Counter, -, -, -, -, Emblem, -, -
M12 - Magic 2012 (2011-07-15)
Bird, 1, W, 3|3, -, Creature - Bird, Paul Bonner, Flying
Soldier, 2, W, 1|1, -, Creature - Soldier, Parente, -
Zombie, 3, B, 2|2, -, Creature - Zombie, Carl Critchlow, -
Beast, 4, G, 3|3, -, Creature - Beast, John Donahue, -
Saproling, 5, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, -
Wurm, 6, G, 6|6, -, Creature - Wurm, Anthony Francisco, -
Pentavite, 7, -, 1|1, -, Artifact Creature - Pentavite, Greg Staples, Flying
DDH - Duel Decks: Ajani vs. Nicol Bolas (2011-09-02)
Griffin, T1, W, 2|2, -, Creature - Griffin, Jim Nelson, Flying
Saproling, T2, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, -
ISD - Innistrad (2011-09-30)
Angel, 1, W, 4|4, -, Creature - Angel, Winona Nelson, Flying
Spirit, 2, W, 1|1, -, Creature - Spirit, Kev Walker, Flying
Homunculus, 3, U, 2|2, -, Creature - Homunculus, Johann Bodin, -
Demon, 4, B, 5|5, -, Creature - Demon, Kev Walker, Flying
Vampire, 5, B, 2|2, -, Creature - Vampire, Svetlin Velinov, Flying
Wolf, 6, B, 1|1, -, Creature - Wolf, Daniel Ljunggren, Deathtouch
Zombie, 7, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Zombie, 8, B, 2|2, -, Creature - Zombie, Christopher Moeller, -
Zombie, 9, B, 2|2, -, Creature - Zombie, Cynthia Sheppard, -
Ooze, 10, G, *|*, -, Creature - Ooze, Erica Yang, This creature's power and toughness are each equal to the number of slime counters on Gutter Grime.
Spider, 11, G, 1|2, -, Creature - Spider, Daniel Ljunggren, Reach
Wolf, 12, G, 2|2, -, Creature - Wolf, David Palumbo, -
Wolf, T12, G, 2|2, Judge, Creature - Wolf, David Palumbo, -
DKA - Dark Ascension (2012-02-03)
Human, 1, W, 1|1, -, Creature - Human, John Stanko, -
Vampire, 2, B, 1|1, -, Creature - Vampire, Peter Mohrbacher, Lifelink
Sorin Emblem, 3, -, -, -, Emblem - Sorin, Michael Komrack, Creatures you control get +1/+0.
DDI - Duel Decks: Venser vs. Koth (2012-03-30)
Koth Emblem, E1, -, -, -, Emblem - Koth, Eric Deschamps, Mountains you control have Tap: This land deals 1 damage to target creature or player.'
Venser Emblem, E2, -, -, -, Emblem - Venser, Eric Deschamps, Whenever you cast a spell exile target permanent.
FNM - Friday Night Magic (2012-04-01)
Human, T1a, W, 1|1, Full Moon, Creature - Human, Lars Grant-West, -
Wolf, T1b, G, 2|2, Full Moon, Creature - Wolf, Lars Grant-West, -
AVR - Avacyn Restored (2012-05-04)
Angel, 1, W, 4|4, -, Creature - Angel, Anthony Palumbo, Flying
Human, 2, W, 1|1, -, Creature - Human, Michael C. Hayes, -
Spirit, 3, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying
Spirit, 4, U, 1|1, -, Creature - Spirit, Dan Scott, Flying
Demon, 5, B, 5|5, -, Creature - Demon, Kev Walker, Flying
Zombie, 6, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Human, 7, R, 1|1, -, Creature - Human, Ryan Pancoast, Haste
Tamiyo Emblem, 8, -, -, -, Emblem - Tamiyo, Eric Deschamps, You have no maximum hand size. Whenever a card is put into your graveyard from anywhere you may return it to your hand.
Angel, T1, W, 4|4, Pre-Release, Creature - Angel, James Ryman, Flying
Angel, T1F, W, 4|4, Pre-Release, Creature - Angel, James Ryman, Flying
Demon, T5, B, 5|5, Pre-Release, Creature - Demon, Karl Kopinski, Flying
Demon, T5F, B, 5|5, Pre-Release, Creature - Demon, Karl Kopinski, Flying
M13 - Magic 2013 (2012-07-13)
Goblin, 1, R, 1|1, League, Creature - Goblin, Jim Nelson, -
Cat, 1, W, 2|2, -, Creature - Cat, Jesper Ejsing, -
Goat, 2, W, -, -, Creature - Goat, Adam Paquette, -
Soldier, 3, W, 1|1, -, Creature - Soldier, Greg Staples, -
Drake, 4, U, 2|2, -, Creature - Drake, Svetlin Velinov, Flying
Zombie, 5, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Goblin, 6, R, 1|1, -, Creature - Goblin, Karl Kopinski, -
Hellion, 7, R, 4|4, -, Creature - Hellion, Anthony Francisco, -
Beast, 8, G, 3|3, -, Creature - Beast, John Donahue, -
Saproling, 9, G, 1|1, -, Creature - Saproling, Brad Rigney, -
Wurm, 10, G, 6|6, -, Creature - Wurm, Anthony Francisco, -
Liliana Emblem, 11, -, -, -, Emblem - Liliana, D. Alexander Gregory, Swamps you control have Tap: Add {B}{B}{B}{B} to your mana pool.'
DDJ - Duel Decks: Izzet vs. Golgari (2012-09-07)
Saproling, T1, G, 1|1, -, Creature - Saproling, Brad Rigney, -
RTR - Return to Ravnica (2012-10-05)
Centaur, 1, G, 3|3, Judge, Creature - Centaur, James Ryman, -
Knight, 1, W, 2|2, League, Creature - Knight, Lucas Graciano, Vigilance
Bird, 1, W, 1|1, -, Creature - Bird, James Ryman, Flying
Knight, 2, W, 2|2, -, Creature - Knight, Matt Stewart, Vigilance
Soldier, 3, W, 1|1, -, Creature - Soldier, Steve Prescott, -
Assassin, 4, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player that player loses the game.
Dragon, 5, R, 6|6, -, Creature - Dragon, Mark Zug, Flying
Goblin, 6, R, 1|1, -, Creature - Goblin, Christopher Moeller, -
Centaur, 7, G, 3|3, -, Creature - Centaur, Slawomir Maniak, -
Ooze, 8, G, *|*, -, Creature - Ooze, Marco Nelor, -
Rhino, 9, G, 4|4, -, Creature - Rhino, Tomasz Jedruszek, Trample
Saproling, 10, G, 1|1, -, Creature - Saproling, Raoul Vitale, -
Wurm, 11, G, 5|5, -, Creature - Wurm, Anthony Palumbo, Trample
Elemental, 12, G W, 8|8, -, Creature - Elemental, Yeong-Hao Han, Vigilance
GTC - Gatecrash (2013-02-01)
Soldier, 1, R W, 1|1, League, Creature - Soldier, Zoltan Boros, Haste
Angel, 1, W, 4|4, -, Creature - Angel, Steve Argyle, Flying
Rat, 2, B, 1|1, -, Creature - Rat, Nils Hamm, -
Frog Lizard, 3, G, 3|3, -, Creature - Frog Lizard, Jack Wang, -
Cleric, 4, W B, 1|1, -, Creature - Cleric, Jason Chan, {3}{W}{B}{B} {T} Sacrifice this creature: Return a card named Deathpact Angel from your graveyard to the battlefield.
Horror, 5, U B, 1|1, -, Creature - Horror, Adam Paquette, Flying
Soldier, 6, R W, 1|1, -, Creature - Soldier, David Palumbo, Haste
Spirit, 7, W B, 1|1, -, Creature - Spirit, Cliff Childs, Flying
Domri Emblem, 8, -, -, -, Emblem - Domri, Tyler Jacobson, Creatures you control have double strike trample hexproof and haste.
DDK - Duel Decks: Sorin vs. Tibalt (2013-03-15)
Spirit, T1, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying
DGM - Dragon's Maze (2013-05-03)
Bird, 1, W, 1|1, League, Creature - Bird, Martina Pilcerova, Flying
Elemental, 1, G W, *|*, -, Creature - Elemental, Mark Winters, This creature's power and toughness are each equal to the number of creatures you control.
MMA - Modern Masters (2013-06-07)
Giant Warrior, 1, W, 5|5, -, Creature - Giant Warrior, Svetlin Velinov, -
Kithkin Soldier, 2, W, 1|1, -, Creature - Kithkin Soldier, Randy Gallegos, -
Soldier, 3, W, 1|1, -, Creature - Soldier, Goran Josic, -
Illusion, 4, U, 1|1, -, Creature - Illusion, Veronique Meignaud, -
Bat, 5, B, 1|1, -, Creature - Bat, Wayne Reynolds, Flying
Goblin Rogue, 6, B, 1|1, -, Creature - Goblin Rogue, Dave Kendall, -
Spider, 7, B, 2|4, -, Creature - Spider, Lars Grant-West, Reach
Zombie, 8, B, 2|2, -, Creature - Zombie, Bud Cook, -
Dragon, 9, R, 4|4, -, Creature - Dragon, Vance Kovacs, Flying
Goblin, 10, R, 1|1, -, Creature - Goblin, Dave Kendall, -
Elemental, 11, G, 4|4, -, Creature - Elemental, Brandon Kitkouski, -
Saproling, 12, G, 1|1, -, Creature - Saproling, Warren Mahy, -
Treefolk Shaman, 13, G, 2|5, -, Creature - Treefolk Shaman, Zack Stella, -
Faerie Rogue, 14, U B, 1|1, -, Creature - Faerie Rogue, E. M. Gist, Flying
Worm, 15, B G, 1|1, -, Creature - Worm, Chuck Lukacs, -
Elspeth Emblem, 16, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts creatures enchantments and lands you control have indestructible.
M14 - Magic 2014 Core Set (2013-07-19)
Sliver, 1, -, 1|1, -, Creature - Sliver, Igor Kieryluk, -
Angel, 1, W, 4|4, -, Creature - Angel, James Ryman, Flying
Cat, 3, W, 2|2, -, Creature - Cat, Jesper Ejsing, -
Goat, 4, W, -, -, Creature - Goat, Adam Paquette, -
Zombie, 5, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Dragon, 6, R, 2|2, -, Creature - Dragon, Jack Wang, Flying {R}: This creature gets +1/+0 until end of turn.
Elemental, 7, R, 1|1, -, Creature - Elemental, Jaime Jones, -
Elemental, 8, R, 1|1, -, Creature - Elemental, Winona Nelson, -
Beast, 9, G, 3|3, -, Creature - Beast, John Donahue, -
Saproling, 10, G, 1|1, -, Creature - Saproling, Brad Rigney, -
Wolf, 11, G, 2|2, -, Creature - Wolf, Lars Grant-West, -
Liliana Emblem, 12, -, -, -, Emblem - Liliana, D. Alexander Gregory, Swamps you control have Tap: Add {B}{B}{B}{B} to your mana pool.'
Garruk Emblem, 13, -, -, -, Emblem - Garruk, Karl Kopinski, Whenever you cast a creature spell you may search your library for a creature card put it onto the battlefield then shuffle your library.
Sliver, T1, -, 1|1, League, Creature - Sliver, Vincent Proce, -
DDL - Duel Decks: Heroes vs. Monsters (2013-09-06)
Griffin, T1, W, 2|2, -, Creature - Griffin, Johann Bodin, Flying
Beast, T2, G, 3|3, -, Creature - Beast, Jesper Ejsing, -
THS - Theros (2013-09-27)
Golem, 1, -, 3|3, Judge, Enchantment Artifact Creature - Golem, Yeong-Hao Han, -
Soldier, 1, W, 1|1, League, Creature - Soldier, Johann Bodin, -
Cleric, 1, W, 2|1, -, Enchantment Creature - Cleric, Johann Bodin, -
Soldier, 2, W, 1|1, -, Creature - Soldier, Seb McKinnon, -
Soldier, 3, W, 1|1, -, Creature - Soldier, Svetlin Velinov, -
Bird, 4, U, 2|2, -, Creature - Bird, Peter Mohrbacher, Flying
Elemental, 5, U, 1|0, -, Creature - Elemental, Karl Kopinski, -
Harpy, 6, B, 1|1, -, Creature - Harpy, Nils Hamm, Flying
Soldier, 7, R, 1|1, -, Creature - Soldier, Johann Bodin, -
Boar, 8, G, 2|2, -, Creature - Boar, James Ryman, -
Satyr, 9, R G, 2|2, -, Creature - Satyr, Johann Bodin, -
Golem, 10, -, 3|3, -, Enchantment Artifact Creature - Golem, Yeong-Hao Han, -
Elspeth Emblem, 11, -, -, -, Emblem - Elspeth, Eric Deschamps, Creatures you control get +2/+2 and have flying.
BNG - Born of the Gods (2014-02-07)
Soldier, 1, W, 1|1, League, Enchantment Creature - Soldier, Ryan Barger, -
Bird, 1, W, 1|1, -, Creature - Bird, Clint Cearly, Flying
Cat Soldier, 2, W, 1|1, -, Creature - Cat Soldier, Scott Chou, Vigilance
Soldier, 3, W, 1|1, -, Enchantment Creature - Soldier, David Palumbo, -
Bird, 4, U, 2|2, -, Enchantment Creature - Bird, Mike Sass, Flying
Kraken, 5, U, 9|9, -, Creature - Kraken, Dan Scott, -
Zombie, 6, B, 2|2, -, Enchantment Creature - Zombie, Winona Nelson, -
Elemental, 7, R, 3|1, -, Enchantment Creature - Elemental, Greg Staples, -
Centaur, 8, G, 3|3, -, Enchantment Creature - Centaur, Ryan Barger, -
Wolf, 9, G, 2|2, -, Creature - Wolf, Raoul Vitale, -
Gold, 10, -, -, -, Artifact, Richard Wright, Sacrifice this artifact: Add one mana of any color to your mana pool.
Kiora Emblem, 11, -, -, -, Emblem - Kiora, Scott M. Fischer, At the beginning of your end step put a 9/9 blue Kraken creature token onto the battlefield.
DDM - Duel Decks: Jace vs. Vraska (2014-03-14)
Assassin, T1, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player that player loses the game.
JOU - Journey into Nyx (2014-05-02)
Minotaur, 1, R, 2|3, League, Creature - Minotaur, Scott Murphy, -
Sphinx, 1, U, 4|4, -, Creature - Sphinx, Jesper Ejsing, Flying
Zombie, 2, B, *|*, -, Creature - Zombie, Zack Stella, -
Minotaur, 3, R, 2|3, -, Creature - Minotaur, Craig J Spearing, -
Hydra, 4, G, *|*, -, Creature - Hydra, Steve Prescott, -
Spider, 5, G, 1|3, -, Enchantment Creature - Spider, Yohann Schepacz, Reach
Snake, 6, G B, 1|1, -, Enchantment Creature - Snake, Greg Staples, Deathtouch
MD1 - Modern Event Deck 2014 (2014-05-30)
Soldier, 1, W, 1|1, -, Creature - Soldier, Goran Josic, -
Spirit, 2, W, 1|1, -, Creature - Spirit, Kev Walker, Flying
Myr, 3, -, 1|1, -, Artifact Creature - Myr, Matt Stewart, -
Elspeth Emblem, 4, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts creatures enchantments and lands you control have indestructible.
CNS - Conspiracy (2014-06-06)
Spirit, 1, W, 1|1, -, Creature - Spirit, Jeff Simpson, Flying
Demon, 2, B, *|*, -, Creature - Demon, Evan Shipard, Flying
Zombie, 3, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Ogre, 4, R, 4|4, -, Creature - Ogre, Dave Kendall, -
Elephant, 5, G, 3|3, -, Creature - Elephant, Lars Grant-West, -
Squirrel, 6, G, 1|1, -, Creature - Squirrel, Daniel Ljunggren, -
Wolf, 7, G, 2|2, -, Creature - Wolf, Raoul Vitale, -
Construct, 8, -, 1|1, -, Artifact Creature - Construct, Adam Paquette, Defender
Dack Emblem, 9, -, -, -, Emblem - Dack, Eric Deschamps, Whenever you cast a spell that targets one or more permanents gain control of those permanents.
M15 - Magic 2015 Core Set (2014-07-18)
Wolf, 001, G, 1|1, Pre-Release, Creature - Wolf, David Palumbo, -
Sliver, 001, -, 1|1, -, Creature - Sliver, Igor Kieryluk, -
Squid, 001, U, 1|1, League, Creature - Squid, Richard Wright, Islandwalk
Soldier, 002, W, 1|1, -, Creature - Soldier, Greg Staples, -
Spirit, 003, W, 1|1, -, Creature - Spirit, Mike Sass, Flying
Squid, 004, U, 1|1, -, Creature - Squid, Jack Wang, Islandwalk
Beast, 005, B, 3|3, -, Creature - Beast, John Donahue, Deathtouch
Zombie, 006, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Dragon, 007, R, 2|2, -, Creature - Dragon, Jack Wang, Flying {R}: This creature gets +1/+0 until end of turn.
Goblin, 008, R, 1|1, -, Creature - Goblin, Karl Kopinski, -
Beast, 009, G, 3|3, -, Creature - Beast, Dave Kendall, -
Insect, 010, G, 1|1, -, Creature - Insect, Martina Pilcerova, Flying deathtouch
Treefolk Warrior, 011, G, *|*, -, Creature - Treefolk Warrior, Todd Lockwood, This creature's power and toughness are each equal to the number of Forests you control.
Land Mine, 012, -, -, -, Artifact, Kev Walker, {R} Sacrifice this artifact: This artifact deals 2 damage to target attacking creature without flying.
Ajani Emblem, 013, -, -, -, Emblem - Ajani, Chris Rahn, If a source would deal damage to you or a planeswalker you control prevent all but 1 of that damage.
Garruk Emblem, 014, -, -, -, Emblem - Garruk, Tyler Jacobson, Whenever a creature attacks you it gets +5/+5 and gains trample until end of turn.
DDN - Duel Decks: Speed vs. Cunning (2014-09-05)
Goblin, 082, R, 1|1, -, Creature - Goblin, Karl Kopinski, -
KTK - Khans of Tarkir (2014-09-26)
Warrior, 001, W, 1|1, League, Creature - Warrior, Winona Nelson, -
Bird, 001, W, 3|4, -, Creature - Bird, Mark Zug, Flying
Spirit, 002, W, 1|1, -, Creature - Spirit, Mike Sass, Flying
Warrior, 003, W, 1|1, -, Creature - Warrior, Ryan Barger, -
Warrior, 004, W, 1|1, -, Creature - Warrior, Yefim Kligerman, -
Vampire, 005, B, 2|2, -, Creature - Vampire, Cynthia Sheppard, Flying
Zombie, 006, B, 2|2, -, Creature - Zombie, Wayne Reynolds, -
Goblin, 007, R, 1|1, -, Creature - Goblin, Kev Walker, -
Bear, 008, G, 4|4, -, Creature - Bear, Kev Walker, -
Snake, 009, G, 1|1, -, Creature - Snake, Lars Grant-West, -
Spirit Warrior, 010, B G, *|*, -, Creature - Spirit Warrior, Ryan Alexander Lee, -
Morph, 011, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down creature with this reminder card. A card with morph can be turned face up any time for its morph cost.)
Sarkhan Emblem, 012, -, -, -, Emblem - Sarkhan, Daarken, At the beginning of your draw step draw two additional cards. At the beginning of your end step discard your hand.
Sorin Emblem, 013, -, -, -, Emblem - Sorin, Cynthia Sheppard, At the beginning of each opponent's upkeep that player sacrifices a creature.
C14 - Commander 2014 (2014-11-07)
Angel, 001, W, 4|4, -, Creature - Angel, Anthony Palumbo, Flying
Cat, 002, W, 2|2, -, Creature - Cat, Scott Chou, -
Goat, 003, W, -, -, Creature - Goat, Adam Paquette, -
Kor Soldier, 004, W, 1|1, -, Creature - Kor Soldier, Daren Bader, -
Pegasus, 005, W, 1|1, -, Creature - Pegasus, Greg Hildebrandt, Flying
Soldier, 006, W, 1|1, -, Creature - Soldier, Goran Josic, -
Spirit, 007, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying
Fish, 008, U, 3|3, -, Creature - Fish, Dan Scott, When this creature dies put a 6/6 blue Whale creature token onto the battlefield with "When this creature dies put a 9/9 blue Kraken creature token onto the battlefield."
Kraken, 009, U, 9|9, -, Creature - Kraken, Dan Scott, -
Whale, 010, U, 6|6, -, Creature - Whale, Dan Scott, When this creature dies put a 9/9 blue Kraken creature token onto the battlefield.
Zombie, 011, U, *|*, -, Creature - Zombie, Dave Kendall, -
Demon, 012, B, *|*, -, Creature - Demon, Pete Venters, Flying
Demon, 013, B, 5|5, -, Creature - Demon, Kev Walker, Flying
Germ, 014, B, -, -, Creature - Germ, Igor Kieryluk, -
Horror, 015, B, *|*, -, Creature - Horror, Jason Felix, -
Zombie, 016, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Goblin, 017, R, 1|1, -, Creature - Goblin, Dave Kendall, -
Ape, 018, G, 3|3, -, Creature - Ape, Lars Grant-West, -
Beast, 019, G, 3|3, -, Creature - Beast, Dave Allsop, -
Beast, 020, G, 4|4, -, Creature - Beast, Steve Prescott, -
Elemental, 021, G, 5|3, -, Creature - Elemental, Nils Hamm, -
Elephant, 022, G, 3|3, -, Creature - Elephant, Lars Grant-West, -
Elf Druid, 023, G, 1|1, -, Creature - Elf Druid, Raymond Swanland, {T}: Add {G} to your mana pool.
Elf Warrior, 024, G, 1|1, -, Creature - Elf Warrior, William O'Connor, -
Treefolk, 025, G, *|*, -, Creature - Treefolk, Filip Burburan, -
Wolf, 026, G, 2|2, -, Creature - Wolf, Daren Bader, -
Gargoyle, 027, -, 3|4, -, Artifact Creature - Gargoyle, Paul Bonner, Flying
Myr, 028, -, 1|1, -, Artifact Creature - Myr, Ryan Pancoast, -
Pentavite, 029, -, 1|1, -, Artifact Creature - Pentavite, Greg Staples, Flying
Stoneforged Blade, 030, -, -, -, Artifact - Equipment, Eric Deschamps, Indestructible Equipped creature gets +5/+5 and has double strike. Equip {0}
Tuktuk The Returned, 031, -, 5|5, -, Legendary Artifact Creature - Goblin Golem, Franz Vohwinkel, -
Wurm, 032, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Deathtouch
Wurm, 033, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Lifelink
Teferi Emblem, 034, -, -, -, Emblem - Teferi, Tyler Jacobson, You may activate loyalty abilities of planeswalkers you control on any player's turn any time you could cast an instant.
Nixilis Emblem, 035, -, -, -, Emblem - Nixilis, Daarken, {1}{B} Sacrifice a creature: You gain X life and draw X cards where X is the sacrificed creature's power.
Daretti Emblem, 036, -, -, -, Emblem - Daretti, Dan Scott, Whenever an artifact is put into your graveyard from the battlefield return that card to the battlefield at the beginning of the next end step.
DD3_EVG - Duel Decks Anthology Elves vs. Goblins (2014-12-05)
Elemental, 001, G, 7|7, -, Creature - Elemental, Anthony S. Waters, Trample
Elf Warrior, 002, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, -
Goblin, 003, R, 1|1, -, Creature - Goblin, Dave Kendall, -
DD3_JVC - Duel Decks Anthology Jace vs. Chandra (2014-12-05)
Elemental Shaman, 004, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, -
DD3_DVD - Duel Decks Anthology Divine vs. Demonic (2014-12-05)
Spirit, 005, W, 1|1, -, Creature - Spirit, Luca Zontini, Flying
Demon, 006, B, *|*, -, Creature - Demon, Pete Venters, Flying
Thrull, 007, B, -, -, Creature - Thrull, Veronique Meignaud, -
DD3_GVL - Duel Decks Anthology Garruk vs. Liliana (2014-12-05)
Beast, 008, G, 3|3, -, Creature - Beast, John Donahue, -
Beast, 009, G, 4|4, -, Creature - Beast, Steve Prescott, -
Elephant, 010, G, 3|3, -, Creature - Elephant, Arnie Swekel, -
Bat, 011, B, 1|1, -, Creature - Bat, Wayne Reynolds, Flying
FRF - Fate Reforged (2015-01-23)
Monk, 001, W, 1|1, -, Creature - Monk, Steven Belledin, Prowess
Monk, 001T, W, 1|1, League, Creature - Monk, Magali Villeneuve, Prowess
Spirit, 002, W, 1|1, -, Creature - Spirit, Aaron Miller, Flying
Warrior, 003, B, 2|1, -, Creature - Warrior, Zoltan Boros, -
Manifest, 004, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down manifested creature with this reminder card. A manifested creature card can be turned face up any time for its mana cost. A face-down card can also be turned face up for its morph cost.)
DDO - Duel Decks: Elspeth vs. Kiora (2015-02-27)
Soldier, 066, W, 1|1, -, Creature - Soldier, Svetlin Velinov, -
Kraken, 067, U, 9|9, -, Creature - Kraken, Dan Scott, -
DTK - Dragons of Tarkir (2015-03-27)
Warrior, 001, W, 1|1, -, Creature - Warrior, Aaron Miller, -
Djinn Monk, 002, U, 2|2, -, Creature - Djinn Monk, Izzy, Flying
Zombie, 003, B, 2|2, -, Creature - Zombie, Vincent Proce, -
Zombie Horror, 004, B, *|*, -, Creature - Zombie Horror, Nils Hamm, -
Dragon, 005, R, 4|4, -, Creature - Dragon, Gabor Szikszai, Flying
Goblin, 006, R, 1|1, -, Creature - Goblin, Mike Bierek, -
Morph, 007, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down creature with this reminder card. A card with morph can be turned face up any time for its morph cost.)
Narset Emblem, 008, -, -, -, Emblem - Narset, Magali Villeneuve, Your opponents can't cast noncreature spells.
MM2 - Modern Masters 2015 Edition (2015-05-22)
Eldrazi Spawn, 001, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 002, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 003, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool.
Soldier, 004, W, 1|1, -, Creature - Soldier, Greg Staples, -
Spirit, 005, W, 1|1, -, Creature - Spirit, Mike Sass, Flying
Faerie Rogue, 006, B, 1|1, -, Creature - Faerie Rogue, Dave Allsop, Flying
Germ, 007, B, -, -, Creature - Germ, Igor Kieryluk, -
Thrull, 008, B, 1|1, -, Creature - Thrull, Mark Tedin, -
Elephant, 009, G, 3|3, -, Creature - Elephant, Lars Grant-West, -
Insect, 010, G, 1|1, -, Creature - Insect, Ron Spencer, -
Saproling, 011, G, 1|1, -, Creature - Saproling, Warren Mahy, -
Snake, 012, G, 1|1, -, Creature - Snake, Austin Hsu, -
Wolf, 013, G, 2|2, -, Creature - Wolf, Daren Bader, -
Worm, 014, B G, 1|1, -, Creature - Worm, Chuck Lukacs, -
Golem, 015, -, 3|3, -, Artifact Creature - Golem, Nic Klein, -
Myr, 016, -, 1|1, -, Artifact Creature - Myr, Ryan Pancoast, -
ORI - Magic Origins (2015-07-17)
Angel, 001, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying
Knight, 002, W, 2|2, -, Creature - Knight, Matt Stewart, Vigilance
Soldier, 003, W, 1|1, -, Creature - Soldier, Steve Prescott, -
Demon, 004, B, 5|5, -, Creature - Demon, Kev Walker, Flying
Zombie, 005, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Goblin, 006, R, 1|1, -, Creature - Goblin, Brandon Kitkouski, -
Ashaya the Awoken World, 007, G, 4|4, -, Legendary Creature - Elemental, Raymond Swanland, -
Elemental, 008, G, 2|2, -, Creature - Elemental, Marco Nelor, -
Elf Warrior, 009, G, 1|1, -, Creature - Elf Warrior, William O'Connor, -
Thopter, 010, -, 1|1, -, Artifact Creature - Thopter, Adam Paquette, Flying
Thopter, 011, -, 1|1, -, Artifact Creature - Thopter, Svetlin Velinov, Flying
Jace Emblem, 012, -, -, -, Emblem - Jace, Jaime Jones, Whenever you cast a spell target opponent puts the top five cards of his or her library into his or her graveyard.
Liliana Emblem, 013, -, -, -, Emblem - Liliana, Karla Ortiz, Whenever a creature dies return it to the battlefield under your control at the beginning of the next end step.
Chandra Emblem, 014, -, -, -, Emblem - Chandra, Eric Deschamps, At the beginning of your upkeep this emblem deals 3 damage to you.
DDP - Duel Decks: Zendikar vs. Eldrazi (2015-08-28)
Eldrazi Spawn, 076, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 077, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Spawn, 078, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool.
Hellion, 079, R, 4|4, -, Creature - Hellion, Anthony Francisco, -
Plant, 080, G, -, -, Creature - Plant, Daren Bader, -
BFZ - Battle for Zendikar (2015-10-09)
Eldrazi, 001, -, 10|10, -, Creature - Eldrazi, Jack Wang, -
Eldrazi Scion, 002, -, 1|1, -, Creature - Eldrazi Scion, Izzy, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Scion, 003, -, 1|1, -, Creature - Eldrazi Scion, Winona Nelson, Sacrifice this creature: Add {1} to your mana pool.
Eldrazi Scion, 004, -, 1|1, -, Creature - Eldrazi Scion, Svetlin Velinov, Sacrifice this creature: Add {1} to your mana pool.
Knight Ally, 005, W, 2|2, -, Creature - Knight Ally, Josu Hernaiz, -
Kor Ally, 006, W, 1|1, -, Creature - Kor Ally, Jeremy Wilson, -
Octopus, 007, U, 8|8, -, Creature - Octopus, Craig J Spearing, -
Dragon, 008, R, 5|5, -, Creature - Dragon, Raymond Swanland, Flying
Plant, 009, G, 1|1, -, Creature - Plant, Sam Burley, -
Elemental, 009, R, 3|1, -, Creature - Elemental, Victor Adame Minguez, Trample Haste
Elemental, 011, G R, 5|5, -, Creature - Elemental, Brad Rigney, -
Gideon Emblem, 012, -, -, -, Emblem - Gideon, Eric Deschamps, -
Nixilis Emblem, 013, -, -, -, Emblem - Nixilis, Chris Rahn, -
Kiora Emblem, 014, -, -, -, Emblem - Kiora, Jason Chan, -
C15 - Commander 2015 (2015-11-13)
Shapeshifter, 001, -, 1|1, -, Creature - Shapeshifter, Franz Vohwinkel, Changeling
Angel, 002, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying
Cat, 003, W, 2|2, -, Creature - Cat, Jesper Ejsing, -
Knight, 004, W, 2|2, -, Creature - Knight, Hideaki Takamura, First strike
Knight, 005, W, 2|2, -, Creature - Knight, Matt Stewart, Vigilance
Drake, 006, U, 2|2, -, Creature - Drake, Svetlin Velinov, Flying
Germ, 007, B, -, -, Creature - Germ, Igor Kieryluk, -
Zombie, 008, B, 2|2, -, Creature - Zombie, Lucas Graciano, -
Dragon, 009, R, 5|5, -, Creature - Dragon, Jim Pavelec, Flying
Elemental Shaman, 010, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, -
Lightning Rager, 011, R, 5|1, -, Creature - Elemental, Svetlin Velinov, Trample Haste At the beginning of your end step sacrifice this creature.
Bear, 012, G, 2|2, -, Creature - Bear, Heather Hudson, -
Beast, 013, G, 4|4, -, Creature - Beast, Svetlin Velinov, -
Elephant, 014, G, 3|3, -, Creature - Elephant, Lars Grant-West, -
Frog Lizard, 015, G, 3|3, -, Creature - Frog Lizard, Jack Wang, -
Saproling, 016, G, 1|1, -, Creature - Saproling, Brad Rigney, -
Snake, 017, G, 1|1, -, Creature - Snake, Dan Scott, -
Spider, 018, G, 1|2, -, Creature - Spider, Daniel Ljunggren, Reach
Wolf, 019, G, 2|2, -, Creature - Wolf, David Palumbo, -
Elemental, 020, U R, 5|5, -, Creature - Elemental, Randy Gallegos, Flying
Snake, 021, G U, 1|1, -, Creature - Snake, Christopher Moeller, -
Spirit, 022, W B, 1|1, -, Creature - Spirit, Cliff Childs, Flying
Spirit, 023, -, *|*, -, Enchantment Creature - Spirit, Adam Paquette, This creature's power and toughness are each equal to the number of experience counters you have.
Gold, 024, -, -, -, Artifact, Richard Wright, Sacrifice this artifact: Add one mana of any color to your mana pool.
Can't render this file because it contains an unexpected character in line 549 and column 138.

View file

@ -0,0 +1,32 @@
package mage.client.game;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.plugins.card.dl.sources.CardImageSource;
import org.mage.plugins.card.dl.sources.TokensMtgImageSource;
import org.mage.plugins.card.images.CardDownloadData;
/**
*
* @author Quercitron
*/
@Ignore
public class TokensMtgImageSourceTest {
@Test
public void generateTokenUrlTest() throws Exception {
CardImageSource imageSource = TokensMtgImageSource.getInstance();
String url = imageSource.generateTokenUrl(new CardDownloadData("Thopter", "ORI", 0, false, 1, "ORI"));
Assert.assertEquals("http://tokens.mtg.onl/tokens/ORI_010-Thopter.jpg", url);
url = imageSource.generateTokenUrl(new CardDownloadData("Thopter", "ORI", 0, false, 2, "ORI"));
Assert.assertEquals("http://tokens.mtg.onl/tokens/ORI_011-Thopter.jpg", url);
url = imageSource.generateTokenUrl(new CardDownloadData("Ashaya, the Awoken World", "ORI", 0, false, 0, "ORI"));
Assert.assertEquals("http://tokens.mtg.onl/tokens/ORI_007-Ashaya,-the-Awoken-World.jpg", url);
url = imageSource.generateTokenUrl(new CardDownloadData("Emblem Gideon, Ally of Zendikar", "BFZ", 0, false, 0, null));
Assert.assertEquals("http://tokens.mtg.onl/tokens/BFZ_012-Gideon-Emblem.jpg", url);
}
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-common</artifactId>

View file

@ -468,9 +468,7 @@ public class SessionImpl implements Session {
@Override
public void handleConnectionException(Throwable throwable, Client client) {
logger.info("connection to server lost - " + throwable.getMessage());
throwable.printStackTrace();
logger.info("connection to server lost - " + throwable.getMessage(), throwable);
reconnect(throwable);
}
}

View file

@ -40,8 +40,8 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
*/
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 4;
public final static String MAGE_VERSION_MINOR_PATCH = "v9";
public final static int MAGE_VERSION_PATCH = 5;
public final static String MAGE_VERSION_MINOR_PATCH = "v0";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -1,7 +1,6 @@
package mage.utils.properties;
import com.j256.ormlite.logger.Logger;
import com.j256.ormlite.logger.LoggerFactory;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.InputStream;
@ -12,7 +11,7 @@ import java.util.Properties;
*/
public class PropertiesUtil {
private static final Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
private static final Logger logger = Logger.getLogger(PropertiesUtil.class);
private static final String LOG_JDBC_URL = "jdbc:h2:file:./db/mage.h2;AUTO_SERVER=TRUE";
private static final String FEEDBACK_JDBC_URL = "jdbc:h2:file:./db/feedback.h2;AUTO_SERVER=TRUE";
@ -25,7 +24,7 @@ public class PropertiesUtil {
try {
properties.load(in);
} catch (IOException e) {
logger.error(e, "Couldn't load properties");
logger.error("Couldn't load properties", e);
}
} else {
logger.warn("No xmage.properties were found on classpath");

View file

@ -32,7 +32,7 @@ import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Modes;
import mage.abilities.Mode;
import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCosts;
import mage.cards.Card;
@ -153,7 +153,7 @@ public class CardView extends SimpleCardView {
* for morph / face down cards to know which player may see information for
* the card
* @param showFaceDownCard if true and the card is not on the battelfield,
* also a face down card is shown in the view down cards will be shown
* also a face down card is shown in the view, face down cards will be shown
*/
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard) {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
@ -311,19 +311,16 @@ public class CardView extends SimpleCardView {
this.mageObjectType = MageObjectType.SPELL;
Spell spell = (Spell) card;
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
spellAbility.getModes().setActiveMode(modeId);
if (spellAbility.getTargets().size() > 0) {
for (Mode mode : spellAbility.getModes().getSelectedModes()) {
if (mode.getTargets().size() > 0) {
setTargets(spellAbility.getTargets());
}
}
}
// show for modal spell, which mode was choosen
if (spell.getSpellAbility().isModal()) {
Modes modes = spell.getSpellAbility().getModes();
for (UUID modeId : modes.getSelectedModes()) {
modes.setActiveMode(modeId);
this.rules.add("<span color='green'><i>Chosen mode: " + spell.getSpellAbility().getEffects().getText(modes.get(modeId)) + "</i></span>");
for (Mode mode : spell.getSpellAbility().getModes().getSelectedModes()) {
this.rules.add("<span color='green'><i>Chosen mode: " + mode.getEffects().getText(mode) + "</i></span>");
}
}
}

View file

@ -28,6 +28,13 @@ public class EmblemView implements CommandObjectView, Serializable {
rules = emblem.getAbilities().getRules(sourceCard.getName());
}
public EmblemView(Emblem emblem) {
id = emblem.getId();
name = emblem.getName();
expansionSetCode = emblem.getExpansionSetCodeForImage();
rules = emblem.getAbilities().getRules(emblem.getName());
}
@Override
public String getExpansionSetCode() {
return expansionSetCode;

View file

@ -62,7 +62,7 @@ public class GameView implements Serializable {
private static final long serialVersionUID = 1L;
private static final transient Logger logger = Logger.getLogger(GameView.class);
private static final Logger logger = Logger.getLogger(GameView.class);
private final int priorityTime;
private final List<PlayerView> players = new ArrayList<>();
@ -123,6 +123,7 @@ public class GameView implements Serializable {
checkPaid(stackObject.getId(), (StackAbility) stackObject);
} else if (object instanceof Emblem) {
Card sourceCard = game.getCard(((Emblem) object).getSourceId());
CardView cardView;
if (sourceCard != null) {
if (!sourceCard.getCardType().contains(CardType.PLANESWALKER)) {
if (sourceCard.getSecondCardFace() != null) {
@ -131,11 +132,12 @@ public class GameView implements Serializable {
}
((StackAbility) stackObject).setName("Emblem " + sourceCard.getName());
((StackAbility) stackObject).setExpansionSetCode(sourceCard.getExpansionSetCode());
cardView = new CardView(new EmblemView(((Emblem) object), sourceCard));
} else {
throw new IllegalArgumentException("Source card for emblem not found.");
cardView = new CardView(new EmblemView((Emblem) object));
}
stack.put(stackObject.getId(),
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), new CardView(new EmblemView(((Emblem) object), sourceCard))));
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
} else {
if (object instanceof StackAbility) {

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.view;
import java.util.ArrayList;
@ -44,6 +43,7 @@ import mage.players.Player;
* @author BetaSteward_at_googlemail.com
*/
public class PermanentView extends CardView {
private static final long serialVersionUID = 1L;
private boolean tapped;
@ -78,7 +78,7 @@ public class PermanentView extends CardView {
}
this.attachedTo = permanent.getAttachedTo();
if (isToken()) {
original = new CardView(((PermanentToken)permanent).getToken());
original = new CardView(((PermanentToken) permanent).getToken());
original.expansionSetCode = permanent.getExpansionSetCode();
tokenSetCode = original.getTokenSetCode();
} else {
@ -98,7 +98,7 @@ public class PermanentView extends CardView {
this.alternateName = permanent.getFlipCardName();
this.originalName = this.getName();
} else {
if (controlled // controller may always know
if (controlled // controller may always know
|| (!morphed && !manifested)) { // others don't know for morph or transformed cards
this.alternateName = original.getName();
this.originalName = this.getName();
@ -113,11 +113,11 @@ public class PermanentView extends CardView {
this.nameOwner = "";
}
} else {
this.nameOwner = "";
this.nameOwner = "";
}
if (permanent.isFaceDown(game) && card != null) {
if (controlled){
if (controlled) {
// must be a morphed or manifested card
for (Ability permanentAbility : permanent.getAbilities()) {
if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) {
@ -131,17 +131,17 @@ public class PermanentView extends CardView {
this.displayName = card.getName();
this.expansionSetCode = card.getExpansionSetCode();
this.cardNumber = card.getCardNumber();
} else{
if (permanent.isMorphed()) {
this.rules.add("If the controller has priority, he or she may turn this permanent face up." +
" This is a special action; it doesn’t use the stack. To do this he or she pays the morph costs," +
" then turns this permanent face up.");
}else if (permanent.isManifested()) {
this.rules.add("A manifested creature card can be turned face up any time for it's mana cost." +
" A face-down card can also be turned face up for its morph cost.");
} else {
if (permanent.isManifested()) {
this.rules.add("A manifested creature card can be turned face up any time for it's mana cost."
+ " A face-down card can also be turned face up for its morph cost.");
} else if (permanent.isMorphed()) {
this.rules.add("If the controller has priority, he or she may turn this permanent face up."
+ " This is a special action; it doesn’t use the stack. To do this he or she pays the morph costs,"
+ " then turns this permanent face up.");
}
}
}
}
// determines if shown in it's own column
if (permanent.getAttachedTo() != null) {
attachedToPermanent = game.getPermanent(permanent.getAttachedTo()) != null;
@ -170,7 +170,7 @@ public class PermanentView extends CardView {
return phasedIn;
}
public boolean hasSummoningSickness(){
public boolean hasSummoningSickness() {
return summoningSickness;
}
@ -209,6 +209,7 @@ public class PermanentView extends CardView {
public boolean isMorphed() {
return morphed;
}
public boolean isManifested() {
return manifested;
}

View file

@ -58,6 +58,10 @@ public class PlayerView implements Serializable {
private final String name;
private final int life;
private final int poison;
private final int experience;
private final int wins;
private final int winsNeeded;
private final long deckHashCode;
private final int libraryCount;
private final int handCount;
private final boolean isActive;
@ -85,6 +89,10 @@ public class PlayerView implements Serializable {
this.name = player.getName();
this.life = player.getLife();
this.poison = player.getCounters().getCount(CounterType.POISON);
this.experience = player.getCounters().getCount(CounterType.EXPERIENCE);
this.wins = player.getMatchPlayer().getWins();
this.winsNeeded = player.getMatchPlayer().getWinsNeeded();
this.deckHashCode = player.getMatchPlayer().getDeck().getDeckHashCode();
this.libraryCount = player.getLibrary().size();
this.handCount = player.getHand().size();
this.manaPool = new ManaPoolView(player.getManaPool());
@ -132,6 +140,8 @@ public class PlayerView implements Serializable {
}
}
commandList.add(new EmblemView(emblem, sourceCard));
} else {
commandList.add(new EmblemView(emblem));
}
}
} else if (commandObject instanceof Commander) {
@ -181,10 +191,26 @@ public class PlayerView implements Serializable {
return this.poison;
}
public int getExperience() {
return this.experience;
}
public int getLibraryCount() {
return this.libraryCount;
}
public int getWins() {
return wins;
}
public int getWinsNeeded() {
return winsNeeded;
}
public long getDeckHashCode() {
return deckHashCode;
}
public int getHandCount() {
return this.handCount;
}
@ -229,7 +255,7 @@ public class PlayerView implements Serializable {
return this.userData;
}
public List<CommandObjectView> getCommadObjectList() {
public List<CommandObjectView> getCommandObjectList() {
return commandList;
}

View file

@ -30,6 +30,7 @@ package mage.view;
import java.io.Serializable;
import java.util.UUID;
import mage.game.Seat;
import mage.players.net.UserData;
/**
*
@ -48,7 +49,11 @@ public class SeatView implements Serializable {
if (seat.getPlayer() != null) {
this.playerId = seat.getPlayer().getId();
this.playerName = seat.getPlayer().getName();
this.flagName = seat.getPlayer().getUserData().getFlagName();
if (seat.getPlayer().getUserData() == null) {
this.flagName = UserData.getDefaultFlagName();
} else {
this.flagName = seat.getPlayer().getUserData().getFlagName();
}
} else {
// Empty seat
this.playerName = "";

View file

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Mode;
import mage.abilities.Modes;
import mage.abilities.effects.Effect;
import mage.cards.Card;
@ -98,13 +99,12 @@ public class StackAbilityView extends CardView {
private void updateTargets(Game game, StackAbility ability) {
List<String> names = new ArrayList<>();
for (UUID modeId : ability.getModes().getSelectedModes()) {
ability.getModes().setActiveMode(modeId);
if (ability.getTargets().size() > 0) {
setTargets(ability.getTargets());
for (Mode mode : ability.getModes().getSelectedModes()) {
if (mode.getTargets().size() > 0) {
setTargets(mode.getTargets());
} else {
List<UUID> targetList = new ArrayList<>();
for (Effect effect : ability.getEffects()) {
for (Effect effect : mode.getEffects()) {
TargetPointer targetPointer = effect.getTargetPointer();
if (targetPointer instanceof FixedTarget) {
targetList.add(((FixedTarget) targetPointer).getTarget());
@ -132,9 +132,8 @@ public class StackAbilityView extends CardView {
// show for modal ability, which mode was choosen
if (ability.isModal()) {
Modes modes = ability.getModes();
for (UUID modeId : modes.getSelectedModes()) {
modes.setActiveMode(modeId);
this.rules.add("<span color='green'><i>Chosen mode: " + ability.getEffects().getText(modes.get(modeId)) + "</i></span>");
for (Mode mode : modes.getSelectedModes()) {
this.rules.add("<span color='green'><i>Chosen mode: " + mode.getEffects().getText(mode) + "</i></span>");
}
}
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-counter-plugin</artifactId>

View file

@ -1,50 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-plugins</artifactId>
<version>1.4.4</version>
</parent>
<artifactId>mage-theme-plugin</artifactId>
<packaging>jar</packaging>
<version>0.5</version>
<name>Mage Theme Plugin</name>
<description>Contains resources for drawing background</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage-common</artifactId>
<version>${mage-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage-client</artifactId>
<version>1.4.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<finalName>mage-theme-plugin</finalName>
</build>
</project>

View file

@ -1,210 +0,0 @@
package org.mage.plugins.theme;
import mage.components.ImagePanel;
import mage.interfaces.plugin.ThemePlugin;
import mage.client.dialog.PreferencesDialog;
import net.xeoh.plugins.base.annotations.PluginImplementation;
import net.xeoh.plugins.base.annotations.events.Init;
import net.xeoh.plugins.base.annotations.events.PluginLoaded;
import net.xeoh.plugins.base.annotations.meta.Author;
import org.apache.log4j.Logger;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.*;
import java.io.InputStream;
import java.util.Map;
@PluginImplementation
@Author(name = "nantuko")
public class ThemePluginImpl implements ThemePlugin {
private static final Logger log = Logger.getLogger(ThemePluginImpl.class);
private static BufferedImage background;
private List flist = new List();
private String BackgroundDir = "plugins" + File.separator + "plugin.data" + File.separator
+ "background" + File.separator;
@Init
public void init() {
}
@PluginLoaded
public void newPlugin(ThemePlugin plugin) {
log.info(plugin.toString() + " has been loaded.");
}
public String toString() {
return "[Theme plugin, version 0.5]";
}
public boolean loadimages(){
File filedir = new File(BackgroundDir);
File[] filelist = filedir.listFiles();
if(filelist == null) return false;
if(filelist.length == 0) return false;
for(File f:filelist){
String filename = f.getName().toLowerCase();
if(filename != null && (filename.endsWith(".png") || filename.endsWith(".jpg")
|| filename.endsWith(".bmp"))){
flist.add(filename);
}
}
if(flist.getItemCount() == 0) return false;
return true;
}
public void applyInGame(Map<String, JComponent> ui) {
BufferedImage background;
try {
if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_DEFAULT,
"true").equals("true")){
background = loadbuffer_default();
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_RANDOM,
"true").equals("true")){
background = loadbuffer_random();
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE, "") != null){
background = loadbuffer_selected();
}else{
background = loadbuffer_default();
}
/*
if(loadimages()){
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
filename = BackgroundDir + flist.getItem(it);
background = ImageIO.read(new File(filename));
}else{
filename = "/dragon.png";
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
}
*/
if (background == null) {
throw new FileNotFoundException("Couldn't find background file in resources.");
}
if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) {
ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED);
unsetOpaque(ui.get("jSplitPane1"));
unsetOpaque(ui.get("pnlBattlefield"));
unsetOpaque(ui.get("jPanel3"));
unsetOpaque(ui.get("hand"));
unsetOpaque(ui.get("gameChatPanel"));
unsetOpaque(ui.get("userChatPanel"));
ui.get("gamePanel").remove(ui.get("jLayeredPane"));
bgPanel.add(ui.get("jLayeredPane"));
ui.get("gamePanel").add(bgPanel);
} else {
log.error("error: no components");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return;
}
}
private BufferedImage loadbuffer_default() throws IOException{
String filename = "/dragon.png";
BufferedImage res;
InputStream is = this.getClass().getResourceAsStream(filename);
res = ImageIO.read(is);
return res;
}
private BufferedImage loadbuffer_random() throws IOException{
BufferedImage res;
if(loadimages()){
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
String filename = BackgroundDir + flist.getItem(it);
res = ImageIO.read(new File(filename));
return res;
}
return null;
}
private BufferedImage loadbuffer_selected() throws IOException{
BufferedImage res;
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BATTLEFIELD_IMAGE, "");
if(path != null){
res = ImageIO.read(new File(path));
return res;
}
return null;
}
public JComponent updateTable(Map<String, JComponent> ui) {
ImagePanel bgPanel = createImagePanelInstance();
unsetOpaque(ui.get("jScrollPane1"));
unsetOpaque(ui.get("jPanel1"));
unsetOpaque(ui.get("tablesPanel"));
JComponent viewport = ui.get("jScrollPane1ViewPort");
if (viewport != null) {
viewport.setBackground(new Color(255,255,255,50));
}
return bgPanel;
}
private ImagePanel createImagePanelInstance() {
if (background == null) {
synchronized (ThemePluginImpl.class) {
if (background == null) {
String filename = "/background.png";
try {
if(PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BACKGROUND_IMAGE_DEFAULT, "true").equals("true")){
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BACKGROUND_IMAGE, "") != null){
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BATTLEFIELD_IMAGE, "");
if(path != null){
background = ImageIO.read(new File(path));
}else{
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
}
}
if (background == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
}
}
return new ImagePanel(background, ImagePanel.SCALED);
}
private void unsetOpaque(JComponent c) {
if (c != null) {
c.setOpaque(false);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-plugins</artifactId>
@ -16,7 +16,6 @@
<description>Mage Plugins POM</description>
<modules>
<module>Mage.Theme.Plugin</module>
<module>Mage.Counter.Plugin</module>
</modules>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-deck-constructed</artifactId>

View file

@ -23,7 +23,7 @@ import mage.constants.SetType;
*
* @author Marthinwurer (at gmail.com)
*/
public class HistoricalStandard extends Constructed {
public class HistoricalType2 extends Constructed {
/*
* This array stores the set codes of each standard up to
@ -34,9 +34,9 @@ public class HistoricalStandard extends Constructed {
{"DRK", "FEM", "4ED"},
// 2nd standard: 4th, Fallen Empires, Ice Age, Chronicles, Homelands,
// Alliances, and Mirage.
{"FEM", "4ED", "ICE", "HML", "ALL", "MIR"},
{"FEM", "4ED", "ICE", "CHR", "HML", "ALL", "MIR"},
// 3rd standard: 4th, Chronicles, Alliances, Mirage, Visions.
{"4ED", "ALL", "MIR", "VIS"},
{"4ED", "CHR", "ALL", "MIR", "VIS"},
// 4th Standard: Ice Age, Homelands, Alliances, Mirage, Visions, 5th,
// and Weatherlight.
{"ICE", "HML", "ALL", "MIR", "VIS", "5ED", "WTH"},
@ -84,15 +84,17 @@ public class HistoricalStandard extends Constructed {
* Constructor. Don't need to mess with any of the sets yet; that will be
* done in the overridden validate function.
*/
public HistoricalStandard() {
super("Constructed - Historical Standard");
public HistoricalType2() {
super("Constructed - Historical Type 2");
// banned cards
banned.add("Balance");
banned.add("Earthcraft");
banned.add("Memory Jar");
banned.add("Mind Over Matter");
banned.add("Mind Twist");
banned.add("Skullclamp");
banned.add("Time Spiral");
banned.add("Tolarian Academy");
banned.add("Yawgmoth's Bargain");
}

View file

@ -0,0 +1,70 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.deck;
import mage.cards.Card;
import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidator;
import java.util.*;
/**
*
* @author nigelzor
*/
public class Momir extends DeckValidator {
public Momir() {
this("Momir Basic");
}
public Momir(String name) {
super(name);
}
@Override
public boolean validate(Deck deck) {
boolean valid = true;
if (deck.getCards().size() != 60) {
invalid.put("Deck", "Must contain 60 cards: has " + deck.getCards().size() + " cards");
valid = false;
}
List<String> basicLandNames = new ArrayList<>(Arrays.asList("Forest", "Island", "Mountain", "Swamp", "Plains"));
for (Card card : deck.getCards()) {
if (!basicLandNames.contains(card.getName())) {
invalid.put(card.getName(), "Only basic lands are allowed");
valid = false;
}
}
return valid;
}
}

View file

@ -18,13 +18,13 @@ import mage.constants.SetType;
*
* This class was originally made to work with the historical standard ruleset.
* Data taken from http://thattournament.website/historic-tournament.php (site
* changed, originally thtp://mtgt.nfshost.com/historic-tournament.php)
* changed, originally http://mtgt.nfshost.com/historic-tournament.php)
*
* If there are any questions or corrections, feel free to contact me.
*
* @author Marthinwurer (at gmail.com)
*/
public class SuperStandard extends Constructed {
public class SuperType2 extends Constructed {
/*
* This array stores the set codes of each standard up to
@ -60,8 +60,8 @@ public class SuperStandard extends Constructed {
* Constructor. Don't need to mess with any of the sets yet; that will be
* done in the overridden validate function.
*/
public SuperStandard() {
super("Constructed - Super Standard");
public SuperType2() {
super("Constructed - Super Type 2");
banned.add("Ancient Den");
banned.add("Disciple of the Vault");

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-deck-limited</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-commanderduel</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-commanderfreeforall</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-freeforall</artifactId>

View file

@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-momirduel</artifactId>
<packaging>jar</packaging>
<name>Mage Game Momir Basic Two Player</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mage</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<finalName>mage-game-momirduel</finalName>
</build>
<properties/>
</project>

View file

@ -0,0 +1,159 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.cards.Card;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*;
import mage.game.command.Emblem;
import mage.game.match.MatchType;
import mage.game.permanent.token.EmptyToken;
import mage.game.turn.TurnMod;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.*;
/**
*
* @author nigelzor
*/
public class MomirDuel extends GameImpl {
public MomirDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
super(attackOption, range, freeMulligans, startLife);
}
public MomirDuel(final MomirDuel game) {
super(game);
}
@Override
public MatchType getGameType() {
return new MomirDuelType();
}
@Override
public int getNumPlayers() {
return 2;
}
@Override
protected void init(UUID choosingPlayerId) {
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Vanguard effects"));
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
Player player = getPlayer(playerId);
if (player != null) {
addEmblem(new MomirEmblem(), ability, playerId);
}
}
getState().addAbility(ability, null);
super.init(choosingPlayerId);
state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
}
@Override
public Set<UUID> getOpponents(UUID playerId) {
Set<UUID> opponents = new HashSet<>();
for (UUID opponentId: this.getPlayer(playerId).getInRange()) {
if (!opponentId.equals(playerId)) {
opponents.add(opponentId);
}
}
return opponents;
}
@Override
public boolean isOpponent(Player player, UUID playerToCheck) {
return !player.getId().equals(playerToCheck);
}
@Override
public MomirDuel copy() {
return new MomirDuel(this);
}
}
// faking Vanguard as an Emblem; need to come back to this and add a new type of CommandObject
class MomirEmblem extends Emblem {
public MomirEmblem() {
setName("Momir Vig, Simic Visionary");
// {X}, Discard a card: Put a token into play as a copy of a random creature card with converted mana cost X. Play this ability only any time you could play a sorcery and only once each turn.
LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.COMMAND, new MomirEffect(), new VariableManaCost());
ability.addCost(new DiscardCardCost());
ability.setTiming(TimingRule.SORCERY);
this.getAbilities().add(ability);
}
}
class MomirEffect extends OneShotEffect {
private static final Random rnd = new Random();
public MomirEffect() {
super(Outcome.PutCreatureInPlay);
}
public MomirEffect(MomirEffect effect) {
super(effect);
staticText = "Put a token into play as a copy of a random creature card with converted mana cost X";
}
@Override
public MomirEffect copy() {
return new MomirEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int value = source.getManaCostsToPay().getX();
// should this be random across card names, or card printings?
CardCriteria criteria = new CardCriteria().types(CardType.CREATURE).convertedManaCost(value);
List<CardInfo> options = CardRepository.instance.findCards(criteria);
if (options != null && !options.isEmpty()) {
Card card = options.get(rnd.nextInt(options.size())).getCard();
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false);
}
return true;
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game;
import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions;
/**
*
* @author nigelzor
*/
public class MomirDuelMatch extends MatchImpl {
public MomirDuelMatch(MatchOptions options) {
super(options);
}
@Override
public void startGame() throws GameException {
// Momir Vig, Simic Visionary gives +4 starting life
int startLife = 24;
MomirDuel game = new MomirDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
game.setStartMessage(this.createGameStartMessage());
this.initGame(game);
games.add(game);
}
}

View file

@ -0,0 +1,57 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game;
import mage.game.match.MatchType;
/**
*
* @author nigelzor
*/
public class MomirDuelType extends MatchType {
public MomirDuelType() {
this.name = "Momir Basic Two Player Duel";
this.maxPlayers = 2;
this.minPlayers = 2;
this.numTeams = 0;
this.useAttackOption = false;
this.useRange = false;
this.sideboardingAllowed = true;
}
protected MomirDuelType(final MomirDuelType matchType){
super(matchType);
}
@Override
public MomirDuelType copy() {
return new MomirDuelType(this);
}
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-tinyleadersduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-game-twoplayerduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-player-ai-draftbot</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-player-ai-ma</artifactId>

View file

@ -104,6 +104,7 @@ import mage.players.Player;
import mage.target.Target;
import mage.target.TargetCard;
import mage.target.Targets;
import org.apache.log4j.Logger;
/**
*
@ -111,7 +112,7 @@ import mage.target.Targets;
*/
public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ComputerPlayer6.class);
private static final Logger logger = Logger.getLogger(ComputerPlayer6.class);
private static final ExecutorService pool = Executors.newFixedThreadPool(1);
protected int maxDepth;
protected int maxNodes;
@ -1193,7 +1194,8 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
safeToAttack = false;
}
if (safeToAttack) {
attackingPlayer.declareAttacker(attacker.getId(), defenderId, game, false);
// undo has to be possible e.g. if not able to pay a attack fee (e.g. Ghostly Prison)
attackingPlayer.declareAttacker(attacker.getId(), defenderId, game, true);
}
}
}

View file

@ -74,7 +74,7 @@ import org.apache.log4j.Logger;
*/
public class ComputerPlayer7 extends ComputerPlayer6 {
private static final transient Logger logger = Logger.getLogger(ComputerPlayer7.class);
private static final Logger logger = Logger.getLogger(ComputerPlayer7.class);
private boolean allowBadMoves;

View file

@ -28,14 +28,13 @@
package mage.player.ai;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.util.Logging;
/**
*
@ -43,7 +42,7 @@ import mage.util.Logging;
*/
public class Config2 {
private static final Logger logger = Logging.getLogger(Config2.class.getName());
private static final Logger logger = Logger.getLogger(Config2.class);
// public static final int maxDepth;
public static final int maxNodes;
@ -70,9 +69,9 @@ public class Config2 {
// p.setProperty("maxThinkSeconds", "30");
}
} catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
logger.error(null, ex);
} catch (URISyntaxException ex) {
Logger.getLogger(Config2.class.getName()).log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
// maxDepth = Integer.parseInt(p.getProperty("maxDepth"));
maxNodes = Integer.parseInt(p.getProperty("maxNodes"));

View file

@ -9,6 +9,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.player.ai.ma.ArtificialScoringSystem;
import mage.players.Player;
import org.apache.log4j.Logger;
/**
*
@ -19,7 +20,7 @@ import mage.players.Player;
*/
public class GameStateEvaluator2 {
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(GameStateEvaluator2.class);
private static final Logger logger = Logger.getLogger(GameStateEvaluator2.class);
public static final int WIN_GAME_SCORE = 100000000;
public static final int LOSE_GAME_SCORE = -WIN_GAME_SCORE;

View file

@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
*/
public class SimulatedPlayer2 extends ComputerPlayer {
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class);
private static final Logger logger = Logger.getLogger(SimulatedPlayer2.class);
private final boolean isSimulatedPlayer;
private transient ConcurrentLinkedQueue<Ability> allActions;
private boolean forced;

View file

@ -29,11 +29,9 @@
package mage.player.ai;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.abilities.Ability;
import mage.game.Game;
import mage.util.Logging;
import org.apache.log4j.Logger;
/**
*
@ -41,7 +39,7 @@ import mage.util.Logging;
*/
public class SimulationWorker2 implements Callable {
private static final Logger logger = Logging.getLogger(SimulationWorker2.class.getName());
private static final Logger logger = Logger.getLogger(SimulationWorker2.class);
private Game game;
private SimulatedAction2 previousActions;
@ -60,7 +58,7 @@ public class SimulationWorker2 implements Callable {
try {
// player.simulateAction(game, previousActions, action);
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
logger.error(null, ex);
}
return null;
}

View file

@ -12,6 +12,7 @@ import mage.game.turn.EndOfCombatStep;
import mage.game.turn.FirstCombatDamageStep;
import mage.game.turn.Step;
import mage.players.Player;
import org.apache.log4j.Logger;
import java.util.*;
@ -24,7 +25,7 @@ public class CombatUtil {
private static final List<Permanent> emptyList = new ArrayList<Permanent>();
private static final transient org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(CombatUtil.class);
private static final Logger log = Logger.getLogger(CombatUtil.class);
private CombatUtil() {
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-player-ai</artifactId>

View file

@ -79,8 +79,6 @@ import mage.cards.decks.Deck;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository;
import mage.choices.Choice;
import mage.choices.ChoiceColor;
import mage.constants.AsThoughEffectType;
@ -145,10 +143,12 @@ import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetCreatureOrPlayerAmount;
import mage.target.common.TargetDefender;
import mage.target.common.TargetDiscard;
import mage.target.common.TargetOpponent;
import mage.target.common.TargetPermanentOrPlayer;
import mage.target.common.TargetSpellOrPermanent;
import mage.util.Copier;
import mage.util.MessageToClient;
import mage.util.TournamentUtil;
import mage.util.TreeNode;
import org.apache.log4j.Logger;
@ -160,7 +160,7 @@ import org.apache.log4j.Logger;
*/
public class ComputerPlayer extends PlayerImpl implements Player {
private transient final static Logger log = Logger.getLogger(ComputerPlayer.class);
private static final Logger log = Logger.getLogger(ComputerPlayer.class);
protected int PASSIVITY_PENALTY = 5; // Penalty value for doing nothing if some actions are availble
protected boolean ALLOW_INTERRUPT = true; // change this for test / debugging purposes to false to switch off interrupts while debugging
@ -173,6 +173,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
private transient List<ColoredManaSymbol> chosenColors;
private transient ManaCost currentUnpaidMana;
private final Random random = new Random();
public ComputerPlayer(String name, RangeOfInfluence range) {
super(name, range);
@ -196,7 +197,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
@Override
public boolean chooseMulligan(Game game) {
log.debug("chooseMulligan");
if (hand.size() < 6 || isTestMode()) {
if (hand.size() < 6 || isTestMode() || game.getClass().getName().contains("Momir")) {
return false;
}
Set<Card> lands = hand.getCards(new FilterLandCard(), game);
@ -218,33 +219,11 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (target.getTargetController() != null && target.getAbilityController() != null) {
abilityControllerId = target.getAbilityController();
}
UUID opponentId = game.getOpponents(abilityControllerId).iterator().next();
UUID randomOpponentId = getRandomOpponent(abilityControllerId, game);
if (target instanceof TargetPlayer) {
if (outcome.isGood()) {
if (target.canTarget(abilityControllerId, game)) {
target.add(abilityControllerId, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(opponentId, game)) {
target.add(opponentId, game);
return true;
}
}
} else {
if (target.canTarget(opponentId, game)) {
target.add(opponentId, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(abilityControllerId, game)) {
target.add(abilityControllerId, game);
return true;
}
}
}
return false;
return setTargetPlayer(outcome, target, null, sourceId, abilityControllerId, randomOpponentId, game);
}
if (target instanceof TargetDiscard) {
findPlayables(game);
if (unplayable.size() > 0) {
@ -291,13 +270,13 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (outcome.isGood()) {
targets = threats(abilityControllerId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
targets = threats(randomOpponentId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
}
if (targets.isEmpty() && target.isRequired()) {
if (!outcome.isGood()) {
targets = threats(abilityControllerId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
targets = threats(randomOpponentId, sourceId, ((TargetPermanent) target).getFilter(), game, target.getTargets());
}
}
}
@ -322,9 +301,10 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return target.isChosen();
}
if (target instanceof TargetCardInHand) {
if (target instanceof TargetCardInHand
|| (target.getZone().equals(Zone.HAND) && (target instanceof TargetCard))) {
List<Card> cards = new ArrayList<>();
for (UUID cardId : ((TargetCardInHand) target).possibleTargets(sourceId, this.getId(), game)) {
for (UUID cardId : target.possibleTargets(sourceId, this.getId(), game)) {
Card card = game.getCard(cardId);
if (card != null) {
cards.add(card);
@ -346,7 +326,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (outcome.isGood()) {
targets = threats(abilityControllerId, sourceId, ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, sourceId, ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
targets = threats(randomOpponentId, sourceId, ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
}
for (Permanent permanent : targets) {
List<UUID> alreadyTargetted = target.getTargets();
@ -363,8 +343,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return true;
}
} else {
if (target.canTarget(opponentId, null, game)) {
target.add(opponentId, game);
if (target.canTarget(randomOpponentId, null, game)) {
target.add(randomOpponentId, game);
return true;
}
}
@ -376,8 +356,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (target instanceof TargetPermanentOrPlayer) {
List<Permanent> targets;
TargetPermanentOrPlayer t = ((TargetPermanentOrPlayer) target);
List<Permanent> ownedTargets = threats(abilityControllerId, sourceId, ((FilterPermanentOrPlayer) t.getFilter()).getPermanentFilter(), game, target.getTargets());;
List<Permanent> opponentTargets = threats(opponentId, sourceId, ((FilterPermanentOrPlayer) t.getFilter()).getPermanentFilter(), game, target.getTargets());
List<Permanent> ownedTargets = threats(abilityControllerId, sourceId, ((FilterPermanentOrPlayer) t.getFilter()).getPermanentFilter(), game, target.getTargets());
List<Permanent> opponentTargets = threats(randomOpponentId, sourceId, ((FilterPermanentOrPlayer) t.getFilter()).getPermanentFilter(), game, target.getTargets());
if (outcome.isGood()) {
targets = ownedTargets;
} else {
@ -398,16 +378,16 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return true;
}
} else {
if (target.canTarget(opponentId, null, game)) {
target.add(opponentId, game);
if (target.canTarget(randomOpponentId, null, game)) {
target.add(randomOpponentId, game);
return true;
}
}
if (!target.isRequired(sourceId, game) || target.getNumberOfTargets() == 0) {
return false;
}
if (target.canTarget(opponentId, null, game)) {
target.add(opponentId, game);
if (target.canTarget(randomOpponentId, null, game)) {
target.add(randomOpponentId, game);
return true;
}
if (target.canTarget(abilityControllerId, null, game)) {
@ -495,33 +475,11 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (target.getAbilityController() != null) {
abilityControllerId = target.getAbilityController();
}
UUID opponentId = game.getOpponents(abilityControllerId).iterator().next();
UUID randomOpponentId = getRandomOpponent(abilityControllerId, game);
if (target instanceof TargetPlayer) {
if (outcome.isGood()) {
if (target.canTarget(abilityControllerId, abilityControllerId, source, game)) {
target.addTarget(playerId, source, game);
return true;
}
if (target.isRequired(source)) {
if (target.canTarget(abilityControllerId, opponentId, source, game)) {
target.addTarget(opponentId, source, game);
return true;
}
}
} else {
if (target.canTarget(abilityControllerId, opponentId, source, game)) {
target.addTarget(opponentId, source, game);
return true;
}
if (target.isRequired(source)) {
if (target.canTarget(abilityControllerId, abilityControllerId, source, game)) {
target.addTarget(abilityControllerId, source, game);
return true;
}
}
}
return false;
return setTargetPlayer(outcome, target, source, source.getSourceId(), abilityControllerId, randomOpponentId, game);
}
if (target instanceof TargetDiscard || target instanceof TargetCardInHand) {
if (outcome.isGood()) {
Cards cards = new CardsImpl(target.possibleTargets(source.getSourceId(), getId(), game));
@ -588,7 +546,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (outcome.isGood()) {
targets = threats(abilityControllerId, source == null ? null : source.getSourceId(), ((TargetPermanent) target).getFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, source == null ? null : source.getSourceId(), ((TargetPermanent) target).getFilter(), game, target.getTargets());
targets = threats(randomOpponentId, source == null ? null : source.getSourceId(), ((TargetPermanent) target).getFilter(), game, target.getTargets());
}
if (targets.isEmpty() && target.isRequired(source)) {
targets = threats(null, source == null ? null : source.getSourceId(), ((TargetPermanent) target).getFilter(), game, target.getTargets());
@ -612,7 +570,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (outcome.isGood()) {
targets = threats(abilityControllerId, source.getSourceId(), ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, source.getSourceId(), ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
targets = threats(randomOpponentId, source.getSourceId(), ((FilterCreatureOrPlayer) t.getFilter()).getCreatureFilter(), game, target.getTargets());
}
if (targets.isEmpty()) {
@ -622,8 +580,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return true;
}
} else {
if (target.canTarget(getId(), opponentId, source, game)) {
target.addTarget(opponentId, source, game);
if (target.canTarget(getId(), randomOpponentId, source, game)) {
target.addTarget(randomOpponentId, source, game);
return true;
}
}
@ -648,8 +606,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return true;
}
} else {
if (target.canTarget(getId(), opponentId, source, game)) {
target.addTarget(opponentId, source, game);
if (target.canTarget(getId(), randomOpponentId, source, game)) {
target.addTarget(randomOpponentId, source, game);
return true;
}
}
@ -709,7 +667,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (outcome.isGood()) {
targets = threats(abilityControllerId, source == null ? null : source.getSourceId(), ((TargetSpellOrPermanent) target).getPermanentFilter(), game, target.getTargets());
} else {
targets = threats(opponentId, source == null ? null : source.getSourceId(), ((TargetSpellOrPermanent) target).getPermanentFilter(), game, target.getTargets());
targets = threats(randomOpponentId, source == null ? null : source.getSourceId(), ((TargetSpellOrPermanent) target).getPermanentFilter(), game, target.getTargets());
}
if (targets.isEmpty() && target.isRequired(source)) {
targets = threats(null, source == null ? null : source.getSourceId(), ((TargetSpellOrPermanent) target).getPermanentFilter(), game, target.getTargets());
@ -757,7 +715,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (target instanceof TargetDefender) {
// TODO: Improve, now planeswalker is always chosen if it exits
List<Permanent> targets;
targets = game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), opponentId, game);
targets = game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), randomOpponentId, game);
if (targets != null && !targets.isEmpty()) {
for (Permanent planeswalker : targets) {
if (target.canTarget(getId(), planeswalker.getId(), source, game)) {
@ -769,8 +727,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
}
if (!target.isChosen()) {
if (target.canTarget(getId(), opponentId, source, game)) {
target.addTarget(opponentId, source, game);
if (target.canTarget(getId(), randomOpponentId, source, game)) {
target.addTarget(randomOpponentId, source, game);
}
}
return target.isChosen();
@ -993,7 +951,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
while (lands.size() > 0 && this.canPlayLand()) {
if (lands.size() == 1) {
this.playLand(lands.iterator().next(), game);
this.playLand(lands.iterator().next(), game, false);
} else {
playALand(lands, game);
}
@ -1008,7 +966,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (ManaAbility ability : card.getAbilities().getManaAbilities(Zone.BATTLEFIELD)) {
for (Mana netMana : ability.getNetMana(game)) {
if (netMana.enough(mana)) {
this.playLand(card, game);
this.playLand(card, game, false);
lands.remove(card);
return;
}
@ -1022,7 +980,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (ManaAbility ability : card.getAbilities().getManaAbilities(Zone.BATTLEFIELD)) {
for (Mana netMana : ability.getNetMana(game)) {
if (mana.contains(netMana)) {
this.playLand(card, game);
this.playLand(card, game, false);
lands.remove(card);
return;
}
@ -1031,7 +989,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
}
//play first available land
this.playLand(lands.iterator().next(), game);
this.playLand(lands.iterator().next(), game, false);
lands.remove(lands.iterator().next());
}
@ -1567,9 +1525,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return modes.getMode();
}
//TODO: improve this;
AvailableMode:
for (Mode mode : modes.getAvailableModes(source, game)) {
if (!modes.getSelectedModes().contains(mode.getId()) // select only modes not already selected
&& mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
for (Mode selectedMode : modes.getSelectedModes()) {
if (selectedMode.getId().equals(mode.getId())) {
continue AvailableMode;
}
}
if (mode.getTargets().canChoose(source.getSourceId(), source.getControllerId(), game)) { // and where targets are available
return mode;
}
}
@ -1631,42 +1594,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
private static void addBasicLands(Deck deck, String landName, int number) {
Random random = new Random();
Set<String> landSets = new HashSet<>();
// decide from which sets basic lands are taken from
for (String setCode : deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo.hasBasicLands()) {
landSets.add(expansionInfo.getCode());
}
}
// if sets have no basic land, take land from block
if (landSets.isEmpty()) {
for (String setCode : deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet : blockSets) {
if (blockSet.hasBasicLands()) {
landSets.add(blockSet.getCode());
}
}
}
}
// if still no set with lands found, take one by random
if (landSets.isEmpty()) {
// if sets have no basic lands and also it has no parent or parent has no lands get last set with lands
// select a set with basic lands by random
Random generator = new Random();
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
if (basicLandSets.size() > 0) {
landSets.add(basicLandSets.get(generator.nextInt(basicLandSets.size())).getCode());
}
}
if (landSets.isEmpty()) {
throw new IllegalArgumentException("No set with basic land was found");
}
Set<String> landSets = TournamentUtil.getLandSetCodeForDeckSets(deck.getExpansionSetCodes());
CardCriteria criteria = new CardCriteria();
if (!landSets.isEmpty()) {
@ -2222,4 +2150,116 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return new ComputerPlayer(this);
}
/**
* Sets a possible target player
*
*/
private boolean setTargetPlayer(Outcome outcome, Target target, Ability source, UUID sourceId, UUID abilityControllerId, UUID randomOpponentId, Game game) {
if (target instanceof TargetOpponent) {
if (source == null) {
if (((TargetOpponent) target).canTarget(randomOpponentId, game)) {
target.add(randomOpponentId, game);
return true;
}
} else {
if (((TargetOpponent) target).canTarget(randomOpponentId, source, game)) {
target.add(randomOpponentId, game);
return true;
}
}
for (UUID currentId : game.getOpponents(abilityControllerId)) {
if (source == null) {
if (((TargetOpponent) target).canTarget(currentId, game)) {
target.add(currentId, game);
return true;
}
} else {
if (((TargetOpponent) target).canTarget(currentId, source, game)) {
target.add(currentId, game);
return true;
}
}
}
return false;
}
if (target instanceof TargetPlayer) {
if (outcome.isGood()) {
if (source == null) {
if (target.canTarget(abilityControllerId, game)) {
target.add(abilityControllerId, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(randomOpponentId, game)) {
target.add(randomOpponentId, game);
return true;
}
}
} else {
if (target.canTarget(abilityControllerId, abilityControllerId, source, game)) {
target.addTarget(playerId, source, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(randomOpponentId, game)) {
target.add(randomOpponentId, game);
return true;
}
}
}
} else {
if (source == null) {
if (target.canTarget(randomOpponentId, game)) {
target.add(randomOpponentId, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(abilityControllerId, game)) {
target.add(abilityControllerId, game);
return true;
}
}
} else {
if (target.canTarget(randomOpponentId, game)) {
target.add(randomOpponentId, game);
return true;
}
if (target.isRequired(sourceId, game)) {
if (target.canTarget(abilityControllerId, game)) {
target.add(abilityControllerId, game);
return true;
}
}
}
}
return false;
}
return false;
}
/**
* Returns an opponent by random
*
* @param abilityControllerId
* @param game
* @return
*/
private UUID getRandomOpponent(UUID abilityControllerId, Game game) {
UUID randomOpponentId = game.getOpponents(abilityControllerId).iterator().next();
Set<UUID> opponents = game.getOpponents(abilityControllerId);
if (opponents.size() > 1) {
int rand = random.nextInt(opponents.size());
int count = 0;
for (UUID currentId : opponents) {
if (count == rand) {
randomOpponentId = currentId;
break;
}
}
}
return randomOpponentId;
}
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-player-ai-mcts</artifactId>

View file

@ -62,7 +62,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
protected transient MCTSNode root;
protected int maxThinkTime;
private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
private static final Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
private int poolSize;
public ComputerPlayerMCTS(String name, RangeOfInfluence range, int skill) {

View file

@ -43,7 +43,7 @@ public class MCTSExecutor implements Callable<Boolean> {
protected UUID playerId;
protected int simCount;
private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
private static final Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
public MCTSExecutor(Game sim, UUID playerId, int thinkTime) {
this.playerId = playerId;

View file

@ -57,7 +57,7 @@ public class MCTSNode {
public static final boolean USE_ACTION_CACHE = false;
private static final double selectionCoefficient = Math.sqrt(2.0);
private static final double passRatioTolerance = 0.0;
private static final transient Logger logger = Logger.getLogger(MCTSNode.class);
private static final Logger logger = Logger.getLogger(MCTSNode.class);
private int visits = 0;
private int wins = 0;

View file

@ -45,7 +45,7 @@ import java.util.UUID;
*/
public class MCTSPlayer extends ComputerPlayer {
private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class);
private static final Logger logger = Logger.getLogger(MCTSPlayer.class);
protected PassAbility pass = new PassAbility();

View file

@ -66,7 +66,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
private boolean isSimulatedPlayer;
private static Random rnd = new Random();
private int actionCount = 0;
private static final transient Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class);
private static final Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class);
public SimulatedPlayerMCTS(UUID id, boolean isSimulatedPlayer) {
super(id);

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</parent>
<artifactId>mage-player-aiminimax</artifactId>

View file

@ -60,8 +60,8 @@ import java.util.concurrent.*;
*/
public class ComputerPlayer2 extends ComputerPlayer implements Player {
private static final transient Logger logger = Logger.getLogger(ComputerPlayer2.class);
private static final transient ExecutorService pool = Executors.newFixedThreadPool(1);
private static final Logger logger = Logger.getLogger(ComputerPlayer2.class);
private static final ExecutorService pool = Executors.newFixedThreadPool(1);
protected int maxDepth;
protected int maxNodes;

Some files were not shown because too many files have changed in this diff Show more