Fixed several bugs, fixed several primitives, improved affnity for other types of cards, improved flip ability for token, added some new primitives from MAT set.

This commit is contained in:
Vittorio Alfieri
2023-05-23 20:29:43 +02:00
parent 1488bbc0f6
commit 675705a6e5
11 changed files with 616 additions and 334 deletions

View File

@@ -55,7 +55,7 @@
#AUTO_DEFINE _CONSTELLATION_ @movedTo(enchantment|myBattlefield):
# Amass, Set WAR
#AUTO_DEFINE _AMASS_($c) if type(army|mybattlefield)~morethan~0 then counter(1/1,$c) notATarget(army|myBattlefield) else create(Zombie Army:creature Zombie Army:0/0:black) and!(counter(1/1,$c) notATarget(army|myBattlefield))!
#AUTO_DEFINE _AMASS_($c) if type(army|mybattlefield)~morethan~0 then counter(1/1.$c) notATarget(army|myBattlefield) else create(Zombie Army:creature Zombie Army:0/0:black) and!(counter(1/1.$c) notATarget(army|myBattlefield))!
# Scry, Evergreen
#AUTO_DEFINE _SCRY_($c) scry:$c scrycore delayed dontshow donothing scrycoreend scryend
@@ -108,7 +108,7 @@
#AUTO_DEFINE _PROLIFERATE_ name(Proliferate) notatarget(proliferation) proliferate
# Scavenge
#AUTO_DEFINE _SCAVENGE_($power) name(scavenge) counter(1/1,$power) target(creature) asSorcery
#AUTO_DEFINE _SCAVENGE_($power) name(scavenge) counter(1/1.$power) target(creature) asSorcery
# Monstrosity, not implemented
#AUTO_DEFINE _MONSTROSITY_($cost,$c) name(Monstrosity) this(cantargetcard(*[-monstrous]) {$cost}:becomes(monstrous) forever && counter(1/1.$c)
@@ -143,7 +143,7 @@
#AUTO_DEFINE _CASTHISTORIC_ @movedTo(*[artifact;legendary;saga]|mystack):
# Mentor, still not working with enhancements, pump effects
#AUTO_DEFINE _MENTOR_ @combat(attacking) source(this):counter(1/1,1) target(other creature[attacking;power<=pminus1minusend]|myBattlefield)
#AUTO_DEFINE _MENTOR_ @combat(attacking) source(this):counter(1/1) target(other creature[attacking;power<=pminus1minusend]|myBattlefield)
# Surveil, like scry, using parameters causes bugs so each value has to be indicated
#AUTO_DEFINE _SURVEIL1_ name(Surveil 1) reveal:psurveiloffsetplus1plusend optionone name(put in graveyard) target(<upto:psurveiloffsetplus1plusend>*|reveal) moveto(ownergraveyard) optiononeend optiontwo name(put in library) target(<psurveiloffsetplus1plusend>*|reveal) moveto(ownerlibrary) optiontwoend afterrevealed surveil afterrevealedend revealend

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
#Primitives Pack for Wagic the Homebrew.
#Please keep these card alphabetized, and try to have the "name=" line at the top of each card
#I sorted this programatically so the other comments are removed except for AUTO_DEFINE - Vitty85 21-05-2023
#I sorted this programatically so the other comments are removed except for AUTO_DEFINE - Vitty85 23-05-2023
[card]
name=Abandon Reason
target=<upto:2>creature
@@ -10179,8 +10179,7 @@ type=Instant
[/card]
[card]
name=Bedlam Reveler
abilities=prowess
anyzone=foreach(instant,sorcery|mygraveyard) changecost(colorless:-1) forcedalive
abilities=prowess,affinitygraveinstsorc
auto=@movedTo(*[-creature]|mystack):1/1 ueot
auto=reject all(*|myhand) && draw:3
text=Bedlam Reveler costs {1} less to cast for each instant and sorcery card in your graveyard. -- Prowess (Whenever you cast a noncreature spell, this creature gets +1/+1 until end of turn.) -- When Bedlam Reveler enters the battlefield, discard your hand, then draw three cards.
@@ -11269,8 +11268,8 @@ type=Enchantment
[/card]
[card]
name=Blasphemous Act
abilities=affinityallcreatures
auto=damage:13 all(creature)
anyzone=foreach(creature|battlefield) changecost(colorless:-1) forcedalive
text=Blasphemous Act costs 1 less to cast for each creature on the battlefield. -- Blasphemous Act deals 13 damage to each creature.
mana={8}{R}
type=Sorcery
@@ -46041,7 +46040,7 @@ toughness=4
[/card]
[card]
name=Ghoultree
anyzone=foreach(creature|mygraveyard) changecost(colorless:-1) forcedalive
abilities=affinitygravecreatures
text=Ghoultree cost {1} less to cast for each creature card in your graveyard.
mana={7}{G}
type=Creature
@@ -88668,7 +88667,7 @@ type=Sorcery
[/card]
[card]
name=Primeval Protector
anyzone=foreach(creature|opponentbattlefield) changecost(colorless:-1) forcedalive
abilities=affinityopponentcreatures
auto=counter(1/1) all(other creature|mybattlefield)
text=Primeval Protector costs {1} less to cast for each creature your opponents control. -- When Primeval Protector enters the battlefield, put a +1/+1 counter on each other creature you control.
mana={10}{G}
@@ -113742,7 +113741,7 @@ toughness=2
[/card]
[card]
name=Stone Idol Trap
anyzone=foreach(creature[attacking]|battlefield) changecost(colorless:-1) forcedalive
abilities=affinityattackingcreatures
auto=token(Construct,Artifact Creature Construct,6/12,trample) and!( transforms((,newability[@next endofturn:moveTo(exile)])) forever )!
text=Stone Idol Trap costs {1} less to cast for each attacking creature. -- Put a 6/12 colorless Construct artifact creature token with trample onto the battlefield. Exile it at the beginning of your next end step.
mana={5}{R}
@@ -126604,7 +126603,7 @@ toughness=1
[card]
name=Urborg Justice
target=opponent
auto=ability$!name(sacrifice) target(<type:creature[fresh]:graveyard>creature|mybattlefield) sacrifice !$ targetedplayer
auto=ability$!name(sacrifice) target(<bothalldeadcreature>creature|mybattlefield) sacrifice !$ targetedplayer
text=Target opponent sacrifices a creature for each creature that died this turn.
mana={B}{B}
type=Instant

