Mercurial > touhou
view pytouhou/vm/common.py @ 182:20843875ad8f
(Hopefully) use difficulty as it should.
The difficulty[0] (also called rank) varies from 0 to 32 and affects
various parts of the game. The difficulty now impact those parts,
but how it is modified during the gameplay is not clear.
Such changes to the difficulty are not handled yet.
[0] http://en.touhouwiki.net/wiki/Embodiment_of_Scarlet_Devil/Gameplay#Rank
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 25 Oct 2011 01:29:40 +0200 |
parents | a142e57218a0 |
children | 69ec72b990a4 |
line wrap: on
line source
# -*- encoding: utf-8 -*- ## ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> ## ## 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; version 3 only. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## class MetaRegistry(type): def __new__(mcs, name, bases, classdict): instruction_handlers = {} for item in classdict.itervalues(): try: instruction_ids = item._instruction_ids except AttributeError: pass else: for id_ in instruction_ids: instruction_handlers[id_] = item classdict['_handlers'] = instruction_handlers return type.__new__(mcs, name, bases, classdict) def instruction(instruction_id): def _decorator(func): if not hasattr(func, '_instruction_ids'): func._instruction_ids = set() func._instruction_ids.add(instruction_id) return func return _decorator