Skip to content
Snippets Groups Projects
Commit b9601e89 authored by Zening Li's avatar Zening Li
Browse files

V1.2

parent 8f0deb8c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
File added
...@@ -225,6 +225,14 @@ private void starter(Hand pack) { ...@@ -225,6 +225,14 @@ private void starter(Hand pack) {
dealt.setVerso(false); dealt.setVerso(false);
log.writeLog("starter," + canonical(dealt)); log.writeLog("starter," + canonical(dealt));
transfer(dealt, starter); transfer(dealt, starter);
HandCards starterCard = new CribbageHandCards();
modifyStarter(starterCard);
starterCard.setPlayer(1);
starterCard.setScore(scores[1]);
starterCard.sendHandCards(starter, starter, deck);
scores[1] = starterCard.scoreHandCards();
updateScore(1);
} }
int total(Hand hand) { int total(Hand hand) {
...@@ -358,13 +366,15 @@ void modifyShow(HandCards playersHandCards){ ...@@ -358,13 +366,15 @@ void modifyShow(HandCards playersHandCards){
} }
void modifyPlay(HandCards playersHandCards){ void modifyPlay(HandCards playersHandCards){
Rule playsss = new playTotal();
playersHandCards.addRule(new playTotal()); playersHandCards.addRule(new playTotal());
playersHandCards.addRule(new playRuns()); playersHandCards.addRule(new playRuns());
playersHandCards.addRule(new playPairs()); playersHandCards.addRule(new playPairs());
} }
void modifyStarter(HandCards playersHandCards){
playersHandCards.addRule(new starterJack());
}
public Cribbage() public Cribbage()
{ {
super(850, 700, 30); super(850, 700, 30);
......
package cribbage;
import ch.aplu.jcardgame.Card;
import ch.aplu.jcardgame.Deck;
import ch.aplu.jcardgame.Hand;
public class starterJack implements Rule{
Card starter;
public starterJack(){}
@Override
public void receiveHandCards(Hand hand, Hand starter, Deck deck){
this.starter = starter.get(0);
}
@Override
public int calculateScore(int playerId, int currentScore){
int score = 0;
if (((Cribbage.Rank) starter.getRank()).order == 11){
score += 2;
}
return score;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment