mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Compare commits
574 Commits
untapRewor
...
forge-1.6.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74005529f5 | ||
|
|
4186a365cb | ||
|
|
51960f0e28 | ||
|
|
a27f69b1c5 | ||
|
|
8ab01cce3e | ||
|
|
e10235aae9 | ||
|
|
05591c6bd9 | ||
|
|
a25e469291 | ||
|
|
ebd14944c6 | ||
|
|
1b08fc3592 | ||
|
|
57457946e5 | ||
|
|
918a39ab60 | ||
|
|
2cc39c2580 | ||
|
|
3aca94dc9b | ||
|
|
65ad9d61d9 | ||
|
|
138e3a4661 | ||
|
|
41844ee7e3 | ||
|
|
d4f2594e26 | ||
|
|
babc9de575 | ||
|
|
11a5683025 | ||
|
|
b6f8f89c7a | ||
|
|
0885fe5898 | ||
|
|
8aa1f049ab | ||
|
|
f7aa7bf580 | ||
|
|
b74033fe17 | ||
|
|
596296cabf | ||
|
|
adcd86e7d7 | ||
|
|
308768ae50 | ||
|
|
235636ca4a | ||
|
|
359ce5e39d | ||
|
|
c6e13e98b3 | ||
|
|
0cc9687e39 | ||
|
|
3d59f1832c | ||
|
|
58fdd58e9a | ||
|
|
ea661c4fbb | ||
|
|
28abe52106 | ||
|
|
e689fd8721 | ||
|
|
fea6c85e97 | ||
|
|
4e80a1b818 | ||
|
|
bdde3520f4 | ||
|
|
165ae649b1 | ||
|
|
0536ebf1c8 | ||
|
|
fb176abe05 | ||
|
|
28f0232736 | ||
|
|
4c29fd8faf | ||
|
|
df8d289ee0 | ||
|
|
203de48dd4 | ||
|
|
97f763b1a0 | ||
|
|
9fd8969ea5 | ||
|
|
d70e699c81 | ||
|
|
39bf8f5313 | ||
|
|
68eb8e2510 | ||
|
|
a20800cfb3 | ||
|
|
adce811a3d | ||
|
|
084a7ae73e | ||
|
|
14a697269b | ||
|
|
7de8cdee90 | ||
|
|
20333491f7 | ||
|
|
d529c55277 | ||
|
|
9e3bb1ca72 | ||
|
|
0caf41f1d6 | ||
|
|
817aadb995 | ||
|
|
c6016c2728 | ||
|
|
492cab9c06 | ||
|
|
64dd84b560 | ||
|
|
496768b566 | ||
|
|
b2fcc6e743 | ||
|
|
1584fcbb82 | ||
|
|
2860111154 | ||
|
|
cfdbb98cf9 | ||
|
|
87ec3a528b | ||
|
|
8ebabd978f | ||
|
|
51fae70e24 | ||
|
|
2f0024a8dd | ||
|
|
cd498e408c | ||
|
|
6d193c315e | ||
|
|
c81d9f6bc2 | ||
|
|
e13e5d0b16 | ||
|
|
ceb892d610 | ||
|
|
2690a4d548 | ||
|
|
59a8e550d6 | ||
|
|
4793425c58 | ||
|
|
e47ee567bf | ||
|
|
c9f33415e1 | ||
|
|
d1a0c9f1ff | ||
|
|
40b43b00c2 | ||
|
|
cea6d3a9df | ||
|
|
ecda5377a3 | ||
|
|
fb9c7290b2 | ||
|
|
5b185d2fe3 | ||
|
|
c4712e705c | ||
|
|
d4656b619f | ||
|
|
e8c5a58d85 | ||
|
|
143cfa04de | ||
|
|
ef752c5db6 | ||
|
|
f4ba889c84 | ||
|
|
f20e61520b | ||
|
|
88f082e261 | ||
|
|
6304fa4091 | ||
|
|
4b01074d0f | ||
|
|
65c8e47e26 | ||
|
|
80c6e30691 | ||
|
|
8cfc922d97 | ||
|
|
92e6c303ad | ||
|
|
762dc60600 | ||
|
|
373b81072a | ||
|
|
9bf2d57715 | ||
|
|
ef71a7befc | ||
|
|
dc34c4e985 | ||
|
|
9a495e516a | ||
|
|
6fcd744132 | ||
|
|
70bc280cf1 | ||
|
|
470fe4b877 | ||
|
|
86f472d29f | ||
|
|
b54ce90df1 | ||
|
|
db270d0c7c | ||
|
|
9d5837bb87 | ||
|
|
12848af745 | ||
|
|
2d28139ca0 | ||
|
|
272663dc4a | ||
|
|
d4a47260cb | ||
|
|
7023521fb2 | ||
|
|
97fe8dc35b | ||
|
|
fb0c0bd807 | ||
|
|
2285541b6d | ||
|
|
e965b899c0 | ||
|
|
011811d183 | ||
|
|
65efbc57f3 | ||
|
|
437587766b | ||
|
|
a1fe5c5db1 | ||
|
|
c44d91281e | ||
|
|
56fdf15b6f | ||
|
|
19be99d106 | ||
|
|
2e25c83775 | ||
|
|
dae91de27e | ||
|
|
15424d2fea | ||
|
|
cd1d744e1f | ||
|
|
dc77591571 | ||
|
|
074467e65e | ||
|
|
c81f93551e | ||
|
|
1f6cbd7d19 | ||
|
|
bd35e224a4 | ||
|
|
ae5986f101 | ||
|
|
5cbf5649c0 | ||
|
|
3da4db3edc | ||
|
|
47121019d4 | ||
|
|
c97b390161 | ||
|
|
f97312dcf2 | ||
|
|
0eed744018 | ||
|
|
655737dcb5 | ||
|
|
488fa4a4dd | ||
|
|
8344522e12 | ||
|
|
e1e085d610 | ||
|
|
e35904e727 | ||
|
|
6dc8d7648a | ||
|
|
c296b32209 | ||
|
|
69f2bb70e8 | ||
|
|
a499e0a551 | ||
|
|
bc99962621 | ||
|
|
bf9b7054b3 | ||
|
|
50be973e57 | ||
|
|
108c39ef7c | ||
|
|
ae6ea42aa9 | ||
|
|
6c4ceccc30 | ||
|
|
fde7d6ff09 | ||
|
|
1af3505d0b | ||
|
|
047f018da4 | ||
|
|
a90e9f05e2 | ||
|
|
7db7e10934 | ||
|
|
397b340701 | ||
|
|
a050b584ac | ||
|
|
d68c740e1d | ||
|
|
b807ce30c4 | ||
|
|
a4bd13d050 | ||
|
|
244960d0d7 | ||
|
|
267c8c6b0d | ||
|
|
06fc409234 | ||
|
|
77ed24a203 | ||
|
|
ed3c519404 | ||
|
|
9fcf8e82ef | ||
|
|
dd4df9baaa | ||
|
|
4384b1621b | ||
|
|
0e1c82a31f | ||
|
|
b5babd5451 | ||
|
|
5cb8502566 | ||
|
|
b7c4720030 | ||
|
|
074243891c | ||
|
|
1117ff1e7c | ||
|
|
5dd24341e1 | ||
|
|
19d4f36faa | ||
|
|
ac9f8e3191 | ||
|
|
9d193fb3bb | ||
|
|
c20b0c3620 | ||
|
|
8409a7e6d1 | ||
|
|
3d59118b94 | ||
|
|
e0fb373b3d | ||
|
|
f0c8deb25e | ||
|
|
b288c9f61a | ||
|
|
823c278cd7 | ||
|
|
ba4ba8d051 | ||
|
|
467268c451 | ||
|
|
3f1f8321d3 | ||
|
|
5730a407c3 | ||
|
|
22974f8bf4 | ||
|
|
6414347d91 | ||
|
|
113f891348 | ||
|
|
cbab3e6000 | ||
|
|
17663bd2c0 | ||
|
|
c226a4dbd5 | ||
|
|
0c2d0e6cb6 | ||
|
|
d63106a71a | ||
|
|
2c26e3f509 | ||
|
|
50e0387cda | ||
|
|
b05dc40a1c | ||
|
|
3846be2321 | ||
|
|
2fa3179a31 | ||
|
|
2617ff339d | ||
|
|
e36311db44 | ||
|
|
2449166c36 | ||
|
|
eb16486ee6 | ||
|
|
e0c858a3d6 | ||
|
|
71749cef3f | ||
|
|
15839e343e | ||
|
|
9a98b39e94 | ||
|
|
9c6c0f1861 | ||
|
|
318d919111 | ||
|
|
c753a1c875 | ||
|
|
e304337a62 | ||
|
|
3768ca8f77 | ||
|
|
12f76827e9 | ||
|
|
3c5f464039 | ||
|
|
9f2304b1a5 | ||
|
|
8a0ba4f27a | ||
|
|
43dc6d35c0 | ||
|
|
d04c593adc | ||
|
|
4e1b7e886f | ||
|
|
8544e805bb | ||
|
|
08823bd94c | ||
|
|
04cfc7a81f | ||
|
|
91656fd7c0 | ||
|
|
e984bd5708 | ||
|
|
eb0c0f3f84 | ||
|
|
19b7daeaee | ||
|
|
c933e722f3 | ||
|
|
1536377eb2 | ||
|
|
a11640cbc9 | ||
|
|
d51fe454b5 | ||
|
|
550fd937f1 | ||
|
|
bd1add4d47 | ||
|
|
944eb38002 | ||
|
|
ddf481f4fd | ||
|
|
2e7d84b58f | ||
|
|
db853cb5ba | ||
|
|
d0d652b427 | ||
|
|
231e048936 | ||
|
|
e95982a043 | ||
|
|
1a7b2677f3 | ||
|
|
b77bb5768d | ||
|
|
2be9fc65b1 | ||
|
|
c4e04fe003 | ||
|
|
964e06b8cb | ||
|
|
78d6847db5 | ||
|
|
25d6ce6763 | ||
|
|
fc26b5d3a9 | ||
|
|
9e4dc631e8 | ||
|
|
b6bff03ad3 | ||
|
|
394a365497 | ||
|
|
d5de2f387b | ||
|
|
5106de0abe | ||
|
|
510c81d251 | ||
|
|
b4437636a8 | ||
|
|
cc64997832 | ||
|
|
c35afecce7 | ||
|
|
2d9e8cc2af | ||
|
|
a9c4842b96 | ||
|
|
c8b21a12ed | ||
|
|
d0a75c0943 | ||
|
|
c75d3b2d04 | ||
|
|
50d8c03f8b | ||
|
|
dde3e08e6a | ||
|
|
2dd3385849 | ||
|
|
bd6cc759c7 | ||
|
|
39f695f120 | ||
|
|
61839df123 | ||
|
|
e6b3ec048a | ||
|
|
4fb5e7d305 | ||
|
|
8d4a80089e | ||
|
|
539e321c53 | ||
|
|
737700719a | ||
|
|
b2bc26142a | ||
|
|
9a125bf4f5 | ||
|
|
b53135d83a | ||
|
|
86262f3810 | ||
|
|
9237de38df | ||
|
|
18d5d7da27 | ||
|
|
cba653d891 | ||
|
|
9ea265625e | ||
|
|
d4aa0ecae4 | ||
|
|
bb5ee52133 | ||
|
|
33d5d45d3c | ||
|
|
87bad70939 | ||
|
|
047bc9c5cd | ||
|
|
f098e333d2 | ||
|
|
785835632d | ||
|
|
360b72fd91 | ||
|
|
19082049e7 | ||
|
|
eacc29672f | ||
|
|
c7b6ac1670 | ||
|
|
0aa54cea23 | ||
|
|
9fe50f6c66 | ||
|
|
2bb84cf79f | ||
|
|
8d0ade1eab | ||
|
|
242c7c3b21 | ||
|
|
ff272b89fd | ||
|
|
4e83e73dca | ||
|
|
7d1ffa4e90 | ||
|
|
aab83d882a | ||
|
|
4f69b673bf | ||
|
|
7d17e58e1f | ||
|
|
3d6677bbd5 | ||
|
|
30d57a5745 | ||
|
|
2fb2b64d33 | ||
|
|
1dc8fed6e8 | ||
|
|
44c6605804 | ||
|
|
560f8ac14a | ||
|
|
b99dea604d | ||
|
|
f3ff419462 | ||
|
|
d79c2469ec | ||
|
|
94de9e7cf2 | ||
|
|
a9d9c800b8 | ||
|
|
678d09558c | ||
|
|
831edab34b | ||
|
|
5b64b41f21 | ||
|
|
78a5827976 | ||
|
|
a9b6faeb7c | ||
|
|
bebc58d91d | ||
|
|
2c70b8b7e0 | ||
|
|
07d7b7cb58 | ||
|
|
4c80dd3c42 | ||
|
|
0b436479be | ||
|
|
036cd90516 | ||
|
|
f0076117df | ||
|
|
f8b4a843c5 | ||
|
|
5a24092dc0 | ||
|
|
bf1c32f12a | ||
|
|
f0fb6539ef | ||
|
|
a85a761bee | ||
|
|
2c61dc9a75 | ||
|
|
9516929495 | ||
|
|
5350a4c476 | ||
|
|
26dc246c52 | ||
|
|
ad6716f00e | ||
|
|
dffb63d95f | ||
|
|
5069c71dd8 | ||
|
|
287abb9f37 | ||
|
|
7f8325fb6c | ||
|
|
6c38674716 | ||
|
|
54fdb69e88 | ||
|
|
068cee2326 | ||
|
|
e9c2e1034c | ||
|
|
f453c2af78 | ||
|
|
cc3c631cad | ||
|
|
7cfd060ed8 | ||
|
|
c77f5e9b61 | ||
|
|
f18bd75257 | ||
|
|
555a1f8411 | ||
|
|
c600dc3b4f | ||
|
|
0f138a1bf5 | ||
|
|
1c19f36637 | ||
|
|
d19973208c | ||
|
|
0a9078a2ec | ||
|
|
bf2368ee44 | ||
|
|
d0a23fbf14 | ||
|
|
015f561740 | ||
|
|
cff4a29f1c | ||
|
|
f50ee0ba36 | ||
|
|
fe5d8e537c | ||
|
|
d943891e4f | ||
|
|
da3d1d7099 | ||
|
|
86dd21ae7b | ||
|
|
2d30184f76 | ||
|
|
271063934a | ||
|
|
3fb601adfb | ||
|
|
757e11af42 | ||
|
|
7ec12fb58d | ||
|
|
6c9cf02884 | ||
|
|
0c904e208a | ||
|
|
d12a898333 | ||
|
|
0e665dc673 | ||
|
|
02299a0400 | ||
|
|
86d7069626 | ||
|
|
776b865761 | ||
|
|
a3a4ef22df | ||
|
|
c2db78baf7 | ||
|
|
9a30d78f54 | ||
|
|
db98ce160b | ||
|
|
ce8b5b53e0 | ||
|
|
0c4055726c | ||
|
|
64ae4bae0c | ||
|
|
044cc793e8 | ||
|
|
ca81b2b55c | ||
|
|
e310dc30d7 | ||
|
|
f239755249 | ||
|
|
57686c0554 | ||
|
|
5ecde572c3 | ||
|
|
23e9974950 | ||
|
|
ec98d128f1 | ||
|
|
5c07951604 | ||
|
|
7be34625f6 | ||
|
|
f15762b746 | ||
|
|
e365e78756 | ||
|
|
5f6cb893ef | ||
|
|
3b636be2fe | ||
|
|
1af940b034 | ||
|
|
8cb1789e60 | ||
|
|
01782de3a6 | ||
|
|
3a7e35c51d | ||
|
|
bff24a1d3d | ||
|
|
8a075000a2 | ||
|
|
5e0761d085 | ||
|
|
2184ddf1bb | ||
|
|
fd032f6ccd | ||
|
|
164c819523 | ||
|
|
987043ead2 | ||
|
|
4aa9c224d0 | ||
|
|
2ac6fa4542 | ||
|
|
2797f95cd3 | ||
|
|
5eb9be6248 | ||
|
|
23eebf9037 | ||
|
|
b59adab68d | ||
|
|
b2d44105be | ||
|
|
2235546f2a | ||
|
|
59d104f68b | ||
|
|
6abdfd391d | ||
|
|
a6ff0b5b10 | ||
|
|
02969cfe5b | ||
|
|
c6a2c35850 | ||
|
|
4c0a71f37d | ||
|
|
74e3bd1895 | ||
|
|
121c9f5012 | ||
|
|
7b1cd816b7 | ||
|
|
02ae8f8108 | ||
|
|
6a76cc8bc6 | ||
|
|
9b9c38126e | ||
|
|
e4ee0c768f | ||
|
|
340de153c8 | ||
|
|
2bf477102d | ||
|
|
42a15b40b3 | ||
|
|
a2589cd433 | ||
|
|
7ec7025ed4 | ||
|
|
5edeb6df94 | ||
|
|
001a1981cf | ||
|
|
446fb59473 | ||
|
|
3b58d6df42 | ||
|
|
a80c683901 | ||
|
|
a5b65eaaed | ||
|
|
31182289b7 | ||
|
|
85eb740264 | ||
|
|
4318e23a40 | ||
|
|
b1b01f2426 | ||
|
|
4ca7352d5c | ||
|
|
84905bd726 | ||
|
|
18e16368be | ||
|
|
7ed84c4c3f | ||
|
|
f334211395 | ||
|
|
164ca8541e | ||
|
|
42f4126aff | ||
|
|
5790e29daa | ||
|
|
88a4a2c6cf | ||
|
|
90b72fc11e | ||
|
|
00391df1f0 | ||
|
|
15de0c0bba | ||
|
|
a2fdce9be9 | ||
|
|
fa6fce9589 | ||
|
|
cc1f03fc94 | ||
|
|
8b25f6f129 | ||
|
|
b37937421c | ||
|
|
df7be19487 | ||
|
|
f17d2bf7fc | ||
|
|
3369db8150 | ||
|
|
408c9df2df | ||
|
|
63b6d665a1 | ||
|
|
cfc8b7fb28 | ||
|
|
1497345a79 | ||
|
|
bbd2940b63 | ||
|
|
b9c65fb8ee | ||
|
|
0b37b4e543 | ||
|
|
4c3e4f2170 | ||
|
|
dc12c50c1a | ||
|
|
2b986f5bac | ||
|
|
2accf7543e | ||
|
|
ba37189410 | ||
|
|
d578eee402 | ||
|
|
5107d89ef5 | ||
|
|
72b8b5c98e | ||
|
|
402885391f | ||
|
|
b4d153ab3b | ||
|
|
1a0cb62ac8 | ||
|
|
c0baf70c59 | ||
|
|
166cf2623c | ||
|
|
8567b69073 | ||
|
|
3a4271e66d | ||
|
|
8b723aebd9 | ||
|
|
eb59d6c86b | ||
|
|
a291b75dd9 | ||
|
|
f1a76e1e76 | ||
|
|
a391f7414f | ||
|
|
299de54ba5 | ||
|
|
37bae14dfd | ||
|
|
d780aa43d4 | ||
|
|
91534776d1 | ||
|
|
ef82e11c53 | ||
|
|
31bb611ecf | ||
|
|
762481e28a | ||
|
|
25194c7abe | ||
|
|
967af29c47 | ||
|
|
ae9ee57d79 | ||
|
|
17706bd5e4 | ||
|
|
9ed54f726c | ||
|
|
53c88f0302 | ||
|
|
ad1cc78578 | ||
|
|
f94a613eef | ||
|
|
e6fa89206a | ||
|
|
b010da744c | ||
|
|
d53eb3a3fe | ||
|
|
ea25ad2c3b | ||
|
|
ac7f34d3f5 | ||
|
|
4969547938 | ||
|
|
6808be7a42 | ||
|
|
70986149ef | ||
|
|
bc859b3e52 | ||
|
|
eb376b8eb3 | ||
|
|
9fce28bed7 | ||
|
|
0bcc0e9248 | ||
|
|
aecee3cea2 | ||
|
|
3432b9fdcd | ||
|
|
8bde4d5f92 | ||
|
|
67c596726f | ||
|
|
60fb1c0d02 | ||
|
|
3261e1a260 | ||
|
|
2e1fa8fa40 | ||
|
|
cadb2ae791 | ||
|
|
2d3990df81 | ||
|
|
23d4904ee7 | ||
|
|
f66f51b25e | ||
|
|
826ff27bd1 | ||
|
|
132aa8d49a | ||
|
|
67148cd84c | ||
|
|
941e3a7537 | ||
|
|
4487952c28 | ||
|
|
5089663b07 | ||
|
|
3ec5bfd4ff | ||
|
|
adb1ef35d9 | ||
|
|
df85278a44 | ||
|
|
7a04669560 | ||
|
|
2e24a1bde4 | ||
|
|
16134cb857 | ||
|
|
d396a8755b | ||
|
|
7617b95fae | ||
|
|
ecdda5b678 | ||
|
|
2a16a29ea2 | ||
|
|
81d7bec2cd | ||
|
|
87ffbe4c20 | ||
|
|
94a0fb20d2 | ||
|
|
7313670d8f | ||
|
|
5047e7732c | ||
|
|
98a459ac9c | ||
|
|
eec3f05dc7 | ||
|
|
4db2fd4ee7 | ||
|
|
41e0760678 | ||
|
|
36b9689cf8 | ||
|
|
c5b09815e3 | ||
|
|
3da7b0f8e6 | ||
|
|
1aa0d321cc |
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>forge</artifactId>
|
||||
<groupId>forge</groupId>
|
||||
<version>1.6.30-SNAPSHOT</version>
|
||||
<version>1.6.31</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>forge-ai</artifactId>
|
||||
|
||||
@@ -1281,7 +1281,8 @@ public class AiBlockController {
|
||||
oppCreatureCount = ComputerUtil.countUsefulCreatures(attackersLeft.get(0).getController());
|
||||
}
|
||||
|
||||
if (attacker.getOwner().equals(ai) && "6".equals(attacker.getSVar("SacMe"))) {
|
||||
if (attacker != null && attacker.getOwner() != null)
|
||||
if (attacker.getOwner().equals(ai) && "6".equals(attacker.getSVar("SacMe"))) {
|
||||
// Temporarily controlled object - don't trade with it
|
||||
// TODO: find a more reliable way to figure out that control will be reestablished next turn
|
||||
return false;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ComputerUtil {
|
||||
if (chooseTargets != null) {
|
||||
chooseTargets.run();
|
||||
}
|
||||
if (sa.hasParam("Bestow")) {
|
||||
if (sa.isBestow()) {
|
||||
sa.getHostCard().animateBestow();
|
||||
}
|
||||
|
||||
|
||||
@@ -643,7 +643,7 @@ public class ComputerUtilCard {
|
||||
return getMostProminentType(list, CardType.getAllCreatureTypes());
|
||||
}
|
||||
|
||||
public static String getMostProminentType(final CardCollectionView list, final List<String> valid) {
|
||||
public static String getMostProminentType(final CardCollectionView list, final Collection<String> valid) {
|
||||
if (list.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
@@ -964,6 +964,22 @@ public class ComputerUtilCard {
|
||||
}
|
||||
chosen.add(chosenColor);
|
||||
}
|
||||
else if (logic.equals("HighestDevotionToColor")) {
|
||||
int curDevotion = 0;
|
||||
String chosenColor = MagicColor.Constant.WHITE;
|
||||
CardCollectionView hand = ai.getCardsIn(ZoneType.Hand);
|
||||
for(byte c : MagicColor.WUBRG) {
|
||||
String devotionCode = "Count$Devotion." + MagicColor.toLongString(c);
|
||||
|
||||
int devotion = CardFactoryUtil.xCount(sa.getHostCard(), devotionCode);
|
||||
if (devotion > curDevotion && !CardLists.filter(hand, CardPredicates.isColor(c)).isEmpty()) {
|
||||
curDevotion = devotion;
|
||||
chosenColor = MagicColor.toLongString(c);
|
||||
}
|
||||
}
|
||||
chosen.add(chosenColor);
|
||||
}
|
||||
|
||||
}
|
||||
if (chosen.isEmpty()) {
|
||||
chosen.add(MagicColor.Constant.GREEN);
|
||||
|
||||
@@ -11,10 +11,7 @@ import forge.game.Game;
|
||||
import forge.game.GameEntity;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.effects.DetachedCardEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardCollectionView;
|
||||
import forge.game.card.CounterType;
|
||||
import forge.game.card.*;
|
||||
import forge.game.card.token.TokenInfo;
|
||||
import forge.game.combat.Combat;
|
||||
import forge.game.combat.CombatUtil;
|
||||
@@ -24,6 +21,7 @@ import forge.game.mana.ManaPool;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.trigger.TriggerType;
|
||||
@@ -244,7 +242,7 @@ public abstract class GameState {
|
||||
if (card instanceof DetachedCardEffect) {
|
||||
continue;
|
||||
}
|
||||
addCard(zone, card.getOwner() == ai ? aiCardTexts : humanCardTexts, card);
|
||||
addCard(zone, card.getController() == ai ? aiCardTexts : humanCardTexts, card);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,6 +269,10 @@ public abstract class GameState {
|
||||
}
|
||||
|
||||
if (zoneType == ZoneType.Battlefield) {
|
||||
if (c.getOwner() != c.getController()) {
|
||||
// TODO: Handle more than 2-player games.
|
||||
newText.append("|Owner:" + (c.getOwner().isAI() ? "AI" : "Human"));
|
||||
}
|
||||
if (c.isTapped()) {
|
||||
newText.append("|Tapped");
|
||||
}
|
||||
@@ -362,6 +364,12 @@ public abstract class GameState {
|
||||
if (c.isFaceDown()) {
|
||||
newText.append("|FaceDown"); // Exiled face down
|
||||
}
|
||||
if (c.isAdventureCard() && c.getZone().is(ZoneType.Exile)) {
|
||||
// TODO: this will basically default all exiled cards with Adventure to being "On Adventure".
|
||||
// Need to figure out a better way to detect if it's actually on adventure.
|
||||
newText.append("|OnAdventure");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (zoneType == ZoneType.Battlefield || zoneType == ZoneType.Exile) {
|
||||
@@ -1202,6 +1210,16 @@ public abstract class GameState {
|
||||
c.setState(CardStateName.Flipped, true);
|
||||
} else if (info.startsWith("Meld")) {
|
||||
c.setState(CardStateName.Meld, true);
|
||||
} else if (info.startsWith("OnAdventure")) {
|
||||
String abAdventure = "DB$ Effect | RememberObjects$ Self | StaticAbilities$ Play | ExileOnMoved$ Exile | Duration$ Permanent | ConditionDefined$ Self | ConditionPresent$ Card.nonCopiedSpell";
|
||||
AbilitySub saAdventure = (AbilitySub)AbilityFactory.getAbility(abAdventure, c);
|
||||
StringBuilder sbPlay = new StringBuilder();
|
||||
sbPlay.append("Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered+nonAdventure");
|
||||
sbPlay.append(" | AffectedZone$ Exile | Description$ You may cast the card.");
|
||||
saAdventure.setSVar("Play", sbPlay.toString());
|
||||
saAdventure.setActivatingPlayer(c.getOwner());
|
||||
saAdventure.resolve();
|
||||
c.setExiledWith(c); // This seems to be the way it's set up internally. Potentially not needed here?
|
||||
} else if (info.startsWith("IsCommander")) {
|
||||
// TODO: This doesn't seem to properly restore the ability to play the commander. Why?
|
||||
c.setCommander(true);
|
||||
|
||||
@@ -502,12 +502,11 @@ public class PlayerControllerAi extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String chooseSomeType(String kindOfType, SpellAbility sa, List<String> validTypes, List<String> invalidTypes, boolean isOptional) {
|
||||
public String chooseSomeType(String kindOfType, SpellAbility sa, Collection<String> validTypes, List<String> invalidTypes, boolean isOptional) {
|
||||
String chosen = ComputerUtil.chooseSomeType(player, kindOfType, sa.getParam("AILogic"), invalidTypes);
|
||||
if (StringUtils.isBlank(chosen) && !validTypes.isEmpty())
|
||||
{
|
||||
chosen = validTypes.get(0);
|
||||
System.err.println("AI has no idea how to choose " + kindOfType +", defaulting to 1st element: chosen");
|
||||
if (StringUtils.isBlank(chosen) && !validTypes.isEmpty()) {
|
||||
chosen = validTypes.iterator().next();
|
||||
System.err.println("AI has no idea how to choose " + kindOfType +", defaulting to arbitrary element: chosen");
|
||||
}
|
||||
game.getAction().nofityOfValue(sa, player, chosen, player);
|
||||
return chosen;
|
||||
|
||||
@@ -1031,7 +1031,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
Card c = null;
|
||||
List<Card> magnetList = null;
|
||||
String stCheck = null;
|
||||
if (attachSource.isAura() || sa.hasParam("Bestow")) {
|
||||
if (attachSource.isAura() || sa.isBestow()) {
|
||||
stCheck = "EnchantedBy";
|
||||
magnetList = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
|
||||
@@ -8,10 +8,7 @@ import forge.ai.SpecialCardAi;
|
||||
import forge.ai.SpellAbilityAi;
|
||||
import forge.card.MagicColor;
|
||||
import forge.game.Game;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollectionView;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardPredicates;
|
||||
import forge.game.card.*;
|
||||
import forge.game.phase.PhaseHandler;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
@@ -69,9 +66,7 @@ public class ChooseColorAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (logic.equals("MostProminentInComputerDeck")) {
|
||||
} else if (logic.equals("MostProminentInComputerDeck")) {
|
||||
if ("Astral Cornucopia".equals(sourceName)) {
|
||||
// activate in Main 2 hoping that the extra mana surplus will make a difference
|
||||
// if there are some nonland permanents in hand
|
||||
@@ -80,6 +75,11 @@ public class ChooseColorAi extends SpellAbilityAi {
|
||||
|
||||
return permanents.size() > 0 && ph.is(PhaseType.MAIN2, ai);
|
||||
}
|
||||
} else if (logic.equals("HighestDevotionToColor")) {
|
||||
// currently only works more or less reliably in Main2 to cast own spells
|
||||
if (!ph.is(PhaseType.MAIN2, ai)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean chance = MyRandom.getRandom().nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package forge.ai.ability;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.ai.*;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -157,6 +159,15 @@ public class DigAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.ability.SpellAbilityAi#chooseSinglePlayer(forge.game.player.Player, forge.card.spellability.SpellAbility, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public Player chooseSinglePlayer(Player ai, SpellAbility sa, Iterable<Player> options) {
|
||||
// an opponent choose a card from
|
||||
return Iterables.getFirst(options, null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,8 @@ public class FightAi extends SpellAbilityAi {
|
||||
aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures);
|
||||
List<Card> humCreatures = ai.getOpponents().getCreaturesInPlay();
|
||||
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
|
||||
if (humCreatures.isEmpty())
|
||||
return false; //prevent IndexOutOfBoundsException on MOJHOSTO variant
|
||||
|
||||
// assumes the triggered card belongs to the ai
|
||||
if (sa.hasParam("Defined")) {
|
||||
|
||||
@@ -63,6 +63,7 @@ public class SacrificeAi extends SpellAbilityAi {
|
||||
final boolean destroy = sa.hasParam("Destroy");
|
||||
|
||||
Player opp = ai.getWeakestOpponent();
|
||||
|
||||
if (tgt != null) {
|
||||
sa.resetTargets();
|
||||
if (!opp.canBeTargetedBy(sa)) {
|
||||
@@ -74,8 +75,16 @@ public class SacrificeAi extends SpellAbilityAi {
|
||||
num = (num == null) ? "1" : num;
|
||||
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), num, sa);
|
||||
|
||||
List<Card> list =
|
||||
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
List<Card> list = null;
|
||||
try {
|
||||
list = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
} finally {
|
||||
if (list == null)
|
||||
return false;
|
||||
}//prevent NPE on MoJhoSto
|
||||
|
||||
for (Card c : list) {
|
||||
if (c.hasSVar("SacMe") && Integer.parseInt(c.getSVar("SacMe")) > 3) {
|
||||
return false;
|
||||
@@ -131,15 +140,31 @@ public class SacrificeAi extends SpellAbilityAi {
|
||||
amount = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), amount);
|
||||
}
|
||||
|
||||
List<Card> humanList =
|
||||
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
List<Card> humanList = null;
|
||||
try {
|
||||
humanList = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
} finally {
|
||||
if (humanList == null)
|
||||
return false;
|
||||
}//prevent NPE on MoJhoSto
|
||||
|
||||
// Since all of the cards have AI:RemoveDeck:All, I enabled 1 for 1
|
||||
// (or X for X) trades for special decks
|
||||
return humanList.size() >= amount;
|
||||
} else if (defined.equals("You")) {
|
||||
List<Card> computerList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
|
||||
List<Card> computerList = null;
|
||||
try {
|
||||
computerList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
} finally {
|
||||
if (computerList == null)
|
||||
return false;
|
||||
}//prevent NPE on MoJhoSto
|
||||
|
||||
for (Card c : computerList) {
|
||||
if (c.hasSVar("SacMe") || ComputerUtilCard.evaluateCreature(c) <= 135) {
|
||||
return true;
|
||||
|
||||
@@ -29,6 +29,13 @@ public class GameStateEvaluator {
|
||||
if (phase.isAfter(PhaseType.COMBAT_DAMAGE) || evalGame.isGameOver()) {
|
||||
return null;
|
||||
}
|
||||
// If the current player has no creatures in play, there won't be any combat. This avoids
|
||||
// an expensive game copy operation.
|
||||
// Note: This is is safe to do because the simulation is based on the current game state,
|
||||
// so there isn't a chance to play creatures in between.
|
||||
if (evalGame.getPhaseHandler().getPlayerTurn().getCreaturesInPlay().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
GameCopier copier = new GameCopier(evalGame);
|
||||
Game gameCopy = copier.makeCopy();
|
||||
gameCopy.getPhaseHandler().devAdvanceToPhase(PhaseType.COMBAT_DAMAGE);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>forge</artifactId>
|
||||
<groupId>forge</groupId>
|
||||
<version>1.6.30-SNAPSHOT</version>
|
||||
<version>1.6.31</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>forge-core</artifactId>
|
||||
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.7</version>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -111,7 +111,18 @@ public final class ImageKeys {
|
||||
file = findFile(dir, TextUtil.fastReplace(filename, "AE", "Ae"));
|
||||
if (file != null) { return file; }
|
||||
}
|
||||
|
||||
//try fullborder...
|
||||
if (filename.contains(".full")) {
|
||||
file = findFile(dir, TextUtil.fastReplace(filename, ".full", ".fullborder"));
|
||||
if (file != null) { return file; }
|
||||
}
|
||||
//if an image, like phenomenon or planes is missing .full in their filenames but you have an existing images that have .full/.fullborder
|
||||
if (!filename.contains(".full")) {
|
||||
file = findFile(dir, TextUtil.addSuffix(filename,".full"));
|
||||
if (file != null) { return file; }
|
||||
file = findFile(dir, TextUtil.addSuffix(filename,".fullborder"));
|
||||
if (file != null) { return file; }
|
||||
}
|
||||
// some S00 cards are really part of 6ED
|
||||
String s2kAlias = getSetFolder("S00");
|
||||
if (filename.startsWith(s2kAlias)) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public abstract class LobbyPlayer {
|
||||
protected String name;
|
||||
private int avatarIndex = -1;
|
||||
private int sleeveIndex = -1;
|
||||
private String avatarCardImageKey;
|
||||
|
||||
public LobbyPlayer(String name) {
|
||||
@@ -59,9 +60,15 @@ public abstract class LobbyPlayer {
|
||||
public int getAvatarIndex() {
|
||||
return avatarIndex;
|
||||
}
|
||||
public int getSleeveIndex() {
|
||||
return sleeveIndex;
|
||||
}
|
||||
public void setAvatarIndex(int avatarIndex) {
|
||||
this.avatarIndex = avatarIndex;
|
||||
}
|
||||
public void setSleeveIndex(int sleeveIndex) {
|
||||
this.sleeveIndex = sleeveIndex;
|
||||
}
|
||||
|
||||
public String getAvatarCardImageKey() {
|
||||
return avatarCardImageKey;
|
||||
|
||||
@@ -35,6 +35,7 @@ public class StaticData {
|
||||
|
||||
private Predicate<PaperCard> standardPredicate;
|
||||
private Predicate<PaperCard> brawlPredicate;
|
||||
private Predicate<PaperCard> pioneerPredicate;
|
||||
private Predicate<PaperCard> modernPredicate;
|
||||
private Predicate<PaperCard> commanderPredicate;
|
||||
private Predicate<PaperCard> oathbreakerPredicate;
|
||||
@@ -197,13 +198,13 @@ public class StaticData {
|
||||
|
||||
public TokenDb getAllTokens() { return allTokens; }
|
||||
|
||||
public Predicate<PaperCard> getStandardPredicate() {
|
||||
return standardPredicate;
|
||||
}
|
||||
|
||||
|
||||
public void setStandardPredicate(Predicate<PaperCard> standardPredicate) { this.standardPredicate = standardPredicate; }
|
||||
|
||||
public void setModernPredicate(Predicate<PaperCard> modernPredicate) { this.modernPredicate = standardPredicate; }
|
||||
public void setPioneerPredicate(Predicate<PaperCard> pioneerPredicate) { this.pioneerPredicate = pioneerPredicate; }
|
||||
|
||||
public void setModernPredicate(Predicate<PaperCard> modernPredicate) { this.modernPredicate = modernPredicate; }
|
||||
|
||||
public void setCommanderPredicate(Predicate<PaperCard> commanderPredicate) { this.commanderPredicate = commanderPredicate; }
|
||||
|
||||
@@ -211,9 +212,11 @@ public class StaticData {
|
||||
|
||||
public void setBrawlPredicate(Predicate<PaperCard> brawlPredicate) { this.brawlPredicate = brawlPredicate; }
|
||||
|
||||
public Predicate<PaperCard> getModernPredicate() {
|
||||
return modernPredicate;
|
||||
}
|
||||
public Predicate<PaperCard> getStandardPredicate() { return standardPredicate; }
|
||||
|
||||
public Predicate<PaperCard> getPioneerPredicate() { return pioneerPredicate; }
|
||||
|
||||
public Predicate<PaperCard> getModernPredicate() { return modernPredicate; }
|
||||
|
||||
public Predicate<PaperCard> getCommanderPredicate() { return commanderPredicate; }
|
||||
|
||||
|
||||
@@ -553,6 +553,23 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
return Lists.newArrayList(Iterables.filter(this.roAllCards, predicate));
|
||||
}
|
||||
|
||||
// Do I want a foiled version of these cards?
|
||||
@Override
|
||||
public List<PaperCard> getAllCardsFromEdition(CardEdition edition) {
|
||||
List<PaperCard> cards = Lists.newArrayList();
|
||||
|
||||
for(CardInSet cis : edition.getCards()) {
|
||||
PaperCard card = this.getCard(cis.name, edition.getCode());
|
||||
if (card == null) {
|
||||
// Just in case the card is listed in the edition file but Forge doesn't support it
|
||||
continue;
|
||||
}
|
||||
|
||||
cards.add(card);
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String name) {
|
||||
return allCardsByName.containsKey(getName(name));
|
||||
|
||||
@@ -110,6 +110,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
private Type type;
|
||||
private String name;
|
||||
private String alias = null;
|
||||
private String prerelease = null;
|
||||
private boolean whiteBorder = false;
|
||||
private FoilType foilType = FoilType.NOT_SUPPORTED;
|
||||
private double foilChanceInBooster = 0;
|
||||
@@ -178,6 +179,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
public Type getType() { return type; }
|
||||
public String getName() { return name; }
|
||||
public String getAlias() { return alias; }
|
||||
public String getPrerelease() { return prerelease; }
|
||||
public FoilType getFoilType() { return foilType; }
|
||||
public double getFoilChanceInBooster() { return foilChanceInBooster; }
|
||||
public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; }
|
||||
@@ -303,7 +305,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
tokenNormalized
|
||||
);
|
||||
|
||||
FileSection section = FileSection.parse(contents.get("metadata"), "=");
|
||||
FileSection section = FileSection.parse(contents.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
res.name = section.get("name");
|
||||
res.date = parseDate(section.get("date"));
|
||||
res.code = section.get("code");
|
||||
@@ -333,6 +335,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
}
|
||||
}
|
||||
res.type = enumType;
|
||||
res.prerelease = section.get("Prerelease", null);
|
||||
|
||||
switch(section.get("foil", "newstyle").toLowerCase()) {
|
||||
case "notsupported":
|
||||
@@ -413,6 +416,16 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
return res;
|
||||
}
|
||||
|
||||
public Iterable<CardEdition> getPrereleaseEditions() {
|
||||
List<CardEdition> res = Lists.newArrayList(this);
|
||||
return Iterables.filter(res, new Predicate<CardEdition>() {
|
||||
@Override
|
||||
public boolean apply(final CardEdition edition) {
|
||||
return edition.getPrerelease() != null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CardEdition getEditionByCodeOrThrow(final String code) {
|
||||
final CardEdition set = this.get(code);
|
||||
if (null == set) {
|
||||
|
||||
@@ -606,13 +606,13 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
|
||||
public static class Constant {
|
||||
public static final Settable LOADED = new Settable();
|
||||
public static final List<String> BASIC_TYPES = Lists.newArrayList();
|
||||
public static final List<String> LAND_TYPES = Lists.newArrayList();
|
||||
public static final List<String> CREATURE_TYPES = Lists.newArrayList();
|
||||
public static final List<String> SPELL_TYPES = Lists.newArrayList();
|
||||
public static final List<String> ENCHANTMENT_TYPES = Lists.newArrayList();
|
||||
public static final List<String> ARTIFACT_TYPES = Lists.newArrayList();
|
||||
public static final List<String> WALKER_TYPES = Lists.newArrayList();
|
||||
public static final Set<String> BASIC_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> LAND_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> CREATURE_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> SPELL_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> ENCHANTMENT_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> ARTIFACT_TYPES = Sets.newHashSet();
|
||||
public static final Set<String> WALKER_TYPES = Sets.newHashSet();
|
||||
|
||||
// singular -> plural
|
||||
public static final BiMap<String,String> pluralTypes = HashBiMap.create();
|
||||
@@ -699,12 +699,12 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
return sortedSubTypes;
|
||||
}
|
||||
|
||||
public static List<String> getBasicTypes() {
|
||||
return Collections.unmodifiableList(Constant.BASIC_TYPES);
|
||||
public static Collection<String> getBasicTypes() {
|
||||
return Collections.unmodifiableCollection(Constant.BASIC_TYPES);
|
||||
}
|
||||
|
||||
public static List<String> getAllCreatureTypes() {
|
||||
return Collections.unmodifiableList(Constant.CREATURE_TYPES);
|
||||
public static Collection<String> getAllCreatureTypes() {
|
||||
return Collections.unmodifiableCollection(Constant.CREATURE_TYPES);
|
||||
}
|
||||
public static List<String> getAllLandTypes() {
|
||||
return ImmutableList.<String>builder()
|
||||
|
||||
@@ -28,6 +28,8 @@ public interface ICardDatabase extends Iterable<PaperCard> {
|
||||
List<PaperCard> getAllCards(String cardName);
|
||||
List<PaperCard> getAllCards(Predicate<PaperCard> predicate);
|
||||
|
||||
List<PaperCard> getAllCardsFromEdition(CardEdition edition);
|
||||
|
||||
Predicate<? super PaperCard> wasPrintedInSets(List<String> allowedSetCodes);
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.StaticData;
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesPredicates;
|
||||
@@ -37,8 +36,11 @@ import forge.util.TextUtil;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* GameType is an enum to determine the type of current game. :)
|
||||
@@ -324,23 +326,32 @@ public enum DeckFormat {
|
||||
}
|
||||
|
||||
final int maxCopies = getMaxCardCopies();
|
||||
if (maxCopies < Integer.MAX_VALUE) {
|
||||
//Must contain no more than 4 of the same card
|
||||
//shared among the main deck and sideboard, except
|
||||
//basic lands, Shadowborn Apostle, Relentless Rats and Rat Colony
|
||||
//Must contain no more than 4 of the same card
|
||||
//shared among the main deck and sideboard, except
|
||||
//basic lands, Shadowborn Apostle, Relentless Rats and Rat Colony
|
||||
// Seven Dwarves can have 7 in the deck. More than 7 in deck + sb is ok in Limited
|
||||
|
||||
final CardPool allCards = deck.getAllCardsInASinglePool(hasCommander());
|
||||
final CardPool allCards = deck.getAllCardsInASinglePool(hasCommander());
|
||||
|
||||
// should group all cards by name, so that different editions of same card are really counted as the same card
|
||||
for (final Entry<String, Integer> cp : Aggregates.groupSumBy(allCards, PaperCard.FN_GET_NAME)) {
|
||||
final IPaperCard simpleCard = StaticData.instance().getCommonCards().getCard(cp.getKey());
|
||||
if (simpleCard == null) {
|
||||
return TextUtil.concatWithSpace("contains the nonexisting card", cp.getKey());
|
||||
}
|
||||
// should group all cards by name, so that different editions of same card are really counted as the same card
|
||||
for (final Entry<String, Integer> cp : Aggregates.groupSumBy(allCards, PaperCard.FN_GET_NAME)) {
|
||||
final IPaperCard simpleCard = StaticData.instance().getCommonCards().getCard(cp.getKey());
|
||||
// Might cause issues since it ignores "Special" Cards
|
||||
if (simpleCard == null) {
|
||||
return TextUtil.concatWithSpace("contains the nonexisting card", cp.getKey());
|
||||
}
|
||||
|
||||
if (!canHaveAnyNumberOf(simpleCard) && cp.getValue() > maxCopies) {
|
||||
return TextUtil.concatWithSpace("must not contain more than", String.valueOf(maxCopies), "copies of the card", cp.getKey());
|
||||
}
|
||||
if (canHaveAnyNumberOf(simpleCard)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer cardCopies = canHaveSpecificNumberInDeck(simpleCard);
|
||||
if (cardCopies != null && deck.getMain().countByName(cp.getKey(), true) > cardCopies) {
|
||||
return TextUtil.concatWithSpace("must not contain more than", String.valueOf(cardCopies), "copies of the card", cp.getKey());
|
||||
}
|
||||
|
||||
if (cardCopies == null && cp.getValue() > maxCopies) {
|
||||
return TextUtil.concatWithSpace("must not contain more than", String.valueOf(maxCopies), "copies of the card", cp.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +373,16 @@ public enum DeckFormat {
|
||||
"A deck can have any number of cards named CARDNAME.");
|
||||
}
|
||||
|
||||
public static Integer canHaveSpecificNumberInDeck(final IPaperCard card) {
|
||||
// Ideally, this would be parsed during card parsing and set this value
|
||||
if (Iterables.contains(card.getRules().getMainPart().getKeywords(),
|
||||
"A deck can have up to seven cards named CARDNAME.")) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getPlaneSectionConformanceProblem(final CardPool planes) {
|
||||
//Must contain at least 10 planes/phenomenons, but max 2 phenomenons. Singleton.
|
||||
if (planes == null || planes.countAll() < 10) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DeckSerializer {
|
||||
}
|
||||
final List<String> metadata = map.get("metadata");
|
||||
if (metadata != null) {
|
||||
return new DeckFileHeader(FileSection.parse(metadata, "="));
|
||||
return new DeckFileHeader(FileSection.parse(metadata, FileSection.EQUALS_KV_SEPARATOR));
|
||||
}
|
||||
final List<String> general = map.get("general");
|
||||
if (general != null) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class PreconDeck implements InventoryItemFromSet {
|
||||
|
||||
// To be able to read "shops" section in overloads
|
||||
protected PreconDeck getPreconDeckFromSections(final Map<String, List<String>> sections) {
|
||||
FileSection kv = FileSection.parse(sections.get("metadata"), "=");
|
||||
FileSection kv = FileSection.parse(sections.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
String imageFilename = kv.get("Image");
|
||||
String description = kv.get("Description");
|
||||
String deckEdition = kv.get("set");
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package forge.card;
|
||||
package forge.util;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
import com.google.common.base.Charsets;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.util.LineReader;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -15,12 +12,12 @@ public class CardTranslation {
|
||||
private static Map <String, String> translatednames;
|
||||
private static Map <String, String> translatedtypes;
|
||||
private static Map <String, String> translatedoracles;
|
||||
private static String languageSelected;
|
||||
private static String languageSelected = "en-US";
|
||||
|
||||
private static void readTranslationFile(String language) {
|
||||
private static void readTranslationFile(String language, String languagesDirectory) {
|
||||
String filename = "cardnames-" + language + ".txt";
|
||||
|
||||
try (LineReader translationFile = new LineReader(new FileInputStream(ForgeConstants.LANG_DIR + filename), Charsets.UTF_8)) {
|
||||
try (LineReader translationFile = new LineReader(new FileInputStream(languagesDirectory + filename), Charsets.UTF_8)) {
|
||||
for (String line : translationFile.readLines()) {
|
||||
String[] matches = line.split("\\|");
|
||||
if (matches.length >= 2) {
|
||||
@@ -34,7 +31,7 @@ public class CardTranslation {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.error("Error reading translation file: cardnames-" + language + ".txt");
|
||||
System.err.println("Error reading translation file: cardnames-" + language + ".txt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +63,7 @@ public class CardTranslation {
|
||||
}
|
||||
|
||||
public static HashMap<String, String> getTranslationTexts(String cardname, String altcardname) {
|
||||
HashMap<String, String> translations = new HashMap<String, String>();
|
||||
HashMap<String, String> translations = new HashMap<>();
|
||||
translations.put("name", getTranslatedName(cardname));
|
||||
translations.put("oracle", getTranslatedOracle(cardname));
|
||||
translations.put("altname", getTranslatedName(altcardname));
|
||||
@@ -78,14 +75,14 @@ public class CardTranslation {
|
||||
return !languageSelected.equals("en-US");
|
||||
}
|
||||
|
||||
public static void preloadTranslation(String language) {
|
||||
public static void preloadTranslation(String language, String languagesDirectory) {
|
||||
languageSelected = language;
|
||||
|
||||
if (needsTranslation()) {
|
||||
translatednames = new HashMap<>();
|
||||
translatedtypes = new HashMap<>();
|
||||
translatedoracles = new HashMap<>();
|
||||
readTranslationFile(languageSelected);
|
||||
readTranslationFile(languageSelected, languagesDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@
|
||||
*/
|
||||
package forge.util;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -56,34 +59,40 @@ public class FileSection {
|
||||
protected FileSection(Map<String, String> lines0) {
|
||||
lines = lines0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the.
|
||||
*
|
||||
* @param line the line
|
||||
* @param kvSeparator the kv separator
|
||||
* @param pairSeparator the pair separator
|
||||
* @return the file section
|
||||
*/
|
||||
public static FileSection parse(final String line, final String kvSeparator, final String pairSeparator) {
|
||||
Map<String, String> map = parseToMap(line, kvSeparator, pairSeparator);
|
||||
return new FileSection(map);
|
||||
}
|
||||
|
||||
public static Map<String, String> parseToMap(final String line, final String kvSeparator, final String pairSeparator) {
|
||||
Map<String, String> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
if (!StringUtils.isEmpty(line)) {
|
||||
final String[] pairs = line.split(Pattern.quote(pairSeparator));
|
||||
final Pattern splitter = Pattern.compile(Pattern.quote(kvSeparator));
|
||||
|
||||
for (final String dd : pairs) {
|
||||
final String[] v = splitter.split(dd, 2);
|
||||
result.put(v[0].trim(), v.length > 1 ? v[1].trim() : "");
|
||||
}
|
||||
|
||||
public static final Pattern DOLLAR_SIGN_KV_SEPARATOR = Pattern.compile(Pattern.quote("$"));
|
||||
public static final Pattern ARROW_KV_SEPARATOR = Pattern.compile(Pattern.quote("->"));
|
||||
public static final Pattern EQUALS_KV_SEPARATOR = Pattern.compile(Pattern.quote("="));
|
||||
public static final Pattern COLON_KV_SEPARATOR = Pattern.compile(Pattern.quote(":"));
|
||||
|
||||
private static final String BAR_PAIR_SPLITTER = Pattern.quote("|");
|
||||
|
||||
private static Table<String, Pattern, Map<String, String>> parseToMapCache = HashBasedTable.create();
|
||||
|
||||
public static Map<String, String> parseToMap(final String line, final Pattern kvSeparator) {
|
||||
Map<String, String> result = parseToMapCache.get(line, kvSeparator);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
result = parseToMapImpl(line, kvSeparator);
|
||||
parseToMapCache.put(line, kvSeparator, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Map<String, String> parseToMapImpl(final String line, final Pattern kvSeparator) {
|
||||
if (StringUtils.isEmpty(line)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
final Map<String, String> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final String[] pairs = line.split(BAR_PAIR_SPLITTER);
|
||||
for (final String dd : pairs) {
|
||||
final String[] v = kvSeparator.split(dd, 2);
|
||||
result.put(v[0].trim(), v.length > 1 ? v[1].trim() : "");
|
||||
}
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the.
|
||||
*
|
||||
@@ -91,11 +100,10 @@ public class FileSection {
|
||||
* @param kvSeparator the kv separator
|
||||
* @return the file section
|
||||
*/
|
||||
public static FileSection parse(final Iterable<String> lines, final String kvSeparator) {
|
||||
public static FileSection parse(final Iterable<String> lines, final Pattern kvSeparator) {
|
||||
final FileSection result = new FileSection();
|
||||
final Pattern splitter = Pattern.compile(Pattern.quote(kvSeparator));
|
||||
for (final String dd : lines) {
|
||||
final String[] v = splitter.split(dd, 2);
|
||||
final String[] v = kvSeparator.split(dd, 2);
|
||||
result.lines.put(v[0].trim(), v.length > 1 ? v[1].trim() : "");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>forge</artifactId>
|
||||
<groupId>forge</groupId>
|
||||
<version>1.6.30-SNAPSHOT</version>
|
||||
<version>1.6.31</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>forge-game</artifactId>
|
||||
@@ -32,8 +32,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.sentry</groupId>
|
||||
<artifactId>sentry-log4j</artifactId>
|
||||
<version>1.7.5</version>
|
||||
<artifactId>sentry-log4j2</artifactId>
|
||||
<version>1.7.27</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -73,7 +73,8 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
|
||||
}
|
||||
|
||||
public final String getParamOrDefault(String key, String defaultValue) {
|
||||
return hasParam(key) ? getParam(key) : defaultValue;
|
||||
String param = mapParams.get(key);
|
||||
return param != null ? param : defaultValue;
|
||||
}
|
||||
|
||||
public String getParam(String key) {
|
||||
|
||||
@@ -701,7 +701,9 @@ public class GameAction {
|
||||
// Run triggers
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||
runParams.put(AbilityKey.Cause, cause);
|
||||
runParams.put(AbilityKey.Origin, origin.getZoneType().name());
|
||||
if (origin != null) { // is generally null when adding via dev mode
|
||||
runParams.put(AbilityKey.Origin, origin.getZoneType().name());
|
||||
}
|
||||
if (params != null) {
|
||||
runParams.putAll(params);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class GameActionUtil {
|
||||
Card source = sa.getHostCard();
|
||||
final Game game = source.getGame();
|
||||
|
||||
if (sa.isSpell()) {
|
||||
if (sa.isSpell() && !source.isInZone(ZoneType.Battlefield)) {
|
||||
boolean lkicheck = false;
|
||||
|
||||
// need to be done before so it works with Vivien and Zoetic Cavern
|
||||
@@ -88,7 +88,7 @@ public final class GameActionUtil {
|
||||
lkicheck = true;
|
||||
}
|
||||
|
||||
if (sa.hasParam("Bestow") && !source.isBestowed() && !source.isInZone(ZoneType.Battlefield)) {
|
||||
if (sa.isBestow() && !source.isBestowed() && !source.isInZone(ZoneType.Battlefield)) {
|
||||
if (!source.isLKI()) {
|
||||
source = CardUtil.getLKICopy(source);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public final class GameActionUtil {
|
||||
}
|
||||
source.turnFaceDownNoUpdate();
|
||||
lkicheck = true;
|
||||
} else if (sa.isAdventure() && !source.isInZone(ZoneType.Battlefield)) {
|
||||
} else if (sa.isAdventure()) {
|
||||
if (!source.isLKI()) {
|
||||
source = CardUtil.getLKICopy(source);
|
||||
}
|
||||
@@ -146,6 +146,7 @@ public final class GameActionUtil {
|
||||
if (lkicheck) {
|
||||
// double freeze tracker, so it doesn't update view
|
||||
game.getTracker().freeze();
|
||||
source.clearChangedCardKeywords(false);
|
||||
CardCollection preList = new CardCollection(source);
|
||||
game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList);
|
||||
}
|
||||
@@ -207,6 +208,57 @@ public final class GameActionUtil {
|
||||
alternatives.add(newSA);
|
||||
}
|
||||
|
||||
// need to be done there before static abilities does reset the card
|
||||
if (sa.isBasicSpell()) {
|
||||
for (final KeywordInterface inst : source.getKeywords()) {
|
||||
final String keyword = inst.getOriginal();
|
||||
|
||||
if (keyword.startsWith("Escape")) {
|
||||
final String[] k = keyword.split(":");
|
||||
final Cost escapeCost = new Cost(k[1], true);
|
||||
|
||||
final SpellAbility newSA = sa.copyWithDefinedCost(escapeCost);
|
||||
|
||||
newSA.getMapParams().put("PrecostDesc", "Escape—");
|
||||
newSA.getMapParams().put("CostDesc", escapeCost.toString());
|
||||
|
||||
// makes new SpellDescription
|
||||
final StringBuilder desc = new StringBuilder();
|
||||
desc.append(newSA.getCostDescription());
|
||||
desc.append("(").append(inst.getReminderText()).append(")");
|
||||
newSA.setDescription(desc.toString());
|
||||
|
||||
// Stack Description only for Permanent or it might crash
|
||||
if (source.isPermanent()) {
|
||||
final StringBuilder sbStack = new StringBuilder();
|
||||
sbStack.append(sa.getStackDescription()).append(" (Escaped)");
|
||||
newSA.setStackDescription(sbStack.toString());
|
||||
}
|
||||
newSA.setAlternativeCost(AlternativeCost.Escape);
|
||||
newSA.getRestrictions().setZone(ZoneType.Graveyard);
|
||||
|
||||
alternatives.add(newSA);
|
||||
} else if (keyword.startsWith("Flashback")) {
|
||||
// if source has No Mana cost, and flashback doesn't have own one,
|
||||
// flashback can't work
|
||||
if (keyword.equals("Flashback") && source.getManaCost().isNoCost()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final SpellAbility flashback = sa.copy(activator);
|
||||
flashback.setAlternativeCost(AlternativeCost.Flashback);
|
||||
flashback.getRestrictions().setZone(ZoneType.Graveyard);
|
||||
|
||||
// there is a flashback cost (and not the cards cost)
|
||||
if (keyword.contains(":")) {
|
||||
final String[] k = keyword.split(":");
|
||||
flashback.setPayCosts(new Cost(k[1], false));
|
||||
}
|
||||
alternatives.add(flashback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset static abilities
|
||||
if (lkicheck) {
|
||||
game.getAction().checkStaticAbilities(false);
|
||||
@@ -244,28 +296,6 @@ public final class GameActionUtil {
|
||||
alternatives.add(newSA);
|
||||
}
|
||||
|
||||
for (final KeywordInterface inst : source.getKeywords()) {
|
||||
final String keyword = inst.getOriginal();
|
||||
if (sa.isSpell() && keyword.startsWith("Flashback")) {
|
||||
// if source has No Mana cost, and flashback doesn't have own one,
|
||||
// flashback can't work
|
||||
if (keyword.equals("Flashback") && source.getManaCost().isNoCost()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final SpellAbility flashback = sa.copy(activator);
|
||||
flashback.setFlashBackAbility(true);
|
||||
|
||||
flashback.getRestrictions().setZone(ZoneType.Graveyard);
|
||||
|
||||
// there is a flashback cost (and not the cards cost)
|
||||
if (keyword.contains(":")) {
|
||||
final String[] k = keyword.split(":");
|
||||
flashback.setPayCosts(new Cost(k[1], false));
|
||||
}
|
||||
alternatives.add(flashback);
|
||||
}
|
||||
}
|
||||
return alternatives;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.Map.Entry;
|
||||
public class GameFormat implements Comparable<GameFormat> {
|
||||
private final String name;
|
||||
public enum FormatType {Sanctioned, Casual, Historic, Digital, Custom}
|
||||
public enum FormatSubType {Block, Standard, Extended, Modern, Legacy, Vintage, Commander, Planechase, Videogame, MTGO, Custom}
|
||||
public enum FormatSubType {Block, Standard, Extended, Pioneer, Modern, Legacy, Vintage, Commander, Planechase, Videogame, MTGO, Custom}
|
||||
|
||||
// contains allowed sets, when empty allows all sets
|
||||
private FormatType formatType;
|
||||
@@ -290,6 +290,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
private List<String> coreFormats = new ArrayList<>();
|
||||
{
|
||||
coreFormats.add("Standard.txt");
|
||||
coreFormats.add("Pioneer.txt");
|
||||
coreFormats.add("Modern.txt");
|
||||
coreFormats.add("Legacy.txt");
|
||||
coreFormats.add("Vintage.txt");
|
||||
@@ -320,7 +321,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
if (formatStrings == null){
|
||||
return null;
|
||||
}
|
||||
FileSection section = FileSection.parse(formatStrings, ":");
|
||||
FileSection section = FileSection.parse(formatStrings, FileSection.COLON_KV_SEPARATOR);
|
||||
String title = section.get("name");
|
||||
FormatType formatType;
|
||||
try {
|
||||
@@ -468,6 +469,10 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
return this.map.get("Extended");
|
||||
}
|
||||
|
||||
public GameFormat getPioneer() {
|
||||
return this.map.get("Pioneer");
|
||||
}
|
||||
|
||||
public GameFormat getModern() {
|
||||
return this.map.get("Modern");
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ import forge.game.player.RegisteredPlayer;
|
||||
import forge.game.spellability.TargetChoices;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.maps.MapOfLists;
|
||||
|
||||
public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
private final GameLog log;
|
||||
|
||||
public GameLogFormatter(GameLog gameLog) {
|
||||
log = gameLog;
|
||||
}
|
||||
@@ -52,16 +52,15 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
|
||||
@Override
|
||||
public GameLogEntry visit(GameEventScry ev) {
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
String scryOutcome = "";
|
||||
String toTop = Lang.nounWithAmount(ev.toTop, "card") + " to the top of the library";
|
||||
String toBottom = Lang.nounWithAmount(ev.toBottom, "card") + " to the bottom of the library";
|
||||
|
||||
if (ev.toTop > 0 && ev.toBottom > 0) {
|
||||
scryOutcome = ev.player.toString() + " scried " + toTop + " and " + toBottom;
|
||||
scryOutcome = localizer.getMessage("lblLogScryTopBottomLibrary").replace("%s", ev.player.toString()).replace("%top", String.valueOf(ev.toTop)).replace("%bottom", String.valueOf(ev.toBottom));
|
||||
} else if (ev.toBottom == 0) {
|
||||
scryOutcome = ev.player.toString() + " scried " + toTop;
|
||||
scryOutcome = localizer.getMessage("lblLogScryTopLibrary").replace("%s", ev.player.toString()).replace("%top", String.valueOf(ev.toTop));
|
||||
} else {
|
||||
scryOutcome = ev.player.toString() + " scried " + toBottom;
|
||||
scryOutcome = localizer.getMessage("lblLogScryBottomLibrary").replace("%s", ev.player.toString()).replace("%bottom", String.valueOf(ev.toBottom));
|
||||
}
|
||||
|
||||
return new GameLogEntry(GameLogEntryType.STACK_RESOLVE, scryOutcome);
|
||||
@@ -218,6 +217,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
@Override
|
||||
public GameLogEntry visit(final GameEventAttackersDeclared ev) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
|
||||
// Loop through Defenders
|
||||
// Append Defending Player/Planeswalker
|
||||
@@ -233,7 +233,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
sb.append(" to attack ").append(k).append(".");
|
||||
}
|
||||
if (sb.length() == 0) {
|
||||
sb.append(ev.player).append(" didn't attack this turn.");
|
||||
sb.append(localizer.getMessage("lblPlayerDidntAttackThisTurn").replace("%s", ev.player.toString()));
|
||||
}
|
||||
return new GameLogEntry(GameLogEntryType.COMBAT, sb.toString());
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
|
||||
@Override
|
||||
public GameLogEntry visit(GameEventMulligan ev) {
|
||||
String message = ev.player.toString() + " has mulliganed down to " + ev.player.getZone(ZoneType.Hand).size() + " cards.";
|
||||
String message = Localizer.getInstance().getMessage("lblPlayerHasMulliganedDownToNCards").replace("%d", String.valueOf(ev.player.getZone(ZoneType.Hand).size())).replace("%s", ev.player.toString());
|
||||
return new GameLogEntry(GameLogEntryType.MULLIGAN, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
@@ -291,12 +292,13 @@ public class Match {
|
||||
}
|
||||
}
|
||||
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
if (!rAICards.isEmpty() && !rules.getGameType().isCardPoolLimited()) {
|
||||
game.getAction().revealAnte("AI can't play these cards well", rAICards);
|
||||
game.getAction().revealAnte(localizer.getMessage("lblAICantPlayCards"), rAICards);
|
||||
}
|
||||
|
||||
if (!removedAnteCards.isEmpty()) {
|
||||
game.getAction().revealAnte("These ante cards were removed", removedAnteCards);
|
||||
game.getAction().revealAnte(localizer.getMessage("lblAnteCardsRemoved"), removedAnteCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -382,21 +382,10 @@ public final class AbilityFactory {
|
||||
* @param mapParams
|
||||
*/
|
||||
private static final void initializeParams(final SpellAbility sa, Map<String, String> mapParams) {
|
||||
if (mapParams.containsKey("Flashback")) {
|
||||
sa.setFlashBackAbility(true);
|
||||
}
|
||||
|
||||
if (mapParams.containsKey("NonBasicSpell")) {
|
||||
sa.setBasicSpell(false);
|
||||
}
|
||||
|
||||
if (mapParams.containsKey("Dash")) {
|
||||
sa.setDash(true);
|
||||
}
|
||||
|
||||
if (mapParams.containsKey("Outlast")) {
|
||||
sa.setOutlast(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,7 +438,7 @@ public final class AbilityFactory {
|
||||
}
|
||||
|
||||
public static final Map<String, String> getMapParams(final String abString) {
|
||||
return FileSection.parseToMap(abString, "$", "|");
|
||||
return FileSection.parseToMap(abString, FileSection.DOLLAR_SIGN_KV_SEPARATOR);
|
||||
}
|
||||
|
||||
public static final void adjustChangeZoneTarget(final Map<String, String> params, final SpellAbility sa) {
|
||||
|
||||
@@ -1708,7 +1708,7 @@ public class AbilityUtils {
|
||||
if (res.checkTimingRestrictions(tgtCard, newSA)
|
||||
// still need to check the other restrictions like Aftermath
|
||||
&& res.checkOtherRestrictions(tgtCard, newSA, controller)
|
||||
&& newSA.checkOtherRestrictions()) {
|
||||
&& newSA.checkOtherRestrictions(tgtCard)) {
|
||||
sas.add(newSA);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,7 +25,7 @@ public class AbandonEffect extends SpellAbilityEffect {
|
||||
Player controller = source.getController();
|
||||
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
if (isOptional && !controller.getController().confirmAction(sa, null, "Would you like to abandon the scheme " + source + "?")) {
|
||||
if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeAbandonSource", CardTranslation.getTranslatedName(source.getName())))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class ActivateAbilityEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
SpellAbility manaAb = p.getController().chooseSingleSpellForEffect(
|
||||
possibleAb, sa, "Choose a mana ability:", ImmutableMap.of());
|
||||
possibleAb, sa, Localizer.getInstance().getMessage("lblChooseManaAbility"), ImmutableMap.of());
|
||||
p.getController().playChosenSpellAbility(manaAb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.Trigger;
|
||||
import forge.game.trigger.TriggerHandler;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,7 +62,7 @@ public class AddTurnEffect extends SpellAbilityEffect {
|
||||
extra.setCantSetSchemesInMotion(true);
|
||||
}
|
||||
if (sa.hasParam("ShowMessage")) {
|
||||
p.getGame().getAction().nofityOfValue(sa, p, p + " takes an extra turn.", null);
|
||||
p.getGame().getAction().nofityOfValue(sa, p, Localizer.getInstance().getMessage("lblPlayerTakesExtraTurn", p.toString()), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.game.card.Card;
|
||||
import forge.game.card.CardCollectionView;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardPredicates;
|
||||
import forge.game.card.CardZoneTable;
|
||||
import forge.game.card.CounterType;
|
||||
import forge.game.card.token.TokenInfo;
|
||||
import forge.game.event.GameEventTokenCreated;
|
||||
@@ -16,6 +17,7 @@ import forge.game.player.PlayerController;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class AmassEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -44,6 +46,17 @@ public class AmassEffect extends SpellAbilityEffect {
|
||||
final int amount = AbilityUtils.calculateAmount(card, sa.getParamOrDefault("Num", "1"), sa);
|
||||
final boolean remember = sa.hasParam("RememberAmass");
|
||||
|
||||
boolean useZoneTable = true;
|
||||
CardZoneTable triggerList = sa.getChangeZoneTable();
|
||||
if (triggerList == null) {
|
||||
triggerList = new CardZoneTable();
|
||||
useZoneTable = false;
|
||||
}
|
||||
if (sa.hasParam("ChangeZoneTable")) {
|
||||
sa.setChangeZoneTable(triggerList);
|
||||
useZoneTable = true;
|
||||
}
|
||||
|
||||
// create army token if needed
|
||||
if (CardLists.count(activator.getCardsIn(ZoneType.Battlefield), CardPredicates.isType("Army")) == 0) {
|
||||
final String tokenScript = "b_0_0_zombie_army";
|
||||
@@ -54,14 +67,21 @@ public class AmassEffect extends SpellAbilityEffect {
|
||||
|
||||
// Should this be catching the Card that's returned?
|
||||
Card c = game.getAction().moveToPlay(tok, sa);
|
||||
if (c.getZone() != null) {
|
||||
triggerList.put(ZoneType.None, c.getZone().getZoneType(), c);
|
||||
}
|
||||
c.updateStateForView();
|
||||
}
|
||||
|
||||
if (!useZoneTable) {
|
||||
triggerList.triggerChangesZoneAll(game);
|
||||
triggerList.clear();
|
||||
}
|
||||
game.fireEvent(new GameEventTokenCreated());
|
||||
}
|
||||
|
||||
CardCollectionView tgtCards = CardLists.getType(activator.getCardsIn(ZoneType.Battlefield), "Army");
|
||||
tgtCards = pc.chooseCardsForEffect(tgtCards, sa, "Choose an army to put counters on", 1, 1, false);
|
||||
tgtCards = pc.chooseCardsForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblChooseAnArmy"), 1, 1, false);
|
||||
|
||||
GameEntityCounterTable table = new GameEntityCounterTable();
|
||||
for(final Card tgtCard : tgtCards) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class AssignGroupEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -49,7 +50,7 @@ public class AssignGroupEffect extends SpellAbilityEffect {
|
||||
Multimap<SpellAbility, GameObject> result = ArrayListMultimap.create();
|
||||
|
||||
for (GameObject g : defined) {
|
||||
final String title = "Choose ability for " + g.toString();
|
||||
final String title = Localizer.getInstance().getMessage("lblChooseAbilityForObject", g.toString());
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Affected", g);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,6 +46,14 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
} else {
|
||||
attachTo = targets.get(0);
|
||||
}
|
||||
|
||||
String attachToName = null;
|
||||
if (attachTo instanceof Card) {
|
||||
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());
|
||||
}
|
||||
else {
|
||||
attachToName = attachTo.toString();
|
||||
}
|
||||
|
||||
final Player p = sa.getActivatingPlayer();
|
||||
|
||||
@@ -60,7 +70,7 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
|
||||
// If Cast Targets will be checked on the Stack
|
||||
for (final Card attachment : attachments) {
|
||||
String message = "Do you want to attach " + attachment + " to " + attachTo + "?";
|
||||
String message = Localizer.getInstance().getMessage("lblDoYouWantAttachSourceToTarget", CardTranslation.getTranslatedName(attachment.getName()), attachToName);
|
||||
if ( sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message) )
|
||||
continue;
|
||||
handleAttachment(attachment, attachTo, sa);
|
||||
@@ -173,7 +183,7 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
final Player pa = p.getController().chooseSingleEntityForEffect(players, aura, source + " - Select a player to attach to.");
|
||||
final Player pa = p.getController().chooseSingleEntityForEffect(players, aura, Localizer.getInstance().getMessage("lblSelectAPlayerAttachSourceTo", CardTranslation.getTranslatedName(source.getName())));
|
||||
if (pa != null) {
|
||||
handleAura(source, pa);
|
||||
return true;
|
||||
@@ -186,7 +196,7 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Card o = p.getController().chooseSingleEntityForEffect(list, aura, source + " - Select a card to attach to.");
|
||||
final Card o = p.getController().chooseSingleEntityForEffect(list, aura, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", CardTranslation.getTranslatedName(source.getName())));
|
||||
if (o != null) {
|
||||
handleAura(source, o);
|
||||
//source.enchantEntity((Card) o);
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.game.player.PlayerActionConfirmMode;
|
||||
import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class BidLifeEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -27,7 +28,7 @@ public class BidLifeEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("StartBidding")) {
|
||||
String start = sa.getParam("StartBidding");
|
||||
if ("Any".equals(start)) {
|
||||
startBidding = activator.getController().announceRequirements(sa, "Choose a starting bid", true);
|
||||
startBidding = activator.getController().announceRequirements(sa, Localizer.getInstance().getMessage("lblChooseStartingBid"), true);
|
||||
} else {
|
||||
startBidding = AbilityUtils.calculateAmount(host, start, sa);
|
||||
}
|
||||
@@ -54,12 +55,12 @@ public class BidLifeEffect extends SpellAbilityEffect {
|
||||
willBid = false;
|
||||
for (final Player p : bidPlayers) {
|
||||
final boolean result = p.getController().confirmBidAction(sa, PlayerActionConfirmMode.BidLife,
|
||||
"Do you want to top bid? Current Bid =" + bid, bid, winner);
|
||||
Localizer.getInstance().getMessage("lblDoYouWantTopBid") + bid, bid, winner);
|
||||
willBid |= result;
|
||||
if (result) { // a different choose number
|
||||
bid += p.getController().chooseNumber(sa, "Bid life:", 1, 9);
|
||||
bid += p.getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblBidLife") + ":", 1, 9);
|
||||
winner = p;
|
||||
host.getGame().getAction().nofityOfValue(sa, p, "topped bid with " + bid + " life", p);
|
||||
host.getGame().getAction().nofityOfValue(sa, p, Localizer.getInstance().getMessage("lblTopBidWithValueLife", String.valueOf(bid)), p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import forge.game.card.Card;
|
||||
import forge.game.card.CardCollectionView;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class BondEffect extends SpellAbilityEffect {
|
||||
Card partner = cards.getFirst();
|
||||
// skip choice if only one card on list
|
||||
if (cards.size() > 1) {
|
||||
partner = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(cards, sa, "Select a card to pair with");
|
||||
partner = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(cards, sa, Localizer.getInstance().getMessage("lblSelectACardPair"));
|
||||
}
|
||||
|
||||
// pair choices together
|
||||
|
||||
@@ -13,6 +13,8 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityStackInstance;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -44,7 +46,7 @@ public class ChangeCombatantsEffect extends SpellAbilityEffect {
|
||||
final GameEntity originalDefender = combat.getDefenderByAttacker(c);
|
||||
final FCollectionView<GameEntity> defs = combat.getDefenders();
|
||||
final GameEntity defender = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(defs, sa,
|
||||
"Choose which defender to attack with " + c, false);
|
||||
Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(c.getName())), false);
|
||||
if (originalDefender != null && !originalDefender.equals(defender)) {
|
||||
AttackingBand ab = combat.getBandOfAttacker(c);
|
||||
if (ab != null) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.game.spellability.SpellAbilityStackInstance;
|
||||
import forge.game.spellability.TargetChoices;
|
||||
import forge.game.zone.MagicStack;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -50,8 +51,8 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
// Redirect rules read 'you MAY choose new targets' ... okay!
|
||||
// TODO: Don't even ask to change targets, if the SA and subs don't actually have targets
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
if (isOptional && !chooser.getController().confirmAction(sa, null, "Do you want to change targets of " + tgtSA.getHostCard() + "?")) {
|
||||
continue;
|
||||
if (isOptional && !chooser.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantChangeAbilityTargets", tgtSA.getHostCard().toString()))) {
|
||||
continue;
|
||||
}
|
||||
if (changesOneTarget) {
|
||||
// 1. choose a target of target spell
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.game.card.Card;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class ChangeTextEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -33,7 +34,7 @@ public class ChangeTextEffect extends SpellAbilityEffect {
|
||||
final String[] changedColorWordsArray = sa.getParam("ChangeColorWord").split(" ");
|
||||
if (changedColorWordsArray[0].equals("Choose")) {
|
||||
originalColor = sa.getActivatingPlayer().getController().chooseColor(
|
||||
"Choose a color word to replace", sa, ColorSet.ALL_COLORS);
|
||||
Localizer.getInstance().getMessage("lblChooseColorReplace"), sa, ColorSet.ALL_COLORS);
|
||||
changedColorWordOriginal = TextUtil.capitalize(MagicColor.toLongString(originalColor));
|
||||
} else {
|
||||
changedColorWordOriginal = changedColorWordsArray[0];
|
||||
@@ -48,7 +49,7 @@ public class ChangeTextEffect extends SpellAbilityEffect {
|
||||
possibleNewColors = ColorSet.fromMask(originalColor).inverse();
|
||||
}
|
||||
final byte newColor = sa.getActivatingPlayer().getController().chooseColor(
|
||||
"Choose a new color word", sa, possibleNewColors);
|
||||
Localizer.getInstance().getMessage("lblChooseNewColor"), sa, possibleNewColors);
|
||||
changedColorWordNew = TextUtil.capitalize(MagicColor.toLongString(newColor));
|
||||
} else {
|
||||
changedColorWordNew = changedColorWordsArray[1];
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -98,19 +99,9 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
final String targets = Lang.joinHomogenous(cards);
|
||||
final String message;
|
||||
if (sa.hasParam("OptionQuestion")) {
|
||||
message = TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets);
|
||||
message = TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets);
|
||||
} else {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("Move ");
|
||||
sb.append(targets);
|
||||
sb.append(" from ");
|
||||
sb.append(Lang.joinHomogenous(origin));
|
||||
sb.append(" to ");
|
||||
sb.append(destination);
|
||||
sb.append("?");
|
||||
|
||||
message = sb.toString();
|
||||
message = Localizer.getInstance().getMessage("lblMoveTargetFromOriginToDestination", targets, Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName());
|
||||
}
|
||||
|
||||
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message)) {
|
||||
|
||||
@@ -32,6 +32,8 @@ import forge.util.MessageUtil;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -439,7 +441,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
hostCard.addRemembered(CardUtil.getLKICopy(tgtC));
|
||||
}
|
||||
|
||||
final String prompt = TextUtil.concatWithSpace("Do you want to move", tgtC.toString(), "from", origin.toString(), "to", TextUtil.addSuffix(destination.toString(),"?"));
|
||||
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantMoveTargetFromOriToDest", CardTranslation.getTranslatedName(tgtC.getName()), Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName()));
|
||||
if (optional && !player.getController().confirmAction(sa, null, prompt) )
|
||||
continue;
|
||||
|
||||
@@ -503,7 +505,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), sa.getParam("AttachedTo"), tgtC.getController(), tgtC);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
Card attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, tgtC + " - Select a card to attach to.");
|
||||
Card attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", tgtC.toString()));
|
||||
tgtC.attachToEntity(attachedTo);
|
||||
} else { // When it should enter the battlefield attached to an illegal permanent it fails
|
||||
continue;
|
||||
@@ -513,7 +515,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("AttachedToPlayer")) {
|
||||
FCollectionView<Player> list = AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("AttachedToPlayer"), sa);
|
||||
if (!list.isEmpty()) {
|
||||
Player attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, tgtC + " - Select a player to attach to.");
|
||||
Player attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectAPlayerAttachSourceTo", tgtC.toString()));
|
||||
tgtC.attachToEntity(attachedTo);
|
||||
}
|
||||
else { // When it should enter the battlefield attached to an illegal player it fails
|
||||
@@ -560,7 +562,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
defender = player.getController().chooseSingleEntityForEffect(e, sa, "Declare a defender for " + movedCard );
|
||||
defender = player.getController().chooseSingleEntityForEffect(e, sa, Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(movedCard.getName())));
|
||||
}
|
||||
if (defender != null) {
|
||||
combat.addAttacker(movedCard, defender);
|
||||
@@ -727,7 +729,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(sa.getParam("AlternativeMessage")).append(" ");
|
||||
sb.append(altFetchList.size()).append(" cards match your searching type in Alternate Zones.");
|
||||
sb.append(altFetchList.size()).append(" " + Localizer.getInstance().getMessage("lblCardMatchSearchingTypeInAlternateZones"));
|
||||
|
||||
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, sb.toString())) {
|
||||
origin = alt;
|
||||
@@ -749,7 +751,14 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
|
||||
final boolean optional = sa.hasParam("Optional");
|
||||
if (optional) {
|
||||
String message = MessageUtil.formatMessage(defined ? "Put that card from {player's} " + Lang.joinHomogenous(origin).toLowerCase() + " to " + destination.name().toLowerCase() : "Search {player's} " + Lang.joinHomogenous(origin).toLowerCase() + "?", decider, player);
|
||||
String prompt;
|
||||
if (defined) {
|
||||
prompt = Localizer.getInstance().getMessage("lblPutThatCardFromPlayerOriginToDestination", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase(), destination.getTranslatedName().toLowerCase());
|
||||
}
|
||||
else {
|
||||
prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase());
|
||||
}
|
||||
String message = MessageUtil.formatMessage(prompt , decider, player);
|
||||
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) {
|
||||
return;
|
||||
}
|
||||
@@ -801,10 +810,10 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
CardCollectionView shown = !decider.hasKeyword("LimitSearchLibrary") ? player.getCardsIn(ZoneType.Library) : player.getCardsIn(ZoneType.Library, fetchNum);
|
||||
// Look at whole library before moving onto choosing a card
|
||||
delayedReveal = new DelayedReveal(shown, ZoneType.Library, PlayerView.get(player), source.getName() + " - Looking at cards in ");
|
||||
delayedReveal = new DelayedReveal(shown, ZoneType.Library, PlayerView.get(player), source.getName() + " - " + Localizer.getInstance().getMessage("lblLookingCardIn") + " ");
|
||||
}
|
||||
else if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
|
||||
delayedReveal = new DelayedReveal(player.getCardsIn(ZoneType.Hand), ZoneType.Hand, PlayerView.get(player), source.getName() + " - Looking at cards in ");
|
||||
delayedReveal = new DelayedReveal(player.getCardsIn(ZoneType.Hand), ZoneType.Hand, PlayerView.get(player), source.getName() + " - " + Localizer.getInstance().getMessage("lblLookingCardIn") + " ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +830,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
SpellAbility tgtSA = decider.getController().getAbilityToPlay(tgtCard, sas);
|
||||
if (!decider.getController().confirmAction(tgtSA, null, "Do you want to play " + tgtCard + "?")) {
|
||||
if (!decider.getController().confirmAction(tgtSA, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) {
|
||||
continue;
|
||||
}
|
||||
// if played, that card cannot be found
|
||||
@@ -853,7 +862,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final boolean champion = sa.hasParam("Champion");
|
||||
final boolean forget = sa.hasParam("ForgetChanged");
|
||||
final boolean imprint = sa.hasParam("Imprint");
|
||||
String selectPrompt = sa.hasParam("SelectPrompt") ? sa.getParam("SelectPrompt") : MessageUtil.formatMessage("Select a card from {player's} " + Lang.joinHomogenous(origin).toLowerCase(), decider, player);
|
||||
String selectPrompt = sa.hasParam("SelectPrompt") ? sa.getParam("SelectPrompt") : MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardFromPlayerZone", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
final String totalcmc = sa.getParam("WithTotalCMC");
|
||||
int totcmc = AbilityUtils.calculateAmount(source, totalcmc, sa);
|
||||
|
||||
@@ -866,9 +875,10 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (! sa.hasParam("SelectPrompt")) {
|
||||
// new default messaging for multi select
|
||||
if (fetchList.size() > changeNum) {
|
||||
selectPrompt = MessageUtil.formatMessage("Select up to " + changeNum + " cards from {player's} " + Lang.joinHomogenous(origin).toLowerCase(), decider, player);
|
||||
//Select up to %changeNum cards from %players %origin
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectUpToNumCardFromPlayerZone", String.valueOf(changeNum), "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
} else {
|
||||
selectPrompt = MessageUtil.formatMessage("Select cards from {player's} " + Lang.joinHomogenous(origin).toLowerCase(), decider, player);
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardsFromPlayerZone", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
}
|
||||
}
|
||||
// ensure that selection is within maximum allowed changeNum
|
||||
@@ -930,7 +940,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
|
||||
if (c == null) {
|
||||
final int num = Math.min(fetchList.size(), changeNum - i);
|
||||
String message = "Cancel Search? Up to " + num + " more card" + (num != 1 ? "s" : "") + " can be selected.";
|
||||
String message = Localizer.getInstance().getMessage("lblCancelSearchUpToSelectNumCards", String.valueOf(num));
|
||||
|
||||
if (fetchList.isEmpty() || decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) {
|
||||
break;
|
||||
@@ -1001,7 +1011,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (!list.isEmpty()) {
|
||||
Card attachedTo = null;
|
||||
if (list.size() > 1) {
|
||||
attachedTo = decider.getController().chooseSingleEntityForEffect(list, sa, c + " - Select a card to attach to.");
|
||||
attachedTo = decider.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", CardTranslation.getTranslatedName(c.getName())));
|
||||
}
|
||||
else {
|
||||
attachedTo = list.get(0);
|
||||
@@ -1019,7 +1029,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("AttachedToPlayer")) {
|
||||
FCollectionView<Player> list = AbilityUtils.getDefinedPlayers(source, sa.getParam("AttachedToPlayer"), sa);
|
||||
if (!list.isEmpty()) {
|
||||
Player attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, c + " - Select a player to attach to.");
|
||||
Player attachedTo = player.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", CardTranslation.getTranslatedName(c.getName())));
|
||||
c.attachToEntity(attachedTo);
|
||||
}
|
||||
else { // When it should enter the battlefield attached to an illegal permanent it fails
|
||||
@@ -1042,7 +1052,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
defender = player.getController().chooseSingleEntityForEffect(e, sa, "Declare a defender for " + c );
|
||||
defender = player.getController().chooseSingleEntityForEffect(e, sa, Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(c.getName())));
|
||||
}
|
||||
if (defender != null) {
|
||||
combat.addAttacker(c, defender);
|
||||
|
||||
@@ -18,6 +18,7 @@ import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -82,7 +83,7 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
||||
for (final String type : CardType.getBasicTypes()) {
|
||||
final CardCollectionView cl = CardLists.getType(land, type);
|
||||
if (!cl.isEmpty()) {
|
||||
final String prompt = "Choose " + Lang.nounWithAmount(1, type);
|
||||
final String prompt = Localizer.getInstance().getMessage("lblChoose") + " " + Lang.nounWithAmount(1, type);
|
||||
Card c = p.getController().chooseSingleEntityForEffect(cl, sa, prompt, false);
|
||||
if (c != null) {
|
||||
chosen.add(c);
|
||||
@@ -98,10 +99,10 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
||||
int chosenP = 0;
|
||||
while (!creature.isEmpty()) {
|
||||
Card c = p.getController().chooseSingleEntityForEffect(creature, sa,
|
||||
"Select creature(s) with total power less than or equal to " + (totP - chosenP - negativeNum)
|
||||
+ "\r\n(Selected:" + chosenPool + ")\r\n" + "(Total Power: " + chosenP + ")", chosenP <= totP);
|
||||
Localizer.getInstance().getMessage("lblSelectCreatureWithTotalPowerLessOrEqualTo", (totP - chosenP - negativeNum))
|
||||
+ "\r\n(" + Localizer.getInstance().getMessage("lblSelected") + ":" + chosenPool + ")\r\n(" + Localizer.getInstance().getMessage("lblTotalPowerNum", chosenP) + ")", chosenP <= totP);
|
||||
if (c == null) {
|
||||
if (p.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, "Cancel Choose?")) {
|
||||
if (p.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, Localizer.getInstance().getMessage("lblCancelChooseConfirm"))) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -118,7 +119,7 @@ public class ChooseCardEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("AtRandom") && !choices.isEmpty()) {
|
||||
Aggregates.random(choices, validAmount, chosen);
|
||||
} else {
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose a card ";
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " ";
|
||||
chosen.addAll(p.getController().chooseCardsForEffect(choices, sa, title, minAmount, validAmount, !sa.hasParam("Mandatory")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import forge.game.spellability.TargetRestrictions;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.ComparableOp;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -99,10 +100,11 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
Collections.sort(faces);
|
||||
chosen = p.getController().chooseCardName(sa, faces, "Choose a card name");
|
||||
chosen = p.getController().chooseCardName(sa, faces, Localizer.getInstance().getMessage("lblChooseACardName"));
|
||||
} else {
|
||||
// use CardFace because you might name a alternate name
|
||||
final String message = validDesc.equals("card") ? "Name a card" : "Name a " + validDesc + " card.";
|
||||
//"name a card" in mtg card oracle text is "choose a card name",change text
|
||||
final String message = validDesc.equals("card") ? Localizer.getInstance().getMessage("lblChooseACardName") : Localizer.getInstance().getMessage("lblChooseASpecificCard", validDesc);
|
||||
|
||||
Predicate<ICardFace> cpp = Predicates.alwaysTrue();
|
||||
if (sa.hasParam("ValidCards")) {
|
||||
@@ -114,7 +116,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
||||
|
||||
host.setNamedCard(chosen);
|
||||
if(!randomChoice) {
|
||||
p.getGame().getAction().nofityOfValue(sa, host, p.getName() + " picked " + chosen, p);
|
||||
p.getGame().getAction().nofityOfValue(sa, host, Localizer.getInstance().getMessage("lblPlayerPickedChosen", p.getName(), chosen), p);
|
||||
p.setNamedCard(chosen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -49,27 +50,25 @@ public class ChooseColorEffect extends SpellAbilityEffect {
|
||||
List<String> chosenColors;
|
||||
int cntMin = sa.hasParam("TwoColors") ? 2 : 1;
|
||||
int cntMax = sa.hasParam("TwoColors") ? 2 : sa.hasParam("OrColors") ? colorChoices.size() : 1;
|
||||
String prompt;
|
||||
String prompt = null;
|
||||
if (cntMax == 1) {
|
||||
prompt = "Choose a color";
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseAColor");
|
||||
}
|
||||
else {
|
||||
prompt = "Choose " + Lang.getNumeral(cntMin);
|
||||
if (cntMax > cntMin) {
|
||||
if (cntMax >= MagicColor.NUMBER_OR_COLORS) {
|
||||
prompt += " or more";
|
||||
} else {
|
||||
prompt += " to " + Lang.getNumeral(cntMax);
|
||||
}
|
||||
if (cntMax >= MagicColor.NUMBER_OR_COLORS) {
|
||||
prompt = Localizer.getInstance().getMessage("lblAtLastChooseNumColors", Lang.getNumeral(cntMin));
|
||||
} else {
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseSpecifiedRangeColors", Lang.getNumeral(cntMin), Lang.getNumeral(cntMax));
|
||||
}
|
||||
}
|
||||
prompt += " colors";
|
||||
}
|
||||
chosenColors = p.getController().chooseColors(prompt, sa, cntMin, cntMax, colorChoices);
|
||||
if (chosenColors.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
card.setChosenColors(chosenColors);
|
||||
p.getGame().getAction().nofityOfValue(sa, card, p.getName() + " picked " + Lang.joinHomogenous(chosenColors), p);
|
||||
p.getGame().getAction().nofityOfValue(sa, card, Localizer.getInstance().getMessage("lblPlayerPickedChosen", p.getName(), Lang.joinHomogenous(chosenColors)), p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import forge.game.player.Player;
|
||||
import forge.game.player.PlayerController.BinaryChoiceType;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class ChooseDirectionEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -18,11 +19,11 @@ public class ChooseDirectionEffect extends SpellAbilityEffect {
|
||||
final Game game = source.getGame();
|
||||
final FCollection<Player> left = new FCollection<>(game.getPlayers());
|
||||
// TODO: We'd better set up turn order UI here
|
||||
final String info = "Left (clockwise): " + left + "\r\nRight (anticlockwise):" + Lists.reverse(left);
|
||||
final String info = Localizer.getInstance().getMessage("lblLeftClockwise") + ": " + left + "\r\n" + Localizer.getInstance().getMessage("lblRightAntiClockwise") + ":" + Lists.reverse(left);
|
||||
sa.getActivatingPlayer().getController().notifyOfValue(sa, source, info);
|
||||
|
||||
boolean chosen = sa.getActivatingPlayer().getController().chooseBinary(sa,
|
||||
"Choose a direction", BinaryChoiceType.LeftOrRight);
|
||||
Localizer.getInstance().getMessage("lblChooseDirection"), BinaryChoiceType.LeftOrRight);
|
||||
source.setChosenDirection(chosen ? Direction.Left : Direction.Right);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import forge.game.event.GameEventCardModeChosen;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
||||
int idxChosen = MyRandom.getRandom().nextInt(abilities.size());
|
||||
chosenSA = abilities.get(idxChosen);
|
||||
} else {
|
||||
chosenSA = p.getController().chooseSingleSpellForEffect(abilities, sa, "Choose one",
|
||||
chosenSA = p.getController().chooseSingleSpellForEffect(abilities, sa, Localizer.getInstance().getMessage("lblChooseOne"),
|
||||
ImmutableMap.of());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -57,7 +58,7 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
|
||||
chosen = MyRandom.getRandom().nextInt(max - min) + min;
|
||||
p.getGame().getAction().nofityOfValue(sa, p, Integer.toString(chosen), null);
|
||||
} else {
|
||||
String title = sa.hasParam("ListTitle") ? sa.getParam("ListTitle") : "Choose a number";
|
||||
String title = sa.hasParam("ListTitle") ? sa.getParam("ListTitle") : Localizer.getInstance().getMessage("lblChooseNumber");
|
||||
if (anyNumber) {
|
||||
Integer value = p.getController().announceRequirements(sa, title, true);
|
||||
chosen = (value == null ? 0 : value);
|
||||
@@ -72,7 +73,7 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
|
||||
card.setChosenNumber(chosen);
|
||||
}
|
||||
if (sa.hasParam("Notify")) {
|
||||
p.getGame().getAction().nofityOfValue(sa, card, p.getName() + " picked " + chosen, p);
|
||||
p.getGame().getAction().nofityOfValue(sa, card, Localizer.getInstance().getMessage("lblPlayerPickedChosen", p.getName(), chosen), p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +86,7 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
|
||||
for (Entry<Player, Integer> ev : chooseMap.entrySet()) {
|
||||
int num = ev.getValue();
|
||||
Player player = ev.getKey();
|
||||
sb.append(player).append(" chose ").append(num);
|
||||
sb.append(Localizer.getInstance().getMessage("lblPlayerChoseNum", player.getName(), String.valueOf(num)));
|
||||
sb.append("\r\n");
|
||||
if (num > highest) {
|
||||
highestNum.clear();
|
||||
|
||||
@@ -9,6 +9,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,7 +38,7 @@ public class ChoosePlayerEffect extends SpellAbilityEffect {
|
||||
final FCollectionView<Player> choices = sa.hasParam("Choices") ? AbilityUtils.getDefinedPlayers(
|
||||
sa.getHostCard(), sa.getParam("Choices"), sa) : sa.getActivatingPlayer().getGame().getPlayersInTurnOrder();
|
||||
|
||||
final String choiceDesc = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose a player";
|
||||
final String choiceDesc = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChoosePlayer");
|
||||
final boolean random = sa.hasParam("Random");
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityStackInstance;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -134,7 +135,7 @@ public class ChooseSourceEffect extends SpellAbilityEffect {
|
||||
final CardCollection chosen = new CardCollection();
|
||||
if (tgt == null || p.canBeTargetedBy(sa)) {
|
||||
for (int i = 0; i < validAmount; i++) {
|
||||
final String choiceTitle = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose a source ";
|
||||
final String choiceTitle = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseSource") + " ";
|
||||
Card o = null;
|
||||
do {
|
||||
o = p.getController().chooseSingleEntityForEffect(sourcesToChooseFrom, sa, choiceTitle);
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -74,7 +75,7 @@ public class ClashEffect extends SpellAbilityEffect {
|
||||
*/
|
||||
final Card source = sa.getHostCard();
|
||||
final Player player = source.getController();
|
||||
final Player opponent = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(player.getOpponents(), sa, "Choose a opponent") ;
|
||||
final Player opponent = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(player.getOpponents(), sa, Localizer.getInstance().getMessage("lblChooseOpponent")) ;
|
||||
final ZoneType lib = ZoneType.Library;
|
||||
|
||||
if (sa.hasParam("RememberClasher")) {
|
||||
@@ -110,11 +111,11 @@ public class ClashEffect extends SpellAbilityEffect {
|
||||
|
||||
// TODO: Split cards will return two CMC values, so both players may become winners of clash
|
||||
|
||||
reveal.append(player).append(" reveals: ").append(pCard.getName()).append(". CMC = ").append(pCMC);
|
||||
reveal.append(player).append(" " + Localizer.getInstance().getMessage("lblReveals") + ": ").append(pCard.getName()).append(". " + Localizer.getInstance().getMessage("lblCMC") + "= ").append(pCMC);
|
||||
reveal.append("\r\n");
|
||||
reveal.append(opponent).append(" reveals: ").append(oCard.getName()).append(". CMC = ").append(oCMC);
|
||||
reveal.append(opponent).append(" " + Localizer.getInstance().getMessage("lblReveals") + ": ").append(oCard.getName()).append(". " + Localizer.getInstance().getMessage("lblCMC") + "= ").append(oCMC);
|
||||
reveal.append("\r\n\r\n");
|
||||
reveal.append(player).append(pCMC > oCMC ? " wins clash." : " loses clash.");
|
||||
reveal.append(player).append(pCMC > oCMC ? " " + Localizer.getInstance().getMessage("lblWinsClash") + "." : " " + Localizer.getInstance().getMessage("lblLosesClash") + ".");
|
||||
|
||||
player.getGame().getAction().nofityOfValue(sa, source, reveal.toString(), null);
|
||||
clashMoveToTopOrBottom(player, pCard, sa);
|
||||
|
||||
@@ -9,6 +9,8 @@ import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -78,7 +80,7 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
|
||||
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, host);
|
||||
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose a card ";
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " ";
|
||||
cardToCopy = activator.getController().chooseSingleEntityForEffect(choices, sa, title, false);
|
||||
} else if (sa.hasParam("Defined")) {
|
||||
List<Card> cloneSources = AbilityUtils.getDefinedCards(host, sa.getParam("Defined"), sa);
|
||||
@@ -93,7 +95,7 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
final boolean optional = sa.hasParam("Optional");
|
||||
if (optional && !host.getController().getController().confirmAction(sa, null, "Do you want to copy " + cardToCopy + "?")) {
|
||||
if (optional && !host.getController().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantCopy", CardTranslation.getTranslatedName(cardToCopy.getName())))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import forge.game.card.CardCollectionView;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,9 +36,9 @@ public class ControlExchangeVariantEffect extends SpellAbilityEffect {
|
||||
CardCollectionView list2 = AbilityUtils.filterListByType(player2.getCardsIn(zone), type, sa);
|
||||
int max = Math.min(list1.size(), list2.size());
|
||||
// choose the same number of cards
|
||||
CardCollectionView chosen1 = activator.getController().chooseCardsForEffect(list1, sa, "Choose cards: " + player1, 0, max, true);
|
||||
CardCollectionView chosen1 = activator.getController().chooseCardsForEffect(list1, sa, Localizer.getInstance().getMessage("lblChooseCards") + ":" + player1, 0, max, true);
|
||||
int num = chosen1.size();
|
||||
CardCollectionView chosen2 = activator.getController().chooseCardsForEffect(list2, sa, "Choose cards: " + player2, num, num, true);
|
||||
CardCollectionView chosen2 = activator.getController().chooseCardsForEffect(list2, sa, Localizer.getInstance().getMessage("lblChooseCards") + ":" + player2, num, num, true);
|
||||
// check all cards can be controlled by the other player
|
||||
for (final Card c : chosen1) {
|
||||
if (!c.canBeControlledBy(player2)) {
|
||||
|
||||
@@ -22,6 +22,8 @@ import forge.game.spellability.Ability;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
public class ControlGainEffect extends SpellAbilityEffect {
|
||||
/* (non-Javadoc)
|
||||
@@ -227,7 +229,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
final FCollectionView<GameEntity> e = combat.getDefenders();
|
||||
|
||||
final GameEntity defender = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(e, sa,
|
||||
"Declare a defender for " + tgtC);
|
||||
Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(tgtC.getName())));
|
||||
|
||||
if (defender != null) {
|
||||
combat.addAttacker(tgtC, defender);
|
||||
|
||||
@@ -27,6 +27,8 @@ import forge.util.Aggregates;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.PredicateString.StringOp;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -64,7 +66,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
final long timestamp = game.getNextTimestamp();
|
||||
|
||||
if (sa.hasParam("Optional")) {
|
||||
if (!activator.getController().confirmAction(sa, null, "Copy this permanent?")) {
|
||||
if (!activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblCopyPermanentConfirm"))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +147,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
CardCollectionView choices = game.getCardsIn(ZoneType.Battlefield);
|
||||
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, host);
|
||||
if (!choices.isEmpty()) {
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose a card ";
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") +" ";
|
||||
|
||||
Card choosen = chooser.getController().chooseSingleEntityForEffect(choices, sa, title, false);
|
||||
|
||||
@@ -206,12 +208,12 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
GameEntity defender;
|
||||
if ("True".equals(attacked)) {
|
||||
FCollectionView<GameEntity> defs = game.getCombat().getDefenders();
|
||||
defender = c.getController().getController().chooseSingleEntityForEffect(defs, sa, "Choose which defender to attack with " + c, false);
|
||||
defender = c.getController().getController().chooseSingleEntityForEffect(defs, sa, Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(c.getName())), false);
|
||||
} else {
|
||||
defender = AbilityUtils.getDefinedPlayers(host, sa.getParam("CopyAttacking"), sa).get(0);
|
||||
if (sa.hasParam("ChoosePlayerOrPlaneswalker") && defender != null) {
|
||||
FCollectionView<GameEntity> defs = game.getCombat().getDefendersControlledBy((Player) defender);
|
||||
defender = c.getController().getController().chooseSingleEntityForEffect(defs, sa, "Choose which defender to attack with " + c + " {defender: "+ defender + "}", false);
|
||||
defender = c.getController().getController().chooseSingleEntityForEffect(defs, sa, Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(c.getName())) + " {" + Localizer.getInstance().getMessage("lblDefender") + ": " + defender + "}", false);
|
||||
}
|
||||
}
|
||||
game.getCombat().addAttacker(copyInPlay, defender);
|
||||
@@ -243,7 +245,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
list = CardLists.getValidCards(list, sa.getParam("AttachedTo"), copyInPlay.getController(), copyInPlay);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
Card attachedTo = activator.getController().chooseSingleEntityForEffect(list, sa, copyInPlay + " - Select a card to attach to.");
|
||||
Card attachedTo = activator.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", copyInPlay.toString()));
|
||||
|
||||
copyInPlay.attachToEntity(attachedTo);
|
||||
} else {
|
||||
|
||||
@@ -15,6 +15,8 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -66,7 +68,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
if (isOptional && !controller.getController().confirmAction(sa, null, "Do you want to copy the spell " + card + "?")) {
|
||||
if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantCopyTheSpell", CardTranslation.getTranslatedName(card.getName())))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
final int spellCount = Integer.parseInt(sa.getParam("CopyMultipleSpells"));
|
||||
|
||||
for (int multi = 0; multi < spellCount && !tgtSpells.isEmpty(); multi++) {
|
||||
String prompt = "Select " + Lang.getOrdinal(multi + 1) + " spell to copy to stack";
|
||||
String prompt = Localizer.getInstance().getMessage("lblSelectMultiSpellCopyToStack", Lang.getOrdinal(multi + 1));
|
||||
SpellAbility chosen = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa, prompt,
|
||||
ImmutableMap.of());
|
||||
SpellAbility copiedSpell = CardFactory.copySpellAbilityAndPossiblyHost(card, chosen.getHostCard(), chosen, true);
|
||||
@@ -96,7 +98,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
}
|
||||
else if (sa.hasParam("CopyForEachCanTarget")) {
|
||||
SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa,
|
||||
"Select a spell to copy", ImmutableMap.of());
|
||||
Localizer.getInstance().getMessage("lblSelectASpellCopy"), ImmutableMap.of());
|
||||
chosenSA.setActivatingPlayer(controller);
|
||||
// Find subability or rootability that has targets
|
||||
SpellAbility targetedSA = chosenSA;
|
||||
@@ -144,7 +146,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
valid.remove(originalTarget);
|
||||
mayChooseNewTargets = false;
|
||||
if (sa.hasParam("ChooseOnlyOne")) {
|
||||
Card choice = controller.getController().chooseSingleEntityForEffect(valid, sa, "Choose one");
|
||||
Card choice = controller.getController().chooseSingleEntityForEffect(valid, sa, Localizer.getInstance().getMessage("lblChooseOne"));
|
||||
SpellAbility copy = CardFactory.copySpellAbilityAndPossiblyHost(card, chosenSA.getHostCard(), chosenSA, true);
|
||||
resetFirstTargetOnCopy(copy, choice, targetedSA);
|
||||
copies.add(copy);
|
||||
@@ -164,7 +166,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
}
|
||||
else {
|
||||
SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa,
|
||||
"Select a spell to copy", ImmutableMap.of());
|
||||
Localizer.getInstance().getMessage("lblSelectASpellCopy"), ImmutableMap.of());
|
||||
chosenSA.setActivatingPlayer(controller);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
SpellAbility copy = CardFactory.copySpellAbilityAndPossiblyHost(
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityStackInstance;
|
||||
import forge.game.spellability.SpellPermanent;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -174,7 +175,7 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
String destination = srcSA.hasParam("Destination") ? srcSA.getParam("Destination") : tgtSA.isAftermath() ? "Exile" : "Graveyard";
|
||||
if (srcSA.hasParam("DestinationChoice")) {//Hinder
|
||||
List<String> pos = Arrays.asList(srcSA.getParam("DestinationChoice").split(","));
|
||||
destination = srcSA.getActivatingPlayer().getController().chooseSomeType("a destination to remove", tgtSA, pos, null);
|
||||
destination = srcSA.getActivatingPlayer().getController().chooseSomeType(Localizer.getInstance().getMessage("lblRemoveDestination"), tgtSA, pos, null);
|
||||
}
|
||||
if (tgtSA.isAbility()) {
|
||||
// For Ability-targeted counterspells - do not move it anywhere,
|
||||
|
||||
@@ -12,6 +12,8 @@ import forge.game.player.Player;
|
||||
import forge.game.player.PlayerController;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -109,10 +111,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
|
||||
// only select cards if the counterNum is any
|
||||
if (counterNum.equals("Any")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Choose cards to take ").append(cType.getName()).append(" counters from");
|
||||
|
||||
srcCards = player.getController().chooseCardsForEffect(srcCards, sa, sb.toString(), 0, srcCards.size(), true);
|
||||
srcCards = player.getController().chooseCardsForEffect(srcCards, sa, Localizer.getInstance().getMessage("lblChooseTakeCountersCard", cType.getName()), 0, srcCards.size(), true);
|
||||
}
|
||||
|
||||
for (Card src : srcCards) {
|
||||
@@ -134,10 +133,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
params.put("CounterType", cType);
|
||||
params.put("Source", src);
|
||||
params.put("Target", dest);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Take how many ").append(cType.getName());
|
||||
sb.append(" counters from ").append(src).append("?");
|
||||
cnum = player.getController().chooseNumber(sa, sb.toString(), 0, cmax, params);
|
||||
cnum = player.getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblTakeHowManyTargetCounterFromCard", cType.getName(), CardTranslation.getTranslatedName(src.getName())), 0, cmax, params);
|
||||
} else {
|
||||
cnum = AbilityUtils.calculateAmount(host, counterNum, sa);
|
||||
}
|
||||
@@ -171,12 +167,8 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
tgtCards = CardLists.getValidCards(tgtCards, sa.getParam("ValidDefined"), player, host, sa);
|
||||
|
||||
if (counterNum.equals("Any")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Choose cards to get ").append(cType.getName());
|
||||
sb.append(" counters from ").append(source).append(".");
|
||||
|
||||
tgtCards = player.getController().chooseCardsForEffect(
|
||||
tgtCards, sa, sb.toString(), 0, tgtCards.size(), true);
|
||||
tgtCards = player.getController().chooseCardsForEffect(tgtCards, sa,
|
||||
Localizer.getInstance().getMessage("lblChooseCardToGetCountersFrom", cType.getName(), CardTranslation.getTranslatedName(source.getName())), 0, tgtCards.size(), true);
|
||||
}
|
||||
|
||||
boolean updateSource = false;
|
||||
@@ -200,9 +192,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
params.put("CounterType", cType);
|
||||
params.put("Source", source);
|
||||
params.put("Target", cur);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Put how many ").append(cType.getName()).append(" counters on ").append(cur).append("?");
|
||||
int cnum = player.getController().chooseNumber(sa, sb.toString(), 0, source.getCounters(cType), params);
|
||||
int cnum = player.getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblPutHowManyTargetCounterOnCard", cType.getName(), CardTranslation.getTranslatedName(cur.getName())), 0, source.getCounters(cType), params);
|
||||
|
||||
if (cnum > 0) {
|
||||
source.subtractCounter(cType, cnum);
|
||||
@@ -260,10 +250,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
params.put("CounterType", cType);
|
||||
params.put("Source", source);
|
||||
params.put("Target", cur);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Take how many ").append(cType.getName());
|
||||
sb.append(" counters from ").append(source).append("?");
|
||||
cntToMove = pc.chooseNumber(sa, sb.toString(), 0, cntToMove, params);
|
||||
cntToMove = pc.chooseNumber(sa, Localizer.getInstance().getMessage("lblTakeHowManyTargetCounterFromCard", cType.getName(), CardTranslation.getTranslatedName(source.getName())), 0, cntToMove, params);
|
||||
}
|
||||
|
||||
if (source.getCounters(cType) >= cntToMove) {
|
||||
@@ -289,17 +276,15 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Source", source);
|
||||
params.put("Target", dest);
|
||||
String title = "Select type counters to remove";
|
||||
String title = Localizer.getInstance().getMessage("lblSelectRemoveCounterType");
|
||||
CounterType chosenType = pc.chooseCounterType(typeChoices, sa, title, params);
|
||||
|
||||
params = Maps.newHashMap();
|
||||
params.put("CounterType", chosenType);
|
||||
params.put("Source", source);
|
||||
params.put("Target", dest);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Take how many ").append(chosenType.getName()).append(" counters?");
|
||||
int chosenAmount = pc.chooseNumber(
|
||||
sa, sb.toString(), 0, Math.min(tgtCounters.get(chosenType), cntToMove), params);
|
||||
int chosenAmount = pc.chooseNumber(sa, Localizer.getInstance().getMessage("lblTakeHowManyTargetCounters", chosenType.getName()),
|
||||
0, Math.min(tgtCounters.get(chosenType), cntToMove), params);
|
||||
|
||||
if (chosenAmount > 0) {
|
||||
dest.addCounter(chosenType, chosenAmount, player, true, table);
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.game.player.PlayerPredicates;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class CountersProliferateEffect extends SpellAbilityEffect {
|
||||
list.addAll(CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.hasCounters()));
|
||||
|
||||
List<GameEntity> result = pc.chooseEntitiesForEffect(list, 0, list.size(), null, sa,
|
||||
"Choose any number of permanents and/or players for proliferate", p);
|
||||
Localizer.getInstance().getMessage("lblChooseProliferateTarget"), p);
|
||||
|
||||
GameEntityCounterTable table = new GameEntityCounterTable();
|
||||
for (final GameEntity ge : result) {
|
||||
|
||||
@@ -26,6 +26,8 @@ import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
@@ -129,7 +131,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("Bolster")) {
|
||||
CardCollection creatsYouCtrl = CardLists.filter(activator.getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
|
||||
CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense));
|
||||
tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, "Choose a creature with the least toughness", 1, 1, false));
|
||||
tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false));
|
||||
tgtObjects.addAll(tgtCards);
|
||||
} else {
|
||||
tgtObjects.addAll(getDefinedOrTargeted(sa, "Defined"));
|
||||
@@ -183,7 +185,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Target", obj);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select counter type to add to ");
|
||||
sb.append(Localizer.getInstance().getMessage("lblSelectCounterTypeAddTo") + " ");
|
||||
sb.append(obj);
|
||||
counterType = pc.chooseCounterType(choices, sa, sb.toString(), params);
|
||||
}
|
||||
@@ -199,7 +201,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Target", obj);
|
||||
params.put("CounterType", counterType);
|
||||
counterAmount = pc.chooseNumber(sa, "How many counters?", 0, counterAmount, params);
|
||||
counterAmount = pc.chooseNumber(sa, Localizer.getInstance().getMessage("lblHowManyCounters"), 0, counterAmount, params);
|
||||
}
|
||||
|
||||
// Adapt need extra logic
|
||||
@@ -235,8 +237,8 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
|
||||
String message = "Do you want to put " + counterAmount + " +1/+1 counters on " + gameCard + " ?";
|
||||
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, "Choose an opponent");
|
||||
String message = Localizer.getInstance().getMessage("lblDoYouWantPutTargetP1P1CountersOnCard", String.valueOf(counterAmount), CardTranslation.getTranslatedName(gameCard.getName()));
|
||||
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, Localizer.getInstance().getMessage("lblChooseAnOpponent"));
|
||||
|
||||
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) {
|
||||
gameCard.setTributed(true);
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -97,11 +98,11 @@ public class CountersPutOrRemoveEffect extends SpellAbilityEffect {
|
||||
list = Lists.newArrayList(ctype);
|
||||
}
|
||||
|
||||
String prompt = "Select type of counters to add or remove";
|
||||
String prompt = Localizer.getInstance().getMessage("lblSelectCounterTypeToAddOrRemove");
|
||||
CounterType chosenType = pc.chooseCounterType(list, sa, prompt, params);
|
||||
|
||||
params.put("CounterType", chosenType);
|
||||
prompt = "What to do with that '" + chosenType.getName() + "' counter ";
|
||||
prompt = Localizer.getInstance().getMessage("lblWhatToDoWithTargetCounter", chosenType.getName()) + " ";
|
||||
Boolean putCounter = pc.chooseBinary(sa, prompt, BinaryChoiceType.AddOrRemove, params);
|
||||
|
||||
if (putCounter) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.player.PlayerController;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -84,8 +85,8 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (sa.hasParam("Optional")) {
|
||||
String ctrs = cntToRemove > 1 ? "counters" : num.equals("All") ? "all counters" : "a counter";
|
||||
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, "Remove " + ctrs + "?")) {
|
||||
String ctrs = cntToRemove > 1 ? Localizer.getInstance().getMessage("lblCounters") : num.equals("All") ? Localizer.getInstance().getMessage("lblAllCounters") : Localizer.getInstance().getMessage("lblACounters");
|
||||
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRemove") + " " + ctrs + "?")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,10 +130,7 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
srcCards = game.getCardsIn(ZoneType.Battlefield);
|
||||
srcCards = CardLists.getValidCards(srcCards, sa.getParam("ValidSource"), player, card, sa);
|
||||
if (num.equals("Any")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Choose cards to take ").append(counterType.getName()).append(" counters from");
|
||||
|
||||
srcCards = player.getController().chooseCardsForEffect(srcCards, sa, sb.toString(), 0, srcCards.size(), true);
|
||||
srcCards = player.getController().chooseCardsForEffect(srcCards, sa, Localizer.getInstance().getMessage("lblChooseCardsToTakeTargetCounters", counterType.getName()), 0, srcCards.size(), true);
|
||||
}
|
||||
} else {
|
||||
srcCards = getTargetCards(sa);
|
||||
@@ -172,7 +170,7 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Target", gameCard);
|
||||
params.put("CounterType", type);
|
||||
String title = "Select the number of " + type + " counters to remove";
|
||||
String title = Localizer.getInstance().getMessage("lblSelectRemoveCountersNumberOfTarget", type);
|
||||
cntToRemove = pc.chooseNumber(sa, title, 0, cntToRemove, params);
|
||||
}
|
||||
|
||||
@@ -213,10 +211,10 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("Target", entity);
|
||||
|
||||
String prompt = "Select type of counters to remove";
|
||||
String prompt = Localizer.getInstance().getMessage("lblSelectCountersTypeToRemove");
|
||||
CounterType chosenType = pc.chooseCounterType(
|
||||
ImmutableList.copyOf(tgtCounters.keySet()), sa, prompt, params);
|
||||
prompt = "Select the number of " + chosenType.getName() + " counters to remove";
|
||||
prompt = Localizer.getInstance().getMessage("lblSelectRemoveCountersNumberOfTarget", chosenType.getName());
|
||||
int max = Math.min(cntToRemove, tgtCounters.get(chosenType));
|
||||
params = Maps.newHashMap();
|
||||
params.put("Target", entity);
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.card.CardUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -83,7 +84,7 @@ public class DamageDealEffect extends DamageBaseEffect {
|
||||
List<GameObject> tgts = getTargets(sa);
|
||||
if (sa.hasParam("OptionalDecider")) {
|
||||
Player decider = Iterables.getFirst(AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("OptionalDecider"), sa), null);
|
||||
if (decider != null && !decider.getController().confirmAction(sa, null, "Do you want to deal " + dmg + " damage to " + tgts + " ?")) {
|
||||
if (decider != null && !decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantDealTargetDamageToTarget", String.valueOf(dmg), tgts.toString()))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -99,13 +101,6 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
final List<Player> tgtPlayers = getTargetPlayers(sa);
|
||||
|
||||
if (sa.hasParam("Choser")) {
|
||||
final List<Player> choosers = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("Choser"), sa);
|
||||
if (!choosers.isEmpty()) {
|
||||
chooser = choosers.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
CardZoneTable table = new CardZoneTable();
|
||||
GameEntityCounterTable counterTable = new GameEntityCounterTable();
|
||||
for (final Player p : tgtPlayers) {
|
||||
@@ -128,7 +123,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
game.getAction().reveal(top, p, false);
|
||||
}
|
||||
else if (sa.hasParam("RevealOptional")) {
|
||||
String question = TextUtil.concatWithSpace("Reveal:", TextUtil.addSuffix(Lang.joinHomogenous(top),"?"));
|
||||
String question = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblReveal") + ":", TextUtil.addSuffix(Lang.joinHomogenous(top),"?"));
|
||||
|
||||
hasRevealed = p.getController().confirmAction(sa, null, question);
|
||||
if (hasRevealed) {
|
||||
@@ -151,7 +146,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
else if (!sa.hasParam("NoLooking")) {
|
||||
// show the user the revealed cards
|
||||
delayedReveal = new DelayedReveal(top, srcZone, PlayerView.get(p), host.getName() + " - Looking at cards in ");
|
||||
delayedReveal = new DelayedReveal(top, srcZone, PlayerView.get(p), host.getName() + " - " + Localizer.getInstance().getMessage("lblLookingCardIn") + " ");
|
||||
|
||||
if (noMove) {
|
||||
// Let the activating player see the cards even if they're not moved
|
||||
@@ -164,7 +159,15 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
host.addRemembered(one);
|
||||
}
|
||||
}
|
||||
|
||||
if (sa.hasParam("Choser")) {
|
||||
final FCollectionView<Player> choosers = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("Choser"), sa);
|
||||
if (!choosers.isEmpty()) {
|
||||
chooser = player.getController().chooseSingleEntityForEffect(choosers, sa, "Choser:");
|
||||
}
|
||||
if (sa.hasParam("SetChosenPlayer")) {
|
||||
host.setChosenPlayer(chooser);
|
||||
}
|
||||
}
|
||||
if (!noMove) {
|
||||
CardCollection movedCards;
|
||||
rest.addAll(top);
|
||||
@@ -194,7 +197,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
|
||||
// Optional abilities that use a dialog box to prompt the user to skip the ability (e.g. Explorer's Scope, Quest for Ula's Temple)
|
||||
if (optional && mayBeSkipped && !valid.isEmpty()) {
|
||||
String prompt = !optionalAbilityPrompt.isEmpty() ? optionalAbilityPrompt : "Would you like to proceed with the optional ability for " + sa.getHostCard() + "?\n\n(" + sa.getDescription() + ")";
|
||||
String prompt = !optionalAbilityPrompt.isEmpty() ? optionalAbilityPrompt : Localizer.getInstance().getMessage("lblWouldYouLikeProceedWithOptionalAbility") + " " + sa.getHostCard() + "?\n\n(" + sa.getDescription() + ")";
|
||||
if (!p.getController().confirmAction(sa, null, TextUtil.fastReplace(prompt, "CARDNAME", sa.getHostCard().getName()))) {
|
||||
return;
|
||||
}
|
||||
@@ -214,24 +217,24 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
for (final byte pair : MagicColor.COLORPAIR) {
|
||||
Card chosen = chooser.getController().chooseSingleEntityForEffect(CardLists.filter(valid, CardPredicates.isExactlyColor(pair)),
|
||||
delayedReveal, sa, "Choose one", false, p);
|
||||
delayedReveal, sa, Localizer.getInstance().getMessage("lblChooseOne"), false, p);
|
||||
if (chosen != null) {
|
||||
movedCards.add(chosen);
|
||||
}
|
||||
}
|
||||
chooser.getController().endTempShowCards();
|
||||
if (!movedCards.isEmpty()) {
|
||||
game.getAction().reveal(movedCards, chooser, true, chooser + " picked ");
|
||||
game.getAction().reveal(movedCards, chooser, true, Localizer.getInstance().getMessage("lblPlayerPickedChosen", chooser.getName(), ""));
|
||||
}
|
||||
}
|
||||
else if (allButOne) {
|
||||
movedCards = new CardCollection(valid);
|
||||
String prompt;
|
||||
if (destZone2.equals(ZoneType.Library) && libraryPosition2 == 0) {
|
||||
prompt = "Choose a card to leave on top of {player's} library";
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseACardToLeaveTargetLibraryTop", "{player's}");
|
||||
}
|
||||
else {
|
||||
prompt = "Choose a card to leave in {player's} " + destZone2.name();
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseACardLeaveTarget", "{player's}", destZone2.getTranslatedName());
|
||||
}
|
||||
|
||||
Card chosen = chooser.getController().chooseSingleEntityForEffect(valid, delayedReveal, sa, prompt, false, p);
|
||||
@@ -245,19 +248,19 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("PrimaryPrompt")) {
|
||||
prompt = sa.getParam("PrimaryPrompt");
|
||||
} else {
|
||||
prompt = "Choose card(s) to put into " + destZone1.name();
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardsPutIntoZone", destZone1.getTranslatedName());
|
||||
if (destZone1.equals(ZoneType.Library)) {
|
||||
if (libraryPosition == -1) {
|
||||
prompt = "Choose card(s) to put on the bottom of {player's} library";
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardPutOnTargetLibarayBottom", "{player's}");
|
||||
} else if (libraryPosition == 0) {
|
||||
prompt = "Choose card(s) to put on top of {player's} library";
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardPutOnTargetLibarayTop", "{player's}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
movedCards = new CardCollection();
|
||||
if (valid.isEmpty()) {
|
||||
chooser.getController().notifyOfValue(sa, null, "No valid cards");
|
||||
chooser.getController().notifyOfValue(sa, null, Localizer.getInstance().getMessage("lblNoValidCards"));
|
||||
} else {
|
||||
if ( p == chooser ) { // the digger can still see all the dug cards when choosing
|
||||
chooser.getController().tempShowCards(top);
|
||||
@@ -275,8 +278,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (!changeValid.isEmpty() && !sa.hasParam("ExileFaceDown") && !sa.hasParam("NoReveal")) {
|
||||
game.getAction().reveal(movedCards, chooser, true,
|
||||
chooser + " picked " + (movedCards.size() == 1 ? "this card" : "these cards") + " from ");
|
||||
game.getAction().reveal(movedCards, chooser, true, Localizer.getInstance().getMessage("lblPlayerPickedCardFrom", chooser.getName()));
|
||||
}
|
||||
}
|
||||
if (sa.hasParam("ForgetOtherRemembered")) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class DigMultipleEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -74,15 +75,14 @@ public class DigMultipleEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (validMap.isEmpty()) {
|
||||
chooser.getController().notifyOfValue(sa, null, "No valid cards");
|
||||
chooser.getController().notifyOfValue(sa, null, Localizer.getInstance().getMessage("lblNoValidCards"));
|
||||
continue;
|
||||
}
|
||||
|
||||
CardCollection chosen = chooser.getController().chooseCardsForEffectMultiple(validMap, sa, "Choose cards");
|
||||
CardCollection chosen = chooser.getController().chooseCardsForEffectMultiple(validMap, sa, Localizer.getInstance().getMessage("lblChooseCards"));
|
||||
|
||||
if (!chosen.isEmpty()) {
|
||||
game.getAction().reveal(chosen, chooser, true,
|
||||
chooser + " picked " + (chosen.size() == 1 ? "this card" : "these cards") + " from ");
|
||||
game.getAction().reveal(chosen, chooser, true, Localizer.getInstance().getMessage("lblPlayerPickedCardFrom", chooser.getName()));
|
||||
}
|
||||
|
||||
for (Card c : chosen) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -86,6 +87,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
|
||||
int untilAmount = 1;
|
||||
if (sa.hasParam("Amount")) {
|
||||
untilAmount = AbilityUtils.calculateAmount(host, sa.getParam("Amount"), sa);
|
||||
if (untilAmount == 0) return;
|
||||
}
|
||||
|
||||
Integer maxRevealed = null;
|
||||
@@ -113,7 +115,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
|
||||
if (optional && !p.getController().confirmAction(sa, null, "Do you want to dig your library?")) {
|
||||
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDigYourLibrary"))) {
|
||||
continue;
|
||||
}
|
||||
CardCollection found = new CardCollection();
|
||||
@@ -159,7 +161,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
|
||||
final Card c = itr.next();
|
||||
final ZoneType origin = c.getZone().getZoneType();
|
||||
if (optionalFound && !p.getController().confirmAction(sa, null,
|
||||
"Do you want to put that card to " + foundDest.name() + "?")) {
|
||||
Localizer.getInstance().getMessage("lblDoYouWantPutCardToZone", foundDest.getTranslatedName()))) {
|
||||
continue;
|
||||
} else {
|
||||
Card m = null;
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -205,7 +206,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
if (!p.canDiscardBy(sa)) {
|
||||
continue;
|
||||
}
|
||||
String message = "Would you like to discard " + numCards + " random card(s)?";
|
||||
String message = Localizer.getInstance().getMessage("lblWouldYouLikeRandomDiscardTargetCard", String.valueOf(numCards));
|
||||
boolean runDiscard = !sa.hasParam("Optional") || p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message);
|
||||
|
||||
if (runDiscard) {
|
||||
@@ -257,7 +258,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
final CardCollectionView dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
|
||||
for (final Player opp : p.getAllOtherPlayers()) {
|
||||
opp.getController().reveal(dPHand, ZoneType.Hand, p, "Reveal ");
|
||||
opp.getController().reveal(dPHand, ZoneType.Hand, p, Localizer.getInstance().getMessage("lblReveal") + " ");
|
||||
}
|
||||
|
||||
if (!p.canDiscardBy(sa)) {
|
||||
@@ -325,8 +326,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (mode.startsWith("Reveal") ) {
|
||||
p.getController().reveal(toBeDiscarded, ZoneType.Hand, p,
|
||||
chooser + " has chosen " + (toBeDiscarded.size() == 1 ? "this card" : "these cards") + " from ");
|
||||
p.getController().reveal(toBeDiscarded, ZoneType.Hand, p, Localizer.getInstance().getMessage("lblPlayerHasChosenCardsFrom", chooser.getName()));
|
||||
}
|
||||
for (Card card : toBeDiscarded) {
|
||||
if (card == null) { continue; }
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,12 +50,12 @@ public class DrawEffect extends SpellAbilityEffect {
|
||||
|
||||
for (final Player p : getDefinedPlayersOrTargeted(sa)) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa))
|
||||
if (optional && !p.getController().confirmAction(sa, null, "Do you want to draw " + Lang.nounWithAmount(numCards, " card") + "?"))
|
||||
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDrawCards", Lang.nounWithAmount(numCards, " card"))))
|
||||
continue;
|
||||
|
||||
int actualNum = numCards;
|
||||
if (upto) {
|
||||
actualNum = p.getController().chooseNumber(sa, "How may cards do you want to draw?", 0, numCards);
|
||||
actualNum = p.getController().chooseNumber(sa, "lblHowMayCardDoYouWantDraw", 0, numCards);
|
||||
}
|
||||
|
||||
final CardCollectionView drawn = p.drawCards(actualNum);
|
||||
|
||||
@@ -8,6 +8,8 @@ import forge.game.card.CardCollectionView;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
public class EncodeEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -44,9 +46,7 @@ public class EncodeEffect extends SpellAbilityEffect {
|
||||
// Handle choice of whether or not to encoded
|
||||
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Do you want to exile ").append(host).append(" and encode it onto a creature you control?");
|
||||
if (!player.getController().confirmAction(sa, null, sb.toString())) {
|
||||
if (!player.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantExileCardAndEncodeOntoYouCreature", CardTranslation.getTranslatedName(host.getName())))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ public class EncodeEffect extends SpellAbilityEffect {
|
||||
Card movedCard = game.getAction().moveTo(ZoneType.Exile, host, sa);
|
||||
|
||||
// choose a creature
|
||||
Card choice = player.getController().chooseSingleEntityForEffect(choices, sa, "Choose a creature you control to encode ", true);
|
||||
Card choice = player.getController().chooseSingleEntityForEffect(choices, sa, Localizer.getInstance().getMessage("lblChooseACreatureYouControlToEncode") + " ", true);
|
||||
|
||||
if (choice == null) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder codeLog = new StringBuilder();
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class ExploreEffect extends SpellAbilityEffect {
|
||||
boolean revealedLand = false;
|
||||
CardCollection top = pl.getTopXCardsFromLibrary(1);
|
||||
if (!top.isEmpty()) {
|
||||
game.getAction().reveal(top, pl, false, "Revealed for Explore - ");
|
||||
game.getAction().reveal(top, pl, false, Localizer.getInstance().getMessage("lblRevealedForExplore") + " - ");
|
||||
final Card r = top.getFirst();
|
||||
if (r.isLand()) {
|
||||
game.getAction().moveTo(ZoneType.Hand, r, sa);
|
||||
@@ -63,7 +64,7 @@ public class ExploreEffect extends SpellAbilityEffect {
|
||||
// TODO find better way to choose optional send away
|
||||
final Card choosen = pc.chooseSingleCardForZoneChange(
|
||||
ZoneType.Graveyard, Lists.newArrayList(ZoneType.Library), sa, top, null,
|
||||
"Put this card in your graveyard?", true, pl);
|
||||
Localizer.getInstance().getMessage("lblPutThisCardToYourGraveyard"), true, pl);
|
||||
if (choosen != null) {
|
||||
game.getAction().moveTo(ZoneType.Graveyard, choosen, sa);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -163,7 +164,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
if (result) {
|
||||
numSuccesses++;
|
||||
}
|
||||
flipper.getGame().getAction().nofityOfValue(sa, flipper, result ? "heads" : "tails", null);
|
||||
flipper.getGame().getAction().nofityOfValue(sa, flipper, result ? Localizer.getInstance().getMessage("lblHeads") : Localizer.getInstance().getMessage("lblTails"), null);
|
||||
} while (sa.hasParam("FlipUntilYouLose") && result != false);
|
||||
|
||||
if (sa.hasParam("FlipUntilYouLose") && sa.hasAdditionalAbility("LoseSubAbility")) {
|
||||
@@ -193,7 +194,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
|
||||
do {
|
||||
Set<Boolean> flipResults = new HashSet<>();
|
||||
final boolean choice = caller.getController().chooseBinary(sa, sa.getHostCard().getName() + " - Call coin flip", PlayerController.BinaryChoiceType.HeadsOrTails);
|
||||
final boolean choice = caller.getController().chooseBinary(sa, sa.getHostCard().getName() + " - " + Localizer.getInstance().getMessage("lblCallCoinFlip"), PlayerController.BinaryChoiceType.HeadsOrTails);
|
||||
for (int i = 0; i < multiplier; i++) {
|
||||
flipResults.add(MyRandom.getRandom().nextBoolean());
|
||||
}
|
||||
@@ -206,7 +207,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
numSuccesses++;
|
||||
}
|
||||
|
||||
caller.getGame().getAction().nofityOfValue(sa, caller, wonFlip ? "win" : "lose", null);
|
||||
caller.getGame().getAction().nofityOfValue(sa, caller, wonFlip ? Localizer.getInstance().getMessage("lblWin") : Localizer.getInstance().getMessage("lblLose"), null);
|
||||
|
||||
// Run triggers
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
|
||||
@@ -5,6 +5,7 @@ import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -34,7 +35,7 @@ public class LifeSetEffect extends SpellAbilityEffect {
|
||||
if (!redistribute) {
|
||||
p.setLife(lifeAmount, sa.getHostCard());
|
||||
} else {
|
||||
int life = sa.getActivatingPlayer().getController().chooseNumber(sa, "Life Total: " + p, lifetotals, p);
|
||||
int life = sa.getActivatingPlayer().getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblLifeTotal") + ": " + p, lifetotals, p);
|
||||
p.setLife(life, sa.getHostCard());
|
||||
lifetotals.remove((Integer) life);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
final boolean optional = sa.hasParam("Optional");
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
|
||||
if (optional && !sa.getActivatingPlayer().getController().confirmAction(sa, null, "Do you want to add mana?")) {
|
||||
if (optional && !sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantAddMana"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
// just use the first possible color.
|
||||
choice = colorsProduced[differentChoice ? nMana : 0];
|
||||
} else {
|
||||
byte chosenColor = activator.getController().chooseColor("Select Mana to Produce", sa,
|
||||
byte chosenColor = activator.getController().chooseColor(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa,
|
||||
differentChoice ? fullOptions : colorOptions);
|
||||
if (chosenColor == 0)
|
||||
throw new RuntimeException("ManaEffect::resolve() /*combo mana*/ - " + activator + " color mana choice is empty for " + card.getName());
|
||||
@@ -111,7 +112,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
return;
|
||||
}
|
||||
|
||||
game.action.nofityOfValue(sa, card, activator + " picked " + choiceString, activator);
|
||||
game.action.nofityOfValue(sa, card, Localizer.getInstance().getMessage("lblPlayerPickedChosen", activator.getName(), choiceString), activator);
|
||||
abMana.setExpressChoice(choiceString.toString());
|
||||
}
|
||||
}
|
||||
@@ -135,13 +136,13 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
mask |= MagicColor.fromName(colorsNeeded.charAt(nChar));
|
||||
}
|
||||
colorMenu = mask == 0 ? ColorSet.ALL_COLORS : ColorSet.fromMask(mask);
|
||||
byte val = p.getController().chooseColor("Select Mana to Produce", sa, colorMenu);
|
||||
byte val = p.getController().chooseColor(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa, colorMenu);
|
||||
if (0 == val) {
|
||||
throw new RuntimeException("ManaEffect::resolve() /*any mana*/ - " + act + " color mana choice is empty for " + card.getName());
|
||||
}
|
||||
choice = MagicColor.toShortString(val);
|
||||
|
||||
game.action.nofityOfValue(sa, card, act + " picked " + choice, act);
|
||||
game.action.nofityOfValue(sa, card, Localizer.getInstance().getMessage("lblPlayerPickedChosen", act.getName(), choice), act);
|
||||
abMana.setExpressChoice(choice);
|
||||
}
|
||||
}
|
||||
@@ -172,7 +173,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
if (cs.isMonoColor())
|
||||
sb.append(MagicColor.toShortString(s.getColorMask()));
|
||||
else /* (cs.isMulticolor()) */ {
|
||||
byte chosenColor = sa.getActivatingPlayer().getController().chooseColor("Choose a single color from " + s.toString(), sa, cs);
|
||||
byte chosenColor = sa.getActivatingPlayer().getController().chooseColor(Localizer.getInstance().getMessage("lblChooseSingleColorFromTarget", s.toString()), sa, cs);
|
||||
sb.append(MagicColor.toShortString(chosenColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.game.card.CardUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -68,7 +69,7 @@ public class ManaReflectedEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (mask == 0 && !expressChoiceColors.isEmpty() && colors.contains("colorless")) {
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless("Select Mana to Produce", sa.getHostCard(), ColorSet.fromMask(mask)));
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa.getHostCard(), ColorSet.fromMask(mask)));
|
||||
} else {
|
||||
// Nothing set previously so ask player if needed
|
||||
if (mask == 0) {
|
||||
@@ -78,14 +79,14 @@ public class ManaReflectedEffect extends SpellAbilityEffect {
|
||||
baseMana = MagicColor.toShortString(colors.iterator().next());
|
||||
} else {
|
||||
if (colors.contains("colorless")) {
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless("Select Mana to Produce", sa.getHostCard(), ColorSet.fromNames(colors)));
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa.getHostCard(), ColorSet.fromNames(colors)));
|
||||
} else {
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColor("Select Mana to Produce", sa, ColorSet.fromNames(colors)));
|
||||
baseMana = MagicColor.toShortString(player.getController().chooseColor(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa, ColorSet.fromNames(colors)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
colorMenu = ColorSet.fromMask(mask);
|
||||
byte color = sa.getActivatingPlayer().getController().chooseColor("Select Mana to Produce", sa, colorMenu);
|
||||
byte color = sa.getActivatingPlayer().getController().chooseColor(Localizer.getInstance().getMessage("lblSelectManaProduce"), sa, colorMenu);
|
||||
if (color == 0) {
|
||||
System.err.println("Unexpected behavior in ManaReflectedEffect: " + sa.getActivatingPlayer() + " - color mana choice is empty for " + sa.getHostCard().getName());
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.card.CardUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class ManifestEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -42,7 +43,7 @@ public class ManifestEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : "Choose cards to manifest ";
|
||||
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseCardToManifest") + " ";
|
||||
tgtCards = new CardCollection(activator.getController().chooseEntitiesForEffect(choices, amount, amount, null, sa, title, p));
|
||||
} else if ("TopOfLibrary".equals(defined)) {
|
||||
tgtCards = p.getTopXCardsFromLibrary(amount);
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.PlayerZoneBattlefield;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class MeldEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -35,7 +36,7 @@ public class MeldEffect extends SpellAbilityEffect {
|
||||
return;
|
||||
}
|
||||
|
||||
Card secondary = controller.getController().chooseSingleEntityForEffect(field, sa, "Choose card to meld with");
|
||||
Card secondary = controller.getController().chooseSingleEntityForEffect(field, sa, Localizer.getInstance().getMessage("lblChooseCardToMeld"));
|
||||
|
||||
secondary = game.getAction().exile(secondary, sa);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import forge.game.zone.ZoneType;
|
||||
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class MillEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -39,7 +40,7 @@ public class MillEffect extends SpellAbilityEffect {
|
||||
for (final Player p : getTargetPlayers(sa)) {
|
||||
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
|
||||
if (sa.hasParam("Optional")) {
|
||||
final String prompt = TextUtil.concatWithSpace("Do you want to put card(s) from library to", TextUtil.addSuffix(destination.toString(),"?"));
|
||||
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantPutLibraryCardsTo", destination.getTranslatedName()));
|
||||
if (!p.getController().confirmAction(sa, null, prompt)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -85,7 +86,7 @@ public class MultiplePilesEffect extends SpellAbilityEffect {
|
||||
|
||||
for (int i = 1; i < piles; i++) {
|
||||
int size = pool.size();
|
||||
CardCollectionView pile = p.getController().chooseCardsForEffect(pool, sa, "Choose cards in Pile " + i, 0, size, false);
|
||||
CardCollectionView pile = p.getController().chooseCardsForEffect(pool, sa, Localizer.getInstance().getMessage("lblChooseCardsInTargetPile", String.valueOf(i)), 0, size, false);
|
||||
pileList.add(pile);
|
||||
pool.removeAll(pile);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,11 +53,11 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
||||
CardCollectionView revealableCards = CardLists.getValidCards(peekCards, revealValid, sa.getActivatingPlayer(), sa.getHostCard());
|
||||
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
|
||||
if (!sa.hasParam("NoPeek")) {
|
||||
peekingPlayer.getController().reveal(peekCards, ZoneType.Library, peekingPlayer, source + " - Revealing cards from ");
|
||||
peekingPlayer.getController().reveal(peekCards, ZoneType.Library, peekingPlayer, source + " - " + Localizer.getInstance().getMessage("lblRevealingCardFrom") + " ");
|
||||
}
|
||||
|
||||
if( doReveal && sa.hasParam("RevealOptional") )
|
||||
doReveal = peekingPlayer.getController().confirmAction(sa, null, "Reveal cards to other players?");
|
||||
doReveal = peekingPlayer.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRevealCardToOtherPlayers"));
|
||||
|
||||
if (doReveal) {
|
||||
peekingPlayer.getGame().getAction().reveal(revealableCards, peekingPlayer);
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.game.ability.effects;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Localizer;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
@@ -13,7 +14,7 @@ public class PermanentCreatureEffect extends PermanentEffect {
|
||||
public String getStackDescription(final SpellAbility sa) {
|
||||
final Card sourceCard = sa.getHostCard();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(sourceCard.getName()).append(" - Creature ").append(sourceCard.getNetPower());
|
||||
sb.append(sourceCard.getName()).append(" - ").append(Localizer.getInstance().getMessage("lblCreature")).append(" ").append(sourceCard.getNetPower());
|
||||
sb.append(" / ").append(sourceCard.getNetToughness());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package forge.game.ability.effects;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.util.TextUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -32,6 +31,8 @@ import forge.game.zone.ZoneType;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
public class PlayEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
@@ -117,7 +118,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
final int choicenum = AbilityUtils.calculateAmount(source, sa.getParam("ChoiceNum"), sa);
|
||||
tgtCards = new CardCollection(
|
||||
activator.getController().chooseCardsForEffect(choice, sa,
|
||||
source + " - Choose up to " + Lang.nounWithNumeral(choicenum, "card"), 0, choicenum, true
|
||||
source + " - " + Localizer.getInstance().getMessage("lblChooseUpTo") + " " + Lang.nounWithNumeral(choicenum, "card"), 0, choicenum, true
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -144,7 +145,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
final CardCollection saidNoTo = new CardCollection();
|
||||
while (tgtCards.size() > saidNoTo.size() && saidNoTo.size() < amount && amount > 0) {
|
||||
activator.getController().tempShowCards(showCards);
|
||||
Card tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, "Select a card to play");
|
||||
Card tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"));
|
||||
activator.getController().endTempShowCards();
|
||||
if (tgtCard == null) {
|
||||
return;
|
||||
@@ -162,7 +163,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
game.getAction().revealTo(tgtCard, activator);
|
||||
}
|
||||
|
||||
if (optional && !controller.getController().confirmAction(sa, null, TextUtil.concatWithSpace("Do you want to play", TextUtil.addSuffix(tgtCard.toString(),"?")))) {
|
||||
if (optional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) {
|
||||
if (wasFaceDown) {
|
||||
tgtCard.turnFaceDownNoUpdate();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -51,7 +52,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
|
||||
final List<String> gains = new ArrayList<>();
|
||||
if (isChoice) {
|
||||
Player choser = sa.getActivatingPlayer();
|
||||
final String choice = choser.getController().chooseProtectionType("Choose a protection", sa, choices);
|
||||
final String choice = choser.getController().chooseProtectionType(Localizer.getInstance().getMessage("lblChooseAProtection"), sa, choices);
|
||||
if( null == choice)
|
||||
return;
|
||||
gains.add(choice);
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -106,9 +107,9 @@ public class ProtectEffect extends SpellAbilityEffect {
|
||||
if (isChoice && !choices.isEmpty()) {
|
||||
Player choser = sa.getActivatingPlayer();
|
||||
if (sa.hasParam("Choser") && sa.getParam("Choser").equals("Controller") && !tgtCards.isEmpty()) {
|
||||
choser = tgtCards.get(0).getController();
|
||||
choser = tgtCards.get(0).getController();
|
||||
}
|
||||
final String choice = choser.getController().chooseProtectionType("Choose a protection", sa, choices);
|
||||
final String choice = choser.getController().chooseProtectionType(Localizer.getInstance().getMessage("lblChooseAProtection"), sa, choices);
|
||||
if( null == choice)
|
||||
return;
|
||||
gains.add(choice);
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -214,7 +215,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
sb.append(atk);
|
||||
sb.append("/");
|
||||
if (def >= 0) {
|
||||
sb.append("+");
|
||||
sb.append("+");
|
||||
}
|
||||
sb.append(def);
|
||||
sb.append(" ");
|
||||
@@ -327,7 +328,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
final String targets = Lang.joinHomogenous(tgtCards);
|
||||
final String message = sa.hasParam("OptionQuestion")
|
||||
? TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets)
|
||||
: TextUtil.concatNoSpace("Apply pump to ", targets, "?");
|
||||
: Localizer.getInstance().getMessage("lblApplyPumpToTarget", targets);
|
||||
|
||||
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message)) {
|
||||
return;
|
||||
|
||||
@@ -10,6 +10,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -116,7 +117,7 @@ public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
||||
Card next = orderedCards.get(i);
|
||||
player.getGame().getAction().moveToLibrary(next, 0, sa);
|
||||
}
|
||||
if (mayshuffle && activator.getController().confirmAction(sa, null, "Do you want to shuffle the library?")) {
|
||||
if (mayshuffle && activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantShuffleTheLibrary"))) {
|
||||
player.shuffle(sa);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect {
|
||||
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
for (final Card c : getTargetCards(sa)) {
|
||||
final Combat combat = game.getPhaseHandler().getCombat();
|
||||
final Combat combat = game.getPhaseHandler().getCombat();
|
||||
if (combat != null && (tgt == null || c.canBeTargetedBy(sa))) {
|
||||
// Unblock creatures that were blocked only by this card (e.g. Ydwen Efreet)
|
||||
if (sa.hasParam("UnblockCreaturesBlockedOnlyBy")) {
|
||||
@@ -58,7 +58,7 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
combat.removeFromCombat(c);
|
||||
combat.removeFromCombat(c);
|
||||
|
||||
if (rem) {
|
||||
sa.getHostCard().addRemembered(c);
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -167,7 +168,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
||||
if (random) {
|
||||
p = Aggregates.random(game.getPlayers());
|
||||
} else {
|
||||
p = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(game.getPlayers(), sa, "Choose a player");
|
||||
p = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(game.getPlayers(), sa, Localizer.getInstance().getMessage("lblChoosePlayer"));
|
||||
}
|
||||
if (recordMap.containsKey(p)) {
|
||||
recordMap.get(p).add(0, card);
|
||||
@@ -188,7 +189,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
||||
valid = CardLists.filterControlledBy(valid,
|
||||
game.getNextPlayerAfter(p, source.getChosenDirection()));
|
||||
}
|
||||
Card card = p.getController().chooseSingleEntityForEffect(valid, sa, "Choose a card");
|
||||
Card card = p.getController().chooseSingleEntityForEffect(valid, sa, Localizer.getInstance().getMessage("lblChooseaCard"));
|
||||
if (recordMap.containsKey(p)) {
|
||||
recordMap.get(p).add(0, card);
|
||||
} else {
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.game.spellability.AbilitySub;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Expressions;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class RepeatEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -49,14 +50,14 @@ public class RepeatEffect extends SpellAbilityEffect {
|
||||
if (maxRepeat != null && maxRepeat <= count) {
|
||||
// TODO Replace Infinite Loop Break with a game draw. Here are the scenarios that can cause this:
|
||||
// Helm of Obedience vs Graveyard to Library replacement effect
|
||||
|
||||
if(source.getName().equals("Helm of Obedience")) {
|
||||
|
||||
if(source.getName().equals("Helm of Obedience")) {
|
||||
StringBuilder infLoop = new StringBuilder(sa.getHostCard().toString());
|
||||
infLoop.append(" - To avoid an infinite loop, this repeat has been broken ");
|
||||
infLoop.append(" and the game will now continue in the current state, ending the loop early. ");
|
||||
infLoop.append("Once Draws are available this probably should change to a Draw.");
|
||||
System.out.println(infLoop.toString());
|
||||
}
|
||||
infLoop.append(" - To avoid an infinite loop, this repeat has been broken ");
|
||||
infLoop.append(" and the game will now continue in the current state, ending the loop early. ");
|
||||
infLoop.append("Once Draws are available this probably should change to a Draw.");
|
||||
System.out.println(infLoop.toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (checkRepeatConditions(sa));
|
||||
@@ -129,7 +130,7 @@ public class RepeatEffect extends SpellAbilityEffect {
|
||||
Player decider = sa.hasParam("RepeatOptionalDecider")
|
||||
? AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("RepeatOptionalDecider"), sa).get(0)
|
||||
: sa.getActivatingPlayer();
|
||||
return decider.getController().confirmAction(sa, null, "Do you want to repeat this process again?");
|
||||
return decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRepeatProcessAgain"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ReplaceDamageEffect extends SpellAbilityEffect {
|
||||
prevent -= n;
|
||||
|
||||
if (card.getType().hasStringType("Effect") && prevent <= 0) {
|
||||
game.getAction().exile(card, null);
|
||||
game.getAction().exile(card, null);
|
||||
} else if (!StringUtils.isNumeric(varValue)) {
|
||||
card.setSVar(varValue, "Number$" + prevent);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ReplaceSplitDamageEffect extends SpellAbilityEffect {
|
||||
prevent -= n;
|
||||
|
||||
if (card.getType().hasStringType("Effect") && prevent <= 0) {
|
||||
game.getAction().exile(card, null);
|
||||
game.getAction().exile(card, null);
|
||||
} else if (!StringUtils.isNumeric(varValue)) {
|
||||
card.setSVar(varValue, "Number$" + prevent);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class RevealHandEffect extends SpellAbilityEffect {
|
||||
|
||||
for (final Player p : getTargetPlayers(sa)) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
if (optional && !p.getController().confirmAction(sa, null, "Do you want to reveal your hand?")) {
|
||||
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRevealYourHand"))) {
|
||||
continue;
|
||||
}
|
||||
final CardCollectionView hand = p.getCardsIn(ZoneType.Hand);
|
||||
|
||||
@@ -5,6 +5,7 @@ import forge.game.PlanarDice;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Localizer;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
@@ -25,7 +26,7 @@ public class RollPlanarDiceEffect extends SpellAbilityEffect {
|
||||
game.getPhaseHandler().incPlanarDiceRolledthisTurn();
|
||||
}
|
||||
PlanarDice result = PlanarDice.roll(activator, null);
|
||||
String message = activator.getName() + " rolled " + result.toString();
|
||||
String message = Localizer.getInstance().getMessage("lblPlayerRolledResult", activator.getName(), result.toString());
|
||||
game.getAction().nofityOfValue(sa, activator, message, null);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ public class RunSVarAbilityEffect extends SpellAbilityEffect {
|
||||
String sVars = sa.getParam("SVars");
|
||||
List<Card> cards = getTargetCards(sa);
|
||||
if (sVars == null || cards.isEmpty()) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
List<SpellAbility> validSA = new ArrayList<>();
|
||||
final boolean isTrigger = sa.hasParam("IsTrigger");
|
||||
for (final Card tgtC : cards) {
|
||||
if (!tgtC.hasSVar(sVars)) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
final SpellAbility actualSA = AbilityFactory.getAbility(tgtC.getSVar(sVars), tgtC);
|
||||
actualSA.setTrigger(isTrigger);
|
||||
actualSA.setActivatingPlayer(sa.getActivatingPlayer());
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,11 +31,11 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("Echo")) {
|
||||
boolean isPaid;
|
||||
if (activator.hasKeyword("You may pay 0 rather than pay the echo cost for permanents you control.")
|
||||
&& activator.getController().confirmAction(sa, null, "Do you want to pay Echo {0}?")) {
|
||||
&& activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPayEcho") + " {0}?")) {
|
||||
isPaid = true;
|
||||
} else {
|
||||
isPaid = activator.getController().payManaOptional(card, new Cost(sa.getParam("Echo"), true),
|
||||
sa, "Pay Echo", ManaPaymentPurpose.Echo);
|
||||
sa, Localizer.getInstance().getMessage("lblPayEcho"), ManaPaymentPurpose.Echo);
|
||||
}
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(card);
|
||||
runParams.put(AbilityKey.EchoPaid, isPaid);
|
||||
@@ -117,7 +118,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
|
||||
if (sa.hasParam("Random")) {
|
||||
choosenToSacrifice = Aggregates.random(validTargets, Math.min(amount, validTargets.size()), new CardCollection());
|
||||
} else if (sa.hasParam("OptionalSacrifice") && !p.getController().confirmAction(sa, null, "Do you want to sacrifice?")) {
|
||||
} else if (sa.hasParam("OptionalSacrifice") && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantSacrifice"))) {
|
||||
choosenToSacrifice = CardCollection.EMPTY;
|
||||
} else {
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
@@ -156,21 +157,21 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Exploited, runParams, false);
|
||||
}
|
||||
if (wasDestroyed || wasSacrificed) {
|
||||
countSacrificed++;
|
||||
if (remSacrificed) {
|
||||
card.addRemembered(lKICopy);
|
||||
}
|
||||
countSacrificed++;
|
||||
if (remSacrificed) {
|
||||
card.addRemembered(lKICopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (remSVar != null) {
|
||||
card.setSVar(remSVar, String.valueOf(countSacrificed));
|
||||
SpellAbility root = sa;
|
||||
do {
|
||||
root.setSVar(remSVar, String.valueOf(countSacrificed));
|
||||
root = root.getSubAbility();
|
||||
} while (root != null);
|
||||
card.setSVar(remSVar, String.valueOf(countSacrificed));
|
||||
SpellAbility root = sa;
|
||||
do {
|
||||
root.setSVar(remSVar, String.valueOf(countSacrificed));
|
||||
root = root.getSubAbility();
|
||||
} while (root != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,10 +194,10 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), num, sa);
|
||||
|
||||
if (valid.equals("Self")) {
|
||||
sb.append("Sacrifice ").append(sa.getHostCard().toString());
|
||||
sb.append("Sacrifices ").append(sa.getHostCard().toString());
|
||||
} else if (valid.equals("Card.AttachedBy")) {
|
||||
final Card toSac = sa.getHostCard().getEnchantingCard();
|
||||
sb.append(toSac.getController()).append(" sacrifices ").append(toSac).append(".");
|
||||
sb.append(toSac.getController()).append(" Sacrifices ").append(toSac).append(".");
|
||||
} else {
|
||||
for (final Player p : tgts) {
|
||||
sb.append(p.getName()).append(" ");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user