mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added PermanentNoncreature AF
- Converted Standstill and Bridge from Below to script
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -12650,6 +12650,7 @@ src/main/java/forge/card/abilityfactory/ai/MillAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/MustAttackAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/MustBlockAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/PermanentCreatureAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/PermanentNoncreatureAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/PhasesAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/PlayAi.java -text
|
||||
src/main/java/forge/card/abilityfactory/ai/PoisonAi.java -text
|
||||
@@ -12748,6 +12749,7 @@ src/main/java/forge/card/abilityfactory/effects/MillEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/MustAttackEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/MustBlockEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/PermanentCreatureEfect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/PermanentNoncreatureEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/PhasesEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/PlayEffect.java -text
|
||||
src/main/java/forge/card/abilityfactory/effects/PoisonEffect.java -text
|
||||
|
||||
@@ -2,6 +2,7 @@ Name:Bridge from Below
|
||||
ManaCost:B B B
|
||||
Types:Enchantment
|
||||
Text:no text
|
||||
A:SP$ PermanentNoncreature | Cost$ B B B | AILogic$ DontCast
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.nonToken+YouOwn | Execute$ TrigToken | TriggerZones$ Graveyard | TriggerDescription$ Whenever a nontoken creature is put into your graveyard from the battlefield, if CARDNAME is in your graveyard, put a 2/2 black Zombie creature token onto the battlefield.
|
||||
SVar:TrigToken:AB$ Token | Cost$ 0 | TokenAmount$ 1 | TokenName$ Zombie | TokenTypes$ Creature,Zombie | TokenOwner$ You | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Graveyard | ValidCard$ Creature.OppOwn | Execute$ TrigChange | TriggerDescription$ When a creature is put into an opponent's graveyard from the battlefield, if CARDNAME is in your graveyard, exile Bridge from Below.
|
||||
|
||||
@@ -2,6 +2,7 @@ Name:Standstill
|
||||
ManaCost:1 U
|
||||
Types:Enchantment
|
||||
Text:no text
|
||||
A:SP$ PermanentNoncreature | Cost$ 1 U | AILogic$ MoreCreatures
|
||||
T:Mode$ SpellCast | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigSacYou | TriggerDescription$ When a player casts a spell, sacrifice CARDNAME. If you do, each of that player's opponents draws three cards.
|
||||
T:Mode$ SpellCast | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigSacOpp | Secondary$ True | TriggerDescription$ When a player casts a spell, sacrifice CARDNAME. If you do, each of that player's opponents draws three cards.
|
||||
#Must use SacrificeAll since regular sacrifice can't remember the sac'd cards atm.
|
||||
|
||||
@@ -233,7 +233,7 @@ public class AbilityFactory {
|
||||
}
|
||||
}
|
||||
|
||||
else if (api == ApiType.PermanentCreature) {
|
||||
else if (api == ApiType.PermanentCreature || api == ApiType.PermanentNoncreature) {
|
||||
// If API is a permanent type, and creating AF Spell
|
||||
// Clear out the auto created SpellPemanent spell
|
||||
if (isSp) {
|
||||
|
||||
@@ -64,6 +64,7 @@ public enum ApiType {
|
||||
MustBlock (MustBlockEffect.class, MustBlockAi.class),
|
||||
NameCard (ChooseCardNameEffect.class, ChooseCardNameAi.class),
|
||||
PermanentCreature (PermanentCreatureEfect.class, PermanentCreatureAi.class),
|
||||
PermanentNoncreature (PermanentNoncreatureEffect.class, PermanentNoncreatureAi.class),
|
||||
Phases (PhasesEffect.class, PhasesAi.class),
|
||||
Play (PlayEffect.class, PlayAi.class),
|
||||
Poison (PoisonEffect.class, PoisonAi.class),
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package forge.card.abilityfactory.ai;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.SpellAiLogic;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.GameState;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.ComputerUtil;
|
||||
import forge.game.player.Player;
|
||||
|
||||
/**
|
||||
* AbilityFactory for Creature Spells.
|
||||
*
|
||||
*/
|
||||
public class PermanentNoncreatureAi extends SpellAiLogic {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
|
||||
String logic = sa.getParam("AILogic");
|
||||
GameState game = Singletons.getModel().getGame();
|
||||
|
||||
if ("DontCast".equals(logic)) {
|
||||
return false;
|
||||
} else if ("MoreCreatures".equals(logic)) {
|
||||
return (aiPlayer.getCreaturesInPlay().size() > aiPlayer.getOpponent().getCreaturesInPlay().size());
|
||||
}
|
||||
|
||||
// Wait for Main2 if possible
|
||||
if (game.getPhaseHandler().is(PhaseType.MAIN1)
|
||||
&& !ComputerUtil.castPermanentInMain1(aiPlayer, sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AI shouldn't be retricted all that much for Creatures for now
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package forge.card.abilityfactory.effects;
|
||||
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.SpellEffect;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class PermanentNoncreatureEffect extends SpellEffect {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.abilityfactory.SpellEffect#resolve(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
sa.getSourceCard().addController(sa.getActivatingPlayer());
|
||||
final Card c = Singletons.getModel().getGame().getAction().moveTo(sa.getActivatingPlayer().getZone(ZoneType.Battlefield), sa.getSourceCard());
|
||||
sa.setSourceCard(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStackDescription(final SpellAbility sa) {
|
||||
final Card sourceCard = sa.getSourceCard();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(sourceCard.getName());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.card.spellability.Ability;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellPermanent;
|
||||
import forge.control.input.Input;
|
||||
import forge.game.GameLossReason;
|
||||
import forge.game.player.Player;
|
||||
@@ -33,24 +32,8 @@ class CardFactoryEnchantments {
|
||||
*/
|
||||
public static void buildCard(final Card card, final String cardName) {
|
||||
|
||||
if (cardName.equals("Bridge from Below")) {
|
||||
final SpellAbility spell = new SpellPermanent(card) {
|
||||
private static final long serialVersionUID = 7254358703158629514L;
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Do not remove SpellAbilities created by AbilityFactory or
|
||||
// Keywords.
|
||||
card.clearFirstSpell();
|
||||
card.addSpellAbility(spell);
|
||||
}
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Night Soil")) {
|
||||
if (cardName.equals("Night Soil")) {
|
||||
final SpellAbility nightSoil = new Ability(card, "1") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
@@ -140,30 +123,6 @@ class CardFactoryEnchantments {
|
||||
card.addSpellAbility(nightSoil);
|
||||
} // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Standstill")) {
|
||||
|
||||
// Do not remove SpellAbilities created by AbilityFactory or
|
||||
// Keywords.
|
||||
card.clearFirstSpell();
|
||||
|
||||
card.addSpellAbility(new SpellPermanent(card) {
|
||||
private static final long serialVersionUID = 6912683989507840172L;
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final List<Card> compCreats = getActivatingPlayer().getCreaturesInPlay();
|
||||
final List<Card> humCreats = getActivatingPlayer().getOpponent().getCreaturesInPlay();
|
||||
|
||||
// only play standstill if comp controls more creatures than
|
||||
// human
|
||||
// this needs some additional rules, maybe add all power +
|
||||
// toughness and compare
|
||||
return (compCreats.size() > humCreats.size());
|
||||
}
|
||||
});
|
||||
} // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Lich")) {
|
||||
final SpellAbility loseAllLife = new Ability(card, "0") {
|
||||
|
||||
Reference in New Issue
Block a user