Complete Overhaul of the cantcast abilities, changes in first comment.
This commit is contained in:
@@ -4323,7 +4323,7 @@ class AAOnlyOne:public ActivatedAbilityTP{
|
||||
}else{
|
||||
player = (Player *) _target;
|
||||
}
|
||||
player->onlyonecast = 1;
|
||||
player->onlyoneinstant = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -4352,7 +4352,7 @@ class AANoSpells:public ActivatedAbilityTP{
|
||||
}else{
|
||||
player = (Player *) _target;
|
||||
}
|
||||
player->castrestrictedspell = 1;
|
||||
player->nospellinstant = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -4381,7 +4381,7 @@ class AANoCreatures:public ActivatedAbilityTP{
|
||||
}else{
|
||||
player = (Player *) _target;
|
||||
}
|
||||
player->castrestrictedcreature = 1;
|
||||
player->nocreatureinstant = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -119,11 +119,12 @@ class Constants
|
||||
CANTMILLLOSE = 61,
|
||||
CANTCASTCREATURE = 62,
|
||||
CANTCAST = 63,
|
||||
CANTCASTINSTANTSORCERY = 64,
|
||||
CANTCASTTWO = 64,
|
||||
STORM = 65,
|
||||
BOTHCANTCAST = 66,
|
||||
BOTHNOCREATURE = 67,
|
||||
BOTHONESPELL = 68,
|
||||
ONLYONEBOTH = 68,
|
||||
|
||||
|
||||
NB_BASIC_ABILITIES = 69,
|
||||
|
||||
|
||||
@@ -64,6 +64,23 @@ class MTGPersistRule:public MTGAbility{
|
||||
virtual MTGPersistRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGCantCasterstart:public MTGAbility{
|
||||
public:
|
||||
MTGCantCasterstart(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
int testDestroy();
|
||||
virtual MTGCantCasterstart * clone() const;
|
||||
};
|
||||
class MTGCantCastercheck:public MTGAbility{
|
||||
public:
|
||||
MTGCantCastercheck(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
int testDestroy();
|
||||
virtual MTGCantCastercheck * clone() const;
|
||||
};
|
||||
|
||||
class MTGUnearthRule:public MTGAbility{
|
||||
public:
|
||||
MTGUnearthRule(int _id);
|
||||
|
||||
@@ -24,11 +24,12 @@ class Player: public Damageable{
|
||||
int canPutLandsIntoPlay;
|
||||
int castedspellsthisturn;
|
||||
int onlyonecast;
|
||||
int castcount;
|
||||
int nocreatureinstant;
|
||||
int nospellinstant;
|
||||
int onlyoneinstant;
|
||||
int castrestrictedcreature;
|
||||
int castrestrictedspell;
|
||||
int cantcastspell;
|
||||
int cantcastcreature;
|
||||
int cantcastinso;
|
||||
MTGPlayerCards * game;
|
||||
int afterDamage();
|
||||
int poisoned();
|
||||
|
||||
@@ -714,19 +714,20 @@ int AIPlayerBaka::computeActions(){
|
||||
|
||||
nextCardToPlay = FindCardToPlay(currentMana, "land");
|
||||
//look for the most expensive creature we can afford
|
||||
if(castrestrictedspell == 0 && cantcastspell == 0){
|
||||
if(onlyonecast == 0 || castedspellsthisturn < onlyonecast){
|
||||
if(castrestrictedcreature == 0 && cantcastcreature == 0){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "creature");
|
||||
if(castrestrictedspell == 0 && nospellinstant == 0){
|
||||
if(onlyonecast == 0 || castcount < 2){
|
||||
if(onlyoneinstant == 0 || castcount < 2){
|
||||
if(castrestrictedcreature == 0 && nocreatureinstant == 0){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "creature");
|
||||
}
|
||||
//Let's Try an enchantment maybe ?
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "enchantment");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "artifact");
|
||||
if (cantcastinso == 0){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "sorcery");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "instant");
|
||||
}
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "sorcery");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "instant");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (potential) delete(currentMana);
|
||||
if (nextCardToPlay){
|
||||
|
||||
@@ -26,6 +26,8 @@ void DuelLayers::init(){
|
||||
action->Add(NEW MTGLegendRule(-1));
|
||||
action->Add(NEW MTGPersistRule(-1));
|
||||
action->Add(NEW MTGUnearthRule(-1));
|
||||
action->Add(NEW MTGCantCasterstart(-1));
|
||||
action->Add(NEW MTGCantCastercheck(-1));
|
||||
action->Add(NEW MTGSneakAttackRule(-1));
|
||||
action->Add(NEW MTGLifelinkRule(-1));
|
||||
action->Add(NEW MTGDeathtouchRule(-1));
|
||||
|
||||
@@ -98,12 +98,10 @@ void GameObserver::nextGamePhase(){
|
||||
cleanupPhase();
|
||||
currentPlayer->canPutLandsIntoPlay = 1;
|
||||
currentPlayer->castedspellsthisturn = 0;
|
||||
currentPlayer->castrestrictedcreature = 0;
|
||||
currentPlayer->castrestrictedspell = 0;
|
||||
currentPlayer->cantcastcreature = 0;
|
||||
currentPlayer->cantcastspell = 0;
|
||||
currentPlayer->cantcastinso = 0;
|
||||
currentPlayer->onlyonecast = 0;
|
||||
currentPlayer->castcount = 0;
|
||||
currentPlayer->nocreatureinstant = 0;
|
||||
currentPlayer->nospellinstant = 0;
|
||||
currentPlayer->onlyoneinstant = 0;
|
||||
currentPlayer->damageCount = 0;
|
||||
currentPlayer->preventable = 0;
|
||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||
|
||||
@@ -70,13 +70,13 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"cantlose",
|
||||
"cantlifelose",
|
||||
"cantmilllose",
|
||||
"cantcastcreature",
|
||||
"cantcreaturecast",
|
||||
"cantspellcast",
|
||||
"cantcastinstantsorcery",
|
||||
"onlyonecast",
|
||||
"storm",
|
||||
"bothcantcast",
|
||||
"bothnocreature",
|
||||
"bothonecast",
|
||||
"oneboth",
|
||||
};
|
||||
|
||||
|
||||
|
||||
+298
-61
@@ -36,68 +36,13 @@ int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
#ifdef WIN32
|
||||
cost->Dump();
|
||||
#endif
|
||||
//cantcast restrictions---------
|
||||
int cantcreaturecasters = 0;
|
||||
MTGGameZone * z = card->controller()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTCREATURE)){
|
||||
player->cantcastcreature = 1;
|
||||
cantcreaturecasters++;
|
||||
}
|
||||
}
|
||||
int cantcasters = 0;
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCAST)){
|
||||
player->cantcastspell = 1;
|
||||
cantcasters++;
|
||||
}
|
||||
}
|
||||
int cantinsocasters = 0;
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTINSTANTSORCERY)){
|
||||
player->cantcastinso = 1;
|
||||
cantinsocasters++;
|
||||
}
|
||||
}
|
||||
//restrict both players-------
|
||||
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHCANTCAST)){
|
||||
player->cantcastspell = 1;
|
||||
player->opponent()->cantcastspell = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHNOCREATURE)){
|
||||
player->cantcastcreature = 1;
|
||||
player->opponent()->cantcastcreature = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHONESPELL)){
|
||||
player->onlyonecast = 1;
|
||||
player->opponent()->onlyonecast = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(player->castedspellsthisturn > 0 && player->onlyonecast > 0){return 0;}
|
||||
if(player->castrestrictedspell > 0){return 0;}
|
||||
if(player->castrestrictedspell > 0 && !card->hasType("land")){ return 0;}
|
||||
if(player->onlyonecast > 0 && player->castcount >= 1){return 0;}
|
||||
if(player->nospellinstant > 0){return 0;}
|
||||
if(player->onlyoneinstant > 0){ if(player->castcount >= 1){return 0;}}
|
||||
if(player->nocreatureinstant > 0 && card->hasType("creature")){return 0;}
|
||||
if(player->castrestrictedcreature > 0 && card->hasType("creature")){return 0;}
|
||||
if(cantcasters > 0 && !card->hasType("land")){ return 0;}
|
||||
if(cantinsocasters > 0 && card->hasType("sorcery")){ return 0;}
|
||||
if(cantinsocasters > 0 && card->hasType("instant")){ return 0;}
|
||||
if(cantcreaturecasters > 0 && card->hasType("creature")){ return 0;}//---this ends the cant cast restriction.
|
||||
|
||||
|
||||
//cost of card.
|
||||
if(alternative && playerMana->canAfford(alternative)){
|
||||
return 1;
|
||||
@@ -167,9 +112,11 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
|
||||
spell = game->mLayers->stackLayer()->addSpell(copy,game->targetChooser, spellCost,payResult,0);
|
||||
game->targetChooser = NULL;
|
||||
player->castedspellsthisturn += 1;
|
||||
if(player->onlyonecast > 0 || player->onlyoneinstant > 0){player->castcount += 1;}
|
||||
}else{
|
||||
spell = game->mLayers->stackLayer()->addSpell(copy,NULL, spellCost, payResult,0);
|
||||
player->castedspellsthisturn += 1;
|
||||
if(player->onlyonecast > 0 || player->onlyoneinstant > 0){player->castcount += 1;}
|
||||
}
|
||||
if(card->has(Constants::STORM)){
|
||||
int storm = player->castedspellsthisturn;
|
||||
@@ -625,6 +572,296 @@ HUDDisplay::~HUDDisplay(){
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//putting cards with restricting effects inplay
|
||||
MTGCantCasterstart::MTGCantCasterstart(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGCantCasterstart::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
if(card){
|
||||
if (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH]){
|
||||
int ok = 0;
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
Player * p = game->players[i];
|
||||
if (e->from == p->game->graveyard || e->from == p->game->hand || e->from == p->game->library || e->from == p->game->exile){ ok = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
Player * p = game->players[i];
|
||||
if (e->to == p->game->inPlay){//this will trigger a check if opponent or player cast the card.
|
||||
|
||||
MTGGameZone * z = card->controller()->game->inPlay;
|
||||
MTGGameZone * y = card->controller()->opponent()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
int onbcards = y->nb_cards;
|
||||
//check my battlefield and opponents
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHCANTCAST)){
|
||||
card->controller()->castrestrictedspell = 1;
|
||||
card->controller()->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::BOTHCANTCAST)){
|
||||
card->controller()->castrestrictedspell = 1;
|
||||
card->controller()->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
}
|
||||
//maybe one of us is still restricted, lets check...
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCAST)){
|
||||
card->controller()->castrestrictedspell = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCAST)){
|
||||
card->controller()->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//---how about if we cant cast creatures---
|
||||
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHNOCREATURE)){
|
||||
card->controller()->castrestrictedcreature += 1;
|
||||
card->controller()->opponent()->castrestrictedcreature += 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::BOTHNOCREATURE)){
|
||||
|
||||
card->controller()->castrestrictedcreature = 1;
|
||||
card->controller()->opponent()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTCREATURE)){
|
||||
card->controller()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCASTCREATURE)){
|
||||
card->controller()->opponent()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//---what if i can only cast 1?
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
card->controller()->life += 100;
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::ONLYONEBOTH)){
|
||||
card->controller()->onlyonecast = 1;
|
||||
card->controller()->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::ONLYONEBOTH)){
|
||||
card->controller()->onlyonecast = 1;
|
||||
card->controller()->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTTWO)){
|
||||
card->controller()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCASTTWO)){
|
||||
card->controller()->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//-----if a card with both*restrict* was found then the players are still restricted, if one player is still restricted he stays restricted.
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
ostream& MTGCantCasterstart::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGCantCasterstart ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGCantCasterstart::testDestroy(){return 0;}
|
||||
MTGCantCasterstart * MTGCantCasterstart::clone() const{
|
||||
MTGCantCasterstart * a = NEW MTGCantCasterstart(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//check if cast resristrictions are lifted when a card leaves play
|
||||
MTGCantCastercheck::MTGCantCastercheck(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGCantCastercheck::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
if (card && (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH])){
|
||||
int ok = 0;
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
Player * p = game->players[i];
|
||||
if (e->from == p->game->inPlay) ok = 1;
|
||||
}
|
||||
if (!ok) return 0;
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
Player * p = game->players[i];
|
||||
if (e->to == p->game->graveyard || e->to == p->game->hand || e->to == p->game->library || e->to == p->game->exile){//if it goes ANYWHERE but inplay.
|
||||
//check happens----------
|
||||
//reset restrictions
|
||||
p->onlyonecast = 0;
|
||||
p->opponent()->onlyonecast = 0;
|
||||
p->castrestrictedspell = 0;//0 means no restrictions apply.
|
||||
p->castrestrictedcreature = 0;
|
||||
p->opponent()->castrestrictedspell = 0;
|
||||
p->opponent()->castrestrictedcreature = 0;
|
||||
/*--------------------------------------------------------------*/
|
||||
MTGGameZone * z = card->controller()->game->inPlay;
|
||||
MTGGameZone * y = card->controller()->opponent()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
int onbcards = y->nb_cards;
|
||||
//check my battlefield and opponents
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHCANTCAST)){
|
||||
p->castrestrictedspell = 1;
|
||||
p->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::BOTHCANTCAST)){
|
||||
p->castrestrictedspell = 1;
|
||||
p->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
}
|
||||
//maybe one of us is still restricted, lets check...
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCAST)){
|
||||
p->castrestrictedspell = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCAST)){
|
||||
p->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//---how about if we cant cast creatures---
|
||||
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::BOTHNOCREATURE)){
|
||||
p->castrestrictedcreature = 1;
|
||||
p->opponent()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::BOTHNOCREATURE)){
|
||||
p->castrestrictedcreature = 1;
|
||||
p->opponent()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTCREATURE)){
|
||||
p->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCASTCREATURE)){
|
||||
p->opponent()->castrestrictedcreature = 1;
|
||||
}
|
||||
}
|
||||
//---what if i can only cast 1?
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::ONLYONEBOTH)){
|
||||
p->onlyonecast = 1;
|
||||
p->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::ONLYONEBOTH)){
|
||||
p->onlyonecast = 1;
|
||||
p->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTCASTTWO)){
|
||||
p->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//maybe opponent has one....
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::CANTCASTTWO)){
|
||||
p->opponent()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//-----if a card with both*restrict* was found then the players are still restricted, if one player is still restricted he stays restricted.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ostream& MTGCantCastercheck::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGCantCastercheck ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGCantCastercheck::testDestroy(){return 0;}
|
||||
MTGCantCastercheck * MTGCantCastercheck::clone() const{
|
||||
MTGCantCastercheck * a = NEW MTGCantCastercheck(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
//the end of this very complex code line.
|
||||
|
||||
|
||||
|
||||
//unearth rule----------------------------------
|
||||
//if the card leaves play, exile it instead.
|
||||
MTGUnearthRule::MTGUnearthRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
@@ -15,10 +15,11 @@ Player::Player(MTGPlayerCards * deck, string file, string fileSmall) : Damageabl
|
||||
castedspellsthisturn = 0;
|
||||
castrestrictedspell = 0;
|
||||
castrestrictedcreature = 0;
|
||||
cantcastcreature = 0;
|
||||
cantcastspell = 0;
|
||||
cantcastinso = 0;
|
||||
onlyonecast = 0;
|
||||
castcount = 0;
|
||||
nocreatureinstant = 0;
|
||||
nospellinstant = 0;
|
||||
onlyoneinstant = 0;
|
||||
poisonCount = 0;
|
||||
damageCount = 0;
|
||||
preventable = 0;
|
||||
|
||||
Reference in New Issue
Block a user