mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 03:39:54 -08:00
Reworking card types in preparation for implementing Grist, the Hunger Tide (#7899)
Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
parent
07e1dff10c
commit
572104b8fc
1159 changed files with 2704 additions and 2203 deletions
|
|
@ -1034,7 +1034,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// planeswalker kill
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
int loy = permanent.getCounters(game).getCount(CounterType.LOYALTY);
|
||||
if (loy <= target.getAmountRemaining()) {
|
||||
return tryAddTarget(target, permanent.getId(), loy, source, game);
|
||||
|
|
@ -1044,7 +1044,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creature kill
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.getToughness().getValue() <= target.getAmountRemaining()) {
|
||||
return tryAddTarget(target, permanent.getId(), permanent.getToughness().getValue(), source, game);
|
||||
}
|
||||
|
|
@ -1064,7 +1064,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// planeswalkers
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -1079,7 +1079,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creature
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -1100,7 +1100,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creatures - non killable (TODO: add extra skill checks like undestructeable)
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
int safeDamage = Math.min(permanent.getToughness().getValue() - 1, target.getAmountRemaining());
|
||||
if (safeDamage > 0) {
|
||||
return tryAddTarget(target, permanent.getId(), safeDamage, source, game);
|
||||
|
|
@ -1110,14 +1110,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creatures - all
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
||||
// planeswalkers
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -1319,7 +1319,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
SpellAbility ability = card.getSpellAbility();
|
||||
if (ability != null && ability.canActivate(playerId, game).canActivate()
|
||||
&& !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability, playerId), ability, game, true)) {
|
||||
if (card.getCardType().contains(CardType.INSTANT)
|
||||
if (card.getCardType(game).contains(CardType.INSTANT)
|
||||
|| card.hasAbility(FlashAbility.getInstance(), game)) {
|
||||
playableInstant.add(card);
|
||||
} else {
|
||||
|
|
@ -1689,9 +1689,9 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (score > 0) { // score mana producers that produce other mana types and have other uses higher
|
||||
score += mageObject.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game).size();
|
||||
score += mageObject.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD).size();
|
||||
if (!mageObject.getCardType().contains(CardType.LAND)) {
|
||||
if (!mageObject.getCardType(game).contains(CardType.LAND)) {
|
||||
score += 2;
|
||||
} else if (mageObject.getCardType().contains(CardType.CREATURE)) {
|
||||
} else if (mageObject.getCardType(game).contains(CardType.CREATURE)) {
|
||||
score += 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1823,7 +1823,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
// choose a creature type of opponent on battlefield or graveyard
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) {
|
||||
if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
|
||||
&& permanent.getCardType().contains(CardType.CREATURE)
|
||||
&& permanent.getCardType(game).contains(CardType.CREATURE)
|
||||
&& !permanent.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(permanent.getSubtype(game).get(0).toString());
|
||||
|
|
@ -1836,7 +1836,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (UUID opponentId : game.getOpponents(this.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
for (Card card : opponent.getGraveyard().getCards(game)) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
|
@ -1852,7 +1852,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
// choose a creature type of hand or library
|
||||
for (UUID cardId : this.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
|
@ -1862,7 +1862,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (!choice.isChosen()) {
|
||||
for (UUID cardId : this.getLibrary().getCardList()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ public class PermanentEvaluator {
|
|||
// more score -- more valueable/powerfull permanent
|
||||
if (!values.containsKey(permanent.getId())) {
|
||||
int value = 0;
|
||||
if (permanent.isCreature()) {
|
||||
if (permanent.isCreature(game)) {
|
||||
value += combat.evaluate(permanent, game);
|
||||
}
|
||||
if (permanent.isPlaneswalker()) {
|
||||
if (permanent.isPlaneswalker(game)) {
|
||||
value += 2 * permanent.getCounters(game).getCount(CounterType.LOYALTY); // planeswalker is more valuable
|
||||
}
|
||||
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue