Fix date in Dat files, Added IKO and HA3 sets, updated the manifest and build files, Added SD card support for Android, Fix the Android app crash when resuming from background, Improved Android downloader, added finger sliding popup menu for Android devices without sidebar menu, fixed several crashes during game, added the mutating card ability, fixed the adventure card ability, added new borderline primitives.

This commit is contained in:
valfieri
2020-06-10 00:10:59 +02:00
parent 275eb9e06e
commit 8645cb9e1e
48 changed files with 9268 additions and 3312 deletions

View File

@@ -1023,6 +1023,44 @@ AAAlterPoison::~AAAlterPoison()
{
}
//AA Yidaro Count
AAAlterYidaroCount::AAAlterYidaroCount(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int yidarocount, ManaCost * _cost,
int who) :
ActivatedAbilityTP(observer, _id, _source, _target, _cost, who), yidarocount(yidarocount)
{
}
int AAAlterYidaroCount::resolve()
{
Damageable * _target = (Damageable *) getTarget();
if (_target)
{
Player * pTarget = (Player*)_target;
if(pTarget)
{
pTarget->yidaroCount += yidarocount;
if(pTarget->yidaroCount < 0)
pTarget->yidaroCount = 0;
}
}
return 0;
}
const string AAAlterYidaroCount::getMenuText()
{
WParsedInt parsedNum(yidarocount);
return _(parsedNum.getStringValue() + " Yidaro Cycling Counter ").c_str();
}
AAAlterYidaroCount * AAAlterYidaroCount::clone() const
{
return NEW AAAlterYidaroCount(*this);
}
AAAlterYidaroCount::~AAAlterYidaroCount()
{
}
//AA Energy Counters
AAAlterEnergy::AAAlterEnergy(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int energy, ManaCost * _cost,
int who) :
@@ -3168,8 +3206,8 @@ AAFrozen * AAFrozen::clone() const
}
// chose a new target for an aura or enchantment and equip it note: VERY basic right now.
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost, bool reequip, bool newhook) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget),reequip(reequip),newhook(newhook)
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost, bool reequip, bool newhook, int mutation) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget),reequip(reequip),newhook(newhook),mutation(mutation)
{
target = _target;
}
@@ -3182,7 +3220,7 @@ int AANewTarget::resolve()
_target = source;
source = (MTGCardInstance *) target;
}
if (_target && !reequip)
if (_target && !reequip && !mutation)
{
while (_target->next)
_target = _target->next;
@@ -3219,7 +3257,7 @@ int AANewTarget::resolve()
}
}
if (_target && _target->currentZone == _target->controller()->game->battlefield && reequip)
if (_target && _target->currentZone == _target->controller()->game->battlefield && reequip && !mutation)
{
if(!newhook)
{
@@ -3254,6 +3292,53 @@ int AANewTarget::resolve()
source = _target;
}
}
if (_target && _target->currentZone == _target->controller()->game->battlefield && mutation > 0)
{
_target = source;
source = (MTGCardInstance *) target;
for (size_t i = 1; i < game->mLayers->actionLayer()->mObjects.size(); i++)
{
MTGAbility * a = ((MTGAbility *) game->mLayers->actionLayer()->mObjects[i]);
AEquip * eq = dynamic_cast<AEquip*> (a);
if (eq && eq->source == _target)
{
uint8_t sourceoldcolors = source->colors; // Read the original colors before mutation
uint8_t _targetoldcolors = _target->colors;
((AEquip*)a)->mutate(source); // hook the cards one each other
source->colors = sourceoldcolors; // Restore the original colors after the mutation
if(mutation == 1){
int deltapower = source->getPower() - source->origpower; // keep counters and power/toughness increasement
int deltatoughness = source->getToughness() - source->origtoughness;
source->origpower = _target->origpower;
source->origtoughness = _target->origtoughness;
source->basepower = _target->basepower;
source->basetoughness = _target->basetoughness;
source->setPower(_target->getPower() + deltapower);
source->setToughness(_target->getToughness() + deltatoughness);
source->colors = _targetoldcolors; // The mutated card gain all colors from the parent
std::string oldname = source->getName(); // The mutated card swap its name with the parent
source->setName(_target->getName());
_target->setName(oldname);
for (int i = ((int)source->types.size())-1; i >= 0; --i) // The mutated card looses all its types
if(source->types[i] != 1)
source->removeType(source->types[i]);
for (int i = 0; i < ((int)_target->types.size()); i++) // The mutated card gains all the types of the source card
if(_target->types[i] != 1)
source->addType(_target->types[i]);
if(source->types[0] == 1 && source->types[1] == 7){ // Fix order for Legendary Creatures
source->types[0] = 7;
source->types[1] = 1;
}
}
_target->colors = 0; // The parent card loose all its colors
for (int i = ((int)_target->types.size())-1; i >= 0; --i) // The parent card looses all types and becomes a dummy Mutated type
_target->removeType(_target->types[i]);
_target->setType("Mutated");
}
}
target = source;
source = _target;
}
return 1;
}
@@ -5389,10 +5474,16 @@ IfThenAbility * IfThenAbility::clone() const
IfThenAbility::~IfThenAbility()
{
SAFE_DELETE(delayedAbility);
SAFE_DELETE(delayedElseAbility);
if(delayedAbility && (std::find(deletedpointers.begin(), deletedpointers.end(), delayedAbility) == deletedpointers.end())) {
deletedpointers.push_back(delayedAbility); // Fix to avoid crash on May abilities nested in IfThenElse Abilities.
SAFE_DELETE(delayedAbility);
}
if(delayedElseAbility && (std::find(deletedpointers.begin(), deletedpointers.end(), delayedElseAbility) == deletedpointers.end())) {
deletedpointers.push_back(delayedElseAbility); // Fix to avoid crash on May abilities nested in IfThenElse Abilities.
SAFE_DELETE(delayedElseAbility);
}
}
//
//May Abilities
MayAbility::MayAbility(GameObserver* observer, int _id, MTGAbility * _ability, MTGCardInstance * _source, bool must,string _cond) :
MTGAbility(observer, _id, _source), NestedAbility(_ability), must(must), Cond(_cond)
@@ -6336,8 +6427,8 @@ int ATransformer::destroy()
{
for (unsigned int i = 0;i < newAbilities[_target].size(); i++)
{
// The primitives Dead Presence probabily causes a double free error and a crash in Wagic, so for now it has been exluded...
if(newAbilities[_target].at(i) && strcmp(_target->name.c_str(),"Dread Presence"))
// The primitives Dead Presence and the mutated cards probably cause a double free error and a crash in Wagic, so for now they have been exluded...
if(newAbilities[_target].at(i) && strcmp(_target->name.c_str(),"Dread Presence") && !_target->mutation)
{
newAbilities[_target].at(i)->forceDestroy = 1;
newAbilities[_target].at(i)->removeFromGame();
@@ -6884,9 +6975,10 @@ int AProduceMana::receiveEvent(WEvent * event)
int AProduceMana::produce()
{
if(ManaDescription == "selectmana")
{//I tried menu ability and vector<MTGAbility*abi> to have a shorter code but it crashes wagic at end of turn...
//The may ability on otherhand works but the ability is cumulative...
//This must be wrapped on menuability so we can use it on successions...
{
//I tried menu ability and vector<MTGAbility*abi> to have a shorter code but it crashes wagic at end of turn...
//The may ability on otherhand works but the ability is cumulative...
//This must be wrapped on menuability so we can use it on successions...
AManaProducer *ap0 = NEW AManaProducer(game, game->mLayers->actionLayer()->getMaxId(), source, source->controller(), ManaCost::parseManaCost(mana[0],NULL,source), NULL, 0,"",false);
MayAbility *mw0 = NEW MayAbility(game, game->mLayers->actionLayer()->getMaxId(), ap0, source,true);
MTGAbility *ga0 = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), source,NULL,mw0);
@@ -8091,11 +8183,47 @@ int AEquip::equip(MTGCardInstance * equipped)
return 1;
}
int AEquip::mutate(MTGCardInstance * mutated)
{
source->target = mutated;
source->target->mutation += 1;
source->mutation += 1;
source->parentCards.push_back(mutated);
source->target->childrenCards.push_back((MTGCardInstance*)source);
AbilityFactory af(game);
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (dynamic_cast<AAConnect *> (a)) continue;
if (dynamic_cast<AANewTarget *> (af.getCoreAbility(a))) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we mutate...
a->addToGame();
}
WEvent * e = NEW WEventCardMutated(mutated);
source->getObserver()->receiveEvent(e); // triggers the @mutated event for any other listener.
return 1;
}
int AEquip::resolve()
{
MTGCardInstance * mTarget = tc->getNextCardTarget();
if (!mTarget) return 0;
if (mTarget == source) return 0;
if (source->mutation) return 0; // No need to unequip mutation cards.
unequip();
equip(mTarget);
return 1;
@@ -8111,6 +8239,9 @@ const string AEquip::getMenuText()
int AEquip::testDestroy()
{
if(source->mutation) // No need to unequip mutation cards.
return 0;
if (source->target && !game->isInPlay(source->target))
//unequip();//testfix for equipment when the card it equip moves to other battlefield
if (!game->connectRule)
@@ -8123,6 +8254,8 @@ int AEquip::testDestroy()
int AEquip::destroy()
{
if(source->mutation) // No need to unequip mutation cards.
return 0;
unequip();
return TargetAbility::destroy();
}
@@ -8133,8 +8266,8 @@ AEquip * AEquip::clone() const
}
// casting a card for free, or casting a copy of a card.
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent,bool putinplay,bool madness) :
MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent),putinplay(putinplay), asNormalMadness(madness)
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent,bool putinplay,bool madness, bool alternative) :
MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent),putinplay(putinplay), asNormalMadness(madness), alternative(alternative)
{
target = _target;
andAbility = NULL;
@@ -8397,7 +8530,7 @@ int AACastCard::resolveSpell()
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true);
if(asNormalMadness)
copy->MadnessPlay = true;
copy->MadnessPlay = true;
}
else
{
@@ -8407,6 +8540,8 @@ int AACastCard::resolveSpell()
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true);
}
if(alternative)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_ALTERNATIVE] = 1;
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();

