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
|
||||
target=creature
|
||||
auto=:1/1
|
||||
auto=draw:1
|
||||
auto=@next upkeep:draw:1
|
||||
name=Krovikan Fetish
|
||||
rarity=C
|
||||
type=Enchantment
|
||||
|
||||
@@ -19,6 +19,7 @@ ascendant_evincar.txt
|
||||
ascendant_evincar2.txt
|
||||
brass_man.txt
|
||||
castle.txt
|
||||
circle_of_protection.txt
|
||||
control_magic.txt
|
||||
control_magic2.txt
|
||||
counsel_of_the_soratami.txt
|
||||
|
||||
34
projects/mtg/bin/Res/test/circle_of_protection.txt
Normal file
34
projects/mtg/bin/Res/test/circle_of_protection.txt
Normal file
@@ -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(){};
|
||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||
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 {
|
||||
@@ -142,6 +145,10 @@ class ActionStack :public GuiLayer{
|
||||
int CombatDamages();
|
||||
int CombatDamages(int firststrike);
|
||||
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);
|
||||
public:
|
||||
Damageable * target;
|
||||
MTGCardInstance * source;
|
||||
int damage;
|
||||
void Render();
|
||||
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));
|
||||
|
||||
if (!card){
|
||||
/*int scaleBackup = mFont->GetScale();
|
||||
mFont->SetScale(scale);
|
||||
mFont->DrawString("empty slot", x, y);
|
||||
mFont->SetScale(scaleBackup);*/
|
||||
return;
|
||||
}
|
||||
if (!card) return;
|
||||
JQuad * quad = backQuad;
|
||||
|
||||
int showName = 1;
|
||||
@@ -648,6 +642,12 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
}
|
||||
}else{
|
||||
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){
|
||||
int fontAlpha = alpha;
|
||||
|
||||
@@ -397,14 +397,18 @@ void ActionStack::repackDamageStacks(){
|
||||
if (action->type == ACTION_DAMAGE){
|
||||
Damage * damage = (Damage *) action;
|
||||
for (int j = 0; j < mCount; j++){
|
||||
Interruptible * action2 = ((Interruptible *)mObjects[j]);
|
||||
if (action->type == ACTION_DAMAGES){
|
||||
DamageStack * ds = (DamageStack *) action2;
|
||||
for (int k = 0; k< ds->mCount; k++){
|
||||
Damage * dsdamage = ((Damage *)ds->mObjects[k]);
|
||||
if (dsdamage==damage) Remove(damage);
|
||||
}
|
||||
}
|
||||
Interruptible * action2 = ((Interruptible *)mObjects[j]);
|
||||
if (action2->type == ACTION_DAMAGES){
|
||||
DamageStack * ds = (DamageStack *) action2;
|
||||
for (int k = 0; k< ds->mCount; k++){
|
||||
Damage * dsdamage = ((Damage *)ds->mObjects[k]);
|
||||
if (dsdamage==damage){
|
||||
//Remove(damage);
|
||||
mObjects[i] = mObjects[mCount-1];
|
||||
mCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,62 +514,62 @@ bool ActionStack::CheckUserInput(u32 key){
|
||||
if (mode == ACTIONSTACK_STANDARD){
|
||||
if (askIfWishesToInterrupt){
|
||||
if (PSP_CTRL_CROSS == key){
|
||||
setIsInterrupting(askIfWishesToInterrupt);
|
||||
return true;
|
||||
setIsInterrupting(askIfWishesToInterrupt);
|
||||
return true;
|
||||
}else if ((PSP_CTRL_CIRCLE == key) || (PSP_CTRL_RTRIGGER == key) ){
|
||||
cancelInterruptOffer();
|
||||
return true;
|
||||
cancelInterruptOffer();
|
||||
return true;
|
||||
}else if ((PSP_CTRL_SQUARE == key)){
|
||||
cancelInterruptOffer(2);
|
||||
return true;
|
||||
cancelInterruptOffer(2);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}else if (game->isInterrupting){
|
||||
if (PSP_CTRL_CROSS == key){
|
||||
endOfInterruption();
|
||||
return true;
|
||||
endOfInterruption();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else if (mode == ACTIONSTACK_TARGET){
|
||||
if (modal){
|
||||
if (PSP_CTRL_UP == key){
|
||||
if( mObjects[mCurr]){
|
||||
int n = getPreviousIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||
if (n != -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_UP))
|
||||
{
|
||||
mCurr = n;
|
||||
mObjects[mCurr]->Entering();
|
||||
if( mObjects[mCurr]){
|
||||
int n = getPreviousIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||
if (n != -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_UP)){
|
||||
mCurr = n;
|
||||
mObjects[mCurr]->Entering();
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack UP TO mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack UP TO mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else if (PSP_CTRL_DOWN == key){
|
||||
if( mObjects[mCurr]){
|
||||
int n = getNextIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||
if (n!= -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_DOWN))
|
||||
{
|
||||
mCurr = n;
|
||||
mObjects[mCurr]->Entering();
|
||||
if( mObjects[mCurr]){
|
||||
int n = getNextIndex(((Interruptible *) mObjects[mCurr]), 0, 0, 1);
|
||||
if (n!= -1 && n != mCurr && mObjects[mCurr]->Leaving(PSP_CTRL_DOWN)){
|
||||
mCurr = n;
|
||||
mObjects[mCurr]->Entering();
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack DOWN TO mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack DOWN TO mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else if (PSP_CTRL_CIRCLE == key){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack CLIKED mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
char buf[4096];
|
||||
sprintf(buf, "Stack CLIKED mCurr = %i\n", mCurr);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
game->stackObjectClicked(((Interruptible *) mObjects[mCurr]));
|
||||
return true;
|
||||
game->stackObjectClicked(((Interruptible *) mObjects[mCurr]));
|
||||
return true;
|
||||
}
|
||||
return true; //Steal the input to other layers if we're visible
|
||||
}
|
||||
if (PSP_CTRL_TRIANGLE == key){
|
||||
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){
|
||||
JQuad * quad = NULL;
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
if (xpos == -1){
|
||||
xpos = 300;
|
||||
if (x > SCREEN_WIDTH / 2)
|
||||
@@ -211,12 +213,12 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
||||
if(ypos == -1)
|
||||
ypos = 20;
|
||||
if (!alternate){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * quad = card->getQuad();
|
||||
quad = card->getQuad();
|
||||
if (quad){
|
||||
quad->SetColor(ARGB(220,255,255,255));
|
||||
renderer->RenderQuad(quad, xpos , ypos , 0.0f,0.9f,0.9f);
|
||||
}else{
|
||||
quad = card->getThumb();
|
||||
alternate = 1;
|
||||
}
|
||||
}
|
||||
@@ -226,6 +228,11 @@ void CardGui::RenderBig(float xpos, float ypos, int alternate){
|
||||
MTGCard * mtgcard = card->model;
|
||||
JLBFont * font = GameApp::CommonRes->GetJLBFont("graphics/magic");
|
||||
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,13 +24,19 @@ void Damage::init(MTGCardInstance * _source, Damageable * _target, int _damage){
|
||||
|
||||
int Damage::resolve(){
|
||||
if (damage <0) damage = 0; //Negative damages cannot happen
|
||||
state = RESOLVED_OK;
|
||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE){
|
||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||
if ((_target)->protectedAgainst(source)) return 0;
|
||||
if ((_target)->protectedAgainst(source)) damage = 0;
|
||||
// Damage for WITHER on creatures
|
||||
|
||||
if (!damage){
|
||||
state = RESOLVED_NOK;
|
||||
return 0;
|
||||
}
|
||||
if (source->has(WITHER)){
|
||||
for (int i = 0; i < damage; i++){
|
||||
_target->counters->addCounter(-1, -1);
|
||||
_target->counters->addCounter(-1, -1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -120,11 +126,13 @@ int DamageStack::CombatDamages(int strike){
|
||||
int DamageStack::resolve(){
|
||||
for (int i = mCount-1; i>= 0; 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--){
|
||||
Damage * damage = (Damage*)mObjects[i];
|
||||
damage->target->afterDamage();
|
||||
if (damage->state == RESOLVED_OK) damage->target->afterDamage();
|
||||
//damage->target->afterDamage();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -133,10 +141,12 @@ void DamageStack::Render(){
|
||||
int currenty = y;
|
||||
for (int i= 0; i < mCount; i++){
|
||||
Damage * damage = (Damage*)mObjects[i];
|
||||
damage->x = x;
|
||||
damage->y = currenty;
|
||||
currenty += damage->mHeight;
|
||||
damage->Render();
|
||||
if (damage->state == NOT_RESOLVED){
|
||||
damage->x = x;
|
||||
damage->y = currenty;
|
||||
currenty += damage->mHeight;
|
||||
damage->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ void OptionItem::Update(float dt){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OptionItem::Entering(){
|
||||
hasFocus = true;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,13 @@ int TestSuiteAI::Act(float dt){
|
||||
timer+= dt;
|
||||
if (timer < suite->timerLimit) return 1;
|
||||
timer = 0;
|
||||
|
||||
string action = suite->getNextAction();
|
||||
g->mLayers->stackLayer()->Dump();
|
||||
OutputDebugString(action.c_str());
|
||||
OutputDebugString("\n");
|
||||
|
||||
|
||||
if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){
|
||||
if(action.compare("no") != 0 && action.compare("yes") != 0){
|
||||
g->mLayers->stackLayer()->cancelInterruptOffer();
|
||||
@@ -56,12 +62,13 @@ int TestSuiteAI::Act(float dt){
|
||||
}
|
||||
}
|
||||
|
||||
if (action == ""){
|
||||
if (action == ""){
|
||||
//end of game
|
||||
suite->assertGame();
|
||||
g->gameOver = g->players[0];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (action.compare("eot")== 0){
|
||||
if (g->getCurrentGamePhase() != MTG_PHASE_CLEANUP) suite->currentAction--;
|
||||
g->userRequestNextGamePhase();
|
||||
@@ -79,14 +86,14 @@ int TestSuiteAI::Act(float dt){
|
||||
}else{
|
||||
int mtgid = atoi(action.c_str());
|
||||
if (mtgid){
|
||||
MTGCardInstance * card = suite->getCardByMTGId(mtgid);
|
||||
if (card) {
|
||||
g->cardClick(card);
|
||||
}else{
|
||||
Interruptible * action = suite->getActionByMTGId(mtgid);
|
||||
if (action){
|
||||
g->stackObjectClicked(action);
|
||||
}
|
||||
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
|
||||
if (toInterrupt){
|
||||
g->stackObjectClicked(toInterrupt);
|
||||
}else{
|
||||
MTGCardInstance * card = suite->getCardByMTGId(mtgid);
|
||||
if (card) {
|
||||
g->cardClick(card);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return 0;
|
||||
@@ -171,8 +178,8 @@ void TestSuiteState::parsePlayerState(int playerId, string s){
|
||||
|
||||
|
||||
string TestSuite::getNextAction(){
|
||||
if (actions.nbitems && currentAction < actions.nbitems){
|
||||
currentAction++;
|
||||
currentAction++;
|
||||
if (actions.nbitems && currentAction <= actions.nbitems){
|
||||
return actions.actions[currentAction-1];
|
||||
}
|
||||
return "";
|
||||
@@ -407,6 +414,7 @@ void TestSuite::load(const char * _filename){
|
||||
if(file){
|
||||
cleanup();
|
||||
while(std::getline(file,s)){
|
||||
if (s[0] == '#') continue;
|
||||
std::transform( s.begin(), s.end(), s.begin(),::tolower );
|
||||
switch(state){
|
||||
case -1:
|
||||
|
||||
Reference in New Issue
Block a user