home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Special: Spiele Hits
/
Hits-CD.iso
/
aminet
/
spiele
/
ammud1_1.lha
/
AmigaMUD
/
Src
/
Extras
/
spells.m
< prev
Wrap
Text File
|
1997-08-07
|
14KB
|
584 lines
/*
* Amiga MUD
*
* Copyright (c) 1997 by Chris Gray
*/
/*
* spells.m - some handy wizard spells for use with 'cast'.
*/
use t_base
use t_icons
use t_graphics
use t_util
use t_fight
use t_quests
/* Make sure the sourcer of this file has a spell table. */
if LookupTable(PrivateTable(), "t_spells") = nil then
ignore DefineTable(PrivateTable(), "t_spells", CreateTable());
fi$
private tp_spellStuff CreateTable()$
use tp_spellStuff
/* a 'spells' spell which lists the spells we have here */
define t_spells proc spells()void:
Print("Known spells:\n\n");
Print("find <who> - show what <who> sees\n");
Print("poofto <who> - teleport to same location as <who>\n");
Print("look <who> - look at <who>, even if not nearby\n");
Print("sendto <who> <stuff> - send <stuff> to <who> as mindsend\n");
Print("heal <who> - heal <who> upto max hitpoints\n");
Print("enrich <who> <amount> - give <amount> blutos to <who>\n");
Print("force <who> <what> - force <who> to do <what>\n");
Print("teleport <who> {here | <dir> | <roomname>} - teleport <who> ...\n");
Print("showmachines - show machines in entire system\n");
Print("Words in spell table:\n");
ShowTable(t_spells);
corp;
define tp_spellStuff proc findMachine(string w1, w2)thing:
int index;
index := 1;
if w2 ~= "" then
index := StringToInt(w2);
if index < 0 then
Print("Invalid index '" + w2 + "' - 1 assumed.\n");
index := 1;
fi;
fi;
FindMachineIndexed(w1, index)
corp;
/* a 'find' spell which will print the location info for the given character */
define t_spells proc find()void:
string name;
character ch;
thing where, agent;
action a;
bool found;
name := GetWord();
if name = "" then
Print("Find who?\n");
else
found := true;
ch := Character(name);
if ch = nil then
agent := findMachine(name, GetWord());
if agent = nil then
Print("There is no character or machine called '" +
name + "'.\n");
found := false;
else
where := AgentLocation(agent);
fi;
else
where := CharacterLocation(ch);
fi;
if found then
if where = nil then
Print(Capitalize(CharacterNameS(agent)) +
" is not currently anywhere.\n");
else
a := where@p_rNameAction;
if a = nil then
Print(name + " is " + where@p_rName + ".\n");
else
Print(name + ": " + call(a, string)() + ".\n");
fi;
a := where@p_rDescAction;
if a = nil then
if where@p_rDesc ~= "" then
Print(where@p_rDesc + "\n");
fi;
ShowExits(where);
ignore ShowList(where@p_rContents, "Nearby:\n");
else
Print(name + ": " + call(a, string)() + ".\n");
fi;
fi;
fi;
fi;
corp;
/* a 'poofto' spell which will poof to where the given character is */
define t_spells proc poofto()void:
string name;
character ch;
thing who, where;
name := GetWord();
if name = "" then
Print("Poofto who?\n");
else
ch := Character(name);
if ch = nil then
who := findMachine(name, GetWord());
if who = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
fi;
fi;
if who ~= nil then
where := AgentLocation(who);
if where = nil then
Print(Capitalize(CharacterNameS(who)) +
" is not currently active or anywhere.\n");
else
LeaveRoomStuff(where, 0, MOVE_POOF);
EnterRoomStuff(where, 0, MOVE_POOF);
fi;
fi;
fi;
corp;
/* a 'look' spell which will look at a given character */
define t_spells proc look()void:
string name, s;
character ch;
thing who;
action a;
name := GetWord();
if name = "" then
Print("Look who?\n");
else
ch := Character(name);
if ch = nil then
who := findMachine(name, GetWord());
if who = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
fi;
fi;
if who ~= nil then
if LookAtCharacter(who) then
if who@p_pMoney ~= 0 then
Print(Capitalize(CharacterNameS(who)) + " has " +
IntToString(who@p_pMoney) + " blutos.\n");
fi;
ignore ShowQuests(who, true);
fi;
fi;
fi;
corp;
/* a 'sendto' spell which will say something to the given character */
define t_spells proc sendto()void:
string name;
character ch;
thing who;
name := GetWord();
if name = "" then
Print("Sendto who?\n");
else
ch := Character(name);
if ch = nil then
if findMachine(name, GetWord()) = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
else
SPrint(who, Me()@p_pName + " mindsends: " + GetTail());
fi;
fi;
fi;
corp;
/* a 'heal' spell to heal someone up */
define t_spells proc heal()void:
string name;
character ch;
thing who;
int max;
name := GetWord();
if name = "" then
Print("Heal who?\n");
else
ch := Character(name);
if ch = nil then
who := findMachine(name, GetWord());
if who = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
fi;
fi;
if who ~= nil then
max := who@p_pHitMax;
if max = 0 then
Print(name + " has no maximum hitpoints.\n");
elif who@p_pHitNow = max then
Print(name + " needs no healing.\n");
else
who@p_pHitNow := max;
Print(name + " healed.\n");
SPrint(who, "You suddenly feel better!\n");
fi;
fi;
fi;
corp;
/* an 'enrich' spell to give someone some blutos */
define t_spells proc enrich()void:
string name, s;
character ch;
thing who;
int amount;
name := GetWord();
if name = "" then
Print("Enrich who?\n");
else
ch := Character(name);
if ch = nil then
who := findMachine(name, GetWord());
if who = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
fi;
fi;
if who ~= nil then
s := GetWord();
if s = "" then
Print("You must specify an amount to enrich by.\n");
else
amount := StringToInt(s);
if amount <= 0 then
Print("Invalid amount - must be positive integer.\n");
else
who@p_pMoney := who@p_pMoney + amount;
Print(name + " enriched - now has " +
IntToString(who@p_pMoney) + " blutos.\n");
SPrint(who, "You suddenly feel richer!\n");
fi;
fi;
fi;
fi;
corp;
/* a 'force' spell which will make someone do something */
define tp_spellStuff p_pForceAction CreateStringProp()$
define tp_spellStuff proc doForceAction()void:
string s;
s := Me()@p_pForceAction;
if s ~= "" then
Me() -- p_pForceAction;
ignore Parse(G, s);
fi;
corp;
define tp_spellStuff proc forceAnAction()status:
After(0.0, doForceAction);
continue
corp;
define tp_spellStuff proc forceCharacter(thing who; string what)void:
who@p_pForceAction := what;
ignore ForceAction(who, forceAnAction);
corp;
define t_spells proc force()void:
string name, w, what;
character ch;
thing who;
int n;
name := GetWord();
if name = "" then
Print("Force who?\n");
else
w := GetWord();
what := GetTail();
ch := Character(name);
if ch = nil then
n := StringToInt(w);
if n < 0 then
what := w + " " + what;
w := "";
fi;
who := findMachine(name, w);
if who = nil then
Print("There is no character or machine called '" +
name + "'.\n");
fi;
else
what := w + " " + what;
who := CharacterThing(ch);
if who = nil then
Print(name + " has no thing????\n");
fi;
fi;
if who ~= nil then
if what = "" then
Print("You must say what you want " + name + " to do.\n");
else
SPrint(who, "***\n" + Me()@p_pName + " forces you: " +
what +