added support for no max hand size, added nonstatic lifetotal checks, added a check for how many equips a card has, added a fix for a typo in affinityswamp.
This commit is contained in:
@@ -55,6 +55,8 @@ public:
|
||||
intValue = computeX(spell,card);
|
||||
}else if (s == "xx" || s == "XX"){
|
||||
intValue = computeXX(spell,card);
|
||||
}else if (s == "equips"){
|
||||
intValue = target->equipment;
|
||||
}else if (s == "manacost"){
|
||||
intValue = target->getManaCost()->getConvertedCost();
|
||||
}else if (s == "lifetotal"){
|
||||
@@ -792,10 +794,19 @@ class AAWinGame:public ActivatedAbilityTP{
|
||||
int cantlosers = 0;
|
||||
MTGGameZone * z = ((Player *)_target)->opponent()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
for (int i = 0; i < nbcards; ++i){
|
||||
|
||||
for (int i = 0; i < nbcards; i++){
|
||||
MTGCardInstance * c = z->cards[i];
|
||||
if (c->has(Constants::CANTLOSE)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
MTGGameZone * k = ((Player *)_target)->game->inPlay;
|
||||
int onbcards = k->nb_cards;
|
||||
for (int m = 0; m < onbcards; ++m){
|
||||
MTGCardInstance * e = k->cards[m];
|
||||
if (e->has(Constants::CANTWIN)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
if(cantlosers < 1){
|
||||
@@ -1190,7 +1201,7 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//equipment
|
||||
class AEquip:public TargetAbility{
|
||||
public:
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
@@ -1199,6 +1210,7 @@ public:
|
||||
}
|
||||
|
||||
int unequip(){
|
||||
if(source->target){source->target->equipment -= 1;}
|
||||
source->target = NULL;
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i){
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
@@ -1215,6 +1227,7 @@ public:
|
||||
|
||||
int equip(MTGCardInstance * equipped){
|
||||
source->target = equipped;
|
||||
source->target->equipment += 1;
|
||||
AbilityFactory af;
|
||||
af.getAbilities(¤tAbilities,NULL,source);
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i){
|
||||
@@ -1233,7 +1246,6 @@ public:
|
||||
if (mTarget == source) return 0;
|
||||
unequip();
|
||||
equip(mTarget);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int flashedback;
|
||||
int paymenttype;
|
||||
int frozen;
|
||||
int equipment;
|
||||
int reduxamount;
|
||||
int regenerateTokens;
|
||||
int isToken;
|
||||
|
||||
@@ -131,9 +131,10 @@ class Constants
|
||||
AFFINITYMOUNTAIN = 73,
|
||||
AFFINITYSWAMP = 74,
|
||||
AFFINITYGREENCREATURES = 75,
|
||||
CANTWIN = 76,
|
||||
NOMAXHAND = 77,
|
||||
|
||||
|
||||
NB_BASIC_ABILITIES = 76,
|
||||
NB_BASIC_ABILITIES = 78,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
|
||||
@@ -22,6 +22,7 @@ class Player: public Damageable{
|
||||
JTexture * mAvatarTex;
|
||||
JQuad * mAvatar;
|
||||
int canPutLandsIntoPlay;
|
||||
int nomaxhandsize;
|
||||
int castedspellsthisturn;
|
||||
int onlyonecast;
|
||||
int castcount;
|
||||
|
||||
@@ -41,6 +41,27 @@ class ThisCounterAny:public ThisDescriptor{
|
||||
ThisCounterAny(int nb);
|
||||
};
|
||||
|
||||
class ThisControllerlife:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisControllerlife(int life);
|
||||
};
|
||||
|
||||
class ThisOpponentlife:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisOpponentlife(int olife);
|
||||
};
|
||||
|
||||
class ThisEquip:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisEquip(int equipment);
|
||||
};
|
||||
|
||||
class ThisPower:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
@@ -137,7 +137,7 @@ void GameObserver::nextGamePhase(){
|
||||
|
||||
if (currentGamePhase == Constants::MTG_PHASE_AFTER_EOT){
|
||||
//Auto Hand cleaning, in case the player didn't do it himself
|
||||
while(currentPlayer->game->hand->nb_cards > 7)
|
||||
while(currentPlayer->game->hand->nb_cards > 7 && currentPlayer->nomaxhandsize < 1)
|
||||
currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]);
|
||||
mLayers->actionLayer()->Update(0);
|
||||
return nextGamePhase();
|
||||
@@ -358,6 +358,14 @@ void GameObserver::stateEffects()
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::CANTLOSE) || c->has(Constants::CANTLIFELOSE)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
MTGGameZone * k = players[i]->opponent()->game->inPlay;
|
||||
int onbcards = k->nb_cards;
|
||||
for (int m = 0; m < onbcards; ++m){
|
||||
MTGCardInstance * e = k->cards[m];
|
||||
if (e->has(Constants::CANTWIN)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
if(cantlosers < 1){
|
||||
@@ -549,7 +557,7 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
||||
if (!card) return;
|
||||
|
||||
//Current player's hand
|
||||
if (currentPlayer->game->hand->hasCard(card) && currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7){
|
||||
if (currentPlayer->game->hand->hasCard(card) && currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7 && currentPlayer->nomaxhandsize < 1){
|
||||
currentPlayer->game->putInGraveyard(card);
|
||||
}else if (reaction){
|
||||
if (reaction == 1){
|
||||
|
||||
@@ -186,7 +186,8 @@ void GameStateOptions::Render()
|
||||
"",
|
||||
"Dev Team: Abrasax, almosthumane, Daddy32, Dr.Solomat"
|
||||
"J, Jeck, Leungclj, linshier, Salmelo, Superhiro",
|
||||
"Psyringe, Wololo, Yeshua, Zethfox",
|
||||
"Psyringe, Wololo, Yeshua, Zethfox,",
|
||||
"Special thanks to Mnguyen(mico) for the awesome menu improvements,",
|
||||
"",
|
||||
"Music by Celestial Aeon Project, http://www.jamendo.com",
|
||||
"",
|
||||
|
||||
@@ -99,6 +99,7 @@ void MTGCardInstance::initMTGCI(){
|
||||
tapped = 0;
|
||||
untapping = 0;
|
||||
frozen = 0;
|
||||
equipment = NULL;
|
||||
boughtback = 0;
|
||||
flashedback = 0;
|
||||
paymenttype = 0;
|
||||
|
||||
@@ -84,6 +84,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"affinitymountains",
|
||||
"affinityswamps",
|
||||
"affinitygreencreatures",
|
||||
"cantwin",
|
||||
"nomaxhand",
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,15 @@ void MTGPlayerCards::drawFromLibrary(){
|
||||
if (c->has(Constants::CANTLOSE) || c->has(Constants::CANTMILLLOSE)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
MTGGameZone * k = library->owner->opponent()->game->inPlay;
|
||||
int onbcards = k->nb_cards;
|
||||
for (int m = 0; m < onbcards; ++m){
|
||||
MTGCardInstance * e = k->cards[m];
|
||||
if (e->has(Constants::CANTWIN)){
|
||||
cantlosers++;
|
||||
}
|
||||
}
|
||||
if(cantlosers < 1){
|
||||
GameObserver::GetInstance()->gameOver = library->owner;}
|
||||
return;
|
||||
|
||||
@@ -1091,7 +1091,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
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]){
|
||||
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] || card->basicAbilities[Constants::NOMAXHAND] ){
|
||||
int ok = 0;
|
||||
|
||||
|
||||
@@ -1109,6 +1109,21 @@ HUDDisplay::~HUDDisplay(){
|
||||
MTGGameZone * y = card->controller()->opponent()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
int onbcards = y->nb_cards;
|
||||
//handsize modifier
|
||||
//check my battlefield and opponents
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::NOMAXHAND)){
|
||||
card->controller()->nomaxhandsize = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::NOMAXHAND)){
|
||||
card->controller()->opponent()->nomaxhandsize = 1;
|
||||
}
|
||||
}
|
||||
//--------------both cant cast-----------------
|
||||
//check my battlefield and opponents
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
@@ -1235,7 +1250,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
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])){
|
||||
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]|| card->basicAbilities[Constants::NOMAXHAND])){
|
||||
int ok = 0;
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
Player * p = game->players[i];
|
||||
@@ -1247,6 +1262,8 @@ HUDDisplay::~HUDDisplay(){
|
||||
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->nomaxhandsize = 0;
|
||||
p->opponent()->nomaxhandsize = 0;
|
||||
p->onlyonecast = 0;
|
||||
p->opponent()->onlyonecast = 0;
|
||||
p->castrestrictedspell = 0;//0 means no restrictions apply.
|
||||
@@ -1258,6 +1275,21 @@ HUDDisplay::~HUDDisplay(){
|
||||
MTGGameZone * y = card->controller()->opponent()->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
int onbcards = y->nb_cards;
|
||||
|
||||
//no max hand size
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::NOMAXHAND)){
|
||||
p->nomaxhandsize = 1;
|
||||
}
|
||||
} //any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::NOMAXHAND)){
|
||||
p->opponent()->nomaxhandsize = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//check my battlefield and opponents
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
@@ -1705,7 +1737,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
for (int j = 0; j < nbcards; ++j){
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (c->has(Constants::AFFINITYSWAMP)){
|
||||
if(c->reduxamount > 0){ c->reduxamount -+ 1;}
|
||||
if(c->reduxamount > 0){ c->reduxamount -= 1;}
|
||||
else{
|
||||
c->getManaCost()->add(0,1);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ Player::Player(MTGPlayerCards * deck, string file, string fileSmall) : Damageabl
|
||||
game->setOwner(this);
|
||||
manaPool = NEW ManaPool(this);
|
||||
canPutLandsIntoPlay = 1;
|
||||
nomaxhandsize = 0;
|
||||
castedspellsthisturn = 0;
|
||||
castrestrictedspell = 0;
|
||||
castrestrictedcreature = 0;
|
||||
|
||||
@@ -126,7 +126,40 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//power
|
||||
//equips
|
||||
found = s.find("equip");
|
||||
if (found != string::npos) {
|
||||
ThisEquip * td = NEW ThisEquip(criterion);
|
||||
if (td) {
|
||||
td->comparisonMode = mode;
|
||||
return td;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//controller life
|
||||
found = s.find("opponentlife");
|
||||
if (found != string::npos) {
|
||||
ThisOpponentlife * td = NEW ThisOpponentlife(criterion);
|
||||
if (td) {
|
||||
td->comparisonMode = mode;
|
||||
return td;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//controller life
|
||||
found = s.find("controllerlife");
|
||||
if (found != string::npos) {
|
||||
ThisControllerlife * td = NEW ThisControllerlife(criterion);
|
||||
if (td) {
|
||||
td->comparisonMode = mode;
|
||||
return td;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//power
|
||||
found = s.find("power");
|
||||
if (found != string::npos) {
|
||||
ThisPower * td = NEW ThisPower(criterion);
|
||||
@@ -198,6 +231,22 @@ ThisCounter::~ThisCounter() {
|
||||
SAFE_DELETE(counter);
|
||||
}
|
||||
|
||||
ThisOpponentlife::ThisOpponentlife(int olife){
|
||||
comparisonCriterion = olife;
|
||||
}
|
||||
|
||||
int ThisOpponentlife::match(MTGCardInstance * card){
|
||||
return matchValue(card->controller()->opponent()->life);
|
||||
}
|
||||
|
||||
ThisControllerlife::ThisControllerlife(int life){
|
||||
comparisonCriterion = life;
|
||||
}
|
||||
|
||||
int ThisControllerlife::match(MTGCardInstance * card){
|
||||
return matchValue(card->controller()->life);
|
||||
}
|
||||
|
||||
ThisPower::ThisPower(int power){
|
||||
comparisonCriterion = power;
|
||||
}
|
||||
@@ -206,6 +255,14 @@ int ThisPower::match(MTGCardInstance * card){
|
||||
return matchValue(card->power);
|
||||
}
|
||||
|
||||
ThisEquip::ThisEquip(int equipment){
|
||||
comparisonCriterion = equipment;
|
||||
}
|
||||
int ThisEquip::match(MTGCardInstance * card){
|
||||
return matchValue(card->equipment);
|
||||
}
|
||||
|
||||
|
||||
ThisToughness::ThisToughness(int toughness){
|
||||
comparisonCriterion = toughness;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user