J :
* Split constants file to have them in a single place.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIPlayer.o objs/AIStats.o objs/Blocker.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/ConstraintResolver.o objs/Counters.o objs/Damage.o objs/DamagerDamaged.o objs/DamageResolverLayer.o objs/DeckDataWrapper.o objs/DeckStats.o objs/DuelLayers.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GuiCardsController.o objs/GuiLayers.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGGuiHand.o objs/MTGGuiPlay.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PriceList.o objs/ShopItem.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TexturesCache.o objs/Token.o objs/utils.o
|
||||
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIPlayer.o objs/AIStats.o objs/Blocker.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/ConstraintResolver.o objs/Counters.o objs/Damage.o objs/DamagerDamaged.o objs/DamageResolverLayer.o objs/DeckDataWrapper.o objs/DeckStats.o objs/DuelLayers.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GuiCardsController.o objs/GuiLayers.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGGuiHand.o objs/MTGGuiPlay.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PriceList.o objs/ShopItem.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TexturesCache.o objs/Token.o objs/utils.o
|
||||
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
||||
|
||||
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
||||
|
||||
@@ -57,15 +57,15 @@ public:
|
||||
|
||||
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
|
||||
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
unsigned int found = sabilities.find(MTGBasicAbilities[j]);
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
unsigned int found = sabilities.find(Constants::MTGBasicAbilities[j]);
|
||||
if (found != string::npos){
|
||||
abilities.push_back(j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < MTG_NB_COLORS; j++){
|
||||
unsigned int found = sabilities.find(MTGColorStrings[j]);
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
||||
unsigned int found = sabilities.find(Constants::MTGColorStrings[j]);
|
||||
if (found != string::npos){
|
||||
colors.push_back(j);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class ABasicAbilityModifierUntilEOT:public TargetAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
for (int i = 0; i < nbTargets; i++){
|
||||
MTGCardInstance * mTarget = mTargets[i];
|
||||
if(mTarget && mTarget->basicAbilities[ability]){
|
||||
@@ -239,7 +239,7 @@ class ABasicAbilityModifierUntilEOT:public TargetAbility{
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
return MTGBasicAbilities[ability];
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
_target->basicAbilities[ability] = stateBeforeActivation;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
return MTGBasicAbilities[ability];
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
|
||||
};
|
||||
@@ -372,7 +372,7 @@ class AUntaperOnceDuringTurn:public AUnBlocker{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) untappedThisTurn = 0;
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) untappedThisTurn = 0;
|
||||
AUnBlocker::Update(dt);
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ class ATargetterPowerToughnessModifierUntilEOT: public TargetAbility{
|
||||
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
for (int i = 0; i < nbTargets; i++){
|
||||
MTGCardInstance * mTarget = mTargets[i];
|
||||
if(mTarget){
|
||||
@@ -478,7 +478,7 @@ class APowerToughnessModifierUntilEndOfTurn: public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
while(counters){
|
||||
((MTGCardInstance *)target)->power -= power;
|
||||
((MTGCardInstance *)target)->addToToughness(-toughness);
|
||||
@@ -596,15 +596,15 @@ class AManaProducer: public MTGAbility{
|
||||
|
||||
int landColor = output->getMainColor();
|
||||
|
||||
if (landColor == MTG_COLOR_RED){
|
||||
if (landColor == Constants::MTG_COLOR_RED){
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/manared.psi",GameApp::CommonRes->GetQuad("particles"));
|
||||
}else if (landColor == MTG_COLOR_BLUE){
|
||||
}else if (landColor == Constants::MTG_COLOR_BLUE){
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/manablue.psi", GameApp::CommonRes->GetQuad("particles"));
|
||||
}else if (landColor == MTG_COLOR_GREEN){
|
||||
}else if (landColor == Constants::MTG_COLOR_GREEN){
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/managreen.psi", GameApp::CommonRes->GetQuad("particles"));
|
||||
}else if (landColor == MTG_COLOR_BLACK){
|
||||
}else if (landColor == Constants::MTG_COLOR_BLACK){
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/manablack.psi", GameApp::CommonRes->GetQuad("particles"));
|
||||
}else if (landColor == MTG_COLOR_WHITE){
|
||||
}else if (landColor == Constants::MTG_COLOR_WHITE){
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/manawhite.psi", GameApp::CommonRes->GetQuad("particles"));
|
||||
}else{
|
||||
mParticleSys = NEW hgeParticleSystem("graphics/mana.psi", GameApp::CommonRes->GetQuad("particles"));
|
||||
@@ -685,19 +685,19 @@ class AManaProducer: public MTGAbility{
|
||||
sprintf(buffer, "%i ", value);
|
||||
menutext.append(buffer);
|
||||
switch (i){
|
||||
case MTG_COLOR_RED:
|
||||
case Constants::MTG_COLOR_RED:
|
||||
menutext.append("red");
|
||||
break;
|
||||
case MTG_COLOR_BLUE:
|
||||
case Constants::MTG_COLOR_BLUE:
|
||||
menutext.append("blue");
|
||||
break;
|
||||
case MTG_COLOR_GREEN:
|
||||
case Constants::MTG_COLOR_GREEN:
|
||||
menutext.append("green");
|
||||
break;
|
||||
case MTG_COLOR_WHITE:
|
||||
case Constants::MTG_COLOR_WHITE:
|
||||
menutext.append("white");
|
||||
break;
|
||||
case MTG_COLOR_BLACK:
|
||||
case Constants::MTG_COLOR_BLACK:
|
||||
menutext.append("black");
|
||||
break;
|
||||
default:
|
||||
@@ -761,7 +761,7 @@ class ALifeLink:public MTGAbility{
|
||||
class ACircleOfProtection: public TargetAbility{
|
||||
public:
|
||||
ACircleOfProtection(int _id, MTGCardInstance * source, int _color):TargetAbility(_id,source,NEW DamageTargetChooser(source,_color),NEW ManaCost(),0,0){
|
||||
cost->add(MTG_COLOR_ARTIFACT,1);
|
||||
cost->add(Constants::MTG_COLOR_ARTIFACT,1);
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
@@ -1193,7 +1193,7 @@ class AOldSchoolDeathtouch:public MTGAbility{
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase){
|
||||
if( newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
if( newPhase == Constants::MTG_PHASE_COMBATDAMAGE){
|
||||
nbOpponents = 0;
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
while (opponent && !opponent->hasSubtype("wall")){
|
||||
@@ -1201,7 +1201,7 @@ class AOldSchoolDeathtouch:public MTGAbility{
|
||||
nbOpponents ++;
|
||||
opponent = source->getNextOpponent(opponent);
|
||||
}
|
||||
}else if (newPhase == MTG_PHASE_COMBATEND){
|
||||
}else if (newPhase == Constants::MTG_PHASE_COMBATEND){
|
||||
for (int i = 0; i < nbOpponents ; i++){
|
||||
game->mLayers->stackLayer()->addPutInGraveyard(opponents[i]);
|
||||
}
|
||||
@@ -1210,7 +1210,7 @@ class AOldSchoolDeathtouch:public MTGAbility{
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if(!game->isInPlay(source) && currentPhase != MTG_PHASE_UNTAP){
|
||||
if(!game->isInPlay(source) && currentPhase != Constants::MTG_PHASE_UNTAP){
|
||||
return 0;
|
||||
}else{
|
||||
return MTGAbility::testDestroy();
|
||||
@@ -1332,22 +1332,22 @@ class AArmageddonClock:public MTGAbility{
|
||||
ManaCost cost;
|
||||
AArmageddonClock(int id, MTGCardInstance * _source):MTGAbility(id, _source){
|
||||
counters = 0;
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 4};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
||||
cost = ManaCost(_cost,1);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase){
|
||||
if (newPhase == MTG_PHASE_UPKEEP && game->currentPlayer->game->inPlay->hasCard(source)){
|
||||
if (newPhase == Constants::MTG_PHASE_UPKEEP && game->currentPlayer->game->inPlay->hasCard(source)){
|
||||
counters ++;
|
||||
}else if (newPhase == MTG_PHASE_DRAW && counters > 0 && game->currentPlayer->game->inPlay->hasCard(source)){ //End of upkeep = beginning of draw
|
||||
}else if (newPhase == Constants::MTG_PHASE_DRAW && counters > 0 && game->currentPlayer->game->inPlay->hasCard(source)){ //End of upkeep = beginning of draw
|
||||
GameObserver::GetInstance()->mLayers->stackLayer()->addDamage(source,GameObserver::GetInstance()->players[0], counters);
|
||||
GameObserver::GetInstance()->mLayers->stackLayer()->addDamage(source,GameObserver::GetInstance()->players[1], counters);
|
||||
}
|
||||
}
|
||||
}
|
||||
int isReactingToClick(MTGCardInstance * _card){
|
||||
if (counters > 0 && _card == source && currentPhase == MTG_PHASE_UPKEEP){
|
||||
if (counters > 0 && _card == source && currentPhase == Constants::MTG_PHASE_UPKEEP){
|
||||
if (game->currentlyActing()->getManaPool()->canAfford( & cost)){
|
||||
return 1;
|
||||
}
|
||||
@@ -1373,10 +1373,10 @@ class ABlackVise: public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase == MTG_PHASE_UPKEEP && GameObserver::GetInstance()->opponent()->game->inPlay->hasCard(source)){
|
||||
if (newPhase == Constants::MTG_PHASE_UPKEEP && GameObserver::GetInstance()->opponent()->game->inPlay->hasCard(source)){
|
||||
nbcards = game->currentPlayer->game->hand->nb_cards;
|
||||
}
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_DRAW && GameObserver::GetInstance()->opponent()->game->inPlay->hasCard(source)){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_DRAW && GameObserver::GetInstance()->opponent()->game->inPlay->hasCard(source)){
|
||||
if ( nbcards > 4) game->mLayers->stackLayer()->addDamage(source,game->currentPlayer, nbcards - 4);
|
||||
}
|
||||
}
|
||||
@@ -1400,12 +1400,12 @@ class AChannel:public ActivatedAbility{
|
||||
|
||||
int resolve(){
|
||||
source->controller()->life--;
|
||||
source->controller()->getManaPool()->add(MTG_COLOR_ARTIFACT, 1);
|
||||
source->controller()->getManaPool()->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) return 1;
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) return 1;
|
||||
currentPhase = newPhase;
|
||||
return 0;
|
||||
}
|
||||
@@ -1420,12 +1420,12 @@ class AClockworkBeast:public MTGAbility{
|
||||
AClockworkBeast(int id, MTGCardInstance * _source):MTGAbility(id, _source){
|
||||
counters = 7;
|
||||
((MTGCardInstance *)target)->power+=7;
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
cost = ManaCost(_cost,1);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_COMBATEND){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_COMBATEND){
|
||||
if (((MTGCardInstance *)source)->isAttacker() || ((MTGCardInstance *)source)->isDefenser()){
|
||||
counters--;
|
||||
((MTGCardInstance *)target)->power-=1;
|
||||
@@ -1433,7 +1433,7 @@ class AClockworkBeast:public MTGAbility{
|
||||
}
|
||||
}
|
||||
int isReactingToClick(MTGCardInstance * _card){
|
||||
if (counters < 7 && _card == source && currentPhase == MTG_PHASE_UPKEEP && game->currentPlayer->game->inPlay->hasCard(source)){
|
||||
if (counters < 7 && _card == source && currentPhase == Constants::MTG_PHASE_UPKEEP && game->currentPlayer->game->inPlay->hasCard(source)){
|
||||
if (game->currentlyActing()->getManaPool()->canAfford( & cost)){
|
||||
return 1;
|
||||
}
|
||||
@@ -1458,7 +1458,7 @@ class AConservator: public MTGAbility{
|
||||
ManaCost cost;
|
||||
AConservator(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
|
||||
canprevent = 0;
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 2};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 2};
|
||||
cost = ManaCost(_cost, 1);
|
||||
}
|
||||
|
||||
@@ -1586,7 +1586,7 @@ class ADisruptingScepter:public TargetAbility{
|
||||
ADisruptingScepter(int id, MTGCardInstance * _source):TargetAbility(id,_source){
|
||||
MTGGameZone * zones[] = {GameObserver::GetInstance()->opponent()->game->hand};
|
||||
tc = NEW TargetZoneChooser(zones,1,_source);
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 3};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 3};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
}
|
||||
|
||||
@@ -1617,7 +1617,7 @@ class AEbonyHorse:public TargetAbility{
|
||||
public:
|
||||
|
||||
AEbonyHorse(int _id, MTGCardInstance * _source):TargetAbility(_id,_source, NEW CreatureTargetChooser()){
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 2};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 2};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
}
|
||||
|
||||
@@ -1632,14 +1632,14 @@ class AEbonyHorse:public TargetAbility{
|
||||
class AFarmstead:public ActivatedAbility{
|
||||
public:
|
||||
AFarmstead(int _id, MTGCardInstance * source, MTGCardInstance * _target):ActivatedAbility(_id, source,0,1,0){
|
||||
int _cost[] = {MTG_COLOR_WHITE, 2};
|
||||
int _cost[] = {Constants::MTG_COLOR_WHITE, 2};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
target = _target;
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
if (!ActivatedAbility::isReactingToClick(card)) return 0;
|
||||
if (currentPhase == MTG_PHASE_UPKEEP) return 1;
|
||||
if (currentPhase == Constants::MTG_PHASE_UPKEEP) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1706,7 +1706,7 @@ class AHowlingMine:public MTGAbility{
|
||||
AHowlingMine(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_DRAW && !source->tapped){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_DRAW && !source->tapped){
|
||||
game->mLayers->stackLayer()->addDraw(game->currentPlayer);
|
||||
}
|
||||
}
|
||||
@@ -1716,7 +1716,7 @@ class AHowlingMine:public MTGAbility{
|
||||
class AJayemdaeTome:public ActivatedAbility{
|
||||
public:
|
||||
AJayemdaeTome(int _id, MTGCardInstance * card):ActivatedAbility(_id, card){
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 4};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
}
|
||||
|
||||
@@ -1740,7 +1740,7 @@ class ALivingArtifact:public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) usedThisTurn = 0;
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) usedThisTurn = 0;
|
||||
Damage * damage = ((Damage *)game->mLayers->stackLayer()->getNext(latest,ACTION_DAMAGE,RESOLVED_OK));
|
||||
while (damage){
|
||||
if (damage->target == source->controller()){
|
||||
@@ -1752,7 +1752,7 @@ class ALivingArtifact:public MTGAbility{
|
||||
}
|
||||
|
||||
int isReactingtoclick(MTGCardInstance * card){
|
||||
if (currentPhase == MTG_PHASE_UPKEEP && card == source && game->currentPlayer == source->controller() && counters && !usedThisTurn){
|
||||
if (currentPhase == Constants::MTG_PHASE_UPKEEP && card == source && game->currentPlayer == source->controller() && counters && !usedThisTurn){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1777,9 +1777,9 @@ class ALordOfThePit: public TargetAbility{
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && source->controller() == game->currentPlayer){
|
||||
if (newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
paidThisTurn = 0;
|
||||
}else if( newPhase == MTG_PHASE_UPKEEP + 1 && !paidThisTurn){
|
||||
}else if( newPhase == Constants::MTG_PHASE_UPKEEP + 1 && !paidThisTurn){
|
||||
game->mLayers->stackLayer()->addDamage(source,source->controller(), 7);
|
||||
}
|
||||
}
|
||||
@@ -1787,7 +1787,7 @@ class ALordOfThePit: public TargetAbility{
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
if (currentPhase != MTG_PHASE_UPKEEP || paidThisTurn) return 0;
|
||||
if (currentPhase != Constants::MTG_PHASE_UPKEEP || paidThisTurn) return 0;
|
||||
return TargetAbility::isReactingToClick(card);
|
||||
}
|
||||
|
||||
@@ -1839,11 +1839,11 @@ class AErgRaiders:public MTGAbility{
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase){
|
||||
Player * controller = source->controller();
|
||||
if (newPhase == MTG_PHASE_COMBATDAMAGE && game->currentPlayer == controller){
|
||||
if (newPhase == Constants::MTG_PHASE_COMBATDAMAGE && game->currentPlayer == controller){
|
||||
if (!source->isAttacker() && init){
|
||||
dealDamage = 1;
|
||||
}
|
||||
}else if (newPhase == MTG_PHASE_UNTAP && game->currentPlayer != controller){
|
||||
}else if (newPhase == Constants::MTG_PHASE_UNTAP && game->currentPlayer != controller){
|
||||
if (dealDamage){
|
||||
game->mLayers->stackLayer()->addDamage(source, controller,2);
|
||||
}
|
||||
@@ -1864,7 +1864,7 @@ class AFastbond:public TriggeredAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase!=currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase!=currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
alreadyPlayedALand = 0;
|
||||
}
|
||||
TriggeredAbility::Update(dt);
|
||||
@@ -1899,7 +1899,7 @@ class AHypnoticSpecter:public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
for (int i = 0; i < 2; i++){
|
||||
nbdamagesthisturn[i] = 0;
|
||||
}
|
||||
@@ -1938,7 +1938,7 @@ class AHypnoticSpecter:public MTGAbility{
|
||||
class AJandorsRing:public ActivatedAbility{
|
||||
public:
|
||||
AJandorsRing(int _id, MTGCardInstance * _source):ActivatedAbility(_id,_source, NEW ManaCost()){
|
||||
cost->add(MTG_COLOR_ARTIFACT, 2);
|
||||
cost->add(Constants::MTG_COLOR_ARTIFACT, 2);
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
@@ -2013,7 +2013,6 @@ class AKudzu: public TargetAbility{
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
int stillLandsInPlay = 0;
|
||||
for (int i = 0; i < 2; i++){
|
||||
if (game->players[i]->game->inPlay->hasType("land")) stillLandsInPlay = 1;
|
||||
@@ -2037,7 +2036,7 @@ class AKudzu: public TargetAbility{
|
||||
class AMillstone:public TargetAbility{
|
||||
public:
|
||||
AMillstone(int _id, MTGCardInstance * card):TargetAbility(_id,card, NEW PlayerTargetChooser(), NEW ManaCost()){
|
||||
cost->add(MTG_COLOR_ARTIFACT, 2);
|
||||
cost->add(Constants::MTG_COLOR_ARTIFACT, 2);
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
@@ -2084,11 +2083,11 @@ class ANightmare:public ListMaintainerAbility{
|
||||
class APestilence: public ActivatedAbility{
|
||||
public:
|
||||
APestilence(int _id, MTGCardInstance * card):ActivatedAbility(_id, card, NEW ManaCost(), 0,0){
|
||||
cost->add(MTG_COLOR_BLACK, 1);
|
||||
cost->add(Constants::MTG_COLOR_BLACK, 1);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase !=currentPhase && newPhase == MTG_PHASE_EOT){
|
||||
if (newPhase !=currentPhase && newPhase == Constants::MTG_PHASE_EOT){
|
||||
if (!game->players[0]->game->inPlay->hasType("creature") && !game->players[1]->game->inPlay->hasType("creature")){
|
||||
source->controller()->game->putInGraveyard(source);
|
||||
}
|
||||
@@ -2145,13 +2144,13 @@ class APowerLeak:public TriggeredAbility{
|
||||
int damagesToDealThisTurn;
|
||||
ManaCost cost;
|
||||
APowerLeak(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id, _source, _target){
|
||||
cost.add(MTG_COLOR_ARTIFACT, 1);
|
||||
cost.add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
damagesToDealThisTurn = 0;
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UPKEEP && _target->controller() == game->currentPlayer){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UPKEEP && _target->controller() == game->currentPlayer){
|
||||
damagesToDealThisTurn = 2;
|
||||
}
|
||||
TriggeredAbility::Update(dt);
|
||||
@@ -2159,7 +2158,7 @@ class APowerLeak:public TriggeredAbility{
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (damagesToDealThisTurn && currentPhase == MTG_PHASE_UPKEEP && card==source && _target->controller() == game->currentPlayer){
|
||||
if (damagesToDealThisTurn && currentPhase == Constants::MTG_PHASE_UPKEEP && card==source && _target->controller() == game->currentPlayer){
|
||||
if (game->currentPlayer->getManaPool()->canAfford(& cost)) return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -2173,7 +2172,7 @@ class APowerLeak:public TriggeredAbility{
|
||||
|
||||
int trigger(){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_DRAW && _target->controller() == game->currentPlayer){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_DRAW && _target->controller() == game->currentPlayer){
|
||||
if (damagesToDealThisTurn) return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -2195,7 +2194,7 @@ class APowerSurge:public TriggeredAbility{
|
||||
}
|
||||
|
||||
int trigger(){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_EOT){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_EOT){
|
||||
//That's ugly but untapped land at the beginning of the turn are opponent's untapped lands at the end of the turn
|
||||
totalLands = 0;
|
||||
MTGInPlay * inPlay = game->opponent()->game->inPlay;
|
||||
@@ -2206,7 +2205,7 @@ class APowerSurge:public TriggeredAbility{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UPKEEP && totalLands){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UPKEEP && totalLands){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -2250,7 +2249,7 @@ class ASacrifice:public InstantAbility{
|
||||
if (_target->isInPlay()){
|
||||
game->currentlyActing()->game->putInGraveyard(_target);
|
||||
int x = _target->getManaCost()->getConvertedCost();
|
||||
game->currentlyActing()->getManaPool()->add(MTG_COLOR_BLACK, x);
|
||||
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_BLACK, x);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -2312,7 +2311,7 @@ class ASerendibEfreet:public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase == MTG_PHASE_UPKEEP && newPhase != currentPhase && game->currentPlayer == source->controller()){
|
||||
if (newPhase == Constants::MTG_PHASE_UPKEEP && newPhase != currentPhase && game->currentPlayer == source->controller()){
|
||||
game->mLayers->stackLayer()->addDamage(source,game->currentPlayer,1);
|
||||
}
|
||||
}
|
||||
@@ -2362,7 +2361,7 @@ class AWanderlust:public TriggeredAbility{
|
||||
AWanderlust(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source, _target){}
|
||||
|
||||
int trigger(){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UPKEEP && ((MTGCardInstance *) target)->controller()==game->currentPlayer){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UPKEEP && ((MTGCardInstance *) target)->controller()==game->currentPlayer){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -2387,7 +2386,7 @@ class AAtog:public TargetAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
for (int i = 0; i < counters; i++){
|
||||
source->power-=2;
|
||||
source->addToToughness(-2);
|
||||
@@ -2420,11 +2419,11 @@ class AAtog:public TargetAbility{
|
||||
class ADragonWhelp: public APowerToughnessModifierUntilEndOfTurn{
|
||||
public:
|
||||
ADragonWhelp(int id, MTGCardInstance * card):APowerToughnessModifierUntilEndOfTurn(id, card, card, 1, 0, NEW ManaCost()){
|
||||
cost->add(MTG_COLOR_RED, 1);
|
||||
cost->add(Constants::MTG_COLOR_RED, 1);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP && counters > 3){
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP && counters > 3){
|
||||
source->controller()->game->putInGraveyard(source);
|
||||
}
|
||||
APowerToughnessModifierUntilEndOfTurn::Update(dt);
|
||||
@@ -2435,7 +2434,7 @@ class ADragonWhelp: public APowerToughnessModifierUntilEndOfTurn{
|
||||
//1288 EarthBind
|
||||
class AEarthbind:public ABasicAbilityModifier{
|
||||
public:
|
||||
AEarthbind(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ABasicAbilityModifier(_id,_source,_target,FLYING,0){
|
||||
AEarthbind(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ABasicAbilityModifier(_id,_source,_target,Constants::FLYING,0){
|
||||
if (value_before_modification) game->mLayers->stackLayer()->addDamage(source,target,2);
|
||||
}
|
||||
};
|
||||
@@ -2461,14 +2460,14 @@ class AForceOfNature:public ActivatedAbility{
|
||||
int dealDamageThisTurn;
|
||||
AForceOfNature(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){
|
||||
dealDamageThisTurn = 0;
|
||||
cost->add(MTG_COLOR_GREEN,4);
|
||||
cost->add(Constants::MTG_COLOR_GREEN,4);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase !=currentPhase){
|
||||
if (newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
dealDamageThisTurn = 1;
|
||||
}else if (newPhase == MTG_PHASE_DRAW && dealDamageThisTurn && game->currentPlayer==source->controller() ){
|
||||
}else if (newPhase == Constants::MTG_PHASE_DRAW && dealDamageThisTurn && game->currentPlayer==source->controller() ){
|
||||
game->mLayers->stackLayer()->addDamage(source,source->controller(),8);
|
||||
}
|
||||
}
|
||||
@@ -2476,7 +2475,7 @@ class AForceOfNature:public ActivatedAbility{
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
return (dealDamageThisTurn && currentPhase == MTG_PHASE_UPKEEP && ActivatedAbility::isReactingToClick(card));
|
||||
return (dealDamageThisTurn && currentPhase == Constants::MTG_PHASE_UPKEEP && ActivatedAbility::isReactingToClick(card));
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
@@ -2605,19 +2604,19 @@ class AIslandSanctuary:public MTGAbility{
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
if (currentPhase == MTG_PHASE_UNTAP && game->currentPlayer == source->controller()) initThisTurn = 0;
|
||||
if (currentPhase == Constants::MTG_PHASE_UNTAP && game->currentPlayer == source->controller()) initThisTurn = 0;
|
||||
|
||||
if (initThisTurn && currentPhase == MTG_PHASE_COMBATATTACKERS && game->currentPlayer != source->controller()){
|
||||
if (initThisTurn && currentPhase == Constants::MTG_PHASE_COMBATATTACKERS && game->currentPlayer != source->controller()){
|
||||
MTGGameZone * zone = game->currentPlayer->game->inPlay;
|
||||
for (int i = 0; i < zone->nb_cards; i++){
|
||||
MTGCardInstance * card = zone->cards[i];
|
||||
if (card->isAttacker() && !card->basicAbilities[FLYING] && !card->basicAbilities[ISLANDWALK]) card->attacker=0;
|
||||
if (card->isAttacker() && !card->basicAbilities[Constants::FLYING] && !card->basicAbilities[Constants::ISLANDWALK]) card->attacker=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
if (card==source && game->currentPlayer == card->controller() && currentPhase == MTG_PHASE_DRAW){
|
||||
if (card==source && game->currentPlayer == card->controller() && currentPhase == Constants::MTG_PHASE_DRAW){
|
||||
Interruptible * action = game->mLayers->stackLayer()->_(-1);
|
||||
if (action->type == ACTION_DRAW) return 1;
|
||||
}
|
||||
@@ -2640,7 +2639,7 @@ class AKarma: public TriggeredAbility{
|
||||
}
|
||||
|
||||
int trigger(){
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UPKEEP) return 1;
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UPKEEP) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2659,14 +2658,14 @@ class AKarma: public TriggeredAbility{
|
||||
class ANorthernPaladin:public TargetAbility{
|
||||
public:
|
||||
ANorthernPaladin(int _id, MTGCardInstance * card):TargetAbility(_id, card){
|
||||
int _cost[] = {MTG_COLOR_WHITE, 2};
|
||||
int _cost[] = {Constants::MTG_COLOR_WHITE, 2};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
tc = NEW TargetChooser();
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
MTGCardInstance * card = tc->getNextCardTarget();
|
||||
if (card->hasColor(MTG_COLOR_BLACK)){
|
||||
if (card->hasColor(Constants::MTG_COLOR_BLACK)){
|
||||
card->controller()->game->putInGraveyard(card);
|
||||
return 1;
|
||||
}
|
||||
@@ -2707,7 +2706,7 @@ class ASoulNet:public ActivatedAbility{
|
||||
PutInGraveyard * latest;
|
||||
PutInGraveyard * newDead;
|
||||
ASoulNet(int _id, MTGCardInstance * card):ActivatedAbility(_id, card,0,0,0){
|
||||
int _cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
cost = NEW ManaCost(_cost,1);
|
||||
latest = ((PutInGraveyard *) GameObserver::GetInstance()->mLayers->stackLayer()->getPrevious(NULL,ACTION_PUTINGRAVEYARD,RESOLVED_OK));
|
||||
newDead = latest;
|
||||
@@ -2733,22 +2732,22 @@ class AStasis:public ActivatedAbility{
|
||||
int paidThisTurn;
|
||||
AStasis(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){
|
||||
paidThisTurn = 1;
|
||||
cost->add(MTG_COLOR_BLUE,1);
|
||||
cost->add(Constants::MTG_COLOR_BLUE,1);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
//Upkeep Cost
|
||||
if (newPhase !=currentPhase){
|
||||
if (newPhase == MTG_PHASE_UPKEEP){
|
||||
if (newPhase == Constants::MTG_PHASE_UPKEEP){
|
||||
paidThisTurn = 0;
|
||||
}else if (!paidThisTurn && newPhase > MTG_PHASE_UPKEEP && game->currentPlayer==source->controller() ){
|
||||
}else if (!paidThisTurn && newPhase > Constants::MTG_PHASE_UPKEEP && game->currentPlayer==source->controller() ){
|
||||
game->currentPlayer->game->putInGraveyard(source);
|
||||
paidThisTurn = 1;
|
||||
}
|
||||
}
|
||||
//Stasis Effect
|
||||
for (int i = 0; i < 2; i++){
|
||||
game->phaseRing->removePhase(MTG_PHASE_UNTAP,game->players[i]);
|
||||
game->phaseRing->removePhase(Constants::MTG_PHASE_UNTAP,game->players[i]);
|
||||
}
|
||||
|
||||
//Parent Class Method Call
|
||||
@@ -2756,7 +2755,7 @@ class AStasis:public ActivatedAbility{
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
return (!paidThisTurn && currentPhase == MTG_PHASE_UPKEEP && ActivatedAbility::isReactingToClick(card));
|
||||
return (!paidThisTurn && currentPhase == Constants::MTG_PHASE_UPKEEP && ActivatedAbility::isReactingToClick(card));
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
@@ -2766,7 +2765,7 @@ class AStasis:public ActivatedAbility{
|
||||
|
||||
int destroy(){
|
||||
for (int i = 0; i < 2; i++){
|
||||
game->phaseRing->addPhaseBefore(MTG_PHASE_UNTAP,game->players[i],MTG_PHASE_UPKEEP,game->players[i]);
|
||||
game->phaseRing->addPhaseBefore(Constants::MTG_PHASE_UNTAP,game->players[i],Constants::MTG_PHASE_UPKEEP,game->players[i]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -2779,7 +2778,7 @@ class AStasis:public ActivatedAbility{
|
||||
class AShieldOfTheAge: public TargetAbility{
|
||||
public:
|
||||
AShieldOfTheAge(int _id, MTGCardInstance * card):TargetAbility(_id,card,NEW DamageTargetChooser(card,_id),NEW ManaCost(),0,0){
|
||||
cost->add(MTG_COLOR_ARTIFACT,2);
|
||||
cost->add(Constants::MTG_COLOR_ARTIFACT,2);
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
@@ -2824,15 +2823,15 @@ class AAbomination :public MTGAbility{
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase){
|
||||
if( newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
if( newPhase == Constants::MTG_PHASE_COMBATDAMAGE){
|
||||
nbOpponents = 0;
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
while ((opponent && opponent->hasColor(MTG_COLOR_GREEN)) || opponent->hasColor(MTG_COLOR_WHITE)){
|
||||
while ((opponent && opponent->hasColor(Constants::MTG_COLOR_GREEN)) || opponent->hasColor(Constants::MTG_COLOR_WHITE)){
|
||||
opponents[nbOpponents] = opponent;
|
||||
nbOpponents ++;
|
||||
opponent = source->getNextOpponent(opponent);
|
||||
}
|
||||
}else if (newPhase == MTG_PHASE_COMBATEND){
|
||||
}else if (newPhase == Constants::MTG_PHASE_COMBATEND){
|
||||
for (int i = 0; i < nbOpponents ; i++){
|
||||
game->mLayers->stackLayer()->addPutInGraveyard(opponents[i]);
|
||||
}
|
||||
@@ -2841,7 +2840,7 @@ class AAbomination :public MTGAbility{
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if(!game->isInPlay(source) && currentPhase != MTG_PHASE_UNTAP){
|
||||
if(!game->isInPlay(source) && currentPhase != Constants::MTG_PHASE_UNTAP){
|
||||
return 0;
|
||||
}else{
|
||||
return MTGAbility::testDestroy();
|
||||
@@ -2890,9 +2889,9 @@ class AMinionofLeshrac: public TargetAbility{
|
||||
|
||||
void Update(float dt){
|
||||
if (newPhase != currentPhase && source->controller() == game->currentPlayer){
|
||||
if (newPhase == MTG_PHASE_UNTAP){
|
||||
if (newPhase == Constants::MTG_PHASE_UNTAP){
|
||||
paidThisTurn = 0;
|
||||
}else if( newPhase == MTG_PHASE_UPKEEP + 1 && !paidThisTurn){
|
||||
}else if( newPhase == Constants::MTG_PHASE_UPKEEP + 1 && !paidThisTurn){
|
||||
game->mLayers->stackLayer()->addDamage(source,source->controller(), 5);
|
||||
source->tapped = 1;
|
||||
}
|
||||
@@ -2901,7 +2900,7 @@ class AMinionofLeshrac: public TargetAbility{
|
||||
}
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card){
|
||||
if (currentPhase != MTG_PHASE_UPKEEP || paidThisTurn) return 0;
|
||||
if (currentPhase != Constants::MTG_PHASE_UPKEEP || paidThisTurn) return 0;
|
||||
return TargetAbility::isReactingToClick(card);
|
||||
}
|
||||
|
||||
@@ -3040,7 +3039,7 @@ class A1RampageAbility:public MTGAbility{
|
||||
void Update(float dt){
|
||||
if (source->isAttacker()){
|
||||
if (newPhase != currentPhase){
|
||||
if( newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
if( newPhase == Constants::MTG_PHASE_COMBATDAMAGE){
|
||||
nbOpponents = 0;
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
while (opponent){
|
||||
|
||||
@@ -26,7 +26,7 @@ class Cmp1 { // compares cards by their name
|
||||
|
||||
class DeckDataWrapper{
|
||||
public:
|
||||
int colors[MTG_NB_COLORS+1];
|
||||
int colors[Constants::MTG_NB_COLORS+1];
|
||||
int currentColor;
|
||||
map<MTGCard *, int,Cmp1> cards;
|
||||
int currentposition;
|
||||
|
||||
@@ -160,13 +160,13 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
|
||||
|
||||
//icon images
|
||||
mIcons[MTG_COLOR_ARTIFACT] = GameApp::CommonRes->GetQuad("c_artifact");
|
||||
mIcons[MTG_COLOR_LAND] = GameApp::CommonRes->GetQuad("c_land");
|
||||
mIcons[MTG_COLOR_WHITE] = GameApp::CommonRes->GetQuad("c_white");
|
||||
mIcons[MTG_COLOR_RED] = GameApp::CommonRes->GetQuad("c_red");
|
||||
mIcons[MTG_COLOR_BLACK] = GameApp::CommonRes->GetQuad("c_black");
|
||||
mIcons[MTG_COLOR_BLUE] = GameApp::CommonRes->GetQuad("c_blue");
|
||||
mIcons[MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green");
|
||||
mIcons[Constants::MTG_COLOR_ARTIFACT] = GameApp::CommonRes->GetQuad("c_artifact");
|
||||
mIcons[Constants::MTG_COLOR_LAND] = GameApp::CommonRes->GetQuad("c_land");
|
||||
mIcons[Constants::MTG_COLOR_WHITE] = GameApp::CommonRes->GetQuad("c_white");
|
||||
mIcons[Constants::MTG_COLOR_RED] = GameApp::CommonRes->GetQuad("c_red");
|
||||
mIcons[Constants::MTG_COLOR_BLACK] = GameApp::CommonRes->GetQuad("c_black");
|
||||
mIcons[Constants::MTG_COLOR_BLUE] = GameApp::CommonRes->GetQuad("c_blue");
|
||||
mIcons[Constants::MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green");
|
||||
for (int i=0; i < 7; i++){
|
||||
mIcons[i]->SetHotSpot(16,16);
|
||||
}
|
||||
@@ -295,13 +295,13 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
last_user_activity = 0;
|
||||
mStage = STAGE_TRANSITION_UP;
|
||||
colorFilter--;
|
||||
if (colorFilter < -1) colorFilter = MTG_COLOR_LAND;
|
||||
if (colorFilter < -1) colorFilter = Constants::MTG_COLOR_LAND;
|
||||
break;
|
||||
case PSP_CTRL_DOWN :
|
||||
last_user_activity = 0;
|
||||
mStage = STAGE_TRANSITION_DOWN;
|
||||
colorFilter ++;
|
||||
if (colorFilter > MTG_COLOR_LAND) colorFilter =-1;
|
||||
if (colorFilter > Constants::MTG_COLOR_LAND) colorFilter =-1;
|
||||
break;
|
||||
case PSP_CTRL_TRIANGLE :
|
||||
if (last_user_activity > 0.2)
|
||||
@@ -473,7 +473,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
int max2 = 0;
|
||||
int maxC2 = 4;
|
||||
|
||||
for (int i= 0; i< MTG_NB_COLORS -1; i++){
|
||||
for (int i= 0; i < Constants::MTG_NB_COLORS -1; i++){
|
||||
int value = myDeck->getCount(i);
|
||||
if (value > max1){
|
||||
max2 = max1;
|
||||
@@ -489,18 +489,12 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
maxC2 = maxC1;
|
||||
}
|
||||
|
||||
int _a[6] = {255, 255, 255,255,255,255};
|
||||
int _r[6] = {75, 0, 0, 255,50,255};
|
||||
int _g[6] = {30, 255, 0, 0, 50,255};
|
||||
int _b[6] = {20, 0, 255,0, 50,255};
|
||||
|
||||
|
||||
PIXEL_TYPE colors[] =
|
||||
{
|
||||
ARGB(255,_r[maxC1],_g[maxC1],_b[maxC1]),
|
||||
ARGB(255,_r[maxC1],_g[maxC1],_b[maxC1]),
|
||||
ARGB(255,_r[maxC2],_g[maxC2],_b[maxC2]),
|
||||
ARGB(255,_r[maxC2],_g[maxC2],_b[maxC2]),
|
||||
ARGB(255, Constants::_r[maxC1], Constants::_g[maxC1], Constants::_b[maxC1]),
|
||||
ARGB(255, Constants::_r[maxC1], Constants::_g[maxC1], Constants::_b[maxC1]),
|
||||
ARGB(255, Constants::_r[maxC2], Constants::_g[maxC2], Constants::_b[maxC2]),
|
||||
ARGB(255, Constants::_r[maxC2], Constants::_g[maxC2], Constants::_b[maxC2]),
|
||||
};
|
||||
|
||||
JRenderer::GetInstance()->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
|
||||
@@ -566,7 +560,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
//Your Deck Information
|
||||
char buffer[300];
|
||||
int nb_letters = 0;
|
||||
for (int j=0; j<MTG_NB_COLORS;j++){
|
||||
for (int j=0; j<Constants::MTG_NB_COLORS;j++){
|
||||
int value = myDeck->getCount(j);
|
||||
if (value > 0){
|
||||
sprintf(buffer, "%i", value);
|
||||
|
||||
@@ -42,8 +42,8 @@ class MTGCard {
|
||||
TexturesCache * mCache;
|
||||
string text;
|
||||
string name;
|
||||
int colors[MTG_NB_COLORS];
|
||||
int basicAbilities[NB_BASIC_ABILITIES];
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
int basicAbilities[Constants::NB_BASIC_ABILITIES];
|
||||
vector<string> formattedText;
|
||||
string magicText;
|
||||
int alias;
|
||||
|
||||
@@ -42,7 +42,7 @@ class MtgSets{
|
||||
class MTGAllCards {
|
||||
protected:
|
||||
int conf_read_mode;
|
||||
int colorsCount[MTG_NB_COLORS];
|
||||
int colorsCount[Constants::MTG_NB_COLORS];
|
||||
int total_cards;
|
||||
GameApp * parent;
|
||||
void init();
|
||||
@@ -51,7 +51,7 @@ class MTGAllCards {
|
||||
|
||||
TexturesCache * mCache;
|
||||
MTGCard * _(int i);
|
||||
MTGCard * collection[TOTAL_NUMBER_OF_CARDS];
|
||||
MTGCard * collection[Constants::TOTAL_NUMBER_OF_CARDS];
|
||||
MTGAllCards();
|
||||
~MTGAllCards();
|
||||
MTGAllCards(TexturesCache * cache);
|
||||
|
||||
@@ -1,194 +1,118 @@
|
||||
#ifndef _MTGDEFINITION_H_
|
||||
#define _MTGDEFINITION_H_
|
||||
|
||||
|
||||
#define TOTAL_NUMBER_OF_CARDS 4000
|
||||
|
||||
#define MTG_NB_COLORS 7
|
||||
|
||||
#define MTG_COLOR_ARTIFACT 0
|
||||
#define MTG_COLOR_GREEN 1
|
||||
#define MTG_COLOR_BLUE 2
|
||||
#define MTG_COLOR_RED 3
|
||||
#define MTG_COLOR_BLACK 4
|
||||
#define MTG_COLOR_WHITE 5
|
||||
#define MTG_COLOR_LAND 6
|
||||
|
||||
|
||||
static char MTGColorChars[] = {'x','g','u','r','b','w','l'};
|
||||
static const char * MTGColorStrings[] = {"artifact", "green", "blue", "red", "black", "white", "land"};
|
||||
|
||||
static int _r[7] = {75, 20, 20, 200,50,255,128};
|
||||
static int _g[7] = {30, 140, 30, 15, 50,255,128};
|
||||
static int _b[7] = {20, 0, 140,15, 50,255,128};
|
||||
|
||||
|
||||
#define MTG_UNCOLORED 0
|
||||
#define MTG_FOREST 1
|
||||
#define MTG_ISLAND 2
|
||||
#define MTG_MOUNTAIN 3
|
||||
#define MTG_SWAMP 4
|
||||
#define MTG_PLAIN 5
|
||||
|
||||
#define MTG_TYPE_CREATURE 10
|
||||
#define MTG_TYPE_ARTIFACT 11
|
||||
#define MTG_TYPE_ENCHANTMENT 12
|
||||
#define MTG_TYPE_SORCERY 13
|
||||
#define MTG_TYPE_LAND 14
|
||||
#define MTG_TYPE_INSTANT 15
|
||||
|
||||
|
||||
|
||||
#define MTG_PHASE_BEFORE_BEGIN 0
|
||||
#define MTG_PHASE_UNTAP 1
|
||||
#define MTG_PHASE_UPKEEP 2
|
||||
#define MTG_PHASE_DRAW 3
|
||||
#define MTG_PHASE_FIRSTMAIN 4
|
||||
#define MTG_PHASE_COMBATBEGIN 5
|
||||
#define MTG_PHASE_COMBATATTACKERS 6
|
||||
#define MTG_PHASE_COMBATBLOCKERS 7
|
||||
#define MTG_PHASE_COMBATDAMAGE 8
|
||||
#define MTG_PHASE_COMBATEND 9
|
||||
#define MTG_PHASE_SECONDMAIN 10
|
||||
#define MTG_PHASE_ENDOFTURN 11
|
||||
#define MTG_PHASE_EOT 11
|
||||
#define MTG_PHASE_CLEANUP 12
|
||||
#define MTG_PHASE_AFTER_EOT 13
|
||||
#define NB_MTG_PHASES 14
|
||||
|
||||
#define TRAMPLE 0
|
||||
#define FORESTWALK 1
|
||||
#define ISLANDWALK 2
|
||||
#define MOUNTAINWALK 3
|
||||
#define SWAMPWALK 4
|
||||
#define PLAINSWALK 5
|
||||
#define FLYING 6
|
||||
#define FIRSTSTRIKE 7
|
||||
#define DOUBLESTRIKE 8
|
||||
#define FEAR 9
|
||||
#define FLASH 10
|
||||
#define HASTE 11
|
||||
#define LIFELINK 12
|
||||
#define REACH 13
|
||||
#define SHROUD 14
|
||||
#define VIGILANCE 15
|
||||
#define DEFENSER 16
|
||||
#define DEFENDER 16
|
||||
#define BANDING 17
|
||||
#define PROTECTIONGREEN 18
|
||||
#define PROTECTIONBLUE 19
|
||||
#define PROTECTIONRED 20
|
||||
#define PROTECTIONBLACK 21
|
||||
#define PROTECTIONWHITE 22
|
||||
#define UNBLOCKABLE 23
|
||||
#define WITHER 24
|
||||
#define PERSIST 25
|
||||
#define RETRACE 26
|
||||
#define EXALTED 27
|
||||
#define LEGENDARY 28
|
||||
#define SHADOW 29
|
||||
#define REACHSHADOW 30
|
||||
#define FORESTHOME 31
|
||||
#define ISLANDHOME 32
|
||||
#define MOUNTAINHOME 33
|
||||
#define SWAMPHOME 34
|
||||
#define PLAINSHOME 35
|
||||
#define FLANKING 36
|
||||
#define RAMPAGE1 37
|
||||
|
||||
#define NB_BASIC_ABILITIES 38
|
||||
|
||||
static const char * MTGBasicAbilities[] = {
|
||||
"trample",
|
||||
"forestwalk",
|
||||
"islandwalk",
|
||||
"mountainwalk",
|
||||
"swampwalk",
|
||||
"plainwalk",
|
||||
"flying",
|
||||
"first strike",
|
||||
"double strike",
|
||||
"fear",
|
||||
"flash",
|
||||
"haste",
|
||||
"lifelink",
|
||||
"reach",
|
||||
"shroud",
|
||||
"vigilance",
|
||||
"defender",
|
||||
"banding",
|
||||
"protection from green",
|
||||
"protection from blue",
|
||||
"protection from red",
|
||||
"protection from black",
|
||||
"protection from white",
|
||||
"unblockable",
|
||||
"wither",
|
||||
"persist",
|
||||
"retrace",
|
||||
"exalted",
|
||||
"legendary",
|
||||
"shadow",
|
||||
"reachshadow",
|
||||
"foresthome",
|
||||
"islandhome",
|
||||
"moutainhome",
|
||||
"swamphome",
|
||||
"plainshome",
|
||||
"flanking",
|
||||
"rampage",
|
||||
};
|
||||
|
||||
|
||||
#define RARITY_M 'M'
|
||||
#define RARITY_R 'R'
|
||||
#define RARITY_U 'U'
|
||||
#define RARITY_C 'C'
|
||||
#define RARITY_L 'L'
|
||||
|
||||
|
||||
#define MAIN_FONT 0
|
||||
#define MAGIC_FONT 1
|
||||
|
||||
|
||||
static const char *MTGPhaseNames[] =
|
||||
{
|
||||
"---",
|
||||
"Untap",
|
||||
"Upkeep",
|
||||
"Draw",
|
||||
"Main phase 1",
|
||||
"Combat begins",
|
||||
"Attackers",
|
||||
"Blockers",
|
||||
"Combat damage",
|
||||
"Combat ends",
|
||||
"Main phase 2",
|
||||
"End of turn",
|
||||
"cleanup",
|
||||
"---"
|
||||
};
|
||||
|
||||
static const char *MTGPhaseCodeNames[] =
|
||||
{
|
||||
"beginofturn",
|
||||
"untap",
|
||||
"upkeep",
|
||||
"draw",
|
||||
"firstmain",
|
||||
"combatbegins",
|
||||
"attackers",
|
||||
"blockers",
|
||||
"combatdamage",
|
||||
"combatends",
|
||||
"secondmain",
|
||||
"endofturn",
|
||||
"cleanup",
|
||||
"beforenextturn"
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _MTGDEFINITION_H_
|
||||
#define _MTGDEFINITION_H_
|
||||
|
||||
class Constants
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
TOTAL_NUMBER_OF_CARDS = 4000,
|
||||
|
||||
|
||||
MTG_COLOR_ARTIFACT = 0,
|
||||
MTG_COLOR_GREEN = 1,
|
||||
MTG_COLOR_BLUE = 2,
|
||||
MTG_COLOR_RED = 3,
|
||||
MTG_COLOR_BLACK = 4,
|
||||
MTG_COLOR_WHITE = 5,
|
||||
MTG_COLOR_LAND = 6,
|
||||
|
||||
MTG_NB_COLORS = 7,
|
||||
|
||||
|
||||
MTG_UNCOLORED = 0,
|
||||
MTG_FOREST = 1,
|
||||
MTG_ISLAND = 2,
|
||||
MTG_MOUNTAIN = 3,
|
||||
MTG_SWAMP = 4,
|
||||
MTG_PLAIN = 5,
|
||||
|
||||
|
||||
MTG_TYPE_CREATURE = 10,
|
||||
MTG_TYPE_ARTIFACT = 11,
|
||||
MTG_TYPE_ENCHANTMENT = 12,
|
||||
MTG_TYPE_SORCERY = 13,
|
||||
MTG_TYPE_LAND = 14,
|
||||
MTG_TYPE_INSTANT = 15,
|
||||
|
||||
|
||||
MTG_PHASE_BEFORE_BEGIN = 0,
|
||||
MTG_PHASE_UNTAP = 1,
|
||||
MTG_PHASE_UPKEEP = 2,
|
||||
MTG_PHASE_DRAW = 3,
|
||||
MTG_PHASE_FIRSTMAIN = 4,
|
||||
MTG_PHASE_COMBATBEGIN = 5,
|
||||
MTG_PHASE_COMBATATTACKERS = 6,
|
||||
MTG_PHASE_COMBATBLOCKERS = 7,
|
||||
MTG_PHASE_COMBATDAMAGE = 8,
|
||||
MTG_PHASE_COMBATEND = 9,
|
||||
MTG_PHASE_SECONDMAIN = 10,
|
||||
MTG_PHASE_ENDOFTURN = 11,
|
||||
MTG_PHASE_EOT = 11,
|
||||
MTG_PHASE_CLEANUP = 12,
|
||||
MTG_PHASE_AFTER_EOT = 13,
|
||||
NB_MTG_PHASES = 14,
|
||||
|
||||
TRAMPLE = 0,
|
||||
FORESTWALK = 1,
|
||||
ISLANDWALK = 2,
|
||||
MOUNTAINWALK = 3,
|
||||
SWAMPWALK = 4,
|
||||
PLAINSWALK = 5,
|
||||
FLYING = 6,
|
||||
FIRSTSTRIKE = 7,
|
||||
DOUBLESTRIKE = 8,
|
||||
FEAR = 9,
|
||||
FLASH = 10,
|
||||
HASTE = 11,
|
||||
LIFELINK = 12,
|
||||
REACH = 13,
|
||||
SHROUD = 14,
|
||||
VIGILANCE = 15,
|
||||
DEFENSER = 16,
|
||||
DEFENDER = 16,
|
||||
BANDING = 17,
|
||||
PROTECTIONGREEN = 18,
|
||||
PROTECTIONBLUE = 19,
|
||||
PROTECTIONRED = 20,
|
||||
PROTECTIONBLACK = 21,
|
||||
PROTECTIONWHITE = 22,
|
||||
UNBLOCKABLE = 23,
|
||||
WITHER = 24,
|
||||
PERSIST = 25,
|
||||
RETRACE = 26,
|
||||
EXALTED = 27,
|
||||
LEGENDARY = 28,
|
||||
SHADOW = 29,
|
||||
REACHSHADOW = 30,
|
||||
FORESTHOME = 31,
|
||||
ISLANDHOME = 32,
|
||||
MOUNTAINHOME = 33,
|
||||
SWAMPHOME = 34,
|
||||
PLAINSHOME = 35,
|
||||
FLANKING = 36,
|
||||
RAMPAGE1 = 37,
|
||||
|
||||
NB_BASIC_ABILITIES = 38,
|
||||
|
||||
|
||||
RARITY_M = 'M',
|
||||
RARITY_R = 'R',
|
||||
RARITY_U = 'U',
|
||||
RARITY_C = 'C',
|
||||
RARITY_L = 'L',
|
||||
|
||||
|
||||
MAIN_FONT = 0,
|
||||
MAGIC_FONT = 1,
|
||||
};
|
||||
|
||||
static char MTGColorChars[];
|
||||
static const char* MTGColorStrings[];
|
||||
static int _r[], _g[], _b[];
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ class MTGPersistRule:public ListMaintainerAbility{
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (card->basicAbilities[PERSIST] && !card->counters->hasCounter(-1,-1) ){
|
||||
if (card->basicAbilities[Constants::PERSIST] && !card->counters->hasCounter(-1,-1) ){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("yay, persist !\n");
|
||||
#endif
|
||||
@@ -90,7 +90,7 @@ class MTGLegendRule:public ListMaintainerAbility{
|
||||
MTGLegendRule(int _id):ListMaintainerAbility(_id){};
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (card->basicAbilities[LEGENDARY]){
|
||||
if (card->basicAbilities[Constants::LEGENDARY]){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -9,7 +9,7 @@ class ManaCostHybrid;
|
||||
|
||||
class ManaCost{
|
||||
protected:
|
||||
int cost[MTG_NB_COLORS+1];
|
||||
int cost[Constants::MTG_NB_COLORS+1];
|
||||
ManaCostHybrid * hybrids[10];
|
||||
int nbhybrids;
|
||||
public:
|
||||
|
||||
@@ -17,7 +17,7 @@ class PriceList{
|
||||
private:
|
||||
MTGAllCards * collection;
|
||||
string filename;
|
||||
Price * prices[TOTAL_NUMBER_OF_CARDS];
|
||||
Price * prices[Constants::TOTAL_NUMBER_OF_CARDS];
|
||||
int nbprices;
|
||||
public:
|
||||
PriceList(const char * file, MTGAllCards * _collection);
|
||||
|
||||
@@ -50,14 +50,14 @@ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){
|
||||
int currentCost = 0;
|
||||
GameObserver * gameObs = GameObserver::GetInstance();
|
||||
CardDescriptor cd;
|
||||
cd.setColor(MTG_COLOR_LAND);
|
||||
cd.setColor(Constants::MTG_COLOR_LAND);
|
||||
cd.tapped = -1;
|
||||
|
||||
MTGCardInstance * card = NULL;
|
||||
while((card = cd.nextmatch(game->inPlay, card))){
|
||||
|
||||
int doTap = 1;
|
||||
for (int i=MTG_NB_COLORS-1; i>= 0; i--){
|
||||
for (int i=Constants::MTG_NB_COLORS-1; i>= 0; i--){
|
||||
if (diff->getCost(i) && card->hasSubtype(MTG_LAND_TEXTS[i]) ){
|
||||
diff->remove(i,1);
|
||||
doTap = 0;
|
||||
@@ -77,21 +77,21 @@ ManaCost * AIPlayer::getPotentialMana(){
|
||||
SAFE_DELETE(potentialMana);
|
||||
potentialMana = NEW ManaCost();
|
||||
CardDescriptor cd;
|
||||
cd.setColor(MTG_COLOR_LAND);
|
||||
cd.setColor(Constants::MTG_COLOR_LAND);
|
||||
cd.tapped = -1;
|
||||
MTGCardInstance * card = NULL;
|
||||
while((card = cd.nextmatch(game->inPlay, card))){
|
||||
|
||||
if (card->hasSubtype("plains")){
|
||||
potentialMana->add(MTG_COLOR_WHITE,1);
|
||||
potentialMana->add(Constants::MTG_COLOR_WHITE,1);
|
||||
}else if(card->hasSubtype("swamp")){
|
||||
potentialMana->add(MTG_COLOR_BLACK,1);
|
||||
potentialMana->add(Constants::MTG_COLOR_BLACK,1);
|
||||
}else if(card->hasSubtype("forest")){
|
||||
potentialMana->add(MTG_COLOR_GREEN,1);
|
||||
potentialMana->add(Constants::MTG_COLOR_GREEN,1);
|
||||
}else if(card->hasSubtype("mountain")){
|
||||
potentialMana->add(MTG_COLOR_RED,1);
|
||||
potentialMana->add(Constants::MTG_COLOR_RED,1);
|
||||
}else if(card->hasSubtype("island")){
|
||||
potentialMana->add(MTG_COLOR_BLUE,1);
|
||||
potentialMana->add(Constants::MTG_COLOR_BLUE,1);
|
||||
}else{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("WTF ????\n");
|
||||
@@ -309,7 +309,7 @@ int AIPlayer::combatDamages(){
|
||||
GameObserver * gameObs = GameObserver::GetInstance();
|
||||
Player * currentPlayer = gameObs->currentPlayer;
|
||||
int currentGamePhase = gameObs->getCurrentGamePhase();
|
||||
if (currentGamePhase != MTG_PHASE_COMBATDAMAGE) return 0;
|
||||
if (currentGamePhase != Constants::MTG_PHASE_COMBATDAMAGE) return 0;
|
||||
DamageResolverLayer * drl = gameObs->mLayers->combatLayer();
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("AI Combat Phase START\n");
|
||||
@@ -345,7 +345,7 @@ int AIPlayer::combatDamages(){
|
||||
}
|
||||
}
|
||||
}
|
||||
if (canardEmissaire && !current->card->has(TRAMPLE)){
|
||||
if (canardEmissaire && !current->card->has(Constants::TRAMPLE)){
|
||||
while(current->dealOneDamage(canardEmissaire)){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("==========\nDealing damage to Canard Emissaire\n================\n");
|
||||
@@ -464,7 +464,7 @@ int AIPlayerBaka::Act(float dt){
|
||||
GameObserver * gameObs = GameObserver::GetInstance();
|
||||
int currentGamePhase = gameObs->getCurrentGamePhase();
|
||||
|
||||
if (currentGamePhase == MTG_PHASE_CLEANUP && currentGamePhase != oldGamePhase){
|
||||
if (currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentGamePhase != oldGamePhase){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("updating stats\n");
|
||||
#endif
|
||||
@@ -496,13 +496,13 @@ int AIPlayerBaka::Act(float dt){
|
||||
if (currentPlayer == this){
|
||||
MTGCardInstance * card = NULL;
|
||||
switch(currentGamePhase){
|
||||
case MTG_PHASE_FIRSTMAIN:
|
||||
case MTG_PHASE_SECONDMAIN:
|
||||
case Constants::MTG_PHASE_FIRSTMAIN:
|
||||
case Constants::MTG_PHASE_SECONDMAIN:
|
||||
if (canPutLandsIntoPlay){
|
||||
|
||||
//Attempt to put land into play
|
||||
cd.init();
|
||||
cd.setColor(MTG_COLOR_LAND);
|
||||
cd.setColor(Constants::MTG_COLOR_LAND);
|
||||
card = cd.match(game->hand);
|
||||
if (card){
|
||||
gameObs->cardClick(card);
|
||||
@@ -556,7 +556,7 @@ int AIPlayerBaka::Act(float dt){
|
||||
gameObs->userRequestNextGamePhase();
|
||||
}
|
||||
break;
|
||||
case MTG_PHASE_COMBATATTACKERS:
|
||||
case Constants::MTG_PHASE_COMBATATTACKERS:
|
||||
chooseAttackers();
|
||||
gameObs->userRequestNextGamePhase();
|
||||
break;
|
||||
@@ -566,7 +566,7 @@ int AIPlayerBaka::Act(float dt){
|
||||
}
|
||||
}else{
|
||||
switch(currentGamePhase){
|
||||
case MTG_PHASE_COMBATBLOCKERS:
|
||||
case Constants::MTG_PHASE_COMBATBLOCKERS:
|
||||
chooseBlockers();
|
||||
gameObs->userRequestNextGamePhase();
|
||||
break;
|
||||
|
||||
@@ -163,7 +163,7 @@ void ActionLayer::setMenuObject(Targetable * object){
|
||||
|
||||
SAFE_DELETE(abilitiesMenu);
|
||||
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
abilitiesMenu = NEW SimpleMenu(10, this, mFont, 100, 100);
|
||||
|
||||
for (int i=0;i<mCount;i++){
|
||||
|
||||
@@ -19,14 +19,14 @@ int NextGamePhase::resolve(){
|
||||
}
|
||||
|
||||
void NextGamePhase::Render(){
|
||||
int nextPhase = (GameObserver::GetInstance()->getCurrentGamePhase() + 1) % MTG_PHASE_CLEANUP;
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
int nextPhase = (GameObserver::GetInstance()->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP;
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
int playerId = 1;
|
||||
if (GameObserver::GetInstance()->currentActionPlayer == GameObserver::GetInstance()->players[1]) playerId = 2;
|
||||
sprintf(buffer, "Player %i : -> %s", playerId, MTGPhaseNames[nextPhase]);
|
||||
sprintf(buffer, "Player %i : -> %s", playerId, Constants::MTGPhaseNames[nextPhase]);
|
||||
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ int StackAbility::resolve(){
|
||||
return (ability->resolve());
|
||||
}
|
||||
void StackAbility::Render(){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
@@ -102,7 +102,7 @@ int Spell::resolve(){
|
||||
}
|
||||
|
||||
void Spell::Render(){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
@@ -148,7 +148,7 @@ int PutInGraveyard::resolve(){
|
||||
}
|
||||
|
||||
void PutInGraveyard::Render(){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
if (!removeFromGame){
|
||||
@@ -180,7 +180,7 @@ int DrawAction::resolve(){
|
||||
}
|
||||
|
||||
void DrawAction::Render(){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
@@ -640,7 +640,7 @@ void ActionStack::Render(){
|
||||
if (current->state==NOT_RESOLVED) height += current->mHeight;
|
||||
}
|
||||
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
|
||||
@@ -686,7 +686,7 @@ void ActionStack::Render(){
|
||||
if (current->display) height += current->mHeight;
|
||||
}
|
||||
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card){
|
||||
}
|
||||
if (!found) return NULL;
|
||||
|
||||
for (int i = 0; i< MTG_NB_COLORS; i++){
|
||||
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
|
||||
if (colors[i] == 1){
|
||||
found = 0;
|
||||
if(card->hasColor(i)){
|
||||
@@ -44,7 +44,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card){
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i< MTG_NB_COLORS; i++){
|
||||
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
|
||||
if ((colors[i] == 1 && !card->hasColor(i))||(colors[i] == -1 && card->hasColor(i))){
|
||||
match = NULL;
|
||||
}
|
||||
@@ -65,14 +65,14 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card){
|
||||
|
||||
|
||||
//Abilities
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
if ((basicAbilities[j] == 1 && !card->basicAbilities[j]) || (basicAbilities[j] == -1 && card->basicAbilities[j])){
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped())){
|
||||
if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped())){
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcons, float x, float y, float rotation, float scale){
|
||||
JQuad * mIcons[7];
|
||||
if (!manaIcons){
|
||||
mIcons[MTG_COLOR_ARTIFACT] = GameApp::CommonRes->GetQuad("c_artifact");
|
||||
mIcons[MTG_COLOR_LAND] = GameApp::CommonRes->GetQuad("c_land");
|
||||
mIcons[MTG_COLOR_WHITE] = GameApp::CommonRes->GetQuad("c_white");
|
||||
mIcons[MTG_COLOR_RED] = GameApp::CommonRes->GetQuad("c_red");
|
||||
mIcons[MTG_COLOR_BLACK] = GameApp::CommonRes->GetQuad("c_black");
|
||||
mIcons[MTG_COLOR_BLUE] = GameApp::CommonRes->GetQuad("c_blue");
|
||||
mIcons[MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green");
|
||||
mIcons[Constants::MTG_COLOR_ARTIFACT] = GameApp::CommonRes->GetQuad("c_artifact");
|
||||
mIcons[Constants::MTG_COLOR_LAND] = GameApp::CommonRes->GetQuad("c_land");
|
||||
mIcons[Constants::MTG_COLOR_WHITE] = GameApp::CommonRes->GetQuad("c_white");
|
||||
mIcons[Constants::MTG_COLOR_RED] = GameApp::CommonRes->GetQuad("c_red");
|
||||
mIcons[Constants::MTG_COLOR_BLACK] = GameApp::CommonRes->GetQuad("c_black");
|
||||
mIcons[Constants::MTG_COLOR_BLUE] = GameApp::CommonRes->GetQuad("c_blue");
|
||||
mIcons[Constants::MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green");
|
||||
for (int i=0; i < 7; i++){
|
||||
mIcons[i]->SetHotSpot(16,16);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcon
|
||||
}
|
||||
|
||||
if (rotation == 0){
|
||||
renderer->FillRoundRect(x+points[0].x + 2 ,y+points[0].y +2 ,width*scale-8,height*scale-8,2,ARGB(255,_r[color],_g[color],_b[color]));
|
||||
renderer->FillRoundRect(x+points[0].x + 2 ,y+points[0].y +2 ,width*scale-8,height*scale-8,2,ARGB(255,Constants::_r[color],Constants::_g[color],Constants::_b[color]));
|
||||
renderer->FillRect(x+points[0].x + 6 ,y+points[0].y + 6 ,width*scale-12,height*scale-12,bgcolor2);
|
||||
}else{
|
||||
for (int i=0; i < 4; i++){
|
||||
@@ -58,7 +58,7 @@ void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcon
|
||||
|
||||
ManaCost * manacost = card->getManaCost();
|
||||
int nbicons = 0;
|
||||
for (int i = 1; i < MTG_NB_COLORS - 1; i++){
|
||||
for (int i = 1; i < Constants::MTG_NB_COLORS - 1; i++){
|
||||
|
||||
int cost = manacost->getCost(i);
|
||||
for (int j=0; j < cost; j++){
|
||||
@@ -135,7 +135,7 @@ void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcon
|
||||
multiply = 1.1;
|
||||
}
|
||||
mFont->SetScale(scale * multiply);
|
||||
mFont->SetColor(ARGB(255,_r[color],_g[color],_b[color]));
|
||||
mFont->SetColor(ARGB(255,Constants::_r[color],Constants::_g[color],Constants::_b[color]));
|
||||
mFont->DrawString(card->getName(),x+v.x,y+v.y);
|
||||
mFont->SetScale(scale);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
@@ -162,15 +162,15 @@ CardGui::CardGui(int id, MTGCardInstance * _card, float desiredHeight,float _x,
|
||||
alpha = 255;
|
||||
mParticleSys = NULL;
|
||||
|
||||
if (card->hasColor(MTG_COLOR_RED)){
|
||||
if (card->hasColor(Constants::MTG_COLOR_RED)){
|
||||
mParticleSys = GameApp::Particles[3];
|
||||
}else if (card->hasColor(MTG_COLOR_BLUE)){
|
||||
}else if (card->hasColor(Constants::MTG_COLOR_BLUE)){
|
||||
mParticleSys = GameApp::Particles[1];
|
||||
}else if (card->hasColor(MTG_COLOR_GREEN)){
|
||||
}else if (card->hasColor(Constants::MTG_COLOR_GREEN)){
|
||||
mParticleSys = GameApp::Particles[2];
|
||||
}else if (card->hasColor(MTG_COLOR_BLACK)){
|
||||
}else if (card->hasColor(Constants::MTG_COLOR_BLACK)){
|
||||
mParticleSys = GameApp::Particles[4];
|
||||
}else if (card->hasColor(MTG_COLOR_WHITE)){
|
||||
}else if (card->hasColor(Constants::MTG_COLOR_WHITE)){
|
||||
mParticleSys = GameApp::Particles[0];
|
||||
}else{
|
||||
mParticleSys = GameApp::Particles[5];
|
||||
@@ -239,7 +239,7 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
||||
|
||||
void CardGui::Render(){
|
||||
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * quad = card->getThumb();
|
||||
@@ -289,15 +289,15 @@ void CardGui::Render(){
|
||||
|
||||
char buffer[200];
|
||||
sprintf(buffer, "%s",card->getName());
|
||||
mFont->SetColor(ARGB(255,_r[color],_g[color],_b[color]));
|
||||
mFont->SetColor(ARGB(255,Constants::_r[color],Constants::_g[color],Constants::_b[color]));
|
||||
if (card->isTapped()){
|
||||
renderer->FillRect(myX - 64 * mScale , myY , 64 * mScale, 40 * mScale, ARGB(255,0,0,0));
|
||||
renderer->DrawRect(myX - 64 * mScale , myY , 64 * mScale, 40 * mScale, ARGB(255,_r[color],_g[color],_b[color]));
|
||||
renderer->DrawRect(myX - 64 * mScale , myY , 64 * mScale, 40 * mScale, ARGB(255,Constants::_r[color],Constants::_g[color],Constants::_b[color]));
|
||||
mFont->SetScale(0.20);
|
||||
mFont->DrawString(buffer,myX - (64 * mScale)+4,myY + 1);
|
||||
}else{
|
||||
renderer->FillRect(myX , myY , 40 * mScale, 64 * mScale, ARGB(255,0,0,0));
|
||||
renderer->DrawRect(myX , myY , 40 * mScale, 64 * mScale, ARGB(255,_r[color],_g[color],_b[color]));
|
||||
renderer->DrawRect(myX , myY , 40 * mScale, 64 * mScale, ARGB(255,Constants::_r[color],Constants::_g[color],Constants::_b[color]));
|
||||
mFont->SetScale(0.40);
|
||||
mFont->DrawString(buffer,myX+4,myY + 1);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ int Damage::resolve(){
|
||||
state = RESOLVED_NOK;
|
||||
return 0;
|
||||
}
|
||||
if (source->has(WITHER)){
|
||||
if (source->has(Constants::WITHER)){
|
||||
for (int i = 0; i < damage; i++){
|
||||
_target->counters->addCounter(-1, -1);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ int Damage::resolve(){
|
||||
}
|
||||
|
||||
void Damage::Render(){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
@@ -91,7 +91,7 @@ int DamageStack::CombatDamages(int strike){
|
||||
MTGCardInstance * attacker = attackers->getNextAttacker(NULL);
|
||||
while (attacker != NULL){
|
||||
int nbdefensers = defensers->nbDefensers(attacker);
|
||||
if ((!strike && !attacker->has(FIRSTSTRIKE)) || (strike && attacker->has(FIRSTSTRIKE)) || attacker->has(DOUBLESTRIKE)){
|
||||
if ((!strike && !attacker->has(Constants::FIRSTSTRIKE)) || (strike && attacker->has(Constants::FIRSTSTRIKE)) || attacker->has(Constants::DOUBLESTRIKE)){
|
||||
if (nbdefensers == 0){
|
||||
Damage * damage = NEW Damage (mCount, attacker, game->opponent());
|
||||
Add(damage);
|
||||
@@ -106,7 +106,7 @@ int DamageStack::CombatDamages(int strike){
|
||||
}
|
||||
MTGCardInstance * defenser = defensers->getNextDefenser(NULL, attacker);
|
||||
while (defenser != NULL){
|
||||
if ((!strike && !defenser->has(FIRSTSTRIKE)) || (strike && defenser->has(FIRSTSTRIKE)) || defenser->has(DOUBLESTRIKE)){
|
||||
if ((!strike && !defenser->has(Constants::FIRSTSTRIKE)) || (strike && defenser->has(Constants::FIRSTSTRIKE)) || defenser->has(Constants::DOUBLESTRIKE)){
|
||||
Damage * damage = NEW Damage (mCount,defenser, attacker);
|
||||
Add(damage);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ DamageResolverLayer::DamageResolverLayer(int id, GameObserver * _game):PlayGuiOb
|
||||
}
|
||||
void DamageResolverLayer::Update(float dt){
|
||||
int newPhase = game->getCurrentGamePhase();
|
||||
if (newPhase == MTG_PHASE_COMBATDAMAGE){
|
||||
if (newPhase == Constants::MTG_PHASE_COMBATDAMAGE){
|
||||
if (!game->mLayers->stackLayer()->getNext(NULL,0,NOT_RESOLVED)){
|
||||
|
||||
if (newPhase != currentPhase){
|
||||
@@ -38,10 +38,10 @@ Player * DamageResolverLayer::whoSelectsDamagesDealtBy(MTGCardInstance * card){
|
||||
MTGInPlay * defensers = game->opponent()->game->inPlay;
|
||||
int nbdefensers = defensers->nbDefensers(card);
|
||||
if (nbdefensers == 0) return NULL;
|
||||
if(nbdefensers == 1 && !card->has(TRAMPLE)) return NULL;
|
||||
if(nbdefensers == 1 && !card->has(Constants::TRAMPLE)) return NULL;
|
||||
MTGCardInstance * defenser = defensers->getNextDefenser(NULL, card);
|
||||
while (defenser != NULL){
|
||||
if (defenser->has(BANDING)) return game->opponent();
|
||||
if (defenser->has(Constants::BANDING)) return game->opponent();
|
||||
defenser = defensers->getNextDefenser(defenser, card);
|
||||
}
|
||||
return game->currentPlayer;
|
||||
@@ -143,7 +143,7 @@ int DamageResolverLayer::initResolve(){
|
||||
sprintf(buf, "attacker : %s \n", attacker->getName());
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
if ((!strike && !attacker->has(FIRSTSTRIKE)) || (strike && attacker->has(FIRSTSTRIKE)) || attacker->has(DOUBLESTRIKE)){
|
||||
if ((!strike && !attacker->has(Constants::FIRSTSTRIKE)) || (strike && attacker->has(Constants::FIRSTSTRIKE)) || attacker->has(Constants::DOUBLESTRIKE)){
|
||||
Player * selecter = whoSelectsDamagesDealtBy(attacker);
|
||||
if (!selecter){
|
||||
addAutoDamageToOpponents(attacker);
|
||||
@@ -153,7 +153,7 @@ int DamageResolverLayer::initResolve(){
|
||||
}
|
||||
MTGCardInstance * defenser = defensers->getNextDefenser(NULL, attacker);
|
||||
while (defenser != NULL){
|
||||
if ((!strike && !defenser->has(FIRSTSTRIKE)) || (strike && defenser->has(FIRSTSTRIKE)) || defenser->has(DOUBLESTRIKE)){
|
||||
if ((!strike && !defenser->has(Constants::FIRSTSTRIKE)) || (strike && defenser->has(Constants::FIRSTSTRIKE)) || defenser->has(Constants::DOUBLESTRIKE)){
|
||||
Player * selecterb = whoSelectsDamagesDealtBy(defenser);
|
||||
if (!selecterb){
|
||||
addAutoDamageToOpponents(defenser);
|
||||
@@ -201,7 +201,7 @@ int DamageResolverLayer::canStopDealDamages(){
|
||||
if (current->damageSelecter==currentChoosingPlayer && current->damageToDeal > 0){
|
||||
MTGCardInstance * card = current->card;
|
||||
if (card->controller() == game->currentPlayer){ //Attacker
|
||||
if (card->has(TRAMPLE)){
|
||||
if (card->has(Constants::TRAMPLE)){
|
||||
MTGInPlay * defensers = game->opponent()->game->inPlay;
|
||||
MTGCardInstance * defenser = defensers->getNextDefenser(NULL, card);
|
||||
while (defenser != NULL){
|
||||
@@ -226,7 +226,7 @@ int DamageResolverLayer::trampleDamage(){
|
||||
if (current->damageToDeal > 0){
|
||||
MTGCardInstance * card = current->card;
|
||||
if (card->controller() == game->currentPlayer){ //Attacker
|
||||
if (card->has(TRAMPLE)){
|
||||
if (card->has(Constants::TRAMPLE)){
|
||||
Damage * damage = NEW Damage(0, card, game->opponent(), current->damageToDeal);
|
||||
damageStack->Add(damage);
|
||||
}
|
||||
@@ -334,7 +334,7 @@ bool DamageResolverLayer::CheckUserInput(u32 key){
|
||||
|
||||
void DamageResolverLayer::Render(){
|
||||
if (!mCount) return;
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ DamagerDamaged::DamagerDamaged(CardGui * cardg, Player * _damageSelecter, bool _
|
||||
DamagerDamaged::~DamagerDamaged(){
|
||||
for (int i = 0; i < mCount; i++){
|
||||
SAFE_DELETE(damages[i]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ int DamagerDamaged::removeDamagesFrom(DamagerDamaged * source){
|
||||
}
|
||||
|
||||
void DamagerDamaged::Render(Player * currentPlayer){
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
CardGui::Render();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
DeckDataWrapper::DeckDataWrapper(MTGDeck * deck){
|
||||
parent = deck;
|
||||
for (int i = 0; i <= MTG_NB_COLORS; i++){
|
||||
for (int i = 0; i <= Constants::MTG_NB_COLORS; i++){
|
||||
colors[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < deck->totalCards(); i++){
|
||||
@@ -33,22 +33,22 @@ DeckDataWrapper::~DeckDataWrapper(){
|
||||
|
||||
void DeckDataWrapper::updateCounts(MTGCard * card, int removed){
|
||||
if (!card){
|
||||
for (int i = 0; i < MTG_NB_COLORS+1; i++){
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS+1; i++){
|
||||
colors[i] = 0;
|
||||
}
|
||||
map<MTGCard *,int,Cmp1>::iterator it;
|
||||
for ( it=cards.begin() ; it != cards.end(); it++ ){
|
||||
MTGCard * current = (*it).first;
|
||||
colors[MTG_NB_COLORS] += (*it).second;
|
||||
for (int i = 0; i < MTG_NB_COLORS; i++){
|
||||
colors[Constants::MTG_NB_COLORS] += (*it).second;
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; i++){
|
||||
if (current->hasColor(i)) colors[i]+=(*it).second;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
int increment = 1;
|
||||
if (removed) increment = -1;
|
||||
colors[MTG_NB_COLORS] += increment;
|
||||
for (int i = 0; i < MTG_NB_COLORS; i++){
|
||||
colors[Constants::MTG_NB_COLORS] += increment;
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; i++){
|
||||
if (card->hasColor(i)) colors[i]+=increment;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,6 @@ MTGCard * DeckDataWrapper::getNext(MTGCard * previous, int color){
|
||||
map<MTGCard *,int,Cmp1>::iterator it;
|
||||
|
||||
it = cards.find(previous);
|
||||
int found = 0;
|
||||
|
||||
while(1){
|
||||
if (it == cards.end()){
|
||||
@@ -95,7 +94,6 @@ MTGCard * DeckDataWrapper::getNext(MTGCard * previous, int color){
|
||||
MTGCard * DeckDataWrapper::getPrevious(MTGCard * next, int color){
|
||||
map<MTGCard *,int,Cmp1>::iterator it;
|
||||
it = cards.find(next);
|
||||
int found = 0;
|
||||
|
||||
while(1){
|
||||
if (it == cards.begin()){
|
||||
@@ -126,6 +124,6 @@ void DeckDataWrapper::updateCurrentPosition(MTGCard * currentCard, int color){
|
||||
}
|
||||
|
||||
int DeckDataWrapper::getCount(int color){
|
||||
if (color == -1) return colors[MTG_NB_COLORS];
|
||||
if (color == -1) return colors[Constants::MTG_NB_COLORS];
|
||||
return colors[color];
|
||||
}
|
||||
|
||||
@@ -83,24 +83,24 @@ void GameObserver::nextGamePhase(){
|
||||
if (currentPlayer != cPhase->player) nextPlayer();
|
||||
|
||||
//init begin of turn
|
||||
if (currentGamePhase == MTG_PHASE_BEFORE_BEGIN){
|
||||
if (currentGamePhase == Constants::MTG_PHASE_BEFORE_BEGIN){
|
||||
cleanupPhase();
|
||||
currentPlayer->canPutLandsIntoPlay = 1;
|
||||
mLayers->actionLayer()->Update(0);
|
||||
return nextGamePhase();
|
||||
}
|
||||
//manaBurn
|
||||
if (currentGamePhase == MTG_PHASE_UNTAP ||
|
||||
currentGamePhase == MTG_PHASE_FIRSTMAIN ||
|
||||
currentGamePhase == MTG_PHASE_COMBATBEGIN ||
|
||||
currentGamePhase == MTG_PHASE_SECONDMAIN ||
|
||||
currentGamePhase == MTG_PHASE_ENDOFTURN
|
||||
if (currentGamePhase == Constants::MTG_PHASE_UNTAP ||
|
||||
currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN ||
|
||||
currentGamePhase == Constants::MTG_PHASE_COMBATBEGIN ||
|
||||
currentGamePhase == Constants::MTG_PHASE_SECONDMAIN ||
|
||||
currentGamePhase == Constants::MTG_PHASE_ENDOFTURN
|
||||
){
|
||||
currentPlayer->manaBurn();
|
||||
}
|
||||
|
||||
//After End of turn
|
||||
if (currentGamePhase == MTG_PHASE_AFTER_EOT){
|
||||
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){
|
||||
currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]);
|
||||
@@ -112,10 +112,10 @@ void GameObserver::nextGamePhase(){
|
||||
|
||||
//Phase Specific actions
|
||||
switch(currentGamePhase){
|
||||
case MTG_PHASE_UNTAP:
|
||||
case Constants::MTG_PHASE_UNTAP:
|
||||
untapPhase();
|
||||
break;
|
||||
case MTG_PHASE_DRAW:
|
||||
case Constants::MTG_PHASE_DRAW:
|
||||
mLayers->stackLayer()->addDraw(currentPlayer,1);
|
||||
break;
|
||||
default:
|
||||
@@ -147,8 +147,8 @@ void GameObserver::startGame(int shuffle, int draw){
|
||||
for (i=0; i<nbPlayers; i++){
|
||||
players[i]->game->initGame(shuffle, draw);
|
||||
}
|
||||
phaseRing->goToPhase(MTG_PHASE_FIRSTMAIN, players[0]);
|
||||
currentGamePhase = MTG_PHASE_FIRSTMAIN;
|
||||
phaseRing->goToPhase(Constants::MTG_PHASE_FIRSTMAIN, players[0]);
|
||||
currentGamePhase = Constants::MTG_PHASE_FIRSTMAIN;
|
||||
}
|
||||
|
||||
void GameObserver::addObserver(MTGAbility * observer){
|
||||
@@ -176,9 +176,9 @@ GameObserver::~GameObserver(){
|
||||
|
||||
void GameObserver::Update(float dt){
|
||||
Player * player = currentPlayer;
|
||||
if (currentGamePhase == MTG_PHASE_COMBATBLOCKERS){
|
||||
if (currentGamePhase == Constants::MTG_PHASE_COMBATBLOCKERS){
|
||||
player = opponent();
|
||||
}else if (currentGamePhase == MTG_PHASE_COMBATDAMAGE){
|
||||
}else if (currentGamePhase == Constants::MTG_PHASE_COMBATDAMAGE){
|
||||
DamageResolverLayer * drl = mLayers->combatLayer();
|
||||
if (drl->currentChoosingPlayer && drl->mCount) player = drl->currentChoosingPlayer;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
||||
currentPlayer->canPutLandsIntoPlay--;
|
||||
}
|
||||
}else if (currentPlayer->game->hand->hasCard(card)){ //Current player's hand
|
||||
if (currentGamePhase == MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7){
|
||||
if (currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7){
|
||||
currentPlayer->game->putInGraveyard(card);
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
||||
mLayers->actionLayer()->setMenuObject(object);
|
||||
}
|
||||
}else if (card->isTapped() && card->controller() == currentPlayer){
|
||||
int a = ConstraintResolver::untap(this, card);
|
||||
// int a = ConstraintResolver::untap(this, card);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,11 +349,11 @@ int GameObserver::canPutInPlay(MTGCardInstance * card){
|
||||
LOG("CANPUTINPLAY- check if card is land or can be played\n");
|
||||
if (card->hasType("land")){
|
||||
LOG("CANPUTINPLAY- card is land - check if can be played\n");
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay && (currentGamePhase == MTG_PHASE_FIRSTMAIN || currentGamePhase == MTG_PHASE_SECONDMAIN)){
|
||||
if (player == currentPlayer && currentPlayer->canPutLandsIntoPlay && (currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || currentGamePhase == Constants::MTG_PHASE_SECONDMAIN)){
|
||||
LOG("CANPUTINPLAY- Land, ok\n");
|
||||
return 1;
|
||||
}
|
||||
}else if ((card->hasType("instant")) || card->has(FLASH) || (player == currentPlayer && (currentGamePhase == MTG_PHASE_FIRSTMAIN || currentGamePhase == MTG_PHASE_SECONDMAIN))){
|
||||
}else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && (currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))){
|
||||
LOG("CANPUTINPLAY- correct time to play\n");
|
||||
if (checkManaCost(card)){
|
||||
LOG("CANPUTINPLAY- ManaCost ok\n");
|
||||
|
||||
@@ -300,20 +300,20 @@ void GameStateMenu::createUsersFirstDeck(int setId){
|
||||
#endif
|
||||
MTGDeck *mCollection = NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache, mParent->collection);
|
||||
//10 lands of each
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Forest")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Forest");
|
||||
if (!mCollection->addRandomCards(10, setId,Constants::RARITY_L,"Forest")){
|
||||
mCollection->addRandomCards(10, -1,Constants::RARITY_L,"Forest");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Plains")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Plains");
|
||||
if (!mCollection->addRandomCards(10, setId,Constants::RARITY_L,"Plains")){
|
||||
mCollection->addRandomCards(10, -1,Constants::RARITY_L,"Plains");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Swamp")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Swamp");
|
||||
if (!mCollection->addRandomCards(10, setId,Constants::RARITY_L,"Swamp")){
|
||||
mCollection->addRandomCards(10, -1,Constants::RARITY_L,"Swamp");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Mountain")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Mountain");
|
||||
if (!mCollection->addRandomCards(10, setId,Constants::RARITY_L,"Mountain")){
|
||||
mCollection->addRandomCards(10, -1,Constants::RARITY_L,"Mountain");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Island")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Island");
|
||||
if (!mCollection->addRandomCards(10, setId,Constants::RARITY_L,"Island")){
|
||||
mCollection->addRandomCards(10, -1,Constants::RARITY_L,"Island");
|
||||
}
|
||||
|
||||
|
||||
@@ -322,18 +322,18 @@ void GameStateMenu::createUsersFirstDeck(int setId){
|
||||
#endif
|
||||
|
||||
//Starter Deck
|
||||
mCollection->addRandomCards(3, setId,RARITY_R,NULL);
|
||||
mCollection->addRandomCards(9, setId,RARITY_U,NULL);
|
||||
mCollection->addRandomCards(48, setId,RARITY_C,NULL);
|
||||
mCollection->addRandomCards(3, setId,Constants::RARITY_R,NULL);
|
||||
mCollection->addRandomCards(9, setId,Constants::RARITY_U,NULL);
|
||||
mCollection->addRandomCards(48, setId,Constants::RARITY_C,NULL);
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("2\n");
|
||||
#endif
|
||||
//Boosters
|
||||
for (int i = 0; i< 2; i++){
|
||||
mCollection->addRandomCards(1, setId,RARITY_R);
|
||||
mCollection->addRandomCards(3, setId,RARITY_U);
|
||||
mCollection->addRandomCards(11, setId,RARITY_C);
|
||||
mCollection->addRandomCards(1, setId,Constants::RARITY_R);
|
||||
mCollection->addRandomCards(3, setId,Constants::RARITY_U);
|
||||
mCollection->addRandomCards(11, setId,Constants::RARITY_C);
|
||||
}
|
||||
mCollection->save();
|
||||
SAFE_DELETE(mCollection);
|
||||
|
||||
@@ -86,8 +86,8 @@ Trigger * AbilityFactory::parseTrigger(string magicText){
|
||||
//Next Time...
|
||||
found = magicText.find("next");
|
||||
if (found != string::npos){
|
||||
for (int i = 0; i < NB_MTG_PHASES; i++){
|
||||
found = magicText.find(MTGPhaseCodeNames[i]);
|
||||
for (int i = 0; i < Constants::NB_MTG_PHASES; i++){
|
||||
found = magicText.find(Constants::MTGPhaseCodeNames[i]);
|
||||
if (found != string::npos){
|
||||
return NEW TriggerNextPhase(i);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
end = s.find(",",previous);
|
||||
string spt = s.substr(previous,end - previous);
|
||||
int power, toughness;
|
||||
int havePowertoughness = parsePowerToughness(spt,&power, &toughness);
|
||||
//int havePowertoughness = parsePowerToughness(spt,&power, &toughness);
|
||||
string sabilities = s.substr(end+1);
|
||||
ManaCost * cost = ManaCost::parseManaCost(s);
|
||||
int multiplier = 1;
|
||||
@@ -499,13 +499,13 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
|
||||
//Gain/loose Ability
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
found = s.find(MTGBasicAbilities[j]);
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
found = s.find(Constants::MTGBasicAbilities[j]);
|
||||
if (found!= string::npos){
|
||||
int modifier = 1;
|
||||
if (found > 0 && s[found-1] == '-') modifier = 0;
|
||||
if (dryMode){
|
||||
if (j == DEFENDER){
|
||||
if (j == Constants::DEFENDER){
|
||||
if (modifier == 1) return BAKA_EFFECT_BAD;
|
||||
return BAKA_EFFECT_GOOD;
|
||||
}else{
|
||||
@@ -610,7 +610,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
|
||||
case 1096: //Basalt Monolith
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 3};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 3};
|
||||
AManaProducer * ability = NEW AManaProducer(_id, card, NEW ManaCost(cost,1));
|
||||
AUntapManaBlocker * ability2 = NEW AUntapManaBlocker(_id+1, card, NEW ManaCost(cost,1));
|
||||
AUnBlocker * ability3 = NEW AUnBlocker(_id+1, card,card, NEW ManaCost(cost,1));
|
||||
@@ -622,7 +622,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1097: //Black Vise
|
||||
{
|
||||
game->addObserver( NEW ALifeZoneLink(_id ,card, MTG_PHASE_UPKEEP, 4));
|
||||
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, 4));
|
||||
break;
|
||||
}
|
||||
case 1191: //Blue Elemental Blast
|
||||
@@ -637,7 +637,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1099: //Brass Man
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
game->addObserver(NEW AUntapManaBlocker(_id, card, NEW ManaCost(cost,1)));
|
||||
break;
|
||||
}
|
||||
@@ -649,36 +649,36 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1282: //Chaoslace
|
||||
{
|
||||
if (card->target){
|
||||
card->target->setColor(MTG_COLOR_RED, 1);
|
||||
card->target->setColor(Constants::MTG_COLOR_RED, 1);
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
starget->source->setColor(MTG_COLOR_RED, 1);
|
||||
starget->source->setColor(Constants::MTG_COLOR_RED, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1335: //Circle of protection : black
|
||||
{
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, MTG_COLOR_BLACK));
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, Constants::MTG_COLOR_BLACK));
|
||||
break;
|
||||
}
|
||||
case 1336: //Circle of protection : blue
|
||||
{
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, MTG_COLOR_BLUE));
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, Constants::MTG_COLOR_BLUE));
|
||||
break;
|
||||
}
|
||||
case 1337: //Circle of protection : green
|
||||
{
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, MTG_COLOR_GREEN));
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, Constants::MTG_COLOR_GREEN));
|
||||
break;
|
||||
}
|
||||
case 1338: //Circle of protection : red
|
||||
{
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, MTG_COLOR_RED));
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, Constants::MTG_COLOR_RED));
|
||||
break;
|
||||
}
|
||||
case 1339: //Circle of protection : white
|
||||
{
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, MTG_COLOR_WHITE));
|
||||
game->addObserver(NEW ACircleOfProtection( _id,card, Constants::MTG_COLOR_WHITE));
|
||||
break;
|
||||
}
|
||||
case 1101: //clockwork Beast
|
||||
@@ -704,24 +704,24 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1103: //Crystal Rod
|
||||
{
|
||||
int cost[] = {MTG_COLOR_BLUE, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, MTG_COLOR_WHITE,NEW ManaCost(cost,1) , 1);
|
||||
int cost[] = {Constants::MTG_COLOR_BLUE, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_WHITE,NEW ManaCost(cost,1) , 1);
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
case 1151: //Deathgrip
|
||||
{
|
||||
int _cost[] = {MTG_COLOR_BLACK, 2};
|
||||
game->addObserver(NEW ASpellCounterEnchantment(_id, card, NEW ManaCost(_cost, 1),MTG_COLOR_GREEN));
|
||||
int _cost[] = {Constants::MTG_COLOR_BLACK, 2};
|
||||
game->addObserver(NEW ASpellCounterEnchantment(_id, card, NEW ManaCost(_cost, 1),Constants::MTG_COLOR_GREEN));
|
||||
break;
|
||||
}
|
||||
case 1152: //Deathlace
|
||||
{
|
||||
if (card->target){
|
||||
card->target->setColor(MTG_COLOR_BLACK, 1);
|
||||
card->target->setColor(Constants::MTG_COLOR_BLACK, 1);
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
starget->source->setColor(MTG_COLOR_BLACK, 1);
|
||||
starget->source->setColor(Constants::MTG_COLOR_BLACK, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -782,8 +782,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1113: //Iron Star
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, MTG_COLOR_RED,NEW ManaCost(cost,1) , 1);
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_RED,NEW ManaCost(cost,1) , 1);
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
@@ -794,14 +794,14 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1114: //Ivory cup
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, MTG_COLOR_WHITE,NEW ManaCost(cost,1) , 1);
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_WHITE,NEW ManaCost(cost,1) , 1);
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
case 1115: //Ivory Tower
|
||||
{
|
||||
game->addObserver(NEW ALifeZoneLink(_id ,card, MTG_PHASE_UPKEEP, 4, 1, 1));
|
||||
game->addObserver(NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, 4, 1, 1));
|
||||
break;
|
||||
}
|
||||
case 1117: //Jandors Ring
|
||||
@@ -821,17 +821,17 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1256: //LifeForce
|
||||
{
|
||||
int _cost[] = {MTG_COLOR_GREEN, 2};
|
||||
game->addObserver(NEW ASpellCounterEnchantment(_id, card, NEW ManaCost(_cost, 1),MTG_COLOR_BLACK));
|
||||
int _cost[] = {Constants::MTG_COLOR_GREEN, 2};
|
||||
game->addObserver(NEW ASpellCounterEnchantment(_id, card, NEW ManaCost(_cost, 1),Constants::MTG_COLOR_BLACK));
|
||||
break;
|
||||
}
|
||||
case 1257: //Lifelace
|
||||
{
|
||||
if (card->target){
|
||||
card->target->setColor(MTG_COLOR_GREEN, 1);
|
||||
card->target->setColor(Constants::MTG_COLOR_GREEN, 1);
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
starget->source->setColor(MTG_COLOR_GREEN, 1);
|
||||
starget->source->setColor(Constants::MTG_COLOR_GREEN, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -847,11 +847,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1124: //Mana Vault
|
||||
{
|
||||
int output[] = {MTG_COLOR_ARTIFACT, 3};
|
||||
int output[] = {Constants::MTG_COLOR_ARTIFACT, 3};
|
||||
game->addObserver(NEW AManaProducer(_id,card,NEW ManaCost(output,1)));
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 4};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
||||
game->addObserver(NEW AUntapManaBlocker(_id+1, card, NEW ManaCost(cost,1)));
|
||||
game->addObserver(NEW ARegularLifeModifierAura(_id+2, card, card, MTG_PHASE_DRAW, -1, 1));
|
||||
game->addObserver(NEW ARegularLifeModifierAura(_id+2, card, card, Constants::MTG_PHASE_DRAW, -1, 1));
|
||||
break;
|
||||
}
|
||||
case 1126:// Millstone
|
||||
@@ -872,10 +872,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1358: //Purelace
|
||||
{
|
||||
if (card->target){
|
||||
card->target->setColor(MTG_COLOR_WHITE, 1);
|
||||
card->target->setColor(Constants::MTG_COLOR_WHITE, 1);
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
starget->source->setColor(MTG_COLOR_WHITE, 1);
|
||||
starget->source->setColor(Constants::MTG_COLOR_WHITE, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -896,20 +896,20 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1139: //The Rack
|
||||
{
|
||||
game->addObserver( NEW ALifeZoneLink(_id ,card, MTG_PHASE_UPKEEP, -3));
|
||||
game->addObserver( NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, -3));
|
||||
break;
|
||||
}
|
||||
case 1140: //Throne of bones
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, MTG_COLOR_BLACK,NEW ManaCost(cost,1) , 1);
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_BLACK,NEW ManaCost(cost,1) , 1);
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
case 1142: //Wooden Sphere
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, MTG_COLOR_GREEN,NEW ManaCost(cost,1) , 1);
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
ASpellCastLife* ability = NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_GREEN,NEW ManaCost(cost,1) , 1);
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1171: //Paralysis
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 4};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
|
||||
game->addObserver(NEW AUntapManaBlocker(_id, card,card->target, NEW ManaCost(cost,1)));
|
||||
card->target->tapped = 1;
|
||||
break;
|
||||
@@ -1042,7 +1042,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1185: //Warp Artifact
|
||||
{
|
||||
game->addObserver(NEW ARegularLifeModifierAura(_id, card, card->target, MTG_PHASE_UPKEEP, -1));
|
||||
game->addObserver(NEW ARegularLifeModifierAura(_id, card, card->target, Constants::MTG_PHASE_UPKEEP, -1));
|
||||
break;
|
||||
}
|
||||
case 1192: //BrainGeyser
|
||||
@@ -1067,7 +1067,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 129601: //Icy Manipulator
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT, 1};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1};
|
||||
TypeTargetChooser * tc = new TypeTargetChooser("artifact",card);
|
||||
tc->addType("land");
|
||||
tc->addType("creature");
|
||||
@@ -1077,7 +1077,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
|
||||
case 1203: //Island Fish
|
||||
{
|
||||
int cost[] = {MTG_COLOR_BLUE, 3};
|
||||
int cost[] = {Constants::MTG_COLOR_BLUE, 3};
|
||||
game->addObserver(NEW AUntapManaBlocker(_id, card, NEW ManaCost(cost,1)));
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card, "island"));
|
||||
break;
|
||||
@@ -1116,7 +1116,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1228: //Unstable mutation
|
||||
{
|
||||
game->addObserver(NEW APowerToughnessModifier(_id, card, card->target, 3, 3));
|
||||
game->addObserver(NEW APowerToughnessModifierRegularCounter(_id, card, card->target, MTG_PHASE_UPKEEP, -1, -1));
|
||||
game->addObserver(NEW APowerToughnessModifierRegularCounter(_id, card, card->target, Constants::MTG_PHASE_UPKEEP, -1, -1));
|
||||
break;
|
||||
}
|
||||
case 1229: //Unsummon
|
||||
@@ -1133,7 +1133,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1236: //Birds of Paradise
|
||||
{
|
||||
for (int i = MTG_COLOR_GREEN; i <= MTG_COLOR_WHITE; i++){
|
||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; i++){
|
||||
int output[]={i,1};
|
||||
game->addObserver(NEW AManaProducer(_id + i, card, NEW ManaCost(output,1)));
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->mLayers->stackLayer()->addDamage(card, game->players[i], x);
|
||||
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){
|
||||
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
|
||||
if (current->basicAbilities[FLYING] && current->isACreature()){
|
||||
if (current->basicAbilities[Constants::FLYING] && current->isACreature()){
|
||||
game->mLayers->stackLayer()->addDamage(card, current, x);
|
||||
}
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1262: //Regeneration
|
||||
{
|
||||
int cost[] = {MTG_COLOR_GREEN, 1};
|
||||
int cost[] = {Constants::MTG_COLOR_GREEN, 1};
|
||||
game->addObserver(NEW AStandardRegenerate(_id,card,card->target,NEW ManaCost(cost,1)));
|
||||
break;
|
||||
}
|
||||
@@ -1204,7 +1204,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1278: //Web
|
||||
{
|
||||
game->addObserver(NEW APowerToughnessModifier(_id, card, card->target, 0,2));
|
||||
game->addObserver(NEW ABasicAbilityModifier(_id + 1, card, card->target, REACH));
|
||||
game->addObserver(NEW ABasicAbilityModifier(_id + 1, card, card->target, Constants::REACH));
|
||||
break;
|
||||
}
|
||||
case 1280: //Atog
|
||||
@@ -1216,7 +1216,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
{
|
||||
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
|
||||
tc->maxpower = 2;
|
||||
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, UNBLOCKABLE, NULL,tc));
|
||||
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, Constants::UNBLOCKABLE, NULL,tc));
|
||||
break;
|
||||
}
|
||||
case 1288: //EarthBind
|
||||
@@ -1231,7 +1231,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->mLayers->stackLayer()->addDamage(card, game->players[i], x);
|
||||
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){
|
||||
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
|
||||
if (!current->basicAbilities[FLYING] && current->isACreature()){
|
||||
if (!current->basicAbilities[Constants::FLYING] && current->isACreature()){
|
||||
game->mLayers->stackLayer()->addDamage(card, current, x);
|
||||
}
|
||||
}
|
||||
@@ -1275,7 +1275,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1326: //Wheel of fortune
|
||||
{
|
||||
for (int i = 0; i < 2; i++){
|
||||
MTGLibrary * library = game->players[i]->game->library;
|
||||
// MTGLibrary * library = game->players[i]->game->library;
|
||||
MTGHand * hand = game->players[i]->game->hand;
|
||||
for (int j = hand->nb_cards-1; j>=0; j--){
|
||||
game->players[i]->game->putInGraveyard(hand->cards[j]);
|
||||
@@ -1288,12 +1288,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1331: //Black Ward
|
||||
{
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_BLACK));
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_BLACK));
|
||||
break;
|
||||
}
|
||||
case 1333: //Blue Ward
|
||||
{
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_BLUE));
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_BLUE));
|
||||
break;
|
||||
}
|
||||
case 1334: //Castle
|
||||
@@ -1308,7 +1308,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1346: //Green Ward
|
||||
{
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_GREEN));
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_GREEN));
|
||||
break;
|
||||
}
|
||||
case 1352: //Karma
|
||||
@@ -1323,7 +1323,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1359: //Red Ward
|
||||
{
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_RED));
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_RED));
|
||||
break;
|
||||
}
|
||||
case 1360: //Resurrection
|
||||
@@ -1361,7 +1361,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 1182: //Terror
|
||||
{
|
||||
if (card->target->hasColor(MTG_COLOR_BLACK) || card->target->hasSubtype("artifact")){
|
||||
if (card->target->hasColor(Constants::MTG_COLOR_BLACK) || card->target->hasSubtype("artifact")){
|
||||
}else{
|
||||
card->target->controller()->game->putInGraveyard(card->target);
|
||||
}
|
||||
@@ -1375,16 +1375,16 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 1227: //Toughtlace
|
||||
{
|
||||
if (card->target){
|
||||
card->target->setColor(MTG_COLOR_BLUE, 1);
|
||||
card->target->setColor(Constants::MTG_COLOR_BLUE, 1);
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
starget->source->setColor(MTG_COLOR_BLUE, 1);
|
||||
starget->source->setColor(Constants::MTG_COLOR_BLUE, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1371: //White Ward
|
||||
{
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_WHITE));
|
||||
game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_WHITE));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1457,7 +1457,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
}
|
||||
case 2443: //Dark Banishing
|
||||
{
|
||||
if (card->target->hasColor(MTG_COLOR_BLACK)){
|
||||
if (card->target->hasColor(Constants::MTG_COLOR_BLACK)){
|
||||
}else{
|
||||
card->target->controller()->game->putInGraveyard(card->target);
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
case 2484: //Songs of the Damned
|
||||
{
|
||||
int mana = card->controller()->game->graveyard->countByType("creature");
|
||||
game->currentlyActing()->getManaPool()->add(MTG_COLOR_BLACK, mana);
|
||||
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_BLACK, mana);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1490,21 +1490,21 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
int mana_cr = game->opponent()->game->graveyard->countByType("creature");
|
||||
int mana_ar = game->opponent()->game->graveyard->countByType("artifact");
|
||||
int spoil = mana_ar + mana_cr;
|
||||
game->currentlyActing()->getManaPool()->add(MTG_COLOR_ARTIFACT, spoil);
|
||||
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_ARTIFACT, spoil);
|
||||
game->currentlyActing()->life+= spoil;
|
||||
break;
|
||||
}
|
||||
case 2435: //Whalebone Glider
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT,2};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT,2};
|
||||
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
|
||||
tc->maxpower = 3;
|
||||
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, FLYING, NEW ManaCost(cost,1),tc));
|
||||
game->addObserver(NEW ABasicAbilityModifierUntilEOT(_id, card, Constants::FLYING, NEW ManaCost(cost,1),tc));
|
||||
break;
|
||||
}
|
||||
case 2393: //Aegis of the Meek work but work also for 0/1 creatures... :D
|
||||
{
|
||||
int cost[] = {MTG_COLOR_ARTIFACT,1};
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT,1};
|
||||
CreatureTargetChooser * tc = NEW CreatureTargetChooser(card);
|
||||
tc->maxpower = 1;
|
||||
tc->maxtoughness =1;
|
||||
@@ -1527,41 +1527,41 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
* For example, setting LIFELINK for a creature is not enough right now...
|
||||
* It shouldn't be necessary to add an object. State based abilities could do the trick
|
||||
*/
|
||||
if (card->basicAbilities[LIFELINK]){
|
||||
if (card->basicAbilities[Constants::LIFELINK]){
|
||||
ALifeLink * ability = NEW ALifeLink(_id, card);
|
||||
game->addObserver(ability);
|
||||
}
|
||||
|
||||
for (int i=PROTECTIONGREEN; i <= PROTECTIONWHITE; i++){
|
||||
for (int i=Constants::PROTECTIONGREEN; i <= Constants::PROTECTIONWHITE; i++){
|
||||
if (card->basicAbilities[i]){
|
||||
game->addObserver(NEW AProtectionFrom(_id, card, card, i - PROTECTIONGREEN + MTG_COLOR_GREEN));
|
||||
game->addObserver(NEW AProtectionFrom(_id, card, card, i - Constants::PROTECTIONGREEN + Constants::MTG_COLOR_GREEN));
|
||||
}
|
||||
}
|
||||
|
||||
if (card->basicAbilities[EXALTED]){
|
||||
if (card->basicAbilities[Constants::EXALTED]){
|
||||
game->addObserver(NEW AExalted(_id, card));
|
||||
}
|
||||
|
||||
// Tested works the first r10 did not function because of the mistake in the array of the definition
|
||||
if (card->basicAbilities[FORESTHOME]){
|
||||
if (card->basicAbilities[Constants::FORESTHOME]){
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card, "forest"));
|
||||
}
|
||||
if (card->basicAbilities[ISLANDHOME]){
|
||||
if (card->basicAbilities[Constants::ISLANDHOME]){
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card, "island"));
|
||||
}
|
||||
if (card->basicAbilities[MOUNTAINHOME]){
|
||||
if (card->basicAbilities[Constants::MOUNTAINHOME]){
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card,"moutain"));
|
||||
}
|
||||
if (card->basicAbilities[SWAMPHOME]){
|
||||
if (card->basicAbilities[Constants::SWAMPHOME]){
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card,"swamp"));
|
||||
}
|
||||
if (card->basicAbilities[PLAINSHOME]){
|
||||
if (card->basicAbilities[Constants::PLAINSHOME]){
|
||||
game->addObserver(NEW AStrongLandLinkCreature(_id, card,"plains"));
|
||||
}
|
||||
|
||||
// New Abilities Flanking and Rampage
|
||||
|
||||
if (card->basicAbilities [RAMPAGE1]){
|
||||
if (card->basicAbilities [Constants::RAMPAGE1]){
|
||||
game->addObserver (NEW ARampageAbility(_id, card, 1, 1));
|
||||
}
|
||||
|
||||
@@ -1751,7 +1751,7 @@ InstantAbility::InstantAbility(int _id, MTGCardInstance * source, Damageable * _
|
||||
//Instant abilities last generally until the end of the turn
|
||||
int InstantAbility::testDestroy(){
|
||||
int newPhase = game->getCurrentGamePhase();
|
||||
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) return 1;
|
||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) return 1;
|
||||
currentPhase = newPhase;
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ const char * MTGCard::getSetName(){
|
||||
|
||||
MTGCard::MTGCard(MTGCard * source){
|
||||
mCache = source->mCache;
|
||||
for (int i = 0; i< NB_BASIC_ABILITIES; i++){
|
||||
for (int i = 0; i< Constants::NB_BASIC_ABILITIES; i++){
|
||||
basicAbilities[i] = source->basicAbilities[i];
|
||||
}
|
||||
for (int i = 0; i< MAX_TYPES_PER_CARD; i++){
|
||||
types[i] = source->types[i];
|
||||
}
|
||||
nb_types = source->nb_types;
|
||||
for (int i = 0; i< MTG_NB_COLORS; i++){
|
||||
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
|
||||
colors[i] = source->colors[i];
|
||||
}
|
||||
manaCost.copy(source->getManaCost());
|
||||
@@ -62,13 +62,13 @@ MTGCard::MTGCard(MTGCard * source){
|
||||
|
||||
int MTGCard::init(){
|
||||
nb_types = 0;
|
||||
for (int i = 0; i< NB_BASIC_ABILITIES; i++){
|
||||
for (int i = 0; i< Constants::NB_BASIC_ABILITIES; i++){
|
||||
basicAbilities[i] = 0;
|
||||
}
|
||||
for (int i = 0; i< MAX_TYPES_PER_CARD; i++){
|
||||
types[i] = 0;
|
||||
}
|
||||
for (int i = 0; i< MTG_NB_COLORS; i++){
|
||||
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
|
||||
colors[i] = 0;
|
||||
}
|
||||
setId = 0;
|
||||
@@ -104,7 +104,7 @@ int MTGCard::isACreature(){
|
||||
|
||||
void MTGCard::setColor(int _color, int removeAllOthers){
|
||||
if (removeAllOthers){
|
||||
for (int i=0; i<MTG_NB_COLORS; i++){
|
||||
for (int i=0; i<Constants::MTG_NB_COLORS; i++){
|
||||
colors[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void MTGCard::setColor(int _color, int removeAllOthers){
|
||||
|
||||
int MTGCard::getColor(){
|
||||
int i = 0;
|
||||
for (int i=0; i<MTG_NB_COLORS; i++){
|
||||
for (int i=0; i<Constants::MTG_NB_COLORS; i++){
|
||||
if (colors[i]){
|
||||
return i;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ int MTGCard::hasColor(int color){
|
||||
|
||||
void MTGCard::setManaCost(string s){
|
||||
ManaCost::parseManaCost(s, &manaCost);
|
||||
for (int i = MTG_COLOR_GREEN; i <=MTG_COLOR_WHITE; i++){
|
||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; i++){
|
||||
if (manaCost.hasColor(i)){
|
||||
setColor(i);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ int MTGCardInstance::cleanup(){
|
||||
*/
|
||||
int MTGCardInstance::hasSummoningSickness(){
|
||||
if (!summoningSickness) return 0;
|
||||
if (basicAbilities[HASTE]) return 0;
|
||||
if (basicAbilities[Constants::HASTE]) return 0;
|
||||
if (!isACreature()) return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ Player * MTGCardInstance::controller(){
|
||||
}
|
||||
|
||||
int MTGCardInstance::canAttack(){
|
||||
if (!hasSummoningSickness() && !tapped && isACreature() && basicAbilities[DEFENSER] !=1)
|
||||
if (!hasSummoningSickness() && !tapped && isACreature() && basicAbilities[Constants::DEFENSER] !=1)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -242,18 +242,18 @@ int MTGCardInstance::canBlock(MTGCardInstance * opponent){
|
||||
if (!opponent->isAttacker()) return 0;
|
||||
// Comprehensive rule 502.7f : If a creature with protection attacks, it can't be blocked by creatures that have the stated quality.
|
||||
if (opponent->protectedAgainst(this)) return 0;
|
||||
if (opponent->basicAbilities[UNBLOCKABLE]) return 0;
|
||||
if (opponent->basicAbilities[FEAR] && !(hasColor(MTG_COLOR_ARTIFACT) || hasColor(MTG_COLOR_BLACK))) return 0;
|
||||
if (opponent->basicAbilities[FLYING] && !( basicAbilities[FLYING] || basicAbilities[REACH])) return 0;
|
||||
if (opponent->basicAbilities[Constants::UNBLOCKABLE]) return 0;
|
||||
if (opponent->basicAbilities[Constants::FEAR] && !(hasColor(Constants::MTG_COLOR_ARTIFACT) || hasColor(Constants::MTG_COLOR_BLACK))) return 0;
|
||||
if (opponent->basicAbilities[Constants::FLYING] && !( basicAbilities[Constants::FLYING] || basicAbilities[Constants::REACH])) return 0;
|
||||
// If opponent has shadow and a creature does not have either shadow or reachshadow it cannot be blocked
|
||||
if (opponent->basicAbilities[SHADOW] && !( basicAbilities[SHADOW] || basicAbilities[REACHSHADOW])) return 0;
|
||||
if (opponent->basicAbilities[Constants::SHADOW] && !( basicAbilities[Constants::SHADOW] || basicAbilities[Constants::REACHSHADOW])) return 0;
|
||||
// If opponent does not have shadow and a creature has shadow it cannot be blocked
|
||||
if (!opponent->basicAbilities[SHADOW] && basicAbilities[SHADOW]) return 0;
|
||||
if (opponent->basicAbilities[SWAMPWALK] && controller()->game->inPlay->hasType("swamp")) return 0;
|
||||
if (opponent->basicAbilities[FORESTWALK] && controller()->game->inPlay->hasType("forest")) return 0;
|
||||
if (opponent->basicAbilities[ISLANDWALK] && controller()->game->inPlay->hasType("island")) return 0;
|
||||
if (opponent->basicAbilities[MOUNTAINWALK] && controller()->game->inPlay->hasType("mountain")) return 0;
|
||||
if (opponent->basicAbilities[PLAINSWALK] && controller()->game->inPlay->hasType("plains")) return 0;
|
||||
if (!opponent->basicAbilities[Constants::SHADOW] && basicAbilities[Constants::SHADOW]) return 0;
|
||||
if (opponent->basicAbilities[Constants::SWAMPWALK] && controller()->game->inPlay->hasType("swamp")) return 0;
|
||||
if (opponent->basicAbilities[Constants::FORESTWALK] && controller()->game->inPlay->hasType("forest")) return 0;
|
||||
if (opponent->basicAbilities[Constants::ISLANDWALK] && controller()->game->inPlay->hasType("island")) return 0;
|
||||
if (opponent->basicAbilities[Constants::MOUNTAINWALK] && controller()->game->inPlay->hasType("mountain")) return 0;
|
||||
if (opponent->basicAbilities[Constants::PLAINSWALK] && controller()->game->inPlay->hasType("plains")) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ MTGCardInstance * MTGCardInstance::getNextPartner(){
|
||||
MTGInPlay * inplay = controller()->game->inPlay;
|
||||
MTGCardInstance * bandingPartner = inplay->getNextAttacker(banding);
|
||||
while (bandingPartner){
|
||||
if (basicAbilities[BANDING] || bandingPartner->basicAbilities[BANDING]) return bandingPartner;
|
||||
if (basicAbilities[Constants::BANDING] || bandingPartner->basicAbilities[Constants::BANDING]) return bandingPartner;
|
||||
bandingPartner = inplay->getNextAttacker(bandingPartner);
|
||||
}
|
||||
return NULL;
|
||||
@@ -422,9 +422,9 @@ JSample * MTGCardInstance::getSample(){
|
||||
}
|
||||
}
|
||||
if (!sample.size()){
|
||||
for (int i = 0; i < NB_BASIC_ABILITIES; i++){
|
||||
for (int i = 0; i < Constants::NB_BASIC_ABILITIES; i++){
|
||||
if (!basicAbilities[i]) continue;
|
||||
string type = MTGBasicAbilities[i];
|
||||
string type = Constants::MTGBasicAbilities[i];
|
||||
type = "sound/sfx/" + type + ".wav";
|
||||
if (fileExists(type.c_str())){
|
||||
sample = type;
|
||||
|
||||
@@ -52,8 +52,8 @@ int MTGAllCards::processConfLine(string s, MTGCard *card){
|
||||
}else if (key.compare("abilities")==0){
|
||||
//Specific Abilities
|
||||
std::transform( value.begin(), value.end(), value.begin(),::tolower );
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
unsigned int found = value.find(MTGBasicAbilities[j]);
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
unsigned int found = value.find(Constants::MTGBasicAbilities[j]);
|
||||
if (found != string::npos){
|
||||
card->basicAbilities[j] = 1;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ int MTGAllCards::processConfLine(string s, MTGCard *card){
|
||||
break;
|
||||
case 'A':
|
||||
card->setType( "Artifact");
|
||||
card->setColor(MTG_COLOR_ARTIFACT);
|
||||
card->setColor(Constants::MTG_COLOR_ARTIFACT);
|
||||
if (value.c_str()[8] == ' ' && value.c_str()[9] == 'C')
|
||||
card->setSubtype("Creature");
|
||||
break;
|
||||
@@ -85,11 +85,11 @@ int MTGAllCards::processConfLine(string s, MTGCard *card){
|
||||
card->setType( "Sorcery");
|
||||
break;
|
||||
case 'B'://Basic Land
|
||||
card->setColor(MTG_COLOR_LAND);
|
||||
card->setColor(Constants::MTG_COLOR_LAND);
|
||||
card->setType("Land");
|
||||
break;
|
||||
case 'L':
|
||||
card->setColor(MTG_COLOR_LAND);
|
||||
card->setColor(Constants::MTG_COLOR_LAND);
|
||||
card->setType( "Land");
|
||||
break;
|
||||
case 'I':
|
||||
@@ -115,7 +115,7 @@ int MTGAllCards::processConfLine(string s, MTGCard *card){
|
||||
}
|
||||
|
||||
void MTGAllCards::initCounters(){
|
||||
for (int i=0; i< MTG_NB_COLORS; i++){
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
colorsCount[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ int MTGAllCards::countByType(const char * _type){
|
||||
|
||||
int MTGAllCards::countByColor(int color){
|
||||
if (colorsCount[color] == 0){
|
||||
for (int i=0; i< MTG_NB_COLORS; i++){
|
||||
for (int i=0; i< Constants::MTG_NB_COLORS; i++){
|
||||
colorsCount[i] = 0;
|
||||
}
|
||||
for (int i=0; i< total_cards; i++){
|
||||
@@ -309,7 +309,7 @@ int MTGDeck::addRandomCards(int howmany, int setId, int rarity, const char * _su
|
||||
sprintf(subtype, _subtype);
|
||||
|
||||
|
||||
int subcollection[TOTAL_NUMBER_OF_CARDS];
|
||||
int subcollection[Constants::TOTAL_NUMBER_OF_CARDS];
|
||||
int subtotal = 0;
|
||||
for (int i = 0; i < collectionTotal; i++){
|
||||
MTGCard * card = allcards->_(i);
|
||||
|
||||
@@ -38,13 +38,13 @@ MTGGuiPlay::MTGGuiPlay(int id, GameObserver * _game):PlayGuiObjectController(id,
|
||||
|
||||
mIconsTexture = JRenderer::GetInstance()->LoadTexture("graphics/menuicons.png", TEX_TYPE_USE_VRAM);
|
||||
//load all the icon images
|
||||
mIcons[MTG_COLOR_ARTIFACT] = NEW JQuad(mIconsTexture, 2+6*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_LAND] = NEW JQuad(mIconsTexture, 2+5*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_WHITE] = NEW JQuad(mIconsTexture, 2+4*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_RED] = NEW JQuad(mIconsTexture, 2+3*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_BLACK] = NEW JQuad(mIconsTexture, 2+2*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_BLUE] = NEW JQuad(mIconsTexture, 2+1*36, 38, 32, 32);
|
||||
mIcons[MTG_COLOR_GREEN] = NEW JQuad(mIconsTexture, 2+0*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_ARTIFACT] = NEW JQuad(mIconsTexture, 2+6*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_LAND] = NEW JQuad(mIconsTexture, 2+5*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_WHITE] = NEW JQuad(mIconsTexture, 2+4*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_RED] = NEW JQuad(mIconsTexture, 2+3*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_BLACK] = NEW JQuad(mIconsTexture, 2+2*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_BLUE] = NEW JQuad(mIconsTexture, 2+1*36, 38, 32, 32);
|
||||
mIcons[Constants::MTG_COLOR_GREEN] = NEW JQuad(mIconsTexture, 2+0*36, 38, 32, 32);
|
||||
for (int i=0; i < 7; i++){
|
||||
mIcons[i]->SetHotSpot(16,16);
|
||||
}
|
||||
@@ -311,7 +311,7 @@ void MTGGuiPlay::RenderPhaseBar(){
|
||||
}else{
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
}
|
||||
mFont->DrawString(MTGPhaseNames[currentPhase], 375, 0);
|
||||
mFont->DrawString(Constants::MTGPhaseNames[currentPhase], 375, 0);
|
||||
}
|
||||
|
||||
void MTGGuiPlay::Render(){
|
||||
@@ -323,7 +323,7 @@ void MTGGuiPlay::Render(){
|
||||
//mBg2->SetColor(ARGB(alphaBg[0], alphaBg[1],alphaBg[2],alphaBg[3]));
|
||||
renderer->RenderQuad(mBg2,0,17);
|
||||
|
||||
if (game->currentGamePhase >=MTG_PHASE_COMBATBEGIN && game->currentGamePhase < MTG_PHASE_COMBATEND){
|
||||
if (game->currentGamePhase >= Constants::MTG_PHASE_COMBATBEGIN && game->currentGamePhase < Constants::MTG_PHASE_COMBATEND){
|
||||
if (alphaBg[0] < 50){
|
||||
alphaBg[3]-=12;
|
||||
alphaBg[2]-=12;
|
||||
|
||||
@@ -5,7 +5,7 @@ MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){
|
||||
}
|
||||
|
||||
int MTGAttackRule::isReactingToClick(MTGCardInstance * card){
|
||||
if (currentPhase == MTG_PHASE_COMBATATTACKERS && card->controller() == game->currentPlayer && !card->isAttacker()){
|
||||
if (currentPhase == Constants::MTG_PHASE_COMBATATTACKERS && card->controller() == game->currentPlayer && !card->isAttacker()){
|
||||
if (card->canAttack()) return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -14,7 +14,7 @@ int MTGAttackRule::isReactingToClick(MTGCardInstance * card){
|
||||
int MTGAttackRule::reactToClick(MTGCardInstance * card){
|
||||
if (!isReactingToClick(card)) return 0;
|
||||
card->attacker = 1;
|
||||
if (!card->basicAbilities[VIGILANCE]) card->tapped = 1;
|
||||
if (!card->basicAbilities[Constants::VIGILANCE]) card->tapped = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ MTGBlockRule::MTGBlockRule(int _id):MTGAbility(_id,NULL){
|
||||
}
|
||||
|
||||
int MTGBlockRule::isReactingToClick(MTGCardInstance * card){
|
||||
if (currentPhase == MTG_PHASE_COMBATBLOCKERS && !game->isInterrupting && card->controller() == game->opponent()){
|
||||
if (currentPhase == Constants::MTG_PHASE_COMBATBLOCKERS && !game->isInterrupting && card->controller() == game->opponent()){
|
||||
if (card->canBlock()) return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -38,15 +38,15 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
||||
}else{
|
||||
string value = s.substr(start+1, end - 1 - start);
|
||||
if (value == "u"){
|
||||
manaCost->add(MTG_COLOR_BLUE, 1);
|
||||
manaCost->add(Constants::MTG_COLOR_BLUE, 1);
|
||||
}else if (value == "b"){
|
||||
manaCost->add(MTG_COLOR_BLACK, 1);
|
||||
manaCost->add(Constants::MTG_COLOR_BLACK, 1);
|
||||
}else if (value == "w"){
|
||||
manaCost->add(MTG_COLOR_WHITE, 1);
|
||||
manaCost->add(Constants::MTG_COLOR_WHITE, 1);
|
||||
}else if (value == "g"){
|
||||
manaCost->add(MTG_COLOR_GREEN, 1);
|
||||
manaCost->add(Constants::MTG_COLOR_GREEN, 1);
|
||||
}else if (value == "r"){
|
||||
manaCost->add(MTG_COLOR_RED, 1);
|
||||
manaCost->add(Constants::MTG_COLOR_RED, 1);
|
||||
}else if (value == "x"){
|
||||
manaCost->x();
|
||||
}else if (value == "t"){
|
||||
@@ -61,11 +61,11 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
||||
for (int i = 0; i < 2; i++){
|
||||
char c = value[i];
|
||||
if (c >='0' && c <='9'){
|
||||
colors[i] = MTG_COLOR_ARTIFACT;
|
||||
colors[i] = Constants::MTG_COLOR_ARTIFACT;
|
||||
values[i] = c - '0';
|
||||
}else{
|
||||
for (int j = 0; j < MTG_NB_COLORS; j++){
|
||||
if (c == MTGColorChars[j]){
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
||||
if (c == Constants::MTGColorChars[j]){
|
||||
colors[i] = j;
|
||||
values[i] = 1;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
||||
}
|
||||
manaCost->addHybrid(colors[0], values[0], colors[1], values[1]);
|
||||
}else{
|
||||
manaCost->add(MTG_COLOR_ARTIFACT, intvalue);
|
||||
manaCost->add(Constants::MTG_COLOR_ARTIFACT, intvalue);
|
||||
}
|
||||
}
|
||||
s = s.substr(end + 1);
|
||||
@@ -109,7 +109,7 @@ ManaCost::ManaCost(int _cost[], int nb_elems){
|
||||
ManaCost::ManaCost(ManaCost * _manaCost){
|
||||
init();
|
||||
int i;
|
||||
for (i=0; i<= MTG_NB_COLORS; i++){
|
||||
for (i=0; i<= Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = _manaCost->getCost(i);
|
||||
}
|
||||
}
|
||||
@@ -122,12 +122,12 @@ ManaCost::~ManaCost(){
|
||||
}
|
||||
|
||||
void ManaCost::x(){
|
||||
cost[MTG_NB_COLORS] = 1;
|
||||
cost[Constants::MTG_NB_COLORS] = 1;
|
||||
}
|
||||
|
||||
void ManaCost::init(){
|
||||
int i;
|
||||
for (i=0; i<= MTG_NB_COLORS; i++){
|
||||
for (i=0; i<= Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = 0;
|
||||
}
|
||||
nbhybrids = 0;
|
||||
@@ -135,7 +135,7 @@ void ManaCost::init(){
|
||||
|
||||
|
||||
void ManaCost::copy(ManaCost * _manaCost){
|
||||
for (int i=0; i<= MTG_NB_COLORS; i++){
|
||||
for (int i=0; i<= Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = _manaCost->getCost(i);
|
||||
}
|
||||
for (int i=0; i< _manaCost->nbhybrids; i++){
|
||||
@@ -149,7 +149,7 @@ int ManaCost::getCost(int color){
|
||||
}
|
||||
|
||||
int ManaCost::getMainColor(){
|
||||
for (int i=0; i< MTG_NB_COLORS; i++){
|
||||
for (int i=0; i< Constants::MTG_NB_COLORS; i++){
|
||||
if (cost[i]) return i;
|
||||
}
|
||||
return 0;
|
||||
@@ -165,7 +165,7 @@ int ManaCost::hasColor(int color){
|
||||
|
||||
int ManaCost::getConvertedCost(){
|
||||
int result = 0;
|
||||
for (int i=0; i< MTG_NB_COLORS; i++){
|
||||
for (int i=0; i< Constants::MTG_NB_COLORS; i++){
|
||||
result += cost[i];
|
||||
}
|
||||
for (int i = 0; i < nbhybrids; i++){
|
||||
@@ -186,7 +186,7 @@ int ManaCost::add(int color, int value){
|
||||
|
||||
int ManaCost::add(ManaCost * _cost){
|
||||
if(!_cost) return 0;
|
||||
for (int i=0; i< MTG_NB_COLORS; i++){
|
||||
for (int i=0; i< Constants::MTG_NB_COLORS; i++){
|
||||
cost[i]+= _cost->getCost(i);
|
||||
}
|
||||
for (int i=0; i< _cost->nbhybrids; i++){
|
||||
@@ -210,7 +210,7 @@ int ManaCost::addHybrid(int c1, int v1, int c2, int v2){
|
||||
|
||||
int ManaCost::pay(ManaCost * _cost){
|
||||
ManaCost * diff = Diff(_cost);
|
||||
for (int i=0; i < MTG_NB_COLORS; i++){
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
cost[i] = diff->getCost(i);
|
||||
}
|
||||
delete diff;
|
||||
@@ -233,7 +233,7 @@ int ManaCost::canAfford(ManaCost * _cost){
|
||||
}
|
||||
|
||||
int ManaCost::isPositive(){
|
||||
for (int i=0; i < MTG_NB_COLORS; i++){
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
|
||||
if (cost[i] < 0){
|
||||
return 0;
|
||||
@@ -273,9 +273,9 @@ int ManaCost::tryToPayHybrids(ManaCostHybrid * _hybrids[], int _nbhybrids, int d
|
||||
|
||||
//compute the difference between two mana costs
|
||||
ManaCost * ManaCost::Diff(ManaCost * _cost){
|
||||
int diff[(MTG_NB_COLORS + 1 )* 2];
|
||||
diff[MTG_NB_COLORS * 2] = MTG_NB_COLORS;
|
||||
for (int i=0; i < MTG_NB_COLORS; i++){
|
||||
int diff[(Constants::MTG_NB_COLORS + 1 )* 2];
|
||||
diff[Constants::MTG_NB_COLORS * 2] = Constants::MTG_NB_COLORS;
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
diff[i*2] = i;
|
||||
diff[i*2 +1] = cost[i] - _cost->getCost(i);
|
||||
}
|
||||
@@ -283,14 +283,14 @@ ManaCost * ManaCost::Diff(ManaCost * _cost){
|
||||
if (!hybridResult) randomDiffHybrids(_cost,diff);
|
||||
|
||||
//Colorless mana, special case
|
||||
int colorless_idx = MTG_COLOR_ARTIFACT * 2 + 1;
|
||||
int colorless_idx = Constants::MTG_COLOR_ARTIFACT * 2 + 1;
|
||||
if (diff[colorless_idx] < 0){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
//char buf[4096], *p = buf;
|
||||
//sprintf(buf, "--Diff color TEST %i : %i\n", i, cost[i]);
|
||||
OutputDebugString("Colorless mana not enough\n");
|
||||
#endif
|
||||
for (int i=0; i < MTG_NB_COLORS; i++){
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
if (diff[i*2 + 1] > 0){
|
||||
if (diff[i*2 + 1] + diff[colorless_idx] > 0){
|
||||
diff[i*2 + 1] += diff[colorless_idx];
|
||||
@@ -305,17 +305,17 @@ ManaCost * ManaCost::Diff(ManaCost * _cost){
|
||||
}
|
||||
|
||||
//Cost X
|
||||
if (_cost->getCost(MTG_NB_COLORS)){
|
||||
diff[MTG_NB_COLORS * 2 + 1] = 0;
|
||||
for (int i=0; i < MTG_NB_COLORS; i++){
|
||||
if (_cost->getCost(Constants::MTG_NB_COLORS)){
|
||||
diff[Constants::MTG_NB_COLORS * 2 + 1] = 0;
|
||||
for (int i=0; i < Constants::MTG_NB_COLORS; i++){
|
||||
if (diff[i*2 + 1] > 0){
|
||||
diff[MTG_NB_COLORS * 2 + 1] += diff[i*2 + 1];
|
||||
diff[Constants::MTG_NB_COLORS * 2 + 1] += diff[i*2 + 1];
|
||||
diff[i*2 + 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ManaCost * result = NEW ManaCost(diff, MTG_NB_COLORS +1);
|
||||
ManaCost * result = NEW ManaCost(diff, Constants::MTG_NB_COLORS +1);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* Creates a new phase ring with the default rules */
|
||||
PhaseRing::PhaseRing(Player* players[], int nbPlayers){
|
||||
for (int i = 0; i < nbPlayers; i++){
|
||||
for (int j = 0; j <NB_MTG_PHASES; j++){
|
||||
for (int j = 0; j < Constants::NB_MTG_PHASES; j++){
|
||||
Phase * phase = NEW Phase(j,players[i]);
|
||||
addPhase(phase);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void GuiAvatar::Render(){
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
int life = player->life;
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(0.75);
|
||||
|
||||
//Avatar
|
||||
@@ -111,7 +111,7 @@ void GuiGameZone::Render(){
|
||||
JRenderer::GetInstance()->FillRect(x,y,quad->mWidth*scale,quad->mHeight*scale,ARGB(abs(wave-128), 255,255,255));
|
||||
}
|
||||
//Number of cards
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
char buffer[512];
|
||||
sprintf(buffer,"%i", zone->nb_cards);
|
||||
mFont->SetScale(0.75);
|
||||
|
||||
@@ -52,19 +52,19 @@ int PriceList::getPrice(int cardId){
|
||||
}
|
||||
char rarity = collection->getCardById(cardId)->getRarity();
|
||||
switch(rarity){
|
||||
case RARITY_M:
|
||||
case Constants::RARITY_M:
|
||||
return 3000;
|
||||
break;
|
||||
case RARITY_R:
|
||||
case Constants::RARITY_R:
|
||||
return 500;
|
||||
break;
|
||||
case RARITY_U:
|
||||
case Constants::RARITY_U:
|
||||
return 100;
|
||||
break;
|
||||
case RARITY_C:
|
||||
case Constants::RARITY_C:
|
||||
return 20;
|
||||
break;
|
||||
case RARITY_L:
|
||||
case Constants::RARITY_L:
|
||||
return 5;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -34,7 +34,7 @@ ShopItem::ShopItem(int id, JLBFont *font, int _cardid, int x, int y, bool hasFoc
|
||||
|
||||
card = collection->getCardById(_cardid);
|
||||
quantity = 1;
|
||||
if (card->getRarity() == RARITY_L) quantity = 50;
|
||||
if (card->getRarity() == Constants::RARITY_L) quantity = 50;
|
||||
quad = NULL;
|
||||
thumb = NULL;
|
||||
}
|
||||
@@ -229,14 +229,14 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
|
||||
int curNbcards = playerdata->collection->totalCards();
|
||||
if (showPriceDialog == 0){
|
||||
//Starter Deck
|
||||
playerdata->collection->addRandomCards(3,setId,RARITY_R,NULL);
|
||||
playerdata->collection->addRandomCards(9, setId,RARITY_U,NULL);
|
||||
playerdata->collection->addRandomCards(48, setId,RARITY_C,NULL);
|
||||
playerdata->collection->addRandomCards(3,setId,Constants::RARITY_R,NULL);
|
||||
playerdata->collection->addRandomCards(9, setId,Constants::RARITY_U,NULL);
|
||||
playerdata->collection->addRandomCards(48, setId,Constants::RARITY_C,NULL);
|
||||
}else{
|
||||
//Booster
|
||||
playerdata->collection->addRandomCards(1, setId,RARITY_R);
|
||||
playerdata->collection->addRandomCards(3, setId,RARITY_U);
|
||||
playerdata->collection->addRandomCards(11, setId,RARITY_C);
|
||||
playerdata->collection->addRandomCards(1, setId,Constants::RARITY_R);
|
||||
playerdata->collection->addRandomCards(3, setId,Constants::RARITY_U);
|
||||
playerdata->collection->addRandomCards(11, setId,Constants::RARITY_C);
|
||||
}
|
||||
int newNbCards = playerdata->collection->totalCards();;
|
||||
for (int i = curNbcards; i < newNbCards ; i++){
|
||||
|
||||
@@ -152,8 +152,8 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
}else{
|
||||
int attributefound = 0;
|
||||
//Colors
|
||||
for (int cid = 0; cid < MTG_NB_COLORS; cid++){
|
||||
if (attribute.find(MTGColorStrings[cid]) != string::npos){
|
||||
for (int cid = 0; cid < Constants::MTG_NB_COLORS; cid++){
|
||||
if (attribute.find(Constants::MTGColorStrings[cid]) != string::npos){
|
||||
attributefound = 1;
|
||||
if (minus){
|
||||
cd->colors[cid] = -1;
|
||||
@@ -167,8 +167,8 @@ OutputDebugString("COLOR FOUND !!!");
|
||||
}
|
||||
if (!attributefound){
|
||||
//Abilities
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
if (attribute.find(MTGBasicAbilities[j]) != string::npos){
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
if (attribute.find(Constants::MTGBasicAbilities[j]) != string::npos){
|
||||
attributefound = 1;
|
||||
if (minus){
|
||||
cd->basicAbilities[j] = -1;
|
||||
@@ -254,12 +254,12 @@ TargetChooser * TargetChooserFactory::createTargetChooser(MTGCardInstance * card
|
||||
//Red Spell or Permanent
|
||||
case 1191: //Blue Elemental Blast
|
||||
{
|
||||
return NEW SpellOrPermanentTargetChooser(card,MTG_COLOR_RED);
|
||||
return NEW SpellOrPermanentTargetChooser(card,Constants::MTG_COLOR_RED);
|
||||
}
|
||||
//Blue Spell or Permanent
|
||||
case 1312: //Red Elemental Blast
|
||||
{
|
||||
return NEW SpellOrPermanentTargetChooser(card,MTG_COLOR_BLUE);
|
||||
return NEW SpellOrPermanentTargetChooser(card,Constants::MTG_COLOR_BLUE);
|
||||
}
|
||||
//Damage History
|
||||
case 1344: //Eye for an Eye
|
||||
@@ -285,7 +285,7 @@ TargetChooser::TargetChooser(MTGCardInstance * card, int _maxtargets): TargetsLi
|
||||
int TargetChooser::canTarget(Targetable * target){
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||
if (source && (card->protectedAgainst(source) || card->has(SHROUD))) return 0;
|
||||
if (source && (card->protectedAgainst(source) || card->has(Constants::SHROUD))) return 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user