mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added AI support for Realmwright.
This commit is contained in:
@@ -3,10 +3,8 @@ ManaCost:U
|
||||
Types:Creature Vedalken Wizard
|
||||
PT:1/1
|
||||
K:ETBReplacement:Other:DBChooseBasic
|
||||
SVar:DBChooseBasic:DB$ ChooseType | Type$ Basic Land | SpellDescription$ As CARDNAME enters the battlefield, choose a basic land type.
|
||||
SVar:DBChooseBasic:DB$ ChooseType | Type$ Basic Land | AILogic$ MostNeededType | SpellDescription$ As CARDNAME enters the battlefield, choose a basic land type.
|
||||
S:Mode$ Continuous | Affected$ Land.YouCtrl | AddType$ ChosenType | Description$ Lands you control are the chosen type in addition to their other types.
|
||||
SVar:RemAIDeck:True
|
||||
SVar:Rarity:Common
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/realmwright.jpg
|
||||
SetInfo:GTC|Rare|http://magiccards.info/scans/en/gtc/45.jpg
|
||||
Oracle:As Realmwright enters the battlefield, choose a basic land type.\nLands you control are the chosen type in addition to their other types.
|
||||
|
||||
@@ -6,7 +6,6 @@ K:Enchant creature
|
||||
A:SP$ Attach | Cost$ 2 U B | ValidTgts$ Creature | AILogic$ GainControl
|
||||
A:AB$ Sacrifice | Cost$ Discard<2/Card> | AnyOpponent$ True | SacValid$ Self | SubAbility$ DBDraw | SpellDescription$ CARDNAME's controller sacrifices it, then draws two cards. Only any opponent may activate this ability.
|
||||
SVar:DBDraw:DB$ Draw | NumCards$ 2 | Defined$ SourceController
|
||||
SVar:RemAIDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/soul_ransom.jpg
|
||||
SetInfo:GTC|Rare|http://magiccards.info/scans/en/gtc/198.jpg
|
||||
Oracle:Enchant creature\nYou control enchanted creature.\nDiscard two cards: Soul Ransom's controller sacrifices it, then draws two cards. Only any opponent may activate this ability.
|
||||
|
||||
@@ -4,8 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardType;
|
||||
@@ -102,19 +105,19 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
|
||||
if (logic.equals("MostProminentOnBattlefield")) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield));
|
||||
}
|
||||
if (logic.equals("MostProminentComputerControls")) {
|
||||
else if (logic.equals("MostProminentComputerControls")) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(ai.getCardsIn(ZoneType.Battlefield));
|
||||
}
|
||||
if (logic.equals("MostProminentHumanControls")) {
|
||||
else if (logic.equals("MostProminentHumanControls")) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(opp.getCardsIn(ZoneType.Battlefield));
|
||||
if (!CardType.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), opp));
|
||||
}
|
||||
}
|
||||
if (logic.equals("MostProminentInComputerDeck")) {
|
||||
else if (logic.equals("MostProminentInComputerDeck")) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), ai));
|
||||
}
|
||||
if (logic.equals("MostProminentInComputerGraveyard")) {
|
||||
else if (logic.equals("MostProminentInComputerGraveyard")) {
|
||||
chosen = CardFactoryUtil.getMostProminentCreatureType(ai.getCardsIn(ZoneType.Graveyard));
|
||||
}
|
||||
}
|
||||
@@ -143,8 +146,38 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
|
||||
card.setChosenType(choice);
|
||||
}
|
||||
} else {
|
||||
// TODO AttachAI for ChosenType should have the exact same logic
|
||||
card.setChosenType("Island");
|
||||
Player ai = sa.getActivatingPlayer();
|
||||
String chosen = "";
|
||||
if (sa.hasParam("AILogic")) {
|
||||
final String logic = sa.getParam("AILogic");
|
||||
if (logic.equals("MostNeededType")) {
|
||||
// Choose a type that is in the deck, but not in hand or on the battlefield
|
||||
final ArrayList<String> basics = new ArrayList<String>();
|
||||
basics.addAll(Constant.CardTypes.BASIC_TYPES);
|
||||
List<Card> presentCards = ai.getCardsIn(ZoneType.Battlefield);
|
||||
presentCards.addAll(ai.getCardsIn(ZoneType.Hand));
|
||||
List<Card> possibleCards = ai.getAllCards();
|
||||
|
||||
for (String b : basics) {
|
||||
if(!Iterables.any(presentCards, CardPredicates.isType(b)) && Iterables.any(possibleCards, CardPredicates.isType(b))) {
|
||||
chosen = b;
|
||||
}
|
||||
}
|
||||
if (chosen.equals("")) {
|
||||
for (String b : basics) {
|
||||
if(Iterables.any(possibleCards, CardPredicates.isType(b))) {
|
||||
chosen = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!CardType.isABasicLandType(chosen) || invalidTypes.contains(chosen)) {
|
||||
chosen = "Island";
|
||||
}
|
||||
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||
card.setChosenType(chosen);
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user