View File

@@ -1,6 +1,6 @@
#Planeswalkers Primitives Pack for Wagic the Homebrew.
#Please keep these card alphabetized, and try to have the "name=" line at the top of each card
#We sorted this in alphabetical order - Luruz & Vitty85 20-05-2023
#We sorted this in alphabetical order - Luruz & Vitty85 23-05-2023
[card]
name=Abian, Luvion Usurper
auto=counter(0/0,5,loyalty)
@@ -2499,7 +2499,7 @@ name=Saheeli, the Gifted
abilities=canbecommander
auto=counter(0/0,4,loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Create a 1/1 colorless Servo) _SERVOTOKEN_
auto={C(0/0,-1,Loyalty)}:name(-1: The next spell has affinity for artifacts) lord(*|mycastingzone):affinityartifacts oneshot
auto={C(0/0,1,Loyalty)}:name(-1: The next spell has affinity for artifacts) target(*|mycastingzone) transforms((,newability[affinityartifacts])) ueot
auto={C(0/0,-7,Loyalty)}:name(-7: Create a token for each artifact) clone all(artifact|mybattlefield) with (unreath)
text=+1: Create a 1/1 colorless Servo artifact creature token. -- +1: The next spell you cast this turn costs {1} less to cast for each artifact you control as you cast it. -- -7: For each artifact you control, create a token that's a copy of it. Those tokens gain haste. Exile those tokens at the beginning of the next end step. -- Saheeli, the Gifted can be your commander.
mana={2}{U}{R}

View File

@@ -343,7 +343,18 @@ class Constants
BOTTOMLIBRARYDEATH = 215,
NOLOYALTYDAMAGE = 216,
NODEFENSEDAMAGE = 217,
NB_BASIC_ABILITIES = 218,
AFFINITYALLCREATURES = 218,
AFFINITYCONTROLLERCREATURES = 219,
AFFINITYOPPONENTCREATURES = 220,
AFFINITYALLDEADCREATURES = 221,
AFFINITYPARTY = 222,
AFFINITYENCHANTMENTS = 223,
AFFINITYBASICLANDTYPES = 224,
AFFINITYTWOBASICLANDTYPES = 225,
AFFINITYGRAVECREATURES = 226,
AFFINITYATTACKINGCREATURES = 227,
AFFINITYGRAVEINSTSORC = 228,
NB_BASIC_ABILITIES = 229,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics

View File

