changing some of the logic to the previous fixes, we want to avoid using code that looks for specific card names.

currently we have kamiflip as the only defined flip type as it is treated differently from the others. 
but we have room for more if needed now
doublefaced=kamiflip
sets the flip type of a card to the kamiflip style cards. since this is defined on cardprimitive level now, we might be able to do something different from the flipping animation. who knows.

commented out the forcing token triggers, it bypass targetchooser check. still working on a fix for this coming soon.
This commit is contained in:
zethfoxster
2016-07-27 20:03:25 -04:00
parent afb98a374c
commit eea240d7f2
12 changed files with 64 additions and 40 deletions

View File

@@ -1370,8 +1370,8 @@ public:
{
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
if (!e) return 0;
if (e->istoken)
return 1;
//if (e->istoken)
// return 1;
MTGCardInstance * check = e->cardAfter;
MTGGameZone * oldZone = e->cardAfter->currentZone;
check->currentZone = check->previousZone;

View File

@@ -69,6 +69,9 @@ public:
int toughness;
int suspendedTime;
int dredgeAmount;
string doubleFaced;
void setdoubleFaced(const string& value);
const string& getdoubleFaced() const;
vector<int>types;
CardPrimitive();

View File

@@ -125,6 +125,7 @@ class GameObserver{
void enchantmentStatus();
void Affinity();
bool AffinityNeedsUpdate;
bool legendNeedUpdate;
void addObserver(MTGAbility * observer);
void checkLegendary(MTGCardInstance * card);
map<MTGCardInstance *,bool> cards;

View File

@@ -256,7 +256,8 @@ class Constants
SHACKLER = 134,
FLYERSONLY = 135,//can attack only if it has flying
TEMPFLASHBACK = 136,
NB_BASIC_ABILITIES = 137,
NOLEGENDRULE =137,
NB_BASIC_ABILITIES = 138,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics

View File

@@ -416,6 +416,12 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
{
if (this->source->controller() != game->isInterrupting)
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
//if (game->currentActionPlayer->isAI() && key != JGE_BTN_OK)
//{
// key = JGE_BTN_NEXT;
// game->Update(0);
//}
}
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)//android back button
{
@@ -432,6 +438,7 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
{
abilityFirst->removeFromGame();
game->mLayers->stackLayer()->Remove(abilityFirst);
abilityFirst = NULL;
}
game->Update(0);
//remove it from the game, update, and remove it from stack if needed.
@@ -723,6 +730,11 @@ bool MTGScryCards::CheckUserInput(JButton key)
//in the future we will need a way to find out if the human is pressing the keys and which player.
if (this->source->controller() != game->isInterrupting)
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
//if (game->currentActionPlayer->isAI() && key != JGE_BTN_OK)
//{
// key = JGE_BTN_NEXT;
// game->Update(0);
//}
}
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)
{
@@ -2718,13 +2730,11 @@ int AASacrificeCard::resolve()
Player * p = _target->controller();
MTGCardInstance * beforeCard = _target;
WEvent * e;
if(!_target->isToken)
e = NEW WEventCardSacrifice(beforeCard,_target);
else
e = NEW WEventCardSacrifice(beforeCard,_target,true);
p->game->putInGraveyard(_target);
while(_target->next)
_target = _target->next;
bool cardIsToken = _target->isToken ? true : false;
e = NEW WEventCardSacrifice(beforeCard, _target, cardIsToken);
game->receiveEvent(e);
if(andAbility)
{

View File

@@ -57,6 +57,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
formattedText = source->formattedText;
setName(source->name);
setdoubleFaced(source->doubleFaced);
power = source->power;
toughness = source->toughness;
restrictions = source->restrictions ? source->restrictions->clone() : NULL;
@@ -319,6 +320,18 @@ void CardPrimitive::addMagicText(string value, string key)
magicTexts[key].append(value);
}
void CardPrimitive::setdoubleFaced(const string& value)
{
std::transform(doubleFaced.begin(), doubleFaced.end(), doubleFaced.begin(), ::tolower);
doubleFaced = value;
}
const string& CardPrimitive::getdoubleFaced() const
{
return doubleFaced;
}
void CardPrimitive::setName(const string& value)
{
name = value;

View File

@@ -1289,12 +1289,10 @@ int SacrificeCost::doPay()
MTGCardInstance * beforeCard = target;
source->storedCard = target->createSnapShot();
WEvent * e;
if(!target->isToken)
e = NEW WEventCardSacrifice(beforeCard,target);
else
e = NEW WEventCardSacrifice(beforeCard,target,true);
target->controller()->game->putInGraveyard(target);
GameObserver * game = target->owner->getObserver();
bool cardIsToken = target->isToken ? true : false;
e = NEW WEventCardSacrifice(beforeCard, target, cardIsToken);
game->receiveEvent(e);
target = NULL;
if (tc)

View File

@@ -54,6 +54,7 @@ void GameObserver::cleanup()
gameTurn.clear();
OpenedDisplay = NULL;
AffinityNeedsUpdate = false;
legendNeedUpdate = false;
}
GameObserver::~GameObserver()
@@ -898,11 +899,15 @@ void GameObserver::gameStateBasedEffects()
//------------------------------
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
//legendary
for (int cl = 0; cl < nbcards; cl++)
if (legendNeedUpdate)
{
MTGCardInstance * c = z->cards[cl];
if(!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
checkLegendary(c);
for (int cl = 0; cl < nbcards; cl++)
{
MTGCardInstance * c = z->cards[cl];
if (!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
checkLegendary(c);
}
legendNeedUpdate = false;
}
/////////////////////////////////////////////////
//handle end of turn effects while we're at it.//
@@ -1126,6 +1131,7 @@ void GameObserver::Affinity()
}
}
///we handle trisnisphere seperately because its a desaster.
if(card->getManaCost())//make sure we check, abiliy$!/token dont have a mancost object.
if (card->has(Constants::TRINISPHERE))
{
for (int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)

View File

@@ -3334,26 +3334,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
/*vector<string>FlipStats = split(splitFlipStat[1],'%');*/
flipStats = splitFlipStat[1];
}
if(flipStats == "Tomoya the Revealer" ||
flipStats == "Tok-Tok, Volcano Born" ||
flipStats == "Tobita, Master of Winds" ||
flipStats == "Stabwhisker the Odious" ||
flipStats == "Shidako, Broodmistress" ||
flipStats == "Sasaya's Essence" ||
flipStats == "Rune-Tail's Essence" ||
flipStats == "Nighteyes the Desecrator" ||
flipStats == "Kuon's Essence" ||
flipStats == "Kenzo the Hardhearted" ||
flipStats == "Kaiso, Memory of Loyalty" ||
flipStats == "Ichiga, Who Topples Oaks" ||
flipStats == "Homura's Essence" ||
flipStats == "Scarmaker" ||
flipStats == "Goka the Unjust" ||
flipStats == "Erayo's Essence" ||
flipStats == "Jaraku the Interloper" ||
flipStats == "Azamuki, Treachery Incarnate" ||
flipStats == "Autumn-Tail, Kitsune Sage" ||
flipStats == "Dokai, Weaver of Life" )
if(card->getdoubleFaced() == "kamiflip")
{//old flip cards kamigawa
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true);
return a;

View File

@@ -140,8 +140,16 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
}
}
break;
case 'd'://dredge
if (!primitive) primitive = NEW CardPrimitive();
case 'd'://double faced card /dredge
if (key == "doublefaced")
{
if (!primitive) primitive = NEW CardPrimitive();
{
primitive->setdoubleFaced(val);
break;
}
}
else if (!primitive) primitive = NEW CardPrimitive();
{
string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower);

View File

@@ -167,7 +167,8 @@ const char* Constants::MTGBasicAbilities[] = {
"overload",
"shackler",
"flyersonly",
"tempflashback"
"tempflashback",
"legendruleremove"
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -3187,7 +3187,7 @@ int MTGLegendRule::canBeInList(MTGCardInstance * card)
return 0;
if (card->hasType(Subtypes::TYPE_LEGENDARY) && card->controller()->game->inPlay->hasCard(card))
{
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasName("Mirror Gallery")||card->controller()->inPlay()->hasName("Mirror Gallery"))
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE))
return 0;
else
return 1;
@@ -3233,8 +3233,10 @@ int MTGLegendRule::added(MTGCardInstance * card)
return 1;
}
int MTGLegendRule::removed(MTGCardInstance *)
int MTGLegendRule::removed(MTGCardInstance * card)
{
if (card->has(Constants::NOLEGENDRULE))
game->legendNeedUpdate = true;
return 0;
}