feat: implement variable token offers and auto-round advancement

- Add variable offer system where P1 can offer any amount of tokens
- Players start with 10 tokens each (P1: pavos, P2: elotes)
- Implement offer/request mechanism with token validation
- Auto-advance rounds after P2 actions or P1 no-offer
- G2: Force offer by default, disable no-offer button when forced
- G3: Wait for shame decision after snatch before advancing
- G4: Implement inverse sanction (P1 gets requested without giving offered)
- Reset rounds to 1 when changing game variants
- Fix OfferControls responsiveness issues
- Hide offer controls after active offer
- Update all G1-G5 components with proper offer flow
This commit is contained in:
2025-08-07 23:53:18 -06:00
parent 426d4b7ab6
commit f89331a3db
19 changed files with 898 additions and 157 deletions

View File

@@ -145,6 +145,55 @@ class ColyseusService {
}
}
// Demo game helpers
setVariant(variant: string): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("setVariant", variant);
}
}
p2Force(force: boolean): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("p2Force", force);
}
}
p1Action(action: 'offer' | 'no_offer' | 'forced_offer'): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("p1Action", action);
}
}
p2Action(action: 'accept' | 'reject' | 'snatch'): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("p2Action", action);
}
}
report(report: boolean): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("report", report);
}
}
assignShame(assign: boolean): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("assignShame", assign);
}
}
proposeOffer(offerPavo: number, offerElote: number, requestPavo: number, requestElote: number): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("proposeOffer", { offerPavo, offerElote, requestPavo, requestElote });
}
}
noOffer(): void {
if (this.gameRoom.value) {
this.gameRoom.value.send("noOffer");
}
}
leaveLobby(): void {
console.log('leaveLobby called');
if (this.lobbyRoom.value) {