mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Added ability to play cards that "Any Player May Play"
- AI may not be properly using it - Added flying pestilence ability for Ifh-Biff Efreet - Added both player usage of ability for Aluren - Fixed infinite loop in Aluren (We should bring back canPlayAI code for Aluren now)
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
Ifh-Biff Efreet
|
||||
2 G G
|
||||
Creature Efreet
|
||||
no text
|
||||
3/3
|
||||
Flying
|
||||
|
||||
Abyssal Horror
|
||||
4 B B
|
||||
Creature Horror
|
||||
@@ -20997,13 +21004,6 @@ Gift of Estates
|
||||
Sorcery
|
||||
If an opponent controls more lands than you, search your library for up to three Plains cards and put them into your hand.
|
||||
|
||||
Ifh-Biff Efreet
|
||||
2 G G
|
||||
Creature Efreet
|
||||
(NOTE: "G: Ifh-Biff Efreet deals 1 damage to each creature with flying and each player. Any player may activate this ability." not implemented.)
|
||||
3/3
|
||||
Flying
|
||||
|
||||
Arashi, the Sky Asunder
|
||||
3 G G
|
||||
Legendary Creature Spirit
|
||||
|
||||
@@ -235,6 +235,15 @@ public class Card extends MyObservable {
|
||||
return dealtCombatDmgToOppThisTurn;
|
||||
}
|
||||
|
||||
public boolean canAnyPlayerActivate() {
|
||||
for(SpellAbility s : spellAbility)
|
||||
{
|
||||
if (s.isAnyPlayer())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setDealtDmgToOppThisTurn(boolean b) {
|
||||
dealtDmgToOppThisTurn = b;
|
||||
}
|
||||
|
||||
@@ -15456,9 +15456,8 @@ public class CardFactory implements NewConstants {
|
||||
|
||||
ability1.setDescription("Any player may play creature cards with converted mana cost 3 or less without paying their mana cost any time he or she could play an instant.");
|
||||
ability1.setStackDescription("Aluren - Play creature with converted manacost 3 or less for free.");
|
||||
ability1.setAnyPlayer(true);
|
||||
card.addSpellAbility(ability1);
|
||||
ability1.setBeforePayMana(new Input_PayManaCost(ability1));
|
||||
|
||||
}
|
||||
//*************** END ************ END **************************
|
||||
|
||||
|
||||
@@ -20541,6 +20541,59 @@ public class CardFactory_Creatures {
|
||||
}
|
||||
//*************** END ************ END **************************
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Ifh-Biff Efreet")) {
|
||||
final SpellAbility ability = new Ability(card, "G") {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
//todo(sol) setting up some AI for next go through
|
||||
CardList human = new CardList(AllZone.Human_Play.getCards());
|
||||
CardList computer = new CardList(AllZone.Computer_Play.getCards());
|
||||
|
||||
human = human.getType("Creature").getKeyword("Flying");
|
||||
computer = computer.getType("Creature").getKeyword("Flying");
|
||||
|
||||
//int compLife = AllZone.Computer_Life.getLife();
|
||||
//int humanLife = AllZone.Human_Life.getLife();
|
||||
|
||||
// if complife > humanLife && humanlife <= available green mana, try to kill human
|
||||
|
||||
if (card.getController().equals(Constant.Player.Computer)){
|
||||
// needs to be careful activating ability if human has green mana available
|
||||
}
|
||||
else{
|
||||
// should try to kill human's flyers but spare own
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
//get all creatures
|
||||
CardList list = new CardList();
|
||||
list.addAll(AllZone.Human_Play.getCards());
|
||||
list.addAll(AllZone.Computer_Play.getCards());
|
||||
list = list.getType("Creature");
|
||||
list = list.getKeyword("Flying");
|
||||
|
||||
for(int i = 0; i < list.size(); i++) {
|
||||
if(CardFactoryUtil.canDamage(card, list.get(i))) list.get(i).addDamage(1, card);
|
||||
}
|
||||
|
||||
AllZone.Human_Life.subtractLife(1,card);
|
||||
AllZone.Computer_Life.subtractLife(1,card);
|
||||
}//resolve()
|
||||
};//SpellAbility
|
||||
ability.setDescription("G: Ifh-B<>ff Efreet deals 1 damage to each creature with flying and each player. Any player may activate this ability");
|
||||
ability.setStackDescription(card + " deals 1 damage to each flying creature and each player.");
|
||||
ability.setAnyPlayer(true);
|
||||
card.addSpellAbility(ability);
|
||||
}
|
||||
//*************** END ************ END **************************
|
||||
|
||||
//*************** START *********** START **************************
|
||||
if (cardName.equals("Roc Egg")) {
|
||||
final SpellAbility ability = new Ability(card, "0") {
|
||||
|
||||
@@ -119,6 +119,18 @@ public class ComputerUtil
|
||||
all.addAll(AllZone.Computer_Hand.getCards());
|
||||
all.addAll(CardFactoryUtil.getFlashbackUnearthCards(Constant.Player.Computer).toArray());
|
||||
|
||||
CardList humanPlayable = new CardList();
|
||||
humanPlayable.addAll(AllZone.Human_Play.getCards());
|
||||
humanPlayable = humanPlayable.filter(new CardListFilter()
|
||||
{
|
||||
public boolean addCard(Card c)
|
||||
{
|
||||
return (c.canAnyPlayerActivate());
|
||||
}
|
||||
});
|
||||
|
||||
all.addAll(humanPlayable.toArray());
|
||||
|
||||
all = all.filter(new CardListFilter()
|
||||
{
|
||||
public boolean addCard(Card c)
|
||||
|
||||
@@ -6,45 +6,44 @@ public class InputUtil
|
||||
//plays activated abilities and instants
|
||||
static public void playInstantAbility(Card card, PlayerZone zone)
|
||||
{
|
||||
if(zone.is(Constant.Zone.Hand) || zone.is(Constant.Zone.Play, Constant.Player.Human))
|
||||
if (zone.is(Constant.Zone.Hand, Constant.Player.Human) || zone.is(Constant.Zone.Play) &&
|
||||
(card.getController().equals(Constant.Player.Human) || card.canAnyPlayerActivate()))
|
||||
AllZone.GameAction.playCard(card);
|
||||
}
|
||||
|
||||
//plays activated abilities and any card including land, sorceries, and instants
|
||||
static public void playAnyCard(Card card, PlayerZone zone)
|
||||
{
|
||||
if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
||||
(card.isLand()))
|
||||
{
|
||||
|
||||
//hacky stuff: see if there's cycling/transmute/other hand abilities on the land:
|
||||
SpellAbility[] sa = card.getSpellAbility();
|
||||
if (sa.length > 0)
|
||||
if(zone.is(Constant.Zone.Hand, Constant.Player.Human)){ // activate from hand
|
||||
if (card.isLand())
|
||||
{
|
||||
int count = 0;
|
||||
for (SpellAbility s : sa)
|
||||
//hacky stuff: see if there's cycling/transmute/other hand abilities on the land:
|
||||
SpellAbility[] sa = card.getSpellAbility();
|
||||
if (sa.length > 0)
|
||||
{
|
||||
if (s.canPlay() && (s instanceof Ability_Hand))
|
||||
count++;
|
||||
int count = 0;
|
||||
for (SpellAbility s : sa)
|
||||
{
|
||||
if (s.canPlay() && (s instanceof Ability_Hand))
|
||||
count++;
|
||||
}
|
||||
if (count > 0)
|
||||
AllZone.GameAction.playCard(card);
|
||||
else //play the land
|
||||
GameAction.playLand(card, zone);
|
||||
}
|
||||
if (count > 0)
|
||||
AllZone.GameAction.playCard(card);
|
||||
else //play the land
|
||||
GameAction.playLand(card, zone);
|
||||
} //land
|
||||
else
|
||||
{
|
||||
AllZone.GameAction.playCard(card);
|
||||
}
|
||||
else //play the land
|
||||
GameAction.playLand(card, zone);
|
||||
} //land
|
||||
/**
|
||||
else if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
||||
card.getManaCost().equals("0"))//for Mox Ruby and the like
|
||||
{
|
||||
AllZone.Human_Hand.remove(card);
|
||||
AllZone.Stack.add(card.getSpellAbility()[0]);
|
||||
}
|
||||
**/
|
||||
else if (zone.is(Constant.Zone.Hand, Constant.Player.Human) || zone.is(Constant.Zone.Play, Constant.Player.Human)
|
||||
|| (zone.is(Constant.Zone.Play, Constant.Player.Computer)) && (card.isEquipment() || card.isAura()) && card.getController().equals(Constant.Player.Human) )
|
||||
AllZone.GameAction.playCard(card);
|
||||
}
|
||||
// (sol) Can activate if: You control it & it's in play or if your opponent controls it and Any Player Can activate.
|
||||
else if (zone.is(Constant.Zone.Play) &&
|
||||
(card.getController().equals(Constant.Player.Human) || card.canAnyPlayerActivate()))
|
||||
AllZone.GameAction.playCard(card);
|
||||
}//selectCard()
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public abstract class SpellAbility {
|
||||
private boolean multiKicker = false;
|
||||
private boolean xCost = false;
|
||||
private boolean kickerAbility = false;
|
||||
private boolean anyPlayer = false;
|
||||
|
||||
private Input beforePayMana;
|
||||
private Input afterResolve;
|
||||
@@ -174,6 +175,14 @@ public abstract class SpellAbility {
|
||||
return xCost;
|
||||
}
|
||||
|
||||
public void setAnyPlayer(boolean b) {
|
||||
anyPlayer = b;
|
||||
}
|
||||
|
||||
public boolean isAnyPlayer() {
|
||||
return anyPlayer;
|
||||
}
|
||||
|
||||
|
||||
public void setSourceCard(Card c) {
|
||||
sourceCard = c;
|
||||
|
||||
Reference in New Issue
Block a user