Ivan Andrus avatar Ivan Andrus committed 310e309

Added unlocks slot and advanced achievements

Comments (0)

Files changed (4)

 ;;; Code:
-;; TODO: Make an `unlocks' attribute so that using org-mode will (require 'org-achievements)
 ;; TODO: easy way to show a random unearned achievement, perhaps on an idle timer
 (require 'cl)
         (incf total points)
         (when (achievements-earned-p achievement)
           (incf score points)
+          (when (emacs-achievement-unlocks achievement)
+            (require (emacs-achievement-unlocks achievement) nil t))
           (unless (emacs-achievement-transient achievement)
             (setf (emacs-achievement-predicate achievement) t)))))
     ;; Save the updated list of achievements


+;;; advanced-achievements.el --- More advanced achievements
+;; Copyright (C) 2012  Ivan Andrus
+;; Author: Ivan Andrus <darthandrus@gmail.com>
+;; Keywords: games
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; GNU General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;; Commentary:
+;; These are meant to be slightly more advanced achievements than
+;; basic-achievements.el and is unlocked with one of the achievements
+;; there.  Nevertheless, what counts as "advanced" is quite arbitrary.
+;;; Code:
+;;{{{ Disabled functions
+(defachievement "Inception"
+  "You have used recursive editing and exited succesfully."
+  :command '(recursive-edit exit-recursive-edit))
+(defachievement "Narrow minded"
+  "You have used narrowing."
+  :command '(narrow-to-region narrow-to-page))
+(defachievement "Forbidden Fruits"
+  "You have used all disabled commands."
+  :command (loop for s being the symbols
+                 when (get s 'disabled) collect s))
+(defachievement "Enabler"
+  "You have enabled all commands."
+  :predicate '(= 0 (length (loop for s being the symbols
+                                 when (get s 'disabled) collect s))))
+(defachievement "Case Changer"
+  "You have changed the case of a few words."
+  :command '(upcase-word downcase-word capitalize-word))
+(defachievement "CASE CHANGER"
+  "You have changed the case of vast amounts of text."
+  :command '(upcase-region downcase-region))
+(defachievement "The Great Destroyer"
+  "You have laid waste to an entire buffer in one go."
+  :command 'erase-buffer)
+(defachievement "Goal Setter"
+  "You have set the goal column."
+  :command 'set-goal-column)
+(defachievement "Wide Load"
+  "You have scrolled to see an extra wide buffer."
+  :command 'scroll-left)
+(defachievement "Dired reuse"
+  "You have reused a dired buffer to look at another file/directory."
+  :command 'dired-find-alternate-file)
+(provide 'advanced-achievements)
+;;; advanced-achievements.el ends here


 (defachievement "Unlocker"
   "You have earned over 50 points in Emacs achievements.  Not bad."
-  :predicate '(> achievement-score 50))
+  :predicate '(>= achievement-score 50)
+  :unlocks 'advanced-achievements)
 (defachievement "Over Achiever"
   "You have earned 500 points in Emacs achievements.  Don't you have some real work to do?"
-  :predicate '(> achievement-score 500))
+  :predicate '(>= achievement-score 500))
 (defachievement "Cheater"
   "You have earned all Emacs achievements.  Actually that's impossible."


 eval-last-sexp twice to get hex numbers
 ;;{{{ Modes
   "You have used smerge-mode to resolve conflicts.")
-;;{{{ Forbidden fruits -- disabled functions
-;; (put 'narrow-to-region 'disabled nil)
-(defachievement ""
-  "You have used recursive editing.")
-(defachievement "Narrow minded"
-  "You have used narrowing.")
-;; Find all disabled commands
-(loop for s being the symbols
-      when (get s 'disabled) collect s)
 ;;{{{ Editing
 ;; unicode characters
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.