View File

@@ -851,7 +851,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
}
} else {
for (unsigned int i = 0; i < card->data->types.size() - 1; i++)
{
{
s += _(MTGAllCards::findType(card->data->types[i]));
if(!strcmp(_(MTGAllCards::findType(card->data->types[i])).c_str(),"Creature") || !strcmp(_(MTGAllCards::findType(card->data->types[i])).c_str(),"Land"))
s += _(" - ");
@@ -1152,7 +1152,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
}
} else {
for (unsigned int i = 0; i < card->data->types.size() - 1; i++)
{
{
s += _(MTGAllCards::findType(card->data->types[i]));
if(!strcmp(_(MTGAllCards::findType(card->data->types[i])).c_str(),"Creature") || !strcmp(_(MTGAllCards::findType(card->data->types[i])).c_str(),"Land"))
s += _(" - ");
@@ -1276,7 +1276,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
string cardsetname = setlist[card->setId].c_str();
/*if(!noborder)
{
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "S00"||cardsetname == "S99"||cardsetname == "PTK"||cardsetname == "BTD"||cardsetname == "ATH"||cardsetname == "BRB"||cardsetname == "CHR"||cardsetname == "DM")
{//Draw white border
renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255));
renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20));
@@ -1299,7 +1299,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
//universal border
if(options[Options::SHOWBORDER].number)
{
if((cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
if((cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "S00"||cardsetname == "S99"||cardsetname == "PTK"||cardsetname == "BTD"||cardsetname == "ATH"||cardsetname == "BRB"||cardsetname == "CHR"||cardsetname == "DM")
&& !options[Options::BLKBORDER].number)
{//white border
renderer->FillRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(255,248,248,255));

View File

@@ -189,7 +189,7 @@ int SnowCost::doPay()
result += source->controller()->snowManaC;
if (result)
{
// Avoided double payments for Snow Mana cost
// Avoided double payments for Snow Mana cost
if (source->controller()->snowManaC && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{1}",NULL,source)))
{
//source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{1}",NULL,source));

View File

@@ -788,7 +788,7 @@ void GameObserver::gameStateBasedEffects()
else if((!card->target->isLand() && card->hasType("fortification")))
((AEquip*)a)->unequip();
}
if(card->controller())
if(card->controller() && !card->mutation)
((AEquip*)a)->getActionTc()->Owner = card->controller();
//fix for equip ability when the equipment changed controller...
}
@@ -1406,9 +1406,9 @@ bool GameObserver::WaitForExtraPayment(MTGCardInstance * card)
mExtraPayment = NULL;
}
result = true;
// Avoid game stucks on current phase till snow mana cost will be paid
if(mExtraPayment && mExtraPayment->costs.size() == 1 && !strcmp(mExtraPayment->costs[0]->mCostRenderString.c_str(), "Snow Mana"))
result = false;
// Avoid game stucks on current phase till snow mana cost will be paid
if(mExtraPayment && mExtraPayment->costs.size() == 1 && !strcmp(mExtraPayment->costs[0]->mCostRenderString.c_str(), "Snow Mana"))
result = false;
}
return result;

View File

@@ -95,13 +95,19 @@ void GameStateAwards::Start()
listview->Add(wgh);
int locked = 0;
for (int i = 0; i < setlist.size(); i++)
vector<pair<string, string> > orderedSet;
for(int i = 0; i < setlist.size(); i++){
sprintf(buf, "%s", setlist[i].c_str());
orderedSet.push_back(pair<string, string> (setlist.getInfo(i)->getName(), buf));
}
sort(orderedSet.begin(),orderedSet.end());
for (unsigned int i = 0; i < orderedSet.size(); i++)
{
MTGSetInfo * si = setlist.getInfo(i);
MTGSetInfo * si = setlist.getInfo(setlist.findSet(orderedSet.at(i).second));
if (!si)
continue;
if (!options[Options::optionSet(i)].number)
{
if (!options[Options::optionSet(setlist.findSet(orderedSet.at(i).second))].number){
locked++;
continue;
}
@@ -119,9 +125,9 @@ void GameStateAwards::Start()
else
sprintf(buf, _("%s: %i cards.").c_str(), si->author.c_str(), si->totalCards());
aw = NEW WGuiAward(Options::optionSet(i), si->getName(), buf, "Card Spoiler");
aw = NEW WGuiAward(Options::optionSet(setlist.findSet(orderedSet.at(i).second)), si->getName(), buf, "Card Spoiler");
aw->mFlags = WGuiItem::NO_TRANSLATE;
btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::optionSet(i), this);
btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::optionSet(setlist.findSet(orderedSet.at(i).second)), this);
listview->Add(btn);
}
if (locked)

View File

@@ -364,6 +364,8 @@ void GameStateDuel::End()
#ifdef TESTSUITE
SAFE_DELETE(testSuite);
#endif
MTGAbility::deletedpointers.clear(); // Clear the list of deallocated pointer.
}
//TODO Move This to utils or ResourceManager. Don't we have more generic functions that can do that?

View File

@@ -58,7 +58,7 @@ void GameStateOptions::Start()
optionsList->Add(NEW WGuiHeader("Card Display Options"));
optionsList->Add(NEW OptionInteger(Options::SHOWBORDER, "Show Borders"));
//black border
optionsList->Add(NEW OptionInteger(Options::BLKBORDER, "All Black Border"));
optionsList->Add(NEW OptionInteger(Options::BLKBORDER, "All Black Borders"));
//show tokens in editor
optionsList->Add(NEW OptionInteger(Options::SHOWTOKENS, "Show Tokens in Editor"));
WDecoStyled * wMisc = NEW WDecoStyled(NEW WGuiHeader("Warning!!!"));
@@ -258,9 +258,9 @@ void GameStateOptions::Render()
"",
"Dev Team:",
"Abrasax, Almosthumane, Daddy32, DJardin, Dr.Solomat,",
"J, Jeck, kevlahnota, Leungclj, linshier, Mootpoint,",
"Mnguyen, Ph34rbot, Psyringe, Rolzad73, Salmelo, Superhiro,",
"Vitty85, Wololo, Yeshua, Zethfox",
"J, Jeck, kevlahnota, Leungclj, linshier, Mootpoint,",
"Mnguyen, Ph34rbot, Psyringe, Rolzad73, Salmelo, Superhiro,",
"Vitty85, Wololo, Yeshua, Zethfox",
"",
"Music by Celestial Aeon Project, http://www.jamendo.com",
"",

View File

@@ -1169,6 +1169,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser * tc = parseSimpleTC(s, "drawn", card))
return NEW TrcardDrawn(observer, id, card, tc,once);
//Card is mutated
if (TargetChooser * tc = parseSimpleTC(s, "mutated", card))
return NEW TrCardMutated(observer, id, card, tc,once);
//Card is sacrificed
if (TargetChooser * tc = parseSimpleTC(s, "sacrificed", card))
return NEW TrCardSacrificed(observer, id, card, tc,once);
@@ -3128,6 +3132,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
bool asNormalMadness = splitCastCard[1].find("madness") != string::npos;
bool sendNoEvent = splitCastCard[1].find("noevent") != string::npos;
bool putinplay = splitCastCard[1].find("putinplay") != string::npos;
bool alternative = splitCastCard[1].find("alternative") != string::npos;
string nameCard = "";
if(splitCastCard[1].find("named!:") != string::npos)
{
@@ -3137,7 +3142,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
nameCard = splitCastName[1];
}
}
MTGAbility *a = NEW AACastCard(observer, id, card, target,withRestrictions,asCopy,asNormal,nameCard,newName,sendNoEvent,putinplay, asNormalMadness);
MTGAbility *a = NEW AACastCard(observer, id, card, target,withRestrictions,asCopy,asNormal,nameCard,newName,sendNoEvent,putinplay, asNormalMadness, alternative);
a->oneShot = false;
if(splitCastCard[1].find("trigger[to]") != string::npos)
{
@@ -3278,6 +3283,38 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//alter yidaro counter
vector<string> splitYidaroCounter = parseBetween(s, "alteryidarocount:", " ", false);
if (splitYidaroCounter.size())
{
int yidarocount = atoi(splitYidaroCounter[1].c_str());
Targetable * t = spell ? spell->getNextTarget() : NULL;
MTGAbility * a = NEW AAAlterYidaroCount(observer, id, card, t, yidarocount, NULL, who);
a->oneShot = 1;
return a;
}
//alter mutation counter on target card with trigger activation
vector<string> splitMutated = parseBetween(s, "altermutationcounter:", " ", false);
if (splitMutated.size())
{
card->mutation += atoi(splitMutated[1].c_str());
WEvent * e = NEW WEventCardMutated(card);
card->getObserver()->receiveEvent(e);
}
//set mutation counter on source card with no trigger activation
vector<string> splitMutatedOver = parseBetween(s, "mutationover:", " ", false);
if (splitMutatedOver.size())
{
card->mutation += atoi(splitMutatedOver[1].c_str());
}
vector<string> splitMutatedUnder = parseBetween(s, "mutationunder:", " ", false);
if (splitMutatedUnder.size())
{
card->mutation += atoi(splitMutatedUnder[1].c_str());
}
//prevent next damage
vector<string> splitPrevent = parseBetween(s, "prevent:", " ", false);
if (splitPrevent.size())
@@ -4174,6 +4211,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//get a new target for muatations
if ((s.find("mutateover") != string::npos) || s.find("mutateunder") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, false,NULL,false,false,(s.find("mutateover") != string::npos)?1:2);
a->oneShot = 1;
return a;
}
//morph
found = s.find("morph");
if (found != string::npos)
@@ -4687,8 +4732,8 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
badAbilities[(int)Constants::NOLIFEGAINOPPONENT] = true;
badAbilities[(int)Constants::MUSTBLOCK] = true;
badAbilities[(int)Constants::FLYERSONLY] = true;
badAbilities[(int)Constants::TREASON] = true;
badAbilities[(int)Constants::SHACKLER] = true;
badAbilities[(int)Constants::TREASON] = true;
badAbilities[(int)Constants::SHACKLER] = true;
if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast<AInstantBasicAbilityModifierUntilEOT *>(a))
{
@@ -5539,6 +5584,8 @@ MTGAbility * AbilityFactory::getManaReduxAbility(string s, int id, Spell *, MTGC
return NEW AAlterCost(observer, id, card, target, amount, color);
}
vector<void*> MTGAbility::deletedpointers;
MTGAbility::MTGAbility(const MTGAbility& a): ActionElement(a)
{
//Todo get rid of menuText, it is only used as a placeholder in getMenuText, for something that could be a string
@@ -6024,7 +6071,7 @@ int TargetAbility::reactToClick(MTGCardInstance * card)
game->mExtraPayment = cost->extraCosts;
return 0;
}
if (!tc) return 0; // Fix crash on mutating cards
waitingForAnswer = 1;
game->mLayers->actionLayer()->setCurrentWaitingAction(this);
tc->initTargets();
@@ -6306,7 +6353,8 @@ void ListMaintainerAbility::updateTargets()
{
MTGCardInstance * card = (*it).first;
cards.erase(card);
removed(card);
if(!card->mutation) // Fix crash on mutating card...
removed(card);
}
temp.clear();
//add New valid ones
@@ -6426,7 +6474,8 @@ int ListMaintainerAbility::destroy()
{
MTGCardInstance * card = (*it).first;
cards.erase(card);
removed(card);
if(!card->mutation) // Fix crash on mutating card...
removed(card);
it = cards.begin();
}
return 1;

View File

@@ -237,6 +237,7 @@ void MTGCardInstance::initMTGCI()
notblocked = 0;
sunburst = 0;
equipment = 0;
mutation = 0;
auras = 0;
combatdamageToOpponent = false;
damageToOpponent = false;

View File

@@ -188,7 +188,9 @@ const char* Constants::MTGBasicAbilities[] = {
"showopponenttoplibrary",
"totemarmor",
"discardtoplaybyopponent",
"modular"
"modular",
"mutate", //it can mutate
"adventure" //it can be adventure
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -782,12 +782,14 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
if(!allowedToAltCast(card,player))
return 0;
if(card->has(Constants::ADVENTURE) && game->isInExile(card))
return 0; // Advetures can't be alternate casted from exile.
alternativeName = "Pay Alternative Cost";
if(card->has(Constants::CANPLAYFROMGRAVEYARD) && game->isInGrave(card))
alternativeName = "Alternate Cast From Graveyard";
else if(card->has(Constants::CANPLAYFROMEXILE) && game->isInExile(card))
else if(card->has(Constants::CANPLAYFROMEXILE) && game->isInExile(card) && !card->has(Constants::ADVENTURE))
alternativeName = "Alternate Cast From Exile";
else if(card->canPlayFromLibrary() && game->isInLibrary(card))
alternativeName = "Alternate Cast From Library";

View File

@@ -35,6 +35,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
extraTurn = 0;
drawCounter = 0;
energyCount = 0;
yidaroCount = 0;
epic = 0;
forcefield = 0;
dealsdamagebycombat = 0;

View File

@@ -598,6 +598,7 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
p->damageCount = initState.playerData[i].player->damageCount;
p->preventable = initState.playerData[i].player->preventable;
p->energyCount = initState.playerData[i].player->energyCount;
p->yidaroCount = initState.playerData[i].player->yidaroCount;
if (initState.playerData[i].player->mAvatarName.size())
{
p->mAvatarName = initState.playerData[i].player->mAvatarName;

View File

@@ -145,6 +145,18 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser
return NULL;
}
//mutations
found = s.find("mutations");
if (found != string::npos)
{
ThisMutation * td = NEW ThisMutation(criterion);
if (td)
{
td->comparisonMode = mode;
return td;
}
return NULL;
}
//equips and auras
found = s.find("gear");//still same meaning, better wording to word conflict with MTGAbility equip.
if (found != string::npos)
@@ -513,6 +525,20 @@ ThisPower* ThisPower::clone() const
return NEW ThisPower(*this);
}
ThisMutation::ThisMutation(int mutation)
{
comparisonCriterion = mutation;
}
int ThisMutation::match(MTGCardInstance * card)
{
return matchValue(card->mutation);
}
ThisMutation* ThisMutation::clone() const
{
return NEW ThisMutation(*this);
}
ThisEquip::ThisEquip(int equipment)
{
comparisonCriterion = equipment;

View File

@@ -286,6 +286,11 @@ WEventplayerEnergized::WEventplayerEnergized(Player * player, int nb_count) :
player(player), nb_count(nb_count)
{
}
WEventCardMutated::WEventCardMutated(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
;
Targetable * WEventDamage::getTarget(int target)
@@ -484,6 +489,12 @@ Targetable * WEventCardCopiedACard::getTarget(int target)
return NULL;
}
Targetable * WEventCardMutated::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventplayerEnergized::getTarget(Player * player)
{
if (player) return player;

View File

@@ -1345,7 +1345,7 @@ void WGuiAward::Underlay()
}
if (!trophy.get()) //Fallback to basic trophy image.
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy.png");
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy.png");
#endif
if (trophy.get())
@@ -2215,11 +2215,15 @@ void WGuiFilterItem::updateValue()
else if (filterType == FILTER_SET)
{
char buf[512];
for (int i = 0; i < setlist.size(); i++)
{
vector<pair<string, string> > orderedSet;
for(int i = 0; i < setlist.size(); i++){
if (options[Options::optionSet(i)].number == 0) continue;
sprintf(buf, "s:%s;", setlist[i].c_str());
mParent->addArg((setlist.getInfo(i))->getName(), buf);
orderedSet.push_back(pair<string, string> (setlist.getInfo(i)->getName(), buf));
}
sort(orderedSet.begin(),orderedSet.end());
for (unsigned int i = 0; i < orderedSet.size(); i++){
mParent->addArg(orderedSet.at(i).first, orderedSet.at(i).second);
}
}
else if (filterType == FILTER_ALPHA)