本文整理汇总了C++中CardStar类的典型用法代码示例。如果您正苦于以下问题:C++ CardStar类的具体用法?C++ CardStar怎么用?C++ CardStar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CardStar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: targetFixed
bool QiceCard::targetFixed() const{
if(ClientInstance->getStatus() == Client::Responsing)
return true;
CardStar card = Self->tag.value("qice").value<CardStar>();
return card && card->targetFixed();
}
示例2: trigger
virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
SlashEffectStruct effect = data.value<SlashEffectStruct>();
Room *room = player->getRoom();
CardStar card = room->askForCard(player, "@axe", "@axe:" + effect.to->objectName(),data, CardDiscarded);
if(card){
QList<int> card_ids = card->getSubcards();
foreach(int card_id, card_ids){
LogMessage log;
log.type = "$DiscardCard";
log.from = player;
log.card_str = QString::number(card_id);
room->sendLog(log);
}
LogMessage log;
log.type = "#AxeSkill";
log.from = player;
log.to << effect.to;
log.arg = objectName();
room->sendLog(log);
room->slashResult(effect, NULL);
}
示例3: trigger
virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
Room *room = player->getRoom();
DamageStruct damage = data.value<DamageStruct>();
room->setPlayerMark(player, "BlackArmor", damage.damage);
if(!player->isWounded() || player->getCards("h").length() < damage.damage)
return false;
CardStar card = room->askForCard(player, "@black_armor", "@black_armor");
if(card){
QList<int> card_ids = card->getSubcards();
foreach(int card_id, card_ids){
LogMessage log;
log.type = "$DiscardCard";
log.from = player;
log.card_str = QString::number(card_id);
room->sendLog(log);
}
LogMessage log;
log.type = "#BlackArmorSkill";
log.from = player;
room->sendLog(log);
RecoverStruct recover;
recover.card = card;
recover.recover = qMin(damage.damage, player->getLostHp());
recover.who = player;
room->recover(player, recover);
room->setPlayerMark(player, "BlackArmor", 0);
return true;
}
示例4: trigger
virtual bool trigger(TriggerEvent triggerEvent, Room* room, ServerPlayer *player, QVariant &data) const{
if(player->getPhase() != Player::NotActive)
return false;
CardStar card = NULL;
if(triggerEvent == CardFinished){
CardUseStruct card_use = data.value<CardUseStruct>();
card = card_use.card;
if(card == player->tag["MoonSpearSlash"].value<CardStar>()){
card = NULL;
}
}else if(triggerEvent == CardResponsed){
card = data.value<ResponsedStruct>().m_card;
player->tag["MoonSpearSlash"] = data;
}
if(card == NULL || !card->isBlack())
return false;
//@todo: askForUseCard combines asking and using the card.
//animating weapon effect should happen in-between.
//we should come back after the askFor methods are restructured.
room->askForUseCard(player, "slash", "@moon-spear-slash");
return false;
}
示例5: trigger
virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
if(player->getPhase() != Player::NotActive)
return false;
CardStar card = NULL;
if(event == CardFinished){
CardUseStruct card_use = data.value<CardUseStruct>();
card = card_use.card;
if(card == player->tag["MoonSpearSlash"].value<CardStar>()){
card = NULL;
}
}else if(event == CardResponsed){
card = data.value<CardStar>();
player->tag["MoonSpearSlash"] = data;
}
if(card == NULL || !card->isBlack())
return false;
Room *room = player->getRoom();
room->askForUseCard(player, "slash", "@moon-spear-slash");
return false;
}
示例6: trigger
virtual bool trigger(TriggerEvent, ServerPlayer *player, QVariant &data) const{
SlashResultStruct result = data.value<SlashResultStruct>();
if(!result.success){
Room *room = player->getRoom();
CardStar card = room->askForCard(player, "@axe-card", "axe-card");
if(card){
QList<int> card_ids = card->getSubcards();
foreach(int card_id, card_ids){
LogMessage log;
log.type = "$DiscardCard";
log.from = player;
log.card_str = QString::number(card_id);
room->sendLog(log);
}
LogMessage log;
log.type = "#AxeSkill";
log.from = player;
log.to << result.to;
room->sendLog(log);
result.success = true;
data = QVariant::fromValue(result);
}
示例7: trigger
virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{
JudgeStar judge = data.value<JudgeStar>();
CardStar card = judge->card;
if(card->isBlack()){
Room *room = player->getRoom();
QList<ServerPlayer *> players = room->getOtherPlayers(player);
foreach(ServerPlayer *p, players){
QVariant who = QVariant::fromValue(p);
if(p->hasLordSkill("songwei") && player->askForSkillInvoke("songwei", who)){
room->playSkillEffect(objectName(), 1);
p->drawCards(1);
}
}
示例8: trigger
virtual bool trigger(TriggerEvent , ServerPlayer *player, QVariant &data) const{
CardStar card = data.value<CardStar>();
if(card->isBlack()){
Room *room = player->getRoom();
if(room->askForSkillInvoke(player, objectName())){
room->playSkillEffect(objectName());
QList<ServerPlayer *> players = room->getOtherPlayers(player);
foreach(ServerPlayer *p, players){
if(p->hasSkill(objectName())){
p->drawCards(1);
break;
}
}
}
示例9:
virtual const Card *viewAs(const QList<CardItem *> &cards) const{
if(cards.length() < Self->getHandcardNum())
return NULL;
if(ClientInstance->getStatus() == Client::Responsing){
QiceCard *card = new QiceCard;
card->setUserString("nullification");
card->addSubcards(cards);
return card;
}
CardStar c = Self->tag.value("qice").value<CardStar>();
if(c){
QiceCard *card = new QiceCard;
card->setUserString(c->objectName());
card->addSubcards(cards);
return card;
}else
return NULL;
}
示例10: onUse
void DaojuCard::onUse(Room *room, const CardUseStruct &card_use) const{
CardStar ju = Sanguosha->getCard(card_use.from->getPile("gui").first());
const Card *first = Sanguosha->getCard(getSubcards().first());
const Card *second = Sanguosha->getCard(getSubcards().last());
Card::Suit suit = Card::NoSuit;
if(first->isBlack() && second->isBlack())
suit = Card::Spade;
else if(first->isRed() && second->isRed())
suit = Card::Heart;
Card *new_card = Sanguosha->cloneCard(ju->objectName(), suit, (first->getNumber() + second->getNumber()) / 2);
new_card->setSkillName("daoju");
new_card->addSubcard(first);
new_card->addSubcard(second);
CardUseStruct use;
use.card = new_card;
use.from = card_use.from;
use.to = card_use.to;
room->useCard(use);
}
示例11: trigger
virtual bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const{
if (player->getPhase() != Player::NotActive)
return false;
CardStar card = NULL;
if (triggerEvent == CardUsed) {
CardUseStruct card_use = data.value<CardUseStruct>();
card = card_use.card;
} else if (triggerEvent == CardResponded) {
card = data.value<CardResponseStruct>().m_card;
}
if (card == NULL || !card->isBlack()
|| (card->getHandlingMethod() != Card::MethodUse && card->getHandlingMethod() != Card::MethodResponse))
return false;
player->setFlags("MoonspearUse");
if (!room->askForUseCard(player, "slash", "@moon-spear-slash", -1, Card::MethodUse, false))
player->setFlags("-MoonspearUse");
return false;
}
示例12: targetsFeasible
bool QiceCard::targetsFeasible(const QList<const Player *> &targets, const Player *Self) const{
CardStar card = Self->tag.value("qice").value<CardStar>();
return card && card->targetsFeasible(targets, Self);
}
示例13: getSuit
bool QiceCard::targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const{
CardStar card = Sanguosha->cloneCard(user_string, getSuit(this->getSubcards()), getNumber(this->getSubcards()));
return card && card->targetFilter(targets, to_select, Self) && !Self->isProhibited(to_select, card);
}
示例14: targetsFeasible
bool DaojuCard::targetsFeasible(const QList<const Player *> &targets, const Player *Self) const{
CardStar card = Sanguosha->getCard(Self->getPile("gui").first());
return card && card->targetsFeasible(targets, Self);
}
示例15: targetFixed
bool DaojuCard::targetFixed() const{
CardStar card = Sanguosha->getCard(Self->getPile("gui").first());
return card && card->targetFixed();
}