several changes here,

first, i added a timer to hide the big card after 5 secs or until a movement is registered. 

2nd, removed the advancing of phases with flick up.

3rd added a flick left to "show/hide hand"

4th, fixed an error in the logic of "getDifficulty" part of the reason optimizedhand was not working.

finally, unrefactored the checks of optimized hand, it was FAR to difficult to see what was actually happening the way it was coded.

optimizedhand is finally working again, 
toggledifficulty and optimizedhand will again trigger and greatly improve ai vs player matches
This commit is contained in:
omegablast2002@yahoo.com
2013-02-21 00:48:39 +00:00
parent 2330e6a613
commit 9a52ae28a2
7 changed files with 78 additions and 31 deletions

View File

@@ -76,6 +76,7 @@ protected:
stack<SelectorMemory> memoryStack;
PlayGuiObject* fetchMemory(SelectorMemory&);
float timer;
public:
CardSelector(GameObserver *observer, DuelLayers*);

View File

@@ -2448,7 +2448,7 @@ int AIPlayerBaka::Act(float dt)
oldGamePhase = currentGamePhase;
if (mFastTimerMode)
timer -= 1;
timer -= dt*3;
else
timer -= dt;
if (timer > 0)

View File

@@ -176,7 +176,7 @@ bool CardSelector::CheckUserInput(JButton key)
return true;
}
Target* oldactive = active;
timer = 250;
int x,y;
JGE* jge = observer->getInput();
if(!jge) return false;
@@ -304,6 +304,10 @@ switch_active:
if (active)
active->Entering();
}
else
{
timer = 250;
}
return true;
}
@@ -319,6 +323,13 @@ void CardSelector::Update(float dt)
position = CardGui::BigWidth / 2;
bigpos.x = position;
bigpos.Update(dt);
//what i really wanted for this was when you remove your finger from the screen or the pointer of your mouse from the screen area
//i wanted it to reduce the show timer to 0, which keeps the big image from displaying.
//couldn't find a method to check if the finger was still touching the screen that wouldn't break mouse support.
//so instead regitering movement resets the timer, which is set to display for about 5 secs;
//if it gets too annoying we can increase or remove this.
if(timer > 0)
timer -= 1;
}
void CardSelector::Render()
@@ -326,9 +337,10 @@ void CardSelector::Render()
if (active)
{
active->Render();
if (CardView* card = dynamic_cast<CardView*>(active))
if (CardView* card = dynamic_cast<CardView*>(active) )
{
card->DrawCard(bigpos, mDrawMode);
if(timer > 0)
card->DrawCard(bigpos, mDrawMode);
}
}
}

View File

@@ -229,6 +229,14 @@ int DeckManager::getDifficultyRating(Player *statsPlayer, Player *player)
if(player->deckFile != "")
{
DeckMetaData *meta = getDeckMetaDataByFilename(player->deckFile, (player->isAI() == 1) );
if (meta)
{
int diff = meta->getVictoryPercentage();
meta->mPlayerDeck = statsPlayer->GetCurrentDeckStatsFile();
meta->mStatsFilename = player->deckFileSmall;
meta->LoadStats();
}
return meta->getDifficulty();
}
else

View File

@@ -971,8 +971,19 @@ void GameStateDuel::OnScroll(int inXVelocity, int inYVelocity)
// ignore magnitude for now, since no action requires scrolling
if (abs(inYVelocity) > 300)
{
bool flickUpwards = (inYVelocity < 0);
mEngine->HoldKey_NoRepeat(flickUpwards ? JGE_BTN_PREV : JGE_BTN_SEC);
/*bool flickUpwards = (inYVelocity < 0);*/
mEngine->HoldKey_NoRepeat(/*flickUpwards ? JGE_BTN_PREV : */JGE_BTN_SEC);
//removing the activation of "left trigger" or "advance phase" because on high end tablets this gesture
//is picked up by simply looking at the cards in your hand if the resolution of tablet exceed 1800 X ANY.
}
if (abs(inXVelocity) > 300)
{
bool flickLeft = (inYVelocity > 0);
if(flickLeft)
{
JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_PREV : JGE_BTN_NEXT);
mEngine->HoldKey_NoRepeat(trigger);
}
}
}

View File

