/************************************************************************* * Why I made this: * * Every time I play a MUD, there comes a point where I have too many * spells to cast. It gets annoying to have to cast sanctuary, cast armor, * and so on ad infinitum. So what I usually do is set up a bunch of * aliases. But then it is annoying to have to check if they have worn * off, so you also set up a whole bunch of intricate triggers. And then * of course, some MUD imms think that you are cheating, when all you are * doing is trying to stop from getting annoyed! * * So it dawned on me - why not have a spellup command? Of course, the * MUD I am creating is a ninja MUD based on an anime called Naruto, so * the word "spellup" was inappropriate (we don't have spells - we have * jutsus), so I decided on the name "battle ready jutsus". I have my * healer perform some of these too (at least the ones that can be done * on someone else). * * The beauty of this is that it checks to see if you are already affected. * If you are affected already, it doesn't do anything. If you aren't * affected, then it does the jutsu. This makes it far superior to regular * spellup commands you might find elsewhere. * * It is also very portable. For your MUD, simply change the names of * jutsus (and probably call them "spells" instead of "jutsus" unless you * are also making a ninja MUD) to suit whatever you have. It is so * simple, so obvious, that I just felt that I had to make this, and let * everyone else use it. **************************************************************************/ /*************************************************************************** * * * Battle Ready Jutsus * * * * Lets you spell yourself up, ready for battle. * * Designed for Rom 2.4b, but might work for other packages as well. * * * * Written by Adrian Meredith aka Ichike, * * owner/coder of World of Naruto * * telnet://narutomud.mudmagic.com:9000 * * http://narutomud.mudmagic.com * * First written on 20 April 2008 * * If you have any problems, e-mail me at therealadrian@hotmail.com * * If using this code snippet, please include this header in the file * * * ***************************************************************************/ /* ==== Add to interp.c ====== */ {"battle", do_battle_ready, POS_RESTING, 0, LOG_NORMAL, 1}, /* ==== Add to interp.h ====== */ DECLARE_DO_FUN( do_battle_ready ); /* I know that bit is obvious, but this is such a simple snippet that I * can afford to include obvious stuff too */ /* ===== Add to healer.c ===== */ /* You can actually add this in a lot of places, or make its own .c file, * but since it is doing a similar thing to healer.c, it is easier to just * add it there */ void do_battle_ready (CHAR_DATA * ch, char * argument) { /* You can get rid of the 2 lines below, or replace them with your own * statement. This is just for show, but it is important for my mud */ act ("{WYou make a long and complex series of handseals then yell, 'Special Technique: Battle ready jutsus!'{x", ch, NULL, NULL, TO_CHAR); act ("{W$n makes a long and complex series of handseals then yells, 'Special Technique: Battle ready jutsus!'{x", ch, NULL, NULL, TO_ROOM); char buf[MAX_STRING_LENGTH]; /* A few notes here: * 1) Note that this includes 3 types of spells: spellups e.g. armor / bless, * personal spellups e.g. detect evil, and remove maladictions e.g. * remove curse. Note that they are handled differently: * 2) Spellups have !is_affected and then they do do_cast. They are simple * to add in, and other muds have spellups that do this. * 3) Personal spellups use the buffer first. This is because it can only * be cast on yourself, so you need to parse your name in there. * 4) Remove maladictions actually check to see if you ARE affected first, * and use different spell names. e.g. is_affected (curse) then * do_cast (ch, "remove curse"). It is important to note this. * 5) Note that I am taking away 5 mana for doing it. This is just my * personal preference, as I think that players should have to pay for * the convenience. You can choose to get rid of this, or increase it, as you * see fit. I also have a check to see if they go into -ve mana. * 6) Note that I also have a wait state. 6 per spell then 18 at the end. * This is also my personal preference. Change this per your wishes. * 7) Note the end note that I have included a bonus bit for how to add in * battle-ready jutsus to your healer */ if (!is_affected (ch, skill_lookup ("armor"))) { do_cast (ch, "armor"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("bless"))) { do_cast (ch, "bless"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (is_affected (ch, skill_lookup ("blindness"))) { sprintf (buf, "'cure blindness' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (is_affected (ch, skill_lookup ("plague"))) { sprintf (buf, "'cure disease' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (is_affected (ch, skill_lookup ("poison"))) { sprintf (buf, "'cure poison' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("detect evil"))) { sprintf (buf, "'detect evil' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("detect good"))) { sprintf (buf, "'detect good' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("detect hidden"))) { sprintf (buf, "'detect hidden' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("detect invis"))) { sprintf (buf, "'detect invis' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("detect magic"))) { sprintf (buf, "'detect magic' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("fly"))) { do_cast (ch, "fly"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("frenzy"))) { do_cast (ch, "frenzy"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("haste"))) { do_cast (ch, "haste"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("infravision"))) { sprintf (buf, "'infravision' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("invis"))) { do_cast (ch, "invis"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("mist strength"))) { sprintf (buf, "'mist strength' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("pass door"))) { sprintf (buf, "'pass door' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (is_affected (ch, skill_lookup ("curse"))) { sprintf (buf, "'remove curse' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("sanctuary"))) { do_cast (ch, "sanctuary"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("shield"))) { do_cast (ch, "shield"); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } if (!is_affected (ch, skill_lookup ("stone skin"))) { sprintf (buf, "'stone skin' %s", ch->name); do_cast (ch, buf); if (ch->mana > 5) ch->mana -= 5; else ch->mana = 0; WAIT_STATE (ch, 6); } WAIT_STATE (ch, 18); return; /* That's it! */ /* ============ End of first code snippet ============ */ /* For a bonus extra, I also include this snippet to add to your healer */ /* ==== Add / replace the appropriate section in do_heal in healer.c ===== * Look for a spot that is displaying the price list, and replace it with * something like this (if you like my ideas, that is). Or at least add * in the battle-ready part, if you are just adding that */ if (arg[0] == '\0') { /* display price list */ act ("$N says 'I offer the following medicinal jutsus:'", ch, NULL, mob, TO_CHAR); send_to_char (" battle: battle-ready jutsus \n\r", ch); send_to_char (" - sanc, frenzy, haste, shield, \n\r", ch); send_to_char (" - armor, bless, mist str 350 Ryo\n\r", ch); send_to_char (" sanctuary: sanctifying jutsu 150 Ryo\n\r", ch); send_to_char (" cancel: cancels jutsus 100 Ryo\n\r", ch); send_to_char (" frenzy: frenzying jutsu 75 Ryo\n\r", ch); send_to_char (" haste: hasting jutsu 60 Ryo\n\r", ch); send_to_char (" heal: healing jutsu 50 Ryo\n\r", ch); send_to_char (" uncurse: remove curse 50 Ryo\n\r", ch); send_to_char (" mist: mist strength jutsu 40 Ryo\n\r", ch); send_to_char (" shield: shielding jutsu 35 Ryo\n\r", ch); send_to_char (" armor: armoring jutsu 30 Ryo\n\r", ch); send_to_char (" bless: blessing jutsu 30 Ryo\n\r", ch); send_to_char (" critic: cure critical wounds 25 Ryo\n\r", ch); send_to_char (" poison: cure poison 25 Ryo\n\r", ch); send_to_char (" blind: cure blindness 20 Ryo\n\r", ch); send_to_char (" disease: cure disease 15 Ryo\n\r", ch); send_to_char (" serious: cure serious wounds 15 Ryo\n\r", ch); send_to_char (" light: cure light wounds 10 Ryo\n\r", ch); send_to_char (" chakra: restore chakra 10 Ryo\n\r", ch); send_to_char (" refresh: restore movement 5 Ryo\n\r", ch); send_to_char (" Type heal <type> to be healed.\n\r", ch); return; } /* ===== end of the first do_heal snippet ===== */ /* Now, go down to where all of the str_prefix things are, and find a spot * you like, then add these, if you wish the healer to do spellups: */ else if (!str_prefix (arg, "sanctuary")) { spell = spell_sanctuary; sn = skill_lookup ("sanctuary"); words = "Sanctifying"; cost = 15000; } else if (!str_prefix (arg, "frenzy")) { spell = spell_frenzy; sn = skill_lookup ("frenzy"); words = "Frenzying"; cost = 7500; } else if (!str_prefix (arg, "haste")) { spell = spell_haste; sn = skill_lookup ("haste"); words = "Hasting"; cost = 6000; } else if (!str_prefix (arg, "shield")) { spell = spell_shield; sn = skill_lookup ("shield"); words = "Shielding"; cost = 3500; } else if (!str_prefix (arg, "armor")) { spell = spell_armor; sn = skill_lookup ("armor"); words = "Armoring"; cost = 3000; } else if (!str_prefix (arg, "bless")) { spell = spell_bless; sn = skill_lookup ("bless"); words = "Blessing"; cost = 3000; } /* Note that stock mud calls this "giant strength" */ else if (!str_prefix (arg, "mist") || !str_prefix (arg, "strength")) { spell = spell_mist_strength; sn = skill_lookup ("mist strength"); words = "Mist strength"; cost = 4000; } /* The cancellation one also requires you modify the do_cancellation in magic.c * so that you have an exception for the healer, but that isn't my code... */ else if (!str_prefix (arg, "cancel")) { spell = spell_cancellation; sn = skill_lookup ("cancellation"); words = "Cancellation"; cost = 10000; } else if (!str_prefix (arg, "chakra") || !str_prefix (arg, "energize") || !str_prefix (arg, "mana")) { spell = NULL; sn = -1; words = "Chakra restore"; cost = 1000; } /* Note that we now have 2 "special" abilities, so I made sn = -2 * for the 2nd one so as to distinguish them */ else if (!str_prefix (arg, "battle")) { spell = NULL; sn = -2; words = "Battle Ready"; cost = 35000; } /* === Go to where it does the restore mana trap, and change it/ add in * the battle-ready jutsus as so === */ /* Stock code says if spell = NULL - this won't work if you have 2 NULL spells, * so you need to change it to if sn == -1 or -2 as so */ if (sn == -1) { /* restore mana trap...kinda hackish */ ch->mana += dice (2, 8) + mob->level / 3; ch->mana = UMIN (ch->mana, ch->max_mana); send_to_char ("A warm glow passes through you.\n\r", ch); return; } if (sn == -2) { /* battle - spellup */ spell = spell_sanctuary; sn = skill_lookup ("sanctuary"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_frenzy; sn = skill_lookup ("frenzy"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_haste; sn = skill_lookup ("haste"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_shield; sn = skill_lookup ("shield"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_armor; sn = skill_lookup ("armor"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_bless; sn = skill_lookup ("bless"); spell (sn, mob->level, mob, ch, TARGET_CHAR); spell = spell_mist_strength; sn = skill_lookup ("mist strength"); spell (sn, mob->level, mob, ch, TARGET_CHAR); sn = -2; return; } if ((sn == -1) || (sn == -2)) return; spell (sn, mob->level, mob, ch, TARGET_CHAR); return; /* === end of do_heal code snippets === */ /* For the mega-lazy, I include the help file too - although you will * likely want to change it to suit your mud */ 0 'BATTLE READY JUTSU'~ Syntax: Battle {WSpecial Ninja Technique: Battle Ready Jutsus!{x Prerequisite: You have knowledge of at least one of the battle ready jutsus : You have enough chakra to perform the battle ready jutsus + 5 chakra per jutsu that you can perform : You are not already affected by the said jutsu Note: This does not perform protection evil or protection good Skilled ninjas have learned special techniques to prepare themselves for battle. They memorise some jutsus, and can perform them in a perfect sequence of handseals one after another such that their skills are at their peak when they head into battle. Below is a list of jutsus that will be performed on you with this command, if you have learned them, and if you are not already affected by them: 'armor', 'bless', 'cure blindness', 'cure disease', 'cure poison', 'det evil', 'det good', 'det hidden', 'det invis', 'det magic', 'fly', 'frenzy', 'haste', 'infravision', 'invisibility', 'mist strength', 'pass door', 'remove curse', 'sanctuary', 'shield', 'stone skin' ~