Skip to content

Instantly share code, notes, and snippets.

@masterzen
Created February 2, 2010 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masterzen/292733 to your computer and use it in GitHub Desktop.
Save masterzen/292733 to your computer and use it in GitHub Desktop.
rule "Captain"
when
// does the achievement has already been granted to player
p : MMPlayerImpl()
a : Achievement() from achievementList.get("CPT")
not ( PlayerAchievement( achievement.id == a.id ) from achievementRepository.getPlayerAchievements( p.getWebsiteID() ) )
// player should be First Lieutenant
PlayerAchievement( achievement.tag == "1LT" ) from achievementRepository.getPlayerAchievements( p.getWebsiteID() )
PlayerAchievement( achievement.tag == "WonOmaha" || achievement.tag == "WonArnhem" ) from achievementRepository.getPlayerAchievements( p.getWebsiteID() )
Number( intValue >= 24 )from accumulate ( $s: ServiceRecord() from playerRepository.getGameHistory( p ), count( $s ) )
Number( intValue >= 8 ) from accumulate ( $s: ServiceRecord( victory == true && side == "AXIS" ) from playerRepository.getGameHistory( p ), count($s) )
Number( intValue >= 8 ) from accumulate ( $s: ServiceRecord( victory == true && side == "ALLIES" ) from playerRepository.getGameHistory( p ), count($s) )
then
achievementRepository.award(p, a, tableID);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment