Erwan
- removed some unused code. Please review! - Added protection from() auto keyword. It is still possible to use protection from [color] in abilities, but when it is not possible, please use protection from([target]) in auto=
This commit is contained in:
@@ -50,20 +50,6 @@ int ActionLayer::reactToTargetClick(ActionElement* ability, Targetable * card){
|
||||
return result;
|
||||
}
|
||||
|
||||
int ActionLayer::unstoppableRenderInProgress(){
|
||||
|
||||
for (int i=0;i<mCount;i++){
|
||||
if (mObjects[i]!=NULL){
|
||||
ActionElement * currentAction = (ActionElement *)mObjects[i];
|
||||
if (currentAction->getActivity() > 0){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool ActionLayer::CheckUserInput(u32 key){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
if (g->waitForExtraPayment && key == PSP_CTRL_CROSS){
|
||||
|
||||
@@ -190,13 +190,6 @@ ostream& CardDisplay::toString(ostream& out) const
|
||||
return (out << "CardDisplay ::: x,y : " << x << "," << y << " ; start_item : " << start_item << " ; nb_displayed_items " << nb_displayed_items << " ; tc : " << tc << " ; listener : " << listener);
|
||||
}
|
||||
|
||||
DefaultTargetDisplay::DefaultTargetDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener, int nb_displayed_items ):CardDisplay(id, game, x, y, listener, NULL, nb_displayed_items ){
|
||||
tc = NEW TargetChooser();
|
||||
}
|
||||
|
||||
DefaultTargetDisplay::~DefaultTargetDisplay(){
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const CardDisplay& m)
|
||||
{
|
||||
|
||||
@@ -90,13 +90,6 @@ DuelLayers::~DuelLayers(){
|
||||
Trash::cleanup();
|
||||
}
|
||||
|
||||
int DuelLayers::unstoppableRenderInProgress(){
|
||||
for (int i = 0; i < nbitems; ++i)
|
||||
if (objects[i]->unstoppableRenderInProgress())
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DuelLayers::Add(GuiLayer * layer){
|
||||
objects.push_back(layer);
|
||||
nbitems++;
|
||||
|
||||
@@ -52,10 +52,6 @@ GameObserver::GameObserver(Player * _players[], int _nb_players){
|
||||
combatStep = BLOCKERS;
|
||||
}
|
||||
|
||||
void GameObserver::setGamePhaseManager(MTGGamePhase * _phases){
|
||||
gamePhaseManager = _phases;
|
||||
}
|
||||
|
||||
int GameObserver::getCurrentGamePhase(){
|
||||
return currentGamePhase;
|
||||
}
|
||||
@@ -467,12 +463,6 @@ int GameObserver::receiveEvent(WEvent * e){
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool GameObserver::isCreature(MTGCardInstance * card){
|
||||
return card->isCreature();
|
||||
}
|
||||
|
||||
|
||||
Player * GameObserver::currentlyActing(){
|
||||
if (isInterrupting) return isInterrupting;
|
||||
return currentActionPlayer;
|
||||
|
||||
@@ -998,8 +998,7 @@ void GameStateDeckViewer::updateStats() {
|
||||
return;
|
||||
}
|
||||
|
||||
AbilityFactory * af;
|
||||
af = NEW AbilityFactory();
|
||||
AbilityFactory * af = NEW AbilityFactory();
|
||||
|
||||
stw.needUpdate = false;
|
||||
|
||||
@@ -1180,7 +1179,7 @@ void GameStateDeckViewer::renderCard(int id, float rotation){
|
||||
MTGCard * card = cardIndex[id];
|
||||
|
||||
|
||||
float max_scale = 0.96;
|
||||
float max_scale = 0.96f;
|
||||
float x_center_0 = 180;
|
||||
float right_border = SCREEN_WIDTH - 20 ;
|
||||
|
||||
|
||||
@@ -59,36 +59,6 @@ void GuiLayer::resetObjects(){
|
||||
mCurr = 0;
|
||||
}
|
||||
|
||||
void GuiLayer::RenderMessageBackground(float x0, float y0, float width, int height){
|
||||
PIXEL_TYPE colors_up[] =
|
||||
{
|
||||
ARGB(0,255,255,255),
|
||||
ARGB(0,255,255,255),
|
||||
ARGB(128,255,255,255),
|
||||
ARGB(128,255,255,255)
|
||||
};
|
||||
|
||||
PIXEL_TYPE colors_down[] =
|
||||
{
|
||||
ARGB(128,255,255,255),
|
||||
ARGB(128,255,255,255),
|
||||
ARGB(0,255,255,255),
|
||||
ARGB(0,255,255,255)
|
||||
};
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
renderer->FillRect(x0,y0,width,height/2,colors_up);
|
||||
renderer->FillRect(x0,y0+height/2,width,height/2,colors_down);
|
||||
|
||||
// mEngine->DrawLine(0,y0,SCREEN_WIDTH,y0,ARGB(128,255,255,255));
|
||||
// mEngine->DrawLine(0,y0+height,SCREEN_WIDTH,y0+height,ARGB(128,255,255,255));
|
||||
}
|
||||
|
||||
void GuiLayer::RenderMessageBackground(float y0, int height){
|
||||
RenderMessageBackground(0,y0,SCREEN_WIDTH, height);
|
||||
|
||||
}
|
||||
|
||||
int GuiLayer::getIndexOf(JGuiObject * object){
|
||||
for (int i=0; i<mCount; i++){
|
||||
if (mObjects[i] == object)
|
||||
|
||||
@@ -36,22 +36,6 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option){
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int AbilityFactory::CantBlock(TargetChooser * tc){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
MTGCardInstance * source = tc->source;
|
||||
for (int j = g->opponent()->game->inPlay->nb_cards-1; j >=0 ; j--){
|
||||
MTGCardInstance * current = g->opponent()->game->inPlay->cards[j];
|
||||
if (tc->canTarget(current)){
|
||||
current->canBlock(source);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int AbilityFactory::parsePowerToughness(string s, int *power, int *toughness){
|
||||
size_t found = s.find("/");
|
||||
if (found != string::npos){
|
||||
@@ -587,18 +571,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
//CannotBeBlockedBy
|
||||
found = s.find("cantbeblockedby(");
|
||||
if (found != string::npos){
|
||||
int end = s.find(")",found);
|
||||
string starget = s.substr(16, end - 16);
|
||||
TargetChooserFactory tcf;
|
||||
tc = tcf.createTargetChooser(starget,card);
|
||||
return NULL; //NEW ACantBlock(tc); //hu ? CantBlock(tc);
|
||||
}
|
||||
|
||||
*/
|
||||
//Discard
|
||||
found = s.find("discard:");
|
||||
if (found != string::npos){
|
||||
@@ -707,6 +679,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Mana Producer
|
||||
found = s.find("add");
|
||||
if (found != string::npos){
|
||||
@@ -735,6 +709,24 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
}
|
||||
}
|
||||
|
||||
//Protection from...
|
||||
found = s.find("protection from(");
|
||||
if (found == 0){
|
||||
size_t end = s.find (")", found);
|
||||
string targets = s.substr(found+16,end - found - 16);
|
||||
TargetChooserFactory tcf;
|
||||
TargetChooser * fromTc = tcf.createTargetChooser(targets, card);
|
||||
if (!fromTc) return NULL;
|
||||
fromTc->setAllZones();
|
||||
if (!activated){
|
||||
if(card->hasType("instant") || card->hasType("sorcery") || forceUEOT){
|
||||
return NULL; //TODO
|
||||
}
|
||||
return NEW AProtectionFrom(id, card,target,fromTc);
|
||||
}
|
||||
return NULL; //TODO
|
||||
}
|
||||
|
||||
//Untapper (Ley Druid...)
|
||||
found = s.find("untap");
|
||||
if (found != string::npos){
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
const char * const MTGCard::Colors_To_Text[] = {"Artifact", "Green", "Blue", "Red", "Black", "White", "Land"};
|
||||
|
||||
MTGCard::MTGCard(){
|
||||
init();
|
||||
}
|
||||
@@ -177,16 +174,6 @@ void MTGCard::setManaCost(string s){
|
||||
|
||||
}
|
||||
|
||||
|
||||
const char * MTGCard::colorToString(){
|
||||
int color = getColor();
|
||||
if (color>=0 && color <=5){
|
||||
return Colors_To_Text[color];
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
void MTGCard::setMTGId(int id){
|
||||
mtgid = id;
|
||||
if (id < 0){
|
||||
|
||||
@@ -94,7 +94,6 @@ void MTGCardInstance::initMTGCI(){
|
||||
untapping = 0;
|
||||
summoningSickness = 1;
|
||||
target = NULL;
|
||||
nbprotections = 0;
|
||||
type_as_damageable = DAMAGEABLE_MTGCARDINSTANCE;
|
||||
banding = NULL;
|
||||
owner = NULL;
|
||||
@@ -231,10 +230,6 @@ int MTGCardInstance::isTapped(){
|
||||
return tapped;
|
||||
}
|
||||
|
||||
void MTGCardInstance::resetAllDamage(){
|
||||
nb_damages = 0;
|
||||
}
|
||||
|
||||
int MTGCardInstance::regenerate(){
|
||||
return ++regenerateTokens;
|
||||
}
|
||||
@@ -301,16 +296,6 @@ MTGCardInstance * MTGCardInstance::changeController(Player * newController){
|
||||
return copy;
|
||||
}
|
||||
|
||||
//Reset the card parameters
|
||||
int MTGCardInstance::reset(){
|
||||
cleanup();
|
||||
untap();
|
||||
SAFE_DELETE(counters);
|
||||
counters = NEW Counters(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Player * MTGCardInstance::controller(){
|
||||
return lastController;
|
||||
}
|
||||
@@ -398,32 +383,6 @@ MTGCardInstance * MTGCardInstance::getNextPartner(){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MTGCardInstance::unband(){
|
||||
if (!banding) return;
|
||||
|
||||
MTGCardInstance * _banding = banding;
|
||||
banding = NULL;
|
||||
MTGCardInstance * newbanding = NULL;
|
||||
MTGInPlay * inplay = controller()->game->inPlay;
|
||||
int nbpartners = inplay->nbPartners(this);
|
||||
MTGCardInstance * card = inplay->getNextAttacker(NULL);
|
||||
while(card){
|
||||
if (card != this){
|
||||
if (card->banding == _banding){
|
||||
if (nbpartners == 1){
|
||||
card->banding = NULL;
|
||||
return;
|
||||
}else{
|
||||
if (!newbanding) newbanding = card;
|
||||
card->banding = newbanding;
|
||||
}
|
||||
}
|
||||
}
|
||||
card = inplay->getNextAttacker(card);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
int MTGCardInstance::setAttacker(int value){
|
||||
Targetable * previousTarget = NULL;
|
||||
Targetable * target = NULL;
|
||||
@@ -477,18 +436,6 @@ int MTGCardInstance::nbOpponents(){
|
||||
return result;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGCardInstance::getNextDefenser(MTGCardInstance * previous){
|
||||
int found_previous = 0;
|
||||
if (!previous) found_previous = 1;
|
||||
list<MTGCardInstance *>::iterator it;
|
||||
for (it= blockers.begin(); it != blockers.end(); ++it){
|
||||
MTGCardInstance * c = *it;
|
||||
if (found_previous && c->isInPlay()) return c;
|
||||
if (c == previous) found_previous = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int MTGCardInstance::raiseBlockerRankOrder(MTGCardInstance * blocker){
|
||||
list<MTGCardInstance *>::iterator it1 = find(blockers.begin(), blockers.end(), blocker);
|
||||
list<MTGCardInstance *>::iterator it2 = it1;
|
||||
@@ -501,19 +448,6 @@ int MTGCardInstance::raiseBlockerRankOrder(MTGCardInstance * blocker){
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MTGCardInstance::bringBlockerToFrontOfOrder(MTGCardInstance * blocker){
|
||||
list<MTGCardInstance *>::iterator it1 = find(blockers.begin(), blockers.end(), blocker);
|
||||
list<MTGCardInstance *>::iterator it2 = blockers.begin();
|
||||
if (it2 != it1)
|
||||
{
|
||||
std::iter_swap(it1,it2);
|
||||
WEvent* e = NEW WEventCreatureBlockerRank(blocker,*it2,this);
|
||||
GameObserver::GetInstance()->receiveEvent(e);
|
||||
//delete(e);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MTGCardInstance::getDefenserRank(MTGCardInstance * blocker){
|
||||
int result = 0;
|
||||
for(list<MTGCardInstance *>::iterator it1 = blockers.begin(); it1 != blockers.end(); ++it1){
|
||||
@@ -598,19 +532,17 @@ int MTGCardInstance::toggleDefenser(MTGCardInstance * opponent){
|
||||
}
|
||||
|
||||
|
||||
int MTGCardInstance::addProtection(CardDescriptor * cd){
|
||||
protections[nbprotections] = cd;
|
||||
nbprotections++;
|
||||
return nbprotections;
|
||||
int MTGCardInstance::addProtection(TargetChooser * tc){
|
||||
tc->targetter = NULL;
|
||||
protections.push_back(tc);
|
||||
return protections.size();
|
||||
}
|
||||
|
||||
int MTGCardInstance::removeProtection(CardDescriptor * cd, int erase){
|
||||
for (int i = 0; i < nbprotections ; i++){
|
||||
if (protections[i] == cd){
|
||||
int MTGCardInstance::removeProtection(TargetChooser * tc, int erase){
|
||||
for (size_t i = 0; i < protections.size() ; i++){
|
||||
if (protections[i] == tc){
|
||||
if (erase) delete (protections[i]);
|
||||
protections[i] = protections[nbprotections -1];
|
||||
protections[nbprotections -1] = NULL;
|
||||
nbprotections--;
|
||||
protections.erase(protections.begin()+i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -624,8 +556,9 @@ int MTGCardInstance::protectedAgainst(MTGCardInstance * card){
|
||||
}
|
||||
|
||||
//General protections
|
||||
for (int i = 0; i < nbprotections ; i++){
|
||||
if (protections[i]->match(card)) return 1;
|
||||
for (size_t i = 0; i < protections.size() ; i++){
|
||||
if (protections[i]->canTarget(card))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -306,31 +306,6 @@ void MTGGameZone::debugPrint(){
|
||||
|
||||
|
||||
//------------------------------
|
||||
int MTGInPlay::nbDefensers( MTGCardInstance * attacker){
|
||||
int result = 0;
|
||||
MTGCardInstance * defenser = getNextDefenser(NULL, attacker);
|
||||
while (defenser){
|
||||
result++;
|
||||
defenser = getNextDefenser(defenser, attacker);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//Return the number of creatures this card is banded with
|
||||
//Number of creatures in the band is n+1 !!!
|
||||
int MTGInPlay::nbPartners(MTGCardInstance * attacker){
|
||||
int result = 0;
|
||||
if (!attacker->banding) return 0;
|
||||
for (int i = 0; i < nb_cards; i ++){
|
||||
if (cards[i]->banding == attacker->banding) result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGInPlay::getNextDefenser(MTGCardInstance * previous, MTGCardInstance * attacker){
|
||||
return attacker->getNextDefenser(previous);
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGInPlay::getNextAttacker(MTGCardInstance * previous){
|
||||
int foundprevious = 0;
|
||||
if (previous == NULL){
|
||||
|
||||
@@ -187,13 +187,6 @@ ManaCostHybrid * ManaCost::getHybridCost(unsigned int i){
|
||||
return hybrids[i];
|
||||
}
|
||||
|
||||
int ManaCost::getMainColor(){
|
||||
for (int i=0; i< Constants::MTG_NB_COLORS; i++){
|
||||
if (cost[i]) return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ManaCost::hasColor(int color){
|
||||
if (cost[color]) return 1;
|
||||
for (unsigned int i = 0; i < nbhybrids; i++){
|
||||
@@ -267,11 +260,6 @@ int ManaCost::isExtraPaymentSet(){
|
||||
return extraCosts->isPaymentSet();
|
||||
}
|
||||
|
||||
int ManaCost::resetExtraPayment(){
|
||||
if (!extraCosts) return 1;
|
||||
return extraCosts->reset();
|
||||
}
|
||||
|
||||
int ManaCost::doPayExtra(){
|
||||
if (!extraCosts) return 0;
|
||||
return extraCosts->doPay(); //TODO reset ?
|
||||
|
||||
@@ -707,39 +707,6 @@ void WGuiList::Reload()
|
||||
listItems[i]->Reload();
|
||||
}
|
||||
}
|
||||
//OptionString
|
||||
|
||||
void OptionString::Render(){
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
if(!bShowValue){
|
||||
mFont->DrawString(_(displayValue).c_str(),x+(width/2),y,JGETEXT_CENTER);
|
||||
}
|
||||
else{
|
||||
mFont->DrawString(_(displayValue).c_str(),x,y);
|
||||
int w = mFont->GetStringWidth(value.c_str()-10);
|
||||
mFont->DrawString(_(value).c_str(),width - w,y,JGETEXT_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionString::setData(){
|
||||
if(id != INVALID_OPTION)
|
||||
options[id] = GameOption(value);
|
||||
}
|
||||
void OptionString::updateValue(){
|
||||
options.keypadStart(value,&value);
|
||||
options.keypadTitle(displayValue);
|
||||
}
|
||||
|
||||
OptionString::OptionString(int _id, string _displayValue): OptionItem(_id, _displayValue)
|
||||
{
|
||||
bShowValue=true;
|
||||
if(id != INVALID_OPTION)
|
||||
value=options[_id].str;
|
||||
}
|
||||
|
||||
OptionTheme::OptionTheme(): OptionDirectory(RESPATH"/themes",Options::ACTIVE_THEME, "Current Theme"){
|
||||
addSelection("Default");
|
||||
@@ -987,52 +954,6 @@ void WDecoConfirm::ButtonPressed(int controllerId, int controlId){
|
||||
it->ButtonPressed(controllerId,controlId);
|
||||
}
|
||||
|
||||
//WDecoImage
|
||||
WGuiImage::WGuiImage(string _file, int _w, int _h, int _margin): WGuiItem("") {
|
||||
imgW = 0;
|
||||
imgH = 0;
|
||||
margin = _margin;
|
||||
filename = _file;
|
||||
exact = false;
|
||||
}
|
||||
|
||||
void WGuiImage::imageScale(float w, float h){
|
||||
imgH = h;
|
||||
imgW = w;
|
||||
}
|
||||
|
||||
float WGuiImage::getHeight(){
|
||||
|
||||
if(imgH == 0 ){
|
||||
JQuad * q = getImage();
|
||||
if(q)
|
||||
return MAX(height,q->mHeight+(2*margin));
|
||||
}
|
||||
|
||||
return MAX(height,imgH+(2*margin));
|
||||
}
|
||||
|
||||
JQuad * WGuiImage::getImage(){
|
||||
if(exact)
|
||||
return resources.RetrieveQuad(filename,0,0,0,0,"temporary",RETRIEVE_NORMAL,TEXTURE_SUB_EXACT);
|
||||
else
|
||||
return resources.RetrieveTempQuad(filename);
|
||||
}
|
||||
|
||||
void WGuiImage::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * q = getImage();
|
||||
if(q){
|
||||
float xS = 1, yS = 1;
|
||||
if(imgH != 0 && q->mHeight != 0)
|
||||
yS = imgH / q->mHeight;
|
||||
if(imgW != 0 && q->mWidth != 0)
|
||||
xS = imgW / q->mWidth;
|
||||
|
||||
renderer->RenderQuad(q,x+margin, y+margin,0,xS,yS);
|
||||
}
|
||||
}
|
||||
|
||||
WGuiButton::WGuiButton( WGuiBase* _it, int _controller, int _control, JGuiListener * jgl): WGuiDeco(_it) {
|
||||
control = _control;
|
||||
controller = _controller;
|
||||
|
||||
@@ -296,22 +296,14 @@ bool TargetChooser::canTarget(Targetable * target){
|
||||
|
||||
|
||||
int TargetChooser::addTarget(Targetable * target){
|
||||
if (canTarget(target) && TargetsList::addTarget(target)){
|
||||
if (canTarget(target)){
|
||||
TargetsList::addTarget(target);
|
||||
}
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "TARGETCHOOSER Nb targets : %i\n", cursor);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
return targetsReadyCheck();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TargetChooser::ForceTargetListReady(){
|
||||
int state = targetsReadyCheck() ;
|
||||
if (state == TARGET_OK){
|
||||
@@ -510,6 +502,27 @@ int TargetZoneChooser::init(int * _zones, int _nbzones){
|
||||
return nbzones;
|
||||
}
|
||||
|
||||
int TargetZoneChooser::setAllZones(){
|
||||
int zones[] = {
|
||||
MTGGameZone::MY_BATTLEFIELD,
|
||||
MTGGameZone::MY_EXILE,
|
||||
MTGGameZone::MY_GRAVEYARD,
|
||||
MTGGameZone::MY_HAND,
|
||||
MTGGameZone::MY_LIBRARY,
|
||||
MTGGameZone::MY_STACK,
|
||||
MTGGameZone::OPPONENT_BATTLEFIELD,
|
||||
MTGGameZone::OPPONENT_EXILE,
|
||||
MTGGameZone::OPPONENT_GRAVEYARD,
|
||||
MTGGameZone::OPPONENT_HAND,
|
||||
MTGGameZone::OPPONENT_LIBRARY,
|
||||
MTGGameZone::OPPONENT_STACK
|
||||
};
|
||||
|
||||
init(zones,12);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool TargetZoneChooser::canTarget(Targetable * target){
|
||||
if (!TargetChooser::canTarget(target)) return false;
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
@@ -619,27 +632,3 @@ bool DamageTargetChooser::canTarget(Targetable * target){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*Damage or Permanent */
|
||||
DamageOrPermanentTargetChooser::DamageOrPermanentTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, bool other):TargetZoneChooser(card, _maxtargets, other){
|
||||
int default_zones[] = {MTGGameZone::MY_BATTLEFIELD, MTGGameZone::OPPONENT_BATTLEFIELD};
|
||||
init(default_zones,2);
|
||||
color = _color;
|
||||
}
|
||||
|
||||
bool DamageOrPermanentTargetChooser::canTarget(Targetable * target){
|
||||
MTGCardInstance * card = NULL;
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
card = (MTGCardInstance *) target;
|
||||
if (color == -1 || card->hasColor(color)) return TargetZoneChooser::canTarget(target);
|
||||
}else if (target->typeAsTarget() == TARGET_STACKACTION){
|
||||
Interruptible * action = (Interruptible *) target;
|
||||
if (action->type == ACTION_DAMAGE){
|
||||
Damage * damage = (Damage *) action;
|
||||
card = damage->source;
|
||||
if (card && (color == -1 || card->hasColor(color))) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user