Refactor: Improve docstring for getPermanent and containsPermanent methods in Battlefield.java (#9115)

This commit is contained in:
DeepCrimson 2022-06-16 11:25:47 -07:00 committed by GitHub
parent 44f8377f7e
commit 6cf3af1d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,6 +156,14 @@ public class Battlefield implements Serializable {
field.put(permanent.getId(), permanent);
}
/**
* Find a permanent on the battlefield by its ID.
* If you are working with cards and want to know if it is on the battlefield then use game.getState().getZone() instead.
* Note that the card ID and permanant ID may be different (e.g. MDFC puts a half card on the battlefield, not the main card).
*
* @param key the UUID of a permanent to be retrieved
* @return the permanent matching the passed in UUID
*/
public Permanent getPermanent(UUID key) {
return field.get(key);
}
@ -165,12 +173,10 @@ public class Battlefield implements Serializable {
}
/**
* Find permanent on the battlefield by id. If you works with cards and want to check it on battlefield then
* use game.getState().getZone() instead. Card's id and permanent's id can be different (example: mdf card
* puts half card to battlefield, not the main card).
* Check whether the battlefield contains a permanent with the passed in UUID.
*
* @param key
* @return
* @param key the UUID whose existence we're checking for among permanents on the battlefield
* @return whether the passed in UUID matches a permanent on the battlefield
*/
public boolean containsPermanent(UUID key) {
return field.containsKey(key);