I was going to post this in response to a different thread, but since it's involved enough, I guess I might as well make a thread of its own...
If you ever looked at the game Changeling: the Lost, which is a game based around a darker take on old fairy tales and folkloric creatures, and so in order to incorporate a rationale behind why a player would want to behave as a fae creature from fairy tales, what you get are "contracts".
A contract is different from a magic spell that a wizard gets because it's based upon making an actual contract with another being. The contract is powered by its own contract magic, and can benefit both parties, so long as the terms of the contract are fulfilled.
For example, a character with gnome-like characteristics might make a contract to repair another person's tools in such a way that they gain magical competency or make their motorcycle race faster or some such using their gnomish abilities, and ask in exchange for that that a saucer of milk be left out, or some other meaningless token. The simple act of receiving this token gives the player back some of their magical essence they need for using their abilities through fulfilling the contract.
At the same time, these contracts have penalty clauses that place a curse upon anyone who breaks the terms of the contract. This curse is automatic, and part of the binding act of the contract itself, so the effect is instantaneous when a person breaks their word, and doesn't even require the other party's knowledge or awareness of being cheated for the penalty clause to take effect.
For DF, contract magic would fit in fairly well with what we already have for a magic system:
Necromancers are twisted souls that make contracts with fell powers for magic control over life and death. Vampires and werecritters are beings who are cursed by the gods for doing something wrong.
All we need to do is expand the game so that being turned into a weresloth is a curse that befell a would-be contractor of some higher being who reneged on their word. Inversely, necromancers are beings that are keeping up their end of the bargain, but whose powers are one that come at the price where your only friends are zombies or other necromancers.
Likewise, elves live by their strict code of life based upon what their nature spirit asks of them, including not killing other living beings of the forest, but consuming the dead, and not chopping down trees, but using the wood of those trees the nature spirit says are ready to die. Elves live by a very complex contracted existence with their nature spirits.
Contract magic is based around first finding some sort of mystical being, such as a spirit or a fae creature or a shrine to deity with the power to enter into a magic contract. A human village may have a shrine to a sky god, for example, and they will go to the sky god to pray for rain for their crops. That prayer may be part of a ritual for fulfilling a contract with the sky god - they offer prayer and some sort of token sacrifice to the sky god, and the sky god will bring rain at the appointed times, in accordance to the contract.
Contracts, however, are often tricky and personal things. Contracts might just be given out openly, but those are typically given out by beings that seek to profit greatly for their services (such as demons who may ask more than you are willing to pay for the power they give).
These "Open Contracts" may be given out on the likes of slabs, or written in common spell books, and may represent some of the more common rituals or prayers for magical blessing. Alternately, one might have to make a different kind of contract with a mystic being to learn them. Regardless, Open Contracts are contracts where the user is undefined, and anyone who learns how to perform the ritual of the open contract may do so, and there are no strict conditions on how those contracts are used - they are simply power for a price.
An open contract may require something mundane, like a prayer to the god in question and a sacrifice to that god, or may require you to have undergone a more long-term ritual, such as not cutting or washing your hair for at least 6 months or chopping off your pinky finger, and making the knuckle bone into an amulet that you use as the focus for your intonation.
Open contracts are often less powerful and more common magic, as they can be used to traffic with lesser spirit beings that may answer a generic call. A mage may learn an open contract that all the trees of the forest may have to abide by if they learn from a forest spirit. This may be an ancient contract where every individual tree has had to swear to abide by the ancient oaths of the forest spirits, and as such, if you know of, and abide by that contract, you can engage in the terms of that contract with any tree of your choice.
Open contracts may be powered by entirely impersonal sources of magical power, as well. For example, a magma magic contract may simply be with the elemental force of magma itself, which has no particular will, but which does have magical power (at least for this argument). This magical power might be taken into a contractor or directed by a contractor through specific ritual that functionally resembles a contract, but which may just be simple shaping of the raw magical energies.
Such a contract might actually be a means of mantling/emulating the powers or mastery over this magical force that another being, such as a god of earth or fire, might have. By taking on some of the symbolic attributes of those beings with control over the raw magical forces of magma, they gain some of those mystic being's powers to control magma.
Open contracts don't have a penalty clause so long as they don't have continuing obligations attached to them. They may be as simple as a light spell that requires learning a prayer to an ancient spirit of light and a small offering to be given every time. No further commitment is needed from the contractor. Other open contracts, like the ones where you must chop off your own pinky and use the knuckle bone in the spell only function so long as you keep that pinky chopped off and your knuckle bone amulet with you.
"Personal contracts", meanwhile, must be negotiated directly with the spirit being in question. This means that you have to open up a dialogue and personally work on a relationship with the power you seek to gain power from.
Personal contracts can be much more powerful, and possibly much less costly in a personal sense for that power than open contracts. However, they require that a contractor initiate contact with the spirit they are seeking power from, and maintain a good-faith relationship with that spirit.
Most deities, for example, will demand at the least that you become one of their worshipers before they start giving you power. Becoming a contractor of a deity is functionally one and the same as becoming a priest(ess) for that deity. As part of this contract, they'll require an observance of standard behaviors all their priesthood must follow, which may include a code of conduct, regular prayers, and possibly other appropriate actions. Failure to comply can bring down divine punishment that, at the least, means denial of all powers until atonement has taken place.
Gaining powers beyond what you first gain from a deity would require doing further good works to put yourself in their good graces, such as evangelizing, and converting more followers to your religion. Alternately, you could search for wayward followers and rekindle their faith.
The powers you could gain would be in the kind of rituals that bring about miracles. For example, that villager sky god's ritual I mentioned earlier will bring about the rains if there is a priest performing the proper rituals to keep the contract going. This may be something like a harvest god demanding a sacrifice of a portion of the harvest, and a festival where sacramental wine is offered to the deity.
Not just sacrifices may be necessary, for that matter: some traditions hold that sacred animals must be cared for. Inari, a Japanese god of harvest, has foxes under his protection, and as such, the foxes are fed fried tofu as part of the offerings to Inari. Monkeys are allowed to stay in temples in parts of India and eat the offerings there. As part of an old tradition, the Tower of London keeps ravens inside the castle walls whose wings are clipped because legend says that the kingdom will fall if less than six ravens remain at the Tower.
Making a personal contract with other types of spirits, such as fae beings like faeries or dryads or nagas or giant living cliff faces that talk with a voice like a landslide, however, are less of a total dedication of your life, and more of a set of personal favors.
A faerie might teach you some magic or give you a bit of their power on command in exchange for playing along with their humiliating games with a humble spirit and good humor. They might simply give you the knowledge of how to enter into an open contract, such as teaching you one of those ancient tree contracts that would give you powers over a tree if you pay the tree a token. (For example, ability to walk through a tree and into the fae realm if you pay the toll of a bolt of rope reed cloth to it. From there, you might be able to walk out of any other tree from a forest connected to that realm.)
More long-term, however, a contractor might enter into a personal contract where there is an ongoing relationship between the contractor and the contracted spiritual being. This would be the craftsman who gets help from a gnome to create nothing but masterwork crafts in a single night so long as he leaves out a saucer of milk for that gnome every single night. Alternately, an ice spirit may lend a wizard the power to control cold and ice in exchange for being kept as a well-treated familiar or companion spirit (especially if that spirit might not be able to exist in this dimension without a summoning and the contractor's continued help keeping it in this world). Another possibility is that you might have to serve the spirit as a servant to gain your powers from them, or possibly, that the spirit is a demon that will act as a slave for the contractor for as long as the contractor is alive, on the condition that after death, the contractor will forever after be the slave of the demon in the underworld.
Personal contracts are personal in nature, and they should often have a finite expiration date - no more than X number of uses or Y number of days before the contract must be renegotiated. This gives the contracted spirit a chance to walk away from an abusive contractor, or at least demand more for what strain they may be putting on the contracted spirit. This, in turn, makes the player have to care about keeping the spirit they contract with happy. And fae spirits can be very irrational and fickle.
Personal contracts, whether with deities or fae spirits or whatever else, are also very likely to bear a penalty clause: If you act against the terms of the contract or betray the contracted spirit somehow, the agreed upon penalty clause will be enacted, and potentially very severe punishment may be met upon the breaker of the contract.
In many folk tales, part of the contract is that the contractor must always keep the source of their magic a secret from everyone else their entire life. A man who is saved by a fae spirit, for example, after begging for his life might be asked to swear never to reveal that he met that fae spirit, and if he ever did, he would immediately die. Of course, any story where terms like that are mentioned inevitably ends with the man telling someone, and immediately dying just as the contract specified.
In Adventure Mode, the ability to go out and find fae creatures or join a monastic order is pretty straightforward, but Fortress Mode would have complications because you wouldn't be able to go out searching for most of those fae creatures.
Fortress mode play, however, might allow you to start a shrine or church to a deity, and through that, you might have a priest that can gain contracts with their deity so long as you build a proper place of worship first.
These wouldn't be so directly under your control, however, and it would be up to the qualities of the priest in question to keep the deity happy - so if they have a bad personality, it can bring about problems for the fortress. Also, the priest would be required to act in the interests of their deity as much as or even more than the interests of the fort as a whole, and so that priest would start making demands of your fortress that may be hard to keep, and more challenging for the player to satisfy, like making ritual sacrifices of goods, or arranging days off from work to participate in a festival, or constructing monuments or allowing for converts or not using certain materials or making a certain number of items out of clear glass or any number of strange requests in exchange for the power that the deity may bring to the priest and therefore, to you.
In an evil biome, for example, a deity of health might sanctify away some of the blighting syndrome clouds (functionally creating a patch of not-evil-biome) in exchange for major concessions and shows of faith in the form of ritual sacrifices of large amounts of cloth bandages and crutches and a set of festivals that makes dwarves take 10% more of the year off to be "on break" participating in health related festivals where everyone does exercises, and where all the dwarves have to eat at least a certain amount of vegetables and swear off fat or tallow meals.
Just as personal knowledge of a spirit being might lead to learning a new open contract, there might also be a way for open contracts to lead to personal contracts:
That is, spells to summon spirit beings of various types (historically, angels, demons, or nature spirits of all stripes) in order to simply get the chance to make a personal contract with them were summoning spells that this set of rules I am talking about would consider an "open contract".
For example, you might have a ritual to summon a specific named angel or demon or elemental or nature spirit, but they would not behave like a summon spell in D&D does, and instead, you'd have to summon the creature (probably with another spell meant to prevent the demon from running amok) and then try to enter into negotiations for a personal contract, or else have to dismiss the creature, or let it go free.
Other, simpler open contract spells might simply lead you to the nearest spirit being that is already on the current plane, like leading you to the nearest dryad or nymph, since those types of creatures are typically tied to specific magical locations.
One more thing on contract magic:
In general, players should be expected to pay their end of contracts "up front" for most contracts unless there is a
really painful penalty clause.
However, you might also have methods of paying for a spell "in advance", like performing a ritual to a sky god to gain the power to summon a storm, but where the actual storm doesn't happen until you take some final triggering action. That way, you might have a spell that takes sitting at a shrine praying for a while and performing your part of the contract in order to "prepare" the spell that could be activated on the fly later on. (It would obtain some "Vancian Magic" properties in that fashion, as well, now that I think about it.)
Note that I also have another "magic theory" running around called
Xenosynthesis, as part of Improved Farming. These two ideas should be capable of working together, as this is how sentient beings cast magic, and Xenosynthesis relates to how ecosystems react to magical energy sources, and how plants and animals that are magical act and exist. Xenosynthesis would be more fitting for alchemy and, obviously, farming, as it is part of the farming thread.
The difference is that Contract magic assumes that sentient beings are trying to gain magical powers they don't already have from beings that do have them via a form of trade. Xenosynthesis is where creatures just are inherently magical, and you can extract magic from an inherently magical creature through the use of alchemy.
If used together, it should be entirely possible for creatures to gain powers on their own through Xenosynthesis, so long as conditions are met - creatures that want to use magic, and are capable of using that form of magic need to have access to some sort of "power source" in an ecosystem, such as just ambient magical energy (like being in an Evil biome in order to power Evil magic), or by having some sort of magic-producing life forms nearby. For example, only being able to cast magic so long as you continuously eat magic-generating mushrooms to replenish your supply, and even then, only if you are already some sort of creature (whether by being born that way or through a transformation) that is capable of "eating" magic of that particular type.
This would be a "predictable" type of magic to a very limited degree. Good biomes have predictable effects, for example, like bubble grass and fairies, while evil biomes have somewhat predictable effects with skeletal creatures and the like. You can see and predict the amount of "evil magic" in an area. You can even know what will happen when you release more evil magic into an area.
However, it's not really all that controllable. Just like how you can predict what will happen when you leave a forest alone, or you can predict what will happen if you clear-cut a forest and let the soil erode until it becomes like a desert, you can know what the consequences of your actions will be, but you can't really control those consequences very easily.
Hence, farming or breeding or destroying magic-consuming or magic-releasing plants, animals, or even crystal formations or the like can have somewhat predictable results. Shattering the evil-releasing crystal may remove the blight of evil in a biome, for example, but so could slaying all the foul blendecs if they are actually responsible for the spread of the evil biome. Hence, a quest might be to reclaim a portion of forest that has turned evil by slaying all the foul blendecs that make the forest evil. Alternately, breeding tons of fluffy wamblers into the area might consume all the evil and change the area from evil to neutral (or eventually even good).
The two types of magic (contract and xenosynthesis) can also blend if we have the spirits that guide contract magic have agendas for spreading their own spheres and biomes. If a god of death wants to see the evil biomes spread, then its death magic will be at your disposal for as long as you perpetually push the evil biomes forward, corrupting the land for your dark master in exchange for a taste of his power. However, the payment is actually measured - you don't get infinite necromancy for just spreading an evil biome by slaying good creatures or something, you get a specific, set number of spells to cast or a specific, set number of days you can cast that magic for each time you spread the evil magic biome a specific, set number of world tiles. (Of course, the murder god can always set limits to the contract, and change the terms when it comes time to re-negotiate, and skills relating to negotiation may or may not actually be very crucial for a wizard in this system...)
More on xenosynthesis and how it relates to contract magic
starting from these quotes here.
I also have later updated this concept on
how to handle a player that is an inherently magical being (that can cast magic from their own innate magic).