Erwan
- Added Tokens (needs testing !!!) - Added a few cards that create tokens
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
TARGET = template
|
||||
OBJS = src/ActionElement.o src/ActionLayer.o src/ActionStack.o src/AIPlayer.o src/AIStats.o src/Blocker.o src/CardGui.o src/CardDescriptor.o src/CardDisplay.o src/ConstraintResolver.o src/Counters.o src/Damage.o src/DamagerDamaged.o src/DamageResolverLayer.o src/DeckDataWrapper.o src/DeckStats.o src/DuelLayers.o src/GameApp.o src/GameLauncher.o src/GameObserver.o src/GameOptions.o src/GameStateDuel.o src/GameStateOptions.o src/GameStateShop.o src/GuiCardsController.o src/GuiLayers.o src/Logger.o src/ManaCost.o src/ManaCostHybrid.o src/MenuItem.o src/MTGAbility.o src/MTGCardInstance.o src/MTGCard.o src/MTGDeck.o src/MTGGamePhase.o src/MTGGameZones.o src/MTGGuiHand.o src/MTGGuiPlay.o src/MTGRules.o src/OptionItem.o src/PhaseRing.o src/Player.o src/PlayerData.o src/PlayGuiObjectController.o src/PlayGuiObject.o src/PriceList.o src/ShopItem.o src/SimpleMenu.o src/SimpleMenuItem.o src/Subtypes.o src/TargetChooser.o src/TargetsList.o src/TexturesCache.o src/utils.o
|
||||
OBJS = src/ActionElement.o src/ActionLayer.o src/ActionStack.o src/AIPlayer.o src/AIStats.o src/Blocker.o src/CardGui.o src/CardDescriptor.o src/CardDisplay.o src/ConstraintResolver.o src/Counters.o src/Damage.o src/DamagerDamaged.o src/DamageResolverLayer.o src/DeckDataWrapper.o src/DeckStats.o src/DuelLayers.o src/GameApp.o src/GameLauncher.o src/GameObserver.o src/GameOptions.o src/GameStateDuel.o src/GameStateOptions.o src/GameStateShop.o src/GuiCardsController.o src/GuiLayers.o src/Logger.o src/ManaCost.o src/ManaCostHybrid.o src/MenuItem.o src/MTGAbility.o src/MTGCardInstance.o src/MTGCard.o src/MTGDeck.o src/MTGGamePhase.o src/MTGGameZones.o src/MTGGuiHand.o src/MTGGuiPlay.o src/MTGRules.o src/OptionItem.o src/PhaseRing.o src/Player.o src/PlayerData.o src/PlayGuiObjectController.o src/PlayGuiObject.o src/PriceList.o src/ShopItem.o src/SimpleMenu.o src/SimpleMenuItem.o src/Subtypes.o src/TargetChooser.o src/TargetsList.o src/TexturesCache.o src/Token.o src/utils.o
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -291,6 +291,16 @@ type=Instant
|
||||
mana={W}
|
||||
[/card]
|
||||
[card]
|
||||
text={5}{R}{R}: Put a 5/5 red Dragon creature token with flying into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
auto={5}{R}{R}:token(Dragon,creature dragon, 5/5,flying red)
|
||||
id=143024
|
||||
name=Dragon Roost
|
||||
rarity=R
|
||||
color=Red
|
||||
type=Enchantment
|
||||
mana={4}{R}{R}
|
||||
[/card]
|
||||
[card]
|
||||
text=
|
||||
id=135216
|
||||
name=Dross Crocodile
|
||||
@@ -1000,6 +1010,17 @@ subtype=Cat Warrior
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
text=Soldier creatures have vigilance. (Attacking doesn't cause them to tap.) {2}{W}: Put a 1/1 white Soldier creature token into play.
|
||||
auto={2}{W:}token(Soldier,creature soldier, 1/1,white)
|
||||
auto=lord(soldier) vigilance includeself
|
||||
id=129716
|
||||
name=Mobilization
|
||||
rarity=R
|
||||
color=White
|
||||
type=Enchantment
|
||||
mana={2}{W}
|
||||
[/card]
|
||||
[card]
|
||||
text={T}: Add {R} to your mana pool.
|
||||
auto={T}: Add {R}
|
||||
id=129652
|
||||
@@ -1778,6 +1799,16 @@ type=Instant
|
||||
mana={1}{B}
|
||||
[/card]
|
||||
[card]
|
||||
text={5}, {T}: Put a 1/1 Insect artifact creature token with flying named Wasp into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
auto={5},{T}:token(Wasp,creature artifact insect, 1/1,flying artifact)
|
||||
id=135253
|
||||
name=The Hive
|
||||
rarity=R
|
||||
color=Artifact
|
||||
type=Artifact
|
||||
mana={5}
|
||||
[/card]
|
||||
[card]
|
||||
text=Haste (This creature can attack and {T} as soon as it comes under your control.)
|
||||
abilities=haste
|
||||
id=130381
|
||||
|
||||
@@ -580,15 +580,6 @@ type=Artifact
|
||||
mana={2}
|
||||
[/card]
|
||||
[card]
|
||||
text={5}{R}{R}: Put a 5/5 red Dragon creature token with flying into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
id=143024
|
||||
name=Dragon Roost
|
||||
rarity=R
|
||||
color=Red
|
||||
type=Enchantment
|
||||
mana={4}{R}{R}
|
||||
[/card]
|
||||
[card]
|
||||
text=Whenever a player plays a red spell, you may gain 1 life.
|
||||
id=129527
|
||||
name=Dragon's Claw
|
||||
@@ -1173,16 +1164,7 @@ color=Artifact
|
||||
type=Artifact
|
||||
mana={2}
|
||||
[/card]
|
||||
[card]
|
||||
text=Soldier creatures have vigilance. (Attacking doesn't cause them to tap.) {2}{W}: Put a 1/1 white Soldier creature token into play.
|
||||
auto=lord(soldier) vigilance includeself
|
||||
id=129716
|
||||
name=Mobilization
|
||||
rarity=R
|
||||
color=White
|
||||
type=Enchantment
|
||||
mana={2}{W}
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
text=Sacrifice Mogg Fanatic: Mogg Fanatic deals 1 damage to target creature or player.
|
||||
id=134748
|
||||
@@ -1953,15 +1935,6 @@ color=Land
|
||||
type=Land
|
||||
[/card]
|
||||
[card]
|
||||
text={5}, {T}: Put a 1/1 Insect artifact creature token with flying named Wasp into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
id=135253
|
||||
name=The Hive
|
||||
rarity=R
|
||||
color=Artifact
|
||||
type=Artifact
|
||||
mana={5}
|
||||
[/card]
|
||||
[card]
|
||||
text=Flying (This creature can't be blocked except by creatures with flying or reach.) Whenever Thieving Magpie deals damage to an opponent, you draw a card.
|
||||
id=129764
|
||||
name=Thieving Magpie
|
||||
|
||||
@@ -35,6 +35,19 @@ subtype=Human Wizard
|
||||
toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
text=Flying When Broodmate Dragon comes into play, put a 4/4 red Dragon creature token with flying into play.
|
||||
abilities=flying
|
||||
auto=token(Dragon,creature dragon, 4/4,flying red)
|
||||
id=178101
|
||||
name=Broodmate Dragon
|
||||
rarity=R
|
||||
type=Creature
|
||||
mana={3}{B}{R}{G}
|
||||
power=4
|
||||
subtype=Dragon
|
||||
toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
text=Vigilance, haste
|
||||
abilities=Vigilance, haste
|
||||
id=174952
|
||||
@@ -140,6 +153,15 @@ subtype=Human Rogue
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
text=Put two 1/1 red Goblin creature tokens into play.
|
||||
auto=token(Goblin,creature goblin, 1/1,red)*2
|
||||
id=174936
|
||||
name=Dragon Fodder
|
||||
rarity=C
|
||||
type=Sorcery
|
||||
mana={1}{R}
|
||||
[/card]
|
||||
[card]
|
||||
text=
|
||||
id=174848
|
||||
name=Dreg Reaver
|
||||
@@ -248,6 +270,19 @@ subtype=Goblin Scout
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
text=Vigilance {T}: Put an 8/8 Beast creature token into play that's red, green, and white.
|
||||
abilities=vigilance
|
||||
auto={T}:token(Beast,creature beast, 8/8,red green white)
|
||||
id=175105
|
||||
name=Godsire
|
||||
rarity=M
|
||||
type=Creature
|
||||
mana={4}{R}{G}{G}{W}
|
||||
power=8
|
||||
subtype=Beast
|
||||
toughness=8
|
||||
[/card]
|
||||
[card]
|
||||
text=Defender Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
|
||||
abilities=defender,exalted
|
||||
id=175103
|
||||
|
||||
@@ -196,17 +196,7 @@ rarity=R
|
||||
type=Sorcery
|
||||
mana={W}{W}{U}{U}{U}{B}{B}
|
||||
[/card]
|
||||
[card]
|
||||
text=Flying When Broodmate Dragon comes into play, put a 4/4 red Dragon creature token with flying into play.
|
||||
id=178101
|
||||
name=Broodmate Dragon
|
||||
rarity=R
|
||||
type=Creature
|
||||
mana={3}{B}{R}{G}
|
||||
power=4
|
||||
subtype=Dragon
|
||||
toughness=4
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
text=Devour 1 (As this comes into play, you may sacrifice any number of creatures. This creature comes into play with that many +1/+1 counters on it.) When Caldera Hellion comes into play, it deals 3 damage to each creature.
|
||||
id=175072
|
||||
@@ -368,14 +358,7 @@ rarity=C
|
||||
type=Artifact
|
||||
mana={W}
|
||||
[/card]
|
||||
[card]
|
||||
text=Put two 1/1 red Goblin creature tokens into play.
|
||||
id=174936
|
||||
name=Dragon Fodder
|
||||
rarity=C
|
||||
type=Sorcery
|
||||
mana={1}{R}
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
text={2}{R}, {T}, Sacrifice a black creature, a red creature, and a green creature: Search your library for a card named Hellkite Overlord and put it into play. Then shuffle your library.
|
||||
id=175239
|
||||
@@ -604,17 +587,6 @@ type=Enchantment
|
||||
mana={2}{R}
|
||||
[/card]
|
||||
[card]
|
||||
text=Vigilance {T}: Put an 8/8 Beast creature token into play that's red, green, and white.
|
||||
id=175105
|
||||
name=Godsire
|
||||
rarity=M
|
||||
type=Creature
|
||||
mana={4}{R}{G}{G}{W}
|
||||
power=8
|
||||
subtype=Beast
|
||||
toughness=8
|
||||
[/card]
|
||||
[card]
|
||||
text={1}{W}, {T}: Prevent all damage that would be dealt to target creature with power 5 or greater this turn.
|
||||
id=174822
|
||||
name=Godtoucher
|
||||
|
||||
@@ -2048,6 +2048,16 @@ type=Instant
|
||||
mana={1}{B}
|
||||
[/card]
|
||||
[card]
|
||||
text={5}, {T}: Put a 1/1 Insect artifact creature token with flying named Wasp into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
auto={5},{T}:token(Wasp,creature artifact insect, 1/1,flying artifact)
|
||||
id=1138
|
||||
name=The Hive
|
||||
rarity=R
|
||||
color=Artifact
|
||||
type=Artifact
|
||||
mana={5}
|
||||
[/card]
|
||||
[card]
|
||||
text=As The Rack comes into play, choose an opponent. At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
|
||||
id=1139
|
||||
name=The Rack
|
||||
|
||||
@@ -540,15 +540,6 @@ subtype=Giant
|
||||
toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
text={5}, {T}: Put a 1/1 Insect artifact creature token with flying named Wasp into play. (It can't be blocked except by creatures with flying or reach.)
|
||||
id=1138
|
||||
name=The Hive
|
||||
rarity=R
|
||||
color=Artifact
|
||||
type=Artifact
|
||||
mana={5}
|
||||
[/card]
|
||||
[card]
|
||||
text=Each noncreature artifact loses its abilities and becomes an artifact creature with power and toughness each equal to its converted mana cost. If Titania's Song leaves play, this effect continues until end of turn.
|
||||
id=1269
|
||||
name=Titania's Song
|
||||
|
||||
@@ -523,6 +523,15 @@ subtype=Elemental Shaman
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
text=({2W} can be paid with any two mana or with {W}. This card's converted mana cost is 6.) Put three 1/1 white Spirit creature tokens with flying into play.
|
||||
auto=token(Spirit,creature spirit, 1/1,flying white)*3
|
||||
id=152070
|
||||
name=Spectral Procession
|
||||
rarity=U
|
||||
type=Sorcery
|
||||
mana={2W}{2W}{2W}
|
||||
[/card]
|
||||
[card]
|
||||
text={T}: Add {1} to your mana pool. {UB}, {T}: Add {U}{U}, {U}{B}, or {B}{B} to your mana pool.
|
||||
auto={T}:Add{1}
|
||||
auto={UB}{T}:Add{U}{U}
|
||||
|
||||
@@ -1892,14 +1892,6 @@ subtype=Elemental
|
||||
toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
text=({2W} can be paid with any two mana or with {W}. This card's converted mana cost is 6.) Put three 1/1 white Spirit creature tokens with flying into play.
|
||||
id=152070
|
||||
name=Spectral Procession
|
||||
rarity=U
|
||||
type=Sorcery
|
||||
mana={2W}{2W}{2W}
|
||||
[/card]
|
||||
[card]
|
||||
text=Counter target spell unless its controller pays {1} for each blue permanent you control.
|
||||
id=153999
|
||||
name=Spell Syphon
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Subtypes.h"
|
||||
#include "CardGui.h"
|
||||
#include "GameOptions.h"
|
||||
#include "Token.h"
|
||||
|
||||
#include <JGui.h>
|
||||
#include <hge/hgeparticle.h>
|
||||
@@ -42,6 +43,70 @@ class ADrawer:public ActivatedAbility{
|
||||
|
||||
};
|
||||
|
||||
class ATokenCreator:public ActivatedAbility{
|
||||
public:
|
||||
list<int>abilities;
|
||||
list<int>types;
|
||||
list<int>colors;
|
||||
int power, toughness;
|
||||
string name;
|
||||
ATokenCreator(int _id,MTGCardInstance * _source,ManaCost * _cost, string sname, string stypes,int _power,int _toughness, string sabilities, int _doTap):ActivatedAbility(_id,_source,_cost,0,_doTap){
|
||||
power = _power;
|
||||
toughness = _toughness;
|
||||
name = sname;
|
||||
|
||||
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
|
||||
|
||||
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
|
||||
unsigned int found = sabilities.find(MTGBasicAbilities[j]);
|
||||
if (found != string::npos){
|
||||
abilities.push_back(j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < MTG_NB_COLORS; j++){
|
||||
unsigned int found = sabilities.find(MTGColorStrings[j]);
|
||||
if (found != string::npos){
|
||||
colors.push_back(j);
|
||||
}
|
||||
}
|
||||
|
||||
string s = stypes;
|
||||
while (s.size()){
|
||||
unsigned int found = s.find(" ");
|
||||
if (found != string::npos){
|
||||
int id = Subtypes::subtypesList->Add(s.substr(0,found));
|
||||
types.push_back(id);
|
||||
s = s.substr(found+1);
|
||||
}else{
|
||||
int id = Subtypes::subtypesList->Add(s);
|
||||
types.push_back(id);
|
||||
s = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
Token * myToken = NEW Token(name,source,power,toughness);
|
||||
list<int>::iterator it;
|
||||
for ( it=types.begin() ; it != types.end(); it++ ){
|
||||
myToken->addType(*it);
|
||||
}
|
||||
for ( it=colors.begin() ; it != colors.end(); it++ ){
|
||||
myToken->setColor(*it);
|
||||
}
|
||||
for ( it=abilities.begin() ; it != abilities.end(); it++ ){
|
||||
myToken->basicAbilities[*it] = 1;
|
||||
}
|
||||
Spell * spell = NEW Spell(myToken);
|
||||
|
||||
source->controller()->game->stack->addCard(myToken);
|
||||
spell->resolve();
|
||||
delete spell;
|
||||
return 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Moves Cards from a zone to another
|
||||
class AZoneMover:public TargetAbility{
|
||||
|
||||
@@ -187,6 +187,7 @@ class AbilityFactory{
|
||||
int countCards(TargetChooser * tc, Player * player = NULL, int option = 0);
|
||||
int destroyAllInPlay(TargetChooser * tc, int bury = 0);
|
||||
int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p);
|
||||
int parsePowerToughness(string s, int *power, int *toughness);
|
||||
Trigger * parseTrigger(string magicText);
|
||||
public:
|
||||
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL);
|
||||
|
||||
@@ -29,7 +29,6 @@ class MTGCard {
|
||||
|
||||
|
||||
int mtgid;
|
||||
TexturesCache * mCache;
|
||||
ManaCost manaCost;
|
||||
|
||||
|
||||
@@ -40,6 +39,7 @@ class MTGCard {
|
||||
int init();
|
||||
|
||||
public:
|
||||
TexturesCache * mCache;
|
||||
string text;
|
||||
string name;
|
||||
int colors[MTG_NB_COLORS];
|
||||
|
||||
@@ -37,6 +37,7 @@ class MTGCardInstance: public MTGCard, public Damageable, public Targetable {
|
||||
MTGCardInstance * getNextPartner();
|
||||
void initMTGCI();
|
||||
public:
|
||||
bool isToken;
|
||||
MTGGameZone * getCurrentZone();
|
||||
int doDamageTest;
|
||||
int summoningSickness;
|
||||
|
||||
12
projects/mtg/include/Token.h
Normal file
12
projects/mtg/include/Token.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _TOKEN_H_
|
||||
#define _TOKEN_H_
|
||||
|
||||
#include "MTGCardInstance.h"
|
||||
|
||||
class Token: public MTGCardInstance{
|
||||
MTGCardInstance * tokenSource;
|
||||
public:
|
||||
Token(string _name, MTGCardInstance * source, int _power=0, int _toughness=0);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -106,7 +106,7 @@ void Spell::Render(){
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(0.75);
|
||||
char buffer[200];
|
||||
sprintf(buffer, "%s", source->model->getName());
|
||||
sprintf(buffer, "%s", source->getName());
|
||||
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * quad = source->getThumb();
|
||||
|
||||
@@ -216,7 +216,8 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
||||
quad = card->getQuad();
|
||||
if (quad){
|
||||
quad->SetColor(ARGB(220,255,255,255));
|
||||
renderer->RenderQuad(quad, xpos , ypos , 0.0f,0.9f,0.9f);
|
||||
float scale = 257.f / quad->mHeight;
|
||||
renderer->RenderQuad(quad, xpos , ypos , 0.0f,scale,scale);
|
||||
}else{
|
||||
quad = card->getThumb();
|
||||
alternate = 1;
|
||||
|
||||
@@ -61,6 +61,24 @@ int AbilityFactory::putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone
|
||||
}
|
||||
|
||||
|
||||
int AbilityFactory::parsePowerToughness(string s, int *power, int *toughness){
|
||||
int found = s.find("/");
|
||||
if (found != string::npos){
|
||||
unsigned int start = s.find(":");
|
||||
if (start == string::npos) start = s.find(" ");
|
||||
if (start == string::npos) start = -1;
|
||||
*power = atoi(s.substr(start+1,s.size()-found).c_str());
|
||||
unsigned int end = s.find(" ",start);
|
||||
if (end != string::npos){
|
||||
*toughness = atoi(s.substr(found+1,end-found-1).c_str());
|
||||
}else{
|
||||
*toughness = atoi(s.substr(found+1).c_str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Trigger * AbilityFactory::parseTrigger(string magicText){
|
||||
size_t found = magicText.find("@");
|
||||
if (found == string::npos) return NULL;
|
||||
@@ -210,6 +228,40 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Token creator. Name, type, p/t, abilities
|
||||
found = s.find("token(");
|
||||
if (found != string::npos){
|
||||
if (dryMode) return BAKA_EFFECT_GOOD;
|
||||
int end = s.find(",", found);
|
||||
string sname = s.substr(found + 6,end - found - 6);
|
||||
int previous = end+1;
|
||||
end = s.find(",",previous);
|
||||
string stypes = s.substr(previous,end - previous);
|
||||
previous = end+1;
|
||||
end = s.find(",",previous);
|
||||
string spt = s.substr(previous,end - previous);
|
||||
int power, toughness;
|
||||
int havePowertoughness = parsePowerToughness(spt,&power, &toughness);
|
||||
string sabilities = s.substr(end+1);
|
||||
ManaCost * cost = ManaCost::parseManaCost(s);
|
||||
int multiplier = 1;
|
||||
found = s.find("*");
|
||||
if (found != string::npos)multiplier = atoi(s.substr(found+1).c_str());
|
||||
if(cost->getConvertedCost() || doTap){
|
||||
game->addObserver(NEW ATokenCreator(id,card,cost,sname,stypes,power,toughness,sabilities,doTap));
|
||||
}else{
|
||||
delete cost;
|
||||
cost = NULL;
|
||||
ATokenCreator * tok = NEW ATokenCreator(id,card,cost,sname,stypes,power,toughness,sabilities,doTap);
|
||||
for (int i=0; i < multiplier; i++){
|
||||
tok->resolve();
|
||||
}
|
||||
delete tok;
|
||||
}
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
//MoveTo Move a card from a zone to another
|
||||
found = s.find("moveto(");
|
||||
if (found != string::npos){
|
||||
@@ -389,19 +441,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
|
||||
//Change Power/Toughness
|
||||
found = s.find("/");
|
||||
if (found != string::npos){
|
||||
unsigned int start = s.find(":");
|
||||
if (start == string::npos) start = s.find(" ");
|
||||
if (start == string::npos) start = -1;
|
||||
int power = atoi(s.substr(start+1,size-found).c_str());
|
||||
unsigned int end = s.find(" ",start);
|
||||
int toughness;
|
||||
if (end != string::npos){
|
||||
toughness = atoi(s.substr(found+1,end-found-1).c_str());
|
||||
}else{
|
||||
toughness = atoi(s.substr(found+1).c_str());
|
||||
}
|
||||
int power, toughness;
|
||||
if ( parsePowerToughness(s,&power, &toughness)){
|
||||
if (dryMode){
|
||||
if (power >=0 && toughness >= 0 ) return BAKA_EFFECT_GOOD;
|
||||
return BAKA_EFFECT_BAD;
|
||||
@@ -533,7 +574,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
|
||||
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
int id = card->model->getId();
|
||||
int id = card->getId();
|
||||
if (card->alias) id = card->alias;
|
||||
switch (id){
|
||||
case 1092: //Aladdin's lamp
|
||||
|
||||
@@ -148,7 +148,14 @@ const char * MTGCard::colorToString(){
|
||||
|
||||
void MTGCard::setMTGId(int id){
|
||||
mtgid = id;
|
||||
sprintf(image_name, "%d.jpg", mtgid);
|
||||
if (id < 0){
|
||||
sprintf(image_name, "%dt.jpg", -mtgid);
|
||||
}else{
|
||||
sprintf(image_name, "%d.jpg", mtgid);
|
||||
}
|
||||
#ifdef WIN32
|
||||
OutputDebugString(image_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
int MTGCard::getMTGId(){
|
||||
|
||||
@@ -36,6 +36,7 @@ MTGCardInstance::~MTGCardInstance(){
|
||||
void MTGCardInstance::initMTGCI(){
|
||||
sample = "";
|
||||
model=NULL;
|
||||
isToken = false;
|
||||
lifeOrig = 0;
|
||||
doDamageTest = 0;
|
||||
belongs_to=NULL;
|
||||
@@ -73,11 +74,6 @@ int MTGCardInstance::isInPlay(){
|
||||
|
||||
int MTGCardInstance::afterDamage(){
|
||||
if (!doDamageTest) return 0;
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096], *p = buf;
|
||||
sprintf(buf,"After Damage Test, life is %i for %s \n",life,model->getName());
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
doDamageTest = 0;
|
||||
if (life <=0 && isInPlay()){
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
|
||||
@@ -89,10 +89,7 @@ void MTGPlayerCards::putInGraveyard(MTGCardInstance * card){
|
||||
|
||||
void MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to){
|
||||
if (from->removeCard(card)){
|
||||
to->addCard(card);
|
||||
card->changedZoneRecently = 1.f;
|
||||
|
||||
card->reset();
|
||||
|
||||
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME] > 0){
|
||||
if (to == graveyard){
|
||||
if (card->isACreature()){
|
||||
@@ -101,6 +98,20 @@ void MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGa
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (card->isToken){
|
||||
GameObserver *g = GameObserver::GetInstance();
|
||||
if (to != g->players[0]->game->inPlay && to != g->players[1]->game->inPlay){
|
||||
//Token leaves play: we destroy it
|
||||
//TODO DELETE Object
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
to->addCard(card);
|
||||
card->changedZoneRecently = 1.f;
|
||||
|
||||
card->reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +234,7 @@ MTGCardInstance * MTGLibrary::draw(){
|
||||
void MTGGameZone::debugPrint(){
|
||||
int i;
|
||||
for (i=0;i<nb_cards;i++){
|
||||
MTGCard * card = cards[i]->model;
|
||||
MTGCard * card = cards[i];
|
||||
fprintf(stderr, "%s", card->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ OutputDebugString("COLOR FOUND !!!");
|
||||
}
|
||||
|
||||
TargetChooser * TargetChooserFactory::createTargetChooser(MTGCardInstance * card){
|
||||
int id = card->model->getId();
|
||||
int id = card->getId();
|
||||
string s = card->spellTargetType;
|
||||
if (card->alias){
|
||||
id = card->alias;
|
||||
|
||||
@@ -96,7 +96,9 @@ CardTexture::CardTexture(MTGCard * card, int _type): type(_type){
|
||||
}else{
|
||||
sprintf(filename, "sets/%s/%s", card->getSetName(), card->getImageName());
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
OutputDebugString(filename);
|
||||
#endif
|
||||
tex = JRenderer::GetInstance()->LoadTexture(filename, false);
|
||||
if (tex){
|
||||
quad = NEW JQuad(tex, 0.0f, 0.0f, tex->mWidth, tex->mHeight);
|
||||
|
||||
19
projects/mtg/src/Token.cpp
Normal file
19
projects/mtg/src/Token.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "../include/Token.h"
|
||||
|
||||
Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness):MTGCardInstance(){
|
||||
isToken = true;
|
||||
tokenSource = source;
|
||||
power = _power;
|
||||
toughness = _toughness;
|
||||
life=toughness;
|
||||
lifeOrig = life;
|
||||
name = _name;
|
||||
setMTGId(- source->getMTGId());
|
||||
setId = source->setId;
|
||||
model = this;
|
||||
owner = source->owner;
|
||||
belongs_to=source->controller()->game;
|
||||
initAttackersDefensers();
|
||||
mCache = source->mCache;
|
||||
|
||||
}
|
||||
@@ -468,6 +468,10 @@
|
||||
RelativePath=".\src\TexturesCache.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Token.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\utils.cpp"
|
||||
>
|
||||
@@ -745,6 +749,10 @@
|
||||
RelativePath=".\include\TexturesCache.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Token.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\utils.h"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user