@@ -156,17 +156,21 @@ void Rules::addExtraRules(GameObserver* g)
int difficultyRating = 0;
int Optimizedhandcheat = options[Options::OPTIMIZE_HAND].number;
MTGAbility * a = af.parseMagicLine(initState.playerData[i].extraRules[j], id++, NULL, &(g->ExtraRules[i]));
if (p->playMode != Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
!= GAME_TYPE_STORY &&
g->mRules->gamemode != GAME_TYPE_DEMO && (!g->players[0]->playMode == PLAYER_TYPE_CPU && !g->players[1]->playMode == PLAYER_TYPE_CPU)
#ifdef NETWORK_SUPPORT
&& !(g->players[1]->playMode == Player::MODE_HUMAN)
#endif //NETWORK_SUPPORT
)//keep this out of momir and other game modes.
{
if (p->isAI() && (p->playMode == Player::MODE_AI && p->opponent()->playMode== Player::MODE_AI))
difficultyRating = 0;
else if (g->players[1]->playMode == Player::MODE_HUMAN)
difficultyRating = 0;
else if (p->playMode == Player::MODE_TEST_SUITE)
difficultyRating = 0;
else if (g->mRules->gamemode == GAME_TYPE_MOMIR)
difficultyRating = 0;
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
difficultyRating = 0;
else if (g->mRules->gamemode == GAME_TYPE_STORY)
difficultyRating = 0;
else if (a->aType == MTGAbility::STANDARD_DRAW)
difficultyRating = g->getDeckManager()->getDifficultyRating(g->players[0], g->players[1]);
}
if (a)
{
@@ -174,13 +178,23 @@ void Rules::addExtraRules(GameObserver* g)
a->canBeInterrupted = false;
if (a->oneShot)
{
if (((p->isAI() && p->playMode
!= Player::MODE_AI && p->opponent()->playMode
!= Player::MODE_AI)||( !p->isAI() && Optimizedhandcheat)) && a->aType == MTGAbility::STANDARD_DRAW &&
difficultyRating != HARD && p->playMode
!= Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
!= GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes.
if (p->isAI() && (p->playMode == Player::MODE_AI && p->opponent()->playMode== Player::MODE_AI))
a->resolve();
else if (a->aType == MTGAbility::STANDARD_DRAW && difficultyRating == HARD)
a->resolve();
else if (a->aType != MTGAbility::STANDARD_DRAW)
a->resolve();
else if (!p->isAI() && !Optimizedhandcheat)
a->resolve();
else if (p->playMode == Player::MODE_TEST_SUITE)
a->resolve();
else if (g->mRules->gamemode == GAME_TYPE_MOMIR)
a->resolve();
else if(g->mRules->gamemode == GAME_TYPE_RANDOM1 || g->mRules->gamemode == GAME_TYPE_RANDOM2)
a->resolve();
else if (g->mRules->gamemode == GAME_TYPE_STORY)
a->resolve();
else//stupid protections to keep this out of mimor and other game modes.
{
handsize = ((AADrawer *)a)->getNumCards();
if(difficultyRating == EASY)
@@ -198,11 +212,7 @@ void Rules::addExtraRules(GameObserver* g)
hand->OptimizedHand(p,handsize, 3, 1, 3);//no rating fall out case.
}
}
else
{//resolve normally if the deck is listed as hard.
a->resolve();
}
delete (a);
SAFE_DELETE(a);
}
else
{

View File

@@ -1166,7 +1166,11 @@ cacheItem* WCache<cacheItem, cacheActual>::Get(int id, const string& filename, i
Cleanup();
// check if we're doing a card lookup
if (submode & TEXTURE_SUB_CARD)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* commented out for the following reason:
cardgui updates so quick that the only reason a person would notice a cache miss is because it takes the
engine longer to switch the card quad from kGeneric to the actual image, than it does to just let the update pass.
if (submode & TEXTURE_SUB_CARD)
{
// processing a cache miss, return a generic card & queue up an async read
@@ -1178,8 +1182,9 @@ cacheItem* WCache<cacheItem, cacheActual>::Get(int id, const string& filename, i
CacheEngine::Instance()->QueueRequest(filename, submode, lookup);
return it->second;
}
}
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Space in cache, make new texture
return LoadIntoCache(lookup, filename, submode, style);
}