Erwan
-fix issue mentioned at http://wololo.net/forum/viewtopic.php?f=4&t=371&p=6296#p6296 . I touched a very sensitive area of the code so please let me know if something goes wrong with this revision with spells or abilities that involve targets and/or sacrifice
This commit is contained in:
19
projects/mtg/bin/Res/test/manual/knight_reliquary.txt
Normal file
19
projects/mtg/bin/Res/test/manual/knight_reliquary.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
#Bug:Knight of the reliquary
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:knight of the reliquary,plains
|
||||
library:swamp
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
human
|
||||
human
|
||||
[ASSERT]
|
||||
COMBATEND
|
||||
[PLAYER1]
|
||||
inplay:Wildslayer Elves,Armadillo Cloak
|
||||
life:25
|
||||
[PLAYER2]
|
||||
graveyard:grizzly bears
|
||||
life:17
|
||||
[END]
|
||||
@@ -116,7 +116,6 @@ class TargetAbility:public ActivatedAbility{
|
||||
MTGAbility * ability;
|
||||
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||
virtual void Update(float dt);
|
||||
virtual int reactToClick(MTGCardInstance * card);
|
||||
virtual int reactToTargetClick(Targetable * object);
|
||||
virtual TargetAbility* clone() const = 0;
|
||||
|
||||
@@ -146,7 +146,7 @@ TargetChooser * ActionLayer::getCurrentTargetChooser(){
|
||||
int ActionLayer::cancelCurrentAction(){
|
||||
ActionElement * ae = isWaitingForAnswer();
|
||||
if (!ae) return 0;
|
||||
ae->waitingForAnswer = 0; //TODO MOVE THIS IS ActionElement
|
||||
ae->waitingForAnswer = 0; //TODO MOVE THIS IN ActionElement
|
||||
setCurrentWaitingAction(NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ void DuelLayers::CheckUserInput(int isAI){
|
||||
if ((!isAI) && (0 != key))
|
||||
{
|
||||
if (stack->CheckUserInput(key)) break;
|
||||
if (combat->CheckUserInput(key)) break;
|
||||
if (combat->CheckUserInput(key)) break;
|
||||
if (avatars->CheckUserInput(key)) break; //avatars need to check their input before action (CTRL_CROSS)
|
||||
if (action->CheckUserInput(key)) break;
|
||||
if (avatars->CheckUserInput(key)) break;
|
||||
if (hand->CheckUserInput(key)) break;
|
||||
if (cs->CheckUserInput(key)) break;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ void SacrificeCost::Render(){
|
||||
//TODO : real stuff
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
char buffer[200];
|
||||
sprintf(buffer, _("sacrifice").c_str());
|
||||
mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT);
|
||||
|
||||
@@ -285,9 +285,9 @@ void GameObserver::stateEffects()
|
||||
card->afterDamage();
|
||||
|
||||
//Remove auras that don't have a valid target anymore
|
||||
if (card->target && !isInPlay(card->target)){
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
if (card->target && !isInPlay(card->target)){
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i =0; i < 2; i++)
|
||||
|
||||
@@ -1817,18 +1817,6 @@ TargetAbility::TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost, in
|
||||
ability = NULL;
|
||||
}
|
||||
|
||||
void TargetAbility::Update(float dt){
|
||||
JGE * mEngine = JGE::GetInstance();
|
||||
if (waitingForAnswer){
|
||||
if(mEngine->GetButtonClick(PSP_CTRL_CROSS)){
|
||||
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
|
||||
waitingForAnswer = 0;
|
||||
}else if(tc->targetsReadyCheck() == TARGET_OK_FULL){
|
||||
//waitingForAnswer = 0;
|
||||
//ActivatedAbility::reactToClick(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TargetAbility::reactToTargetClick(Targetable * object){
|
||||
if (object->typeAsTarget() == TARGET_CARD) return reactToClick((MTGCardInstance *)object);
|
||||
@@ -1859,7 +1847,6 @@ int TargetAbility::reactToClick(MTGCardInstance * card){
|
||||
return ActivatedAbility::reactToClick(source);
|
||||
}else{
|
||||
if (tc->toggleTarget(card) == TARGET_OK_FULL){
|
||||
|
||||
int result = ActivatedAbility::reactToClick(source);
|
||||
if (result) {
|
||||
waitingForAnswer = 0;
|
||||
|
||||
Reference in New Issue
Block a user