[ tamius.net | &DnD — Quick guide to magic++ ]

&DnD
Quick guide to magic++

This rule leaflet is designed to serve as a quick guide to alternative magic system for D&D, magic++. This system is meant to replace D&D’s magic system completely.

Spec version: v0.5
Release date: 2017-04-01

Intro

Even though RPGs are usually firmly in the realm of fantasy, we still really like to have plenty of realism in our game. This is why we have decided to completely overhaul / homebrew certain parts of D&D to our liking.

One of the theories about our universe claims that (our universe) is only a simulation. If its a simulation, there’s probably a way to interact with the engine the simulation runs on. And if there’s a way to interact with the simulation, there’s slim chances that some people were gifted with a way to access the simulation console. Such console would work exactly like the terminal on your computer: if you know what to put in, computer will do the stuff you want.

In here, we explain the new rules of how magic works. Don’t worry, it’s simple and easy to remember.

Index

magic++ example

magic++ is a brand new way of making and casting spells in D&D. You need to write a spell from scratch, every time you want to use it. DM then ’interprets’ it and tells you the end result. As an example, this section describes how to cast a fireball spell.

First, we need to import essential stuff:

#include <magic.h>
#include <stdnd.h>

Now, we need to create new object and get a direction in which the player character is pointing. (NOTE: non-magical player actions shouldn’t be expressed in the script, as scripts only handle magic).

Object fireball = new Object();
Object direction = Player.getPointingDirection(Player.RIGHT_HAND);

After that, we use MagicAPI.getObject() to find the first object in the direction we’re pointing at (we assume there’s nothing between the player and the target, as getObject() returns the object closest to the player by default):

Object foe = getObject(direction);

We set location where we want our fireball to land (function getLocation() may sometimes be inaccurate and require player to roll their dice). Note that some spells have a maximum (or minimum) range. If target is out of range, the setTargetAOE() function will throw an exception and the spell will fail. If exception isn’t caught, the player will not be able to perform any magic until the next long rest. Since that’s not optimal, we place the statement within a try/catch block.

In example below, if setTargetAOE() throws an exception, the catch block gets executed. Because we don’t want to allow our spell to continue if setTargetAOE() failed, we use return command to stop the spell entirely.

try{
  fireball.setTargetAOE(foe.getLocation());
}
catch(OutOfRangeException e){
  return;
}

Next, we call on character’s player to roll their D20.

Player.roll(D20);

The roll sets values for the next action. You must take action even if the roll was unsuccessful, since function roll() sets internal variables for the next move.

Now, we have to cast the fireball:

fireball = (Fireball) fireball;

And finally, after the fireball has been cast, we need to determine how much damage have we dealt:

fireball.determineDamage(D6, Player);

DM will automatically process the actions, according to the rolls. You don’t have to bother with whether the roll itself was successful as these things are handled by magic VM.

All put together, our script looks like this:

#include <magic.h>
#include <stdnd.h>


Object fireball = new Object();
Object direction = Player.getPointingDirection(Player.RIGHT_HAND);

Object foe = getObject(direction);
try{
  fireball.setTargetAOE(foe.getLocation());
}
catch(OutOfRangeException e){
  return;
}

Player.roll(D20);
fireball = (Fireball) fireball;
fireball.determineDamage(D6, Player);

By the way, egyptian brackets should be enforced. Always. Class, function, if, case, or a loop, it doesn’t matter. Egyptian brackets are the one true way. If player fails to use egyptian brackets (see example above) and, at any point, puts opening brackets in the new line like so:

if (cond)
{
  code(); // code
}

they should be penalized. If they use anything that’s more retarded than that, such as GNU-style brackets (mind the indentation):

if (cond)
  {
    code(); // code
  }

they should be banned from using magic for the rest of the campaign.