diff --git a/JGE/include/JTypes.h b/JGE/include/JTypes.h index 0a7a23766..42936da5c 100644 --- a/JGE/include/JTypes.h +++ b/JGE/include/JTypes.h @@ -165,7 +165,7 @@ typedef uint32_t u32; #if defined (ABGR8888) #ifndef ARGB -#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format +#define ARGB(a, r, g, b) ((u32)((a << 24) | (b << 16) | (g << 8) | r)) // macro to assemble pixels in correct format #endif #define MAKE_COLOR(a, c) (a << 24 | c) #define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels diff --git a/projects/mtg/include/AIPlayerBaka.h b/projects/mtg/include/AIPlayerBaka.h index 501d3dbe0..30bc56ba3 100644 --- a/projects/mtg/include/AIPlayerBaka.h +++ b/projects/mtg/include/AIPlayerBaka.h @@ -45,6 +45,8 @@ public: // Functions depending on the type of Ability int getEfficiency(AADamager * aad); + int getRevealedEfficiency(MTGAbility * ability); + }; // compares Abilities efficiency diff --git a/projects/mtg/include/GameOptions.h b/projects/mtg/include/GameOptions.h index e0b9e215a..df873da68 100644 --- a/projects/mtg/include/GameOptions.h +++ b/projects/mtg/include/GameOptions.h @@ -45,6 +45,7 @@ public: OPTIMIZE_HAND, CHEATMODEAIDECK, OSD, + BLKBORDER, CLOSEDHAND, HANDDIRECTION, MANADISPLAY, diff --git a/projects/mtg/src/AIPlayerBaka.cpp b/projects/mtg/src/AIPlayerBaka.cpp index e3bc5160d..20566c6ae 100644 --- a/projects/mtg/src/AIPlayerBaka.cpp +++ b/projects/mtg/src/AIPlayerBaka.cpp @@ -620,7 +620,15 @@ int OrderedAIAction::getEfficiency() else if (GenericRevealAbility * grA = dynamic_cast(a)) { if(grA->source->getAICustomCode().size() && grA->source->alias != 185709)//Sphinx of Jwar Isle so the ai will ignore it - efficiency = 45 + (owner->getRandomGenerator()->random() % 50); + { + //efficiency = 45 + (owner->getRandomGenerator()->random() % 50); + + AbilityFactory af(g); + MTGAbility * parsedAICC = af.parseMagicLine(cReplaceString(grA->source->getAICustomCode(),"activate",""),0,NULL,grA->source); + efficiency = getRevealedEfficiency(parsedAICC); + SAFE_DELETE(parsedAICC); + + } else efficiency = 0; } @@ -668,6 +676,605 @@ int OrderedAIAction::getEfficiency() return efficiency; } +int OrderedAIAction::getRevealedEfficiency(MTGAbility * ability2) +{ + int eff2 = 0; + if (!ability2) + return 0; + GameObserver * g = owner->getObserver(); + ActionStack * s = g->mLayers->stackLayer(); + int currentPhase = g->getCurrentGamePhase(); + + Player * p = g->currentlyActing(); + if (s->has(ability2)) + return 0; + MTGAbility * a = AbilityFactory::getCoreAbility(ability2); + MTGAbility * transAbility = NULL; + if(ATransformerInstant * atia = dynamic_cast(a)) + { + if(atia->newAbilityFound) + { + AbilityFactory af(g); + transAbility = af.parseMagicLine(atia->newAbilitiesList[atia->newAbilitiesList.size()-1], 0, NULL, atia->source); + transAbility->target = ability2->target; + a = transAbility; + } + } + if (!a) + { + DebugTrace("FATAL: Ability is NULL in AIAction::getEfficiency()"); + return 0; + } + + if (!((AIPlayerBaka *)owner)->canHandleCost(ability2)) + { + SAFE_DELETE(transAbility); + return 0; + } + MTGCardInstance * coreAbilityCardTarget = dynamic_cast(a->target); + + //CoreAbility shouldn't return a Lord, but it does. + //When we don't have a target for a lord action, we assume it's the lord itself + if (!target && dynamic_cast (a)) + { + target = a->source; + } + + AACastCard * CC = dynamic_cast (a); + if (CC) + return 99; + + switch (a->aType) + { + case MTGAbility::DAMAGER: + { + eff2 = getEfficiency ((AADamager *) a); + break; + } + case MTGAbility::STANDARD_REGENERATE: + { + eff2 = 0; + if (!coreAbilityCardTarget) + break; + + if (!coreAbilityCardTarget->regenerateTokens && currentPhase == MTG_PHASE_COMBATBLOCKERS + && (coreAbilityCardTarget->defenser || coreAbilityCardTarget->blockers.size()) + ) + { + eff2 = 95; + } + //TODO If the card is the target of a damage spell + break; + } + case MTGAbility::STANDARD_PREVENT: + { + eff2 = 0;//starts out low to avoid spamming it when its not needed. + + if (!target) + break; + + if (currentPhase == MTG_PHASE_COMBATBLOCKERS) + { + bool NeedPreventing = false; + MTGCardInstance * nextOpponent = target->getNextOpponent(); + if(!nextOpponent) + break; + if ((target->defenser || target->blockers.size()) && target->preventable < nextOpponent->power) + NeedPreventing = true; + if (p == target->controller() && target->controller()->isAI() && NeedPreventing && !(nextOpponent->has(Constants::DEATHTOUCH) + ||nextOpponent->has(Constants::WITHER))) + { + eff2 = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved".. + if (target->toughness == 1 && nextOpponent->power == 1) + eff2 += 15; + //small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence. + //note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste. + //if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result. + if((target->defenser || target->blockers.size()) && target->controller() == p) + { + int damages = nextOpponent->power; + int calculateAfterDamage = target->toughness - damages; + if((calculateAfterDamage + target->preventable) > 0) + { + eff2 = 0; + //this is to avoid wasting prevents on creatures that will already survive. + //this should take into account bushido and flanking as this check is run after every trigger. + } + } + } + } + //TODO If the card is the target of a damage spell + break; + } + case MTGAbility::STANDARD_EQUIP: + { + + eff2 = 0; + if (!target) + break; + + unsigned int equips = p->game->battlefield->countByType("Equipment"); + unsigned int myArmy = p->game->battlefield->countByType("Creature"); + // when can this ever be negative? + int equalized = myArmy ? equips / myArmy : 0; + + if (p == target->controller() && target->equipment <= 1 && !a->source->target) + { + eff2 = 20 * (target->DangerRanking()); + if (target->hasColor(Constants::MTG_COLOR_WHITE)) + eff2 += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking. + if (target->power == 1 && target->toughness == 1 && target->isToken == 0) + eff2 += 10; //small bonus to encourage equipping nontoken 1/1 creatures. + } + + if (p == target->controller() && !a->source->target && target->equipment < equalized) + { + eff2 = 15 * (target->DangerRanking()); + eff2 -= 5 * (target->equipment); + } + + if ( eff2 < 20 && eff2 > 0 ) + eff2 += target->controller()->getObserver()->getRandomGenerator()->random() % 30; + break; + } + case MTGAbility::STANDARD_LEVELUP: + { + eff2 = 0; + Counter * targetCounter = NULL; + int currentlevel = 0; + + if (!coreAbilityCardTarget) + break; + + if (coreAbilityCardTarget->counters && coreAbilityCardTarget->counters->hasCounter("level", 0, 0)) + { + targetCounter = coreAbilityCardTarget->counters->hasCounter("level", 0, 0); + currentlevel = targetCounter->nb; + } + if (currentlevel < coreAbilityCardTarget->MaxLevelUp) + { + eff2 = 85; + //increase the efficeincy of leveling up by a small amount equal to current level. + eff2 += currentlevel; + + if (p->game->hand->nb_cards > 0 && p->isAI()) + { + eff2 -= (10 * p->game->hand->nb_cards);//reduce the eff if by 10 times the amount of cards in Ais hand. + //it should always try playing more cards before deciding + } + + if (g->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN) + { + eff2 = 100; + //in 2nd main, go all out and try to max stuff. + } + } + + break; + } + case MTGAbility::COUNTERS: + { + MTGCardInstance * _target = target ? target : coreAbilityCardTarget; + eff2 = 0; + + if (!_target) + break; + + if(AACounter * cc = dynamic_cast (a)) + { + if(_target->controller() == p && cc->toughness>=0) + { + eff2 = 90; + + } + if(_target->controller() != p && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0))) + { + eff2 = 90; + + } + if(_target->counters && _target->counters->hasCounter(cc->power,cc->toughness) && _target->counters->hasCounter(cc->power,cc->toughness)->nb > 15) + { + eff2 = _target->counters->hasCounter(cc->power,cc->toughness)->nb; + } + if(cc->maxNb && _target->counters && _target->counters->hasCounter(cc->power,cc->toughness)->nb >= cc->maxNb) + eff2 = 0; + if(a->target == a->source && a->getCost() && a->getCost()->hasX()) + eff2 -= 10 * int(p->game->hand->cards.size()); + } + break; + } + case MTGAbility::STANDARD_PUMP: + { + eff2 = 0; + if(!coreAbilityCardTarget) + break; + if(!target && !dynamic_cast (a) && (((MTGCardInstance *)a->source)->hasSubtype(Subtypes::TYPE_AURA) || ((MTGCardInstance *)a->source)->hasSubtype(Subtypes::TYPE_EQUIPMENT))) + { + if(a->source->target) + coreAbilityCardTarget = a->source->target; //TODO use intermediate value? + target = a->source; + } + if (!target && !dynamic_cast (a)) + break; + if(dynamic_cast (a) && !target) + { + target = a->source; + } + + AbilityFactory af(g); + int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); + //i do not set a starting eff. on this ability, this allows Ai to sometimes randomly do it as it normally does. + int currentPhase = g->getCurrentGamePhase(); + if ((currentPhase == MTG_PHASE_COMBATBLOCKERS) || (currentPhase == MTG_PHASE_COMBATATTACKERS)) + { + if (suggestion == BAKA_EFFECT_GOOD && target->controller() == p) + { + if(coreAbilityCardTarget->defenser || coreAbilityCardTarget->blockers.size()) + { + MTGCardInstance * opponent = coreAbilityCardTarget->getNextOpponent(); + if (!opponent) + break; + + if (coreAbilityCardTarget->power < opponent->toughness ||( coreAbilityCardTarget->toughness < opponent->power) || (coreAbilityCardTarget->has(Constants::TRAMPLE))) + { + //this pump is based on a start eff. of 20 multiplied by how good the creature is. + eff2 = 20 * coreAbilityCardTarget->DangerRanking(); + } + } + if (coreAbilityCardTarget->isAttacker() && !coreAbilityCardTarget->blockers.size()) + { + //this means im heading directly for the player, pump this creature as much as possible. + eff2 = 100; + if(coreAbilityCardTarget->power > 50) + eff2 -= coreAbilityCardTarget->power;//we don't need to go overboard. better to not put all your eggs in a single basket. + } + } + } + if (suggestion == BAKA_EFFECT_BAD && target->controller() != p && target->toughness > 0) + { + eff2 = 100; + } + break; + } + case MTGAbility::STANDARD_BECOMES: + { + if(!coreAbilityCardTarget) + break; + + //nothing huge here, just ensuring that Ai makes his noncreature becomers into creatures during first main, so it can actually use them in combat. + if (coreAbilityCardTarget && !coreAbilityCardTarget->isCreature() && currentPhase == MTG_PHASE_FIRSTMAIN) + { + eff2 = 100; + } + break; + } + case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use. + { + AManaProducer * manamaker = dynamic_cast(a); + GenericActivatedAbility * GAA = dynamic_cast(ability2); + AForeach * forMana = dynamic_cast(GAA->ability); + if (manamaker && forMana) + { + int outPut = forMana->checkActivation(); + if (ability2->getCost() && outPut > int(ability2->getCost()->getConvertedCost() +1) && currentPhase == MTG_PHASE_FIRSTMAIN && ability2->source->controller()->game->hand->nb_cards > 1) + eff2 = 90;//might be a bit random, but better than never using them. + } + else + eff2 = 0; + break; + } + case MTGAbility::STANDARDABILITYGRANT: + { + eff2 = 0; + + if (!target) + break; + + //ensuring that Ai grants abilities to creatures during first main, so it can actually use them in combat. + //quick note: the eff is multiplied by creatures ranking then divided by the number of cards in hand. + //the reason i do this is to encourage more casting and less waste of mana on abilities. + AbilityFactory af(g); + int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); + + int eff2Modifier = (25 * target->DangerRanking()); + if (p->game->hand->nb_cards > 1) + { + eff2Modifier -= p->game->hand->nb_cards*3; + } + if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && !target->has(a->abilitygranted)) + { + eff2 += eff2Modifier; + } + + if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == MTG_PHASE_COMBATBEGIN + && p == target->controller() + ) + { + eff2 += eff2Modifier; + } + + if (suggestion == BAKA_EFFECT_GOOD && target->has(a->abilitygranted)) + { + //trying to avoid Ai giving ie:flying creatures ie:flying twice. + eff2 = 0; + } + + if ((suggestion == BAKA_EFFECT_BAD && p == target->controller()) + || (suggestion == BAKA_EFFECT_GOOD && p != target->controller()) + ) + { + eff2 = 0; + //stop giving trample to the players creatures. + } + break; + } + + case MTGAbility::UNTAPPER: + //untap things that Ai owns and are tapped. + { + eff2 = 0; + if (!target) + break; + + if (target->isTapped() && target->controller() == p) + { + eff2 = target->isCreature()? (20 * target->DangerRanking()) : 100; + } + break; + } + + case MTGAbility::TAPPER: + //tap things the player owns and that are untapped. + { + if (!target) + break; + + if (target->controller() != p) + eff2 = (20 * target->DangerRanking()); + + if (target->isTapped()) + eff2 = 0; + + break; + } + + case MTGAbility::LIFER: + { + //use life abilities whenever possible. + AALifer * alife = (AALifer *) a; + Targetable * _t = alife->getTarget(); + + eff2 = 100; + AbilityFactory af(g); + int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY); + + if(MTGCardInstance * cTarget = dynamic_cast(_t)) + { + if((suggestion == BAKA_EFFECT_BAD && (cTarget)->controller() == p) || (suggestion == BAKA_EFFECT_GOOD && (cTarget)->controller() != p)) + eff2 = 0; + } + else if ((suggestion == BAKA_EFFECT_BAD && _t == p) || (suggestion == BAKA_EFFECT_GOOD && _t != p)) + { + eff2 = 0; + } + + break; + } + case MTGAbility::STANDARD_DRAW: + { + AADrawer * drawer = (AADrawer *)a; + //adding this case since i played a few games where Ai litterally decided to mill himself to death. fastest and easiest win ever. + //this should help a little, tho ultimately it will be decided later what the best course of action is. + //eff of drawing ability is calculated by base 20 + the amount of cards in library minus the amount of cards in hand times 7. + //drawing is never going to return a hundred eff because later eff is multiplied by 1.3 if no cards in hand. + eff2 = int(20 + p->game->library->nb_cards) - int(p->game->hand->nb_cards * 7); + if (p->game->hand->nb_cards > 8)//reduce by 50 if cards in hand are over 8, high chance ai cant play them. + { + eff2 -= 70; + } + if ((drawer->getNumCards() >= p->game->library->nb_cards && (Targetable*)p == drawer->getTarget()) || (p->game->hand->nb_cards > 10 && (Targetable*)p == drawer->getTarget())) + { + //if the amount im drawing will mill me to death or i have more than 10 cards in hand, eff is 0; + eff2 = 0; + } + break; + } + case MTGAbility::CLONING: + { + eff2 = 0; + if(!target) + eff2 = 100;//a clone ability with no target is an "clone all(" + else if (p == target->controller()) + { + eff2 = 20 * target->DangerRanking(); + } + break; + } + case MTGAbility::STANDARD_FIZZLER: + { + eff2 = 0; + + if(!target) + break; + + Interruptible * action = g->mLayers->stackLayer()->getAt(-1); + if (!action) + break; + + Spell * spell = dynamic_cast(action); + if (!spell) + break; + + Player * lastStackActionController = spell->source->controller(); + if(p != target->controller() && lastStackActionController != p) + eff2 = 60;//we want ai to fizzle at higher than "unknown" ability %. + + break; + } + default: + if (target) + { + AbilityFactory af(g); + int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY,NULL,target); + if (AADynamic * ady = dynamic_cast(a)) + { + if(ady) + { + //not going into massive detail with this ability, its far to complex, just going to give it a general idea. + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_COUNTERSONEONE) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_DEPLETE) + suggestion = BAKA_EFFECT_BAD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_DRAW) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_LIFEGAIN) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_LIFELOSS) + suggestion = BAKA_EFFECT_BAD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_PUMPBOTH) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_PUMPTOUGHNESS) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_PUMPPOWER) + suggestion = BAKA_EFFECT_GOOD; + if(ady->effect == ady->DYNAMIC_ABILITY_EFFECT_STRIKE) + suggestion = BAKA_EFFECT_BAD; + } + } + if ((suggestion == BAKA_EFFECT_BAD && p == target->controller()) + || (suggestion == BAKA_EFFECT_GOOD && p != target->controller())) + { + eff2 = 0; + } + else + { + //without a base to start with Wrand % 5 almost always returns 0. + eff2 = 10 + (owner->getRandomGenerator()->random() % 20); //Small percentage of chance for unknown abilities + } + } + else + { + eff2 = 10 + (owner->getRandomGenerator()->random() % 30); + } + break; + } + if(AUpkeep * auk = dynamic_cast(ability2)) + { + //hello, Ai pay your upcost please :P, this entices Ai into paying upcost, the conditional isAi() is required strangely ai is able to pay upcost during YOUR upkeep. + if (auk && g->getCurrentGamePhase() == MTG_PHASE_UPKEEP && g->currentPlayer == p && p == a->source->controller()) + { + eff2 = 100; + } + } + else if (AAMover * aam = dynamic_cast(a)) + { + MTGGameZone * z = aam->destinationZone(target); + if (target) + { + if (target->currentZone == p->game->library|| target->currentZone == p->opponent()->game->inPlay||target->currentZone == p->game->hand) + { + if (z == p->game->hand || z == p->game->inPlay || z == target->controller()->game->hand) + eff2 = 100; + } + else if( target->currentZone == p->game->inPlay && (MTGCardInstance*)target == a->source) + { + if (z == p->game->hand) + eff2 = 10 + (owner->getRandomGenerator()->random() % 10);//random chance to bounce their own card; + } + else + { + eff2 = 10 + (owner->getRandomGenerator()->random() % 5); + } + } + else + { + eff2 = 50; + //may abilities target the source until thier nested ability is activated, so 50% chance to use this + //mover, until we can come up with something more elegent.... + } + } + else if (dynamic_cast(a)) + { + if (playerAbilityTarget && playerAbilityTarget != p) + { + eff2 = 60;//ai determines if the counters are good or bad on menu check. + } + else + eff2 = 90; + } + else if (dynamic_cast(a)) + { + if (playerAbilityTarget && playerAbilityTarget != p) + { + eff2 = 90; + } + } + else if (dynamic_cast(a)) + { + if (playerAbilityTarget && playerAbilityTarget == p) + { + eff2 = 90; + } + } + else if (ATokenCreator * atc = dynamic_cast(a)) + { + eff2 = 80; + if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name)) + { + for (list::const_iterator it = atc->types.begin(); it != atc->types.end(); ++it) + { + if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P + eff2 = 0; + } + } + if(p->game->battlefield->countByType("token") >= 25) + eff2 = 0; + + } + //At this point the "basic" eff2 is computed, we further tweak it depending on general decisions, independent of theAbility type + + MayAbility * may = dynamic_cast(ability2); + if (!eff2 && may) + { + AIPlayer * chk = (AIPlayer*)p; + if(may->ability && may->ability->getActionTc() && chk->chooseTarget(may->ability->getActionTc(),NULL,NULL,true)) + eff2 = 50 + (owner->getRandomGenerator()->random() % 50); + } + if (p->game->hand->nb_cards == 0) + eff2 = (int) ((float) eff2 * 1.3); //increase chance of using ability if hand is empty + ManaCost * cost = ability2->getCost(); + if (cost) + { + ExtraCosts * ec = cost->extraCosts; + if (ec) + { + for(unsigned int i = 0; i < ec->costs.size();i++) + { + ExtraCost * tapper = dynamic_cast(ec->costs[i]); + if(tapper) + continue; + else + eff2 = eff2 / 2; + } + //Decrease chance of using ability if there is an extra cost to use the ability, ignore tap + } + } + if (dynamic_cast(a)) + { + eff2 += 65; + } + else if (dynamic_cast(a)) + { + eff2 += 55; + } + else if (dynamic_cast(a)) + { + eff2 += 55; + } + SAFE_DELETE(transAbility); + return eff2; +} + int AIPlayerBaka::getEfficiency(OrderedAIAction * action) { return action->getEfficiency(); diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 827769701..5799c089a 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -567,12 +567,12 @@ int PutInGraveyard::resolve() MTGGameZone * zone = card->getCurrentZone(); if (card->basicAbilities[(int)Constants::EXILEDEATH]) { - card->owner->game->putInZone(card, zone, card->owner->game->exile); + card->controller()->game->putInZone(card, zone, card->owner->game->exile); return 1; } if (zone == observer->players[0]->game->inPlay || zone == observer->players[1]->game->inPlay) { - card->owner->game->putInZone(card, zone, card->owner->game->graveyard); + card->controller()->game->putInZone(card, zone, card->owner->game->graveyard); return 1; } return 0; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 270840733..72edd24f1 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -8153,7 +8153,7 @@ int AACastCard::resolveSpell() if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER))) copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent); else - copy =_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->stack,noEvent); + copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent); copy->changeController(source->controller(),true); if(asNormalMadness) copy->MadnessPlay = true; @@ -8163,7 +8163,7 @@ int AACastCard::resolveSpell() if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER))) copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent); else - copy =_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->stack,noEvent); + copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent); copy->changeController(source->controller(),true); } if (game->targetChooser) diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 1348d4afb..fc92feb0a 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1240,7 +1240,8 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder } }*///disabled this for universal border across game, deck editor, etc... //universal border - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") + if((cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") + && !options[Options::BLKBORDER].number) {//white border renderer->FillRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(255,248,248,255)); renderer->DrawRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(150,20,20,20)); diff --git a/projects/mtg/src/GameOptions.cpp b/projects/mtg/src/GameOptions.cpp index c10bf2435..aa9d7219b 100644 --- a/projects/mtg/src/GameOptions.cpp +++ b/projects/mtg/src/GameOptions.cpp @@ -21,6 +21,7 @@ const string Options::optionNames[] = { "optimizedhand", "cheatmodedecks", "displayOSD", + "BlackBorder", "closed_hand", "hand_direction", "mana_display", diff --git a/projects/mtg/src/GameStateDeckViewer.cpp b/projects/mtg/src/GameStateDeckViewer.cpp index 5ad61b9a3..733ff97a3 100644 --- a/projects/mtg/src/GameStateDeckViewer.cpp +++ b/projects/mtg/src/GameStateDeckViewer.cpp @@ -827,12 +827,12 @@ void GameStateDeckViewer::renderOnScreenMenu() case 1: // Counts, price // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Statistics Summary").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); posY = 30; posX = 180; sprintf(buffer, _("Your Deck: %i cards").c_str(), mStatsWrapper->cardCount); - font->DrawString(buffer, 20 + leftTransition, posY); + font->DrawString(buffer, 20 + 20 + leftTransition, posY); posY += 10; // Counts by color @@ -842,8 +842,8 @@ void GameStateDeckViewer::renderOnScreenMenu() if (value > 0) { sprintf(buffer, "%i", value); - font->DrawString(buffer, 38 + nb_letters * 13 + leftTransition, posY + 5); - r->RenderQuad(mIcons[j].get(), 30 + nb_letters * 13 + leftTransition, posY + 11, 0, 0.5, 0.5); + font->DrawString(buffer, 38 + nb_letters * 13 + 20 + leftTransition, posY + 5); + r->RenderQuad(mIcons[j].get(), 30 + nb_letters * 13 + 20 + leftTransition, posY + 11, 0, 0.5, 0.5); if (value > 9) { nb_letters += 3; @@ -856,132 +856,132 @@ void GameStateDeckViewer::renderOnScreenMenu() } posY += 25; - r->DrawLine(posX - 4 + leftTransition, posY - 1, posX - 4 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); - r->DrawLine(19 + leftTransition, posY - 1, 19 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); - r->DrawLine(posX + 40 + leftTransition, posY - 1, posX + 40 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); + r->DrawLine(posX - 4 + 20 + leftTransition, posY - 1, posX - 4 + 20 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); + r->DrawLine(19 + 20 + leftTransition, posY - 1, 19 + 20 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); + r->DrawLine(posX + 40 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY + 177, ARGB(128, 255, 255, 255)); - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Lands"), 20 + leftTransition, posY); + font->DrawString(_("Lands"), 20 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countLands); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 14; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Creatures"), 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + font->DrawString(_("Creatures"), 20 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countCreatures); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 14; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Spells"), 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + font->DrawString(_("Spells"), 20 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countSpells); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("Instants"), 30 + leftTransition, posY); + font->DrawString(_("Instants"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countInstants); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("Enchantments"), 30 + leftTransition, posY); + font->DrawString(_("Enchantments"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countEnchantments); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("Sorceries"), 30 + leftTransition, posY); + font->DrawString(_("Sorceries"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->countSorceries); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); //sprintf(buffer, "Artifacts: %i", stw->countArtifacts); //mFont->DrawString(buffer, 20, 123); posY += 14; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Average converted mana cost"), 20 + leftTransition, posY); + font->DrawString(_("Average converted mana cost"), 20 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f").c_str(), mStatsWrapper->avgManaCost); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 14; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Probabilities"), 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + font->DrawString(_("Probabilities"), 20 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("No land in 1st hand"), 30 + leftTransition, posY); + font->DrawString(_("No land in 1st hand"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f%%").c_str(), mStatsWrapper->noLandsProbInTurn[0]); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("No land in 9 cards"), 30 + leftTransition, posY); + font->DrawString(_("No land in 9 cards"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f%%").c_str(), mStatsWrapper->noLandsProbInTurn[2]); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("No creatures in 1st hand"), 30 + leftTransition, posY); + font->DrawString(_("No creatures in 1st hand"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f%%").c_str(), mStatsWrapper->noCreaturesProbInTurn[0]); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); // Playgame Statistics posY += 14; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Playgame statistics"), 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + font->DrawString(_("Playgame statistics"), 20 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("Games played"), 30 + leftTransition, posY); + font->DrawString(_("Games played"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%i").c_str(), mStatsWrapper->gamesPlayed); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("Victory ratio"), 30 + leftTransition, posY); + font->DrawString(_("Victory ratio"), 30 + 20 + leftTransition, posY); sprintf(buffer, _("%i%%").c_str(), mStatsWrapper->percentVictories); - font->DrawString(buffer, posX + leftTransition, posY); + font->DrawString(buffer, posX + 20 + leftTransition, posY); posY += 15; - r->DrawLine(20 + leftTransition, posY - 1, posX + 40 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - font->DrawString(_("Total price (credits)"), 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY - 1, posX + 40 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); + font->DrawString(_("Total price (credits)"), 20 + 20 + leftTransition, posY); sprintf(buffer, _("%i ").c_str(), mStatsWrapper->totalPrice); - font->DrawString(buffer, posX + leftTransition, posY); - r->DrawLine(20 + leftTransition, posY + 13, posX + 40 + leftTransition, posY + 13, ARGB(128, 255, 255, 255)); + font->DrawString(buffer, posX + 20 + leftTransition, posY); + r->DrawLine(20 + 20 + leftTransition, posY + 13, posX + 40 + 20 + leftTransition, posY + 13, ARGB(128, 255, 255, 255)); break; case 5: // Land statistics sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana production").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); - font->DrawString(_("Counts of manasources per type and color:"), 20 + leftTransition, 30); + font->DrawString(_("Counts of manasources per type and color:"), 20 + 20 + leftTransition, 30); posY = 70; // Column titles for (int j = 0; j < Constants::NB_Colors - 1; j++) { - r->RenderQuad(mIcons[j].get(), 52 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5); + r->RenderQuad(mIcons[j].get(), 52 + j * 15 + 20 + leftTransition, posY - 10, 0, 0.5, 0.5); } //font->DrawString(_("C"), 30 + leftTransition, posY-16); //font->DrawString(_("Ty"), 27 + leftTransition, posY-16); // Horizontal table lines - r->DrawLine(27 + leftTransition, posY - 20, 60 + (Constants::NB_Colors - 2) * 15 + leftTransition, posY - 20, + r->DrawLine(27 + 20 + leftTransition, posY - 20, 60 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, posY - 20, ARGB(128, 255, 255, 255)); - r->DrawLine(27 + leftTransition, posY - 1, 60 + (Constants::NB_Colors - 2) * 15 + leftTransition, posY - 1, + r->DrawLine(27 + 20 + leftTransition, posY - 1, 60 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - r->DrawLine(27 + leftTransition, 2 * 10 + posY + 12, 60 + (Constants::NB_Colors - 2) * 15 + leftTransition, 2 * 10 + r->DrawLine(27 + 20 + leftTransition, 2 * 10 + posY + 12, 60 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, 2 * 10 + posY + 12, ARGB(128, 255, 255, 255)); - r->DrawLine(27 + leftTransition, 3 * 10 + posY + 14, 60 + (Constants::NB_Colors - 2) * 15 + leftTransition, 3 * 10 + r->DrawLine(27 + 20 + leftTransition, 3 * 10 + posY + 14, 60 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); // Vertical table lines - r->DrawLine(26 + leftTransition, posY - 20, 26 + leftTransition, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); - r->DrawLine(43 + leftTransition, posY - 20, 43 + leftTransition, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); - r->DrawLine(60 + leftTransition + (Constants::NB_Colors - 2) * 15, posY - 20, 60 + leftTransition + r->DrawLine(26 + 20 + leftTransition, posY - 20, 26 + 20 + leftTransition, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); + r->DrawLine(43 + 20 + leftTransition, posY - 20, 43 + 20 + leftTransition, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); + r->DrawLine(60 + 20 + leftTransition + (Constants::NB_Colors - 2) * 15, posY - 20, 60 + 20 + leftTransition + (Constants::NB_Colors - 2) * 15, 3 * 10 + posY + 14, ARGB(128, 255, 255, 255)); - font->DrawString(_("BL"), 27 + leftTransition, posY); - font->DrawString(_("NB"), 27 + leftTransition, posY + 10); - font->DrawString(_("O"), 30 + leftTransition, posY + 20); - font->DrawString(_("T"), 30 + leftTransition, posY + 33); + font->DrawString(_("BL"), 27 + 20 + leftTransition, posY); + font->DrawString(_("NB"), 27 + 20 + leftTransition, posY + 10); + font->DrawString(_("O"), 30 + 20 + leftTransition, posY + 20); + font->DrawString(_("T"), 30 + 20 + leftTransition, posY + 33); int curCount; @@ -993,7 +993,7 @@ void GameStateDeckViewer::renderOnScreenMenu() } else { sprintf(buffer, "%i", curCount); } - font->DrawString(buffer, 49 + leftTransition + j * 15, posY); + font->DrawString(buffer, 49 + 20 + leftTransition + j * 15, posY); curCount = mStatsWrapper->countLandsPerColor[j]; if(curCount == 0) { @@ -1001,7 +1001,7 @@ void GameStateDeckViewer::renderOnScreenMenu() } else { sprintf(buffer, "%i", curCount); } - font->DrawString(buffer, 49 + leftTransition + j * 15, posY + 10); + font->DrawString(buffer, 49 + 20 + leftTransition + j * 15, posY + 10); curCount = mStatsWrapper->countNonLandProducersPerColor[j]; if(curCount == 0) { @@ -1009,7 +1009,7 @@ void GameStateDeckViewer::renderOnScreenMenu() } else { sprintf(buffer, "%i", curCount); } - font->DrawString(buffer, 49 + leftTransition + j * 15, posY + 20); + font->DrawString(buffer, 49 + 20 + leftTransition + j * 15, posY + 20); curCount = mStatsWrapper->countLandsPerColor[j] + mStatsWrapper->countBasicLandsPerColor[j] + mStatsWrapper->countNonLandProducersPerColor[j]; if(curCount == 0) { @@ -1017,24 +1017,24 @@ void GameStateDeckViewer::renderOnScreenMenu() } else { sprintf(buffer, "%i", curCount); } - font->DrawString(buffer, 49 + leftTransition + j * 15, posY + 33); + font->DrawString(buffer, 49 + 20 + leftTransition + j * 15, posY + 33); } posY += 55; - font->DrawString(_("BL - Basic lands"), 20 + leftTransition, posY); + font->DrawString(_("BL - Basic lands"), 20 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("NB - Non-basic lands"), 20 + leftTransition, posY); + font->DrawString(_("NB - Non-basic lands"), 20 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("O - Other (non-land) manasources"), 26 + leftTransition, posY); + font->DrawString(_("O - Other (non-land) manasources"), 26 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("T - Totals"), 26 + leftTransition, posY); + font->DrawString(_("T - Totals"), 26 + 20 + leftTransition, posY); break; case 6: // Land statistics - in symbols sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana production - in mana symbols").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); - font->DrawString(_("Total colored manasymbols in lands' production:"), 20 + leftTransition, 30); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); + font->DrawString(_("Total colored mana symbols in lands' production:"), 20 + 20 + leftTransition, 30); int totalProducedSymbols; totalProducedSymbols = 0; @@ -1052,11 +1052,11 @@ void GameStateDeckViewer::renderOnScreenMenu() font->DrawString(buffer, 20 + leftTransition, posY); sprintf(buffer, _("(%i%%)").c_str(), (int) (100 * (float) (mStatsWrapper->countLandsPerColor[i] + mStatsWrapper->countBasicLandsPerColor[i]) / totalProducedSymbols)); - font->DrawString(buffer, 33 + leftTransition, posY); + font->DrawString(buffer, 33 + 20 + leftTransition, posY); posX = 72; for (int j = 0; j < mStatsWrapper->countLandsPerColor[i] + mStatsWrapper->countBasicLandsPerColor[i]; j++) { - r->RenderQuad(mIcons[i].get(), posX + leftTransition, posY + 6, 0, 0.5, 0.5); + r->RenderQuad(mIcons[i].get(), posX + 20 + leftTransition, posY + 6, 0, 0.5, 0.5); posX += ((j + 1) % 10 == 0) ? 17 : 13; if ((((j + 1) % 30) == 0) && (j < mStatsWrapper->countLandsPerColor[i] + mStatsWrapper->countBasicLandsPerColor[i] - 1)) { @@ -1082,8 +1082,8 @@ void GameStateDeckViewer::renderOnScreenMenu() case 2: // Total counts // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana cost detail").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); - font->DrawString(_("Card counts per mana cost:"), 20 + leftTransition, 30); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); + font->DrawString(_("Card counts per mana cost:"), 20 + 20 + leftTransition, 30); avgCost = mStatsWrapper->avgManaCost; countPerCost = &mStatsWrapper->countCardsPerCost; countPerCostAndColor = &mStatsWrapper->countCardsPerCostAndColor; @@ -1091,8 +1091,8 @@ void GameStateDeckViewer::renderOnScreenMenu() case 3: // Creature counts // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana cost detail - Creatures").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); - font->DrawString(_("Creature counts per mana cost:"), 20 + leftTransition, 30); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); + font->DrawString(_("Creature counts per mana cost:"), 20 + 20 + leftTransition, 30); avgCost = mStatsWrapper->avgCreatureCost; countPerCost = &mStatsWrapper->countCreaturesPerCost; countPerCostAndColor = &mStatsWrapper->countCreaturesPerCostAndColor; @@ -1100,8 +1100,8 @@ void GameStateDeckViewer::renderOnScreenMenu() case 4: // Spell counts // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana cost detail - Spells").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); - font->DrawString(_("Non-creature spell counts per mana cost:"), 20 + leftTransition, 30); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); + font->DrawString(_("Non-creature spell counts per mana cost:"), 20 + 20 + leftTransition, 30); avgCost = mStatsWrapper->avgSpellCost; countPerCost = &mStatsWrapper->countSpellsPerCost; countPerCostAndColor = &mStatsWrapper->countSpellsPerCostAndColor; @@ -1118,94 +1118,94 @@ void GameStateDeckViewer::renderOnScreenMenu() // Column titles for (int j = 0; j < Constants::NB_Colors - 1; j++) { - r->RenderQuad(mIcons[j].get(), 67 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5); + r->RenderQuad(mIcons[j].get(), 67 + j * 15 + 20 + leftTransition, posY - 10, 0, 0.5, 0.5); } - font->DrawString(_("C"), 30 + leftTransition, posY - 16); - font->DrawString(_("#"), 45 + leftTransition, posY - 16); + font->DrawString(_("C"), 30 + 20 + leftTransition, posY - 16); + font->DrawString(_("#"), 45 + 20 + leftTransition, posY - 16); // Horizontal table lines - r->DrawLine(27 + leftTransition, posY - 20, 75 + (Constants::NB_Colors - 2) * 15 + leftTransition, posY - 20, + r->DrawLine(27 + 20 + leftTransition, posY - 20, 75 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, posY - 20, ARGB(128, 255, 255, 255)); - r->DrawLine(27 + leftTransition, posY - 1, 75 + (Constants::NB_Colors - 2) * 15 + leftTransition, posY - 1, + r->DrawLine(27 + 20 + leftTransition, posY - 1, 75 + (Constants::NB_Colors - 2) * 15 + 20 + leftTransition, posY - 1, ARGB(128, 255, 255, 255)); - r->DrawLine(27 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, 75 + (Constants::NB_Colors - 2) - * 15 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); + r->DrawLine(27 + 20 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, 75 + (Constants::NB_Colors - 2) + * 15 + 20 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); // Vertical table lines - r->DrawLine(26 + leftTransition, posY - 20, 26 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, + r->DrawLine(26 + 20 + leftTransition, posY - 20, 26 + 20 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); - r->DrawLine(41 + leftTransition, posY - 20, 41 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, + r->DrawLine(41 + 20 + leftTransition, posY - 20, 41 + 20 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); - r->DrawLine(58 + leftTransition, posY - 20, 58 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, + r->DrawLine(58 + 20 + leftTransition, posY - 20, 58 + 20 + leftTransition, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); - r->DrawLine(75 + leftTransition + (Constants::NB_Colors - 2) * 15, posY - 20, 75 + leftTransition + r->DrawLine(75 + 20 + leftTransition + (Constants::NB_Colors - 2) * 15, posY - 20, 75 + 20 + leftTransition + (Constants::NB_Colors - 2) * 15, Constants::STATS_MAX_MANA_COST * 10 + posY + 12, ARGB(128, 255, 255, 255)); for (int i = 0; i <= Constants::STATS_MAX_MANA_COST; i++) { sprintf(buffer, _("%i").c_str(), i); - font->DrawString(buffer, 30 + leftTransition, posY); + font->DrawString(buffer, 30 + 20 + leftTransition, posY); sprintf(buffer, ((*countPerCost)[i] > 0) ? _("%i").c_str() : ".", (*countPerCost)[i]); - font->DrawString(buffer, 45 + leftTransition, posY); + font->DrawString(buffer, 45 + 20 + leftTransition, posY); for (int j = 0; j < Constants::NB_Colors - 1; j++) { sprintf(buffer, ((*countPerCostAndColor)[i][j] > 0) ? _("%i").c_str() : ".", (*countPerCostAndColor)[i][j]); - font->DrawString(buffer, 64 + leftTransition + j * 15, posY); + font->DrawString(buffer, 64 + 20 + leftTransition + j * 15, posY); } - r->FillRect(77.f + leftTransition + (Constants::NB_Colors - 2) * 15.0f, posY + 2.0f, (*countPerCost)[i] * 5.0f, + r->FillRect(77.f + 20 + leftTransition + (Constants::NB_Colors - 2) * 15.0f, posY + 2.0f, (*countPerCost)[i] * 5.0f, 8.0f, graphColor); posY += 10; } posY += 10; sprintf(buffer, _("Average converted mana cost: %2.2f").c_str(), avgCost); - font->DrawString(buffer, 20 + leftTransition, posY); + font->DrawString(buffer, 20 + 20 + leftTransition, posY); posY += 15; sprintf(buffer, _("C - Converted mana cost. Cards with cost>%i are included in the last row.").c_str(), Constants::STATS_MAX_MANA_COST); - font->DrawString(buffer, 20 + leftTransition, posY); + font->DrawString(buffer, 20 + 20 + leftTransition, posY); posY += 10; - font->DrawString(_("# - Total number of cards with given cost"), 20 + leftTransition, posY); + font->DrawString(_("# - Total number of cards with given cost"), 20 + 20 + leftTransition, posY); break; case 8: // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Probabilities").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); // No lands detail float graphScale, graphWidth; graphWidth = 100; graphScale = (mStatsWrapper->noLandsProbInTurn[0] == 0) ? 0 : (graphWidth / mStatsWrapper->noLandsProbInTurn[0]); - font->DrawString(_("No lands in first n cards:"), 20 + leftTransition, 30); + font->DrawString(_("No lands in first n cards:"), 20 + 20 + leftTransition, 30); posY = 50; for (int i = 0; i < Constants::STATS_FOR_TURNS; i++) { sprintf(buffer, _("%i:").c_str(), i + 7); - font->DrawString(buffer, 30 + leftTransition, posY); + font->DrawString(buffer, 30 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f%%").c_str(), mStatsWrapper->noLandsProbInTurn[i]); - font->DrawString(buffer, 45 + leftTransition, posY); - r->FillRect(84 + leftTransition, posY + 2, graphScale * mStatsWrapper->noLandsProbInTurn[i], 8, graphColor); + font->DrawString(buffer, 45 + 20 + leftTransition, posY); + r->FillRect(84 + 20 + leftTransition, posY + 2, graphScale * mStatsWrapper->noLandsProbInTurn[i], 8, graphColor); posY += 10; } // No creatures probability detail posY += 10; - font->DrawString(_("No creatures in first n cards:"), 20 + leftTransition, posY); + font->DrawString(_("No creatures in first n cards:"), 20 + 20 + leftTransition, posY); posY += 20; graphScale = (mStatsWrapper->noCreaturesProbInTurn[0] == 0) ? 0 : (graphWidth / mStatsWrapper->noCreaturesProbInTurn[0]); for (int i = 0; i < Constants::STATS_FOR_TURNS; i++) { sprintf(buffer, _("%i:").c_str(), i + 7); - font->DrawString(buffer, 30 + leftTransition, posY); + font->DrawString(buffer, 30 + 20 + leftTransition, posY); sprintf(buffer, _("%2.2f%%").c_str(), mStatsWrapper->noCreaturesProbInTurn[i]); - font->DrawString(buffer, 45 + leftTransition, posY); - r->FillRect(84 + leftTransition, posY + 2, graphScale * mStatsWrapper->noCreaturesProbInTurn[i], 8, graphColor); + font->DrawString(buffer, 45 + 20 + leftTransition, posY); + r->FillRect(84 + 20 + leftTransition, posY + 2, graphScale * mStatsWrapper->noCreaturesProbInTurn[i], 8, graphColor); posY += 10; } @@ -1214,9 +1214,9 @@ void GameStateDeckViewer::renderOnScreenMenu() case 7: // Total mana cost per color // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Mana cost per color").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); - font->DrawString(_("Total colored manasymbols in cards' casting costs:"), 20 + leftTransition, 30); + font->DrawString(_("Total colored manasymbols in cards' casting costs:"), 20 + 20 + leftTransition, 30); posY = 50; for (int i = 1; i < Constants::NB_Colors - 1; i++) @@ -1230,7 +1230,7 @@ void GameStateDeckViewer::renderOnScreenMenu() posX = 72; for (int j = 0; j < mStatsWrapper->totalCostPerColor[i]; j++) { - r->RenderQuad(mIcons[i].get(), posX + leftTransition, posY + 6, 0, 0.5, 0.5); + r->RenderQuad(mIcons[i].get(), posX + 20 + leftTransition, posY + 6, 0, 0.5, 0.5); posX += ((j + 1) % 10 == 0) ? 17 : 13; if ((((j + 1) % 30) == 0) && (j < mStatsWrapper->totalCostPerColor[i] - 1)) { @@ -1246,14 +1246,14 @@ void GameStateDeckViewer::renderOnScreenMenu() case 9: // Victory statistics // Title sprintf(buffer, STATS_TITLE_FORMAT.c_str(), mStatsWrapper->currentPage, _("Victory statistics").c_str()); - font->DrawString(buffer, 10 + leftTransition, 10); + font->DrawString(buffer, 10 + 20 + leftTransition, 10); - font->DrawString(_("Victories against AI:"), 20 + leftTransition, 30); + font->DrawString(_("Victories against AI:"), 20 + 20 + leftTransition, 30); sprintf(buffer, _("Games played: %i").c_str(), mStatsWrapper->gamesPlayed); - font->DrawString(buffer, 20 + leftTransition, 45); + font->DrawString(buffer, 20 + 20 + leftTransition, 45); sprintf(buffer, _("Victory ratio: %i%%").c_str(), mStatsWrapper->percentVictories); - font->DrawString(buffer, 20 + leftTransition, 55); + font->DrawString(buffer, 20 + 20 + leftTransition, 55); int AIsPerColumn = 19; posY = 70; diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 6a8ab3937..4a7d2d401 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -56,6 +56,7 @@ void GameStateOptions::Start() optionsList = NEW WGuiList("Game"); optionsList->Add(NEW WGuiHeader("Interface Options")); + optionsList->Add(NEW OptionInteger(Options::BLKBORDER, "All Black Border")); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND, "Closed hand", 1, 1, 0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::HANDDIRECTION, "Hand direction", 1, 1, 0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MANADISPLAY, "Mana display", 3, 1, 0))); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 12f38ac78..46f0767f5 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -5250,11 +5250,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell) if (card->hasType(Subtypes::TYPE_INSTANT) || card->hasType(Subtypes::TYPE_SORCERY)) { - MTGPlayerCards * zones = card->owner->game; + MTGPlayerCards * zones = card->controller()->game; MTGPlayerCards * Endzones = card->owner->game;//put them in thier owners respective zones as per rules. if (card->basicAbilities[(int)Constants::EXILEDEATH]) { - card->owner->game->putInZone(card, card->getCurrentZone(), card->owner->game->exile); + card->controller()->game->putInZone(card, card->getCurrentZone(), card->owner->game->exile); } else if (card->alternateCostPaid[ManaCost::MANA_PAID_WITH_BUYBACK] > 0)