本文整理汇总了C++中Slash::isAvailable方法的典型用法代码示例。如果您正苦于以下问题:C++ Slash::isAvailable方法的具体用法?C++ Slash::isAvailable怎么用?C++ Slash::isAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slash
的用法示例。
在下文中一共展示了Slash::isAvailable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
const Card *WuxinCard::validate(CardUseStruct &cardUse) const{
QList<int> skysoldier = cardUse.from->getPile("skysoldier");
QList<int> black_skysoldier, disabled_skysoldier;
foreach(int id, skysoldier){
if (Sanguosha->getCard(id)->isBlack()){
Slash *theslash = new Slash(Card::SuitToBeDecided, -1);
theslash->setSkillName("wuxin");
theslash->addSubcard(id);
theslash->deleteLater();
bool can_slash = theslash->isAvailable(cardUse.from) &&
theslash->targetsFeasible(ServerPlayerList2PlayerList(cardUse.to), cardUse.from);
if (can_slash)
black_skysoldier << id;
else
disabled_skysoldier << id;
}
else
disabled_skysoldier << id;
}
if (black_skysoldier.isEmpty())
return NULL;
Room *room = cardUse.from->getRoom();
room->fillAG(skysoldier, cardUse.from, disabled_skysoldier);
int slash_id = room->askForAG(cardUse.from, black_skysoldier, false, "wuxin");
room->clearAG(cardUse.from);
Slash *slash = new Slash(Card::SuitToBeDecided, -1);
slash->addSubcard(slash_id);
slash->setSkillName("wuxin");
return slash;
}
示例2: targetsFeasible
bool WuxinCard::targetsFeasible(const QList<const Player *> &targets, const Player *Self) const{
foreach(int id, Self->getPile("skysoldier")){
if (Sanguosha->getCard(id)->isBlack()){
Slash *theslash = new Slash(Card::SuitToBeDecided, -1);
theslash->setSkillName("wuxin");
theslash->addSubcard(id);
theslash->deleteLater();
bool can_slash = theslash->isAvailable(Self) && theslash->targetsFeasible(targets, Self);
if (can_slash)
return true;
}
}
return false;
}