mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
* AI: fixed that computer can't target cards on battlefield if it contains tokens;
This commit is contained in:
parent
de07960ee5
commit
50195e8f35
4 changed files with 121 additions and 78 deletions
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.cards;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Abilities;
|
||||
|
|
@ -17,13 +14,16 @@ import mage.game.Game;
|
|||
import mage.game.GameState;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Card extends MageObject {
|
||||
|
||||
UUID getOwnerId();
|
||||
|
||||
String getCardNumber();
|
||||
|
||||
Rarity getRarity();
|
||||
Rarity getRarity(); // null for tokens
|
||||
|
||||
void setOwnerId(UUID ownerId);
|
||||
|
||||
|
|
@ -77,15 +77,15 @@ public interface Card extends MageObject {
|
|||
* @param zone
|
||||
* @param sourceId
|
||||
* @param game
|
||||
* @param flag If zone
|
||||
* <ul>
|
||||
* <li>LIBRARY: <ul><li>true - put on top</li><li>false - put on
|
||||
* bottom</li></ul></li>
|
||||
* <li>BATTLEFIELD: <ul><li>true - tapped</li><li>false -
|
||||
* untapped</li></ul></li>
|
||||
* <li>GRAVEYARD: <ul><li>true - not from Battlefield</li><li>false - from
|
||||
* Battlefield</li></ul></li>
|
||||
* </ul>
|
||||
* @param flag If zone
|
||||
* <ul>
|
||||
* <li>LIBRARY: <ul><li>true - put on top</li><li>false - put on
|
||||
* bottom</li></ul></li>
|
||||
* <li>BATTLEFIELD: <ul><li>true - tapped</li><li>false -
|
||||
* untapped</li></ul></li>
|
||||
* <li>GRAVEYARD: <ul><li>true - not from Battlefield</li><li>false - from
|
||||
* Battlefield</li></ul></li>
|
||||
* </ul>
|
||||
* @return true if card was moved to zone
|
||||
*/
|
||||
boolean moveToZone(Zone zone, UUID sourceId, Game game, boolean flag);
|
||||
|
|
@ -95,8 +95,8 @@ public interface Card extends MageObject {
|
|||
/**
|
||||
* Moves the card to an exile zone
|
||||
*
|
||||
* @param exileId set to null for generic exile zone
|
||||
* @param name used for exile zone with the specified exileId
|
||||
* @param exileId set to null for generic exile zone
|
||||
* @param name used for exile zone with the specified exileId
|
||||
* @param sourceId
|
||||
* @param game
|
||||
* @return true if card was moved to zone
|
||||
|
|
@ -122,7 +122,6 @@ public interface Card extends MageObject {
|
|||
List<Mana> getMana();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if there exists various art images for this card
|
||||
*/
|
||||
boolean getUsesVariousArt();
|
||||
|
|
@ -149,7 +148,6 @@ public interface Card extends MageObject {
|
|||
Card copy();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The main card of a split half card or adventure spell card, otherwise the card itself is
|
||||
* returned
|
||||
*/
|
||||
|
|
@ -169,7 +167,7 @@ public interface Card extends MageObject {
|
|||
|
||||
boolean removeAttachment(UUID permanentId, Game game);
|
||||
|
||||
default boolean isOwnedBy(UUID controllerId){
|
||||
default boolean isOwnedBy(UUID controllerId) {
|
||||
return getOwnerId().equals(controllerId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,22 +186,27 @@ public final class RateCard {
|
|||
// ratings from card rarity
|
||||
// some cards can have different rarity -- it's will be used from first set
|
||||
int newRating;
|
||||
switch (card.getRarity()) {
|
||||
case COMMON:
|
||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||
break;
|
||||
case UNCOMMON:
|
||||
newRating = DEFAULT_NOT_RATED_UNCOMMON_RATING;
|
||||
break;
|
||||
case RARE:
|
||||
newRating = DEFAULT_NOT_RATED_RARE_RATING;
|
||||
break;
|
||||
case MYTHIC:
|
||||
newRating = DEFAULT_NOT_RATED_MYTHIC_RATING;
|
||||
break;
|
||||
default:
|
||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||
break;
|
||||
if (card.getRarity() != null) {
|
||||
switch (card.getRarity()) {
|
||||
case COMMON:
|
||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||
break;
|
||||
case UNCOMMON:
|
||||
newRating = DEFAULT_NOT_RATED_UNCOMMON_RATING;
|
||||
break;
|
||||
case RARE:
|
||||
newRating = DEFAULT_NOT_RATED_RARE_RATING;
|
||||
break;
|
||||
case MYTHIC:
|
||||
newRating = DEFAULT_NOT_RATED_MYTHIC_RATING;
|
||||
break;
|
||||
default:
|
||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// tokens
|
||||
newRating = DEFAULT_NOT_RATED_CARD_RATING;
|
||||
}
|
||||
|
||||
int oldRating = baseRatings.getOrDefault(card.getName(), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue