本文整理汇总了C++中DummyCard::clearSubcards方法的典型用法代码示例。如果您正苦于以下问题:C++ DummyCard::clearSubcards方法的具体用法?C++ DummyCard::clearSubcards怎么用?C++ DummyCard::clearSubcards使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DummyCard
的用法示例。
在下文中一共展示了DummyCard::clearSubcards方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDamaged
virtual void onDamaged(ServerPlayer *target, const DamageStruct &damage) const{
Room *room = target->getRoom();
if (!target->askForSkillInvoke(objectName(), QVariant::fromValue(damage))) return;
room->broadcastSkillInvoke(objectName());
QList<int> card_ids = room->getNCards(4);
room->fillAG(card_ids);
QList<int> to_get, to_throw;
while (true) {
int sum = 0;
foreach (int id, to_get)
sum += Sanguosha->getCard(id)->getNumber();
foreach (int id, card_ids) {
if (sum + Sanguosha->getCard(id)->getNumber() >= 13) {
room->takeAG(NULL, id, false);
card_ids.removeOne(id);
to_throw << id;
}
}
if (card_ids.isEmpty()) break;
int card_id = room->askForAG(target, card_ids, card_ids.length() < 4, objectName());
if (card_id == -1) break;
card_ids.removeOne(card_id);
to_get << card_id;
room->takeAG(target, card_id, false);
if (card_ids.isEmpty()) break;
}
DummyCard *dummy = new DummyCard;
if (!to_get.isEmpty()) {
dummy->addSubcards(to_get);
target->obtainCard(dummy);
}
dummy->clearSubcards();
if (!to_throw.isEmpty() || !card_ids.isEmpty()) {
dummy->addSubcards(to_throw + card_ids);
CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, target->objectName(), objectName(), QString());
room->throwCard(dummy, reason, NULL);
}
delete dummy;
room->clearAG();
}