Erwan
- opponentshroud small bug fix - added "kicker=" line and "kicker" auto keyword. See Vines of Vastwood (ZEN) for an example. WARNING: kicker= line has to be AFTER "mana=" line - daily build
This commit is contained in:
@@ -128,6 +128,8 @@ ManaCost::~ManaCost(){
|
||||
if (!extraCostsIsCopy) {
|
||||
SAFE_DELETE(extraCosts);
|
||||
}
|
||||
|
||||
SAFE_DELETE(kicker);
|
||||
}
|
||||
|
||||
void ManaCost::x(){
|
||||
@@ -142,6 +144,7 @@ void ManaCost::init(){
|
||||
nbhybrids = 0;
|
||||
extraCosts = NULL;
|
||||
extraCostsIsCopy = 0;
|
||||
kicker = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +152,9 @@ void ManaCost::copy(ManaCost * _manaCost){
|
||||
for (unsigned int i = 0; i <= Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = _manaCost->getCost(i);
|
||||
}
|
||||
for (unsigned int i = 0; i < nbhybrids ; i++){
|
||||
SAFE_DELETE(hybrids[i]);
|
||||
}
|
||||
for (unsigned int i = 0; i < _manaCost->nbhybrids; i++){
|
||||
hybrids[i] = NEW ManaCostHybrid((*_manaCost->hybrids[i]));
|
||||
}
|
||||
@@ -160,6 +166,12 @@ void ManaCost::copy(ManaCost * _manaCost){
|
||||
extraCosts = _manaCost->extraCosts;
|
||||
extraCostsIsCopy = 1;
|
||||
}
|
||||
|
||||
SAFE_DELETE(kicker);
|
||||
if (_manaCost->kicker){
|
||||
kicker = NEW ManaCost();
|
||||
kicker->copy(_manaCost->kicker);
|
||||
}
|
||||
}
|
||||
|
||||
int ManaCost::getCost(int color){
|
||||
@@ -267,12 +279,24 @@ int ManaCost::setExtraCostsAction(MTGAbility * action, MTGCardInstance * card){
|
||||
}
|
||||
|
||||
int ManaCost::pay(ManaCost * _cost){
|
||||
ManaCost * diff = Diff(_cost);
|
||||
int result = MANA_PAID;
|
||||
ManaCost * toPay = NEW ManaCost();
|
||||
toPay->copy(_cost);
|
||||
if (toPay->kicker){
|
||||
toPay->add(toPay->kicker);
|
||||
if (!canAfford(toPay)){
|
||||
toPay->copy(_cost);
|
||||
}else{
|
||||
result = MANA_PAID_WITH_KICKER;
|
||||
}
|
||||
}
|
||||
ManaCost * diff = Diff(toPay);
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = diff->getCost(i);
|
||||
}
|
||||
delete diff;
|
||||
return 1;
|
||||
delete toPay;
|
||||
return result;
|
||||
//TODO return 0 if can't afford the cost!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user