Erwan
- new Ability : ALifeGiver (bottle gnomes) - Added a few cards from Tempest - Hybrid mana fix for hybrid mana involving uncolored mana costs (see tests/generic/hybridmana2.txt - spectral possession) - Fixed bugs with targetting for TargetAbilities - Fixed multiple sacrifice abilities cost (Siege gang commander, see tests) - Fixed a small font issue
This commit is contained in:
@@ -126,10 +126,7 @@ int ActionLayer::reactToTargetClick(Targetable * card){
|
||||
int ActionLayer::isReactingToClick(MTGCardInstance * card){
|
||||
int result = 0;
|
||||
|
||||
for (int i=0;i<mCount;i++){
|
||||
ActionElement * currentAction = (ActionElement *)mObjects[i];
|
||||
if(currentAction->waitingForAnswer) return -1;
|
||||
}
|
||||
if (isWaitingForAnswer()) return -1;
|
||||
|
||||
|
||||
for (int i=0;i<mCount;i++){
|
||||
|
||||
@@ -43,6 +43,8 @@ int SacrificeCost::isPaymentSet(){
|
||||
int SacrificeCost::doPay(){
|
||||
if(target){
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
target = NULL;
|
||||
if (tc) tc->initTargets();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -272,11 +272,9 @@ void GameObserver::stackObjectClicked(Interruptible * action){
|
||||
}
|
||||
|
||||
void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){
|
||||
LOG("==GameObserver::cardClick");
|
||||
if (card) {LOG(card->getName())};
|
||||
Player * clickedPlayer = NULL;
|
||||
if (!card) clickedPlayer = ((Player *)object);
|
||||
if (targetChooser != NULL){
|
||||
if (targetChooser){
|
||||
int result;
|
||||
if (card) {
|
||||
if (card == cardWaitingForTargets){
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../include/GameOptions.h"
|
||||
#include "../include/GameApp.h"
|
||||
|
||||
static const char* GAME_VERSION = "WTH?! 0.4.0 - by WilLoW";
|
||||
static const char* GAME_VERSION = "WTH?! 0.4.1 - by WilLoW";
|
||||
#define ALPHA_WARNING 0
|
||||
|
||||
#define DEFAULT_ANGLE_MULTIPLIER 0.4
|
||||
|
||||
@@ -373,7 +373,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}else{
|
||||
if (dryMode) return BAKA_EFFECT_BAD;
|
||||
if (tc){
|
||||
game->addObserver(NEW ADestroyer(id, card,tc));
|
||||
game->addObserver(NEW ADestroyer(id, card,tc,0,cost));
|
||||
}else{
|
||||
game->mLayers->stackLayer()->addPutInGraveyard(target);
|
||||
}
|
||||
@@ -434,7 +434,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
if (!cost && !doTap){
|
||||
card->controller()->life+=life;
|
||||
}else{
|
||||
//TODO;
|
||||
game->addObserver(NEW ALifeGiver(id, card,cost, life, doTap));
|
||||
}
|
||||
}
|
||||
result++;
|
||||
@@ -1699,7 +1699,10 @@ ActivatedAbility::~ActivatedAbility(){
|
||||
if (cost) delete cost;
|
||||
}
|
||||
|
||||
//
|
||||
//The whole targetAbility mechanism is messed up, mainly because of its interactions with
|
||||
// the ActionLayer, GameObserver, and parent class ActivatedAbility.
|
||||
// Currently choosing a target is a complete different mechanism for put into play and for other abilities.
|
||||
// It probably shouldn't be the case.
|
||||
|
||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost, int _playerturnonly,int tap):ActivatedAbility(id, card,_cost,_playerturnonly, tap){
|
||||
tc = _tc;
|
||||
@@ -1715,8 +1718,8 @@ void TargetAbility::Update(float dt){
|
||||
if(mEngine->GetButtonClick(PSP_CTRL_CROSS)){
|
||||
waitingForAnswer = 0;
|
||||
}else if(tc->targetsReadyCheck() == TARGET_OK_FULL){
|
||||
waitingForAnswer = 0;
|
||||
ActivatedAbility::reactToClick(source);
|
||||
//waitingForAnswer = 0;
|
||||
//ActivatedAbility::reactToClick(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1724,8 +1727,11 @@ void TargetAbility::Update(float dt){
|
||||
int TargetAbility::reactToTargetClick(Targetable * object){
|
||||
if (object->typeAsTarget() == TARGET_CARD) return reactToClick((MTGCardInstance *)object);
|
||||
if (waitingForAnswer){
|
||||
tc->toggleTarget(object);
|
||||
return 1;
|
||||
if (tc->toggleTarget(object) == TARGET_OK_FULL){
|
||||
waitingForAnswer = 0;
|
||||
return ActivatedAbility::reactToClick(source);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1740,12 +1746,17 @@ int TargetAbility::reactToClick(MTGCardInstance * card){
|
||||
}
|
||||
}else{
|
||||
if (card == source){
|
||||
if (tc->targetsReadyCheck() == TARGET_OK){
|
||||
if (tc->targetsReadyCheck() == TARGET_OK || tc->targetsReadyCheck() == TARGET_OK_FULL){
|
||||
waitingForAnswer = 0;
|
||||
return ActivatedAbility::reactToClick(source);
|
||||
}
|
||||
}else{
|
||||
tc->toggleTarget(card);
|
||||
if (tc->toggleTarget(card) == TARGET_OK_FULL){
|
||||
|
||||
int result = ActivatedAbility::reactToClick(source);
|
||||
if (result) waitingForAnswer = 0;
|
||||
return result;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1753,7 +1764,7 @@ int TargetAbility::reactToClick(MTGCardInstance * card){
|
||||
}
|
||||
|
||||
void TargetAbility::Render(){
|
||||
//TODO
|
||||
//TODO ?
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card){
|
||||
LOG("CANPUTINPLAY- correct time to play\n");
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
#ifdef WIN32
|
||||
cost->Dump();
|
||||
#endif
|
||||
if (playerMana->canAfford(cost)){
|
||||
LOG("CANPUTINPLAY- ManaCost ok\n");
|
||||
return 1;
|
||||
|
||||
@@ -70,19 +70,19 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
||||
int intvalue = atoi(value.c_str());
|
||||
int colors[2];
|
||||
int values[2];
|
||||
if (!intvalue && value.size() > 1){
|
||||
if (intvalue < 10 && value.size() > 1){
|
||||
for (int i = 0; i < 2; i++){
|
||||
char c = value[i];
|
||||
if (c >='0' && c <='9'){
|
||||
colors[i] = Constants::MTG_COLOR_ARTIFACT;
|
||||
values[i] = c - '0';
|
||||
colors[i] = Constants::MTG_COLOR_ARTIFACT;
|
||||
values[i] = c - '0';
|
||||
}else{
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
||||
if (c == Constants::MTGColorChars[j]){
|
||||
colors[i] = j;
|
||||
values[i] = 1;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
||||
if (c == Constants::MTGColorChars[j]){
|
||||
colors[i] = j;
|
||||
values[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
manaCost->addHybrid(colors[0], values[0], colors[1], values[1]);
|
||||
@@ -98,6 +98,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
@@ -378,3 +379,25 @@ ManaCost * ManaCost::Diff(ManaCost * _cost){
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
void ManaCost::Dump(){
|
||||
char buf[4096];
|
||||
OutputDebugString("\n===ManaCost===\n");
|
||||
for (int i=0; i<= Constants::MTG_NB_COLORS; i++){
|
||||
if (cost[i]) {
|
||||
sprintf(buf, "%c:%i - ", Constants::MTGColorChars[i],cost[i]);
|
||||
OutputDebugString(buf);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i< nbhybrids; i++){
|
||||
ManaCostHybrid * h = hybrids[i];
|
||||
|
||||
sprintf(buf, "H:{%c:%i}/{%c:%i}", Constants::MTGColorChars[h->color1], h->value1, Constants::MTGColorChars[h->color2], h->value2);
|
||||
OutputDebugString(buf);
|
||||
}
|
||||
OutputDebugString("\n=============\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -189,7 +189,7 @@ OutputDebugString("COLOR FOUND !!!");
|
||||
typeName = typeName.substr(0,found);
|
||||
}
|
||||
//X targets allowed ?
|
||||
if (typeName.at(typeName.length()-1) == 's'){
|
||||
if (typeName.at(typeName.length()-1) == 's' && !Subtypes::subtypesList->find(typeName)){
|
||||
typeName = typeName.substr(0,typeName.length()-1);
|
||||
maxtargets = -1;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ Interruptible * TestSuite::getActionByMTGId(int mtgid){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int TestSuiteAI::Act(float dt){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
g->gameOver = NULL; // Prevent draw rule from losing the game
|
||||
@@ -211,7 +212,7 @@ void TestSuite::initGame(){
|
||||
// or go faster when it comes to the whole test suite.
|
||||
//Warning, putting this value too low (< 0.25) will give unexpected results
|
||||
if (!timerLimit){
|
||||
timerLimit = 0.3;
|
||||
timerLimit = 0.5;
|
||||
}else{
|
||||
timerLimit = 0.1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user