Erwan
- display the thumbnail as a "shadow" over the text version of the card if the big picture is not available - fixed a bug with circles of protection, although graphically it is difficult to understand what's going on when using those cards - fixed a bug with a card in Ice age
This commit is contained in:
@@ -1140,7 +1140,7 @@ text=Draw a card at the beginning of the upkeep of the turn after Krovikan Fetis
|
|||||||
id=2464
|
id=2464
|
||||||
target=creature
|
target=creature
|
||||||
auto=:1/1
|
auto=:1/1
|
||||||
auto=draw:1
|
auto=@next upkeep:draw:1
|
||||||
name=Krovikan Fetish
|
name=Krovikan Fetish
|
||||||
rarity=C
|
rarity=C
|
||||||
type=Enchantment
|
type=Enchantment
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ ascendant_evincar.txt
|
|||||||
ascendant_evincar2.txt
|
ascendant_evincar2.txt
|
||||||
brass_man.txt
|
brass_man.txt
|
||||||
castle.txt
|
castle.txt
|
||||||
|
circle_of_protection.txt
|
||||||
control_magic.txt
|
control_magic.txt
|
||||||
control_magic2.txt
|
control_magic2.txt
|
||||||
counsel_of_the_soratami.txt
|
counsel_of_the_soratami.txt
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#Testing circle of protection (black) with a lord of the pit attack
|
||||||
|
[INIT]
|
||||||
|
COMBATATTACKERS
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:1166
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:1335
|
||||||
|
manapool:{1}
|
||||||
|
[DO]
|
||||||
|
1166
|
||||||
|
next
|
||||||
|
#blockers
|
||||||
|
next
|
||||||
|
no
|
||||||
|
#damage phase
|
||||||
|
no
|
||||||
|
#interrupt the actual damage
|
||||||
|
yes
|
||||||
|
1335
|
||||||
|
1166
|
||||||
|
endinterrupt
|
||||||
|
next
|
||||||
|
#combatend
|
||||||
|
[ASSERT]
|
||||||
|
COMBATEND
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:1166
|
||||||
|
manapool:{0}
|
||||||
|
life:20
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:1335
|
||||||
|
manapool:{0}
|
||||||
|
life:20
|
||||||
|
[END]
|
||||||
@@ -53,6 +53,9 @@ class Interruptible: public PlayGuiObject, public Targetable{
|
|||||||
virtual void Render(){};
|
virtual void Render(){};
|
||||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||||
Interruptible(int id,bool hasFocus = false):PlayGuiObject(id,40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
Interruptible(int id,bool hasFocus = false):PlayGuiObject(id,40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||||
|
#if defined (WIN32) || defined (LINUX)
|
||||||
|
virtual void Dump();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class NextGamePhase: public Interruptible {
|
class NextGamePhase: public Interruptible {
|
||||||
@@ -142,6 +145,10 @@ class ActionStack :public GuiLayer{
|
|||||||
int CombatDamages();
|
int CombatDamages();
|
||||||
int CombatDamages(int firststrike);
|
int CombatDamages(int firststrike);
|
||||||
int has(Interruptible * action);
|
int has(Interruptible * action);
|
||||||
|
#if defined (WIN32) || defined (LINUX)
|
||||||
|
void Dump();
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class Damage: public Interruptible {
|
|||||||
void init(MTGCardInstance * _source, Damageable * _target, int _damage);
|
void init(MTGCardInstance * _source, Damageable * _target, int _damage);
|
||||||
public:
|
public:
|
||||||
Damageable * target;
|
Damageable * target;
|
||||||
MTGCardInstance * source;
|
|
||||||
int damage;
|
int damage;
|
||||||
void Render();
|
void Render();
|
||||||
Damage(int id, MTGCardInstance* _source, Damageable * _target);
|
Damage(int id, MTGCardInstance* _source, Damageable * _target);
|
||||||
|
|||||||
@@ -615,13 +615,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
|||||||
|
|
||||||
int alpha = (int) (255 * (scale + 1.0 - max_scale));
|
int alpha = (int) (255 * (scale + 1.0 - max_scale));
|
||||||
|
|
||||||
if (!card){
|
if (!card) return;
|
||||||
/*int scaleBackup = mFont->GetScale();
|
|
||||||
mFont->SetScale(scale);
|
|
||||||
mFont->DrawString("empty slot", x, y);
|
|
||||||
mFont->SetScale(scaleBackup);*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JQuad * quad = backQuad;
|
JQuad * quad = backQuad;
|
||||||
|
|
||||||
int showName = 1;
|
int showName = 1;
|
||||||
@@ -648,6 +642,12 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
CardGui::alternateRender(card, mFont, mIcons, x_center, y + 142.5*scale, 0, scale);
|
CardGui::alternateRender(card, mFont, mIcons, x_center, y + 142.5*scale, 0, scale);
|
||||||
|
quad = card->getThumb();
|
||||||
|
if (quad){
|
||||||
|
float _scale = 285 * scale / quad->mHeight;
|
||||||
|
quad->SetColor(ARGB(40,255,255,255));
|
||||||
|
JRenderer::GetInstance()->RenderQuad(quad,x,y,0,_scale,_scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (last_user_activity < 3){
|
if (last_user_activity < 3){
|
||||||
int fontAlpha = alpha;
|
int fontAlpha = alpha;
|
||||||
|
|||||||
@@ -398,11 +398,15 @@ void ActionStack::repackDamageStacks(){
|
|||||||
Damage * damage = (Damage *) action;
|
Damage * damage = (Damage *) action;
|
||||||
for (int j = 0; j < mCount; j++){
|
for (int j = 0; j < mCount; j++){
|
||||||
Interruptible * action2 = ((Interruptible *)mObjects[j]);
|
Interruptible * action2 = ((Interruptible *)mObjects[j]);
|
||||||
if (action->type == ACTION_DAMAGES){
|
if (action2->type == ACTION_DAMAGES){
|
||||||
DamageStack * ds = (DamageStack *) action2;
|
DamageStack * ds = (DamageStack *) action2;
|
||||||
for (int k = 0; k< ds->mCount; k++){
|
for (int k = 0; k< ds->mCount; k++){
|
||||||
Damage * dsdamage = ((Damage *)ds->mObjects[k]);
|
Damage * dsdamage = ((Damage *)ds->mObjects[k]);
|
||||||
if (dsdamage==damage) Remove(damage);
|
if (dsdamage==damage){
|
||||||
|
//Remove(damage);
|
||||||
|
mObjects[i] = mObjects[mCount-1];
|
||||||
|
mCount--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,6 +523,7 @@ bool ActionStack::CheckUserInput(u32 key){
|
|||||||
cancelInterruptOffer(2);
|
cancelInterruptOffer(2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}else if (game->isInterrupting){
|
}else if (game->isInterrupting){
|
||||||
if (PSP_CTRL_CROSS == key){
|
if (PSP_CTRL_CROSS == key){
|
||||||
endOfInterruption();
|
endOfInterruption();
|
||||||
@@ -530,8 +535,7 @@ bool ActionStack::CheckUserInput(u32 key){
|
|||||||
if (PSP_CTRL_UP == key){
|
if (PSP_CTRL_UP == key){
|
||||||
if( mObjects[mCurr]){
|
if( mObjects[mCurr]){
|
||||||
int n = getPreviousIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
int n = getPreviousIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||||
if (n != -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_UP))
|
if (n != -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_UP)){
|
||||||
{
|
|
||||||
mCurr = n;
|
mCurr = n;
|
||||||
mObjects[mCurr]->Entering();
|
mObjects[mCurr]->Entering();
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
@@ -545,8 +549,7 @@ bool ActionStack::CheckUserInput(u32 key){
|
|||||||
}else if (PSP_CTRL_DOWN == key){
|
}else if (PSP_CTRL_DOWN == key){
|
||||||
if( mObjects[mCurr]){
|
if( mObjects[mCurr]){
|
||||||
int n = getNextIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
int n = getNextIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||||
if (n!= -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_DOWN))
|
if (n!= -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_DOWN)){
|
||||||
{
|
|
||||||
mCurr = n;
|
mCurr = n;
|
||||||
mObjects[mCurr]->Entering();
|
mObjects[mCurr]->Entering();
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
@@ -566,6 +569,7 @@ bool ActionStack::CheckUserInput(u32 key){
|
|||||||
game->stackObjectClicked(((Interruptible *) mObjects[mCurr]));
|
game->stackObjectClicked(((Interruptible *) mObjects[mCurr]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return true; //Steal the input to other layers if we're visible
|
||||||
}
|
}
|
||||||
if (PSP_CTRL_TRIANGLE == key){
|
if (PSP_CTRL_TRIANGLE == key){
|
||||||
if (modal) {modal = 0;} else {modal = 1;}
|
if (modal) {modal = 0;} else {modal = 1;}
|
||||||
@@ -703,3 +707,65 @@ void ActionStack::Render(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (WIN32) || defined (LINUX)
|
||||||
|
|
||||||
|
void Interruptible::Dump(){
|
||||||
|
string stype, sstate, sdisplay = "";
|
||||||
|
switch (type){
|
||||||
|
case ACTION_SPELL:
|
||||||
|
stype = "spell";
|
||||||
|
break;
|
||||||
|
case ACTION_DAMAGE:
|
||||||
|
stype = "damage";
|
||||||
|
break;
|
||||||
|
case ACTION_DAMAGES:
|
||||||
|
stype = "damages";
|
||||||
|
break;
|
||||||
|
case ACTION_NEXTGAMEPHASE:
|
||||||
|
stype = "next phase";
|
||||||
|
break;
|
||||||
|
case ACTION_DRAW:
|
||||||
|
stype = "draw";
|
||||||
|
break;
|
||||||
|
case ACTION_PUTINGRAVEYARD:
|
||||||
|
stype = "put in graveyard";
|
||||||
|
break;
|
||||||
|
case ACTION_ABILITY:
|
||||||
|
stype = "ability";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
stype = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(state){
|
||||||
|
case NOT_RESOLVED:
|
||||||
|
sstate = "not resolved";
|
||||||
|
break;
|
||||||
|
case RESOLVED_OK:
|
||||||
|
sstate = "resolved";
|
||||||
|
break;
|
||||||
|
case RESOLVED_NOK:
|
||||||
|
sstate = "fizzled";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sstate = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[4096];
|
||||||
|
sprintf(buf, " type %s(%i) - state %s(%i) - display %i\n", stype.c_str(), type, sstate.c_str(),state, display);
|
||||||
|
OutputDebugString(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionStack::Dump(){
|
||||||
|
OutputDebugString("=====\nDumping Action Stack=====\n");
|
||||||
|
for (int i=0;i<mCount ;i++){
|
||||||
|
Interruptible * current = (Interruptible *)mObjects[i];
|
||||||
|
current->Dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -203,6 +203,8 @@ void CardGui::Update(float dt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
||||||
|
JQuad * quad = NULL;
|
||||||
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
if (xpos == -1){
|
if (xpos == -1){
|
||||||
xpos = 300;
|
xpos = 300;
|
||||||
if (x > SCREEN_WIDTH / 2)
|
if (x > SCREEN_WIDTH / 2)
|
||||||
@@ -211,12 +213,12 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
|||||||
if(ypos == -1)
|
if(ypos == -1)
|
||||||
ypos = 20;
|
ypos = 20;
|
||||||
if (!alternate){
|
if (!alternate){
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
quad = card->getQuad();
|
||||||
JQuad * quad = card->getQuad();
|
|
||||||
if (quad){
|
if (quad){
|
||||||
quad->SetColor(ARGB(220,255,255,255));
|
quad->SetColor(ARGB(220,255,255,255));
|
||||||
renderer->RenderQuad(quad, xpos , ypos , 0.0f,0.9f,0.9f);
|
renderer->RenderQuad(quad, xpos , ypos , 0.0f,0.9f,0.9f);
|
||||||
}else{
|
}else{
|
||||||
|
quad = card->getThumb();
|
||||||
alternate = 1;
|
alternate = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,6 +228,11 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
|||||||
MTGCard * mtgcard = card->model;
|
MTGCard * mtgcard = card->model;
|
||||||
JLBFont * font = GameApp::CommonRes->GetJLBFont("graphics/magic");
|
JLBFont * font = GameApp::CommonRes->GetJLBFont("graphics/magic");
|
||||||
CardGui::alternateRender(mtgcard, font, NULL, xpos + 90 , ypos + 130, 0.0f,0.9f);
|
CardGui::alternateRender(mtgcard, font, NULL, xpos + 90 , ypos + 130, 0.0f,0.9f);
|
||||||
|
if (quad){
|
||||||
|
float scale = 250 / quad->mHeight;
|
||||||
|
quad->SetColor(ARGB(40,255,255,255));
|
||||||
|
renderer->RenderQuad(quad,xpos,ypos,0,scale,scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,16 @@ void Damage::init(MTGCardInstance * _source, Damageable * _target, int _damage){
|
|||||||
|
|
||||||
int Damage::resolve(){
|
int Damage::resolve(){
|
||||||
if (damage <0) damage = 0; //Negative damages cannot happen
|
if (damage <0) damage = 0; //Negative damages cannot happen
|
||||||
|
state = RESOLVED_OK;
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE){
|
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE){
|
||||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||||
if ((_target)->protectedAgainst(source)) return 0;
|
if ((_target)->protectedAgainst(source)) damage = 0;
|
||||||
// Damage for WITHER on creatures
|
// Damage for WITHER on creatures
|
||||||
|
|
||||||
|
if (!damage){
|
||||||
|
state = RESOLVED_NOK;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (source->has(WITHER)){
|
if (source->has(WITHER)){
|
||||||
for (int i = 0; i < damage; i++){
|
for (int i = 0; i < damage; i++){
|
||||||
_target->counters->addCounter(-1, -1);
|
_target->counters->addCounter(-1, -1);
|
||||||
@@ -120,11 +126,13 @@ int DamageStack::CombatDamages(int strike){
|
|||||||
int DamageStack::resolve(){
|
int DamageStack::resolve(){
|
||||||
for (int i = mCount-1; i>= 0; i--){
|
for (int i = mCount-1; i>= 0; i--){
|
||||||
Damage * damage = (Damage*)mObjects[i];
|
Damage * damage = (Damage*)mObjects[i];
|
||||||
damage->resolve();
|
if (damage->state == NOT_RESOLVED) damage->resolve();
|
||||||
|
//damage->resolve();
|
||||||
}
|
}
|
||||||
for (int i = mCount-1; i>= 0; i--){
|
for (int i = mCount-1; i>= 0; i--){
|
||||||
Damage * damage = (Damage*)mObjects[i];
|
Damage * damage = (Damage*)mObjects[i];
|
||||||
damage->target->afterDamage();
|
if (damage->state == RESOLVED_OK) damage->target->afterDamage();
|
||||||
|
//damage->target->afterDamage();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -133,10 +141,12 @@ void DamageStack::Render(){
|
|||||||
int currenty = y;
|
int currenty = y;
|
||||||
for (int i= 0; i < mCount; i++){
|
for (int i= 0; i < mCount; i++){
|
||||||
Damage * damage = (Damage*)mObjects[i];
|
Damage * damage = (Damage*)mObjects[i];
|
||||||
|
if (damage->state == NOT_RESOLVED){
|
||||||
damage->x = x;
|
damage->x = x;
|
||||||
damage->y = currenty;
|
damage->y = currenty;
|
||||||
currenty += damage->mHeight;
|
currenty += damage->mHeight;
|
||||||
damage->Render();
|
damage->Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ void OptionItem::Update(float dt){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OptionItem::Entering(){
|
void OptionItem::Entering(){
|
||||||
hasFocus = true;
|
hasFocus = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,13 @@ int TestSuiteAI::Act(float dt){
|
|||||||
timer+= dt;
|
timer+= dt;
|
||||||
if (timer < suite->timerLimit) return 1;
|
if (timer < suite->timerLimit) return 1;
|
||||||
timer = 0;
|
timer = 0;
|
||||||
|
|
||||||
string action = suite->getNextAction();
|
string action = suite->getNextAction();
|
||||||
|
g->mLayers->stackLayer()->Dump();
|
||||||
|
OutputDebugString(action.c_str());
|
||||||
|
OutputDebugString("\n");
|
||||||
|
|
||||||
|
|
||||||
if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){
|
if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){
|
||||||
if(action.compare("no") != 0 && action.compare("yes") != 0){
|
if(action.compare("no") != 0 && action.compare("yes") != 0){
|
||||||
g->mLayers->stackLayer()->cancelInterruptOffer();
|
g->mLayers->stackLayer()->cancelInterruptOffer();
|
||||||
@@ -62,6 +68,7 @@ int TestSuiteAI::Act(float dt){
|
|||||||
g->gameOver = g->players[0];
|
g->gameOver = g->players[0];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.compare("eot")== 0){
|
if (action.compare("eot")== 0){
|
||||||
if (g->getCurrentGamePhase() != MTG_PHASE_CLEANUP) suite->currentAction--;
|
if (g->getCurrentGamePhase() != MTG_PHASE_CLEANUP) suite->currentAction--;
|
||||||
g->userRequestNextGamePhase();
|
g->userRequestNextGamePhase();
|
||||||
@@ -79,13 +86,13 @@ int TestSuiteAI::Act(float dt){
|
|||||||
}else{
|
}else{
|
||||||
int mtgid = atoi(action.c_str());
|
int mtgid = atoi(action.c_str());
|
||||||
if (mtgid){
|
if (mtgid){
|
||||||
|
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
|
||||||
|
if (toInterrupt){
|
||||||
|
g->stackObjectClicked(toInterrupt);
|
||||||
|
}else{
|
||||||
MTGCardInstance * card = suite->getCardByMTGId(mtgid);
|
MTGCardInstance * card = suite->getCardByMTGId(mtgid);
|
||||||
if (card) {
|
if (card) {
|
||||||
g->cardClick(card);
|
g->cardClick(card);
|
||||||
}else{
|
|
||||||
Interruptible * action = suite->getActionByMTGId(mtgid);
|
|
||||||
if (action){
|
|
||||||
g->stackObjectClicked(action);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -171,8 +178,8 @@ void TestSuiteState::parsePlayerState(int playerId, string s){
|
|||||||
|
|
||||||
|
|
||||||
string TestSuite::getNextAction(){
|
string TestSuite::getNextAction(){
|
||||||
if (actions.nbitems && currentAction < actions.nbitems){
|
|
||||||
currentAction++;
|
currentAction++;
|
||||||
|
if (actions.nbitems && currentAction <= actions.nbitems){
|
||||||
return actions.actions[currentAction-1];
|
return actions.actions[currentAction-1];
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@@ -407,6 +414,7 @@ void TestSuite::load(const char * _filename){
|
|||||||
if(file){
|
if(file){
|
||||||
cleanup();
|
cleanup();
|
||||||
while(std::getline(file,s)){
|
while(std::getline(file,s)){
|
||||||
|
if (s[0] == '#') continue;
|
||||||
std::transform( s.begin(), s.end(), s.begin(),::tolower );
|
std::transform( s.begin(), s.end(), s.begin(),::tolower );
|
||||||
switch(state){
|
switch(state){
|
||||||
case -1:
|
case -1:
|
||||||
|
|||||||
Reference in New Issue
Block a user