home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Special: Spiele Hits
/
Hits-CD.iso
/
aminet
/
spiele
/
ammud1_1.lha
/
AmigaMUD
/
Src
/
Combat
/
fight.m
< prev
next >
Wrap
Text File
|
1997-06-19
|
51KB
|
1,917 lines
/*
* Amiga MUD
*
* Copyright (c) 1997 by Chris Gray
*/
/*
* fight.m - add player stats, fighting, etc. to the starter dungeon.
*/
private tp_fight CreateTable()$
use tp_fight
/*
* NOTE: there is a direct dependency on r_arrivals, to send killed
* players there.
*/
define t_fight STEPS_PER_REGAINED_HIT_POINT 25$
define t_fight BLUTOS_AFTER_DYING 25$
define t_fight RANDOM_MONSTER_LIFE 100$
define t_fight FOREVER_LIFE -1$
define t_fight STANDARD_STRENGTH 5$
define t_fight STANDARD_ACCURACY 5$
define t_fight STANDARD_DAMAGE 5$
define t_fight STANDARD_SPEED 5$
/* first, the new player properties. Note: these are all the effective values,
which may include modifications from armour, weapons, spells, etc. */
define t_fight p_pInited CreateBoolProp()$ /* player has been set up */
define t_fight p_pFightTerse CreateBoolProp()$
define t_fight p_pFightSuperTerse CreateBoolProp()$
define t_fight p_pHitMax CreateIntProp()$ /* max hit points */
define t_fight p_pHitNow CreateIntProp()$ /* current hit points */
define t_fight p_pHitCount CreateIntProp()$ /* part count for healing */
define t_fight p_pExperience CreateIntProp()$ /* experience */
define t_fight p_pLevel CreateIntProp()$ /* current level */
define t_fight p_pStrength CreateIntProp()$ /* strength */
define t_fight p_pSpeed CreateIntProp()$ /* speed/dexterity */
define t_fight p_pProtection CreateIntProp()$ /* current armour class */
define t_fight p_pWeapon CreateThingProp()$ /* current weapon */
define t_fight p_pShield CreateThingProp()$ /* current shield */
define t_fight p_pArmour CreateThingProp()$ /* current armour */
define t_fight p_pCurrentTarget CreateThingProp()$ /* current opponent */
define t_fight p_pDieNotifyList CreateActionListProp()$
define t_fight p_pNewMonster CreateThingProp()$ /* temp during creation */
define t_fight p_pWieldChecker CreateActionProp()$ /* allow player check */
define t_fight p_pTrackerList CreateThingListProp()$ /* list of trackers */
/* monster-only properties */
define t_fight p_mActions CreateStringProp()$ /* single string of actions */
define t_fight p_mActionIndexes CreateIntListProp()$ /* indices of them */
define t_fight p_mMovesUntilVanish CreateIntProp()$ /* when it leaves */
define t_fight p_mSound CreateStringProp()$ /* name of sample */
define t_fight p_mInitAction CreateActionProp()$ /* startup action */
define t_fight p_mMoveAction CreateActionProp()$ /* step action */
define t_fight p_mAfterMoveAction CreateActionProp()$ /* on enter new room */
define t_fight p_mFightAction CreateActionProp()$ /* fight action */
define t_fight p_mSpecialAction CreateActionProp()$ /* action to do */
define t_fight p_mKillAction CreateActionProp()$ /* action on kill */
define t_fight p_mCreateAction CreateActionProp()$ /* something new */
define t_fight p_mArriveAction CreateActionProp()$ /* something comes */
define t_fight p_mArrivedAction CreateActionProp()$ /* check new loc */
define t_fight p_mExpired CreateBoolProp()$ /* it has "died" */
define t_fight p_mBlocker CreateBoolProp()$ /* it can block */
define t_fight p_mHunting CreateBoolProp()$ /* look for target */
define t_fight p_mTrackerPath CreateIntListProp()$ /* path to target */
/* properties for weapons/shield/armour */
define t_fight p_oHitBonus CreateIntProp()$ /* hitpoints bonus */
define t_fight p_oStrBonus CreateIntProp()$ /* strength bonus */
define t_fight p_oSpeedBonus CreateIntProp()$ /* speed bonus */
define t_fight p_oArmourProt CreateIntProp()$ /* armour protection bonus */
define t_fight p_oShieldProt CreateIntProp()$ /* shield protection bonus */
define t_fight p_oAccuracy CreateIntProp()$ /* base accuracy level */
define t_fight p_oDamage CreateIntProp()$ /* base damage level */
define t_fight p_oHealing CreateIntProp()$ /* strength of heal */
define t_fight p_oWieldChecker CreateActionProp()$ /* when wield a weapon */
/* properties on rooms */
define t_fight p_rNoGenerateMonsters CreateBoolProp()$/* no new baddies */
define t_fight p_rMonsterList CreateThingListProp()$ /* what might turn up */
define t_fight p_rMonsterChance CreateIntListProp()$ /* diff per person */
define t_fight p_rMonsterTotal CreateIntProp()$ /* total of the chances */
define t_fight p_rKillAction CreateActionProp()$ /* when monster killed */
/* this is an ancestor of all generic monsters */
define t_fight GenericMonster CreateThing(nil)$
/*
* fighterDesc - return additional description for a fighter.
*/
define tp_fight proc fighterDesc()string:
thing it, weapon, shield, armour;
string name, s, shieldName, armourName;
it := It();
s := "";
name := Capitalize(CharacterNameS(it));
weapon := it@p_pWeapon;
shield := it@p_pShield;
if shield ~= nil then
shieldName := FormatName(shield@p_oName);
fi;
armour := it@p_pArmour;
if armour ~= nil then
armourName := FormatName(armour@p_oName);
fi;
if weapon = nil then
if shield = nil then
if armour ~= nil then
s := name + " is wearing " + armourName;
fi;
else
s := name + AAn(" is using", shieldName);
if armour ~= nil then
s := s + " and wearing " + armourName;
fi;
fi;
else
s := name + AAn(" is wielding", FormatName(weapon@p_oName));
if shield = nil then
if armour ~= nil then
s := s + " and wearing " + armourName;
fi;
else
if armour ~= nil then
s := s + AAn(", using", shieldName);
s := s + " and wearing " + armourName;
else
s := s + AAn(" and using", shieldName);
fi;
fi;
fi;
if s ~= "" then
s := " " + s + ".";
fi;
s
corp;
/*
* AddFighterDesc - add the description about weapons, etc. to the list
* of extra descriptions on the passed character, if it is not
* already there.
*/
define t_fight proc AddFighterDesc(thing theCharacter)void:
list action la;
la := theCharacter@p_pDescMore;
if la = nil then
la := CreateActionList();
theCharacter@p_pDescMore := la;
fi;
if FindElement(la, fighterDesc) = -1 then
AddTail(la, fighterDesc);
fi;
corp;
/*
* useItem - start using the given item.
*/
define tp_fight proc useItem(thing th)void:
thing me;
list action la;
me := Me();
me@p_pHitMax := me@p_pHitMax + th@p_oHitBonus;
me@p_pStrength := me@p_pStrength + th@p_oStrBonus;
me@p_pSpeed := me@p_pSpeed + th@p_oSpeedBonus;
me@p_pProtection := me@p_pProtection + th@p_oArmourProt + th@p_oShieldProt;
AddFighterDesc(me);
corp;
/*
* unUseItem - stop using the given item.
*/
define tp_fight proc unUseItem(thing th, theCharacter)void:
theCharacter@p_pHitMax := theCharacter@p_pHitMax - th@p_oHitBonus;
theCharacter@p_pStrength := theCharacter@p_pStrength - th@p_oStrBonus;
theCharacter@p_pSpeed := theCharacter@p_pSpeed - th@p_oSpeedBonus;
theCharacter@p_pProtection := theCharacter@p_pProtection -
th@p_oArmourProt - th@p_oShieldProt;
corp;
/* the wear/use/wield routines for armour/shields/weapons */
define tp_fight proc armourDrop(thing th)status:
thing theCharacter;
theCharacter := th@p_oCarryer;
if theCharacter ~= nil then
unUseItem(th, theCharacter);
theCharacter -- p_pArmour;
th -- p_oUnGetChecker;
fi;
continue
corp;
define tp_fight proc shieldDrop(thing th)status:
thing theCharacter;
theCharacter := th@p_oCarryer;
if theCharacter ~= nil then
unUseItem(th, theCharacter);
theCharacter -- p_pShield;
th -- p_oUnGetChecker;
fi;
continue
corp;
define tp_fight proc weaponDrop(thing th)status:
thing theCharacter;
theCharacter := th@p_oCarryer;
if theCharacter ~= nil then
unUseItem(th, theCharacter);
theCharacter -- p_pWeapon;
th -- p_oUnGetChecker;
fi;
continue
corp;
define tp_fight proc armourWear()status:
thing th, me, oldArmour;
string aName;
th := It();
me := Me();
if me@p_pWeapon = th then
ignore weaponDrop(th);
fi;
if me@p_pShield = th then
ignore shieldDrop(th);
fi;
oldArmour := me@p_pArmour;
if oldArmour ~= nil then
unUseItem(oldArmour, me);
oldArmour -- p_oUnGetChecker;
fi;
useItem(th);
th@p_oUnGetChecker := armourDrop;
me@p_pArmour := th;
aName := FormatName(th@p_oN