Altercost
Altercost alter cards to be cast... Removed Trinisphere temporarily...
This commit is contained in:
@@ -1146,9 +1146,9 @@ AASetCoin::~AASetCoin()
|
||||
|
||||
//paying for an ability as an effect but as a cost
|
||||
GenericPaidAbility::GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source,
|
||||
Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, ManaCost * cost) :
|
||||
Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, bool asAlternate, ManaCost * cost) :
|
||||
ActivatedAbility(observer, id, source, cost, 0),
|
||||
newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd)
|
||||
newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd), asAlternate(asAlternate)
|
||||
{
|
||||
this->GetId();
|
||||
baseAbility = NULL;
|
||||
@@ -1172,6 +1172,8 @@ int GenericPaidAbility::resolve()
|
||||
AbilityFactory Af(game);
|
||||
vector<string> baseAbilityStrSplit = split(baseAbilityStr,'?');
|
||||
vector<MTGAbility*> selection;
|
||||
MTGAbility * nomenuAbility = NULL;
|
||||
bool nomenu = false;
|
||||
if (baseAbilityStrSplit.size() > 1)
|
||||
{
|
||||
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
|
||||
@@ -1200,10 +1202,12 @@ int GenericPaidAbility::resolve()
|
||||
}
|
||||
else
|
||||
{
|
||||
nomenu = true;
|
||||
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
|
||||
baseAbility->target = target;
|
||||
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
|
||||
MTGAbility * set = baseAbility->clone();
|
||||
nomenuAbility = baseAbility->clone();
|
||||
set->oneShot = true;
|
||||
selection.push_back(set);
|
||||
}
|
||||
@@ -1211,10 +1215,37 @@ int GenericPaidAbility::resolve()
|
||||
if (selection.size())
|
||||
{
|
||||
bool must = baseAbilityStrSplit.size() > 1 ? true : false;
|
||||
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);
|
||||
a1->optionalCosts.push_back(NEW ManaCost(optionalCost));
|
||||
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
|
||||
a1->resolve();
|
||||
//todo get increased - reduced cost if asAlternate cost to cast using castcard
|
||||
if(asAlternate)
|
||||
{
|
||||
must = true;
|
||||
//cost increase - reduce + trinisphere effect ability todo...
|
||||
if(((MTGCardInstance *)target)->getIncreasedManaCost()->getConvertedCost())
|
||||
optionalCost->add(((MTGCardInstance *)target)->getIncreasedManaCost());
|
||||
if(((MTGCardInstance *)target)->getReducedManaCost()->getConvertedCost())
|
||||
optionalCost->remove(((MTGCardInstance *)target)->getReducedManaCost());
|
||||
//trinisphere effect must be hardcoded...here..
|
||||
/*if(((MTGCardInstance *)target)->has(Constants::TRINISPHERE))
|
||||
{
|
||||
if(optionalCost->getConvertedCost() == 2)
|
||||
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
else if(optionalCost->getConvertedCost() == 1)
|
||||
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 2);
|
||||
else if(optionalCost->getConvertedCost() < 1)
|
||||
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 3);
|
||||
}*/
|
||||
}
|
||||
if(nomenu && optionalCost->getConvertedCost() < 1)
|
||||
{
|
||||
nomenuAbility->resolve();
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);
|
||||
a1->optionalCosts.push_back(NEW ManaCost(optionalCost));
|
||||
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
|
||||
a1->resolve();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user