Rules ----- _General_ Spells has the power to disrupt the game balance and must therefore be approved. All spells must check the following, and if true, they are not to work at all: + Is the player currently a ghost, i.e. dead? + Is the player currently busy? + Does the player have the required SP? + Does the environment have the property "no_magic"? _Teleportation_ One of the most desired spells in the game seems to be a teleport spell, at least judging from how many such have been coded. A teleport spell must cost 30 SP or more to use. Before teleporting, check the following properties: + "no_teleport" + "no_teleport_in" + "no_teleport_out" Old code use a mechanism where a function realm() returns a string. You must check this, too. If realm() returns "NT", or if the start location and the destination has different realms, the transport must not take place. If either location does not have a realm, no transport can take place.Spells that does not follow this might get approved in exceedingly rare cases. _Attack_spells_ Attack spells must check for the property "no_fight" in the environment; if this property exists the spell must not function. _Healing_spells_ Healing spells must cost at least 1 SP per HP healed, but preferably more. The spells are easy to carry around the game; consider them portable. Some spells convert the players HP into SP. If so 1 HP should give less than 1 SP. _Code_pieces_ Here are pieces of code that show checks for various things, as it has been found that wizards have a hard time writing such checks + ghost : The player must not be able to use any abilites when ghost. if(this_player()->query_ghost()) return 0; + no_magic : If the room is no_magic, then the player must fail in casting the spell. Note the check for the realm "no_magic", too. if (environment(this_player()) -> query_property("no_magic") || environment(this_player()) -> realm() == "no_magic") { write("You cannot cast a spell here.\n"); return 1; } + busy : Busy is a thing that will keep players from casting two spells at one time. if (this_player() -> check_busy(2)) { write("You cannot do two things at one time.\n"); return 1; } The function 'check_busy()' returns 1 if the player is busy and 0 if not. The argument is the number of heart beats the player will be busy by this action, if he wasn't busy before. + spell points : If the player hasn't got enough SP, he shouldnt be able to cast the spell. Do not forget to draw the SP from the player when he casts the spell. consume_sp(arg) { if (this_player() -> query_spell_points()add_sp(-arg); return 1; } /* consume_sp */ + no_fight : In places like churches, no aggressive actions are allowed, and therefore no attack spells. if (environment(this_player()) -> query_property("no_fight")) { write("Such actions are forbidden here.\n"); return 1; } + no_teleport : Teleportation is not allowed between every two locations. The following checks take care of it all. Sorry for the mess. :) here = environment(this_player()); there = destination; if ( here -> realm() != there -> realm() || here -> realm() == "NT" || there -> realm()=="NT" || here -> query_property("no_teleport_out") || there -> query_property("no_teleport_in")) { write("The spell fails.\n"); return 1; } - EOT -
Help topics available:
README | area.r | armour.r | behave.r | clubs.r |
container.r | debug.r | general.r | guilds.r | heal.r |
monster.r | paragon.r | pub.r | puzzles.r | quests.r |
room.r | shop.r | spells.r | testplaying.r | weapon.r |
word_list |
You are guest number 167 since November 2019.
This file was last modified: June 2000.