Skip to content

Commit

Permalink
partial fix for #3
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioSoler committed Apr 9, 2017
1 parent 2e4aebc commit 90f19e4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions takaraisland.game.php
Original file line number Diff line number Diff line change
Expand Up @@ -1160,10 +1160,10 @@ function stplayermove()
self::incGameStateValue( 'playermoves' , 1 );
$player_id = self::getActivePlayerId();
self::giveExtraTime($player_id);

if ( self::getGameStateValue('playermoves') == 1 )
$gold=self::getGoldBalance($player_id);
if ( self::getGameStateValue('playermoves') == 1 AND $gold > 2 )
{
self::notifyPlayer($player_id, "activatesword", clienttranslate( '${player_name} starts a new turn' ) , array( 'player_name' => self::getActivePlayerName() ) );
self::notifyPlayer($player_id, "activatesword", clienttranslate( '${player_name} can rent now the sword' ) , array( 'player_name' => self::getActivePlayerName() ) );
}

$emptydecks=self::getUniqueValueFromDB("SELECT COUNT(*) FROM (SELECT COUNT(CARD_ID) c FROM cards WHERE card_location like 'deck%' GROUP BY CARD_LOCATION) cardsondecks WHERE c=0");
Expand All @@ -1187,9 +1187,13 @@ function stendturn()
$player_id = self::getActivePlayerId();
self::DbQuery( "UPDATE tokens SET card_location='TH_$player_id' WHERE card_type_arg=$player_id AND card_type in ('1','2','3') and ((card_location like 'explore%') or (card_location in ('diveC','counterC','expertsC','WaitingroomC'))) " );
self::DbQuery( "UPDATE tokens SET card_location='swordholder' WHERE card_type='4'" );
$sql = "SELECT COUNT(*) FROM tokens where card_location in ('workersC','HospitalC') and card_type_arg=$player_id";
$tiles = self::getUniqueValueFromDB( $sql ); // DOES THE PLAYER HAS TILES TO PAY FOR?
if ($tiles == 0 )
$sql = "SELECT COUNT(*) FROM tokens where card_location in ('workersC') and card_type_arg=$player_id";
$tilesb = self::getUniqueValueFromDB( $sql ); // DOES THE PLAYER HAS TILES TO PAY FOR?
$sql = "SELECT COUNT(*) FROM tokens where card_location in ('HospitalC') and card_type_arg=$player_id";
$tilesh = self::getUniqueValueFromDB( $sql ); // DOES THE PLAYER HAS TILES TO PAY FOR?
$tilest=$tilesh+$tilesb;
$gold=self::getGoldBalance($player_id);
if (! ( $tilest > 0 OR ($gold >= 2 AND $tilesh >0 ) OR ($tilesb>0 AND $gold >=5 )) )
{
$this->gamestate->nextState( );
}
Expand Down

0 comments on commit 90f19e4

Please sign in to comment.