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:
@@ -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;
|
MTGAbility * ability;
|
||||||
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
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);
|
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 reactToClick(MTGCardInstance * card);
|
||||||
virtual int reactToTargetClick(Targetable * object);
|
virtual int reactToTargetClick(Targetable * object);
|
||||||
virtual TargetAbility* clone() const = 0;
|
virtual TargetAbility* clone() const = 0;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ TargetChooser * ActionLayer::getCurrentTargetChooser(){
|
|||||||
int ActionLayer::cancelCurrentAction(){
|
int ActionLayer::cancelCurrentAction(){
|
||||||
ActionElement * ae = isWaitingForAnswer();
|
ActionElement * ae = isWaitingForAnswer();
|
||||||
if (!ae) return 0;
|
if (!ae) return 0;
|
||||||
ae->waitingForAnswer = 0; //TODO MOVE THIS IS ActionElement
|
ae->waitingForAnswer = 0; //TODO MOVE THIS IN ActionElement
|
||||||
setCurrentWaitingAction(NULL);
|
setCurrentWaitingAction(NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ void DuelLayers::CheckUserInput(int isAI){
|
|||||||
{
|
{
|
||||||
if (stack->CheckUserInput(key)) break;
|
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 (action->CheckUserInput(key)) break;
|
||||||
if (avatars->CheckUserInput(key)) break;
|
|
||||||
if (hand->CheckUserInput(key)) break;
|
if (hand->CheckUserInput(key)) break;
|
||||||
if (cs->CheckUserInput(key)) break;
|
if (cs->CheckUserInput(key)) break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void SacrificeCost::Render(){
|
|||||||
//TODO : real stuff
|
//TODO : real stuff
|
||||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||||
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
sprintf(buffer, _("sacrifice").c_str());
|
sprintf(buffer, _("sacrifice").c_str());
|
||||||
mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT);
|
mFont->DrawString(buffer, 20 ,20, JGETEXT_LEFT);
|
||||||
|
|||||||
@@ -1817,18 +1817,6 @@ TargetAbility::TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost, in
|
|||||||
ability = NULL;
|
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){
|
int TargetAbility::reactToTargetClick(Targetable * object){
|
||||||
if (object->typeAsTarget() == TARGET_CARD) return reactToClick((MTGCardInstance *)object);
|
if (object->typeAsTarget() == TARGET_CARD) return reactToClick((MTGCardInstance *)object);
|
||||||
@@ -1859,7 +1847,6 @@ int TargetAbility::reactToClick(MTGCardInstance * card){
|
|||||||
return ActivatedAbility::reactToClick(source);
|
return ActivatedAbility::reactToClick(source);
|
||||||
}else{
|
}else{
|
||||||
if (tc->toggleTarget(card) == TARGET_OK_FULL){
|
if (tc->toggleTarget(card) == TARGET_OK_FULL){
|
||||||
|
|
||||||
int result = ActivatedAbility::reactToClick(source);
|
int result = ActivatedAbility::reactToClick(source);
|
||||||
if (result) {
|
if (result) {
|
||||||
waitingForAnswer = 0;
|
waitingForAnswer = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user