@@ -4890,7 +4890,7 @@ int AAFlip::resolve()
if (_target)
{
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be flipped, they will follow the fate of top-card
if(((_target->isACopier||_target->isToken) && !isflipcard && !backfromcopy) || _target->has(Constants::CANTTRANSFORM))
if(((_target->isACopier||(_target->isToken && _target->backSide == "")) && !isflipcard && !backfromcopy) || _target->has(Constants::CANTTRANSFORM))
{
game->removeObserver(this);
return 0;

View File

@@ -739,15 +739,15 @@ void GameObserver::gameStateBasedEffects()
if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0)))
players[i]->game->putInGraveyard(card);
if(card->hasType(Subtypes::TYPE_BATTLE) && (!card->counters||!card->counters->hasCounter("defense",0,0))){
if(!card->isDefeated){
card->isDefeated = true;
WEvent * e = NEW WEventCardDefeated(card);
receiveEvent(e);
if(!card->isDefeated){
card->isDefeated = true;
WEvent * e = NEW WEventCardDefeated(card);
receiveEvent(e);
}
}
if(!card->isCreature() && card->hasType(Subtypes::TYPE_PLANESWALKER) && card->counters->hasCounter("loyalty", 0, 0))
if(!card->isCreature() && card->hasType(Subtypes::TYPE_PLANESWALKER) && card->counters->hasCounter("loyalty", 0, 0))
card->life = card->counters->hasCounter("loyalty", 0, 0)->nb;
if(!card->isCreature() && card->hasType(Subtypes::TYPE_BATTLE) && card->counters->hasCounter("defense", 0, 0))
if(!card->isCreature() && card->hasType(Subtypes::TYPE_BATTLE) && card->counters->hasCounter("defense", 0, 0))
card->life = card->counters->hasCounter("defense", 0, 0)->nb;
if(card->myPair && !isInPlay(card->myPair))
{
@@ -1285,6 +1285,7 @@ void GameObserver::Affinity()
bool DoReduceIncrease = false;
if (
(card->has(Constants::AFFINITYARTIFACTS) ||
card->has(Constants::AFFINITYENCHANTMENTS) ||
card->has(Constants::AFFINITYFOREST) ||
card->has(Constants::AFFINITYGREENCREATURES) ||
card->has(Constants::AFFINITYISLAND) ||
@@ -1292,6 +1293,16 @@ void GameObserver::Affinity()
card->has(Constants::AFFINITYPLAINS) ||
card->has(Constants::AFFINITYSWAMP) ||
card->has(Constants::CONDUITED) ||
card->has(Constants::AFFINITYALLCREATURES) ||
card->has(Constants::AFFINITYCONTROLLERCREATURES) ||
card->has(Constants::AFFINITYOPPONENTCREATURES) ||
card->has(Constants::AFFINITYALLDEADCREATURES) ||
card->has(Constants::AFFINITYPARTY) ||
card->has(Constants::AFFINITYBASICLANDTYPES) ||
card->has(Constants::AFFINITYTWOBASICLANDTYPES) ||
card->has(Constants::AFFINITYGRAVECREATURES) ||
card->has(Constants::AFFINITYATTACKINGCREATURES) ||
card->has(Constants::AFFINITYGRAVEINSTSORC) ||
card->getIncreasedManaCost()->getConvertedCost() ||
card->getReducedManaCost()->getConvertedCost() ||
NewAffinityFound || checkAuraP)

View File

@@ -1272,18 +1272,33 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
}
}//end2
if (card->has(Constants::AFFINITYARTIFACTS) ||
card->has(Constants::AFFINITYENCHANTMENTS) ||
card->has(Constants::AFFINITYFOREST) ||
card->has(Constants::AFFINITYGREENCREATURES) ||
card->has(Constants::AFFINITYISLAND) ||
card->has(Constants::AFFINITYMOUNTAIN) ||
card->has(Constants::AFFINITYPLAINS) ||
card->has(Constants::AFFINITYSWAMP) ||
card->has(Constants::AFFINITYALLCREATURES) ||
card->has(Constants::AFFINITYCONTROLLERCREATURES) ||
card->has(Constants::AFFINITYOPPONENTCREATURES) ||
card->has(Constants::AFFINITYALLDEADCREATURES) ||
card->has(Constants::AFFINITYPARTY) ||
card->has(Constants::AFFINITYBASICLANDTYPES) ||
card->has(Constants::AFFINITYTWOBASICLANDTYPES) ||
card->has(Constants::AFFINITYGRAVECREATURES) ||
card->has(Constants::AFFINITYATTACKINGCREATURES) ||
card->has(Constants::AFFINITYGRAVEINSTSORC) ||
card->has(Constants::CONDUITED))
{//start3
if (card->has(Constants::AFFINITYARTIFACTS))
{
type = "artifact";
}
if (card->has(Constants::AFFINITYENCHANTMENTS))
{
type = "enchantment";
}
else if (card->has(Constants::AFFINITYSWAMP))
{
type = "swamp";
@@ -1309,6 +1324,22 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
color = 1;
type = "creature";
}
else if (card->has(Constants::AFFINITYALLCREATURES) || card->has(Constants::AFFINITYCONTROLLERCREATURES) || card->has(Constants::AFFINITYOPPONENTCREATURES) || card->has(Constants::AFFINITYALLDEADCREATURES))
{
type = "creature";
}
else if (card->has(Constants::AFFINITYPARTY) || card->has(Constants::AFFINITYGRAVECREATURES) || card->has(Constants::AFFINITYATTACKINGCREATURES))
{
type = "creature";
}
else if (card->has(Constants::AFFINITYBASICLANDTYPES) || card->has(Constants::AFFINITYTWOBASICLANDTYPES))
{
type = "land";
}
else if (card->has(Constants::AFFINITYGRAVEINSTSORC))
{
type = "instant,sorcery";
}
Cost->copy(original);
if (Cost->extraCosts)
@@ -1326,7 +1357,77 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
}
}
int reduce = 0;
if (card->has(Constants::AFFINITYGREENCREATURES))
if (card->has(Constants::AFFINITYALLCREATURES))
{
TargetChooserFactory tf(getObserver());
TargetChooser * tc = tf.createTargetChooser("creature", NULL);
reduce = card->controller()->game->battlefield->countByCanTarget(tc) + card->controller()->opponent()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else if (card->has(Constants::AFFINITYCONTROLLERCREATURES))
{
TargetChooserFactory tf(getObserver());
TargetChooser * tc = tf.createTargetChooser("creature", NULL);
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else if (card->has(Constants::AFFINITYATTACKINGCREATURES))
{
TargetChooserFactory tf(getObserver());
TargetChooser * tc = tf.createTargetChooser("creature[attacking]", NULL);
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else if (card->has(Constants::AFFINITYOPPONENTCREATURES))
{
TargetChooserFactory tf(getObserver());
TargetChooser * tc = tf.createTargetChooser("creature", NULL);
reduce = card->controller()->opponent()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else if (card->has(Constants::AFFINITYGRAVECREATURES))
{
WParsedInt* value = NEW WParsedInt("type:creature:mygraveyard",NULL, card);
if(value)
reduce = value->getValue();
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYALLDEADCREATURES))
{
WParsedInt* value = NEW WParsedInt("bothalldeadcreature",NULL, card);
if(value)
reduce = value->getValue();
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYPARTY))
{
WParsedInt* value = NEW WParsedInt("calculateparty",NULL, card);
if(value)
reduce = value->getValue();
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYBASICLANDTYPES))
{
WParsedInt* value = NEW WParsedInt("pbasiclandtypes",NULL, card);
if(value)
reduce = value->getValue();
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYTWOBASICLANDTYPES))
{
WParsedInt* value = NEW WParsedInt("pbasiclandtypes",NULL, card);
if(value)
reduce = value->getValue() * 2;
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYGRAVEINSTSORC))
{
WParsedInt* value = NEW WParsedInt("pginstantsorcery",NULL, card);
if(value)
reduce = value->getValue();
SAFE_DELETE(value);
}
else if (card->has(Constants::AFFINITYGREENCREATURES))
{
TargetChooserFactory tf(getObserver());
TargetChooser * tc = tf.createTargetChooser("creature[green]", NULL);

View File

@@ -248,7 +248,18 @@ const char* Constants::MTGBasicAbilities[] = {
"backgroundpartner", //Can choose a backgorund partner as commander (e.g. "Faceless One").
"bottomlibrarydeath", //It goes to bottom of library after death (e.g. "Quintorius, Loremaster").
"noloyaltydamage", //Damage does not cause loyalty counter to be removed from a Planeswalker (e.g. "Spark Rupture").
"nodefensedamage" //Damage does not cause defense counter to be removed from a Battle.
"nodefensedamage", //Damage does not cause defense counter to be removed from a Battle.
"affinityallcreatures", //Cost 1 less for each creature in all battlefields.
"affinitycontrollercreatures", //Cost 1 less for each creature in controller battlefield.
"affinityopponentcreatures", //Cost 1 less for each creature in opponent battlefield.
"affinityalldeadcreatures", //Cost 1 less for each died creature in this turn.
"affinityparty", //Cost 1 less for each creature in your party.
"affinityenchantments", //Cost 1 less for each enchantment in your battlefield.
"affinitybasiclandtypes", //Cost 1 less for each basic land type in your battlefield.
"affinitytwobasiclandtypes", //Cost 2 less for each basic land type in your battlefield.
"affinitygravecreatures", //Cost 1 less for each creature in your graveyard.
"affinityattackingcreatures", //Cost 1 less for each attacking creature in your battlefield.
"affinitygraveinstsorc" //Cost 1 less for each instant or sorcery in your graveyard.
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -579,15 +579,17 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
// This fix issue types problem when card change zone with different card types than its original version (e.g. double face cards or cards that gained new types before to change zone).
std::vector<int> realTypes;
string originame = copy->name;
string realName = copy->name;
if(doCopy && !asCopy && !inplaytoinplay && !equal(copy->types.begin(), copy->types.end(), card->types.begin()) ){
realTypes = copy->types;
copy->types = card->types;
if(copy->name == "")
copy->name = originame;
copy->mPropertiesChangedSinceLastUpdate = false;
}
// This fix issue when card changes zone with different name than its original version (e.g. double face cards).
if(doCopy && !asCopy && !inplaytoinplay && copy->name != card->name)
copy->name = card->name;
// Copy all the counters of the original card... (solving the bug on comparison cards with counter before zone changing events)
if(card->counters && doCopy && !asCopy && !inplaytoinplay){
for (unsigned int i = 0; i < card->counters->counters.size(); i++){
@@ -799,15 +801,17 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
if(doCopy && !inplaytoinplay && copy->has(Constants::ISPREY))
copy->basicAbilities[Constants::ISPREY] = 0;
// Reset original types when card change zone with different card types than its original version (e.g. double face cards).
// Reset original types when card changes zone with different card types than its original version (e.g. double face cards).
if(doCopy && !inplaytoinplay && realTypes.size()){
copy->types = realTypes;
realTypes.clear();
if(copy->name == "")
copy->name = originame;
copy->mPropertiesChangedSinceLastUpdate = false;
}
// Reset the original name when card changes zone with different name than its original version (e.g. double face cards).
if(doCopy && !inplaytoinplay && copy->name != realName)
copy->name = realName;
// Erasing counters from copy after the event has been triggered (no counter can survive to a zone changing except the perpetual ones)
if(doCopy && !inplaytoinplay && copy->counters && copy->counters->mCount > 0){
for (unsigned int i = 0; i < copy->counters->counters.size(); i++){

View File

@@ -1520,6 +1520,51 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
if(card->controller()->getObserver()->currentlyActing() != card->controller())
intValue = 1 - intValue;
}
else if (s == "pinstsorcount" || s == "oinstsorcount") // Return the number of instant or sorceries that were casted this turn by controller or opponent.
{
intValue = (s == "pinstsorcount")?card->controller()->game->stack->seenThisTurn("*[instant;sorcery]", Constants::CAST_ALL):card->controller()->opponent()->game->stack->seenThisTurn("*[instant;sorcery]", Constants::CAST_ALL);
}
else if ((s.find("palldead") != string::npos) || (s.find("oalldead") != string::npos)) // Return the number of cards of a specific type that died this turn for controller or opponent.
{
int hasdeadtype = 0;
MTGGameZone * grave = (s.find("oalldead") != string::npos)?card->controller()->opponent()->game->graveyard:card->controller()->game->graveyard;
Player * checkCurrent = (s.find("oalldead") != string::npos)?card->controller()->opponent():card->controller();
string checktype = s.substr(8);
for(unsigned int gy = 0; gy < grave->cardsSeenThisTurn.size(); gy++)
{
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
if(checkCard->hasType(checktype) &&
((checkCard->previousZone == checkCurrent->game->battlefield)||
(checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield
)
{
hasdeadtype++;
}
}
intValue = hasdeadtype;
}
else if (s.find("bothalldead") != string::npos) // Return the number of cards of a specific type that died this turn.
{
int hasdeadtype = 0;
string checktype = s.substr(11);
for(int cp = 0; cp < 2; cp++)
{
Player * checkCurrent = card->getObserver()->players[cp];
MTGGameZone * grave = checkCurrent->game->graveyard;
for(unsigned int gy = 0; gy < grave->cardsSeenThisTurn.size(); gy++)
{
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
if(checkCard->hasType(checktype) &&
((checkCard->previousZone == checkCurrent->game->battlefield)||
(checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield
)
{
hasdeadtype++;
}
}
}
intValue = hasdeadtype;
}
else if(!intValue)//found nothing, try parsing a atoi
{
intValue = atoi(s.c_str());