void ServerPlayer::throwAllEquips(){ room->throwCard(getWeapon(), true); room->throwCard(getArmor(), true); room->throwCard(getDefensiveHorse(), true); room->throwCard(getOffensiveHorse(), true); }
int Player::distanceTo(const Player *other) const{ if(this == other) return 0; if(fixed_distance.contains(other)) return fixed_distance.value(other); int right = qAbs(seat - other->seat); int left = aliveCount() - right; int distance = qMin(left, right); // the shorten ways of distance if(getOffensiveHorse()) distance --; if(hasSkill("mashu")) distance --; if(hasSkill("yicong") && getHp() > 2) distance --; // the lengthen ways of distance if(other->getDefensiveHorse()) distance ++; if(other->hasSkill("feiying")) distance ++; if(other->hasSkill("yicong") && other->getHp() <= 2) distance ++; // keep the distance >=1 if(distance < 1) distance = 1; return distance; }
bool Player::isNude() const{ return getHandcardNum() == 0 && getWeapon() == NULL && getArmor() == NULL && getDefensiveHorse() == NULL && getOffensiveHorse() == NULL; }