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:
@@ -1370,8 +1370,8 @@ public:
|
|||||||
{
|
{
|
||||||
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
|
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
|
||||||
if (!e) return 0;
|
if (!e) return 0;
|
||||||
if (e->istoken)
|
//if (e->istoken)
|
||||||
return 1;
|
// return 1;
|
||||||
MTGCardInstance * check = e->cardAfter;
|
MTGCardInstance * check = e->cardAfter;
|
||||||
MTGGameZone * oldZone = e->cardAfter->currentZone;
|
MTGGameZone * oldZone = e->cardAfter->currentZone;
|
||||||
check->currentZone = check->previousZone;
|
check->currentZone = check->previousZone;
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ public:
|
|||||||
int toughness;
|
int toughness;
|
||||||
int suspendedTime;
|
int suspendedTime;
|
||||||
int dredgeAmount;
|
int dredgeAmount;
|
||||||
|
string doubleFaced;
|
||||||
|
void setdoubleFaced(const string& value);
|
||||||
|
const string& getdoubleFaced() const;
|
||||||
|
|
||||||
vector<int>types;
|
vector<int>types;
|
||||||
CardPrimitive();
|
CardPrimitive();
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class GameObserver{
|
|||||||
void enchantmentStatus();
|
void enchantmentStatus();
|
||||||
void Affinity();
|
void Affinity();
|
||||||
bool AffinityNeedsUpdate;
|
bool AffinityNeedsUpdate;
|
||||||
|
bool legendNeedUpdate;
|
||||||
void addObserver(MTGAbility * observer);
|
void addObserver(MTGAbility * observer);
|
||||||
void checkLegendary(MTGCardInstance * card);
|
void checkLegendary(MTGCardInstance * card);
|
||||||
map<MTGCardInstance *,bool> cards;
|
map<MTGCardInstance *,bool> cards;
|
||||||
|
|||||||
@@ -256,7 +256,8 @@ class Constants
|
|||||||
SHACKLER = 134,
|
SHACKLER = 134,
|
||||||
FLYERSONLY = 135,//can attack only if it has flying
|
FLYERSONLY = 135,//can attack only if it has flying
|
||||||
TEMPFLASHBACK = 136,
|
TEMPFLASHBACK = 136,
|
||||||
NB_BASIC_ABILITIES = 137,
|
NOLEGENDRULE =137,
|
||||||
|
NB_BASIC_ABILITIES = 138,
|
||||||
|
|
||||||
RARITY_S = 'S', //Special Rarity
|
RARITY_S = 'S', //Special Rarity
|
||||||
RARITY_M = 'M', //Mythics
|
RARITY_M = 'M', //Mythics
|
||||||
|
|||||||
@@ -416,6 +416,12 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
|
|||||||
{
|
{
|
||||||
if (this->source->controller() != game->isInterrupting)
|
if (this->source->controller() != game->isInterrupting)
|
||||||
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
|
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
|
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();
|
abilityFirst->removeFromGame();
|
||||||
game->mLayers->stackLayer()->Remove(abilityFirst);
|
game->mLayers->stackLayer()->Remove(abilityFirst);
|
||||||
|
abilityFirst = NULL;
|
||||||
}
|
}
|
||||||
game->Update(0);
|
game->Update(0);
|
||||||
//remove it from the game, update, and remove it from stack if needed.
|
//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.
|
//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)
|
if (this->source->controller() != game->isInterrupting)
|
||||||
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
|
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)
|
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();
|
Player * p = _target->controller();
|
||||||
MTGCardInstance * beforeCard = _target;
|
MTGCardInstance * beforeCard = _target;
|
||||||
WEvent * e;
|
WEvent * e;
|
||||||
if(!_target->isToken)
|
|
||||||
e = NEW WEventCardSacrifice(beforeCard,_target);
|
|
||||||
else
|
|
||||||
e = NEW WEventCardSacrifice(beforeCard,_target,true);
|
|
||||||
p->game->putInGraveyard(_target);
|
p->game->putInGraveyard(_target);
|
||||||
while(_target->next)
|
while(_target->next)
|
||||||
_target = _target->next;
|
_target = _target->next;
|
||||||
|
bool cardIsToken = _target->isToken ? true : false;
|
||||||
|
e = NEW WEventCardSacrifice(beforeCard, _target, cardIsToken);
|
||||||
game->receiveEvent(e);
|
game->receiveEvent(e);
|
||||||
if(andAbility)
|
if(andAbility)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
|
|||||||
formattedText = source->formattedText;
|
formattedText = source->formattedText;
|
||||||
setName(source->name);
|
setName(source->name);
|
||||||
|
|
||||||
|
setdoubleFaced(source->doubleFaced);
|
||||||
power = source->power;
|
power = source->power;
|
||||||
toughness = source->toughness;
|
toughness = source->toughness;
|
||||||
restrictions = source->restrictions ? source->restrictions->clone() : NULL;
|
restrictions = source->restrictions ? source->restrictions->clone() : NULL;
|
||||||
@@ -319,6 +320,18 @@ void CardPrimitive::addMagicText(string value, string key)
|
|||||||
magicTexts[key].append(value);
|
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)
|
void CardPrimitive::setName(const string& value)
|
||||||
{
|
{
|
||||||
name = value;
|
name = value;
|
||||||
|
|||||||
@@ -1289,12 +1289,10 @@ int SacrificeCost::doPay()
|
|||||||
MTGCardInstance * beforeCard = target;
|
MTGCardInstance * beforeCard = target;
|
||||||
source->storedCard = target->createSnapShot();
|
source->storedCard = target->createSnapShot();
|
||||||
WEvent * e;
|
WEvent * e;
|
||||||
if(!target->isToken)
|
|
||||||
e = NEW WEventCardSacrifice(beforeCard,target);
|
|
||||||
else
|
|
||||||
e = NEW WEventCardSacrifice(beforeCard,target,true);
|
|
||||||
target->controller()->game->putInGraveyard(target);
|
target->controller()->game->putInGraveyard(target);
|
||||||
GameObserver * game = target->owner->getObserver();
|
GameObserver * game = target->owner->getObserver();
|
||||||
|
bool cardIsToken = target->isToken ? true : false;
|
||||||
|
e = NEW WEventCardSacrifice(beforeCard, target, cardIsToken);
|
||||||
game->receiveEvent(e);
|
game->receiveEvent(e);
|
||||||
target = NULL;
|
target = NULL;
|
||||||
if (tc)
|
if (tc)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ void GameObserver::cleanup()
|
|||||||
gameTurn.clear();
|
gameTurn.clear();
|
||||||
OpenedDisplay = NULL;
|
OpenedDisplay = NULL;
|
||||||
AffinityNeedsUpdate = false;
|
AffinityNeedsUpdate = false;
|
||||||
|
legendNeedUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObserver::~GameObserver()
|
GameObserver::~GameObserver()
|
||||||
@@ -898,12 +899,16 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
//------------------------------
|
//------------------------------
|
||||||
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
|
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
|
||||||
//legendary
|
//legendary
|
||||||
|
if (legendNeedUpdate)
|
||||||
|
{
|
||||||
for (int cl = 0; cl < nbcards; cl++)
|
for (int cl = 0; cl < nbcards; cl++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * c = z->cards[cl];
|
MTGCardInstance * c = z->cards[cl];
|
||||||
if(!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
|
if (!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
|
||||||
checkLegendary(c);
|
checkLegendary(c);
|
||||||
}
|
}
|
||||||
|
legendNeedUpdate = false;
|
||||||
|
}
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
//handle end of turn effects while we're at it.//
|
//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.
|
///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))
|
if (card->has(Constants::TRINISPHERE))
|
||||||
{
|
{
|
||||||
for (int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)
|
for (int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)
|
||||||
|
|||||||
@@ -3334,26 +3334,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
/*vector<string>FlipStats = split(splitFlipStat[1],'%');*/
|
/*vector<string>FlipStats = split(splitFlipStat[1],'%');*/
|
||||||
flipStats = splitFlipStat[1];
|
flipStats = splitFlipStat[1];
|
||||||
}
|
}
|
||||||
if(flipStats == "Tomoya the Revealer" ||
|
if(card->getdoubleFaced() == "kamiflip")
|
||||||
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" )
|
|
||||||
{//old flip cards kamigawa
|
{//old flip cards kamigawa
|
||||||
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true);
|
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats,true);
|
||||||
return a;
|
return a;
|
||||||
|
|||||||
@@ -140,8 +140,16 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd'://dredge
|
case 'd'://double faced card /dredge
|
||||||
|
if (key == "doublefaced")
|
||||||
|
{
|
||||||
if (!primitive) primitive = NEW CardPrimitive();
|
if (!primitive) primitive = NEW CardPrimitive();
|
||||||
|
{
|
||||||
|
primitive->setdoubleFaced(val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!primitive) primitive = NEW CardPrimitive();
|
||||||
{
|
{
|
||||||
string value = val;
|
string value = val;
|
||||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
|||||||
"overload",
|
"overload",
|
||||||
"shackler",
|
"shackler",
|
||||||
"flyersonly",
|
"flyersonly",
|
||||||
"tempflashback"
|
"tempflashback",
|
||||||
|
"legendruleremove"
|
||||||
};
|
};
|
||||||
|
|
||||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||||
|
|||||||
@@ -3187,7 +3187,7 @@ int MTGLegendRule::canBeInList(MTGCardInstance * card)
|
|||||||
return 0;
|
return 0;
|
||||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && card->controller()->game->inPlay->hasCard(card))
|
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;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
@@ -3233,8 +3233,10 @@ int MTGLegendRule::added(MTGCardInstance * card)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGLegendRule::removed(MTGCardInstance *)
|
int MTGLegendRule::removed(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
|
if (card->has(Constants::NOLEGENDRULE))
|
||||||
|
game->legendNeedUpdate = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user