Merge remote-tracking branch 'core/master'

This commit is contained in:
Anthony Calosa
2021-02-20 06:57:10 +08:00
8 changed files with 1366 additions and 608 deletions

View File

@@ -1537,11 +1537,11 @@ public class AiController {
top = game.getStack().peekAbility(); top = game.getStack().peekAbility();
} }
final boolean topOwnedByAI = top != null && top.getActivatingPlayer().equals(player); final boolean topOwnedByAI = top != null && top.getActivatingPlayer().equals(player);
final boolean mustRespond = top != null && top.hasParam("AIRespondsToOwnAbility");
if (topOwnedByAI) { if (topOwnedByAI) {
// AI's own spell: should probably let my stuff resolve first, but may want to copy the SA or respond to it // AI's own spell: should probably let my stuff resolve first, but may want to copy the SA or respond to it
// in a scripted timed fashion. // in a scripted timed fashion.
final boolean mustRespond = top.hasParam("AIRespondsToOwnAbility");
if (!mustRespond) { if (!mustRespond) {
saList = ComputerUtilAbility.getSpellAbilities(cards, player); // get the SA list early to check for copy SAs saList = ComputerUtilAbility.getSpellAbilities(cards, player); // get the SA list early to check for copy SAs
@@ -1567,6 +1567,10 @@ public class AiController {
SpellAbility chosenSa = chooseSpellAbilityToPlayFromList(saList, true); SpellAbility chosenSa = chooseSpellAbilityToPlayFromList(saList, true);
if (topOwnedByAI && !mustRespond && chosenSa != ComputerUtilAbility.getFirstCopySASpell(saList)) {
return null; // not planning to copy the spell and not marked as something the AI would respond to
}
return chosenSa; return chosenSa;
} }

View File

@@ -310,6 +310,8 @@ public abstract class GameState {
newText.append("|Flipped"); newText.append("|Flipped");
} else if (c.getCurrentStateName().equals(CardStateName.Meld)) { } else if (c.getCurrentStateName().equals(CardStateName.Meld)) {
newText.append("|Meld"); newText.append("|Meld");
} else if (c.getCurrentStateName().equals(CardStateName.Modal)) {
newText.append("|Modal");
} }
if (c.isAttachedToEntity()) { if (c.isAttachedToEntity()) {
newText.append("|AttachedTo:").append(c.getEntityAttachedTo().getId()); newText.append("|AttachedTo:").append(c.getEntityAttachedTo().getId());
@@ -1252,6 +1254,9 @@ public abstract class GameState {
zone.setCards(kv.getValue()); zone.setCards(kv.getValue());
} }
} }
for (Card cmd : p.getCommanders()) {
p.getZone(ZoneType.Command).add(Player.createCommanderEffect(p.getGame(), cmd));
}
} }
/** /**
@@ -1322,7 +1327,10 @@ public abstract class GameState {
c.setState(CardStateName.Flipped, true); c.setState(CardStateName.Flipped, true);
} else if (info.startsWith("Meld")) { } else if (info.startsWith("Meld")) {
c.setState(CardStateName.Meld, true); c.setState(CardStateName.Meld, true);
} else if (info.startsWith("OnAdventure")) { } else if (info.startsWith("Modal")) {
c.setState(CardStateName.Modal, true);
}
else if (info.startsWith("OnAdventure")) {
String abAdventure = "DB$ Effect | RememberObjects$ Self | StaticAbilities$ Play | ExileOnMoved$ Exile | Duration$ Permanent | ConditionDefined$ Self | ConditionPresent$ Card.nonCopiedSpell"; String abAdventure = "DB$ Effect | RememberObjects$ Self | StaticAbilities$ Play | ExileOnMoved$ Exile | Duration$ Permanent | ConditionDefined$ Self | ConditionPresent$ Card.nonCopiedSpell";
AbilitySub saAdventure = (AbilitySub)AbilityFactory.getAbility(abAdventure, c); AbilitySub saAdventure = (AbilitySub)AbilityFactory.getAbility(abAdventure, c);
StringBuilder sbPlay = new StringBuilder(); StringBuilder sbPlay = new StringBuilder();
@@ -1334,10 +1342,8 @@ public abstract class GameState {
c.setExiledWith(c); // This seems to be the way it's set up internally. Potentially not needed here? c.setExiledWith(c); // This seems to be the way it's set up internally. Potentially not needed here?
c.setExiledBy(c.getController()); c.setExiledBy(c.getController());
} else if (info.startsWith("IsCommander")) { } else if (info.startsWith("IsCommander")) {
// TODO: This doesn't seem to properly restore the ability to play the commander. Why?
c.setCommander(true); c.setCommander(true);
player.setCommanders(Lists.newArrayList(c)); player.setCommanders(Lists.newArrayList(c));
player.getZone(ZoneType.Command).add(Player.createCommanderEffect(player.getGame(), c));
} else if (info.startsWith("Id:")) { } else if (info.startsWith("Id:")) {
int id = Integer.parseInt(info.substring(3)); int id = Integer.parseInt(info.substring(3));
idToCard.put(id, c); idToCard.put(id, c);

View File

@@ -26,7 +26,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
final PhaseHandler ph = aiPlayer.getGame().getPhaseHandler(); final PhaseHandler ph = aiPlayer.getGame().getPhaseHandler();
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
if (source.isPermanent() && sa.getRestrictions().isInstantSpeed() if (source.isPermanent() && !sa.getRestrictions().isSorcerySpeed()
&& (sa.getPayCosts().hasTapCost() || sa.getPayCosts().hasManaCost())) { && (sa.getPayCosts().hasTapCost() || sa.getPayCosts().hasManaCost())) {
// If it has an associated cost, try to only do this before own turn // If it has an associated cost, try to only do this before own turn
if (!(ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == aiPlayer)) { if (!(ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == aiPlayer)) {

View File

@@ -67,7 +67,7 @@ Staff of Zegon|ATQ
Strip Mine|ATQ Strip Mine|ATQ
Su-Chi|ATQ Su-Chi|ATQ
Tablet of Epityr|ATQ Tablet of Epityr|ATQ
#Tawnos's Coffin|ATQ Tawnos's Coffin|ATQ
Tawnos's Wand|ATQ Tawnos's Wand|ATQ
Tawnos's Weaponry|ATQ Tawnos's Weaponry|ATQ
Tetravus|ATQ Tetravus|ATQ
@@ -78,7 +78,7 @@ Triskelion|ATQ
Urza's Avenger|ATQ Urza's Avenger|ATQ
Urza's Chalice|ATQ Urza's Chalice|ATQ
Urza's Mine|ATQ Urza's Mine|ATQ
#Urza's Miter|ATQ Urza's Miter|ATQ
Urza's Power Plant|ATQ Urza's Power Plant|ATQ
Urza's Tower|ATQ Urza's Tower|ATQ
Wall of Spears|ATQ Wall of Spears|ATQ
@@ -146,7 +146,7 @@ Oasis|ARN
Old Man of the Sea|ARN Old Man of the Sea|ARN
Oubliette|ARN Oubliette|ARN
Piety|ARN Piety|ARN
#Pyramids|ARN Pyramids|ARN
Repentant Blacksmith|ARN Repentant Blacksmith|ARN
Ring of Ma'ruf|ARN Ring of Ma'ruf|ARN
Rukh Egg|ARN Rukh Egg|ARN
@@ -154,7 +154,7 @@ Sandals of Abdallah|ARN
Sandstorm|ARN Sandstorm|ARN
Serendib Djinn|ARN Serendib Djinn|ARN
Serendib Efreet|ARN Serendib Efreet|ARN
#Shahrazad|ARN Shahrazad|ARN
Sindbad|ARN Sindbad|ARN
Singing Tree|ARN Singing Tree|ARN
Sorceress Queen|ARN Sorceress Queen|ARN
@@ -162,7 +162,7 @@ Stone-Throwing Devils|ARN
Unstable Mutation|ARN Unstable Mutation|ARN
War Elephant|ARN War Elephant|ARN
Wyluli Wolf|ARN Wyluli Wolf|ARN
#Ydwen Efreet|ARN Ydwen Efreet|ARN
AErathi Berserker|LEG AErathi Berserker|LEG
Abomination|LEG Abomination|LEG
Acid Rain|LEG Acid Rain|LEG
@@ -226,7 +226,7 @@ Deadfall|LEG
Demonic Torment|LEG Demonic Torment|LEG
Devouring Deep|LEG Devouring Deep|LEG
Disharmony|LEG Disharmony|LEG
#Divine Intervention|LEG Divine Intervention|LEG
Divine Offering|LEG Divine Offering|LEG
Divine Transformation|LEG Divine Transformation|LEG
Dream Coat|LEG Dream Coat|LEG
@@ -263,11 +263,11 @@ Ghosts of the Damned|LEG
Giant Slug|LEG Giant Slug|LEG
Giant Strength|LEG Giant Strength|LEG
Giant Turtle|LEG Giant Turtle|LEG
#Glyph of Delusion|LEG Glyph of Delusion|LEG
Glyph of Destruction|LEG Glyph of Destruction|LEG
Glyph of Doom|LEG Glyph of Doom|LEG
Glyph of Life|LEG Glyph of Life|LEG
#Glyph of Reincarnation|LEG Glyph of Reincarnation|LEG
Gosta Dirk|LEG Gosta Dirk|LEG
Gravity Sphere|LEG Gravity Sphere|LEG
Great Defender|LEG Great Defender|LEG
@@ -292,7 +292,7 @@ Hunding Gjornersen|LEG
Hyperion Blacksmith|LEG Hyperion Blacksmith|LEG
Ichneumon Druid|LEG Ichneumon Druid|LEG
Immolation|LEG Immolation|LEG
#Imprison|LEG Imprison|LEG
In the Eye of Chaos|LEG In the Eye of Chaos|LEG
Indestructible Aura|LEG Indestructible Aura|LEG
Infernal Medusa|LEG Infernal Medusa|LEG
@@ -375,7 +375,7 @@ Ramirez DePietro|LEG
Ramses Overdark|LEG Ramses Overdark|LEG
Rapid Fire|LEG Rapid Fire|LEG
Rasputin Dreamweaver|LEG Rasputin Dreamweaver|LEG
#Rebirth|LEG Rebirth|LEG
Recall|LEG Recall|LEG
Red Mana Battery|LEG Red Mana Battery|LEG
Reincarnation|LEG Reincarnation|LEG
@@ -422,7 +422,7 @@ Syphon Soul|LEG
Takklemaggot|LEG Takklemaggot|LEG
Telekinesis|LEG Telekinesis|LEG
Teleport|LEG Teleport|LEG
#Tempest Efreet|LEG Tempest Efreet|LEG
Tetsuo Umezawa|LEG Tetsuo Umezawa|LEG
The Abyss|LEG The Abyss|LEG
The Brute|LEG The Brute|LEG
@@ -551,7 +551,7 @@ Earthbind|LEB
Earthquake|LEB Earthquake|LEB
Elvish Archers|LEB Elvish Archers|LEB
Evil Presence|LEB Evil Presence|LEB
#False Orders|LEB False Orders|LEB
Farmstead|LEB Farmstead|LEB
Fastbond|LEB Fastbond|LEB
Fear|LEB Fear|LEB
@@ -592,7 +592,7 @@ Hurricane|LEB
Hypnotic Specter|LEB Hypnotic Specter|LEB
Ice Storm|LEB Ice Storm|LEB
Icy Manipulator|LEB Icy Manipulator|LEB
#Illusionary Mask|LEB Illusionary Mask|LEB
Instill Energy|LEB Instill Energy|LEB
Invisibility|LEB Invisibility|LEB
Iron Star|LEB Iron Star|LEB
@@ -659,7 +659,7 @@ Phantom Monster|LEB
Pirate Ship|LEB Pirate Ship|LEB
Plague Rats|LEB Plague Rats|LEB
Plateau|LEB Plateau|LEB
#Power Leak|LEB Power Leak|LEB
Power Sink|LEB Power Sink|LEB
Power Surge|LEB Power Surge|LEB
Prodigal Sorcerer|LEB Prodigal Sorcerer|LEB
@@ -676,7 +676,7 @@ Resurrection|LEB
Reverse Damage|LEB Reverse Damage|LEB
Righteousness|LEB Righteousness|LEB
Roc of Kher Ridges|LEB Roc of Kher Ridges|LEB
#Rock Hydra|LEB Rock Hydra|LEB
Rod of Ruin|LEB Rod of Ruin|LEB
Royal Assassin|LEB Royal Assassin|LEB
Sacrifice|LEB Sacrifice|LEB
@@ -857,7 +857,7 @@ Scavenger Folk|DRK
#Season of the Witch|DRK #Season of the Witch|DRK
Sisters of the Flame|DRK Sisters of the Flame|DRK
Skull of Orm|DRK Skull of Orm|DRK
#Sorrow's Path|DRK Sorrow's Path|DRK
Spitting Slug|DRK Spitting Slug|DRK
Squire|DRK Squire|DRK
Standing Stones|DRK Standing Stones|DRK
@@ -874,8 +874,8 @@ Venom|DRK
Wand of Ith|DRK Wand of Ith|DRK
War Barge|DRK War Barge|DRK
Water Wurm|DRK Water Wurm|DRK
#Whippoorwill|DRK Whippoorwill|DRK
Witch Hunter|DRK Witch Hunter|DRK
Word of Binding|DRK Word of Binding|DRK
#Worms of the Earth|DRK Worms of the Earth|DRK
Wormwood Treefolk|DRK Wormwood Treefolk|DRK

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff