Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Forge
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
479
Issues
479
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Forge Core Developers
Forge
Commits
d11bafd2
Commit
d11bafd2
authored
Jul 30, 2018
by
Hans Mackowiak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GameAction: fixed putEtbCounters with Arixmethes
parent
3d85051f
Pipeline
#171
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
19 deletions
+60
-19
GameAction.java
forge-game/src/main/java/forge/game/GameAction.java
+21
-2
GameEntity.java
forge-game/src/main/java/forge/game/GameEntity.java
+1
-1
Card.java
forge-game/src/main/java/forge/game/card/Card.java
+26
-10
CardUtil.java
forge-game/src/main/java/forge/game/card/CardUtil.java
+5
-0
Player.java
forge-game/src/main/java/forge/game/player/Player.java
+7
-6
No files found.
forge-game/src/main/java/forge/game/GameAction.java
View file @
d11bafd2
...
...
@@ -252,11 +252,24 @@ public class GameAction {
Card
noLandLKI
=
CardUtil
.
getLKICopy
(
c
);
// this check needs to check if this card would be on the battlefield
noLandLKI
.
setLastKnownZone
(
zoneTo
);
CardCollection
preList
=
new
CardCollection
(
noLandLKI
);
checkStaticAbilities
(
false
,
Sets
.
newHashSet
(
noLandLKI
),
preList
);
// fake etb counters thing, then if something changed,
// need to apply checkStaticAbilities again
if
(!
noLandLKI
.
isLand
())
{
if
(
noLandLKI
.
putEtbCounters
())
{
// counters are added need to check again
checkStaticAbilities
(
false
,
Sets
.
newHashSet
(
noLandLKI
),
preList
);
}
}
if
(
noLandLKI
.
isLand
())
{
// if it isn't on the Stack, it stays in that Zone
if
(!
c
.
getZone
().
is
(
ZoneType
.
Stack
))
{
return
c
;
}
// if something would only be a land when entering the battlefield and not before
// put it into the graveyard instead
zoneTo
=
c
.
getOwner
().
getZone
(
ZoneType
.
Graveyard
);
...
...
@@ -264,6 +277,9 @@ public class GameAction {
copied
.
setState
(
CardStateName
.
Original
,
false
);
copied
.
setManifested
(
false
);
copied
.
updateStateForView
();
// not to battlefield anymore!
toBattlefield
=
false
;
}
}
...
...
@@ -359,7 +375,10 @@ public class GameAction {
// do ETB counters after StaticAbilities check
if
(!
suppress
)
{
if
(
toBattlefield
)
{
copied
.
putEtbCounters
();
if
(
copied
.
putEtbCounters
())
{
// if counter where put of card, call checkStaticAbilities again
checkStaticAbilities
();
}
}
copied
.
clearEtbCounters
();
}
...
...
forge-game/src/main/java/forge/game/GameEntity.java
View file @
d11bafd2
...
...
@@ -366,7 +366,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
abstract
public
void
setCounters
(
final
Map
<
CounterType
,
Integer
>
allCounters
);
abstract
public
boolean
canReceiveCounters
(
final
CounterType
type
);
abstract
public
void
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
,
final
boolean
fireEvents
);
abstract
public
int
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
,
final
boolean
fireEvents
);
abstract
public
void
subtractCounter
(
final
CounterType
counterName
,
final
int
n
);
abstract
public
void
clearCounters
();
...
...
forge-game/src/main/java/forge/game/card/Card.java
View file @
d11bafd2
...
...
@@ -1082,18 +1082,19 @@ public class Card extends GameEntity implements Comparable<Card> {
countersAdded
=
value
;
}
public
final
void
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
true
);
public
final
int
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
return
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
true
);
}
public
final
void
addCounterFireNoEvents
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
false
);
public
final
int
addCounterFireNoEvents
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
return
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
false
);
}
@Override
public
void
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
,
final
boolean
fireEvents
)
{
public
int
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
,
final
boolean
fireEvents
)
{
int
addAmount
=
n
;
if
(
addAmount
<
0
)
{
addAmount
=
0
;
// As per rule 107.1b
return
0
;
}
final
Map
<
String
,
Object
>
repParams
=
Maps
.
newHashMap
();
repParams
.
put
(
"Event"
,
"AddCounter"
);
...
...
@@ -1111,7 +1112,7 @@ public class Card extends GameEntity implements Comparable<Card> {
break
;
}
default
:
return
;
return
0
;
}
if
(
canReceiveCounters
(
counterType
))
{
...
...
@@ -1124,7 +1125,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
if
(
addAmount
<=
0
)
{
return
;
return
0
;
}
setTotalCountersToAdd
(
addAmount
);
...
...
@@ -1170,6 +1171,7 @@ public class Card extends GameEntity implements Comparable<Card> {
getController
().
addCounterToPermThisTurn
(
counterType
,
addAmount
);
view
.
updateCounters
(
this
);
}
return
addAmount
;
}
/**
...
...
@@ -5091,7 +5093,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public
boolean
isInZone
(
final
ZoneType
zone
)
{
Zone
z
=
get
Zone
();
Zone
z
=
this
.
getLastKnown
Zone
();
return
z
!=
null
&&
z
.
is
(
zone
);
}
...
...
@@ -5791,10 +5793,24 @@ public class Card extends GameEntity implements Comparable<Card> {
etbCounters
.
clear
();
}
public
final
void
putEtbCounters
()
{
public
final
Set
<
Table
.
Cell
<
Player
,
CounterType
,
Integer
>>
getEtbCounters
()
{
return
etbCounters
.
cellSet
();
}
public
final
boolean
putEtbCounters
()
{
boolean
changed
=
false
;
for
(
Table
.
Cell
<
Player
,
CounterType
,
Integer
>
e
:
etbCounters
.
cellSet
())
{
this
.
addCounter
(
e
.
getColumnKey
(),
e
.
getValue
(),
e
.
getRowKey
(),
true
);
CounterType
ct
=
e
.
getColumnKey
();
if
(
this
.
isLKI
())
{
if
(
canReceiveCounters
(
ct
))
{
setCounters
(
ct
,
getCounters
(
ct
)
+
e
.
getValue
());
changed
=
true
;
}
}
else
{
changed
|=
addCounter
(
ct
,
e
.
getValue
(),
e
.
getRowKey
(),
true
)
>
0
;
}
}
return
changed
;
}
public
final
void
clearTemporaryVars
()
{
...
...
forge-game/src/main/java/forge/game/card/CardUtil.java
View file @
d11bafd2
...
...
@@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableList;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Table
;
import
forge.ImageKeys
;
import
forge.card.CardStateName
;
...
...
@@ -270,6 +271,10 @@ public final class CardUtil {
newCopy
.
addImprintedCard
(
o
);
}
for
(
Table
.
Cell
<
Player
,
CounterType
,
Integer
>
cl
:
in
.
getEtbCounters
())
{
newCopy
.
addEtbCounter
(
cl
.
getColumnKey
(),
cl
.
getValue
(),
cl
.
getRowKey
());
}
newCopy
.
setUnearthed
(
in
.
isUnearthed
());
newCopy
.
setChangedCardColors
(
in
.
getChangedCardColors
());
...
...
forge-game/src/main/java/forge/game/player/Player.java
View file @
d11bafd2
...
...
@@ -876,20 +876,20 @@ public class Player extends GameEntity implements Comparable<Player> {
return
true
;
}
public
final
void
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
true
);
public
final
int
addCounter
(
final
CounterType
counterType
,
final
int
n
,
final
Player
source
,
final
boolean
applyMultiplier
)
{
return
addCounter
(
counterType
,
n
,
source
,
applyMultiplier
,
true
);
}
@Override
public
void
addCounter
(
CounterType
counterType
,
int
n
,
final
Player
source
,
boolean
applyMultiplier
,
boolean
fireEvents
)
{
public
int
addCounter
(
CounterType
counterType
,
int
n
,
final
Player
source
,
boolean
applyMultiplier
,
boolean
fireEvents
)
{
if
(!
canReceiveCounters
(
counterType
))
{
return
;
return
0
;
}
int
addAmount
=
n
;
if
(
addAmount
<=
0
)
{
// Can't add negative or 0 counters, bail out now
return
;
return
0
;
}
final
Map
<
String
,
Object
>
repParams
=
Maps
.
newHashMap
();
...
...
@@ -908,7 +908,7 @@ public class Player extends GameEntity implements Comparable<Player> {
break
;
}
default
:
return
;
return
0
;
}
final
int
oldValue
=
getCounters
(
counterType
);
...
...
@@ -925,6 +925,7 @@ public class Player extends GameEntity implements Comparable<Player> {
if
(
addAmount
>
0
)
{
getGame
().
getTriggerHandler
().
runTrigger
(
TriggerType
.
CounterAddedOnce
,
runParams
,
false
);
}
return
addAmount
;
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment