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:
@@ -112,6 +112,19 @@ auto=@next end:bury
|
|||||||
abilities=trample,haste
|
abilities=trample,haste
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
id=191065
|
||||||
|
name=Baneslayer Angel
|
||||||
|
mana={3}{W}{W}
|
||||||
|
type=Creature
|
||||||
|
subtype=Angel
|
||||||
|
power=5
|
||||||
|
toughness=5
|
||||||
|
text=Flying, first strike, lifelink, protection from Demons and from Dragons
|
||||||
|
abilities=flying,first strike,lifelink
|
||||||
|
auto=protection from(demon,dragon)
|
||||||
|
rarity=M
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
id=191071
|
id=191071
|
||||||
name=Berserkers of Blood Ridge
|
name=Berserkers of Blood Ridge
|
||||||
mana={4}{R}
|
mana={4}{R}
|
||||||
|
|||||||
@@ -30,17 +30,7 @@ toughness=1
|
|||||||
text=When Awakener Druid enters the battlefield, target Forest becomes a 4/5 green Treefolk creature for as long as Awakener Druid is on the battlefield. It's still a land.
|
text=When Awakener Druid enters the battlefield, target Forest becomes a 4/5 green Treefolk creature for as long as Awakener Druid is on the battlefield. It's still a land.
|
||||||
rarity=U
|
rarity=U
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
|
||||||
id=191065
|
|
||||||
name=Baneslayer Angel
|
|
||||||
mana={3}{W}{W}
|
|
||||||
type=Creature
|
|
||||||
subtype=Angel
|
|
||||||
power=5
|
|
||||||
toughness=5
|
|
||||||
text=Flying, first strike, lifelink, protection from Demons and from Dragons
|
|
||||||
rarity=M
|
|
||||||
[/card]
|
|
||||||
[card]
|
[card]
|
||||||
id=191340
|
id=191340
|
||||||
name=Bogardan Hellkite
|
name=Bogardan Hellkite
|
||||||
|
|||||||
@@ -9,3 +9,15 @@ toughness=4
|
|||||||
text=Flying
|
text=Flying
|
||||||
rarity=U
|
rarity=U
|
||||||
[/card]
|
[/card]
|
||||||
|
[card]
|
||||||
|
id=6605
|
||||||
|
name=Brimstone Dragon
|
||||||
|
mana={6}{R}{R}
|
||||||
|
type=Creature
|
||||||
|
subtype=Dragon
|
||||||
|
power=6
|
||||||
|
toughness=6
|
||||||
|
text=Flying, haste
|
||||||
|
abilities=flying,haste
|
||||||
|
rarity=R
|
||||||
|
[/card]
|
||||||
|
|||||||
@@ -244,17 +244,7 @@ type=Sorcery
|
|||||||
text=Return target creature card from your graveyard to the battlefield.
|
text=Return target creature card from your graveyard to the battlefield.
|
||||||
rarity=U
|
rarity=U
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
|
||||||
id=6605
|
|
||||||
name=Brimstone Dragon
|
|
||||||
mana={6}{R}{R}
|
|
||||||
type=Creature
|
|
||||||
subtype=Dragon
|
|
||||||
power=6
|
|
||||||
toughness=6
|
|
||||||
text=Flying, haste
|
|
||||||
rarity=R
|
|
||||||
[/card]
|
|
||||||
[card]
|
[card]
|
||||||
id=6566
|
id=6566
|
||||||
name=Brutal Nightstalker
|
name=Brutal Nightstalker
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ ascendant_evincar3.txt
|
|||||||
ashen_firebeast.txt
|
ashen_firebeast.txt
|
||||||
ashen_firebeast2.txt
|
ashen_firebeast2.txt
|
||||||
aura_mutation.txt
|
aura_mutation.txt
|
||||||
|
baneslayer_angel.txt
|
||||||
|
baneslayer_angel2.txt
|
||||||
barbed_sliver.txt
|
barbed_sliver.txt
|
||||||
basal_sliver.txt
|
basal_sliver.txt
|
||||||
beacon_of_unrest.txt
|
beacon_of_unrest.txt
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#Test: prtection from(
|
||||||
|
[INIT]
|
||||||
|
COMBATATTACKERS
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Brimstone Dragon
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:baneslayer angel
|
||||||
|
[DO]
|
||||||
|
Brimstone Dragon
|
||||||
|
next
|
||||||
|
#blockers
|
||||||
|
baneslayer angel
|
||||||
|
next
|
||||||
|
#damage 1st strike
|
||||||
|
next
|
||||||
|
#damage
|
||||||
|
next
|
||||||
|
#end combat
|
||||||
|
[ASSERT]
|
||||||
|
COMBATEND
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Brimstone Dragon
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:baneslayer angel
|
||||||
|
life:25
|
||||||
|
[END]
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#Test: prtection from(
|
||||||
|
[INIT]
|
||||||
|
COMBATATTACKERS
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Denizen of the deep
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:baneslayer angel
|
||||||
|
[DO]
|
||||||
|
Denizen of the deep
|
||||||
|
next
|
||||||
|
#blockers
|
||||||
|
baneslayer angel
|
||||||
|
next
|
||||||
|
#damage 1st strike
|
||||||
|
next
|
||||||
|
#damage
|
||||||
|
next
|
||||||
|
#end combat
|
||||||
|
[ASSERT]
|
||||||
|
COMBATEND
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Denizen of the deep
|
||||||
|
[PLAYER2]
|
||||||
|
graveyard:baneslayer angel
|
||||||
|
life:25
|
||||||
|
[END]
|
||||||
@@ -24,7 +24,6 @@ class ActionLayer: public GuiLayer, public JGuiListener{
|
|||||||
int stuffHappened;
|
int stuffHappened;
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
int unstoppableRenderInProgress();
|
|
||||||
bool CheckUserInput(u32 key);
|
bool CheckUserInput(u32 key);
|
||||||
ActionLayer();
|
ActionLayer();
|
||||||
~ActionLayer();
|
~ActionLayer();
|
||||||
|
|||||||
@@ -1034,6 +1034,38 @@ class AUnBlocker:public MTGAbility{
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Protection From (creature/aura)
|
||||||
|
class AProtectionFrom: public MTGAbility{
|
||||||
|
public:
|
||||||
|
TargetChooser * fromTc;
|
||||||
|
AProtectionFrom(int id, MTGCardInstance * _source, MTGCardInstance * _target, TargetChooser *fromTc):MTGAbility(id,_source,_target),fromTc(fromTc){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int addToGame(){
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||||
|
_target->addProtection(fromTc);
|
||||||
|
return MTGAbility::addToGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
int destroy(){
|
||||||
|
((MTGCardInstance *)target)->removeProtection(fromTc);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AProtectionFrom * clone() const{
|
||||||
|
AProtectionFrom * a = NEW AProtectionFrom(*this);
|
||||||
|
a->isClone = 1;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
~AProtectionFrom(){
|
||||||
|
SAFE_DELETE(fromTc);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//Alteration of Power and Toughness (enchantments)
|
//Alteration of Power and Toughness (enchantments)
|
||||||
class APowerToughnessModifier: public MTGAbility{
|
class APowerToughnessModifier: public MTGAbility{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -28,13 +28,6 @@ class CardDisplay:public PlayGuiObjectController{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultTargetDisplay:CardDisplay{
|
|
||||||
public:
|
|
||||||
DefaultTargetDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener, int nb_displayed_items );
|
|
||||||
~DefaultTargetDisplay();
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
|
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public:
|
|||||||
void Render();
|
void Render();
|
||||||
void Add(GuiLayer * layer);
|
void Add(GuiLayer * layer);
|
||||||
void Remove();
|
void Remove();
|
||||||
int unstoppableRenderInProgress();
|
|
||||||
int receiveEvent(WEvent * e);
|
int receiveEvent(WEvent * e);
|
||||||
float RightBoundary();
|
float RightBoundary();
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ class GameObserver{
|
|||||||
ReplacementEffects *replacementEffects;
|
ReplacementEffects *replacementEffects;
|
||||||
Player * gameOver;
|
Player * gameOver;
|
||||||
Player * players[2]; //created outside
|
Player * players[2]; //created outside
|
||||||
MTGGamePhase * gamePhaseManager; //Created Outside ?
|
|
||||||
|
|
||||||
TargetChooser * getCurrentTargetChooser();
|
TargetChooser * getCurrentTargetChooser();
|
||||||
void stackObjectClicked(Interruptible * action);
|
void stackObjectClicked(Interruptible * action);
|
||||||
@@ -67,7 +66,6 @@ class GameObserver{
|
|||||||
Player * currentlyActing();
|
Player * currentlyActing();
|
||||||
GameObserver(Player * _players[], int _nbplayers);
|
GameObserver(Player * _players[], int _nbplayers);
|
||||||
~GameObserver();
|
~GameObserver();
|
||||||
void setGamePhaseManager(MTGGamePhase * _phases);
|
|
||||||
void stateEffects();
|
void stateEffects();
|
||||||
void eventOccured();
|
void eventOccured();
|
||||||
void addObserver(MTGAbility * observer);
|
void addObserver(MTGAbility * observer);
|
||||||
@@ -76,7 +74,6 @@ class GameObserver{
|
|||||||
void untapPhase();
|
void untapPhase();
|
||||||
void draw();
|
void draw();
|
||||||
int isInPlay(MTGCardInstance * card);
|
int isInPlay(MTGCardInstance * card);
|
||||||
bool isCreature(MTGCardInstance * card);
|
|
||||||
|
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
void Render();
|
void Render();
|
||||||
|
|||||||
@@ -25,13 +25,10 @@ class GuiLayer{
|
|||||||
bool hasFocus;
|
bool hasFocus;
|
||||||
virtual void resetObjects();
|
virtual void resetObjects();
|
||||||
int getMaxId();
|
int getMaxId();
|
||||||
void RenderMessageBackground(float x0, float y0, float width, int height);
|
|
||||||
void RenderMessageBackground(float y0, int height);
|
|
||||||
GuiLayer();
|
GuiLayer();
|
||||||
virtual ~GuiLayer();
|
virtual ~GuiLayer();
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
virtual bool CheckUserInput(u32 key){ return false; };
|
virtual bool CheckUserInput(u32 key){ return false; };
|
||||||
virtual int unstoppableRenderInProgress(){return 0;};
|
|
||||||
int getIndexOf(JGuiObject * object);
|
int getIndexOf(JGuiObject * object);
|
||||||
JGuiObject * getByIndex (int index);
|
JGuiObject * getByIndex (int index);
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ class AbilityFactory{
|
|||||||
int moveAll(TargetChooser * tc, string destinationZone);
|
int moveAll(TargetChooser * tc, string destinationZone);
|
||||||
int damageAll(TargetChooser * tc, int damage);
|
int damageAll(TargetChooser * tc, int damage);
|
||||||
int TapAll(TargetChooser * tc);
|
int TapAll(TargetChooser * tc);
|
||||||
int CantBlock(TargetChooser * tc);
|
|
||||||
int UntapAll(TargetChooser * tc);
|
int UntapAll(TargetChooser * tc);
|
||||||
void addAbilities(int _id, Spell * spell);
|
void addAbilities(int _id, Spell * spell);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class MTGCard {
|
|||||||
int power;
|
int power;
|
||||||
int toughness;
|
int toughness;
|
||||||
int setId;
|
int setId;
|
||||||
static const char * const Colors_To_Text[];
|
|
||||||
int nb_types;
|
int nb_types;
|
||||||
int types[MAX_TYPES_PER_CARD];
|
int types[MAX_TYPES_PER_CARD];
|
||||||
MTGCard();
|
MTGCard();
|
||||||
@@ -55,7 +54,6 @@ class MTGCard {
|
|||||||
int getColor();
|
int getColor();
|
||||||
int hasColor(int _color);
|
int hasColor(int _color);
|
||||||
int countColors();
|
int countColors();
|
||||||
const char * colorToString();
|
|
||||||
|
|
||||||
void setMTGId(int id);
|
void setMTGId(int id);
|
||||||
int getMTGId();
|
int getMTGId();
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
UntapBlockers * untapBlockers;
|
UntapBlockers * untapBlockers;
|
||||||
MTGPlayerCards * belongs_to;
|
MTGPlayerCards * belongs_to;
|
||||||
MTGAbility * untapBlockerAbilities[10];
|
MTGAbility * untapBlockerAbilities[10];
|
||||||
void unband();
|
|
||||||
MTGCardInstance * getNextPartner();
|
MTGCardInstance * getNextPartner();
|
||||||
void initMTGCI();
|
void initMTGCI();
|
||||||
int setDefenser(MTGCardInstance * c);
|
int setDefenser(MTGCardInstance * c);
|
||||||
@@ -81,7 +80,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
int attacker;
|
int attacker;
|
||||||
int toggleDefenser(MTGCardInstance * opponent);
|
int toggleDefenser(MTGCardInstance * opponent);
|
||||||
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
||||||
int bringBlockerToFrontOfOrder(MTGCardInstance * blocker);
|
|
||||||
|
|
||||||
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
|
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
|
||||||
int getDefenserRank(MTGCardInstance * blocker);
|
int getDefenserRank(MTGCardInstance * blocker);
|
||||||
@@ -94,7 +92,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
MTGCardInstance * isDefenser();
|
MTGCardInstance * isDefenser();
|
||||||
int initAttackersDefensers();
|
int initAttackersDefensers();
|
||||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
||||||
MTGCardInstance * getNextDefenser(MTGCardInstance * previous=NULL);
|
|
||||||
int nbOpponents();
|
int nbOpponents();
|
||||||
int stepPower(CombatStep step);
|
int stepPower(CombatStep step);
|
||||||
|
|
||||||
@@ -102,8 +99,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
|
|
||||||
int has(int ability);
|
int has(int ability);
|
||||||
int cleanup();
|
int cleanup();
|
||||||
int reset();
|
|
||||||
|
|
||||||
|
|
||||||
MTGCard * model;
|
MTGCard * model;
|
||||||
MTGCardInstance();
|
MTGCardInstance();
|
||||||
@@ -121,13 +116,12 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
int addToToughness(int value);
|
int addToToughness(int value);
|
||||||
int setToughness(int value);
|
int setToughness(int value);
|
||||||
|
|
||||||
CardDescriptor * protections[10];
|
vector<TargetChooser *>protections;
|
||||||
int nbprotections;
|
int addProtection(TargetChooser * tc);
|
||||||
int addProtection(CardDescriptor * cd);
|
int removeProtection(TargetChooser *tc, int erase = 0);
|
||||||
int removeProtection(CardDescriptor *cd, int erase = 0);
|
|
||||||
int protectedAgainst(MTGCardInstance * card);
|
int protectedAgainst(MTGCardInstance * card);
|
||||||
|
|
||||||
void copy(MTGCardInstance * card);
|
void copy(MTGCardInstance * card);
|
||||||
// in game
|
|
||||||
|
|
||||||
void setUntapping();
|
void setUntapping();
|
||||||
int isUntapping();
|
int isUntapping();
|
||||||
@@ -137,7 +131,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
void attemptUntap();
|
void attemptUntap();
|
||||||
|
|
||||||
int isInPlay();
|
int isInPlay();
|
||||||
void resetAllDamage();
|
|
||||||
JSample * getSample();
|
JSample * getSample();
|
||||||
|
|
||||||
JQuad * getIcon();
|
JQuad * getIcon();
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ class MTGGameZone {
|
|||||||
|
|
||||||
class MTGLibrary: public MTGGameZone {
|
class MTGLibrary: public MTGGameZone {
|
||||||
public:
|
public:
|
||||||
// MTGLibrary();
|
|
||||||
void shuffleTopToBottom(int nbcards);
|
void shuffleTopToBottom(int nbcards);
|
||||||
MTGCardInstance * draw();
|
MTGCardInstance * draw();
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
@@ -102,7 +101,6 @@ class MTGLibrary: public MTGGameZone {
|
|||||||
|
|
||||||
class MTGGraveyard: public MTGGameZone {
|
class MTGGraveyard: public MTGGameZone {
|
||||||
public:
|
public:
|
||||||
// MTGGraveyard();
|
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
const char * getName(){return "graveyard";}
|
const char * getName(){return "graveyard";}
|
||||||
};
|
};
|
||||||
@@ -127,12 +125,8 @@ class MTGStack: public MTGGameZone {
|
|||||||
|
|
||||||
class MTGInPlay: public MTGGameZone {
|
class MTGInPlay: public MTGGameZone {
|
||||||
public:
|
public:
|
||||||
//MTGInPlay();
|
|
||||||
void untapAll();
|
void untapAll();
|
||||||
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
||||||
MTGCardInstance * getNextDefenser(MTGCardInstance * previous, MTGCardInstance * attacker);
|
|
||||||
int nbDefensers( MTGCardInstance * attacker);
|
|
||||||
int nbPartners(MTGCardInstance * attacker);
|
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
const char * getName(){return "battlefield";}
|
const char * getName(){return "battlefield";}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class ManaCost{
|
|||||||
int getCost(int color);
|
int getCost(int color);
|
||||||
//Returns NULL if i is greater than nbhybrids
|
//Returns NULL if i is greater than nbhybrids
|
||||||
ManaCostHybrid * getHybridCost(unsigned int i);
|
ManaCostHybrid * getHybridCost(unsigned int i);
|
||||||
int getMainColor();
|
|
||||||
int hasColor(int color);
|
int hasColor(int color);
|
||||||
int remove (int color, int value);
|
int remove (int color, int value);
|
||||||
int add(int color, int value);
|
int add(int color, int value);
|
||||||
@@ -52,7 +51,6 @@ class ManaCost{
|
|||||||
int addExtraCost(ExtraCost * _cost);
|
int addExtraCost(ExtraCost * _cost);
|
||||||
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
|
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
|
||||||
int isExtraPaymentSet();
|
int isExtraPaymentSet();
|
||||||
int resetExtraPayment();
|
|
||||||
int doPayExtra();
|
int doPayExtra();
|
||||||
|
|
||||||
int addHybrid(int c1, int v1, int c2, int v2);
|
int addHybrid(int c1, int v1, int c2, int v2);
|
||||||
|
|||||||
@@ -261,23 +261,6 @@ protected:
|
|||||||
JGuiListener * mListener;
|
JGuiListener * mListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WGuiImage: public WGuiItem{
|
|
||||||
public:
|
|
||||||
WGuiImage(string _file, int _w, int _h, int _margin);
|
|
||||||
virtual bool Selectable() {return false;};
|
|
||||||
virtual JQuad * getImage();
|
|
||||||
virtual void Render();
|
|
||||||
virtual float getHeight();
|
|
||||||
|
|
||||||
virtual void imageScale(float w, float h);
|
|
||||||
protected:
|
|
||||||
bool exact;
|
|
||||||
int margin;
|
|
||||||
int imgW, imgH;
|
|
||||||
string filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WGuiText:public WGuiItem {
|
class WGuiText:public WGuiItem {
|
||||||
public:
|
public:
|
||||||
WGuiText(string _displayValue): WGuiItem(_displayValue) {};
|
WGuiText(string _displayValue): WGuiItem(_displayValue) {};
|
||||||
@@ -376,19 +359,6 @@ class OptionInteger:public OptionItem{
|
|||||||
virtual void updateValue(){value+=increment; if (value>maxValue) value=0;};
|
virtual void updateValue(){value+=increment; if (value>maxValue) value=0;};
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptionString:public OptionItem{
|
|
||||||
public:
|
|
||||||
string value;
|
|
||||||
OptionString(int _id, string _displayValue);
|
|
||||||
|
|
||||||
virtual void Render();
|
|
||||||
virtual void setData();
|
|
||||||
virtual void updateValue();
|
|
||||||
virtual bool Changed() {return value != options[id].str;};
|
|
||||||
virtual void Reload() {if(id != INVALID_OPTION) value = options[id].str;};
|
|
||||||
bool bShowValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OptionSelect:public OptionItem{
|
class OptionSelect:public OptionItem{
|
||||||
public:
|
public:
|
||||||
size_t value;
|
size_t value;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ class TargetChooser: public TargetsList {
|
|||||||
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
||||||
|
|
||||||
int maxtargets; //Set to -1 for "unlimited"
|
int maxtargets; //Set to -1 for "unlimited"
|
||||||
|
|
||||||
|
virtual int setAllZones(){return 0;}
|
||||||
virtual bool targetsZone(MTGGameZone * z){return false;};
|
virtual bool targetsZone(MTGGameZone * z){return false;};
|
||||||
int ForceTargetListReady();
|
int ForceTargetListReady();
|
||||||
int targetsReadyCheck();
|
int targetsReadyCheck();
|
||||||
@@ -65,13 +67,14 @@ class TargetChooserFactory{
|
|||||||
|
|
||||||
class TargetZoneChooser:public TargetChooser{
|
class TargetZoneChooser:public TargetChooser{
|
||||||
public:
|
public:
|
||||||
int zones[10];
|
int zones[15];
|
||||||
int nbzones;
|
int nbzones;
|
||||||
int init(int * _zones, int _nbzones);
|
int init(int * _zones, int _nbzones);
|
||||||
bool targetsZone(MTGGameZone * z);
|
bool targetsZone(MTGGameZone * z);
|
||||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||||
virtual bool canTarget(Targetable * _card);
|
virtual bool canTarget(Targetable * _card);
|
||||||
|
int setAllZones();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CardTargetChooser:public TargetZoneChooser {
|
class CardTargetChooser:public TargetZoneChooser {
|
||||||
@@ -155,10 +158,5 @@ class DamageTargetChooser:public TargetChooser{
|
|||||||
virtual bool canTarget(Targetable * target);
|
virtual bool canTarget(Targetable * target);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DamageOrPermanentTargetChooser:public TargetZoneChooser{
|
|
||||||
public:
|
|
||||||
int color;
|
|
||||||
DamageOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
|
|
||||||
virtual bool canTarget(Targetable * target);
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,20 +50,6 @@ int ActionLayer::reactToTargetClick(ActionElement* ability, Targetable * card){
|
|||||||
return result;
|
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){
|
bool ActionLayer::CheckUserInput(u32 key){
|
||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
if (g->waitForExtraPayment && key == PSP_CTRL_CROSS){
|
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);
|
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)
|
std::ostream& operator<<(std::ostream& out, const CardDisplay& m)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,13 +90,6 @@ DuelLayers::~DuelLayers(){
|
|||||||
Trash::cleanup();
|
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){
|
void DuelLayers::Add(GuiLayer * layer){
|
||||||
objects.push_back(layer);
|
objects.push_back(layer);
|
||||||
nbitems++;
|
nbitems++;
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ GameObserver::GameObserver(Player * _players[], int _nb_players){
|
|||||||
combatStep = BLOCKERS;
|
combatStep = BLOCKERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObserver::setGamePhaseManager(MTGGamePhase * _phases){
|
|
||||||
gamePhaseManager = _phases;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GameObserver::getCurrentGamePhase(){
|
int GameObserver::getCurrentGamePhase(){
|
||||||
return currentGamePhase;
|
return currentGamePhase;
|
||||||
}
|
}
|
||||||
@@ -467,12 +463,6 @@ int GameObserver::receiveEvent(WEvent * e){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GameObserver::isCreature(MTGCardInstance * card){
|
|
||||||
return card->isCreature();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Player * GameObserver::currentlyActing(){
|
Player * GameObserver::currentlyActing(){
|
||||||
if (isInterrupting) return isInterrupting;
|
if (isInterrupting) return isInterrupting;
|
||||||
return currentActionPlayer;
|
return currentActionPlayer;
|
||||||
|
|||||||
@@ -998,8 +998,7 @@ void GameStateDeckViewer::updateStats() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbilityFactory * af;
|
AbilityFactory * af = NEW AbilityFactory();
|
||||||
af = NEW AbilityFactory();
|
|
||||||
|
|
||||||
stw.needUpdate = false;
|
stw.needUpdate = false;
|
||||||
|
|
||||||
@@ -1180,7 +1179,7 @@ void GameStateDeckViewer::renderCard(int id, float rotation){
|
|||||||
MTGCard * card = cardIndex[id];
|
MTGCard * card = cardIndex[id];
|
||||||
|
|
||||||
|
|
||||||
float max_scale = 0.96;
|
float max_scale = 0.96f;
|
||||||
float x_center_0 = 180;
|
float x_center_0 = 180;
|
||||||
float right_border = SCREEN_WIDTH - 20 ;
|
float right_border = SCREEN_WIDTH - 20 ;
|
||||||
|
|
||||||
|
|||||||
@@ -59,36 +59,6 @@ void GuiLayer::resetObjects(){
|
|||||||
mCurr = 0;
|
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){
|
int GuiLayer::getIndexOf(JGuiObject * object){
|
||||||
for (int i=0; i<mCount; i++){
|
for (int i=0; i<mCount; i++){
|
||||||
if (mObjects[i] == object)
|
if (mObjects[i] == object)
|
||||||
|
|||||||
@@ -36,22 +36,6 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option){
|
|||||||
return result;
|
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){
|
int AbilityFactory::parsePowerToughness(string s, int *power, int *toughness){
|
||||||
size_t found = s.find("/");
|
size_t found = s.find("/");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
@@ -587,18 +571,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
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
|
//Discard
|
||||||
found = s.find("discard:");
|
found = s.find("discard:");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
@@ -707,6 +679,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Mana Producer
|
//Mana Producer
|
||||||
found = s.find("add");
|
found = s.find("add");
|
||||||
if (found != string::npos){
|
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...)
|
//Untapper (Ley Druid...)
|
||||||
found = s.find("untap");
|
found = s.find("untap");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
const char * const MTGCard::Colors_To_Text[] = {"Artifact", "Green", "Blue", "Red", "Black", "White", "Land"};
|
|
||||||
|
|
||||||
MTGCard::MTGCard(){
|
MTGCard::MTGCard(){
|
||||||
init();
|
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){
|
void MTGCard::setMTGId(int id){
|
||||||
mtgid = id;
|
mtgid = id;
|
||||||
if (id < 0){
|
if (id < 0){
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ void MTGCardInstance::initMTGCI(){
|
|||||||
untapping = 0;
|
untapping = 0;
|
||||||
summoningSickness = 1;
|
summoningSickness = 1;
|
||||||
target = NULL;
|
target = NULL;
|
||||||
nbprotections = 0;
|
|
||||||
type_as_damageable = DAMAGEABLE_MTGCARDINSTANCE;
|
type_as_damageable = DAMAGEABLE_MTGCARDINSTANCE;
|
||||||
banding = NULL;
|
banding = NULL;
|
||||||
owner = NULL;
|
owner = NULL;
|
||||||
@@ -231,10 +230,6 @@ int MTGCardInstance::isTapped(){
|
|||||||
return tapped;
|
return tapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGCardInstance::resetAllDamage(){
|
|
||||||
nb_damages = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MTGCardInstance::regenerate(){
|
int MTGCardInstance::regenerate(){
|
||||||
return ++regenerateTokens;
|
return ++regenerateTokens;
|
||||||
}
|
}
|
||||||
@@ -301,16 +296,6 @@ MTGCardInstance * MTGCardInstance::changeController(Player * newController){
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset the card parameters
|
|
||||||
int MTGCardInstance::reset(){
|
|
||||||
cleanup();
|
|
||||||
untap();
|
|
||||||
SAFE_DELETE(counters);
|
|
||||||
counters = NEW Counters(this);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Player * MTGCardInstance::controller(){
|
Player * MTGCardInstance::controller(){
|
||||||
return lastController;
|
return lastController;
|
||||||
}
|
}
|
||||||
@@ -398,32 +383,6 @@ MTGCardInstance * MTGCardInstance::getNextPartner(){
|
|||||||
return NULL;
|
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){
|
int MTGCardInstance::setAttacker(int value){
|
||||||
Targetable * previousTarget = NULL;
|
Targetable * previousTarget = NULL;
|
||||||
Targetable * target = NULL;
|
Targetable * target = NULL;
|
||||||
@@ -477,18 +436,6 @@ int MTGCardInstance::nbOpponents(){
|
|||||||
return result;
|
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){
|
int MTGCardInstance::raiseBlockerRankOrder(MTGCardInstance * blocker){
|
||||||
list<MTGCardInstance *>::iterator it1 = find(blockers.begin(), blockers.end(), blocker);
|
list<MTGCardInstance *>::iterator it1 = find(blockers.begin(), blockers.end(), blocker);
|
||||||
list<MTGCardInstance *>::iterator it2 = it1;
|
list<MTGCardInstance *>::iterator it2 = it1;
|
||||||
@@ -501,19 +448,6 @@ int MTGCardInstance::raiseBlockerRankOrder(MTGCardInstance * blocker){
|
|||||||
return 1;
|
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 MTGCardInstance::getDefenserRank(MTGCardInstance * blocker){
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for(list<MTGCardInstance *>::iterator it1 = blockers.begin(); it1 != blockers.end(); ++it1){
|
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){
|
int MTGCardInstance::addProtection(TargetChooser * tc){
|
||||||
protections[nbprotections] = cd;
|
tc->targetter = NULL;
|
||||||
nbprotections++;
|
protections.push_back(tc);
|
||||||
return nbprotections;
|
return protections.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGCardInstance::removeProtection(CardDescriptor * cd, int erase){
|
int MTGCardInstance::removeProtection(TargetChooser * tc, int erase){
|
||||||
for (int i = 0; i < nbprotections ; i++){
|
for (size_t i = 0; i < protections.size() ; i++){
|
||||||
if (protections[i] == cd){
|
if (protections[i] == tc){
|
||||||
if (erase) delete (protections[i]);
|
if (erase) delete (protections[i]);
|
||||||
protections[i] = protections[nbprotections -1];
|
protections.erase(protections.begin()+i);
|
||||||
protections[nbprotections -1] = NULL;
|
|
||||||
nbprotections--;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,8 +556,9 @@ int MTGCardInstance::protectedAgainst(MTGCardInstance * card){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//General protections
|
//General protections
|
||||||
for (int i = 0; i < nbprotections ; i++){
|
for (size_t i = 0; i < protections.size() ; i++){
|
||||||
if (protections[i]->match(card)) return 1;
|
if (protections[i]->canTarget(card))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
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){
|
MTGCardInstance * MTGInPlay::getNextAttacker(MTGCardInstance * previous){
|
||||||
int foundprevious = 0;
|
int foundprevious = 0;
|
||||||
if (previous == NULL){
|
if (previous == NULL){
|
||||||
|
|||||||
@@ -187,13 +187,6 @@ ManaCostHybrid * ManaCost::getHybridCost(unsigned int i){
|
|||||||
return hybrids[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){
|
int ManaCost::hasColor(int color){
|
||||||
if (cost[color]) return 1;
|
if (cost[color]) return 1;
|
||||||
for (unsigned int i = 0; i < nbhybrids; i++){
|
for (unsigned int i = 0; i < nbhybrids; i++){
|
||||||
@@ -267,11 +260,6 @@ int ManaCost::isExtraPaymentSet(){
|
|||||||
return extraCosts->isPaymentSet();
|
return extraCosts->isPaymentSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ManaCost::resetExtraPayment(){
|
|
||||||
if (!extraCosts) return 1;
|
|
||||||
return extraCosts->reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ManaCost::doPayExtra(){
|
int ManaCost::doPayExtra(){
|
||||||
if (!extraCosts) return 0;
|
if (!extraCosts) return 0;
|
||||||
return extraCosts->doPay(); //TODO reset ?
|
return extraCosts->doPay(); //TODO reset ?
|
||||||
|
|||||||
@@ -707,39 +707,6 @@ void WGuiList::Reload()
|
|||||||
listItems[i]->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"){
|
OptionTheme::OptionTheme(): OptionDirectory(RESPATH"/themes",Options::ACTIVE_THEME, "Current Theme"){
|
||||||
addSelection("Default");
|
addSelection("Default");
|
||||||
@@ -987,52 +954,6 @@ void WDecoConfirm::ButtonPressed(int controllerId, int controlId){
|
|||||||
it->ButtonPressed(controllerId,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) {
|
WGuiButton::WGuiButton( WGuiBase* _it, int _controller, int _control, JGuiListener * jgl): WGuiDeco(_it) {
|
||||||
control = _control;
|
control = _control;
|
||||||
controller = _controller;
|
controller = _controller;
|
||||||
|
|||||||
@@ -296,22 +296,14 @@ bool TargetChooser::canTarget(Targetable * target){
|
|||||||
|
|
||||||
|
|
||||||
int TargetChooser::addTarget(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();
|
return targetsReadyCheck();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TargetChooser::ForceTargetListReady(){
|
int TargetChooser::ForceTargetListReady(){
|
||||||
int state = targetsReadyCheck() ;
|
int state = targetsReadyCheck() ;
|
||||||
if (state == TARGET_OK){
|
if (state == TARGET_OK){
|
||||||
@@ -510,6 +502,27 @@ int TargetZoneChooser::init(int * _zones, int _nbzones){
|
|||||||
return 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){
|
bool TargetZoneChooser::canTarget(Targetable * target){
|
||||||
if (!TargetChooser::canTarget(target)) return false;
|
if (!TargetChooser::canTarget(target)) return false;
|
||||||
if (target->typeAsTarget() == TARGET_CARD){
|
if (target->typeAsTarget() == TARGET_CARD){
|
||||||
@@ -619,27 +632,3 @@ bool DamageTargetChooser::canTarget(Targetable * target){
|
|||||||
}
|
}
|
||||||
return false;
|
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