Skip to content

Instantly share code, notes, and snippets.

@ThanawatMas
Last active December 2, 2018 16:41
Show Gist options
  • Save ThanawatMas/18524244a9922b648867d0017cc1a5c0 to your computer and use it in GitHub Desktop.
Save ThanawatMas/18524244a9922b648867d0017cc1a5c0 to your computer and use it in GitHub Desktop.
Lucky logic for RxOperation Merge & Zip
boolean luckyUser =  FortuneQueue.enterNo(API 2) == LuckyCategory.enterNo(API 3) && 
UserProfile.currentCategory(API 1) == LuckyCategory.category(API 3);
if(luckyUser) {
boolean receiveSpecialDiscount =
((FortuneQueue.luckyScale(API 2) * UserProfile.userExp(API 1))/ UserProfile.expToNextLevel(API 1))
> 1;
if(receiveSpecialDiscount) {
discountAmount = totalBuy * LuckyCategory.discountRate(API 3);
payAmount = totalBuy - discountAmount;
System.out.println("ยินดีด้วย คุณได้ส่วนลดพิเศษเพิ่ม " + discountAmount + " บาท
ครั้งนี้คุณจ่ายเพียง " + payAmount + " บาทเท่านั้น");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment