Skip to content

Commit

Permalink
probably fixed preshow-disabled if skill inherits ViewAsSkill
Browse files Browse the repository at this point in the history
  • Loading branch information
YanGuam committed Feb 2, 2014
1 parent 8356e40 commit 73a2e4e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ui/roomscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,12 @@ void RoomScene::updateStatus(Client::Status oldStatus, Client::Status newStatus)
reason = CardUseStruct::CARD_USE_REASON_RESPONSE;
} else if (newStatus == Client::Playing)
reason = CardUseStruct::CARD_USE_REASON_PLAY;
button->setEnabled(vsSkill->isAvailable(Self, reason, pattern) && !pattern.endsWith("!"));
if (vsSkill->isAvailable(Self, reason, pattern) && !pattern.endsWith("!"))
button->setEnabled(true);
else if(!Sanguosha->getTriggerSkill(vsSkill->objectName()))
button->setEnabled(false);
else if(button->isDown() || button->getState() == QSanButton::S_STATE_UP)
button->setState(QSanButton::S_STATE_DISABLED);
} else {
const Skill *skill = button->getSkill();
if (skill->getFrequency() == Skill::Wake)
Expand Down Expand Up @@ -2339,7 +2344,7 @@ void RoomScene::updateStatus(Client::Status oldStatus, Client::Status newStatus)
const ViewAsSkill *vsSkill = button->getViewAsSkill();
if (vsSkill != NULL && vsSkill->objectName() == skill_name
&& vsSkill->isAvailable(Self, reason, pattern))
button->click();
button->setState(QSanButton::S_STATE_DOWN);
break;
}
}
Expand Down

0 comments on commit 73a2e4e

Please sign in to comment.