- fix issue 151 (I hope)
- small french translation Update
- Nezumi Cutthroat fix
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-03 03:51:05 +00:00
parent 7fd44a077e
commit 1d20f37ded
9 changed files with 33 additions and 24 deletions
+5 -3
View File
@@ -727,6 +727,11 @@ int AIPlayerBaka::computeActions(){
return 1;
};
int AIPlayer::receiveEvent(WEvent * event){
if (getStats()) return getStats()->receiveEvent(event);
return 0;
}
int AIPlayerBaka::Act(float dt){
GameObserver * g = GameObserver::GetInstance();
@@ -736,9 +741,6 @@ int AIPlayerBaka::Act(float dt){
int currentGamePhase = g->getCurrentGamePhase();
if (currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentGamePhase != oldGamePhase){
if (getStats()) getStats()->updateStats();
}
oldGamePhase = currentGamePhase;
timer-= dt;
+16 -16
View File
@@ -3,6 +3,7 @@
#include "../include/GameObserver.h"
#include "../include/Player.h"
#include "../include/MTGCardInstance.h"
#include "../include/WEvent.h"
bool compare_aistats(AIStat * first, AIStat * second){
float damage1 = first->value / first->occurences;
@@ -42,25 +43,24 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
}
}
void AIStats::updateStats(){
GameObserver * game = GameObserver::GetInstance();
ActionStack * as = game->mLayers->stackLayer();
Damage * damage = ((Damage * )as->getNext(NULL,ACTION_DAMAGE, RESOLVED_OK));
MTGGameZone * opponentZone = player->opponent()->game->inPlay;
while(damage){
MTGCardInstance * card = damage->source;
updateStatsCard(card,damage);
int AIStats::receiveEvent(WEvent * event){
WEventDamage * e = dynamic_cast<WEventDamage *>(event);
if (!e) return 0; //we take only Damage events into accountright now
Damage * damage = e->damage;
MTGGameZone * opponentZone = player->opponent()->game->inPlay;
//Auras on damage source can be the cause
for (int i=0; i < opponentZone->nb_cards; i++){
MTGCardInstance * aura = opponentZone->cards[i];
if (aura->target == card){
updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER);
}
MTGCardInstance * card = damage->source;
updateStatsCard(card,damage);
//Auras on damage source can be the cause
for (int i = 0; i < opponentZone->nb_cards; ++i){
MTGCardInstance * aura = opponentZone->cards[i];
if (aura->target == card){
updateStatsCard(aura,damage, STATS_AURA_MULTIPLIER);
}
damage = ((Damage * )as->getNext(damage,ACTION_DAMAGE, RESOLVED_OK));
}
stats.sort(compare_aistats);
stats.sort(compare_aistats); //this could be slow, if it is, let's run it only at the end of the turn
return 1; //is this meant to return 0 or 1?
}
bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue ){
+3
View File
@@ -458,6 +458,9 @@ int GameObserver::receiveEvent(WEvent * e){
while(eventsQueue.size()){
WEvent * ev = eventsQueue.front();
result += mLayers->receiveEvent(ev);
for (int i = 0; i < 2; ++i){
result += players[i]->receiveEvent(ev);
}
SAFE_DELETE(ev);
eventsQueue.pop();
}
+1 -1
View File
@@ -11,7 +11,7 @@
#include "../include/utils.h"
#include "../include/DeckDataWrapper.h"
static const char* GAME_VERSION = "WTH?! 0.9.2 - by wololo";
static const char* GAME_VERSION = "WTH?! 0.9.3 - by wololo";
#define DEFAULT_ANGLE_MULTIPLIER 0.4
#define MAX_ANGLE_MULTIPLIER (3*M_PI)