bool cPlayer::checkSkill( ushort skill, int min, int max, bool advance ) { if ( !isJailed() ) { if ( isDead() ) { if ( socket_ ) socket_->clilocMessage( 0x7A12C ); // You cannot use skills while dead. return false; } bool success = cBaseChar::checkSkill( skill, min, max, advance ); return success; } else { return false; // In jail, there is no skillgain or skillcheck. } }
// returns true if the player gets another go. bool stinkingRich::InputSystem::doMove() { bool retVal = false; auto playerEntity = stinkingRich::StinkingRich::currentPlayer.lock(); auto positionComponent = ashley::ComponentMapper<stinkingRich::Position>::getMapper().get( playerEntity); auto playerComponent = ashley::ComponentMapper<stinkingRich::Player>::getMapper().get( playerEntity); int dieOne = stinkingRich::StinkingRich::getRand(1, 6); int dieTwo = stinkingRich::StinkingRich::getRand(1, 6); die1 = dieOne; die2 = dieTwo; int totalMove = dieOne + dieTwo; if (keyStates[SDL_SCANCODE_1]) { totalMove = 1; } else if (keyStates[SDL_SCANCODE_5]) { totalMove = 5; } std::cout << "Rolled " << dieOne << " and " << dieTwo << ", moving " << totalMove << " spaces.\n"; if (dieOne == dieTwo) { playerComponent->rolledDouble(); int doubles = playerComponent->getDoublesRolled(); std::cout << "Double rolled, total of " << doubles << ".\n"; if (playerComponent->isJailed()) { playerComponent->freeFromJail(); } else { retVal = true; if (doubles == 3) { jailPlayer(); return false; } else { getsAnotherGo = true; } } } else { getsAnotherGo = false; } if (!playerComponent->isJailed()) { auto boardLocationMapper = ashley::ComponentMapper<stinkingRich::BoardLocation>::getMapper(); for (int i = 0; i < totalMove; i++) { auto newLocation = positionComponent->position.lock(); auto newLoc = newLocation->nextLocation.lock(); auto newBoardLoc = boardLocationMapper.get(newLoc); newLocation = nullptr; newLoc = nullptr; positionComponent->position = std::shared_ptr<BoardLocation>(newBoardLoc); stinkingRich::LocationType &type = newBoardLoc->details.type; if (type == stinkingRich::LocationType::GO) { std::cout << "GO: Money changed by " << newBoardLoc->details.value.toString() << ".\n"; playerComponent->addMoney(newBoardLoc->details.value); } if (i == (totalMove - 1)) { playerComponent->handleMoveResult(positionComponent); } newLoc = nullptr; } } std::cout.flush(); if (playerComponent->isJailed()) { retVal = false; } return retVal; }